返回 reveal.js
util.d.ts
根目录 / dist / utils / util.d.ts
1 /**
2 * Extend object a with the properties of object b.
3 * If there's a conflict, object b takes precedence.
4 *
5 * @param {object} a
6 * @param {object} b
7 */
8 export declare const extend: (a: Record<string, any>, b: Record<string, any>) => Record<string, any>;
9 /**
10 * querySelectorAll but returns an Array.
11 */
12 export declare const queryAll: (el: Element | Document, selector: string) => Element[];
13 /**
14 * classList.toggle() with cross browser support
15 */
16 export declare const toggleClass: (el: Element, className: string, value: boolean) => void;
17 type DeserializedValue = string | number | boolean | null;
18 /**
19 * Utility for deserializing a value.
20 *
21 * @param {*} value
22 * @return {*}
23 */
24 export declare const deserialize: (value: string) => DeserializedValue;
25 /**
26 * Measures the distance in pixels between point a
27 * and point b.
28 *
29 * @param {object} a point with x/y properties
30 * @param {object} b point with x/y properties
31 *
32 * @return {number}
33 */
34 export declare const distanceBetween: (a: {
35 x: number;
36 y: number;
37 }, b: {
38 x: number;
39 y: number;
40 }) => number;
41 /**
42 * Applies a CSS transform to the target element.
43 *
44 * @param {HTMLElement} element
45 * @param {string} transform
46 */
47 export declare const transformElement: (element: HTMLElement, transform: string) => void;
48 /**
49 * Element.matches with IE support.
50 *
51 * @param {HTMLElement} target The element to match
52 * @param {String} selector The CSS selector to match
53 * the element against
54 *
55 * @return {Boolean}
56 */
57 export declare const matches: (target: any, selector: string) => boolean;
58 /**
59 * Find the closest parent that matches the given
60 * selector.
61 *
62 * @param {HTMLElement} target The child element
63 * @param {String} selector The CSS selector to match
64 * the parents against
65 *
66 * @return {HTMLElement} The matched parent or null
67 * if no matching parent was found
68 */
69 export declare const closest: (target: Element | null, selector: string) => Element | null;
70 /**
71 * Handling the fullscreen functionality via the fullscreen API
72 *
73 * @see http://fullscreen.spec.whatwg.org/
74 * @see https://developer.mozilla.org/en-US/docs/DOM/Using_fullscreen_mode
75 */
76 export declare const enterFullscreen: (element?: Element) => void;
77 /**
78 * Creates an HTML element and returns a reference to it.
79 * If the element already exists the existing instance will
80 * be returned.
81 *
82 * @param {HTMLElement} container
83 * @param {string} tagname
84 * @param {string} classname
85 * @param {string} innerHTML
86 *
87 * @return {HTMLElement}
88 */
89 export declare const createSingletonNode: (container: Element, tagname: string, classname: string, innerHTML?: string) => Element;
90 /**
91 * Injects the given CSS styles into the DOM.
92 *
93 * @param {string} value
94 */
95 export declare const createStyleSheet: (value: string) => HTMLStyleElement;
96 /**
97 * Returns a key:value hash of all query params.
98 */
99 export declare const getQueryHash: () => Record<string, DeserializedValue>;
100 /**
101 * Returns the remaining height within the parent of the
102 * target element.
103 *
104 * remaining height = [ configured parent height ] - [ current parent height ]
105 *
106 * @param {HTMLElement} element
107 * @param {number} [height]
108 */
109 export declare const getRemainingHeight: (element: HTMLElement | null, height?: number) => number;
110 /**
111 * Guess the MIME type for common file formats.
112 */
113 export declare const getMimeTypeFromFile: (filename?: string) => string | undefined;
114 /**
115 * Encodes a string for RFC3986-compliant URL format.
116 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI#encoding_for_rfc3986
117 *
118 * @param {string} url
119 */
120 export declare const encodeRFC3986URI: (url?: string) => string;
121 export {};
122
122 lines TYPESCRIPT