@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,13 +1,13 @@
|
|
|
1
|
-
import { filter, tail, unnestR } from "../../
|
|
2
|
-
import { isDefined, isFunction, isString } from "../../
|
|
3
|
-
import { kebobString } from "../../
|
|
4
|
-
import { noop } from "../../
|
|
5
|
-
import { parse } from "../../
|
|
6
|
-
import { ResolveContext } from "
|
|
7
|
-
import { trace } from "
|
|
1
|
+
import { filter, tail, unnestR } from "../../shared/common";
|
|
2
|
+
import { isDefined, isFunction, isString } from "../../shared/utils";
|
|
3
|
+
import { kebobString } from "../../shared/strings";
|
|
4
|
+
import { noop } from "../../shared/common";
|
|
5
|
+
import { parse } from "../../shared/hof";
|
|
6
|
+
import { ResolveContext } from "../resolve/resolveContext";
|
|
7
|
+
import { trace } from "../common/trace";
|
|
8
8
|
import { getLocals } from "../services";
|
|
9
|
-
import { Ng1ViewConfig } from "../
|
|
10
|
-
import { jqLite } from "
|
|
9
|
+
import { Ng1ViewConfig } from "../state/views";
|
|
10
|
+
import { jqLite } from "../../jqLite";
|
|
11
11
|
/**
|
|
12
12
|
* `ui-view`: A viewport directive which is filled in by a view from the active state.
|
|
13
13
|
*
|
|
@@ -12,13 +12,23 @@ export class UIRouterGlobals {
|
|
|
12
12
|
* Current parameter values
|
|
13
13
|
*
|
|
14
14
|
* The parameter values from the latest successful transition
|
|
15
|
+
* @type {StateParams}
|
|
15
16
|
*/
|
|
16
17
|
this.params = new StateParams();
|
|
17
|
-
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @type {Number}
|
|
21
|
+
*/
|
|
18
22
|
this.lastStartedTransitionId = -1;
|
|
19
|
-
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @type {Queue}
|
|
26
|
+
*/
|
|
20
27
|
this.transitionHistory = new Queue([], 1);
|
|
21
|
-
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @type {Queue}
|
|
31
|
+
*/
|
|
22
32
|
this.successfulTransitions = new Queue([], 1);
|
|
23
33
|
}
|
|
24
34
|
dispose() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Transition } from "../transition/transition";
|
|
2
2
|
import { UIRouter } from "../router";
|
|
3
3
|
import { Resolvable } from "../resolve/resolvable";
|
|
4
|
-
import { inArray, uniqR, unnestR } from "
|
|
4
|
+
import { inArray, uniqR, unnestR } from "../../shared/common";
|
|
5
5
|
function addCoreResolvables(trans) {
|
|
6
6
|
trans.addResolvable(Resolvable.fromData(UIRouter, trans.router), "");
|
|
7
7
|
trans.addResolvable(Resolvable.fromData(Transition, trans), "");
|
|
@@ -11,15 +11,17 @@ function addCoreResolvables(trans) {
|
|
|
11
11
|
trans.addResolvable(Resolvable.fromData("$state$", state), state);
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
-
export
|
|
14
|
+
export function registerAddCoreResolvables(transitionService) {
|
|
15
15
|
transitionService.onCreate({}, addCoreResolvables);
|
|
16
|
+
}
|
|
17
|
+
|
|
16
18
|
const TRANSITION_TOKENS = ["$transition$", Transition];
|
|
17
19
|
const isTransition = inArray(TRANSITION_TOKENS);
|
|
18
20
|
// References to Transition in the treeChanges pathnodes makes all
|
|
19
21
|
// previous Transitions reachable in memory, causing a memory leak
|
|
20
22
|
// This function removes resolves for '$transition$' and `Transition` from the treeChanges.
|
|
21
23
|
// Do not use this on current transitions, only on old ones.
|
|
22
|
-
export
|
|
24
|
+
export function treeChangesCleanup(trans) {
|
|
23
25
|
const nodes = Object.values(trans.treeChanges())
|
|
24
26
|
.reduce(unnestR, [])
|
|
25
27
|
.reduce(uniqR, []);
|
|
@@ -30,4 +32,4 @@ export const treeChangesCleanup = (trans) => {
|
|
|
30
32
|
nodes.forEach((node) => {
|
|
31
33
|
node.resolvables = node.resolvables.map(replaceTransitionWithNull);
|
|
32
34
|
});
|
|
33
|
-
}
|
|
35
|
+
}
|
|
@@ -57,11 +57,14 @@ const lazyLoadHook = (transition) => {
|
|
|
57
57
|
.map((state) => lazyLoadState(transition, state));
|
|
58
58
|
return services.$q.all(promises).then(retryTransition);
|
|
59
59
|
};
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
|
|
61
|
+
export function registerLazyLoadHook(transitionService) {
|
|
62
|
+
return transitionService.onBefore(
|
|
62
63
|
{ entering: (state) => !!state.lazyLoad },
|
|
63
64
|
lazyLoadHook,
|
|
64
65
|
);
|
|
66
|
+
}
|
|
67
|
+
|
|
65
68
|
/**
|
|
66
69
|
* Invokes a state's lazy load function
|
|
67
70
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { noop } from "
|
|
1
|
+
import { noop } from "../../shared/common";
|
|
2
2
|
import { ResolveContext } from "../resolve/resolveContext";
|
|
3
|
-
import { val } from "
|
|
3
|
+
import { val } from "../../shared/hof";
|
|
4
4
|
export const RESOLVE_HOOK_PRIORITY = 1000;
|
|
5
5
|
/**
|
|
6
6
|
* A [[TransitionHookFn]] which resolves all EAGER Resolvables in the To Path
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
$routerProvider,
|
|
3
|
+
getProviderFor,
|
|
4
|
+
getStateProvider,
|
|
5
|
+
router,
|
|
6
|
+
runBlock,
|
|
7
|
+
watchDigests,
|
|
8
|
+
} from "./services";
|
|
9
|
+
import { TemplateFactory } from "./templateFactory";
|
|
10
|
+
import { trace } from "./common/trace";
|
|
11
|
+
import { $ViewScrollProvider } from "./viewScroll";
|
|
12
|
+
import { $IsStateFilter, $IncludedByStateFilter } from "./stateFilters";
|
|
13
|
+
import {
|
|
14
|
+
uiSrefActiveDirective,
|
|
15
|
+
uiStateDirective,
|
|
16
|
+
uiSrefDirective,
|
|
17
|
+
} from "./directives/stateDirectives";
|
|
18
|
+
import { uiView, $ViewDirectiveFill } from "./directives/viewDirective";
|
|
19
|
+
|
|
20
|
+
export function initRouter() {
|
|
21
|
+
window.angular
|
|
22
|
+
.module("ui.router", ["ng"])
|
|
23
|
+
.provider("$router", $routerProvider)
|
|
24
|
+
.provider("$urlService", getProviderFor("urlService"))
|
|
25
|
+
.provider("$urlMatcherFactory", [
|
|
26
|
+
"$routerProvider",
|
|
27
|
+
function RouterProvide() {
|
|
28
|
+
return router.urlMatcherFactory;
|
|
29
|
+
},
|
|
30
|
+
])
|
|
31
|
+
.provider("$templateFactory", function () {
|
|
32
|
+
return new TemplateFactory();
|
|
33
|
+
})
|
|
34
|
+
.provider("$stateRegistry", getProviderFor("stateRegistry"))
|
|
35
|
+
.provider("$routerGlobals", getProviderFor("globals"))
|
|
36
|
+
.provider("$transitions", getProviderFor("transitionService"))
|
|
37
|
+
.provider("$state", ["$routerProvider", getStateProvider])
|
|
38
|
+
.provider("$uiViewScroll", $ViewScrollProvider)
|
|
39
|
+
.factory("$stateParams", [
|
|
40
|
+
"$router",
|
|
41
|
+
function StateParamse($router) {
|
|
42
|
+
return $router.globals.params;
|
|
43
|
+
},
|
|
44
|
+
])
|
|
45
|
+
.factory("$view", function () {
|
|
46
|
+
return router.viewService;
|
|
47
|
+
})
|
|
48
|
+
.value("$trace", trace)
|
|
49
|
+
.filter("isState", $IsStateFilter)
|
|
50
|
+
.filter("includedByState", $IncludedByStateFilter)
|
|
51
|
+
.directive("uiSref", uiSrefDirective)
|
|
52
|
+
.directive("uiSrefActive", uiSrefActiveDirective)
|
|
53
|
+
.directive("uiSrefActiveEq", uiSrefActiveDirective)
|
|
54
|
+
.directive("uiState", uiStateDirective)
|
|
55
|
+
.directive("uiView", uiView)
|
|
56
|
+
.directive("uiView", $ViewDirectiveFill)
|
|
57
|
+
|
|
58
|
+
.run(watchDigests)
|
|
59
|
+
.run(runBlock);
|
|
60
|
+
}
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
* Because of these confusing details, this service is deprecated.
|
|
18
18
|
*
|
|
19
19
|
* ### Instead of using the global `$stateParams` service object,
|
|
20
|
-
* inject [[$
|
|
20
|
+
* inject [[$routerGlobals]] and use [[UIRouterGlobals.params]]
|
|
21
21
|
*
|
|
22
22
|
* ```js
|
|
23
|
-
* MyService.$inject = ['$
|
|
24
|
-
* function MyService($
|
|
23
|
+
* MyService.$inject = ['$routerGlobals'];
|
|
24
|
+
* function MyService($routerGlobals) {
|
|
25
25
|
* return {
|
|
26
26
|
* paramValues: function () {
|
|
27
|
-
* return $
|
|
27
|
+
* return $routerGlobals.params;
|
|
28
28
|
* }
|
|
29
29
|
* }
|
|
30
30
|
* }
|
|
@@ -67,7 +67,7 @@ let $stateParams;
|
|
|
67
67
|
*
|
|
68
68
|
* This object contains globals such as the current state and current parameter values.
|
|
69
69
|
*/
|
|
70
|
-
let $
|
|
70
|
+
let $routerGlobals;
|
|
71
71
|
/**
|
|
72
72
|
* The UI-Router instance
|
|
73
73
|
*
|
|
@@ -76,9 +76,9 @@ let $uiRouterGlobals;
|
|
|
76
76
|
* This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap.
|
|
77
77
|
* It has references to the other UI-Router services
|
|
78
78
|
*
|
|
79
|
-
* #### Note: This object is also exposed as [[$
|
|
79
|
+
* #### Note: This object is also exposed as [[$routerProvider]] for injection during angular config time.
|
|
80
80
|
*/
|
|
81
|
-
let $
|
|
81
|
+
let $router;
|
|
82
82
|
/**
|
|
83
83
|
* The UI-Router instance
|
|
84
84
|
*
|
|
@@ -87,9 +87,9 @@ let $uiRouter;
|
|
|
87
87
|
* This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap.
|
|
88
88
|
* It has references to the other UI-Router services
|
|
89
89
|
*
|
|
90
|
-
* #### Note: This object is also exposed as [[$
|
|
90
|
+
* #### Note: This object is also exposed as [[$router]] for injection during runtime.
|
|
91
91
|
*/
|
|
92
|
-
let $
|
|
92
|
+
let $routerProvider;
|
|
93
93
|
/**
|
|
94
94
|
* Transition debug/tracing
|
|
95
95
|
*
|
|
@@ -1,12 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { isDefined, isObject } from "../shared/utils";
|
|
2
|
+
import { val } from "../shared/hof";
|
|
3
|
+
import { createProxyFunctions, removeFrom } from "../shared/common";
|
|
4
|
+
|
|
5
5
|
/**
|
|
6
6
|
* Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service
|
|
7
7
|
* @internalapi
|
|
8
8
|
*/
|
|
9
9
|
export class Ng1LocationServices {
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {angular.ILocationProvider} $locationProvider
|
|
13
|
+
*/
|
|
14
|
+
constructor($locationProvider) {
|
|
15
|
+
// .onChange() registry
|
|
16
|
+
this._urlListeners = [];
|
|
17
|
+
/** @type {angular.ILocationProvider} */ this.$locationProvider =
|
|
18
|
+
$locationProvider;
|
|
19
|
+
const _lp = val($locationProvider);
|
|
20
|
+
createProxyFunctions(_lp, this, _lp, ["hashPrefix"]);
|
|
21
|
+
}
|
|
10
22
|
/**
|
|
11
23
|
* Applys ng1-specific path parameter encoding
|
|
12
24
|
*
|
|
@@ -33,13 +45,7 @@ export class Ng1LocationServices {
|
|
|
33
45
|
: x;
|
|
34
46
|
}
|
|
35
47
|
dispose() {}
|
|
36
|
-
|
|
37
|
-
// .onChange() registry
|
|
38
|
-
this._urlListeners = [];
|
|
39
|
-
this.$locationProvider = $locationProvider;
|
|
40
|
-
const _lp = val($locationProvider);
|
|
41
|
-
createProxyFunctions(_lp, this, _lp, ["hashPrefix"]);
|
|
42
|
-
}
|
|
48
|
+
|
|
43
49
|
onChange(callback) {
|
|
44
50
|
this._urlListeners.push(callback);
|
|
45
51
|
return () => removeFrom(this._urlListeners)(callback);
|
|
@@ -62,8 +68,9 @@ export class Ng1LocationServices {
|
|
|
62
68
|
if (state) this.$location.state(state);
|
|
63
69
|
return this.$location.url();
|
|
64
70
|
}
|
|
71
|
+
|
|
65
72
|
_runtimeServices($rootScope, $location, $browser) {
|
|
66
|
-
this.$location = $location;
|
|
73
|
+
/** @type {angular.ILocationService} */ this.$location = $location;
|
|
67
74
|
this.$browser = $browser;
|
|
68
75
|
this.$window = window;
|
|
69
76
|
// Bind $locationChangeSuccess to the listeners registered in LocationService.onChange
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import { filter, map, allTrueR, find } from "
|
|
2
|
-
import { prop } from "
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
isDefined,
|
|
6
|
-
isString,
|
|
7
|
-
isArray,
|
|
8
|
-
isUndefined,
|
|
9
|
-
} from "../common/predicates";
|
|
1
|
+
import { filter, map, allTrueR, find } from "../../shared/common";
|
|
2
|
+
import { prop } from "../../shared/hof";
|
|
3
|
+
import { isInjectable } from "../../shared/predicates";
|
|
4
|
+
import { isDefined, isUndefined, isString } from "../../shared/utils";
|
|
10
5
|
import { services } from "../common/coreservices";
|
|
11
6
|
import { ParamType } from "./paramType";
|
|
12
7
|
const hasOwn = Object.prototype.hasOwnProperty;
|
|
@@ -79,7 +74,7 @@ function getReplace(config, arrayMode, isOptional, squash) {
|
|
|
79
74
|
{ from: "", to: isOptional || arrayMode ? undefined : "" },
|
|
80
75
|
{ from: null, to: isOptional || arrayMode ? undefined : "" },
|
|
81
76
|
];
|
|
82
|
-
const replace = isArray(config.replace) ? config.replace : [];
|
|
77
|
+
const replace = Array.isArray(config.replace) ? config.replace : [];
|
|
83
78
|
if (isString(squash)) replace.push({ from: squash, to: undefined });
|
|
84
79
|
const configuredKeys = map(replace, prop("from"));
|
|
85
80
|
return filter(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { filter, map } from "
|
|
2
|
-
import {
|
|
1
|
+
import { filter, map } from "../../shared/common";
|
|
2
|
+
import { isDefined } from "../../shared/utils";
|
|
3
3
|
/**
|
|
4
4
|
* An internal class which implements [[ParamTypeDefinition]].
|
|
5
5
|
*
|
|
@@ -86,7 +86,7 @@ export class ParamType {
|
|
|
86
86
|
function ArrayType(type, mode) {
|
|
87
87
|
// Wrap non-array value as array
|
|
88
88
|
function arrayWrap(val) {
|
|
89
|
-
return isArray(val) ? val : isDefined(val) ? [val] : [];
|
|
89
|
+
return Array.isArray(val) ? val : isDefined(val) ? [val] : [];
|
|
90
90
|
}
|
|
91
91
|
// Unwrap array value for "auto" mode. Return undefined for empty array.
|
|
92
92
|
function arrayUnwrap(val) {
|
|
@@ -102,7 +102,7 @@ function ArrayType(type, mode) {
|
|
|
102
102
|
// Wraps type (.is/.encode/.decode) functions to operate on each value of an array
|
|
103
103
|
function arrayHandler(callback, allTruthyMode) {
|
|
104
104
|
return function handleArray(val) {
|
|
105
|
-
if (isArray(val) && val.length === 0) return val;
|
|
105
|
+
if (Array.isArray(val) && val.length === 0) return val;
|
|
106
106
|
const arr = arrayWrap(val);
|
|
107
107
|
const result = map(arr, callback);
|
|
108
108
|
return allTruthyMode === true
|
|
@@ -6,9 +6,10 @@ import {
|
|
|
6
6
|
inherit,
|
|
7
7
|
map,
|
|
8
8
|
pick,
|
|
9
|
-
} from "
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
} from "../../shared/common";
|
|
10
|
+
import { isNullOrUndefined } from "../../shared/predicates";
|
|
11
|
+
import { isDefined } from "../../shared/utils";
|
|
12
|
+
import { is } from "../../shared/hof";
|
|
12
13
|
import { services } from "../common/coreservices";
|
|
13
14
|
import { ParamType } from "./paramType";
|
|
14
15
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { applyPairs, find } from "
|
|
2
|
-
import { propEq } from "
|
|
1
|
+
import { applyPairs, find } from "../../shared/common";
|
|
2
|
+
import { propEq } from "../../shared/hof";
|
|
3
3
|
import { Param } from "../params/param";
|
|
4
4
|
/**
|
|
5
5
|
* A node in a [[TreeChanges]] path
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
unnestR,
|
|
8
8
|
inArray,
|
|
9
9
|
arrayTuples,
|
|
10
|
-
} from "
|
|
11
|
-
import { prop, propEq } from "
|
|
10
|
+
} from "../../shared/common";
|
|
11
|
+
import { prop, propEq } from "../../shared/hof";
|
|
12
12
|
import { TargetState } from "../state/targetState";
|
|
13
13
|
import { PathNode } from "./pathNode";
|
|
14
14
|
/**
|
|
@@ -190,9 +190,15 @@ export class PathUtils {
|
|
|
190
190
|
const elementIdx = path.indexOf(node);
|
|
191
191
|
return elementIdx === -1 ? undefined : path.slice(0, elementIdx + 1);
|
|
192
192
|
}
|
|
193
|
+
|
|
194
|
+
static nonDynamicParams(node) {
|
|
195
|
+
return node.state
|
|
196
|
+
.parameters({ inherit: false })
|
|
197
|
+
.filter((param) => !param.dynamic);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** Gets the raw parameter values from a path */
|
|
201
|
+
static paramValues(path) {
|
|
202
|
+
return path.reduce((acc, node) => Object.assign(acc, node.paramValues), {});
|
|
203
|
+
}
|
|
193
204
|
}
|
|
194
|
-
PathUtils.nonDynamicParams = (node) =>
|
|
195
|
-
node.state.parameters({ inherit: false }).filter((param) => !param.dynamic);
|
|
196
|
-
/** Gets the raw parameter values from a path */
|
|
197
|
-
PathUtils.paramValues = (path) =>
|
|
198
|
-
path.reduce((acc, node) => Object.assign(acc, node.paramValues), {});
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { identity } from "
|
|
1
|
+
import { identity, isFunction, isObject } from "../../shared/utils";
|
|
2
2
|
import { services } from "../common/coreservices";
|
|
3
3
|
import { trace } from "../common/trace";
|
|
4
|
-
import { stringify } from "
|
|
5
|
-
import {
|
|
6
|
-
import { isNullOrUndefined } from "../common/predicates";
|
|
4
|
+
import { stringify } from "../../shared/strings";
|
|
5
|
+
import { isNullOrUndefined } from "../../shared/predicates";
|
|
7
6
|
// TODO: explicitly make this user configurable
|
|
8
7
|
export let defaultResolvePolicy = {
|
|
9
8
|
when: "LAZY",
|
|
@@ -44,7 +43,8 @@ export class Resolvable {
|
|
|
44
43
|
} else if (
|
|
45
44
|
isObject(arg1) &&
|
|
46
45
|
arg1.token &&
|
|
47
|
-
(
|
|
46
|
+
(Object.prototype.hasOwnProperty.call(arg1, "resolveFn") ||
|
|
47
|
+
Object.prototype.hasOwnProperty.call(arg1, "data"))
|
|
48
48
|
) {
|
|
49
49
|
const literal = arg1;
|
|
50
50
|
return new Resolvable(
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
import { find, tail, uniqR, unnestR, inArray } from "
|
|
2
|
-
import { propEq, not } from "
|
|
1
|
+
import { find, tail, uniqR, unnestR, inArray } from "../../shared/common";
|
|
2
|
+
import { propEq, not } from "../../shared/hof";
|
|
3
3
|
import { trace } from "../common/trace";
|
|
4
4
|
import { services } from "../common/coreservices";
|
|
5
|
-
import { resolvePolicies } from "./interface";
|
|
6
5
|
import { Resolvable } from "./resolvable";
|
|
7
6
|
import { PathUtils } from "../path/pathUtils";
|
|
8
|
-
import { stringify } from "
|
|
9
|
-
import { isUndefined } from "
|
|
7
|
+
import { stringify } from "../../shared/strings";
|
|
8
|
+
import { isUndefined } from "../../shared/utils";
|
|
9
|
+
|
|
10
|
+
export let resolvePolicies = {
|
|
11
|
+
when: {
|
|
12
|
+
LAZY: "LAZY",
|
|
13
|
+
EAGER: "EAGER",
|
|
14
|
+
},
|
|
15
|
+
async: {
|
|
16
|
+
WAIT: "WAIT",
|
|
17
|
+
NOWAIT: "NOWAIT",
|
|
18
|
+
},
|
|
19
|
+
};
|
|
10
20
|
|
|
11
21
|
const whens = resolvePolicies.when;
|
|
12
22
|
const ALL_WHENS = [whens.EAGER, whens.LAZY];
|
|
@@ -179,7 +189,7 @@ export class ResolveContext {
|
|
|
179
189
|
return resolvable.deps.map(getDependency);
|
|
180
190
|
}
|
|
181
191
|
}
|
|
182
|
-
|
|
192
|
+
|
|
183
193
|
class UIInjectorImpl {
|
|
184
194
|
constructor(context) {
|
|
185
195
|
this.context = context;
|