11import { Optional } from '@stoplight/types' ;
2- import { DeprecatedTreeListNode , TreeListNode , TreeListParentNode } from '../types' ;
2+ import { DeprecatedTreeListNode , TreeFragment , TreeListNode , TreeListParentNode } from '../types' ;
33import { IndexLookup } from './cache' ;
44declare type Arrayish = Pick < typeof Array [ 'prototype' ] , 'indexOf' | 'every' > ;
55declare type Range = {
@@ -12,17 +12,18 @@ export interface ITreeIterationOptions {
1212 readonly expanded : ( ( node : TreeListParentNode ) => boolean ) | null ;
1313}
1414export declare class Tree implements Arrayish {
15- protected readonly tree : TreeListParentNode ;
1615 protected readonly iterationOptions : ITreeIterationOptions | null ;
17- root : TreeListParentNode ;
16+ protected readonly tree : TreeListParentNode ;
17+ protected _root : TreeListParentNode ;
18+ get root ( ) : import ( "../types" ) . ITreeListNodeWithChildren ;
1819 protected readonly indexLookup : IndexLookup < TreeListNode > ;
19- private readonly wrapped ;
20- private readonly sorted ;
21- private readonly filtered ;
20+ private wrapped ;
21+ private sorted ;
22+ private filtered ;
2223 private _count ;
2324 get count ( ) : number ;
2425 set count ( val : number ) ;
25- constructor ( tree : TreeListParentNode , iterationOptions ?: ITreeIterationOptions | null , cacheSize ?: number ) ;
26+ constructor ( iterationOptions ?: ITreeIterationOptions | null , tree ?: TreeListParentNode , cacheSize ?: number ) ;
2627 static getLevel ( node : TreeListNode ) : any ;
2728 static getDropZoneId ( node : TreeListNode ) : any ;
2829 clearCache ( ) : void ;
@@ -38,6 +39,8 @@ export declare class Tree implements Arrayish {
3839 static getOffsetForNode ( node : TreeListNode ) : number ;
3940 protected _itemAt ( node : TreeListParentNode , pos : number , boundaries : Range ) : Optional < TreeListNode > ;
4041 protected static readonly boundaries : Range ;
42+ private static getLastItem ;
43+ protected static getNodeIndex ( node : TreeListNode ) : number ;
4144 private static nextItem ;
4245 nextItem ( node : TreeListNode ) : Optional < TreeListNode > ;
4346 prevItem ( node : TreeListNode ) : Optional < TreeListNode > ;
@@ -51,10 +54,11 @@ export declare class Tree implements Arrayish {
5154 protected invalidateChildren ( node : TreeListParentNode ) : void ;
5255 wrap ( node : TreeListParentNode ) : void ;
5356 unwrap ( node : TreeListParentNode ) : void ;
54- moveNode ( node : TreeListNode , parentId : string | null ) : void ;
55- insertNode ( node : TreeListNode , parentId : string | null ) : void ;
56- insertTreeFragment ( fragment : TreeListNode [ ] , parentId : string | null ) : void ;
57+ moveNode ( node : TreeListNode , parent : TreeListParentNode ) : void ;
58+ insertNode ( node : TreeListNode , parent : TreeListParentNode ) : void ;
59+ insertTreeFragment ( fragment : TreeFragment , parent : TreeListParentNode ) : void ;
5760 removeNode ( node : TreeListNode ) : void ;
61+ replaceNode ( node : TreeListNode , newNode : TreeListNode ) : void ;
5862 protected getCount ( node : TreeListParentNode ) : any ;
5963 protected resetCounter ( node : TreeListParentNode ) : void ;
6064 protected processTreeFragment ( node : TreeListParentNode ) : number ;
0 commit comments