@conterra/ct-mapapps-typings 4.18.4-next.20241007040658 → 4.18.4-next.20241009040310
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/agssearch/api.d.ts +5 -4
- package/apprt/event/EventConstants.d.ts +1 -1
- package/apprt-core/AsyncTask.d.ts +4 -5
- package/apprt-core/BlockingTaskExecutor.d.ts +4 -6
- package/apprt-core/CancelablePromise.d.ts +6 -5
- package/apprt-core/Events.d.ts +23 -21
- package/apprt-core/Exception.d.ts +9 -9
- package/apprt-core/Logger.d.ts +7 -7
- package/apprt-core/Mutable.d.ts +35 -39
- package/apprt-core/Observable.d.ts +8 -6
- package/apprt-core/Observers.d.ts +40 -34
- package/apprt-core/Promise.d.ts +3 -3
- package/apprt-core/TaskExecutor.d.ts +3 -3
- package/apprt-core/assignWithPrototype.d.ts +23 -20
- package/apprt-core/async.d.ts +6 -6
- package/apprt-core/base64.d.ts +2 -2
- package/apprt-core/bindAsync.d.ts +9 -12
- package/apprt-core/clone.d.ts +13 -15
- package/apprt-core/comparators.d.ts +7 -7
- package/apprt-core/config.d.ts +5 -1
- package/apprt-core/delegate.d.ts +9 -9
- package/apprt-core/deprecate.d.ts +1 -1
- package/apprt-core/equals.d.ts +2 -2
- package/apprt-core/freeze.d.ts +1 -1
- package/apprt-core/global.d.ts +1 -1
- package/apprt-core/join.d.ts +14 -11
- package/apprt-core/load-css.d.ts +4 -4
- package/apprt-core/load-js.d.ts +5 -5
- package/apprt-core/promise-utils.d.ts +23 -23
- package/apprt-core/propertyToSymbol.d.ts +1 -1
- package/apprt-core/string-escape.d.ts +1 -1
- package/apprt-core/string-pattern.d.ts +1 -1
- package/apprt-core/string-replace.d.ts +10 -10
- package/apprt-core/url-utils.d.ts +2 -2
- package/apprt-core/when.d.ts +3 -3
- package/apprt-dom/index.d.ts +7 -7
- package/apprt-fetch/index.d.ts +17 -17
- package/apprt-streams/Stream.d.ts +34 -34
- package/coordinatetransformer/api/CoordinateTransformer.d.ts +15 -10
- package/coordinatetransformer/api/ProjectionStore.d.ts +7 -6
- package/coordinatetransformer/api/TransformationProvider.d.ts +11 -4
- package/coordinatetransformer/api/TransformerStrategy.d.ts +8 -5
- package/ct/util/css.d.ts +9 -8
- package/domains-system/api.d.ts +26 -30
- package/highlights/api.d.ts +6 -11
- package/integration-map/api.d.ts +38 -35
- package/map-actions/api.d.ts +9 -5
- package/map-config-api/api.d.ts +31 -3
- package/map-init/api.d.ts +5 -5
- package/map-widget/Constraints.d.ts +1 -1
- package/map-widget/LayerObserver.d.ts +6 -2
- package/map-widget/LayerTraverser.d.ts +4 -1
- package/map-widget/MapWidgetFactory.d.ts +1 -1
- package/map-widget/MapWidgetModel.d.ts +1 -1
- package/map-widget/ViewReadyWatcher.d.ts +1 -1
- package/map-widget/__internal__/{I0BOBZBz.d.ts → DFiGfJS1.d.ts} +3 -3
- package/map-widget/api/Constraints.d.ts +1 -1
- package/map-widget/api/MapWidget.d.ts +1 -1
- package/map-widget/api/MapWidgetFactory.d.ts +1 -1
- package/map-widget/api/MapWidgetModel.d.ts +1 -1
- package/map-widget/api/MapWidgetRegistration.d.ts +23 -12
- package/map-widget/api/SrsChangeService.d.ts +1 -1
- package/map-widget/api/index.d.ts +1 -1
- package/package.json +1 -1
- package/popups/ContentUpdateProxy.d.ts +61 -33
- package/popups/api.d.ts +35 -38
- package/portal-security/api.d.ts +48 -0
- package/portal-security/package.json +5 -0
- package/result-api/__internal__/{Cf0JLId0.d.ts → LZ4ypyEL.d.ts} +12 -12
- package/result-api/api/actions.d.ts +1 -1
- package/result-api/api/formatting.d.ts +1 -1
- package/result-api/api/index.d.ts +1 -1
- package/result-api/api/model.d.ts +1 -1
- package/result-api/api/service.d.ts +3 -3
- package/result-api/api/ui.d.ts +2 -2
- package/search-api/api.d.ts +8 -1
- package/search-ui/api.d.ts +2 -2
- package/selection-resultcenter/CachingStore.d.ts +3 -3
- package/store-api/ComplexQuery.d.ts +1 -1
- package/store-api/QueryExecution.d.ts +12 -11
- package/store-api/QueryExecutions.d.ts +3 -2
- package/store-api/SpatialQuery.d.ts +9 -9
- package/store-api/utils.d.ts +9 -9
- package/toc/api/Action.d.ts +3 -0
- package/toc/api/Item.d.ts +4 -1
- package/toc/api/StateChecker.d.ts +3 -0
- package/toc/api/index.d.ts +3 -0
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @param sources Objects from where the properties are read.
|
|
11
11
|
* @returns the target
|
|
12
12
|
* @example
|
|
13
|
-
* ```
|
|
13
|
+
* ```typescript
|
|
14
14
|
* import assignWithPrototype from "apprt-core/assignWithPrototype";
|
|
15
15
|
* let a = {x: 1, z: 1 };
|
|
16
16
|
* let b = {x: 2, y: 1 };
|
|
@@ -30,20 +30,23 @@ declare function assignWithPrototype<T extends {}>(target: T, ...sources: Record
|
|
|
30
30
|
* @param sources Objects from where the properties are read.
|
|
31
31
|
* @returns the target
|
|
32
32
|
* @example
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* const
|
|
36
|
-
* const b = { x: 2, _calc() { } };
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const a: any = { x: 1, z: 1 };
|
|
35
|
+
* const b = { x: 2, _calc() {} };
|
|
37
36
|
* const c = { y: 2, _hidden: "test" };
|
|
38
|
-
* const
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
37
|
+
* const a1 = assignWithPrototypeCustomized(
|
|
38
|
+
* a,
|
|
39
|
+
* (target, name, value) => {
|
|
40
|
+
* if (name.startsWith("_")) {
|
|
41
|
+
* return;
|
|
42
|
+
* }
|
|
43
|
+
* target[name] = value;
|
|
44
|
+
* },
|
|
45
|
+
* b,
|
|
46
|
+
* c
|
|
47
|
+
* );
|
|
48
|
+
* a1 === a; // -> true
|
|
49
|
+
* // a1 is {x:2, y: 2, z: 1}
|
|
47
50
|
* ```
|
|
48
51
|
*/
|
|
49
52
|
declare function assignWithPrototypeCustomized<T extends {}>(target: T, assigner: (target: T, name: string, value: any) => void, ...sources: Record<string, any>[]): Record<string, any>;
|
|
@@ -55,13 +58,13 @@ declare function assignWithPrototypeCustomized<T extends {}>(target: T, assigner
|
|
|
55
58
|
* @param sources Objects from where the properties are read.
|
|
56
59
|
* @returns the target
|
|
57
60
|
* @example
|
|
58
|
-
* ```
|
|
61
|
+
* ```ts
|
|
59
62
|
* import assignRecursiveWithPrototype from "apprt-core/assignRecursiveWithPrototype";
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* a1 === a // -> true
|
|
64
|
-
* a1 is {x:2, z: { a: 1, b: 1 }}
|
|
63
|
+
* const a: any = { x: 1, z: { a: 1 } };
|
|
64
|
+
* const b = { x: 2, z: { b: 1 } };
|
|
65
|
+
* const a1 = assignRecursiveWithPrototype(a, b);
|
|
66
|
+
* a1 === a; // -> true
|
|
67
|
+
* // a1 is {x:2, z: { a: 1, b: 1 }}
|
|
65
68
|
* ```
|
|
66
69
|
*/
|
|
67
70
|
declare function assignRecursiveWithPrototype<T extends {}>(target: T, ...sources: Record<string, any>[]): Record<string, any>;
|
package/apprt-core/async.d.ts
CHANGED
|
@@ -8,14 +8,14 @@ import './Promise.js';
|
|
|
8
8
|
* @param args the arguments pushed to the callback during execution.
|
|
9
9
|
* @returns the execution promise
|
|
10
10
|
* @example
|
|
11
|
-
* ```
|
|
11
|
+
* ```ts
|
|
12
12
|
* import async from "apprt-core/async";
|
|
13
13
|
* // a sum function
|
|
14
|
-
*
|
|
15
|
-
* // execute 3+4, 200msec later
|
|
16
|
-
* async(sum,200,3,4)
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* const sum = (x: number, y: number) => x + y;
|
|
15
|
+
* // execute 3 + 4, 200msec later
|
|
16
|
+
* const result = await async(sum, 200, 3, 4);
|
|
17
|
+
* // result === 7
|
|
18
|
+
* assert.equal(result, 7);
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
21
|
declare function async<Args extends any[], Result>(callback: (...args: Args) => Result | PromiseLike<Result>, delay: number, ...args: Args): CancelablePromise<Result>;
|
package/apprt-core/base64.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @module
|
|
9
9
|
*
|
|
10
10
|
* @example Encode string to Base64
|
|
11
|
-
* ```
|
|
11
|
+
* ```ts
|
|
12
12
|
* import { encodeBase64 } from "apprt-core/base64";
|
|
13
13
|
*
|
|
14
14
|
* const base64str = encodeBase64("hello world");
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* ```
|
|
17
17
|
*
|
|
18
18
|
* @example Decode Base64 string
|
|
19
|
-
* ```
|
|
19
|
+
* ```ts
|
|
20
20
|
* import { decodeBase64 } from "apprt-core/base64";
|
|
21
21
|
*
|
|
22
22
|
* const str = decodeBase64("aGVsbG8gd29ybGQ=");
|
|
@@ -14,23 +14,20 @@ type MethodNames<Scope> = string & keyof Methods<Scope>;
|
|
|
14
14
|
* @returns the function which runs the cb async
|
|
15
15
|
* @deprecated use apprt-core/async with plain functions instead
|
|
16
16
|
* @example
|
|
17
|
-
* ```
|
|
17
|
+
* ```ts
|
|
18
18
|
* import bindAsync from "apprt-core/bindAsync";
|
|
19
19
|
* class Counter {
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* inc(){
|
|
24
|
-
* return ++this.count;
|
|
20
|
+
* count = 0;
|
|
21
|
+
* inc() {
|
|
22
|
+
* return ++this.count;
|
|
25
23
|
* }
|
|
26
24
|
* }
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* let asyncInc = bindAsync(counter,"inc");
|
|
25
|
+
* const counter = new Counter();
|
|
26
|
+
* const asyncInc = bindAsync(counter, "inc");
|
|
30
27
|
* // execute counter.inc() async
|
|
31
|
-
* asyncInc()
|
|
32
|
-
*
|
|
33
|
-
*
|
|
28
|
+
* const result = await asyncInc();
|
|
29
|
+
* // result === 1
|
|
30
|
+
* console.log(result));
|
|
34
31
|
* ```
|
|
35
32
|
*/
|
|
36
33
|
declare function bindAsync<Scope, MethodName extends MethodNames<Scope>, Partials extends any[]>(scope: Scope, name: MethodName, delay?: number, ...partials: Partials): (...args: any[]) => Promise<unknown>;
|
package/apprt-core/clone.d.ts
CHANGED
|
@@ -8,11 +8,11 @@ import { Primitive } from './Types.js';
|
|
|
8
8
|
* > Note: Cycles in `obj` are not supported for now.
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
|
-
* ```
|
|
11
|
+
* ```ts
|
|
12
12
|
* import clone from "apprt-core/clone";
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* const src = {x: 1, y: { a: 2 } };
|
|
15
|
+
* const copy = clone(src);
|
|
16
16
|
* src === copy // -> false
|
|
17
17
|
* src.y === copy.y // -> false
|
|
18
18
|
* copy.y.a // -> 2
|
|
@@ -71,27 +71,25 @@ type TransformFunc = (value: any, ctx: TransformContext) => any | symbol;
|
|
|
71
71
|
*
|
|
72
72
|
* @example simple clone
|
|
73
73
|
*
|
|
74
|
-
* ```
|
|
74
|
+
* ```ts
|
|
75
75
|
* import {transform} from "apprt-core/clone";
|
|
76
76
|
* const input = { x: 1, c: {a: 1} };
|
|
77
77
|
* const copyOfInput = transform(input);
|
|
78
78
|
* ```
|
|
79
79
|
*
|
|
80
80
|
* @example transformation
|
|
81
|
-
* ```
|
|
81
|
+
* ```ts
|
|
82
82
|
* import {transform} from "apprt-core/clone";
|
|
83
|
-
* const input = { x: 1, c: {a: 1} };
|
|
84
|
-
* const transformedCopy = transform(input, (value, ctx)=> {
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
83
|
+
* const input = { x: 1, c: { a: 1 } };
|
|
84
|
+
* const transformedCopy = transform(input, (value, ctx) => {
|
|
85
|
+
* if (ctx.path[ctx.path.length - 1] === "c") {
|
|
86
|
+
* // value is { a: 1 }
|
|
87
|
+
* // change c to be a number
|
|
88
|
+
* return value.a;
|
|
89
|
+
* }
|
|
90
|
+
* return value;
|
|
91
91
|
* });
|
|
92
|
-
*
|
|
93
92
|
* // -> transformedCopy === { x: 1, c: 1 }
|
|
94
|
-
*
|
|
95
93
|
* ```
|
|
96
94
|
*/
|
|
97
95
|
declare function transform<Input = any, Output = Input>(value: Input, valueTransformer?: TransformFunc): Output;
|
|
@@ -46,9 +46,9 @@ declare function createStringComparator(locale?: string, ignoreCase?: boolean, n
|
|
|
46
46
|
* Factory to create a string comparator which compares strings respecting numeric parts of the given strings.
|
|
47
47
|
* The comparator splits the input into string and numeric parts to compare them separately.
|
|
48
48
|
* @example
|
|
49
|
-
* ```
|
|
49
|
+
* ```ts
|
|
50
50
|
* const comparator = createStringWithNumberPartsComparator();
|
|
51
|
-
* const values = ["a1", "a10", "a2", "b1, "a20", "a3"];
|
|
51
|
+
* const values = ["a1", "a10", "a2", "b1", "a20", "a3"];
|
|
52
52
|
* values.sort(comparator);
|
|
53
53
|
* assert.deepStrictEqual(["a1", "a2", "a3", "a10", "a20", "b1"], values);
|
|
54
54
|
* ```
|
|
@@ -127,7 +127,7 @@ keyof ObjectType | AllFieldSpecObjects<ObjectType, keyof ObjectType>;
|
|
|
127
127
|
* The function can then be used, for example, in calls to _Array.sort()_.
|
|
128
128
|
*
|
|
129
129
|
* @example _Sort by age, then by name_
|
|
130
|
-
* ```
|
|
130
|
+
* ```ts
|
|
131
131
|
* const data = [
|
|
132
132
|
* { name: "B", age: 21 },
|
|
133
133
|
* { name: "A", age: 21 },
|
|
@@ -138,7 +138,7 @@ keyof ObjectType | AllFieldSpecObjects<ObjectType, keyof ObjectType>;
|
|
|
138
138
|
* ```
|
|
139
139
|
*
|
|
140
140
|
* @example _Reverse sort order for a single field_
|
|
141
|
-
* ```
|
|
141
|
+
* ```ts
|
|
142
142
|
* const data = [
|
|
143
143
|
* { name: "B", age: 21 },
|
|
144
144
|
* { name: "A", age: 21 },
|
|
@@ -148,7 +148,7 @@ keyof ObjectType | AllFieldSpecObjects<ObjectType, keyof ObjectType>;
|
|
|
148
148
|
* ```
|
|
149
149
|
*
|
|
150
150
|
* @example _Compare array items using indices as field "names"_
|
|
151
|
-
* ```
|
|
151
|
+
* ```ts
|
|
152
152
|
* const data = [
|
|
153
153
|
* [1, 2],
|
|
154
154
|
* [1, 3],
|
|
@@ -159,7 +159,7 @@ keyof ObjectType | AllFieldSpecObjects<ObjectType, keyof ObjectType>;
|
|
|
159
159
|
* ```
|
|
160
160
|
*
|
|
161
161
|
* @example _Compare field values with a custom comparator_
|
|
162
|
-
* ```
|
|
162
|
+
* ```ts
|
|
163
163
|
* const compare = (a, b) => b - a; // Some custom comparison logic
|
|
164
164
|
* const data = [
|
|
165
165
|
* { value: 3 },
|
|
@@ -170,7 +170,7 @@ keyof ObjectType | AllFieldSpecObjects<ObjectType, keyof ObjectType>;
|
|
|
170
170
|
* ```
|
|
171
171
|
*
|
|
172
172
|
* @example _Compare field values with a custom value picker_
|
|
173
|
-
* ```
|
|
173
|
+
* ```ts
|
|
174
174
|
* const valuePicker = (a) => a.value ?? 0; // Some custom value lookup logic, e.g. default values
|
|
175
175
|
* const data = [
|
|
176
176
|
* { value: 3 },
|
package/apprt-core/config.d.ts
CHANGED
|
@@ -82,9 +82,13 @@ interface WellknownConfigKeys {
|
|
|
82
82
|
*/
|
|
83
83
|
"apprt-boot-loader-info": any;
|
|
84
84
|
/**
|
|
85
|
-
* A
|
|
85
|
+
* A globally configured Enterprise-Portal URL.
|
|
86
86
|
*/
|
|
87
87
|
"arcgis-portal-url": string;
|
|
88
|
+
/**
|
|
89
|
+
* The globally configured ArcGIS API key.
|
|
90
|
+
*/
|
|
91
|
+
"esri-api-key": string;
|
|
88
92
|
/**
|
|
89
93
|
* URL to the /agol/token endpoint of map.apps.
|
|
90
94
|
* Which provides an technical user token to e.g. consume a geolocation service as anonymous app user.
|
package/apprt-core/delegate.d.ts
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* The proxy.prototype is set to the given `source` object.
|
|
4
4
|
*
|
|
5
5
|
* @example
|
|
6
|
-
* ```
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* const src = {x: 1};
|
|
8
|
+
* const proxy = {
|
|
9
9
|
* y: 2
|
|
10
10
|
* };
|
|
11
|
-
*
|
|
11
|
+
* const a = delegate(src, proxy);
|
|
12
12
|
* a === proxy // -> true
|
|
13
13
|
* a.y // -> 2
|
|
14
14
|
* a.x // -> 1
|
|
@@ -22,13 +22,13 @@ declare function delegate<SourceType extends object>(source: SourceType): Source
|
|
|
22
22
|
* The proxy.prototype is set to the given `source` object.
|
|
23
23
|
*
|
|
24
24
|
* @example
|
|
25
|
-
* ```
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* const src = {x: 1};
|
|
27
|
+
* const proxy = {
|
|
28
28
|
* y: 2
|
|
29
29
|
* };
|
|
30
|
-
*
|
|
31
|
-
* a === proxy // -> true
|
|
30
|
+
* const a = delegate(src, proxy);
|
|
31
|
+
* a === proxy; // -> true
|
|
32
32
|
* a.y // -> 2
|
|
33
33
|
* a.x // -> 1
|
|
34
34
|
* ```
|
package/apprt-core/equals.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* * If `a` and `b` are arrays then both will be equal if all items are equal.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
|
-
* ```
|
|
9
|
+
* ```ts
|
|
10
10
|
* import { equal } from "apprt-core/equals";
|
|
11
11
|
*
|
|
12
12
|
* if (equal(a, b)) {
|
|
@@ -27,7 +27,7 @@ declare function equal(a: any, b: any): boolean;
|
|
|
27
27
|
* * If `a` and `b` are arrays then both will be equal if all items are equal.
|
|
28
28
|
*
|
|
29
29
|
* @example
|
|
30
|
-
* ```
|
|
30
|
+
* ```ts
|
|
31
31
|
* import { deepEqual } from "apprt-core/equals";
|
|
32
32
|
*
|
|
33
33
|
* if (deepEqual(a, b)){
|
package/apprt-core/freeze.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ type DeepFrozen<T> = T extends Record<string | symbol, any> | any[] ? {
|
|
|
11
11
|
* @param obj Object to freeze. Should be an object or an array, otherwise has on effect.
|
|
12
12
|
* @returns Always returns `obj`.
|
|
13
13
|
* @example
|
|
14
|
-
* ```
|
|
14
|
+
* ```ts
|
|
15
15
|
* import freeze from "apprt-core/freeze";
|
|
16
16
|
* let src = {x: 1, y: { a: 2 } };
|
|
17
17
|
* let srcFrozen = freeze(src);
|
package/apprt-core/global.d.ts
CHANGED
package/apprt-core/join.d.ts
CHANGED
|
@@ -23,18 +23,21 @@ interface JoinError {
|
|
|
23
23
|
* @param promises the promises to wait for.
|
|
24
24
|
* @returns to wait for all promises to finish.
|
|
25
25
|
* @example
|
|
26
|
-
* ```
|
|
26
|
+
* ```ts
|
|
27
27
|
* import join from "apprt-core/join";
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
28
|
+
* const a = fetch("test.json");
|
|
29
|
+
* const b = fetch("test2.json");
|
|
30
|
+
*
|
|
31
|
+
* try {
|
|
32
|
+
* const results = await join([a, b]);
|
|
33
|
+
* const ajson = results[0];
|
|
34
|
+
* const bjson = results[1];
|
|
35
|
+
* } catch (e) {
|
|
36
|
+
* const joinError: JoinError = e;
|
|
37
|
+
* // joinError.all => results, e.g. e.all[0] === result of ajson
|
|
38
|
+
* // joinError.error => first of all errors
|
|
39
|
+
* // joinError.errors => all errors
|
|
40
|
+
* }
|
|
38
41
|
* ```
|
|
39
42
|
*/
|
|
40
43
|
declare function join<T>(promises: (T | PromiseLike<T>)[]): CancelablePromise<T[]>;
|
package/apprt-core/load-css.d.ts
CHANGED
|
@@ -14,20 +14,20 @@ interface LoadCssResult {
|
|
|
14
14
|
* Loads a css file and returns a Promise to support waiting for the load.
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
|
-
* ```
|
|
17
|
+
* ```ts
|
|
18
18
|
* import loadCSS from "apprt-core/load-css";
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* loadCss(require.toUrl("./test.css")).then(function(result){
|
|
21
21
|
* // result.url = url of css
|
|
22
22
|
* // result.link = link created in head
|
|
23
23
|
* // css loaded
|
|
24
24
|
* });
|
|
25
25
|
* ```
|
|
26
26
|
* @example
|
|
27
|
-
* ```
|
|
27
|
+
* ```ts
|
|
28
28
|
* import loadCSS from "apprt-core/load-css";
|
|
29
29
|
*
|
|
30
|
-
*
|
|
30
|
+
* loadCss([
|
|
31
31
|
* require.toUrl("./a.css"),
|
|
32
32
|
* require.toUrl("./b.css")
|
|
33
33
|
* ]).then(function(results){
|
package/apprt-core/load-js.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ interface LoadJsOptions {
|
|
|
17
17
|
* Loads a js file, by wrapping 'require' into a Promise.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
|
-
* ```
|
|
20
|
+
* ```ts
|
|
21
21
|
* import loadJS from "apprt-core/load-js";
|
|
22
22
|
*
|
|
23
23
|
* loadJS("esri/Map").then(function(Map){
|
|
@@ -25,13 +25,13 @@ interface LoadJsOptions {
|
|
|
25
25
|
* });
|
|
26
26
|
* ```
|
|
27
27
|
* @example
|
|
28
|
-
* ```
|
|
28
|
+
* ```ts
|
|
29
29
|
* import loadJS from "apprt-core/load-js";
|
|
30
30
|
*
|
|
31
31
|
* loadJS(["test/Class1","test/Class2"]).then(function(clazzes){
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* ...
|
|
32
|
+
* const Class1 = clazzes[0];
|
|
33
|
+
* const Class2 = clazzes[1];
|
|
34
|
+
* // ...
|
|
35
35
|
* });
|
|
36
36
|
* ```
|
|
37
37
|
* @param clazzes class names to load.
|
|
@@ -21,22 +21,22 @@ interface ManualPromise<T> {
|
|
|
21
21
|
/**
|
|
22
22
|
* @returns a ManualPromise which helps to separate a promise from the resolve/reject methods.
|
|
23
23
|
* @example
|
|
24
|
-
* ```
|
|
24
|
+
* ```ts
|
|
25
25
|
* import { createManualPromise } from "apprt-core/promise-utils";
|
|
26
26
|
*
|
|
27
|
-
*
|
|
27
|
+
* const manualPromise = createManualPromise();
|
|
28
28
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
29
|
+
* // the created promise
|
|
30
|
+
* const promise = manualPromise.promise;
|
|
31
31
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
32
|
+
* // can be resolved by
|
|
33
|
+
* manualPromise.resolve("value");
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
35
|
+
* // or rejected by
|
|
36
|
+
* manualPromise.reject(new Error("error"));
|
|
37
37
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* // destructuring is allowed
|
|
39
|
+
* const {promise, resolve, reject} = createManualPromise();
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
42
|
declare function createManualPromise<T>(): ManualPromise<T>;
|
|
@@ -44,25 +44,25 @@ declare function createManualPromise<T>(): ManualPromise<T>;
|
|
|
44
44
|
* Helper to lazy update a promise and an associated value.
|
|
45
45
|
*
|
|
46
46
|
* @example
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
47
|
+
* ```ts
|
|
48
|
+
* import { LazyValue } from "apprt-core/promise-utils";
|
|
49
49
|
*
|
|
50
|
-
*
|
|
50
|
+
* const lazy = new LazyValue();
|
|
51
51
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
52
|
+
* // code which needs the value, has to use:
|
|
53
|
+
* const theValue = await lazy.promise;
|
|
54
54
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
55
|
+
* // code which like to update the value uses:
|
|
56
|
+
* lazy.value = "newValue";
|
|
57
57
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
58
|
+
* // the value can updated several times.
|
|
59
|
+
* // with every update the promise is replaced
|
|
60
60
|
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
61
|
+
* // this resets the value to not fulfilled
|
|
62
|
+
* // the promise will then block again.
|
|
63
|
+
* lazy.value = undefined;
|
|
64
64
|
*
|
|
65
|
-
*
|
|
65
|
+
* // NOTE: currently the promise can not be switched into an error state.
|
|
66
66
|
* ```
|
|
67
67
|
*/
|
|
68
68
|
declare class LazyValue<T> {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* This is a replacement function for `ct/_string.stringPatternToRegExp`.
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
|
-
* ```
|
|
12
|
+
* ```ts
|
|
13
13
|
* import { createRegexFromPattern } from "apprt-core/string-pattern";
|
|
14
14
|
* const regex = createRegexFromPattern("foo*");
|
|
15
15
|
* const match = regex.test("foobar"); // true
|
|
@@ -43,10 +43,10 @@ interface ReplaceOptions {
|
|
|
43
43
|
* A replacement function to replace all `${key}` values in a given `template`.
|
|
44
44
|
*
|
|
45
45
|
* @example
|
|
46
|
-
* ```
|
|
46
|
+
* ```ts
|
|
47
47
|
* import replace from "apprt-core/string-replace";
|
|
48
48
|
*
|
|
49
|
-
*
|
|
49
|
+
* const msg = replace("Say ${msg}",{msg: "hello" });
|
|
50
50
|
* msg === "Say hello"; // true
|
|
51
51
|
* ```
|
|
52
52
|
* @param template the template string containing `${key}` expressions.
|
|
@@ -59,19 +59,19 @@ type StringReplacer = (template: string, values?: Record<string, any> | ValueRes
|
|
|
59
59
|
* @param options options of replacement function
|
|
60
60
|
* @returns string replacer function.
|
|
61
61
|
* @example _Adjust options to change not found values_
|
|
62
|
-
* ```
|
|
62
|
+
* ```ts
|
|
63
63
|
* import {customReplacer} from "apprt-core/string-replace";
|
|
64
64
|
*
|
|
65
65
|
* const replace = customReplacer({
|
|
66
66
|
* valueNotFound: ""
|
|
67
67
|
* });
|
|
68
68
|
*
|
|
69
|
-
*
|
|
69
|
+
* const msg = replace("${name} says ${msg}",{msg: "hello" });
|
|
70
70
|
* msg === " says hello"; // true
|
|
71
71
|
* ```
|
|
72
72
|
*
|
|
73
73
|
* @example _Custom value lookup function_
|
|
74
|
-
* ```
|
|
74
|
+
* ```ts
|
|
75
75
|
* import {customReplacer} from "apprt-core/string-replace";
|
|
76
76
|
*
|
|
77
77
|
* const replace = customReplacer({
|
|
@@ -79,7 +79,7 @@ type StringReplacer = (template: string, values?: Record<string, any> | ValueRes
|
|
|
79
79
|
* valueLookup: (key, values) => values[key]
|
|
80
80
|
* });
|
|
81
81
|
*
|
|
82
|
-
*
|
|
82
|
+
* const msg = replace("Says ${msg}",{msg: "hello" });
|
|
83
83
|
* msg === "Says hello"; // true
|
|
84
84
|
* ```
|
|
85
85
|
*/
|
|
@@ -89,19 +89,19 @@ declare function customReplacer(options?: ReplaceOptions): StringReplacer;
|
|
|
89
89
|
*
|
|
90
90
|
* @example
|
|
91
91
|
* _Replace `${key}` using object as key to value mapping_
|
|
92
|
-
* ```
|
|
92
|
+
* ```ts
|
|
93
93
|
* import {replace} from "apprt-core/string-replace";
|
|
94
94
|
*
|
|
95
|
-
*
|
|
95
|
+
* const msg = replace("${name} says ${msg}", { msg: "hello" });
|
|
96
96
|
* msg === "${name} says hello"; // true
|
|
97
97
|
* ```
|
|
98
98
|
*
|
|
99
99
|
* @example
|
|
100
100
|
* _Replacing `${key}` using custom value lookup function_
|
|
101
|
-
* ```
|
|
101
|
+
* ```ts
|
|
102
102
|
* import {replace} from "apprt-core/string-replace";
|
|
103
103
|
*
|
|
104
|
-
*
|
|
104
|
+
* const msg = replace("${name} says ${msg}", (key) => key === "msg" ? "hello" : "");
|
|
105
105
|
* msg === " says hello"; // true
|
|
106
106
|
* ```
|
|
107
107
|
*
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Note: the returned string does *not* contain a leading "?"
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
|
-
* ```
|
|
8
|
+
* ```ts
|
|
9
9
|
* import { objectToQuery } from "apprt-core/url-utils";
|
|
10
10
|
* const query = objectToQuery({
|
|
11
11
|
* a: 1,
|
|
@@ -24,7 +24,7 @@ declare function objectToQuery(object?: Record<string, any | any[]>): string;
|
|
|
24
24
|
* No transformation of the individual values is done, i.e. all values will be strings.
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
|
-
* ```
|
|
27
|
+
* ```ts
|
|
28
28
|
* import { queryToObject } from "apprt-core/url-utils";
|
|
29
29
|
* const object = queryToObject("a=1&b=2&b=3");
|
|
30
30
|
* // object is { a: "1", b: ["2", "3"] }
|
package/apprt-core/when.d.ts
CHANGED
|
@@ -11,16 +11,16 @@ type ErrorCallback<Scope> = (this: Scope, error: any) => any;
|
|
|
11
11
|
* @param scope this binding for the callbacks
|
|
12
12
|
* @returns always produces a promise
|
|
13
13
|
* @example
|
|
14
|
-
* ```
|
|
14
|
+
* ```ts
|
|
15
15
|
* // use it as wrapper to get a promise
|
|
16
16
|
* return when(thing).then((thing)=> doSomethingWithTheThing);
|
|
17
17
|
* ```
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
|
-
* ```
|
|
20
|
+
* ```td
|
|
21
21
|
* import when from "apprt-core/when";
|
|
22
22
|
* // bind success and error handler from an object
|
|
23
|
-
*
|
|
23
|
+
* const scope = {
|
|
24
24
|
* counter : 0,
|
|
25
25
|
* ok() {
|
|
26
26
|
* ++this.counter;
|