@arcgis/components-utils 4.33.0-next.7 → 4.33.0-next.71
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.
- package/dist/array-utils.d.cts +5 -0
- package/dist/array-utils.d.ts +5 -0
- package/dist/css-utils.d.cts +15 -0
- package/dist/css-utils.d.ts +15 -0
- package/dist/deferred.d.cts +30 -0
- package/dist/deferred.d.ts +30 -0
- package/dist/dom.d.cts +65 -0
- package/dist/dom.d.ts +65 -0
- package/dist/errors.d.cts +30 -0
- package/dist/errors.d.ts +30 -0
- package/dist/guid.d.cts +5 -0
- package/dist/guid.d.ts +5 -0
- package/dist/index.cjs +65 -158
- package/dist/index.d.cts +15 -378
- package/dist/index.d.ts +15 -378
- package/dist/index.js +26 -55
- package/dist/intl.d.cts +91 -0
- package/dist/intl.d.ts +91 -0
- package/dist/preamble.d.cts +17 -0
- package/dist/preamble.d.ts +17 -0
- package/dist/strings.d.cts +29 -0
- package/dist/strings.d.ts +29 -0
- package/dist/tests/utils.d.cts +1 -0
- package/dist/tests/utils.d.ts +1 -0
- package/dist/text.d.cts +7 -0
- package/dist/text.d.ts +7 -0
- package/dist/timeouts.d.cts +7 -0
- package/dist/timeouts.d.ts +7 -0
- package/dist/type-guards.d.cts +12 -0
- package/dist/type-guards.d.ts +12 -0
- package/dist/types.d.cts +30 -0
- package/dist/types.d.ts +30 -0
- package/dist/ui.d.cts +8 -0
- package/dist/ui.d.ts +8 -0
- package/dist/url.d.cts +14 -0
- package/dist/url.d.ts +14 -0
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Nil } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* This code contains imperative syntax (like for loops and mutation) as it is
|
|
4
|
+
* in the hot path - performance optimizations are critical here.
|
|
5
|
+
* See https://devtopia.esri.com/WebGIS/arcgis-js-api/commit/2565cedd87b
|
|
6
|
+
*
|
|
7
|
+
* Stencil has native support for passing-in class prop as an object or string,
|
|
8
|
+
* but it does not support arrays or booleans, thus this utility is used
|
|
9
|
+
* instead.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* This function is not necessary in a Lit package as Lit's `classMap` directive
|
|
13
|
+
* accepts an object
|
|
14
|
+
*/
|
|
15
|
+
export declare function classes(...classes: (Nil | Record<string, boolean> | string[] | string | false)[]): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Nil } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* This code contains imperative syntax (like for loops and mutation) as it is
|
|
4
|
+
* in the hot path - performance optimizations are critical here.
|
|
5
|
+
* See https://devtopia.esri.com/WebGIS/arcgis-js-api/commit/2565cedd87b
|
|
6
|
+
*
|
|
7
|
+
* Stencil has native support for passing-in class prop as an object or string,
|
|
8
|
+
* but it does not support arrays or booleans, thus this utility is used
|
|
9
|
+
* instead.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* This function is not necessary in a Lit package as Lit's `classMap` directive
|
|
13
|
+
* accepts an object
|
|
14
|
+
*/
|
|
15
|
+
export declare function classes(...classes: (Nil | Record<string, boolean> | string[] | string | false)[]): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A deferred promise.
|
|
3
|
+
* Useful for when you want to return a promise but don't have the value yet.
|
|
4
|
+
* Example:
|
|
5
|
+
* ```
|
|
6
|
+
* const deferred = new Deferred<string>();
|
|
7
|
+
* setTimeout(() => deferred.resolve("Hello World"), 1000);
|
|
8
|
+
* return deferred.promise;
|
|
9
|
+
* ```
|
|
10
|
+
* @template T The type of the promise.
|
|
11
|
+
*/
|
|
12
|
+
export declare class Deferred<T> {
|
|
13
|
+
/**
|
|
14
|
+
* The promise that can be awaited.
|
|
15
|
+
*/
|
|
16
|
+
promise: Promise<T>;
|
|
17
|
+
/**
|
|
18
|
+
* Resolves the promise.
|
|
19
|
+
* @param value The value to resolve the promise with.
|
|
20
|
+
*/
|
|
21
|
+
resolve(_value: PromiseLike<T> | T): void;
|
|
22
|
+
/**
|
|
23
|
+
* Rejects the promise.
|
|
24
|
+
*/
|
|
25
|
+
reject(_error: unknown): void;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a new deferred promise.
|
|
28
|
+
*/
|
|
29
|
+
constructor();
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A deferred promise.
|
|
3
|
+
* Useful for when you want to return a promise but don't have the value yet.
|
|
4
|
+
* Example:
|
|
5
|
+
* ```
|
|
6
|
+
* const deferred = new Deferred<string>();
|
|
7
|
+
* setTimeout(() => deferred.resolve("Hello World"), 1000);
|
|
8
|
+
* return deferred.promise;
|
|
9
|
+
* ```
|
|
10
|
+
* @template T The type of the promise.
|
|
11
|
+
*/
|
|
12
|
+
export declare class Deferred<T> {
|
|
13
|
+
/**
|
|
14
|
+
* The promise that can be awaited.
|
|
15
|
+
*/
|
|
16
|
+
promise: Promise<T>;
|
|
17
|
+
/**
|
|
18
|
+
* Resolves the promise.
|
|
19
|
+
* @param value The value to resolve the promise with.
|
|
20
|
+
*/
|
|
21
|
+
resolve(_value: PromiseLike<T> | T): void;
|
|
22
|
+
/**
|
|
23
|
+
* Rejects the promise.
|
|
24
|
+
*/
|
|
25
|
+
reject(_error: unknown): void;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a new deferred promise.
|
|
28
|
+
*/
|
|
29
|
+
constructor();
|
|
30
|
+
}
|
package/dist/dom.d.cts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observe the element and its ancestors for attribute mutations.
|
|
3
|
+
* If the attributes have been changed in the ancestor tree then the callback will be invoked.
|
|
4
|
+
* Example: `observeAncestorsMutation(element, ["dir", "lang"], () => console.log("dir or lang changed"));`
|
|
5
|
+
* @param element The element on which to observe the attribute mutations.
|
|
6
|
+
* @param attributeFilter The list of attributes to observe.
|
|
7
|
+
* @param callback The callback to invoke when the attributes have been changed.
|
|
8
|
+
* @returns The mutation observer
|
|
9
|
+
*/
|
|
10
|
+
export declare function observeAncestorsMutation(element: Node, attributeFilter: string[], callback: () => void): () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Find the closest element that matches the selector.
|
|
13
|
+
* It will traverse the element's ancestors to find the target element.
|
|
14
|
+
* Shadow DOM boundaries are also taken into account.
|
|
15
|
+
* @param base The element to start the search from.
|
|
16
|
+
* @param selector The selector to match.
|
|
17
|
+
* @returns The closest element that matches the selector or null if not found.
|
|
18
|
+
*/
|
|
19
|
+
export declare function closestElement(base: Element, selector: string): Element | null;
|
|
20
|
+
/**
|
|
21
|
+
* Use the Calcite mode to determine the theme of the element.
|
|
22
|
+
* It will traverse the element's ancestors to find the theme.
|
|
23
|
+
* Shadow DOM boundaries are also taken into account.
|
|
24
|
+
* @param base The element to start the search from.
|
|
25
|
+
* @returns The theme of the element, either "light" or "dark", "light" is the default.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getElementTheme(base: Element): "dark" | "light";
|
|
28
|
+
/**
|
|
29
|
+
* Get direction property of closest element.
|
|
30
|
+
* @param el The element to start the search from.
|
|
31
|
+
* @returns The direction of the element, either "ltr" | "rtl", "ltr" is the default.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getElementDir(el: HTMLElement): "ltr" | "rtl";
|
|
34
|
+
/**
|
|
35
|
+
* Get the attribute value from the element.
|
|
36
|
+
* It will traverse the element's ancestors to find the attribute.
|
|
37
|
+
* Shadow DOM boundaries are also taken into account.
|
|
38
|
+
* If the attribute is not found then the fallback value is returned.
|
|
39
|
+
* Example: `getElementAttribute(element, "dir", "ltr");`
|
|
40
|
+
* @param base The element to start the search from.
|
|
41
|
+
* @param prop The attribute name.
|
|
42
|
+
* @param fallbackValue The fallback value if the attribute is not found.
|
|
43
|
+
* @returns The attribute value or the fallback value if the attribute is not found.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getElementAttribute(el: Element, prop: string, fallbackValue: string): string;
|
|
46
|
+
export interface FocusableElement extends HTMLElement {
|
|
47
|
+
setFocus?: () => Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
export declare function focusElement(el: FocusableElement | undefined): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Set the focus on the element that matches the selector.
|
|
52
|
+
* It will traverse the element's ancestors to find the target element.
|
|
53
|
+
* Shadow DOM boundaries are also taken into account.
|
|
54
|
+
* If the element is not found then the focus is not set.
|
|
55
|
+
* Example: `setFocusOnElement(element, "[role='menuitem']");`
|
|
56
|
+
* @param ref The element to start the search from.
|
|
57
|
+
* @param selector The selector to match.
|
|
58
|
+
* @returns Returns true if the focus is set on the element.
|
|
59
|
+
*
|
|
60
|
+
* REFACTOR: this is doing too much. break it into separate find element and focus
|
|
61
|
+
* element utilities
|
|
62
|
+
*/
|
|
63
|
+
export declare function setFocusOnElement(ref: (Element & {
|
|
64
|
+
componentOnReady?: () => Promise<void>;
|
|
65
|
+
}) | null | undefined, selector: string): void;
|
package/dist/dom.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observe the element and its ancestors for attribute mutations.
|
|
3
|
+
* If the attributes have been changed in the ancestor tree then the callback will be invoked.
|
|
4
|
+
* Example: `observeAncestorsMutation(element, ["dir", "lang"], () => console.log("dir or lang changed"));`
|
|
5
|
+
* @param element The element on which to observe the attribute mutations.
|
|
6
|
+
* @param attributeFilter The list of attributes to observe.
|
|
7
|
+
* @param callback The callback to invoke when the attributes have been changed.
|
|
8
|
+
* @returns The mutation observer
|
|
9
|
+
*/
|
|
10
|
+
export declare function observeAncestorsMutation(element: Node, attributeFilter: string[], callback: () => void): () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Find the closest element that matches the selector.
|
|
13
|
+
* It will traverse the element's ancestors to find the target element.
|
|
14
|
+
* Shadow DOM boundaries are also taken into account.
|
|
15
|
+
* @param base The element to start the search from.
|
|
16
|
+
* @param selector The selector to match.
|
|
17
|
+
* @returns The closest element that matches the selector or null if not found.
|
|
18
|
+
*/
|
|
19
|
+
export declare function closestElement(base: Element, selector: string): Element | null;
|
|
20
|
+
/**
|
|
21
|
+
* Use the Calcite mode to determine the theme of the element.
|
|
22
|
+
* It will traverse the element's ancestors to find the theme.
|
|
23
|
+
* Shadow DOM boundaries are also taken into account.
|
|
24
|
+
* @param base The element to start the search from.
|
|
25
|
+
* @returns The theme of the element, either "light" or "dark", "light" is the default.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getElementTheme(base: Element): "dark" | "light";
|
|
28
|
+
/**
|
|
29
|
+
* Get direction property of closest element.
|
|
30
|
+
* @param el The element to start the search from.
|
|
31
|
+
* @returns The direction of the element, either "ltr" | "rtl", "ltr" is the default.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getElementDir(el: HTMLElement): "ltr" | "rtl";
|
|
34
|
+
/**
|
|
35
|
+
* Get the attribute value from the element.
|
|
36
|
+
* It will traverse the element's ancestors to find the attribute.
|
|
37
|
+
* Shadow DOM boundaries are also taken into account.
|
|
38
|
+
* If the attribute is not found then the fallback value is returned.
|
|
39
|
+
* Example: `getElementAttribute(element, "dir", "ltr");`
|
|
40
|
+
* @param base The element to start the search from.
|
|
41
|
+
* @param prop The attribute name.
|
|
42
|
+
* @param fallbackValue The fallback value if the attribute is not found.
|
|
43
|
+
* @returns The attribute value or the fallback value if the attribute is not found.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getElementAttribute(el: Element, prop: string, fallbackValue: string): string;
|
|
46
|
+
export interface FocusableElement extends HTMLElement {
|
|
47
|
+
setFocus?: () => Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
export declare function focusElement(el: FocusableElement | undefined): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Set the focus on the element that matches the selector.
|
|
52
|
+
* It will traverse the element's ancestors to find the target element.
|
|
53
|
+
* Shadow DOM boundaries are also taken into account.
|
|
54
|
+
* If the element is not found then the focus is not set.
|
|
55
|
+
* Example: `setFocusOnElement(element, "[role='menuitem']");`
|
|
56
|
+
* @param ref The element to start the search from.
|
|
57
|
+
* @param selector The selector to match.
|
|
58
|
+
* @returns Returns true if the focus is set on the element.
|
|
59
|
+
*
|
|
60
|
+
* REFACTOR: this is doing too much. break it into separate find element and focus
|
|
61
|
+
* element utilities
|
|
62
|
+
*/
|
|
63
|
+
export declare function setFocusOnElement(ref: (Element & {
|
|
64
|
+
componentOnReady?: () => Promise<void>;
|
|
65
|
+
}) | null | undefined, selector: string): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check whether the code is executing in an Esri internal environment (for
|
|
3
|
+
* example, Lumina dev server). When true, your code can enable extra validation
|
|
4
|
+
* to detect incorrect usages or do runtime bug detection.
|
|
5
|
+
*
|
|
6
|
+
* The call to isEsriInternalEnv() MUST always appear behind one of the
|
|
7
|
+
* following guards to ensure it is correctly eliminated in production bundles:
|
|
8
|
+
*
|
|
9
|
+
* - `process.env.NODE_ENV !== "production"`
|
|
10
|
+
* - `process.env.NODE_ENV === "development"`
|
|
11
|
+
* - `process.env.NODE_ENV === "test"`
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* This function is primary for usage in support packages. In Lumina component
|
|
15
|
+
* packages, simpler alternatives are provided:
|
|
16
|
+
* https://qawebgis.esri.com/components/lumina/publishing#bundling-code-conditionally
|
|
17
|
+
*/
|
|
18
|
+
export declare function isEsriInternalEnv(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Calls a sync method and catch any errors. Returns undefined if error occurred.
|
|
21
|
+
*
|
|
22
|
+
* Can also provide a thisContext and rest arguments
|
|
23
|
+
*/
|
|
24
|
+
export declare function safeCall<Callback extends (...args: never[]) => unknown>(callback?: Callback, thisContext?: ThisParameterType<Callback>, ...rest: Parameters<Callback>): ReturnType<Callback> | void;
|
|
25
|
+
/**
|
|
26
|
+
* Calls an async method and catch any errors. Returns undefined if error occurred.
|
|
27
|
+
*
|
|
28
|
+
* Can also provide a thisContext and rest arguments
|
|
29
|
+
*/
|
|
30
|
+
export declare function safeAsyncCall<Callback extends (...args: never[]) => unknown>(callback?: Callback, thisContext?: ThisParameterType<Callback>, ...rest: Parameters<Callback>): Promise<Awaited<ReturnType<Callback>> | void>;
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check whether the code is executing in an Esri internal environment (for
|
|
3
|
+
* example, Lumina dev server). When true, your code can enable extra validation
|
|
4
|
+
* to detect incorrect usages or do runtime bug detection.
|
|
5
|
+
*
|
|
6
|
+
* The call to isEsriInternalEnv() MUST always appear behind one of the
|
|
7
|
+
* following guards to ensure it is correctly eliminated in production bundles:
|
|
8
|
+
*
|
|
9
|
+
* - `process.env.NODE_ENV !== "production"`
|
|
10
|
+
* - `process.env.NODE_ENV === "development"`
|
|
11
|
+
* - `process.env.NODE_ENV === "test"`
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* This function is primary for usage in support packages. In Lumina component
|
|
15
|
+
* packages, simpler alternatives are provided:
|
|
16
|
+
* https://qawebgis.esri.com/components/lumina/publishing#bundling-code-conditionally
|
|
17
|
+
*/
|
|
18
|
+
export declare function isEsriInternalEnv(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Calls a sync method and catch any errors. Returns undefined if error occurred.
|
|
21
|
+
*
|
|
22
|
+
* Can also provide a thisContext and rest arguments
|
|
23
|
+
*/
|
|
24
|
+
export declare function safeCall<Callback extends (...args: never[]) => unknown>(callback?: Callback, thisContext?: ThisParameterType<Callback>, ...rest: Parameters<Callback>): ReturnType<Callback> | void;
|
|
25
|
+
/**
|
|
26
|
+
* Calls an async method and catch any errors. Returns undefined if error occurred.
|
|
27
|
+
*
|
|
28
|
+
* Can also provide a thisContext and rest arguments
|
|
29
|
+
*/
|
|
30
|
+
export declare function safeAsyncCall<Callback extends (...args: never[]) => unknown>(callback?: Callback, thisContext?: ThisParameterType<Callback>, ...rest: Parameters<Callback>): Promise<Awaited<ReturnType<Callback>> | void>;
|
package/dist/guid.d.cts
ADDED
package/dist/guid.d.ts
ADDED
package/dist/index.cjs
CHANGED
|
@@ -1,67 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var src_exports = {};
|
|
22
|
-
__export(src_exports, {
|
|
23
|
-
Deferred: () => Deferred,
|
|
24
|
-
addLTRMark: () => addLTRMark,
|
|
25
|
-
camelToHuman: () => camelToHuman,
|
|
26
|
-
camelToKebab: () => camelToKebab,
|
|
27
|
-
capitalize: () => capitalize,
|
|
28
|
-
classes: () => classes,
|
|
29
|
-
closestElement: () => closestElement,
|
|
30
|
-
createFilterExpression: () => createFilterExpression,
|
|
31
|
-
debounce: () => debounce,
|
|
32
|
-
defaultLocale: () => defaultLocale,
|
|
33
|
-
devToolsAwareTimeout: () => devToolsAwareTimeout,
|
|
34
|
-
extractMinorVersion: () => extractMinorVersion,
|
|
35
|
-
fetchT9nStringsBundle: () => fetchT9nStringsBundle,
|
|
36
|
-
focusElement: () => focusElement,
|
|
37
|
-
generateGuid: () => generateGuid,
|
|
38
|
-
getElementAttribute: () => getElementAttribute,
|
|
39
|
-
getElementDir: () => getElementDir,
|
|
40
|
-
getElementLocales: () => getElementLocales,
|
|
41
|
-
getElementTheme: () => getElementTheme,
|
|
42
|
-
getPreamble: () => getPreamble,
|
|
43
|
-
hasSameOrigin: () => hasSameOrigin,
|
|
44
|
-
identity: () => identity,
|
|
45
|
-
isEsriInternalEnv: () => isEsriInternalEnv,
|
|
46
|
-
isNotNull: () => isNotNull,
|
|
47
|
-
isNotUndefined: () => isNotUndefined,
|
|
48
|
-
isURL: () => isURL,
|
|
49
|
-
kebabToPascal: () => kebabToPascal,
|
|
50
|
-
mappedFind: () => mappedFind,
|
|
51
|
-
normalizeLocale: () => normalizeLocale,
|
|
52
|
-
observeAncestorsMutation: () => observeAncestorsMutation,
|
|
53
|
-
quoteString: () => quoteString,
|
|
54
|
-
safeAsyncCall: () => safeAsyncCall,
|
|
55
|
-
safeCall: () => safeCall,
|
|
56
|
-
setFocusOnElement: () => setFocusOnElement,
|
|
57
|
-
setValuesInString: () => setValuesInString,
|
|
58
|
-
startLocaleObserver: () => startLocaleObserver,
|
|
59
|
-
supportedLocales: () => supportedLocales,
|
|
60
|
-
uncapitalize: () => uncapitalize
|
|
61
|
-
});
|
|
62
|
-
module.exports = __toCommonJS(src_exports);
|
|
63
|
-
|
|
64
|
-
// src/array-utils.ts
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
65
3
|
function mappedFind(array, callback) {
|
|
66
4
|
for (let i = 0; i < array.length; i++) {
|
|
67
5
|
const value = callback(array[i], i);
|
|
@@ -71,8 +9,6 @@ function mappedFind(array, callback) {
|
|
|
71
9
|
}
|
|
72
10
|
return;
|
|
73
11
|
}
|
|
74
|
-
|
|
75
|
-
// src/css-utils.ts
|
|
76
12
|
function classes(...classes2) {
|
|
77
13
|
const effectiveClasses = [];
|
|
78
14
|
for (let i = 0; i < classes2.length; i++) {
|
|
@@ -93,9 +29,7 @@ function classes(...classes2) {
|
|
|
93
29
|
effectiveClasses.length = 0;
|
|
94
30
|
return className;
|
|
95
31
|
}
|
|
96
|
-
|
|
97
|
-
// src/deferred.ts
|
|
98
|
-
var Deferred = class {
|
|
32
|
+
class Deferred {
|
|
99
33
|
/**
|
|
100
34
|
* Resolves the promise.
|
|
101
35
|
* @param value The value to resolve the promise with.
|
|
@@ -116,9 +50,7 @@ var Deferred = class {
|
|
|
116
50
|
this.reject = reject;
|
|
117
51
|
});
|
|
118
52
|
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// src/dom.ts
|
|
53
|
+
}
|
|
122
54
|
function inTargetElement(element, targetElement) {
|
|
123
55
|
let currentElement = element;
|
|
124
56
|
while (currentElement) {
|
|
@@ -145,7 +77,7 @@ function observeAncestorsMutation(element, attributeFilter, callback) {
|
|
|
145
77
|
}
|
|
146
78
|
});
|
|
147
79
|
}
|
|
148
|
-
|
|
80
|
+
const observers = {};
|
|
149
81
|
function observe(attributeFilter) {
|
|
150
82
|
const attributes = attributeFilter.join(",");
|
|
151
83
|
const previousObserver = observers[attributes];
|
|
@@ -253,8 +185,6 @@ function setFocusOnElement(ref, selector) {
|
|
|
253
185
|
}
|
|
254
186
|
void Promise.resolve(ref.componentOnReady?.()).then(() => setFocus(ref, selector));
|
|
255
187
|
}
|
|
256
|
-
|
|
257
|
-
// src/errors.ts
|
|
258
188
|
function isEsriInternalEnv() {
|
|
259
189
|
return typeof globalThis.process === "object" && !!process.env.ESRI_INTERNAL;
|
|
260
190
|
}
|
|
@@ -275,8 +205,6 @@ async function safeAsyncCall(callback, thisContext, ...rest) {
|
|
|
275
205
|
}
|
|
276
206
|
return void 0;
|
|
277
207
|
}
|
|
278
|
-
|
|
279
|
-
// src/guid.ts
|
|
280
208
|
function gen(count) {
|
|
281
209
|
let out = "";
|
|
282
210
|
for (let i = 0; i < count; i++) {
|
|
@@ -287,9 +215,7 @@ function gen(count) {
|
|
|
287
215
|
function generateGuid() {
|
|
288
216
|
return [gen(2), gen(1), gen(1), gen(1), gen(3)].join("-");
|
|
289
217
|
}
|
|
290
|
-
|
|
291
|
-
// src/intl.ts
|
|
292
|
-
var supportedLocalesArray = [
|
|
218
|
+
const supportedLocalesArray = [
|
|
293
219
|
"ar",
|
|
294
220
|
"bg",
|
|
295
221
|
"bs",
|
|
@@ -332,9 +258,9 @@ var supportedLocalesArray = [
|
|
|
332
258
|
"zh-HK",
|
|
333
259
|
"zh-TW"
|
|
334
260
|
];
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
261
|
+
const supportedLocales = /* @__PURE__ */ new Set(supportedLocalesArray);
|
|
262
|
+
const defaultLocale = "en";
|
|
263
|
+
const localeEquivalencies = {
|
|
338
264
|
// We use `pt-PT` as it will have the same translations as `pt`, which has no corresponding bundle
|
|
339
265
|
pt: "pt-PT",
|
|
340
266
|
// We support both 'nb' and 'no' (BCP 47) for Norwegian but only `no` has corresponding bundle
|
|
@@ -348,7 +274,7 @@ async function fetchT9nStringsBundle(locale, assetsPath, prefix = "") {
|
|
|
348
274
|
t9nStringsCache[filePath] ?? (t9nStringsCache[filePath] = fetchBundle(locale, path));
|
|
349
275
|
return await t9nStringsCache[filePath];
|
|
350
276
|
}
|
|
351
|
-
|
|
277
|
+
const t9nStringsCache = {};
|
|
352
278
|
async function fetchBundle(locale, path) {
|
|
353
279
|
const filePath = `${path}${locale}.json`;
|
|
354
280
|
try {
|
|
@@ -405,7 +331,7 @@ function startLocaleObserver(element, getAssetsPath, onUpdated, assetName) {
|
|
|
405
331
|
queueMicrotask(callback);
|
|
406
332
|
return observeAncestorsMutation(element, ["lang"], callback);
|
|
407
333
|
}
|
|
408
|
-
async function updateComponentLocaleState(element, assetsPath, assetName = element.
|
|
334
|
+
async function updateComponentLocaleState(element, assetsPath, assetName = element.localName.split("-").slice(1).join("-")) {
|
|
409
335
|
const { lang, t9nLocale } = getElementLocales(element);
|
|
410
336
|
const t9nAssetsPath = `${assetsPath}/${assetName}/t9n`;
|
|
411
337
|
const prefix = `messages.`;
|
|
@@ -415,18 +341,14 @@ async function updateComponentLocaleState(element, assetsPath, assetName = eleme
|
|
|
415
341
|
);
|
|
416
342
|
return { lang, t9nLocale, t9nStrings };
|
|
417
343
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
var blurb = "All material copyright Esri, All Rights Reserved, unless otherwise specified.\nSee https://js.arcgis.com/{minorVersion}/esri/copyright.txt for details.\nv{version}";
|
|
421
|
-
var extractMinorVersion = (version) => {
|
|
344
|
+
const blurb = "All material copyright Esri, All Rights Reserved, unless otherwise specified.\nSee https://js.arcgis.com/{minorVersion}/esri/copyright.txt for details.\nv{version}";
|
|
345
|
+
const extractMinorVersion = (version) => {
|
|
422
346
|
const [major, minor] = version.split(".");
|
|
423
347
|
return `${major}.${minor}`;
|
|
424
348
|
};
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
var doubleQuote = '"';
|
|
429
|
-
var singleQuote = "'";
|
|
349
|
+
const getPreamble = (version) => blurb.replace("{minorVersion}", extractMinorVersion(version)).replace("{version}", version);
|
|
350
|
+
const doubleQuote = '"';
|
|
351
|
+
const singleQuote = "'";
|
|
430
352
|
function repeatString(value, n) {
|
|
431
353
|
return new Array(n + 1).join(value);
|
|
432
354
|
}
|
|
@@ -461,18 +383,14 @@ function setValuesInString(message, values = {}) {
|
|
|
461
383
|
return (message ?? "").replace(/\{(?<valueName>.*?)\}/gu, (match, valueName) => values[valueName] ?? match);
|
|
462
384
|
}
|
|
463
385
|
function addLTRMark(value) {
|
|
464
|
-
return
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
var uncapitalize = (string) => string.charAt(0).toLowerCase() + string.slice(1);
|
|
473
|
-
var camelToHuman = (string) => capitalize(string.replace(upperBeforeLower, (upper, remainder) => `${remainder === 0 ? "" : " "}${upper}`));
|
|
474
|
-
|
|
475
|
-
// src/timeouts.ts
|
|
386
|
+
return `${value ?? ""}`;
|
|
387
|
+
}
|
|
388
|
+
const kebabToPascal = (string) => string.split("-").map(capitalize).join("");
|
|
389
|
+
const camelToKebab = (string) => string.replace(upperBeforeLower, (upper, remainder) => `${remainder === 0 ? "" : "-"}${upper.toLowerCase()}`);
|
|
390
|
+
const upperBeforeLower = /[A-Z]+(?![a-z])|[A-Z]/gu;
|
|
391
|
+
const capitalize = (string) => string.charAt(0).toUpperCase() + string.slice(1);
|
|
392
|
+
const uncapitalize = (string) => string.charAt(0).toLowerCase() + string.slice(1);
|
|
393
|
+
const camelToHuman = (string) => capitalize(string.replace(upperBeforeLower, (upper, remainder) => `${remainder === 0 ? "" : " "}${upper}`));
|
|
476
394
|
function devToolsAwareTimeout(callback, timeout) {
|
|
477
395
|
const interval = timeout > longTimeoutThreshold ? longTimeoutInterval : timeout / shortTimeoutIntervals;
|
|
478
396
|
let elapsed = 0;
|
|
@@ -485,22 +403,16 @@ function devToolsAwareTimeout(callback, timeout) {
|
|
|
485
403
|
}, interval);
|
|
486
404
|
return reference;
|
|
487
405
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
// src/type-guards.ts
|
|
406
|
+
const longTimeoutThreshold = 4e3;
|
|
407
|
+
const longTimeoutInterval = 2e3;
|
|
408
|
+
const shortTimeoutIntervals = 4;
|
|
493
409
|
function isNotNull(item) {
|
|
494
410
|
return item !== null;
|
|
495
411
|
}
|
|
496
412
|
function isNotUndefined(item) {
|
|
497
413
|
return item !== void 0;
|
|
498
414
|
}
|
|
499
|
-
|
|
500
|
-
// src/types.ts
|
|
501
|
-
var identity = (value) => value;
|
|
502
|
-
|
|
503
|
-
// src/ui.ts
|
|
415
|
+
const identity = (value) => value;
|
|
504
416
|
function debounce(func, waitFor = 100) {
|
|
505
417
|
let timeout;
|
|
506
418
|
return (...args) => {
|
|
@@ -512,8 +424,6 @@ function debounce(func, waitFor = 100) {
|
|
|
512
424
|
timeout = setTimeout(later, waitFor);
|
|
513
425
|
};
|
|
514
426
|
}
|
|
515
|
-
|
|
516
|
-
// src/url.ts
|
|
517
427
|
function hasSameOrigin(url1, url2, ignoreProtocol = false) {
|
|
518
428
|
if (!url1 || !url2) {
|
|
519
429
|
return false;
|
|
@@ -536,44 +446,41 @@ function isURL(url) {
|
|
|
536
446
|
return false;
|
|
537
447
|
}
|
|
538
448
|
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
supportedLocales,
|
|
578
|
-
uncapitalize
|
|
579
|
-
});
|
|
449
|
+
exports.Deferred = Deferred;
|
|
450
|
+
exports.addLTRMark = addLTRMark;
|
|
451
|
+
exports.camelToHuman = camelToHuman;
|
|
452
|
+
exports.camelToKebab = camelToKebab;
|
|
453
|
+
exports.capitalize = capitalize;
|
|
454
|
+
exports.classes = classes;
|
|
455
|
+
exports.closestElement = closestElement;
|
|
456
|
+
exports.createFilterExpression = createFilterExpression;
|
|
457
|
+
exports.debounce = debounce;
|
|
458
|
+
exports.defaultLocale = defaultLocale;
|
|
459
|
+
exports.devToolsAwareTimeout = devToolsAwareTimeout;
|
|
460
|
+
exports.extractMinorVersion = extractMinorVersion;
|
|
461
|
+
exports.fetchT9nStringsBundle = fetchT9nStringsBundle;
|
|
462
|
+
exports.focusElement = focusElement;
|
|
463
|
+
exports.generateGuid = generateGuid;
|
|
464
|
+
exports.getElementAttribute = getElementAttribute;
|
|
465
|
+
exports.getElementDir = getElementDir;
|
|
466
|
+
exports.getElementLocales = getElementLocales;
|
|
467
|
+
exports.getElementTheme = getElementTheme;
|
|
468
|
+
exports.getPreamble = getPreamble;
|
|
469
|
+
exports.hasSameOrigin = hasSameOrigin;
|
|
470
|
+
exports.identity = identity;
|
|
471
|
+
exports.isEsriInternalEnv = isEsriInternalEnv;
|
|
472
|
+
exports.isNotNull = isNotNull;
|
|
473
|
+
exports.isNotUndefined = isNotUndefined;
|
|
474
|
+
exports.isURL = isURL;
|
|
475
|
+
exports.kebabToPascal = kebabToPascal;
|
|
476
|
+
exports.mappedFind = mappedFind;
|
|
477
|
+
exports.normalizeLocale = normalizeLocale;
|
|
478
|
+
exports.observeAncestorsMutation = observeAncestorsMutation;
|
|
479
|
+
exports.quoteString = quoteString;
|
|
480
|
+
exports.safeAsyncCall = safeAsyncCall;
|
|
481
|
+
exports.safeCall = safeCall;
|
|
482
|
+
exports.setFocusOnElement = setFocusOnElement;
|
|
483
|
+
exports.setValuesInString = setValuesInString;
|
|
484
|
+
exports.startLocaleObserver = startLocaleObserver;
|
|
485
|
+
exports.supportedLocales = supportedLocales;
|
|
486
|
+
exports.uncapitalize = uncapitalize;
|