import { TItemKey } from '../composable'; import { ComponentPublicInstance, ComponentInternalInstance, ComputedGetter, InjectionKey, PropType, Ref, ToRefs, VNodeProps, VNodeChild, AllowedComponentProps, Component, VNode, VNodeArrayChildren } from 'vue'; export declare const preventedScrollClass = "cds-scroll-blocked"; export declare const keyNames: Record; export declare const classesStates: Readonly<{ hover: "cds-state-hover"; focus: "cds-state-focus"; active: "cds-state-active"; visited: "cds-state-visited"; disabled: "cds-state-disabled"; checked: "cds-state-checked"; indeterminate: "cds-state-indeterminate"; invalid: "cds-state-invalid"; empty: "cds-state-empty"; loading: "cds-state-loading"; readonly: "cds-state-readonly"; dragging: "cds-state-dragging"; }>; export declare function keys(o: O): (keyof O)[]; export declare function has(obj: object, key: T[]): obj is Record; export declare function isString(value: any): value is string; export declare function isArray(value: any): boolean; export declare function isSymbol(value: any): value is symbol; /** * Check if value is a object. * @param obj */ export declare function isObject(obj: any): obj is object; /** * Check if value is a Date. * @param value */ export declare function isDate(value: any): boolean; /** * Check if value is a Window object. * @param obj */ export declare function isWindow(obj: any): boolean; /** * Add item from array if not exists. * @param array * @param value */ export declare function addItemToArray(array: T[], value: T): T[]; /** * Remove item from array if exists. * @param array * @param value */ export declare function removeItemFromArray(array: T[], value: T): T[]; /** * Deep merge two objects. * @param source * @param target * @param arrayFn */ export declare function mergeDeep(source?: Record, target?: Record, arrayFn?: (a: unknown[], b: unknown[]) => unknown[]): Record; /** * Deep compare two values to determine if they are equivalent. * @param a * @param b */ export declare function deepEqual(a: any, b: any): boolean; /** * Wrap value in array if it's not already an array * @param value */ type IfAny = 0 extends 1 & T ? Y : N; export declare function wrapInArray(value: T | T[] | null | undefined): T extends readonly any[] ? IfAny : NonNullable[]; /** * Get the nested value of an object at a given path. * @param obj * @param path * @param fallback */ export declare function getNestedValue(obj: any, path: (string | number)[], fallback?: any): any; /** * Get the value of an object at a given path. * @param obj * @param path * @param fallback */ export declare function getObjectValueByPath(obj: any, path: string, fallback?: any): any; /** * This function is used to get the value of a property from an item. The property can be a string, an array, a function, or a boolean. * If the property is a string, it will be used as a path to retrieve the value from the item. * If the property is an array, it will be used as a nested path to retrieve the value from the item. * If the property is a function, it will be called with the item and the fallback value as arguments, and its return value will be used. * If the property is a boolean, and it's true, the item itself will be returned. * If the property is null, undefined, or a boolean that's not true, the fallback value will be returned. * If the item is not an object, and the property is not a function, the fallback value will be returned. * If the property is not a string, an array, or a function, the fallback value will be returned. * If the value retrieved from the item is undefined, the fallback value will be returned. * * @param item - The item from which to get the property value. * @param property - The property to get from the item. Can be a string, an array, a function, or a boolean. * @param fallback - The value to return if the property is not found or its value is undefined. * @returns The value of the property from the item, or the fallback value. */ export declare function getPropertyFromItem(item: any, property: SelectItemKey, fallback?: any): any; /** * This function is used to return the scroll position of the given element. * @param target * @param top */ export declare function getScroll(target: HTMLElement | Window | Document | null, top: boolean): number; /** * @description This function is used to return a copy of the object that is composed of the picked object properties. * @param obj * @param paths */ export declare function pick>(obj: T, paths: U[]): [yes: MaybePick, no: Omit]; /** * @description This function is used to return a copy of the object that is composed of the picked object properties * excluding the specified properties. * @param obj * @param paths * @param exclude */ export declare function pickWithRest, E extends Extract>(obj: T, paths: U[], exclude?: E[]): [yes: MaybePick>, no: Omit>]; export declare function pickWithRest, E extends Extract>(obj: T, paths: (U | RegExp)[], exclude?: E[]): [yes: Partial, no: Partial]; /** * Convert a computed ref to a record of refs. * The getter function must always return an object with the same keys. */ export declare function destructComputed(getter: ComputedGetter>): ToRefs; /** * Array.includes but value can be any type * @param arr * @param val */ export declare function includes(arr: readonly any[], val: any): boolean; export declare function eventName(propName: string): string; export declare function convertToUnit(str: number, unit?: string): string; export declare function convertToUnit(str: string | number | null | undefined, unit?: string): string | undefined; export declare function convertRemToPx(value: string): number; /** * Clamp a value between a min and max * @param value * @param min * @param max */ export declare function clamp(value: number, min?: number, max?: number): number; export declare function createRange(length: number, start?: number): number[]; /** * Is value an like event * @param key */ export declare const onRE: RegExp; export declare const isOn: (key: string) => boolean; export declare const bubblingEvents: string[]; export declare const EventProp: PropType; export declare function isComponentInstance(obj: any): obj is ComponentPublicInstance; export declare function isFixedPosition(el?: HTMLElement): boolean; export declare function padEnd(str: string, length: number, char?: string): string; export declare function padStart(string: number | string, targetLength: number, padString: string): string; export declare function pad(n: string | number, length?: number): string; export declare function refElement(obj: ComponentPublicInstance | HTMLElement): HTMLElement | undefined; export declare function omit(obj: T, fields: K[]): Omit; export declare function findChildrenWithProvide(key: InjectionKey | symbol, vnode?: VNodeChild | { [key: string]: any; }): ComponentInternalInstance[]; export declare function focusableChildren(el: Element): HTMLElement[]; /** * https://github.com/lodash/lodash/blob/master/partition.js * @param items * @param predicates */ export declare function partition(items: T[], predicates: (item: T) => boolean): [T[], T[]]; export declare function matchesSelector(el: T | Element | undefined, selector: string): boolean | null; /** * Debounce function * @param fn * @param delay */ export declare function debounce(fn: Function, delay: number): (...args: any[]) => void; /** * Pluralize a word based on a number. * @param n * @param opts */ export declare function plurals(n: number, opts: string[]): string; /** * Chunk a string into an array of strings. * @param str * @param size */ export declare function chunk(str: string, size?: number): string[]; export declare function defer(timeout: number, cb: () => void): () => void; export declare function isValidElement(element: any): any; export declare function ensureValidVNode(vnodes: VNodeArrayChildren): VNodeArrayChildren | null; export declare function noop(): void; export declare function isClickInsideElement(event: MouseEvent, targetDiv: HTMLElement): boolean; /** * Types */ export type MaybeRef = T | Ref; declare type VNodeChildAtom = VNode | string | number | boolean | null | undefined | void; export type VueNode = VNodeChildAtom | VNodeChildAtom[]; export type SelectItemKey = TItemKey; export type MaybePick> = Record extends T ? Partial> : Pick; export type EventProp any> = T; type NotAUnion = [T] extends [infer U] ? _NotAUnion : never; type _NotAUnion = U extends any ? ([T] extends [U] ? unknown : never) : never; export type ComponentProps = C extends new (...args: any) => any ? Omit['$props'], keyof VNodeProps | keyof AllowedComponentProps> : never; /** * Maybe it's a ref, or a plain value, or a getter function * * ```ts * type MaybeRefOrGetter = (() => T) | T | Ref | ComputedRef * ``` */ export type MaybeRefOrGetter = MaybeRef | (() => T); export type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; export {};