import type { TemplateResult } from '@mantou/gem/lib/element'; import type { Store } from '@mantou/gem/lib/store'; import type { NonPrimitive } from '@mantou/gem/lib/utils'; /**Similar `lodash.keyBy` */ export declare function convertToMap, V = T>(list: (T | null)[], key: keyof T): Record; export declare function convertToMap, V = string>(list: (T | null)[], key: keyof T, value: keyof T, fallback?: any): Record; /**Get Cascader/Tree max deep*/ export declare function getCascaderDeep(list: T[], cascaderKey: keyof T): number; /** * Get the value from the bottom layer, * compare the new value of the upper layer to choose a new value, bubbling to the top layer */ export declare function getCascaderBubbleWeakMap, F extends (_: T) => any, K = Exclude, undefined | null>>(list: T[] | undefined, cascaderKey: keyof T, getValue: F, comparerFn?: (bottomValue: K, topValue: K) => K, setValueCallback?: (item: T, bubbleValue: K) => void): WeakMap; /**Simple proxy object, use prop name as a fallback when reading prop */ export declare function proxyObject(object: Record): Record; type ReadPropOptions = { fill?: boolean; onlyFillIntermediate?: boolean; }; /**Deep read prop */ export declare function readProp(obj: Record, paths: string | number | symbol | string[], options?: ReadPropOptions): any; /**Only let the last add Promise take effect, don’t care about the order of Resolve */ export declare class OrderlyPromisePool { pool: any[]; add(promise: Promise, callback: (r: T) => void): void; } export declare enum ComparerType { Eq = "eq", Gte = "gte", Lte = "lte", Lt = "lt", Gt = "gt", Ne = "ne", Miss = "miss", Have = "have" } /**Serialize comparer */ export declare function comparer(a: any, comparerType: ComparerType, b: any): boolean; /**Serialized `TemplateResult` return text content */ export declare function getStringFromTemplate(input: TemplateResult | string): string; /**Segmentation search word */ export declare function splitString(s: string): string[]; /**Search */ export declare function isIncludesString(origin: TemplateResult | string, search: string, caseSensitive?: boolean): boolean; export type UseCacheStoreOptions = { cacheExcludeKeys?: (keyof T)[]; prefix?: string | (() => string | undefined); depStore?: Store; }; /**Create auto cache(localStorage) Store */ export declare function createCacheStore>(storageKey: string, initStore: T, options?: UseCacheStoreOptions): { store: ((value?: Partial | undefined) => void) & Omit<{ name: never; apply: never; call: never; bind: never; toString: never; prototype: never; length: never; arguments: never; caller: never; [Symbol.hasInstance]: never; [Symbol.metadata]: never; }, keyof T> & T; saveStore: () => void; }; export declare function isRemoteIcon(icon: string | Element | DocumentFragment): icon is string; /** * Pass additional fields * * not support async function */ export declare class DyPromise> extends Promise { static new>(executor: (resolve: (value: V | PromiseLike) => void, reject: (reason?: any) => void) => void, props: U): DyPromise & U; then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): DyPromise & E; catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): DyPromise & E; finally(onfinally?: (() => void) | null | undefined): DyPromise & E; } export declare const ignoredPromiseReasonSet: WeakSet; export {}; //# sourceMappingURL=utils.d.ts.map