@arcgis/components-utils 4.33.0-next.98 → 4.34.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,4 +2,4 @@ import { Nil } from './types';
2
2
  /**
3
3
  * Find a value in an array, and return it's mapped variant.
4
4
  */
5
- export declare function mappedFind<Item, ReturnType>(array: readonly Item[], callback: (item: Item, index: number) => Nil | ReturnType): ReturnType | undefined;
5
+ export declare const mappedFind: <Item, ReturnType>(array: readonly Item[], callback: (item: Item, index: number) => Nil | ReturnType) => ReturnType | undefined;
@@ -2,4 +2,4 @@ import { Nil } from './types';
2
2
  /**
3
3
  * Find a value in an array, and return it's mapped variant.
4
4
  */
5
- export declare function mappedFind<Item, ReturnType>(array: readonly Item[], callback: (item: Item, index: number) => Nil | ReturnType): ReturnType | undefined;
5
+ export declare const mappedFind: <Item, ReturnType>(array: readonly Item[], callback: (item: Item, index: number) => Nil | ReturnType) => ReturnType | undefined;
@@ -12,4 +12,4 @@ import { Nil } from './types';
12
12
  * This function is not necessary in a Lit package as Lit's `classMap` directive
13
13
  * accepts an object
14
14
  */
15
- export declare function classes(...classes: (Nil | Record<string, boolean> | string[] | string | false)[]): string;
15
+ export declare const classes: (...classes: (Nil | Record<string, boolean> | string[] | string | false)[]) => string;
@@ -12,4 +12,4 @@ import { Nil } from './types';
12
12
  * This function is not necessary in a Lit package as Lit's `classMap` directive
13
13
  * accepts an object
14
14
  */
15
- export declare function classes(...classes: (Nil | Record<string, boolean> | string[] | string | false)[]): string;
15
+ export declare const classes: (...classes: (Nil | Record<string, boolean> | string[] | string | false)[]) => string;
@@ -14,17 +14,22 @@ export declare class Deferred<T> {
14
14
  * The promise that can be awaited.
15
15
  */
16
16
  promise: Promise<T>;
17
+ /**
18
+ * Creates a new deferred promise.
19
+ */
20
+ constructor();
21
+ }
22
+ export interface Deferred<T> {
17
23
  /**
18
24
  * Resolves the promise.
19
25
  * @param value The value to resolve the promise with.
26
+ *
27
+ * @privateRemarks
28
+ * Defined as a method to disable covariance checks. Overridden in constructor.
20
29
  */
21
30
  resolve(_value: PromiseLike<T> | T): void;
22
31
  /**
23
32
  * Rejects the promise.
24
33
  */
25
34
  reject(_error: unknown): void;
26
- /**
27
- * Creates a new deferred promise.
28
- */
29
- constructor();
30
35
  }
@@ -14,17 +14,22 @@ export declare class Deferred<T> {
14
14
  * The promise that can be awaited.
15
15
  */
16
16
  promise: Promise<T>;
17
+ /**
18
+ * Creates a new deferred promise.
19
+ */
20
+ constructor();
21
+ }
22
+ export interface Deferred<T> {
17
23
  /**
18
24
  * Resolves the promise.
19
25
  * @param value The value to resolve the promise with.
26
+ *
27
+ * @privateRemarks
28
+ * Defined as a method to disable covariance checks. Overridden in constructor.
20
29
  */
21
30
  resolve(_value: PromiseLike<T> | T): void;
22
31
  /**
23
32
  * Rejects the promise.
24
33
  */
25
34
  reject(_error: unknown): void;
26
- /**
27
- * Creates a new deferred promise.
28
- */
29
- constructor();
30
35
  }
package/dist/dom.d.cts CHANGED
@@ -7,7 +7,7 @@
7
7
  * @param callback The callback to invoke when the attributes have been changed.
8
8
  * @returns The mutation observer
9
9
  */
10
- export declare function observeAncestorsMutation(element: Node, attributeFilter: string[], callback: () => void): () => void;
10
+ export declare const observeAncestorsMutation: (element: Node, attributeFilter: string[], callback: () => void) => (() => void);
11
11
  /**
12
12
  * Find the closest element that matches the selector.
13
13
  * It will traverse the element's ancestors to find the target element.
@@ -16,7 +16,7 @@ export declare function observeAncestorsMutation(element: Node, attributeFilter:
16
16
  * @param selector The selector to match.
17
17
  * @returns The closest element that matches the selector or null if not found.
18
18
  */
19
- export declare function closestElement(base: Element, selector: string): Element | null;
19
+ export declare const closestElement: (base: Element, selector: string) => Element | null;
20
20
  /**
21
21
  * Use the Calcite mode to determine the theme of the element.
22
22
  * It will traverse the element's ancestors to find the theme.
@@ -24,13 +24,13 @@ export declare function closestElement(base: Element, selector: string): Element
24
24
  * @param base The element to start the search from.
25
25
  * @returns The theme of the element, either "light" or "dark", "light" is the default.
26
26
  */
27
- export declare function getElementTheme(base: Element): "dark" | "light";
27
+ export declare const getElementTheme: (base: Element) => "dark" | "light";
28
28
  /**
29
29
  * Get direction property of closest element.
30
30
  * @param el The element to start the search from.
31
31
  * @returns The direction of the element, either "ltr" | "rtl", "ltr" is the default.
32
32
  */
33
- export declare function getElementDir(el: HTMLElement): "ltr" | "rtl";
33
+ export declare const getElementDir: (el: HTMLElement) => "ltr" | "rtl";
34
34
  /**
35
35
  * Get the attribute value from the element.
36
36
  * It will traverse the element's ancestors to find the attribute.
@@ -42,11 +42,11 @@ export declare function getElementDir(el: HTMLElement): "ltr" | "rtl";
42
42
  * @param fallbackValue The fallback value if the attribute is not found.
43
43
  * @returns The attribute value or the fallback value if the attribute is not found.
44
44
  */
45
- export declare function getElementAttribute(el: Element, prop: string, fallbackValue: string): string;
45
+ export declare const getElementAttribute: (el: Element, prop: string, fallbackValue: string) => string;
46
46
  export interface FocusableElement extends HTMLElement {
47
47
  setFocus?: () => Promise<void>;
48
48
  }
49
- export declare function focusElement(el: FocusableElement | undefined): Promise<void>;
49
+ export declare const focusElement: (el: FocusableElement | undefined) => Promise<void>;
50
50
  /**
51
51
  * Set the focus on the element that matches the selector.
52
52
  * It will traverse the element's ancestors to find the target element.
@@ -60,6 +60,6 @@ export declare function focusElement(el: FocusableElement | undefined): Promise<
60
60
  * REFACTOR: this is doing too much. break it into separate find element and focus
61
61
  * element utilities
62
62
  */
63
- export declare function setFocusOnElement(ref: (Element & {
63
+ export declare const setFocusOnElement: (ref: (Element & {
64
64
  componentOnReady?: () => Promise<void>;
65
- }) | null | undefined, selector: string): void;
65
+ }) | null | undefined, selector: string) => void;
package/dist/dom.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * @param callback The callback to invoke when the attributes have been changed.
8
8
  * @returns The mutation observer
9
9
  */
10
- export declare function observeAncestorsMutation(element: Node, attributeFilter: string[], callback: () => void): () => void;
10
+ export declare const observeAncestorsMutation: (element: Node, attributeFilter: string[], callback: () => void) => (() => void);
11
11
  /**
12
12
  * Find the closest element that matches the selector.
13
13
  * It will traverse the element's ancestors to find the target element.
@@ -16,7 +16,7 @@ export declare function observeAncestorsMutation(element: Node, attributeFilter:
16
16
  * @param selector The selector to match.
17
17
  * @returns The closest element that matches the selector or null if not found.
18
18
  */
19
- export declare function closestElement(base: Element, selector: string): Element | null;
19
+ export declare const closestElement: (base: Element, selector: string) => Element | null;
20
20
  /**
21
21
  * Use the Calcite mode to determine the theme of the element.
22
22
  * It will traverse the element's ancestors to find the theme.
@@ -24,13 +24,13 @@ export declare function closestElement(base: Element, selector: string): Element
24
24
  * @param base The element to start the search from.
25
25
  * @returns The theme of the element, either "light" or "dark", "light" is the default.
26
26
  */
27
- export declare function getElementTheme(base: Element): "dark" | "light";
27
+ export declare const getElementTheme: (base: Element) => "dark" | "light";
28
28
  /**
29
29
  * Get direction property of closest element.
30
30
  * @param el The element to start the search from.
31
31
  * @returns The direction of the element, either "ltr" | "rtl", "ltr" is the default.
32
32
  */
33
- export declare function getElementDir(el: HTMLElement): "ltr" | "rtl";
33
+ export declare const getElementDir: (el: HTMLElement) => "ltr" | "rtl";
34
34
  /**
35
35
  * Get the attribute value from the element.
36
36
  * It will traverse the element's ancestors to find the attribute.
@@ -42,11 +42,11 @@ export declare function getElementDir(el: HTMLElement): "ltr" | "rtl";
42
42
  * @param fallbackValue The fallback value if the attribute is not found.
43
43
  * @returns The attribute value or the fallback value if the attribute is not found.
44
44
  */
45
- export declare function getElementAttribute(el: Element, prop: string, fallbackValue: string): string;
45
+ export declare const getElementAttribute: (el: Element, prop: string, fallbackValue: string) => string;
46
46
  export interface FocusableElement extends HTMLElement {
47
47
  setFocus?: () => Promise<void>;
48
48
  }
49
- export declare function focusElement(el: FocusableElement | undefined): Promise<void>;
49
+ export declare const focusElement: (el: FocusableElement | undefined) => Promise<void>;
50
50
  /**
51
51
  * Set the focus on the element that matches the selector.
52
52
  * It will traverse the element's ancestors to find the target element.
@@ -60,6 +60,6 @@ export declare function focusElement(el: FocusableElement | undefined): Promise<
60
60
  * REFACTOR: this is doing too much. break it into separate find element and focus
61
61
  * element utilities
62
62
  */
63
- export declare function setFocusOnElement(ref: (Element & {
63
+ export declare const setFocusOnElement: (ref: (Element & {
64
64
  componentOnReady?: () => Promise<void>;
65
- }) | null | undefined, selector: string): void;
65
+ }) | null | undefined, selector: string) => void;
package/dist/errors.d.cts CHANGED
@@ -15,16 +15,16 @@
15
15
  * packages, simpler alternatives are provided:
16
16
  * https://qawebgis.esri.com/components/lumina/publishing#bundling-code-conditionally
17
17
  */
18
- export declare function isEsriInternalEnv(): boolean;
18
+ export declare const isEsriInternalEnv: () => boolean;
19
19
  /**
20
20
  * Calls a sync method and catch any errors. Returns undefined if error occurred.
21
21
  *
22
22
  * Can also provide a thisContext and rest arguments
23
23
  */
24
- export declare function safeCall<Callback extends (...args: never[]) => unknown>(callback?: Callback, thisContext?: ThisParameterType<Callback>, ...rest: Parameters<Callback>): ReturnType<Callback> | void;
24
+ export declare const safeCall: <Callback extends (...args: never[]) => unknown>(callback?: Callback, thisContext?: ThisParameterType<Callback>, ...rest: Parameters<Callback>) => ReturnType<Callback> | void;
25
25
  /**
26
26
  * Calls an async method and catch any errors. Returns undefined if error occurred.
27
27
  *
28
28
  * Can also provide a thisContext and rest arguments
29
29
  */
30
- export declare function safeAsyncCall<Callback extends (...args: never[]) => unknown>(callback?: Callback, thisContext?: ThisParameterType<Callback>, ...rest: Parameters<Callback>): Promise<Awaited<ReturnType<Callback>> | void>;
30
+ export declare const safeAsyncCall: <Callback extends (...args: never[]) => unknown>(callback?: Callback, thisContext?: ThisParameterType<Callback>, ...rest: Parameters<Callback>) => Promise<Awaited<ReturnType<Callback>> | void>;
package/dist/errors.d.ts CHANGED
@@ -15,16 +15,16 @@
15
15
  * packages, simpler alternatives are provided:
16
16
  * https://qawebgis.esri.com/components/lumina/publishing#bundling-code-conditionally
17
17
  */
18
- export declare function isEsriInternalEnv(): boolean;
18
+ export declare const isEsriInternalEnv: () => boolean;
19
19
  /**
20
20
  * Calls a sync method and catch any errors. Returns undefined if error occurred.
21
21
  *
22
22
  * Can also provide a thisContext and rest arguments
23
23
  */
24
- export declare function safeCall<Callback extends (...args: never[]) => unknown>(callback?: Callback, thisContext?: ThisParameterType<Callback>, ...rest: Parameters<Callback>): ReturnType<Callback> | void;
24
+ export declare const safeCall: <Callback extends (...args: never[]) => unknown>(callback?: Callback, thisContext?: ThisParameterType<Callback>, ...rest: Parameters<Callback>) => ReturnType<Callback> | void;
25
25
  /**
26
26
  * Calls an async method and catch any errors. Returns undefined if error occurred.
27
27
  *
28
28
  * Can also provide a thisContext and rest arguments
29
29
  */
30
- export declare function safeAsyncCall<Callback extends (...args: never[]) => unknown>(callback?: Callback, thisContext?: ThisParameterType<Callback>, ...rest: Parameters<Callback>): Promise<Awaited<ReturnType<Callback>> | void>;
30
+ export declare const safeAsyncCall: <Callback extends (...args: never[]) => unknown>(callback?: Callback, thisContext?: ThisParameterType<Callback>, ...rest: Parameters<Callback>) => Promise<Awaited<ReturnType<Callback>> | void>;
package/dist/guid.d.cts CHANGED
@@ -2,4 +2,4 @@
2
2
  * Generates a GUID string.
3
3
  * @returns A GUID string with the pattern 00000000-0000-0000-0000-000000000000.
4
4
  */
5
- export declare function generateGuid(): string;
5
+ export declare const generateGuid: () => string;
package/dist/guid.d.ts CHANGED
@@ -2,4 +2,4 @@
2
2
  * Generates a GUID string.
3
3
  * @returns A GUID string with the pattern 00000000-0000-0000-0000-000000000000.
4
4
  */
5
- export declare function generateGuid(): string;
5
+ export declare const generateGuid: () => string;