uni-shared.d.ts 3.9 KB
Newer Older
fxy060608's avatar
fxy060608 已提交
1 2 3
import { FontFaceDescriptors } from 'css-font-loading-module';

export declare function addFont(family: string, source: string, desc?: FontFaceDescriptors): Promise<void>;
fxy060608's avatar
fxy060608 已提交
4 5 6

export declare const BUILT_IN_TAGS: string[];

Q
qiang 已提交
7 8 9 10 11 12 13
export declare function callOptions(options: Options, errMsg: string): void;

export declare function callOptions(options: Options, data: {
    [key: string]: any;
    errMsg: string;
}): void;

fxy060608's avatar
fxy060608 已提交
14 15
export declare const COMPONENT_NAME_PREFIX = "VUni";

fxy060608's avatar
fxy060608 已提交
16 17 18
export declare const COMPONENT_PREFIX: string;

export declare const COMPONENT_SELECTOR_PREFIX = "uni-";
fxy060608's avatar
fxy060608 已提交
19

fxy060608's avatar
fxy060608 已提交
20 21
export declare function createRpx2Unit(unit: string, unitRatio: number, unitPrecision: number): (val: string) => string;

fxy060608's avatar
fxy060608 已提交
22 23 24 25 26
export declare function debounce(fn: Function, delay: number): {
    (this: any): void;
    cancel(): void;
};

fxy060608's avatar
fxy060608 已提交
27 28 29 30 31 32 33 34 35 36 37
/**
 * Decode text using `decodeURIComponent`. Returns the original text if it
 * fails.
 *
 * @param text - string to decode
 * @returns decoded string
 */
export declare function decode(text: string | number): string;

export declare function decodedQuery(query?: Record<string, any>): Record<string, string>;

fxy060608's avatar
fxy060608 已提交
38 39 40 41 42 43
export declare const defaultRpx2Unit: {
    unit: string;
    unitRatio: number;
    unitPrecision: number;
};

D
DCloud_LXH 已提交
44 45 46 47 48
export declare function formatDateTime({ date, mode }: {
    date?: Date | undefined;
    mode?: string | undefined;
}): string;

Q
qiang 已提交
49 50
export declare function getCostomDataset(el: HTMLElement | HTMLElementWithDataset): DOMStringMap & Record<string, any>;

fxy060608's avatar
fxy060608 已提交
51 52
export declare function getEnvLocale(): string;

fxy060608's avatar
fxy060608 已提交
53 54
export declare function getLen(str?: string): number;

Q
qiang 已提交
55 56 57 58 59 60
declare interface HTMLElementWithDataset extends HTMLElement {
    __uniDataset?: Record<string, any>;
}

export declare function initCostomDataset(): void;

fxy060608's avatar
fxy060608 已提交
61 62
export declare const invokeArrayFns: (fns: Function[], arg?: any) => any;

fxy060608's avatar
fxy060608 已提交
63 64 65 66 67 68 69 70
export declare function isBuiltInComponent(tag: string): boolean;

export declare function isCustomElement(tag: string): boolean;

export declare function isNativeTag(tag: string): boolean;

export declare const NAVBAR_HEIGHT = 44;

fxy060608's avatar
fxy060608 已提交
71 72
export declare function normalizeDataset(el: Element): any;

fxy060608's avatar
fxy060608 已提交
73 74
export declare function normalizeTarget(el: HTMLElement): {
    id: string;
Q
qiang 已提交
75
    dataset: DOMStringMap & Record<string, any>;
fxy060608's avatar
fxy060608 已提交
76 77 78 79
    offsetTop: number;
    offsetLeft: number;
};

fxy060608's avatar
fxy060608 已提交
80 81
export declare const ON_REACH_BOTTOM_DISTANCE = 50;

fxy060608's avatar
fxy060608 已提交
82
export declare function once<T extends (...args: any[]) => any>(fn: T, ctx?: unknown): T;
fxy060608's avatar
fxy060608 已提交
83

Q
qiang 已提交
84 85 86 87 88 89
declare interface Options {
    success?: (res: any) => void;
    fail?: (res: any) => void;
    complete?: (res: any) => void;
}

fxy060608's avatar
fxy060608 已提交
90 91 92 93 94 95 96 97 98
/**
 * https://github.com/vuejs/vue-router-next/blob/master/src/query.ts
 * @internal
 *
 * @param search - search string to parse
 * @returns a query object
 */
export declare function parseQuery(search: string): Record<string, any>;

fxy060608's avatar
fxy060608 已提交
99 100 101 102
export declare function passive(passive: boolean): {
    passive: boolean;
};

fxy060608's avatar
fxy060608 已提交
103 104
export declare const PLUS_RE: RegExp;

fxy060608's avatar
fxy060608 已提交
105 106
export declare function plusReady(callback: () => void): void;

fxy060608's avatar
fxy060608 已提交
107 108
export declare const PRIMARY_COLOR = "#007aff";

fxy060608's avatar
fxy060608 已提交
109 110
export declare function removeLeadingSlash(str: string): string;

fxy060608's avatar
fxy060608 已提交
111 112
export declare const RESPONSIVE_MIN_WIDTH = 768;

fxy060608's avatar
fxy060608 已提交
113 114
export declare type Rpx2UnitOptions = typeof defaultRpx2Unit;

fxy060608's avatar
fxy060608 已提交
115 116
export declare const sanitise: (val: unknown) => any;

fxy060608's avatar
fxy060608 已提交
117 118 119
declare function scrollTo_2(scrollTop: number | string, duration: number): void;
export { scrollTo_2 as scrollTo }

fxy060608's avatar
fxy060608 已提交
120 121 122 123 124 125
export declare function stringifyQuery(obj?: Record<string, any>, encodeStr?: typeof encodeURIComponent): string;

export declare const TABBAR_HEIGHT = 50;

export declare const TAGS: string[];

fxy060608's avatar
fxy060608 已提交
126 127 128 129 130 131
export declare const UNI_SSR = "__uniSSR";

export declare const UNI_SSR_DATA = "data";

export declare const UNI_SSR_GLOBAL_DATA = "globalData";

fxy060608's avatar
fxy060608 已提交
132 133
export declare const UNI_SSR_STORE = "store";

fxy060608's avatar
fxy060608 已提交
134 135
export declare function updateElementStyle(element: HTMLElement, styles: Partial<CSSStyleDeclaration>): void;

fxy060608's avatar
fxy060608 已提交
136
export { }