@arcgis/components-utils 4.33.0-next.99 → 4.34.0-next.1
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 +1 -1
- package/dist/array-utils.d.ts +1 -1
- package/dist/css-utils.d.cts +1 -1
- package/dist/css-utils.d.ts +1 -1
- package/dist/deferred.d.cts +9 -4
- package/dist/deferred.d.ts +9 -4
- package/dist/dom.d.cts +8 -8
- package/dist/dom.d.ts +8 -8
- package/dist/errors.d.cts +3 -3
- package/dist/errors.d.ts +3 -3
- package/dist/guid.d.cts +1 -1
- package/dist/guid.d.ts +1 -1
- package/dist/index.cjs +83 -139
- package/dist/index.js +83 -139
- package/dist/intl.d.cts +7 -7
- package/dist/intl.d.ts +7 -7
- package/dist/strings.d.cts +4 -4
- package/dist/strings.d.ts +4 -4
- package/dist/timeouts.d.cts +1 -1
- package/dist/timeouts.d.ts +1 -1
- package/dist/type-guards.d.cts +2 -2
- package/dist/type-guards.d.ts +2 -2
- package/dist/ui.d.cts +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/url.d.cts +2 -2
- package/dist/url.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const mappedFind = (array, callback) => {
|
|
2
2
|
for (let i = 0; i < array.length; i++) {
|
|
3
3
|
const value = callback(array[i], i);
|
|
4
4
|
if (value != null) {
|
|
@@ -6,8 +6,8 @@ function mappedFind(array, callback) {
|
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
return;
|
|
9
|
-
}
|
|
10
|
-
|
|
9
|
+
};
|
|
10
|
+
const classes = (...classes2) => {
|
|
11
11
|
const effectiveClasses = [];
|
|
12
12
|
for (let i = 0; i < classes2.length; i++) {
|
|
13
13
|
const arg = classes2[i];
|
|
@@ -26,19 +26,8 @@ function classes(...classes2) {
|
|
|
26
26
|
const className = effectiveClasses.join(" ");
|
|
27
27
|
effectiveClasses.length = 0;
|
|
28
28
|
return className;
|
|
29
|
-
}
|
|
29
|
+
};
|
|
30
30
|
class Deferred {
|
|
31
|
-
/**
|
|
32
|
-
* Resolves the promise.
|
|
33
|
-
* @param value The value to resolve the promise with.
|
|
34
|
-
*/
|
|
35
|
-
resolve(_value) {
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Rejects the promise.
|
|
39
|
-
*/
|
|
40
|
-
reject(_error) {
|
|
41
|
-
}
|
|
42
31
|
/**
|
|
43
32
|
* Creates a new deferred promise.
|
|
44
33
|
*/
|
|
@@ -49,7 +38,7 @@ class Deferred {
|
|
|
49
38
|
});
|
|
50
39
|
}
|
|
51
40
|
}
|
|
52
|
-
|
|
41
|
+
const inTargetElement = (element, targetElement) => {
|
|
53
42
|
let currentElement = element;
|
|
54
43
|
while (currentElement) {
|
|
55
44
|
if (currentElement === targetElement) {
|
|
@@ -65,18 +54,18 @@ function inTargetElement(element, targetElement) {
|
|
|
65
54
|
}
|
|
66
55
|
}
|
|
67
56
|
return false;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const
|
|
57
|
+
};
|
|
58
|
+
const observeAncestorsMutation = (element, attributeFilter, callback) => {
|
|
59
|
+
const subscribe = observe(attributeFilter).subscribe;
|
|
71
60
|
return subscribe((mutations) => {
|
|
72
61
|
const matched = mutations.some((mutation) => inTargetElement(element, mutation.target));
|
|
73
62
|
if (matched) {
|
|
74
63
|
callback();
|
|
75
64
|
}
|
|
76
65
|
});
|
|
77
|
-
}
|
|
66
|
+
};
|
|
78
67
|
const observers = {};
|
|
79
|
-
|
|
68
|
+
const observe = (attributeFilter) => {
|
|
80
69
|
const attributes = attributeFilter.join(",");
|
|
81
70
|
const previousObserver = observers[attributes];
|
|
82
71
|
if (previousObserver !== void 0) {
|
|
@@ -92,7 +81,7 @@ function observe(attributeFilter) {
|
|
|
92
81
|
});
|
|
93
82
|
}
|
|
94
83
|
const observer = {
|
|
95
|
-
subscribe(callback) {
|
|
84
|
+
subscribe: (callback) => {
|
|
96
85
|
subscribers.add(callback);
|
|
97
86
|
return () => {
|
|
98
87
|
subscribers.delete(callback);
|
|
@@ -105,8 +94,8 @@ function observe(attributeFilter) {
|
|
|
105
94
|
};
|
|
106
95
|
observers[attributes] = observer;
|
|
107
96
|
return observer;
|
|
108
|
-
}
|
|
109
|
-
|
|
97
|
+
};
|
|
98
|
+
const closestElement = (base, selector) => {
|
|
110
99
|
let currentElement = base;
|
|
111
100
|
while (currentElement) {
|
|
112
101
|
const element = currentElement.closest?.(selector);
|
|
@@ -120,25 +109,19 @@ function closestElement(base, selector) {
|
|
|
120
109
|
currentElement = rootElement.host;
|
|
121
110
|
}
|
|
122
111
|
return null;
|
|
123
|
-
}
|
|
124
|
-
|
|
112
|
+
};
|
|
113
|
+
const getElementTheme = (base) => {
|
|
125
114
|
const themeElement = closestElement(base, ":is(.calcite-mode-light, .calcite-mode-dark)");
|
|
126
115
|
return themeElement?.classList.contains("calcite-mode-dark") ? "dark" : "light";
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
function getElementAttribute(el, prop, fallbackValue) {
|
|
116
|
+
};
|
|
117
|
+
const getElementDir = (el) => getElementAttribute(el, "dir", "ltr");
|
|
118
|
+
const getElementAttribute = (el, prop, fallbackValue) => {
|
|
132
119
|
const closest = closestElement(el, `[${prop}]`);
|
|
133
120
|
return closest?.getAttribute(prop) ?? fallbackValue;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
function hasSetFocus(ref) {
|
|
139
|
-
return typeof ref.setFocus === "function";
|
|
140
|
-
}
|
|
141
|
-
function setFocus(ref, selector = "") {
|
|
121
|
+
};
|
|
122
|
+
const isElement = (ref) => ref.nodeType === Node.ELEMENT_NODE;
|
|
123
|
+
const hasSetFocus = (ref) => typeof ref.setFocus === "function";
|
|
124
|
+
const setFocus = (ref, selector = "") => {
|
|
142
125
|
if (!isElement(ref)) {
|
|
143
126
|
return false;
|
|
144
127
|
}
|
|
@@ -162,8 +145,8 @@ function setFocus(ref, selector = "") {
|
|
|
162
145
|
}
|
|
163
146
|
}
|
|
164
147
|
return false;
|
|
165
|
-
}
|
|
166
|
-
async
|
|
148
|
+
};
|
|
149
|
+
const focusElement = async (el) => {
|
|
167
150
|
if (el == null) {
|
|
168
151
|
return;
|
|
169
152
|
}
|
|
@@ -172,8 +155,8 @@ async function focusElement(el) {
|
|
|
172
155
|
} else {
|
|
173
156
|
el.focus();
|
|
174
157
|
}
|
|
175
|
-
}
|
|
176
|
-
|
|
158
|
+
};
|
|
159
|
+
const setFocusOnElement = (ref, selector) => {
|
|
177
160
|
if (!ref?.shadowRoot) {
|
|
178
161
|
return;
|
|
179
162
|
}
|
|
@@ -182,19 +165,29 @@ function setFocusOnElement(ref, selector) {
|
|
|
182
165
|
return;
|
|
183
166
|
}
|
|
184
167
|
void Promise.resolve(ref.componentOnReady?.()).then(() => setFocus(ref, selector));
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
168
|
+
};
|
|
169
|
+
const isEsriInternalEnv = () => (
|
|
170
|
+
/*
|
|
171
|
+
* `globalThis.` is important here. Some bundlers remove the `typeof process`
|
|
172
|
+
* checks, but don't remove the usages of undefined variables - this can cause
|
|
173
|
+
* runtime error. By adding `globalThis.`, we avoid having `typeof process`
|
|
174
|
+
* check removed by the bundler.
|
|
175
|
+
* This does meant tree-shaking won't happen for the isEsriInternalEnv()
|
|
176
|
+
* check, but this is ok since this check is meant to always be behind the
|
|
177
|
+
* development/test guard.
|
|
178
|
+
* See https://devtopia.esri.com/WebGIS/arcgis-web-components/pull/2087#issuecomment-5152454
|
|
179
|
+
*/
|
|
180
|
+
typeof globalThis.process === "object" && !!process.env.ESRI_INTERNAL
|
|
181
|
+
);
|
|
182
|
+
const safeCall = (callback, thisContext, ...rest) => {
|
|
190
183
|
try {
|
|
191
184
|
return callback?.call(thisContext, ...rest);
|
|
192
185
|
} catch (error) {
|
|
193
186
|
console.error(error, callback);
|
|
194
187
|
}
|
|
195
188
|
return void 0;
|
|
196
|
-
}
|
|
197
|
-
async
|
|
189
|
+
};
|
|
190
|
+
const safeAsyncCall = async (callback, thisContext, ...rest) => {
|
|
198
191
|
try {
|
|
199
192
|
const result = callback?.call(thisContext, ...rest);
|
|
200
193
|
return await result;
|
|
@@ -202,60 +195,18 @@ async function safeAsyncCall(callback, thisContext, ...rest) {
|
|
|
202
195
|
console.error(error, callback);
|
|
203
196
|
}
|
|
204
197
|
return void 0;
|
|
205
|
-
}
|
|
206
|
-
|
|
198
|
+
};
|
|
199
|
+
const gen = (count) => {
|
|
207
200
|
let out = "";
|
|
208
201
|
for (let i = 0; i < count; i++) {
|
|
209
202
|
out += ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
|
|
210
203
|
}
|
|
211
204
|
return out;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
"ar",
|
|
218
|
-
"bg",
|
|
219
|
-
"bs",
|
|
220
|
-
"ca",
|
|
221
|
-
"cs",
|
|
222
|
-
"da",
|
|
223
|
-
"de",
|
|
224
|
-
"el",
|
|
225
|
-
"en",
|
|
226
|
-
"es",
|
|
227
|
-
"et",
|
|
228
|
-
"fi",
|
|
229
|
-
"fr",
|
|
230
|
-
"he",
|
|
231
|
-
"hr",
|
|
232
|
-
"hu",
|
|
233
|
-
"id",
|
|
234
|
-
"it",
|
|
235
|
-
"ja",
|
|
236
|
-
"ko",
|
|
237
|
-
"lt",
|
|
238
|
-
"lv",
|
|
239
|
-
"nl",
|
|
240
|
-
"nb",
|
|
241
|
-
"no",
|
|
242
|
-
"pl",
|
|
243
|
-
"pt-BR",
|
|
244
|
-
"pt-PT",
|
|
245
|
-
"ro",
|
|
246
|
-
"ru",
|
|
247
|
-
"sk",
|
|
248
|
-
"sl",
|
|
249
|
-
"sr",
|
|
250
|
-
"sv",
|
|
251
|
-
"th",
|
|
252
|
-
"tr",
|
|
253
|
-
"uk",
|
|
254
|
-
"vi",
|
|
255
|
-
"zh-CN",
|
|
256
|
-
"zh-HK",
|
|
257
|
-
"zh-TW"
|
|
258
|
-
];
|
|
205
|
+
};
|
|
206
|
+
const generateGuid = () => [gen(2), gen(1), gen(1), gen(1), gen(3)].join("-");
|
|
207
|
+
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".split(
|
|
208
|
+
","
|
|
209
|
+
);
|
|
259
210
|
const supportedLocales = /* @__PURE__ */ new Set(supportedLocalesArray);
|
|
260
211
|
const defaultLocale = "en";
|
|
261
212
|
const localeEquivalencies = {
|
|
@@ -269,14 +220,14 @@ const localeEquivalencies = {
|
|
|
269
220
|
// We use `zh-CN` as base translation for chinese locales which has no corresponding bundle.
|
|
270
221
|
zh: "zh-CN"
|
|
271
222
|
};
|
|
272
|
-
async
|
|
223
|
+
const fetchT9nStringsBundle = async (locale, assetsPath, prefix = "") => {
|
|
273
224
|
const path = `${assetsPath}/${prefix}`;
|
|
274
225
|
const filePath = `${path}${locale}.json`;
|
|
275
226
|
t9nStringsCache[filePath] ?? (t9nStringsCache[filePath] = fetchBundle(locale, path));
|
|
276
227
|
return await t9nStringsCache[filePath];
|
|
277
|
-
}
|
|
228
|
+
};
|
|
278
229
|
const t9nStringsCache = {};
|
|
279
|
-
async
|
|
230
|
+
const fetchBundle = async (locale, path) => {
|
|
280
231
|
const filePath = `${path}${locale}.json`;
|
|
281
232
|
try {
|
|
282
233
|
const response = await fetch(filePath);
|
|
@@ -300,12 +251,12 @@ async function fetchBundle(locale, path) {
|
|
|
300
251
|
return {};
|
|
301
252
|
}
|
|
302
253
|
return await fetchBundle(defaultLocale, path);
|
|
303
|
-
}
|
|
304
|
-
|
|
254
|
+
};
|
|
255
|
+
const getElementLocales = (element) => {
|
|
305
256
|
const lang = getElementAttribute(element, "lang", globalThis.navigator?.language || defaultLocale);
|
|
306
257
|
return { lang, t9nLocale: normalizeLocale(lang) };
|
|
307
|
-
}
|
|
308
|
-
|
|
258
|
+
};
|
|
259
|
+
const normalizeLocale = (locale) => {
|
|
309
260
|
const [rawLanguageCode, regionCode] = locale.split("-");
|
|
310
261
|
const languageCode = rawLanguageCode.toLowerCase();
|
|
311
262
|
let normalizedLocale = languageCode;
|
|
@@ -320,10 +271,10 @@ function normalizeLocale(locale) {
|
|
|
320
271
|
return normalizeLocale(languageCode);
|
|
321
272
|
}
|
|
322
273
|
return defaultLocale;
|
|
323
|
-
}
|
|
324
|
-
|
|
274
|
+
};
|
|
275
|
+
const startLocaleObserver = (element, getAssetsPath, onUpdated, assetName) => {
|
|
325
276
|
let result = void 0;
|
|
326
|
-
const callback = () =>
|
|
277
|
+
const callback = () => updateComponentLocaleState(element, getAssetsPath(), assetName).then((newResult) => {
|
|
327
278
|
if (result?.lang !== newResult.lang || result.t9nLocale !== newResult.t9nLocale || result.t9nStrings !== newResult.t9nStrings) {
|
|
328
279
|
onUpdated(newResult);
|
|
329
280
|
}
|
|
@@ -331,8 +282,8 @@ function startLocaleObserver(element, getAssetsPath, onUpdated, assetName) {
|
|
|
331
282
|
}).catch(console.error);
|
|
332
283
|
queueMicrotask(callback);
|
|
333
284
|
return observeAncestorsMutation(element, ["lang"], callback);
|
|
334
|
-
}
|
|
335
|
-
async
|
|
285
|
+
};
|
|
286
|
+
const updateComponentLocaleState = async (element, assetsPath, assetName = element.localName.split("-").slice(1).join("-")) => {
|
|
336
287
|
const { lang, t9nLocale } = getElementLocales(element);
|
|
337
288
|
const t9nAssetsPath = `${assetsPath}/${assetName}/t9n`;
|
|
338
289
|
const prefix = `messages.`;
|
|
@@ -341,7 +292,7 @@ async function updateComponentLocaleState(element, assetsPath, assetName = eleme
|
|
|
341
292
|
assetName === null ? {} : await fetchT9nStringsBundle(t9nLocale, t9nAssetsPath, prefix)
|
|
342
293
|
);
|
|
343
294
|
return { lang, t9nLocale, t9nStrings };
|
|
344
|
-
}
|
|
295
|
+
};
|
|
345
296
|
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}";
|
|
346
297
|
const extractMinorVersion = (version) => {
|
|
347
298
|
const [major, minor] = version.split(".");
|
|
@@ -350,10 +301,8 @@ const extractMinorVersion = (version) => {
|
|
|
350
301
|
const getPreamble = (version) => blurb.replace("{minorVersion}", extractMinorVersion(version)).replace("{version}", version);
|
|
351
302
|
const doubleQuote = '"';
|
|
352
303
|
const singleQuote = "'";
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
}
|
|
356
|
-
function quoteString(value) {
|
|
304
|
+
const repeatString = (value, n) => new Array(n + 1).join(value);
|
|
305
|
+
const quoteString = (value) => {
|
|
357
306
|
let quote = doubleQuote;
|
|
358
307
|
let alternateQuote = singleQuote;
|
|
359
308
|
const avoidEscape = value.includes(quote) && !value.includes(alternateQuote);
|
|
@@ -375,24 +324,23 @@ function quoteString(value) {
|
|
|
375
324
|
(_, boundaryChar, leadingEscapedSlashes, quoteChars) => boundaryChar + leadingEscapedSlashes + repeatString(`\\${quote}`, quoteChars.length)
|
|
376
325
|
);
|
|
377
326
|
return quote + value + quote;
|
|
378
|
-
}
|
|
379
|
-
|
|
327
|
+
};
|
|
328
|
+
const createFilterExpression = (filterWord) => {
|
|
380
329
|
const sanitizedWord = filterWord ? filterWord.replaceAll(/[-[\]/{}()*+?.\\^$|]/gu, "\\$&") : "^.*$";
|
|
381
330
|
return new RegExp(sanitizedWord, "i");
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
}
|
|
331
|
+
};
|
|
332
|
+
const setValuesInString = (message, values = {}) => (message ?? "").replace(/\{(?<valueName>.*?)\}/gu, (match, valueName) => values[valueName] ?? match);
|
|
333
|
+
const addLTRMark = (value) => (
|
|
334
|
+
// Make sure the string value is LTR. This prevent issues with RTL language used in LTR containers.
|
|
335
|
+
`${value ?? ""}`
|
|
336
|
+
);
|
|
389
337
|
const kebabToPascal = (string) => string.split("-").map(capitalize).join("");
|
|
390
338
|
const camelToKebab = (string) => string.replace(upperBeforeLower, (upper, remainder) => `${remainder === 0 ? "" : "-"}${upper.toLowerCase()}`);
|
|
391
339
|
const upperBeforeLower = /[A-Z]+(?![a-z])|[A-Z]/gu;
|
|
392
340
|
const capitalize = (string) => string.charAt(0).toUpperCase() + string.slice(1);
|
|
393
341
|
const uncapitalize = (string) => string.charAt(0).toLowerCase() + string.slice(1);
|
|
394
342
|
const camelToHuman = (string) => capitalize(string.replace(upperBeforeLower, (upper, remainder) => `${remainder === 0 ? "" : " "}${upper}`));
|
|
395
|
-
|
|
343
|
+
const devToolsAwareTimeout = (callback, timeout) => {
|
|
396
344
|
const interval = timeout > longTimeoutThreshold ? longTimeoutInterval : timeout / shortTimeoutIntervals;
|
|
397
345
|
let elapsed = 0;
|
|
398
346
|
const reference = setInterval(() => {
|
|
@@ -403,18 +351,14 @@ function devToolsAwareTimeout(callback, timeout) {
|
|
|
403
351
|
}
|
|
404
352
|
}, interval);
|
|
405
353
|
return reference;
|
|
406
|
-
}
|
|
354
|
+
};
|
|
407
355
|
const longTimeoutThreshold = 4e3;
|
|
408
356
|
const longTimeoutInterval = 2e3;
|
|
409
357
|
const shortTimeoutIntervals = 4;
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
}
|
|
413
|
-
function isNotUndefined(item) {
|
|
414
|
-
return item !== void 0;
|
|
415
|
-
}
|
|
358
|
+
const isNotNull = (item) => item !== null;
|
|
359
|
+
const isNotUndefined = (item) => item !== void 0;
|
|
416
360
|
const identity = (value) => value;
|
|
417
|
-
|
|
361
|
+
const debounce = (func, waitFor = 100) => {
|
|
418
362
|
let timeout;
|
|
419
363
|
return (...args) => {
|
|
420
364
|
const later = () => {
|
|
@@ -424,8 +368,8 @@ function debounce(func, waitFor = 100) {
|
|
|
424
368
|
clearTimeout(timeout);
|
|
425
369
|
timeout = setTimeout(later, waitFor);
|
|
426
370
|
};
|
|
427
|
-
}
|
|
428
|
-
|
|
371
|
+
};
|
|
372
|
+
const hasSameOrigin = (url1, url2, ignoreProtocol = false) => {
|
|
429
373
|
if (!url1 || !url2) {
|
|
430
374
|
return false;
|
|
431
375
|
}
|
|
@@ -438,15 +382,15 @@ function hasSameOrigin(url1, url2, ignoreProtocol = false) {
|
|
|
438
382
|
return false;
|
|
439
383
|
}
|
|
440
384
|
return url1Obj.host.toLowerCase() === url2Obj.host.toLowerCase() && url1Obj.port === url2Obj.port;
|
|
441
|
-
}
|
|
442
|
-
|
|
385
|
+
};
|
|
386
|
+
const isURL = (url) => {
|
|
443
387
|
try {
|
|
444
388
|
new URL(url);
|
|
445
389
|
return true;
|
|
446
390
|
} catch (e) {
|
|
447
391
|
return false;
|
|
448
392
|
}
|
|
449
|
-
}
|
|
393
|
+
};
|
|
450
394
|
export {
|
|
451
395
|
Deferred,
|
|
452
396
|
addLTRMark,
|
package/dist/intl.d.cts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
export interface GenericT9nStrings {
|
|
5
5
|
[key: string]: GenericT9nStrings | string;
|
|
6
6
|
}
|
|
7
|
-
declare const supportedLocalesArray:
|
|
7
|
+
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"];
|
|
8
8
|
/**
|
|
9
9
|
* The list of supported locales for ArcGIS Maps SDK for JavaScript components.
|
|
10
10
|
*/
|
|
@@ -25,23 +25,23 @@ export declare const defaultLocale = "en";
|
|
|
25
25
|
* const t9nStrings = await fetchT9nStringsBundle("en", getAssetPath("./assets/coding-editor/t9n"), "messages.");
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
export declare
|
|
28
|
+
export declare const fetchT9nStringsBundle: <Strings extends GenericT9nStrings>(
|
|
29
29
|
/** The locale for which to fetch the T9N strings */
|
|
30
30
|
locale: string,
|
|
31
31
|
/** The path to the assets folder where the T9N strings are located */
|
|
32
32
|
assetsPath: string,
|
|
33
33
|
/** The prefix to use for the T9N strings file name. */
|
|
34
|
-
prefix?: string)
|
|
34
|
+
prefix?: string) => Promise<Strings>;
|
|
35
35
|
/**
|
|
36
36
|
* Get the locale of the given element.
|
|
37
37
|
* It will look for the lang attribute on the element and its ancestors.
|
|
38
38
|
* If not lang is found, it will default to 'en'.
|
|
39
39
|
*/
|
|
40
|
-
export declare
|
|
40
|
+
export declare const getElementLocales: (element: HTMLElement) => {
|
|
41
41
|
readonly lang: string;
|
|
42
42
|
readonly t9nLocale: SupportedLocale;
|
|
43
43
|
};
|
|
44
|
-
export declare
|
|
44
|
+
export declare const normalizeLocale: (locale: string) => SupportedLocale;
|
|
45
45
|
export type LocaleObserver<Strings extends GenericT9nStrings = GenericT9nStrings> = {
|
|
46
46
|
/** The T9N strings of the component */
|
|
47
47
|
t9nStrings: Strings;
|
|
@@ -64,7 +64,7 @@ export type LocaleObserver<Strings extends GenericT9nStrings = GenericT9nStrings
|
|
|
64
64
|
* @remarks
|
|
65
65
|
* Rather than using this function directly, prefer the `useT9n()` controller.
|
|
66
66
|
*/
|
|
67
|
-
export declare
|
|
67
|
+
export declare const startLocaleObserver: <Strings extends GenericT9nStrings = GenericT9nStrings>(
|
|
68
68
|
/** The Web component HTML element that is doing the fetching */
|
|
69
69
|
element: HTMLElement,
|
|
70
70
|
/**
|
|
@@ -87,5 +87,5 @@ onUpdated: (payload: LocaleObserver<Strings>) => void,
|
|
|
87
87
|
* Set to null if the component has no localization strings, but you still
|
|
88
88
|
* wish to use `startLocaleObserver` to get the locale information.
|
|
89
89
|
*/
|
|
90
|
-
assetName?: string | null)
|
|
90
|
+
assetName?: string | null) => (() => void);
|
|
91
91
|
export {};
|
package/dist/intl.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
export interface GenericT9nStrings {
|
|
5
5
|
[key: string]: GenericT9nStrings | string;
|
|
6
6
|
}
|
|
7
|
-
declare const supportedLocalesArray:
|
|
7
|
+
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"];
|
|
8
8
|
/**
|
|
9
9
|
* The list of supported locales for ArcGIS Maps SDK for JavaScript components.
|
|
10
10
|
*/
|
|
@@ -25,23 +25,23 @@ export declare const defaultLocale = "en";
|
|
|
25
25
|
* const t9nStrings = await fetchT9nStringsBundle("en", getAssetPath("./assets/coding-editor/t9n"), "messages.");
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
export declare
|
|
28
|
+
export declare const fetchT9nStringsBundle: <Strings extends GenericT9nStrings>(
|
|
29
29
|
/** The locale for which to fetch the T9N strings */
|
|
30
30
|
locale: string,
|
|
31
31
|
/** The path to the assets folder where the T9N strings are located */
|
|
32
32
|
assetsPath: string,
|
|
33
33
|
/** The prefix to use for the T9N strings file name. */
|
|
34
|
-
prefix?: string)
|
|
34
|
+
prefix?: string) => Promise<Strings>;
|
|
35
35
|
/**
|
|
36
36
|
* Get the locale of the given element.
|
|
37
37
|
* It will look for the lang attribute on the element and its ancestors.
|
|
38
38
|
* If not lang is found, it will default to 'en'.
|
|
39
39
|
*/
|
|
40
|
-
export declare
|
|
40
|
+
export declare const getElementLocales: (element: HTMLElement) => {
|
|
41
41
|
readonly lang: string;
|
|
42
42
|
readonly t9nLocale: SupportedLocale;
|
|
43
43
|
};
|
|
44
|
-
export declare
|
|
44
|
+
export declare const normalizeLocale: (locale: string) => SupportedLocale;
|
|
45
45
|
export type LocaleObserver<Strings extends GenericT9nStrings = GenericT9nStrings> = {
|
|
46
46
|
/** The T9N strings of the component */
|
|
47
47
|
t9nStrings: Strings;
|
|
@@ -64,7 +64,7 @@ export type LocaleObserver<Strings extends GenericT9nStrings = GenericT9nStrings
|
|
|
64
64
|
* @remarks
|
|
65
65
|
* Rather than using this function directly, prefer the `useT9n()` controller.
|
|
66
66
|
*/
|
|
67
|
-
export declare
|
|
67
|
+
export declare const startLocaleObserver: <Strings extends GenericT9nStrings = GenericT9nStrings>(
|
|
68
68
|
/** The Web component HTML element that is doing the fetching */
|
|
69
69
|
element: HTMLElement,
|
|
70
70
|
/**
|
|
@@ -87,5 +87,5 @@ onUpdated: (payload: LocaleObserver<Strings>) => void,
|
|
|
87
87
|
* Set to null if the component has no localization strings, but you still
|
|
88
88
|
* wish to use `startLocaleObserver` to get the locale information.
|
|
89
89
|
*/
|
|
90
|
-
assetName?: string | null)
|
|
90
|
+
assetName?: string | null) => (() => void);
|
|
91
91
|
export {};
|
package/dist/strings.d.cts
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* @param value The string to quote
|
|
7
7
|
* @returns The quoted string
|
|
8
8
|
*/
|
|
9
|
-
export declare
|
|
9
|
+
export declare const quoteString: (value: string) => string;
|
|
10
10
|
/**
|
|
11
11
|
* Create a filter expression from a filter word.
|
|
12
12
|
* @param filterWord The filter word to create the expression from.
|
|
13
13
|
* @returns The filter expression.
|
|
14
14
|
*/
|
|
15
|
-
export declare
|
|
15
|
+
export declare const createFilterExpression: (filterWord: string) => RegExp;
|
|
16
16
|
/**
|
|
17
17
|
* Replace values in a string using the format {valueName} with the value from the values object.
|
|
18
18
|
* If the value is not found in the values object, then the value is not replaced.
|
|
@@ -20,10 +20,10 @@ export declare function createFilterExpression(filterWord: string): RegExp;
|
|
|
20
20
|
* @param values The values to replace in the string.
|
|
21
21
|
* @returns The string with the values replaced.
|
|
22
22
|
*/
|
|
23
|
-
export declare
|
|
23
|
+
export declare const setValuesInString: (message: string | null | undefined, values?: Record<string, string>) => string;
|
|
24
24
|
/**
|
|
25
25
|
* Add LTR marks to a string to ensure it is displayed as LTR.
|
|
26
26
|
* @param value The string to add LTR marks to.
|
|
27
27
|
* @returns The string with LTR marks.
|
|
28
28
|
*/
|
|
29
|
-
export declare
|
|
29
|
+
export declare const addLTRMark: (value: string | undefined) => string;
|
package/dist/strings.d.ts
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* @param value The string to quote
|
|
7
7
|
* @returns The quoted string
|
|
8
8
|
*/
|
|
9
|
-
export declare
|
|
9
|
+
export declare const quoteString: (value: string) => string;
|
|
10
10
|
/**
|
|
11
11
|
* Create a filter expression from a filter word.
|
|
12
12
|
* @param filterWord The filter word to create the expression from.
|
|
13
13
|
* @returns The filter expression.
|
|
14
14
|
*/
|
|
15
|
-
export declare
|
|
15
|
+
export declare const createFilterExpression: (filterWord: string) => RegExp;
|
|
16
16
|
/**
|
|
17
17
|
* Replace values in a string using the format {valueName} with the value from the values object.
|
|
18
18
|
* If the value is not found in the values object, then the value is not replaced.
|
|
@@ -20,10 +20,10 @@ export declare function createFilterExpression(filterWord: string): RegExp;
|
|
|
20
20
|
* @param values The values to replace in the string.
|
|
21
21
|
* @returns The string with the values replaced.
|
|
22
22
|
*/
|
|
23
|
-
export declare
|
|
23
|
+
export declare const setValuesInString: (message: string | null | undefined, values?: Record<string, string>) => string;
|
|
24
24
|
/**
|
|
25
25
|
* Add LTR marks to a string to ensure it is displayed as LTR.
|
|
26
26
|
* @param value The string to add LTR marks to.
|
|
27
27
|
* @returns The string with LTR marks.
|
|
28
28
|
*/
|
|
29
|
-
export declare
|
|
29
|
+
export declare const addLTRMark: (value: string | undefined) => string;
|
package/dist/timeouts.d.cts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @see https://devtopia.esri.com/WebGIS/arcgis-js-api/discussions/60405
|
|
6
6
|
*/
|
|
7
|
-
export declare
|
|
7
|
+
export declare const devToolsAwareTimeout: (callback: () => void, timeout: number) => ReturnType<typeof setInterval>;
|
package/dist/timeouts.d.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @see https://devtopia.esri.com/WebGIS/arcgis-js-api/discussions/60405
|
|
6
6
|
*/
|
|
7
|
-
export declare
|
|
7
|
+
export declare const devToolsAwareTimeout: (callback: () => void, timeout: number) => ReturnType<typeof setInterval>;
|
package/dist/type-guards.d.cts
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* @param item The item to check.
|
|
4
4
|
* @returns Returns true if the item is not null.
|
|
5
5
|
*/
|
|
6
|
-
export declare
|
|
6
|
+
export declare const isNotNull: <T>(item: T | null) => item is T;
|
|
7
7
|
/**
|
|
8
8
|
* Safe guard to ensure that an item is not undefined.
|
|
9
9
|
* @param item The item to check.
|
|
10
10
|
* @returns Returns true if the item is not undefined.
|
|
11
11
|
*/
|
|
12
|
-
export declare
|
|
12
|
+
export declare const isNotUndefined: <T>(item: T | undefined) => item is T;
|
package/dist/type-guards.d.ts
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* @param item The item to check.
|
|
4
4
|
* @returns Returns true if the item is not null.
|
|
5
5
|
*/
|
|
6
|
-
export declare
|
|
6
|
+
export declare const isNotNull: <T>(item: T | null) => item is T;
|
|
7
7
|
/**
|
|
8
8
|
* Safe guard to ensure that an item is not undefined.
|
|
9
9
|
* @param item The item to check.
|
|
10
10
|
* @returns Returns true if the item is not undefined.
|
|
11
11
|
*/
|
|
12
|
-
export declare
|
|
12
|
+
export declare const isNotUndefined: <T>(item: T | undefined) => item is T;
|
package/dist/ui.d.cts
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* @param waitFor Debounce time in milliseconds
|
|
6
6
|
* @returns Returns a function that can be called to debounce the given function.
|
|
7
7
|
*/
|
|
8
|
-
export declare
|
|
8
|
+
export declare const debounce: <F extends (...args: Parameters<F>) => ReturnType<F>>(func: F, waitFor?: number) => ((...args: Parameters<F>) => void);
|
package/dist/ui.d.ts
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* @param waitFor Debounce time in milliseconds
|
|
6
6
|
* @returns Returns a function that can be called to debounce the given function.
|
|
7
7
|
*/
|
|
8
|
-
export declare
|
|
8
|
+
export declare const debounce: <F extends (...args: Parameters<F>) => ReturnType<F>>(func: F, waitFor?: number) => ((...args: Parameters<F>) => void);
|
package/dist/url.d.cts
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* @param ignoreProtocol Indicates if protocol comparison should be ignored
|
|
6
6
|
* @returns True if the two url strings have the same origin
|
|
7
7
|
*/
|
|
8
|
-
export declare
|
|
8
|
+
export declare const hasSameOrigin: (url1: string | null | undefined, url2: string | null | undefined, ignoreProtocol?: boolean) => boolean;
|
|
9
9
|
/**
|
|
10
10
|
* Tests if a url string is a URL or not.
|
|
11
11
|
* @param url The url string to test
|
|
12
12
|
* @returns True if the string is a URL.
|
|
13
13
|
*/
|
|
14
|
-
export declare
|
|
14
|
+
export declare const isURL: (url: string) => boolean;
|