import { Events, EventHandle, Observer, History } from '@playcanvas/observer'; /** * The interface for bindable elements. */ interface IBindable { /** * Sets the value of the Element. */ set value(values: T); /** * Gets the value of the Element. */ get value(): T; /** * Sets multiple values on the Element. It is up to the Element to determine how to display them. */ set values(values: T[]); /** * Gets multiple values on the Element. */ get values(): T[]; /** * Sets whether the input should flash on changes. */ set renderChanges(value: boolean); /** * Gets whether the input should flash on changes. */ get renderChanges(): boolean; } /** * The interface for arguments for bindable elements. */ interface IBindableArgs { /** * Sets the value of the Element. */ value?: T; /** * Sets multiple values to the Element. It is up to the Element to determine how to display them. */ values?: T[]; /** * If `true` each input will flash on changes. */ renderChanges?: boolean; } /** * The interface for elements that have placeholder text. */ interface IPlaceholder { /** * Sets the placeholder text of the input. */ set placeholder(value: string); /** * Gets the placeholder text of the input. */ get placeholder(): string; } /** * The interface for arguments for elements that have placeholder text. */ interface IPlaceholderArgs { /** * Sets the placeholder label that appears on the right of the input. */ placeholder?: string; } /** * The interface for multi-value elements that have placeholder text for each value. */ interface IMultiPlaceholder { /** * Sets the placeholder text of the inputs. Can be a single string applied to all inputs, * or an array of strings for each input. */ set placeholder(value: string | string[]); /** * Gets the placeholder text of all inputs as an array. */ get placeholder(): string[]; } /** * The interface for arguments for multi-value elements that have placeholder text. */ interface IMultiPlaceholderArgs { /** * Placeholder text for the inputs. Can be a single string applied to all inputs, * or an array of strings for each input. */ placeholder?: string | string[]; } /** * The interface for elements that can be focused. */ interface IFocusable { /** * Focus on the element. If the input contains text and select is provided, the text will be selected on focus. */ focus(select?: boolean): void; /** * Unfocus the element */ blur(): void; } /** * The interface for arguments for elements that have children. The React wrappers that hold * children add a `children` prop to their own props, so that the core types don't depend on React. */ interface IParentArgs { } /** * The interface for flex-related CSS properties available on elements. * These properties do not themselves enable `display: flex`; flex layout is * configured separately (for example via `Container#flex`). */ interface IFlexArgs { /** * Sets the element's `flexBasis` CSS property. */ flexBasis?: string | number; /** * Sets the element's `flexDirection` CSS property. */ flexDirection?: string; /** * Sets the element's `flexGrow` CSS property. */ flexGrow?: string | number; /** * Sets the element's `flexShrink` CSS property. */ flexShrink?: string | number; /** * Sets the element's `flexWrap` CSS property. */ flexWrap?: string; /** * Sets the element's `alignItems` CSS property. */ alignItems?: string; /** * Sets the element's `alignSelf` CSS property. */ alignSelf?: string; /** * Sets the element's `justifyContent` CSS property. */ justifyContent?: string; /** * Sets the element's `justifySelf` CSS property. */ justifySelf?: string; } /** * The arguments for the {@link Element} constructor. */ type ChangeHandler = { bivarianceHack(value: T): void; }['bivarianceHack']; interface ElementArgs extends IFlexArgs { /** * The HTMLElement to create this {@link Element} with. If not provided this Element will create one. */ dom?: HTMLElement | string; /** * A binding to use with this {@link Element}. */ binding?: BindingBase; /** * If provided and the {@link Element} is clickable, this function will be called each time the element is clicked. */ onClick?: () => void; /** * If provided and the {@link Element} is changeable, this function will be called each time the element value is changed. */ onChange?: ChangeHandler; /** * If provided and the {@link Element} is removable, this function will be called each time the element is removed. */ onRemove?: () => void; /** * Sets the parent {@link Element}. */ parent?: Element$1; /** * Links the observer attribute at the path location in the given observer to this {@link Element}. */ link?: { observer: Observer[] | Observer; path: string[] | string; }; /** * The id attribute of this {@link Element}'s HTMLElement. */ id?: string; /** * The class attribute of this {@link Element}'s HTMLElement. */ class?: string | string[]; /** * Sets whether this {@link Element} is at the root of the hierarchy. */ isRoot?: boolean; /** * Sets whether it is possible to interact with this {@link Element} and its children. */ enabled?: boolean; /** * Sets whether this {@link Element} is hidden. Defaults to `false`. */ hidden?: boolean; /** * If `true`, this {@link Element} will ignore its parent's enabled value when determining whether this element is enabled. Defaults to `false`. */ ignoreParent?: boolean; /** * Sets the initial width of the {@link Element}. */ width?: number | null; /** * Sets the initial height of the {@link Element}. */ height?: number | null; /** * Sets the tabIndex of the {@link Element}. */ tabIndex?: number; /** * Sets whether the {@link Element} is in an error state. */ error?: boolean; /** * Sets an initial value for Element.dom.style. */ style?: string; /** * Whether this {@link Element} is read only or not. Defaults to `false`. */ readOnly?: boolean; } /** * The base class for all UI elements. */ declare class Element$1 extends Events { /** * Fired when the Element gets enabled. * * @event * @example * ```ts * const element = new Element(); * element.on('enable', () => { * console.log('Element enabled'); * }); * ``` */ static readonly EVENT_ENABLE = "enable"; /** * Fired when the Element gets disabled. * * @event * @example * ```ts * const element = new Element(); * element.on('disable', () => { * console.log('Element disabled'); * }); * ``` */ static readonly EVENT_DISABLE = "disable"; /** * Fired when the Element gets hidden. * * @event * @example * ```ts * const element = new Element(); * element.on('hide', () => { * console.log('Element hidden'); * }); * ``` */ static readonly EVENT_HIDE = "hide"; /** * Fired when the Element or any of its parent get hidden. * * @event * @example * ```ts * const element = new Element(); * element.on('hideToRoot', () => { * console.log('Element or one of its parents hidden'); * }); * ``` */ static readonly EVENT_HIDE_TO_ROOT = "hideToRoot"; /** * Fired when the Element stops being hidden. * * @event * @example * ```ts * const element = new Element(); * element.on('show', () => { * console.log('Element shown'); * }); * ``` */ static readonly EVENT_SHOW = "show"; /** * Fired when the Element and all of its parents become visible. * * @event * @example * ```ts * const element = new Element(); * element.on('showToRoot', () => { * console.log('Element and all of its parents shown'); * }); * ``` */ static readonly EVENT_SHOW_TO_ROOT = "showToRoot"; /** * Fired when the readOnly property of an Element changes. * * @event * @example * ```ts * const element = new Element(); * element.on('readOnly', (readOnly: boolean) => { * console.log(`Element is now ${readOnly ? 'read only' : 'editable'}`); * }); * ``` */ static readonly EVENT_READ_ONLY = "readOnly"; /** * Fired when the Element's parent gets set. * * @event * @example * ```ts * const element = new Element(); * element.on('parent', (parent: Element) => { * console.log(`Element's parent is now ${parent}`); * }); * ``` */ static readonly EVENT_PARENT = "parent"; /** * Fired when the mouse is clicked on the Element but only if the Element is enabled. The * native DOM MouseEvent is passed as a parameter to the event handler. * * @event * @example * ```ts * const element = new Element(); * element.on('click', (evt: MouseEvent) => { * console.log('Element clicked'); * }); * ``` */ static readonly EVENT_CLICK = "click"; /** * Fired when the mouse starts hovering on the Element. The native DOM MouseEvent is passed as a * parameter to the event handler. * * @event * @example * ```ts * const element = new Element(); * element.on('hover', (evt: MouseEvent) => { * console.log('Element hovered'); * }); * ``` */ static readonly EVENT_HOVER = "hover"; /** * Fired when the mouse stops hovering on the Element. The native DOM MouseEvent is passed as a * parameter to the event handler. * * @event * @example * ```ts * const element = new Element(); * element.on('hoverend', (evt: MouseEvent) => { * console.log('Element hover ended'); * }); * ``` */ static readonly EVENT_HOVER_END = "hoverend"; /** * Fired after the element has been destroyed. Both the DOM element and the owner Element * instance are passed as parameters to the event handler. * * @event * @example * ```ts * const element = new Element(); * element.on('destroy', (dom: HTMLElement, element: Element) => { * console.log('Element destroyed'); * }); * ``` */ static readonly EVENT_DESTROY = "destroy"; /** * Stores Element types by name and default arguments. */ private static registry; protected _destroyed: boolean; protected _parent: Element$1; protected _eventsParent: EventHandle[]; protected _dom: HTMLElement; protected _hiddenParents: boolean; protected _flashTimeout: number; protected _suppressChange: boolean; protected _binding: BindingBase; protected _ignoreParent: boolean; protected _enabled: boolean; protected _readOnly: boolean; protected _hidden: boolean; protected _hasError: boolean; protected _domContent: HTMLElement; protected _onClickEvt: (evt: Event) => void; /** * Creates a new Element. * * @param args - The arguments. */ constructor(args?: Readonly); /** * Destroys the Element and its events. */ destroy(): void; /** * Links the specified observers and paths to the Element's data binding. * * @param observers - An array of observers or a single observer. * @param paths - A path for the observer(s) or an array of paths that maps to each separate observer. */ link(observers: Observer | Observer[], paths: string | string[]): void; /** * Unlinks the Element from its observers. */ unlink(): void; /** * Triggers a flash animation on the Element. */ flash(): void; protected _onClick(evt: Event): void; protected _onMouseOver: (evt: MouseEvent) => void; protected _onMouseOut: (evt: MouseEvent) => void; protected _onHiddenToRootChange(hiddenToRoot: boolean): void; protected _onEnabledChange(enabled: boolean): void; protected _onParentDestroy(): void; protected _onParentDisable(): void; protected _onParentEnable(): void; protected _onParentShowToRoot(): void; protected _onParentHideToRoot(): void; protected _onReadOnlyChange(readOnly: boolean): void; protected _onParentReadOnlyChange(readOnly: boolean): void; /** * @param type - The type we want to reference this Element by. * @param cls - The actual class of the Element. * @param defaultArguments - Default arguments when creating this type. */ static register(type: string, cls: new () => Type, defaultArguments?: object): void; /** * @param type - The type we want to unregister. */ static unregister(type: string): void; /** * Creates a new Element of the desired type. * * @param type - The type of the Element (registered by Element#register). * @param args - Arguments for the Element. * @returns The new Element or undefined if type is not found. */ static create(type: string, args: ElementArgs): Type | undefined; /** * Sets whether the Element or its parent chain is enabled or not. Defaults to `true`. */ set enabled(value: boolean); /** * Gets whether the Element or its parent chain is enabled or not. */ get enabled(): boolean; /** * Sets whether the Element will ignore parent events & variable states. */ set ignoreParent(value: boolean); /** * Gets whether the Element will ignore parent events & variable states. */ get ignoreParent(): boolean; /** * Gets the root DOM node for this Element. */ get dom(): HTMLElement; /** * Sets the parent Element. */ set parent(value: Element$1); /** * Gets the parent Element. */ get parent(): Element$1; /** * Sets whether the Element is hidden. */ set hidden(value: boolean); /** * Gets whether the Element is hidden. */ get hidden(): boolean; /** * Gets whether the Element is hidden all the way up to the root. If the Element itself or any of its parents are hidden then this is true. */ get hiddenToRoot(): boolean; /** * Sets whether the Element is read only. */ set readOnly(value: boolean); /** * Gets whether the Element is read only. */ get readOnly(): boolean; /** * Sets whether the Element is in an error state. */ set error(value: boolean); /** * Gets whether the Element is in an error state. */ get error(): boolean; /** * Shortcut to Element.dom.style. */ get style(): CSSStyleDeclaration; /** * Get the `DOMTokenList` of the underlying DOM element. This is essentially a shortcut to * `element.dom.classList`. */ get class(): DOMTokenList; /** * Sets the width of the Element in pixels. Can also be an empty string to remove it. */ set width(value: number | string); /** * Gets the width of the Element in pixels. */ get width(): number; /** * Sets the height of the Element in pixels. Can also be an empty string to remove it. */ set height(value: number | string); /** * Gets the height of the Element in pixels. */ get height(): number; /** * Sets the tabIndex of the Element. */ set tabIndex(value: number); /** * Gets the tabIndex of the Element. */ get tabIndex(): number; /** * Sets the Binding object for the element. */ set binding(value: BindingBase); /** * Gets the Binding object for the element. */ get binding(): BindingBase; get destroyed(): boolean; /** * Sets the flex-direction CSS property. */ set flexDirection(value: string); /** * Gets the flex-direction CSS property. */ get flexDirection(): string; /** * Sets the flex-grow CSS property. */ set flexGrow(value: string | number); /** * Gets the flex-grow CSS property. */ get flexGrow(): string; /** * Sets the flex-basis CSS property. */ set flexBasis(value: string | number); /** * Gets the flex-basis CSS property. */ get flexBasis(): string; /** * Sets the flex-shrink CSS property. */ set flexShrink(value: string | number); /** * Gets the flex-shrink CSS property. */ get flexShrink(): string; /** * Sets the flex-wrap CSS property. */ set flexWrap(value: string); /** * Gets the flex-wrap CSS property. */ get flexWrap(): string; /** * Sets the align-items CSS property. */ set alignItems(value: string); /** * Gets the align-items CSS property. */ get alignItems(): string; /** * Sets the align-self CSS property. */ set alignSelf(value: string); /** * Gets the align-self CSS property. */ get alignSelf(): string; /** * Sets the justify-content CSS property. */ set justifyContent(value: string); /** * Gets the justify-content CSS property. */ get justifyContent(): string; /** * Sets the justify-self CSS property. */ set justifySelf(value: string); /** * Gets the justify-self CSS property. */ get justifySelf(): string; /** @ignore */ set disabled(value: boolean); /** @ignore */ get disabled(): boolean; /** @ignore */ set element(value: HTMLElement); /** @ignore */ get element(): HTMLElement; /** @ignore */ set innerElement(value: HTMLElement); /** @ignore */ get innerElement(): HTMLElement; } declare global { interface Node { ui: Element$1; } } /** * The interface for arguments for the {@link BindingBase} constructor. */ interface BindingBaseArgs { /** * The IBindable element. */ element?: IBindable; /** * The history object which will be used to record undo / redo actions. * If none is provided then no history will be recorded. */ history?: History; /** * A prefix that will be used for the name of every history action. */ historyPrefix?: string; /** * A postfix that will be used for the name of every history action. */ historyPostfix?: string; /** * The name of each history action. */ historyName?: string; /** * Whether to combine history actions. */ historyCombine?: boolean; } /** * Base class for data binding between {@link IBindable} {@link Element}s and Observers. */ declare class BindingBase extends Events { protected _observers: Observer[]; protected _paths: string[]; protected _applyingChange: boolean; protected _element?: IBindable; protected _history?: History; protected _historyPrefix?: string; protected _historyPostfix?: string; protected _historyName?: string; protected _historyCombine: boolean; protected _linked: boolean; /** * Creates a new binding. * * @param args - The arguments. */ constructor(args: Readonly); protected _pathAt(paths: string[], index: number): string; /** * Links the specified observers to the specified paths. * * @param observers - The observer(s). * @param paths - The path(s). The behavior of the binding depends on how many paths are passed. * If an equal amount of paths and observers are passed then the binding will map each path to each observer at each index. * If more observers than paths are passed then the path at index 0 will be used for all observers. * If one observer and multiple paths are passed then all of the paths will be used for the observer (e.g. for curves). */ link(observers: Observer | Observer[], paths: string | string[]): void; /** * Unlinks the observers and paths. */ unlink(): void; /** * Clones the binding. To be implemented by derived classes. */ clone(): BindingBase; /** * Sets a value to the linked observers at the linked paths. * * @param value - The value */ setValue(value: unknown): void; /** * Sets an array of values to the linked observers at the linked paths. * * @param values - The values. */ setValues(values: unknown[]): void; /** * Adds (inserts) a value to the linked observers at the linked paths. * * @param value - The value. */ addValue(value: unknown): void; /** * Adds (inserts) multiple values to the linked observers at the linked paths. * * @param values - The values. */ addValues(values: unknown[]): void; /** * Removes a value from the linked observers at the linked paths. * * @param value - The value. */ removeValue(value: unknown): void; /** * Removes multiple values from the linked observers from the linked paths. * * @param values - The values. */ removeValues(values: unknown[]): void; /** * Sets the element. */ set element(value: IBindable | undefined); /** * Gets the element. */ get element(): IBindable | undefined; /** * Sets whether the binding is currently applying a change, either to the observers or the element. */ set applyingChange(value: boolean); /** * Gets whether the binding is currently applying a change, either to the observers or the element. */ get applyingChange(): boolean; /** * Gets whether the binding is linked to observers. */ get linked(): boolean; /** * Sets whether to combine history actions when applying changes to observers. This is assuming * a history module is being used. */ set historyCombine(value: boolean); /** * Gets whether to combine history actions when applying changes to observers. */ get historyCombine(): boolean; /** * Sets the name of the history action when applying changes to observers. */ set historyName(value: string); /** * Gets the name of the history action when applying changes to observers. */ get historyName(): string; /** * Sets the string to prefix {@link historyName} with. */ set historyPrefix(value: string); /** * Gets the string to prefix {@link historyName} with. */ get historyPrefix(): string; /** * Sets the string to postfix {@link historyName} with. */ set historyPostfix(value: string); /** * Gets the string to postfix {@link historyName} with. */ get historyPostfix(): string; /** * Sets whether history is enabled for the binding. A valid history object must have been provided first. */ set historyEnabled(value: boolean); /** * Gets whether history is enabled for the binding. */ get historyEnabled(): boolean; /** * Gets the linked observers. */ get observers(): Observer[]; /** * Gets the linked paths. */ get paths(): string[]; } /** * Provides one way binding between an {@link IBindable} element and Observers. Any changes from * the element will be propagated to the observers. */ declare class BindingElementToObservers extends BindingBase { /** * Clone the binding and return a new instance. */ clone(): BindingElementToObservers; private _getHistoryActionName; private _setValue; private _setValueToObservers; private _observerSet; private _addValues; private _removeValues; setValue(value: unknown): void; setValues(values: unknown[]): void; addValue(value: unknown): void; addValues(values: unknown[]): void; removeValue(value: unknown): void; removeValues(values: unknown[]): void; } type Child = Node | { dom?: Node; element?: Node; parent?: Element$1; }; type DomNode = { root?: DomNode; children?: DomNode[]; [key: string]: Element$1 | DomNode | DomNode[] | undefined; }; /** * The arguments for the {@link Container} constructor. */ interface ContainerArgs extends ElementArgs, IParentArgs { /** * Sets whether the {@link Container} uses flex layout. */ flex?: boolean; /** * Sets whether the {@link Container} is resizable and where the resize handle is located. Can * be one of 'top', 'bottom', 'right', 'left'. Defaults to `null` which disables resizing. */ resizable?: string; /** * Sets the minimum size the {@link Container} can take when resized in pixels. */ resizeMin?: number; /** * Sets the maximum size the {@link Container} can take when resized in pixels. */ resizeMax?: number; /** * Called when the {@link Container} has been resized. */ onResize?: () => void; /** * Sets whether the {@link Container} should be scrollable. */ scrollable?: boolean; /** * Sets whether the {@link Container} supports the grid layout. */ grid?: boolean; } /** * A container is the basic building block for {@link Element}s that are grouped together. A * container can contain any other element including other containers. */ declare class Container extends Element$1 { /** * Fired when a child Element gets added to the Container. * * @event * @example * ```ts * const container = new Container(); * container.on('append', (element: Element) => { * console.log('Element added to container:', element); * }); * ``` */ static readonly EVENT_APPEND = "append"; /** * Fired when a child Element gets removed from the Container. * * @event * @example * ```ts * const container = new Container(); * container.on('remove', (element: Element) => { * console.log('Element removed from container:', element); * }); * ``` */ static readonly EVENT_REMOVE = "remove"; /** * Fired when the container is scrolled. The native DOM scroll event is passed to the event handler. * * @event * @example * ```ts * const container = new Container(); * container.on('scroll', (event: Event) => { * console.log('Container scrolled:', event); * }); * ``` */ static readonly EVENT_SCROLL = "scroll"; /** * Fired when the container gets resized using the resize handle. * * @event * @example * ```ts * const container = new Container(); * container.on('resize', () => { * console.log('Container resized to:', container.width, container.height, 'px'); * }); * ``` */ static readonly EVENT_RESIZE = "resize"; protected _scrollable: boolean; protected _flex: boolean; protected _grid: boolean; protected _domResizeHandle: HTMLDivElement; protected _resizePointerId: number; protected _resizeData: { x: number; y: number; width: number; height: number; }; protected _resizeHorizontally: boolean; protected _resizeMin: number; protected _resizeMax: number; protected _draggedStartIndex: number; protected _domContent: HTMLElement; protected _resizable: string; /** * Creates a new Container. * * @param args - The arguments. */ constructor(args?: Readonly); destroy(): void; /** * Appends an element to the container. * * @param {Element} element - The element to append. */ append(element: Child): void; /** * Appends an element to the container before the specified reference element. * * @param {Element} element - The element to append. * @param {Element} referenceElement - The element before which the element will be appended. */ appendBefore(element: Child, referenceElement: Child): void; /** * Appends an element to the container just after the specified reference element. * * @param {Element} element - The element to append. * @param {Element} referenceElement - The element after which the element will be appended. */ appendAfter(element: Child, referenceElement: Child): void; /** * Inserts an element in the beginning of the container. * * @param {Element} element - The element to prepend. */ prepend(element: Child): void; /** * Removes the specified child element from the container. * * @param element - The element to remove. */ remove(element: Element$1): void; /** * Moves the specified child at the specified index. * * @param element - The element to move. * @param index - The index to move the element to. */ move(element: Element$1, index: number): void; /** * Clears all children from the container. */ clear(): void; protected _getDomFromElement(element: Child): Node; protected _onAppendChild(element: Element$1): void; protected _onRemoveChild(element: Element$1): void; protected _onScroll: (evt: Event) => void; protected _createResizeHandle(): void; protected _onResizeStart: (evt: PointerEvent) => void; protected _onResizeMove: (evt: PointerEvent) => void; protected _onResizeEnd: (evt: PointerEvent) => void; protected _resizeStart(): void; protected _resizeMove(x: number, y: number): void; protected _resizeEnd(): void; /** * Resize the container. * * @param x - The number of pixels to resize the width. * @param y - The number of pixels to resize the height. */ resize(x?: number, y?: number): void; protected _getDraggedChildIndex(draggedChild: Element$1): number; protected _onChildDragStart(evt: MouseEvent, childPanel: Element$1): void; protected _onChildDragMove(evt: MouseEvent, childPanel: Element$1): void; protected _onChildDragEnd(evt: MouseEvent, childPanel: Element$1): void; /** * Iterate over each child element using the supplied function. To early out of the iteration, * return `false` from the function. * * @param fn - The function to call for each child element. */ forEachChild(fn: (child: Element$1, index: number) => void | false): void; /** * If the current node contains a root, recursively append its children to this node * and return it. Otherwise return the current node. Also add each child to the parent * under its keyed name. * * @param node - The current element in the dom structure which must be recursively * traversed and appended to its parent. * @param node.root - The root node of the dom structure. * @param node.children - The children of the root node. * @returns The recursively appended element node. */ protected _buildDomNode(node: DomNode): Element$1; /** * Takes an array of pcui elements, each of which can contain their own child elements, and * appends them to this container. These child elements are traversed recursively using * _buildDomNode. * * @param dom - An array of child pcui elements to append to this container. * * @example * buildDom([ * { * child1: pcui.Label() * }, * { * root: { * container1: pcui.Container() * }, * children: [ * { * child2: pcui.Label() * }, * { * child3: pcui.Label() * } * ] * } * ]); */ buildDom(dom: DomNode[]): void; /** * Sets whether the Element supports flex layout. */ set flex(value: boolean); /** * Gets whether the Element supports flex layout. */ get flex(): boolean; /** * Sets whether the Element supports the grid layout. */ set grid(value: boolean); /** * Gets whether the Element supports the grid layout. */ get grid(): boolean; /** * Sets whether the Element should be scrollable. */ set scrollable(value: boolean); /** * Gets whether the Element should be scrollable. */ get scrollable(): boolean; /** * Sets whether the Element is resizable and where the resize handle is located. Can be one of * 'top', 'bottom', 'right', 'left'. Set to null to disable resizing. */ set resizable(value: string); /** * Gets whether the Element is resizable and where the resize handle is located. */ get resizable(): string; /** * Sets the minimum size the Element can take when resized in pixels. */ set resizeMin(value: number); /** * Gets the minimum size the Element can take when resized in pixels. */ get resizeMin(): number; /** * Sets the maximum size the Element can take when resized in pixels. */ set resizeMax(value: number); /** * Gets the maximum size the Element can take when resized in pixels. */ get resizeMax(): number; /** * Sets the internal DOM element used as a the container of all children. Can be overridden by * derived classes. */ set domContent(value: HTMLElement); /** * Gets the internal DOM element used as a the container of all children. */ get domContent(): HTMLElement; } /** * The arguments for the {@link InputElement} constructor. */ interface InputElementArgs extends ElementArgs, IBindableArgs, IPlaceholderArgs { /** * Sets whether pressing Enter will blur (unfocus) the field. Defaults to `true`. */ blurOnEnter?: boolean; /** * Sets whether pressing Escape will blur (unfocus) the field. Defaults to `true`. */ blurOnEscape?: boolean; /** * Sets whether any key up event will cause a change event to be fired. */ keyChange?: boolean; /** * The input element to associate this {@link InputElement} with. If not supplied one will be created instead. */ input?: HTMLInputElement; } /** * The InputElement is an abstract class that manages an input DOM element. It is the superclass of * {@link TextInput} and {@link NumericInput}. It is not intended to be used directly. */ declare abstract class InputElement extends Element$1 implements IBindable, IFocusable, IPlaceholder { /** * Determines whether the input should blur when the enter key is pressed. */ blurOnEnter: boolean; /** * Determines whether the input should blur when the escape key is pressed. */ blurOnEscape: boolean; protected _domInput: HTMLInputElement; protected _suspendInputChangeEvt: boolean; protected _prevValue: string; protected _keyChange: boolean; protected _renderChanges: boolean; protected _onInputKeyDownEvt: (evt: KeyboardEvent) => void; protected _onInputChangeEvt: (evt: Event) => void; constructor(args?: InputElementArgs); destroy(): void; protected _onInputFocus: (evt: FocusEvent) => void; protected _onInputBlur: (evt: FocusEvent) => void; protected _onInputKeyDown(evt: KeyboardEvent): void; protected _onInputChange(evt: Event): void; protected _onInputKeyUp: (evt: KeyboardEvent) => void; protected _onInputCtxMenu: (evt: MouseEvent) => void; protected _updateInputReadOnly: () => void; /** * Focuses the input element. If the input contains text and select is `true`, the text will be * selected on focus. * * @param select - If `true`, the input text will be selected. */ focus(select?: boolean): void; /** * Unfocuses (blurs) the input element. */ blur(): void; set placeholder(value: string); get placeholder(): string; /** * Sets the method to call when keyup is called on the input DOM element. */ set keyChange(value: boolean); /** * Gets the method to call when keyup is called on the input DOM element. */ get keyChange(): boolean; /** * Gets the input DOM element. */ get input(): HTMLInputElement; abstract set value(value: unknown); abstract get value(): unknown; abstract set values(value: unknown[]); abstract get values(): unknown[]; set renderChanges(value: boolean); get renderChanges(): boolean; } /** * The arguments for the {@link NumericInput} constructor. */ interface NumericInputArgs extends InputElementArgs { /** * Sets the minimum value this field can take. */ min?: number; /** * Sets the maximum value this field can take. */ max?: number; /** * Sets the decimal precision of this field. Defaults to 7. */ precision?: number; /** * Sets the amount that the value will be increased or decreased when using the arrow keys and * the slider input. */ step?: number; /** * Sets the amount that the value will be increased or decreased when holding shift using the * arrow keys and the slider input. Defaults to {@link NumericInput#step} * 0.1. */ stepPrecision?: number; /** * Hide the input mouse drag slider. */ hideSlider?: boolean; /** * Sets whether the value can be `null`. If not then it will be 0 instead of `null`. */ allowNull?: boolean; } /** * The NumericInput represents an input element that holds numbers. * * NumericInput accepts `number` values. It also accepts strings that contain mathematical * expressions which are then evaluated to a number. Here are some examples: * * | Input String | Evaluated Number Value | * | ------------------ | ---------------------- | * | `"10 + 20"` | `30` | * | `"10 - 20"` | `-10` | * | `"10 * 20"` | `200` | * | `"10 / 20"` | `0.5` | * | `"10 * (20 + 30)"` | `500` | * * By default, a NumericInput displays a slider input that can be used to quickly change the value * via a click and drag. The slider can be disabled by setting the `hideSlider` argument to `true`. */ declare class NumericInput extends InputElement { /** * Fired when the value of the NumericInput changes. * * @event * @example * ```ts * const numericInput = new NumericInput(); * numericInput.on('change', (value: number) => { * console.log('Value changed to:', value); * }); * ``` */ static readonly EVENT_CHANGE = "change"; /** * Fired when the user starts dragging the slider. * * @event * @example * ```ts * const numericInput = new NumericInput(); * numericInput.on('slider:mousedown', (evt: MouseEvent) => { * console.log('Slider drag started'); * }); * ``` */ static readonly EVENT_SLIDER_MOUSEDOWN = "slider:mousedown"; /** * Fired when the user stops dragging the slider. * * @event * @example * ```ts * const numericInput = new NumericInput(); * numericInput.on('slider:mouseup', () => { * console.log('Slider drag ended'); * }); * ``` */ static readonly EVENT_SLIDER_MOUSEUP = "slider:mouseup"; protected _min: number; protected _max: number; protected _allowNull: boolean; protected _precision: number; protected _step: number; protected _stepPrecision: number; protected _oldValue: number; protected _historyCombine: boolean; protected _historyPostfix: string; protected _sliderPrevValue: number; protected _sliderControl: Element$1; protected _sliderMovement: number; protected _sliderUsed: boolean; /** * Creates a new NumericInput. * * @param args - The arguments. */ constructor(args?: Readonly); destroy(): void; protected _updatePosition(movement: number, shiftKey: boolean): void; protected _onSliderMouseWheel: (evt: WheelEvent) => void; protected _onSliderMouseMove: (evt: MouseEvent) => void; protected _onSliderMouseDown: (evt: MouseEvent) => void; protected _onSliderMouseUp: () => void; protected _onInputChange(evt: Event): void; protected _onInputKeyDown(evt: KeyboardEvent): void; protected _getPointerLockElementByShadowRoot(pointerLockElement: Element): boolean; protected _isScrolling(): boolean; protected _onPointerLockChange: () => void; protected _normalizeValue(value: unknown): number; protected _updateValue(value: number, force?: boolean): boolean; /** * Sets the value of the NumericInput. */ set value(value: number | string); /** * Gets the value of the NumericInput. */ get value(): number; /** * Sets multiple values on the input. If all values are the same, the input will display that * value. Otherwise, it will be empty and display a "multiple values" state. */ set values(values: number[]); /** * Sets the minimum value this field can take. */ set min(value: number); /** * Gets the minimum value this field can take. */ get min(): number; /** * Sets the maximum value this field can take. */ set max(value: number); /** * Gets the maximum value this field can take. */ get max(): number; /** * Sets the precision of the input. */ set precision(value: number); /** * Gets the precision of the input. */ get precision(): number; /** * Sets the amount that the value will be increased or decreased when using the arrow keys and the slider input. */ set step(value: number); /** * Gets the amount that the value will be increased or decreased when using the arrow keys and the slider input. */ get step(): number; } type Attribute = { path?: string; [key: string]: unknown; }; type ElementConfig = Record & { binding?: BindingBase; attributes?: Attribute[]; curves?: unknown[]; channels?: number; renderChanges?: boolean; type?: string; }; type BindableElement = Element$1 & IBindable & { renderChanges: boolean; }; type Entry = { container: Container; element: BindableElement; }; /** * The arguments for the {@link ArrayInput} constructor. */ interface ArrayInputArgs extends ElementArgs, IBindableArgs { /** * The type of values that the array can hold. Can be one of the following: * * - `boolean` * - `number` * - `string` * - `vec2` * - `vec3` * - `vec4` * * Defaults to `string`. */ type?: 'boolean' | 'number' | 'string' | 'vec2' | 'vec3' | 'vec4'; /** * Arguments for each array Element. */ elementArgs?: ElementConfig; /** * If `true` then editing the number of elements that the array has will not be allowed. */ fixedSize?: boolean; /** * If `true` then the array will be rendered using panels. Defaults to `false`. */ usePanels?: boolean; /** * Used to specify the default values for each element in the array. Defaults to `null`. */ getDefaultFn?: () => unknown; } /** * Element that allows editing an array of values. */ declare class ArrayInput extends Element$1 implements IFocusable, IBindable { /** * Fired when an array element is linked to observers. * * @event * @example * ```ts * arrayInput.on('linkElement', (element: Element, index: number, path: string) => { * console.log(`Element ${index} is now linked to ${path}`); * }); * ``` */ static readonly EVENT_LINK_ELEMENT = "linkElement"; /** * Fired when an array element is unlinked from observers. * * @event * @example * ```ts * arrayInput.on('unlinkElement', (element: Element, index: number) => { * console.log(`Element ${index} is now unlinked`); * }); * ``` */ static readonly EVENT_UNLINK_ELEMENT = "unlinkElement"; static DEFAULTS: { boolean: boolean; number: number; string: string; vec2: number[]; vec3: number[]; vec4: number[]; }; protected _container: Container; protected _usePanels: boolean; protected _fixedSize: boolean; protected _inputSize: NumericInput; protected _suspendSizeChangeEvt: boolean; protected _containerArray: Container; protected _arrayElements: Entry[]; protected _suspendArrayElementEvts: boolean; protected _arrayElementChangeTimeout: number; protected _getDefaultFn: () => unknown; protected _valueType: string; protected _elementType: string; protected _elementArgs: ElementConfig; protected _values: unknown[][]; protected _renderChanges: boolean; /** * Creates a new ArrayInput. * * @param args - The arguments. */ constructor(args?: Readonly); destroy(): void; protected _onSizeChange(size: number): void; protected _createArrayElement(): { container: Container; element: BindableElement; }; protected _removeArrayElement(entry: Entry): void; protected _onArrayElementChange(entry: Entry, value: unknown): void; protected _linkArrayElement(element: BindableElement, index: number): void; protected _updateValues(values: unknown[][], applyToBinding: boolean): void; focus(): void; blur(): void; unlink(): void; link(observers: Observer | Observer[], paths: string | string[]): void; /** * Executes the specified function for each array element. * * @param fn - The function with signature (element, index) => bool to execute. If the function * returns `false` then the iteration will early out. */ forEachArrayElement(fn: (element: Element$1, index: number) => false | void): void; set binding(value: BindingBase); get binding(): BindingBase; /** * Sets the value of the ArrayInput. Must be an array. */ set value(value: unknown[]); /** * Gets the value of the ArrayInput as an array. */ get value(): unknown[]; /** * Sets multiple array values on the ArrayInput. */ set values(values: unknown[][]); /** * Sets whether array elements should flash when their values change. */ set renderChanges(value: boolean); /** * Gets whether array elements should flash when their values change. */ get renderChanges(): boolean; } /** * The arguments for the {@link BooleanInput} constructor. */ interface BooleanInputArgs extends ElementArgs, IBindableArgs { /** * Sets the tabIndex of the {@link BooleanInput}. Defaults to 0. */ tabIndex?: number; /** * The type of checkbox. Currently can be `null` or 'toggle'. */ type?: string; } /** * A checkbox element. */ declare class BooleanInput extends Element$1 implements IBindable, IFocusable { protected _value: boolean; protected _renderChanges: boolean; /** * Creates a new BooleanInput. * * @param args - The arguments. */ constructor(args?: Readonly); destroy(): void; protected _onClick(evt: MouseEvent): void; protected _onKeyDown: (evt: KeyboardEvent) => void; protected _onFocus: () => void; protected _onBlur: () => void; protected _updateValue(value: boolean): boolean; focus(): void; blur(): void; set value(value: boolean); get value(): boolean; set values(values: boolean[]); set renderChanges(value: boolean); get renderChanges(): boolean; } /** * The arguments for the {@link Button} constructor. */ interface ButtonArgs extends ElementArgs { /** * If `true`, the {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML innerHTML} property will be * used to set the text. Otherwise, {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent textContent} * will be used instead. Defaults to `false`. */ unsafe?: boolean; /** * Sets the text of the button. Defaults to ''. */ text?: string; /** * The CSS code for an icon for the button. e.g. 'E401' (notice we omit the '\\' character). Defaults to ''. */ icon?: string; /** * Sets the 'size' type of the button. Can be 'small' or `null`. Defaults to `null`. */ size?: 'small'; } /** * User input with click interaction. */ declare class Button extends Element$1 { protected _unsafe: boolean; protected _text: string; protected _icon: string; protected _size: string | null; /** * Creates a new Button. * * @param args - The arguments. */ constructor(args?: Readonly); destroy(): void; protected _onKeyDown: (evt: KeyboardEvent) => void; protected _onClick(evt: Event): void; /** * Focuses the button. */ focus(): void; /** * Unfocuses (blurs) the button. */ blur(): void; /** * Sets the text of the button. */ set text(value: string); /** * Gets the text of the button. */ get text(): string; /** * Sets the CSS code for an icon for the button. e.g. 'E401' (notice we omit the '\\' character). */ set icon(value: string); /** * Gets the CSS code for an icon for the button. */ get icon(): string; /** * Sets the 'size' type of the button. Can be null or 'small'. */ set size(value: string); /** * Gets the 'size' type of the button. */ get size(): string; } /** * The arguments for the {@link Canvas} constructor. */ interface CanvasArgs extends ElementArgs { /** * Whether the canvas should use the {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio devicePixelRatio}. * Defaults to `false`. */ useDevicePixelRatio?: boolean; } /** * Represents a Canvas. */ declare class Canvas extends Element$1 { protected _width: number; protected _height: number; protected _ratio: number; /** * Creates a new Canvas. * * @param args - The arguments. */ constructor(args?: Readonly); /** * Resize the canvas using the given width and height parameters. * * @param width - The new width of the canvas. * @param height - The new height of the canvas. */ resize(width: number, height: number): void; /** * Sets the width of the canvas. */ set width(value: number); /** * Gets the width of the canvas. */ get width(): number; /** * Sets the height of the canvas. */ set height(value: number); /** * Gets the height of the canvas. */ get height(): number; /** * Gets the pixel height of the canvas. */ get pixelWidth(): number; /** * Gets the pixel height of the canvas. */ get pixelHeight(): number; /** * Gets the pixel ratio of the canvas. */ get pixelRatio(): number; } /** * The arguments for the {@link Label} constructor. */ interface LabelArgs extends ElementArgs, IBindableArgs, IPlaceholderArgs { /** * Sets the text of the Label. Defaults to ''. */ text?: string; /** * If `true`, the {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML innerHTML} property will be * used to set the text. Otherwise, {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent textContent} * will be used instead. Defaults to `false`. */ unsafe?: boolean; /** * If `true` then use the text of the label as the native HTML tooltip. Defaults to `false`. */ nativeTooltip?: boolean; /** * If `true` then the label can be clicked to select text. Defaults to `false`. */ allowTextSelection?: boolean; /** * The DOM element or its type to use for this component. Defaults to 'span'. */ dom?: HTMLElement | string; /** * Sets the value of the Label. Defaults to ''. */ value?: string; } /** * The Label is a simple span element that displays some text. */ declare class Label extends Element$1 implements IPlaceholder, IBindable { protected _unsafe: boolean; protected _text: string; protected _renderChanges: boolean; /** * Creates a new Label. * * @param args - The arguments. */ constructor(args?: Readonly); protected _updateText(value: string): boolean; /** * Sets the text of the Label. */ set text(value: string); /** * Gets the text of the Label. */ get text(): string; /** * Sets the value of the Label. This is an alias for {@link Label#text}. */ set value(value: string); /** * Gets the value of the Label. This is an alias for {@link Label#text}. */ get value(): string; /** * Sets multiple values on the Label. If all values are the same, the Label will display that * value. Otherwise, it will be empty and display a "multiple values" state. */ set values(values: string[]); /** * Sets the placeholder text of the Label. */ set placeholder(value: string); /** * Gets the placeholder text of the Label. */ get placeholder(): string; /** * Sets whether the Label should flash when its value changes. */ set renderChanges(value: boolean); /** * Gets whether the Label should flash when its value changes. */ get renderChanges(): boolean; } /** * The arguments for the {@link Code} constructor. */ interface CodeArgs extends ContainerArgs { /** * Sets the text to display in the code block. */ text?: string; } /** * Represents a code block. */ declare class Code extends Container { protected _inner: Label; protected _text: string; /** * Creates a new Code. * * @param args - The arguments. */ constructor(args?: Readonly); /** * Sets the text to display in the code block. */ set text(value: string); /** * Gets the text to display in the code block. */ get text(): string; } /** * The arguments for the {@link Overlay} constructor. */ interface OverlayArgs extends ElementArgs { /** * Whether the overlay can be hidden by clicking on it. */ clickable?: boolean; /** * Whether the overlay is transparent or not. */ transparent?: boolean; } /** * An overlay element. */ declare class Overlay extends Container { protected _domClickableOverlay: HTMLDivElement; /** * Creates a new Overlay. * * @param args - The arguments. */ constructor(args?: Readonly); destroy(): void; protected _onPointerDown: (evt: PointerEvent) => void; /** * Position the overlay at specific x, y coordinates. * * @param x - The x coordinate. * @param y - The y coordinate. */ position(x: number, y: number): void; /** * Sets whether the overlay can be hidden by clicking on it. */ set clickable(value: boolean); /** * Gets whether the overlay can be hidden by clicking on it. */ get clickable(): boolean; /** * Sets whether the overlay is transparent or not. */ set transparent(value: boolean); /** * Gets whether the overlay is transparent or not. */ get transparent(): boolean; } /** * The arguments for the {@link TextInput} constructor. */ interface TextInputArgs extends InputElementArgs, IPlaceholderArgs { /** * A function that validates the value that is entered into the input and returns `true` if it * is valid or `false` otherwise. If `false` then the input will be set in an error state and * the value will not propagate to the binding. */ onValidate?: (value: string) => boolean; } /** * The TextInput is an input element of type text. */ declare class TextInput extends InputElement { /** * A function that validates the value that is entered into the input and returns `true` if it * is valid or `false` otherwise. If `false` then the input will be set in an error state and * the value will not propagate to the binding. */ onValidate: (value: string) => boolean; /** * The value of the last change event, so an unchanged value isn't emitted again. */ protected _emittedValue: string; /** * Creates a new TextInput. * * @param args - The arguments. */ constructor(args?: Readonly); protected _onInputChange(evt: Event): void; protected _updateValue(value: string | string[]): boolean; set value(value: string | string[]); get value(): string; /** * Sets multiple values on the input. If all values are the same, the input will display that * value. Otherwise, it will be empty and display a "multiple values" state. */ set values(values: string[]); } /** * The arguments for the {@link ColorPicker} constructor. */ interface ColorPickerArgs extends ElementArgs, IBindableArgs { /** * An array of 4 numbers in the range 0 to 1 containing the RGBA values the picker should be * initialized to. For example, `[1, 0.5, 0, 1]` is opaque orange. Defaults to `[0, 0, 0, 1]` * (opaque black). */ value?: number[]; /** * Number of color channels. Defaults to 3. Changing to 4 adds the option to change the alpha value. */ channels?: number; } /** * Represents a color picker. */ declare class ColorPicker extends Element$1 implements IBindable { protected _historyCombine: boolean; protected _historyPostfix: string; protected _value: number[]; protected _channels: number; protected _size: number; protected _directInput: boolean; protected _colorHSV: number[]; protected _pickerChannels: NumericInput[]; protected _channelsNumber: number; protected _changing: boolean; protected _dragging: boolean; protected _callingCallback: boolean; protected _overlay: Overlay; protected _domColor: HTMLDivElement; protected _pickRect: HTMLDivElement; protected _pickRectPointerId: number; protected _pickRectWhite: HTMLDivElement; protected _pickRectBlack: HTMLDivElement; protected _pickRectHandle: HTMLDivElement; protected _pickHue: HTMLDivElement; protected _pickHuePointerId: number; protected _pickHueHandle: HTMLDivElement; protected _pickOpacity: HTMLDivElement; protected _pickOpacityPointerId: number; protected _pickOpacityHandle: HTMLDivElement; protected _panelFields: HTMLDivElement; protected _evtColorPick: EventHandle; protected _evtColorToPicker: EventHandle; protected _evtColorPickStart: EventHandle; protected _evtColorPickEnd: EventHandle; protected _fieldHex: TextInput; protected _renderChanges: boolean; /** * Creates a new ColorPicker. * * @param args - The arguments. */ constructor(args?: Readonly); destroy(): void; focus(): void; blur(): void; protected _onKeyDown: (evt: KeyboardEvent) => void; protected _onFocus: (evt: FocusEvent) => void; protected _onBlur: (evt: FocusEvent) => void; protected _setColorPickerPosition(x: number, y: number): void; protected _setPickerColor(color: number[]): void; protected _openColorPicker(): void; protected _callPicker(color: number[]): void; protected _valueToColor(value: number): number; protected _setValue(value: number[]): void; protected _updateValue(value: number[]): boolean; protected _getHex(): string; protected _pickRectPointerDown: (event: PointerEvent) => void; protected _pickRectPointerMove: (event: PointerEvent) => void; protected _pickRectPointerUp: (event: PointerEvent) => void; protected _pickHuePointerDown: (event: PointerEvent) => void; protected _pickHuePointerMove: (event: PointerEvent) => void; protected _pickHuePointerUp: (event: PointerEvent) => void; protected _pickOpacityPointerDown: (event: PointerEvent) => void; protected _pickOpacityPointerMove: (event: PointerEvent) => void; protected _pickOpacityPointerUp: (event: PointerEvent) => void; protected _onChangeHex(): void; protected _onChangeRgb(): void; protected _onChangeAlpha(value: number): void; /** @ignore */ callbackHandle(): void; /** @ignore */ callCallback(): void; set value(value: number[]); get value(): number[]; set values(values: number[][]); set channels(value: number); get channels(): number; set renderChanges(value: boolean); get renderChanges(): boolean; } /** * Represents a vertical division between two elements. */ declare class Divider extends Element$1 { /** * Creates a new Divider. * * @param args - The arguments. */ constructor(args?: Readonly); } /** * The arguments for the {@link Panel} constructor. */ interface PanelArgs extends ContainerArgs { /** * Sets whether the Element is collapsible. */ collapsible?: boolean; /** * Sets whether the Element should be collapsed. */ collapsed?: boolean; /** * Sets whether the panel can be reordered. */ sortable?: boolean; /** * Sets whether the panel collapses horizontally - this would be the case for side panels. Defaults to `false`. */ collapseHorizontally?: boolean; /** * Sets whether the panel can be removed. */ removable?: boolean; /** * The height of the header in pixels. Defaults to 32. */ headerSize?: number; /** * The header text of the panel. Defaults to the empty string. */ headerText?: string; /** * Sets the panel type. */ panelType?: 'normal'; /** * A DOM element to use for the content container. */ content?: HTMLElement; /** * A DOM element to use for the header container. */ header?: HTMLElement; } /** * The Panel is a {@link Container} that itself contains a header container and a content * container. The respective Container functions work using the content container. One can also * append elements to the header of the Panel. */ declare class Panel extends Container { /** * Fired when the panel gets collapsed. * * @event * @example * ```ts * const panel = new Panel(); * panel.on('collapse', () => { * console.log('Panel collapsed'); * }); * ``` */ static readonly EVENT_COLLAPSE = "collapse"; /** * Fired when the panel gets expanded. * * @event * @example * ```ts * const panel = new Panel(); * panel.on('expand', () => { * console.log('Panel expanded'); * }); * ``` */ static readonly EVENT_EXPAND = "expand"; protected _suspendReflow: boolean; protected _reflowTimeout: number; protected _widthBeforeCollapse: string; protected _heightBeforeCollapse: string; protected _iconSort: Label; protected _btnRemove: Button; protected _containerContent: Container; protected _containerHeader: Container; protected _labelTitle: Label; protected _collapsible: boolean; protected _collapseHorizontally: boolean; protected _draggedChild: this; protected _collapsed: boolean; protected _sortable: boolean; protected _headerSize: number; protected _onDragEndEvt: (event: MouseEvent) => void; /** * Creates a new Panel. * * @param args - The arguments. Extends the Container constructor arguments. All settable * properties can also be set through the constructor. */ constructor(args?: Readonly); destroy(): void; protected _initializeHeader(args: PanelArgs): void; protected _onHeaderClick: (evt: MouseEvent) => void; protected _onClickRemove(evt: MouseEvent): void; protected _initializeContent(args: PanelArgs): void; protected _reflow(): void; protected _onDragStart: (evt: MouseEvent) => void; protected _onDragMove: (evt: MouseEvent) => void; protected _onDragEnd(evt: MouseEvent): void; /** * Sets whether the Element is collapsible. */ set collapsible(value: boolean); /** * Gets whether the Element is collapsible. */ get collapsible(): boolean; /** * Sets whether the Element should be collapsed. */ set collapsed(value: boolean); /** * Gets whether the Element should be collapsed. */ get collapsed(): boolean; /** * Sets whether the panel can be reordered. */ set sortable(value: boolean); /** * Gets whether the panel can be reordered. */ get sortable(): boolean; /** * Sets whether the panel can be removed */ set removable(value: boolean); /** * Gets whether the panel can be removed */ get removable(): boolean; /** * Sets whether the panel collapses horizontally. This would be the case for side panels. Defaults to `false`. */ set collapseHorizontally(value: boolean); /** * Gets whether the panel collapses horizontally. */ get collapseHorizontally(): boolean; /** * Gets the content container. */ get content(): Container; /** * Gets the header container. */ get header(): Container; /** * Sets the header text of the panel. Defaults to the empty string. */ set headerText(value: string); /** * Gets the header text of the panel. */ get headerText(): string; /** * Sets the height of the header in pixels. Defaults to 32. */ set headerSize(value: number); /** * Gets the height of the header in pixels. */ get headerSize(): number; } type OptionValue = boolean | number | string; type SelectHandler = { bivarianceHack(value: unknown): void; }['bivarianceHack']; /** * The arguments for the {@link SelectInput} constructor. */ interface SelectInputArgs extends ElementArgs, IBindableArgs, IPlaceholderArgs { /** * Used to map the options. */ optionsFn?: () => { t: string; v: OptionValue; }[]; /** * Default value for the input. */ defaultValue?: unknown; /** * If `true` then the input value becomes an array allowing the selection of multiple options. Defaults to `false`. */ multiSelect?: boolean; /** * The dropdown options of the input. Contains an array of objects with the following format \{v: Any, t: String\} where v is the value and t is the text of the option. */ options?: { t: string; v: boolean | number | string; }[]; /** * An array of values against which new values are checked before they are created. If a value is in the array it will not be created. */ invalidOptions?: unknown[]; /** * If `true` then null is a valid input value. Defaults to `false`. */ allowNull?: boolean; /** * If `true` then a text field is shown for the user to search for values or enter new ones. Defaults to `false`. */ allowInput?: boolean; /** * If `true` then the input allows creating new values from the text field. Only used when allowInput is true. Defaults to `false`. */ allowCreate?: boolean; /** * A function to be executed when the user selects to create a new value. The function takes the new value as a parameter. */ createFn?: (value: string) => void; /** * The placeholder text to show when creating a new value. Used when allowInput and allowCreate are both true. */ createLabelText?: string; /** * The type of each value. Can be one of 'string', 'number' or 'boolean'. Defaults to 'string'. */ type?: 'string' | 'number' | 'boolean'; /** * The order that the options should be checked in to find a valid fallback option that isn't included in the disabledOptions object. */ fallbackOrder?: string[]; /** * All the option values that should be disabled. The keys of the object are the values of the options and the values are the text to show when the option is disabled. */ disabledOptions?: Record; /** * If provided, this function will be called each time an option is selected. */ onSelect?: SelectHandler; /** * Text to display in the SelectInput before the selected option. */ prefix?: string; } /** * An input that allows selecting from a dropdown or entering tags. */ declare class SelectInput extends Element$1 implements IBindable, IFocusable { /** * Fired when the value of the SelectInput changes. * * @event * @example * ```ts * const selectInput = new SelectInput(); * selectInput.on('change', (value) => { * console.log('Value changed to:', value); * }); * ``` */ static readonly EVENT_CHANGE = "change"; /** * Fired when the SelectInput receives focus. * * @event * @example * ```ts * const selectInput = new SelectInput(); * selectInput.on('focus', () => { * console.log('SelectInput focused'); * }); * ``` */ static readonly EVENT_FOCUS = "focus"; /** * Fired when the SelectInput loses focus. * * @event * @example * ```ts * const selectInput = new SelectInput(); * selectInput.on('blur', () => { * console.log('SelectInput blurred'); * }); * ``` */ static readonly EVENT_BLUR = "blur"; protected _container: Container; protected _containerValue: Container; protected _domShadow: HTMLDivElement; protected _allowInput: boolean; protected _allowCreate: boolean; protected _createFn?: (value: string) => void; protected _createLabelText?: string; protected _labelValue: Label; protected _timeoutLabelValueTabIndex: number; protected _labelIcon: Label; protected _input: TextInput; protected _lastInputValue: string; protected _suspendInputChange: boolean; protected _containerOptions: Container; protected _containerTags: Container; protected _type: string; protected _valueToText: Record; protected _valueToLabel: Record; protected _labelToValue: Map; protected _labelHighlighted: Label; protected _optionsFn?: () => { t: string; v: OptionValue; }[]; protected _allowNull: boolean; protected _values: unknown[][]; protected _value: unknown; protected _createLabelContainer: Container; protected _options: { t: string; v: boolean | number | string; }[]; protected _invalidOptions: unknown[]; protected _renderChanges: boolean; protected _disabledOptions: Record; protected _fallbackOrder: string[]; protected _disabledValue: string; protected _onSelect: SelectHandler; protected _prefix: string; /** * Creates a new SelectInput. * * @param args - The arguments. */ constructor(args?: Readonly); destroy(): void; protected _initializeCreateLabel(): Container; protected _convertSingleValue(value: unknown): unknown; protected _convertValue(value: unknown): unknown; protected _onSelectValue(value: unknown): void; protected _highlightLabel(label: Label): void; protected _onValueChange(value: unknown): void; protected _onMultipleValuesChange(values: unknown[][]): void; protected _addTag(value: unknown): Container; protected _removeTag(tagElement: Container, value: unknown): void; protected _onInputChange: (value: string) => void; protected _filterOptions(filter: string): void; protected _onInputKeyDown: (evt: KeyboardEvent) => void; /** * Handles pointer down events on the document. It has to be the document instead of the window * because otherwise `pointerdown` is not fired when the PCUI app is running in an iframe. * @param evt - Pointer event. */ protected _onDocumentPointerDown: (evt: PointerEvent) => void; protected _onKeyDown: (evt: KeyboardEvent) => void; protected _resizeShadow(): void; protected _onPointerDown: () => void; protected _onFocus: () => void; protected _onBlur: () => void; protected _onWheel: (evt: WheelEvent) => void; protected _updateInputFieldsVisibility(focused?: boolean): void; /** * Focuses the SelectInput. */ focus(): void; /** * Unfocuses (blurs) the SelectInput. */ blur(): void; /** * Opens the dropdown menu. */ open(): void; /** * Closes the dropdown menu. */ close(): void; /** * Toggles the dropdown menu. */ toggle(): void; unlink(): void; _updateValue(value: unknown): void; _updateDisabledValue(value: unknown): unknown; /** * Sets the dropdown options. Each option should have the format `{v: value, t: text}` where `v` * is the value and `t` is the display text. */ set options(value: { t: string; v: boolean | number | string; }[]); /** * Gets the dropdown options. */ get options(): { t: string; v: boolean | number | string; }[]; /** * Sets an array of values that should not be allowed when creating new options. */ set invalidOptions(value: unknown[]); /** * Gets the array of invalid options. */ get invalidOptions(): unknown[]; /** * Sets the value that is currently disabled (shown but not selectable). */ set disabledValue(value: string | null); /** * Sets the options that should be disabled. The keys are the option values and the values are * the text to show when the option is disabled. */ set disabledOptions(value: Record); /** * Sets the order in which options should be checked for a valid fallback when the current * value becomes disabled. */ set fallbackOrder(value: string[]); /** * Gets whether the SelectInput allows selecting multiple options. */ get multiSelect(): boolean; /** * Sets the value of the SelectInput. For multi-select inputs, this should be an array. */ set value(value: unknown); /** * Gets the value of the SelectInput. For multi-select inputs, this returns an array. */ get value(): unknown; /** * Sets multiple values on the SelectInput. If all values are the same, the SelectInput will * display that value. Otherwise, it will display a "multiple values" state. */ set values(values: unknown[]); /** * Sets the placeholder text for the input field. */ set placeholder(value: string); /** * Gets the placeholder text for the input field. */ get placeholder(): string; /** * Sets whether the SelectInput should flash when its value changes. */ set renderChanges(value: boolean); /** * Gets whether the SelectInput should flash when its value changes. */ get renderChanges(): boolean; } type CurveData = { type: number; keys: number[][]; }; type Gradient = CurveData & { betweenCurves: boolean; }; type CurveLike = { keys: number[][]; type: number; value(time: number): number; sort(): void; }; type Helpers = { rgbaStr: (color: number[], scale?: number) => string; hexStr: (color: number[]) => string; toHsva: (rgba: number[]) => number[]; toRgba: (hsva: number[]) => number[]; normalizedCoord: (canvas: Canvas, x: number, y: number) => number[]; }; type Ui = { root: HTMLElement; overlay: Overlay & { center: boolean; }; panel: HTMLDivElement; gradient: Canvas; checkerPattern: CanvasPattern; anchors: Canvas; footer: Panel; typeLabel: Label; typeCombo: SelectInput; positionLabel: Label; positionEdit: NumericInput; copyButton: Button; pasteButton: Button; deleteButton: Button; showSelectedPosition: NumericInput; showCrosshairPosition: HTMLDivElement; anchorAddCrossHair: HTMLDivElement; colorPicker: null; draggingAnchor?: boolean; }; type State = { curves: CurveLike[]; keystore: number[][][]; anchors: number[]; hoveredAnchor: number; selectedAnchor: number; selectedValue: number[]; changing: boolean; draggingAnchor: boolean; typeMap: Record; }; /** * The arguments for the {@link GradientPicker} constructor. */ interface GradientPickerArgs extends ElementArgs { /** * If `true`, the picker will render changes to the gradient as they happen. Defaults to `true`. */ renderChanges?: boolean; /** * An array of 4 integers containing the RGBA values the picker should be initialized to. */ value?: number[]; /** * Number of color channels. Defaults to 3. Changing to 4 adds the option to change the alpha value. */ channels?: number; } /** * Represents a gradient picker. */ declare class GradientPicker extends Element$1 { protected _canvas: Canvas; protected _checkerboardPattern: CanvasPattern; protected _resizeInterval: number; protected _panel: Panel; protected _colorRect: Canvas; protected _colorHandle: HTMLDivElement; protected _hueRect: Canvas; protected _hueHandle: HTMLDivElement; protected _alphaRect: Canvas; protected _alphaHandle: HTMLDivElement; protected _fields: HTMLDivElement; protected _rField: NumericInput; protected _gField: NumericInput; protected _bField: NumericInput; protected _aField: NumericInput; protected _hexField: TextInput; protected _hsva: number[]; protected _storeHsva: number[]; protected _dragMode: number; protected _changing: boolean; protected _copiedData: CurveData; protected _channels: number; protected _value: Gradient; protected _evtPickerChanged: EventHandle; protected _evtRefreshPicker: EventHandle; protected renderChanges: boolean; protected Helpers: Helpers; protected CONSTANTS: { bg: string; anchorRadius: number; selectedRadius: number; }; protected UI: Ui; protected STATE: State; protected fieldChangeHandler: (evt: Event) => void; protected hexChangeHandler: (evt: Event) => void; protected downHandler: (evt: MouseEvent) => void; protected moveHandler: (evt: MouseEvent) => void; protected upHandler: (evt: MouseEvent) => void; /** * Creates a new GradientPicker. * * @param args - The arguments. Extends the Element arguments. Any settable property can also * be set through the constructor. */ constructor(args?: Readonly); destroy(): void; protected _createCheckerboardPattern(context: CanvasRenderingContext2D): CanvasPattern; protected _onKeyDown: (evt: KeyboardEvent) => void; protected _onFocus: (evt: FocusEvent) => void; protected _onBlur: (evt: FocusEvent) => void; protected _getDefaultValue(): { type: number; keys: number[][]; betweenCurves: boolean; }; protected _openGradientPicker(): void; protected _onPickerChange(paths: string[], values: number[][] | number[]): void; protected _renderGradient(): void; focus(): void; blur(): void; set channels(value: number); get channels(): number; set value(value: Gradient); get value(): Gradient; set values(values: Gradient[]); protected _generateHue(canvas: Canvas): void; protected _generateAlpha(canvas: Canvas): void; protected _generateGradient(canvas: Canvas, clr: number[]): void; protected _onFieldChanged(): void; protected _onHexChanged(): void; protected _onMouseDown(evt: MouseEvent): void; protected _onMouseMove(evt: MouseEvent): void; protected _onMouseUp(evt: MouseEvent): void; set hsva(hsva: number[]); get hsva(): number[]; set color(clr: number[]); get color(): number[]; set editAlpha(editAlpha: boolean); get editAlpha(): boolean; open(): void; close(): void; onOpen(): void; onClose(): void; onDeleteKey(): void; protected _onTypeChanged(value: number): void; render(): void; renderGradient(): void; renderAnchors(): void; renderAnchor(ctx: CanvasRenderingContext2D, time: number, type?: string): void; evaluateGradient(time: number, alphaOverride?: number): number[]; calcAnchorTimes(): number[]; calcNormalizedCoord(x: number, y: number, rect: DOMRect): number[]; getClientRect(element: HTMLElement): DOMRect; protected _onAnchorsMouseDown: (e: MouseEvent) => void; protected _onAnchorsMouseMove: (e: MouseEvent) => void; protected _onAnchorsMouseUp: (evt: MouseEvent) => void; selectHovered(index: number): void; selectAnchor(index: number): void; dragStart(): void; dragUpdate(time: number): void; dragEnd(): void; insertAnchor(time: number, color: number[]): void; deleteAnchor(time: number): void; moveSelectedAnchor(time: number): void; colorSelectedAnchor(clr: number[], dragging?: boolean): void; emitCurveChange(): void; doCopy(): void; doPaste(): void; doDelete(): void; createCheckerPattern(): CanvasPattern; setValue(value: CurveData[], args?: { channels?: number; }): void; callOpenGradientPicker(value: CurveData[], args?: { channels?: number; }): void; getGradientPickerRect(): DOMRect; positionGradientPicker(x: number, y: number): void; setGradientPicker(value: CurveData[], args?: { channels?: number; }): void; } /** * The arguments for the {@link RadioButton} constructor. */ interface RadioButtonArgs extends ElementArgs, IBindableArgs { } /** * A radio button element. */ declare class RadioButton extends Element$1 implements IBindable, IFocusable { protected _value: boolean; protected _renderChanges: boolean; /** * Creates a new RadioButton. * * @param args - The arguments. */ constructor(args?: Readonly); destroy(): void; protected _onClick(evt: MouseEvent): void; protected _onKeyDown: (evt: KeyboardEvent) => void; protected _onFocus: (evt: FocusEvent) => void; protected _onBlur: (evt: FocusEvent) => void; protected _updateValue(value: boolean): boolean; focus(): void; blur(): void; set value(value: boolean); get value(): boolean; set values(values: boolean[]); set renderChanges(renderChanges: boolean); get renderChanges(): boolean; } /** * The arguments for the {@link GridViewItem} constructor. */ interface GridViewItemArgs extends ContainerArgs { /** * The type of the {@link GridViewItem}. Can be `null` or 'radio'. */ type?: string; /** * If `true`, allow selecting the item. Defaults to `true`. */ allowSelect?: boolean; /** * Whether the item is selected. */ selected?: boolean; /** * The text of the item. Defaults to ''. */ text?: string; /** * Sets the tabIndex of the {@link GridViewItem}. Defaults to 0. */ tabIndex?: number; } /** * Represents a grid view item used in {@link GridView}. */ declare class GridViewItem extends Container implements IFocusable { /** * Determines whether the item can be selected. Defaults to `true`. */ allowSelect: boolean; protected _selected: boolean; protected _radioButton: RadioButton; protected _labelText: Label; protected _type: string; /** * Creates a new GridViewItem. * * @param args - The arguments. */ constructor(args?: Readonly); destroy(): void; protected _onRadioButtonClick: () => void; protected _onFocus: () => void; protected _onBlur: () => void; focus(): void; blur(): void; link(observers: Observer | Observer[], paths: string | string[]): void; unlink(): void; /** * Sets whether the item is selected. */ set selected(value: boolean); /** * Gets whether the item is selected. */ get selected(): boolean; /** * Sets the text of the item. */ set text(value: string); /** * Gets the text of the item. */ get text(): string; /** * Gets the next visible sibling grid view item. */ get nextSibling(): GridViewItem; /** * Gets the previous visible sibling grid view item. */ get previousSibling(): GridViewItem; } /** * The arguments for the {@link GridView} constructor. */ interface GridViewArgs extends ContainerArgs { /** * If `true` the {@link GridView} layout will be vertical. */ vertical?: boolean; /** * If `true`, the layout will allow for multiple options to be selected. Defaults to `true`. */ multiSelect?: boolean; /** * If `true` and `multiSelect` is set to `false`, the layout will allow options to be deselected. Defaults to `true`. */ allowDeselect?: boolean; /** * A filter function to filter {@link GridViewItem}s with signature `(GridViewItem) => boolean`. */ filterFn?: (item: GridViewItem) => boolean; } /** * Represents a container that shows a flexible wrappable list of items that looks like a grid. * Contains {@link GridViewItem}s. */ declare class GridView extends Container { /** * Fired when user activates a {@link GridViewItem} by pressing Enter or double-clicking. * * @event * @example * ```ts * const gridView = new GridView(); * gridView.on('activate', (item: GridViewItem) => { * console.log(`Activated item ${item.text}`); * }); * ``` */ static readonly EVENT_ACTIVATE = "activate"; protected _vertical: boolean; protected _clickFn: (evt: MouseEvent, item: GridViewItem) => void; protected _filterFn: (item: GridViewItem) => boolean; protected _filterAnimationFrame: number; protected _filterCanceled: boolean; protected _multiSelect: boolean; protected _allowDeselect: boolean; protected _selected: GridViewItem[]; protected _activeItem: GridViewItem; /** * Creates a new GridView. * * @param args - The arguments. */ constructor(args?: Readonly); protected _onFocusIn: (evt: FocusEvent) => void; protected _setActiveItem(item: GridViewItem | null): void; protected _onAppendGridViewItem(item: GridViewItem): void; protected _onRemoveGridViewItem(item: GridViewItem): void; protected _onClickItem(evt: MouseEvent, item: GridViewItem): void; protected _onSelectItem(item: GridViewItem): void; protected _onDeselectItem(item: GridViewItem): void; protected _onKeyDown: (evt: KeyboardEvent) => void; protected _onDblClick: (evt: MouseEvent) => void; protected _selectSingleItem(item: GridViewItem): void; protected _findItemInAdjacentRow(item: GridViewItem, direction: number): GridViewItem | null; protected _validateActiveItem(): void; /** * Deselects all selected grid view items. */ deselect(): void; /** * Filters grid view items with the filter function provided in the constructor. */ filter(): void; /** * Filters grid view items asynchronously by only allowing up to the specified number of grid * view item operations. Fires the following events: * * - filter:start - When filtering starts. * - filter:end - When filtering ends. * - filter:delay - When an animation frame is requested to process another batch. * - filter:cancel - When filtering is canceled. * * @param batchLimit - The maximum number of items to show before requesting another animation frame. */ filterAsync(batchLimit?: number): void; /** * Cancels asynchronous filtering. */ filterAsyncCancel(): void; destroy(): void; /** * Gets the selected GridViewItems. */ get selected(): GridViewItem[]; /** * Gets whether the grid layout is vertical or not. */ get vertical(): boolean; } /** * The arguments for the {@link InfoBox} constructor. */ interface InfoBoxArgs extends ContainerArgs { /** * The CSS code for an icon for the {@link InfoBox}. e.g. 'E401' (notice we omit the '\\' character). Defaults to ''. * Useful icon values for InfoBox are: * * - 'E218' - warning * - 'E400' - info */ icon?: string; /** * Sets the 'title' of the {@link InfoBox}. Defaults to ''. */ title?: string; /** * Sets the 'text' of the {@link InfoBox}. Defaults to ''. */ text?: string; /** * If `true`, the {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML innerHTML} property will be * used to set the text. Otherwise, {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent textContent} * will be used instead. Defaults to `false`. */ unsafe?: boolean; } /** * Represents an information box. */ declare class InfoBox extends Container { protected _titleElement: Element$1; protected _textElement: Element$1; protected _unsafe: boolean; protected _icon: string; protected _title: string; protected _text: string; /** * Creates a new InfoBox. * * @param args - The arguments. */ constructor(args?: Readonly); /** * Sets the icon of the info box. */ set icon(value: string); /** * Gets the icon of the info box. */ get icon(): string; /** * Sets the title of the info box. */ set title(value: string); /** * Gets the title of the info box. */ get title(): string; /** * Sets the text of the info box. */ set text(value: string); /** * Gets the text of the info box. */ get text(): string; } /** * The arguments for the {@link LabelGroup} constructor. */ interface LabelGroupArgs extends ContainerArgs { /** * The label text. Defaults to 'Label'. */ text?: string; /** * The {@link Element} to be wrapped by the label group. */ field?: Element$1; /** * Whether to align the label at the top of the group. Defaults to `false` which aligns it at the center. */ labelAlignTop?: boolean; /** * Add a native tooltip to the label. */ nativeTooltip?: boolean; } /** * Represents a group of an {@link Element} and a {@link Label}. Useful for rows of labeled fields. */ declare class LabelGroup extends Container { protected _label: Label; protected _field: Element$1; /** * Creates a new LabelGroup. * * @param args - The arguments. */ constructor(args?: Readonly); /** * The label element. */ get label(): Label; /** * The field element. */ get field(): Element$1; /** * Sets the text of the label. */ set text(value: string); /** * Gets the text of the label. */ get text(): string; /** * Sets whether to align the label at the top of the group. Defaults to `false` which aligns it at the center. */ set labelAlignTop(value: boolean); /** * Gets whether to align the label at the top of the group. */ get labelAlignTop(): boolean; } /** * The arguments for the {@link MenuItem} constructor. */ interface MenuItemArgs extends ContainerArgs { value?: string; /** * Whether the MenuItem has any child MenuItems. */ hasChildren?: boolean; /** * Sets the text shown on the MenuItem. */ text?: string; /** * Sets the CSS code for an icon for the MenuItem. e.g. 'E401' (notice we omit the '\\' character). */ icon?: string; /** * Sets the parent Menu Element. */ menu?: Menu; /** * Sets the function called when we select the MenuItem. */ onSelect?: (evt?: MouseEvent) => void; /** * Sets the function that determines whether the MenuItem should be enabled when the Menu is shown. */ onIsEnabled?: () => boolean; /** * Sets the function that determines whether the MenuItem should be visible when the Menu is shown. */ onIsVisible?: () => boolean; /** * An array of MenuItem constructor data. If defined then child MenuItems will be created and added to the MenuItem. */ items?: MenuItemArgs[]; /** * Sets the keyboard shortcut to display on the MenuItem (e.g., 'Ctrl+C'). */ shortcut?: string; } /** * The MenuItem is a selectable option that is appended to a {@link Menu}. A MenuItem can also * contain child MenuItems (by appending them to the MenuItem). This can be useful to show nested * Menus. */ declare class MenuItem extends Container implements IBindable { /** * The function called when the MenuItem is selected. */ onSelect: (evt?: MouseEvent) => void; /** * The function that determines whether the MenuItem should be enabled when the Menu is shown. */ onIsEnabled: () => boolean; /** * The function that determines whether the MenuItem should be visible when the Menu is shown. */ onIsVisible: () => boolean; protected _containerContent: Container; protected _numChildren: number; protected _icon: string; protected _labelText: Label; protected _labelShortcut: Label; protected _containerItems: Container; protected _menu: Menu; protected _renderChanges: boolean; /** * Creates a new MenuItem. * * @param args - The arguments. */ constructor(args?: Readonly); destroy(): void; protected _onAppendChild(element: Element$1): void; protected _onRemoveChild(element: Element$1): void; protected _onClickMenuItem: (evt: MouseEvent) => void; link(observers: Observer | Observer[], paths: string | string[]): void; unlink(): void; /** * Selects the MenuItem which also happens automatically when the user clicks on the MenuItem. */ select(): void; /** * Sets the text shown on the MenuItem. */ set text(value: string); /** * Gets the text shown on the MenuItem. */ get text(): string; set value(value: string); get value(): string; set values(values: string[]); /** * Sets the CSS code for an icon for the MenuItem. e.g. 'E401' (notice we omit the '\\' character). */ set icon(value: string); /** * Gets the CSS code for an icon for the MenuItem. */ get icon(): string; /** * Sets the keyboard shortcut displayed on the MenuItem. */ set shortcut(value: string); /** * Gets the keyboard shortcut displayed on the MenuItem. */ get shortcut(): string; /** * Sets the binding for the MenuItem label. */ set binding(value: BindingBase); /** * Gets the binding for the MenuItem label. */ get binding(): BindingBase; /** * Sets the menu. */ set menu(value: Menu); /** * Gets the menu. */ get menu(): Menu; /** * Returns whether the MenuItem has children. */ get hasChildren(): boolean; set renderChanges(value: boolean); get renderChanges(): boolean; } /** * The arguments for the {@link Menu} constructor. */ interface MenuArgs extends ContainerArgs { /** * An array of {@link MenuItemArgs}. If these are passed then new MenuItems will be created * and appended to the menu. */ items?: MenuItemArgs[]; /** * Sets whether this {@link Menu} is hidden. Defaults to `true`. */ hidden?: boolean; /** * Sets the tabIndex of the {@link Menu}. Defaults to 1. */ tabIndex?: number; } /** * A Menu is a list of {@link MenuItem}s which can contain child MenuItems. Useful to show context * menus and nested menus. Note that a Menu must be appended to the root Element and then * positioned accordingly. */ declare class Menu extends Container implements IFocusable { protected _containerMenuItems: Container; /** * Creates a new Menu. * * @param args - The arguments. */ constructor(args?: Readonly); destroy(): void; protected _onAppendChild(element: Element$1): void; protected _onRemoveChild(element: Element$1): void; protected _onClickMenu: (evt: MouseEvent) => void; protected _onFocus: (evt: FocusEvent) => void; protected _onBlur: (evt: FocusEvent) => void; protected _filterMenuItems(item: MenuItem): void; protected _onShowMenu(): void; protected _onKeyDown: (evt: KeyboardEvent) => void; protected _limitSubmenuAtScreenEdges(item: MenuItem): void; focus(): void; blur(): void; /** * Positions the top-left corner of the menu at the specified coordinates. * * @param x - The x coordinate. * @param y - The y coordinate. * @example * ```ts * // open a context menu at the mouse position * window.addEventListener('contextmenu', (event) => { * event.stopPropagation(); * event.preventDefault(); * * menu.hidden = false; * menu.position(event.clientX, event.clientY); * }); * ``` */ position(x: number, y: number): void; /** * Remove all the current menu items from the menu. */ clear(): void; } /** * The arguments for the {@link Progress} constructor. */ interface ProgressArgs extends ContainerArgs { /** * Sets the value of the progress bar (between 0 and 100). */ value?: number; } /** * Represents a bar that can highlight progress of an activity. */ declare class Progress extends Container { protected _inner: Element$1; protected _value: number; /** * Creates a new Progress. * * @param args - The arguments. */ constructor(args?: Readonly); /** * Sets the value of the progress bar. The range is from 0 to 100. */ set value(val: number); /** * Gets the value of the progress bar. */ get value(): number; } /** * The arguments for the {@link SliderInput} constructor. */ interface SliderInputArgs extends ElementArgs, IBindableArgs, IPlaceholderArgs { /** * Sets whether any key up event will cause a change event to be fired. */ keyChange?: boolean; /** * Sets the minimum value that the numeric input field can take. */ min?: number; /** * Sets the maximum value that the numeric input field can take. */ max?: number; /** * Sets the minimum value that the slider field can take. Defaults to 0. */ sliderMin?: number; /** * Sets the maximum value that the slider field can take. Defaults to 1. */ sliderMax?: number; /** * Sets the maximum number of decimals a value can take. Defaults to 2. */ precision?: number; /** * Sets the amount that the value will be increased or decreased when using the arrow * keys. Holding Shift will use 10x the step. */ step?: number; /** * Sets whether the value can be null. If not then it will be 0 instead of null. */ allowNull?: boolean; } /** * The SliderInput shows a NumericInput and a slider widget next to it. It acts as a proxy of the * NumericInput. */ declare class SliderInput extends Element$1 implements IBindable, IFocusable, IPlaceholder { protected _historyCombine: boolean; protected _historyPostfix: string; protected _numericInput: NumericInput; protected _sliderMin: number; protected _sliderMax: number; protected _domSlider: HTMLDivElement; protected _domBar: HTMLDivElement; protected _domHandle: HTMLDivElement; protected _cursorHandleOffset: number; protected _pointerId: number; /** * Creates a new SliderInput. * * @param args - The arguments. */ constructor(args?: Readonly); destroy(): void; protected _onPointerDown: (evt: PointerEvent) => void; protected _onPointerMove: (evt: PointerEvent) => void; protected _onPointerUp: (evt: PointerEvent) => void; protected _onKeyDown: (evt: KeyboardEvent) => void; protected _updateHandle(value: number): void; protected _onValueChange(value: number): void; protected _calculateCursorHandleOffset(pageX: number): number; protected _onSlideStart(pageX: number): void; protected _onSlideMove(pageX: number): void; protected _onSlideEnd(pageX: number): void; focus(): void; blur(): void; /** * Sets the minimum value that the slider field can take. */ set sliderMin(value: number); /** * Gets the minimum value that the slider field can take. */ get sliderMin(): number; /** * Sets the maximum value that the slider field can take. */ set sliderMax(value: number); /** * Gets the maximum value that the slider field can take. */ get sliderMax(): number; set value(value: number); get value(): number; set values(values: number[]); set renderChanges(value: boolean); get renderChanges(): boolean; /** * Sets the minimum value that the numeric input field can take. */ set min(value: number); /** * Gets the minimum value that the numeric input field can take. */ get min(): number; /** * Sets the maximum value that the numeric input field can take. */ set max(value: number); /** * Gets the maximum value that the numeric input field can take. */ get max(): number; /** * Sets the amount that the value will be increased or decreased when using the arrow keys. Holding Shift will use 10x the step. */ set step(value: number); /** * Gets the amount that the value will be increased or decreased when using the arrow keys. */ get step(): number; /** * Sets the maximum number of decimals a value can take. */ set precision(value: number); /** * Gets the maximum number of decimals a value can take. */ get precision(): number; set keyChange(value: boolean); get keyChange(): boolean; set placeholder(value: string); get placeholder(): string; } /** * The arguments for the {@link Spinner} constructor. */ interface SpinnerArgs extends ElementArgs { /** * Sets the pixel size of the spinner. Defaults to 12. */ size?: string | number; /** * Can be 'small-thick'. Defaults to 'small-thick'. */ type?: 'small-thick'; } /** * Represents a spinning icon. */ declare class Spinner extends Element$1 { static TYPE_SMALL_THICK: string; /** * Creates a new Spinner. * * @param args - The arguments. */ constructor(args?: Readonly); } /** * The arguments for the {@link TextAreaInput} constructor. */ interface TextAreaInputArgs extends TextInputArgs { /** * Sets which directions the text area can be resized in. One of 'both', 'horizontal', * 'vertical' or 'none'. Defaults to 'none'. */ resizable?: 'horizontal' | 'vertical' | 'both' | 'none'; } /** * The TextAreaInput wraps a textarea element. It has the same interface as {@link TextInput}. */ declare class TextAreaInput extends TextInput { /** * Creates a new TextAreaInput. * * @param args - The arguments. */ constructor(args?: Readonly); protected _onInputKeyDown(evt: KeyboardEvent): void; } type TreeApi = { allowDrag: boolean; allowRenaming: boolean; deselect: () => void; _onAppendTreeViewItem: (item: TreeViewItem) => void; _onRemoveTreeViewItem: (item: TreeViewItem) => void; _onChildKeyDown: (evt: KeyboardEvent, item: TreeViewItem) => void; _updateModifierKeys: (evt: KeyboardEvent | MouseEvent) => void; _onChildDragEnd: (evt: MouseEvent, item: TreeViewItem) => void; _onChildDragOver: (evt: MouseEvent, item: TreeViewItem) => void; _onChildDragStart: (evt: MouseEvent, item: TreeViewItem) => void; _onChildClick: (evt: MouseEvent, item: TreeViewItem) => void; _onContextMenu?: (evt: MouseEvent, item: TreeViewItem) => void; _onChildSelected: (item: TreeViewItem) => void; _onChildDeselected: (item: TreeViewItem) => void; _onChildRename: (item: TreeViewItem, value: string) => void; }; /** * The arguments for the {@link TreeViewItem} constructor. */ interface TreeViewItemArgs extends ContainerArgs { /** * Whether the item is selected. */ selected?: boolean; /** * Whether the item can be selected. Defaults to `true`. */ allowSelect?: boolean; /** * Whether the item is open (showing its children). Defaults to `false`. */ open?: boolean; /** * Whether this {@link TreeViewItem} can be dragged. Only considered if the parent {@link TreeView} * has `allowDrag` set to `true`. Defaults to `true`. */ allowDrag?: boolean; /** * Whether dropping is allowed on the {@link TreeViewItem}. Defaults to `true`. */ allowDrop?: boolean; /** * The text shown by the {@link TreeViewItem}. */ text?: string; /** * The icon shown before the text in the {@link TreeViewItem}. Defaults to 'E360'. */ icon?: string; /** * Method to be called when the {@link TreeViewItem} is selected. */ onSelect?: (deselect: () => void) => void; /** * Method to be called when the {@link TreeViewItem} is deselected. */ onDeselect?: () => void; } /** * A TreeViewItem is a single node in a hierarchical {@link TreeView} control. */ declare class TreeViewItem extends Container { /** * Fired when user selects the TreeViewItem. * * @event * @example * ```ts * treeViewItem.on('select', (item: TreeViewItem) => { * console.log('TreeViewItem selected', item); * }); * ``` */ static readonly EVENT_SELECT = "select"; /** * Fired when user deselects the TreeViewItem. * * @event * @example * ```ts * treeViewItem.on('deselect', (item: TreeViewItem) => { * console.log('TreeViewItem deselected', item); * }); * ``` */ static readonly EVENT_DESELECT = "deselect"; /** * Fired when user opens the TreeViewItem. * * @event * @example * ```ts * treeViewItem.on('open', (item: TreeViewItem) => { * console.log('TreeViewItem opened', item); * }); * ``` */ static readonly EVENT_OPEN = "open"; /** * Fired when user closes the TreeViewItem. * * @event * @example * ```ts * treeViewItem.on('close', (item: TreeViewItem) => { * console.log('TreeViewItem closed', item); * }); * ``` */ static readonly EVENT_CLOSE = "close"; /** * Determines whether dropping is allowed on the tree item. */ allowDrop: boolean; /** * Determines whether this tree item can be dragged. Only considered if the parent * {@link TreeView} has {@link TreeView#allowDrag} set to `true`. */ allowDrag: boolean; /** * Determines whether the item can be selected. */ allowSelect: boolean; protected _containerContents: Container; protected _labelIcon: Label; protected _labelText: Label; protected _numChildren: number; protected _treeView: TreeApi; protected _icon: string; protected _open: boolean; /** * Creates a new TreeViewItem. * * @param args - The arguments. */ constructor(args?: Readonly); destroy(): void; protected _onAppendChild(element: Element$1): void; protected _onRemoveChild(element: Element$1): void; protected _onContentKeyDown: (evt: KeyboardEvent) => void; protected _onContentMouseDown: (evt: MouseEvent) => void; protected _onContentMouseUp: (evt: MouseEvent) => void; protected _onContentMouseOver: (evt: MouseEvent) => void; protected _onContentDragStart: (evt: DragEvent) => void; protected _onContentClick: (evt: MouseEvent) => void; protected _dfs(fn: (item: TreeViewItem) => void): void; protected _onContentDblClick: (evt: MouseEvent) => void; protected _onContentContextMenu: (evt: MouseEvent) => void; protected _onContentFocus: (evt: FocusEvent) => void; protected _onContentBlur: (evt: FocusEvent) => void; rename(): void; focus(): void; blur(): void; /** * Sets whether the item is selected. */ set selected(value: boolean); /** * Gets whether the item is selected. */ get selected(): boolean; /** * Sets the text shown by the TreeViewItem. */ set text(value: string); /** * Gets the text shown by the TreeViewItem. */ get text(): string; /** * Gets the internal label that shows the text. */ get textLabel(): Label; /** * Gets the internal label that shows the icon. */ get iconLabel(): Label; /** * Gets the container that holds the icon and text for this tree view item. Useful for * positioning calculations or appending custom content alongside the item row. */ get content(): Container; /** * Sets whether the item is expanded and showing its children. */ set open(value: boolean); /** * Gets whether the item is expanded and showing its children. */ get open(): boolean; /** * Sets whether the ancestors of the item are open or closed. */ set parentsOpen(value: boolean); /** * Gets whether the ancestors of the item are open or closed. */ get parentsOpen(): boolean; /** * Sets the parent {@link TreeView}. */ set treeView(value: TreeView | null); /** * Gets the parent {@link TreeView}. */ get treeView(): TreeView | null; /** * Gets the number of direct children. */ get numChildren(): number; /** * Gets the first child item. */ get firstChild(): TreeViewItem; /** * Gets the last child item. */ get lastChild(): TreeViewItem; /** * Gets the next sibling item. */ get nextSibling(): TreeViewItem; /** * Gets the previous sibling item. */ get previousSibling(): TreeViewItem; /** * Sets the icon shown before the text in the TreeViewItem. */ set icon(value: string); /** * Gets the icon shown before the text in the TreeViewItem. */ get icon(): string; } /** * Represents an item that has been reparented in a {@link TreeView} drag operation. */ interface ReparentedItem { /** * The reparented tree view item. */ item: TreeViewItem; /** * The old parent of the item. */ oldParent: Element$1; /** * The new parent of the item. */ newParent?: Element$1; /** * The new child index of the item within its new parent. */ newChildIndex?: number; } /** * The arguments for the {@link TreeView} constructor. */ interface TreeViewArgs extends ContainerArgs { /** * Whether dragging a {@link TreeViewItem} is allowed. Defaults to `true`. */ allowDrag?: boolean; /** * Whether reordering {@link TreeViewItem}s is allowed. Defaults to `true`. */ allowReordering?: boolean; /** * Whether renaming {@link TreeViewItem}s is allowed by double clicking on them. Defaults to `false`. */ allowRenaming?: boolean; /** * A filter that searches {@link TreeViewItem}s and only shows the ones that are relevant to the filter. */ filter?: string; /** * A function to be called when we right click on a {@link TreeViewItem}. */ onContextMenu?: (evt: MouseEvent, item: TreeViewItem) => void; /** * A function to be called when we try to reparent tree items. If a function is provided then the * tree items will not be reparented by the {@link TreeView} but instead will rely on the function to * reparent them as it sees fit. */ onReparent?: (reparented: ReparentedItem[]) => void; /** * The element to scroll on drag. Defaults to this {@link TreeView}'s element. */ dragScrollElement?: Element$1; } /** * A container that can show a TreeView like a hierarchy. The TreeView contains * a hierarchy of {@link TreeViewItem}s. */ declare class TreeView extends Container { /** * Fired when user starts dragging selected TreeViewItems. * * @event * @example * ```ts * const treeView = new TreeView({ * allowDrag: true // this is the default but we're showing it here for clarity * }); * treeView.on('dragstart', (items: TreeViewItem[]) => { * console.log(`Drag started of ${items.length} items`); * }); * ``` */ static readonly EVENT_DRAGSTART = "dragstart"; /** * Fired when user stops dragging selected TreeViewItems. * * @event * @example * ```ts * const treeView = new TreeView({ * allowDrag: true // this is the default but we're showing it here for clarity * }); * treeView.on('dragend', () => { * console.log('Drag ended'); * }); * ``` */ static readonly EVENT_DRAGEND = "dragend"; /** * Fired when user reparents TreeViewItems. * * @event * @example * ```ts * const treeView = new TreeView(); * treeView.on('reparent', (reparented: ReparentedItem[]) => { * console.log(`Reparented ${reparented.length} items`); * }); * ``` */ static readonly EVENT_REPARENT = "reparent"; /** * Fired when user selects a TreeViewItem. * * @event * @example * ```ts * const treeView = new TreeView(); * treeView.on('select', (item: TreeViewItem) => { * console.log(`Selected item ${item.text}`); * }); * ``` */ static readonly EVENT_SELECT = "select"; /** * Fired when user deselects a TreeViewItem. * * @event * @example * ```ts * const treeView = new TreeView(); * treeView.on('deselect', (item: TreeViewItem) => { * console.log(`Deselected item ${item.text}`); * }); * ``` */ static readonly EVENT_DESELECT = "deselect"; /** * Fired when user renames a TreeViewItem. * * @event * @example * ```ts * const treeView = new TreeView(); * treeView.on('rename', (item: TreeViewItem, name: string) => { * console.log(`Renamed item to ${name}`); * }); * ``` */ static readonly EVENT_RENAME = "rename"; /** * Determines whether reordering {@link TreeViewItem}s is allowed. */ allowReordering: boolean; /** * Determines whether renaming {@link TreeViewItem}s is allowed by double clicking on them. */ allowRenaming: boolean; protected _selectedItems: TreeViewItem[]; protected _dragItems: TreeViewItem[]; protected _allowDrag: boolean; protected _dragging: boolean; protected _dragOverItem: TreeViewItem; protected _dragArea: string; protected _dragScroll: number; protected _dragScrollInterval: number; protected _dragHandle: Element$1; protected _dragScrollElement: Element$1; protected _onContextMenu: (evt: MouseEvent, item: TreeViewItem) => void; protected _onReparentFn: ((reparented: ReparentedItem[]) => void) | undefined; protected _pressedCtrl: boolean; protected _pressedShift: boolean; protected _pressedArrow: boolean; protected _filter: string; protected _filterResults: TreeViewItem[]; protected _wasDraggingAllowedBeforeFiltering: boolean; protected _activeItem: TreeViewItem; /** * Creates a new TreeView. * * @param args - The arguments. */ constructor(args?: Readonly); destroy(): void; protected _updateModifierKeys: (evt: KeyboardEvent | MouseEvent) => void; protected _onFocusIn: (evt: FocusEvent) => void; protected _setActiveItem(item: TreeViewItem | null): void; /** * Finds the next tree item that is not currently hidden. * * @param currentItem - The current tree item. * @returns The next visible tree item. */ protected _findNextVisibleTreeItem(currentItem: TreeViewItem): TreeViewItem; /** * Finds the last visible child tree item of the specified tree item. * * @param currentItem - The current item. * @returns The last child item. */ protected _findLastVisibleChildTreeItem(currentItem: TreeViewItem): TreeViewItem; /** * Finds the previous visible tree item of the specified tree item. * * @param currentItem - The current tree item. * @returns The previous item. */ protected _findPreviousVisibleTreeItem(currentItem: TreeViewItem): TreeViewItem; /** * Gets the visible tree items between the specified start and end tree items. * * @param startChild - The start tree item. * @param endChild - The end tree item. */ protected _getChildrenRange(startChild: TreeViewItem, endChild: TreeViewItem): TreeViewItem[]; protected _onAppendChild(element: Element$1): void; protected _onRemoveChild(element: Element$1): void; protected _onAppendTreeViewItem(item: TreeViewItem): void; protected _onRemoveTreeViewItem(item: TreeViewItem): void; protected _ensureActiveItem(): void; protected _onChildKeyDown(evt: KeyboardEvent, item: TreeViewItem): void; protected _onChildClick(evt: MouseEvent, item: TreeViewItem): void; /** * Call specified function on every child TreeViewItem by traversing the hierarchy depth first. * * @param fn - The function to call. The function takes the TreeViewItem as an argument. */ protected _traverseDepthFirst(fn: (item: TreeViewItem) => void): void; /** * Do a depth first traversal of all tree items * and assign an order to them so that we know which one * is above the other. Performance wise this means it traverses * all tree items every time however seems to be pretty fast even with 15 - 20 K entities. */ protected _getTreeOrder(): Map; protected _getChildIndex(item: TreeViewItem, parent: Container): number; protected _onChildDragStart(evt: MouseEvent, item: TreeViewItem): void; protected _onChildDragEnd(evt: MouseEvent, item: TreeViewItem): void; protected _onChildDragOver(evt: MouseEvent, item: TreeViewItem): void; protected _onMouseLeave: (evt: MouseEvent) => void; protected _onMouseMove: (evt: MouseEvent) => void; protected _scrollWhileDragging(): void; protected _onDragMove: (evt: MouseEvent) => void; protected _updateDragHandle(dragOverItem?: TreeViewItem, force?: boolean): void; /** * Opens all the parents of the specified item. * * @param endItem - The end tree view item. */ protected _openHierarchy(endItem: TreeViewItem): void; /** * Selects a tree view item. * * @param item - The tree view item. */ protected _selectSingleItem(item: TreeViewItem): void; /** * Called when a child tree view item is selected. * * @param item - The tree view item. */ protected _onChildSelected(item: TreeViewItem): void; /** * Called when a child tree view item is deselected. * * @param item - The tree view item. */ protected _onChildDeselected(item: TreeViewItem): void; /** * Called when a child tree view item is renamed. * * @param item - The tree view item. * @param newName - The new name. */ protected _onChildRename(item: TreeViewItem, newName: string): void; protected _searchItems(items: TreeViewItem[], filter: string): void; /** * Searches the treeview. * * @param filter - The search filter. */ protected _applyFilter(filter: string): void; /** * Clears search filter. */ protected _clearFilter(): void; /** * Show the drag handle on the given tree item. * * @param treeItem - The tree item. */ showDragHandle(treeItem: TreeViewItem): void; /** * Deselects all selected tree view items. */ deselect(): void; /** * Traverses all child {@link TreeViewItem}s using depth first search and calls the supplied * function for each item. * * @param fn - The function to call. The function takes the {@link TreeViewItem} as an argument. * @example * ```ts * treeView.traverse((item: TreeViewItem) => { * console.log(item.text); * }); * ``` */ traverse(fn: (item: TreeViewItem) => void): void; /** * Expands all tree view items. */ expandAll(): void; /** * Collapses all tree view items. */ collapseAll(): void; /** * Removes all child tree view items. */ clearTreeItems(): void; /** * Sets whether dragging a TreeViewItem is allowed. */ set allowDrag(value: boolean); /** * Gets whether dragging a TreeViewItem is allowed. */ get allowDrag(): boolean; /** * Sets whether a TreeViewItem is currently being dragged. */ set isDragging(value: boolean); /** * Gets whether a TreeViewItem is currently being dragged. */ get isDragging(): boolean; /** * Gets all of the currently selected TreeViewItems. */ get selected(): TreeViewItem[]; /** * Sets the filter that searches TreeViewItems and only shows the ones that are relevant to the filter. */ set filter(value: string | null); /** * Gets the filter that searches TreeViewItems and only shows the ones that are relevant to the filter. */ get filter(): string | null; /** * Gets whether Ctrl is currently pressed. */ get pressedCtrl(): boolean; /** * Gets whether Shift is currently pressed. */ get pressedShift(): boolean; /** * Gets whether the selection was triggered by arrow key navigation. */ get pressedArrow(): boolean; } /** * The arguments for the {@link VectorInput} constructor. */ interface VectorInputArgs extends ElementArgs, IBindableArgs, IMultiPlaceholderArgs { /** * The number of dimensions in the vector. Can be between 2 to 4. Defaults to 3. */ dimensions?: 2 | 3 | 4; /** * The minimum value of each vector element. */ min?: number; /** * The maximum value of each vector element. */ max?: number; /** * The incremental step when using arrow keys or dragger for each vector element. */ step?: number; /** * The decimal precision of each vector element. Defaults to 7. */ precision?: number; /** * The incremental step when holding Shift and using arrow keys or dragger for each vector element. */ stepPrecision?: number; } /** * A vector input. The vector can have 2 to 4 dimensions with each dimension being a {@link NumericInput}. */ declare class VectorInput extends Element$1 implements IBindable, IFocusable, IMultiPlaceholder { /** * Fired when the value of the VectorInput changes. * * @event * @example * ```ts * const vectorInput = new VectorInput({ dimensions: 3 }); * vectorInput.on('change', (value: number[]) => { * console.log('Value changed to:', value); * }); * ``` */ static readonly EVENT_CHANGE = "change"; /** * Fired when the VectorInput receives focus. * * @event * @example * ```ts * const vectorInput = new VectorInput(); * vectorInput.on('focus', () => { * console.log('VectorInput focused'); * }); * ``` */ static readonly EVENT_FOCUS = "focus"; /** * Fired when the VectorInput loses focus. * * @event * @example * ```ts * const vectorInput = new VectorInput(); * vectorInput.on('blur', () => { * console.log('VectorInput blurred'); * }); * ``` */ static readonly EVENT_BLUR = "blur"; protected _inputs: NumericInput[]; protected _applyingChange: boolean; protected _bindAllInputs: boolean; /** * Creates a new VectorInput. * * @param args - The arguments. */ constructor(args?: Readonly); protected _onInputChange(input: NumericInput): void; protected _updateValue(value: number[]): boolean; link(observers: Observer | Observer[], paths: string | string[]): void; unlink(): void; /** * Focuses the first input element. */ focus(): void; /** * Unfocuses (blurs) all input elements. */ blur(): void; /** * Sets the value of the VectorInput. This should be an array of numbers matching the * dimensions of the vector (e.g. [x, y] for 2D, [x, y, z] for 3D). */ set value(value: number[]); /** * Gets the value of the VectorInput as an array of numbers. */ get value(): number[]; /** * Sets multiple values on the VectorInput. Each value should be an array representing the * vector dimensions. If all values are the same, the VectorInput will display that value. * Otherwise, it will display a "multiple values" state. */ set values(values: number[][]); /** * Sets the Binding object for the VectorInput. The binding is cloned for each input. */ set binding(value: BindingBase); /** * Gets the Binding object for the VectorInput. */ get binding(): BindingBase; /** * Sets the placeholder text for all inputs. Can be a single string applied to all inputs, * or an array of strings for each input. */ set placeholder(value: string | string[]); /** * Gets the placeholder text of all inputs as an array. */ get placeholder(): string[]; /** * Gets the array of NumericInput elements owned by this vector. */ get inputs(): NumericInput[]; /** * Sets whether inputs should flash when their values change. */ set renderChanges(value: boolean); /** * Gets whether inputs should flash when their values change. */ get renderChanges(): boolean; /** * Sets the minimum value accepted by all inputs of the vector. */ set min(value: number); /** * Gets the minimum value accepted by all inputs of the vector. */ get min(): number; /** * Sets the maximum value accepted by all inputs of the vector. */ set max(value: number); /** * Gets the maximum value accepted by all inputs of the vector. */ get max(): number; /** * Sets the maximum number of decimal places supported by all inputs of the vector. */ set precision(value: number); /** * Gets the maximum number of decimal places supported by all inputs of the vector. */ get precision(): number; /** * Sets the amount that the value will be increased or decreased when using the arrow keys and * the slider input for all inputs of the vector. */ set step(value: number); /** * Gets the amount that the value will be increased or decreased when using the arrow keys and * the slider input for all inputs of the vector. */ get step(): number; } /** * The interface for arguments for the {@link BindingObserversToElement} constructor. */ interface BindingObserversToElementArgs extends BindingBaseArgs { /** * Custom update function. */ customUpdate?: (element: IBindable, observers: Observer[], paths: string[]) => void; } /** * Provides one way binding between Observers and an {@link IBindable} element and Observers. Any * changes from the observers will be propagated to the element. */ declare class BindingObserversToElement extends BindingBase { _customUpdate: (element: IBindable, observers: Observer[], paths: string[]) => void; _eventHandles: EventHandle[]; _updateTimeout: number; /** * Creates a new BindingObserversToElement instance. * * @param args - The arguments. */ constructor(args?: Readonly); private _linkObserver; private _deferUpdateElement; private _updateElement; link(observers: Observer | Observer[], paths: string | string[]): void; /** * Unlink the binding from its set of observers. */ unlink(): void; /** * Clone the BindingObserversToElement instance. */ clone(): BindingObserversToElement; } /** * The interface for arguments for the {@link BindingTwoWay} constructor. */ interface BindingTwoWayArgs extends BindingBaseArgs { /** * BindingElementToObservers instance. */ bindingElementToObservers?: BindingElementToObservers; /** * BindingObserversToElement instance. */ bindingObserversToElement?: BindingObserversToElement; } /** * Provides two way data binding between Observers and {@link IBindable} elements. This means that * when the value of the Observers changes the IBindable will be updated and vice versa. */ declare class BindingTwoWay extends BindingBase { _bindingElementToObservers: BindingElementToObservers; _bindingObserversToElement: BindingObserversToElement; /** * Creates a new BindingTwoWay instance. * * @param args - The arguments. */ constructor(args?: Readonly); link(observers: Observer | Observer[], paths: string | string[]): void; unlink(): void; clone(): BindingTwoWay; setValue(value: unknown): void; setValues(values: unknown[]): void; addValue(value: unknown): void; addValues(values: unknown[]): void; removeValue(value: unknown): void; removeValues(values: unknown[]): void; set element(value: IBindable | undefined); get element(): IBindable | undefined; set applyingChange(value: boolean); get applyingChange(): boolean; set historyCombine(value: boolean); get historyCombine(): boolean; set historyPrefix(value: string); get historyPrefix(): string; set historyPostfix(value: string); get historyPostfix(): string; set historyEnabled(value: boolean); get historyEnabled(): boolean; } /** * PCUI is a front-end framework designed for creating user interfaces in web applications. It is * particularly well-suited for building browser-based tools. It offers a comprehensive set of UI * components like buttons, sliders, menus and data inputs. * * PCUI is written in TypeScript. The API can be used from both TypeScript and JavaScript. A React * wrapper is provided for easy integration with React applications. * * @module PCUI */ /** * The version of the PCUI library. This is a string in semantic version format of `major.minor.patch`. */ declare const version: string; /** * The git revision of the PCUI library. This is a string of the git commit hash. */ declare const revision: string; export { ArrayInput, BindingBase, BindingElementToObservers, BindingObserversToElement, BindingTwoWay, BooleanInput, Button, Canvas, Code, ColorPicker, Container, Divider, Element$1 as Element, GradientPicker, GridView, GridViewItem, InfoBox, InputElement, Label, LabelGroup, Menu, MenuItem, NumericInput, Overlay, Panel, Progress, RadioButton, SelectInput, SliderInput, Spinner, TextAreaInput, TextInput, TreeView, TreeViewItem, VectorInput, revision, version }; export type { ArrayInputArgs, BindingBaseArgs, BindingObserversToElementArgs, BindingTwoWayArgs, BooleanInputArgs, ButtonArgs, CanvasArgs, CodeArgs, ColorPickerArgs, ContainerArgs, ElementArgs, GradientPickerArgs, GridViewArgs, GridViewItemArgs, IBindable, IBindableArgs, IFlexArgs, IFocusable, IParentArgs, IPlaceholder, IPlaceholderArgs, InfoBoxArgs, InputElementArgs, LabelArgs, LabelGroupArgs, MenuArgs, MenuItemArgs, NumericInputArgs, OverlayArgs, PanelArgs, ProgressArgs, RadioButtonArgs, ReparentedItem, SelectInputArgs, SliderInputArgs, SpinnerArgs, TextAreaInputArgs, TextInputArgs, TreeViewArgs, TreeViewItemArgs, VectorInputArgs };