@arcgis/toolkit 5.1.0-next.60 → 5.1.0-next.62
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 +29 -0
- package/dist/dom/index.d.cts +1 -0
- package/dist/dom/index.d.ts +1 -0
- package/dist/dom/index.js +29 -0
- package/dist/dom/reference-element.d.cts +6 -0
- package/dist/dom/reference-element.d.ts +6 -0
- package/dist/intl/index.cjs +2 -0
- package/dist/intl/index.d.cts +4 -1
- package/dist/intl/index.d.ts +4 -1
- package/dist/intl/index.js +2 -0
- package/dist/string/index.d.cts +1 -1
- package/dist/string/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) {
|
|
@@ -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) {
|
|
@@ -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,6 +12,8 @@ const supportedLocales = (
|
|
|
12
12
|
const defaultLocale = "en";
|
|
13
13
|
const localeEquivalencies = {
|
|
14
14
|
//#region localeEquivalencies
|
|
15
|
+
// Locale equivalencies aligned with ArcGIS Maps SDK for JavaScript:
|
|
16
|
+
// https://developers.arcgis.com/javascript/latest/localization/#locale-support
|
|
15
17
|
// We resolve to `pt-BR` as it will have the same translations as `pt`, which has no corresponding bundle
|
|
16
18
|
pt: "pt-BR",
|
|
17
19
|
// We support both 'nb' and 'no' (BCP 47) for Norwegian but only `no` has corresponding bundle
|
package/dist/intl/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ declare const supportedLocalesArray: ["ar", "bg", "bs", "ca", "cs", "da", "de",
|
|
|
2
2
|
/**
|
|
3
3
|
* The list of supported locales for ArcGIS Maps SDK for JavaScript components.
|
|
4
4
|
*/
|
|
5
|
-
export declare const supportedLocales: Set<"
|
|
5
|
+
export declare const supportedLocales: Set<"el" | "hr" | "th" | "tr" | "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
6
|
/**
|
|
7
7
|
* TypeScript union type for each locale supported by WebGIS SDK
|
|
8
8
|
*/
|
|
@@ -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
|
@@ -2,7 +2,7 @@ declare const supportedLocalesArray: ["ar", "bg", "bs", "ca", "cs", "da", "de",
|
|
|
2
2
|
/**
|
|
3
3
|
* The list of supported locales for ArcGIS Maps SDK for JavaScript components.
|
|
4
4
|
*/
|
|
5
|
-
export declare const supportedLocales: Set<"
|
|
5
|
+
export declare const supportedLocales: Set<"el" | "hr" | "th" | "tr" | "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
6
|
/**
|
|
7
7
|
* TypeScript union type for each locale supported by WebGIS SDK
|
|
8
8
|
*/
|
|
@@ -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,6 +10,8 @@ const supportedLocales = (
|
|
|
10
10
|
const defaultLocale = "en";
|
|
11
11
|
const localeEquivalencies = {
|
|
12
12
|
//#region localeEquivalencies
|
|
13
|
+
// Locale equivalencies aligned with ArcGIS Maps SDK for JavaScript:
|
|
14
|
+
// https://developers.arcgis.com/javascript/latest/localization/#locale-support
|
|
13
15
|
// We resolve to `pt-BR` as it will have the same translations as `pt`, which has no corresponding bundle
|
|
14
16
|
pt: "pt-BR",
|
|
15
17
|
// We support both 'nb' and 'no' (BCP 47) for Norwegian but only `no` has corresponding bundle
|
package/dist/string/index.d.cts
CHANGED
|
@@ -92,7 +92,7 @@ export declare const getMinorVersion: (version: string) => string;
|
|
|
92
92
|
* The preamble text contains the version number and a link to the license.
|
|
93
93
|
* The version number should normally come from package.json.
|
|
94
94
|
*
|
|
95
|
-
* @see https://webgis.esri.com/webgis/
|
|
95
|
+
* @see https://webgis.esri.com/webgis/contributing/licensing
|
|
96
96
|
* @example
|
|
97
97
|
* ```ts
|
|
98
98
|
* const preamble = getPreamble("5.0.1-next.456");
|
package/dist/string/index.d.ts
CHANGED
|
@@ -92,7 +92,7 @@ export declare const getMinorVersion: (version: string) => string;
|
|
|
92
92
|
* The preamble text contains the version number and a link to the license.
|
|
93
93
|
* The version number should normally come from package.json.
|
|
94
94
|
*
|
|
95
|
-
* @see https://webgis.esri.com/webgis/
|
|
95
|
+
* @see https://webgis.esri.com/webgis/contributing/licensing
|
|
96
96
|
* @example
|
|
97
97
|
* ```ts
|
|
98
98
|
* const preamble = getPreamble("5.0.1-next.456");
|
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.62",
|
|
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,
|