@angular-wave/angular.ts 0.0.16 → 0.0.18
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/rollup.config.js +2 -6
- package/src/animations/animate-children-directive.js +1 -1
- package/src/animations/animate-css-driver.js +1 -1
- package/src/animations/animate-css.js +220 -15
- 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/module.js +750 -0
- package/src/animations/shared.js +15 -4
- package/src/core/animate-runner.js +1 -1
- package/src/core/animate.js +4 -5
- package/src/core/compile.js +6 -7
- 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 +2 -4
- 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 +10 -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 +5 -4
- package/src/router/{core/hooks → hooks}/updateGlobals.js +1 -1
- package/src/router/{core/hooks → hooks}/views.js +2 -3
- 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 +171 -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} +51 -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 +1010 -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/index.d.ts +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/animations/animate.css.md +0 -263
- package/src/animations/animate.md +0 -933
- 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 -37
- 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
|
@@ -3,14 +3,13 @@ import {
|
|
|
3
3
|
identity,
|
|
4
4
|
inherit,
|
|
5
5
|
mapObj,
|
|
6
|
-
noop,
|
|
7
6
|
omit,
|
|
8
7
|
tail,
|
|
9
8
|
copy,
|
|
10
|
-
} from "
|
|
11
|
-
import {
|
|
12
|
-
import { stringify } from "
|
|
13
|
-
import { is, pattern, pipe, prop, val } from "
|
|
9
|
+
} from "../../shared/common";
|
|
10
|
+
import { isDefined, isFunction, isString } from "../../shared/utils";
|
|
11
|
+
import { stringify } from "../../shared/strings";
|
|
12
|
+
import { is, pattern, pipe, prop, val } from "../../shared/hof";
|
|
14
13
|
import { Resolvable } from "../resolve/resolvable";
|
|
15
14
|
import { services } from "../common/coreservices";
|
|
16
15
|
const parseUrl = (url) => {
|
|
@@ -85,7 +84,11 @@ const getParamsBuilder = (paramFactory) =>
|
|
|
85
84
|
.reduce(applyPairs, {});
|
|
86
85
|
};
|
|
87
86
|
function pathBuilder(state) {
|
|
88
|
-
|
|
87
|
+
if (state.parent && !state.abstract) {
|
|
88
|
+
return state.parent.path.concat(state);
|
|
89
|
+
} else {
|
|
90
|
+
return [state];
|
|
91
|
+
}
|
|
89
92
|
}
|
|
90
93
|
function includesBuilder(state) {
|
|
91
94
|
const includes = state.parent ? Object.assign({}, state.parent.includes) : {};
|
|
@@ -167,7 +170,7 @@ export function resolvablesBuilder(state) {
|
|
|
167
170
|
!!(
|
|
168
171
|
obj &&
|
|
169
172
|
obj.val &&
|
|
170
|
-
(isString(obj.val) || isArray(obj.val) || isFunction(obj.val))
|
|
173
|
+
(isString(obj.val) || Array.isArray(obj.val) || isFunction(obj.val))
|
|
171
174
|
);
|
|
172
175
|
/** extracts the token from a Provider or provide literal */
|
|
173
176
|
const getToken = (p) => p.provide || p.token;
|
|
@@ -204,7 +207,7 @@ export function resolvablesBuilder(state) {
|
|
|
204
207
|
// prettier-ignore
|
|
205
208
|
const tuple2Resolvable = pattern([
|
|
206
209
|
[pipe(prop('val'), isString), (tuple) => new Resolvable(tuple.token, identity, [tuple.val], tuple.policy)],
|
|
207
|
-
[pipe(prop('val'), isArray), (tuple) => new Resolvable(tuple.token, tail(tuple.val), tuple.val.slice(0, -1), tuple.policy)],
|
|
210
|
+
[pipe(prop('val'), Array.isArray), (tuple) => new Resolvable(tuple.token, tail(tuple.val), tuple.val.slice(0, -1), tuple.policy)],
|
|
208
211
|
[pipe(prop('val'), isFunction), (tuple) => new Resolvable(tuple.token, tuple.val, annotate(tuple.val), tuple.policy)],
|
|
209
212
|
]);
|
|
210
213
|
// prettier-ignore
|
|
@@ -218,7 +221,7 @@ export function resolvablesBuilder(state) {
|
|
|
218
221
|
// If resolveBlock is already an array, use it as-is.
|
|
219
222
|
// Otherwise, assume it's an object and convert to an Array of tuples
|
|
220
223
|
const decl = state.resolve;
|
|
221
|
-
const items = isArray(decl)
|
|
224
|
+
const items = Array.isArray(decl)
|
|
222
225
|
? decl
|
|
223
226
|
: objects2Tuples(decl, state.resolvePolicy || {});
|
|
224
227
|
return items.map(item2Resolvable);
|
|
@@ -293,12 +296,13 @@ export class StateBuilder {
|
|
|
293
296
|
if (!Object.prototype.hasOwnProperty.call(builders, key)) continue;
|
|
294
297
|
const chain = builders[key].reduce(
|
|
295
298
|
(parentFn, step) => (_state) => step(_state, parentFn),
|
|
296
|
-
|
|
299
|
+
() => {},
|
|
297
300
|
);
|
|
298
301
|
state[key] = chain(state);
|
|
299
302
|
}
|
|
300
303
|
return state;
|
|
301
304
|
}
|
|
305
|
+
|
|
302
306
|
parentName(state) {
|
|
303
307
|
// name = 'foo.bar.baz.**'
|
|
304
308
|
const name = state.name || "";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { isString } from "
|
|
2
|
-
import { safeConsole } from "../common/safeConsole";
|
|
1
|
+
import { isString } from "../../shared/utils";
|
|
3
2
|
export class StateMatcher {
|
|
4
3
|
constructor(_states) {
|
|
5
4
|
this._states = _states;
|
|
@@ -28,7 +27,7 @@ export class StateMatcher {
|
|
|
28
27
|
_state.__stateObjectCache.nameGlob.matches(name),
|
|
29
28
|
);
|
|
30
29
|
if (matches.length > 1) {
|
|
31
|
-
|
|
30
|
+
console.error(
|
|
32
31
|
`stateMatcher.find: Found multiple matches for ${name} using glob: `,
|
|
33
32
|
matches.map((match) => match.name),
|
|
34
33
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defaults, find } from "
|
|
2
|
-
import { propEq } from "
|
|
1
|
+
import { defaults, find } from "../../shared/common";
|
|
2
|
+
import { propEq } from "../../shared/hof";
|
|
3
3
|
import { Glob } from "../common/glob";
|
|
4
|
-
import {
|
|
4
|
+
import { isFunction, isObject } from "../../shared/utils";
|
|
5
5
|
/**
|
|
6
6
|
* Internal representation of a UI-Router state.
|
|
7
7
|
*
|
|
@@ -22,10 +22,12 @@ export class StateObject {
|
|
|
22
22
|
* @returns {StateObject} an internal State object
|
|
23
23
|
*/
|
|
24
24
|
static create(stateDecl) {
|
|
25
|
-
|
|
25
|
+
const state = StateObject.isStateClass(stateDecl)
|
|
26
26
|
? new stateDecl()
|
|
27
|
-
:
|
|
28
|
-
|
|
27
|
+
: Object.setPrototypeOf(
|
|
28
|
+
Object.assign({}, stateDecl),
|
|
29
|
+
StateObject.prototype,
|
|
30
|
+
);
|
|
29
31
|
stateDecl.$$state = () => state;
|
|
30
32
|
state.self = stateDecl;
|
|
31
33
|
state.__stateObjectCache = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { inArray } from "
|
|
2
|
-
import { prop } from "
|
|
3
|
-
import { isString } from "
|
|
1
|
+
import { inArray } from "../../shared/common";
|
|
2
|
+
import { prop } from "../../shared/hof";
|
|
3
|
+
import { isString } from "../../shared/utils";
|
|
4
4
|
import { StateObject } from "./stateObject";
|
|
5
5
|
export class StateQueueManager {
|
|
6
6
|
constructor(router, states, builder, listeners) {
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { StateMatcher } from "./stateMatcher";
|
|
2
2
|
import { StateBuilder } from "./stateBuilder";
|
|
3
3
|
import { StateQueueManager } from "./stateQueueManager";
|
|
4
|
-
import { removeFrom } from "
|
|
5
|
-
import { propEq } from "
|
|
4
|
+
import { removeFrom } from "../../shared/common";
|
|
5
|
+
import { propEq } from "../../shared/hof";
|
|
6
6
|
/**
|
|
7
7
|
* A registry for all of the application's [[StateDeclaration]]s
|
|
8
8
|
*
|
|
9
9
|
* This API is found at `router.stateRegistry` ([[UIRouter.stateRegistry]])
|
|
10
10
|
*/
|
|
11
11
|
export class StateRegistry {
|
|
12
|
-
/** @internal */
|
|
13
12
|
constructor(router) {
|
|
14
13
|
this.router = router;
|
|
15
14
|
this.states = {};
|
|
16
|
-
|
|
15
|
+
|
|
17
16
|
this.listeners = [];
|
|
18
17
|
this.matcher = new StateMatcher(this.states);
|
|
19
18
|
this.builder = new StateBuilder(this.matcher, router.urlMatcherFactory);
|
|
@@ -25,7 +24,7 @@ export class StateRegistry {
|
|
|
25
24
|
);
|
|
26
25
|
this._registerRoot();
|
|
27
26
|
}
|
|
28
|
-
|
|
27
|
+
|
|
29
28
|
_registerRoot() {
|
|
30
29
|
const rootStateDef = {
|
|
31
30
|
name: "",
|
|
@@ -39,7 +38,7 @@ export class StateRegistry {
|
|
|
39
38
|
const _root = (this._root = this.stateQueue.register(rootStateDef));
|
|
40
39
|
_root.navigable = null;
|
|
41
40
|
}
|
|
42
|
-
|
|
41
|
+
|
|
43
42
|
dispose() {
|
|
44
43
|
this.stateQueue.dispose();
|
|
45
44
|
this.listeners = [];
|
|
@@ -108,7 +107,7 @@ export class StateRegistry {
|
|
|
108
107
|
register(stateDefinition) {
|
|
109
108
|
return this.stateQueue.register(stateDefinition);
|
|
110
109
|
}
|
|
111
|
-
|
|
110
|
+
|
|
112
111
|
_deregisterTree(state) {
|
|
113
112
|
const all = this.get().map((s) => s.$$state());
|
|
114
113
|
const getChildren = (states) => {
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
removeFrom,
|
|
7
7
|
silenceUncaughtInPromise,
|
|
8
8
|
silentRejection,
|
|
9
|
-
} from "
|
|
10
|
-
import { isDefined, isObject, isString } from "
|
|
9
|
+
} from "../../shared/common";
|
|
10
|
+
import { isDefined, isObject, isString } from "../../shared/utils";
|
|
11
11
|
import { Queue } from "../common/queue";
|
|
12
12
|
import { services } from "../common/coreservices";
|
|
13
13
|
import { PathUtils } from "../path/pathUtils";
|
|
@@ -19,7 +19,7 @@ import { Param } from "../params/param";
|
|
|
19
19
|
import { Glob } from "../common/glob";
|
|
20
20
|
import { ResolveContext } from "../resolve/resolveContext";
|
|
21
21
|
import { lazyLoadState } from "../hooks/lazyLoad";
|
|
22
|
-
import { not, val } from "
|
|
22
|
+
import { not, val } from "../../shared/hof";
|
|
23
23
|
/**
|
|
24
24
|
* Provides services related to ui-router states.
|
|
25
25
|
*
|
|
@@ -58,22 +58,19 @@ export class StateService {
|
|
|
58
58
|
get $current() {
|
|
59
59
|
return this.router.globals.$current;
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
constructor(
|
|
61
|
+
|
|
62
|
+
constructor(router) {
|
|
63
63
|
this.router = router;
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
this.invalidCallbacks = [];
|
|
66
|
-
|
|
66
|
+
|
|
67
67
|
this._defaultErrorHandler = function $defaultErrorHandler($error$) {
|
|
68
68
|
if ($error$ instanceof Error && $error$.stack) {
|
|
69
|
-
|
|
70
|
-
console.error($error$.stack);
|
|
69
|
+
throw $error$;
|
|
71
70
|
} else if ($error$ instanceof Rejection) {
|
|
72
|
-
|
|
73
|
-
if ($error$.detail && $error$.detail.stack)
|
|
74
|
-
console.error($error$.detail.stack);
|
|
71
|
+
throw new Error($error$.toString());
|
|
75
72
|
} else {
|
|
76
|
-
|
|
73
|
+
throw new Error($error$);
|
|
77
74
|
}
|
|
78
75
|
};
|
|
79
76
|
const getters = ["current", "$current", "params", "transition"];
|
|
@@ -87,7 +84,7 @@ export class StateService {
|
|
|
87
84
|
boundFns,
|
|
88
85
|
);
|
|
89
86
|
}
|
|
90
|
-
|
|
87
|
+
|
|
91
88
|
dispose() {
|
|
92
89
|
this.defaultErrorHandler(noop);
|
|
93
90
|
this.invalidCallbacks = [];
|
|
@@ -302,7 +299,7 @@ export class StateService {
|
|
|
302
299
|
options,
|
|
303
300
|
);
|
|
304
301
|
}
|
|
305
|
-
|
|
302
|
+
|
|
306
303
|
getCurrentPath() {
|
|
307
304
|
const globals = this.router.globals;
|
|
308
305
|
const latestSuccess = globals.successfulTransitions.peekTail();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isObject, isString } from "
|
|
2
|
-
import { stringify } from "
|
|
1
|
+
import { isObject, isString } from "../../shared/utils";
|
|
2
|
+
import { stringify } from "../../shared/strings";
|
|
3
3
|
/**
|
|
4
4
|
* Encapsulate the target (destination) state/params/options of a [[Transition]].
|
|
5
5
|
*
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { pick, forEach, tail } from "../../
|
|
2
|
-
import {
|
|
3
|
-
import { isInjectable } from "../../
|
|
4
|
-
import { services } from "
|
|
5
|
-
import { trace } from "
|
|
6
|
-
import { ViewService } from "
|
|
7
|
-
import { ResolveContext } from "
|
|
8
|
-
import { Resolvable } from "
|
|
1
|
+
import { pick, forEach, tail } from "../../shared/common";
|
|
2
|
+
import { isDefined, isString } from "../../shared/utils";
|
|
3
|
+
import { isInjectable } from "../../shared/predicates";
|
|
4
|
+
import { services } from "../common/coreservices";
|
|
5
|
+
import { trace } from "../common/trace";
|
|
6
|
+
import { ViewService } from "../view/view";
|
|
7
|
+
import { ResolveContext } from "../resolve/resolveContext";
|
|
8
|
+
import { Resolvable } from "../resolve/resolvable";
|
|
9
9
|
|
|
10
|
-
/** @internalapi */
|
|
11
10
|
export function getNg1ViewConfigFactory() {
|
|
12
11
|
let templateFactory = null;
|
|
13
12
|
return (path, view) => {
|
|
@@ -16,7 +15,7 @@ export function getNg1ViewConfigFactory() {
|
|
|
16
15
|
return [new Ng1ViewConfig(path, view, templateFactory)];
|
|
17
16
|
};
|
|
18
17
|
}
|
|
19
|
-
|
|
18
|
+
|
|
20
19
|
const hasAnyKey = (keys, obj) =>
|
|
21
20
|
keys.reduce((acc, key) => acc || isDefined(obj[key]), false);
|
|
22
21
|
/**
|
|
@@ -28,7 +27,6 @@ const hasAnyKey = (keys, obj) =>
|
|
|
28
27
|
* If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object
|
|
29
28
|
* and applies the state-level configuration to a view named `$default`.
|
|
30
29
|
*
|
|
31
|
-
* @internalapi
|
|
32
30
|
*/
|
|
33
31
|
export function ng1ViewsBuilder(state) {
|
|
34
32
|
// Do not process root state
|
|
@@ -89,15 +87,19 @@ export function ng1ViewsBuilder(state) {
|
|
|
89
87
|
});
|
|
90
88
|
return views;
|
|
91
89
|
}
|
|
92
|
-
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @type {Number}
|
|
93
|
+
*/
|
|
93
94
|
let id = 0;
|
|
94
|
-
|
|
95
|
+
|
|
95
96
|
export class Ng1ViewConfig {
|
|
96
97
|
constructor(path, viewDecl, factory) {
|
|
97
98
|
this.path = path;
|
|
98
99
|
this.viewDecl = viewDecl;
|
|
99
100
|
this.factory = factory;
|
|
100
|
-
|
|
101
|
+
|
|
102
|
+
/** @type {Number} */ this.$id = id++;
|
|
101
103
|
this.loaded = false;
|
|
102
104
|
this.getTemplate = (uiView, context) =>
|
|
103
105
|
this.component
|
|
@@ -138,7 +140,7 @@ export class Ng1ViewConfig {
|
|
|
138
140
|
const provider = this.viewDecl.controllerProvider;
|
|
139
141
|
if (!isInjectable(provider)) return this.viewDecl.controller;
|
|
140
142
|
const deps = services.$injector.annotate(provider);
|
|
141
|
-
const providerFn = isArray(provider) ? tail(provider) : provider;
|
|
143
|
+
const providerFn = Array.isArray(provider) ? tail(provider) : provider;
|
|
142
144
|
const resolvable = new Resolvable("", providerFn, deps);
|
|
143
145
|
return resolvable.get(context);
|
|
144
146
|
}
|
|
@@ -1,8 +1,35 @@
|
|
|
1
1
|
/** @publicapi @module ng1 */ /** */
|
|
2
2
|
|
|
3
|
-
import { val } from "../
|
|
4
|
-
import { createProxyFunctions } from "../
|
|
5
|
-
import {
|
|
3
|
+
import { val } from "../shared/hof";
|
|
4
|
+
import { createProxyFunctions } from "../shared/common";
|
|
5
|
+
import { minErr } from "../shared/utils";
|
|
6
|
+
|
|
7
|
+
const err = minErr("$stateProvider");
|
|
8
|
+
const validKeys = [
|
|
9
|
+
"controller",
|
|
10
|
+
"controllerProvider",
|
|
11
|
+
"component",
|
|
12
|
+
"data",
|
|
13
|
+
"includes",
|
|
14
|
+
"name",
|
|
15
|
+
"navigable",
|
|
16
|
+
"onEnter",
|
|
17
|
+
"onExit",
|
|
18
|
+
"onRetain",
|
|
19
|
+
"params",
|
|
20
|
+
"parent",
|
|
21
|
+
"path",
|
|
22
|
+
"reloadOnSearch",
|
|
23
|
+
"resolve",
|
|
24
|
+
"resolvables",
|
|
25
|
+
"self",
|
|
26
|
+
"template",
|
|
27
|
+
"templateProvider",
|
|
28
|
+
"templateUrl",
|
|
29
|
+
"url",
|
|
30
|
+
"views",
|
|
31
|
+
];
|
|
32
|
+
|
|
6
33
|
/**
|
|
7
34
|
* The Angular 1 `StateProvider`
|
|
8
35
|
*
|
|
@@ -117,13 +144,28 @@ export class StateProvider {
|
|
|
117
144
|
decorator(name, func) {
|
|
118
145
|
return this.stateRegistry.decorator(name, func) || this;
|
|
119
146
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
*
|
|
150
|
+
* @param {angular.Ng1StateDeclaration} definition
|
|
151
|
+
* @returns {StateProvider}
|
|
152
|
+
*/
|
|
153
|
+
state(definition) {
|
|
154
|
+
if (!definition.name) {
|
|
155
|
+
throw err("stateinvalid", `'name' required`);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const hasInvalidKeys = Object.keys(definition).filter(
|
|
159
|
+
(key) => !validKeys.includes(key),
|
|
160
|
+
);
|
|
161
|
+
if (hasInvalidKeys.length) {
|
|
162
|
+
throw err("stateinvalid", `Invalid key(s): ${hasInvalidKeys.join(", ")}`);
|
|
163
|
+
}
|
|
164
|
+
try {
|
|
165
|
+
this.stateRegistry.register(definition);
|
|
166
|
+
} catch (e) {
|
|
167
|
+
throw err("stateinvalid", e.message);
|
|
125
168
|
}
|
|
126
|
-
this.stateRegistry.register(definition);
|
|
127
169
|
return this;
|
|
128
170
|
}
|
|
129
171
|
/**
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
/** @publicapi @module view */ /** */
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "../core/common/predicates";
|
|
8
|
-
import { services } from "../core/common/coreservices";
|
|
9
|
-
import { tail, unnestR } from "../core/common/common";
|
|
10
|
-
import { Resolvable } from "../core/resolve/resolvable";
|
|
11
|
-
import { kebobString } from "../core/common/strings";
|
|
2
|
+
import { isDefined, isFunction, isObject } from "../shared/utils";
|
|
3
|
+
import { services } from "./common/coreservices";
|
|
4
|
+
import { tail, unnestR } from "../shared/common";
|
|
5
|
+
import { Resolvable } from "./resolve/resolvable";
|
|
6
|
+
import { kebobString } from "../shared/strings";
|
|
12
7
|
|
|
13
8
|
/**
|
|
14
9
|
* Service which manages loading of templates from a ViewConfig.
|
|
15
10
|
*/
|
|
16
11
|
export class TemplateFactory {
|
|
17
12
|
constructor() {
|
|
18
|
-
/** @hidden */ this._useHttp = true; // TODO investigate
|
|
19
13
|
/** @hidden */ this.$get = [
|
|
20
14
|
"$http",
|
|
21
15
|
"$templateCache",
|
|
@@ -31,10 +25,7 @@ export class TemplateFactory {
|
|
|
31
25
|
},
|
|
32
26
|
];
|
|
33
27
|
}
|
|
34
|
-
|
|
35
|
-
useHttpService(value) {
|
|
36
|
-
this._useHttp = value;
|
|
37
|
-
}
|
|
28
|
+
|
|
38
29
|
/**
|
|
39
30
|
* Creates a template from a configuration object.
|
|
40
31
|
*
|
|
@@ -120,7 +111,7 @@ export class TemplateFactory {
|
|
|
120
111
|
*/
|
|
121
112
|
fromProvider(provider, params, context) {
|
|
122
113
|
const deps = services.$injector.annotate(provider);
|
|
123
|
-
const providerFn = isArray(provider) ? tail(provider) : provider;
|
|
114
|
+
const providerFn = Array.isArray(provider) ? tail(provider) : provider;
|
|
124
115
|
const resolvable = new Resolvable("", providerFn, deps);
|
|
125
116
|
return resolvable.get(context);
|
|
126
117
|
}
|
|
@@ -133,7 +124,7 @@ export class TemplateFactory {
|
|
|
133
124
|
*/
|
|
134
125
|
fromComponentProvider(provider, params, context) {
|
|
135
126
|
const deps = services.$injector.annotate(provider);
|
|
136
|
-
const providerFn = isArray(provider) ? tail(provider) : provider;
|
|
127
|
+
const providerFn = Array.isArray(provider) ? tail(provider) : provider;
|
|
137
128
|
const resolvable = new Resolvable("", providerFn, deps);
|
|
138
129
|
return resolvable.get(context);
|
|
139
130
|
}
|
|
@@ -181,7 +172,7 @@ export class TemplateFactory {
|
|
|
181
172
|
const fn = res && res.data;
|
|
182
173
|
const args = (fn && services.$injector.annotate(fn)) || [];
|
|
183
174
|
// account for array style injection, i.e., ['foo', function(foo) {}]
|
|
184
|
-
const arrayIdxStr = isArray(fn) ? `[${fn.length - 1}]` : "";
|
|
175
|
+
const arrayIdxStr = Array.isArray(fn) ? `[${fn.length - 1}]` : "";
|
|
185
176
|
return `${attrName}='$resolve.${resolveName}${arrayIdxStr}(${args.join(",")})'`;
|
|
186
177
|
}
|
|
187
178
|
// some-attr="::$resolve.someResolveName"
|
|
@@ -213,6 +204,6 @@ const scopeBindings = (bindingsObj) =>
|
|
|
213
204
|
// [ 'input', [ '=foo', '=', 'foo' ] ]
|
|
214
205
|
.map((key) => [key, /^([=<@&])[?]?(.*)/.exec(bindingsObj[key])])
|
|
215
206
|
// skip malformed values
|
|
216
|
-
.filter((tuple) => isDefined(tuple) && isArray(tuple[1]))
|
|
207
|
+
.filter((tuple) => isDefined(tuple) && Array.isArray(tuple[1]))
|
|
217
208
|
// { name: ('foo' || 'input'), type: '=' }
|
|
218
209
|
.map((tuple) => ({ name: tuple[1][2] || tuple[0], type: tuple[1][1] }));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { assertPredicate, unnestR, identity } from "
|
|
2
|
-
import { isArray } from "../common/predicates";
|
|
1
|
+
import { assertPredicate, unnestR, identity } from "../../shared/common";
|
|
3
2
|
import { TransitionHookPhase, TransitionHookScope } from "./interface";
|
|
4
3
|
import { TransitionHook } from "./transitionHook";
|
|
5
4
|
/**
|
|
@@ -103,7 +102,9 @@ export class HookBuilder {
|
|
|
103
102
|
: [this.transition, $transitions];
|
|
104
103
|
return registries
|
|
105
104
|
.map((reg) => reg.getHooks(hookType.name)) // Get named hooks from registries
|
|
106
|
-
.filter(
|
|
105
|
+
.filter(
|
|
106
|
+
assertPredicate(Array.isArray, `broken event named: ${hookType.name}`),
|
|
107
|
+
) // Sanity check
|
|
107
108
|
.reduce(unnestR, []) // Un-nest RegisteredHook[][] to RegisteredHook[] array
|
|
108
109
|
.filter((hook) => hook.matches(treeChanges, transition)); // Only those satisfying matchCriteria
|
|
109
110
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { removeFrom, tail, identity, mapObj } from "
|
|
2
|
-
import { isString, isFunction } from "
|
|
1
|
+
import { removeFrom, tail, identity, mapObj } from "../../shared/common";
|
|
2
|
+
import { isString, isFunction } from "../../shared/utils";
|
|
3
3
|
import { Glob } from "../common/glob";
|
|
4
|
-
import {
|
|
5
|
-
// has or is using
|
|
6
|
-
TransitionHookScope,
|
|
7
|
-
} from "./interface";
|
|
4
|
+
import { TransitionHookScope } from "./interface";
|
|
8
5
|
/**
|
|
9
6
|
* Determines if the given state matches the matchCriteria
|
|
10
7
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { silentRejection } from "
|
|
2
|
-
import { stringify } from "
|
|
3
|
-
import { is } from "
|
|
1
|
+
import { silentRejection } from "../../shared/common";
|
|
2
|
+
import { stringify } from "../../shared/strings";
|
|
3
|
+
import { is } from "../../shared/hof";
|
|
4
4
|
/** An enum for Transition Rejection reasons */
|
|
5
5
|
var RejectType;
|
|
6
6
|
(function (RejectType) {
|
|
@@ -42,7 +42,7 @@ var RejectType;
|
|
|
42
42
|
RejectType[(RejectType["ERROR"] = 6)] = "ERROR";
|
|
43
43
|
})(RejectType || (RejectType = {}));
|
|
44
44
|
export { RejectType };
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
let id = 0;
|
|
47
47
|
export class Rejection {
|
|
48
48
|
/** Returns true if the obj is a rejected promise created from the `asPromise` factory */
|
|
@@ -100,7 +100,6 @@ export class Rejection {
|
|
|
100
100
|
return is(Rejection)(detail) ? detail : Rejection.errored(detail);
|
|
101
101
|
}
|
|
102
102
|
constructor(type, message, detail) {
|
|
103
|
-
/** @internal */
|
|
104
103
|
this.$id = id++;
|
|
105
104
|
this.type = type;
|
|
106
105
|
this.message = message;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { trace } from "../common/trace";
|
|
2
2
|
import { services } from "../common/coreservices";
|
|
3
|
-
import { stringify } from "
|
|
3
|
+
import { stringify } from "../../shared/strings";
|
|
4
4
|
import {
|
|
5
5
|
map,
|
|
6
6
|
find,
|
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
anyTrueR,
|
|
14
14
|
flattenR,
|
|
15
15
|
uniqR,
|
|
16
|
-
} from "
|
|
17
|
-
import {
|
|
18
|
-
import { prop, propEq, val, not, is } from "
|
|
16
|
+
} from "../../shared/common";
|
|
17
|
+
import { isUndefined, isObject } from "../../shared/utils";
|
|
18
|
+
import { prop, propEq, val, not, is } from "../../shared/hof";
|
|
19
19
|
import { TransitionHookPhase } from "./interface"; // has or is using
|
|
20
20
|
import { TransitionHook } from "./transitionHook";
|
|
21
21
|
import { matchState, makeEvent } from "./hookRegistry";
|
|
@@ -25,7 +25,7 @@ import { Param } from "../params/param";
|
|
|
25
25
|
import { Resolvable } from "../resolve/resolvable";
|
|
26
26
|
import { ResolveContext } from "../resolve/resolveContext";
|
|
27
27
|
import { Rejection } from "./rejectFactory";
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
const stateSelf = prop("self");
|
|
30
30
|
/**
|
|
31
31
|
* Represents a transition between two states.
|
|
@@ -36,7 +36,6 @@ const stateSelf = prop("self");
|
|
|
36
36
|
* It has information about all states being entered and exited as a result of the transition.
|
|
37
37
|
*/
|
|
38
38
|
export class Transition {
|
|
39
|
-
/** @internal */
|
|
40
39
|
onBefore(criteria, callback, options) {
|
|
41
40
|
return;
|
|
42
41
|
}
|
|
@@ -78,7 +77,7 @@ export class Transition {
|
|
|
78
77
|
.filter((type) => type.hookPhase !== TransitionHookPhase.CREATE)
|
|
79
78
|
.forEach((type) => makeEvent(this, this.router.transitionService, type));
|
|
80
79
|
}
|
|
81
|
-
|
|
80
|
+
|
|
82
81
|
getHooks(hookName) {
|
|
83
82
|
return this._registeredHooks[hookName];
|
|
84
83
|
}
|
|
@@ -92,11 +91,10 @@ export class Transition {
|
|
|
92
91
|
* @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`
|
|
93
92
|
* encapsulates the "from state".
|
|
94
93
|
* @param targetState The target state and parameters being transitioned to (also, the transition options)
|
|
95
|
-
* @param router The [[UIRouter]] instance
|
|
94
|
+
* @param {import('../router').UIRouter} router The [[UIRouter]] instance
|
|
96
95
|
* @internal
|
|
97
96
|
*/
|
|
98
97
|
constructor(fromPath, targetState, router) {
|
|
99
|
-
/** @internal */
|
|
100
98
|
this._deferred = services.$q.defer();
|
|
101
99
|
/**
|
|
102
100
|
* This promise is resolved or rejected based on the outcome of the Transition.
|
|
@@ -107,7 +105,7 @@ export class Transition {
|
|
|
107
105
|
this.promise = this._deferred.promise;
|
|
108
106
|
/** @internal Holds the hook registration functions such as those passed to Transition.onStart() */
|
|
109
107
|
this._registeredHooks = {};
|
|
110
|
-
|
|
108
|
+
|
|
111
109
|
this._hookBuilder = new HookBuilder(this);
|
|
112
110
|
/** Checks if this transition is currently active/running. */
|
|
113
111
|
this.isActive = () => this.router.globals.transition === this;
|
|
@@ -585,7 +583,7 @@ export class Transition {
|
|
|
585
583
|
ignored() {
|
|
586
584
|
return !!this._ignoredReason();
|
|
587
585
|
}
|
|
588
|
-
|
|
586
|
+
|
|
589
587
|
_ignoredReason() {
|
|
590
588
|
const pending = this.router.globals.transition;
|
|
591
589
|
const reloadState = this._options.reloadState;
|
|
@@ -737,5 +735,5 @@ export class Transition {
|
|
|
737
735
|
return `Transition#${id}( '${from}'${fromParams} -> ${toValid}'${to}'${toParams} )`;
|
|
738
736
|
}
|
|
739
737
|
}
|
|
740
|
-
|
|
738
|
+
|
|
741
739
|
Transition.diToken = Transition;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TransitionHookPhase } from "./interface";
|
|
2
|
-
import { defaults, noop, silentRejection } from "
|
|
3
|
-
import { fnToString, maxLength } from "
|
|
4
|
-
import { isPromise } from "
|
|
5
|
-
import { is, parse } from "
|
|
2
|
+
import { defaults, noop, silentRejection } from "../../shared/common";
|
|
3
|
+
import { fnToString, maxLength } from "../../shared/strings";
|
|
4
|
+
import { isPromise } from "../../shared/predicates";
|
|
5
|
+
import { is, parse } from "../../shared/hof";
|
|
6
6
|
import { trace } from "../common/trace";
|
|
7
7
|
import { services } from "../common/coreservices";
|
|
8
8
|
import { Rejection } from "./rejectFactory";
|