@angular-wave/angular.ts 0.9.2 → 0.9.4
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/@types/angular.d.ts +4 -19
- package/@types/animations/animate.d.ts +2 -2
- package/@types/animations/animation.d.ts +1 -1
- package/@types/core/compile/attributes.d.ts +1 -1
- package/@types/core/compile/compile.d.ts +2 -2
- package/@types/core/controller/controller.d.ts +1 -1
- package/@types/core/controller/interface.d.ts +6 -0
- package/@types/core/di/ng-module.d.ts +27 -26
- package/@types/core/filter/filter.d.ts +5 -5
- package/@types/core/interpolate/interface.d.ts +13 -0
- package/@types/core/interpolate/interpolate.d.ts +1 -13
- package/@types/core/scope/scope.d.ts +4 -1
- package/@types/directive/http/http.d.ts +16 -16
- package/@types/directive/http/interface.d.ts +27 -0
- package/@types/directive/include/include.d.ts +4 -4
- package/@types/directive/inject/inject.d.ts +12 -0
- package/@types/directive/model/model.d.ts +1 -1
- package/@types/directive/script/script.d.ts +2 -2
- package/@types/directive/setter/setter.d.ts +4 -4
- package/@types/filters/filter.d.ts +2 -2
- package/@types/filters/filters.d.ts +2 -2
- package/@types/filters/interface.d.ts +8 -0
- package/@types/filters/limit-to.d.ts +2 -2
- package/@types/filters/order-by.d.ts +2 -2
- package/@types/index.d.ts +84 -1
- package/@types/interface.d.ts +105 -82
- package/@types/router/state/interface.d.ts +8 -8
- package/@types/router/state-filters.d.ts +4 -4
- package/@types/router/template-factory.d.ts +6 -6
- package/@types/router/transition/hook-builder.d.ts +5 -2
- package/@types/router/transition/hook-registry.d.ts +11 -2
- package/@types/router/transition/transition-service.d.ts +6 -2
- package/@types/router/transition/transition.d.ts +2 -2
- package/@types/router/view/view.d.ts +1 -8
- package/@types/router/view-scroll.d.ts +4 -2
- package/@types/services/{anchor-scroll.d.ts → anchor-scroll/anchor-scroll.d.ts} +2 -2
- package/@types/services/exception/exception-handler.d.ts +2 -2
- package/@types/services/exception/interface.d.ts +1 -1
- package/@types/services/http/http.d.ts +40 -2
- package/@types/services/http/interface.d.ts +11 -0
- package/@types/services/location/location.d.ts +1 -4
- package/@types/services/sce/sce.d.ts +3 -4
- package/@types/services/template-cache/template-cache.d.ts +4 -4
- package/@types/services/template-request/interface.d.ts +22 -0
- package/@types/services/{template-request.d.ts → template-request/template-request.d.ts} +4 -7
- package/@types/shared/common.d.ts +8 -69
- package/@types/shared/hof.d.ts +7 -7
- package/dist/angular-ts.esm.js +509 -570
- package/dist/angular-ts.umd.js +509 -570
- package/dist/angular-ts.umd.min.js +1 -1
- package/{src/filters → docs/content/docs/filter}/filter.md +18 -9
- package/{src/filters → docs/content/docs/filter}/json.md +6 -3
- package/docs/content/docs/filter/limit-to.md +30 -0
- package/docs/content/docs/filter/order-by.md +123 -0
- package/docs/content/docs/provider/sceProvider.md +194 -0
- package/docs/content/docs/provider/templateRequestProvider.md +5 -0
- package/docs/content/docs/service/compile.md +5 -0
- package/docs/content/docs/service/controller.md +5 -0
- package/docs/content/docs/service/http.md +161 -0
- package/docs/content/docs/service/interpolation.md +5 -0
- package/docs/content/docs/service/log.md +1 -1
- package/docs/content/docs/service/parse.md +5 -0
- package/docs/content/docs/service/rootElement.md +5 -0
- package/docs/content/docs/service/rootScope.md +5 -0
- package/docs/content/docs/service/sce.md +194 -0
- package/docs/content/docs/service/templateRequest.md +5 -0
- package/docs/content/docs/values/_index.md +4 -0
- package/docs/content/docs/values/document.md +29 -0
- package/docs/content/docs/values/window.md +29 -0
- package/docs/layouts/shortcodes/version.html +1 -1
- package/docs/static/examples/document/document.html +3 -0
- package/docs/static/examples/i18n/i18n.html +77 -0
- package/docs/static/examples/window/window.html +4 -0
- package/docs/static/typedoc/assets/hierarchy.js +1 -1
- package/docs/static/typedoc/assets/highlight.css +0 -49
- package/docs/static/typedoc/assets/navigation.js +1 -1
- package/docs/static/typedoc/assets/search.js +1 -1
- package/docs/static/typedoc/classes/PubSubProvider.html +3 -2
- package/docs/static/typedoc/classes/TemplateCacheProvider.html +1 -1
- package/docs/static/typedoc/hierarchy.html +1 -1
- package/docs/static/typedoc/index.html +1 -1
- package/docs/static/typedoc/interfaces/HttpProviderDefaults.html +1 -1
- package/docs/static/typedoc/interfaces/RequestConfig.html +1 -1
- package/docs/static/typedoc/interfaces/RequestShortcutConfig.html +1 -1
- package/docs/static/typedoc/interfaces/ServiceProvider.html +3 -3
- package/docs/static/typedoc/types/HttpParamSerializer.html +2 -0
- package/docs/static/typedoc/types/{Expression.html → HttpParams.html} +1 -5
- package/legacy.d.ts +0 -921
- package/package.json +1 -1
- package/src/angular.js +2 -9
- package/src/animations/animate.js +1 -1
- package/src/animations/animation.js +7 -7
- package/src/core/compile/compile.js +3 -2
- package/src/core/controller/controller.js +10 -6
- package/src/core/controller/interface.ts +6 -0
- package/src/core/di/injector.js +1 -1
- package/src/core/di/internal-injector.js +2 -0
- package/src/core/di/ng-module.js +16 -13
- package/src/core/filter/filter.js +3 -3
- package/src/core/interpolate/interface.ts +14 -0
- package/src/core/interpolate/interpolate.js +7 -5
- package/src/core/scope/scope.js +4 -1
- package/src/directive/http/delete.spec.js +5 -8
- package/src/directive/http/http.js +16 -16
- package/src/directive/http/interface.ts +36 -0
- package/src/directive/http/put.spec.js +5 -8
- package/src/directive/include/include.js +2 -2
- package/src/{services/http-backend/http-backend.html → directive/inject/inject.html} +1 -4
- package/src/directive/inject/inject.js +35 -0
- package/src/directive/inject/inject.spec.js +108 -0
- package/src/{services/http-backend/http-backend.test.js → directive/inject/inject.test.js} +1 -1
- package/src/directive/script/script.js +1 -1
- package/src/directive/setter/setter.js +2 -2
- package/src/filters/filter.js +1 -1
- package/src/filters/filters.js +1 -1
- package/src/filters/interface.ts +9 -0
- package/src/filters/limit-to.js +1 -1
- package/src/filters/order-by.js +1 -1
- package/src/index.ts +96 -0
- package/src/injection-tokens.js +4 -1
- package/src/interface.ts +102 -93
- package/src/ng.js +6 -4
- package/src/ng.spec.js +12 -0
- package/src/router/directives/state-directives.js +1 -1
- package/src/router/directives/view-directive.spec.js +19 -35
- package/src/router/state/interface.ts +8 -8
- package/src/router/state/state-builder.js +4 -4
- package/src/router/state/state-registry.js +7 -2
- package/src/router/state/state-service.js +2 -14
- package/src/router/state-filters.js +2 -2
- package/src/router/template-factory.js +3 -3
- package/src/router/template-factory.spec.js +10 -19
- package/src/router/transition/hook-builder.js +5 -1
- package/src/router/transition/hook-registry.js +12 -3
- package/src/router/transition/transition-service.js +4 -9
- package/src/router/transition/transition.js +3 -2
- package/src/router/url/url-service.js +2 -2
- package/src/router/view/view.js +3 -15
- package/src/router/view-scroll.js +2 -2
- package/src/services/{anchor-scroll.js → anchor-scroll/anchor-scroll.js} +4 -4
- package/src/services/exception/exception-handler.js +1 -1
- package/src/services/exception/interface.ts +1 -1
- package/src/services/http/http.js +200 -13
- package/src/services/http/http.spec.js +388 -9
- package/src/services/http/interface.ts +13 -0
- package/src/services/location/location.js +1 -1
- package/src/services/pubsub/pubsub.js +0 -1
- package/src/services/sce/sce.js +18 -13
- package/src/services/template-cache/template-cache.js +2 -2
- package/src/services/template-request/interface.ts +23 -0
- package/src/services/{template-request.js → template-request/template-request.js} +6 -6
- package/src/shared/common.js +7 -80
- package/src/shared/hof.js +23 -17
- package/typedoc.json +1 -1
- package/@types/services/cookie-reader.d.ts +0 -4
- package/@types/services/http-backend/http-backend.d.ts +0 -58
- package/@types/services/template-cache/interface.d.ts +0 -10
- package/docs/static/typedoc/interfaces/ChangesObject.html +0 -6
- package/docs/static/typedoc/interfaces/ComponentOptions.html +0 -16
- package/docs/static/typedoc/interfaces/Controller.html +0 -12
- package/docs/static/typedoc/interfaces/Directive.html +0 -37
- package/docs/static/typedoc/interfaces/DirectivePrePost.html +0 -4
- package/docs/static/typedoc/interfaces/NgModelController.html +0 -30
- package/docs/static/typedoc/interfaces/NgModelOptions.html +0 -16
- package/docs/static/typedoc/interfaces/Provider.html +0 -34
- package/docs/static/typedoc/interfaces/TemplateCache.html +0 -7
- package/docs/static/typedoc/interfaces/TranscludeFunctionObject.html +0 -8
- package/docs/static/typedoc/types/AnnotatedDirectiveFactory.html +0 -1
- package/docs/static/typedoc/types/AnnotatedFactory.html +0 -8
- package/docs/static/typedoc/types/CloneAttachFunction.html +0 -2
- package/docs/static/typedoc/types/ControllerConstructor.html +0 -2
- package/docs/static/typedoc/types/DirectiveCompileFn.html +0 -2
- package/docs/static/typedoc/types/DirectiveController.html +0 -2
- package/docs/static/typedoc/types/DirectiveFactory.html +0 -1
- package/docs/static/typedoc/types/DirectiveFactoryFn.html +0 -1
- package/docs/static/typedoc/types/DirectiveLinkFn.html +0 -2
- package/docs/static/typedoc/types/ExpandoStore.html +0 -2
- package/docs/static/typedoc/types/FilterFactory.html +0 -2
- package/docs/static/typedoc/types/FilterFn.html +0 -2
- package/docs/static/typedoc/types/Injectable.html +0 -4
- package/docs/static/typedoc/types/InjectableClass.html +0 -1
- package/docs/static/typedoc/types/InjectableFactory.html +0 -1
- package/docs/static/typedoc/types/OnChangesObject.html +0 -2
- package/docs/static/typedoc/types/SwapModeType.html +0 -2
- package/docs/static/typedoc/types/TController.html +0 -2
- package/docs/static/typedoc/variables/SwapMode.html +0 -11
- package/src/filters/limit-to.md +0 -19
- package/src/filters/order-by.md +0 -83
- package/src/router/state/README.md +0 -21
- package/src/services/cookie-reader.js +0 -48
- package/src/services/http/http.md +0 -413
- package/src/services/http-backend/http-backend.js +0 -158
- package/src/services/http-backend/http-backend.spec.js +0 -389
- package/src/services/sce/sce.md +0 -300
- package/src/services/template-cache/interface.ts +0 -10
- /package/src/services/{anchor-scroll.html → anchor-scroll/anchor-scroll.html} +0 -0
|
@@ -1121,27 +1121,18 @@ describe("angular 1.5+ style .component()", () => {
|
|
|
1121
1121
|
"defaultModule",
|
|
1122
1122
|
]);
|
|
1123
1123
|
|
|
1124
|
-
$injector.invoke(
|
|
1125
|
-
|
|
1126
|
-
_$
|
|
1127
|
-
_$
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
};
|
|
1137
|
-
$rootScope = _$rootScope_;
|
|
1138
|
-
scope = $rootScope.$new();
|
|
1139
|
-
log = "";
|
|
1140
|
-
el.innerHTML = "<div><ng-view></ng-view></div>";
|
|
1141
|
-
svcs.$compile(el)(scope);
|
|
1142
|
-
$templateCache = _$templateCache_;
|
|
1143
|
-
},
|
|
1144
|
-
);
|
|
1124
|
+
$injector.invoke((_$rootScope_, _$compile_, _$state_, _$templateCache_) => {
|
|
1125
|
+
svcs = {
|
|
1126
|
+
$compile: _$compile_,
|
|
1127
|
+
$state: _$state_,
|
|
1128
|
+
};
|
|
1129
|
+
$rootScope = _$rootScope_;
|
|
1130
|
+
scope = $rootScope.$new();
|
|
1131
|
+
log = "";
|
|
1132
|
+
el.innerHTML = "<div><ng-view></ng-view></div>";
|
|
1133
|
+
svcs.$compile(el)(scope);
|
|
1134
|
+
$templateCache = _$templateCache_;
|
|
1135
|
+
});
|
|
1145
1136
|
});
|
|
1146
1137
|
|
|
1147
1138
|
describe("routing using component templates", () => {
|
|
@@ -1311,8 +1302,7 @@ describe("angular 1.5+ style .component()", () => {
|
|
|
1311
1302
|
},
|
|
1312
1303
|
});
|
|
1313
1304
|
|
|
1314
|
-
const $state = svcs.$state
|
|
1315
|
-
$httpBackend = svcs.$httpBackend;
|
|
1305
|
+
const $state = svcs.$state;
|
|
1316
1306
|
|
|
1317
1307
|
$templateCache.set("/comp_tpl.html", "-{{ $ctrl.data }}-");
|
|
1318
1308
|
$state.transitionTo("route2cmp");
|
|
@@ -1358,8 +1348,7 @@ describe("angular 1.5+ style .component()", () => {
|
|
|
1358
1348
|
},
|
|
1359
1349
|
});
|
|
1360
1350
|
|
|
1361
|
-
const $state = svcs.$state
|
|
1362
|
-
$httpBackend = svcs.$httpBackend;
|
|
1351
|
+
const $state = svcs.$state;
|
|
1363
1352
|
|
|
1364
1353
|
$templateCache.set("/comp_tpl.html", "-{{ $ctrl.data }}-");
|
|
1365
1354
|
$state.transitionTo("route2cmp");
|
|
@@ -1382,8 +1371,7 @@ describe("angular 1.5+ style .component()", () => {
|
|
|
1382
1371
|
},
|
|
1383
1372
|
});
|
|
1384
1373
|
|
|
1385
|
-
const $state = svcs.$state
|
|
1386
|
-
$httpBackend = svcs.$httpBackend;
|
|
1374
|
+
const $state = svcs.$state;
|
|
1387
1375
|
|
|
1388
1376
|
$templateCache.set("/comp_tpl.html", "-{{ $ctrl.data }}-");
|
|
1389
1377
|
$state.transitionTo("route2cmp");
|
|
@@ -1403,8 +1391,7 @@ describe("angular 1.5+ style .component()", () => {
|
|
|
1403
1391
|
},
|
|
1404
1392
|
});
|
|
1405
1393
|
|
|
1406
|
-
const $state = svcs.$state
|
|
1407
|
-
$httpBackend = svcs.$httpBackend;
|
|
1394
|
+
const $state = svcs.$state;
|
|
1408
1395
|
|
|
1409
1396
|
$templateCache.set("/comp_tpl.html", "-{{ $ctrl.data }}-");
|
|
1410
1397
|
$state.transitionTo("route2cmp");
|
|
@@ -1431,8 +1418,7 @@ describe("angular 1.5+ style .component()", () => {
|
|
|
1431
1418
|
bindings: { attr: "attribute" },
|
|
1432
1419
|
});
|
|
1433
1420
|
|
|
1434
|
-
const $state = svcs.$state
|
|
1435
|
-
$httpBackend = svcs.$httpBackend;
|
|
1421
|
+
const $state = svcs.$state;
|
|
1436
1422
|
|
|
1437
1423
|
$state.transitionTo("bindingtypes");
|
|
1438
1424
|
await wait(100);
|
|
@@ -1742,8 +1728,7 @@ describe("angular 1.5+ style .component()", () => {
|
|
|
1742
1728
|
},
|
|
1743
1729
|
};
|
|
1744
1730
|
$stateProvider.state(stateDef);
|
|
1745
|
-
const $state = svcs.$state
|
|
1746
|
-
$httpBackend = svcs.$httpBackend;
|
|
1731
|
+
const $state = svcs.$state;
|
|
1747
1732
|
|
|
1748
1733
|
$templateCache.set("/comp_tpl.html", "-{{ $ctrl.data }}-");
|
|
1749
1734
|
$state.transitionTo("route2cmp");
|
|
@@ -1813,8 +1798,7 @@ describe("angular 1.5+ style .component()", () => {
|
|
|
1813
1798
|
},
|
|
1814
1799
|
});
|
|
1815
1800
|
|
|
1816
|
-
const $state = svcs.$state
|
|
1817
|
-
$httpBackend = svcs.$httpBackend;
|
|
1801
|
+
const $state = svcs.$state;
|
|
1818
1802
|
|
|
1819
1803
|
$templateCache.set(
|
|
1820
1804
|
"/comp_tpl.html",
|
|
@@ -189,7 +189,7 @@ export interface ViewDeclaration {
|
|
|
189
189
|
* }
|
|
190
190
|
* ```
|
|
191
191
|
*/
|
|
192
|
-
componentProvider?: Injectable
|
|
192
|
+
componentProvider?: Injectable<any>;
|
|
193
193
|
|
|
194
194
|
/**
|
|
195
195
|
* The view's controller function or name
|
|
@@ -204,7 +204,7 @@ export interface ViewDeclaration {
|
|
|
204
204
|
*
|
|
205
205
|
* See: [[Ng1Controller]] for information about component-level router hooks.
|
|
206
206
|
*/
|
|
207
|
-
controller?: Injectable | string;
|
|
207
|
+
controller?: Injectable<any> | string;
|
|
208
208
|
|
|
209
209
|
/**
|
|
210
210
|
* A controller alias name.
|
|
@@ -240,7 +240,7 @@ export interface ViewDeclaration {
|
|
|
240
240
|
* }
|
|
241
241
|
* ```
|
|
242
242
|
*/
|
|
243
|
-
controllerProvider?: Injectable
|
|
243
|
+
controllerProvider?: Injectable<any>;
|
|
244
244
|
|
|
245
245
|
/**
|
|
246
246
|
* The scope variable name to use for resolve data.
|
|
@@ -319,7 +319,7 @@ export interface ViewDeclaration {
|
|
|
319
319
|
* }
|
|
320
320
|
* ```
|
|
321
321
|
*/
|
|
322
|
-
templateProvider?: Injectable
|
|
322
|
+
templateProvider?: Injectable<any>;
|
|
323
323
|
}
|
|
324
324
|
|
|
325
325
|
/**
|
|
@@ -534,7 +534,7 @@ export interface StateDeclaration {
|
|
|
534
534
|
* }
|
|
535
535
|
* ```
|
|
536
536
|
*/
|
|
537
|
-
resolve?: ResolveTypes[] | { [key: string]: Injectable };
|
|
537
|
+
resolve?: ResolveTypes[] | { [key: string]: Injectable<any> };
|
|
538
538
|
|
|
539
539
|
/**
|
|
540
540
|
* Sets the resolve policy defaults for all resolves on this state
|
|
@@ -759,7 +759,7 @@ export interface StateDeclaration {
|
|
|
759
759
|
* });
|
|
760
760
|
* ```
|
|
761
761
|
*/
|
|
762
|
-
onEnter?: TransitionStateHookFn | Injectable
|
|
762
|
+
onEnter?: TransitionStateHookFn | Injectable<any>;
|
|
763
763
|
/**
|
|
764
764
|
* A state hook invoked when a state is being retained.
|
|
765
765
|
*
|
|
@@ -786,7 +786,7 @@ export interface StateDeclaration {
|
|
|
786
786
|
* });
|
|
787
787
|
* ```
|
|
788
788
|
*/
|
|
789
|
-
onRetain?: TransitionStateHookFn | Injectable
|
|
789
|
+
onRetain?: TransitionStateHookFn | Injectable<any>;
|
|
790
790
|
/**
|
|
791
791
|
* A state hook invoked when a state is being exited.
|
|
792
792
|
*
|
|
@@ -813,7 +813,7 @@ export interface StateDeclaration {
|
|
|
813
813
|
* });
|
|
814
814
|
* ```
|
|
815
815
|
*/
|
|
816
|
-
onExit?: TransitionStateHookFn | Injectable
|
|
816
|
+
onExit?: TransitionStateHookFn | Injectable<any>;
|
|
817
817
|
|
|
818
818
|
/**
|
|
819
819
|
* A function used to lazy load code
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "../../shared/common.js";
|
|
9
9
|
import { hasOwn, isDefined, isFunction, isString } from "../../shared/utils.js";
|
|
10
10
|
import { stringify } from "../../shared/strings.js";
|
|
11
|
-
import { is, pattern,
|
|
11
|
+
import { is, pattern, val } from "../../shared/hof.js";
|
|
12
12
|
import { Resolvable } from "../resolve/resolvable.js";
|
|
13
13
|
import { annotate } from "../../core/di/injector.js";
|
|
14
14
|
|
|
@@ -209,12 +209,12 @@ export function resolvablesBuilder(state) {
|
|
|
209
209
|
]);
|
|
210
210
|
const tuple2Resolvable = pattern([
|
|
211
211
|
[
|
|
212
|
-
|
|
212
|
+
(x) => isString(x.val),
|
|
213
213
|
(tuple) =>
|
|
214
214
|
new Resolvable(tuple.token, (x) => x, [tuple.val], tuple.policy),
|
|
215
215
|
],
|
|
216
216
|
[
|
|
217
|
-
|
|
217
|
+
(x) => Array.isArray(x.val),
|
|
218
218
|
(tuple) =>
|
|
219
219
|
new Resolvable(
|
|
220
220
|
tuple.token,
|
|
@@ -224,7 +224,7 @@ export function resolvablesBuilder(state) {
|
|
|
224
224
|
),
|
|
225
225
|
],
|
|
226
226
|
[
|
|
227
|
-
|
|
227
|
+
(x) => isFunction(x.val),
|
|
228
228
|
(tuple) =>
|
|
229
229
|
new Resolvable(
|
|
230
230
|
tuple.token,
|
|
@@ -16,7 +16,12 @@ import { $injectTokens as $t, provider } from "../../injection-tokens.js";
|
|
|
16
16
|
*
|
|
17
17
|
*/
|
|
18
18
|
export class StateRegistryProvider {
|
|
19
|
-
static $inject = provider([
|
|
19
|
+
/* @ignore */ static $inject = provider([
|
|
20
|
+
$t.$url,
|
|
21
|
+
$t.$state,
|
|
22
|
+
$t.$router,
|
|
23
|
+
$t.$view,
|
|
24
|
+
]);
|
|
20
25
|
|
|
21
26
|
/**
|
|
22
27
|
* @param urlService
|
|
@@ -145,7 +150,7 @@ export class StateRegistryProvider {
|
|
|
145
150
|
onStatesChanged(listener) {
|
|
146
151
|
this.listeners.push(listener);
|
|
147
152
|
return function deregisterListener() {
|
|
148
|
-
removeFrom(this.listeners
|
|
153
|
+
removeFrom(this.listeners, listener);
|
|
149
154
|
}.bind(this);
|
|
150
155
|
}
|
|
151
156
|
/**
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
createProxyFunctions,
|
|
3
2
|
defaults,
|
|
4
3
|
removeFrom,
|
|
5
4
|
silenceUncaughtInPromise,
|
|
@@ -15,7 +14,6 @@ import { TargetState } from "./target-state.js";
|
|
|
15
14
|
import { Param } from "../params/param.js";
|
|
16
15
|
import { Glob } from "../glob/glob.js";
|
|
17
16
|
import { lazyLoadState } from "../hooks/lazy-load.js";
|
|
18
|
-
import { val } from "../../shared/hof.js";
|
|
19
17
|
import { EventBus } from "../../services/pubsub/pubsub.js";
|
|
20
18
|
|
|
21
19
|
const err = minErr("$stateProvider");
|
|
@@ -51,7 +49,7 @@ export class StateProvider {
|
|
|
51
49
|
return this.globals.$current;
|
|
52
50
|
}
|
|
53
51
|
|
|
54
|
-
static $inject = ["$routerProvider", "$transitionsProvider"];
|
|
52
|
+
/* @ignore */ static $inject = ["$routerProvider", "$transitionsProvider"];
|
|
55
53
|
|
|
56
54
|
/**
|
|
57
55
|
*
|
|
@@ -76,16 +74,6 @@ export class StateProvider {
|
|
|
76
74
|
throw new Error($error$);
|
|
77
75
|
}
|
|
78
76
|
};
|
|
79
|
-
const getters = ["current", "$current", "params", "transition"];
|
|
80
|
-
const boundFns = Object.keys(StateProvider.prototype).filter(
|
|
81
|
-
(x) => !getters.includes(x),
|
|
82
|
-
);
|
|
83
|
-
createProxyFunctions(
|
|
84
|
-
val(StateProvider.prototype),
|
|
85
|
-
this,
|
|
86
|
-
val(this),
|
|
87
|
-
boundFns,
|
|
88
|
-
);
|
|
89
77
|
|
|
90
78
|
EventBus.subscribe("$stateService:defaultErrorHandler", (err) =>
|
|
91
79
|
this.defaultErrorHandler()(err),
|
|
@@ -285,7 +273,7 @@ export class StateProvider {
|
|
|
285
273
|
onInvalid(callback) {
|
|
286
274
|
this.invalidCallbacks.push(callback);
|
|
287
275
|
return function deregisterListener() {
|
|
288
|
-
removeFrom(this.invalidCallbacks
|
|
276
|
+
removeFrom(this.invalidCallbacks, callback);
|
|
289
277
|
}.bind(this);
|
|
290
278
|
}
|
|
291
279
|
/**
|
|
@@ -13,7 +13,7 @@ $IsStateFilter.$inject = [$t.$state];
|
|
|
13
13
|
* ```
|
|
14
14
|
*
|
|
15
15
|
* @param {import('./state/state-service.js').StateProvider} $state
|
|
16
|
-
* @returns {
|
|
16
|
+
* @returns {ng.FilterFn}
|
|
17
17
|
*/
|
|
18
18
|
export function $IsStateFilter($state) {
|
|
19
19
|
const isFilter = (state, params, options) =>
|
|
@@ -35,7 +35,7 @@ $IncludedByStateFilter.$inject = [$t.$state];
|
|
|
35
35
|
* ```
|
|
36
36
|
*
|
|
37
37
|
* @param {import('./state/state-service.js').StateProvider} $state
|
|
38
|
-
* @returns {
|
|
38
|
+
* @returns {ng.FilterFn}
|
|
39
39
|
*/
|
|
40
40
|
export function $IncludedByStateFilter($state) {
|
|
41
41
|
const includesFilter = function (state, params, options) {
|
|
@@ -28,7 +28,7 @@ export class TemplateFactoryProvider {
|
|
|
28
28
|
$t.$injector,
|
|
29
29
|
/**
|
|
30
30
|
* @param {import("interface.ts").HttpService} $http
|
|
31
|
-
* @param {
|
|
31
|
+
* @param {ng.TemplateCacheService} $templateCache
|
|
32
32
|
* @param {any} $templateRequest
|
|
33
33
|
* @param {import("../core/di/internal-injector.js").InjectorService} $injector
|
|
34
34
|
* @returns
|
|
@@ -140,7 +140,7 @@ export class TemplateFactoryProvider {
|
|
|
140
140
|
/**
|
|
141
141
|
* Creates a template by invoking an injectable provider function.
|
|
142
142
|
*
|
|
143
|
-
* @param {import('../interface.ts').Injectable} provider Function to invoke via `locals`
|
|
143
|
+
* @param {import('../interface.ts').Injectable<any>} provider Function to invoke via `locals`
|
|
144
144
|
* @param {Function} params a function used to invoke the template provider
|
|
145
145
|
* @param {import("./resolve/resolve-context.js").ResolveContext} context
|
|
146
146
|
* @return {string|Promise.<string>} The template html as a string, or a promise
|
|
@@ -155,7 +155,7 @@ export class TemplateFactoryProvider {
|
|
|
155
155
|
/**
|
|
156
156
|
* Creates a component's template by invoking an injectable provider function.
|
|
157
157
|
*
|
|
158
|
-
* @param {import('../interface.ts').Injectable} provider Function to invoke via `locals`
|
|
158
|
+
* @param {import('../interface.ts').Injectable<any>} provider Function to invoke via `locals`
|
|
159
159
|
* @return {Promise<any>} The template html as a string: "<component-name input1='::$resolve.foo'></component-name>".
|
|
160
160
|
*/
|
|
161
161
|
fromComponentProvider(provider, context) {
|
|
@@ -5,7 +5,6 @@ import { wait } from "../shared/test-utils.js";
|
|
|
5
5
|
describe("templateFactory", () => {
|
|
6
6
|
let $injector,
|
|
7
7
|
$templateFactory,
|
|
8
|
-
$httpBackend,
|
|
9
8
|
$sce,
|
|
10
9
|
$scope,
|
|
11
10
|
$compile,
|
|
@@ -26,14 +25,11 @@ describe("templateFactory", () => {
|
|
|
26
25
|
$injector = window.angular.bootstrap(document.getElementById("app"), [
|
|
27
26
|
"defaultModule",
|
|
28
27
|
]);
|
|
29
|
-
$injector.invoke(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
$scope = $rootScope;
|
|
35
|
-
},
|
|
36
|
-
);
|
|
28
|
+
$injector.invoke((_$templateFactory_, _$sce_, $rootScope) => {
|
|
29
|
+
$templateFactory = _$templateFactory_;
|
|
30
|
+
$sce = _$sce_;
|
|
31
|
+
$scope = $rootScope;
|
|
32
|
+
});
|
|
37
33
|
});
|
|
38
34
|
|
|
39
35
|
it("exists", () => {
|
|
@@ -73,14 +69,11 @@ describe("templateFactory", () => {
|
|
|
73
69
|
$injector = window.angular.bootstrap(document.getElementById("app"), [
|
|
74
70
|
"defaultModule",
|
|
75
71
|
]);
|
|
76
|
-
$injector.invoke(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
$scope = $rootScope;
|
|
82
|
-
},
|
|
83
|
-
);
|
|
72
|
+
$injector.invoke((_$templateFactory_, _$sce_, $rootScope) => {
|
|
73
|
+
$templateFactory = _$templateFactory_;
|
|
74
|
+
$sce = _$sce_;
|
|
75
|
+
$scope = $rootScope;
|
|
76
|
+
});
|
|
84
77
|
});
|
|
85
78
|
|
|
86
79
|
it("does not restrict URL loading", function () {
|
|
@@ -109,7 +102,6 @@ describe("templateFactory", () => {
|
|
|
109
102
|
$injector.invoke(
|
|
110
103
|
(
|
|
111
104
|
_$templateFactory_,
|
|
112
|
-
_$httpBackend_,
|
|
113
105
|
_$sce_,
|
|
114
106
|
$rootScope,
|
|
115
107
|
_$stateRegistry_,
|
|
@@ -117,7 +109,6 @@ describe("templateFactory", () => {
|
|
|
117
109
|
_$compile_,
|
|
118
110
|
) => {
|
|
119
111
|
$templateFactory = _$templateFactory_;
|
|
120
|
-
$httpBackend = _$httpBackend_;
|
|
121
112
|
$sce = _$sce_;
|
|
122
113
|
$scope = $rootScope;
|
|
123
114
|
$stateRegistry = _$stateRegistry_;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { assertPredicate, unnestR } from "../../shared/common.js";
|
|
2
2
|
import { TransitionHookPhase, TransitionHookScope } from "./interface.js";
|
|
3
3
|
import { TransitionHook } from "./transition-hook.js";
|
|
4
|
+
|
|
4
5
|
/**
|
|
5
6
|
* This class returns applicable TransitionHooks for a specific Transition instance.
|
|
6
7
|
*
|
|
@@ -15,6 +16,9 @@ import { TransitionHook } from "./transition-hook.js";
|
|
|
15
16
|
* in the Transition class, so we must also provide the Transition's _treeChanges)
|
|
16
17
|
*/
|
|
17
18
|
export class HookBuilder {
|
|
19
|
+
/**
|
|
20
|
+
* @param {import("./transition.js").Transition} transition
|
|
21
|
+
*/
|
|
18
22
|
constructor(transition) {
|
|
19
23
|
this.transition = transition;
|
|
20
24
|
}
|
|
@@ -24,7 +28,7 @@ export class HookBuilder {
|
|
|
24
28
|
* @returns
|
|
25
29
|
*/
|
|
26
30
|
buildHooksForPhase(phase) {
|
|
27
|
-
return this.transition.transitionService
|
|
31
|
+
return this.transition.transitionService
|
|
28
32
|
._getEvents(phase)
|
|
29
33
|
.map((type) => this.buildHooks(type))
|
|
30
34
|
.reduce(unnestR, [])
|
|
@@ -37,6 +37,14 @@ export function matchState(state, criterion, transition) {
|
|
|
37
37
|
* The registration data for a registered transition hook
|
|
38
38
|
*/
|
|
39
39
|
export class RegisteredHook {
|
|
40
|
+
/**
|
|
41
|
+
* @param {import("./transition-service.js").TransitionProvider} tranSvc
|
|
42
|
+
* @param eventType
|
|
43
|
+
* @param callback
|
|
44
|
+
* @param matchCriteria
|
|
45
|
+
* @param removeHookFromRegistry
|
|
46
|
+
* @param options
|
|
47
|
+
*/
|
|
40
48
|
constructor(
|
|
41
49
|
tranSvc,
|
|
42
50
|
eventType,
|
|
@@ -45,6 +53,7 @@ export class RegisteredHook {
|
|
|
45
53
|
removeHookFromRegistry,
|
|
46
54
|
options = {},
|
|
47
55
|
) {
|
|
56
|
+
/** @type {import("./transition-service.js").TransitionProvider} */
|
|
48
57
|
this.tranSvc = tranSvc;
|
|
49
58
|
this.eventType = eventType;
|
|
50
59
|
this.callback = callback;
|
|
@@ -93,7 +102,7 @@ export class RegisteredHook {
|
|
|
93
102
|
* }
|
|
94
103
|
*/
|
|
95
104
|
_getDefaultMatchCriteria() {
|
|
96
|
-
return map(this.tranSvc.
|
|
105
|
+
return map(this.tranSvc._getPathTypes(), () => true);
|
|
97
106
|
}
|
|
98
107
|
/**
|
|
99
108
|
* Gets matching nodes as [[IMatchingNodes]]
|
|
@@ -115,7 +124,7 @@ export class RegisteredHook {
|
|
|
115
124
|
this._getDefaultMatchCriteria(),
|
|
116
125
|
this.matchCriteria,
|
|
117
126
|
);
|
|
118
|
-
const paths = Object.values(this.tranSvc.
|
|
127
|
+
const paths = Object.values(this.tranSvc._getPathTypes());
|
|
119
128
|
return paths.reduce((mn, pathtype) => {
|
|
120
129
|
// STATE scope criteria matches against every node in the path.
|
|
121
130
|
// TRANSITION scope criteria matches against only the last node in the path
|
|
@@ -153,7 +162,7 @@ export function makeEvent(registry, transitionService, eventType) {
|
|
|
153
162
|
const _registeredHooks = (registry._registeredHooks =
|
|
154
163
|
registry._registeredHooks || {});
|
|
155
164
|
const hooks = (_registeredHooks[eventType.name] = []);
|
|
156
|
-
const removeHookFn = removeFrom(hooks);
|
|
165
|
+
const removeHookFn = (x) => removeFrom(hooks, x);
|
|
157
166
|
// Create hook registration function on the IHookRegistry for the event
|
|
158
167
|
registry[eventType.name] = hookRegistrationFn;
|
|
159
168
|
function hookRegistrationFn(matchObject, callback, options = {}) {
|
|
@@ -25,8 +25,6 @@ import { registerLazyLoadHook } from "../hooks/lazy-load.js";
|
|
|
25
25
|
import { TransitionEventType } from "./transition-event-type.js";
|
|
26
26
|
import { TransitionHook } from "./transition-hook.js";
|
|
27
27
|
import { isDefined } from "../../shared/utils.js";
|
|
28
|
-
import { createProxyFunctions } from "../../shared/common.js";
|
|
29
|
-
import { val } from "../../shared/hof.js";
|
|
30
28
|
import { registerIgnoredTransitionHook } from "../hooks/ignored-transition.js";
|
|
31
29
|
import { registerInvalidTransitionHook } from "../hooks/invalid-transition.js";
|
|
32
30
|
import { registerRedirectToHook } from "../hooks/redirect-to.js";
|
|
@@ -79,13 +77,6 @@ export class TransitionProvider {
|
|
|
79
77
|
this.globals = globals;
|
|
80
78
|
this.$view = viewService;
|
|
81
79
|
this._deregisterHookFns = {};
|
|
82
|
-
this._pluginapi = createProxyFunctions(val(this), {}, val(this), [
|
|
83
|
-
"_definePathType",
|
|
84
|
-
"_defineEvent",
|
|
85
|
-
"_getPathTypes",
|
|
86
|
-
"_getEvents",
|
|
87
|
-
"getHooks",
|
|
88
|
-
]);
|
|
89
80
|
this._defineCorePaths();
|
|
90
81
|
this._defineCoreEvents();
|
|
91
82
|
this._registerCoreTransitionHooks();
|
|
@@ -243,6 +234,10 @@ export class TransitionProvider {
|
|
|
243
234
|
makeEvent(this, this, eventType);
|
|
244
235
|
}
|
|
245
236
|
|
|
237
|
+
/**
|
|
238
|
+
* @param {TransitionHookPhase} [phase]
|
|
239
|
+
* @return {any[]}
|
|
240
|
+
*/
|
|
246
241
|
_getEvents(phase) {
|
|
247
242
|
const transitionHookTypes = isDefined(phase)
|
|
248
243
|
? this._eventTypes.filter((type) => type.hookPhase === phase)
|
|
@@ -101,7 +101,7 @@ export class Transition {
|
|
|
101
101
|
* (which can then be used to register hooks)
|
|
102
102
|
*/
|
|
103
103
|
createTransitionHookRegFns() {
|
|
104
|
-
this.transitionService
|
|
104
|
+
this.transitionService
|
|
105
105
|
._getEvents()
|
|
106
106
|
.filter((type) => type.hookPhase !== TransitionHookPhase.CREATE)
|
|
107
107
|
.forEach((type) => makeEvent(this, this.transitionService, type));
|
|
@@ -516,6 +516,7 @@ export class Transition {
|
|
|
516
516
|
)
|
|
517
517
|
return "SameAsCurrent";
|
|
518
518
|
}
|
|
519
|
+
|
|
519
520
|
/**
|
|
520
521
|
* Runs the transition
|
|
521
522
|
*
|
|
@@ -523,7 +524,7 @@ export class Transition {
|
|
|
523
524
|
*
|
|
524
525
|
* @internal
|
|
525
526
|
*
|
|
526
|
-
* @returns a promise for a successful transition.
|
|
527
|
+
* @returns {Promise} a promise for a successful transition.
|
|
527
528
|
*/
|
|
528
529
|
run() {
|
|
529
530
|
// Gets transition hooks array for the given phase
|
|
@@ -19,7 +19,7 @@ import { $injectTokens as $t, provider } from "../../injection-tokens.js";
|
|
|
19
19
|
* API for URL management
|
|
20
20
|
*/
|
|
21
21
|
export class UrlService {
|
|
22
|
-
static $inject = provider([
|
|
22
|
+
/* @ignore */ static $inject = provider([
|
|
23
23
|
$t.$location,
|
|
24
24
|
$t.$state,
|
|
25
25
|
$t.$router,
|
|
@@ -200,7 +200,7 @@ export class UrlService {
|
|
|
200
200
|
*/
|
|
201
201
|
onChange(callback) {
|
|
202
202
|
this._urlListeners.push(callback);
|
|
203
|
-
return () => removeFrom(this._urlListeners
|
|
203
|
+
return () => removeFrom(this._urlListeners, callback);
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
/**
|
package/src/router/view/view.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { applyPairs, equals,
|
|
1
|
+
import { applyPairs, equals, removeFrom } from "../../shared/common.js";
|
|
2
2
|
import { curry } from "../../shared/hof.js";
|
|
3
3
|
import { trace } from "../common/trace.js";
|
|
4
4
|
import { getViewConfigFactory } from "../state/views.js";
|
|
@@ -23,23 +23,11 @@ export class ViewService {
|
|
|
23
23
|
constructor() {
|
|
24
24
|
this._ngViews = [];
|
|
25
25
|
this._viewConfigs = [];
|
|
26
|
-
this._viewConfigFactories = {};
|
|
27
26
|
this._listeners = [];
|
|
28
|
-
this._pluginapi = {
|
|
29
|
-
_registeredUIView: (id) => {
|
|
30
|
-
return find(this._ngViews, (view) => view.id === id);
|
|
31
|
-
},
|
|
32
|
-
_registeredUIViews: () => this._ngViews,
|
|
33
|
-
_activeViewConfigs: () => this._viewConfigs,
|
|
34
|
-
_onSync: (listener) => {
|
|
35
|
-
this._listeners.push(listener);
|
|
36
|
-
return () => removeFrom(this._listeners, listener);
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
27
|
this.viewConfigFactory(getViewConfigFactory());
|
|
40
28
|
}
|
|
41
29
|
|
|
42
|
-
$get =
|
|
30
|
+
$get = () => this;
|
|
43
31
|
|
|
44
32
|
/**
|
|
45
33
|
* @param {?import('../state/state-object.js').StateObject} context
|
|
@@ -177,7 +165,7 @@ export class ViewService {
|
|
|
177
165
|
return;
|
|
178
166
|
}
|
|
179
167
|
trace.traceViewServiceUIViewEvent("<- Deregistering", ngView);
|
|
180
|
-
removeFrom(ngViews
|
|
168
|
+
removeFrom(ngViews, ngView);
|
|
181
169
|
};
|
|
182
170
|
}
|
|
183
171
|
/**
|
|
@@ -12,8 +12,8 @@ export class ViewScrollProvider {
|
|
|
12
12
|
$get = [
|
|
13
13
|
$t.$anchorScroll,
|
|
14
14
|
/**
|
|
15
|
-
* @param {import('../services/anchor-scroll.js').AnchorScrollObject} $anchorScroll
|
|
16
|
-
* @returns {import('../services/anchor-scroll.js').AnchorScrollObject|Function}
|
|
15
|
+
* @param {import('../services/anchor-scroll/anchor-scroll.js').AnchorScrollObject} $anchorScroll
|
|
16
|
+
* @returns {import('../services/anchor-scroll/anchor-scroll.js').AnchorScrollObject|Function}
|
|
17
17
|
*/
|
|
18
18
|
($anchorScroll) => {
|
|
19
19
|
if (this.enabled) {
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
isNumber,
|
|
5
5
|
isString,
|
|
6
6
|
getNodeName,
|
|
7
|
-
} from "
|
|
8
|
-
import { $injectTokens as $t } from "
|
|
7
|
+
} from "../../shared/utils.js";
|
|
8
|
+
import { $injectTokens as $t } from "../../injection-tokens.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @typedef {Object} AnchorScrollObject
|
|
@@ -30,8 +30,8 @@ export class AnchorScrollProvider {
|
|
|
30
30
|
$t.$rootScope,
|
|
31
31
|
/**
|
|
32
32
|
*
|
|
33
|
-
* @param {import('
|
|
34
|
-
* @param {import('
|
|
33
|
+
* @param {import('../../services/location/location.js').Location} $location
|
|
34
|
+
* @param {import('../../core/scope/scope.js').Scope} $rootScope
|
|
35
35
|
* @returns
|
|
36
36
|
*/
|
|
37
37
|
function ($location, $rootScope) {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
|
|
45
45
|
/** @typedef {import('../log/interface.ts').LogService} LogService */
|
|
46
46
|
|
|
47
|
-
/** @typedef {import("./interface.ts").
|
|
47
|
+
/** @typedef {import("./interface.ts").ErrorHandler} ErrorHandler */
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Provider for `$exceptionHandler` service. Delegates uncaught exceptions to `$log.error()` by default.
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @param exception - The exception associated with the error.
|
|
5
5
|
* @param [cause] - Optional information about the context in which the error was thrown.
|
|
6
6
|
*/
|
|
7
|
-
export type
|
|
7
|
+
export type ErrorHandler = (exception: Error, cause?: string) => void;
|