@arcgis/toolkit 5.2.0-next.11 → 5.2.0-next.110

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.
Files changed (39) hide show
  1. package/LICENSE.md +4 -2
  2. package/README.md +2 -2
  3. package/dist/{array/index.d.ts → array.d.ts} +4 -1
  4. package/dist/dom/referenceElement.d.ts +17 -0
  5. package/dist/dom/referenceElement.js +5 -0
  6. package/dist/dom/slots.d.ts +8 -0
  7. package/dist/dom/slots.js +39 -0
  8. package/dist/{dom/index.js → dom-Bnc7oSYx.js} +30 -48
  9. package/dist/dom.d.ts +177 -0
  10. package/dist/dom.js +21 -0
  11. package/dist/{error/index.d.ts → error.d.ts} +15 -4
  12. package/dist/{error/index.js → error.js} +1 -1
  13. package/dist/{function/index.d.ts → function.d.ts} +4 -1
  14. package/dist/intl/dom.d.ts +74 -0
  15. package/dist/intl/{index.js → dom.js} +40 -36
  16. package/dist/intl.d.ts +89 -0
  17. package/dist/intl.js +10 -0
  18. package/dist/{log/index.d.ts → log.d.ts} +38 -6
  19. package/dist/{number/index.d.ts → number.d.ts} +2 -1
  20. package/dist/predicate.d.ts +27 -0
  21. package/dist/predicate.js +8 -0
  22. package/dist/{promise/index.d.ts → promise.d.ts} +16 -1
  23. package/dist/{promise/index.js → promise.js} +2 -0
  24. package/dist/{string/index.d.ts → string.d.ts} +40 -3
  25. package/dist/{type/index.d.ts → type.d.ts} +11 -1
  26. package/dist/{url/index.d.ts → url.d.ts} +4 -3
  27. package/package.json +16 -13
  28. package/dist/dom/index.d.ts +0 -117
  29. package/dist/dom/reference-element.d.ts +0 -6
  30. package/dist/intl/index.d.ts +0 -124
  31. package/dist/predicate/index.d.ts +0 -24
  32. package/dist/predicate/index.js +0 -8
  33. /package/dist/{array/index.js → array.js} +0 -0
  34. /package/dist/{function/index.js → function.js} +0 -0
  35. /package/dist/{log/index.js → log.js} +0 -0
  36. /package/dist/{number/index.js → number.js} +0 -0
  37. /package/dist/{string/index.js → string.js} +0 -0
  38. /package/dist/{type/index.js → type.js} +0 -0
  39. /package/dist/{url/index.js → url.js} +0 -0
@@ -1,117 +0,0 @@
1
- import { nil } from '../type/index.ts';
2
- export * from './slots.ts';
3
- export * from './reference-element.ts';
4
- /**
5
- * Combine multiple class names into a single string.
6
- *
7
- * @remarks
8
- * This function is less necessary in Lumina packages as the `class` JSX prop
9
- * accepts `Record<string, boolean>` objects.
10
- */
11
- export declare const classes: (...classes: (nil | Record<string, boolean> | string[] | string | false)[]) => string;
12
- /**
13
- * Observe the element and its ancestors for attribute mutations.
14
- * If the attributes have been changed in the ancestor tree then the callback
15
- * will be invoked.
16
- *
17
- * @param element The element on which to observe the attribute mutations.
18
- * @param attributeFilter The list of attributes to observe.
19
- * @param callback The callback to invoke when the attributes have been changed.
20
- * @returns A callback to unsubscribe from the observer.
21
- *
22
- * @example
23
- * ```ts
24
- * observeAncestorsMutation(
25
- * element,
26
- * ["dir", "lang"],
27
- * () => console.log(getElementAttribute(element, "dir", "ltr"))
28
- * );
29
- * ```
30
- */
31
- export declare const observeAncestorsMutation: (element: Node, attributeFilter: string[], callback: () => void) => (() => void);
32
- /**
33
- * Find the closest element that matches the selector.
34
- * It will traverse the element's ancestors to find the target element.
35
- * Shadow DOM boundaries are also taken into account.
36
- * @param base The element to start the search from.
37
- * @param selector The selector to match.
38
- * @returns The closest element that matches the selector or null if not found.
39
- *
40
- * @remarks
41
- * This is similar to [Element.closest()](https://developer.mozilla.org/docs/Web/API/Element/closest),
42
- * but the DOM's utility only looks up until the first shadow boundary.
43
- *
44
- * @example
45
- * ```ts
46
- * const hostElement = getClosestElement(element, "arcgis-map, arcgis-scene");
47
- * ```
48
- */
49
- export declare const getClosestElement: <T = Element>(base: Element, selector: string) => T | undefined;
50
- /**
51
- * Use the closest Calcite mode class name to determine the
52
- * theme of the element. It will traverse the element's
53
- * ancestors to find the theme. Shadow DOM boundaries are also
54
- * taken into account.
55
- *
56
- * @param base The element to start the search from.
57
- * @returns The theme of the element ("light" or "dark"). "light" is the default.
58
- *
59
- * @remarks
60
- * It is advised to consider alternative solutions before using this utility:
61
- * - Calcite CSS variables. Benefits: makes styles more consistent,
62
- * and variables are updated automatically to match dark/light theme.
63
- * - Detect dark mode using CSS selectors and apply styles in CSS.
64
- * Benefit: styles update automatically when the theme changes.
65
- */
66
- export declare function unsafeGetCalciteModeName(el: HTMLElement): "dark" | "light";
67
- /**
68
- * Get direction property of the closest element.
69
- *
70
- * @param el The element to start the search from.
71
- * @returns The direction of the element ("ltr" | "rtl"). "ltr" is the default.
72
- *
73
- * @remarks
74
- * Do not set the `dir` property on the element itself. Do not set the `dir`
75
- * attribute on the components you are rendering. The `dir` attribute is only
76
- * meant to be set by the consumers of your component. Your component is
77
- * expected to respect what was set by the consumer.
78
- *
79
- * @remarks
80
- * Prefer [useDirection()](https://webgis.esri.com/references/lumina/controllers/useDirection)
81
- * to ensure your component is responsive to direction changes.
82
- */
83
- export declare const unsafeGetElementDirection: (el: HTMLElement) => "ltr" | "rtl";
84
- /**
85
- * Get the attribute value from the element or closest ancestor.
86
- * Shadow DOM boundaries are also taken into account.
87
- * If the attribute is not found then the fallback value is returned.
88
- *
89
- * @example
90
- * ```ts
91
- * const dir = getElementAttribute(element, "dir", "ltr");
92
- * ```
93
- */
94
- export declare const getElementAttribute: (el: Element, attributeName: string, fallbackValue: string) => string;
95
- /**
96
- * Focus the element if it is focusable.
97
- * @returns A promise that resolves once the focus is set.
98
- */
99
- export declare const focusElement: (el: FocusableElement | undefined) => Promise<void>;
100
- export interface FocusableElement extends HTMLElement {
101
- setFocus?: () => Promise<void>;
102
- }
103
- /**
104
- * Set the focus on the element that matches the selector.
105
- * It will traverse the element's ancestors to find the target element.
106
- * Shadow DOM boundaries are also taken into account.
107
- * If the element is not found then the focus is not set.
108
- * Example: `setFocusOnElement(element, "[role='menuitem']");`
109
- * @param ref The element to start the search from.
110
- * @param selector The selector to match.
111
- * @returns Returns true if the focus is set on the element.
112
- *
113
- * @deprecated This function is doing too much. Import from `focusElement(getClosestElement())` from `@arcgis/toolkit/dom` instead.
114
- */
115
- export declare const setFocusOnElement: (ref: (Element & {
116
- componentOnReady?: () => Promise<void>;
117
- }) | null | undefined, selector: string) => void;
@@ -1,6 +0,0 @@
1
- type ArcgisComponentBase<T> = {
2
- el: HTMLElement;
3
- referenceElement?: T | string | null | undefined;
4
- };
5
- export declare function resolveReferenceElement<T extends Element>(component: ArcgisComponentBase<T>, referenceElementString?: ArcgisComponentBase<T>["referenceElement"] | string): T | undefined;
6
- export {};
@@ -1,124 +0,0 @@
1
- declare const supportedLocalesArray: ["ar", "bg", "bs", "ca", "cs", "da", "de", "el", "en", "es", "et", "fi", "fr", "he", "hr", "hu", "id", "it", "ja", "ko", "lt", "lv", "nl", "nb", "no", "pl", "pt-BR", "pt-PT", "ro", "ru", "sk", "sl", "sr", "sv", "th", "tr", "uk", "vi", "zh-CN", "zh-HK", "zh-TW"];
2
- /**
3
- * The list of supported locales for ArcGIS Maps SDK for JavaScript components.
4
- */
5
- export declare const supportedLocales: Set<"hr" | "th" | "tr" | "el" | "ar" | "bg" | "bs" | "ca" | "cs" | "da" | "de" | "en" | "es" | "et" | "fi" | "fr" | "he" | "hu" | "id" | "it" | "ja" | "ko" | "lt" | "lv" | "nl" | "nb" | "no" | "pl" | "pt-BR" | "pt-PT" | "ro" | "ru" | "sk" | "sl" | "sr" | "sv" | "uk" | "vi" | "zh-CN" | "zh-HK" | "zh-TW">;
6
- /**
7
- * TypeScript union type for each locale supported by WebGIS SDK
8
- */
9
- export type SupportedLocale = (typeof supportedLocalesArray)[number];
10
- /**
11
- * The default locale for WebGIS SDK.
12
- */
13
- export declare const defaultLocale = "en";
14
- /**
15
- * Fetch the T9N strings bundle for the given locale, assets path and prefix.
16
- * The locale must be one of the supported locales.
17
- * If the locale is not supported, it will default to 'en'.
18
- * If the T9N strings bundle cannot be found, it will default to 'en'.
19
- *
20
- * @param locale The locale for which to fetch the T9N strings
21
- * @param assetsPath The path to the assets folder where the T9N strings are located
22
- * @param prefix The prefix to use for the T9N strings file name.
23
- *
24
- * @remarks
25
- * Rather than using this function directly, prefer the
26
- * [useT9n()](https://webgis.esri.com/references/lumina/controllers/useT9n)
27
- * controller.
28
- *
29
- * @remarks
30
- * The function implements cache. Frequent calls are safe.
31
- *
32
- * @example
33
- * ```ts
34
- * // Will make a request for ./assets/coding-editor/t9n/messages.en.json
35
- * const t9nStrings = await fetchT9nStringsBundle(
36
- * "en",
37
- * getAssetPath("./assets/coding-editor/t9n"),
38
- * "messages."
39
- * );
40
- * ```
41
- *
42
- * @see [Lumina asset handling](https://webgis.esri.com/references/lumina/assets)
43
- */
44
- export declare const fetchT9nStringsBundle: <Strings extends GenericT9nStrings>(locale: string, assetsPath: string, prefix?: string) => Promise<Strings>;
45
- /**
46
- * The interface for translated strings.
47
- */
48
- export interface GenericT9nStrings {
49
- [key: string]: GenericT9nStrings | string;
50
- }
51
- /**
52
- * Get the locale of the given element.
53
- * It will look for the lang attribute on the element and its ancestors.
54
- * If not lang is found, it will default to 'en'.
55
- *
56
- * @returns an object with the `lang` and `t9nLocale` properties.
57
- *
58
- * @see [lang vs t9nLocale](https://webgis.esri.com/references/lumina/controllers/useT9n#difference-between-lang-and-t9nlocale).
59
- */
60
- export declare const getElementLocale: (element: HTMLElement) => {
61
- readonly lang: string;
62
- readonly t9nLocale: SupportedLocale;
63
- };
64
- /**
65
- * Try to parse any language string into one of the locales supported by WebGIS SDK.
66
- *
67
- * @remarks
68
- * Follows the ArcGIS Maps SDK for JavaScript locale support:
69
- * https://developers.arcgis.com/javascript/latest/localization/#locale-support
70
- *
71
- * If language includes a region code, but we don't have a bundle for it, the
72
- * language is normalized to the language code only.
73
- */
74
- export declare const normalizeLocale: (lang: string) => SupportedLocale;
75
- export interface LocaleObserverResult<Strings extends GenericT9nStrings = GenericT9nStrings> {
76
- /** The T9N strings of the component */
77
- t9nStrings: Strings;
78
- /**
79
- * The locale of the component set by the `lang` attribute on the component host element or one of its ancestors.
80
- */
81
- lang: string;
82
- /**
83
- * The locale used by the component to load the T9N strings.
84
- * It may be different than the locale of the component host element that was set by the `lang` attribute.
85
- */
86
- t9nLocale: SupportedLocale;
87
- }
88
- /**
89
- * Start the locale observer for the given component.
90
- * The callback will be called when the locale changes for the component.
91
- * It will observe the lang attribute on the component and its ancestors.
92
- * The callback is called once at the beginning.
93
- *
94
- * @param element The HTML element that is doing the fetching
95
- * This is used to determine the locale to fetch, observe the `lang` attribute
96
- * changes, and is used as the default value for the `assetName` parameter.
97
- * @param getAssetsPath The callback to get path to the assets folder where the
98
- * T9N strings are located.
99
- * @param onUpdated The callback to call when the locale changes.
100
- * @param assetName Optionally override the asset file name.
101
- * Default file name is the element tag name without the part before the
102
- * first dash (e.g. `arcgis-map` becomes `map`).
103
- *
104
- * Set to null if the component has no localization strings, but you still
105
- * wish to use `startLocaleObserver` to get the locale information.
106
- *
107
- * @remarks
108
- * Rather than using this function directly, prefer the
109
- * [useT9n()](https://webgis.esri.com/references/lumina/controllers/useT9n)
110
- * controller.
111
- *
112
- * @example
113
- * ```ts
114
- * const observer = startLocaleObserver(
115
- * element,
116
- * () => getAssetPath("./assets"),
117
- * ({ strings, lang, t9nLocale }) => console.log({ strings, lang, t9nLocale }),
118
- * );
119
- * // Later: cleanup
120
- * observer();
121
- * ```
122
- */
123
- export declare const startLocaleObserver: <Strings extends GenericT9nStrings = GenericT9nStrings>(element: HTMLElement, getAssetsPath: () => string, onUpdated: (payload: LocaleObserverResult<Strings>) => void, assetName?: string | null) => (() => void);
124
- export {};
@@ -1,24 +0,0 @@
1
- import { nil } from '../type/index.ts';
2
- /**
3
- * Safeguard to ensure that an item is not undefined.
4
- * @param item The item to check.
5
- * @returns Returns true if the item is not undefined.
6
- * @example
7
- * ```ts
8
- * const arr = [1, undefined, 3];
9
- * const result = arr.filter(isNotUndefined);
10
- * ```
11
- */
12
- export declare const isNotUndefined: <T>(item: T | undefined) => item is T;
13
- /**
14
- * Safeguard to ensure that an item is not null.
15
- * @param item The item to check.
16
- * @returns Returns true if the item is not null.
17
- */
18
- export declare const isNotNull: <T>(item: T | null) => item is T;
19
- /**
20
- * Safeguard to ensure that an item is not null.
21
- * @param item The item to check.
22
- * @returns Returns true if the item is not and not undefined and not null.
23
- */
24
- export declare const isNotNil: <T>(x: nil | T) => x is T;
@@ -1,8 +0,0 @@
1
- const isNotUndefined = (item) => item !== void 0;
2
- const isNotNull = (item) => item !== null;
3
- const isNotNil = (x) => x != null;
4
- export {
5
- isNotNil,
6
- isNotNull,
7
- isNotUndefined
8
- };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes