@angular-wave/angular.ts 0.0.15 → 0.0.17
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 +5 -3
- package/dist/angular-ts.esm.js +1 -1
- package/dist/angular-ts.umd.js +1 -1
- package/index.html +66 -57
- package/package.json +1 -1
- package/src/animations/animate-children-directive.js +1 -1
- package/src/animations/animate-css-driver.js +1 -1
- package/src/animations/animate-css.js +2 -2
- package/src/animations/animate-js-driver.js +1 -1
- package/src/animations/animate-js.js +2 -2
- package/src/animations/animate-queue.js +3 -4
- package/src/animations/animation.js +1 -1
- package/src/animations/shared.js +4 -4
- package/src/core/animate-runner.js +1 -1
- package/src/core/animate.js +4 -5
- package/src/core/compile.js +5 -6
- package/src/core/controller.js +4 -3
- package/src/core/filter.js +1 -1
- package/src/core/interpolate.js +1 -1
- package/src/core/interval-factory.js +1 -1
- package/src/core/interval.js +1 -1
- package/src/core/location.js +1 -1
- package/src/core/parser/parse.js +1 -1
- package/src/core/q.js +2 -3
- package/src/core/root-scope.js +1 -1
- package/src/core/sanitize-uri.js +1 -1
- package/src/core/sce.js +1 -1
- package/src/core/task-tracker-factory.js +1 -1
- package/src/core/timeout.js +1 -1
- package/src/core/urlUtils.js +1 -1
- package/src/directive/attrs.js +1 -1
- package/src/directive/bind.js +1 -1
- package/src/directive/class.js +2 -2
- package/src/directive/events.js +1 -1
- package/src/directive/form.js +1 -1
- package/src/directive/include.js +1 -1
- package/src/directive/input.js +1 -1
- package/src/directive/list.js +2 -2
- package/src/directive/model-options.js +1 -1
- package/src/directive/model.js +1 -1
- package/src/directive/options.js +2 -3
- package/src/directive/ref.js +1 -1
- package/src/directive/repeat.js +1 -1
- package/src/directive/select.js +1 -1
- package/src/directive/switch.js +1 -1
- package/src/directive/transclude.js +1 -1
- package/src/directive/validators.js +1 -1
- package/src/exts/aria.js +1 -1
- package/src/exts/messages.js +3 -3
- package/src/exts/messages.md +28 -31
- package/src/filters/filter.js +2 -3
- package/src/filters/filters.js +1 -1
- package/src/filters/limit-to.js +1 -1
- package/src/filters/order-by.js +2 -3
- package/src/injector.js +8 -9
- package/src/jqLite.js +3 -4
- package/src/loader.js +1 -3
- package/src/public.js +1 -1
- package/src/router/common/coreservices.js +5 -0
- package/src/router/{core/common → common}/queue.js +1 -1
- package/src/router/{core/common → common}/trace.js +21 -19
- package/src/router/{adapter/directives → directives}/stateDirectives.js +24 -28
- package/src/router/{adapter/directives → directives}/viewDirective.js +9 -9
- package/src/router/{core/globals.js → globals.js} +13 -3
- package/src/router/{core/hooks → hooks}/coreResolvables.js +6 -4
- package/src/router/{core/hooks → hooks}/lazyLoad.js +5 -2
- package/src/router/{core/hooks → hooks}/redirectTo.js +1 -1
- package/src/router/{core/hooks → hooks}/resolve.js +2 -2
- package/src/router/{core/hooks → hooks}/updateGlobals.js +1 -1
- package/src/router/{core/hooks → hooks}/views.js +1 -1
- package/src/router/index.js +60 -0
- package/src/router/{adapter/injectables.js → injectables.js} +9 -9
- package/src/router/{adapter/locationServices.js → locationServices.js} +19 -12
- package/src/router/{core/params → params}/param.js +5 -10
- package/src/router/{core/params → params}/paramType.js +4 -4
- package/src/router/{core/params → params}/paramTypes.js +4 -3
- package/src/router/{core/params → params}/stateParams.js +1 -1
- package/src/router/{core/path → path}/pathNode.js +2 -2
- package/src/router/{core/path → path}/pathUtils.js +13 -7
- package/src/router/{core/resolve → resolve}/resolvable.js +5 -5
- package/src/router/{core/resolve → resolve}/resolveContext.js +16 -6
- package/src/router/router.js +172 -72
- package/src/router/{adapter/services.js → services.js} +47 -27
- package/src/router/{core/state → state}/stateBuilder.js +14 -10
- package/src/router/{core/state → state}/stateMatcher.js +2 -3
- package/src/router/{core/state → state}/stateObject.js +8 -6
- package/src/router/{core/state → state}/stateQueueManager.js +3 -3
- package/src/router/{core/state → state}/stateRegistry.js +6 -7
- package/src/router/{core/state → state}/stateService.js +12 -15
- package/src/router/{core/state → state}/targetState.js +2 -2
- package/src/router/{adapter/statebuilders → state}/views.js +17 -15
- package/src/router/{adapter/stateProvider.js → stateProvider.js} +52 -9
- package/src/router/{adapter/templateFactory.js → templateFactory.js} +10 -19
- package/src/router/{core/transition → transition}/hookBuilder.js +4 -3
- package/src/router/{core/transition → transition}/hookRegistry.js +3 -6
- package/src/router/{core/transition → transition}/rejectFactory.js +4 -5
- package/src/router/{core/transition → transition}/transition.js +10 -12
- package/src/router/{core/transition → transition}/transitionHook.js +4 -4
- package/src/router/{core/transition → transition}/transitionService.js +13 -13
- package/src/router/{core/url → url}/urlConfig.js +28 -19
- package/src/router/{core/url → url}/urlMatcher.js +14 -16
- package/src/router/{core/url → url}/urlMatcherFactory.js +7 -6
- package/src/router/{core/url → url}/urlRouter.js +6 -30
- package/src/router/{core/url → url}/urlRule.js +3 -3
- package/src/router/{core/url → url}/urlRules.js +10 -11
- package/src/router/{core/url → url}/urlService.js +12 -6
- package/src/router/{core/view → view}/view.js +32 -27
- package/src/router/{adapter/viewScroll.js → viewScroll.js} +3 -0
- package/src/services/anchor-scroll.js +1 -1
- package/src/services/browser.js +1 -1
- package/src/services/cache-factory.js +7 -1
- package/src/services/cookie-reader.js +1 -1
- package/src/services/http-backend.js +6 -1
- package/src/services/http.js +4 -5
- package/src/services/log.js +1 -1
- package/src/services/template-request.js +2 -2
- package/src/{router/core/common → shared}/common.js +35 -16
- package/src/{router/core/common → shared}/predicates.js +2 -12
- package/src/{router/core/common → shared}/strings.js +5 -13
- package/src/{core → shared}/utils.js +13 -29
- package/test/angular.spec.js +1 -31
- package/test/{ng → core}/animate.spec.js +1 -1
- package/test/{ng → core}/compile.spec.js +2 -3
- package/test/{ng → core}/http.spec.js +2 -2
- package/test/{ng → core}/on.spec.js +1 -1
- package/test/{ng → core}/parse.spec.js +1 -1
- package/test/{ng → core}/prop.spec.js +1 -1
- package/test/{ng → core}/scope.spec.js +1 -1
- package/test/{ng/directive → directive}/a.spec.js +4 -4
- package/test/{ng/directive → directive}/bind.spec.js +3 -3
- package/test/{ng/directive → directive}/boolean.spec.js +2 -2
- package/test/{ng/directive → directive}/change.spec.js +3 -3
- package/test/{ng/directive → directive}/class.spec.js +4 -4
- package/test/{ng/directive → directive}/click.spec.js +3 -3
- package/test/{ng/directive → directive}/cloak.spec.js +4 -4
- package/test/{ng/directive → directive}/constoller.spec.js +5 -5
- package/test/{ng/directive → directive}/element-style.spec.js +3 -3
- package/test/{ng/directive → directive}/event.spec.js +4 -4
- package/test/{ng/directive → directive}/form.spec.js +5 -5
- package/test/{ng/directive → directive}/href.spec.js +4 -4
- package/test/{ng/directive → directive}/if.spec.js +5 -5
- package/test/{ng/directive → directive}/include.spec.js +5 -5
- package/test/{ng/directive → directive}/init.spec.js +4 -4
- package/test/{ng/directive → directive}/input.spec.js +5 -5
- package/test/{ng/directive → directive}/list.spec.js +3 -3
- package/test/{ng/directive → directive}/model-options.spec.js +6 -6
- package/test/{ng/directive → directive}/model.spec.js +8 -8
- package/test/{ng/directive → directive}/non-bindable.spec.js +3 -3
- package/test/{ng/directive → directive}/options.spec.js +5 -5
- package/test/{ng/directive → directive}/ref.spec.js +2 -2
- package/test/{ng/directive → directive}/repeat.spec.js +5 -5
- package/test/{ng/directive → directive}/script.spec.js +3 -3
- package/test/{ng/directive → directive}/scrset.spec.js +3 -3
- package/test/{ng/directive → directive}/select.spec.js +5 -5
- package/test/{ng/directive → directive}/show-hide.spec.js +3 -3
- package/test/{ng/directive → directive}/src.spec.js +3 -3
- package/test/{ng/directive → directive}/style.spec.js +3 -3
- package/test/{ng/directive → directive}/switch.spec.js +3 -3
- package/test/{ng/directive → directive}/validators.spec.js +3 -3
- package/test/{ng/filter → filter}/filter.spec.js +4 -4
- package/test/{ng/filter → filter}/filters.spec.js +3 -3
- package/test/{ng/filter → filter}/limit-to.spec.js +3 -3
- package/test/{ng/filter → filter}/order-by.spec.js +2 -2
- package/test/injector.spec.js +1 -1
- package/test/jqlite.spec.js +1 -1
- package/test/messages/messages.spec.js +1 -1
- package/test/min-err.spec.js +1 -1
- package/test/original-test.html +4 -4
- package/test/router/glob.spec.js +78 -0
- package/test/router/state.spec.js +931 -0
- package/test/sanitize/bing-html.spec.js +1 -1
- package/test/shared/common.spec.js +283 -0
- package/test/shared/hof.spec.js +60 -0
- package/test/shared/strings.spec.js +40 -0
- package/test/{ng → shared}/utils.spec.js +1 -1
- package/types/router/angular.d.ts +1 -0
- package/types/router/core/common/common.d.ts +370 -0
- package/types/router/core/common/coreservices.d.ts +80 -0
- package/types/router/core/common/glob.d.ts +60 -0
- package/types/router/core/common/hof.d.ts +160 -0
- package/types/router/core/common/index.d.ts +8 -0
- package/types/router/core/common/predicates.d.ts +25 -0
- package/types/router/core/common/queue.d.ts +15 -0
- package/types/router/core/common/safeConsole.d.ts +5 -0
- package/types/router/core/common/strings.d.ts +64 -0
- package/types/router/core/common/trace.d.ts +114 -0
- package/types/router/core/globals.d.ts +45 -0
- package/types/router/core/hooks/coreResolvables.d.ts +4 -0
- package/types/router/core/hooks/ignoredTransition.d.ts +2 -0
- package/types/router/core/hooks/invalidTransition.d.ts +2 -0
- package/types/router/core/hooks/lazyLoad.d.ts +12 -0
- package/types/router/core/hooks/onEnterExitRetain.d.ts +4 -0
- package/types/router/core/hooks/redirectTo.d.ts +2 -0
- package/types/router/core/hooks/resolve.d.ts +5 -0
- package/types/router/core/hooks/updateGlobals.d.ts +2 -0
- package/types/router/core/hooks/url.d.ts +2 -0
- package/types/router/core/hooks/views.d.ts +3 -0
- package/types/router/core/index.d.ts +12 -0
- package/types/router/core/interface.d.ts +102 -0
- package/types/router/core/params/index.d.ts +12 -0
- package/types/router/core/params/interface.d.ts +606 -0
- package/types/router/core/params/param.d.ts +65 -0
- package/types/router/core/params/paramType.d.ts +65 -0
- package/types/router/core/params/paramTypes.d.ts +190 -0
- package/types/router/core/params/stateParams.d.ts +15 -0
- package/types/router/core/path/index.d.ts +2 -0
- package/types/router/core/path/pathNode.d.ts +60 -0
- package/types/router/core/path/pathUtils.d.ts +79 -0
- package/types/router/core/resolve/index.d.ts +3 -0
- package/types/router/core/resolve/interface.d.ts +210 -0
- package/types/router/core/resolve/resolvable.d.ts +69 -0
- package/types/router/core/resolve/resolveContext.d.ts +92 -0
- package/types/router/core/router.d.ts +95 -0
- package/types/router/core/state/index.d.ts +28 -0
- package/types/router/core/state/interface.d.ts +708 -0
- package/types/router/core/state/stateBuilder.d.ts +104 -0
- package/types/router/core/state/stateMatcher.d.ts +11 -0
- package/types/router/core/state/stateObject.d.ts +155 -0
- package/types/router/core/state/stateQueueManager.d.ts +24 -0
- package/types/router/core/state/stateRegistry.d.ts +136 -0
- package/types/router/core/state/stateService.d.ts +350 -0
- package/types/router/core/state/targetState.d.ts +100 -0
- package/types/router/core/transition/hookBuilder.d.ts +45 -0
- package/types/router/core/transition/hookRegistry.d.ts +93 -0
- package/types/router/core/transition/index.d.ts +20 -0
- package/types/router/core/transition/interface.d.ts +819 -0
- package/types/router/core/transition/rejectFactory.d.ts +103 -0
- package/types/router/core/transition/transition.d.ts +527 -0
- package/types/router/core/transition/transitionEventType.d.ts +17 -0
- package/types/router/core/transition/transitionHook.d.ts +88 -0
- package/types/router/core/transition/transitionService.d.ts +187 -0
- package/types/router/core/url/index.d.ts +8 -0
- package/types/router/core/url/interface.d.ts +156 -0
- package/types/router/core/url/urlConfig.d.ts +141 -0
- package/types/router/core/url/urlMatcher.d.ts +180 -0
- package/types/router/core/url/urlMatcherFactory.d.ts +52 -0
- package/types/router/core/url/urlRouter.d.ts +85 -0
- package/types/router/core/url/urlRule.d.ts +120 -0
- package/types/router/core/url/urlRules.d.ts +244 -0
- package/types/router/core/url/urlService.d.ts +206 -0
- package/types/router/core/vanilla.d.ts +1 -0
- package/types/router/core/view/index.d.ts +2 -0
- package/types/router/core/view/interface.d.ts +46 -0
- package/types/router/core/view/view.d.ts +167 -0
- package/types/router/directives/stateDirectives.d.ts +3 -0
- package/types/router/directives/viewDirective.d.ts +143 -0
- package/types/router/index.d.ts +19 -0
- package/types/router/interface.d.ts +491 -0
- package/types/router/legacy/resolveService.d.ts +44 -0
- package/types/router/legacy/stateEvents.d.ts +123 -0
- package/types/router/locationServices.d.ts +43 -0
- package/types/router/services.d.ts +15 -0
- package/types/router/stateFilters.d.ts +11 -0
- package/types/router/stateProvider.d.ts +254 -0
- package/types/router/statebuilders/onEnterExitRetain.d.ts +12 -0
- package/types/router/statebuilders/views.d.ts +41 -0
- package/types/router/templateFactory.d.ts +84 -0
- package/types/router/viewScroll.d.ts +9 -0
- package/src/router/adapter/statebuilders/onEnterExitRetain.js +0 -29
- package/src/router/core/common/coreservices.js +0 -15
- package/src/router/core/common/safeConsole.js +0 -38
- package/src/router/core/interface.js +0 -3
- package/src/router/core/resolve/interface.js +0 -10
- package/src/router/core/router.js +0 -203
- package/src/router/core/url/interface.js +0 -1
- package/src/router/core/view/interface.js +0 -1
- /package/src/router/{core/common → common}/glob.js +0 -0
- /package/src/router/{core/hooks → hooks}/ignoredTransition.js +0 -0
- /package/src/router/{core/hooks → hooks}/invalidTransition.js +0 -0
- /package/src/router/{core/hooks → hooks}/onEnterExitRetain.js +0 -0
- /package/src/router/{core/hooks → hooks}/url.js +0 -0
- /package/src/router/{core/params → params}/README.md +0 -0
- /package/src/router/{core/state → state}/README.md +0 -0
- /package/src/router/{adapter/stateFilters.js → stateFilters.js} +0 -0
- /package/src/router/{core/transition → transition}/interface.js +0 -0
- /package/src/router/{core/transition → transition}/transitionEventType.js +0 -0
- /package/src/{router/core/common → shared}/hof.js +0 -0
- /package/test/{ng → core}/cache-factor.spec.js +0 -0
- /package/test/{ng → core}/controller-provider.spec.js +0 -0
- /package/test/{ng → core}/cookie-reader.spec.js +0 -0
- /package/test/{ng → core}/document.spec.js +0 -0
- /package/test/{ng → core}/filter.spec.js +0 -0
- /package/test/{ng → core}/http-backend.spec.js +0 -0
- /package/test/{ng → core}/interpolate.spec.js +0 -0
- /package/test/{ng → core}/interval.spec.js +0 -0
- /package/test/{ng → core}/location.spec.js +0 -0
- /package/test/{ng → core}/q.spec.js +0 -0
- /package/test/{ng → core}/root-element.spec.js +0 -0
- /package/test/{ng → core}/sanitize-uri.spec.js +0 -0
- /package/test/{ng → core}/sce.spec.js +0 -0
- /package/test/{ng → core}/template-request.spec.js +0 -0
- /package/test/{ng → core}/timeout.spec.js +0 -0
- /package/test/{ng → core}/url-utils.spec.js +0 -0
- /package/{src/router/adapter/interface.js → types/router/injectables.d.ts} +0 -0
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { forEach, isDefined, isFunction, isObject } from "
|
|
1
|
+
import { forEach, isDefined, isFunction, isObject } from "../../shared/utils";
|
|
2
2
|
import { UrlMatcher } from "./urlMatcher";
|
|
3
3
|
import { DefType, Param } from "../params/param";
|
|
4
4
|
|
|
5
5
|
export class ParamFactory {
|
|
6
|
+
constructor(router) {
|
|
7
|
+
this.router = router;
|
|
8
|
+
}
|
|
9
|
+
|
|
6
10
|
fromConfig(id, type, state) {
|
|
7
11
|
return new Param(
|
|
8
12
|
id,
|
|
@@ -30,9 +34,6 @@ export class ParamFactory {
|
|
|
30
34
|
state,
|
|
31
35
|
);
|
|
32
36
|
}
|
|
33
|
-
constructor(router) {
|
|
34
|
-
this.router = router;
|
|
35
|
-
}
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
39
|
* Factory for [[UrlMatcher]] instances.
|
|
@@ -42,7 +43,7 @@ export class ParamFactory {
|
|
|
42
43
|
*/
|
|
43
44
|
export class UrlMatcherFactory {
|
|
44
45
|
// TODO: move implementations to UrlConfig (urlService.config)
|
|
45
|
-
constructor(
|
|
46
|
+
constructor(router) {
|
|
46
47
|
this.router = router;
|
|
47
48
|
/** Creates a new [[Param]] for a given location (DefType) */
|
|
48
49
|
this.paramFactory = new ParamFactory(this.router);
|
|
@@ -107,7 +108,7 @@ export class UrlMatcherFactory {
|
|
|
107
108
|
});
|
|
108
109
|
return result;
|
|
109
110
|
}
|
|
110
|
-
|
|
111
|
+
|
|
111
112
|
$get() {
|
|
112
113
|
const urlConfig = this.router.urlService.config;
|
|
113
114
|
urlConfig.paramTypes.enqueue = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { stripLastPathElement } from "
|
|
1
|
+
import { stripLastPathElement } from "../../shared/strings";
|
|
2
2
|
import { UrlRuleFactory } from "./urlRule";
|
|
3
3
|
function appendBasePath(url, isHtml5, absolute, baseHref) {
|
|
4
4
|
if (baseHref === "/") return url;
|
|
@@ -15,36 +15,12 @@ function appendBasePath(url, isHtml5, absolute, baseHref) {
|
|
|
15
15
|
* For configuring URL rules, use the [[UrlRules]] which can be found as [[UrlService.rules]].
|
|
16
16
|
*/
|
|
17
17
|
export class UrlRouter {
|
|
18
|
-
/**
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param {import('../router').UIRouter} router
|
|
21
|
+
*/
|
|
22
|
+
constructor(router) {
|
|
20
23
|
this.router = router;
|
|
21
|
-
// Delegate these calls to [[UrlService]]
|
|
22
|
-
/** @deprecated use [[UrlService.sync]]*/
|
|
23
|
-
this.sync = (evt) => this.router.urlService.sync(evt);
|
|
24
|
-
/** @deprecated use [[UrlService.listen]]*/
|
|
25
|
-
this.listen = (enabled) => this.router.urlService.listen(enabled);
|
|
26
|
-
/** @deprecated use [[UrlService.deferIntercept]]*/
|
|
27
|
-
this.deferIntercept = (defer) =>
|
|
28
|
-
this.router.urlService.deferIntercept(defer);
|
|
29
|
-
/** @deprecated use [[UrlService.match]]*/
|
|
30
|
-
this.match = (urlParts) => this.router.urlService.match(urlParts);
|
|
31
|
-
// Delegate these calls to [[UrlRules]]
|
|
32
|
-
/** @deprecated use [[UrlRules.initial]]*/
|
|
33
|
-
this.initial = (handler) => this.router.urlService.rules.initial(handler);
|
|
34
|
-
/** @deprecated use [[UrlRules.otherwise]]*/
|
|
35
|
-
this.otherwise = (handler) =>
|
|
36
|
-
this.router.urlService.rules.otherwise(handler);
|
|
37
|
-
/** @deprecated use [[UrlRules.removeRule]]*/
|
|
38
|
-
this.removeRule = (rule) => this.router.urlService.rules.removeRule(rule);
|
|
39
|
-
/** @deprecated use [[UrlRules.rule]]*/
|
|
40
|
-
this.rule = (rule) => this.router.urlService.rules.rule(rule);
|
|
41
|
-
/** @deprecated use [[UrlRules.rules]]*/
|
|
42
|
-
this.rules = () => this.router.urlService.rules.rules();
|
|
43
|
-
/** @deprecated use [[UrlRules.sort]]*/
|
|
44
|
-
this.sort = (compareFn) => this.router.urlService.rules.sort(compareFn);
|
|
45
|
-
/** @deprecated use [[UrlRules.when]]*/
|
|
46
|
-
this.when = (matcher, handler, options) =>
|
|
47
|
-
this.router.urlService.rules.when(matcher, handler, options);
|
|
48
24
|
this.urlRuleFactory = new UrlRuleFactory(router);
|
|
49
25
|
}
|
|
50
26
|
/** Internal API. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UrlMatcher } from "./urlMatcher";
|
|
2
|
-
import { isString,
|
|
3
|
-
import { identity } from "
|
|
4
|
-
import { is, or, pattern } from "
|
|
2
|
+
import { isString, isFunction, isDefined } from "../../shared/utils";
|
|
3
|
+
import { identity } from "../../shared/common";
|
|
4
|
+
import { is, or, pattern } from "../../shared/hof";
|
|
5
5
|
import { StateObject } from "../state/stateObject";
|
|
6
6
|
/**
|
|
7
7
|
* Creates a [[UrlRule]]
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TargetState } from "../state/targetState";
|
|
2
2
|
import { UrlMatcher } from "./urlMatcher";
|
|
3
|
-
import { is, val } from "
|
|
4
|
-
import { isDefined, isFunction, isString } from "
|
|
5
|
-
import { removeFrom } from "
|
|
3
|
+
import { is, val } from "../../shared/hof";
|
|
4
|
+
import { isDefined, isFunction, isString } from "../../shared/utils";
|
|
5
|
+
import { removeFrom } from "../../shared/common";
|
|
6
6
|
import { UrlRuleFactory } from "./urlRule";
|
|
7
7
|
const prioritySort = (a, b) => (b.priority || 0) - (a.priority || 0);
|
|
8
8
|
const typeSort = (a, b) => {
|
|
@@ -65,15 +65,14 @@ function getHandlerFn(handler) {
|
|
|
65
65
|
* This API is found at `router.urlService.rules` (see: [[UIRouter.urlService]], [[URLService.rules]])
|
|
66
66
|
*/
|
|
67
67
|
export class UrlRules {
|
|
68
|
-
|
|
69
|
-
constructor(/** @internal */ router) {
|
|
68
|
+
constructor(router) {
|
|
70
69
|
this.router = router;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
this._sortFn = defaultRuleSortFn;
|
|
71
|
+
this._rules = [];
|
|
72
|
+
this._id = 0;
|
|
74
73
|
this.urlRuleFactory = new UrlRuleFactory(router);
|
|
75
74
|
}
|
|
76
|
-
|
|
75
|
+
|
|
77
76
|
dispose(router) {
|
|
78
77
|
this._rules = [];
|
|
79
78
|
delete this._otherwiseFn;
|
|
@@ -266,11 +265,11 @@ export class UrlRules {
|
|
|
266
265
|
this._rules = sorted;
|
|
267
266
|
this._sorted = true;
|
|
268
267
|
}
|
|
269
|
-
|
|
268
|
+
|
|
270
269
|
ensureSorted() {
|
|
271
270
|
this._sorted || this.sort();
|
|
272
271
|
}
|
|
273
|
-
|
|
272
|
+
|
|
274
273
|
stableSort(arr, compareFn) {
|
|
275
274
|
const arrOfWrapper = arr.map((elem, idx) => ({ elem, idx }));
|
|
276
275
|
arrOfWrapper.sort((wrapperA, wrapperB) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isString } from "
|
|
2
|
-
import { is, pattern } from "
|
|
1
|
+
import { isString } from "../../shared/utils";
|
|
2
|
+
import { is, pattern } from "../../shared/hof";
|
|
3
3
|
import { UrlRules } from "./urlRules";
|
|
4
4
|
import { UrlConfig } from "./urlConfig";
|
|
5
5
|
import { TargetState } from "../state/targetState";
|
|
@@ -7,10 +7,16 @@ import { TargetState } from "../state/targetState";
|
|
|
7
7
|
* API for URL management
|
|
8
8
|
*/
|
|
9
9
|
export class UrlService {
|
|
10
|
-
/**
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {import('../router').UIRouter} router
|
|
13
|
+
*/
|
|
14
|
+
constructor(router) {
|
|
15
|
+
/**
|
|
16
|
+
* @type {import('../router').UIRouter}
|
|
17
|
+
*/
|
|
12
18
|
this.router = router;
|
|
13
|
-
|
|
19
|
+
this.interceptDeferred = false;
|
|
14
20
|
/**
|
|
15
21
|
* The nested [[UrlRules]] API for managing URL rules and rewrites
|
|
16
22
|
*
|
|
@@ -120,7 +126,7 @@ export class UrlService {
|
|
|
120
126
|
this.onChange = (callback) =>
|
|
121
127
|
this.router.locationService.onChange(callback);
|
|
122
128
|
}
|
|
123
|
-
|
|
129
|
+
|
|
124
130
|
dispose() {
|
|
125
131
|
this.listen(false);
|
|
126
132
|
this.rules.dispose();
|
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
removeFrom,
|
|
5
5
|
inArray,
|
|
6
6
|
find,
|
|
7
|
-
} from "
|
|
8
|
-
import { curry, prop } from "
|
|
9
|
-
import { isString
|
|
7
|
+
} from "../../shared/common";
|
|
8
|
+
import { curry, prop } from "../../shared/hof";
|
|
9
|
+
import { isString } from "../../shared/utils";
|
|
10
10
|
import { trace } from "../common/trace";
|
|
11
11
|
/**
|
|
12
12
|
* The View service
|
|
@@ -25,6 +25,32 @@ import { trace } from "../common/trace";
|
|
|
25
25
|
*
|
|
26
26
|
*/
|
|
27
27
|
export class ViewService {
|
|
28
|
+
/**
|
|
29
|
+
* @param {import('../router').UIRouter} router
|
|
30
|
+
*/
|
|
31
|
+
constructor(router) {
|
|
32
|
+
/**
|
|
33
|
+
* @type {import('../router').UIRouter}
|
|
34
|
+
*/
|
|
35
|
+
this.router = router;
|
|
36
|
+
this._uiViews = [];
|
|
37
|
+
this._viewConfigs = [];
|
|
38
|
+
this._viewConfigFactories = {};
|
|
39
|
+
this._listeners = [];
|
|
40
|
+
this._pluginapi = {
|
|
41
|
+
_rootViewContext: this._rootViewContext.bind(this),
|
|
42
|
+
_viewConfigFactory: this._viewConfigFactory.bind(this),
|
|
43
|
+
_registeredUIView: (id) =>
|
|
44
|
+
find(this._uiViews, (view) => `${this.router.$id}.${view.id}` === id),
|
|
45
|
+
_registeredUIViews: () => this._uiViews,
|
|
46
|
+
_activeViewConfigs: () => this._viewConfigs,
|
|
47
|
+
_onSync: (listener) => {
|
|
48
|
+
this._listeners.push(listener);
|
|
49
|
+
return () => removeFrom(this._listeners, listener);
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
28
54
|
/**
|
|
29
55
|
* Normalizes a view's name from a state.views configuration block.
|
|
30
56
|
*
|
|
@@ -69,32 +95,11 @@ export class ViewService {
|
|
|
69
95
|
}
|
|
70
96
|
return { uiViewName, uiViewContextAnchor };
|
|
71
97
|
}
|
|
72
|
-
|
|
73
|
-
constructor(/** @internal */ router) {
|
|
74
|
-
this.router = router;
|
|
75
|
-
/** @internal */ this._uiViews = [];
|
|
76
|
-
/** @internal */ this._viewConfigs = [];
|
|
77
|
-
/** @internal */ this._viewConfigFactories = {};
|
|
78
|
-
/** @internal */ this._listeners = [];
|
|
79
|
-
/** @internal */
|
|
80
|
-
this._pluginapi = {
|
|
81
|
-
_rootViewContext: this._rootViewContext.bind(this),
|
|
82
|
-
_viewConfigFactory: this._viewConfigFactory.bind(this),
|
|
83
|
-
_registeredUIView: (id) =>
|
|
84
|
-
find(this._uiViews, (view) => `${this.router.$id}.${view.id}` === id),
|
|
85
|
-
_registeredUIViews: () => this._uiViews,
|
|
86
|
-
_activeViewConfigs: () => this._viewConfigs,
|
|
87
|
-
_onSync: (listener) => {
|
|
88
|
-
this._listeners.push(listener);
|
|
89
|
-
return () => removeFrom(this._listeners, listener);
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
/** @internal */
|
|
98
|
+
|
|
94
99
|
_rootViewContext(context) {
|
|
95
100
|
return (this._rootContext = context || this._rootContext);
|
|
96
101
|
}
|
|
97
|
-
|
|
102
|
+
|
|
98
103
|
_viewConfigFactory(viewType, factory) {
|
|
99
104
|
this._viewConfigFactories[viewType] = factory;
|
|
100
105
|
}
|
|
@@ -105,7 +110,7 @@ export class ViewService {
|
|
|
105
110
|
"ViewService: No view config factory registered for type " + decl.$type,
|
|
106
111
|
);
|
|
107
112
|
const cfgs = cfgFactory(path, decl);
|
|
108
|
-
return isArray(cfgs) ? cfgs : [cfgs];
|
|
113
|
+
return Array.isArray(cfgs) ? cfgs : [cfgs];
|
|
109
114
|
}
|
|
110
115
|
/**
|
|
111
116
|
* Deactivates a ViewConfig.
|
package/src/services/browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jqLite } from "../jqLite";
|
|
2
2
|
import { urlResolve } from "../core/urlUtils";
|
|
3
|
-
import { forEach, isUndefined, equals } from "../
|
|
3
|
+
import { forEach, isUndefined, equals } from "../shared/utils";
|
|
4
4
|
|
|
5
5
|
// This variable should be used *only* inside the cacheState function.
|
|
6
6
|
let lastCachedState = null;
|
package/src/services/http.js
CHANGED
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
forEachSorted,
|
|
8
8
|
isUndefined,
|
|
9
9
|
isFunction,
|
|
10
|
-
isArray,
|
|
11
10
|
forEach,
|
|
12
11
|
encodeUriQuery,
|
|
13
12
|
isString,
|
|
@@ -23,7 +22,7 @@ import {
|
|
|
23
22
|
extend,
|
|
24
23
|
uppercase,
|
|
25
24
|
isPromiseLike,
|
|
26
|
-
} from "../
|
|
25
|
+
} from "../shared/utils";
|
|
27
26
|
|
|
28
27
|
const APPLICATION_JSON = "application/json";
|
|
29
28
|
const CONTENT_TYPE_APPLICATION_JSON = {
|
|
@@ -67,7 +66,7 @@ export function $HttpParamSerializerProvider() {
|
|
|
67
66
|
const parts = [];
|
|
68
67
|
forEachSorted(params, (value, key) => {
|
|
69
68
|
if (value === null || isUndefined(value) || isFunction(value)) return;
|
|
70
|
-
if (isArray(value)) {
|
|
69
|
+
if (Array.isArray(value)) {
|
|
71
70
|
forEach(value, (v) => {
|
|
72
71
|
parts.push(
|
|
73
72
|
`${encodeUriQuery(key)}=${encodeUriQuery(serializeValue(v))}`,
|
|
@@ -138,7 +137,7 @@ export function $HttpParamSerializerJQLikeProvider() {
|
|
|
138
137
|
return parts.join("&");
|
|
139
138
|
|
|
140
139
|
function serialize(toSerialize, prefix, topLevel) {
|
|
141
|
-
if (isArray(toSerialize)) {
|
|
140
|
+
if (Array.isArray(toSerialize)) {
|
|
142
141
|
forEach(toSerialize, (value, index) => {
|
|
143
142
|
serialize(value, `${prefix}[${isObject(value) ? index : ""}]`);
|
|
144
143
|
});
|
|
@@ -1380,7 +1379,7 @@ export function $HttpProvider() {
|
|
|
1380
1379
|
);
|
|
1381
1380
|
} else {
|
|
1382
1381
|
// serving from cache
|
|
1383
|
-
if (isArray(cachedResp)) {
|
|
1382
|
+
if (Array.isArray(cachedResp)) {
|
|
1384
1383
|
resolvePromise(
|
|
1385
1384
|
cachedResp[1],
|
|
1386
1385
|
cachedResp[0],
|
package/src/services/log.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defaultHttpResponseTransform } from "./http";
|
|
2
|
-
import { extend,
|
|
2
|
+
import { extend, isString, isUndefined, minErr } from "../shared/utils";
|
|
3
3
|
|
|
4
4
|
var $templateRequestMinErr = minErr("$templateRequest");
|
|
5
5
|
|
|
@@ -88,7 +88,7 @@ export function TemplateRequestProvider() {
|
|
|
88
88
|
var transformResponse =
|
|
89
89
|
$http.defaults && $http.defaults.transformResponse;
|
|
90
90
|
|
|
91
|
-
if (isArray(transformResponse)) {
|
|
91
|
+
if (Array.isArray(transformResponse)) {
|
|
92
92
|
transformResponse = transformResponse.filter(function (transformer) {
|
|
93
93
|
return transformer !== defaultHttpResponseTransform;
|
|
94
94
|
});
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
* @preferred
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { isDate, isFunction, isRegExp, isString } from "./utils";
|
|
10
10
|
import { all, any, prop, curry, not } from "./hof";
|
|
11
|
-
import { services } from "
|
|
11
|
+
import { services } from "../router/common/coreservices";
|
|
12
12
|
export const root =
|
|
13
13
|
(typeof self === "object" && self.self === self && self) ||
|
|
14
14
|
(typeof global === "object" && global.global === global && global) ||
|
|
@@ -100,11 +100,27 @@ export function createProxyFunctions(
|
|
|
100
100
|
* prototypal inheritance helper.
|
|
101
101
|
* Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it
|
|
102
102
|
*/
|
|
103
|
-
|
|
104
|
-
/**
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* prototypal inheritance helper.
|
|
106
|
+
* Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it.
|
|
107
|
+
*
|
|
108
|
+
* @param {Object} parent - The object to be used as the prototype.
|
|
109
|
+
* @param {Object} [extra] - The object containing additional properties to be copied.
|
|
110
|
+
* @returns {Object} - A new object with `parent` as its prototype and properties from `extra`.
|
|
111
|
+
*/
|
|
112
|
+
export function inherit(parent, extra) {
|
|
113
|
+
const newObj = Object.create(parent);
|
|
114
|
+
if (extra) {
|
|
115
|
+
Object.assign(newObj, extra);
|
|
116
|
+
}
|
|
117
|
+
return newObj;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Given an array, returns true if the object is found in the array, (using includes) */
|
|
105
121
|
export const inArray = curry(_inArray);
|
|
106
122
|
export function _inArray(array, obj) {
|
|
107
|
-
return array.
|
|
123
|
+
return array.includes(obj);
|
|
108
124
|
}
|
|
109
125
|
/**
|
|
110
126
|
* Given an array, and an item, if the item is found in the array, it removes it (in-place).
|
|
@@ -117,10 +133,11 @@ export function _removeFrom(array, obj) {
|
|
|
117
133
|
return array;
|
|
118
134
|
}
|
|
119
135
|
/** pushes a values to an array and returns the value */
|
|
120
|
-
export const pushTo = curry(
|
|
121
|
-
|
|
122
|
-
return
|
|
123
|
-
}
|
|
136
|
+
export const pushTo = curry((arr, val) => {
|
|
137
|
+
arr.push(val);
|
|
138
|
+
return val;
|
|
139
|
+
});
|
|
140
|
+
|
|
124
141
|
/** Given an array of (deregistration) functions, calls all functions and removes each one from the source array */
|
|
125
142
|
export const deregAll = (functions) =>
|
|
126
143
|
functions.slice().forEach((fn) => {
|
|
@@ -199,7 +216,7 @@ export function pluck(collection, propName) {
|
|
|
199
216
|
}
|
|
200
217
|
/** Filters an Array or an Object's properties based on a predicate */
|
|
201
218
|
export function filter(collection, callback) {
|
|
202
|
-
const arr = isArray(collection),
|
|
219
|
+
const arr = Array.isArray(collection),
|
|
203
220
|
result = arr ? [] : {};
|
|
204
221
|
const accept = arr ? (x) => result.push(x) : (x, key) => (result[key] = x);
|
|
205
222
|
forEach(collection, function (item, i) {
|
|
@@ -220,7 +237,7 @@ export function find(collection, callback) {
|
|
|
220
237
|
export let mapObj = map;
|
|
221
238
|
/** Maps an array or object properties using a callback function */
|
|
222
239
|
export function map(collection, callback, target) {
|
|
223
|
-
target = target || (isArray(collection) ? [] : {});
|
|
240
|
+
target = target || (Array.isArray(collection) ? [] : {});
|
|
224
241
|
forEach(collection, (item, i) => (target[i] = callback(item, i)));
|
|
225
242
|
return target;
|
|
226
243
|
}
|
|
@@ -274,7 +291,9 @@ export const unnestR = (memo, elem) => memo.concat(elem);
|
|
|
274
291
|
* ```
|
|
275
292
|
*/
|
|
276
293
|
export const flattenR = (memo, elem) =>
|
|
277
|
-
isArray(elem)
|
|
294
|
+
Array.isArray(elem)
|
|
295
|
+
? memo.concat(elem.reduce(flattenR, []))
|
|
296
|
+
: pushR(memo, elem);
|
|
278
297
|
/**
|
|
279
298
|
* Reduce function that pushes an object to an array, then returns the array.
|
|
280
299
|
* Mostly just for [[flattenR]] and [[uniqR]]
|
|
@@ -424,7 +443,7 @@ export function arrayTuples(...args) {
|
|
|
424
443
|
*/
|
|
425
444
|
export function applyPairs(memo, keyValTuple) {
|
|
426
445
|
let key, value;
|
|
427
|
-
if (isArray(keyValTuple)) [key, value] = keyValTuple;
|
|
446
|
+
if (Array.isArray(keyValTuple)) [key, value] = keyValTuple;
|
|
428
447
|
if (!isString(key)) throw new Error("invalid parameters to applyPairs");
|
|
429
448
|
memo[key] = value;
|
|
430
449
|
return memo;
|
|
@@ -443,7 +462,7 @@ export function copy(src, dest) {
|
|
|
443
462
|
}
|
|
444
463
|
/** Naive forEach implementation works with Objects or Arrays */
|
|
445
464
|
function _forEach(obj, cb, _this) {
|
|
446
|
-
if (isArray(obj)) return obj.forEach(cb, _this);
|
|
465
|
+
if (Array.isArray(obj)) return obj.forEach(cb, _this);
|
|
447
466
|
Object.keys(obj).forEach((key) => cb(obj[key], key));
|
|
448
467
|
}
|
|
449
468
|
|
|
@@ -455,11 +474,11 @@ function _equals(o1, o2) {
|
|
|
455
474
|
t2 = typeof o2;
|
|
456
475
|
if (t1 !== t2 || t1 !== "object") return false;
|
|
457
476
|
const tup = [o1, o2];
|
|
458
|
-
if (all(isArray)(tup)) return _arraysEq(o1, o2);
|
|
477
|
+
if (all(Array.isArray)(tup)) return _arraysEq(o1, o2);
|
|
459
478
|
if (all(isDate)(tup)) return o1.getTime() === o2.getTime();
|
|
460
479
|
if (all(isRegExp)(tup)) return o1.toString() === o2.toString();
|
|
461
480
|
if (all(isFunction)(tup)) return true; // meh
|
|
462
|
-
const predicates = [isFunction, isArray, isDate, isRegExp];
|
|
481
|
+
const predicates = [isFunction, Array.isArray, isDate, isRegExp];
|
|
463
482
|
if (predicates.map(any).reduce((b, fn) => b || !!fn(tup), false))
|
|
464
483
|
return false;
|
|
465
484
|
const keys = {};
|
|
@@ -7,19 +7,9 @@
|
|
|
7
7
|
* @packageDocumentation
|
|
8
8
|
*/
|
|
9
9
|
import { and, not, pipe, prop, or } from "./hof";
|
|
10
|
-
|
|
11
|
-
const tis = (t) => (x) => typeof x === t;
|
|
12
|
-
export const isUndefined = tis("undefined");
|
|
13
|
-
export const isDefined = not(isUndefined);
|
|
10
|
+
import { isFunction, isObject, isString, isUndefined } from "./utils";
|
|
14
11
|
export const isNull = (o) => o === null;
|
|
15
12
|
export const isNullOrUndefined = or(isNull, isUndefined);
|
|
16
|
-
export const isFunction = tis("function");
|
|
17
|
-
export const isNumber = tis("number");
|
|
18
|
-
export const isString = tis("string");
|
|
19
|
-
export const isObject = (x) => x !== null && typeof x === "object";
|
|
20
|
-
export const isArray = Array.isArray;
|
|
21
|
-
export const isDate = (x) => toStr.call(x) === "[object Date]";
|
|
22
|
-
export const isRegExp = (x) => toStr.call(x) === "[object RegExp]";
|
|
23
13
|
/**
|
|
24
14
|
* Predicate which checks if a value is injectable
|
|
25
15
|
*
|
|
@@ -27,7 +17,7 @@ export const isRegExp = (x) => toStr.call(x) === "[object RegExp]";
|
|
|
27
17
|
* where all the elements in the array are Strings, except the last one, which is a Function
|
|
28
18
|
*/
|
|
29
19
|
export function isInjectable(val) {
|
|
30
|
-
if (isArray(val) && val.length) {
|
|
20
|
+
if (Array.isArray(val) && val.length) {
|
|
31
21
|
const head = val.slice(0, -1),
|
|
32
22
|
tail = val.slice(-1);
|
|
33
23
|
return !(
|
|
@@ -5,17 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
isInjectable,
|
|
12
|
-
isNull,
|
|
13
|
-
isObject,
|
|
14
|
-
isPromise,
|
|
15
|
-
isString,
|
|
16
|
-
isUndefined,
|
|
17
|
-
} from "./predicates";
|
|
18
|
-
import { Rejection } from "../transition/rejectFactory";
|
|
8
|
+
import { isInjectable, isNull, isPromise } from "./predicates";
|
|
9
|
+
import { isUndefined, isFunction, isString, isObject } from "./utils";
|
|
10
|
+
import { Rejection } from "../router/transition/rejectFactory";
|
|
19
11
|
import { identity, pushR, tail } from "./common";
|
|
20
12
|
import { pattern, val } from "./hof";
|
|
21
13
|
/**
|
|
@@ -60,7 +52,7 @@ export function functionToString(fn) {
|
|
|
60
52
|
return toStr;
|
|
61
53
|
}
|
|
62
54
|
export function fnToString(fn) {
|
|
63
|
-
const _fn = isArray(fn) ? fn.slice(-1)[0] : fn;
|
|
55
|
+
const _fn = Array.isArray(fn) ? fn.slice(-1)[0] : fn;
|
|
64
56
|
return (_fn && _fn.toString()) || "undefined";
|
|
65
57
|
}
|
|
66
58
|
export function stringify(o) {
|
|
@@ -68,7 +60,7 @@ export function stringify(o) {
|
|
|
68
60
|
const isRejection = Rejection.isRejectionPromise;
|
|
69
61
|
const hasToString = (obj) =>
|
|
70
62
|
isObject(obj) &&
|
|
71
|
-
!isArray(obj) &&
|
|
63
|
+
!Array.isArray(obj) &&
|
|
72
64
|
obj.constructor !== Object &&
|
|
73
65
|
isFunction(obj.toString);
|
|
74
66
|
const stringifyPattern = pattern([
|