@angular-wave/angular.ts 0.0.24 → 0.0.25

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@angular-wave/angular.ts",
3
3
  "license": "MIT",
4
- "version": "0.0.24",
4
+ "version": "0.0.25",
5
5
  "type": "module",
6
6
  "main": "dist/angular-ts.esm.js",
7
7
  "browser": "dist/angular-ts.umd.js",
@@ -36,7 +36,7 @@ export function initRouter() {
36
36
  .provider("$uiViewScroll", $ViewScrollProvider)
37
37
  .factory("$stateParams", [
38
38
  "$router",
39
- function StateParamse($router) {
39
+ function ($router) {
40
40
  return $router.globals.params;
41
41
  },
42
42
  ])
@@ -14,36 +14,12 @@ export class Ng1LocationServices {
14
14
  constructor($locationProvider) {
15
15
  // .onChange() registry
16
16
  this._urlListeners = [];
17
- /** @type {angular.ILocationProvider} */ this.$locationProvider =
18
- $locationProvider;
17
+ /** @type {angular.ILocationProvider} */
18
+ this.$locationProvider = $locationProvider;
19
19
  const _lp = val($locationProvider);
20
20
  createProxyFunctions(_lp, this, _lp, ["hashPrefix"]);
21
21
  }
22
- /**
23
- * Applys ng1-specific path parameter encoding
24
- *
25
- * The Angular 1 `$location` service is a bit weird.
26
- * It doesn't allow slashes to be encoded/decoded bi-directionally.
27
- *
28
- * See the writeup at https://github.com/angular-ui/ui-router/issues/2598
29
- *
30
- * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F
31
- *
32
- * @param router
33
- */
34
- static monkeyPatchPathParameterType(router) {
35
- const pathType = router.urlMatcherFactory.type("path");
36
- pathType.encode = (x) =>
37
- x != null
38
- ? x.toString().replace(/(~|\/)/g, (m) => ({ "~": "~~", "/": "~2F" })[m])
39
- : x;
40
- pathType.decode = (x) =>
41
- x != null
42
- ? x
43
- .toString()
44
- .replace(/(~~|~2F)/g, (m) => ({ "~~": "~", "~2F": "/" })[m])
45
- : x;
46
- }
22
+
47
23
  dispose() {}
48
24
 
49
25
  onChange(callback) {
@@ -102,7 +102,9 @@ export class UIRouter {
102
102
  try {
103
103
  typeof d.dispose === "function" && d.dispose(this);
104
104
  removeFrom(this._disposables, d);
105
- } catch (ignored) {}
105
+ } catch (ignored) {
106
+ /* empty */
107
+ }
106
108
  });
107
109
  }
108
110
 
@@ -19,6 +19,7 @@ import { StateProvider } from "./state-provider";
19
19
  import { Ng1LocationServices } from "./location-services";
20
20
  import { ResolveContext } from "./resolve/resolve-context";
21
21
 
22
+ /** @type {angular.UIRouter}} */
22
23
  export let router = null;
23
24
  $routerProvider.$inject = ["$locationProvider"];
24
25
  /** This angular 1 provider instantiates a Router and exposes its services via the angular injector */
@@ -42,7 +43,27 @@ export function $routerProvider($locationProvider) {
42
43
  // Disable decoding of params by UrlMatcherFactory because $location already handles this
43
44
  router.urlService.config._decodeParams = false;
44
45
 
45
- Ng1LocationServices.monkeyPatchPathParameterType(router);
46
+ /**
47
+ * Applys ng1-specific path parameter encoding
48
+ *
49
+ * The Angular 1 `$location` service is a bit weird.
50
+ * It doesn't allow slashes to be encoded/decoded bi-directionally.
51
+ *
52
+ * See the writeup at https://github.com/angular-ui/ui-router/issues/2598
53
+ *
54
+ * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F
55
+ *
56
+ */
57
+ const pathType = router.urlMatcherFactory.type("path");
58
+ pathType.encode = (x) =>
59
+ x != null
60
+ ? x.toString().replace(/(~|\/)/g, (m) => ({ "~": "~~", "/": "~2F" })[m])
61
+ : x;
62
+ pathType.decode = (x) =>
63
+ x != null
64
+ ? x.toString().replace(/(~~|~2F)/g, (m) => ({ "~~": "~", "~2F": "/" })[m])
65
+ : x;
66
+
46
67
  // backwards compat: also expose router instance as $routerProvider.router
47
68
  router["router"] = router;
48
69
  router["$get"] = $get;
@@ -59,6 +59,7 @@ export class StateService {
59
59
  }
60
60
 
61
61
  constructor(router) {
62
+ /** @private */
62
63
  this.router = router;
63
64
 
64
65
  this.invalidCallbacks = [];
@@ -109,46 +109,12 @@ export class TransitionService {
109
109
  * @param options the registration options
110
110
  * @returns a function which deregisters the hook.
111
111
  */
112
- onCreate(criteria, callback, options) {
113
- return;
114
- }
115
- /** @inheritdoc */
116
- onBefore(criteria, callback, options) {
117
- return;
118
- }
119
- /** @inheritdoc */
120
- onStart(criteria, callback, options) {
121
- return;
122
- }
123
- /** @inheritdoc */
124
- onExit(criteria, callback, options) {
125
- return;
126
- }
127
- /** @inheritdoc */
128
- onRetain(criteria, callback, options) {
129
- return;
130
- }
131
- /** @inheritdoc */
132
- onEnter(criteria, callback, options) {
133
- return;
134
- }
135
- /** @inheritdoc */
136
- onFinish(criteria, callback, options) {
137
- return;
138
- }
139
- /** @inheritdoc */
140
- onSuccess(criteria, callback, options) {
141
- return;
142
- }
143
- /** @inheritdoc */
144
- onError(criteria, callback, options) {
145
- return;
146
- }
112
+
147
113
  /**
148
114
  * dispose
149
115
  * @internal
150
116
  */
151
- dispose(router) {
117
+ dispose() {
152
118
  Object.values(this._registeredHooks).forEach((hooksArray) =>
153
119
  hooksArray.forEach((hook) => {
154
120
  hook._deregistered = true;
@@ -35,38 +35,7 @@ const stateSelf = prop("self");
35
35
  * It has information about all states being entered and exited as a result of the transition.
36
36
  */
37
37
  export class Transition {
38
- onBefore(criteria, callback, options) {
39
- return;
40
- }
41
- /** @inheritdoc */
42
- onStart(criteria, callback, options) {
43
- return;
44
- }
45
- /** @inheritdoc */
46
- onExit(criteria, callback, options) {
47
- return;
48
- }
49
- /** @inheritdoc */
50
- onRetain(criteria, callback, options) {
51
- return;
52
- }
53
- /** @inheritdoc */
54
- onEnter(criteria, callback, options) {
55
- return;
56
- }
57
- /** @inheritdoc */
58
- onFinish(criteria, callback, options) {
59
- return;
60
- }
61
- /** @inheritdoc */
62
- onSuccess(criteria, callback, options) {
63
- return;
64
- }
65
- /** @inheritdoc */
66
- onError(criteria, callback, options) {
67
- return;
68
- }
69
- /** @internal
38
+ /**
70
39
  * Creates the transition-level hook registration functions
71
40
  * (which can then be used to register hooks)
72
41
  */
@@ -84,8 +84,4 @@ export class UrlRouter {
84
84
  const port = cfgPort === 80 || cfgPort === 443 ? "" : ":" + cfgPort;
85
85
  return [cfg.protocol(), "://", cfg.host(), port, slash, url].join("");
86
86
  }
87
- /** @deprecated use [[UrlService.interceptDeferred]]*/
88
- get interceptDeferred() {
89
- return this.router.urlService.interceptDeferred;
90
- }
91
87
  }
@@ -66,7 +66,6 @@ function getHandlerFn(handler) {
66
66
  */
67
67
  export class UrlRules {
68
68
  constructor(router) {
69
- this.router = router;
70
69
  this._sortFn = defaultRuleSortFn;
71
70
  this._rules = [];
72
71
  this._id = 0;
@@ -16,17 +16,21 @@ export class UrlService {
16
16
  * @type {import('../router').UIRouter}
17
17
  */
18
18
  this.router = router;
19
+
20
+ /** @type {boolean} */
19
21
  this.interceptDeferred = false;
20
22
  /**
21
23
  * The nested [[UrlRules]] API for managing URL rules and rewrites
22
24
  *
23
25
  * See: [[UrlRules]] for details
26
+ * @type {UrlRules}
24
27
  */
25
28
  this.rules = new UrlRules(this.router);
26
29
  /**
27
30
  * The nested [[UrlConfig]] API to configure the URL and retrieve URL information
28
31
  *
29
32
  * See: [[UrlConfig]] for details
33
+ * @type {UrlConfig}
30
34
  */
31
35
  this.config = new UrlConfig(this.router);
32
36
  // Delegate these calls to the current LocationServices implementation
@@ -29,10 +29,6 @@ export class ViewService {
29
29
  * @param {import('../router').UIRouter} router
30
30
  */
31
31
  constructor(router) {
32
- /**
33
- * @type {import('../router').UIRouter}
34
- */
35
- this.router = router;
36
32
  this._uiViews = [];
37
33
  this._viewConfigs = [];
38
34
  this._viewConfigFactories = {};
@@ -41,7 +37,7 @@ export class ViewService {
41
37
  _rootViewContext: this._rootViewContext.bind(this),
42
38
  _viewConfigFactory: this._viewConfigFactory.bind(this),
43
39
  _registeredUIView: (id) =>
44
- find(this._uiViews, (view) => `${this.router.$id}.${view.id}` === id),
40
+ find(this._uiViews, (view) => `${router.$id}.${view.id}` === id),
45
41
  _registeredUIViews: () => this._uiViews,
46
42
  _activeViewConfigs: () => this._viewConfigs,
47
43
  _onSync: (listener) => {
@@ -3,8 +3,6 @@
3
3
  *
4
4
  * These functions are exported, but are subject to change without notice.
5
5
  *
6
- * @packageDocumentation
7
- * @preferred
8
6
  */
9
7
  import { isDate, isFunction, isRegExp, isString } from "./utils";
10
8
  import { all, any, prop, curry, not } from "./hof";