import "bootstrap-icons/font/bootstrap-icons.min.css";
import '../src/css/patch.css';
export declare class Widget {
#private;
/**
* @param tag - The tag type of the widget.
* @param ns - The namespace of the widget.
*/
constructor(tag?: string | HTMLElement, ns?: string);
/**
* Adds child widget to the widget.
* @param child - The child widget to add.
* @returns - Itself.
*/
addChild(child: Widget): this;
/**
* Adds child widgets to the widget.
* @param children - The child widgets to add.
* @returns - Itself.
*/
addChildren(...args: Widget[]): this;
/**
* Adds given CSS classes to the widget.
* @param args
* @returns - Itself.
*/
addClass(...args: string[]): this;
/**
* Attaches an event handler to the widget
* @param event - A String that specifies the name of the {@link https://developer.mozilla.org/en-US/docs/Web/Events | event.}
* @param callback - Specifies the function to run when the event occurs.
* @param options - A Boolean value that specifies whether the event should be executed in the capturing or in the bubbling phase.
* @example
* ```javascript
* myWidget.addEventListener("click", () => consoleLog("clicked"))
* ```
* @returns - Itself.
*/
addEventListener(event: string, callback: EventListener, options?: boolean | AddEventListenerOptions): this;
/**
* The classes are named using the format {property}{sides}-{size} for xs and
* {property}{sides}-{breakpoint}-{size} for sm, md, lg, xl, and xxl.
*
* Where property is one of:
* - m - for classes that set margin
* - p - for classes that set padding
*
* Where sides is one of:
* - t - for classes that set margin-top or padding-top
* - b - for classes that set margin-bottom or padding-bottom
* - s - for classes that set margin-left or padding-left in LTR, margin-right or padding-right in RTL
* - e - for classes that set margin-right or padding-right in LTR, margin-left or padding-left in RTL
* - x - for classes that set both *-left and *-right
* - y - for classes that set both *-top and *-bottom
* - blank - for classes that set a margin or padding on all 4 sides of the element
*
* Where size is one of:
* - 0 - for classes that eliminate the margin or padding by setting it to 0
* - 1 - (by default) for classes that set the margin or padding to $spacer * .25
* - 2 - (by default) for classes that set the margin or padding to $spacer * .5
* - 3 - (by default) for classes that set the margin or padding to $spacer
* - 4 - (by default) for classes that set the margin or padding to $spacer * 1.5
* - 5 - (by default) for classes that set the margin or padding to $spacer * 3
* - auto - for classes that set the margin to auto
*
* @example
* ```javascript
* myWidget.setSpace("m-2", "ps-1")
* ```
* @param args
* @returns - Itself.
*/
addSpacing(...args: string[]): this;
/**
* Sets alignment of the widget along the {@link ALIGN_CROSS | cross axis} in parent layout space. This is the vertical axis for {@link Row | Row}, horizontal axis for {@link Column | Column}.
* @param alignment
* @param breakpoint
* @example
* ```javascript
* // Button will be aligned to center position in it's parent space.
* myWidget.align("center")
* // Button will be aligned to start position in it's parent space.
* // Once small breakpoint is reached, button will be aligned to end position.
* myWidget.align("start").align("end", "sm")
* ```
* @returns - Itself.
*/
align(alignment?: ALIGNMENT, breakpoint?: BREAKPOINT): this;
/**
* Sets the alingment of the widget's inner text.
* @param value
* @param breakpoint
* @returns - Itself.
*/
alignText(value?: "start" | "center" | "end", breakpoint?: BREAKPOINT): this;
/**
* Allows performing additional computations inside method chain by providing object - Itself..
* @param callback
* @example
* ```javascript
* myWidget.addChild(
* new Text().apply(self => {
* count(self, 0);
* })
* )
* function count(widget, timer) {
* widget.setText(`${timer++} seconds passed.`);
* setTimeout(()=>count(widget, timer), 1000);
* }
* ```
* @returns - Itself.
*/
apply(callback: (self: Widget) => void): this;
/**
* Applies a Gaussian blur to the input image.
* @param value
* @param unit
* @returns - Itself.
*/
blur(value?: number, unit?: UNIT): this;
/**
* Clears all children from the widget.
* @returns - Itself.
*/
clearChildren(): this;
/**
* Clears all events from the widget.
* @returns - Itself.
*/
clearEventListeners(): this;
/**
* Clears space classes from the widget.
* @returns - Itself.
*/
clearSpacing(): this;
click(): this;
/**
* Disables the widget for user interaction.
* @returns - Itself.
*/
disable(): this;
/**
* Sets the visibility property of element.
* @param value
* @param breakpoint
* @returns - Itself.
*/
display(value?: boolean, breakpoint?: BREAKPOINT): this;
/**
* Enables the widget for user interaction.
* @returns - Itself.
*/
enable(): this;
/**
* Fills the widget on parent's available space on main axis relative to its content size or width value if its set.
* @param value
* @param breakpoint
* @returns - Itself.
*/
fill(value?: boolean, breakpoint?: BREAKPOINT): this;
/**
* Fixes position on the screen. It will only work if parent's overflow poroperty not set.
* @param value
* @returns - Itself.
*/
fixPosition(value?: "fixed-top" | "fixed-bottom" | "sticky-top" | "sticky-sm-top" | "sticky-md-top" | "sticky-lg-top" | "sticky-xl-top"): this;
/**
* Sets focus on the widget, if it can be focused. The focused widget will receive keyboard and similar events by default
* @returns - Itself.
*/
focus(): this;
/**
* Sets the font type to italic.
* @param value
* @returns - Itself.
*/
fontItalic(value?: boolean): this;
/**
* Sets font type to monospace.
* @param value
* @returns - Itself.
*/
fontMonospace(value?: boolean): this;
/**
* Returns the value of a specified attribute on the widget.
* @returns Attribute value of specified attribute.
*/
getAttribute(attribute: string): string | undefined;
/**
* Returns child widget from the specified index.
* @param idx
* @returns Child widget from the specified index.
*/
getChild(idx: number): Widget;
/**
* Returns children widgets as array.
* @returns Children widgets as array.
*/
getChildren(): Widget[];
/**
* Returns the inner height of an element in pixels.
* @returns The inner height of an element in pixels.
*/
getClientHeight(): number;
/**
* Returns the width of the left border of an element in pixels.
* @returns The width of the left border of an element in pixels.
*/
getClientLeft(): number;
/**
* Returns the width of the top border of an element in pixels.
* @returns The width of the top border of an element in pixels.
*/
getClientTop(): number;
/**
* Returns the inner width of an element in pixels.
* @returns The inner width of an element in pixels.
*/
getClientWidth(): number;
/**
* Returns height value of the widget.
* @returns height of the widget.
*/
getHeight(): string;
/**
* Returns inner html value of the widget.
* @returns Inner html value of the widget.
*/
getInnerHTML(): any;
/**
* Returns html dom element of the widget.
* @returns Html dom element of the widget.
*/
getDom(): HTMLElement;
/**
* Returns max height value of the widget.
* @returns Max height value of the widget.
*/
getMaxHeight(): string;
/**
* Returns max width value of the widget.
* @returns Max width value of the widget.
*/
getMaxWidth(): string;
/**
* Returns min height value of the widget.
* @returns Min height value of the widget.
*/
getMinHeight(): string;
/**
* Returns min width value of the widget.
* @returns Min width value of the widget.
*/
getMinWidth(): string;
/**
* Returns the height of an element, including vertical padding and borders, as an integer.
* @returns the height of an element, including vertical padding and borders, as an integer.
*/
getOffsetHeight(): number;
/**
* Returns the number of pixels that the upper left corner of the current element is offset to the left within the offsetParent node.
* @returns The number of pixels that the upper left corner of the current element is offset to the left within the offsetParent node.
*/
getOffsetLeft(): number;
/**
* Returns the distance of the outer border of the current element relative to the inner border of the top of the offsetParent node.
* @returns The distance of the outer border of the current element relative to the inner border of the top of the offsetParent node.
*/
getOffsetTop(): number;
/**
* Returns the layout width of an element as an integer.
* @returns The layout width of an element as an integer.
*/
getOffsetWidth(): number;
/**
* Returns parent widget of the widget.
* @returns Parent widget of the widget.
*/
getParent(): Widget | undefined;
/**
* Returns the value of a specified property of the widget's dom element.
* @returns Value of a specified property.
*/
getProperty(property: string): any;
/**
* Returns the height of an element's content, including content not visible on the screen due to overflow
* @returns the height of an element's content, including content not visible on the screen due to overflow.
*/
getScrollHeight(): number;
/**
* Returns the number of pixels that an element's content is scrolled from its left edge.
* @returns the number of pixels that an element's content is scrolled from its left edge.
*/
getScrollLeft(): number;
/**
* Returns the number of pixels that an element's content is scrolled vertically.
* @returns the number of pixels that an element's content is scrolled vertically.
*/
getScrollTop(): number;
/**
* Returns the width of an element's content, including content not visible on the screen due to overflow.
* @returns the width of an element's content, including content not visible on the screen due to overflow.
*/
getScrollWidth(): number;
/**
* Returns the specified style property of the widget.
* @param style
* @returns Style property
*/
getStyle(style: string): string;
/**
* Returns inner text of the widget.
* @returns Inner text of the widget.
*/
getText(): any;
/**
* Transform value of the widget.
* @returns Transform value.
*/
getTransform(): string;
/**
* Returns width value of the widget.
* @returns width of the widget.
*/
getWidth(): string;
/**
* It will grow on its parent main axis.
* @param {number|string} [value = 1] - { 0 | 1 | "none"}
* @param {BREAKPOINT} [breakpoint] - { "sm" | "md" | "lg" | "xl" | "xxl" | "none" }
* @returns {Widget} - Self.
*/
/**
* Fills the widget on parent's available space on main axis.
* @param value
* @returns - Itself.
*/
grow(value?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | "clear"): this;
/**
* Checks if specified attribute is present in the widget.
* @param attribute
* @returns
*/
hasAttribute(attribute: string): boolean;
/**
* Checks if specified widget is child of the widget.
* @param child
* @returns
*/
hasChild(child: Widget): boolean;
/**
* Checks if specified CSS class is present in the widget.
* @param child
* @returns
*/
hasClass(className: string): boolean;
/**
* Hides the widget and removes element space in the page.
* @returns - Itself.
*/
hide(): this;
/**
* Hides tooltip of the widget.
* @returns - Itself.
*/
hideTooltip(): this;
/**
* Inserts child widget at specified index.
* @param idx
* @param child
* @returns - Itself.
*/
insertChild(idx: number, child: Widget): this;
/**
* Inverts the color samples in the input image.
* @param value
* @param unit
* @returns - Itself.
*/
invert(value?: number, unit?: UNIT): this;
/**
* Returns hidden state of the widget.
* @returns {boolean}
*/
isHidden(): boolean;
/**
* Checks if widget is in the visible DOM hierarch.
* @returns
*/
isInViewport(): boolean;
onClick(callback?: (self: Widget, e: Event) => void): this;
/**
* Removes given attributes from widget.
* @param args
* @returns - Itself.
*/
removeAttribute(...args: string[]): this;
/**
* Removes given children from widget.
* @param args
* @returns - Itself.
*/
removeChild(...args: Widget[]): this;
/**
* Removes child from widget at given index.
* @param idx
* @returns - Itself.
*/
removeChildAt(idx: number): this;
/**
* Removes given CSS classes from widget.
* @param args
* @returns - Itself.
*/
removeClass(...args: string[]): this;
/**
* Removes specified listener from widget.
* @param callback
* @param evnt
* @returns - Itself.
*/
removeEventListener(callback: EventListener, evnt?: string): this;
/**
* Removes given styles from widget.
* @param args
* @returns - Itself.
*/
removeStyle(...args: string[]): this;
/**
* Removes given space classes from widget.
* @param args
* @returns - Itself.
*/
removeSpacing(...args: string[]): this;
/**
* Renders widget to given html element once document is loaded.
* @param dom
* @returns - Itself.
*/
render(dom?: HTMLElement): this;
/**
* Replaces child widget at specified index.
* @param child
* @param idx
* @returns - Itself.
*/
replaceChild(idx: number, child: Widget): this;
replaceChildren(...child: Widget[]): this;
/**
* Defines a transformation that rotates an element around a fixed point on the 2D plane, without deforming it.
* @param value
* @param unit
* @example
* ```javascript
* // Rotates element by 90 degrees
* myWidget.rotate(90)
*
* // Rotates element by 2 turns
* myWidget.rotate(2, "turn")
* ```
* @returns - Itself.
*/
rotate(value?: number, unit?: ANGLE): this;
/**
* Runs given function after widget dom is mounted to document. Runs immediately if dom is already mounted.
* @param callback - Function to run after widget's dom is mounted to document.
* @example
* ```javascript
* myWidget.runOnMount(() => console.log("dom is mounted!"))
* ```
* @returns - Itself.
*/
runOnMount(callback: ((self: Widget) => void)): this;
/**
* Saturates or desaturates the input image.
* @param value
* @param unit
* @returns - Itself.
*/
saturate(value?: number, unit?: UNIT): this;
/**
* Defines a transformation that resizes an element on the 2D plane
* @param x
* @param y
* @example
* ```javascript
* myWidget.scale(2, 2)
* ```
* @returns - Itself.
*/
scale(x?: number, y?: number): this;
/**
* Scrolls widget into view.
* @param alignToTop
* @example
* ```javascript
* myWidget.scrollIntoView()
* ```
* @returns - Itself.
*/
scrollIntoView(alignToTop?: boolean | ScrollIntoViewOptions): void;
/**
* Defines a transformation that skews an element on the 2D plane.
* @param x
* @param y
* @param unit
* @example
* ```javascript
* myWidget.skew(.2, .4, "rad")
* ```
* @returns - Itself.
*/
skew(x?: number, y?: number, unit?: ANGLE): this;
/**
* Sets given attributes to widget's HTML element.
* @param attribute
* @param value
* @returns - Itself.
*/
setAttribute(attribute: string, value: any): this;
/**
* Sets background color of widget.
* @param value - primary | secondary | success | danger | warning | info | light | dark
* @returns - this.
*/
setBgColor(value?: BG_COLOR, gradient?: boolean): this;
/**
* Sets background images on the widget.
* @param value - Path to image, valid inputs: "url", "none", "initial", "inherit", "revert", "unset"
* @returns - Itself.
*/
setBgImage(value?: "inherit" | "initial" | "revert" | "unset" | string): this;
/**
* Creates an image consisting of a progressive transition between two or more colors.
* @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient() | linear-gradient}
* @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/radial-gradient() | radial-gradient}
* @param values
* @param options
* @param options.type
* @param options.repeat
* @param options.angleOrPos - The angle or position of the gradient.
* @example
* ```javascript
* myWidget.setBgGradient([green, "red 50%"], {type: linear, angleOrPos:60})
* myWidget.setBgGradient([green %10, "red 50%"], {type: linear, angleOrPos:"to bottom right"})
* myWidget.setBgGradient([green, "red 50%"], {type: radial, angleOrPos:"closest-corner"})
* ```
* @returns - Itself.
*/
setBgGradient(values?: string[], options?: {
type?: "linear" | "radial";
repeat?: boolean;
angleOrPos?: number | string;
}): this;
/**
* Sets the initial position for each background image.
* @param x
* @param y
* @param unit
* @returns - Itself.
*/
setBgPosition(x?: "left" | "center" | "right" | "inherit" | "initial" | "revert" | "unset" | number, y?: "top" | "center" | "bottom" | number, unit?: UNIT): this;
/**
* Sets how background images are repeated. A background image can be repeated along the horizontal and vertical axes, or not repeated at all.
* @param x
* @param y
* @returns - Itself.
*/
setBgRepeat(x?: "repeat" | "space" | "round" | "no-repeat" | "repeat-x" | "repeat-y" | "inherit" | "initial" | "revert" | "unset", y?: "repeat" | "space" | "round" | "no-repeat"): this;
/**
* Sets the size of the widgets's background image. The image can be left to its natural size, stretched, or constrained to fit the available space.
* @param x
* @param y
* @param unit
* @returns - Itself.
*/
setBgSize(x?: "cover" | "contain" | "inherit" | "initial" | "revert" | "unset" | "auto" | number, y?: "auto" | number, unit?: UNIT): this;
/**
* Enables backgroud hover color effect.
* @param value - Dark or light, disables if undefined.
* @returns
*/
setBgHoverColor(value?: "dark" | "light"): this;
/**
* Adds or removes this element’s borders
* @param value - Additive border value.
* @param parameters
* @param parameters.subtractive - Reverts border value.
* @param parameters.color - Hex color code, valid inputs: "rgb", "rgba", "rrggbb", "rrggbbaa", "#rgb", "#rgba", "#rrggbb", "#rrggbbaa" | "initial" | "inherit"
* @param parameters.width - Line thickness.
* @returns - Itself.
*/
setBorder(value?: BORDER | BORDER[], options?: {
subtractive?: boolean;
color?: COLOR;
width?: 1 | 2 | 3 | 4 | 5;
}): this;
/**
* The bottom property participates in setting the vertical position of a {@link POSITION | positioned element.} It has no effect on non-positioned elements.
* @param value
* @param unit
* @returns
*/
setBottomPos(value?: number | string, unit?: UNIT): this;
/**
* Applies a linear multiplier to the input image, making it appear brighter or darker
* @param value
* @param unit
* @returns
*/
setBrightness(value?: number, unit?: UNIT): this;
/**
* Replaces children with the given ones.
* @param args
* @returns - Itself.
*/
setChild(child?: Widget): this;
/**
* Replaces CSS classes with the given ones.
* @param args
* @returns - Itself.
*/
setClass(...args: string[]): this;
/**
* Adjusts the contrast of the input image.
* @param value
* @param unit
* @returns - Itself.
*/
setContrast(value?: number, unit?: UNIT): this;
/**
* The {@link https://developer.mozilla.org/en-US/docs/Web/CSS/cursor | cursor} property sets the type of mouse cursor, if any, to show when the mouse pointer is over an widget.
* @param value
* @returns - Itself.
*/
setCursor(value?: CURSOR): this;
/**
* Sets the display order of item.
* @param value
* @param breakpoint
* @returns - Itself.
*/
setDisplayOrder(value?: 0 | 1 | 2 | 3 | 4 | 5 | "first" | "last", breakpoint?: BREAKPOINT): this;
/**
* Applies a drop shadow effect to the input image.
* @param x
* @param y
* @param options
* @param options.blur
* @param options.color
* @param options.unit
* @returns - Itself.
*/
setDropShadow(x?: number, y?: number, options?: {
blur?: number;
color?: string;
unit?: UNIT;
}): this;
/**
* Specifies whether the content of an widget should be editable.
* @param value
* @returns - Itself.
*/
setEditable(value?: boolean): this;
/**
* Sets the size of the font.
* @param value
* @param unit
* @returns - Itself.
*/
setFontSize(value?: number | string, unit?: UNIT): this;
/**
* Sets the tickness of the font.
* @param value
* @returns - Itself.
*/
setFontWeight(value?: "bold" | "bolder" | "normal" | "light" | "lighter"): this;
/**
* Converts the input image to grayscale.
* @param value
* @param unit
* @returns - Itself.
*/
setGrayscale(value?: number, unit?: UNIT): this;
/**
* Sets height of the widget.
* @param value
* @param unit
* @returns - Itself.
*/
setHeight(value?: number | string, unit?: UNIT): this;
/**
* Rotates the hue of an widget and its contents.
* @param value
* @param unit
* @returns - Itself.
*/
setHue(value?: number, unit?: ANGLE): this;
/**
* Sets the inner HTML of the widget.
* @param value
* @returns - Itself.
*/
setInnerHTML(value?: string): this;
/**
* The left property participates in setting the horizontal position of a {@link POSITION | positioned element.} It has no effect on non-positioned elements.
* @param value
* @param unit
* @returns - Itself.
*/
setLeftPos(value?: number | string, unit?: UNIT): this;
/**
* Sets max height of the widget.
* @param value
* @param unit
* @returns - Itself.
*/
setMaxHeight(value?: number | string, unit?: UNIT): this;
/**
* Sets max width and max height of the widget.
* @param width
* @param height
* @param unit
* @returns - Itself.
*/
setMaxSize(width?: number | string, height?: number | string, unit?: UNIT): this;
/**
* Sets max width of the widget.
* @param value
* @param unit
* @returns - Itself.
*/
setMaxWidth(value?: number | string, unit?: UNIT): this;
/**
* Sets min height of the widget.
* @param value
* @param unit
* @returns - Itself.
*/
setMinHeight(value?: number | string, unit?: UNIT): this;
/**
* Sets min width and min height of the widget.
* @param width
* @param height
* @param unit
* @returns - Itself.
*/
setMinSize(width?: number | string, height?: number | string, unit?: UNIT): this;
/**
* Sets min width of the widget.
* @param value
* @param unit
* @returns - Itself.
*/
setMinWidth(value?: number | string, unit?: UNIT): this;
/**
* A string representing the attribute's qualified name.
* @param {string} value
*/
setName(name?: string): this;
/**
* A string representing the attribute's qualified name.
*/
getName(): string | undefined;
/**
* Sets the opacity of an widget. Opacity is the degree to which content behind an element is hidden, and is the opposite of transparency.
* @param value
* @returns - Itself.
*/
setOpacity(value?: number): this;
/**
* Sets the rotation origin. Clears if nothing is passed.
* @param x
* @param y
* @param unit
* @returns - Itself.
*/
setOrigin(x?: "left" | "center" | "right" | number, y?: "top" | "center" | "bottom" | number, unit?: UNIT): this;
/**
* Sets the desired behavior for an element's overflow. Clears if nothing is passed.
* @param value
* @returns - Itself.
*/
setOverflow(value?: OVERFLOW, breakpoint?: BREAKPOINT): this;
/**
* Set parent of the widget. Use addChild instead.
* @param parent
* @returns - Itself.
*/
private setParent;
/**
* Arrange elements with the edge.
* @param args
* @returns - Itself.
*/
setPlacement(...args: PLACEMENT[]): this;
/**
* Enables or disables cursor interaction for this element.
* @param value
* @returns - Itself.
*/
setPointerInteraction(value?: "none" | "auto"): this;
/**
* Adds given propery to widget's DOM object.
* @param property
* @param value
* @returns
*/
setProperty(property: string, value: any): this;
/**
* Sets the position of the element. Clears if nothing is passed.
* @param value
* @param unit
* @returns - Itself.
* @example
* ```javascript
* widget.setPosition("center")
* widget.setPosition(["left", "top"])
* widget.setPosition({top: 10, left: 20})
* widget.setPosition({bottom: 10, right: 20}, "em")
* ```
*/
setPosition(value?: SIDE | SIDE[] | {
top?: number;
right?: number;
bottom?: number;
left?: number;
}, unit?: UNIT): this;
/**
* The position property sets how an element is positioned in a document. The setTopPos, setRightPos, setBottomPos, and setLeftPos properties determine the final location of positioned elements.
* @param value
* @returns - Itself.
*/
setPositioning(value?: POSITION): this;
/**
* Manages the aspect ratios of content. Width needs to be defined.
* @param ratio
* @returns - Itself.
*/
setRatio(ratio?: "1x1" | "4x3" | "16x9" | "21x9"): this;
expose(key: string, obj: any | null): this;
/**
* Sets the resizing methot of layout. The resize property does not apply to inline elements or to block elements where overflow="visible".
* So, make sure that overflow is set to "scroll", "auto", or "hidden".
* @param value
* @returns - Itself.
*/
setResizable(value?: string | "both" | "horizontal" | "none" | "vertical" | "inherit" | "initial" | "unset"): this;
/**
* The right property participates in setting the horizontal position of a {@link POSITION | positioned element.} It has no effect on non-positioned elements.
* @param value
* @param unit
* @returns - Itself.
*/
setRightPos(value?: number | string, unit?: UNIT): this;
/**
* Sets or removes round corners.
* @param value
* @param size
* @returns Itsellf
*/
setRound(value?: "all" | "top" | "end" | "bottom" | "start" | "circle" | "pill" | "none", size?: 0 | 1 | 2 | 3 | 4 | 5): this;
/**
* Sets the number of pixels that an element's content is scrolled from its left edge.
* @param - The number of pixels to scroll.
* @returns Itself
*/
setScrollLeft(value: number): this;
/**
* Sets the number of pixels that an element's content is scrolled vertically.
* @param - The number of pixels to scroll.
* @returns Itself
*/
setScrollTop(value: number): this;
/**
* Sets shadow of the widget.
* @param value
* @returns - Itself.
*/
setShadow(value?: "sm" | "md" | "lg" | "xl"): this;
/**
* Sets width and height of the widget.
* @param width
* @param height
* @param unit
* @returns - Itself.
*/
setSize(width?: number | string, height?: number | string, unit?: UNIT): this;
/**
* Set a specific style of an element using different CSS properties.
* @param type
* @param value
*
* @example
* ```javascript
* myWidget.setStyle("backgroundColor", "white")
* ```
*/
setStyle(type: string, value: any): this;
/**
* Sets the tab index of the widget.
* @param value
* @returns - Itself.
* @example
* ```javascript
* myWidget.setTabIndex(1)
* ```
*/
setTabIndex(value?: number | string): this;
/**
* Returns the tab index of the widget.
* @returns - string
*/
getTabIndex(): string | null;
/**
* Sets the inner text of the widget.
* @param value
* @returns - Itself.
*/
setText(value?: string): this;
/**
* Sets the text color. Reset inherits the color from its parent. None removes color class.
* @param value
* @returns - Itself.
*/
setTextColor(value?: TEXT_COLOR): this;
/**
* Sets text decoration style.
* @param value
* @returns - Itself.
*/
setTextDecoration(value?: "none" | "underline" | "line-through"): this;
/**
* Sets the selectable state of the widget's inner text.
* @param value
* @returns - Itself.
*/
setTextInteraction(value?: "none" | "all" | "auto"): this;
/**
* Sets text line height.
* @param value
* @returns - Itself.
*/
setTextLineHeight(value?: "1" | "sm" | "base" | "lg"): this;
/**
* Sets text overflow behavior.
* @param value
* @returns - Itself.
*/
setTextOverflow(value?: "clip" | "ellipsis"): this;
/**
* Sets text shadow.
* @param value
* @param color
* @returns - Itself.
*/
setTextShadow(value?: "sm" | "md" | "lg"): this;
/**
* @param {"lowercase" | "uppercase" | "capitalize" | "none"} value - { "lowercase" | "uppercase" | "capitalize" | "none" }
* @returns {Widget} - Self.
*/
setTextTransform(value?: "lowercase" | "uppercase" | "capitalize"): this;
/**
* @param {"wrap" | "nowrap" | "none"} value - { "wrap" | "nowrap" | "none" }
* @returns {Widget} - Self.
*/
setTextWrap(value?: "wrap" | "nowrap"): this;
/**
* Adds tooltip to given position. Existing tooltip will be removed if title is not given.
* @param title - Default value of the title.
* @param options
* @param options.animation - Apply a CSS fade transition to the popover
* @param options.content - Default value of the body
* @param options.delay - Delay showing the popover (ms)
* @param options.placement - How to position the popover { "top" | "bottom" | "right" | "left" | "auto" }
* @param options.trigger - How popover is triggered { "click" | "hover" | "focus" | "manual" }
* @param options.offset - Offset of the popover relative to its target
* @returns - Itself.
*/
setTooltip(content?: string, options?: {
animation?: boolean;
delay?: number;
hide?: number;
placement?: "top" | "bottom" | "right" | "left" | "auto";
title?: string;
trigger?: "click" | "hover" | "focus" | "manual";
offset?: [number, number];
onShow?: (() => any);
onHide?: (() => any);
}): this;
/**
* The top property participates in setting the vertical position of a {@link POSITION | positioned element.} It has no effect on non-positioned elements.
* @param value
* @param unit
* @returns
*/
setTopPos(value?: number | string, unit?: UNIT): this;
/**
* The transform CSS property lets you rotate, scale, skew, or translate an element.
* @param value
* @returns - Itself.
*/
setTransform(value?: string): this;
/**
* Sets width of the widget.
* @param value
* @param unit
* @returns - Itself.
*/
setWidth(value?: number | string, unit?: UNIT): this;
/**
* Control the visibility of elements, without modifying their display, with visibility utilities. Invisible widgets still take up space in the page.
* @param value
* @returns - Itself.
*/
setVisibility(value?: boolean): this;
/**
* Sets z depth of the widget.
* @param value
* @returns - Itself.
*/
setZIndex(value?: number): this;
/**
* Makes the widget visible by modifying display property.
* @returns - Itself.
*/
show(): this;
/**
* Shows tooltip.
* @returns - Itself.
*/
showTooltip(): this;
/**
* Shrinks on its parent main axis.
* @param value
* @param breakpoint
* @returns - Itself.
*/
shrink(value?: 0 | 1 | "clear", breakpoint?: BREAKPOINT): this;
/**
* Stretches widget to parent width and height. Margings should not be set to be able to work properly.
* @param x
* @param y
* @returns - Itself.
*/
stretch(x?: SIZING, y?: SIZING): this;
/**
* Stretches widget to parent width. Margings should not be set to be able to work properly.
* @param value
* @param breakpoint
* @returns - Itself.
*/
stretchX(value?: SIZING, breakpoint?: BREAKPOINT): this;
/**
* Stretches widget to parent height. Margings should not be set to be able to work properly.
* @param value
* @param breakpoint
* @returns - Itself.
*/
stretchY(value?: SIZING, breakpoint?: BREAKPOINT): this;
/**
* Prevent long strings of text from breaking your components.
* @param value
* @returns Itelf
*/
textBreak(value?: boolean): this;
/**
* Repositions an element in the horizontal and/or vertical directions
* @param x
* @param y
* @param unit
* @example
* ```javascript
* myWidget.translate(100, 80)
* ```
* @returns - Itself.
*/
translate(x?: number, y?: number, unit?: UNIT): this;
/**
* Applies the transformations translateX(-50%) and translateY(-50%) to the element which,
* in combination with the edge positioning utilities, allows you to absolute center an element.
* @param value
* @returns - Itself.
*/
translateMiddle(value?: "x" | "y" | "both" | "clear"): this;
/**
* Sets truncate behaviour.
* @param value
* @returns - Itself.
*/
truncateText(value?: boolean): this;
/**
* Removes keyboard focus from the current element.
* @returns - Itself.
*/
unfocus(): this;
}
export declare class Layout extends Widget {
#private;
constructor(type?: "row" | "col");
/**
* Add fake element to push all other elements to the side. This element won't be added to the children list.
* @returns - Itself.
* @example
* ```javascript
* const layout = new Row().addChild(new Text("Test"))
* .addStretch();
* ```
*/
addStretch(): this;
/**
* Removes all fake elements.
* @returns - Itself.
* @example
* ```javascript
* layout.clearStretches();
* ```
*/
clearStretches(): this;
/**
* Aligns this element on the cross axis of parent.
* @param crossAxis
* @param breakpoint
* @returns - Itself.
*/
alignItems(crossAxis: ALIGNMENT, breakpoint?: BREAKPOINT): this;
/**
* Aligns this element on the cross axis of parent.
* @param mainAxis
* @param breakpoint
* @returns - Itself.
*/
justifyItems(mainAxis: JUSTIFY, breakpoint?: BREAKPOINT): this;
/**
* Adds or removes this element’s borders
* @param {Object} [parameters]
* @param {boolean} [parameters.reverse = false]
* @param {BREAKPOINT} [parameters.breakpoint] - { "sm" | "md" | "lg" | "xl" | "xxl" | "none" }
* @returns {Widget} - Self.
*/
column(breakpoint?: BREAKPOINT, reverse?: boolean): this;
reverse(breakpoint?: BREAKPOINT): this;
/**
* Adds or removes this element’s borders
* @param {Object} [parameters]
* @param {boolean} [parameters.reverse = false]
* @param {BREAKPOINT} [parameters.breakpoint] - { "sm" | "md" | "lg" | "xl" | "xxl" | "none" }
* @returns {Widget} - Self.
*/
row(breakpoint?: BREAKPOINT, reverse?: boolean): this;
snapToBreakpoints(value?: boolean, breakpoint?: BREAKPOINT): this;
/**
* Enables scroll spy for sub elements.
* - It must be used on a Nav component or List group.
* - Scrollspy requires position: relative; on the element you’re spying on.
* - Anchors required and must point to an element with that id.
* - If you’re making a scrollable container (other than the
), be sure to have a height set and overflow-y: scroll; applied to it—alongside a tabindex="0" to ensure keyboard access.
*
* @param {boolean} value
* @param {object} options
* @param {string} options.target - ID the parent element of spy controls.
* @param {string} options.offset - Scroll offset
* @param {string} options.tabindex
* @returns {Widget} - Self.
*/
scrollSpy(value?: boolean, options?: {
target?: string;
offset?: number;
tabindex?: number;
}): this;
/**
* @param {ContextMenu} menu
* @param {boolean} triggerOnChild - Allows child elements trigger context menu
* @returns {Widget} - Self.
*/
setContextMenu(menu?: ContextMenu): this;
/**
* Sets the gap between children.
* @param {number} value
* @param {string} [unit="px"]
* @returns {Widget} - Self.
*/
setGap(value: number, unit?: UNIT): this;
/**
* Change how items wrap in a this container.
* @param {boolean} [value = 1] - { 0 | 1 | "none" }
* @param {Object} [parameters]
* @param {BREAKPOINT} [parameters.breakpoint] - { "sm" | "md" | "lg" | "xl" | "xxl" }
* @param {boolean} [parameters.reverse = false]
* @returns {Widget} - Self.
*/
wrapItems(value?: boolean | null, breakpoint?: BREAKPOINT, reverse?: boolean): this;
onScrollToBottom(callback?: (self: Widget) => void, offset?: number): this;
}
export declare class Row extends Layout {
constructor();
}
export declare class Column extends Layout {
constructor();
}
export declare class Stack extends Widget {
constructor();
}
export declare const Router: {
"__#3@#routes": any;
add(path: string, handler?: ((args: {
[key: string]: any;
}) => void) | undefined): any;
parse(path: string): {
handler: any;
params: {
[key: string]: any;
};
searchParams: {
[key: string]: any;
};
anchor: string;
path: string;
} | undefined;
_navigate(path: string, options?: {
message?: any;
history?: boolean;
}): any;
navigate(path: string, options?: {
message?: any;
history?: boolean;
}): void;
};
export declare class Route extends Column {
#private;
constructor(baseRoute?: string, defaultRoute?: string);
addRoute(route: string, element: () => Widget, handler?: (args: {
[key: string]: any;
}) => void): this;
setBaseRoute(route: string): this;
}
export declare class App extends Route {
#private;
constructor();
onLoad(cb: (self: Widget) => {}): this;
loadTheme(theme: string): this;
render(dom?: HTMLElement): this;
}
export declare class Input extends Widget {
#private;
constructor(type: string);
/**
* Controls whether and how text input is automatically capitalized
* @param { off | on | words | characters | string } value - Supported types: "url" | "email" | "password"
*/
setAutocapitalize(value?: "off" | "on" | "words" | "characters" | "none" | string): this;
/**
* Whether is automatically capitalized or not
*/
getAutocapitalize(): string | undefined;
/**
* Specifies hint for form autofill feature
* @param {string} autocomplete - Valid input: "all"
*/
autocomplete(autocomplete: string): this;
/**
* Hint for form autofill feature
*/
isAutocomplete(): boolean;
/**
* Automatically focus the control when the page is loaded
* @param {boolean} autofocus
*/
autofocus(autofocus: boolean): this;
/**
* Focus state
*/
isAutofocus(): boolean;
/**
* Specifies the default value of the input
* @param {any} dv - Valid input: "all"
*/
setDefaultValue(dv: any): this;
/**
* Default value of the input
*/
getDefaultValue(): any;
/**
* Specifies name of form field to use for sending the element's directionality in form submission
* @param {string} value - Valid input: "text" | "search"
*/
setDirname(dirname: string): this;
/**
* Name of form field to use for sending the element's directionality in form submission
*/
getDirname(): string | undefined;
/**
* Specifies id of the form that this input element belongs to
*/
setFormId(formId: string): this;
/**
* Id of the form element this input element belongs to
*/
getFormId(): string | undefined;
/**
* Specifies the width (in characters) of an input field
*/
setInputLength(inputLength: number): this;
/**
* Width (in characters) of an input field
*/
getInputLength(): string | undefined;
/**
* Specifies the value of the id attribute of the