@angular-wave/angular.ts 0.0.16 → 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/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 +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 +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} +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/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
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/** @publicapi @module ng1 */ /** */
|
|
2
|
-
import { getLocals } from "../services";
|
|
3
|
-
import { services } from "../../core/common/coreservices";
|
|
4
|
-
import { ResolveContext } from "../../core/resolve/resolveContext";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* This is a [[StateBuilder.builder]] function for angular1 `onEnter`, `onExit`,
|
|
8
|
-
* `onRetain` callback hooks on a [[Ng1StateDeclaration]].
|
|
9
|
-
*
|
|
10
|
-
* When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder
|
|
11
|
-
* ensures that those hooks are injectable for @uirouter/angularjs (ng1).
|
|
12
|
-
*
|
|
13
|
-
* @internalapi
|
|
14
|
-
*/
|
|
15
|
-
export const getStateHookBuilder = (hookName) =>
|
|
16
|
-
function stateHookBuilder(stateObject) {
|
|
17
|
-
const hook = stateObject[hookName];
|
|
18
|
-
const pathname = hookName === "onExit" ? "from" : "to";
|
|
19
|
-
function decoratedNg1Hook(trans, state) {
|
|
20
|
-
const resolveContext = new ResolveContext(trans.treeChanges(pathname));
|
|
21
|
-
const subContext = resolveContext.subContext(state.$$state());
|
|
22
|
-
const locals = Object.assign(getLocals(subContext), {
|
|
23
|
-
$state$: state,
|
|
24
|
-
$transition$: trans,
|
|
25
|
-
});
|
|
26
|
-
return services.$injector.invoke(hook, this, locals);
|
|
27
|
-
}
|
|
28
|
-
return hook ? decoratedNg1Hook : undefined;
|
|
29
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const noImpl = (fnname) => () => {
|
|
2
|
-
throw new Error(
|
|
3
|
-
`No implementation for ${fnname}. The framework specific code did not implement this method.`,
|
|
4
|
-
);
|
|
5
|
-
};
|
|
6
|
-
export const makeStub = (service, methods) =>
|
|
7
|
-
methods.reduce(
|
|
8
|
-
(acc, key) => ((acc[key] = noImpl(`${service}.${key}()`)), acc),
|
|
9
|
-
{},
|
|
10
|
-
);
|
|
11
|
-
const services = {
|
|
12
|
-
$q: undefined,
|
|
13
|
-
$injector: undefined,
|
|
14
|
-
};
|
|
15
|
-
export { services };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* workaround for missing console object in IE9 when dev tools haven't been opened o_O
|
|
3
|
-
* @packageDocumentation
|
|
4
|
-
*/
|
|
5
|
-
/* tslint:disable:no-console */
|
|
6
|
-
const noopConsoleStub = { log: () => {}, error: () => {}, table: () => {} };
|
|
7
|
-
function ie9Console(console) {
|
|
8
|
-
const bound = (fn) => Function.prototype.bind.call(fn, console);
|
|
9
|
-
return {
|
|
10
|
-
log: bound(console.log),
|
|
11
|
-
error: bound(console.log),
|
|
12
|
-
table: bound(console.log),
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function fallbackConsole(console) {
|
|
16
|
-
const log = console.log.bind(console);
|
|
17
|
-
const error = console.error ? console.error.bind(console) : log;
|
|
18
|
-
const table = console.table ? console.table.bind(console) : log;
|
|
19
|
-
return { log, error, table };
|
|
20
|
-
}
|
|
21
|
-
function getSafeConsole() {
|
|
22
|
-
// @ts-ignore
|
|
23
|
-
const isIE9 =
|
|
24
|
-
typeof document !== "undefined" &&
|
|
25
|
-
document.documentMode &&
|
|
26
|
-
document.documentMode === 9;
|
|
27
|
-
if (isIE9) {
|
|
28
|
-
return window && window.console
|
|
29
|
-
? ie9Console(window.console)
|
|
30
|
-
: noopConsoleStub;
|
|
31
|
-
} else if (!console.table || !console.error) {
|
|
32
|
-
return fallbackConsole(console);
|
|
33
|
-
} else {
|
|
34
|
-
return console;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
export const safeConsole = getSafeConsole();
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import { UrlMatcherFactory } from "./url/urlMatcherFactory";
|
|
2
|
-
import { UrlRouter } from "./url/urlRouter";
|
|
3
|
-
import { TransitionService } from "./transition/transitionService";
|
|
4
|
-
import { ViewService } from "./view/view";
|
|
5
|
-
import { StateRegistry } from "./state/stateRegistry";
|
|
6
|
-
import { StateService } from "./state/stateService";
|
|
7
|
-
import { UIRouterGlobals } from "./globals";
|
|
8
|
-
import { removeFrom } from "./common/common";
|
|
9
|
-
import { isFunction } from "./common/predicates";
|
|
10
|
-
import { UrlService } from "./url/urlService";
|
|
11
|
-
import { trace } from "./common/trace";
|
|
12
|
-
import { makeStub } from "./common/coreservices";
|
|
13
|
-
|
|
14
|
-
/** @internal
|
|
15
|
-
* @type {number}
|
|
16
|
-
*/
|
|
17
|
-
let _routerInstance = 0;
|
|
18
|
-
|
|
19
|
-
/** @internal
|
|
20
|
-
* @type {(keyof LocationServices)[]}
|
|
21
|
-
*/
|
|
22
|
-
const locSvcFns = ["url", "path", "search", "hash", "onChange"];
|
|
23
|
-
/** @internal
|
|
24
|
-
* @type {(keyof LocationConfig)[]}
|
|
25
|
-
*/
|
|
26
|
-
const locCfgFns = [
|
|
27
|
-
"port",
|
|
28
|
-
"protocol",
|
|
29
|
-
"host",
|
|
30
|
-
"baseHref",
|
|
31
|
-
"html5Mode",
|
|
32
|
-
"hashPrefix",
|
|
33
|
-
];
|
|
34
|
-
/** @internal
|
|
35
|
-
* @type {any}
|
|
36
|
-
*/
|
|
37
|
-
const locationServiceStub = makeStub("LocationServices", locSvcFns);
|
|
38
|
-
/** @internal
|
|
39
|
-
* @type {any}
|
|
40
|
-
*/
|
|
41
|
-
const locationConfigStub = makeStub("LocationConfig", locCfgFns);
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* An instance of UI-Router.
|
|
45
|
-
*
|
|
46
|
-
* This object contains references to service APIs which define your application's routing behavior.
|
|
47
|
-
*/
|
|
48
|
-
export class UIRouter {
|
|
49
|
-
/**
|
|
50
|
-
* Creates a new `UIRouter` object
|
|
51
|
-
*
|
|
52
|
-
* @param locationService a [[LocationServices]] implementation
|
|
53
|
-
* @param locationConfig a [[LocationConfig]] implementation
|
|
54
|
-
* @internal
|
|
55
|
-
*/
|
|
56
|
-
constructor(
|
|
57
|
-
locationService = locationServiceStub,
|
|
58
|
-
locationConfig = locationConfigStub,
|
|
59
|
-
) {
|
|
60
|
-
this.locationService = locationService;
|
|
61
|
-
this.locationConfig = locationConfig;
|
|
62
|
-
/** @internal */ this.$id = _routerInstance++;
|
|
63
|
-
/** @internal */ this._disposed = false;
|
|
64
|
-
/** @internal */ this._disposables = [];
|
|
65
|
-
/** Enable/disable tracing to the javascript console */
|
|
66
|
-
this.trace = trace;
|
|
67
|
-
/** Provides services related to ui-view synchronization */
|
|
68
|
-
this.viewService = new ViewService(this);
|
|
69
|
-
/** An object that contains global router state, such as the current state and params */
|
|
70
|
-
this.globals = new UIRouterGlobals();
|
|
71
|
-
/** A service that exposes global Transition Hooks */
|
|
72
|
-
this.transitionService = new TransitionService(this);
|
|
73
|
-
/**
|
|
74
|
-
* Deprecated for public use. Use [[urlService]] instead.
|
|
75
|
-
* @deprecated Use [[urlService]] instead
|
|
76
|
-
*/
|
|
77
|
-
this.urlMatcherFactory = new UrlMatcherFactory(this);
|
|
78
|
-
/**
|
|
79
|
-
* Deprecated for public use. Use [[urlService]] instead.
|
|
80
|
-
* @deprecated Use [[urlService]] instead
|
|
81
|
-
*/
|
|
82
|
-
this.urlRouter = new UrlRouter(this);
|
|
83
|
-
/** Provides services related to the URL */
|
|
84
|
-
this.urlService = new UrlService(this);
|
|
85
|
-
/** Provides a registry for states, and related registration services */
|
|
86
|
-
this.stateRegistry = new StateRegistry(this);
|
|
87
|
-
/** Provides services related to states */
|
|
88
|
-
this.stateService = new StateService(this);
|
|
89
|
-
/** @internal plugin instances are registered here */
|
|
90
|
-
this._plugins = {};
|
|
91
|
-
this.viewService._pluginapi._rootViewContext(this.stateRegistry.root());
|
|
92
|
-
this.globals.$current = this.stateRegistry.root();
|
|
93
|
-
this.globals.current = this.globals.$current.self;
|
|
94
|
-
this.disposable(this.globals);
|
|
95
|
-
this.disposable(this.stateService);
|
|
96
|
-
this.disposable(this.stateRegistry);
|
|
97
|
-
this.disposable(this.transitionService);
|
|
98
|
-
this.disposable(this.urlService);
|
|
99
|
-
this.disposable(locationService);
|
|
100
|
-
this.disposable(locationConfig);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Registers an object to be notified when the router is disposed
|
|
105
|
-
* @param {Disposable} disposable
|
|
106
|
-
* @returns {void}
|
|
107
|
-
*/
|
|
108
|
-
disposable(disposable) {
|
|
109
|
-
this._disposables.push(disposable);
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Disposes this router instance
|
|
113
|
-
*
|
|
114
|
-
* When called, clears resources retained by the router by calling `dispose(this)` on all
|
|
115
|
-
* registered [[disposable]] objects.
|
|
116
|
-
*
|
|
117
|
-
* Or, if a `disposable` object is provided, calls `dispose(this)` on that object only.
|
|
118
|
-
*
|
|
119
|
-
* @internal
|
|
120
|
-
* @param disposable (optional) the disposable to dispose
|
|
121
|
-
*/
|
|
122
|
-
dispose(disposable) {
|
|
123
|
-
if (disposable && isFunction(disposable.dispose)) {
|
|
124
|
-
disposable.dispose(this);
|
|
125
|
-
return undefined;
|
|
126
|
-
}
|
|
127
|
-
this._disposed = true;
|
|
128
|
-
this._disposables.slice().forEach((d) => {
|
|
129
|
-
try {
|
|
130
|
-
typeof d.dispose === "function" && d.dispose(this);
|
|
131
|
-
removeFrom(this._disposables, d);
|
|
132
|
-
} catch (ignored) {}
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Adds a plugin to UI-Router
|
|
138
|
-
*
|
|
139
|
-
* This method adds a UI-Router Plugin.
|
|
140
|
-
* A plugin can enhance or change UI-Router behavior using any public API.
|
|
141
|
-
*
|
|
142
|
-
* #### Example:
|
|
143
|
-
* ```js
|
|
144
|
-
* import { MyCoolPlugin } from "ui-router-cool-plugin";
|
|
145
|
-
*
|
|
146
|
-
* var plugin = router.addPlugin(MyCoolPlugin);
|
|
147
|
-
* ```
|
|
148
|
-
*
|
|
149
|
-
* ### Plugin authoring
|
|
150
|
-
*
|
|
151
|
-
* A plugin is simply a class (or constructor function) which accepts a [[UIRouter]] instance and (optionally) an options object.
|
|
152
|
-
*
|
|
153
|
-
* The plugin can implement its functionality using any of the public APIs of [[UIRouter]].
|
|
154
|
-
* For example, it may configure router options or add a Transition Hook.
|
|
155
|
-
*
|
|
156
|
-
* The plugin can then be published as a separate module.
|
|
157
|
-
*
|
|
158
|
-
* #### Example:
|
|
159
|
-
* ```js
|
|
160
|
-
* export class MyAuthPlugin implements UIRouterPlugin {
|
|
161
|
-
* constructor(router: UIRouter, options: any) {
|
|
162
|
-
* this.name = "MyAuthPlugin";
|
|
163
|
-
* let $transitions = router.transitionService;
|
|
164
|
-
* let $state = router.stateService;
|
|
165
|
-
*
|
|
166
|
-
* let authCriteria = {
|
|
167
|
-
* to: (state) => state.data && state.data.requiresAuth
|
|
168
|
-
* };
|
|
169
|
-
*
|
|
170
|
-
* function authHook(transition: Transition) {
|
|
171
|
-
* let authService = transition.injector().get('AuthService');
|
|
172
|
-
* if (!authService.isAuthenticated()) {
|
|
173
|
-
* return $state.target('login');
|
|
174
|
-
* }
|
|
175
|
-
* }
|
|
176
|
-
*
|
|
177
|
-
* $transitions.onStart(authCriteria, authHook);
|
|
178
|
-
* }
|
|
179
|
-
* }
|
|
180
|
-
* ```
|
|
181
|
-
*
|
|
182
|
-
* @param plugin one of:
|
|
183
|
-
* - a plugin class which implements [[UIRouterPlugin]]
|
|
184
|
-
* - a constructor function for a [[UIRouterPlugin]] which accepts a [[UIRouter]] instance
|
|
185
|
-
* - a factory function which accepts a [[UIRouter]] instance and returns a [[UIRouterPlugin]] instance
|
|
186
|
-
* @param options options to pass to the plugin class/factory
|
|
187
|
-
* @returns the registered plugin instance
|
|
188
|
-
*/
|
|
189
|
-
plugin(plugin, options = {}) {
|
|
190
|
-
const pluginInstance = new plugin(this, options);
|
|
191
|
-
if (!pluginInstance.name)
|
|
192
|
-
throw new Error(
|
|
193
|
-
"Required property `name` missing on plugin: " + pluginInstance,
|
|
194
|
-
);
|
|
195
|
-
this._disposables.push(pluginInstance);
|
|
196
|
-
return (this._plugins[pluginInstance.name] = pluginInstance);
|
|
197
|
-
}
|
|
198
|
-
getPlugin(pluginName) {
|
|
199
|
-
return pluginName
|
|
200
|
-
? this._plugins[pluginName]
|
|
201
|
-
: Object.values(this._plugins);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|