@angular-wave/angular.ts 0.0.65 → 0.0.67
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/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +1 -1
- package/src/animations/animate-js.js +6 -0
- package/src/animations/animate-swap.js +3 -0
- package/src/animations/animation.js +1 -1
- package/src/core/compile/compile.js +16 -4
- package/src/core/controller/controller.js +5 -5
- package/src/core/di/injector.js +133 -259
- package/src/core/di/injector.md +3 -3
- package/src/core/di/injector.spec.js +30 -24
- package/src/core/di/internal-injector.js +286 -0
- package/src/core/filter/filter.js +5 -0
- package/src/core/parser/parse.js +1 -12
- package/src/core/parser/parse.spec.js +96 -110
- package/src/core/sce/sce.js +6 -1
- package/src/core/timeout/timeout.js +110 -111
- package/src/directive/input/input.js +32 -726
- package/src/directive/input/input.md +706 -0
- package/src/directive/select/select.js +48 -122
- package/src/directive/select/select.md +74 -0
- package/src/directive/show-hide/show-hide.js +13 -224
- package/src/directive/show-hide/show-hide.md +257 -0
- package/src/filters/limit-to.spec.js +1 -1
- package/src/filters/order-by.spec.js +1 -1
- package/src/index.js +6 -2
- package/src/loader.js +8 -4
- package/src/public.js +1 -7
- package/src/router/services.js +9 -4
- package/src/router/state/state-builder.js +6 -7
- package/src/router/state/state-registry.js +5 -0
- package/src/router/state/state-service.js +1 -1
- package/src/router/state/views.js +2 -1
- package/src/router/state-provider.js +1 -1
- package/src/router/template-factory.js +15 -14
- package/src/router/url/url-service.js +4 -4
- package/src/services/anchor-scroll.js +2 -2
- package/src/services/browser.js +2 -9
- package/src/services/cache-factory.js +0 -67
- package/src/services/cache-factory.md +75 -0
- package/src/services/cookie-reader.js +36 -55
- package/src/services/http/http.js +73 -586
- package/src/services/http/http.md +413 -0
- package/src/services/http-backend/http-backend.js +19 -44
- package/src/services/template-request.js +1 -9
- package/src/shared/jqlite/jqlite.js +4 -69
- package/src/types.js +8 -12
- package/types/animations/animate-js.d.ts +1 -1
- package/types/animations/animate-swap.d.ts +4 -7
- package/types/animations/animation.d.ts +1 -1
- package/types/core/compile/compile.d.ts +7 -7
- package/types/core/controller/controller.d.ts +1 -6
- package/types/core/di/injector.d.ts +13 -7
- package/types/core/di/internal-injector.d.ts +91 -0
- package/types/core/exception-handler.d.ts +1 -1
- package/types/core/filter/filter.d.ts +1 -1
- package/types/core/parser/parse.d.ts +1 -1
- package/types/core/sce/sce.d.ts +1 -1
- package/types/core/timeout/timeout.d.ts +16 -26
- package/types/directive/input/input.d.ts +19 -124
- package/types/directive/select/select.d.ts +7 -74
- package/types/directive/show-hide/show-hide.d.ts +11 -224
- package/types/loader.d.ts +4 -4
- package/types/router/services.d.ts +8 -1
- package/types/router/state/state-builder.d.ts +1 -2
- package/types/router/state/state-registry.d.ts +2 -2
- package/types/router/state/state-service.d.ts +2 -2
- package/types/router/state-provider.d.ts +2 -2
- package/types/router/template-factory.d.ts +16 -16
- package/types/router/url/url-service.d.ts +4 -4
- package/types/services/anchor-scroll.d.ts +1 -1
- package/types/services/browser.d.ts +0 -10
- package/types/services/cache-factory.d.ts +0 -67
- package/types/services/cookie-reader.d.ts +2 -10
- package/types/services/http/http.d.ts +53 -61
- package/types/services/http-backend/http-backend.d.ts +8 -31
- package/types/services/template-request.d.ts +1 -9
- package/types/shared/jqlite/jqlite.d.ts +9 -9
- package/types/types.d.ts +5 -38
|
@@ -1,72 +1,5 @@
|
|
|
1
1
|
import { extend, forEach, isUndefined, minErr } from "../shared/utils";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @ngdoc service
|
|
5
|
-
* @name $cacheFactory
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @description
|
|
9
|
-
* Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to
|
|
10
|
-
* them.
|
|
11
|
-
*
|
|
12
|
-
* ```js
|
|
13
|
-
*
|
|
14
|
-
* let cache = $cacheFactory('cacheId');
|
|
15
|
-
* expect($cacheFactory.get('cacheId')).toBe(cache);
|
|
16
|
-
* expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();
|
|
17
|
-
*
|
|
18
|
-
* cache.put("key", "value");
|
|
19
|
-
* cache.put("another key", "another value");
|
|
20
|
-
*
|
|
21
|
-
* // We've specified no options on creation
|
|
22
|
-
* expect(cache.info()).toEqual({id: 'cacheId', size: 2});
|
|
23
|
-
*
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
<example module="cacheExampleApp" name="cache-factory">
|
|
29
|
-
<file name="index.html">
|
|
30
|
-
<div ng-controller="CacheController">
|
|
31
|
-
<input ng-model="newCacheKey" placeholder="Key">
|
|
32
|
-
<input ng-model="newCacheValue" placeholder="Value">
|
|
33
|
-
<button ng-click="put(newCacheKey, newCacheValue)">Cache</button>
|
|
34
|
-
|
|
35
|
-
<p ng-if="keys.length">Cached Values</p>
|
|
36
|
-
<div ng-repeat="key in keys">
|
|
37
|
-
<span ng-bind="key"></span>
|
|
38
|
-
<span>: </span>
|
|
39
|
-
<b ng-bind="cache.get(key)"></b>
|
|
40
|
-
</div>
|
|
41
|
-
|
|
42
|
-
<p>Cache Info</p>
|
|
43
|
-
<div ng-repeat="(key, value) in cache.info()">
|
|
44
|
-
<span ng-bind="key"></span>
|
|
45
|
-
<span>: </span>
|
|
46
|
-
<b ng-bind="value"></b>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</file>
|
|
50
|
-
<file name="script.js">
|
|
51
|
-
angular.module('cacheExampleApp', []).
|
|
52
|
-
controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) {
|
|
53
|
-
$scope.keys = [];
|
|
54
|
-
$scope.cache = $cacheFactory('cacheId');
|
|
55
|
-
$scope.put = function(key, value) {
|
|
56
|
-
if (angular.isUndefined($scope.cache.get(key))) {
|
|
57
|
-
$scope.keys.push(key);
|
|
58
|
-
}
|
|
59
|
-
$scope.cache.put(key, angular.isUndefined(value) ? null : value);
|
|
60
|
-
};
|
|
61
|
-
}]);
|
|
62
|
-
</file>
|
|
63
|
-
<file name="style.css">
|
|
64
|
-
p {
|
|
65
|
-
margin: 10px 0 3px;
|
|
66
|
-
}
|
|
67
|
-
</file>
|
|
68
|
-
</example>
|
|
69
|
-
*/
|
|
70
3
|
export function CacheFactoryProvider() {
|
|
71
4
|
this.$get = function () {
|
|
72
5
|
const caches = {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/\*\*
|
|
2
|
+
|
|
3
|
+
- @ngdoc service
|
|
4
|
+
- @name $cacheFactory
|
|
5
|
+
-
|
|
6
|
+
-
|
|
7
|
+
- @description
|
|
8
|
+
- Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to
|
|
9
|
+
- them.
|
|
10
|
+
-
|
|
11
|
+
- ```js
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
-
|
|
16
|
+
- let cache = $cacheFactory('cacheId');
|
|
17
|
+
- expect($cacheFactory.get('cacheId')).toBe(cache);
|
|
18
|
+
- expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();
|
|
19
|
+
-
|
|
20
|
+
- cache.put("key", "value");
|
|
21
|
+
- cache.put("another key", "another value");
|
|
22
|
+
-
|
|
23
|
+
- // We've specified no options on creation
|
|
24
|
+
- expect(cache.info()).toEqual({id: 'cacheId', size: 2});
|
|
25
|
+
-
|
|
26
|
+
- ```
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
-
|
|
31
|
+
-
|
|
32
|
+
- @example
|
|
33
|
+
<example module="cacheExampleApp" name="cache-factory">
|
|
34
|
+
<file name="index.html">
|
|
35
|
+
<div ng-controller="CacheController">
|
|
36
|
+
<input ng-model="newCacheKey" placeholder="Key">
|
|
37
|
+
<input ng-model="newCacheValue" placeholder="Value">
|
|
38
|
+
<button ng-click="put(newCacheKey, newCacheValue)">Cache</button>
|
|
39
|
+
|
|
40
|
+
<p ng-if="keys.length">Cached Values</p>
|
|
41
|
+
<div ng-repeat="key in keys">
|
|
42
|
+
<span ng-bind="key"></span>
|
|
43
|
+
<span>: </span>
|
|
44
|
+
<b ng-bind="cache.get(key)"></b>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<p>Cache Info</p>
|
|
48
|
+
<div ng-repeat="(key, value) in cache.info()">
|
|
49
|
+
<span ng-bind="key"></span>
|
|
50
|
+
<span>: </span>
|
|
51
|
+
<b ng-bind="value"></b>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</file>
|
|
55
|
+
<file name="script.js">
|
|
56
|
+
angular.module('cacheExampleApp', []).
|
|
57
|
+
controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) {
|
|
58
|
+
$scope.keys = [];
|
|
59
|
+
$scope.cache = $cacheFactory('cacheId');
|
|
60
|
+
$scope.put = function(key, value) {
|
|
61
|
+
if (angular.isUndefined($scope.cache.get(key))) {
|
|
62
|
+
$scope.keys.push(key);
|
|
63
|
+
}
|
|
64
|
+
$scope.cache.put(key, angular.isUndefined(value) ? null : value);
|
|
65
|
+
};
|
|
66
|
+
}]);
|
|
67
|
+
</file>
|
|
68
|
+
<file name="style.css">
|
|
69
|
+
p {
|
|
70
|
+
margin: 10px 0 3px;
|
|
71
|
+
}
|
|
72
|
+
</file>
|
|
73
|
+
|
|
74
|
+
</example>
|
|
75
|
+
*/
|
|
@@ -1,67 +1,48 @@
|
|
|
1
1
|
import { isUndefined } from "../shared/utils";
|
|
2
2
|
|
|
3
|
+
let lastCookies = {};
|
|
4
|
+
let lastCookieString = "";
|
|
5
|
+
|
|
3
6
|
/**
|
|
4
|
-
*
|
|
5
|
-
* @description
|
|
6
|
-
* This is a private service for reading cookies used by $http and ngCookies
|
|
7
|
-
*
|
|
8
|
-
* @return {Object} a key/value map of the current cookies
|
|
7
|
+
* @returns {Object<String, String>} List of all cookies
|
|
9
8
|
*/
|
|
10
|
-
export function
|
|
11
|
-
|
|
12
|
-
let
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return rawDocument.cookie || "";
|
|
18
|
-
} catch (e) {
|
|
19
|
-
return "";
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function safeDecodeURIComponent(str) {
|
|
24
|
-
try {
|
|
25
|
-
return decodeURIComponent(str);
|
|
26
|
-
} catch (e) {
|
|
27
|
-
return str;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return function () {
|
|
32
|
-
let cookieArray;
|
|
33
|
-
let cookie;
|
|
34
|
-
let i;
|
|
35
|
-
let index;
|
|
36
|
-
let name;
|
|
37
|
-
const currentCookieString = safeGetCookie(rawDocument);
|
|
9
|
+
export function getCookies() {
|
|
10
|
+
let cookieArray;
|
|
11
|
+
let cookie;
|
|
12
|
+
let i;
|
|
13
|
+
let index;
|
|
14
|
+
let name;
|
|
15
|
+
const currentCookieString = window.document.cookie;
|
|
38
16
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
17
|
+
if (currentCookieString !== lastCookieString) {
|
|
18
|
+
lastCookieString = currentCookieString;
|
|
19
|
+
cookieArray = lastCookieString.split("; ");
|
|
20
|
+
lastCookies = {};
|
|
43
21
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
22
|
+
for (i = 0; i < cookieArray.length; i++) {
|
|
23
|
+
cookie = cookieArray[i];
|
|
24
|
+
index = cookie.indexOf("=");
|
|
25
|
+
if (index > 0) {
|
|
26
|
+
// ignore nameless cookies
|
|
27
|
+
name = safeDecodeURIComponent(cookie.substring(0, index));
|
|
28
|
+
// the first value that is seen for a cookie is the most
|
|
29
|
+
// specific one. values for the same cookie name that
|
|
30
|
+
// follow are for less specific paths.
|
|
31
|
+
if (isUndefined(lastCookies[name])) {
|
|
32
|
+
lastCookies[name] = safeDecodeURIComponent(
|
|
33
|
+
cookie.substring(index + 1),
|
|
34
|
+
);
|
|
58
35
|
}
|
|
59
36
|
}
|
|
60
37
|
}
|
|
61
|
-
|
|
62
|
-
|
|
38
|
+
}
|
|
39
|
+
return lastCookies;
|
|
63
40
|
}
|
|
64
41
|
|
|
65
|
-
|
|
66
|
-
|
|
42
|
+
function safeDecodeURIComponent(str) {
|
|
43
|
+
try {
|
|
44
|
+
return decodeURIComponent(str);
|
|
45
|
+
} catch (e) {
|
|
46
|
+
return str;
|
|
47
|
+
}
|
|
67
48
|
}
|