@angular-wave/angular.ts 0.18.0 → 0.19.0

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 (107) hide show
  1. package/@types/angular.d.ts +18 -6
  2. package/@types/animations/animate-css-driver.d.ts +2 -2
  3. package/@types/animations/animate-js-driver.d.ts +11 -1
  4. package/@types/animations/animate-js.d.ts +10 -2
  5. package/@types/animations/animate-swap.d.ts +4 -1
  6. package/@types/animations/animate.d.ts +11 -5
  7. package/@types/animations/animation.d.ts +7 -0
  8. package/@types/animations/css/animate-css.d.ts +16 -0
  9. package/@types/animations/interface.d.ts +308 -19
  10. package/@types/animations/queue/animate-queue.d.ts +16 -7
  11. package/@types/animations/queue/interface.d.ts +14 -7
  12. package/@types/core/compile/attributes.d.ts +1 -1
  13. package/@types/core/compile/compile.d.ts +25 -15
  14. package/@types/core/compile/interface.d.ts +209 -34
  15. package/@types/core/controller/controller.d.ts +30 -38
  16. package/@types/core/controller/interface.d.ts +12 -3
  17. package/@types/core/parse/interface.d.ts +2 -2
  18. package/@types/core/parse/interpreter.d.ts +110 -58
  19. package/@types/core/scope/interface.d.ts +6 -0
  20. package/@types/core/scope/scope.d.ts +2 -1
  21. package/@types/directive/aria/aria.d.ts +66 -26
  22. package/@types/directive/aria/interface.d.ts +9 -0
  23. package/@types/directive/class/class.d.ts +31 -0
  24. package/@types/directive/form/form.d.ts +54 -18
  25. package/@types/directive/input/input.d.ts +59 -18
  26. package/@types/directive/input/interface.d.ts +10 -0
  27. package/@types/directive/messages/messages.d.ts +63 -12
  28. package/@types/directive/model/interface.d.ts +19 -0
  29. package/@types/directive/model/model.d.ts +70 -33
  30. package/@types/directive/model-options/model-options.d.ts +1 -23
  31. package/@types/directive/repeat/repeat.d.ts +2 -3
  32. package/@types/directive/validators/validators.d.ts +1 -5
  33. package/@types/directive/worker/interface.d.ts +9 -0
  34. package/@types/docs.d.ts +24 -0
  35. package/@types/filters/json.d.ts +4 -0
  36. package/@types/interface.d.ts +22 -69
  37. package/@types/namespace.d.ts +66 -40
  38. package/@types/router/common/trace.d.ts +150 -42
  39. package/@types/router/directives/state-directives.d.ts +4 -4
  40. package/@types/router/directives/view-directive.d.ts +2 -5
  41. package/@types/router/hooks/core-resolvables.d.ts +11 -2
  42. package/@types/router/hooks/ignored-transition.d.ts +3 -1
  43. package/@types/router/hooks/invalid-transition.d.ts +3 -1
  44. package/@types/router/hooks/lazy-load.d.ts +17 -13
  45. package/@types/router/hooks/on-enter-exit-retain.d.ts +9 -3
  46. package/@types/router/hooks/redirect-to.d.ts +3 -3
  47. package/@types/router/hooks/resolve.d.ts +11 -3
  48. package/@types/router/hooks/views.d.ts +6 -4
  49. package/@types/router/params/interface.d.ts +3 -2
  50. package/@types/router/params/param-factory.d.ts +24 -3
  51. package/@types/router/params/param-type.d.ts +47 -11
  52. package/@types/router/params/param-types.d.ts +52 -0
  53. package/@types/router/params/param.d.ts +52 -28
  54. package/@types/router/params/state-params.d.ts +5 -3
  55. package/@types/router/path/interface.d.ts +3 -0
  56. package/@types/router/path/path-node.d.ts +34 -14
  57. package/@types/router/path/path-utils.d.ts +75 -25
  58. package/@types/router/resolve/resolvable.d.ts +34 -7
  59. package/@types/router/resolve/resolve-context.d.ts +52 -34
  60. package/@types/router/router.d.ts +10 -12
  61. package/@types/router/state/interface.d.ts +194 -31
  62. package/@types/router/state/state-builder.d.ts +29 -29
  63. package/@types/router/state/state-matcher.d.ts +29 -11
  64. package/@types/router/state/state-object.d.ts +67 -21
  65. package/@types/router/state/state-queue-manager.d.ts +19 -10
  66. package/@types/router/state/state-registry.d.ts +80 -28
  67. package/@types/router/state/state-service.d.ts +182 -123
  68. package/@types/router/state/target-state.d.ts +36 -27
  69. package/@types/router/state/views.d.ts +48 -19
  70. package/@types/router/template-factory.d.ts +8 -15
  71. package/@types/router/transition/hook-builder.d.ts +17 -6
  72. package/@types/router/transition/hook-registry.d.ts +80 -46
  73. package/@types/router/transition/interface.d.ts +138 -118
  74. package/@types/router/transition/reject-factory.d.ts +58 -22
  75. package/@types/router/transition/transition-event-type.d.ts +19 -8
  76. package/@types/router/transition/transition-hook.d.ts +50 -29
  77. package/@types/router/transition/transition-service.d.ts +186 -30
  78. package/@types/router/transition/transition.d.ts +201 -70
  79. package/@types/router/url/interface.d.ts +140 -0
  80. package/@types/router/url/url-config.d.ts +19 -16
  81. package/@types/router/url/url-matcher.d.ts +66 -46
  82. package/@types/router/url/url-rule.d.ts +58 -35
  83. package/@types/router/url/url-rules.d.ts +38 -28
  84. package/@types/router/url/url-service.d.ts +68 -41
  85. package/@types/router/view/interface.d.ts +10 -30
  86. package/@types/router/view/view.d.ts +35 -21
  87. package/@types/services/anchor-scroll/interface.d.ts +1 -1
  88. package/@types/services/http/http.d.ts +19 -22
  89. package/@types/services/http/interface.d.ts +11 -23
  90. package/@types/services/location/interface.d.ts +1 -4
  91. package/@types/services/location/location.d.ts +13 -13
  92. package/@types/services/sce/sce.d.ts +14 -8
  93. package/@types/services/template-request/template-request.d.ts +21 -4
  94. package/@types/shared/common.d.ts +5 -32
  95. package/@types/shared/dom.d.ts +10 -5
  96. package/@types/shared/interface.d.ts +4 -0
  97. package/@types/shared/utils.d.ts +17 -6
  98. package/dist/angular-ts.esm.js +6424 -2850
  99. package/dist/angular-ts.umd.js +6424 -2850
  100. package/dist/angular-ts.umd.min.js +1 -1
  101. package/dist/angular-ts.umd.min.js.gz +0 -0
  102. package/dist/angular-ts.umd.min.js.map +1 -1
  103. package/package.json +1 -2
  104. package/@types/animations/animate-css.d.ts +0 -11
  105. package/@types/filters/filters.d.ts +0 -38
  106. package/@types/router/hooks/update-globals.d.ts +0 -1
  107. package/@types/router/hooks/url.d.ts +0 -5
@@ -15,12 +15,15 @@ export class UrlService {
15
15
  globals: import("../router.js").RouterProvider,
16
16
  urlConfigProvider: import("../../router/url/url-config.js").UrlConfigProvider,
17
17
  );
18
- /** @type {ng.LocationService} */
19
- $location: ng.LocationService;
18
+ /** @type {ng.LocationService | undefined} */
19
+ $location: ng.LocationService | undefined;
20
20
  /** @private */
21
21
  private _locationProvider;
22
22
  stateService: import("../../router/state/state-service.js").StateProvider;
23
- /** @type {UrlRuleFactory} Provides services related to the URL */
23
+ /**
24
+ * @type {UrlRuleFactory} Provides services related to the URL
25
+ * @ignore
26
+ */
24
27
  _urlRuleFactory: UrlRuleFactory;
25
28
  /**
26
29
  * The nested [[UrlRules]] API for managing URL rules and rewrites
@@ -30,12 +33,20 @@ export class UrlService {
30
33
  _rules: UrlRules;
31
34
  /**
32
35
  * The nested [[UrlConfig]] API to configure the URL and retrieve URL information
36
+ * @ignore
33
37
  * @type {import("./url-config.js").UrlConfigProvider}
34
38
  */
35
39
  _config: import("./url-config.js").UrlConfigProvider;
36
- /** @type {ParamFactory} Creates a new [[Param]] for a given location (DefType) */
40
+ /**
41
+ * @type {ParamFactory} Creates a new [[Param]] for a given location (DefType)
42
+ * @ignore
43
+ */
37
44
  _paramFactory: ParamFactory;
38
- _urlListeners: any[];
45
+ /**
46
+ * @type {((evt: ng.ScopeEvent) => void)[]}
47
+ * @ignore
48
+ */
49
+ _urlListeners: ((evt: ng.ScopeEvent) => void)[];
39
50
  /**
40
51
  * Gets the path part of the current url
41
52
  *
@@ -136,8 +147,8 @@ export class UrlService {
136
147
  * let deregisterFn = locationServices.onChange((evt) => console.log("url change", evt));
137
148
  * ```
138
149
  *
139
- * @param {Function} callback a function that will be called when the url is changing
140
- * @return {Function} a function that de-registers the callback
150
+ * @param {(evt: ng.ScopeEvent) => void} callback a function that will be called when the url is changing
151
+ * @return {() => void} a function that de-registers the callback
141
152
  */
142
153
  private onChange;
143
154
  /**
@@ -167,8 +178,11 @@ export class UrlService {
167
178
  * urlService.sync();
168
179
  * });
169
180
  * ```
181
+ * @param {import("../../core/scope/interface.ts").ScopeEvent | undefined} [evt]
170
182
  */
171
- sync(evt: any): void;
183
+ sync(
184
+ evt?: import("../../core/scope/interface.ts").ScopeEvent | undefined,
185
+ ): void;
172
186
  /**
173
187
  * Starts or stops listening for URL changes
174
188
  *
@@ -193,62 +207,75 @@ export class UrlService {
193
207
  listen(enabled: boolean): any;
194
208
  _stopListeningFn: any;
195
209
  /**
196
- * Matches a URL
197
- *
198
210
  * Given a URL (as a [[UrlParts]] object), check all rules and determine the best matching rule.
199
211
  * Return the result as a [[MatchResult]].
212
+ * @param {import("../../docs.ts").UrlParts} url
200
213
  * @returns {any}
201
214
  */
202
- match(url: any): any;
203
- update(read: any): void;
215
+ match(url: import("../../docs.ts").UrlParts): any;
216
+ /**
217
+ * @param {boolean | undefined} [read]
218
+ */
219
+ update(read?: boolean | undefined): void;
204
220
  location: string;
205
221
  /**
206
222
  * Internal API.
207
223
  *
208
224
  * Pushes a new location to the browser history.
209
- *
210
225
  * @internal
211
- * @param urlMatcher
212
- * @param params
213
- * @param options
226
+ * @param {{ format: (arg0: any) => string | undefined; }} urlMatcher
227
+ * @param {import("../params/state-params.js").StateParams} params
228
+ * @param {string} options
214
229
  */
215
- push(urlMatcher: any, params: any, options: any): void;
230
+ push(
231
+ urlMatcher: {
232
+ format: (arg0: any) => string | undefined;
233
+ },
234
+ params: import("../params/state-params.js").StateParams,
235
+ options: string,
236
+ ): void;
216
237
  /**
217
- * Builds and returns a URL with interpolated parameters
218
- *
219
- * #### Example:
220
- * ```js
221
- * matcher = $umf.compile("/about/:person");
222
- * params = { person: "bob" };
223
- * $bob = $url.href(matcher, params);
224
- * // $bob == "/about/bob";
225
- * ```
226
- *
227
- * @param urlMatcher The [[UrlMatcher]] object which is used as the template of the URL to generate.
228
- * @param params An object of parameter values to fill the matcher's required parameters.
229
- * @param options Options object. The options are:
230
- *
231
- * - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. "http://www.example.com/fullurl".
232
- *
233
- * @returns Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`
234
- */
235
- href(urlMatcher: any, params: any, options: any): any;
238
+ * Builds and returns a URL with interpolated parameters
239
+ *
240
+ * #### Example:
241
+ * ```js
242
+ * matcher = $umf.compile("/about/:person");
243
+ * params = { person: "bob" };
244
+ * $bob = $url.href(matcher, params);
245
+ * // $bob == "/about/bob";
246
+ * ```
247
+ * @param {{ format: (arg0: any) => any; }} urlMatcher The [[UrlMatcher]] object which is used as the template of the URL to generate.
248
+ * @param {Object} params An object of parameter values to fill the matcher's required parameters.
249
+ * @param {{ absolute: any; }} options Options object. The options are:
250
+
251
+ - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. "http://www.example.com/fullurl".
252
+ * @returns Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`
253
+ */
254
+ href(
255
+ urlMatcher: {
256
+ format: (arg0: any) => any;
257
+ },
258
+ params: any,
259
+ options: {
260
+ absolute: any;
261
+ },
262
+ ): any;
236
263
  /**
237
264
  * Creates a [[UrlMatcher]] for the specified pattern.
238
265
  *
239
- * @param urlPattern The URL pattern.
240
- * @param config The config object hash.
266
+ * @param {string} urlPattern The URL pattern.
267
+ * @param {*} [config] The config object hash.
241
268
  * @returns The UrlMatcher.
242
269
  */
243
- compile(urlPattern: any, config: any): UrlMatcher;
270
+ compile(urlPattern: string, config?: any): UrlMatcher;
244
271
  /**
245
272
  * Returns true if the specified object is a [[UrlMatcher]], or false otherwise.
246
273
  *
247
- * @param object The object to perform the type check against.
274
+ * @param {UrlMatcher & Record<string, any>} object The object to perform the type check against.
248
275
  * @returns `true` if the object matches the `UrlMatcher` interface, by
249
276
  * implementing all the same methods.
250
277
  */
251
- isMatcher(object: any): boolean;
278
+ isMatcher(object: UrlMatcher & Record<string, any>): boolean;
252
279
  }
253
280
  import { UrlRuleFactory } from "./url-rule.js";
254
281
  import { UrlRules } from "./url-rules.js";
@@ -1,5 +1,4 @@
1
- import { ViewDeclaration } from "../state/interface.ts";
2
- import { PathNode } from "../path/path-node.js";
1
+ import { ViewConfig } from "../state/views.js";
3
2
  /** The context ref can be anything that has a `name` and a `parent` reference to another IContextRef */
4
3
  export interface ViewContext {
5
4
  name: string;
@@ -8,37 +7,18 @@ export interface ViewContext {
8
7
  export interface ActiveUIView {
9
8
  /** An auto-incremented id */
10
9
  id: number;
11
- /** The ui-view short name */
10
+ /** The ng-view short name */
12
11
  name: string;
13
- /** The ui-view's fully qualified name */
12
+ /** The ng-view's fully qualified name */
14
13
  fqn: string;
15
- /** The ViewConfig that is currently loaded into the ui-view */
16
- config: ViewConfig;
17
- /** The state context in which the ui-view tag was created. */
14
+ /** The ViewConfig that is currently loaded into the ng-view */
15
+ config: ViewConfig | null;
16
+ /** The state context in which the ng-view tag was created. */
18
17
  creationContext: ViewContext;
19
- /** A callback that should apply a ViewConfig (or clear the ui-view, if config is undefined) */
18
+ /** A callback that should apply a ViewConfig (or clear the ng-view, if config is undefined) */
20
19
  configUpdated: (config: ViewConfig) => void;
21
20
  }
22
- /**
23
- * This interface represents a [[_ViewDeclaration]] that is bound to a [[PathNode]].
24
- *
25
- * A `ViewConfig` is the runtime definition of a single view.
26
- *
27
- * During a transition, `ViewConfig`s are created for each [[_ViewDeclaration]] defined on each "entering" [[StateObject]].
28
- * Then, the [[ViewService]] finds any matching `ui-view`(s) in the DOM, and supplies the ui-view
29
- * with the `ViewConfig`. The `ui-view` then loads itself using the information found in the `ViewConfig`.
30
- *
31
- * A `ViewConfig` if matched with a `ui-view` by finding all `ui-view`s which were created in the
32
- * context named by the `uiViewContextAnchor`, and finding the `ui-view` or child `ui-view` that matches
33
- * the `uiViewName` address.
34
- */
35
- export interface ViewConfig {
36
- $id: number;
37
- /** The normalized view declaration from [[State.views]] */
38
- viewDecl: ViewDeclaration;
39
- /** The node the ViewConfig is bound to */
40
- path: PathNode[];
41
- loaded: boolean;
42
- /** Fetches templates, runs dynamic (controller|template)Provider code, lazy loads Components, etc */
43
- load(): Promise<ViewConfig>;
21
+ export interface ViewTuple {
22
+ ngView: ActiveUIView | undefined;
23
+ viewConfig: ViewConfig;
44
24
  }
@@ -1,7 +1,20 @@
1
1
  export class ViewService {
2
+ /**
3
+ * @type {any[]}
4
+ */
2
5
  _ngViews: any[];
6
+ /**
7
+ * @type {any[]}
8
+ */
3
9
  _viewConfigs: any[];
10
+ /**
11
+ * @type {any[]}
12
+ */
4
13
  _listeners: any[];
14
+ _viewConfigFactory: (
15
+ path: import("../path/path-node.js").PathNode[],
16
+ view: import("../state/interface.ts").ViewDeclaration,
17
+ ) => import("../state/views.js").ViewConfig;
5
18
  $get: () => this;
6
19
  /**
7
20
  * @param {?import('../state/state-object.js').StateObject} [context]
@@ -11,15 +24,14 @@ export class ViewService {
11
24
  context?: import("../state/state-object.js").StateObject | null,
12
25
  ): import("../state/state-object.js").StateObject | null;
13
26
  _rootContext: any;
14
- _viewConfigFactory(factory: any): void;
15
27
  /**
16
- * @param path
17
- * @param decl
28
+ * @param {import("../path/path-node.js").PathNode[]} path
29
+ * @param {import("../state/interface.ts").ViewDeclaration} decl
18
30
  * @return {import("../state/views.js").ViewConfig}
19
31
  */
20
32
  _createViewConfig(
21
- path: any,
22
- decl: any,
33
+ path: import("../path/path-node.js").PathNode[],
34
+ decl: import("../state/interface.ts").ViewDeclaration,
23
35
  ): import("../state/views.js").ViewConfig;
24
36
  /**
25
37
  * Deactivates a ViewConfig.
@@ -27,10 +39,13 @@ export class ViewService {
27
39
  * This function deactivates a `ViewConfig`.
28
40
  * After calling [[sync]], it will un-pair from any `ng-view` with which it is currently paired.
29
41
  *
30
- * @param viewConfig The ViewConfig view to deregister.
42
+ * @param {ViewConfig} viewConfig The ViewConfig view to deregister.
43
+ */
44
+ deactivateViewConfig(viewConfig: ViewConfig): void;
45
+ /**
46
+ * @param {ViewConfig} viewConfig
31
47
  */
32
- deactivateViewConfig(viewConfig: any): void;
33
- activateViewConfig(viewConfig: any): void;
48
+ activateViewConfig(viewConfig: ViewConfig): void;
34
49
  sync(): void;
35
50
  /**
36
51
  * Registers a `ng-view` component
@@ -43,23 +58,22 @@ export class ViewService {
43
58
  *
44
59
  * Note: There is no corresponding `deregisterUIView`.
45
60
  * A `ng-view` should hang on to the return value of `registerUIView` and invoke it to deregister itself.
46
- *
47
- * @param ngView The metadata for a UIView
48
- * @return a de-registration function used when the view is destroyed.
61
+ * @param {import("./interface.ts").ActiveUIView} ngView The metadata for a UIView
62
+ * @return {() => void} a de-registration function used when the view is destroyed.
49
63
  */
50
- registerUIView(ngView: any): () => void;
64
+ registerUIView(ngView: import("./interface.ts").ActiveUIView): () => void;
51
65
  /**
52
66
  * Returns the list of views currently available on the page, by fully-qualified name.
53
67
  *
54
- * @return {Array<any>} Returns an array of fully-qualified view names.
68
+ * @return {Array<string>} Returns an array of fully-qualified view names.
55
69
  */
56
- available(): Array<any>;
70
+ available(): Array<string>;
57
71
  /**
58
72
  * Returns the list of views on the page containing loaded content.
59
73
  *
60
- * @return {Array<any>} Returns an array of fully-qualified view names.
74
+ * @return {Array<string>} Returns an array of fully-qualified view names.
61
75
  */
62
- active(): Array<any>;
76
+ active(): Array<string>;
63
77
  }
64
78
  export namespace ViewService {
65
79
  /**
@@ -71,8 +85,6 @@ export namespace ViewService {
71
85
  * A ViewConfig has a target ng-view name and a context anchor. The ng-view name can be a simple name, or
72
86
  * can be a segmented ng-view path, describing a portion of a ng-view fqn.
73
87
  *
74
- * In order for a ng-view to match ViewConfig, ng-view's $type must match the ViewConfig's $type
75
- *
76
88
  * If the ViewConfig's target ng-view name is a simple name (no dots), then a ng-view matches if:
77
89
  * - the ng-view's name matches the ViewConfig's target name
78
90
  * - the ng-view's context matches the ViewConfig's anchor
@@ -120,7 +132,9 @@ export namespace ViewService {
120
132
  * @internal
121
133
  */
122
134
  function matches(
123
- ngViewsByFqn: any,
124
- ngView: any,
125
- ): (viewConfig: any) => boolean;
135
+ ngViewsByFqn: import("../../shared/interface.ts").Dict<ActiveUIView>,
136
+ ngView: ActiveUIView,
137
+ ): (/** @type {ViewConfig} */ viewConfig: ViewConfig) => boolean;
126
138
  }
139
+ export type ActiveUIView = import("./interface.ts").ActiveUIView;
140
+ export type ViewConfig = import("../state/views.js").ViewConfig;
@@ -2,7 +2,7 @@ export interface AnchorScrollService {
2
2
  /**
3
3
  * Invoke anchor scrolling.
4
4
  */
5
- (hash?: string | number): void;
5
+ (hashOrElement?: string | number | HTMLElement): void;
6
6
  /**
7
7
  * Vertical scroll offset.
8
8
  * Can be a number, a function returning a number,
@@ -17,7 +17,14 @@ export class HttpParamSerializerProvider {
17
17
  */
18
18
  $get: () => import("./interface.ts").HttpParamSerializer;
19
19
  }
20
- export function defaultHttpResponseTransform(data: any, headers: any): any;
20
+ /**
21
+ * @param {unknown} data
22
+ * @param {(arg0: string) => any} headers
23
+ */
24
+ export function defaultHttpResponseTransform(
25
+ data: unknown,
26
+ headers: (arg0: string) => any,
27
+ ): unknown;
21
28
  /**
22
29
  * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service.
23
30
  */
@@ -98,17 +105,7 @@ export class HttpProvider {
98
105
  $injector: ng.InjectorService,
99
106
  $sce: ng.SceService,
100
107
  $cookie: ng.CookieService,
101
- ) => {
102
- (requestConfig: any): Promise<any>;
103
- pendingRequests: any[];
104
- /**
105
- * Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of
106
- * default headers, withCredentials as well as request and response transformations.
107
- *
108
- * See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above.
109
- */
110
- defaults: import("./interface.ts").HttpProviderDefaults;
111
- })
108
+ ) => ng.HttpService)
112
109
  )[];
113
110
  }
114
111
  /**
@@ -117,13 +114,13 @@ export class HttpProvider {
117
114
  * @param {string} method - The HTTP method (e.g., "GET", "POST").
118
115
  * @param {string} [url] - The URL to send the request to. Defaults to the current page URL.
119
116
  * @param {*} [post] - The body to send with the request, if any.
120
- * @param {function(number, any, string|null, string, string): void} [callback] - Callback invoked when the request completes.
117
+ * @param {(status: number, response: any, headersString: string|null, statusText: string, xhrStatus: import("./interface.ts").HttpResponseStatus) => void} [callback] - Callback invoked when the request completes.
121
118
  * @param {Object<string, string|undefined>} [headers] - Headers to set on the request.
122
119
  * @param {number|Promise<any>} [timeout] - Timeout in ms or a cancellable promise.
123
120
  * @param {boolean} [withCredentials] - Whether to send credentials with the request.
124
121
  * @param {XMLHttpRequestResponseType} [responseType] - The type of data expected in the response.
125
- * @param {Record<string, EventListener>} [eventHandlers] - Event listeners for the XMLHttpRequest object.
126
- * @param {Record<string, EventListener>} [uploadEventHandlers] - Event listeners for the XMLHttpRequest.upload object.
122
+ * @param {ng.RequestConfig["eventHandlers"]} [eventHandlers] - Event listeners for the XMLHttpRequest object.
123
+ * @param {ng.RequestConfig["uploadEventHandlers"]} [uploadEventHandlers] - Event listeners for the XMLHttpRequest.upload object.
127
124
  * @returns {void}
128
125
  */
129
126
  export function http(
@@ -131,11 +128,11 @@ export function http(
131
128
  url?: string,
132
129
  post?: any,
133
130
  callback?: (
134
- arg0: number,
135
- arg1: any,
136
- arg2: string | null,
137
- arg3: string,
138
- arg4: string,
131
+ status: number,
132
+ response: any,
133
+ headersString: string | null,
134
+ statusText: string,
135
+ xhrStatus: import("./interface.ts").HttpResponseStatus,
139
136
  ) => void,
140
137
  headers?: {
141
138
  [x: string]: string;
@@ -143,8 +140,8 @@ export function http(
143
140
  timeout?: number | Promise<any>,
144
141
  withCredentials?: boolean,
145
142
  responseType?: XMLHttpRequestResponseType,
146
- eventHandlers?: Record<string, EventListener>,
147
- uploadEventHandlers?: Record<string, EventListener>,
143
+ eventHandlers?: ng.RequestConfig["eventHandlers"],
144
+ uploadEventHandlers?: ng.RequestConfig["uploadEventHandlers"],
148
145
  ): void;
149
146
  export type Http = number;
150
147
  export namespace Http {
@@ -1,17 +1,10 @@
1
+ import { Dict } from "../../shared/interface.ts";
1
2
  export interface HttpHeadersGetter {
2
3
  (): {
3
4
  [name: string]: string;
4
5
  };
5
6
  (headerName: string): string;
6
7
  }
7
- export interface HttpPromiseCallback<T> {
8
- (
9
- data: T,
10
- status: number,
11
- headers: HttpHeadersGetter,
12
- config: RequestConfig,
13
- ): void;
14
- }
15
8
  export interface HttpRequestConfigHeaders {
16
9
  [requestType: string]: any;
17
10
  common?: any;
@@ -71,7 +64,8 @@ export interface HttpProviderDefaults {
71
64
  /** Name of cookie containing the XSRF token. */
72
65
  xsrfCookieName?: string | undefined;
73
66
  /**
74
- * whether to to set the withCredentials flag on the XHR object. See [requests with credentials]https://developer.mozilla.org/en/http_access_control#section_5 for more information.
67
+ * whether to to set the withCredentials flag on the XHR object.
68
+ * See [requests with credentials](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS#requests_with_credentials) for more information.
75
69
  */
76
70
  withCredentials?: boolean | undefined;
77
71
  /**
@@ -88,7 +82,8 @@ export interface HttpProviderDefaults {
88
82
  export interface RequestShortcutConfig extends HttpProviderDefaults {
89
83
  /**
90
84
  * {Object.<string|Object>}
91
- * Map of strings or objects which will be turned to ?key1=value1&key2=value2 after the url. If the value is not a string, it will be JSONified.
85
+ * Map of strings or objects which will be turned to ?key1=value1&key2=value2 after the url.
86
+ * If the value is not a string, it will be JSONified.
92
87
  */
93
88
  params?: any;
94
89
  /**
@@ -101,7 +96,7 @@ export interface RequestShortcutConfig extends HttpProviderDefaults {
101
96
  */
102
97
  timeout?: number | Promise<any> | undefined;
103
98
  /**
104
- * See [XMLHttpRequest.responseType]https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype
99
+ * See [XMLHttpRequest.responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype)
105
100
  */
106
101
  responseType?: string | undefined;
107
102
  }
@@ -113,7 +108,7 @@ export interface RequestConfig extends RequestShortcutConfig {
113
108
  /**
114
109
  * HTTP method (e.g. 'GET', 'POST', etc)
115
110
  */
116
- method: string;
111
+ method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS";
117
112
  /**
118
113
  * Absolute or relative URL of the resource that is being requested.
119
114
  */
@@ -122,20 +117,12 @@ export interface RequestConfig extends RequestShortcutConfig {
122
117
  * Event listeners to be bound to the XMLHttpRequest object.
123
118
  * To bind events to the XMLHttpRequest upload object, use uploadEventHandlers. The handler will be called in the context of a $apply block.
124
119
  */
125
- eventHandlers?:
126
- | {
127
- [type: string]: EventListenerOrEventListenerObject;
128
- }
129
- | undefined;
120
+ eventHandlers?: Dict<EventListenerOrEventListenerObject>;
130
121
  /**
131
122
  * Event listeners to be bound to the XMLHttpRequest upload object.
132
123
  * To bind events to the XMLHttpRequest object, use eventHandlers. The handler will be called in the context of a $apply block.
133
124
  */
134
- uploadEventHandlers?:
135
- | {
136
- [type: string]: EventListenerOrEventListenerObject;
137
- }
138
- | undefined;
125
+ uploadEventHandlers?: Dict<EventListenerOrEventListenerObject>;
139
126
  }
140
127
  export type HttpResponseStatus = "complete" | "error" | "timeout" | "abort";
141
128
  export interface HttpResponse<T> {
@@ -148,7 +135,7 @@ export interface HttpResponse<T> {
148
135
  }
149
136
  export type HttpPromise<T> = Promise<HttpResponse<T>>;
150
137
  /**
151
- * HttpService
138
+ * $http service interface
152
139
  */
153
140
  export interface HttpService {
154
141
  /**
@@ -243,3 +230,4 @@ export interface HttpInterceptor {
243
230
  export interface HttpInterceptorFactory {
244
231
  (...args: any[]): HttpInterceptor;
245
232
  }
233
+ export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD";
@@ -52,10 +52,7 @@ export interface UrlParts {
52
52
  * The parsed query string as an object.
53
53
  * Mirrors AngularJS’s `$location.setSearch()` format.
54
54
  */
55
- search: Record<
56
- string,
57
- string | number | boolean | (string | number | boolean)[]
58
- >;
55
+ search: Object;
59
56
  /**
60
57
  * The fragment identifier (everything after `#`, not including the `#` itself).
61
58
  */
@@ -161,6 +161,18 @@ export class Location {
161
161
  html5?: boolean,
162
162
  prefix?: string,
163
163
  );
164
+ /**
165
+ * @ignore
166
+ * Current url
167
+ * @type {string | undefined}
168
+ */
169
+ _url: string | undefined;
170
+ /**
171
+ * @ignore
172
+ * Callback to update browser url
173
+ * @type {Function | undefined}
174
+ */
175
+ _updateBrowser: Function | undefined;
164
176
  /** @type {string} */
165
177
  appBase: string;
166
178
  /** @type {string} */
@@ -177,18 +189,6 @@ export class Location {
177
189
  * @type {string}
178
190
  */
179
191
  absUrl: string;
180
- /**
181
- * @ignore
182
- * Current url
183
- * @type {string}
184
- */
185
- _url: string;
186
- /**
187
- * @ignore
188
- * Callback to update browser url
189
- * @type {Function | undefined}
190
- */
191
- _updateBrowser: Function | undefined;
192
192
  /**
193
193
  * Change path, search and hash, when called with parameter and return `$location`.
194
194
  *
@@ -324,7 +324,7 @@ export class LocationProvider {
324
324
  | string
325
325
  | ((
326
326
  $rootScope: ng.Scope,
327
- $rootElement: Element,
327
+ $rootElement: HTMLElement,
328
328
  $exceptionHandler: ng.ExceptionHandlerService,
329
329
  ) => Location)
330
330
  )[];
@@ -1,4 +1,7 @@
1
- export function escapeForRegexp(str: any): any;
1
+ /**
2
+ * @param {string} str
3
+ */
4
+ export function escapeForRegexp(str: string): string;
2
5
  /**
3
6
  * Adjusts a matcher string or RegExp into a proper RegExp.
4
7
  *
@@ -114,13 +117,13 @@ export namespace SCE_CONTEXTS {
114
117
  export class SceDelegateProvider {
115
118
  /**
116
119
  *
117
- * @param {Array=} value When provided, replaces the trustedResourceUrlList with
120
+ * @param {(Array<RegExp | "self"> | null)=} value When provided, replaces the trustedResourceUrlList with
118
121
  * the value provided. This must be an array or null. A snapshot of this array is used so
119
122
  * further changes to the array are ignored.
120
123
  * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
121
124
  * allowed in this array.
122
125
  *
123
- * @return {Array<any>} The currently set trusted resource URL array.
126
+ * @return {Array<RegExp | "self">} The currently set trusted resource URL array.
124
127
  *
125
128
  *
126
129
  * Sets/Gets the list trusted of resource URLs.
@@ -134,12 +137,12 @@ export class SceDelegateProvider {
134
137
  * </div>
135
138
  */
136
139
  trustedResourceUrlList: (
137
- value?: any[] | undefined,
140
+ value?: (Array<RegExp | "self"> | null) | undefined,
138
141
  ...args: any[]
139
- ) => Array<any>;
142
+ ) => Array<RegExp | "self">;
140
143
  /**
141
144
  *
142
- * @param {Array=} bannedResourceUrlList When provided, replaces the `bannedResourceUrlList` with
145
+ * @param {(Array<RegExp | "self"> | null)=} value When provided, replaces the `bannedResourceUrlList` with
143
146
  * the value provided. This must be an array or null. A snapshot of this array is used so
144
147
  * further changes to the array are ignored.</p><p>
145
148
  * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
@@ -151,7 +154,7 @@ export class SceDelegateProvider {
151
154
  * Finally, **the banned resource URL list overrides the trusted resource URL list** and has
152
155
  * the final say.
153
156
  *
154
- * @return {Array<any>} The currently set `bannedResourceUrlList` array.
157
+ * @return {Array<RegExp | "self">} The currently set `bannedResourceUrlList` array.
155
158
  *
156
159
  *
157
160
  * Sets/Gets the `bannedResourceUrlList` of trusted resource URLs.
@@ -159,7 +162,10 @@ export class SceDelegateProvider {
159
162
  * The **default value** when no trusted resource URL list has been explicitly set is the empty
160
163
  * array (i.e. there is no `bannedResourceUrlList`.)
161
164
  */
162
- bannedResourceUrlList: (value: any, ...args: any[]) => Array<any>;
165
+ bannedResourceUrlList: (
166
+ value?: (Array<RegExp | "self"> | null) | undefined,
167
+ ...args: any[]
168
+ ) => Array<RegExp | "self">;
163
169
  $get: (
164
170
  | string
165
171
  | ((