@angular-wave/angular.ts 0.0.60 → 0.0.61
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/README.md +1 -1
- package/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +1 -1
- package/src/core/parser/parse.js +14 -0
- package/src/core/parser/parser.js +1 -1
- package/src/core/q/q.js +46 -289
- package/src/core/q/q.md +229 -0
- package/src/core/sanitize/sanitize-uri.js +2 -3
- package/src/core/scope/scope.js +18 -8
- package/src/directive/if/if.js +6 -1
- package/src/filters/limit-to.js +5 -2
- package/src/loader.js +1 -5
- package/src/router/params/param-type.js +2 -1
- package/src/router/state/views.js +3 -0
- package/src/router/transition/reject-factory.js +1 -0
- package/src/router/url/url-rule.js +1 -1
- package/src/router/url/url-service.js +4 -4
- package/src/services/http/http.js +7 -5
- package/src/services/template-request.js +2 -7
- package/src/shared/common.js +1 -1
- package/src/shared/utils.js +1 -1
- package/src/types.js +9 -1
- package/types/core/parser/parse.d.ts +3 -4
- package/types/core/parser/parser.d.ts +1 -1
- package/types/core/q/q.d.ts +2 -2
- package/types/core/sanitize/sanitize-uri.d.ts +4 -5
- package/types/core/scope/scope.d.ts +19 -7
- package/types/loader.d.ts +0 -4
- package/types/router/params/param-type.d.ts +2 -1
- package/types/router/state/views.d.ts +2 -0
- package/types/router/transition/reject-factory.d.ts +1 -0
- package/types/router/url/url-rule.d.ts +0 -1
- package/types/router/url/url-service.d.ts +7 -7
- package/types/services/template-request.d.ts +4 -9
- package/types/types.d.ts +6 -1
- package/types-back/README.md +0 -2
- package/types-back/angular.d.ts +0 -146
- package/types-back/index.d.ts +0 -2126
- package/types-back/jqlite.d.ts +0 -374
- package/types-back/router/core/common/common.d.ts +0 -416
- package/types-back/router/core/common/coreservices.d.ts +0 -77
- package/types-back/router/core/common/glob.d.ts +0 -60
- package/types-back/router/core/common/hof.d.ts +0 -168
- package/types-back/router/core/common/index.d.ts +0 -8
- package/types-back/router/core/common/predicates.d.ts +0 -25
- package/types-back/router/core/common/queue.d.ts +0 -15
- package/types-back/router/core/common/safeConsole.d.ts +0 -5
- package/types-back/router/core/common/strings.d.ts +0 -66
- package/types-back/router/core/common/trace.d.ts +0 -126
- package/types-back/router/core/globals.d.ts +0 -43
- package/types-back/router/core/hooks/coreResolvables.d.ts +0 -6
- package/types-back/router/core/hooks/ignoredTransition.d.ts +0 -4
- package/types-back/router/core/hooks/invalidTransition.d.ts +0 -4
- package/types-back/router/core/hooks/lazyLoad.d.ts +0 -17
- package/types-back/router/core/hooks/onEnterExitRetain.d.ts +0 -10
- package/types-back/router/core/hooks/redirectTo.d.ts +0 -4
- package/types-back/router/core/hooks/resolve.d.ts +0 -11
- package/types-back/router/core/hooks/updateGlobals.d.ts +0 -4
- package/types-back/router/core/hooks/url.d.ts +0 -4
- package/types-back/router/core/hooks/views.d.ts +0 -7
- package/types-back/router/core/index.d.ts +0 -11
- package/types-back/router/core/interface.d.ts +0 -91
- package/types-back/router/core/params/index.d.ts +0 -12
- package/types-back/router/core/params/interface.d.ts +0 -606
- package/types-back/router/core/params/param.d.ts +0 -77
- package/types-back/router/core/params/paramType.d.ts +0 -65
- package/types-back/router/core/params/paramTypes.d.ts +0 -193
- package/types-back/router/core/params/stateParams.d.ts +0 -15
- package/types-back/router/core/path/index.d.ts +0 -2
- package/types-back/router/core/path/pathNode.d.ts +0 -60
- package/types-back/router/core/path/pathUtils.d.ts +0 -105
- package/types-back/router/core/resolve/index.d.ts +0 -3
- package/types-back/router/core/resolve/interface.d.ts +0 -210
- package/types-back/router/core/resolve/resolvable.d.ts +0 -75
- package/types-back/router/core/resolve/resolveContext.d.ts +0 -97
- package/types-back/router/core/router.d.ts +0 -57
- package/types-back/router/core/state/index.d.ts +0 -28
- package/types-back/router/core/state/interface.d.ts +0 -732
- package/types-back/router/core/state/stateBuilder.d.ts +0 -107
- package/types-back/router/core/state/stateMatcher.d.ts +0 -13
- package/types-back/router/core/state/stateObject.d.ts +0 -170
- package/types-back/router/core/state/stateQueueManager.d.ts +0 -27
- package/types-back/router/core/state/stateRegistry.d.ts +0 -138
- package/types-back/router/core/state/stateService.d.ts +0 -386
- package/types-back/router/core/state/targetState.d.ts +0 -105
- package/types-back/router/core/transition/hookBuilder.d.ts +0 -49
- package/types-back/router/core/transition/hookRegistry.d.ts +0 -115
- package/types-back/router/core/transition/index.d.ts +0 -20
- package/types-back/router/core/transition/interface.d.ts +0 -862
- package/types-back/router/core/transition/rejectFactory.d.ts +0 -103
- package/types-back/router/core/transition/transition.d.ts +0 -575
- package/types-back/router/core/transition/transitionEventType.d.ts +0 -26
- package/types-back/router/core/transition/transitionHook.d.ts +0 -96
- package/types-back/router/core/transition/transitionService.d.ts +0 -253
- package/types-back/router/core/url/index.d.ts +0 -8
- package/types-back/router/core/url/interface.d.ts +0 -169
- package/types-back/router/core/url/urlConfig.d.ts +0 -144
- package/types-back/router/core/url/urlMatcher.d.ts +0 -185
- package/types-back/router/core/url/urlMatcherFactory.d.ts +0 -56
- package/types-back/router/core/url/urlRouter.d.ts +0 -101
- package/types-back/router/core/url/urlRule.d.ts +0 -143
- package/types-back/router/core/url/urlRules.d.ts +0 -251
- package/types-back/router/core/url/urlService.d.ts +0 -205
- package/types-back/router/core/view/index.d.ts +0 -2
- package/types-back/router/core/view/interface.d.ts +0 -46
- package/types-back/router/core/view/view.d.ts +0 -176
- package/types-back/router/directives/viewDirective.d.ts +0 -144
- package/types-back/router/index.d.ts +0 -17
- package/types-back/router/interface.d.ts +0 -500
- package/types-back/router/legacy/resolveService.d.ts +0 -47
- package/types-back/router/legacy/stateEvents.d.ts +0 -124
- package/types-back/router/services.d.ts +0 -15
- package/types-back/router/stateFilters.d.ts +0 -10
- package/types-back/router/stateProvider.d.ts +0 -258
- package/types-back/router/statebuilders/onEnterExitRetain.d.ts +0 -13
- package/types-back/router/statebuilders/views.d.ts +0 -53
- package/types-back/router/templateFactory.d.ts +0 -104
- package/types-back/router/viewScroll.d.ts +0 -9
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
import { StateObject } from "../state/stateObject";
|
|
2
|
-
export declare const root: any;
|
|
3
|
-
export declare const fromJson: any;
|
|
4
|
-
export declare const toJson: any;
|
|
5
|
-
export declare const forEach: any;
|
|
6
|
-
export declare const extend: typeof _extend;
|
|
7
|
-
export declare const equals: any;
|
|
8
|
-
export declare function identity(x: any): any;
|
|
9
|
-
export declare type Mapper<X, T> = (x: X, key?: string | number) => T;
|
|
10
|
-
export interface TypedMap<T> {
|
|
11
|
-
[key: string]: T;
|
|
12
|
-
}
|
|
13
|
-
export declare type Predicate<X> = (x?: X) => boolean;
|
|
14
|
-
export declare type PredicateBinary<X, Y> = (x?: X, y?: Y) => boolean;
|
|
15
|
-
/**
|
|
16
|
-
* An ng1-style injectable
|
|
17
|
-
*
|
|
18
|
-
* This could be a (non-minified) function such as:
|
|
19
|
-
* ```js
|
|
20
|
-
* function injectableFunction(SomeDependency) {
|
|
21
|
-
*
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* or an explicitly annotated function (minify safe)
|
|
26
|
-
* ```js
|
|
27
|
-
* injectableFunction.$inject = [ 'SomeDependency' ];
|
|
28
|
-
* function injectableFunction(SomeDependency) {
|
|
29
|
-
*
|
|
30
|
-
* }
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* or an array style annotated function (minify safe)
|
|
34
|
-
* ```js
|
|
35
|
-
* ['SomeDependency', function injectableFunction(SomeDependency) {
|
|
36
|
-
*
|
|
37
|
-
* }];
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
export declare type IInjectable = Function | any[];
|
|
41
|
-
export interface Obj extends Object {
|
|
42
|
-
[key: string]: any;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Builds proxy functions on the `to` object which pass through to the `from` object.
|
|
46
|
-
*
|
|
47
|
-
* For each key in `fnNames`, creates a proxy function on the `to` object.
|
|
48
|
-
* The proxy function calls the real function on the `from` object.
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* #### Example:
|
|
52
|
-
* This example creates an new class instance whose functions are prebound to the new'd object.
|
|
53
|
-
* ```js
|
|
54
|
-
* class Foo {
|
|
55
|
-
* constructor(data) {
|
|
56
|
-
* // Binds all functions from Foo.prototype to 'this',
|
|
57
|
-
* // then copies them to 'this'
|
|
58
|
-
* bindFunctions(Foo.prototype, this, this);
|
|
59
|
-
* this.data = data;
|
|
60
|
-
* }
|
|
61
|
-
*
|
|
62
|
-
* log() {
|
|
63
|
-
* console.log(this.data);
|
|
64
|
-
* }
|
|
65
|
-
* }
|
|
66
|
-
*
|
|
67
|
-
* let myFoo = new Foo([1,2,3]);
|
|
68
|
-
* var logit = myFoo.log;
|
|
69
|
-
* logit(); // logs [1, 2, 3] from the myFoo 'this' instance
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* #### Example:
|
|
73
|
-
* This example creates a bound version of a service function, and copies it to another object
|
|
74
|
-
* ```
|
|
75
|
-
*
|
|
76
|
-
* var SomeService = {
|
|
77
|
-
* this.data = [3, 4, 5];
|
|
78
|
-
* this.log = function() {
|
|
79
|
-
* console.log(this.data);
|
|
80
|
-
* }
|
|
81
|
-
* }
|
|
82
|
-
*
|
|
83
|
-
* // Constructor fn
|
|
84
|
-
* function OtherThing() {
|
|
85
|
-
* // Binds all functions from SomeService to SomeService,
|
|
86
|
-
* // then copies them to 'this'
|
|
87
|
-
* bindFunctions(SomeService, this, SomeService);
|
|
88
|
-
* }
|
|
89
|
-
*
|
|
90
|
-
* let myOtherThing = new OtherThing();
|
|
91
|
-
* myOtherThing.log(); // logs [3, 4, 5] from SomeService's 'this'
|
|
92
|
-
* ```
|
|
93
|
-
*
|
|
94
|
-
* @param source A function that returns the source object which contains the original functions to be bound
|
|
95
|
-
* @param target A function that returns the target object which will receive the bound functions
|
|
96
|
-
* @param bind A function that returns the object which the functions will be bound to
|
|
97
|
-
* @param fnNames The function names which will be bound (Defaults to all the functions found on the 'from' object)
|
|
98
|
-
* @param latebind If true, the binding of the function is delayed until the first time it's invoked
|
|
99
|
-
*/
|
|
100
|
-
export declare function createProxyFunctions(
|
|
101
|
-
source: Function,
|
|
102
|
-
target: Obj,
|
|
103
|
-
bind: Function,
|
|
104
|
-
fnNames?: string[],
|
|
105
|
-
latebind?: boolean,
|
|
106
|
-
): Obj;
|
|
107
|
-
/**
|
|
108
|
-
* prototypal inheritance helper.
|
|
109
|
-
* Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it
|
|
110
|
-
*/
|
|
111
|
-
export declare const inherit: (parent: Obj, extra?: Obj) => any;
|
|
112
|
-
/** Given an array, returns true if the object is found in the array, (using indexOf) */
|
|
113
|
-
export declare const inArray: typeof _inArray;
|
|
114
|
-
export declare function _inArray(array: any[], obj: any): boolean;
|
|
115
|
-
export declare function _inArray(array: any[]): (obj: any) => boolean;
|
|
116
|
-
/**
|
|
117
|
-
* Given an array, and an item, if the item is found in the array, it removes it (in-place).
|
|
118
|
-
* The same array is returned
|
|
119
|
-
*/
|
|
120
|
-
export declare const removeFrom: typeof _removeFrom;
|
|
121
|
-
export declare function _removeFrom<T>(array: T[], obj: T): T[];
|
|
122
|
-
export declare function _removeFrom<T>(array: T[]): (obj: T) => T[];
|
|
123
|
-
/** pushes a values to an array and returns the value */
|
|
124
|
-
export declare const pushTo: typeof _pushTo;
|
|
125
|
-
export declare function _pushTo<T>(arr: T[], val: T): T;
|
|
126
|
-
export declare function _pushTo<T>(arr: T[]): (val: T) => T;
|
|
127
|
-
/** Given an array of (deregistration) functions, calls all functions and removes each one from the source array */
|
|
128
|
-
export declare const deregAll: (functions: Function[]) => void;
|
|
129
|
-
/**
|
|
130
|
-
* Applies a set of defaults to an options object. The options object is filtered
|
|
131
|
-
* to only those properties of the objects in the defaultsList.
|
|
132
|
-
* Earlier objects in the defaultsList take precedence when applying defaults.
|
|
133
|
-
*/
|
|
134
|
-
export declare function defaults(opts: any, ...defaultsList: Obj[]): any;
|
|
135
|
-
/** Reduce function that merges each element of the list into a single object, using extend */
|
|
136
|
-
export declare const mergeR: (memo: Obj, item: Obj) => any;
|
|
137
|
-
/**
|
|
138
|
-
* Finds the common ancestor path between two states.
|
|
139
|
-
*
|
|
140
|
-
* @param {Object} first The first state.
|
|
141
|
-
* @param {Object} second The second state.
|
|
142
|
-
* @return {Array} Returns an array of state names in descending order, not including the root.
|
|
143
|
-
*/
|
|
144
|
-
export declare function ancestors(
|
|
145
|
-
first: StateObject,
|
|
146
|
-
second: StateObject,
|
|
147
|
-
): StateObject[];
|
|
148
|
-
/**
|
|
149
|
-
* Return a copy of the object only containing the whitelisted properties.
|
|
150
|
-
*
|
|
151
|
-
* #### Example:
|
|
152
|
-
* ```
|
|
153
|
-
* var foo = { a: 1, b: 2, c: 3 };
|
|
154
|
-
* var ab = pick(foo, ['a', 'b']); // { a: 1, b: 2 }
|
|
155
|
-
* ```
|
|
156
|
-
* @param obj the source object
|
|
157
|
-
* @param propNames an Array of strings, which are the whitelisted property names
|
|
158
|
-
*/
|
|
159
|
-
export declare function pick(obj: Obj, propNames: string[]): Obj;
|
|
160
|
-
/**
|
|
161
|
-
* Return a copy of the object omitting the blacklisted properties.
|
|
162
|
-
*
|
|
163
|
-
* @example
|
|
164
|
-
* ```
|
|
165
|
-
*
|
|
166
|
-
* var foo = { a: 1, b: 2, c: 3 };
|
|
167
|
-
* var ab = omit(foo, ['a', 'b']); // { c: 3 }
|
|
168
|
-
* ```
|
|
169
|
-
* @param obj the source object
|
|
170
|
-
* @param propNames an Array of strings, which are the blacklisted property names
|
|
171
|
-
*/
|
|
172
|
-
export declare function omit(obj: Obj, propNames: string[]): Obj;
|
|
173
|
-
/** Given an array of objects, maps each element to a named property of the element. */
|
|
174
|
-
export declare function pluck<T>(collection: Obj[], propName: string): T[];
|
|
175
|
-
/** Given an object, maps each property of the object to a named property of the property. */
|
|
176
|
-
export declare function pluck(
|
|
177
|
-
collection: {
|
|
178
|
-
[key: string]: any;
|
|
179
|
-
},
|
|
180
|
-
propName: string,
|
|
181
|
-
): {
|
|
182
|
-
[key: string]: any;
|
|
183
|
-
};
|
|
184
|
-
/** Given an array of objects, returns a new array containing only the elements which passed the callback predicate */
|
|
185
|
-
export declare function filter<T>(
|
|
186
|
-
collection: T[],
|
|
187
|
-
callback: (t: T, key?: number) => boolean,
|
|
188
|
-
): T[];
|
|
189
|
-
/** Given an object, returns a new object with only those properties that passed the callback predicate */
|
|
190
|
-
export declare function filter<T>(
|
|
191
|
-
collection: TypedMap<T>,
|
|
192
|
-
callback: (t: T, key?: string) => boolean,
|
|
193
|
-
): TypedMap<T>;
|
|
194
|
-
/** Given an object, return the first property of that object which passed the callback predicate */
|
|
195
|
-
export declare function find<T>(
|
|
196
|
-
collection: TypedMap<T>,
|
|
197
|
-
callback: Predicate<T>,
|
|
198
|
-
): T;
|
|
199
|
-
/** Given an array of objects, returns the first object which passed the callback predicate */
|
|
200
|
-
export declare function find<T>(collection: T[], callback: Predicate<T>): T;
|
|
201
|
-
/** Given an object, returns a new object, where each property is transformed by the callback function */
|
|
202
|
-
export declare let mapObj: <T, U>(
|
|
203
|
-
collection: {
|
|
204
|
-
[key: string]: T;
|
|
205
|
-
},
|
|
206
|
-
callback: Mapper<T, U>,
|
|
207
|
-
target?: typeof collection,
|
|
208
|
-
) => {
|
|
209
|
-
[key: string]: U;
|
|
210
|
-
};
|
|
211
|
-
/** Given an array, returns a new array, where each element is transformed by the callback function */
|
|
212
|
-
export declare function map<T, U>(
|
|
213
|
-
collection: T[],
|
|
214
|
-
callback: Mapper<T, U>,
|
|
215
|
-
target?: typeof collection,
|
|
216
|
-
): U[];
|
|
217
|
-
export declare function map<T, U>(
|
|
218
|
-
collection: {
|
|
219
|
-
[key: string]: T;
|
|
220
|
-
},
|
|
221
|
-
callback: Mapper<T, U>,
|
|
222
|
-
target?: typeof collection,
|
|
223
|
-
): {
|
|
224
|
-
[key: string]: U;
|
|
225
|
-
};
|
|
226
|
-
/**
|
|
227
|
-
* Given an object, return its enumerable property values
|
|
228
|
-
*
|
|
229
|
-
* @example
|
|
230
|
-
* ```
|
|
231
|
-
*
|
|
232
|
-
* let foo = { a: 1, b: 2, c: 3 }
|
|
233
|
-
* let vals = values(foo); // [ 1, 2, 3 ]
|
|
234
|
-
* ```
|
|
235
|
-
*/
|
|
236
|
-
export declare const values: <T>(obj: TypedMap<T>) => T[];
|
|
237
|
-
/**
|
|
238
|
-
* Reduce function that returns true if all of the values are truthy.
|
|
239
|
-
*
|
|
240
|
-
* @example
|
|
241
|
-
* ```
|
|
242
|
-
*
|
|
243
|
-
* let vals = [ 1, true, {}, "hello world"];
|
|
244
|
-
* vals.reduce(allTrueR, true); // true
|
|
245
|
-
*
|
|
246
|
-
* vals.push(0);
|
|
247
|
-
* vals.reduce(allTrueR, true); // false
|
|
248
|
-
* ```
|
|
249
|
-
*/
|
|
250
|
-
export declare const allTrueR: (memo: boolean, elem: any) => any;
|
|
251
|
-
/**
|
|
252
|
-
* Reduce function that returns true if any of the values are truthy.
|
|
253
|
-
*
|
|
254
|
-
* * @example
|
|
255
|
-
* ```
|
|
256
|
-
*
|
|
257
|
-
* let vals = [ 0, null, undefined ];
|
|
258
|
-
* vals.reduce(anyTrueR, true); // false
|
|
259
|
-
*
|
|
260
|
-
* vals.push("hello world");
|
|
261
|
-
* vals.reduce(anyTrueR, true); // true
|
|
262
|
-
* ```
|
|
263
|
-
*/
|
|
264
|
-
export declare const anyTrueR: (memo: boolean, elem: any) => any;
|
|
265
|
-
/**
|
|
266
|
-
* Reduce function which un-nests a single level of arrays
|
|
267
|
-
* @example
|
|
268
|
-
* ```
|
|
269
|
-
*
|
|
270
|
-
* let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ];
|
|
271
|
-
* input.reduce(unnestR, []) // [ "a", "b", "c", "d", [ "double, "nested" ] ]
|
|
272
|
-
* ```
|
|
273
|
-
*/
|
|
274
|
-
export declare const unnestR: (memo: any[], elem: any[]) => any[];
|
|
275
|
-
/**
|
|
276
|
-
* Reduce function which recursively un-nests all arrays
|
|
277
|
-
*
|
|
278
|
-
* @example
|
|
279
|
-
* ```
|
|
280
|
-
*
|
|
281
|
-
* let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ];
|
|
282
|
-
* input.reduce(unnestR, []) // [ "a", "b", "c", "d", "double, "nested" ]
|
|
283
|
-
* ```
|
|
284
|
-
*/
|
|
285
|
-
export declare const flattenR: (memo: any[], elem: any) => any[];
|
|
286
|
-
/**
|
|
287
|
-
* Reduce function that pushes an object to an array, then returns the array.
|
|
288
|
-
* Mostly just for [[flattenR]] and [[uniqR]]
|
|
289
|
-
*/
|
|
290
|
-
export declare function pushR(arr: any[], obj: any): any[];
|
|
291
|
-
/** Reduce function that filters out duplicates */
|
|
292
|
-
export declare const uniqR: <T>(acc: T[], token: T) => T[];
|
|
293
|
-
/**
|
|
294
|
-
* Return a new array with a single level of arrays unnested.
|
|
295
|
-
*
|
|
296
|
-
* @example
|
|
297
|
-
* ```
|
|
298
|
-
*
|
|
299
|
-
* let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ];
|
|
300
|
-
* unnest(input) // [ "a", "b", "c", "d", [ "double, "nested" ] ]
|
|
301
|
-
* ```
|
|
302
|
-
*/
|
|
303
|
-
export declare const unnest: (arr: any[]) => any;
|
|
304
|
-
/**
|
|
305
|
-
* Return a completely flattened version of an array.
|
|
306
|
-
*
|
|
307
|
-
* @example
|
|
308
|
-
* ```
|
|
309
|
-
*
|
|
310
|
-
* let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ];
|
|
311
|
-
* flatten(input) // [ "a", "b", "c", "d", "double, "nested" ]
|
|
312
|
-
* ```
|
|
313
|
-
*/
|
|
314
|
-
export declare const flatten: (arr: any[]) => any;
|
|
315
|
-
/**
|
|
316
|
-
* Given a .filter Predicate, builds a .filter Predicate which throws an error if any elements do not pass.
|
|
317
|
-
* @example
|
|
318
|
-
* ```
|
|
319
|
-
*
|
|
320
|
-
* let isNumber = (obj) => typeof(obj) === 'number';
|
|
321
|
-
* let allNumbers = [ 1, 2, 3, 4, 5 ];
|
|
322
|
-
* allNumbers.filter(assertPredicate(isNumber)); //OK
|
|
323
|
-
*
|
|
324
|
-
* let oneString = [ 1, 2, 3, 4, "5" ];
|
|
325
|
-
* oneString.filter(assertPredicate(isNumber, "Not all numbers")); // throws Error(""Not all numbers"");
|
|
326
|
-
* ```
|
|
327
|
-
*/
|
|
328
|
-
export declare const assertPredicate: <T>(
|
|
329
|
-
predicate: Predicate<T>,
|
|
330
|
-
errMsg: string | Function,
|
|
331
|
-
) => Predicate<T>;
|
|
332
|
-
/**
|
|
333
|
-
* Given a .map function, builds a .map function which throws an error if any mapped elements do not pass a truthyness test.
|
|
334
|
-
* @example
|
|
335
|
-
* ```
|
|
336
|
-
*
|
|
337
|
-
* var data = { foo: 1, bar: 2 };
|
|
338
|
-
*
|
|
339
|
-
* let keys = [ 'foo', 'bar' ]
|
|
340
|
-
* let values = keys.map(assertMap(key => data[key], "Key not found"));
|
|
341
|
-
* // values is [1, 2]
|
|
342
|
-
*
|
|
343
|
-
* let keys = [ 'foo', 'bar', 'baz' ]
|
|
344
|
-
* let values = keys.map(assertMap(key => data[key], "Key not found"));
|
|
345
|
-
* // throws Error("Key not found")
|
|
346
|
-
* ```
|
|
347
|
-
*/
|
|
348
|
-
export declare const assertMap: <T, U>(
|
|
349
|
-
mapFn: (t: T) => U,
|
|
350
|
-
errMsg: string | Function,
|
|
351
|
-
) => (t: T) => U;
|
|
352
|
-
export declare function assertFn(
|
|
353
|
-
predicateOrMap: Function,
|
|
354
|
-
errMsg?: string | Function,
|
|
355
|
-
): any;
|
|
356
|
-
/**
|
|
357
|
-
* Like _.pairs: Given an object, returns an array of key/value pairs
|
|
358
|
-
*
|
|
359
|
-
* @example
|
|
360
|
-
* ```
|
|
361
|
-
*
|
|
362
|
-
* pairs({ foo: "FOO", bar: "BAR }) // [ [ "foo", "FOO" ], [ "bar": "BAR" ] ]
|
|
363
|
-
* ```
|
|
364
|
-
*/
|
|
365
|
-
export declare const pairs: (obj: Obj) => any[][];
|
|
366
|
-
/**
|
|
367
|
-
* Given two or more parallel arrays, returns an array of tuples where
|
|
368
|
-
* each tuple is composed of [ a[i], b[i], ... z[i] ]
|
|
369
|
-
*
|
|
370
|
-
* @example
|
|
371
|
-
* ```
|
|
372
|
-
*
|
|
373
|
-
* let foo = [ 0, 2, 4, 6 ];
|
|
374
|
-
* let bar = [ 1, 3, 5, 7 ];
|
|
375
|
-
* let baz = [ 10, 30, 50, 70 ];
|
|
376
|
-
* arrayTuples(foo, bar); // [ [0, 1], [2, 3], [4, 5], [6, 7] ]
|
|
377
|
-
* arrayTuples(foo, bar, baz); // [ [0, 1, 10], [2, 3, 30], [4, 5, 50], [6, 7, 70] ]
|
|
378
|
-
* ```
|
|
379
|
-
*/
|
|
380
|
-
export declare function arrayTuples(...args: any[]): any[];
|
|
381
|
-
/**
|
|
382
|
-
* Reduce function which builds an object from an array of [key, value] pairs.
|
|
383
|
-
*
|
|
384
|
-
* Each iteration sets the key/val pair on the memo object, then returns the memo for the next iteration.
|
|
385
|
-
*
|
|
386
|
-
* Each keyValueTuple should be an array with values [ key: string, value: any ]
|
|
387
|
-
*
|
|
388
|
-
* @example
|
|
389
|
-
* ```
|
|
390
|
-
*
|
|
391
|
-
* var pairs = [ ["fookey", "fooval"], ["barkey", "barval"] ]
|
|
392
|
-
*
|
|
393
|
-
* var pairsToObj = pairs.reduce((memo, pair) => applyPairs(memo, pair), {})
|
|
394
|
-
* // pairsToObj == { fookey: "fooval", barkey: "barval" }
|
|
395
|
-
*
|
|
396
|
-
* // Or, more simply:
|
|
397
|
-
* var pairsToObj = pairs.reduce(applyPairs, {})
|
|
398
|
-
* // pairsToObj == { fookey: "fooval", barkey: "barval" }
|
|
399
|
-
* ```
|
|
400
|
-
*/
|
|
401
|
-
export declare function applyPairs(
|
|
402
|
-
memo: TypedMap<any>,
|
|
403
|
-
keyValTuple: any[],
|
|
404
|
-
): TypedMap<any>;
|
|
405
|
-
/** Get the last element of an array */
|
|
406
|
-
export declare function tail<T>(arr: T[]): T;
|
|
407
|
-
/**
|
|
408
|
-
* shallow copy from src to dest
|
|
409
|
-
*/
|
|
410
|
-
export declare function copy(src: Obj, dest?: Obj): any;
|
|
411
|
-
/** Like Object.assign() */
|
|
412
|
-
export declare function _extend(toObj: Obj, ...fromObjs: Obj[]): any;
|
|
413
|
-
export declare const silenceUncaughtInPromise: (
|
|
414
|
-
promise: Promise<any>,
|
|
415
|
-
) => Promise<any>;
|
|
416
|
-
export declare const silentRejection: (error: any) => Promise<any>;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This module is a stub for core services such as Dependency Injection or Browser Location.
|
|
3
|
-
* Core services may be implemented by a specific framework, such as ng1 or ng2, or be pure javascript.
|
|
4
|
-
*
|
|
5
|
-
* @packageDocumentation
|
|
6
|
-
*/
|
|
7
|
-
import { IInjectable, Obj } from "./common";
|
|
8
|
-
import { UrlConfig, UrlService } from "../url";
|
|
9
|
-
export declare const makeStub: <T>(service: string, methods: (keyof T)[]) => T;
|
|
10
|
-
declare const services: CoreServices;
|
|
11
|
-
export interface $QLikeDeferred {
|
|
12
|
-
resolve: (val?: any) => void;
|
|
13
|
-
reject: (reason?: any) => void;
|
|
14
|
-
promise: Promise<any>;
|
|
15
|
-
}
|
|
16
|
-
export interface $QLike {
|
|
17
|
-
when<T>(value?: T | PromiseLike<T>): Promise<T>;
|
|
18
|
-
reject<T>(reason: any): Promise<T>;
|
|
19
|
-
defer(): $QLikeDeferred;
|
|
20
|
-
all(promises: { [key: string]: Promise<any> }): Promise<any>;
|
|
21
|
-
all(promises: Promise<any>[]): Promise<any[]>;
|
|
22
|
-
}
|
|
23
|
-
export interface $InjectorLike {
|
|
24
|
-
strictDi?: boolean;
|
|
25
|
-
get(token: any): any;
|
|
26
|
-
get<T>(token: any): T;
|
|
27
|
-
has(token: any): boolean;
|
|
28
|
-
invoke(fn: IInjectable, context?: any, locals?: Obj): any;
|
|
29
|
-
annotate(fn: IInjectable, strictDi?: boolean): any[];
|
|
30
|
-
}
|
|
31
|
-
export interface CoreServices {
|
|
32
|
-
$q: $QLike;
|
|
33
|
-
$injector: $InjectorLike;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Handles low level URL read/write
|
|
37
|
-
*
|
|
38
|
-
* This service handles low level reads and updates of the URL and listens for url changes.
|
|
39
|
-
* Implementors should pass these through to the underlying URL mechanism.
|
|
40
|
-
* The underlying URL mechanism might be browser APIs, framework APIs, or some 3rd party URL management library.
|
|
41
|
-
*
|
|
42
|
-
* Router Core includes three basic implementations:
|
|
43
|
-
*
|
|
44
|
-
* - [[PushStateLocationService]]
|
|
45
|
-
* - [[HashLocationService]]
|
|
46
|
-
* - [[MemoryLocationService]]
|
|
47
|
-
*/
|
|
48
|
-
export interface LocationServices {
|
|
49
|
-
/** See: [[UrlService.url]] */ url: UrlService["url"];
|
|
50
|
-
/** See: [[UrlService.path]] */ path: UrlService["path"];
|
|
51
|
-
/** See: [[UrlService.search]] */ search: UrlService["search"];
|
|
52
|
-
/** See: [[UrlService.hash]] */ hash: UrlService["hash"];
|
|
53
|
-
/** See: [[UrlService.onChange]] */ onChange: UrlService["onChange"];
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Returns low level URL configuration and metadata
|
|
57
|
-
*
|
|
58
|
-
* This service returns information about the location configuration.
|
|
59
|
-
* This service is primarily used when building URLs (e.g., for `hrefs`)
|
|
60
|
-
*
|
|
61
|
-
* Implementors should pass these through to the underlying URL APIs.
|
|
62
|
-
* The underlying URL mechanism might be browser APIs, framework APIs, or some 3rd party URL management library.
|
|
63
|
-
*
|
|
64
|
-
* Router Core includes two basic implementations:
|
|
65
|
-
*
|
|
66
|
-
* - [[BrowserLocationConfig]]
|
|
67
|
-
* - [[MemoryLocationConfig]]
|
|
68
|
-
*/
|
|
69
|
-
export interface LocationConfig {
|
|
70
|
-
/** See: [[UrlConfig.port]] */ port: UrlConfig["port"];
|
|
71
|
-
/** See: [[UrlConfig.protocol]] */ protocol: UrlConfig["protocol"];
|
|
72
|
-
/** See: [[UrlConfig.host]] */ host: UrlConfig["host"];
|
|
73
|
-
/** See: [[UrlConfig.baseHref]] */ baseHref: UrlConfig["baseHref"];
|
|
74
|
-
/** See: [[UrlConfig.html5Mode]] */ html5Mode: UrlConfig["html5Mode"];
|
|
75
|
-
/** See: [[UrlConfig.hashPrefix]] */ hashPrefix: UrlConfig["hashPrefix"];
|
|
76
|
-
}
|
|
77
|
-
export { services };
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Matches state names using glob-like pattern strings.
|
|
3
|
-
*
|
|
4
|
-
* Globs can be used in specific APIs including:
|
|
5
|
-
*
|
|
6
|
-
* - [[StateService.is]]
|
|
7
|
-
* - [[StateService.includes]]
|
|
8
|
-
* - The first argument to Hook Registration functions like [[TransitionService.onStart]]
|
|
9
|
-
* - [[HookMatchCriteria]] and [[HookMatchCriterion]]
|
|
10
|
-
*
|
|
11
|
-
* A `Glob` string is a pattern which matches state names.
|
|
12
|
-
* Nested state names are split into segments (separated by a dot) when processing.
|
|
13
|
-
* The state named `foo.bar.baz` is split into three segments ['foo', 'bar', 'baz']
|
|
14
|
-
*
|
|
15
|
-
* Globs work according to the following rules:
|
|
16
|
-
*
|
|
17
|
-
* ### Exact match:
|
|
18
|
-
*
|
|
19
|
-
* The glob `'A.B'` matches the state named exactly `'A.B'`.
|
|
20
|
-
*
|
|
21
|
-
* | Glob |Matches states named|Does not match state named|
|
|
22
|
-
* |:------------|:--------------------|:---------------------|
|
|
23
|
-
* | `'A'` | `'A'` | `'B'` , `'A.C'` |
|
|
24
|
-
* | `'A.B'` | `'A.B'` | `'A'` , `'A.B.C'` |
|
|
25
|
-
* | `'foo'` | `'foo'` | `'FOO'` , `'foo.bar'`|
|
|
26
|
-
*
|
|
27
|
-
* ### Single star (`*`)
|
|
28
|
-
*
|
|
29
|
-
* A single star (`*`) is a wildcard that matches exactly one segment.
|
|
30
|
-
*
|
|
31
|
-
* | Glob |Matches states named |Does not match state named |
|
|
32
|
-
* |:------------|:---------------------|:--------------------------|
|
|
33
|
-
* | `'*'` | `'A'` , `'Z'` | `'A.B'` , `'Z.Y.X'` |
|
|
34
|
-
* | `'A.*'` | `'A.B'` , `'A.C'` | `'A'` , `'A.B.C'` |
|
|
35
|
-
* | `'A.*.*'` | `'A.B.C'` , `'A.X.Y'`| `'A'`, `'A.B'` , `'Z.Y.X'`|
|
|
36
|
-
*
|
|
37
|
-
* ### Double star (`**`)
|
|
38
|
-
*
|
|
39
|
-
* A double star (`'**'`) is a wildcard that matches *zero or more segments*
|
|
40
|
-
*
|
|
41
|
-
* | Glob |Matches states named |Does not match state named |
|
|
42
|
-
* |:------------|:----------------------------------------------|:----------------------------------|
|
|
43
|
-
* | `'**'` | `'A'` , `'A.B'`, `'Z.Y.X'` | (matches all states) |
|
|
44
|
-
* | `'A.**'` | `'A'` , `'A.B'` , `'A.C.X'` | `'Z.Y.X'` |
|
|
45
|
-
* | `'**.X'` | `'X'` , `'A.X'` , `'Z.Y.X'` | `'A'` , `'A.login.Z'` |
|
|
46
|
-
* | `'A.**.X'` | `'A.X'` , `'A.B.X'` , `'A.B.C.X'` | `'A'` , `'A.B.C'` |
|
|
47
|
-
*
|
|
48
|
-
* @packageDocumentation
|
|
49
|
-
*/
|
|
50
|
-
export declare class Glob {
|
|
51
|
-
text: string;
|
|
52
|
-
glob: Array<string>;
|
|
53
|
-
regexp: RegExp;
|
|
54
|
-
/** Returns true if the string has glob-like characters in it */
|
|
55
|
-
static is(text: string): boolean;
|
|
56
|
-
/** Returns a glob from the string, or null if the string isn't Glob-like */
|
|
57
|
-
static fromString(text: string): Glob;
|
|
58
|
-
constructor(text: string);
|
|
59
|
-
matches(name: string): boolean;
|
|
60
|
-
}
|