@fluidframework/tree 2.50.0 → 2.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +3 -2
- package/.vscode/Tree.code-workspace +14 -1
- package/.vscode/settings.json +16 -0
- package/CHANGELOG.md +51 -2
- package/api-report/tree.alpha.api.md +7 -7
- package/dist/core/schema-stored/schema.d.ts +14 -1
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.js +3 -0
- package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/dist/feature-libraries/flex-tree/context.d.ts +7 -2
- package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/context.js +4 -4
- package/dist/feature-libraries/flex-tree/context.js.map +1 -1
- package/dist/feature-libraries/flex-tree/index.d.ts +1 -0
- package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/index.js +3 -1
- package/dist/feature-libraries/flex-tree/index.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +5 -5
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.d.ts +3 -1
- package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.js +5 -3
- package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +3 -4
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +2 -2
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +3 -8
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.js +0 -3
- package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +0 -1
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +1 -8
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/index.d.ts +0 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +1 -3
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizeTree.d.ts +1 -1
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +7 -10
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +11 -13
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +60 -83
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeTypes.d.ts +1 -1
- package/dist/shared-tree/sharedTreeChangeTypes.js.map +1 -1
- package/dist/shared-tree/tree.d.ts.map +1 -1
- package/dist/shared-tree/tree.js +4 -3
- package/dist/shared-tree/tree.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +7 -1
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +7 -2
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +4 -1
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/simple-tree/api/conciseTree.d.ts +1 -1
- package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/conciseTree.js.map +1 -1
- package/dist/simple-tree/api/configuration.d.ts +1 -1
- package/dist/simple-tree/api/configuration.d.ts.map +1 -1
- package/dist/simple-tree/api/configuration.js +5 -5
- package/dist/simple-tree/api/configuration.js.map +1 -1
- package/dist/simple-tree/api/create.d.ts +3 -1
- package/dist/simple-tree/api/create.d.ts.map +1 -1
- package/dist/simple-tree/api/create.js +2 -0
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/customTree.d.ts +1 -2
- package/dist/simple-tree/api/customTree.d.ts.map +1 -1
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/getJsonSchema.d.ts +1 -1
- package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/getSimpleSchema.d.ts +1 -1
- package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
- package/dist/simple-tree/api/identifierIndex.d.ts +1 -1
- package/dist/simple-tree/api/identifierIndex.js +2 -2
- package/dist/simple-tree/api/identifierIndex.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +1 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +4 -19
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.js +31 -82
- package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts +14 -2
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js +41 -4
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +36 -3
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +18 -18
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +16 -16
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js +2 -2
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.js +4 -4
- package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +2 -2
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.d.ts +2 -2
- package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +2 -2
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +2 -1
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeBeta.d.ts +4 -1
- package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/treeBeta.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts +1 -2
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +3 -3
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +2 -3
- package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/api/verboseTree.d.ts +2 -1
- package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +2 -2
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/dist/simple-tree/core/allowedTypes.d.ts +316 -0
- package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -0
- package/dist/simple-tree/core/allowedTypes.js +173 -0
- package/dist/simple-tree/core/allowedTypes.js.map +1 -0
- package/dist/simple-tree/core/context.d.ts +3 -9
- package/dist/simple-tree/core/context.d.ts.map +1 -1
- package/dist/simple-tree/core/context.js +3 -11
- package/dist/simple-tree/core/context.js.map +1 -1
- package/dist/simple-tree/core/flexList.d.ts.map +1 -0
- package/dist/simple-tree/core/flexList.js.map +1 -0
- package/dist/simple-tree/core/getOrCreateNode.d.ts +1 -1
- package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
- package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +9 -3
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +19 -3
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts +8 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +24 -20
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +182 -39
- package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js +47 -17
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/{lib/simple-tree → dist/simple-tree/core}/treeNodeValid.d.ts +18 -4
- package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -0
- package/dist/simple-tree/{treeNodeValid.js → core/treeNodeValid.js} +41 -11
- package/dist/simple-tree/core/treeNodeValid.js.map +1 -0
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/core/walkSchema.d.ts +2 -1
- package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/walkSchema.js +6 -2
- package/dist/simple-tree/core/walkSchema.js.map +1 -1
- package/dist/simple-tree/createContext.d.ts +6 -2
- package/dist/simple-tree/createContext.d.ts.map +1 -1
- package/dist/simple-tree/createContext.js +15 -3
- package/dist/simple-tree/createContext.js.map +1 -1
- package/dist/{feature-libraries/modular-schema → simple-tree}/discrepancies.d.ts +22 -29
- package/dist/simple-tree/discrepancies.d.ts.map +1 -0
- package/dist/simple-tree/discrepancies.js +382 -0
- package/dist/simple-tree/discrepancies.js.map +1 -0
- package/dist/simple-tree/fieldSchema.d.ts +423 -0
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -0
- package/dist/simple-tree/{schemaTypes.js → fieldSchema.js} +5 -195
- package/dist/simple-tree/fieldSchema.js.map +1 -0
- package/dist/simple-tree/index.d.ts +7 -6
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +17 -11
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +14 -5
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +117 -2
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +3 -4
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +97 -26
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +2 -2
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/common.d.ts +16 -0
- package/dist/simple-tree/node-kinds/common.d.ts.map +1 -0
- package/dist/simple-tree/node-kinds/common.js +42 -0
- package/dist/simple-tree/node-kinds/common.js.map +1 -0
- package/dist/simple-tree/node-kinds/index.d.ts +1 -1
- package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts +2 -3
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +64 -26
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +2 -2
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/index.d.ts +2 -2
- package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts +19 -5
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js +131 -27
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +11 -4
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.d.ts +2 -2
- package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.js +41 -13
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
- package/dist/simple-tree/prepareForInsertion.d.ts +2 -2
- package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/dist/simple-tree/prepareForInsertion.js +3 -3
- package/dist/simple-tree/prepareForInsertion.js.map +1 -1
- package/dist/simple-tree/simpleSchema.d.ts +2 -2
- package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/simpleSchema.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +6 -7
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +5 -11
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +25 -395
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/dist/simple-tree/unsafeUnknownSchema.d.ts +52 -0
- package/dist/simple-tree/unsafeUnknownSchema.d.ts.map +1 -0
- package/dist/simple-tree/unsafeUnknownSchema.js +13 -0
- package/dist/simple-tree/unsafeUnknownSchema.js.map +1 -0
- package/dist/simple-tree/walkFieldSchema.d.ts +1 -1
- package/dist/simple-tree/walkFieldSchema.js +2 -2
- package/dist/simple-tree/walkFieldSchema.js.map +1 -1
- package/dist/tableSchema.d.ts +12 -12
- package/dist/treeFactory.d.ts +0 -1
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +0 -1
- package/dist/treeFactory.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +14 -1
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.js +3 -0
- package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/lib/feature-libraries/flex-tree/context.d.ts +7 -2
- package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/context.js +4 -4
- package/lib/feature-libraries/flex-tree/context.js.map +1 -1
- package/lib/feature-libraries/flex-tree/index.d.ts +1 -0
- package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/index.js +1 -0
- package/lib/feature-libraries/flex-tree/index.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +6 -6
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.d.ts +3 -1
- package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.js +3 -1
- package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -2
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +2 -2
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +2 -2
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.js +0 -3
- package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +0 -1
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +0 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/index.d.ts +0 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +0 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizeTree.d.ts +1 -1
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +5 -8
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +11 -13
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +61 -83
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeTypes.d.ts +1 -1
- package/lib/shared-tree/sharedTreeChangeTypes.js.map +1 -1
- package/lib/shared-tree/tree.d.ts.map +1 -1
- package/lib/shared-tree/tree.js +4 -3
- package/lib/shared-tree/tree.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +7 -1
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +7 -2
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +5 -2
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/simple-tree/api/conciseTree.d.ts +1 -1
- package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/conciseTree.js.map +1 -1
- package/lib/simple-tree/api/configuration.d.ts +1 -1
- package/lib/simple-tree/api/configuration.d.ts.map +1 -1
- package/lib/simple-tree/api/configuration.js +2 -2
- package/lib/simple-tree/api/configuration.js.map +1 -1
- package/lib/simple-tree/api/create.d.ts +3 -1
- package/lib/simple-tree/api/create.d.ts.map +1 -1
- package/lib/simple-tree/api/create.js +2 -0
- package/lib/simple-tree/api/create.js.map +1 -1
- package/lib/simple-tree/api/customTree.d.ts +1 -2
- package/lib/simple-tree/api/customTree.d.ts.map +1 -1
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/getJsonSchema.d.ts +1 -1
- package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/getSimpleSchema.d.ts +1 -1
- package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
- package/lib/simple-tree/api/identifierIndex.d.ts +1 -1
- package/lib/simple-tree/api/identifierIndex.js +1 -1
- package/lib/simple-tree/api/identifierIndex.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +1 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +4 -19
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.js +25 -76
- package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts +14 -2
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js +40 -4
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +36 -3
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +2 -2
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +16 -16
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.js +1 -1
- package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.d.ts +2 -2
- package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.js +2 -2
- package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +2 -2
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +2 -1
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeBeta.d.ts +4 -1
- package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/treeBeta.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts +1 -2
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +2 -2
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +2 -3
- package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/api/verboseTree.d.ts +2 -1
- package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/lib/simple-tree/core/allowedTypes.d.ts +316 -0
- package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -0
- package/lib/simple-tree/core/allowedTypes.js +162 -0
- package/lib/simple-tree/core/allowedTypes.js.map +1 -0
- package/lib/simple-tree/core/context.d.ts +3 -9
- package/lib/simple-tree/core/context.d.ts.map +1 -1
- package/lib/simple-tree/core/context.js +0 -8
- package/lib/simple-tree/core/context.js.map +1 -1
- package/lib/simple-tree/core/flexList.d.ts.map +1 -0
- package/lib/simple-tree/core/flexList.js.map +1 -0
- package/lib/simple-tree/core/getOrCreateNode.d.ts +1 -1
- package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
- package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +9 -3
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +6 -3
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts +8 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +10 -6
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +182 -39
- package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js +44 -14
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/{dist/simple-tree → lib/simple-tree/core}/treeNodeValid.d.ts +18 -4
- package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -0
- package/lib/simple-tree/{treeNodeValid.js → core/treeNodeValid.js} +31 -3
- package/lib/simple-tree/core/treeNodeValid.js.map +1 -0
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/core/walkSchema.d.ts +2 -1
- package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/walkSchema.js +7 -3
- package/lib/simple-tree/core/walkSchema.js.map +1 -1
- package/lib/simple-tree/createContext.d.ts +6 -2
- package/lib/simple-tree/createContext.d.ts.map +1 -1
- package/lib/simple-tree/createContext.js +13 -2
- package/lib/simple-tree/createContext.js.map +1 -1
- package/lib/{feature-libraries/modular-schema → simple-tree}/discrepancies.d.ts +22 -29
- package/lib/simple-tree/discrepancies.d.ts.map +1 -0
- package/lib/simple-tree/discrepancies.js +376 -0
- package/lib/simple-tree/discrepancies.js.map +1 -0
- package/lib/simple-tree/fieldSchema.d.ts +423 -0
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -0
- package/lib/simple-tree/{schemaTypes.js → fieldSchema.js} +3 -183
- package/lib/simple-tree/fieldSchema.js.map +1 -0
- package/lib/simple-tree/index.d.ts +7 -6
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +4 -3
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +14 -5
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +117 -3
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +3 -4
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +86 -15
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +2 -2
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
- package/lib/simple-tree/node-kinds/common.d.ts +16 -0
- package/lib/simple-tree/node-kinds/common.d.ts.map +1 -0
- package/lib/simple-tree/node-kinds/common.js +38 -0
- package/lib/simple-tree/node-kinds/common.js.map +1 -0
- package/lib/simple-tree/node-kinds/index.d.ts +1 -1
- package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts +2 -3
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +51 -13
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +2 -2
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.js +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/index.d.ts +2 -2
- package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts +19 -5
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js +116 -14
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +11 -4
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.js +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.d.ts +2 -2
- package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.js +40 -12
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.js +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
- package/lib/simple-tree/prepareForInsertion.d.ts +2 -2
- package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/lib/simple-tree/prepareForInsertion.js +2 -2
- package/lib/simple-tree/prepareForInsertion.js.map +1 -1
- package/lib/simple-tree/simpleSchema.d.ts +2 -2
- package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/simpleSchema.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +2 -3
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +5 -11
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +10 -381
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/lib/simple-tree/unsafeUnknownSchema.d.ts +52 -0
- package/lib/simple-tree/unsafeUnknownSchema.d.ts.map +1 -0
- package/lib/simple-tree/unsafeUnknownSchema.js +10 -0
- package/lib/simple-tree/unsafeUnknownSchema.js.map +1 -0
- package/lib/simple-tree/walkFieldSchema.d.ts +1 -1
- package/lib/simple-tree/walkFieldSchema.js +1 -1
- package/lib/simple-tree/walkFieldSchema.js.map +1 -1
- package/lib/tableSchema.d.ts +12 -12
- package/lib/treeFactory.d.ts +0 -1
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +0 -1
- package/lib/treeFactory.js.map +1 -1
- package/package.json +22 -23
- package/src/core/schema-stored/schema.ts +14 -1
- package/src/feature-libraries/default-schema/schemaChecker.ts +3 -0
- package/src/feature-libraries/flex-tree/context.ts +10 -5
- package/src/feature-libraries/flex-tree/index.ts +2 -0
- package/src/feature-libraries/flex-tree/lazyField.ts +10 -6
- package/src/feature-libraries/flex-tree/lazyNode.ts +6 -1
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -2
- package/src/feature-libraries/index.ts +1 -15
- package/src/feature-libraries/modular-schema/comparison.ts +0 -4
- package/src/feature-libraries/modular-schema/index.ts +0 -17
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +0 -2
- package/src/shared-tree/schematizeTree.ts +5 -9
- package/src/shared-tree/schematizingTreeView.ts +75 -113
- package/src/shared-tree/sharedTreeChangeTypes.ts +1 -1
- package/src/shared-tree/tree.ts +4 -3
- package/src/shared-tree/treeAlpha.ts +7 -1
- package/src/shared-tree/treeCheckout.ts +15 -2
- package/src/simple-tree/api/conciseTree.ts +1 -2
- package/src/simple-tree/api/configuration.ts +7 -4
- package/src/simple-tree/api/create.ts +3 -1
- package/src/simple-tree/api/customTree.ts +1 -2
- package/src/simple-tree/api/getJsonSchema.ts +1 -1
- package/src/simple-tree/api/getSimpleSchema.ts +1 -1
- package/src/simple-tree/api/identifierIndex.ts +1 -1
- package/src/simple-tree/api/index.ts +2 -0
- package/src/simple-tree/api/schemaCompatibilityTester.ts +38 -128
- package/src/simple-tree/api/schemaCreationUtilities.ts +50 -5
- package/src/simple-tree/api/schemaFactory.ts +45 -10
- package/src/simple-tree/api/schemaFactoryAlpha.ts +4 -7
- package/src/simple-tree/api/schemaFactoryRecursive.ts +9 -4
- package/src/simple-tree/api/schemaFromSimple.ts +2 -3
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +1 -1
- package/src/simple-tree/api/simpleTreeIndex.ts +8 -3
- package/src/simple-tree/api/storedSchema.ts +1 -2
- package/src/simple-tree/api/tree.ts +2 -2
- package/src/simple-tree/api/treeBeta.ts +4 -1
- package/src/simple-tree/api/treeNodeApi.ts +5 -8
- package/src/simple-tree/api/typesUnsafe.ts +5 -4
- package/src/simple-tree/api/verboseTree.ts +3 -6
- package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +1 -1
- package/src/simple-tree/core/README.md +1 -1
- package/src/simple-tree/core/allowedTypes.ts +496 -0
- package/src/simple-tree/core/context.ts +3 -10
- package/src/simple-tree/core/getOrCreateNode.ts +1 -1
- package/src/simple-tree/core/index.ts +62 -9
- package/src/simple-tree/core/treeNodeKernel.ts +12 -6
- package/src/simple-tree/core/treeNodeSchema.ts +247 -63
- package/src/simple-tree/{treeNodeValid.ts → core/treeNodeValid.ts} +59 -15
- package/src/simple-tree/core/unhydratedFlexTree.ts +1 -1
- package/src/simple-tree/core/walkSchema.ts +9 -5
- package/src/simple-tree/createContext.ts +26 -2
- package/src/simple-tree/discrepancies.ts +648 -0
- package/src/simple-tree/fieldSchema.ts +734 -0
- package/src/simple-tree/index.ts +41 -31
- package/src/simple-tree/leafNodeSchema.ts +137 -5
- package/src/simple-tree/node-kinds/array/arrayNode.ts +141 -30
- package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +5 -7
- package/src/simple-tree/node-kinds/common.ts +60 -0
- package/src/simple-tree/node-kinds/index.ts +2 -0
- package/src/simple-tree/node-kinds/map/mapNode.ts +91 -33
- package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +5 -7
- package/src/simple-tree/node-kinds/object/index.ts +2 -0
- package/src/simple-tree/node-kinds/object/objectNode.ts +205 -25
- package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +22 -5
- package/src/simple-tree/node-kinds/record/recordNode.ts +68 -26
- package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +6 -8
- package/src/simple-tree/prepareForInsertion.ts +7 -6
- package/src/simple-tree/simpleSchema.ts +2 -2
- package/src/simple-tree/toStoredSchema.ts +2 -3
- package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +12 -494
- package/src/simple-tree/unsafeUnknownSchema.ts +70 -0
- package/src/simple-tree/walkFieldSchema.ts +1 -1
- package/src/treeFactory.ts +0 -1
- package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +0 -1
- package/dist/feature-libraries/modular-schema/discrepancies.js +0 -361
- package/dist/feature-libraries/modular-schema/discrepancies.js.map +0 -1
- package/dist/shared-tree/checkoutFlexTreeView.d.ts +0 -58
- package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +0 -1
- package/dist/shared-tree/checkoutFlexTreeView.js +0 -77
- package/dist/shared-tree/checkoutFlexTreeView.js.map +0 -1
- package/dist/simple-tree/flexList.d.ts.map +0 -1
- package/dist/simple-tree/flexList.js.map +0 -1
- package/dist/simple-tree/schemaTypes.d.ts +0 -856
- package/dist/simple-tree/schemaTypes.d.ts.map +0 -1
- package/dist/simple-tree/schemaTypes.js.map +0 -1
- package/dist/simple-tree/treeNodeValid.d.ts.map +0 -1
- package/dist/simple-tree/treeNodeValid.js.map +0 -1
- package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +0 -1
- package/lib/feature-libraries/modular-schema/discrepancies.js +0 -354
- package/lib/feature-libraries/modular-schema/discrepancies.js.map +0 -1
- package/lib/shared-tree/checkoutFlexTreeView.d.ts +0 -58
- package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +0 -1
- package/lib/shared-tree/checkoutFlexTreeView.js +0 -72
- package/lib/shared-tree/checkoutFlexTreeView.js.map +0 -1
- package/lib/simple-tree/flexList.d.ts.map +0 -1
- package/lib/simple-tree/flexList.js.map +0 -1
- package/lib/simple-tree/schemaTypes.d.ts +0 -856
- package/lib/simple-tree/schemaTypes.d.ts.map +0 -1
- package/lib/simple-tree/schemaTypes.js.map +0 -1
- package/lib/simple-tree/treeNodeValid.d.ts.map +0 -1
- package/lib/simple-tree/treeNodeValid.js.map +0 -1
- package/src/feature-libraries/modular-schema/discrepancies.ts +0 -567
- package/src/shared-tree/checkoutFlexTreeView.ts +0 -100
- package/src/simple-tree/schemaTypes.ts +0 -1420
- /package/dist/simple-tree/{flexList.d.ts → core/flexList.d.ts} +0 -0
- /package/dist/simple-tree/{flexList.js → core/flexList.js} +0 -0
- /package/lib/simple-tree/{flexList.d.ts → core/flexList.d.ts} +0 -0
- /package/lib/simple-tree/{flexList.js → core/flexList.js} +0 -0
- /package/src/simple-tree/{flexList.ts → core/flexList.ts} +0 -0
|
@@ -14,12 +14,13 @@ exports.arraySchema = exports.asIndex = exports.IterableTreeArrayContent = expor
|
|
|
14
14
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
15
15
|
const internal_2 = require("@fluidframework/telemetry-utils/internal");
|
|
16
16
|
const index_js_1 = require("../../../core/index.js");
|
|
17
|
-
const
|
|
18
|
-
const
|
|
17
|
+
const index_js_2 = require("../../../feature-libraries/index.js");
|
|
18
|
+
const index_js_3 = require("../../core/index.js");
|
|
19
19
|
const unhydratedFlexTreeFromInsertable_js_1 = require("../../unhydratedFlexTreeFromInsertable.js");
|
|
20
20
|
const prepareForInsertion_js_1 = require("../../prepareForInsertion.js");
|
|
21
|
-
const treeNodeValid_js_1 = require("../../treeNodeValid.js");
|
|
22
21
|
const createContext_js_1 = require("../../createContext.js");
|
|
22
|
+
const index_js_4 = require("../../../util/index.js");
|
|
23
|
+
const leafNodeSchema_js_1 = require("../../leafNodeSchema.js");
|
|
23
24
|
/**
|
|
24
25
|
* A {@link TreeNode} which implements 'readonly T[]' and the array mutation APIs.
|
|
25
26
|
* @public
|
|
@@ -66,7 +67,7 @@ exports.IterableTreeArrayContent = IterableTreeArrayContent;
|
|
|
66
67
|
* Given a array node proxy, returns its underlying LazySequence field.
|
|
67
68
|
*/
|
|
68
69
|
function getSequenceField(arrayNode) {
|
|
69
|
-
return (0,
|
|
70
|
+
return (0, index_js_3.getOrCreateInnerNode)(arrayNode).getBoxed(index_js_1.EmptyKey);
|
|
70
71
|
}
|
|
71
72
|
// For compatibility, we are initially implement 'readonly T[]' by applying the Array.prototype methods
|
|
72
73
|
// to the array node proxy. Over time, we should replace these with efficient implementations on LazySequence
|
|
@@ -118,7 +119,7 @@ const TreeNodeWithArrayFeatures = (() => {
|
|
|
118
119
|
/**
|
|
119
120
|
* {@link TreeNodeValid}, but modified to add members from Array.prototype named in {@link arrayPrototypeKeys}.
|
|
120
121
|
*/
|
|
121
|
-
class TreeNodeWithArrayFeaturesUntyped extends
|
|
122
|
+
class TreeNodeWithArrayFeaturesUntyped extends index_js_3.TreeNodeValid {
|
|
122
123
|
}
|
|
123
124
|
// Modify TreeNodeWithArrayFeaturesUntyped to add the members from Array.prototype
|
|
124
125
|
arrayPrototypeKeys.forEach((key) => {
|
|
@@ -168,7 +169,7 @@ exports.asIndex = asIndex;
|
|
|
168
169
|
function createArrayNodeProxy(allowAdditionalProperties, proxyTarget, dispatchTarget) {
|
|
169
170
|
// To satisfy 'deepEquals' level scrutiny, the target of the proxy must be an array literal in order
|
|
170
171
|
// to pass 'Object.getPrototypeOf'. It also satisfies 'Array.isArray' and 'Object.prototype.toString'
|
|
171
|
-
// requirements without use of Array[Symbol.species], which is potentially on a path
|
|
172
|
+
// requirements without use of Array[Symbol.species], which is potentially on a path to deprecation.
|
|
172
173
|
const proxy = new Proxy(proxyTarget, {
|
|
173
174
|
get: (target, key, receiver) => {
|
|
174
175
|
const field = getSequenceField(receiver);
|
|
@@ -177,6 +178,11 @@ function createArrayNodeProxy(allowAdditionalProperties, proxyTarget, dispatchTa
|
|
|
177
178
|
if (key === "length") {
|
|
178
179
|
return field.length;
|
|
179
180
|
}
|
|
181
|
+
// In NodeJS 22, assert.strict.deepEqual started special casing well known constructors like Array.
|
|
182
|
+
// That made this necessary, ensuring that in POJO mode, TreeArrayNode are still deepEqual to arrays.
|
|
183
|
+
if (key === "constructor") {
|
|
184
|
+
return proxyTarget.constructor;
|
|
185
|
+
}
|
|
180
186
|
// Pass the proxy as the receiver here, so that any methods on
|
|
181
187
|
// the prototype receive `proxy` as `this`.
|
|
182
188
|
return Reflect.get(dispatchTarget, key, receiver);
|
|
@@ -184,7 +190,7 @@ function createArrayNodeProxy(allowAdditionalProperties, proxyTarget, dispatchTa
|
|
|
184
190
|
const maybeContent = field.at(maybeIndex);
|
|
185
191
|
return maybeContent === undefined
|
|
186
192
|
? undefined
|
|
187
|
-
: (0,
|
|
193
|
+
: (0, index_js_3.getOrCreateNodeFromInnerUnboxedNode)(maybeContent);
|
|
188
194
|
},
|
|
189
195
|
set: (target, key, newValue, receiver) => {
|
|
190
196
|
if (key === "length") {
|
|
@@ -235,7 +241,7 @@ function createArrayNodeProxy(allowAdditionalProperties, proxyTarget, dispatchTa
|
|
|
235
241
|
// To satisfy 'deepEquals' level scrutiny, the property descriptor for indexed properties must
|
|
236
242
|
// be a simple value property (as opposed to using getter) and declared writable/enumerable/configurable.
|
|
237
243
|
return {
|
|
238
|
-
value: val === undefined ? undefined : (0,
|
|
244
|
+
value: val === undefined ? undefined : (0, index_js_3.getOrCreateNodeFromInnerUnboxedNode)(val),
|
|
239
245
|
writable: true, // For MVP, setting indexed properties is reported as allowed here (for deep equals compatibility noted above), but not actually supported.
|
|
240
246
|
enumerable: true,
|
|
241
247
|
configurable: true,
|
|
@@ -300,7 +306,7 @@ class CustomArrayNodeBase extends TreeNodeWithArrayFeatures {
|
|
|
300
306
|
if (val === undefined) {
|
|
301
307
|
return val;
|
|
302
308
|
}
|
|
303
|
-
return (0,
|
|
309
|
+
return (0, index_js_3.getOrCreateNodeFromInnerNode)(val);
|
|
304
310
|
}
|
|
305
311
|
insertAt(index, ...value) {
|
|
306
312
|
const field = getSequenceField(this);
|
|
@@ -370,7 +376,7 @@ class CustomArrayNodeBase extends TreeNodeWithArrayFeatures {
|
|
|
370
376
|
if (sourceField !== destinationField) {
|
|
371
377
|
for (let i = sourceStart; i < sourceEnd; i++) {
|
|
372
378
|
const sourceNode = sourceField.boxedAt(i) ?? (0, internal_1.oob)();
|
|
373
|
-
const sourceSchema = (0,
|
|
379
|
+
const sourceSchema = (0, index_js_3.getSimpleNodeSchemaFromInnerNode)(sourceNode);
|
|
374
380
|
if (!destinationSchema.has(sourceSchema)) {
|
|
375
381
|
throw new internal_2.UsageError("Type in source sequence is not allowed in destination.");
|
|
376
382
|
}
|
|
@@ -378,7 +384,7 @@ class CustomArrayNodeBase extends TreeNodeWithArrayFeatures {
|
|
|
378
384
|
}
|
|
379
385
|
const movedCount = sourceEnd - sourceStart;
|
|
380
386
|
if (!destinationField.context.isHydrated()) {
|
|
381
|
-
if (!(sourceField instanceof
|
|
387
|
+
if (!(sourceField instanceof index_js_3.UnhydratedSequenceField)) {
|
|
382
388
|
throw new internal_2.UsageError("Cannot move elements from a hydrated array to an unhydrated array.");
|
|
383
389
|
}
|
|
384
390
|
if (sourceField.context.isHydrated()) {
|
|
@@ -402,10 +408,10 @@ class CustomArrayNodeBase extends TreeNodeWithArrayFeatures {
|
|
|
402
408
|
}
|
|
403
409
|
}
|
|
404
410
|
values() {
|
|
405
|
-
return this.generateValues((0,
|
|
411
|
+
return this.generateValues((0, index_js_3.getKernel)(this).generationNumber);
|
|
406
412
|
}
|
|
407
413
|
*generateValues(initialLastUpdatedStamp) {
|
|
408
|
-
const kernel = (0,
|
|
414
|
+
const kernel = (0, index_js_3.getKernel)(this);
|
|
409
415
|
if (initialLastUpdatedStamp !== kernel.generationNumber) {
|
|
410
416
|
throw new internal_2.UsageError(`Concurrent editing and iteration is not allowed.`);
|
|
411
417
|
}
|
|
@@ -417,7 +423,7 @@ class CustomArrayNodeBase extends TreeNodeWithArrayFeatures {
|
|
|
417
423
|
}
|
|
418
424
|
}
|
|
419
425
|
}
|
|
420
|
-
CustomArrayNodeBase.kind =
|
|
426
|
+
CustomArrayNodeBase.kind = index_js_3.NodeKind.Array;
|
|
421
427
|
/**
|
|
422
428
|
* Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.
|
|
423
429
|
*
|
|
@@ -426,11 +432,10 @@ CustomArrayNodeBase.kind = index_js_2.NodeKind.Array;
|
|
|
426
432
|
*/
|
|
427
433
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
428
434
|
function arraySchema(identifier, info, implicitlyConstructable, customizable, metadata, persistedMetadata) {
|
|
429
|
-
const unannotatedTypes = (0,
|
|
430
|
-
const lazyChildTypes = new internal_1.Lazy(() => (0,
|
|
431
|
-
const lazyAnnotatedTypes = new internal_1.Lazy(() => [(0, schemaTypes_js_1.normalizeAnnotatedAllowedTypes)(info)]);
|
|
435
|
+
const unannotatedTypes = (0, index_js_3.unannotateImplicitAllowedTypes)(info);
|
|
436
|
+
const lazyChildTypes = new internal_1.Lazy(() => (0, index_js_3.normalizeAllowedTypes)(unannotatedTypes));
|
|
432
437
|
const lazyAllowedTypesIdentifiers = new internal_1.Lazy(() => new Set([...lazyChildTypes.value].map((type) => type.identifier)));
|
|
433
|
-
let
|
|
438
|
+
let privateData;
|
|
434
439
|
// This class returns a proxy from its constructor to handle numeric indexing.
|
|
435
440
|
// Alternatively it could extend a normal class which gets tons of numeric properties added.
|
|
436
441
|
class Schema extends CustomArrayNodeBase {
|
|
@@ -455,8 +460,6 @@ function arraySchema(identifier, info, implicitlyConstructable, customizable, me
|
|
|
455
460
|
return lazyAllowedTypesIdentifiers.value;
|
|
456
461
|
}
|
|
457
462
|
static oneTimeSetup() {
|
|
458
|
-
const schema = this;
|
|
459
|
-
unhydratedContext = (0, createContext_js_1.getUnhydratedContext)(schema);
|
|
460
463
|
// First run, do extra validation.
|
|
461
464
|
// TODO: provide a way for TreeConfiguration to trigger this same validation to ensure it gets run early.
|
|
462
465
|
// Scan for shadowing inherited members which won't work, but stop scan early to allow shadowing built in (which seems to work ok).
|
|
@@ -478,19 +481,20 @@ function arraySchema(identifier, info, implicitlyConstructable, customizable, me
|
|
|
478
481
|
prototype = Reflect.getPrototypeOf(prototype);
|
|
479
482
|
}
|
|
480
483
|
}
|
|
481
|
-
|
|
484
|
+
const schema = this;
|
|
485
|
+
return (0, createContext_js_1.getTreeNodeSchemaInitializedData)(this, {
|
|
486
|
+
shallowCompatibilityTest: (data) => shallowCompatibilityTest(data, schema),
|
|
487
|
+
toFlexContent: (data, allowedTypes) => arrayToFlexContent(data, schema),
|
|
488
|
+
});
|
|
482
489
|
}
|
|
483
490
|
static get childTypes() {
|
|
484
491
|
return lazyChildTypes.value;
|
|
485
492
|
}
|
|
486
|
-
static get childAnnotatedAllowedTypes() {
|
|
487
|
-
return lazyAnnotatedTypes.value;
|
|
488
|
-
}
|
|
489
493
|
// eslint-disable-next-line import/no-deprecated
|
|
490
|
-
get [
|
|
494
|
+
get [index_js_3.typeNameSymbol]() {
|
|
491
495
|
return identifier;
|
|
492
496
|
}
|
|
493
|
-
get [
|
|
497
|
+
get [index_js_3.typeSchemaSymbol]() {
|
|
494
498
|
return Schema.constructorCached?.constructor;
|
|
495
499
|
}
|
|
496
500
|
get simpleSchema() {
|
|
@@ -499,6 +503,9 @@ function arraySchema(identifier, info, implicitlyConstructable, customizable, me
|
|
|
499
503
|
get allowedTypes() {
|
|
500
504
|
return lazyChildTypes.value;
|
|
501
505
|
}
|
|
506
|
+
static get [index_js_3.privateDataSymbol]() {
|
|
507
|
+
return (privateData ??= (0, index_js_3.createTreeNodeSchemaPrivateData)(this, [info]));
|
|
508
|
+
}
|
|
502
509
|
}
|
|
503
510
|
Schema.constructorCached = undefined;
|
|
504
511
|
Schema.identifier = identifier;
|
|
@@ -541,4 +548,68 @@ function validateIndexRange(startIndex, endIndex, array, methodName) {
|
|
|
541
548
|
throw new internal_2.UsageError(`Index value passed to TreeArrayNode.${methodName} is out of bounds.`);
|
|
542
549
|
}
|
|
543
550
|
}
|
|
551
|
+
/**
|
|
552
|
+
* Transforms data for a child of an array.
|
|
553
|
+
* @param child - The tree data to be transformed.
|
|
554
|
+
* @param allowedTypes - The set of types allowed by the parent context. Used to validate the input tree.
|
|
555
|
+
*/
|
|
556
|
+
function arrayChildToFlexTree(child, allowedTypes) {
|
|
557
|
+
// We do not support undefined sequence entries.
|
|
558
|
+
// If we encounter an undefined entry, use null instead if supported by the schema, otherwise throw.
|
|
559
|
+
let childWithFallback = child;
|
|
560
|
+
if (child === undefined) {
|
|
561
|
+
if (allowedTypes.has(leafNodeSchema_js_1.nullSchema)) {
|
|
562
|
+
childWithFallback = null;
|
|
563
|
+
}
|
|
564
|
+
else {
|
|
565
|
+
throw new TypeError(`Received unsupported array entry value: ${child}.`);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return (0, unhydratedFlexTreeFromInsertable_js_1.unhydratedFlexTreeFromInsertableNode)(childWithFallback, allowedTypes);
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* {@link TreeNodeSchemaInitializedData.toFlexContent} for Array nodes.
|
|
572
|
+
*
|
|
573
|
+
* @param data - The tree data to be transformed. Must be an iterable.
|
|
574
|
+
* @param schema - The schema to comply with.
|
|
575
|
+
*/
|
|
576
|
+
function arrayToFlexContent(data, schema) {
|
|
577
|
+
if (!(typeof data === "object" && data !== null && Symbol.iterator in data)) {
|
|
578
|
+
throw new internal_2.UsageError(`Input data is incompatible with Array schema: ${data}`);
|
|
579
|
+
}
|
|
580
|
+
const allowedChildTypes = (0, index_js_3.normalizeAllowedTypes)(schema.info);
|
|
581
|
+
const mappedData = Array.from(data, (child) => arrayChildToFlexTree(child, allowedChildTypes));
|
|
582
|
+
const context = (0, createContext_js_1.getUnhydratedContext)(schema).flexContext;
|
|
583
|
+
// Array nodes have a single `EmptyKey` field:
|
|
584
|
+
const fieldsEntries = mappedData.length === 0
|
|
585
|
+
? []
|
|
586
|
+
: [
|
|
587
|
+
[
|
|
588
|
+
index_js_1.EmptyKey,
|
|
589
|
+
new index_js_3.UnhydratedSequenceField(context, index_js_2.FieldKinds.sequence.identifier, index_js_1.EmptyKey, mappedData),
|
|
590
|
+
],
|
|
591
|
+
];
|
|
592
|
+
return [
|
|
593
|
+
{
|
|
594
|
+
type: (0, index_js_4.brand)(schema.identifier),
|
|
595
|
+
},
|
|
596
|
+
new Map(fieldsEntries),
|
|
597
|
+
];
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* {@link TreeNodeSchemaInitializedData.shallowCompatibilityTest} for Array nodes.
|
|
601
|
+
*/
|
|
602
|
+
function shallowCompatibilityTest(data, schema) {
|
|
603
|
+
if ((0, index_js_2.isTreeValue)(data)) {
|
|
604
|
+
return index_js_3.CompatibilityLevel.None;
|
|
605
|
+
}
|
|
606
|
+
if (data instanceof Map) {
|
|
607
|
+
// Maps are iterable, so type checking does allow constructing an ArrayNode from a map if the ArrayNode's type is an array that includes the key and value types of the map.
|
|
608
|
+
return index_js_3.CompatibilityLevel.Low;
|
|
609
|
+
}
|
|
610
|
+
if (Symbol.iterator in data) {
|
|
611
|
+
return index_js_3.CompatibilityLevel.Normal;
|
|
612
|
+
}
|
|
613
|
+
return index_js_3.CompatibilityLevel.None;
|
|
614
|
+
}
|
|
544
615
|
//# sourceMappingURL=arrayNode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrayNode.js","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/array/arrayNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAEH,kEAAsE;AACtE,uEAAsE;AAEtE,qDAAkD;AAMlD,yDAW8B;AAC9B,kDAmB6B;AAC7B,mGAGmD;AACnD,yEAA+E;AAC/E,6DAA6E;AAC7E,6DAA8D;AAgX9D;;;GAGG;AACU,QAAA,aAAa,GAAG;IAC5B;;;;;;;;;OASG;IACH,MAAM,EAAE,CAAI,OAAoB,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC;CAC3C,CAAC;AAEX;;;GAGG;AACH,IAAI,MAAgE,CAAC;AAErE;;;;GAIG;AACH,MAAa,wBAAwB;IAKpC,YAAqC,OAAoB;QAApB,YAAO,GAAP,OAAO,CAAa;IAAG,CAAC;IAE7D;;OAEG;IACI,CAAC,MAAM,CAAC,QAAQ,CAAC;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,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AAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,qBAAU,CAAC,gCAAgC,KAAK,GAAG,CAAC,CAAC;IAChE,CAAC;AACF,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAa;IAC3C,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAC3B,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,qBAAU,CAAC,oCAAoC,KAAK,GAAG,CAAC,CAAC;IACpE,CAAC;AACF,CAAC;AAED,SAAS,aAAa,CACrB,KAAa,EACb,KAAkC,EAClC,UAAkB,EAClB,kBAA2B,KAAK;IAEhC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,eAAe,EAAE,CAAC;QACrB,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAC1B,MAAM,IAAI,qBAAU,CACnB,uCAAuC,UAAU,oBAAoB,CACrE,CAAC;QACH,CAAC;IACF,CAAC;SAAM,CAAC;QACP,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YAC3B,MAAM,IAAI,qBAAU,CACnB,uCAAuC,UAAU,oBAAoB,CACrE,CAAC;QACH,CAAC;IACF,CAAC;AACF,CAAC;AAED,SAAS,kBAAkB,CAC1B,UAAkB,EAClB,QAAgB,EAChB,KAAkC,EAClC,UAAkB;IAElB,aAAa,CAAC,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IACnD,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IACjD,IAAI,UAAU,GAAG,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,QAAQ,EAAE,CAAC;QACtD,MAAM,IAAI,qBAAU,CACnB,uCAAuC,UAAU,oBAAoB,CACrE,CAAC;IACH,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Lazy, oob, fail } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { EmptyKey } from \"../../../core/index.js\";\nimport type {\n\tFlexibleFieldContent,\n\tFlexTreeNode,\n\tFlexTreeSequenceField,\n} from \"../../../feature-libraries/index.js\";\nimport {\n\tnormalizeAllowedTypes,\n\tnormalizeAnnotatedAllowedTypes,\n\tunannotateImplicitAllowedTypes,\n\ttype ImplicitAllowedTypes,\n\ttype ImplicitAnnotatedAllowedTypes,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype NodeSchemaMetadata,\n\ttype TreeLeafValue,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype UnannotateImplicitAllowedTypes,\n} from \"../../schemaTypes.js\";\nimport {\n\ttype WithType,\n\t// eslint-disable-next-line import/no-deprecated\n\ttypeNameSymbol,\n\tNodeKind,\n\ttype TreeNode,\n\ttype InternalTreeNode,\n\ttype TreeNodeSchema,\n\ttypeSchemaSymbol,\n\ttype Context,\n\tgetOrCreateNodeFromInnerNode,\n\tgetSimpleNodeSchemaFromInnerNode,\n\tgetOrCreateInnerNode,\n\ttype TreeNodeSchemaClass,\n\tgetKernel,\n\ttype UnhydratedFlexTreeNode,\n\tUnhydratedSequenceField,\n\tgetOrCreateNodeFromInnerUnboxedNode,\n\ttype NormalizedAnnotatedAllowedTypes,\n} from \"../../core/index.js\";\nimport {\n\ttype InsertableContent,\n\tunhydratedFlexTreeFromInsertable,\n} from \"../../unhydratedFlexTreeFromInsertable.js\";\nimport { prepareArrayContentForInsertion } from \"../../prepareForInsertion.js\";\nimport { TreeNodeValid, type MostDerivedData } from \"../../treeNodeValid.js\";\nimport { getUnhydratedContext } from \"../../createContext.js\";\nimport type { System_Unsafe } from \"../../api/index.js\";\nimport type {\n\tArrayNodeCustomizableSchema,\n\tArrayNodePojoEmulationSchema,\n} from \"./arrayNodeTypes.js\";\nimport type { JsonCompatibleReadOnlyObject } from \"../../../util/index.js\";\n\n/**\n * A covariant base type for {@link (TreeArrayNode:interface)}.\n *\n * This provides the readonly subset of TreeArrayNode functionality, and is used as the source interface for moves since that needs to be covariant.\n * @privateRemarks\n * Ideally this would just include `TreeNode, WithType<string, NodeKind.Array>` in the extends list but https://github.com/microsoft/TypeScript/issues/16936 prevents that from compiling.\n * As a workaround around for this TypeScript limitation, the conflicting type intersection is wrapped in `Awaited` (which has no effect on the type in this case) which allows it to compile.\n * @system @sealed @public\n */\nexport interface ReadonlyArrayNode<out T = TreeNode | TreeLeafValue>\n\textends ReadonlyArray<T>,\n\t\tAwaited<TreeNode & WithType<string, NodeKind.Array>> {}\n\n/**\n * A {@link TreeNode} which implements 'readonly T[]' and the array mutation APIs.\n *\n * @typeParam TAllowedTypes - Schema for types which are allowed as members of this array.\n * @typeParam T - Use Default: Do not specify. Type of values to read from the array.\n * @typeParam TNew - Use Default: Do not specify. Type of values to write into the array.\n * @typeParam TMoveFrom - Use Default: Do not specify. Type of node from which children can be moved into this array.\n *\n * @sealed @public\n */\nexport interface TreeArrayNode<\n\tTAllowedTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe = ImplicitAllowedTypes,\n\tout T = [TAllowedTypes] extends [ImplicitAllowedTypes]\n\t\t? TreeNodeFromImplicitAllowedTypes<TAllowedTypes>\n\t\t: TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>,\n\tin TNew = [TAllowedTypes] extends [ImplicitAllowedTypes]\n\t\t? InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes>\n\t\t: InsertableTreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>,\n\tin TMoveFrom = ReadonlyArrayNode,\n> extends ReadonlyArrayNode<T> {\n\t/**\n\t * Inserts new item(s) at a specified location.\n\t * @param index - The index at which to insert `value`.\n\t * @param value - The content to insert.\n\t * @throws Throws if `index` is not in the range [0, `array.length`).\n\t */\n\tinsertAt(index: number, ...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;\n\n\t/**\n\t * Inserts new item(s) at the start of the array.\n\t * @param value - The content to insert.\n\t */\n\tinsertAtStart(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;\n\n\t/**\n\t * Inserts new item(s) at the end of the array.\n\t * @param value - The content to insert.\n\t */\n\tinsertAtEnd(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;\n\n\t/**\n\t * Removes the item at the specified location.\n\t * @param index - The index at which to remove the item.\n\t * @throws Throws if `index` is not in the range [0, `array.length`).\n\t */\n\tremoveAt(index: number): void;\n\n\t/**\n\t * Removes all items between the specified indices.\n\t * @param start - The starting index of the range to remove (inclusive). Defaults to the start of the array.\n\t * @param end - The ending index of the range to remove (exclusive). Defaults to `array.length`.\n\t * @throws Throws if `start` is not in the range [0, `array.length`].\n\t * @throws Throws if `end` is less than `start`.\n\t * If `end` is not supplied or is greater than the length of the array, all items after `start` are removed.\n\t *\n\t * @remarks\n\t * The default values for start and end are computed when this is called,\n\t * and thus the behavior is the same as providing them explicitly, even with respect to merge resolution with concurrent edits.\n\t * For example, two concurrent transactions both emptying the array with `node.removeRange()` then inserting an item,\n\t * will merge to result in the array having both inserted items.\n\t */\n\tremoveRange(start?: number, end?: number): void;\n\n\t/**\n\t * Moves the specified item to the start of the array.\n\t * @param sourceIndex - The index of the item to move.\n\t * @throws Throws if `sourceIndex` is not in the range [0, `array.length`).\n\t */\n\tmoveToStart(sourceIndex: number): void;\n\n\t/**\n\t * Moves the specified item to the start of the array.\n\t * @param sourceIndex - The index of the item to move.\n\t * @param source - The source array to move the item out of.\n\t * @throws Throws if `sourceIndex` is not in the range [0, `array.length`).\n\t */\n\tmoveToStart(sourceIndex: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified item to the end of the array.\n\t * @param sourceIndex - The index of the item to move.\n\t * @throws Throws if `sourceIndex` is not in the range [0, `array.length`).\n\t */\n\tmoveToEnd(sourceIndex: number): void;\n\n\t/**\n\t * Moves the specified item to the end of the array.\n\t * @param sourceIndex - The index of the item to move.\n\t * @param source - The source array to move the item out of.\n\t * @throws Throws if `sourceIndex` is not in the range [0, `array.length`).\n\t */\n\tmoveToEnd(sourceIndex: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified item to the desired location in the array.\n\t *\n\t * WARNING - This API is easily misused.\n\t * Please read the documentation for the `destinationGap` parameter carefully.\n\t *\n\t * @param destinationGap - The location *between* existing items that the moved item should be moved to.\n\t *\n\t * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.\n\t *\n\t * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:\n\t *\n\t * - `0` (between the start of the array and `A`'s original position)\n\t *\n\t * - `1` (between `A`'s original position and `B`'s original position)\n\t *\n\t * - `2` (between `B`'s original position and `C`'s original position)\n\t *\n\t * - `3` (between `C`'s original position and the end of the array)\n\t *\n\t * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.\n\t *\n\t * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,\n\t * or relative to the start or end of the array:\n\t *\n\t * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)\n\t *\n\t * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`\n\t *\n\t * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)\n\t *\n\t * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)\n\t *\n\t * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:\n\t *\n\t * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`\n\t *\n\t * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`\n\t *\n\t * Notice the asymmetry between `-1` and `+2` in the above examples.\n\t * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:\n\t * If items A and B are adjacent, such that A precedes B,\n\t * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.\n\t *\n\t * @param sourceIndex - The index of the item to move.\n\t * @throws Throws if any of the input indices are not in the range [0, `array.length`).\n\t */\n\tmoveToIndex(destinationGap: number, sourceIndex: number): void;\n\n\t/**\n\t * Moves the specified item to the desired location in the array.\n\t *\n\t * WARNING - This API is easily misused.\n\t * Please read the documentation for the `destinationGap` parameter carefully.\n\t *\n\t * @param destinationGap - The location *between* existing items that the moved item should be moved to.\n\t *\n\t * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.\n\t *\n\t * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:\n\t *\n\t * - `0` (between the start of the array and `A`'s original position)\n\t *\n\t * - `1` (between `A`'s original position and `B`'s original position)\n\t *\n\t * - `2` (between `B`'s original position and `C`'s original position)\n\t *\n\t * - `3` (between `C`'s original position and the end of the array)\n\t *\n\t * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.\n\t *\n\t * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,\n\t * or relative to the start or end of the array:\n\t *\n\t * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)\n\t *\n\t * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`\n\t *\n\t * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)\n\t *\n\t * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)\n\t *\n\t * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:\n\t *\n\t * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`\n\t *\n\t * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`\n\t *\n\t * Notice the asymmetry between `-1` and `+2` in the above examples.\n\t * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:\n\t * If items A and B are adjacent, such that A precedes B,\n\t * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.\n\t *\n\t * @param sourceIndex - The index of the item to move.\n\t * @param source - The source array to move the item out of.\n\t * @throws Throws if any of the source index is not in the range [0, `array.length`),\n\t * or if the index is not in the range [0, `array.length`].\n\t */\n\tmoveToIndex(destinationGap: number, sourceIndex: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified items to the start of the array.\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @throws Throws if either of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToStart(sourceStart: number, sourceEnd: number): void;\n\n\t/**\n\t * Moves the specified items to the start of the array.\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @param source - The source array to move items out of.\n\t * @throws Throws if the types of any of the items being moved are not allowed in the destination array,\n\t * if either of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToStart(sourceStart: number, sourceEnd: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified items to the end of the array.\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @throws Throws if either of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToEnd(sourceStart: number, sourceEnd: number): void;\n\n\t/**\n\t * Moves the specified items to the end of the array.\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @param source - The source array to move items out of.\n\t * @throws Throws if the types of any of the items being moved are not allowed in the destination array,\n\t * if either of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToEnd(sourceStart: number, sourceEnd: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified items to the desired location within the array.\n\t *\n\t * WARNING - This API is easily misused.\n\t * Please read the documentation for the `destinationGap` parameter carefully.\n\t *\n\t * @param destinationGap - The location *between* existing items that the moved item should be moved to.\n\t *\n\t * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.\n\t *\n\t * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:\n\t *\n\t * - `0` (between the start of the array and `A`'s original position)\n\t *\n\t * - `1` (between `A`'s original position and `B`'s original position)\n\t *\n\t * - `2` (between `B`'s original position and `C`'s original position)\n\t *\n\t * - `3` (between `C`'s original position and the end of the array)\n\t *\n\t * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.\n\t *\n\t * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,\n\t * or relative to the start or end of the array:\n\t *\n\t * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)\n\t *\n\t * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`\n\t *\n\t * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)\n\t *\n\t * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)\n\t *\n\t * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:\n\t *\n\t * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`\n\t *\n\t * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`\n\t *\n\t * Notice the asymmetry between `-1` and `+2` in the above examples.\n\t * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:\n\t * If items A and B are adjacent, such that A precedes B,\n\t * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.\n\t *\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @throws Throws if any of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToIndex(destinationGap: number, sourceStart: number, sourceEnd: number): void;\n\n\t/**\n\t * Moves the specified items to the desired location within the array.\n\t *\n\t * WARNING - This API is easily misused.\n\t * Please read the documentation for the `destinationGap` parameter carefully.\n\t *\n\t * @param destinationGap - The location *between* existing items that the moved item should be moved to.\n\t *\n\t * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.\n\t *\n\t * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:\n\t *\n\t * - `0` (between the start of the array and `A`'s original position)\n\t *\n\t * - `1` (between `A`'s original position and `B`'s original position)\n\t *\n\t * - `2` (between `B`'s original position and `C`'s original position)\n\t *\n\t * - `3` (between `C`'s original position and the end of the array)\n\t *\n\t * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.\n\t *\n\t * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,\n\t * or relative to the start or end of the array:\n\t *\n\t * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)\n\t *\n\t * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`\n\t *\n\t * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)\n\t *\n\t * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)\n\t *\n\t * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:\n\t *\n\t * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`\n\t *\n\t * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`\n\t *\n\t * Notice the asymmetry between `-1` and `+2` in the above examples.\n\t * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:\n\t * If items A and B are adjacent, such that A precedes B,\n\t * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.\n\t *\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @param source - The source array to move items out of.\n\t * @throws Throws if the types of any of the items being moved are not allowed in the destination array,\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToIndex(\n\t\tdestinationGap: number,\n\t\tsourceStart: number,\n\t\tsourceEnd: number,\n\t\tsource: TMoveFrom,\n\t): void;\n\n\t/**\n\t * Returns a custom IterableIterator which throws usage errors if concurrent editing and iteration occurs.\n\t */\n\tvalues(): IterableIterator<T>;\n}\n\n/**\n * A {@link TreeNode} which implements 'readonly T[]' and the array mutation APIs.\n * @public\n */\nexport const TreeArrayNode = {\n\t/**\n\t * Wrap an iterable of items to inserted as consecutive items in a array.\n\t * @remarks\n\t * The object returned by this function can be inserted into a {@link (TreeArrayNode:interface)}.\n\t * Its contents will be inserted consecutively in the corresponding location in the array.\n\t * @example\n\t * ```ts\n\t * array.insertAtEnd(TreeArrayNode.spread(iterable))\n\t * ```\n\t */\n\tspread: <T>(content: Iterable<T>) => create(content),\n} as const;\n\n/**\n * Package internal construction API.\n * Use {@link (TreeArrayNode:variable).spread} to create an instance of this type instead.\n */\nlet create: <T>(content: Iterable<T>) => IterableTreeArrayContent<T>;\n\n/**\n * Used to insert iterable content into a {@link (TreeArrayNode:interface)}.\n * Use {@link (TreeArrayNode:variable).spread} to create an instance of this type.\n * @sealed @public\n */\nexport class IterableTreeArrayContent<T> implements Iterable<T> {\n\tstatic {\n\t\tcreate = <T2>(content: Iterable<T2>) => new IterableTreeArrayContent(content);\n\t}\n\n\tprivate constructor(private readonly content: Iterable<T>) {}\n\n\t/**\n\t * Iterates over content for nodes to insert.\n\t */\n\tpublic [Symbol.iterator](): Iterator<T> {\n\t\treturn this.content[Symbol.iterator]();\n\t}\n}\n\n/**\n * Given a array node proxy, returns its underlying LazySequence field.\n */\nfunction getSequenceField(arrayNode: ReadonlyArrayNode): FlexTreeSequenceField {\n\treturn getOrCreateInnerNode(arrayNode).getBoxed(EmptyKey) as FlexTreeSequenceField;\n}\n\n// For compatibility, we are initially implement 'readonly T[]' by applying the Array.prototype methods\n// to the array node proxy. Over time, we should replace these with efficient implementations on LazySequence\n// to avoid re-entering the proxy as these methods access 'length' and the indexed properties.\n//\n// For brevity, the current implementation dynamically builds a property descriptor map from a list of\n// Array functions we want to re-expose via the proxy.\n\nconst arrayPrototypeKeys = [\n\t\"concat\",\n\t\"entries\",\n\t\"every\",\n\t\"filter\",\n\t\"find\",\n\t\"findIndex\",\n\t\"flat\",\n\t\"flatMap\",\n\t\"forEach\",\n\t\"includes\",\n\t\"indexOf\",\n\t\"join\",\n\t\"keys\",\n\t\"lastIndexOf\",\n\t\"map\",\n\t\"reduce\",\n\t\"reduceRight\",\n\t\"slice\",\n\t\"some\",\n\t\"toLocaleString\",\n\t\"toString\",\n\n\t// \"copyWithin\",\n\t// \"fill\",\n\t// \"length\",\n\t// \"pop\",\n\t// \"push\",\n\t// \"reverse\",\n\t// \"shift\",\n\t// \"sort\",\n\t// \"splice\",\n\t// \"unshift\",\n] as const;\n\n/**\n * {@link TreeNodeValid}, but modified to add members from Array.prototype named in {@link arrayPrototypeKeys}.\n * @privateRemarks\n * Since a lot of scratch types and values are involved with creating this,\n * it's generating using an immediately invoked function expression (IIFE).\n * This is a common JavaScript pattern for cases like this to avoid cluttering the scope.\n */\nconst TreeNodeWithArrayFeatures = (() => {\n\t/**\n\t * {@link TreeNodeValid}, but modified to add members from Array.prototype named in {@link arrayPrototypeKeys}.\n\t */\n\tabstract class TreeNodeWithArrayFeaturesUntyped<\n\t\tconst T extends ImplicitAllowedTypes,\n\t> extends TreeNodeValid<Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>> {}\n\n\t// Modify TreeNodeWithArrayFeaturesUntyped to add the members from Array.prototype\n\tarrayPrototypeKeys.forEach((key) => {\n\t\tObject.defineProperty(TreeNodeWithArrayFeaturesUntyped.prototype, key, {\n\t\t\tvalue: Array.prototype[key],\n\t\t});\n\t});\n\n\treturn TreeNodeWithArrayFeaturesUntyped as unknown as typeof NodeWithArrayFeatures;\n})();\n\n/**\n * Type of {@link TreeNodeValid}, but with array members added to the instance type.\n *\n * TypeScript has a rule that `Base constructors must all have the same return type.ts(2510)`.\n * This means that intersecting two types with different constructors to create a type with a more constrained constructor (ex: more specific return type)\n * is not supported.\n *\n * TypeScript also has a limitation that there is no way to replace or remove just the constructor of a type without losing all the private and protected members.\n * See https://github.com/microsoft/TypeScript/issues/35416 for details.\n *\n * TypeScript also does not support explicitly specifying the instance type in a class definition as the constructor return type.\n *\n * Thus to replace the instance type, while preserving the protected static members of TreeNodeValid,\n * the only option seems to be actually declaring a class with all the members explicitly inline.\n *\n * To avoid incurring any bundle size / runtime overhead from this and having to stub out the function bodies,\n * the class uses `declare`.\n * TypeScript does not support `declare` inside scopes, so this is not inside the function scope above.\n *\n * The members of this class were generated using the \"implement interface\" refactoring.\n * Since that refactoring does not add `public`, the lint to require it is disabled for this section of the file.\n * To update this class delete all members and reapply the \"implement interface\" refactoring.\n * As these signatures get formatted to be over three times as many lines with prettier (which is not helpful), it is also suppressed.\n */\n/* eslint-disable @typescript-eslint/explicit-member-accessibility, @typescript-eslint/no-explicit-any */\n// prettier-ignore\ndeclare abstract class NodeWithArrayFeatures<Input, T>\n\textends TreeNodeValid<Input>\n\timplements Pick<readonly T[], (typeof arrayPrototypeKeys)[number]>\n{\n\tconcat(...items: ConcatArray<T>[]): T[];\n\tconcat(...items: (T | ConcatArray<T>)[]): T[];\n\tentries(): IterableIterator<[number, T]>;\n\tevery<S extends T>(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => value is S,\n\t\tthisArg?: any,\n\t): this is readonly S[];\n\tevery(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): boolean;\n\tfilter<S extends T>(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => value is S,\n\t\tthisArg?: any,\n\t): S[];\n\tfilter(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): T[];\n\tfind<S extends T>(\n\t\tpredicate: (value: T, index: number, obj: readonly T[]) => value is S,\n\t\tthisArg?: any,\n\t): S | undefined;\n\tfind(\n\t\tpredicate: (value: T, index: number, obj: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): T | undefined;\n\tfindIndex(\n\t\tpredicate: (value: T, index: number, obj: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): number;\n\tflat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];\n\tflatMap<U, This = undefined>(\n\t\tcallback: (this: This, value: T, index: number, array: T[]) => U | readonly U[],\n\t\tthisArg?: This | undefined,\n\t): U[];\n\tforEach(\n\t\tcallbackfn: (value: T, index: number, array: readonly T[]) => void,\n\t\tthisArg?: any,\n\t): void;\n\tincludes(searchElement: T, fromIndex?: number | undefined): boolean;\n\tindexOf(searchElement: T, fromIndex?: number | undefined): number;\n\tjoin(separator?: string | undefined): string;\n\tkeys(): IterableIterator<number>;\n\tlastIndexOf(searchElement: T, fromIndex?: number | undefined): number;\n\tmap<U>(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[];\n\treduce(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: T,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => T,\n\t): T;\n\treduce(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: T,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => T,\n\t\tinitialValue: T,\n\t): T;\n\treduce<U>(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: U,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => U,\n\t\tinitialValue: U,\n\t): U;\n\treduceRight(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: T,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => T,\n\t): T;\n\treduceRight(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: T,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => T,\n\t\tinitialValue: T,\n\t): T;\n\treduceRight<U>(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: U,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => U,\n\t\tinitialValue: U,\n\t): U;\n\tslice(start?: number | undefined, end?: number | undefined): T[];\n\tsome(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): boolean;\n\ttoLocaleString(): string;\n\ttoString(): string;\n}\n/* eslint-enable @typescript-eslint/explicit-member-accessibility, @typescript-eslint/no-explicit-any */\n\n/**\n * Attempts to coerce the given property key to an integer index property.\n * @param key - The property key to coerce.\n * @param exclusiveMax - This restricts the range in which the resulting index is allowed to be.\n * The coerced index of `key` must be less than `exclusiveMax` or else this function will return `undefined`.\n * This is useful for reading an array within the bounds of its length, e.g. `asIndex(key, array.length)`.\n */\nexport function asIndex(key: string | symbol, exclusiveMax: number): number | undefined {\n\tif (typeof key !== \"string\") {\n\t\treturn undefined;\n\t}\n\n\t// TODO: It may be worth a '0' <= ch <= '9' check before calling 'Number' to quickly\n\t// reject 'length' as an index, or even parsing integers ourselves.\n\tconst asNumber = Number(key);\n\tif (!Number.isInteger(asNumber)) {\n\t\treturn undefined;\n\t}\n\n\t// Check that the original string is the same after converting to a number and back again.\n\t// This prevents keys like \"5.0\", \"0x5\", \" 5\" from coercing to 5, and keys like \" \" or \"\" from coercing to 0.\n\tconst asString = String(asNumber);\n\tif (asString !== key) {\n\t\treturn undefined;\n\t}\n\n\t// TODO: See 'matrix/range.ts' for fast integer coercing + range check.\n\treturn 0 <= asNumber && asNumber < exclusiveMax ? asNumber : undefined;\n}\n\n/**\n * Create a proxy which implements the {@link TreeArrayNode} API.\n * @param allowAdditionalProperties - If true, setting of unexpected properties will be forwarded to the target object.\n * Otherwise setting of unexpected properties will error.\n * @param proxyTarget - Target object of the proxy. Must provide an own `length` value property\n * (which is not used but must exist for getOwnPropertyDescriptor invariants) and the array functionality from {@link arrayNodePrototype}.\n * Controls the prototype exposed by the produced proxy.\n * @param dispatchTarget - provides the functionally of the node, implementing all fields.\n */\nfunction createArrayNodeProxy(\n\tallowAdditionalProperties: boolean,\n\tproxyTarget: object,\n\tdispatchTarget: object,\n): TreeArrayNode {\n\t// To satisfy 'deepEquals' level scrutiny, the target of the proxy must be an array literal in order\n\t// to pass 'Object.getPrototypeOf'. It also satisfies 'Array.isArray' and 'Object.prototype.toString'\n\t// requirements without use of Array[Symbol.species], which is potentially on a path ot deprecation.\n\tconst proxy: TreeArrayNode = new Proxy<TreeArrayNode>(proxyTarget as TreeArrayNode, {\n\t\tget: (target, key, receiver) => {\n\t\t\tconst field = getSequenceField(receiver);\n\t\t\tconst maybeIndex = asIndex(key, field.length);\n\n\t\t\tif (maybeIndex === undefined) {\n\t\t\t\tif (key === \"length\") {\n\t\t\t\t\treturn field.length;\n\t\t\t\t}\n\n\t\t\t\t// Pass the proxy as the receiver here, so that any methods on\n\t\t\t\t// the prototype receive `proxy` as `this`.\n\t\t\t\treturn Reflect.get(dispatchTarget, key, receiver) as unknown;\n\t\t\t}\n\n\t\t\tconst maybeContent = field.at(maybeIndex);\n\t\t\treturn maybeContent === undefined\n\t\t\t\t? undefined\n\t\t\t\t: getOrCreateNodeFromInnerUnboxedNode(maybeContent);\n\t\t},\n\t\tset: (target, key, newValue, receiver) => {\n\t\t\tif (key === \"length\") {\n\t\t\t\t// To allow \"length\" to look like \"length\" on an array, getOwnPropertyDescriptor has to report it as a writable value.\n\t\t\t\t// This means the proxy target must provide a length value, but since it can't use getters and setters, it can't be correct.\n\t\t\t\t// Therefor length has to be handled in this proxy.\n\t\t\t\t// Since it's not actually mutable, return false so setting it will produce a type error.\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// 'Symbol.isConcatSpreadable' may be set on an Array instance to modify the behavior of\n\t\t\t// the concat method. We allow this property to be added to the dispatch object.\n\t\t\tif (key === Symbol.isConcatSpreadable) {\n\t\t\t\treturn Reflect.set(dispatchTarget, key, newValue, receiver);\n\t\t\t}\n\n\t\t\t// Array nodes treat all non-negative integer indexes as array access.\n\t\t\t// Using Infinity here (rather than length) ensures that indexing past the end doesn't create additional session local properties.\n\t\t\tconst maybeIndex = asIndex(key, Number.POSITIVE_INFINITY);\n\t\t\tif (maybeIndex !== undefined) {\n\t\t\t\t// For MVP, we otherwise disallow setting properties (mutation is only available via the array node mutation APIs).\n\t\t\t\t// To ensure a clear and actionable error experience, we will throw explicitly here, rather than just returning false.\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot set indexed properties on array nodes. Use array node mutation APIs to alter the array.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn allowAdditionalProperties ? Reflect.set(target, key, newValue, receiver) : false;\n\t\t},\n\t\thas: (target, key) => {\n\t\t\tconst field = getSequenceField(proxy);\n\t\t\tconst maybeIndex = asIndex(key, field.length);\n\t\t\treturn maybeIndex !== undefined || Reflect.has(dispatchTarget, key);\n\t\t},\n\t\townKeys: (target) => {\n\t\t\tconst field = getSequenceField(proxy);\n\n\t\t\t// TODO: Would a lazy iterator to produce the indexes work / be more efficient?\n\t\t\t// TODO: Need to surface 'Symbol.isConcatSpreadable' as an own key.\n\t\t\tconst keys: (string | symbol)[] = Array.from(\n\t\t\t\t{ length: field.length },\n\t\t\t\t(_, index) => `${index}`,\n\t\t\t);\n\n\t\t\tif (allowAdditionalProperties) {\n\t\t\t\tkeys.push(...Reflect.ownKeys(target));\n\t\t\t} else {\n\t\t\t\tkeys.push(\"length\");\n\t\t\t}\n\t\t\treturn keys;\n\t\t},\n\t\tgetOwnPropertyDescriptor: (target, key) => {\n\t\t\tconst field = getSequenceField(proxy);\n\t\t\tconst maybeIndex = asIndex(key, field.length);\n\t\t\tif (maybeIndex !== undefined) {\n\t\t\t\tconst val = field.at(maybeIndex);\n\t\t\t\t// To satisfy 'deepEquals' level scrutiny, the property descriptor for indexed properties must\n\t\t\t\t// be a simple value property (as opposed to using getter) and declared writable/enumerable/configurable.\n\t\t\t\treturn {\n\t\t\t\t\tvalue: val === undefined ? undefined : getOrCreateNodeFromInnerUnboxedNode(val),\n\t\t\t\t\twritable: true, // For MVP, setting indexed properties is reported as allowed here (for deep equals compatibility noted above), but not actually supported.\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t};\n\t\t\t} else if (key === \"length\") {\n\t\t\t\t// To satisfy 'deepEquals' level scrutiny, the property descriptor for 'length' must be a simple\n\t\t\t\t// value property (as opposed to using getter) and be declared writable / non-configurable.\n\t\t\t\treturn {\n\t\t\t\t\tvalue: field.length,\n\t\t\t\t\twritable: true,\n\t\t\t\t\tenumerable: false,\n\t\t\t\t\tconfigurable: false,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn Reflect.getOwnPropertyDescriptor(dispatchTarget, key);\n\t\t},\n\t\tdefineProperty(target, key, attributes) {\n\t\t\tconst maybeIndex = asIndex(key, Number.POSITIVE_INFINITY);\n\t\t\tif (maybeIndex !== undefined) {\n\t\t\t\tthrow new UsageError(\"Shadowing of array indices is not permitted.\");\n\t\t\t}\n\t\t\treturn Reflect.defineProperty(dispatchTarget, key, attributes);\n\t\t},\n\t});\n\treturn proxy;\n}\n\ntype Insertable<T extends ImplicitAllowedTypes> = readonly (\n\t| InsertableTreeNodeFromImplicitAllowedTypes<T>\n\t| IterableTreeArrayContent<InsertableTreeNodeFromImplicitAllowedTypes<T>>\n)[];\n\nabstract class CustomArrayNodeBase<const T extends ImplicitAllowedTypes>\n\textends TreeNodeWithArrayFeatures<\n\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\tTreeNodeFromImplicitAllowedTypes<T>\n\t>\n\timplements TreeArrayNode<T>\n{\n\t// Indexing must be provided by subclass.\n\t[k: number]: TreeNodeFromImplicitAllowedTypes<T>;\n\n\tpublic static readonly kind = NodeKind.Array;\n\n\tprotected abstract get simpleSchema(): T;\n\tprotected abstract get allowedTypes(): ReadonlySet<TreeNodeSchema>;\n\n\tpublic abstract override get [typeSchemaSymbol](): TreeNodeSchemaClass<\n\t\tstring,\n\t\tNodeKind.Array\n\t>;\n\n\tpublic constructor(\n\t\tinput?: Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>> | InternalTreeNode,\n\t) {\n\t\tsuper(input ?? []);\n\t}\n\n\t#mapTreesFromFieldData(value: Insertable<T>): FlexibleFieldContent {\n\t\tconst sequenceField = getSequenceField(this);\n\t\tconst content = value as readonly (\n\t\t\t| InsertableContent\n\t\t\t| IterableTreeArrayContent<InsertableContent>\n\t\t)[];\n\n\t\tconst contentArray = content.flatMap((c): InsertableContent[] =>\n\t\t\tc instanceof IterableTreeArrayContent ? Array.from(c) : [c],\n\t\t);\n\t\tconst mapTrees = prepareArrayContentForInsertion(\n\t\t\tcontentArray,\n\t\t\tthis.simpleSchema,\n\t\t\tsequenceField.context,\n\t\t);\n\n\t\treturn mapTrees;\n\t}\n\n\tpublic toJSON(): unknown {\n\t\t// This override causes the class instance to `JSON.stringify` as `[a, b]` rather than `{0: a, 1: b}`.\n\t\treturn Array.from(this as unknown as TreeArrayNode);\n\t}\n\n\t// Instances of this class are used as the dispatch object for the proxy,\n\t// and thus its set of keys is used to implement `has` (for the `in` operator) for the non-numeric cases.\n\t// Therefore it must include `length`,\n\t// even though this \"length\" is never invoked (due to being shadowed by the proxy provided own property).\n\tpublic get length(): number {\n\t\treturn fail(0xadb /* Proxy should intercept length */);\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>> {\n\t\treturn this.values();\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic get [Symbol.unscopables]() {\n\t\t// This might not be the exact right set of values, but it only matters for `with` clauses which are deprecated and are banned in strict mode, so it shouldn't matter much.\n\t\t// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/with for details.\n\t\treturn Array.prototype[Symbol.unscopables];\n\t}\n\n\tpublic at(\n\t\tthis: TreeArrayNode<T>,\n\t\tindex: number,\n\t): TreeNodeFromImplicitAllowedTypes<T> | undefined {\n\t\tconst field = getSequenceField(this);\n\t\tconst val = field.boxedAt(index);\n\n\t\tif (val === undefined) {\n\t\t\treturn val;\n\t\t}\n\n\t\treturn getOrCreateNodeFromInnerNode(val) as TreeNodeFromImplicitAllowedTypes<T>;\n\t}\n\tpublic insertAt(index: number, ...value: Insertable<T>): void {\n\t\tconst field = getSequenceField(this);\n\t\tvalidateIndex(index, field, \"insertAt\", true);\n\t\tconst content = this.#mapTreesFromFieldData(value);\n\t\tfield.editor.insert(index, content);\n\t}\n\tpublic insertAtStart(...value: Insertable<T>): void {\n\t\tthis.insertAt(0, ...value);\n\t}\n\tpublic insertAtEnd(...value: Insertable<T>): void {\n\t\tthis.insertAt(this.length, ...value);\n\t}\n\tpublic removeAt(index: number): void {\n\t\tconst field = getSequenceField(this);\n\t\tvalidateIndex(index, field, \"removeAt\");\n\t\tfield.editor.remove(index, 1);\n\t}\n\tpublic removeRange(start?: number, end?: number): void {\n\t\tconst field = getSequenceField(this);\n\t\tconst { length } = field;\n\t\tconst removeStart = start ?? 0;\n\t\tconst removeEnd = Math.min(length, end ?? length);\n\t\tvalidatePositiveIndex(removeStart);\n\t\tvalidatePositiveIndex(removeEnd);\n\t\tif (removeEnd < removeStart) {\n\t\t\t// This catches both the case where start is > array.length and when start is > end.\n\t\t\tthrow new UsageError('Too large of \"start\" value passed to TreeArrayNode.removeRange.');\n\t\t}\n\t\tfield.editor.remove(removeStart, removeEnd - removeStart);\n\t}\n\tpublic moveToStart(sourceIndex: number, source?: ReadonlyArrayNode): void {\n\t\tconst sourceArray = source ?? this;\n\t\tconst sourceField = getSequenceField(sourceArray);\n\t\tvalidateIndex(sourceIndex, sourceField, \"moveToStart\");\n\t\tthis.moveRangeToIndex(0, sourceIndex, sourceIndex + 1, source);\n\t}\n\tpublic moveToEnd(sourceIndex: number, source?: ReadonlyArrayNode): void {\n\t\tconst sourceArray = source ?? this;\n\t\tconst sourceField = getSequenceField(sourceArray);\n\t\tvalidateIndex(sourceIndex, sourceField, \"moveToEnd\");\n\t\tthis.moveRangeToIndex(this.length, sourceIndex, sourceIndex + 1, source);\n\t}\n\tpublic moveToIndex(\n\t\tdestinationGap: number,\n\t\tsourceIndex: number,\n\t\tsource?: ReadonlyArrayNode,\n\t): void {\n\t\tconst sourceArray = source ?? this;\n\t\tconst sourceField = getSequenceField(sourceArray);\n\t\tconst destinationField = getSequenceField(this);\n\t\tvalidateIndex(destinationGap, destinationField, \"moveToIndex\", true);\n\t\tvalidateIndex(sourceIndex, sourceField, \"moveToIndex\");\n\t\tthis.moveRangeToIndex(destinationGap, sourceIndex, sourceIndex + 1, source);\n\t}\n\tpublic moveRangeToStart(\n\t\tsourceStart: number,\n\t\tsourceEnd: number,\n\t\tsource?: ReadonlyArrayNode,\n\t): void {\n\t\tvalidateIndexRange(\n\t\t\tsourceStart,\n\t\t\tsourceEnd,\n\t\t\tsource ?? getSequenceField(this),\n\t\t\t\"moveRangeToStart\",\n\t\t);\n\t\tthis.moveRangeToIndex(0, sourceStart, sourceEnd, source);\n\t}\n\tpublic moveRangeToEnd(\n\t\tsourceStart: number,\n\t\tsourceEnd: number,\n\t\tsource?: ReadonlyArrayNode,\n\t): void {\n\t\tvalidateIndexRange(\n\t\t\tsourceStart,\n\t\t\tsourceEnd,\n\t\t\tsource ?? getSequenceField(this),\n\t\t\t\"moveRangeToEnd\",\n\t\t);\n\t\tthis.moveRangeToIndex(this.length, sourceStart, sourceEnd, source);\n\t}\n\tpublic moveRangeToIndex(\n\t\tdestinationGap: number,\n\t\tsourceStart: number,\n\t\tsourceEnd: number,\n\t\tsource?: ReadonlyArrayNode,\n\t): void {\n\t\tconst destinationField = getSequenceField(this);\n\t\tconst destinationSchema = this.allowedTypes;\n\t\tconst sourceField = source !== undefined ? getSequenceField(source) : destinationField;\n\n\t\tvalidateIndex(destinationGap, destinationField, \"moveRangeToIndex\", true);\n\t\tvalidateIndexRange(sourceStart, sourceEnd, source ?? destinationField, \"moveRangeToIndex\");\n\n\t\t// TODO: determine support for move across different sequence types\n\t\tif (sourceField !== destinationField) {\n\t\t\tfor (let i = sourceStart; i < sourceEnd; i++) {\n\t\t\t\tconst sourceNode = sourceField.boxedAt(i) ?? oob();\n\t\t\t\tconst sourceSchema = getSimpleNodeSchemaFromInnerNode(sourceNode);\n\t\t\t\tif (!destinationSchema.has(sourceSchema)) {\n\t\t\t\t\tthrow new UsageError(\"Type in source sequence is not allowed in destination.\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst movedCount = sourceEnd - sourceStart;\n\t\tif (!destinationField.context.isHydrated()) {\n\t\t\tif (!(sourceField instanceof UnhydratedSequenceField)) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot move elements from a hydrated array to an unhydrated array.\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (sourceField.context.isHydrated()) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot move elements from an unhydrated array to a hydrated array.\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (sourceField !== destinationField || destinationGap < sourceStart) {\n\t\t\t\tdestinationField.editor.insert(\n\t\t\t\t\tdestinationGap,\n\t\t\t\t\tsourceField.editor.remove(sourceStart, movedCount),\n\t\t\t\t);\n\t\t\t} else if (destinationGap > sourceStart + movedCount) {\n\t\t\t\tdestinationField.editor.insert(\n\t\t\t\t\tdestinationGap - movedCount,\n\t\t\t\t\tsourceField.editor.remove(sourceStart, movedCount),\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tif (!sourceField.context.isHydrated()) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot move elements from an unhydrated array to a hydrated array.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (sourceField.context !== destinationField.context) {\n\t\t\t\tthrow new UsageError(\"Cannot move elements between two different TreeViews.\");\n\t\t\t}\n\n\t\t\tdestinationField.context.checkout.editor.move(\n\t\t\t\tsourceField.getFieldPath(),\n\t\t\t\tsourceStart,\n\t\t\t\tmovedCount,\n\t\t\t\tdestinationField.getFieldPath(),\n\t\t\t\tdestinationGap,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic values(): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>> {\n\t\treturn this.generateValues(getKernel(this).generationNumber);\n\t}\n\tprivate *generateValues(\n\t\tinitialLastUpdatedStamp: number,\n\t): Generator<TreeNodeFromImplicitAllowedTypes<T>> {\n\t\tconst kernel = getKernel(this);\n\t\tif (initialLastUpdatedStamp !== kernel.generationNumber) {\n\t\t\tthrow new UsageError(`Concurrent editing and iteration is not allowed.`);\n\t\t}\n\t\tfor (let i = 0; i < this.length; i++) {\n\t\t\tyield this.at(i) ?? fail(0xadc /* Index is out of bounds */);\n\t\t\tif (initialLastUpdatedStamp !== kernel.generationNumber) {\n\t\t\t\tthrow new UsageError(`Concurrent editing and iteration is not allowed.`);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n *\n * @param name - Unique identifier for this schema including the factory's scope.\n * @param persistedMetadata - Optional persisted metadata for the object node schema.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function arraySchema<\n\tTName extends string,\n\tconst T extends ImplicitAnnotatedAllowedTypes,\n\tconst ImplicitlyConstructable extends boolean,\n\tconst TCustomMetadata = unknown,\n>(\n\tidentifier: TName,\n\tinfo: T,\n\timplicitlyConstructable: ImplicitlyConstructable,\n\tcustomizable: boolean,\n\tmetadata?: NodeSchemaMetadata<TCustomMetadata>,\n\tpersistedMetadata?: JsonCompatibleReadOnlyObject | undefined,\n) {\n\ttype Output = ArrayNodeCustomizableSchema<\n\t\tTName,\n\t\tT,\n\t\tImplicitlyConstructable,\n\t\tTCustomMetadata\n\t> &\n\t\tArrayNodePojoEmulationSchema<TName, T, ImplicitlyConstructable, TCustomMetadata>;\n\n\tconst unannotatedTypes = unannotateImplicitAllowedTypes(info);\n\n\tconst lazyChildTypes = new Lazy(() => normalizeAllowedTypes(unannotatedTypes));\n\tconst lazyAnnotatedTypes = new Lazy(() => [normalizeAnnotatedAllowedTypes(info)]);\n\tconst lazyAllowedTypesIdentifiers = new Lazy(\n\t\t() => new Set([...lazyChildTypes.value].map((type) => type.identifier)),\n\t);\n\n\tlet unhydratedContext: Context;\n\n\t// This class returns a proxy from its constructor to handle numeric indexing.\n\t// Alternatively it could extend a normal class which gets tons of numeric properties added.\n\tclass Schema extends CustomArrayNodeBase<UnannotateImplicitAllowedTypes<T>> {\n\t\tpublic static override prepareInstance<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tflexNode: FlexTreeNode,\n\t\t): TreeNodeValid<T2> {\n\t\t\tconst proxyTarget = customizable ? instance : [];\n\n\t\t\tif (customizable) {\n\t\t\t\t// Since proxy reports this as a \"non-configurable\" property, it must exist on the underlying object used as the proxy target, not as an inherited property.\n\t\t\t\t// This should not get used as the proxy should intercept all use.\n\t\t\t\tObject.defineProperty(instance, \"length\", {\n\t\t\t\t\tvalue: Number.NaN,\n\t\t\t\t\twritable: true,\n\t\t\t\t\tenumerable: false,\n\t\t\t\t\tconfigurable: false,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn createArrayNodeProxy(customizable, proxyTarget, instance) as unknown as Schema;\n\t\t}\n\n\t\tpublic static override buildRawNode<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tinput: T2,\n\t\t): UnhydratedFlexTreeNode {\n\t\t\treturn unhydratedFlexTreeFromInsertable(input as object, this as typeof Schema);\n\t\t}\n\n\t\tpublic static get allowedTypesIdentifiers(): ReadonlySet<string> {\n\t\t\treturn lazyAllowedTypesIdentifiers.value;\n\t\t}\n\n\t\tprotected static override constructorCached: MostDerivedData | undefined = undefined;\n\n\t\tprotected static override oneTimeSetup<T2>(this: typeof TreeNodeValid<T2>): Context {\n\t\t\tconst schema = this as unknown as TreeNodeSchema;\n\t\t\tunhydratedContext = getUnhydratedContext(schema);\n\n\t\t\t// First run, do extra validation.\n\t\t\t// TODO: provide a way for TreeConfiguration to trigger this same validation to ensure it gets run early.\n\t\t\t// Scan for shadowing inherited members which won't work, but stop scan early to allow shadowing built in (which seems to work ok).\n\t\t\t{\n\t\t\t\tlet prototype: object = this.prototype;\n\t\t\t\t// There isn't a clear cleaner way to author this loop.\n\t\t\t\twhile (prototype !== Schema.prototype) {\n\t\t\t\t\t// Search prototype keys and check for positive integers. Throw if any are found.\n\t\t\t\t\t// Shadowing of index properties on array nodes is not supported.\n\t\t\t\t\tfor (const key of Object.getOwnPropertyNames(prototype)) {\n\t\t\t\t\t\tconst maybeIndex = asIndex(key, Number.POSITIVE_INFINITY);\n\t\t\t\t\t\tif (maybeIndex !== undefined) {\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t`Schema ${identifier} defines an inherited index property \"${key.toString()}\" which shadows a possible array index. Shadowing of array indices is not permitted.`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Since this stops at the array node base schema, it should never see a null prototype, so this case is safe.\n\t\t\t\t\t// Additionally, if the prototype chain is ever messed up such that the array base schema is not in it,\n\t\t\t\t\t// the null that would show up here does at least ensure this code throws instead of hanging.\n\t\t\t\t\tprototype = Reflect.getPrototypeOf(prototype) as object;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn unhydratedContext;\n\t\t}\n\n\t\tpublic static readonly identifier = identifier;\n\t\tpublic static readonly info = info;\n\t\tpublic static readonly implicitlyConstructable: ImplicitlyConstructable =\n\t\t\timplicitlyConstructable;\n\t\tpublic static get childTypes(): ReadonlySet<TreeNodeSchema> {\n\t\t\treturn lazyChildTypes.value;\n\t\t}\n\t\tpublic static get childAnnotatedAllowedTypes(): readonly NormalizedAnnotatedAllowedTypes[] {\n\t\t\treturn lazyAnnotatedTypes.value;\n\t\t}\n\t\tpublic static readonly metadata: NodeSchemaMetadata<TCustomMetadata> = metadata ?? {};\n\t\tpublic static readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined =\n\t\t\tpersistedMetadata;\n\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tpublic get [typeNameSymbol](): TName {\n\t\t\treturn identifier;\n\t\t}\n\t\tpublic get [typeSchemaSymbol](): Output {\n\t\t\treturn Schema.constructorCached?.constructor as unknown as Output;\n\t\t}\n\n\t\tprotected get simpleSchema(): UnannotateImplicitAllowedTypes<T> {\n\t\t\treturn unannotatedTypes;\n\t\t}\n\t\tprotected get allowedTypes(): ReadonlySet<TreeNodeSchema> {\n\t\t\treturn lazyChildTypes.value;\n\t\t}\n\t}\n\n\tconst output: Output = Schema;\n\treturn output;\n}\n\nfunction validateSafeInteger(index: number): void {\n\tif (!Number.isSafeInteger(index)) {\n\t\tthrow new UsageError(`Expected a safe integer, got ${index}.`);\n\t}\n}\n\nfunction validatePositiveIndex(index: number): void {\n\tvalidateSafeInteger(index);\n\tif (index < 0) {\n\t\tthrow new UsageError(`Expected non-negative index, got ${index}.`);\n\t}\n}\n\nfunction validateIndex(\n\tindex: number,\n\tarray: { readonly length: number },\n\tmethodName: string,\n\tallowOnePastEnd: boolean = false,\n): void {\n\tvalidatePositiveIndex(index);\n\tif (allowOnePastEnd) {\n\t\tif (index > array.length) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Index value passed to TreeArrayNode.${methodName} is out of bounds.`,\n\t\t\t);\n\t\t}\n\t} else {\n\t\tif (index >= array.length) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Index value passed to TreeArrayNode.${methodName} is out of bounds.`,\n\t\t\t);\n\t\t}\n\t}\n}\n\nfunction validateIndexRange(\n\tstartIndex: number,\n\tendIndex: number,\n\tarray: { readonly length: number },\n\tmethodName: string,\n): void {\n\tvalidateIndex(startIndex, array, methodName, true);\n\tvalidateIndex(endIndex, array, methodName, true);\n\tif (startIndex > endIndex || array.length < endIndex) {\n\t\tthrow new UsageError(\n\t\t\t`Index value passed to TreeArrayNode.${methodName} is out of bounds.`,\n\t\t);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"arrayNode.js","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/array/arrayNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAEH,kEAAsE;AACtE,uEAAsE;AAEtE,qDAAkD;AAMlD,kEAA8E;AAC9E,kDAmC6B;AAC7B,mGAKmD;AACnD,yEAA+E;AAC/E,6DAGgC;AAOhC,qDAAkF;AAClF,+DAAqD;AA0WrD;;;GAGG;AACU,QAAA,aAAa,GAAG;IAC5B;;;;;;;;;OASG;IACH,MAAM,EAAE,CAAI,OAAoB,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC;CAC3C,CAAC;AAEX;;;GAGG;AACH,IAAI,MAAgE,CAAC;AAErE;;;;GAIG;AACH,MAAa,wBAAwB;IAKpC,YAAqC,OAAoB;QAApB,YAAO,GAAP,OAAO,CAAa;IAAG,CAAC;IAE7D;;OAEG;IACI,CAAC,MAAM,CAAC,QAAQ,CAAC;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;IACxC,CAAC;CACD;AAbD,4DAaC;AAZA;IACC,MAAM,GAAG,CAAK,OAAqB,EAAE,EAAE,CAAC,IAAI,wBAAwB,CAAC,OAAO,CAAC,CAAC;AAC/E,CAAC,GAAA,CAAA;AAYF;;GAEG;AACH,SAAS,gBAAgB,CAAC,SAA4B;IACrD,OAAO,IAAA,+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QACN;YACC,IAAI,EAAE,IAAA,gBAAK,EAAC,MAAM,CAAC,UAAU,CAAC;SAC9B;QACD,IAAI,GAAG,CAAC,aAAa,CAAC;KACtB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,wBAAwB,CAChC,IAAoB,EACpB,MAAuB;IAEvB,IAAI,IAAA,sBAAW,EAAC,IAAI,CAAC,EAAE,CAAC;QACvB,OAAO,6BAAkB,CAAC,IAAI,CAAC;IAChC,CAAC;IAED,IAAI,IAAI,YAAY,GAAG,EAAE,CAAC;QACzB,4KAA4K;QAC5K,OAAO,6BAAkB,CAAC,GAAG,CAAC;IAC/B,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC;QAC7B,OAAO,6BAAkB,CAAC,MAAM,CAAC;IAClC,CAAC;IAED,OAAO,6BAAkB,CAAC,IAAI,CAAC;AAChC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Lazy, oob, fail } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { EmptyKey } from \"../../../core/index.js\";\nimport type {\n\tFlexibleFieldContent,\n\tFlexTreeNode,\n\tFlexTreeSequenceField,\n} from \"../../../feature-libraries/index.js\";\nimport { FieldKinds, isTreeValue } from \"../../../feature-libraries/index.js\";\nimport {\n\tCompatibilityLevel,\n\ttype WithType,\n\t// eslint-disable-next-line import/no-deprecated\n\ttypeNameSymbol,\n\tNodeKind,\n\ttype TreeNode,\n\ttype InternalTreeNode,\n\ttype TreeNodeSchema,\n\ttypeSchemaSymbol,\n\tgetOrCreateNodeFromInnerNode,\n\tgetSimpleNodeSchemaFromInnerNode,\n\tgetOrCreateInnerNode,\n\ttype TreeNodeSchemaClass,\n\tgetKernel,\n\ttype UnhydratedFlexTreeNode,\n\tUnhydratedSequenceField,\n\tgetOrCreateNodeFromInnerUnboxedNode,\n\tnormalizeAllowedTypes,\n\tunannotateImplicitAllowedTypes,\n\ttype ImplicitAllowedTypes,\n\ttype ImplicitAnnotatedAllowedTypes,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype NodeSchemaMetadata,\n\ttype TreeLeafValue,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype UnannotateImplicitAllowedTypes,\n\tTreeNodeValid,\n\ttype MostDerivedData,\n\ttype TreeNodeSchemaInitializedData,\n\ttype TreeNodeSchemaCorePrivate,\n\tprivateDataSymbol,\n\tcreateTreeNodeSchemaPrivateData,\n\ttype FlexContent,\n\ttype TreeNodeSchemaPrivateData,\n} from \"../../core/index.js\";\nimport {\n\ttype FactoryContent,\n\ttype InsertableContent,\n\tunhydratedFlexTreeFromInsertable,\n\tunhydratedFlexTreeFromInsertableNode,\n} from \"../../unhydratedFlexTreeFromInsertable.js\";\nimport { prepareArrayContentForInsertion } from \"../../prepareForInsertion.js\";\nimport {\n\tgetTreeNodeSchemaInitializedData,\n\tgetUnhydratedContext,\n} from \"../../createContext.js\";\nimport type { System_Unsafe } from \"../../api/index.js\";\nimport type {\n\tArrayNodeCustomizableSchema,\n\tArrayNodePojoEmulationSchema,\n\tArrayNodeSchema,\n} from \"./arrayNodeTypes.js\";\nimport { brand, type JsonCompatibleReadOnlyObject } from \"../../../util/index.js\";\nimport { nullSchema } from \"../../leafNodeSchema.js\";\n\n/**\n * A covariant base type for {@link (TreeArrayNode:interface)}.\n *\n * This provides the readonly subset of TreeArrayNode functionality, and is used as the source interface for moves since that needs to be covariant.\n * @privateRemarks\n * Ideally this would just include `TreeNode, WithType<string, NodeKind.Array>` in the extends list but https://github.com/microsoft/TypeScript/issues/16936 prevents that from compiling.\n * As a workaround around for this TypeScript limitation, the conflicting type intersection is wrapped in `Awaited` (which has no effect on the type in this case) which allows it to compile.\n * @system @sealed @public\n */\nexport interface ReadonlyArrayNode<out T = TreeNode | TreeLeafValue>\n\textends ReadonlyArray<T>,\n\t\tAwaited<TreeNode & WithType<string, NodeKind.Array>> {}\n\n/**\n * A {@link TreeNode} which implements 'readonly T[]' and the array mutation APIs.\n *\n * @typeParam TAllowedTypes - Schema for types which are allowed as members of this array.\n * @typeParam T - Use Default: Do not specify. Type of values to read from the array.\n * @typeParam TNew - Use Default: Do not specify. Type of values to write into the array.\n * @typeParam TMoveFrom - Use Default: Do not specify. Type of node from which children can be moved into this array.\n *\n * @sealed @public\n */\nexport interface TreeArrayNode<\n\tTAllowedTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe = ImplicitAllowedTypes,\n\tout T = [TAllowedTypes] extends [ImplicitAllowedTypes]\n\t\t? TreeNodeFromImplicitAllowedTypes<TAllowedTypes>\n\t\t: TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>,\n\tin TNew = [TAllowedTypes] extends [ImplicitAllowedTypes]\n\t\t? InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes>\n\t\t: InsertableTreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>,\n\tin TMoveFrom = ReadonlyArrayNode,\n> extends ReadonlyArrayNode<T> {\n\t/**\n\t * Inserts new item(s) at a specified location.\n\t * @param index - The index at which to insert `value`.\n\t * @param value - The content to insert.\n\t * @throws Throws if `index` is not in the range [0, `array.length`).\n\t */\n\tinsertAt(index: number, ...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;\n\n\t/**\n\t * Inserts new item(s) at the start of the array.\n\t * @param value - The content to insert.\n\t */\n\tinsertAtStart(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;\n\n\t/**\n\t * Inserts new item(s) at the end of the array.\n\t * @param value - The content to insert.\n\t */\n\tinsertAtEnd(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;\n\n\t/**\n\t * Removes the item at the specified location.\n\t * @param index - The index at which to remove the item.\n\t * @throws Throws if `index` is not in the range [0, `array.length`).\n\t */\n\tremoveAt(index: number): void;\n\n\t/**\n\t * Removes all items between the specified indices.\n\t * @param start - The starting index of the range to remove (inclusive). Defaults to the start of the array.\n\t * @param end - The ending index of the range to remove (exclusive). Defaults to `array.length`.\n\t * @throws Throws if `start` is not in the range [0, `array.length`].\n\t * @throws Throws if `end` is less than `start`.\n\t * If `end` is not supplied or is greater than the length of the array, all items after `start` are removed.\n\t *\n\t * @remarks\n\t * The default values for start and end are computed when this is called,\n\t * and thus the behavior is the same as providing them explicitly, even with respect to merge resolution with concurrent edits.\n\t * For example, two concurrent transactions both emptying the array with `node.removeRange()` then inserting an item,\n\t * will merge to result in the array having both inserted items.\n\t */\n\tremoveRange(start?: number, end?: number): void;\n\n\t/**\n\t * Moves the specified item to the start of the array.\n\t * @param sourceIndex - The index of the item to move.\n\t * @throws Throws if `sourceIndex` is not in the range [0, `array.length`).\n\t */\n\tmoveToStart(sourceIndex: number): void;\n\n\t/**\n\t * Moves the specified item to the start of the array.\n\t * @param sourceIndex - The index of the item to move.\n\t * @param source - The source array to move the item out of.\n\t * @throws Throws if `sourceIndex` is not in the range [0, `array.length`).\n\t */\n\tmoveToStart(sourceIndex: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified item to the end of the array.\n\t * @param sourceIndex - The index of the item to move.\n\t * @throws Throws if `sourceIndex` is not in the range [0, `array.length`).\n\t */\n\tmoveToEnd(sourceIndex: number): void;\n\n\t/**\n\t * Moves the specified item to the end of the array.\n\t * @param sourceIndex - The index of the item to move.\n\t * @param source - The source array to move the item out of.\n\t * @throws Throws if `sourceIndex` is not in the range [0, `array.length`).\n\t */\n\tmoveToEnd(sourceIndex: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified item to the desired location in the array.\n\t *\n\t * WARNING - This API is easily misused.\n\t * Please read the documentation for the `destinationGap` parameter carefully.\n\t *\n\t * @param destinationGap - The location *between* existing items that the moved item should be moved to.\n\t *\n\t * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.\n\t *\n\t * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:\n\t *\n\t * - `0` (between the start of the array and `A`'s original position)\n\t *\n\t * - `1` (between `A`'s original position and `B`'s original position)\n\t *\n\t * - `2` (between `B`'s original position and `C`'s original position)\n\t *\n\t * - `3` (between `C`'s original position and the end of the array)\n\t *\n\t * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.\n\t *\n\t * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,\n\t * or relative to the start or end of the array:\n\t *\n\t * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)\n\t *\n\t * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`\n\t *\n\t * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)\n\t *\n\t * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)\n\t *\n\t * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:\n\t *\n\t * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`\n\t *\n\t * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`\n\t *\n\t * Notice the asymmetry between `-1` and `+2` in the above examples.\n\t * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:\n\t * If items A and B are adjacent, such that A precedes B,\n\t * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.\n\t *\n\t * @param sourceIndex - The index of the item to move.\n\t * @throws Throws if any of the input indices are not in the range [0, `array.length`).\n\t */\n\tmoveToIndex(destinationGap: number, sourceIndex: number): void;\n\n\t/**\n\t * Moves the specified item to the desired location in the array.\n\t *\n\t * WARNING - This API is easily misused.\n\t * Please read the documentation for the `destinationGap` parameter carefully.\n\t *\n\t * @param destinationGap - The location *between* existing items that the moved item should be moved to.\n\t *\n\t * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.\n\t *\n\t * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:\n\t *\n\t * - `0` (between the start of the array and `A`'s original position)\n\t *\n\t * - `1` (between `A`'s original position and `B`'s original position)\n\t *\n\t * - `2` (between `B`'s original position and `C`'s original position)\n\t *\n\t * - `3` (between `C`'s original position and the end of the array)\n\t *\n\t * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.\n\t *\n\t * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,\n\t * or relative to the start or end of the array:\n\t *\n\t * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)\n\t *\n\t * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`\n\t *\n\t * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)\n\t *\n\t * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)\n\t *\n\t * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:\n\t *\n\t * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`\n\t *\n\t * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`\n\t *\n\t * Notice the asymmetry between `-1` and `+2` in the above examples.\n\t * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:\n\t * If items A and B are adjacent, such that A precedes B,\n\t * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.\n\t *\n\t * @param sourceIndex - The index of the item to move.\n\t * @param source - The source array to move the item out of.\n\t * @throws Throws if any of the source index is not in the range [0, `array.length`),\n\t * or if the index is not in the range [0, `array.length`].\n\t */\n\tmoveToIndex(destinationGap: number, sourceIndex: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified items to the start of the array.\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @throws Throws if either of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToStart(sourceStart: number, sourceEnd: number): void;\n\n\t/**\n\t * Moves the specified items to the start of the array.\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @param source - The source array to move items out of.\n\t * @throws Throws if the types of any of the items being moved are not allowed in the destination array,\n\t * if either of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToStart(sourceStart: number, sourceEnd: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified items to the end of the array.\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @throws Throws if either of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToEnd(sourceStart: number, sourceEnd: number): void;\n\n\t/**\n\t * Moves the specified items to the end of the array.\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @param source - The source array to move items out of.\n\t * @throws Throws if the types of any of the items being moved are not allowed in the destination array,\n\t * if either of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToEnd(sourceStart: number, sourceEnd: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified items to the desired location within the array.\n\t *\n\t * WARNING - This API is easily misused.\n\t * Please read the documentation for the `destinationGap` parameter carefully.\n\t *\n\t * @param destinationGap - The location *between* existing items that the moved item should be moved to.\n\t *\n\t * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.\n\t *\n\t * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:\n\t *\n\t * - `0` (between the start of the array and `A`'s original position)\n\t *\n\t * - `1` (between `A`'s original position and `B`'s original position)\n\t *\n\t * - `2` (between `B`'s original position and `C`'s original position)\n\t *\n\t * - `3` (between `C`'s original position and the end of the array)\n\t *\n\t * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.\n\t *\n\t * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,\n\t * or relative to the start or end of the array:\n\t *\n\t * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)\n\t *\n\t * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`\n\t *\n\t * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)\n\t *\n\t * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)\n\t *\n\t * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:\n\t *\n\t * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`\n\t *\n\t * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`\n\t *\n\t * Notice the asymmetry between `-1` and `+2` in the above examples.\n\t * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:\n\t * If items A and B are adjacent, such that A precedes B,\n\t * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.\n\t *\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @throws Throws if any of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToIndex(destinationGap: number, sourceStart: number, sourceEnd: number): void;\n\n\t/**\n\t * Moves the specified items to the desired location within the array.\n\t *\n\t * WARNING - This API is easily misused.\n\t * Please read the documentation for the `destinationGap` parameter carefully.\n\t *\n\t * @param destinationGap - The location *between* existing items that the moved item should be moved to.\n\t *\n\t * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.\n\t *\n\t * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:\n\t *\n\t * - `0` (between the start of the array and `A`'s original position)\n\t *\n\t * - `1` (between `A`'s original position and `B`'s original position)\n\t *\n\t * - `2` (between `B`'s original position and `C`'s original position)\n\t *\n\t * - `3` (between `C`'s original position and the end of the array)\n\t *\n\t * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.\n\t *\n\t * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,\n\t * or relative to the start or end of the array:\n\t *\n\t * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)\n\t *\n\t * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`\n\t *\n\t * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)\n\t *\n\t * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)\n\t *\n\t * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:\n\t *\n\t * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`\n\t *\n\t * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`\n\t *\n\t * Notice the asymmetry between `-1` and `+2` in the above examples.\n\t * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:\n\t * If items A and B are adjacent, such that A precedes B,\n\t * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.\n\t *\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @param source - The source array to move items out of.\n\t * @throws Throws if the types of any of the items being moved are not allowed in the destination array,\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToIndex(\n\t\tdestinationGap: number,\n\t\tsourceStart: number,\n\t\tsourceEnd: number,\n\t\tsource: TMoveFrom,\n\t): void;\n\n\t/**\n\t * Returns a custom IterableIterator which throws usage errors if concurrent editing and iteration occurs.\n\t */\n\tvalues(): IterableIterator<T>;\n}\n\n/**\n * A {@link TreeNode} which implements 'readonly T[]' and the array mutation APIs.\n * @public\n */\nexport const TreeArrayNode = {\n\t/**\n\t * Wrap an iterable of items to inserted as consecutive items in a array.\n\t * @remarks\n\t * The object returned by this function can be inserted into a {@link (TreeArrayNode:interface)}.\n\t * Its contents will be inserted consecutively in the corresponding location in the array.\n\t * @example\n\t * ```ts\n\t * array.insertAtEnd(TreeArrayNode.spread(iterable))\n\t * ```\n\t */\n\tspread: <T>(content: Iterable<T>) => create(content),\n} as const;\n\n/**\n * Package internal construction API.\n * Use {@link (TreeArrayNode:variable).spread} to create an instance of this type instead.\n */\nlet create: <T>(content: Iterable<T>) => IterableTreeArrayContent<T>;\n\n/**\n * Used to insert iterable content into a {@link (TreeArrayNode:interface)}.\n * Use {@link (TreeArrayNode:variable).spread} to create an instance of this type.\n * @sealed @public\n */\nexport class IterableTreeArrayContent<T> implements Iterable<T> {\n\tstatic {\n\t\tcreate = <T2>(content: Iterable<T2>) => new IterableTreeArrayContent(content);\n\t}\n\n\tprivate constructor(private readonly content: Iterable<T>) {}\n\n\t/**\n\t * Iterates over content for nodes to insert.\n\t */\n\tpublic [Symbol.iterator](): Iterator<T> {\n\t\treturn this.content[Symbol.iterator]();\n\t}\n}\n\n/**\n * Given a array node proxy, returns its underlying LazySequence field.\n */\nfunction getSequenceField(arrayNode: ReadonlyArrayNode): FlexTreeSequenceField {\n\treturn getOrCreateInnerNode(arrayNode).getBoxed(EmptyKey) as FlexTreeSequenceField;\n}\n\n// For compatibility, we are initially implement 'readonly T[]' by applying the Array.prototype methods\n// to the array node proxy. Over time, we should replace these with efficient implementations on LazySequence\n// to avoid re-entering the proxy as these methods access 'length' and the indexed properties.\n//\n// For brevity, the current implementation dynamically builds a property descriptor map from a list of\n// Array functions we want to re-expose via the proxy.\n\nconst arrayPrototypeKeys = [\n\t\"concat\",\n\t\"entries\",\n\t\"every\",\n\t\"filter\",\n\t\"find\",\n\t\"findIndex\",\n\t\"flat\",\n\t\"flatMap\",\n\t\"forEach\",\n\t\"includes\",\n\t\"indexOf\",\n\t\"join\",\n\t\"keys\",\n\t\"lastIndexOf\",\n\t\"map\",\n\t\"reduce\",\n\t\"reduceRight\",\n\t\"slice\",\n\t\"some\",\n\t\"toLocaleString\",\n\t\"toString\",\n\n\t// \"copyWithin\",\n\t// \"fill\",\n\t// \"length\",\n\t// \"pop\",\n\t// \"push\",\n\t// \"reverse\",\n\t// \"shift\",\n\t// \"sort\",\n\t// \"splice\",\n\t// \"unshift\",\n] as const;\n\n/**\n * {@link TreeNodeValid}, but modified to add members from Array.prototype named in {@link arrayPrototypeKeys}.\n * @privateRemarks\n * Since a lot of scratch types and values are involved with creating this,\n * it's generating using an immediately invoked function expression (IIFE).\n * This is a common JavaScript pattern for cases like this to avoid cluttering the scope.\n */\nconst TreeNodeWithArrayFeatures = (() => {\n\t/**\n\t * {@link TreeNodeValid}, but modified to add members from Array.prototype named in {@link arrayPrototypeKeys}.\n\t */\n\tabstract class TreeNodeWithArrayFeaturesUntyped<\n\t\tconst T extends ImplicitAllowedTypes,\n\t> extends TreeNodeValid<Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>> {}\n\n\t// Modify TreeNodeWithArrayFeaturesUntyped to add the members from Array.prototype\n\tarrayPrototypeKeys.forEach((key) => {\n\t\tObject.defineProperty(TreeNodeWithArrayFeaturesUntyped.prototype, key, {\n\t\t\tvalue: Array.prototype[key],\n\t\t});\n\t});\n\n\treturn TreeNodeWithArrayFeaturesUntyped as unknown as typeof NodeWithArrayFeatures;\n})();\n\n/**\n * Type of {@link TreeNodeValid}, but with array members added to the instance type.\n *\n * TypeScript has a rule that `Base constructors must all have the same return type.ts(2510)`.\n * This means that intersecting two types with different constructors to create a type with a more constrained constructor (ex: more specific return type)\n * is not supported.\n *\n * TypeScript also has a limitation that there is no way to replace or remove just the constructor of a type without losing all the private and protected members.\n * See https://github.com/microsoft/TypeScript/issues/35416 for details.\n *\n * TypeScript also does not support explicitly specifying the instance type in a class definition as the constructor return type.\n *\n * Thus to replace the instance type, while preserving the protected static members of TreeNodeValid,\n * the only option seems to be actually declaring a class with all the members explicitly inline.\n *\n * To avoid incurring any bundle size / runtime overhead from this and having to stub out the function bodies,\n * the class uses `declare`.\n * TypeScript does not support `declare` inside scopes, so this is not inside the function scope above.\n *\n * The members of this class were generated using the \"implement interface\" refactoring.\n * Since that refactoring does not add `public`, the lint to require it is disabled for this section of the file.\n * To update this class delete all members and reapply the \"implement interface\" refactoring.\n * As these signatures get formatted to be over three times as many lines with prettier (which is not helpful), it is also suppressed.\n */\n/* eslint-disable @typescript-eslint/explicit-member-accessibility, @typescript-eslint/no-explicit-any */\n// prettier-ignore\ndeclare abstract class NodeWithArrayFeatures<Input, T>\n\textends TreeNodeValid<Input>\n\timplements Pick<readonly T[], (typeof arrayPrototypeKeys)[number]>\n{\n\tconcat(...items: ConcatArray<T>[]): T[];\n\tconcat(...items: (T | ConcatArray<T>)[]): T[];\n\tentries(): IterableIterator<[number, T]>;\n\tevery<S extends T>(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => value is S,\n\t\tthisArg?: any,\n\t): this is readonly S[];\n\tevery(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): boolean;\n\tfilter<S extends T>(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => value is S,\n\t\tthisArg?: any,\n\t): S[];\n\tfilter(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): T[];\n\tfind<S extends T>(\n\t\tpredicate: (value: T, index: number, obj: readonly T[]) => value is S,\n\t\tthisArg?: any,\n\t): S | undefined;\n\tfind(\n\t\tpredicate: (value: T, index: number, obj: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): T | undefined;\n\tfindIndex(\n\t\tpredicate: (value: T, index: number, obj: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): number;\n\tflat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];\n\tflatMap<U, This = undefined>(\n\t\tcallback: (this: This, value: T, index: number, array: T[]) => U | readonly U[],\n\t\tthisArg?: This | undefined,\n\t): U[];\n\tforEach(\n\t\tcallbackfn: (value: T, index: number, array: readonly T[]) => void,\n\t\tthisArg?: any,\n\t): void;\n\tincludes(searchElement: T, fromIndex?: number | undefined): boolean;\n\tindexOf(searchElement: T, fromIndex?: number | undefined): number;\n\tjoin(separator?: string | undefined): string;\n\tkeys(): IterableIterator<number>;\n\tlastIndexOf(searchElement: T, fromIndex?: number | undefined): number;\n\tmap<U>(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[];\n\treduce(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: T,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => T,\n\t): T;\n\treduce(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: T,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => T,\n\t\tinitialValue: T,\n\t): T;\n\treduce<U>(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: U,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => U,\n\t\tinitialValue: U,\n\t): U;\n\treduceRight(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: T,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => T,\n\t): T;\n\treduceRight(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: T,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => T,\n\t\tinitialValue: T,\n\t): T;\n\treduceRight<U>(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: U,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => U,\n\t\tinitialValue: U,\n\t): U;\n\tslice(start?: number | undefined, end?: number | undefined): T[];\n\tsome(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): boolean;\n\ttoLocaleString(): string;\n\ttoString(): string;\n}\n/* eslint-enable @typescript-eslint/explicit-member-accessibility, @typescript-eslint/no-explicit-any */\n\n/**\n * Attempts to coerce the given property key to an integer index property.\n * @param key - The property key to coerce.\n * @param exclusiveMax - This restricts the range in which the resulting index is allowed to be.\n * The coerced index of `key` must be less than `exclusiveMax` or else this function will return `undefined`.\n * This is useful for reading an array within the bounds of its length, e.g. `asIndex(key, array.length)`.\n */\nexport function asIndex(key: string | symbol, exclusiveMax: number): number | undefined {\n\tif (typeof key !== \"string\") {\n\t\treturn undefined;\n\t}\n\n\t// TODO: It may be worth a '0' <= ch <= '9' check before calling 'Number' to quickly\n\t// reject 'length' as an index, or even parsing integers ourselves.\n\tconst asNumber = Number(key);\n\tif (!Number.isInteger(asNumber)) {\n\t\treturn undefined;\n\t}\n\n\t// Check that the original string is the same after converting to a number and back again.\n\t// This prevents keys like \"5.0\", \"0x5\", \" 5\" from coercing to 5, and keys like \" \" or \"\" from coercing to 0.\n\tconst asString = String(asNumber);\n\tif (asString !== key) {\n\t\treturn undefined;\n\t}\n\n\t// TODO: See 'matrix/range.ts' for fast integer coercing + range check.\n\treturn 0 <= asNumber && asNumber < exclusiveMax ? asNumber : undefined;\n}\n\n/**\n * Create a proxy which implements the {@link TreeArrayNode} API.\n * @param allowAdditionalProperties - If true, setting of unexpected properties will be forwarded to the target object.\n * Otherwise setting of unexpected properties will error.\n * @param proxyTarget - Target object of the proxy. Must provide an own `length` value property\n * (which is not used but must exist for getOwnPropertyDescriptor invariants) and the array functionality from {@link arrayNodePrototype}.\n * Controls the prototype exposed by the produced proxy.\n * @param dispatchTarget - provides the functionally of the node, implementing all fields.\n */\nfunction createArrayNodeProxy(\n\tallowAdditionalProperties: boolean,\n\tproxyTarget: object,\n\tdispatchTarget: object,\n): TreeArrayNode {\n\t// To satisfy 'deepEquals' level scrutiny, the target of the proxy must be an array literal in order\n\t// to pass 'Object.getPrototypeOf'. It also satisfies 'Array.isArray' and 'Object.prototype.toString'\n\t// requirements without use of Array[Symbol.species], which is potentially on a path to deprecation.\n\tconst proxy: TreeArrayNode = new Proxy<TreeArrayNode>(proxyTarget as TreeArrayNode, {\n\t\tget: (target, key, receiver) => {\n\t\t\tconst field = getSequenceField(receiver);\n\t\t\tconst maybeIndex = asIndex(key, field.length);\n\n\t\t\tif (maybeIndex === undefined) {\n\t\t\t\tif (key === \"length\") {\n\t\t\t\t\treturn field.length;\n\t\t\t\t}\n\n\t\t\t\t// In NodeJS 22, assert.strict.deepEqual started special casing well known constructors like Array.\n\t\t\t\t// That made this necessary, ensuring that in POJO mode, TreeArrayNode are still deepEqual to arrays.\n\t\t\t\tif (key === \"constructor\") {\n\t\t\t\t\treturn proxyTarget.constructor;\n\t\t\t\t}\n\n\t\t\t\t// Pass the proxy as the receiver here, so that any methods on\n\t\t\t\t// the prototype receive `proxy` as `this`.\n\t\t\t\treturn Reflect.get(dispatchTarget, key, receiver) as unknown;\n\t\t\t}\n\n\t\t\tconst maybeContent = field.at(maybeIndex);\n\t\t\treturn maybeContent === undefined\n\t\t\t\t? undefined\n\t\t\t\t: getOrCreateNodeFromInnerUnboxedNode(maybeContent);\n\t\t},\n\t\tset: (target, key, newValue, receiver) => {\n\t\t\tif (key === \"length\") {\n\t\t\t\t// To allow \"length\" to look like \"length\" on an array, getOwnPropertyDescriptor has to report it as a writable value.\n\t\t\t\t// This means the proxy target must provide a length value, but since it can't use getters and setters, it can't be correct.\n\t\t\t\t// Therefor length has to be handled in this proxy.\n\t\t\t\t// Since it's not actually mutable, return false so setting it will produce a type error.\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// 'Symbol.isConcatSpreadable' may be set on an Array instance to modify the behavior of\n\t\t\t// the concat method. We allow this property to be added to the dispatch object.\n\t\t\tif (key === Symbol.isConcatSpreadable) {\n\t\t\t\treturn Reflect.set(dispatchTarget, key, newValue, receiver);\n\t\t\t}\n\n\t\t\t// Array nodes treat all non-negative integer indexes as array access.\n\t\t\t// Using Infinity here (rather than length) ensures that indexing past the end doesn't create additional session local properties.\n\t\t\tconst maybeIndex = asIndex(key, Number.POSITIVE_INFINITY);\n\t\t\tif (maybeIndex !== undefined) {\n\t\t\t\t// For MVP, we otherwise disallow setting properties (mutation is only available via the array node mutation APIs).\n\t\t\t\t// To ensure a clear and actionable error experience, we will throw explicitly here, rather than just returning false.\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot set indexed properties on array nodes. Use array node mutation APIs to alter the array.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn allowAdditionalProperties ? Reflect.set(target, key, newValue, receiver) : false;\n\t\t},\n\t\thas: (target, key) => {\n\t\t\tconst field = getSequenceField(proxy);\n\t\t\tconst maybeIndex = asIndex(key, field.length);\n\t\t\treturn maybeIndex !== undefined || Reflect.has(dispatchTarget, key);\n\t\t},\n\t\townKeys: (target) => {\n\t\t\tconst field = getSequenceField(proxy);\n\n\t\t\t// TODO: Would a lazy iterator to produce the indexes work / be more efficient?\n\t\t\t// TODO: Need to surface 'Symbol.isConcatSpreadable' as an own key.\n\t\t\tconst keys: (string | symbol)[] = Array.from(\n\t\t\t\t{ length: field.length },\n\t\t\t\t(_, index) => `${index}`,\n\t\t\t);\n\n\t\t\tif (allowAdditionalProperties) {\n\t\t\t\tkeys.push(...Reflect.ownKeys(target));\n\t\t\t} else {\n\t\t\t\tkeys.push(\"length\");\n\t\t\t}\n\t\t\treturn keys;\n\t\t},\n\t\tgetOwnPropertyDescriptor: (target, key) => {\n\t\t\tconst field = getSequenceField(proxy);\n\t\t\tconst maybeIndex = asIndex(key, field.length);\n\t\t\tif (maybeIndex !== undefined) {\n\t\t\t\tconst val = field.at(maybeIndex);\n\t\t\t\t// To satisfy 'deepEquals' level scrutiny, the property descriptor for indexed properties must\n\t\t\t\t// be a simple value property (as opposed to using getter) and declared writable/enumerable/configurable.\n\t\t\t\treturn {\n\t\t\t\t\tvalue: val === undefined ? undefined : getOrCreateNodeFromInnerUnboxedNode(val),\n\t\t\t\t\twritable: true, // For MVP, setting indexed properties is reported as allowed here (for deep equals compatibility noted above), but not actually supported.\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t};\n\t\t\t} else if (key === \"length\") {\n\t\t\t\t// To satisfy 'deepEquals' level scrutiny, the property descriptor for 'length' must be a simple\n\t\t\t\t// value property (as opposed to using getter) and be declared writable / non-configurable.\n\t\t\t\treturn {\n\t\t\t\t\tvalue: field.length,\n\t\t\t\t\twritable: true,\n\t\t\t\t\tenumerable: false,\n\t\t\t\t\tconfigurable: false,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn Reflect.getOwnPropertyDescriptor(dispatchTarget, key);\n\t\t},\n\t\tdefineProperty(target, key, attributes) {\n\t\t\tconst maybeIndex = asIndex(key, Number.POSITIVE_INFINITY);\n\t\t\tif (maybeIndex !== undefined) {\n\t\t\t\tthrow new UsageError(\"Shadowing of array indices is not permitted.\");\n\t\t\t}\n\t\t\treturn Reflect.defineProperty(dispatchTarget, key, attributes);\n\t\t},\n\t});\n\treturn proxy;\n}\n\ntype Insertable<T extends ImplicitAllowedTypes> = readonly (\n\t| InsertableTreeNodeFromImplicitAllowedTypes<T>\n\t| IterableTreeArrayContent<InsertableTreeNodeFromImplicitAllowedTypes<T>>\n)[];\n\nabstract class CustomArrayNodeBase<const T extends ImplicitAllowedTypes>\n\textends TreeNodeWithArrayFeatures<\n\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\tTreeNodeFromImplicitAllowedTypes<T>\n\t>\n\timplements TreeArrayNode<T>\n{\n\t// Indexing must be provided by subclass.\n\t[k: number]: TreeNodeFromImplicitAllowedTypes<T>;\n\n\tpublic static readonly kind = NodeKind.Array;\n\n\tprotected abstract get simpleSchema(): T;\n\tprotected abstract get allowedTypes(): ReadonlySet<TreeNodeSchema>;\n\n\tpublic abstract override get [typeSchemaSymbol](): TreeNodeSchemaClass<\n\t\tstring,\n\t\tNodeKind.Array\n\t>;\n\n\tpublic constructor(\n\t\tinput?: Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>> | InternalTreeNode,\n\t) {\n\t\tsuper(input ?? []);\n\t}\n\n\t#mapTreesFromFieldData(value: Insertable<T>): FlexibleFieldContent {\n\t\tconst sequenceField = getSequenceField(this);\n\t\tconst content = value as readonly (\n\t\t\t| InsertableContent\n\t\t\t| IterableTreeArrayContent<InsertableContent>\n\t\t)[];\n\n\t\tconst contentArray = content.flatMap((c): InsertableContent[] =>\n\t\t\tc instanceof IterableTreeArrayContent ? Array.from(c) : [c],\n\t\t);\n\t\tconst mapTrees = prepareArrayContentForInsertion(\n\t\t\tcontentArray,\n\t\t\tthis.simpleSchema,\n\t\t\tsequenceField.context,\n\t\t);\n\n\t\treturn mapTrees;\n\t}\n\n\tpublic toJSON(): unknown {\n\t\t// This override causes the class instance to `JSON.stringify` as `[a, b]` rather than `{0: a, 1: b}`.\n\t\treturn Array.from(this as unknown as TreeArrayNode);\n\t}\n\n\t// Instances of this class are used as the dispatch object for the proxy,\n\t// and thus its set of keys is used to implement `has` (for the `in` operator) for the non-numeric cases.\n\t// Therefore it must include `length`,\n\t// even though this \"length\" is never invoked (due to being shadowed by the proxy provided own property).\n\tpublic get length(): number {\n\t\treturn fail(0xadb /* Proxy should intercept length */);\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>> {\n\t\treturn this.values();\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic get [Symbol.unscopables]() {\n\t\t// This might not be the exact right set of values, but it only matters for `with` clauses which are deprecated and are banned in strict mode, so it shouldn't matter much.\n\t\t// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/with for details.\n\t\treturn Array.prototype[Symbol.unscopables];\n\t}\n\n\tpublic at(\n\t\tthis: TreeArrayNode<T>,\n\t\tindex: number,\n\t): TreeNodeFromImplicitAllowedTypes<T> | undefined {\n\t\tconst field = getSequenceField(this);\n\t\tconst val = field.boxedAt(index);\n\n\t\tif (val === undefined) {\n\t\t\treturn val;\n\t\t}\n\n\t\treturn getOrCreateNodeFromInnerNode(val) as TreeNodeFromImplicitAllowedTypes<T>;\n\t}\n\tpublic insertAt(index: number, ...value: Insertable<T>): void {\n\t\tconst field = getSequenceField(this);\n\t\tvalidateIndex(index, field, \"insertAt\", true);\n\t\tconst content = this.#mapTreesFromFieldData(value);\n\t\tfield.editor.insert(index, content);\n\t}\n\tpublic insertAtStart(...value: Insertable<T>): void {\n\t\tthis.insertAt(0, ...value);\n\t}\n\tpublic insertAtEnd(...value: Insertable<T>): void {\n\t\tthis.insertAt(this.length, ...value);\n\t}\n\tpublic removeAt(index: number): void {\n\t\tconst field = getSequenceField(this);\n\t\tvalidateIndex(index, field, \"removeAt\");\n\t\tfield.editor.remove(index, 1);\n\t}\n\tpublic removeRange(start?: number, end?: number): void {\n\t\tconst field = getSequenceField(this);\n\t\tconst { length } = field;\n\t\tconst removeStart = start ?? 0;\n\t\tconst removeEnd = Math.min(length, end ?? length);\n\t\tvalidatePositiveIndex(removeStart);\n\t\tvalidatePositiveIndex(removeEnd);\n\t\tif (removeEnd < removeStart) {\n\t\t\t// This catches both the case where start is > array.length and when start is > end.\n\t\t\tthrow new UsageError('Too large of \"start\" value passed to TreeArrayNode.removeRange.');\n\t\t}\n\t\tfield.editor.remove(removeStart, removeEnd - removeStart);\n\t}\n\tpublic moveToStart(sourceIndex: number, source?: ReadonlyArrayNode): void {\n\t\tconst sourceArray = source ?? this;\n\t\tconst sourceField = getSequenceField(sourceArray);\n\t\tvalidateIndex(sourceIndex, sourceField, \"moveToStart\");\n\t\tthis.moveRangeToIndex(0, sourceIndex, sourceIndex + 1, source);\n\t}\n\tpublic moveToEnd(sourceIndex: number, source?: ReadonlyArrayNode): void {\n\t\tconst sourceArray = source ?? this;\n\t\tconst sourceField = getSequenceField(sourceArray);\n\t\tvalidateIndex(sourceIndex, sourceField, \"moveToEnd\");\n\t\tthis.moveRangeToIndex(this.length, sourceIndex, sourceIndex + 1, source);\n\t}\n\tpublic moveToIndex(\n\t\tdestinationGap: number,\n\t\tsourceIndex: number,\n\t\tsource?: ReadonlyArrayNode,\n\t): void {\n\t\tconst sourceArray = source ?? this;\n\t\tconst sourceField = getSequenceField(sourceArray);\n\t\tconst destinationField = getSequenceField(this);\n\t\tvalidateIndex(destinationGap, destinationField, \"moveToIndex\", true);\n\t\tvalidateIndex(sourceIndex, sourceField, \"moveToIndex\");\n\t\tthis.moveRangeToIndex(destinationGap, sourceIndex, sourceIndex + 1, source);\n\t}\n\tpublic moveRangeToStart(\n\t\tsourceStart: number,\n\t\tsourceEnd: number,\n\t\tsource?: ReadonlyArrayNode,\n\t): void {\n\t\tvalidateIndexRange(\n\t\t\tsourceStart,\n\t\t\tsourceEnd,\n\t\t\tsource ?? getSequenceField(this),\n\t\t\t\"moveRangeToStart\",\n\t\t);\n\t\tthis.moveRangeToIndex(0, sourceStart, sourceEnd, source);\n\t}\n\tpublic moveRangeToEnd(\n\t\tsourceStart: number,\n\t\tsourceEnd: number,\n\t\tsource?: ReadonlyArrayNode,\n\t): void {\n\t\tvalidateIndexRange(\n\t\t\tsourceStart,\n\t\t\tsourceEnd,\n\t\t\tsource ?? getSequenceField(this),\n\t\t\t\"moveRangeToEnd\",\n\t\t);\n\t\tthis.moveRangeToIndex(this.length, sourceStart, sourceEnd, source);\n\t}\n\tpublic moveRangeToIndex(\n\t\tdestinationGap: number,\n\t\tsourceStart: number,\n\t\tsourceEnd: number,\n\t\tsource?: ReadonlyArrayNode,\n\t): void {\n\t\tconst destinationField = getSequenceField(this);\n\t\tconst destinationSchema = this.allowedTypes;\n\t\tconst sourceField = source !== undefined ? getSequenceField(source) : destinationField;\n\n\t\tvalidateIndex(destinationGap, destinationField, \"moveRangeToIndex\", true);\n\t\tvalidateIndexRange(sourceStart, sourceEnd, source ?? destinationField, \"moveRangeToIndex\");\n\n\t\t// TODO: determine support for move across different sequence types\n\t\tif (sourceField !== destinationField) {\n\t\t\tfor (let i = sourceStart; i < sourceEnd; i++) {\n\t\t\t\tconst sourceNode = sourceField.boxedAt(i) ?? oob();\n\t\t\t\tconst sourceSchema = getSimpleNodeSchemaFromInnerNode(sourceNode);\n\t\t\t\tif (!destinationSchema.has(sourceSchema)) {\n\t\t\t\t\tthrow new UsageError(\"Type in source sequence is not allowed in destination.\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst movedCount = sourceEnd - sourceStart;\n\t\tif (!destinationField.context.isHydrated()) {\n\t\t\tif (!(sourceField instanceof UnhydratedSequenceField)) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot move elements from a hydrated array to an unhydrated array.\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (sourceField.context.isHydrated()) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot move elements from an unhydrated array to a hydrated array.\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (sourceField !== destinationField || destinationGap < sourceStart) {\n\t\t\t\tdestinationField.editor.insert(\n\t\t\t\t\tdestinationGap,\n\t\t\t\t\tsourceField.editor.remove(sourceStart, movedCount),\n\t\t\t\t);\n\t\t\t} else if (destinationGap > sourceStart + movedCount) {\n\t\t\t\tdestinationField.editor.insert(\n\t\t\t\t\tdestinationGap - movedCount,\n\t\t\t\t\tsourceField.editor.remove(sourceStart, movedCount),\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tif (!sourceField.context.isHydrated()) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot move elements from an unhydrated array to a hydrated array.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (sourceField.context !== destinationField.context) {\n\t\t\t\tthrow new UsageError(\"Cannot move elements between two different TreeViews.\");\n\t\t\t}\n\n\t\t\tdestinationField.context.checkout.editor.move(\n\t\t\t\tsourceField.getFieldPath(),\n\t\t\t\tsourceStart,\n\t\t\t\tmovedCount,\n\t\t\t\tdestinationField.getFieldPath(),\n\t\t\t\tdestinationGap,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic values(): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>> {\n\t\treturn this.generateValues(getKernel(this).generationNumber);\n\t}\n\tprivate *generateValues(\n\t\tinitialLastUpdatedStamp: number,\n\t): Generator<TreeNodeFromImplicitAllowedTypes<T>> {\n\t\tconst kernel = getKernel(this);\n\t\tif (initialLastUpdatedStamp !== kernel.generationNumber) {\n\t\t\tthrow new UsageError(`Concurrent editing and iteration is not allowed.`);\n\t\t}\n\t\tfor (let i = 0; i < this.length; i++) {\n\t\t\tyield this.at(i) ?? fail(0xadc /* Index is out of bounds */);\n\t\t\tif (initialLastUpdatedStamp !== kernel.generationNumber) {\n\t\t\t\tthrow new UsageError(`Concurrent editing and iteration is not allowed.`);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n *\n * @param name - Unique identifier for this schema including the factory's scope.\n * @param persistedMetadata - Optional persisted metadata for the object node schema.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function arraySchema<\n\tTName extends string,\n\tconst T extends ImplicitAnnotatedAllowedTypes,\n\tconst ImplicitlyConstructable extends boolean,\n\tconst TCustomMetadata = unknown,\n>(\n\tidentifier: TName,\n\tinfo: T,\n\timplicitlyConstructable: ImplicitlyConstructable,\n\tcustomizable: boolean,\n\tmetadata?: NodeSchemaMetadata<TCustomMetadata>,\n\tpersistedMetadata?: JsonCompatibleReadOnlyObject | undefined,\n) {\n\ttype Output = ArrayNodeCustomizableSchema<\n\t\tTName,\n\t\tT,\n\t\tImplicitlyConstructable,\n\t\tTCustomMetadata\n\t> &\n\t\tArrayNodePojoEmulationSchema<TName, T, ImplicitlyConstructable, TCustomMetadata> &\n\t\tTreeNodeSchemaCorePrivate;\n\n\tconst unannotatedTypes = unannotateImplicitAllowedTypes(info);\n\n\tconst lazyChildTypes = new Lazy(() => normalizeAllowedTypes(unannotatedTypes));\n\tconst lazyAllowedTypesIdentifiers = new Lazy(\n\t\t() => new Set([...lazyChildTypes.value].map((type) => type.identifier)),\n\t);\n\n\tlet privateData: TreeNodeSchemaPrivateData | undefined;\n\n\t// This class returns a proxy from its constructor to handle numeric indexing.\n\t// Alternatively it could extend a normal class which gets tons of numeric properties added.\n\tclass Schema extends CustomArrayNodeBase<UnannotateImplicitAllowedTypes<T>> {\n\t\tpublic static override prepareInstance<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tflexNode: FlexTreeNode,\n\t\t): TreeNodeValid<T2> {\n\t\t\tconst proxyTarget = customizable ? instance : [];\n\n\t\t\tif (customizable) {\n\t\t\t\t// Since proxy reports this as a \"non-configurable\" property, it must exist on the underlying object used as the proxy target, not as an inherited property.\n\t\t\t\t// This should not get used as the proxy should intercept all use.\n\t\t\t\tObject.defineProperty(instance, \"length\", {\n\t\t\t\t\tvalue: Number.NaN,\n\t\t\t\t\twritable: true,\n\t\t\t\t\tenumerable: false,\n\t\t\t\t\tconfigurable: false,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn createArrayNodeProxy(customizable, proxyTarget, instance) as unknown as Schema;\n\t\t}\n\n\t\tpublic static override buildRawNode<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tinput: T2,\n\t\t): UnhydratedFlexTreeNode {\n\t\t\treturn unhydratedFlexTreeFromInsertable(input as object, this as typeof Schema);\n\t\t}\n\n\t\tpublic static get allowedTypesIdentifiers(): ReadonlySet<string> {\n\t\t\treturn lazyAllowedTypesIdentifiers.value;\n\t\t}\n\n\t\tprotected static override constructorCached: MostDerivedData | undefined = undefined;\n\n\t\tprotected static override oneTimeSetup(): TreeNodeSchemaInitializedData {\n\t\t\t// First run, do extra validation.\n\t\t\t// TODO: provide a way for TreeConfiguration to trigger this same validation to ensure it gets run early.\n\t\t\t// Scan for shadowing inherited members which won't work, but stop scan early to allow shadowing built in (which seems to work ok).\n\t\t\t{\n\t\t\t\tlet prototype: object = this.prototype;\n\t\t\t\t// There isn't a clear cleaner way to author this loop.\n\t\t\t\twhile (prototype !== Schema.prototype) {\n\t\t\t\t\t// Search prototype keys and check for positive integers. Throw if any are found.\n\t\t\t\t\t// Shadowing of index properties on array nodes is not supported.\n\t\t\t\t\tfor (const key of Object.getOwnPropertyNames(prototype)) {\n\t\t\t\t\t\tconst maybeIndex = asIndex(key, Number.POSITIVE_INFINITY);\n\t\t\t\t\t\tif (maybeIndex !== undefined) {\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t`Schema ${identifier} defines an inherited index property \"${key.toString()}\" which shadows a possible array index. Shadowing of array indices is not permitted.`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Since this stops at the array node base schema, it should never see a null prototype, so this case is safe.\n\t\t\t\t\t// Additionally, if the prototype chain is ever messed up such that the array base schema is not in it,\n\t\t\t\t\t// the null that would show up here does at least ensure this code throws instead of hanging.\n\t\t\t\t\tprototype = Reflect.getPrototypeOf(prototype) as object;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst schema = this as ArrayNodeSchema;\n\n\t\t\treturn getTreeNodeSchemaInitializedData(this, {\n\t\t\t\tshallowCompatibilityTest: (data: FactoryContent): CompatibilityLevel =>\n\t\t\t\t\tshallowCompatibilityTest(data, schema),\n\t\t\t\ttoFlexContent: (\n\t\t\t\t\tdata: FactoryContent,\n\t\t\t\t\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n\t\t\t\t): FlexContent => arrayToFlexContent(data, schema),\n\t\t\t});\n\t\t}\n\n\t\tpublic static readonly identifier = identifier;\n\t\tpublic static readonly info = info;\n\t\tpublic static readonly implicitlyConstructable: ImplicitlyConstructable =\n\t\t\timplicitlyConstructable;\n\t\tpublic static get childTypes(): ReadonlySet<TreeNodeSchema> {\n\t\t\treturn lazyChildTypes.value;\n\t\t}\n\t\tpublic static readonly metadata: NodeSchemaMetadata<TCustomMetadata> = metadata ?? {};\n\t\tpublic static readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined =\n\t\t\tpersistedMetadata;\n\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tpublic get [typeNameSymbol](): TName {\n\t\t\treturn identifier;\n\t\t}\n\t\tpublic get [typeSchemaSymbol](): Output {\n\t\t\treturn Schema.constructorCached?.constructor as unknown as Output;\n\t\t}\n\n\t\tprotected get simpleSchema(): UnannotateImplicitAllowedTypes<T> {\n\t\t\treturn unannotatedTypes;\n\t\t}\n\t\tprotected get allowedTypes(): ReadonlySet<TreeNodeSchema> {\n\t\t\treturn lazyChildTypes.value;\n\t\t}\n\n\t\tpublic static get [privateDataSymbol](): TreeNodeSchemaPrivateData {\n\t\t\treturn (privateData ??= createTreeNodeSchemaPrivateData(this, [info]));\n\t\t}\n\t}\n\n\tconst output: Output = Schema;\n\treturn output;\n}\n\nfunction validateSafeInteger(index: number): void {\n\tif (!Number.isSafeInteger(index)) {\n\t\tthrow new UsageError(`Expected a safe integer, got ${index}.`);\n\t}\n}\n\nfunction validatePositiveIndex(index: number): void {\n\tvalidateSafeInteger(index);\n\tif (index < 0) {\n\t\tthrow new UsageError(`Expected non-negative index, got ${index}.`);\n\t}\n}\n\nfunction validateIndex(\n\tindex: number,\n\tarray: { readonly length: number },\n\tmethodName: string,\n\tallowOnePastEnd: boolean = false,\n): void {\n\tvalidatePositiveIndex(index);\n\tif (allowOnePastEnd) {\n\t\tif (index > array.length) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Index value passed to TreeArrayNode.${methodName} is out of bounds.`,\n\t\t\t);\n\t\t}\n\t} else {\n\t\tif (index >= array.length) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Index value passed to TreeArrayNode.${methodName} is out of bounds.`,\n\t\t\t);\n\t\t}\n\t}\n}\n\nfunction validateIndexRange(\n\tstartIndex: number,\n\tendIndex: number,\n\tarray: { readonly length: number },\n\tmethodName: string,\n): void {\n\tvalidateIndex(startIndex, array, methodName, true);\n\tvalidateIndex(endIndex, array, methodName, true);\n\tif (startIndex > endIndex || array.length < endIndex) {\n\t\tthrow new UsageError(\n\t\t\t`Index value passed to TreeArrayNode.${methodName} is out of bounds.`,\n\t\t);\n\t}\n}\n\n/**\n * Transforms data for a child of an array.\n * @param child - The tree data to be transformed.\n * @param allowedTypes - The set of types allowed by the parent context. Used to validate the input tree.\n */\nfunction arrayChildToFlexTree(\n\tchild: InsertableContent,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n): UnhydratedFlexTreeNode {\n\t// We do not support undefined sequence entries.\n\t// If we encounter an undefined entry, use null instead if supported by the schema, otherwise throw.\n\tlet childWithFallback = child;\n\tif (child === undefined) {\n\t\tif (allowedTypes.has(nullSchema)) {\n\t\t\tchildWithFallback = null;\n\t\t} else {\n\t\t\tthrow new TypeError(`Received unsupported array entry value: ${child}.`);\n\t\t}\n\t}\n\treturn unhydratedFlexTreeFromInsertableNode(childWithFallback, allowedTypes);\n}\n\n/**\n * {@link TreeNodeSchemaInitializedData.toFlexContent} for Array nodes.\n *\n * @param data - The tree data to be transformed. Must be an iterable.\n * @param schema - The schema to comply with.\n */\nfunction arrayToFlexContent(data: FactoryContent, schema: ArrayNodeSchema): FlexContent {\n\tif (!(typeof data === \"object\" && data !== null && Symbol.iterator in data)) {\n\t\tthrow new UsageError(`Input data is incompatible with Array schema: ${data}`);\n\t}\n\n\tconst allowedChildTypes = normalizeAllowedTypes(schema.info as ImplicitAllowedTypes);\n\n\tconst mappedData = Array.from(data, (child) =>\n\t\tarrayChildToFlexTree(child, allowedChildTypes),\n\t);\n\n\tconst context = getUnhydratedContext(schema).flexContext;\n\n\t// Array nodes have a single `EmptyKey` field:\n\tconst fieldsEntries =\n\t\tmappedData.length === 0\n\t\t\t? []\n\t\t\t: ([\n\t\t\t\t\t[\n\t\t\t\t\t\tEmptyKey,\n\t\t\t\t\t\tnew UnhydratedSequenceField(\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tFieldKinds.sequence.identifier,\n\t\t\t\t\t\t\tEmptyKey,\n\t\t\t\t\t\t\tmappedData,\n\t\t\t\t\t\t),\n\t\t\t\t\t],\n\t\t\t\t] as const);\n\n\treturn [\n\t\t{\n\t\t\ttype: brand(schema.identifier),\n\t\t},\n\t\tnew Map(fieldsEntries),\n\t];\n}\n\n/**\n * {@link TreeNodeSchemaInitializedData.shallowCompatibilityTest} for Array nodes.\n */\nfunction shallowCompatibilityTest(\n\tdata: FactoryContent,\n\tschema: ArrayNodeSchema,\n): CompatibilityLevel {\n\tif (isTreeValue(data)) {\n\t\treturn CompatibilityLevel.None;\n\t}\n\n\tif (data instanceof Map) {\n\t\t// Maps are iterable, so type checking does allow constructing an ArrayNode from a map if the ArrayNode's type is an array that includes the key and value types of the map.\n\t\treturn CompatibilityLevel.Low;\n\t}\n\n\tif (Symbol.iterator in data) {\n\t\treturn CompatibilityLevel.Normal;\n\t}\n\n\treturn CompatibilityLevel.None;\n}\n"]}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { TreeArrayNode } from "./arrayNode.js";
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
6
|
+
import { NodeKind } from "../../core/index.js";
|
|
7
|
+
import type { TreeNodeSchemaClass, TreeNodeSchema, TreeNodeSchemaNonClass, WithType, ImplicitAnnotatedAllowedTypes, InsertableTreeNodeFromImplicitAllowedTypes, UnannotateImplicitAllowedTypes } from "../../core/index.js";
|
|
8
8
|
import type { SimpleArrayNodeSchema } from "../../simpleSchema.js";
|
|
9
9
|
/**
|
|
10
10
|
* A schema for customizable {@link (TreeArrayNode:interface)}s.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrayNodeTypes.d.ts","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/array/arrayNodeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"arrayNodeTypes.d.ts","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/array/arrayNodeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EACX,mBAAmB,EACnB,cAAc,EACd,sBAAsB,EACtB,QAAQ,EACR,6BAA6B,EAC7B,0CAA0C,EAC1C,8BAA8B,EAC9B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE;;;GAGG;AACH,MAAM,WAAW,2BAA2B,CAC3C,GAAG,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EACjC,EAAE,CAAC,GAAG,CAAC,CAAC,SAAS,6BAA6B,GAAG,6BAA6B,EAC9E,GAAG,CAAC,uBAAuB,SAAS,OAAO,GAAG,IAAI,EAClD,GAAG,CAAC,eAAe,GAAG,OAAO,CAC5B,SAAQ,mBAAmB,CAC1B,KAAK,EACL,QAAQ,CAAC,KAAK,EACd,aAAa,CAAC,8BAA8B,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,EACrF,QAAQ,CAAC,0CAA0C,CAAC,8BAA8B,CAAC,CAAC,CAAC,CAAC,CAAC,EACvF,uBAAuB,EACvB,CAAC,EACD,SAAS,EACT,eAAe,CACf,EACD,qBAAqB,CAAC,eAAe,CAAC;CAAG;AAE3C;;;GAGG;AACH,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