@angular-wave/angular.ts 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/dist/angular-ts.esm.js +2 -2
  2. package/dist/angular-ts.umd.js +2 -2
  3. package/package.json +1 -1
  4. package/src/animations/animate-cache.js +1 -1
  5. package/src/animations/animate-css-driver.js +2 -2
  6. package/src/animations/animate-css.js +1 -1
  7. package/src/animations/animate-js-driver.js +2 -2
  8. package/src/animations/animate-js.js +2 -2
  9. package/src/animations/animate-queue.js +2 -2
  10. package/src/animations/animation.js +1 -1
  11. package/src/core/cache/cache-factory.js +18 -2
  12. package/src/core/compile/compile.js +9 -11
  13. package/src/core/compile/compile.spec.js +0 -1
  14. package/src/core/controller/controller.js +1 -1
  15. package/src/core/exception-handler.js +1 -1
  16. package/src/core/filter/filter.js +2 -2
  17. package/src/core/interpolate/interpolate.js +3 -3
  18. package/src/core/interval/interval-factory.js +1 -1
  19. package/src/core/interval/interval.js +1 -1
  20. package/src/core/location/location.js +1 -1
  21. package/src/core/location/location.spec.js +3 -3
  22. package/src/core/parser/parse.js +2 -2
  23. package/src/core/sce/sce.js +2 -2
  24. package/src/core/scope/scope.js +1 -1
  25. package/src/core/task-tracker-factory.js +1 -1
  26. package/src/core/timeout/timeout.js +3 -3
  27. package/src/directive/if/if.js +5 -5
  28. package/src/directive/script/script.js +11 -9
  29. package/src/directive/validators/validators.js +70 -42
  30. package/src/public.js +56 -60
  31. package/src/router/params/param.js +1 -2
  32. package/src/router/path/path-node.js +5 -5
  33. package/src/router/path/path-utils.js +19 -21
  34. package/src/router/state/state-builder.js +17 -11
  35. package/src/router/state/state-queue-manager.js +16 -7
  36. package/src/router/state/state-registry.js +9 -5
  37. package/src/router/state/state-service.js +4 -8
  38. package/src/router/template-factory.js +2 -2
  39. package/src/router/transition/transition-service.js +1 -1
  40. package/src/router/transition/transition.js +13 -11
  41. package/src/router/url/url-matcher.js +2 -2
  42. package/src/router/url/url-service.js +1 -1
  43. package/src/router/view/view.js +3 -3
  44. package/src/services/http/http.js +2 -82
  45. package/src/services/http/http.spec.js +0 -118
  46. package/src/services/http/template-request.spec.js +10 -12
  47. package/src/services/http-backend/http-backend.js +1 -1
  48. package/src/services/log.js +1 -1
  49. package/src/services/template-request.js +3 -3
  50. package/src/shared/common.js +3 -9
  51. package/src/shared/hof.js +6 -8
  52. package/src/types.js +0 -14
  53. package/types/animations/animate-cache.d.ts +2 -2
  54. package/types/animations/animate-css-driver.d.ts +3 -3
  55. package/types/animations/animate-css.d.ts +2 -2
  56. package/types/animations/animate-js-driver.d.ts +3 -3
  57. package/types/animations/animate-js.d.ts +3 -3
  58. package/types/animations/animate-queue.d.ts +3 -3
  59. package/types/animations/animation.d.ts +2 -2
  60. package/types/core/cache/cache-factory.d.ts +20 -2
  61. package/types/core/compile/attributes.d.ts +1 -1
  62. package/types/core/compile/compile.d.ts +11 -11
  63. package/types/core/controller/controller.d.ts +1 -1
  64. package/types/core/exception-handler.d.ts +2 -3
  65. package/types/core/filter/filter.d.ts +3 -3
  66. package/types/core/interpolate/interpolate.d.ts +6 -6
  67. package/types/core/interval/interval-factory.d.ts +2 -2
  68. package/types/core/interval/interval.d.ts +2 -2
  69. package/types/core/location/location.d.ts +2 -2
  70. package/types/core/parser/parse.d.ts +4 -4
  71. package/types/core/sce/sce.d.ts +4 -4
  72. package/types/core/scope/scope.d.ts +1 -1
  73. package/types/core/task-tracker-factory.d.ts +1 -1
  74. package/types/core/timeout/timeout.d.ts +1 -2
  75. package/types/directive/script/script.d.ts +8 -5
  76. package/types/directive/validators/validators.d.ts +3 -15
  77. package/types/router/path/path-node.d.ts +0 -7
  78. package/types/router/path/path-utils.d.ts +7 -2
  79. package/types/router/state/state-queue-manager.d.ts +13 -3
  80. package/types/router/state/state-registry.d.ts +5 -2
  81. package/types/router/state/state-service.d.ts +1 -1
  82. package/types/router/template-factory.d.ts +3 -3
  83. package/types/router/transition/transition-service.d.ts +1 -1
  84. package/types/router/transition/transition.d.ts +3 -3
  85. package/types/router/url/url-service.d.ts +3 -3
  86. package/types/services/http/http.d.ts +4 -48
  87. package/types/services/http-backend/http-backend.d.ts +2 -2
  88. package/types/services/log.d.ts +2 -3
  89. package/types/services/template-request.d.ts +1 -1
  90. package/types/shared/common.d.ts +0 -5
  91. package/types/shared/hof.d.ts +0 -1
  92. package/types/types.d.ts +1 -1
  93. package/src/directive/csp.md +0 -63
package/src/public.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $CompileProvider } from "./core/compile/compile";
1
+ import { CompileProvider } from "./core/compile/compile";
2
2
  import {
3
3
  inputDirective,
4
4
  ngValueDirective,
@@ -59,30 +59,27 @@ import {
59
59
  AnimateAsyncRunFactoryProvider,
60
60
  AnimateRunnerFactoryProvider,
61
61
  } from "./animations/animate-runner";
62
+ import { TemplateCacheProvider } from "./core/cache/cache-factory";
63
+ import { ControllerProvider } from "./core/controller/controller";
64
+ import { ExceptionHandlerProvider } from "./core/exception-handler";
65
+ import { FilterProvider } from "./core/filter/filter";
66
+ import { IntervalProvider } from "./core/interval/interval";
67
+ import { InterpolateProvider } from "./core/interpolate/interpolate";
68
+ import { $IntervalFactoryProvider } from "./core/interval/interval-factory";
62
69
  import {
63
- TemplateCacheProvider,
64
- } from "./core/cache/cache-factory";
65
- import { $ControllerProvider } from "./core/controller/controller";
66
- import { $ExceptionHandlerProvider } from "./core/exception-handler";
67
- import { $FilterProvider } from "./core/filter/filter";
68
- import { $IntervalProvider } from "./core/interval/interval";
69
- import { $InterpolateProvider } from "./core/interpolate/interpolate";
70
- import { $$IntervalFactoryProvider } from "./core/interval/interval-factory";
71
- import {
72
- $HttpProvider,
73
- $HttpParamSerializerProvider,
74
- $HttpParamSerializerJQLikeProvider,
70
+ HttpProvider,
71
+ HttpParamSerializerProvider,
75
72
  } from "./services/http/http";
76
- import { $HttpBackendProvider } from "./services/http-backend/http-backend";
77
- import { $LocationProvider } from "./core/location/location";
78
- import { $LogProvider } from "./services/log";
79
- import { $ParseProvider } from "./core/parser/parse";
80
- import { $RootScopeProvider } from "./core/scope/scope";
73
+ import { HttpBackendProvider } from "./services/http-backend/http-backend";
74
+ import { LocationProvider } from "./core/location/location";
75
+ import { LogProvider } from "./services/log";
76
+ import { ParseProvider } from "./core/parser/parse";
77
+ import { RootScopeProvider } from "./core/scope/scope";
81
78
  import { $QProvider, $$QProvider } from "./core/q/q";
82
- import { $SceProvider, $SceDelegateProvider } from "./core/sce/sce";
83
- import { $$TaskTrackerFactoryProvider } from "./core/task-tracker-factory";
79
+ import { SceProvider, SceDelegateProvider } from "./core/sce/sce";
80
+ import { TaskTrackerFactoryProvider } from "./core/task-tracker-factory";
84
81
  import { TemplateRequestProvider } from "./services/template-request";
85
- import { $TimeoutProvider } from "./core/timeout/timeout";
82
+ import { TimeoutProvider } from "./core/timeout/timeout";
86
83
  import { SanitizeUriProvider } from "./core/sanitize/sanitize-uri";
87
84
  import {
88
85
  ngMessageDefaultDirective,
@@ -105,25 +102,25 @@ import {
105
102
  ngShowAriaDirective,
106
103
  ngValueAriaDirective,
107
104
  } from "./directive/aria/aria";
108
- import { $AnimateCssProvider } from "./animations/animate-css";
109
- import { $$AnimateQueueProvider } from "./animations/animate-queue";
110
- import { $$AnimateJsProvider } from "./animations/animate-js";
111
- import { $$AnimationProvider } from "./animations/animation";
105
+ import { AnimateCssProvider } from "./animations/animate-css";
106
+ import { AnimateQueueProvider } from "./animations/animate-queue";
107
+ import { AnimateJsProvider } from "./animations/animate-js";
108
+ import { AnimationProvider } from "./animations/animation";
112
109
  import { RafSchedulerProvider } from "./animations/raf-scheduler";
113
- import { $$AnimateCacheProvider } from "./animations/animate-cache";
114
- import { $$AnimateCssDriverProvider } from "./animations/animate-css-driver";
115
- import { $$AnimateJsDriverProvider } from "./animations/animate-js-driver";
110
+ import { AnimateCacheProvider } from "./animations/animate-cache";
111
+ import { AnimateCssDriverProvider } from "./animations/animate-css-driver";
112
+ import { AnimateJsDriverProvider } from "./animations/animate-js-driver";
116
113
  import { ngAnimateSwapDirective } from "./animations/animate-swap";
117
114
  import { $$AnimateChildrenDirective } from "./animations/animate-children-directive";
118
115
  import { UrlConfigProvider } from "./router/url/url-config";
119
116
  import { UIRouterGlobals } from "./router/globals";
120
117
  import { ViewService } from "./router/view/view";
121
- import { TransitionService } from "./router/transition/transition-service";
118
+ import { TransitionProvider } from "./router/transition/transition-service";
122
119
  import { StateService } from "./router/state/state-service";
123
120
  import { $ViewScrollProvider } from "./router/view-scroll";
124
- import { TemplateFactory } from "./router/template-factory";
121
+ import { TemplateFactoryProvider } from "./router/template-factory";
125
122
  import { UrlService } from "./router/url/url-service";
126
- import { StateRegistry } from "./router/state/state-registry";
123
+ import { StateRegistryProvider } from "./router/state/state-registry";
127
124
  import { trace } from "./router/common/trace";
128
125
  import {
129
126
  $StateRefActiveDirective,
@@ -155,7 +152,7 @@ export function publishExternalAPI(angular) {
155
152
  $$sanitizeUri: SanitizeUriProvider,
156
153
  });
157
154
  $provide
158
- .provider("$compile", $CompileProvider)
155
+ .provider("$compile", CompileProvider)
159
156
  .directive({
160
157
  input: inputDirective,
161
158
  textarea: inputDirective,
@@ -236,48 +233,47 @@ export function publishExternalAPI(angular) {
236
233
  $aria: AriaProvider,
237
234
  $anchorScroll: AnchorScrollProvider,
238
235
  $animate: AnimateProvider,
239
- $$animation: $$AnimationProvider,
240
- $animateCss: $AnimateCssProvider,
241
- $$animateCssDriver: $$AnimateCssDriverProvider,
242
- $$animateJs: $$AnimateJsProvider,
243
- $$animateJsDriver: $$AnimateJsDriverProvider,
244
- $$animateCache: $$AnimateCacheProvider,
245
- $$animateQueue: $$AnimateQueueProvider,
236
+ $$animation: AnimationProvider,
237
+ $animateCss: AnimateCssProvider,
238
+ $$animateCssDriver: AnimateCssDriverProvider,
239
+ $$animateJs: AnimateJsProvider,
240
+ $$animateJsDriver: AnimateJsDriverProvider,
241
+ $$animateCache: AnimateCacheProvider,
242
+ $$animateQueue: AnimateQueueProvider,
246
243
  $$AnimateRunner: AnimateRunnerFactoryProvider,
247
244
  $$animateAsyncRun: AnimateAsyncRunFactoryProvider,
248
245
  $browser: BrowserProvider,
249
- $controller: $ControllerProvider,
250
- $exceptionHandler: $ExceptionHandlerProvider,
251
- $filter: $FilterProvider,
252
- $interpolate: $InterpolateProvider,
253
- $interval: $IntervalProvider,
254
- $$intervalFactory: $$IntervalFactoryProvider,
255
- $http: $HttpProvider,
256
- $httpParamSerializer: $HttpParamSerializerProvider,
257
- $httpParamSerializerJQLike: $HttpParamSerializerJQLikeProvider,
258
- $httpBackend: $HttpBackendProvider,
259
- $location: $LocationProvider,
260
- $log: $LogProvider,
261
- $parse: $ParseProvider,
246
+ $controller: ControllerProvider,
247
+ $exceptionHandler: ExceptionHandlerProvider,
248
+ $filter: FilterProvider,
249
+ $interpolate: InterpolateProvider,
250
+ $interval: IntervalProvider,
251
+ $$intervalFactory: $IntervalFactoryProvider,
252
+ $http: HttpProvider,
253
+ $httpParamSerializer: HttpParamSerializerProvider,
254
+ $httpBackend: HttpBackendProvider,
255
+ $location: LocationProvider,
256
+ $log: LogProvider,
257
+ $parse: ParseProvider,
262
258
  $$rAFScheduler: RafSchedulerProvider,
263
- $rootScope: $RootScopeProvider,
259
+ $rootScope: RootScopeProvider,
264
260
  $routerGlobals: UIRouterGlobals,
265
261
  $q: $QProvider,
266
262
  $$q: $$QProvider,
267
- $sce: $SceProvider,
268
- $sceDelegate: $SceDelegateProvider,
269
- $$taskTrackerFactory: $$TaskTrackerFactoryProvider,
263
+ $sce: SceProvider,
264
+ $sceDelegate: SceDelegateProvider,
265
+ $$taskTrackerFactory: TaskTrackerFactoryProvider,
270
266
  $templateCache: TemplateCacheProvider,
271
267
  $templateRequest: TemplateRequestProvider,
272
- $timeout: $TimeoutProvider,
268
+ $timeout: TimeoutProvider,
273
269
  $urlConfig: UrlConfigProvider,
274
270
  $view: ViewService,
275
- $transitions: TransitionService,
271
+ $transitions: TransitionProvider,
276
272
  $state: StateService,
277
273
  $ngViewScroll: $ViewScrollProvider,
278
- $templateFactory: TemplateFactory,
274
+ $templateFactory: TemplateFactoryProvider,
279
275
  $urlService: UrlService,
280
- $stateRegistry: StateRegistry,
276
+ $stateRegistry: StateRegistryProvider,
281
277
  });
282
278
  },
283
279
  ],
@@ -1,5 +1,4 @@
1
1
  import { filter, map, allTrueR, find } from "../../shared/common";
2
- import { prop } from "../../shared/hof";
3
2
  import { isInjectable } from "../../shared/predicates";
4
3
  import { isDefined, isUndefined, isString } from "../../shared/utils";
5
4
  import { services } from "../common/coreservices";
@@ -79,7 +78,7 @@ function getReplace(config, arrayMode, isOptional, squash) {
79
78
  ];
80
79
  const replace = Array.isArray(config.replace) ? config.replace : [];
81
80
  if (isString(squash)) replace.push({ from: squash, to: undefined });
82
- const configuredKeys = map(replace, prop("from"));
81
+ const configuredKeys = map(replace, (x) => x.from);
83
82
  return filter(
84
83
  defaultPolicy,
85
84
  (item) => configuredKeys.indexOf(item.from) === -1,
@@ -25,9 +25,11 @@ export class PathNode {
25
25
  this.resolvables = state.resolvables.map((res) => res.clone());
26
26
  }
27
27
  }
28
+
28
29
  clone() {
29
30
  return new PathNode(this);
30
31
  }
32
+
31
33
  /** Sets [[paramValues]] for the node, from the values of an object hash */
32
34
  applyRawParams(params) {
33
35
  const getParamVal = (paramDef) => [
@@ -40,10 +42,12 @@ export class PathNode {
40
42
  );
41
43
  return this;
42
44
  }
45
+
43
46
  /** Gets a specific [[Param]] metadata that belongs to the node */
44
47
  parameter(name) {
45
48
  return find(this.paramSchema, propEq("id", name));
46
49
  }
50
+
47
51
  /**
48
52
  * @returns true if the state and parameter values for another PathNode are
49
53
  * equal to the state and param values for this PathNode
@@ -52,6 +56,7 @@ export class PathNode {
52
56
  const diff = this.diff(node, paramsFn);
53
57
  return diff && diff.length === 0;
54
58
  }
59
+
55
60
  /**
56
61
  * Finds Params with different parameter values on another PathNode.
57
62
  *
@@ -70,8 +75,3 @@ export class PathNode {
70
75
  return Param.changed(params, this.paramValues, node.paramValues);
71
76
  }
72
77
  }
73
- /**
74
- * Returns a clone of the PathNode
75
- * @deprecated use instance method `node.clone()`
76
- */
77
- PathNode.clone = (node) => node.clone();
@@ -1,29 +1,11 @@
1
- import {
2
- find,
3
- pick,
4
- omit,
5
- tail,
6
- mergeR,
7
- unnestR,
8
- arrayTuples,
9
- } from "../../shared/common";
10
- import { prop, propEq } from "../../shared/hof";
1
+ import { find, pick, omit, unnestR, arrayTuples } from "../../shared/common";
2
+ import { propEq } from "../../shared/hof";
11
3
  import { TargetState } from "../state/target-state";
12
4
  import { PathNode } from "./path-node";
13
5
  /**
14
6
  * This class contains functions which convert TargetStates, Nodes and paths from one type to another.
15
7
  */
16
8
  export class PathUtils {
17
- /** Given a PathNode[], create an TargetState */
18
- static makeTargetState(registry, path) {
19
- const state = tail(path).state;
20
- return new TargetState(
21
- registry,
22
- state,
23
- path.map(prop("paramValues")).reduce(mergeR, {}),
24
- {},
25
- );
26
- }
27
9
  static buildPath(targetState) {
28
10
  const toParams = targetState.params();
29
11
  return targetState
@@ -81,7 +63,7 @@ export class PathUtils {
81
63
  .map((node) => node.paramSchema)
82
64
  .reduce(unnestR, [])
83
65
  .filter((param) => !param.inherit)
84
- .map(prop("id"));
66
+ .map((x) => x.id);
85
67
  /**
86
68
  * Given an [[PathNode]] "toNode", return a new [[PathNode]] with param values inherited from the
87
69
  * matching node in fromPath. Only inherit keys that aren't found in "toKeys" from the node in "fromPath""
@@ -202,3 +184,19 @@ export class PathUtils {
202
184
  return path.reduce((acc, node) => Object.assign(acc, node.paramValues), {});
203
185
  }
204
186
  }
187
+
188
+ /** Given a PathNode[], create an TargetState
189
+ * @param {import("../state/state-registry.js").StateRegistryProvider} registry
190
+ * @param {Array<PathNode>} path
191
+ * @returns
192
+ */
193
+ export function makeTargetState(registry, path) {
194
+ return new TargetState(
195
+ registry,
196
+ path.at(-1).state,
197
+ path
198
+ .map((x) => x.paramValues)
199
+ .reduce((acc, obj) => ({ ...acc, ...obj }), {}),
200
+ {},
201
+ );
202
+ }
@@ -8,7 +8,7 @@ import {
8
8
  } from "../../shared/common";
9
9
  import { isDefined, isFunction, isString } from "../../shared/utils";
10
10
  import { stringify } from "../../shared/strings";
11
- import { is, pattern, pipe, prop, val } from "../../shared/hof";
11
+ import { is, pattern, pipe, val } from "../../shared/hof";
12
12
  import { Resolvable } from "../resolve/resolvable";
13
13
  import { services } from "../common/coreservices";
14
14
  import { annotate } from "../../core/di/injector";
@@ -73,12 +73,18 @@ function getNavigableBuilder(isRoot) {
73
73
 
74
74
  function getParamsBuilder(paramFactory) {
75
75
  return function (state) {
76
- const makeConfigParam = (config, id) =>
76
+ const makeConfigParam = (_config, id) =>
77
77
  paramFactory.fromConfig(id, null, state.self);
78
78
  const urlParams =
79
79
  (state.url && state.url.parameters({ inherit: false })) || [];
80
80
  const nonUrlParams = Object.values(
81
- map(omit(state.params || {}, urlParams.map(prop("id"))), makeConfigParam),
81
+ map(
82
+ omit(
83
+ state.params || {},
84
+ urlParams.map((x) => x.id),
85
+ ),
86
+ makeConfigParam,
87
+ ),
82
88
  );
83
89
  return urlParams
84
90
  .concat(nonUrlParams)
@@ -176,11 +182,11 @@ export function resolvablesBuilder(state) {
176
182
  // Given a literal resolve or provider object, returns a Resolvable
177
183
  const literal2Resolvable = pattern([
178
184
  [
179
- prop("resolveFn"),
185
+ (x) => x.resolveFn,
180
186
  (p) => new Resolvable(getToken(p), p.resolveFn, p.deps, p.policy),
181
187
  ],
182
188
  [
183
- prop("useFactory"),
189
+ (x) => x.useFactory,
184
190
  (p) =>
185
191
  new Resolvable(
186
192
  getToken(p),
@@ -190,27 +196,27 @@ export function resolvablesBuilder(state) {
190
196
  ),
191
197
  ],
192
198
  [
193
- prop("useClass"),
199
+ (x) => x.useClass,
194
200
  (p) => new Resolvable(getToken(p), () => new p.useClass(), [], p.policy),
195
201
  ],
196
202
  [
197
- prop("useValue"),
203
+ (x) => x.useValue,
198
204
  (p) =>
199
205
  new Resolvable(getToken(p), () => p.useValue, [], p.policy, p.useValue),
200
206
  ],
201
207
  [
202
- prop("useExisting"),
208
+ (x) => x.useExisting,
203
209
  (p) => new Resolvable(getToken(p), (x) => x, [p.useExisting], p.policy),
204
210
  ],
205
211
  ]);
206
212
  const tuple2Resolvable = pattern([
207
213
  [
208
- pipe(prop("val"), isString),
214
+ pipe((x) => x.val, isString),
209
215
  (tuple) =>
210
216
  new Resolvable(tuple.token, (x) => x, [tuple.val], tuple.policy),
211
217
  ],
212
218
  [
213
- pipe(prop("val"), Array.isArray),
219
+ pipe((x) => x.val, Array.isArray),
214
220
  (tuple) =>
215
221
  new Resolvable(
216
222
  tuple.token,
@@ -220,7 +226,7 @@ export function resolvablesBuilder(state) {
220
226
  ),
221
227
  ],
222
228
  [
223
- pipe(prop("val"), isFunction),
229
+ pipe((x) => x.val, isFunction),
224
230
  (tuple) =>
225
231
  new Resolvable(
226
232
  tuple.token,
@@ -1,30 +1,39 @@
1
- import { prop } from "../../shared/hof";
2
1
  import { isString } from "../../shared/utils";
3
2
  import { StateObject } from "./state-object";
4
3
 
5
4
  export class StateQueueManager {
5
+ /**
6
+ * @param {import("./state-registry.js").StateRegistryProvider} stateRegistry
7
+ * @param {*} urlServiceRules
8
+ * @param {*} states
9
+ * @param {*} builder
10
+ * @param {*} listeners
11
+ */
6
12
  constructor(stateRegistry, urlServiceRules, states, builder, listeners) {
7
13
  this.stateRegistry = stateRegistry;
8
14
  this.urlServiceRules = urlServiceRules;
9
15
  this.states = states;
10
16
  this.builder = builder;
11
17
  this.listeners = listeners;
18
+ /**
19
+ * @type {Array<StateObject>}
20
+ */
12
21
  this.queue = [];
13
22
  }
23
+
14
24
  register(stateDecl) {
15
- const queue = this.queue;
16
25
  const state = new StateObject(stateDecl);
17
- const name = state.name;
18
26
  if (!isString(name)) throw new Error("State must have a valid name");
19
27
  if (
20
- Object.prototype.hasOwnProperty.call(this.states, name) ||
21
- queue.map(prop("name")).includes(name)
28
+ Object.prototype.hasOwnProperty.call(this.states, state.name) ||
29
+ this.queue.map((x) => x.name).includes(state.name)
22
30
  )
23
- throw new Error(`State '${name}' is already defined`);
24
- queue.push(state);
31
+ throw new Error(`State '${state.name}' is already defined`);
32
+ this.queue.push(state);
25
33
  this.flush();
26
34
  return state;
27
35
  }
36
+
28
37
  flush() {
29
38
  const { queue, states, builder } = this;
30
39
  const registered = [], // states that got registered
@@ -12,7 +12,7 @@ import { isString } from "../../shared/utils";
12
12
  *
13
13
  * This API is found at `$stateRegistry` ([[UIRouter.stateRegistry]])
14
14
  */
15
- export class StateRegistry {
15
+ export class StateRegistryProvider {
16
16
  static $inject = [
17
17
  "$urlServiceProvider",
18
18
  "$stateProvider",
@@ -42,7 +42,8 @@ export class StateRegistry {
42
42
  this.builder,
43
43
  this.listeners,
44
44
  );
45
- this._registerRoot();
45
+
46
+ this.registerRoot();
46
47
 
47
48
  viewService._pluginapi._rootViewContext(this.root());
48
49
  globals.$current = this.root();
@@ -90,7 +91,10 @@ export class StateRegistry {
90
91
  };
91
92
  }
92
93
 
93
- _registerRoot() {
94
+ /**
95
+ * @private
96
+ */
97
+ registerRoot() {
94
98
  const rootStateDef = {
95
99
  name: "",
96
100
  url: "^",
@@ -100,8 +104,8 @@ export class StateRegistry {
100
104
  },
101
105
  abstract: true,
102
106
  };
103
- const _root = (this._root = this.stateQueue.register(rootStateDef));
104
- _root.navigable = null;
107
+ this._root = this.stateQueue.register(rootStateDef);
108
+ this._root.navigable = null;
105
109
  }
106
110
 
107
111
  /**
@@ -8,7 +8,7 @@ import {
8
8
  import { isDefined, isObject, isString, minErr } from "../../shared/utils";
9
9
  import { Queue } from "../common/queue";
10
10
  import { services } from "../common/coreservices";
11
- import { PathUtils } from "../path/path-utils";
11
+ import { makeTargetState } from "../path/path-utils";
12
12
  import { PathNode } from "../path/path-node";
13
13
  import { defaultTransOpts } from "../transition/transition-service";
14
14
  import { Rejection, RejectType } from "../transition/reject-factory";
@@ -88,11 +88,7 @@ export class StateService {
88
88
  );
89
89
  }
90
90
 
91
- $get = [
92
- () => {
93
- return this;
94
- },
95
- ];
91
+ $get = () => this;
96
92
 
97
93
  /**
98
94
  * Decorates states when they are registered
@@ -215,7 +211,7 @@ export class StateService {
215
211
  * @internal
216
212
  */
217
213
  _handleInvalidTargetState(fromPath, toState) {
218
- const fromState = PathUtils.makeTargetState(this.stateRegistry, fromPath);
214
+ const fromState = makeTargetState(this.stateRegistry, fromPath);
219
215
  const globals = this.globals;
220
216
  const latestThing = () => globals.transitionHistory.peekTail();
221
217
  const latest = latestThing();
@@ -690,7 +686,7 @@ export class StateService {
690
686
  if (!state || !state.lazyLoad)
691
687
  throw new Error("Can not lazy load " + stateOrName);
692
688
  const currentPath = this.getCurrentPath();
693
- const target = PathUtils.makeTargetState(this.stateRegistry, currentPath);
689
+ const target = makeTargetState(this.stateRegistry, currentPath);
694
690
  transition =
695
691
  transition || this.transitionService.create(currentPath, target);
696
692
  return lazyLoadState(transition, state);
@@ -14,7 +14,7 @@ import { annotate } from "../core/di/injector";
14
14
  /**
15
15
  * Service which manages loading of templates from a ViewConfig.
16
16
  */
17
- export class TemplateFactory {
17
+ export class TemplateFactoryProvider {
18
18
  constructor() {
19
19
  /** @type {boolean} */
20
20
  this._useHttp = false;
@@ -28,7 +28,7 @@ export class TemplateFactory {
28
28
  "$injector",
29
29
  /**
30
30
  * @param {any} $http
31
- * @param {any} $templateCache
31
+ * @param {import("../core/cache/cache-factory").TemplateCache} $templateCache
32
32
  * @param {any} $templateRequest
33
33
  * @param {any} $q
34
34
  * @param {import("../core/di/internal-injector").InjectorService} $injector
@@ -60,7 +60,7 @@ export let defaultTransOpts = {
60
60
  *
61
61
  * This API is located at `router.transitionService` ([[UIRouter.transitionService]])
62
62
  */
63
- export class TransitionService {
63
+ export class TransitionProvider {
64
64
  static $inject = ["$routerGlobalsProvider", "$viewProvider"];
65
65
 
66
66
  /**
@@ -4,7 +4,6 @@ import { stringify } from "../../shared/strings";
4
4
  import {
5
5
  map,
6
6
  find,
7
- mergeR,
8
7
  tail,
9
8
  omit,
10
9
  arrayTuples,
@@ -14,7 +13,7 @@ import {
14
13
  uniqR,
15
14
  } from "../../shared/common";
16
15
  import { isUndefined, isObject, assert } from "../../shared/utils";
17
- import { prop, propEq, val, is } from "../../shared/hof";
16
+ import { propEq, val, is } from "../../shared/hof";
18
17
  import { TransitionHookPhase } from "./interface"; // has or is using
19
18
  import { TransitionHook } from "./transition-hook";
20
19
  import { matchState, makeEvent } from "./hook-registry";
@@ -25,7 +24,6 @@ import { Resolvable } from "../resolve/resolvable";
25
24
  import { ResolveContext } from "../resolve/resolve-context";
26
25
  import { Rejection } from "./reject-factory";
27
26
 
28
- const stateSelf = prop("self");
29
27
  /**
30
28
  * Represents a transition between two states.
31
29
  *
@@ -45,7 +43,7 @@ export class Transition {
45
43
  * @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`
46
44
  * encapsulates the "from state".
47
45
  * @param targetState The target state and parameters being transitioned to (also, the transition options)
48
- * @param {import('../transition/transition-service').TransitionService} transitionService The [[TransitionService]] instance
46
+ * @param {import('../transition/transition-service').TransitionProvider} transitionService The [[TransitionService]] instance
49
47
  * @internal
50
48
  */
51
49
  constructor(fromPath, targetState, transitionService, globals) {
@@ -172,7 +170,9 @@ export class Transition {
172
170
  }
173
171
  params(pathname = "to") {
174
172
  return Object.freeze(
175
- this._treeChanges[pathname].map(prop("paramValues")).reduce(mergeR, {}),
173
+ this._treeChanges[pathname]
174
+ .map((x) => x.paramValues)
175
+ .reduce((acc, obj) => ({ ...acc, ...obj }), {}),
176
176
  );
177
177
  }
178
178
  paramsChanged() {
@@ -403,7 +403,7 @@ export class Transition {
403
403
  * @returns an array of states that will be entered during this transition.
404
404
  */
405
405
  entering() {
406
- return map(this._treeChanges.entering, prop("state")).map(stateSelf);
406
+ return map(this._treeChanges.entering, (x) => x.state).map((x) => x.self);
407
407
  }
408
408
  /**
409
409
  * Gets the states being exited.
@@ -411,8 +411,8 @@ export class Transition {
411
411
  * @returns an array of states that will be exited during this transition.
412
412
  */
413
413
  exiting() {
414
- return map(this._treeChanges.exiting, prop("state"))
415
- .map(stateSelf)
414
+ return map(this._treeChanges.exiting, (x) => x.state)
415
+ .map((x) => x.self)
416
416
  .reverse();
417
417
  }
418
418
  /**
@@ -422,7 +422,7 @@ export class Transition {
422
422
  * exited during this Transition
423
423
  */
424
424
  retained() {
425
- return map(this._treeChanges.retained, prop("state")).map(stateSelf);
425
+ return map(this._treeChanges.retained, (x) => x.state).map((x) => x.self);
426
426
  }
427
427
  /**
428
428
  * Get the [[ViewConfig]]s associated with this Transition
@@ -439,7 +439,7 @@ export class Transition {
439
439
  views(pathname = "entering", state) {
440
440
  let path = this._treeChanges[pathname];
441
441
  path = !state ? path : path.filter(propEq("state", state));
442
- return path.map(prop("views")).reduce(unnestR, []);
442
+ return path.map((x) => x.views).reduce(unnestR, []);
443
443
  }
444
444
  treeChanges(pathname) {
445
445
  return pathname ? this._treeChanges[pathname] : this._treeChanges;
@@ -702,7 +702,9 @@ export class Transition {
702
702
  from = isObject(fromStateOrName) ? fromStateOrName.name : fromStateOrName,
703
703
  fromParams = stringify(
704
704
  avoidEmptyHash(
705
- this._treeChanges.from.map(prop("paramValues")).reduce(mergeR, {}),
705
+ this._treeChanges.from
706
+ .map((x) => x.paramValues)
707
+ .reduce((acc, obj) => ({ ...acc, ...obj }), {}),
706
708
  ),
707
709
  ),
708
710
  toValid = this.valid() ? "" : "(X) ",
@@ -9,7 +9,7 @@ import {
9
9
  arrayTuples,
10
10
  defaults,
11
11
  } from "../../shared/common";
12
- import { prop, propEq } from "../../shared/hof";
12
+ import { propEq } from "../../shared/hof";
13
13
  import { isDefined, isString } from "../../shared/utils";
14
14
  import { Param, DefType } from "../params/param";
15
15
  import { joinNeighborsR, splitOnDelim } from "../../shared/strings";
@@ -344,7 +344,7 @@ export class UrlMatcher {
344
344
  return new RegExp(
345
345
  [
346
346
  "^",
347
- unnest(this._cache.path.map(prop("_compiled"))).join(""),
347
+ unnest(this._cache.path.map((x) => x._compiled)).join(""),
348
348
  this.config.strict === false ? "/?" : "",
349
349
  "$",
350
350
  ].join(""),
@@ -26,7 +26,7 @@ export class UrlService {
26
26
  ];
27
27
 
28
28
  /**
29
- * @param {import("../../core/location/location").$LocationProvider} $locationProvider
29
+ * @param {import("../../core/location/location").LocationProvider} $locationProvider
30
30
  */
31
31
  constructor($locationProvider, stateService, globals, urlConfigProvider) {
32
32
  this.stateService = stateService;