@arcgis/toolkit 5.1.0-next.7 → 5.1.0-next.70
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/dom/index.cjs +30 -1
- package/dist/dom/index.d.cts +1 -0
- package/dist/dom/index.d.ts +1 -0
- package/dist/dom/index.js +30 -1
- package/dist/dom/reference-element.d.cts +6 -0
- package/dist/dom/reference-element.d.ts +6 -0
- package/dist/intl/index.cjs +4 -2
- package/dist/intl/index.d.cts +3 -0
- package/dist/intl/index.d.ts +3 -0
- package/dist/intl/index.js +4 -2
- package/dist/log/index.d.cts +3 -3
- package/dist/log/index.d.ts +3 -3
- package/dist/string/index.d.cts +9 -6
- package/dist/string/index.d.ts +9 -6
- package/dist/type/index.d.cts +1 -1
- package/dist/type/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/dom/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const log_index = require("../log/index.cjs");
|
|
3
4
|
function slotChangeHasContent(event) {
|
|
4
5
|
return slotChangeHasAssignedElement(event) || slotChangeHasTextContent(event);
|
|
5
6
|
}
|
|
@@ -29,6 +30,33 @@ function getSlotAssignedElements(slot, selector) {
|
|
|
29
30
|
});
|
|
30
31
|
return selector ? assignedElements.filter((element) => element.matches(selector)) : assignedElements;
|
|
31
32
|
}
|
|
33
|
+
const allowedTags = ["arcgis-map", "arcgis-scene", "arcgis-link-chart"];
|
|
34
|
+
function resolveReferenceElement(component, referenceElementString) {
|
|
35
|
+
const referenceElement = referenceElementString ?? component.referenceElement;
|
|
36
|
+
if (typeof referenceElement !== "string") {
|
|
37
|
+
return referenceElement ?? void 0;
|
|
38
|
+
}
|
|
39
|
+
const isComplexSelector = referenceElement.includes("#") || referenceElement.includes(".") || referenceElement.includes("[");
|
|
40
|
+
const rootNode = component.el.getRootNode();
|
|
41
|
+
const resolved = (isComplexSelector ? void 0 : rootNode.querySelector(`#${referenceElement}`)) ?? rootNode.querySelector(referenceElement) ?? (isComplexSelector ? void 0 : getClosestElement(component.el, `#${referenceElement}`)) ?? getClosestElement(component.el, referenceElement);
|
|
42
|
+
if (resolved == null) {
|
|
43
|
+
log_index.log(
|
|
44
|
+
"error",
|
|
45
|
+
component,
|
|
46
|
+
`Expected property \`referenceElement\` to resolve to an <arcgis-map>, <arcgis-scene>, or <arcgis-link-chart> element, but no element matched \`${referenceElement}\`.`
|
|
47
|
+
);
|
|
48
|
+
return void 0;
|
|
49
|
+
}
|
|
50
|
+
if (!allowedTags.includes(resolved.localName)) {
|
|
51
|
+
log_index.log(
|
|
52
|
+
"error",
|
|
53
|
+
component,
|
|
54
|
+
`Expected property \`referenceElement\` to point to an <arcgis-map>, <arcgis-scene>, or <arcgis-link-chart> element, but instead found <${resolved?.localName}>.`,
|
|
55
|
+
{ detail: { referenceElement, resolved } }
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return resolved ?? void 0;
|
|
59
|
+
}
|
|
32
60
|
const classes = (...classes2) => {
|
|
33
61
|
const effectiveClasses = [];
|
|
34
62
|
for (let i = 0; i < classes2.length; ++i) {
|
|
@@ -117,7 +145,7 @@ const getClosestElement = (base, selector) => {
|
|
|
117
145
|
if (rootElement === globalThis.document) {
|
|
118
146
|
return;
|
|
119
147
|
}
|
|
120
|
-
currentElement = rootElement
|
|
148
|
+
currentElement = rootElement?.host;
|
|
121
149
|
}
|
|
122
150
|
return;
|
|
123
151
|
};
|
|
@@ -186,6 +214,7 @@ exports.getClosestElement = getClosestElement;
|
|
|
186
214
|
exports.getElementAttribute = getElementAttribute;
|
|
187
215
|
exports.getSlotAssignedElements = getSlotAssignedElements;
|
|
188
216
|
exports.observeAncestorsMutation = observeAncestorsMutation;
|
|
217
|
+
exports.resolveReferenceElement = resolveReferenceElement;
|
|
189
218
|
exports.setFocusOnElement = setFocusOnElement;
|
|
190
219
|
exports.slotChangeGetAssignedElements = slotChangeGetAssignedElements;
|
|
191
220
|
exports.slotChangeGetAssignedNodes = slotChangeGetAssignedNodes;
|
package/dist/dom/index.d.cts
CHANGED
package/dist/dom/index.d.ts
CHANGED
package/dist/dom/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { log } from "../log/index.js";
|
|
1
2
|
function slotChangeHasContent(event) {
|
|
2
3
|
return slotChangeHasAssignedElement(event) || slotChangeHasTextContent(event);
|
|
3
4
|
}
|
|
@@ -27,6 +28,33 @@ function getSlotAssignedElements(slot, selector) {
|
|
|
27
28
|
});
|
|
28
29
|
return selector ? assignedElements.filter((element) => element.matches(selector)) : assignedElements;
|
|
29
30
|
}
|
|
31
|
+
const allowedTags = ["arcgis-map", "arcgis-scene", "arcgis-link-chart"];
|
|
32
|
+
function resolveReferenceElement(component, referenceElementString) {
|
|
33
|
+
const referenceElement = referenceElementString ?? component.referenceElement;
|
|
34
|
+
if (typeof referenceElement !== "string") {
|
|
35
|
+
return referenceElement ?? void 0;
|
|
36
|
+
}
|
|
37
|
+
const isComplexSelector = referenceElement.includes("#") || referenceElement.includes(".") || referenceElement.includes("[");
|
|
38
|
+
const rootNode = component.el.getRootNode();
|
|
39
|
+
const resolved = (isComplexSelector ? void 0 : rootNode.querySelector(`#${referenceElement}`)) ?? rootNode.querySelector(referenceElement) ?? (isComplexSelector ? void 0 : getClosestElement(component.el, `#${referenceElement}`)) ?? getClosestElement(component.el, referenceElement);
|
|
40
|
+
if (resolved == null) {
|
|
41
|
+
log(
|
|
42
|
+
"error",
|
|
43
|
+
component,
|
|
44
|
+
`Expected property \`referenceElement\` to resolve to an <arcgis-map>, <arcgis-scene>, or <arcgis-link-chart> element, but no element matched \`${referenceElement}\`.`
|
|
45
|
+
);
|
|
46
|
+
return void 0;
|
|
47
|
+
}
|
|
48
|
+
if (!allowedTags.includes(resolved.localName)) {
|
|
49
|
+
log(
|
|
50
|
+
"error",
|
|
51
|
+
component,
|
|
52
|
+
`Expected property \`referenceElement\` to point to an <arcgis-map>, <arcgis-scene>, or <arcgis-link-chart> element, but instead found <${resolved?.localName}>.`,
|
|
53
|
+
{ detail: { referenceElement, resolved } }
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
return resolved ?? void 0;
|
|
57
|
+
}
|
|
30
58
|
const classes = (...classes2) => {
|
|
31
59
|
const effectiveClasses = [];
|
|
32
60
|
for (let i = 0; i < classes2.length; ++i) {
|
|
@@ -115,7 +143,7 @@ const getClosestElement = (base, selector) => {
|
|
|
115
143
|
if (rootElement === globalThis.document) {
|
|
116
144
|
return;
|
|
117
145
|
}
|
|
118
|
-
currentElement = rootElement
|
|
146
|
+
currentElement = rootElement?.host;
|
|
119
147
|
}
|
|
120
148
|
return;
|
|
121
149
|
};
|
|
@@ -185,6 +213,7 @@ export {
|
|
|
185
213
|
getElementAttribute,
|
|
186
214
|
getSlotAssignedElements,
|
|
187
215
|
observeAncestorsMutation,
|
|
216
|
+
resolveReferenceElement,
|
|
188
217
|
setFocusOnElement,
|
|
189
218
|
slotChangeGetAssignedElements,
|
|
190
219
|
slotChangeGetAssignedNodes,
|
|
@@ -0,0 +1,6 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,6 @@
|
|
|
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 {};
|
package/dist/intl/index.cjs
CHANGED
|
@@ -12,8 +12,10 @@ const supportedLocales = (
|
|
|
12
12
|
const defaultLocale = "en";
|
|
13
13
|
const localeEquivalencies = {
|
|
14
14
|
//#region localeEquivalencies
|
|
15
|
-
//
|
|
16
|
-
|
|
15
|
+
// Locale equivalencies aligned with ArcGIS Maps SDK for JavaScript:
|
|
16
|
+
// https://developers.arcgis.com/javascript/latest/localization/#locale-support
|
|
17
|
+
// We resolve to `pt-BR` as it will have the same translations as `pt`, which has no corresponding bundle
|
|
18
|
+
pt: "pt-BR",
|
|
17
19
|
// We support both 'nb' and 'no' (BCP 47) for Norwegian but only `no` has corresponding bundle
|
|
18
20
|
nb: "no",
|
|
19
21
|
// We support both 'nn' and 'no' (BCP 47) for Norwegian but only `no` has corresponding bundle
|
package/dist/intl/index.d.cts
CHANGED
|
@@ -65,6 +65,9 @@ export declare const getElementLocale: (element: HTMLElement) => {
|
|
|
65
65
|
* Try to parse any language string into one of the locales supported by WebGIS SDK.
|
|
66
66
|
*
|
|
67
67
|
* @remarks
|
|
68
|
+
* Follows the ArcGIS Maps SDK for JavaScript locale support:
|
|
69
|
+
* https://developers.arcgis.com/javascript/latest/localization/#locale-support
|
|
70
|
+
*
|
|
68
71
|
* If language includes a region code, but we don't have a bundle for it, the
|
|
69
72
|
* language is normalized to the language code only.
|
|
70
73
|
*/
|
package/dist/intl/index.d.ts
CHANGED
|
@@ -65,6 +65,9 @@ export declare const getElementLocale: (element: HTMLElement) => {
|
|
|
65
65
|
* Try to parse any language string into one of the locales supported by WebGIS SDK.
|
|
66
66
|
*
|
|
67
67
|
* @remarks
|
|
68
|
+
* Follows the ArcGIS Maps SDK for JavaScript locale support:
|
|
69
|
+
* https://developers.arcgis.com/javascript/latest/localization/#locale-support
|
|
70
|
+
*
|
|
68
71
|
* If language includes a region code, but we don't have a bundle for it, the
|
|
69
72
|
* language is normalized to the language code only.
|
|
70
73
|
*/
|
package/dist/intl/index.js
CHANGED
|
@@ -10,8 +10,10 @@ const supportedLocales = (
|
|
|
10
10
|
const defaultLocale = "en";
|
|
11
11
|
const localeEquivalencies = {
|
|
12
12
|
//#region localeEquivalencies
|
|
13
|
-
//
|
|
14
|
-
|
|
13
|
+
// Locale equivalencies aligned with ArcGIS Maps SDK for JavaScript:
|
|
14
|
+
// https://developers.arcgis.com/javascript/latest/localization/#locale-support
|
|
15
|
+
// We resolve to `pt-BR` as it will have the same translations as `pt`, which has no corresponding bundle
|
|
16
|
+
pt: "pt-BR",
|
|
15
17
|
// We support both 'nb' and 'no' (BCP 47) for Norwegian but only `no` has corresponding bundle
|
|
16
18
|
nb: "no",
|
|
17
19
|
// We support both 'nn' and 'no' (BCP 47) for Norwegian but only `no` has corresponding bundle
|
package/dist/log/index.d.cts
CHANGED
|
@@ -19,15 +19,15 @@ type LogOptions = {
|
|
|
19
19
|
type EsriConfig = {
|
|
20
20
|
log: {
|
|
21
21
|
/**
|
|
22
|
-
* @link {https://developers.arcgis.com/javascript/latest/
|
|
22
|
+
* @link {https://developers.arcgis.com/javascript/latest/references/core/config/#LogInterceptor}
|
|
23
23
|
*/
|
|
24
24
|
interceptors?: ((level: LogLevel | "none", module: string, ...args: any[]) => void)[];
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
|
-
* Workaround for setting {@link https://developers.arcgis.com/javascript/latest/
|
|
28
|
+
* Workaround for setting {@link https://developers.arcgis.com/javascript/latest/references/core/config/#log log interceptors} and maintaining compatibility with {@link https://devtopia.esri.com/WebGIS/arcgis-websceneviewer-app/blob/8f0a1bbcf12d1193134d94589d9e187f0afa72fa/src/js/support/ApiLoggerInstrumentation.ts#L17 js-api's interceptor usage}.
|
|
29
29
|
* @see {@link https://devtopia.esri.com/WebGIS/arcgis-js-api/discussions/74935}
|
|
30
|
-
* @param config {@link https://developers.arcgis.com/javascript/latest/
|
|
30
|
+
* @param config {@link https://developers.arcgis.com/javascript/latest/references/core/config/}
|
|
31
31
|
* @example
|
|
32
32
|
* ```ts
|
|
33
33
|
* // IMPORTANT: do this only in config.ts or another early-loaded module
|
package/dist/log/index.d.ts
CHANGED
|
@@ -19,15 +19,15 @@ type LogOptions = {
|
|
|
19
19
|
type EsriConfig = {
|
|
20
20
|
log: {
|
|
21
21
|
/**
|
|
22
|
-
* @link {https://developers.arcgis.com/javascript/latest/
|
|
22
|
+
* @link {https://developers.arcgis.com/javascript/latest/references/core/config/#LogInterceptor}
|
|
23
23
|
*/
|
|
24
24
|
interceptors?: ((level: LogLevel | "none", module: string, ...args: any[]) => void)[];
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
|
-
* Workaround for setting {@link https://developers.arcgis.com/javascript/latest/
|
|
28
|
+
* Workaround for setting {@link https://developers.arcgis.com/javascript/latest/references/core/config/#log log interceptors} and maintaining compatibility with {@link https://devtopia.esri.com/WebGIS/arcgis-websceneviewer-app/blob/8f0a1bbcf12d1193134d94589d9e187f0afa72fa/src/js/support/ApiLoggerInstrumentation.ts#L17 js-api's interceptor usage}.
|
|
29
29
|
* @see {@link https://devtopia.esri.com/WebGIS/arcgis-js-api/discussions/74935}
|
|
30
|
-
* @param config {@link https://developers.arcgis.com/javascript/latest/
|
|
30
|
+
* @param config {@link https://developers.arcgis.com/javascript/latest/references/core/config/}
|
|
31
31
|
* @example
|
|
32
32
|
* ```ts
|
|
33
33
|
* // IMPORTANT: do this only in config.ts or another early-loaded module
|
package/dist/string/index.d.cts
CHANGED
|
@@ -62,15 +62,18 @@ export declare const addLtrMark: (value: string | undefined) => string;
|
|
|
62
62
|
export type UUID = ReturnType<typeof crypto.randomUUID>;
|
|
63
63
|
/**
|
|
64
64
|
* Generate a GUID string.
|
|
65
|
+
*
|
|
66
|
+
* If your component is using shadow root, the DOM element IDs do not need
|
|
67
|
+
* to be globally unique - IDs are scoped to the shadow root.
|
|
68
|
+
*
|
|
69
|
+
* Avoid using GUID and other non-deterministic output in render() as they
|
|
70
|
+
* cause SSR hydration issues and snapshot test instability.
|
|
71
|
+
*
|
|
65
72
|
* @example
|
|
66
73
|
* ```ts
|
|
67
74
|
* const id = generateGuid();
|
|
68
75
|
* // 00000000-0000-0000-0000-000000000000.
|
|
69
76
|
* ```
|
|
70
|
-
*
|
|
71
|
-
* @remarks
|
|
72
|
-
* If your component is using shadow root, the DOM element IDs do not need
|
|
73
|
-
* to be globally unique.
|
|
74
77
|
*/
|
|
75
78
|
export declare const generateGuid: () => UUID;
|
|
76
79
|
/**
|
|
@@ -89,7 +92,7 @@ export declare const getMinorVersion: (version: string) => string;
|
|
|
89
92
|
* The preamble text contains the version number and a link to the license.
|
|
90
93
|
* The version number should normally come from package.json.
|
|
91
94
|
*
|
|
92
|
-
* @see https://webgis.esri.com/webgis/
|
|
95
|
+
* @see https://webgis.esri.com/webgis/contributing/licensing
|
|
93
96
|
* @example
|
|
94
97
|
* ```ts
|
|
95
98
|
* const preamble = getPreamble("5.0.1-next.456");
|
|
@@ -101,6 +104,6 @@ export declare const getPreamble: (version: string) => string;
|
|
|
101
104
|
* Replace values in a string using the format {valueName} with the value from the values object.
|
|
102
105
|
* If the value is not found in the values object, then the value is not replaced.
|
|
103
106
|
*
|
|
104
|
-
* @deprecated Import from https://next.gha.afd.arcgis.com/javascript/latest/
|
|
107
|
+
* @deprecated Import from https://next.gha.afd.arcgis.com/javascript/latest/references/core/intl/#substitute instead
|
|
105
108
|
*/
|
|
106
109
|
export declare const setValuesInString: (message: string | null | undefined, values?: Record<string, string>) => string;
|
package/dist/string/index.d.ts
CHANGED
|
@@ -62,15 +62,18 @@ export declare const addLtrMark: (value: string | undefined) => string;
|
|
|
62
62
|
export type UUID = ReturnType<typeof crypto.randomUUID>;
|
|
63
63
|
/**
|
|
64
64
|
* Generate a GUID string.
|
|
65
|
+
*
|
|
66
|
+
* If your component is using shadow root, the DOM element IDs do not need
|
|
67
|
+
* to be globally unique - IDs are scoped to the shadow root.
|
|
68
|
+
*
|
|
69
|
+
* Avoid using GUID and other non-deterministic output in render() as they
|
|
70
|
+
* cause SSR hydration issues and snapshot test instability.
|
|
71
|
+
*
|
|
65
72
|
* @example
|
|
66
73
|
* ```ts
|
|
67
74
|
* const id = generateGuid();
|
|
68
75
|
* // 00000000-0000-0000-0000-000000000000.
|
|
69
76
|
* ```
|
|
70
|
-
*
|
|
71
|
-
* @remarks
|
|
72
|
-
* If your component is using shadow root, the DOM element IDs do not need
|
|
73
|
-
* to be globally unique.
|
|
74
77
|
*/
|
|
75
78
|
export declare const generateGuid: () => UUID;
|
|
76
79
|
/**
|
|
@@ -89,7 +92,7 @@ export declare const getMinorVersion: (version: string) => string;
|
|
|
89
92
|
* The preamble text contains the version number and a link to the license.
|
|
90
93
|
* The version number should normally come from package.json.
|
|
91
94
|
*
|
|
92
|
-
* @see https://webgis.esri.com/webgis/
|
|
95
|
+
* @see https://webgis.esri.com/webgis/contributing/licensing
|
|
93
96
|
* @example
|
|
94
97
|
* ```ts
|
|
95
98
|
* const preamble = getPreamble("5.0.1-next.456");
|
|
@@ -101,6 +104,6 @@ export declare const getPreamble: (version: string) => string;
|
|
|
101
104
|
* Replace values in a string using the format {valueName} with the value from the values object.
|
|
102
105
|
* If the value is not found in the values object, then the value is not replaced.
|
|
103
106
|
*
|
|
104
|
-
* @deprecated Import from https://next.gha.afd.arcgis.com/javascript/latest/
|
|
107
|
+
* @deprecated Import from https://next.gha.afd.arcgis.com/javascript/latest/references/core/intl/#substitute instead
|
|
105
108
|
*/
|
|
106
109
|
export declare const setValuesInString: (message: string | null | undefined, values?: Record<string, string>) => string;
|
package/dist/type/index.d.cts
CHANGED
package/dist/type/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/toolkit",
|
|
3
|
-
"version": "5.1.0-next.
|
|
3
|
+
"version": "5.1.0-next.70",
|
|
4
4
|
"description": "Collection of common internal patterns and utilities for ArcGIS Maps SDK for JavaScript components.",
|
|
5
5
|
"homepage": "https://developers.arcgis.com/javascript/latest/",
|
|
6
6
|
"sideEffects": false,
|