@arcgis/toolkit 5.2.0-next.9 → 5.2.0-next.91

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 (66) hide show
  1. package/LICENSE.md +4 -2
  2. package/README.md +2 -2
  3. package/dist/{array/index.d.cts → 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.cts → error.d.ts} +15 -4
  12. package/dist/{error/index.js → error.js} +1 -1
  13. package/dist/{function/index.d.cts → function.d.ts} +4 -1
  14. package/dist/intl/dom.d.ts +74 -0
  15. package/dist/intl/{index.js → dom.js} +41 -37
  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.cts → 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} +17 -2
  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.cts → type.d.ts} +11 -1
  26. package/dist/{url/index.d.cts → url.d.ts} +4 -3
  27. package/package.json +16 -61
  28. package/dist/array/index.cjs +0 -13
  29. package/dist/array/index.d.ts +0 -12
  30. package/dist/dom/index.cjs +0 -227
  31. package/dist/dom/index.d.cts +0 -117
  32. package/dist/dom/index.d.ts +0 -117
  33. package/dist/dom/reference-element.d.cts +0 -6
  34. package/dist/dom/reference-element.d.ts +0 -6
  35. package/dist/dom/slots.d.cts +0 -93
  36. package/dist/error/index.cjs +0 -36
  37. package/dist/error/index.d.ts +0 -32
  38. package/dist/function/index.cjs +0 -16
  39. package/dist/function/index.d.ts +0 -19
  40. package/dist/intl/index.cjs +0 -110
  41. package/dist/intl/index.d.cts +0 -124
  42. package/dist/intl/index.d.ts +0 -124
  43. package/dist/log/index.cjs +0 -81
  44. package/dist/log/index.d.cts +0 -128
  45. package/dist/number/index.cjs +0 -10
  46. package/dist/number/index.d.ts +0 -19
  47. package/dist/predicate/index.cjs +0 -8
  48. package/dist/predicate/index.d.cts +0 -24
  49. package/dist/predicate/index.d.ts +0 -24
  50. package/dist/predicate/index.js +0 -8
  51. package/dist/promise/index.cjs +0 -45
  52. package/dist/promise/index.d.cts +0 -60
  53. package/dist/string/index.cjs +0 -117
  54. package/dist/string/index.d.cts +0 -130
  55. package/dist/tests/utils.d.cts +0 -1
  56. package/dist/type/index.cjs +0 -4
  57. package/dist/type/index.d.ts +0 -29
  58. package/dist/url/index.cjs +0 -26
  59. package/dist/url/index.d.ts +0 -18
  60. /package/dist/{array/index.js → array.js} +0 -0
  61. /package/dist/{function/index.js → function.js} +0 -0
  62. /package/dist/{log/index.js → log.js} +0 -0
  63. /package/dist/{number/index.js → number.js} +0 -0
  64. /package/dist/{string/index.js → string.js} +0 -0
  65. /package/dist/{type/index.js → type.js} +0 -0
  66. /package/dist/{url/index.js → url.js} +0 -0
@@ -1,128 +0,0 @@
1
- export type LogLevel = "error" | "info" | "warn";
2
- type CustomElementLike = {
3
- el: {
4
- localName: string;
5
- };
6
- } | {
7
- localName: string;
8
- };
9
- type AccessorLike = {
10
- declaredClass: string;
11
- };
12
- export type LogContext = AccessorLike | CustomElementLike | string;
13
- type LogOptions = {
14
- /** Whether the message should only be logged once. */
15
- once?: boolean;
16
- /** Additional objects to log after `message`. Use this to avoid memory leaks when logging objects to the console. Each object value will be automatically wrapped in a `WeakRef` before logging so it can be garbage-collected. */
17
- detail?: Record<string, unknown>;
18
- };
19
- type EsriConfig = {
20
- log: {
21
- /**
22
- * @link {https://developers.arcgis.com/javascript/latest/references/core/config/#LogInterceptor}
23
- */
24
- interceptors?: ((level: LogLevel | "none", module: string, ...args: any[]) => void)[];
25
- };
26
- };
27
- /**
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
- * @see {@link https://devtopia.esri.com/WebGIS/arcgis-js-api/discussions/74935}
30
- * @param config {@link https://developers.arcgis.com/javascript/latest/references/core/config/}
31
- * @example
32
- * ```ts
33
- * // IMPORTANT: do this only in config.ts or another early-loaded module
34
- * import esriConfig from "@arcgis/core/config.js";
35
- * import { setEsriConfig } from "@arcgis/toolkit/log";
36
- *
37
- * setEsriConfig(esriConfig);
38
- *
39
- * // either here or in another file, you can add your interceptors
40
- * // and they will be respected when log is called later on
41
- * esriConfig.log.interceptors?.push(yourInterceptor);
42
- * ```
43
- */
44
- export declare const setEsriConfig: (config: EsriConfig) => void;
45
- /**
46
- * Helper utility for logging messages in a consistent manner.
47
- *
48
- * @param level The log level
49
- * @param context The context of the log message (e.g., `this` inside a Lit-like component, or just a custom string)
50
- * @param message A custom message to log
51
- * @param options Additional options for logging, such as to provide a context object
52
- *
53
- * @see [setEsriConfig](#setEsriConfig)
54
- *
55
- * @example
56
- * ```ts
57
- * // Basic usage
58
- * log("error", this, "message to log");
59
- * ```
60
- *
61
- * @example
62
- * ```ts
63
- * // Optional usage
64
- * log("warn", this, "message to log", {
65
- * once: true,
66
- * detail: { object1, object2 }
67
- * });
68
- */
69
- export declare const log: (level: LogLevel, context: LogContext, message: string, options?: LogOptions) => void;
70
- /**
71
- * Rethrows an error and prepends context information to the error message. The error is
72
- * thrown asynchronously to avoid interrupting the current execution stack, so it cannot be caught
73
- * with `try/catch` and will bubble to the global object.
74
- * @param context From where the error is being thrown (e.g., `this` inside a Lit-like component, or just a custom string)
75
- * @returns A function that can be used in `try-catch`/`.catch` to rethrow an error
76
- *
77
- * @example
78
- * ```ts
79
- * try {
80
- * functionThatMightThrow();
81
- * } catch (error) {
82
- * rethrowError(this)(error);
83
- * }
84
- * ```
85
- *
86
- * @example
87
- * ```ts
88
- * promise.then().catch(rethrowError("context string"));
89
- * ```
90
- */
91
- export declare const rethrowError: (context: LogContext) => ((error: unknown) => void);
92
- type LogContextOrObject = Exclude<LogContext, string> | object;
93
- type InferPropertyType<T extends LogContextOrObject> = [object] extends [T] ? string : keyof T;
94
- /**
95
- * Returns a string that can be used in log messages for missing required properties.
96
- * @param property The name of the required property
97
- * @example
98
- * ```ts
99
- * // returns "The property `x` is required but missing."
100
- * composeMissingPropertyMessage<YourClass>("x");
101
- * // you don't need to provide a generic type argument if you don't have one
102
- * composeMissingPropertyMessage("object.sub.property");
103
- * ```
104
- */
105
- export declare const composeMissingPropertyMessage: <T extends LogContextOrObject = object>(property: InferPropertyType<T>) => string;
106
- /**
107
- * Returns a string that can be used in log messages for empty required arrays.
108
- * @param property The name of the required property
109
- * @example
110
- * ```ts
111
- * // returns "The property `x` is empty but must have at least one element."
112
- * composeEmptyPropertyMessage<YourClass>("x");
113
- * // you don't need to provide a generic type argument if you don't have one
114
- * composeEmptyPropertyMessage("object.sub.property");
115
- * ```
116
- */
117
- export declare const composeEmptyPropertyMessage: <T extends LogContextOrObject = object>(property: InferPropertyType<T>) => string;
118
- /**
119
- * Logs a warning message for deprecated object properties.
120
- * @example
121
- * ```ts
122
- * logDeprecatedProperty(this, "oldName", "newName", {
123
- * once: true,
124
- * });
125
- * ```
126
- */
127
- export declare const logDeprecatedProperty: <T extends LogContext>(context: T, oldName: keyof T, newName: keyof T, options?: LogOptions) => ReturnType<typeof log>;
128
- export {};
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- function clamp(value, min, max) {
4
- return Math.max(min, Math.min(max, value));
5
- }
6
- function lerp(min, max, t) {
7
- return min + (max - min) * t;
8
- }
9
- exports.clamp = clamp;
10
- exports.lerp = lerp;
@@ -1,19 +0,0 @@
1
- /**
2
- * Clamps a value between a minimum and maximum value.
3
- *
4
- * @param value The number to clamp.
5
- * @param min The minimum value.
6
- * @param max The maximum value.
7
- *
8
- * @returns The clamped value.
9
- */
10
- export declare function clamp(value: number, min: number, max: number): number;
11
- /**
12
- * Linearly interpolates between two numbers.
13
- *
14
- * @param min - The start value.
15
- * @param max - The end value.
16
- * @param t - The interpolation factor, typically between 0 and 1.
17
- * @returns The interpolated value between `min` and `max` based on `t`.
18
- */
19
- export declare function lerp(min: number, max: number, t: number): number;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const isNotUndefined = (item) => item !== void 0;
4
- const isNotNull = (item) => item !== null;
5
- const isNotNil = (x) => x != null;
6
- exports.isNotNil = isNotNil;
7
- exports.isNotNull = isNotNull;
8
- exports.isNotUndefined = isNotUndefined;
@@ -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,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
- };
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- class Deferred {
4
- /**
5
- * Creates a new deferred promise.
6
- */
7
- constructor() {
8
- this.promise = new Promise((resolve, reject) => {
9
- this.resolve = resolve;
10
- this.reject = reject;
11
- });
12
- }
13
- }
14
- async function forEachWithConcurrency(items, concurrency, callback) {
15
- if (items.length === 0) {
16
- return;
17
- }
18
- let index = 0;
19
- async function consumeItems() {
20
- while (index < items.length) {
21
- const item = items[index];
22
- index += 1;
23
- await callback(item);
24
- }
25
- }
26
- await Promise.all(Array.from({ length: Math.min(concurrency, items.length) }, async () => await consumeItems()));
27
- }
28
- const devToolsAwareTimeout = (callback, timeout) => {
29
- const interval = timeout > longTimeoutThreshold ? longTimeoutInterval : timeout / shortTimeoutIntervals;
30
- let elapsed = 0;
31
- const reference = setInterval(() => {
32
- elapsed += interval;
33
- if (elapsed >= timeout) {
34
- clearInterval(reference);
35
- callback();
36
- }
37
- }, interval);
38
- return reference;
39
- };
40
- const longTimeoutThreshold = 4e3;
41
- const longTimeoutInterval = 2e3;
42
- const shortTimeoutIntervals = 4;
43
- exports.Deferred = Deferred;
44
- exports.devToolsAwareTimeout = devToolsAwareTimeout;
45
- exports.forEachWithConcurrency = forEachWithConcurrency;
@@ -1,60 +0,0 @@
1
- /**
2
- * A deferred promise.
3
- * Useful for when you want to return a promise but don't have the value yet.
4
- *
5
- * @example
6
- * ```ts
7
- * const deferred = new Deferred<string>();
8
- * setTimeout(() => deferred.resolve("Hello World"), 1000);
9
- * return deferred.promise;
10
- * ```
11
- *
12
- * @deprecated
13
- * If browser support permits, prefer using
14
- * [Promise.withResolvers()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers)
15
- */
16
- export declare class Deferred<T> {
17
- /**
18
- * The promise that can be awaited.
19
- */
20
- promise: Promise<T>;
21
- /**
22
- * Creates a new deferred promise.
23
- */
24
- constructor();
25
- }
26
- export interface Deferred<T> {
27
- /**
28
- * Resolves the promise.
29
- * @param value The value to resolve the promise with.
30
- *
31
- * @privateRemarks
32
- * Defined as a method to disable covariance checks. Overridden in constructor.
33
- */
34
- resolve(_value: PromiseLike<T> | T): void;
35
- /**
36
- * Rejects the promise.
37
- */
38
- reject(_error: unknown): void;
39
- }
40
- /**
41
- * Execute async callbacks against a list with a fixed number of in-flight
42
- * operations.
43
- * Useful for rate-limiting or to avoid overwhelming resources with too many concurrent operations.
44
- *
45
- * @example
46
- * ```ts
47
- * const items = [...lotsOfItems];
48
- * await forEachWithConcurrency(items, 5, async (item) => {
49
- * await doSomethingAsync(item);
50
- * });
51
- * ```
52
- */
53
- export declare function forEachWithConcurrency<T>(items: readonly T[], concurrency: number, callback: (item: T) => Promise<void>): Promise<void>;
54
- /**
55
- * Like setTimeout(), but does not advance the clock if the program is
56
- * stopped on a debugger breakpoint.
57
- *
58
- * @see https://devtopia.esri.com/WebGIS/arcgis-js-api/discussions/60405
59
- */
60
- export declare const devToolsAwareTimeout: (callback: () => void, timeout: number) => ReturnType<typeof setInterval>;
@@ -1,117 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const kebabToPascal = (string) => (
4
- //#endregion kebabToPascal
5
- string.split("-").map(capitalize).join("")
6
- );
7
- const camelToKebab = (string) => (
8
- //#endregion camelToKebab
9
- string.replace(upperBeforeLower, (upper, remainder) => `${remainder === 0 ? "" : "-"}${upper.toLowerCase()}`)
10
- );
11
- const upperBeforeLower = /[A-Z]+(?![a-z])|[A-Z]/gu;
12
- const camelToHuman = (string) => (
13
- //#endregion camelToHuman
14
- capitalize(string.replace(upperBeforeLower, (upper, remainder) => `${remainder === 0 ? "" : " "}${upper}`))
15
- );
16
- const capitalize = (string) => (
17
- //#endregion capitalize
18
- string.charAt(0).toUpperCase() + string.slice(1)
19
- );
20
- const uncapitalize = (string) => (
21
- //#endregion uncapitalize
22
- string.charAt(0).toLowerCase() + string.slice(1)
23
- );
24
- const doubleQuote = '"';
25
- const singleQuote = "'";
26
- const repeatString = (value, n) => new Array(n + 1).join(value);
27
- const quoteString = (value) => {
28
- let quote = doubleQuote;
29
- let alternateQuote = singleQuote;
30
- const avoidEscape = value.includes(quote) && !value.includes(alternateQuote);
31
- if (avoidEscape) {
32
- alternateQuote = doubleQuote;
33
- quote = singleQuote;
34
- }
35
- const alternateEscape = new RegExp(`(^|[^\\\\])((?:\\\\{2})*)((?:\\\\${alternateQuote})+)`, "gu");
36
- value = value.replace(
37
- alternateEscape,
38
- (_, boundaryChar, leadingEscapedSlashes, escapedQuoteChars) => (
39
- // We divide the escapedQuoteChars by 2 since there are 2 characters in each escaped part ('\\"'.length === 2)
40
- boundaryChar + leadingEscapedSlashes + repeatString(alternateQuote, escapedQuoteChars.length / 2)
41
- )
42
- );
43
- const quoteEscape = new RegExp(`(^|[^\\\\])((?:\\\\{2})*)(${quote}+)`, "gu");
44
- value = value.replace(
45
- quoteEscape,
46
- (_, boundaryChar, leadingEscapedSlashes, quoteChars) => boundaryChar + leadingEscapedSlashes + repeatString(`\\${quote}`, quoteChars.length)
47
- );
48
- return quote + value + quote;
49
- };
50
- const createFilterExpression = (filterWord) => {
51
- const sanitizedWord = filterWord ? filterWord.replaceAll(/[-[\]/{}()*+?.\\^$|]/gu, "\\$&") : "^.*$";
52
- return new RegExp(sanitizedWord, "i");
53
- };
54
- const addLtrMark = (value) => (
55
- // Make sure the string value is LTR. This prevent issues with RTL language used in LTR containers.
56
- `‎${value ?? ""}‎`
57
- );
58
- const hasRandomUUID = "randomUUID" in crypto;
59
- const generateGuid = () => {
60
- if (hasRandomUUID) {
61
- return crypto.randomUUID();
62
- }
63
- const values = crypto.getRandomValues(new Uint16Array(8));
64
- values[3] = values[3] & 4095 | 16384;
65
- values[4] = values[4] & 16383 | 32768;
66
- const p = (i) => values[i].toString(16).padStart(4, "0");
67
- return `${p(0) + p(1)}-${p(2)}-${p(3)}-${p(4)}-${p(5)}${p(6)}${p(7)}`;
68
- };
69
- const getMinorVersion = (version) => {
70
- const [major, minor] = version.split(".");
71
- return `${major}.${minor}`;
72
- };
73
- const getPreamble = (version) => (
74
- //#endregion getPreamble
75
- `COPYRIGHT Esri - https://js.arcgis.com/${getMinorVersion(version)}/LICENSE.txt`
76
- );
77
- const setValuesInString = (message, values = {}) => (message ?? "").replace(/\{(?<valueName>.*?)\}/gu, (match, valueName) => values[valueName] ?? match);
78
- const regionStartPattern = /^\s*\/\/\s*#region(?::)?\s*(?<regionName>.*?)\s*$/u;
79
- const regionAnyStartPattern = /^\s*\/\/\s*#region(?::)?\s*.*$/u;
80
- const regionEndPattern = /^\s*\/\/\s*#endregion(?::)?(?:\s+.*)?\s*$/u;
81
- const extractRegion = (source, regionName) => {
82
- const lines = source.split(/\r?\n/gu);
83
- const startLineIndex = lines.findIndex((line) => regionStartPattern.exec(line)?.groups?.regionName === regionName);
84
- if (startLineIndex === -1) {
85
- throw new Error(`Unable to locate source region "${regionName}".`);
86
- }
87
- let nestedRegionDepth = 0;
88
- for (let lineIndex = startLineIndex + 1; lineIndex < lines.length; lineIndex++) {
89
- const line = lines[lineIndex];
90
- if (regionAnyStartPattern.test(line)) {
91
- nestedRegionDepth++;
92
- continue;
93
- }
94
- if (!regionEndPattern.test(line)) {
95
- continue;
96
- }
97
- if (nestedRegionDepth > 0) {
98
- nestedRegionDepth--;
99
- continue;
100
- }
101
- return lines.slice(startLineIndex + 1, lineIndex).join("\n").trim();
102
- }
103
- throw new Error(`Unable to locate source region end for "${regionName}".`);
104
- };
105
- exports.addLtrMark = addLtrMark;
106
- exports.camelToHuman = camelToHuman;
107
- exports.camelToKebab = camelToKebab;
108
- exports.capitalize = capitalize;
109
- exports.createFilterExpression = createFilterExpression;
110
- exports.extractRegion = extractRegion;
111
- exports.generateGuid = generateGuid;
112
- exports.getMinorVersion = getMinorVersion;
113
- exports.getPreamble = getPreamble;
114
- exports.kebabToPascal = kebabToPascal;
115
- exports.quoteString = quoteString;
116
- exports.setValuesInString = setValuesInString;
117
- exports.uncapitalize = uncapitalize;
@@ -1,130 +0,0 @@
1
- /**
2
- * Convert kebab-case string to PascalCase
3
- *
4
- * @example
5
- * ```ts
6
- * const pascal = kebabToPascal("my-component-name");
7
- * // MyComponentName
8
- */
9
- export declare const kebabToPascal: (string: string) => string;
10
- /**
11
- * Convert camelCase string to kebab-case
12
- *
13
- * @example
14
- * ```ts
15
- * const kebab = camelToKebab("myComponentName");
16
- * // my-component-name
17
- * ```
18
- */
19
- export declare const camelToKebab: (string: string) => string;
20
- /**
21
- * Convert camelCase string to Sentence case.
22
- *
23
- * @example
24
- * ```ts
25
- * const human = camelToHuman("myComponentName");
26
- * // My component name
27
- * ```
28
- */
29
- export declare const camelToHuman: (string: string) => string;
30
- /** Capitalize the first letter of a string. */
31
- export declare const capitalize: <T extends string>(string: T) => Capitalize<T>;
32
- /** Uncapitalize the first letter of a string. */
33
- export declare const uncapitalize: <T extends string>(string: T) => Uncapitalize<T>;
34
- /**
35
- * Add quotes to a string for display purposes.
36
- * If the string contains a double quote, then single quotes will be used.
37
- * If the string contains a single quote, then double quotes will be used.
38
- * If the string contains both, then double quotes will be used and the single quotes will be escaped.
39
- */
40
- export declare const quoteString: (value: string) => string;
41
- /**
42
- * Create a filter expression from a filter word.
43
- *
44
- * @remarks Once browser support permits, use `RegExp.escape()` instead.
45
- * @privateRemarks TODO: DEPRECATE
46
- */
47
- export declare const createFilterExpression: (filterWord: string) => RegExp;
48
- /**
49
- * Add LTR marks to a string to ensure it is displayed as LTR even in RTL contexts.
50
- * @param value The string to add LTR marks to.
51
- * @returns The string with LTR marks.
52
- *
53
- * @example
54
- * ```ts
55
- * // Without addLtrMark, this will render as arcadeVariable$ in RTL languages.
56
- * return <div>{addLtrMark("$arcadeVariable")}</div>;
57
- */
58
- export declare const addLtrMark: (value: string | undefined) => string;
59
- /**
60
- * A string containing a randomly generated, 36 character long v4 UUID.
61
- */
62
- export type UUID = ReturnType<typeof crypto.randomUUID>;
63
- /**
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
- *
72
- * @example
73
- * ```ts
74
- * const id = generateGuid();
75
- * // 00000000-0000-0000-0000-000000000000.
76
- * ```
77
- */
78
- export declare const generateGuid: () => UUID;
79
- /**
80
- * Extract the major and minor version from a full version string.
81
- *
82
- * @example
83
- * ```ts
84
- * const minorVersion = getMinorVersion("4.34.0-next.123");
85
- * // "4.34"
86
- * ```
87
- */
88
- export declare const getMinorVersion: (version: string) => string;
89
- /**
90
- * Create a preamble text from a version number. Preamble text is used as legal
91
- * notice at the top of a file.
92
- * The preamble text contains the version number and a link to the license.
93
- * The version number should normally come from package.json.
94
- *
95
- * @see https://webgis.esri.com/sdk/contributing/licensing
96
- * @example
97
- * ```ts
98
- * const preamble = getPreamble("5.0.1-next.456");
99
- * // COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt
100
- * ```
101
- */
102
- export declare const getPreamble: (version: string) => string;
103
- /**
104
- * Replace values in a string using the format {valueName} with the value from the values object.
105
- * If the value is not found in the values object, then the value is not replaced.
106
- *
107
- * @deprecated Import from https://next.gha.afd.arcgis.com/javascript/latest/references/core/intl/#substitute instead
108
- */
109
- export declare const setValuesInString: (message: string | null | undefined, values?: Record<string, string>) => string;
110
- /**
111
- * Use `extractRegion` when you need to read a named `#region` block from a JavaScript/TypeScript source string,
112
- * such as docs or MDX snippets that should stay in sync with the real implementation.
113
- *
114
- * Throws when the named region cannot be found or is missing its closing marker.
115
- *
116
- * @example
117
- * ```ts
118
- * import code from "my-code-file.ts?raw";
119
- * const snippet = extractRegion(code, "myRegion");
120
- *
121
- * // where code is:
122
- * `
123
- * //#region myRegion
124
- * const value = 1;
125
- * //#endregion
126
- * `
127
- * // const value = 1;
128
- * ```
129
- */
130
- export declare const extractRegion: (source: string, regionName: string) => string;
@@ -1 +0,0 @@
1
- export declare function captureConsoleErrors(): unknown[][];
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const typeTest = 0;
4
- exports.typeTest = typeTest;
@@ -1,29 +0,0 @@
1
- /**
2
- * A convenient alias for `null | undefined`.
3
- * @remarks Named `nil` over `Nil` as per https://devtopia.esri.com/WebGIS/arcgis-js-api/pull/66920
4
- */
5
- export type nil = null | undefined;
6
- /**
7
- * @deprecated import type { ResourceHandle } from "@arcgis/core/core/Handles.js";
8
- */
9
- export type IHandle = {
10
- remove: () => void;
11
- };
12
- /**
13
- * @deprecated Import type { nil } from `@arcgis/toolkit/type` instead
14
- */
15
- export type Nil = nil;
16
- /**
17
- * A helper for doing TypeScript type tests.
18
- * This complements the TypeScript's `satisfies` operator.
19
- *
20
- * See usage examples:
21
- * https://webgis.esri.com/sdk/resources/typescript-tips#use-satisfies-operator-for-type-tests
22
- *
23
- * During production end-application build, such type tests will be removed as
24
- * they have no runtime impact.
25
- *
26
- * @privateRemarks
27
- * Using `0` over `undefined` to take fewer bytes if minifier is disabled.
28
- */
29
- export declare const typeTest: unknown;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const hasSameOrigin = (url1, url2, ignoreProtocol = false) => {
4
- if (!url1 || !url2) {
5
- return false;
6
- }
7
- const url1Obj = new URL(url1);
8
- const url2Obj = new URL(url2);
9
- if (!ignoreProtocol && url1Obj.protocol !== url2Obj.protocol) {
10
- return false;
11
- }
12
- if (url1Obj.host == null || url2Obj.host == null) {
13
- return false;
14
- }
15
- return url1Obj.host.toLowerCase() === url2Obj.host.toLowerCase() && url1Obj.port === url2Obj.port;
16
- };
17
- const isURL = (url) => {
18
- try {
19
- new URL(url);
20
- return true;
21
- } catch (e) {
22
- return false;
23
- }
24
- };
25
- exports.hasSameOrigin = hasSameOrigin;
26
- exports.isURL = isURL;
@@ -1,18 +0,0 @@
1
- /**
2
- * Compares two url strings for their origin and returns true if they have the same origin.
3
- *
4
- * @param url1 First url string
5
- * @param url2 Second url string
6
- * @param ignoreProtocol Indicates if protocol comparison should be ignored
7
- * @returns True if the two url strings have the same origin
8
- */
9
- export declare const hasSameOrigin: (url1: string | null | undefined, url2: string | null | undefined, ignoreProtocol?: boolean) => boolean;
10
- /**
11
- * Tests if a url string is a URL or not.
12
- * @param url The url string to test
13
- * @returns True if the string is a URL.
14
- *
15
- * @remarks If browser support permits, use https://developer.mozilla.org/en-US/docs/Web/API/URL/parse_static instead
16
- * @privateRemarks TODO: DEPRECATE
17
- */
18
- export declare const isURL: (url: string) => boolean;
File without changes
File without changes
File without changes
File without changes
File without changes