@angular-wave/angular.ts 0.0.30 → 0.0.33

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 (55) hide show
  1. package/dist/angular-ts.esm.js +1 -1
  2. package/dist/angular-ts.umd.js +1 -1
  3. package/index.html +5 -14
  4. package/package.json +1 -1
  5. package/src/core/compile.js +5 -4
  6. package/src/core/location.js +1 -1
  7. package/src/core/parser/parse.js +1 -2
  8. package/src/core/root-scope.js +49 -99
  9. package/src/directive/events.js +2 -1
  10. package/src/directive/model.js +4 -2
  11. package/src/router/directives/state-directives.js +33 -18
  12. package/src/router/directives/view-directive.js +1 -2
  13. package/src/router/globals.js +2 -0
  14. package/src/router/hooks/url.js +4 -4
  15. package/src/router/index.js +23 -27
  16. package/src/router/injectables.js +1 -52
  17. package/src/router/services.js +6 -84
  18. package/src/router/state/state-builder.js +7 -6
  19. package/src/router/state/state-queue-manager.js +2 -1
  20. package/src/router/state/state-registry.js +39 -21
  21. package/src/router/state/state-service.js +173 -6
  22. package/src/router/state/views.js +46 -2
  23. package/src/router/transition/reject-factory.js +0 -8
  24. package/src/router/transition/transition-service.js +43 -1
  25. package/src/router/url/url-config.js +32 -1
  26. package/src/router/url/url-rule.js +4 -4
  27. package/src/router/url/url-service.js +161 -14
  28. package/src/router/view/view.js +7 -51
  29. package/src/services/http.js +1 -1
  30. package/src/shared/common.js +1 -1
  31. package/src/shared/strings.js +7 -2
  32. package/test/core/compile.spec.js +2 -2
  33. package/test/core/scope.spec.js +2 -37
  34. package/test/router/services.spec.js +14 -31
  35. package/test/router/state-directives.spec.js +2 -2
  36. package/test/router/state-filter.spec.js +0 -2
  37. package/test/router/state.spec.js +4 -4
  38. package/test/router/template-factory.spec.js +19 -10
  39. package/test/router/{url-matcher-factory.spec.js → url-service.spec.js} +126 -132
  40. package/test/router/view-directive.spec.js +9 -9
  41. package/test/router/view-hook.spec.js +10 -10
  42. package/test/router/view.spec.js +4 -11
  43. package/types/router/core/params/interface.d.ts +2 -2
  44. package/types/router/core/url/urlMatcherFactory.d.ts +1 -1
  45. package/legacy/angular-animate.js +0 -4272
  46. package/legacy/angular-aria.js +0 -426
  47. package/legacy/angular-message-format.js +0 -1072
  48. package/legacy/angular-messages.js +0 -829
  49. package/legacy/angular-route.js +0 -1266
  50. package/legacy/angular-sanitize.js +0 -891
  51. package/legacy/angular.js +0 -36600
  52. package/src/router/router.js +0 -125
  53. package/src/router/url/url-matcher-factory.js +0 -76
  54. package/src/router/url/url-router.js +0 -101
  55. package/test/original-test.html +0 -33
@@ -1,125 +0,0 @@
1
- import { UrlMatcherFactory } from "./url/url-matcher-factory";
2
- import { UrlRouter } from "./url/url-router";
3
- import { TransitionService } from "./transition/transition-service";
4
- import { ViewService } from "./view/view";
5
- import { StateRegistry } from "./state/state-registry";
6
- import { StateService } from "./state/state-service";
7
- import { UIRouterGlobals } from "./globals";
8
- import { UrlService } from "./url/url-service";
9
- import { trace } from "./common/trace";
10
- import { UrlRuleFactory } from "./url/url-rule";
11
- import { registerLazyLoadHook } from "./hooks/lazy-load";
12
- import { registerUpdateUrl } from "./hooks/url";
13
- import { registerActivateViews } from "./hooks/views";
14
- import { registerRedirectToHook } from "./hooks/redirect-to";
15
-
16
- /**
17
- * Router id tracker
18
- * @type {number}
19
- */
20
- let routerId = 0;
21
-
22
- /**
23
- * An instance of ng-router.
24
- * @class
25
- *
26
- * This object contains references to service APIs which define your application's routing behavior.
27
- */
28
- export class UIRouter {
29
- /**
30
- * Creates a new `UIRouter` object
31
- *
32
- * @param {angular.ILocationProvider} $locationProvider
33
- */
34
- constructor($locationProvider) {
35
- /** @type {number} */
36
- this.$id = routerId++;
37
-
38
- /** Enable/disable tracing to the javascript console */
39
- this.trace = trace;
40
- this.$locationProvider = $locationProvider;
41
-
42
- /** Provides services related to ui-view synchronization */
43
- this.viewService = new ViewService(routerId);
44
-
45
- /** @type {UIRouterGlobals} An object that contains global router state, such as the current state and params */
46
- this.globals = new UIRouterGlobals();
47
-
48
- /** @type {TransitionService} A service that exposes global Transition Hooks */
49
- this.transitionService = new TransitionService(
50
- this.globals,
51
- this.viewService,
52
- );
53
-
54
- /** @type {StateService} Provides services related to states */
55
- this.stateService = new StateService(this.globals, this.transitionService);
56
-
57
- /** Provides services related to the URL */
58
- let urlRuleFactory = new UrlRuleFactory(
59
- this.urlMatcherFactory,
60
- this.stateService,
61
- this.globals,
62
- );
63
-
64
- /**
65
- * @type {angular.UrlService}
66
- */
67
- this.urlService = new UrlService(
68
- $locationProvider,
69
- urlRuleFactory,
70
- this.stateService,
71
- );
72
-
73
- /**
74
- * Deprecated for public use. Use [[urlService]] instead.
75
- * @deprecated Use [[urlService]] instead
76
- */
77
- this.urlMatcherFactory = new UrlMatcherFactory(this.urlService.config);
78
-
79
- /**
80
- * Deprecated for public use. Use [[urlService]] instead.
81
- * @deprecated Use [[urlService]] instead
82
- */
83
- this.urlRouter = new UrlRouter(
84
- this.urlService,
85
- urlRuleFactory,
86
- $locationProvider,
87
- );
88
-
89
- /** Provides a registry for states, and related registration services */
90
- this.stateRegistry = new StateRegistry(
91
- this.urlMatcherFactory,
92
- this.urlService.rules,
93
- );
94
-
95
- // Manual wiring ideally we would want to do this at runtime
96
- this.stateService.stateRegistry = this.stateRegistry;
97
- this.stateService.urlRouter = this.urlRouter;
98
- this.stateService.urlService = this.urlService; // <-- NOTE: circular dependency
99
-
100
- // Lazy load state trees
101
- this.transitionService._deregisterHookFns.lazyLoad = registerLazyLoadHook(
102
- this.transitionService,
103
- this.stateService,
104
- this.urlService,
105
- this.stateRegistry,
106
- );
107
-
108
- // After globals.current is updated at priority: 10000
109
- this.transitionService._deregisterHookFns.updateUrl = registerUpdateUrl(
110
- this.transitionService,
111
- this.stateService,
112
- this.urlRouter,
113
- );
114
-
115
- // Wire up redirectTo hook
116
- this.transitionService._deregisterHookFns.redirectTo =
117
- registerRedirectToHook(this.transitionService, this.stateService);
118
-
119
- this.transitionService._deregisterHookFns.activateViews =
120
- registerActivateViews(this.transitionService, this.viewService);
121
- this.viewService._pluginapi._rootViewContext(this.stateRegistry.root());
122
- this.globals.$current = this.stateRegistry.root();
123
- this.globals.current = this.globals.$current.self;
124
- }
125
- }
@@ -1,76 +0,0 @@
1
- import { forEach, isDefined, isFunction, isObject } from "../../shared/utils";
2
- import { UrlMatcher } from "./url-matcher";
3
- import { ParamFactory } from "../params/param-factory";
4
-
5
- /**
6
- * Factory for [[UrlMatcher]] instances.
7
- *
8
- * The factory is available to ng1 services as
9
- * `$urlMatcherFactory` or ng1 providers as `$urlMatcherFactoryProvider`.
10
- */
11
- export class UrlMatcherFactory {
12
- // TODO: move implementations to UrlConfig (urlService.config)
13
- constructor(urlServiceConfig) {
14
- this.urlServiceConfig = urlServiceConfig;
15
- /** Creates a new [[Param]] for a given location (DefType) */
16
- this.paramFactory = new ParamFactory(urlServiceConfig);
17
- /** @deprecated use [[UrlConfig.caseInsensitive]] */
18
- this.caseInsensitive = (value) => urlServiceConfig.caseInsensitive(value);
19
- /** @deprecated use [[UrlConfig.defaultSquashPolicy]] */
20
- this.defaultSquashPolicy = (value) =>
21
- urlServiceConfig.defaultSquashPolicy(value);
22
- /** @deprecated use [[UrlConfig.strictMode]] */
23
- this.strictMode = (value) => urlServiceConfig.strictMode(value);
24
- /** @deprecated use [[UrlConfig.type]] */
25
- this.type = (name, definition, definitionFn) => {
26
- return urlServiceConfig.type(name, definition, definitionFn) || this;
27
- };
28
- }
29
- /**
30
- * Creates a [[UrlMatcher]] for the specified pattern.
31
- *
32
- * @param pattern The URL pattern.
33
- * @param config The config object hash.
34
- * @returns The UrlMatcher.
35
- */
36
- compile(pattern, config) {
37
- const urlConfig = this.urlServiceConfig;
38
- // backward-compatible support for config.params -> config.state.params
39
- const params = config && !config.state && config.params;
40
- config = params ? Object.assign({ state: { params } }, config) : config;
41
- const globalConfig = {
42
- strict: urlConfig._isStrictMode,
43
- caseInsensitive: urlConfig._isCaseInsensitive,
44
- };
45
- return new UrlMatcher(
46
- pattern,
47
- urlConfig.paramTypes,
48
- this.paramFactory,
49
- Object.assign(globalConfig, config),
50
- );
51
- }
52
- /**
53
- * Returns true if the specified object is a [[UrlMatcher]], or false otherwise.
54
- *
55
- * @param object The object to perform the type check against.
56
- * @returns `true` if the object matches the `UrlMatcher` interface, by
57
- * implementing all the same methods.
58
- */
59
- isMatcher(object) {
60
- // TODO: typeof?
61
- if (!isObject(object)) return false;
62
- let result = true;
63
- forEach(UrlMatcher.prototype, (val, name) => {
64
- if (isFunction(val))
65
- result = result && isDefined(object[name]) && isFunction(object[name]);
66
- });
67
- return result;
68
- }
69
-
70
- $get() {
71
- const urlConfig = this.urlServiceConfig;
72
- urlConfig.paramTypes.enqueue = false;
73
- urlConfig.paramTypes._flushTypeQueue();
74
- return this;
75
- }
76
- }
@@ -1,101 +0,0 @@
1
- import { EventBus } from "../../core/pubsub";
2
- import { stripLastPathElement } from "../../shared/strings";
3
-
4
- function appendBasePath(url, isHtml5, absolute, baseHref) {
5
- if (baseHref === "/") return url;
6
- if (isHtml5) return stripLastPathElement(baseHref) + url;
7
- if (absolute) return baseHref.slice(1) + url;
8
- return url;
9
- }
10
- /**
11
- * Updates URL and responds to URL changes
12
- *
13
- * ### Deprecation warning:
14
- * This class is now considered to be an internal API
15
- * Use the [[UrlService]] instead.
16
- * For configuring URL rules, use the [[UrlRules]] which can be found as [[UrlService.rules]].
17
- */
18
- export class UrlRouter {
19
- /**
20
- * @param {angular.UrlService} urlService
21
- */
22
- constructor(urlService, urlRuleFactory, $locationProvider) {
23
- this.urlService = urlService;
24
- this.urlRuleFactory = urlRuleFactory;
25
- this.$locationProvider = $locationProvider;
26
- EventBus.subscribe("$urlRouter:update", () => {
27
- this.update();
28
- });
29
- }
30
-
31
- update(read) {
32
- const $url = this.urlService;
33
- if (read) {
34
- this.location = $url.url();
35
- return;
36
- }
37
- if ($url.url() === this.location) return;
38
- $url.url(this.location, true);
39
- }
40
- /**
41
- * Pushes a new location to the browser history.
42
- *
43
- * @internal
44
- * @param urlMatcher
45
- * @param params
46
- * @param options
47
- */
48
- push(urlMatcher, params, options) {
49
- const replace = options && !!options.replace;
50
- this.urlService.url(urlMatcher.format(params || {}), replace);
51
- }
52
- /**
53
- * Builds and returns a URL with interpolated parameters
54
- *
55
- * #### Example:
56
- * ```js
57
- * matcher = $umf.compile("/about/:person");
58
- * params = { person: "bob" };
59
- * $bob = $urlRouter.href(matcher, params);
60
- * // $bob == "/about/bob";
61
- * ```
62
- *
63
- * @param urlMatcher The [[UrlMatcher]] object which is used as the template of the URL to generate.
64
- * @param params An object of parameter values to fill the matcher's required parameters.
65
- * @param options Options object. The options are:
66
- *
67
- * - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. "http://www.example.com/fullurl".
68
- *
69
- * @returns Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`
70
- */
71
- href(urlMatcher, params, options) {
72
- let url = urlMatcher.format(params);
73
- if (url == null) return null;
74
- options = options || { absolute: false };
75
- const cfg = this.urlService.config;
76
- const isHtml5 = this.urlService.html5Mode();
77
- if (!isHtml5 && url !== null) {
78
- url = "#" + this.$locationProvider.hashPrefix() + url;
79
- }
80
- url = appendBasePath(
81
- url,
82
- isHtml5,
83
- options.absolute,
84
- this.urlService.baseHref(),
85
- );
86
- if (!options.absolute || !url) {
87
- return url;
88
- }
89
- const slash = !isHtml5 && url ? "/" : "";
90
- const cfgPort = this.urlService.$location.port();
91
- const port = cfgPort === 80 || cfgPort === 443 ? "" : ":" + cfgPort;
92
- return [
93
- cfg.protocol(),
94
- "://",
95
- this.urlService.$location.host(),
96
- port,
97
- slash,
98
- url,
99
- ].join("");
100
- }
101
- }
@@ -1,33 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <script src="../legacy/angular.js"></script>
5
-
6
- <script src="//unpkg.com/@uirouter/angularjs/release/angular-ui-router.js"></script>
7
- <script>
8
- var myApp = angular.module("test", ["ng.router"]);
9
-
10
- myApp.config(function ($stateProvider) {
11
- var helloState = {
12
- name: "hello",
13
- url: "/",
14
- template: "<h3>hello world!</h3>",
15
- };
16
-
17
- var aboutState = {
18
- name: "about",
19
- url: "/about",
20
- template: "<h3>Its the UI-Router hello world app!</h3>",
21
- };
22
-
23
- $stateProvider.state(helloState);
24
- $stateProvider.state(aboutState);
25
- });
26
- </script>
27
- </head>
28
- <body ng-app="test">
29
- <a ng-sref="hello" ng-sref-active="active">Hello</a>
30
- <ng-view></ng-view>
31
- {{ 2 + 2}}
32
- </body>
33
- </html>