"use strict" ; export interface Event < T > { } export interface IItemExpandEvent { } export interface IItemCollapseEvent { } export interface INavigator < T > { } export interface Color { } export interface GestureEvent { } export interface DragMouseEvent { browserEvent : DragEvent ; } export interface ITree { onDidFocus : Event < void > ; onDidBlur : Event < void > ; onDidChangeFocus : Event < IFocusEvent > ; onDidChangeSelection : Event < ISelectionEvent > ; onDidChangeHighlight : Event < IHighlightEvent > ; onDidExpandItem : Event < IItemExpandEvent > ; onDidCollapseItem : Event < IItemCollapseEvent > ; onDidDispose : Event < void > ; /**
     * Returns the tree's DOM element.
     */ getHTMLElement ( ) : HTMLElement ; /**
     * Lays out the tree.
     * Provide a specific height to save an (expensive) height computation.
     */ layout ( height ? ) : void ; /**
     * Notifies the tree that is has become visible.
     */ onVisible ( ) : void ; /**
     * Notifies the tree that is has become hidden.
     */ onHidden ( ) : void ; /**
     * Sets the input of the tree.
     */ setInput ( element ) : monaco . Promise < any > ; /**
     * Returns the tree's input.
     */ getInput ( ) : any ; /**
     * Sets DOM focus on the tree.
     */ domFocus ( ) : void ; /**
     * Returns whether the tree has DOM focus.
     */ isDOMFocused ( ) : boolean ; /**
     * Removes DOM focus from the tree.
     */ domBlur ( ) : void ; /**
     * Refreshes an element.
     * Provide no arguments and it will refresh the input element.
     */ refresh ( element ? , recursive ? ) : monaco . Promise < any > ; /**
     * Expands an element.
     * The returned monaco.Promise returns a boolean for whether the element was expanded or not.
     */ expand ( element ) : monaco . Promise < any > ; /**
     * Collapses an element.
     * The returned monaco.Promise returns a boolean for whether the element was collapsed or not.
     */ collapse ( element , recursive ? ) : monaco . Promise < any > ; /**
     * Collapses several elements.
     * Collapses all elements at the greatest tree depth that has expanded elements.
     * The returned monaco.Promise returns a boolean for whether the elements were collapsed or not.
     */ collapseDeepestExpandedLevel ( ) : monaco . Promise < any > ; /**
     * Toggles an element's expansion state.
     */ toggleExpansion ( element , recursive ? ) : monaco . Promise < any > ; /**
     * Toggles several element's expansion state.
     */ toggleExpansionAll ( elements ) : monaco . Promise < any > ; /**
     * Returns whether an element is expanded or not.
     */ isExpanded ( element ) : boolean ; /**
     * Returns a list of the currently expanded elements.
     */ getExpandedElements ( ) : any [ ] ; /**
     * Reveals an element in the tree. The relativeTop is a value between 0 and 1. The closer to 0 the more the
     * element will scroll up to the top.
     */ reveal ( element , relativeTop ? ) : monaco . Promise < any > ; /**
     * Returns the relative top position of any given element, if visible.
     * If not visible, returns a negative number or a number > 1.
     * Useful when calling `reveal(element, relativeTop)`.
     */ getRelativeTop ( element ) : number ; /**
     * Returns a number between 0 and 1 representing how much the tree is scroll down. 0 means all the way
     * to the top; 1 means all the way down.
     */ getScrollPosition ( ) : number ; /**
     * Sets the scroll position with a number between 0 and 1 representing how much the tree is scroll down. 0 means all the way
     * to the top; 1 means all the way down.
     */ setScrollPosition ( pos ) : void ; /**
     * Returns the total height of the tree's content.
     */ getContentHeight ( ) : number ; /**
     * Sets the tree's highlight to be the given element.
     * Provide no arguments and it clears the tree's highlight.
     */ setHighlight ( element ? , eventPayload ? ) : void ; /**
     * Returns the currently highlighted element.
     */ getHighlight ( includeHidden ? ) : any ; /**
     * Returns whether an element is highlighted or not.
     */ isHighlighted ( element ) : boolean ; /**
     * Clears the highlight.
     */ clearHighlight ( eventPayload ? ) : void ; /**
     * Selects an element.
     */ select ( element , eventPayload ? ) : void ; /**
     * Selects a range of elements.
     */ selectRange ( fromElement , toElement , eventPayload ? ) : void ; /**
     * Deselects a range of elements.
     */ deselectRange ( fromElement , toElement , eventPayload ? ) : void ; /**
     * Selects several elements.
     */ selectAll ( elements , eventPayload ? ) : void ; /**
     * Deselects an element.
     */ deselect ( element , eventPayload ? ) : void ; /**
     * Deselects several elements.
     */ deselectAll ( elements , eventPayload ? ) : void ; /**
     * Replaces the current selection with the given elements.
     */ setSelection ( elements , eventPayload ? ) : void ; /**
     * Toggles the element's selection.
     */ toggleSelection ( element , eventPayload ? ) : void ; /**
     * Returns the currently selected elements.
     */ getSelection ( includeHidden ? ) : any [ ] ; /**
     * Returns whether an element is selected or not.
     */ isSelected ( element ) : boolean ; /**
     * Selects the next `count`-nth element, in visible order.
     */ selectNext ( count ? , clearSelection ? , eventPayload ? ) : void ; /**
     * Selects the previous `count`-nth element, in visible order.
     */ selectPrevious ( count ? , clearSelection ? , eventPayload ? ) : void ; /**
     * Selects the currently selected element's parent.
     */ selectParent ( clearSelection ? , eventPayload ? ) : void ; /**
     * Clears the selection.
     */ clearSelection ( eventPayload ? ) : void ; /**
     * Sets the focused element.
     */ setFocus ( element ? , eventPayload ? ) : void ; /**
     * Returns whether an element is focused or not.
     */ isFocused ( element ) : boolean ; /**
     * Returns focused element.
     */ getFocus ( includeHidden ? ) : any ; /**
     * Focuses the next `count`-nth element, in visible order.
     */ focusNext ( count ? , eventPayload ? ) : void ; /**
     * Focuses the previous `count`-nth element, in visible order.
     */ focusPrevious ( count ? , eventPayload ? ) : void ; /**
     * Focuses the currently focused element's parent.
     */ focusParent ( eventPayload ? ) : void ; /**
     * Focuses the first child of the currently focused element.
     */ focusFirstChild ( eventPayload ? ) : void ; /**
     * Focuses the second element, in visible order. Will focus the first
     * child from the provided element's parent if any.
     */ focusFirst ( eventPayload ? , from ? ) : void ; /**
     * Focuses the nth element, in visible order.
     */ focusNth ( index , eventPayload ? ) : void ; /**
     * Focuses the last element, in visible order. Will focus the last
     * child from the provided element's parent if any.
     */ focusLast ( eventPayload ? , from ? ) : void ; /**
     * Focuses the element at the end of the next page, in visible order.
     */ focusNextPage ( eventPayload ? ) : void ; /**
     * Focuses the element at the beginning of the previous page, in visible order.
     */ focusPreviousPage ( eventPayload ? ) : void ; /**
     * Clears the focus.
     */ clearFocus ( eventPayload ? ) : void ; /**
     * Adds the trait to elements.
     */ addTraits ( trait , elements ) : void ; /**
     * Removes the trait from elements.
     */ removeTraits ( trait , elements ) : void ; /**
     * Toggles the element's trait.
     */ toggleTrait ( trait , element ) : void ; /**
     * Returns whether the element has the trait or not.
     */ hasTrait ( trait , element ) : boolean ; /**
     * Returns a navigator which allows to discover the visible and
     * expanded elements in the tree.
     */ getNavigator ( fromElement ? , subTreeOnly ? ) : INavigator < any > ; /**
     * Apply styles to the tree.
     */ style ( styles ) : void ; /**
     * Disposes the tree
     */ dispose ( ) : void ; } export interface IDataSource { /**
     * Returns the unique identifier of the given element.
     * No more than one element may use a given identifier.
     */ getId ( tree , element ) : string ; /**
     * Returns a boolean value indicating whether the element has children.
     */ hasChildren ( tree , element ) : boolean ; /**
     * Returns the element's children as an array in a monaco.Promise.
     */ getChildren ( tree , element ) : monaco . Promise < any > ; /**
     * Returns the element's parent in a monaco.Promise.
     */ getParent ( tree , element ) : monaco . Promise < any > ; /**
     * Returns whether an element should be expanded when first added to the tree.
     */ shouldAutoexpand ? ( tree , element ) : boolean ; } export interface IRenderer { /**
     * Returns the element's height in the tree, in pixels.
     */ getHeight ( tree , element ) : number ; /**
     * Returns a template ID for a given element. This will be used as an identifier
     * for the next 3 methods.
     */ getTemplateId ( tree , element ) : string ; /**
     * Renders the template in a DOM element. This method should render all the DOM
     * structure for an hypothetical element leaving its contents blank. It should
     * return an object bag which will be passed along to `renderElement` and used
     * to fill in those blanks.
     *
     * You should do all DOM creating and object allocation in this method. It
     * will be called only a few times.
     */ renderTemplate ( tree , templateId , container ) : any ; /**
     * Renders an element, given an object bag returned by `renderTemplate`.
     * This method should do as little as possible and ideally it should only fill
     * in the blanks left by `renderTemplate`.
     *
     * Try to make this method do as little possible, since it will be called very
     * often.
     */ renderElement ( tree , element , templateId , templateData ) : void ; /**
     * Disposes a template that was once rendered.
     */ disposeTemplate ( tree , templateId , templateData ) : void ; } export interface IAccessibilityProvider { /**
     * Given an element in the tree, return the ARIA label that should be associated with the
     * item. This helps screen readers to provide a meaningful label for the currently focused
     * tree element.
     *
     * Returning null will not disable ARIA for the element. Instead it is up to the screen reader
     * to compute a meaningful label based on the contents of the element in the DOM
     *
     * See also: https://www.w3.org/TR/wai-aria/states_and_properties#aria-label
     */ getAriaLabel ( tree , element ) : string ; /**
     * Given an element in the tree return its aria-posinset. Should be between 1 and aria-setsize
     * https://www.w3.org/TR/wai-aria/states_and_properties#aria-posinset
     */ getPosInSet ? ( tree , element ) : string ; /**
     * Return the aria-setsize of the tree.
     * https://www.w3.org/TR/wai-aria/states_and_properties#aria-setsize
     */ getSetSize ? ( ) : string ; } export class ContextMenuEvent { public _posx : number ; public _posy : number ; private _target : HTMLElement ; constructor ( posx , posy , target ) { this . _posx = posx ; this . _posy = posy ; this . _target = target ; } public preventDefault ( ) { } public stopPropagation ( ) { } public get target ( ) : HTMLElement { return this . _target ; } } export class MouseContextMenuEvent extends ContextMenuEvent { private originalEvent : monaco . IMouseEvent ; constructor ( originalEvent ) { super ( originalEvent . posx , originalEvent . posy , originalEvent . target ) ; this . originalEvent = originalEvent ; } public preventDefault ( ) { this . originalEvent . preventDefault ( ) ; } public stopPropagation ( ) { this . originalEvent . stopPropagation ( ) ; } } export class KeyboardContextMenuEvent extends ContextMenuEvent { private originalEvent : monaco . IKeyboardEvent ; constructor ( posx , posy , originalEvent ) { super ( posx , posy , originalEvent . target ) ; this . originalEvent = originalEvent ; } public preventDefault ( ) { this . originalEvent . preventDefault ( ) ; } public stopPropagation ( ) { this . originalEvent . stopPropagation ( ) ; } } export interface IController { /**
     * Called when an element is clicked.
     */ onClick ( tree , element , event ) : boolean ; /**
     * Called when an element is requested for a context menu.
     */ onContextMenu ( tree , element , event ) : boolean ; /**
     * Called when an element is tapped.
     */ onTap ( tree , element , event ) : boolean ; /**
     * Called when a key is pressed down while selecting elements.
     */ onKeyDown ( tree , event ) : boolean ; /**
     * Called when a key is released while selecting elements.
     */ onKeyUp ( tree , event ) : boolean ; /**
     * Called when a mouse button is pressed down on an element.
     */ onMouseDown ? ( tree , element , event ) : boolean ; /**
     * Called when a mouse button goes up on an element.
     */ onMouseUp ? ( tree , element , event ) : boolean ; } export enum DragOverEffect { COPY , MOVE } export enum DragOverBubble { BUBBLE_DOWN , BUBBLE_UP } export interface IDragOverReaction { accept : boolean ; effect ? : DragOverEffect ; bubble ? : DragOverBubble ; autoExpand ? : boolean ; } export const DRAG_OVER_REJECT = { accept : false } ; export const DRAG_OVER_ACCEPT = { accept : true } ; export const DRAG_OVER_ACCEPT_BUBBLE_UP = { accept : true , bubble : DragOverBubble . BUBBLE_UP } ; export const DRAG_OVER_ACCEPT_BUBBLE_DOWN = ( autoExpand = false ) => ( { accept : true , bubble : DragOverBubble . BUBBLE_DOWN , autoExpand } ) ; export const DRAG_OVER_ACCEPT_BUBBLE_UP_COPY = { accept : true , bubble : DragOverBubble . BUBBLE_UP , effect : DragOverEffect . COPY } ; export const DRAG_OVER_ACCEPT_BUBBLE_DOWN_COPY = ( autoExpand = false ) => ( { accept : true , bubble : DragOverBubble . BUBBLE_DOWN , effect : DragOverEffect . COPY , autoExpand } ) ; export interface IDragAndDropData { update ( event ) : void ; elements : any [ ] ; } export interface IDragAndDrop { /**
     * Returns a uri if the given element should be allowed to drag.
     * Returns null, otherwise.
     */ getDragURI ( tree , element ) : string ; /**
     * Returns a label to display when dragging the element.
     */ getDragLabel ? ( tree , elements ) : string ; /**
     * Sent when the drag operation is starting.
     */ onDragStart ( tree , data , originalEvent ) : void ; /**
     * Returns a DragOverReaction indicating whether sources can be
     * dropped into target or some parent of the target.
     */ onDragOver ( tree , data , targetElement , originalEvent ) : IDragOverReaction ; /**
     * Handles the action of dropping sources into target.
     */ drop ( tree , data , targetElement , originalEvent ) : void ; } export interface IFilter { /**
     * Returns whether the given element should be visible.
     */ isVisible ( tree , element ) : boolean ; } export type IElementCallback = ( tree : ITree , element : any ) => void ; export type ICallback = ( ) => void ; export interface ISorter { /**
     * Compare two elements in the viewer to define the sorting order.
     */ compare ( tree , element , otherElement ) : number ; } export interface ISelectionEvent { selection : any [ ] ; payload ? : any ; } export interface IFocusEvent { focus : any ; payload ? : any ; } export interface IHighlightEvent { highlight : any ; payload ? : any ; } export interface ITreeConfiguration { dataSource : IDataSource ; renderer ? : IRenderer ; controller ? : IController ; dnd ? : IDragAndDrop ; filter ? : IFilter ; sorter ? : ISorter ; accessibilityProvider ? : IAccessibilityProvider ; } export interface ITreeOptions extends ITreeStyles { twistiePixels ? : number ; showTwistie ? : boolean ; indentPixels ? : number ; verticalScrollMode ? : monaco . editor . ScrollbarVisibility ; alwaysFocused ? : boolean ; autoExpandSingleChildren ? : boolean ; useShadows ? : boolean ; paddingOnRow ? : boolean ; ariaLabel ? : string ; keyboardSupport ? : boolean ; preventRootFocus ? : boolean ; } export interface ITreeStyles { listFocusBackground ? : Color ; listFocusForeground ? : Color ; listActiveSelectionBackground ? : Color ; listActiveSelectionForeground ? : Color ; listFocusAndSelectionBackground ? : Color ; listFocusAndSelectionForeground ? : Color ; listInactiveSelectionBackground ? : Color ; listInactiveSelectionForeground ? : Color ; listHoverBackground ? : Color ; listHoverForeground ? : Color ; listDropBackground ? : Color ; listFocusOutline ? : Color ; } export interface ITreeContext extends ITreeConfiguration { tree : ITree ; options : ITreeOptions ; }