@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
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@angular-wave/angular.ts",
|
|
3
3
|
"description": "A modern, optimized and type-safe version of AngularJS",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.9.
|
|
5
|
+
"version": "0.9.4",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/angular-ts.esm.js",
|
|
8
8
|
"module": "dist/angular-ts.esm.js",
|
package/src/angular.js
CHANGED
|
@@ -26,13 +26,6 @@ const $injectorMinErr = minErr("$injector");
|
|
|
26
26
|
/** @type {Object.<string, NgModule>} */
|
|
27
27
|
const modules = {};
|
|
28
28
|
|
|
29
|
-
/**
|
|
30
|
-
* Configuration option for AngularTS bootstrap process.
|
|
31
|
-
*
|
|
32
|
-
* @typedef {Object} AngularBootstrapConfig
|
|
33
|
-
* @property {boolean} [strictDi] - Disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. Defaults to `false`.
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
29
|
export class Angular {
|
|
37
30
|
constructor() {
|
|
38
31
|
this.$cache = Cache;
|
|
@@ -98,7 +91,7 @@ export class Angular {
|
|
|
98
91
|
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
|
99
92
|
* function that will be invoked by the injector as a `config` block.
|
|
100
93
|
* See: {@link angular.module modules}
|
|
101
|
-
* @param {AngularBootstrapConfig} [config]
|
|
94
|
+
* @param {import("./interface.ts").AngularBootstrapConfig} [config]
|
|
102
95
|
* @returns {import('./core/di/internal-injector.js').InjectorService} The created injector instance for this application.
|
|
103
96
|
*/
|
|
104
97
|
bootstrap(element, modules, config) {
|
|
@@ -266,7 +259,7 @@ export class Angular {
|
|
|
266
259
|
* @param {string} name The name of the module to create or retrieve.
|
|
267
260
|
* @param {Array.<string>} [requires] If specified then new module is being created. If
|
|
268
261
|
* unspecified then the module is being retrieved for further configuration.
|
|
269
|
-
* @param {import("./interface.js").Injectable} [configFn] Optional configuration function for the module that gets
|
|
262
|
+
* @param {import("./interface.js").Injectable<any>} [configFn] Optional configuration function for the module that gets
|
|
270
263
|
* passed to {@link NgModule.config NgModule.config()}.
|
|
271
264
|
* @returns {NgModule} A newly registered module.
|
|
272
265
|
*/
|
|
@@ -76,7 +76,7 @@ export function AnimateProvider($provide) {
|
|
|
76
76
|
* ```
|
|
77
77
|
*
|
|
78
78
|
* @param {string} name The name of the animation (this is what the class-based CSS value will be compared to).
|
|
79
|
-
* @param {import("../interface.ts").Injectable} factory The factory function that will be executed to return the animation
|
|
79
|
+
* @param {import("../interface.ts").Injectable<any>} factory The factory function that will be executed to return the animation
|
|
80
80
|
* object.
|
|
81
81
|
*/
|
|
82
82
|
this.register = function (name, factory) {
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
applyAnimationStyles,
|
|
13
13
|
prepareAnimationOptions,
|
|
14
14
|
} from "./shared.js";
|
|
15
|
+
import { $injectTokens as $t } from "../injection-tokens.js";
|
|
15
16
|
|
|
16
17
|
const RUNNER_STORAGE_KEY = "$$animationRunner";
|
|
17
18
|
const PREPARE_CLASSES_KEY = "$$animatePrepareClasses";
|
|
@@ -34,14 +35,14 @@ export function AnimationProvider() {
|
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
this.$get = [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
$t.$rootScope,
|
|
39
|
+
$t.$injector,
|
|
40
|
+
$t.$$AnimateRunner,
|
|
41
|
+
$t.$$rAFScheduler,
|
|
42
|
+
$t.$$animateCache,
|
|
42
43
|
/**
|
|
43
44
|
*
|
|
44
|
-
* @param {
|
|
45
|
+
* @param {ng.RootScopeService} $rootScope
|
|
45
46
|
* @param {import("../core/di/internal-injector").InjectorService} $injector
|
|
46
47
|
* @param {*} $$AnimateRunner
|
|
47
48
|
* @param {import("./raf-scheduler").RafScheduler} $$rAFScheduler
|
|
@@ -207,7 +208,6 @@ export function AnimationProvider() {
|
|
|
207
208
|
// block. This way we can group animations for all the animations that
|
|
208
209
|
// were apart of the same postDigest flush call.
|
|
209
210
|
if (animationQueue.length > 1) return runner;
|
|
210
|
-
|
|
211
211
|
$rootScope.$postUpdate(() => {
|
|
212
212
|
const animations = [];
|
|
213
213
|
animationQueue.forEach((entry) => {
|
|
@@ -42,6 +42,7 @@ import { PREFIX_REGEXP } from "../../shared/constants.js";
|
|
|
42
42
|
import { createEventDirective } from "../../directive/events/events.js";
|
|
43
43
|
import { Attributes } from "./attributes.js";
|
|
44
44
|
import { ngObserveDirective } from "../../directive/observe/observe.js";
|
|
45
|
+
import { $injectTokens as $t } from "../../injection-tokens.js";
|
|
45
46
|
|
|
46
47
|
/**
|
|
47
48
|
* A function passed as the fifth argument to a {@type PublicLinkFn} link function.
|
|
@@ -139,7 +140,7 @@ const EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;
|
|
|
139
140
|
export const DirectiveSuffix = "Directive";
|
|
140
141
|
|
|
141
142
|
export class CompileProvider {
|
|
142
|
-
/* @ignore */ static $inject = [
|
|
143
|
+
/* @ignore */ static $inject = [$t.$provide, $t.$$sanitizeUriProvider];
|
|
143
144
|
|
|
144
145
|
/**
|
|
145
146
|
* @param {import('../../interface.js').Provider} $provide
|
|
@@ -333,7 +334,7 @@ export class CompileProvider {
|
|
|
333
334
|
/**
|
|
334
335
|
* @param {string|Object} name Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`),
|
|
335
336
|
* or an object map of components where the keys are the names and the values are the component definition objects.
|
|
336
|
-
* @param {import("../../interface.js").
|
|
337
|
+
* @param {import("../../interface.js").Component} options Component definition object (a simplified
|
|
337
338
|
* {directive definition object}),
|
|
338
339
|
* with the following properties (all optional):
|
|
339
340
|
*
|
|
@@ -71,7 +71,7 @@ export class ControllerProvider {
|
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* @param {import("../../core/di/internal-injector.js").InjectorService} $injector
|
|
74
|
-
* @returns {
|
|
74
|
+
* @returns {import("./interface.js").ControllerService} A service function that creates controllers.
|
|
75
75
|
*/
|
|
76
76
|
($injector) => {
|
|
77
77
|
return (expression, locals, later, ident) => {
|
|
@@ -82,7 +82,7 @@ export class ControllerProvider {
|
|
|
82
82
|
later = later === true;
|
|
83
83
|
|
|
84
84
|
if (isString(expression)) {
|
|
85
|
-
match = expression.match(CNTRL_REG);
|
|
85
|
+
match = /** @type {string} */ (expression).match(CNTRL_REG);
|
|
86
86
|
if (!match) {
|
|
87
87
|
throw $controllerMinErr(
|
|
88
88
|
"ctrlfmt",
|
|
@@ -119,7 +119,7 @@ export class ControllerProvider {
|
|
|
119
119
|
locals,
|
|
120
120
|
identifier,
|
|
121
121
|
instance,
|
|
122
|
-
constructor || expression.name,
|
|
122
|
+
constructor || /** @type {any} */ (expression).name,
|
|
123
123
|
);
|
|
124
124
|
}
|
|
125
125
|
|
|
@@ -142,7 +142,7 @@ export class ControllerProvider {
|
|
|
142
142
|
locals,
|
|
143
143
|
identifier,
|
|
144
144
|
instance,
|
|
145
|
-
constructor || expression.name,
|
|
145
|
+
constructor || /** @type {any} */ (expression).name,
|
|
146
146
|
);
|
|
147
147
|
}
|
|
148
148
|
}
|
|
@@ -151,14 +151,18 @@ export class ControllerProvider {
|
|
|
151
151
|
}.bind(this, { instance, identifier });
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
instance = $injector.instantiate(
|
|
154
|
+
instance = $injector.instantiate(
|
|
155
|
+
/** @type {any} */ (expression),
|
|
156
|
+
locals,
|
|
157
|
+
constructor,
|
|
158
|
+
);
|
|
155
159
|
|
|
156
160
|
if (identifier) {
|
|
157
161
|
this.addIdentifier(
|
|
158
162
|
locals,
|
|
159
163
|
identifier,
|
|
160
164
|
instance,
|
|
161
|
-
constructor || expression.name,
|
|
165
|
+
constructor || /** @type {any} */ (expression).name,
|
|
162
166
|
);
|
|
163
167
|
}
|
|
164
168
|
|
package/src/core/di/injector.js
CHANGED
|
@@ -73,7 +73,7 @@ export function createInjector(modulesToLoad, strictDi = false) {
|
|
|
73
73
|
/**
|
|
74
74
|
* Registers a provider.
|
|
75
75
|
* @param {string} name
|
|
76
|
-
* @param {import('../../interface.ts').ServiceProvider | import('../../interface.ts').
|
|
76
|
+
* @param {import('../../interface.ts').ServiceProvider | import('../../interface.ts').Injectable<any>} provider
|
|
77
77
|
* @returns {import('../../interface.ts').ServiceProvider}
|
|
78
78
|
*/
|
|
79
79
|
function provider(name, provider) {
|
package/src/core/di/ng-module.js
CHANGED
|
@@ -26,7 +26,7 @@ export class NgModule {
|
|
|
26
26
|
/**
|
|
27
27
|
* @param {string} name - Name of the module
|
|
28
28
|
* @param {Array<string>} requires - List of modules which the injector will load before the current module
|
|
29
|
-
* @param {import("../../interface.js").Injectable} [configFn]
|
|
29
|
+
* @param {import("../../interface.js").Injectable<any>} [configFn]
|
|
30
30
|
*/
|
|
31
31
|
constructor(name, requires, configFn) {
|
|
32
32
|
assert(isString(name), "name required");
|
|
@@ -52,12 +52,14 @@ export class NgModule {
|
|
|
52
52
|
/** @type {!Array<Array<*>>} */
|
|
53
53
|
this.configBlocks = [];
|
|
54
54
|
|
|
55
|
-
/** @type {!Array.<import("../../interface.js").Injectable
|
|
55
|
+
/** @type {!Array.<import("../../interface.js").Injectable<any>>} */
|
|
56
56
|
this.runBlocks = [];
|
|
57
57
|
|
|
58
58
|
if (configFn) {
|
|
59
59
|
this.config(configFn);
|
|
60
60
|
}
|
|
61
|
+
|
|
62
|
+
this.services = [];
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
/**
|
|
@@ -82,7 +84,7 @@ export class NgModule {
|
|
|
82
84
|
|
|
83
85
|
/**
|
|
84
86
|
*
|
|
85
|
-
* @param {import("../../interface.
|
|
87
|
+
* @param {import("../../interface.ts").Injectable<any>} configFn
|
|
86
88
|
* @returns {NgModule}
|
|
87
89
|
*/
|
|
88
90
|
config(configFn) {
|
|
@@ -91,7 +93,7 @@ export class NgModule {
|
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
/**
|
|
94
|
-
* @param {import("../../interface.
|
|
96
|
+
* @param {import("../../interface.ts").Injectable<any>} block
|
|
95
97
|
* @returns {NgModule}
|
|
96
98
|
*/
|
|
97
99
|
run(block) {
|
|
@@ -101,7 +103,7 @@ export class NgModule {
|
|
|
101
103
|
|
|
102
104
|
/**
|
|
103
105
|
* @param {string} name
|
|
104
|
-
* @param {import("../../interface.
|
|
106
|
+
* @param {import("../../interface.ts").Component} options
|
|
105
107
|
* @returns {NgModule}
|
|
106
108
|
*/
|
|
107
109
|
component(name, options) {
|
|
@@ -114,7 +116,7 @@ export class NgModule {
|
|
|
114
116
|
|
|
115
117
|
/**
|
|
116
118
|
* @param {string} name
|
|
117
|
-
* @param {import("../../interface.
|
|
119
|
+
* @param {import("../../interface.ts").Injectable<any>} providerFunction
|
|
118
120
|
* @returns {NgModule}
|
|
119
121
|
*/
|
|
120
122
|
factory(name, providerFunction) {
|
|
@@ -127,20 +129,21 @@ export class NgModule {
|
|
|
127
129
|
|
|
128
130
|
/**
|
|
129
131
|
* @param {string} name
|
|
130
|
-
* @param {import("../../interface.
|
|
132
|
+
* @param {import("../../interface.ts").Injectable<any>} serviceFunction
|
|
131
133
|
* @returns {NgModule}
|
|
132
134
|
*/
|
|
133
135
|
service(name, serviceFunction) {
|
|
134
136
|
if (serviceFunction && isFunction(serviceFunction)) {
|
|
135
137
|
serviceFunction["$$moduleName"] = name;
|
|
136
138
|
}
|
|
139
|
+
this.services.push(name);
|
|
137
140
|
this.invokeQueue.push([$t.$provide, "service", [name, serviceFunction]]);
|
|
138
141
|
return this;
|
|
139
142
|
}
|
|
140
143
|
|
|
141
144
|
/**
|
|
142
145
|
* @param {string} name
|
|
143
|
-
* @param {import("../../interface.
|
|
146
|
+
* @param {import("../../interface.ts").Injectable<any>} providerType
|
|
144
147
|
* @returns {NgModule}
|
|
145
148
|
*/
|
|
146
149
|
provider(name, providerType) {
|
|
@@ -153,7 +156,7 @@ export class NgModule {
|
|
|
153
156
|
|
|
154
157
|
/**
|
|
155
158
|
* @param {string} name
|
|
156
|
-
* @param {import("../../interface.js").Injectable} decorFn
|
|
159
|
+
* @param {import("../../interface.js").Injectable<any>} decorFn
|
|
157
160
|
* @returns {NgModule}
|
|
158
161
|
*/
|
|
159
162
|
decorator(name, decorFn) {
|
|
@@ -166,7 +169,7 @@ export class NgModule {
|
|
|
166
169
|
|
|
167
170
|
/**
|
|
168
171
|
* @param {string} name
|
|
169
|
-
* @param {import("../../interface.js").Injectable} directiveFactory
|
|
172
|
+
* @param {import("../../interface.js").Injectable<any>} directiveFactory
|
|
170
173
|
* @returns {NgModule}
|
|
171
174
|
*/
|
|
172
175
|
directive(name, directiveFactory) {
|
|
@@ -183,7 +186,7 @@ export class NgModule {
|
|
|
183
186
|
|
|
184
187
|
/**
|
|
185
188
|
* @param {string} name
|
|
186
|
-
* @param {import("../../interface.js").Injectable} animationFactory
|
|
189
|
+
* @param {import("../../interface.js").Injectable<any>} animationFactory
|
|
187
190
|
* @returns {NgModule}
|
|
188
191
|
*/
|
|
189
192
|
animation(name, animationFactory) {
|
|
@@ -200,7 +203,7 @@ export class NgModule {
|
|
|
200
203
|
|
|
201
204
|
/**
|
|
202
205
|
* @param {string} name
|
|
203
|
-
* @param {import("../../interface.js").Injectable} filterFn
|
|
206
|
+
* @param {import("../../interface.js").Injectable<any>} filterFn
|
|
204
207
|
* @return {NgModule}
|
|
205
208
|
*/
|
|
206
209
|
filter(name, filterFn) {
|
|
@@ -213,7 +216,7 @@ export class NgModule {
|
|
|
213
216
|
|
|
214
217
|
/**
|
|
215
218
|
* @param {string} name
|
|
216
|
-
* @param {import("../../interface.js").Injectable} ctlFn
|
|
219
|
+
* @param {import("../../interface.js").Injectable<any>} ctlFn
|
|
217
220
|
* @returns {NgModule}
|
|
218
221
|
*/
|
|
219
222
|
controller(name, ctlFn) {
|
|
@@ -30,8 +30,8 @@ export class FilterProvider {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* @param {string|Record<string,
|
|
34
|
-
* @param {
|
|
33
|
+
* @param {string|Record<string, ng.FilterFn>} name
|
|
34
|
+
* @param {ng.FilterService} [factory]
|
|
35
35
|
* @return {import('../../interface.ts').Provider}
|
|
36
36
|
*/
|
|
37
37
|
register(name, factory) {
|
|
@@ -48,7 +48,7 @@ export class FilterProvider {
|
|
|
48
48
|
$t.$injector,
|
|
49
49
|
/**
|
|
50
50
|
* @param {import("../../core/di/internal-injector.js").InjectorService} $injector
|
|
51
|
-
* @returns {
|
|
51
|
+
* @returns {ng.FilterService}
|
|
52
52
|
*/
|
|
53
53
|
($injector) => (/** @type {string} */ name) => $injector.get(name + SUFFIX),
|
|
54
54
|
];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface InterpolationFunction {
|
|
2
|
+
(context: any): string;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export interface InterpolateService {
|
|
6
|
+
(
|
|
7
|
+
text: string,
|
|
8
|
+
mustHaveExpression?: boolean,
|
|
9
|
+
trustedContext?: string,
|
|
10
|
+
allOrNothing?: boolean,
|
|
11
|
+
): InterpolationFunction | undefined;
|
|
12
|
+
endSymbol(): string;
|
|
13
|
+
startSymbol(): string;
|
|
14
|
+
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
stringify,
|
|
7
7
|
} from "../../shared/utils.js";
|
|
8
8
|
import { constantWatchDelegate } from "../parse/parse.js";
|
|
9
|
+
import { $injectTokens as $t } from "../../injection-tokens.js";
|
|
9
10
|
|
|
10
11
|
const $interpolateMinErr = minErr("$interpolate");
|
|
11
12
|
function throwNoconcat(text) {
|
|
@@ -53,13 +54,13 @@ export class InterpolateProvider {
|
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
$get = [
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
$t.$parse,
|
|
58
|
+
$t.$sce,
|
|
58
59
|
/**
|
|
59
60
|
*
|
|
60
|
-
* @param {
|
|
61
|
+
* @param {ng.ParseService} $parse
|
|
61
62
|
* @param {*} $sce
|
|
62
|
-
* @returns
|
|
63
|
+
* @returns {ng.InterpolateService}
|
|
63
64
|
*/
|
|
64
65
|
function ($parse, $sce) {
|
|
65
66
|
/** @type {InterpolateProvider} */
|
|
@@ -308,7 +309,7 @@ export class InterpolateProvider {
|
|
|
308
309
|
return concat.join("");
|
|
309
310
|
};
|
|
310
311
|
|
|
311
|
-
return extend(
|
|
312
|
+
return /**@type {import("./interface.js").InterpolationFunction} */ extend(
|
|
312
313
|
(context, cb) => {
|
|
313
314
|
let i = 0;
|
|
314
315
|
const ii = expressions.length;
|
|
@@ -402,6 +403,7 @@ export class InterpolateProvider {
|
|
|
402
403
|
return provider.endSymbol;
|
|
403
404
|
};
|
|
404
405
|
|
|
406
|
+
// @ts-ignore
|
|
405
407
|
return $interpolate;
|
|
406
408
|
},
|
|
407
409
|
];
|
package/src/core/scope/scope.js
CHANGED
|
@@ -25,7 +25,7 @@ export function nextId() {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* @type {
|
|
28
|
+
* @type {ng.ParseService}
|
|
29
29
|
*/
|
|
30
30
|
let $parse;
|
|
31
31
|
|
|
@@ -1125,6 +1125,9 @@ export class Scope {
|
|
|
1125
1125
|
return this.$root == /** @type {Scope} */ (this);
|
|
1126
1126
|
}
|
|
1127
1127
|
|
|
1128
|
+
/**
|
|
1129
|
+
* @param {Function} fn
|
|
1130
|
+
*/
|
|
1128
1131
|
$postUpdate(fn) {
|
|
1129
1132
|
$postUpdateQueue.push(fn);
|
|
1130
1133
|
}
|
|
@@ -3,7 +3,7 @@ import { dealoc } from "../../shared/dom.js";
|
|
|
3
3
|
// import { browserTrigger, wait } from "../../shared/test-utils.js";
|
|
4
4
|
|
|
5
5
|
describe("ngDelete", () => {
|
|
6
|
-
let $compile, $rootScope,
|
|
6
|
+
let $compile, $rootScope, el;
|
|
7
7
|
|
|
8
8
|
beforeEach(() => {
|
|
9
9
|
el = document.getElementById("app");
|
|
@@ -11,13 +11,10 @@ describe("ngDelete", () => {
|
|
|
11
11
|
el.innerHTML = "";
|
|
12
12
|
let angular = new Angular();
|
|
13
13
|
angular.module("default", []);
|
|
14
|
-
angular
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
$rootScope = _$rootScope_;
|
|
19
|
-
$httpBackend = _$httpBackend_;
|
|
20
|
-
});
|
|
14
|
+
angular.bootstrap(el, ["default"]).invoke((_$compile_, _$rootScope_) => {
|
|
15
|
+
$compile = _$compile_;
|
|
16
|
+
$rootScope = _$rootScope_;
|
|
17
|
+
});
|
|
21
18
|
});
|
|
22
19
|
|
|
23
20
|
it("should pass", () => {
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @param {"get" | "delete" | "post" | "put"} method
|
|
12
|
-
* @returns {
|
|
12
|
+
* @returns {ng.DirectiveFactory}
|
|
13
13
|
*/
|
|
14
14
|
function defineDirective(method) {
|
|
15
15
|
const attrName = "ng" + method.charAt(0).toUpperCase() + method.slice(1);
|
|
@@ -18,16 +18,16 @@ function defineDirective(method) {
|
|
|
18
18
|
return directive;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
/** @type {
|
|
21
|
+
/** @type {ng.DirectiveFactory} */
|
|
22
22
|
export const ngGetDirective = defineDirective("get");
|
|
23
23
|
|
|
24
|
-
/** @type {
|
|
24
|
+
/** @type {ng.DirectiveFactory} */
|
|
25
25
|
export const ngDeleteDirective = defineDirective("delete");
|
|
26
26
|
|
|
27
|
-
/** @type {
|
|
27
|
+
/** @type {ng.DirectiveFactory} */
|
|
28
28
|
export const ngPostDirective = defineDirective("post");
|
|
29
29
|
|
|
30
|
-
/** @type {
|
|
30
|
+
/** @type {ng.DirectiveFactory} */
|
|
31
31
|
export const ngPutDirective = defineDirective("put");
|
|
32
32
|
|
|
33
33
|
/**
|
|
@@ -54,10 +54,10 @@ export function getEventNameForElement(element) {
|
|
|
54
54
|
* Handles DOM manipulation based on a swap strategy and server-rendered HTML.
|
|
55
55
|
*
|
|
56
56
|
* @param {string} html - The HTML string returned from the server.
|
|
57
|
-
* @param {import("
|
|
57
|
+
* @param {import("./interface.ts").SwapModeType} swap
|
|
58
58
|
* @param {Element} target - The target DOM element to apply the swap to.
|
|
59
|
-
* @param {
|
|
60
|
-
* @param {
|
|
59
|
+
* @param {ng.Scope} scope
|
|
60
|
+
* @param {ng.CompileService} $compile
|
|
61
61
|
*/
|
|
62
62
|
export function handleSwapResponse(html, swap, target, scope, $compile) {
|
|
63
63
|
let nodes = [];
|
|
@@ -138,16 +138,16 @@ export function handleSwapResponse(html, swap, target, scope, $compile) {
|
|
|
138
138
|
*
|
|
139
139
|
* @param {"get" | "delete" | "post" | "put"} method - HTTP method to use.
|
|
140
140
|
* @param {string} attrName - Attribute name containing the URL.
|
|
141
|
-
* @returns {
|
|
141
|
+
* @returns {ng.DirectiveFactory}
|
|
142
142
|
*/
|
|
143
143
|
export function createHttpDirective(method, attrName) {
|
|
144
144
|
/**
|
|
145
|
-
* @param {
|
|
146
|
-
* @param {
|
|
147
|
-
* @param {
|
|
148
|
-
* @param {
|
|
149
|
-
* @param {
|
|
150
|
-
* @returns {
|
|
145
|
+
* @param {ng.HttpService} $http
|
|
146
|
+
* @param {ng.CompileService} $compile
|
|
147
|
+
* @param {ng.LogService} $log
|
|
148
|
+
* @param {ng.ParseService} $parse
|
|
149
|
+
* @param {ng.StateService} $state
|
|
150
|
+
* @returns {ng.Directive}
|
|
151
151
|
*/
|
|
152
152
|
return function ($http, $compile, $log, $parse, $state) {
|
|
153
153
|
/**
|
|
@@ -286,7 +286,7 @@ export function createHttpDirective(method, attrName) {
|
|
|
286
286
|
|
|
287
287
|
handleSwapResponse(
|
|
288
288
|
html,
|
|
289
|
-
/** @type {import("
|
|
289
|
+
/** @type {import("./interface.ts").SwapModeType} */ (swap),
|
|
290
290
|
target,
|
|
291
291
|
scope,
|
|
292
292
|
$compile,
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Possible values for `data-swap` attribute
|
|
3
|
+
*/
|
|
4
|
+
export const SwapMode = {
|
|
5
|
+
/** (default) Replaces the contents inside the element */
|
|
6
|
+
innerHTML: "innerHTML",
|
|
7
|
+
|
|
8
|
+
/** Replaces the entire element, including the tag itself */
|
|
9
|
+
outerHTML: "outerHTML",
|
|
10
|
+
|
|
11
|
+
/** Inserts plain text (without parsing HTML) */
|
|
12
|
+
textContent: "textContent",
|
|
13
|
+
|
|
14
|
+
/** Inserts HTML immediately before the element itself */
|
|
15
|
+
beforebegin: "beforebegin",
|
|
16
|
+
|
|
17
|
+
/** Inserts HTML inside the element, before its first child */
|
|
18
|
+
afterbegin: "afterbegin",
|
|
19
|
+
|
|
20
|
+
/** Inserts HTML inside the element, after its last child */
|
|
21
|
+
beforeend: "beforeend",
|
|
22
|
+
|
|
23
|
+
/** Inserts HTML immediately after the element itself */
|
|
24
|
+
afterend: "afterend",
|
|
25
|
+
|
|
26
|
+
/** Removes the element entirely */
|
|
27
|
+
delete: "delete",
|
|
28
|
+
|
|
29
|
+
/** Performs no insertion (no-op) */
|
|
30
|
+
none: "none",
|
|
31
|
+
} as const;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Union type representing all possible DOM insertion modes.
|
|
35
|
+
*/
|
|
36
|
+
export type SwapModeType = keyof typeof SwapMode;
|
|
@@ -3,7 +3,7 @@ import { dealoc } from "../../shared/dom.js";
|
|
|
3
3
|
// import { browserTrigger, wait } from "../../shared/test-utils.js";
|
|
4
4
|
|
|
5
5
|
describe("ngPut", () => {
|
|
6
|
-
let $compile, $rootScope,
|
|
6
|
+
let $compile, $rootScope, el;
|
|
7
7
|
|
|
8
8
|
beforeEach(() => {
|
|
9
9
|
el = document.getElementById("app");
|
|
@@ -11,13 +11,10 @@ describe("ngPut", () => {
|
|
|
11
11
|
el.innerHTML = "";
|
|
12
12
|
let angular = new Angular();
|
|
13
13
|
angular.module("default", []);
|
|
14
|
-
angular
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
$rootScope = _$rootScope_;
|
|
19
|
-
$httpBackend = _$httpBackend_;
|
|
20
|
-
});
|
|
14
|
+
angular.bootstrap(el, ["default"]).invoke((_$compile_, _$rootScope_) => {
|
|
15
|
+
$compile = _$compile_;
|
|
16
|
+
$rootScope = _$rootScope_;
|
|
17
|
+
});
|
|
21
18
|
});
|
|
22
19
|
|
|
23
20
|
it("should pass", () => {
|
|
@@ -12,9 +12,9 @@ ngIncludeDirective.$inject = [
|
|
|
12
12
|
/**
|
|
13
13
|
*
|
|
14
14
|
* @param {*} $templateRequest
|
|
15
|
-
* @param {import("../../services/anchor-scroll.js").AnchorScrollFunction} $anchorScroll
|
|
15
|
+
* @param {import("../../services/anchor-scroll/anchor-scroll.js").AnchorScrollFunction} $anchorScroll
|
|
16
16
|
* @param {*} $animate
|
|
17
|
-
* @param {import('../../services/exception/interface.ts').
|
|
17
|
+
* @param {import('../../services/exception/interface.ts').ErrorHandler} $exceptionHandler
|
|
18
18
|
* @returns {import('../../interface.js').Directive}
|
|
19
19
|
*/
|
|
20
20
|
export function ngIncludeDirective(
|
|
@@ -11,10 +11,7 @@
|
|
|
11
11
|
<script src="/jasmine/jasmine-html.js"></script>
|
|
12
12
|
<script src="/jasmine/boot0.js"></script>
|
|
13
13
|
<script src="/jasmine/boot1.js"></script>
|
|
14
|
-
<script
|
|
15
|
-
type="module"
|
|
16
|
-
src="/src/services/http-backend/http-backend.spec.js"
|
|
17
|
-
></script>
|
|
14
|
+
<script type="module" src="/src/directive/inject/inject.spec.js"></script>
|
|
18
15
|
</head>
|
|
19
16
|
<body>
|
|
20
17
|
<div id="app"></div>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { $injectTokens as $t } from "../../injection-tokens.js";
|
|
2
|
+
|
|
3
|
+
ngInjectDirective.$inject = [$t.$log, $t.$injector];
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {ng.LogService} $log
|
|
7
|
+
* @param {ng.InjectorService} $injector
|
|
8
|
+
* @returns {import('interface.ts').Directive}
|
|
9
|
+
*/
|
|
10
|
+
export function ngInjectDirective($log, $injector) {
|
|
11
|
+
return {
|
|
12
|
+
restrict: "A",
|
|
13
|
+
link(scope, _element, attrs) {
|
|
14
|
+
const expr = attrs["ngInject"];
|
|
15
|
+
|
|
16
|
+
if (!expr) return;
|
|
17
|
+
// Match any identifier that starts with $, or ends with Service/Factory
|
|
18
|
+
// Example matches: $http, userService, authFactory
|
|
19
|
+
const replacedExpr = expr.replace(
|
|
20
|
+
/(\$[\w]+|[\w]+(?:Service|Factory))/g,
|
|
21
|
+
(match, name) => {
|
|
22
|
+
try {
|
|
23
|
+
const service = $injector.get(name);
|
|
24
|
+
scope.$target[name] = service;
|
|
25
|
+
return name;
|
|
26
|
+
} catch {
|
|
27
|
+
$log.warn(`Injectable ${name} not found in $injector`);
|
|
28
|
+
return match;
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
);
|
|
32
|
+
scope.$apply(replacedExpr);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|