1 | import { EventEmitter } from '../stencil-public-runtime';
|
2 | import { Side } from '../interface';
|
3 | /**
|
4 | * Waits for a component to be ready for
|
5 | * both custom element and non-custom element builds.
|
6 | * If non-custom element build, el.componentOnReady
|
7 | * will be used.
|
8 | * For custom element builds, we wait a frame
|
9 | * so that the inner contents of the component
|
10 | * have a chance to render.
|
11 | *
|
12 | * Use this utility rather than calling
|
13 | * el.componentOnReady yourself.
|
14 | */
|
15 | export declare const componentOnReady: (el: any, callback: any) => void;
|
16 | /**
|
17 | * Elements inside of web components sometimes need to inherit global attributes
|
18 | * set on the host. For example, the inner input in `ion-input` should inherit
|
19 | * the `title` attribute that developers set directly on `ion-input`. This
|
20 | * helper function should be called in componentWillLoad and assigned to a variable
|
21 | * that is later used in the render function.
|
22 | *
|
23 | * This does not need to be reactive as changing attributes on the host element
|
24 | * does not trigger a re-render.
|
25 | */
|
26 | export declare const inheritAttributes: (el: HTMLElement, attributes?: string[]) => {
|
27 | [k: string]: any;
|
28 | };
|
29 | export declare const addEventListener: (el: any, eventName: string, callback: any, opts?: any) => any;
|
30 | export declare const removeEventListener: (el: any, eventName: string, callback: any, opts?: any) => any;
|
31 | /**
|
32 | * Gets the root context of a shadow dom element
|
33 | * On newer browsers this will be the shadowRoot,
|
34 | * but for older browser this may just be the
|
35 | * element itself.
|
36 | *
|
37 | * Useful for whenever you need to explicitly
|
38 | * do "myElement.shadowRoot!.querySelector(...)".
|
39 | */
|
40 | export declare const getElementRoot: (el: HTMLElement, fallback?: HTMLElement) => HTMLElement | ShadowRoot;
|
41 | /**
|
42 | * Patched version of requestAnimationFrame that avoids ngzone
|
43 | * Use only when you know ngzone should not run
|
44 | */
|
45 | export declare const raf: (h: any) => any;
|
46 | export declare const hasShadowDom: (el: HTMLElement) => boolean;
|
47 | export declare const findItemLabel: (componentEl: HTMLElement) => HTMLIonLabelElement | null;
|
48 | /**
|
49 | * This method is used for Ionic's input components that use Shadow DOM. In
|
50 | * order to properly label the inputs to work with screen readers, we need
|
51 | * to get the text content of the label outside of the shadow root and pass
|
52 | * it to the input inside of the shadow root.
|
53 | *
|
54 | * Referencing label elements by id from outside of the component is
|
55 | * impossible due to the shadow boundary, read more here:
|
56 | * https://developer.salesforce.com/blogs/2020/01/accessibility-for-web-components.html
|
57 | *
|
58 | * @param componentEl The shadow element that needs the aria label
|
59 | * @param inputId The unique identifier for the input
|
60 | */
|
61 | export declare const getAriaLabel: (componentEl: HTMLElement, inputId: string) => {
|
62 | label: Element | null;
|
63 | labelId: string;
|
64 | labelText: string | null | undefined;
|
65 | };
|
66 | /**
|
67 | * This method is used to add a hidden input to a host element that contains
|
68 | * a Shadow DOM. It does not add the input inside of the Shadow root which
|
69 | * allows it to be picked up inside of forms. It should contain the same
|
70 | * values as the host element.
|
71 | *
|
72 | * @param always Add a hidden input even if the container does not use Shadow
|
73 | * @param container The element where the input will be added
|
74 | * @param name The name of the input
|
75 | * @param value The value of the input
|
76 | * @param disabled If true, the input is disabled
|
77 | */
|
78 | export declare const renderHiddenInput: (always: boolean, container: HTMLElement, name: string, value: string | undefined | null, disabled: boolean) => void;
|
79 | export declare const clamp: (min: number, n: number, max: number) => number;
|
80 | export declare const assert: (actual: any, reason: string) => void;
|
81 | export declare const now: (ev: UIEvent) => number;
|
82 | export declare const pointerCoord: (ev: any) => {
|
83 | x: number;
|
84 | y: number;
|
85 | };
|
86 | /**
|
87 | * @hidden
|
88 | * Given a side, return if it should be on the end
|
89 | * based on the value of dir
|
90 | * @param side the side
|
91 | * @param isRTL whether the application dir is rtl
|
92 | */
|
93 | export declare const isEndSide: (side: Side) => boolean;
|
94 | export declare const deferEvent: (event: EventEmitter) => EventEmitter;
|
95 | export declare const debounceEvent: (event: EventEmitter, wait: number) => EventEmitter;
|
96 | export declare const debounce: (func: (...args: any[]) => void, wait?: number) => (...args: any[]) => any;
|