@angular-wave/angular.ts 0.4.0 → 0.4.1
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/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@angular-wave/angular.ts",
|
|
3
3
|
"description": "A modern, optimized and typesafe version of AngularJS",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.4.
|
|
5
|
+
"version": "0.4.1",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/angular-ts.esm.js",
|
|
8
8
|
"browser": "dist/angular-ts.umd.js",
|
|
@@ -40,9 +40,13 @@ function interr(text, err) {
|
|
|
40
40
|
* security bugs!
|
|
41
41
|
* </div>
|
|
42
42
|
*/
|
|
43
|
-
export
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
export class InterpolateProvider {
|
|
44
|
+
constructor() {
|
|
45
|
+
/** @type {string} */
|
|
46
|
+
this.start = "{{";
|
|
47
|
+
/** @type {string} */
|
|
48
|
+
this.end = "}}";
|
|
49
|
+
}
|
|
46
50
|
|
|
47
51
|
/**
|
|
48
52
|
* Symbol to denote start of expression in the interpolated string. Defaults to `{{`.
|
|
@@ -50,13 +54,13 @@ export function InterpolateProvider() {
|
|
|
50
54
|
* @param {string=} value new value to set the starting symbol to.
|
|
51
55
|
* @returns {string|InterpolateProvider} Returns the symbol when used as getter and self if used as setter.
|
|
52
56
|
*/
|
|
53
|
-
|
|
57
|
+
startSymbol(value) {
|
|
54
58
|
if (value) {
|
|
55
|
-
|
|
59
|
+
this.start = value;
|
|
56
60
|
return this;
|
|
57
61
|
}
|
|
58
|
-
return
|
|
59
|
-
}
|
|
62
|
+
return this.start;
|
|
63
|
+
}
|
|
60
64
|
|
|
61
65
|
/**
|
|
62
66
|
* Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
|
|
@@ -64,33 +68,36 @@ export function InterpolateProvider() {
|
|
|
64
68
|
* @param {string=} value new value to set the ending symbol to.
|
|
65
69
|
* @returns {string|InterpolateProvider} Returns the symbol when used as getter and self if used as setter.
|
|
66
70
|
*/
|
|
67
|
-
|
|
71
|
+
endSymbol(value) {
|
|
68
72
|
if (value) {
|
|
69
|
-
|
|
73
|
+
this.end = value;
|
|
70
74
|
return this;
|
|
71
75
|
}
|
|
72
|
-
return
|
|
73
|
-
}
|
|
76
|
+
return this.end;
|
|
77
|
+
}
|
|
74
78
|
|
|
75
|
-
|
|
79
|
+
$get = [
|
|
76
80
|
"$parse",
|
|
77
|
-
"$exceptionHandler",
|
|
78
81
|
"$sce",
|
|
79
82
|
/**
|
|
80
83
|
*
|
|
81
84
|
* @param {import("../parser/parse").ParseService} $parse
|
|
82
|
-
* @param {import('../exception-handler').ErrorHandler} $exceptionHandler
|
|
83
85
|
* @param {*} $sce
|
|
84
86
|
* @returns
|
|
85
87
|
*/
|
|
86
|
-
function ($parse, $
|
|
87
|
-
|
|
88
|
-
const
|
|
88
|
+
function ($parse, $sce) {
|
|
89
|
+
/** @type {InterpolateProvider} */
|
|
90
|
+
const provider = this;
|
|
91
|
+
const startSymbolLength = provider.start.length;
|
|
92
|
+
const endSymbolLength = provider.end.length;
|
|
89
93
|
const escapedStartRegexp = new RegExp(
|
|
90
|
-
|
|
94
|
+
this.start.replace(/./g, escape),
|
|
95
|
+
"g",
|
|
96
|
+
);
|
|
97
|
+
const escapedEndRegexp = new RegExp(
|
|
98
|
+
provider.end.replace(/./g, escape),
|
|
91
99
|
"g",
|
|
92
100
|
);
|
|
93
|
-
const escapedEndRegexp = new RegExp(endSymbol.replace(/./g, escape), "g");
|
|
94
101
|
|
|
95
102
|
function escape(ch) {
|
|
96
103
|
return `\\\\\\${ch}`;
|
|
@@ -98,8 +105,8 @@ export function InterpolateProvider() {
|
|
|
98
105
|
|
|
99
106
|
function unescapeText(text) {
|
|
100
107
|
return text
|
|
101
|
-
.replace(escapedStartRegexp,
|
|
102
|
-
.replace(escapedEndRegexp,
|
|
108
|
+
.replace(escapedStartRegexp, provider.start)
|
|
109
|
+
.replace(escapedEndRegexp, provider.end);
|
|
103
110
|
}
|
|
104
111
|
|
|
105
112
|
/**
|
|
@@ -222,7 +229,7 @@ export function InterpolateProvider() {
|
|
|
222
229
|
trustedContext === $sce.URL || trustedContext === $sce.MEDIA_URL;
|
|
223
230
|
|
|
224
231
|
// Provide a quick exit and simplified result function for text with no interpolation
|
|
225
|
-
if (!text.length || text.indexOf(
|
|
232
|
+
if (!text.length || text.indexOf(provider.start) === -1) {
|
|
226
233
|
if (mustHaveExpression) return;
|
|
227
234
|
|
|
228
235
|
let unescapedText = unescapeText(text);
|
|
@@ -255,9 +262,9 @@ export function InterpolateProvider() {
|
|
|
255
262
|
|
|
256
263
|
while (index < textLength) {
|
|
257
264
|
if (
|
|
258
|
-
(startIndex = text.indexOf(
|
|
265
|
+
(startIndex = text.indexOf(provider.start, index)) !== -1 &&
|
|
259
266
|
(endIndex = text.indexOf(
|
|
260
|
-
|
|
267
|
+
provider.end,
|
|
261
268
|
startIndex + startSymbolLength,
|
|
262
269
|
)) !== -1
|
|
263
270
|
) {
|
|
@@ -390,7 +397,7 @@ export function InterpolateProvider() {
|
|
|
390
397
|
* @returns {string} start symbol.
|
|
391
398
|
*/
|
|
392
399
|
$interpolate.startSymbol = function () {
|
|
393
|
-
return
|
|
400
|
+
return provider.start;
|
|
394
401
|
};
|
|
395
402
|
|
|
396
403
|
/**
|
|
@@ -402,7 +409,7 @@ export function InterpolateProvider() {
|
|
|
402
409
|
* @returns {string} end symbol.
|
|
403
410
|
*/
|
|
404
411
|
$interpolate.endSymbol = function () {
|
|
405
|
-
return
|
|
412
|
+
return provider.end;
|
|
406
413
|
};
|
|
407
414
|
|
|
408
415
|
return $interpolate;
|
package/src/core/scope/scope.js
CHANGED
|
@@ -102,7 +102,7 @@ export class RootScopeProvider {
|
|
|
102
102
|
* @param {import('../../services/browser').Browser} browser
|
|
103
103
|
* @returns {Scope} root scope
|
|
104
104
|
*/
|
|
105
|
-
|
|
105
|
+
(exceptionHandler, parse, browser) => {
|
|
106
106
|
$exceptionHandler = exceptionHandler;
|
|
107
107
|
$parse = parse;
|
|
108
108
|
$browser = browser;
|
|
@@ -200,7 +200,6 @@ export class Scope {
|
|
|
200
200
|
/** @type {boolean} */
|
|
201
201
|
this.$$suspended = false;
|
|
202
202
|
|
|
203
|
-
// TODO use maps
|
|
204
203
|
/** @type {Map<String, Function[]>} */
|
|
205
204
|
this.$$listeners = new Map();
|
|
206
205
|
|
|
@@ -245,7 +244,7 @@ export class Scope {
|
|
|
245
244
|
let child = isolate ? new Scope() : Object.create(this);
|
|
246
245
|
|
|
247
246
|
if (isolate) {
|
|
248
|
-
child.$root = this
|
|
247
|
+
child.$root = this.$root;
|
|
249
248
|
} else {
|
|
250
249
|
// Initialize properties for a non-isolated child scope
|
|
251
250
|
child.$id = nextUid();
|
|
@@ -10,23 +10,26 @@
|
|
|
10
10
|
* security bugs!
|
|
11
11
|
* </div>
|
|
12
12
|
*/
|
|
13
|
-
export function InterpolateProvider(): void;
|
|
14
13
|
export class InterpolateProvider {
|
|
14
|
+
/** @type {string} */
|
|
15
|
+
start: string;
|
|
16
|
+
/** @type {string} */
|
|
17
|
+
end: string;
|
|
15
18
|
/**
|
|
16
19
|
* Symbol to denote start of expression in the interpolated string. Defaults to `{{`.
|
|
17
20
|
*
|
|
18
21
|
* @param {string=} value new value to set the starting symbol to.
|
|
19
22
|
* @returns {string|InterpolateProvider} Returns the symbol when used as getter and self if used as setter.
|
|
20
23
|
*/
|
|
21
|
-
startSymbol
|
|
24
|
+
startSymbol(value?: string | undefined): string | InterpolateProvider;
|
|
22
25
|
/**
|
|
23
26
|
* Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
|
|
24
27
|
*
|
|
25
28
|
* @param {string=} value new value to set the ending symbol to.
|
|
26
29
|
* @returns {string|InterpolateProvider} Returns the symbol when used as getter and self if used as setter.
|
|
27
30
|
*/
|
|
28
|
-
endSymbol
|
|
29
|
-
$get: (string | (($parse: import("../parser/parse").ParseService, $
|
|
31
|
+
endSymbol(value?: string | undefined): string | InterpolateProvider;
|
|
32
|
+
$get: (string | (($parse: import("../parser/parse").ParseService, $sce: any) => {
|
|
30
33
|
(text: string, mustHaveExpression?: boolean | undefined, trustedContext?: string | undefined, allOrNothing?: boolean | undefined): Function;
|
|
31
34
|
/**
|
|
32
35
|
* Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.
|