@angular-wave/angular.ts 0.0.48 → 0.0.49
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/Makefile +3 -0
- package/README.md +1 -1
- package/css/angular.css +0 -6
- package/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/jsdoc.json +24 -0
- package/package.json +6 -2
- package/src/core/compile/compile.md +1 -1
- package/src/core/compile/compile.spec.js +50 -48
- package/src/core/on.spec.js +7 -12
- package/src/core/parser/ast.js +4 -0
- package/src/core/parser/lexer.js +144 -56
- package/src/core/parser/parse.js +16 -56
- package/src/core/parser/parse.md +57 -0
- package/src/core/parser/parser.js +6 -0
- package/src/core/prop.spec.js +4 -4
- package/src/core/scope/scope.js +14 -10
- package/src/directive/form/form.spec.js +18 -18
- package/src/directive/include/include.spec.js +18 -18
- package/src/directive/switch/switch.spec.js +4 -4
- package/src/shared/constants.js +3 -2
- package/src/types.js +1 -1
- package/types/core/parser/ast.d.ts +17 -9
- package/types/core/parser/lexer.d.ts +153 -0
- package/types/core/parser/parse.d.ts +4 -15
- package/types/core/parser/parser.d.ts +7 -1
- package/types/core/scope/scope.d.ts +11 -11
- package/types/types.d.ts +1 -1
|
@@ -523,12 +523,12 @@ describe("form", () => {
|
|
|
523
523
|
describe("nested forms", () => {
|
|
524
524
|
it("should chain nested forms", () => {
|
|
525
525
|
doc = JQLite(
|
|
526
|
-
'<ng
|
|
527
|
-
'<ng
|
|
528
|
-
'<input ng
|
|
529
|
-
'<input ng
|
|
530
|
-
"</ng
|
|
531
|
-
"</ng
|
|
526
|
+
'<ng-form name="parent">' +
|
|
527
|
+
'<ng-form name="child">' +
|
|
528
|
+
'<input ng-model="modelA" name="inputA">' +
|
|
529
|
+
'<input ng-model="modelB" name="inputB">' +
|
|
530
|
+
"</ng-form>" +
|
|
531
|
+
"</ng-form>",
|
|
532
532
|
);
|
|
533
533
|
$compile(doc)(scope);
|
|
534
534
|
|
|
@@ -561,8 +561,8 @@ describe("form", () => {
|
|
|
561
561
|
doc = JQLite(
|
|
562
562
|
'<ng-form name="parent">' +
|
|
563
563
|
'<ng-form name="child">' +
|
|
564
|
-
'<input ng
|
|
565
|
-
'<input ng
|
|
564
|
+
'<input ng-model="modelA" name="inputA">' +
|
|
565
|
+
'<input ng-model="modelB" name="inputB">' +
|
|
566
566
|
"</ng-form>" +
|
|
567
567
|
"</ng-form>",
|
|
568
568
|
);
|
|
@@ -581,7 +581,7 @@ describe("form", () => {
|
|
|
581
581
|
'<ng-form name="parent">' +
|
|
582
582
|
'<ng-form name="child">' +
|
|
583
583
|
'<ng-form name="grandchild">' +
|
|
584
|
-
'<input ng
|
|
584
|
+
'<input ng-model="modelA" name="inputA">' +
|
|
585
585
|
"</ng-form>" +
|
|
586
586
|
"</ng-form>" +
|
|
587
587
|
"</ng-form>",
|
|
@@ -647,8 +647,8 @@ describe("form", () => {
|
|
|
647
647
|
'<ng-form name="parent">' +
|
|
648
648
|
'<ng-form name="child">' +
|
|
649
649
|
'<ng-form name="grandchild">' +
|
|
650
|
-
'<input ng
|
|
651
|
-
'<input ng
|
|
650
|
+
'<input ng-model="modelA" name="inputA">' +
|
|
651
|
+
'<input ng-model="modelB" name="inputB">' +
|
|
652
652
|
"</ng-form>" +
|
|
653
653
|
"</ng-form>" +
|
|
654
654
|
"</ng-form>",
|
|
@@ -670,7 +670,7 @@ describe("form", () => {
|
|
|
670
670
|
doc = JQLite(
|
|
671
671
|
'<form name="parent">' +
|
|
672
672
|
'<div ng-form name="child">' +
|
|
673
|
-
'<input ng
|
|
673
|
+
'<input ng-model="modelA" name="inputA" required>' +
|
|
674
674
|
"</div>" +
|
|
675
675
|
"</form>",
|
|
676
676
|
);
|
|
@@ -694,7 +694,7 @@ describe("form", () => {
|
|
|
694
694
|
doc = JQLite(
|
|
695
695
|
'<form name="parent">' +
|
|
696
696
|
'<div ng-form name="child.form">' +
|
|
697
|
-
'<input ng
|
|
697
|
+
'<input ng-model="modelA" name="inputA" required>' +
|
|
698
698
|
"</div>" +
|
|
699
699
|
"</form>",
|
|
700
700
|
);
|
|
@@ -974,11 +974,11 @@ describe("form", () => {
|
|
|
974
974
|
|
|
975
975
|
it("should chain nested forms in repeater", () => {
|
|
976
976
|
doc = JQLite(
|
|
977
|
-
"<ng
|
|
978
|
-
'<ng
|
|
979
|
-
"<input type=text ng
|
|
980
|
-
"</ng
|
|
981
|
-
"</ng
|
|
977
|
+
"<ng-form name=parent>" +
|
|
978
|
+
'<ng-form ng-repeat="f in forms" name=child>' +
|
|
979
|
+
"<input type=text ng-model=text name=text>" +
|
|
980
|
+
"</ng-form>" +
|
|
981
|
+
"</ng-form>",
|
|
982
982
|
);
|
|
983
983
|
$compile(doc)(scope);
|
|
984
984
|
|
|
@@ -93,7 +93,7 @@ describe("ngInclude", () => {
|
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
it("should NOT use untrusted URL expressions ", () => {
|
|
96
|
-
element = JQLite('<ng
|
|
96
|
+
element = JQLite('<ng-include src="url"></ng-include>');
|
|
97
97
|
const injector = angular.bootstrap(element);
|
|
98
98
|
$rootScope = injector.get("$rootScope");
|
|
99
99
|
$rootScope.url = "http://example.com/myUrl";
|
|
@@ -103,7 +103,7 @@ describe("ngInclude", () => {
|
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
it("should NOT use mistyped expressions ", () => {
|
|
106
|
-
element = JQLite('<ng
|
|
106
|
+
element = JQLite('<ng-include src="url"></ng-include>');
|
|
107
107
|
const injector = angular.bootstrap(element);
|
|
108
108
|
$rootScope = injector.get("$rootScope");
|
|
109
109
|
$rootScope.name = "chirayu";
|
|
@@ -115,7 +115,7 @@ describe("ngInclude", () => {
|
|
|
115
115
|
});
|
|
116
116
|
|
|
117
117
|
it("should remove previously included text if a falsy value is bound to src", (done) => {
|
|
118
|
-
element = JQLite('<div><ng
|
|
118
|
+
element = JQLite('<div><ng-include src="url"></ng-include></div>');
|
|
119
119
|
const injector = angular.bootstrap(element);
|
|
120
120
|
$rootScope = injector.get("$rootScope");
|
|
121
121
|
$rootScope.expr = "igor";
|
|
@@ -142,7 +142,7 @@ describe("ngInclude", () => {
|
|
|
142
142
|
});
|
|
143
143
|
});
|
|
144
144
|
element = JQLite(
|
|
145
|
-
'<div><div><ng
|
|
145
|
+
'<div><div><ng-include src="url"></ng-include></div></div>',
|
|
146
146
|
);
|
|
147
147
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
148
148
|
$rootScope = injector.get("$rootScope");
|
|
@@ -165,7 +165,7 @@ describe("ngInclude", () => {
|
|
|
165
165
|
});
|
|
166
166
|
});
|
|
167
167
|
element = JQLite(
|
|
168
|
-
'<div><div><ng
|
|
168
|
+
'<div><div><ng-include src="url"></ng-include></div></div>',
|
|
169
169
|
);
|
|
170
170
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
171
171
|
$rootScope = injector.get("$rootScope");
|
|
@@ -189,7 +189,7 @@ describe("ngInclude", () => {
|
|
|
189
189
|
});
|
|
190
190
|
|
|
191
191
|
element = JQLite(
|
|
192
|
-
'<div><div><ng
|
|
192
|
+
'<div><div><ng-include src="url"></ng-include></div></div>',
|
|
193
193
|
);
|
|
194
194
|
|
|
195
195
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
@@ -207,7 +207,7 @@ describe("ngInclude", () => {
|
|
|
207
207
|
window.angular.module("myModule", []);
|
|
208
208
|
|
|
209
209
|
element = JQLite(
|
|
210
|
-
'<div><div><ng
|
|
210
|
+
'<div><div><ng-include src="url" onload="loaded = true"></ng-include></div></div>',
|
|
211
211
|
);
|
|
212
212
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
213
213
|
$rootScope = injector.get("$rootScope");
|
|
@@ -227,7 +227,7 @@ describe("ngInclude", () => {
|
|
|
227
227
|
it("should create child scope and destroy old one", (done) => {
|
|
228
228
|
window.angular.module("myModule", []);
|
|
229
229
|
|
|
230
|
-
element = JQLite('<div><ng
|
|
230
|
+
element = JQLite('<div><ng-include src="url"></ng-include></div>');
|
|
231
231
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
232
232
|
$rootScope = injector.get("$rootScope");
|
|
233
233
|
$rootScope.$digest();
|
|
@@ -267,7 +267,7 @@ describe("ngInclude", () => {
|
|
|
267
267
|
|
|
268
268
|
it("should do xhr request and cache it", async () => {
|
|
269
269
|
window.angular.module("myModule", []);
|
|
270
|
-
element = JQLite('<div><ng
|
|
270
|
+
element = JQLite('<div><ng-include src="url"></ng-include></div>');
|
|
271
271
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
272
272
|
$rootScope = injector.get("$rootScope");
|
|
273
273
|
$rootScope.url = "/mock/hello";
|
|
@@ -287,7 +287,7 @@ describe("ngInclude", () => {
|
|
|
287
287
|
|
|
288
288
|
it("should clear content when error during xhr request", () => {
|
|
289
289
|
window.angular.module("myModule", []);
|
|
290
|
-
element = JQLite('<div><ng
|
|
290
|
+
element = JQLite('<div><ng-include src="url">content</ng-include></div>');
|
|
291
291
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
292
292
|
$rootScope = injector.get("$rootScope");
|
|
293
293
|
$rootScope.url = "/mock/401";
|
|
@@ -297,7 +297,7 @@ describe("ngInclude", () => {
|
|
|
297
297
|
|
|
298
298
|
it("should be async even if served from cache", (done) => {
|
|
299
299
|
window.angular.module("myModule", []);
|
|
300
|
-
element = JQLite('<div><ng
|
|
300
|
+
element = JQLite('<div><ng-include src="url"></ng-include></div>');
|
|
301
301
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
302
302
|
$rootScope = injector.get("$rootScope");
|
|
303
303
|
$rootScope.url = "/mock/hello";
|
|
@@ -319,7 +319,7 @@ describe("ngInclude", () => {
|
|
|
319
319
|
it("should discard pending xhr callbacks if a new template is requested before the current finished loading", (done) => {
|
|
320
320
|
window.angular.module("myModule", []);
|
|
321
321
|
element = JQLite(
|
|
322
|
-
"<div><ng
|
|
322
|
+
"<div><ng-include src='templateUrl'></ng-include></div>",
|
|
323
323
|
);
|
|
324
324
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
325
325
|
$rootScope = injector.get("$rootScope");
|
|
@@ -339,7 +339,7 @@ describe("ngInclude", () => {
|
|
|
339
339
|
it("should not break attribute bindings on the same element", async () => {
|
|
340
340
|
window.angular.module("myModule", []);
|
|
341
341
|
element = JQLite(
|
|
342
|
-
'<div><span foo="#/{{hrefUrl}}" ng
|
|
342
|
+
'<div><span foo="#/{{hrefUrl}}" ng-include="includeUrl"></span></div>',
|
|
343
343
|
);
|
|
344
344
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
345
345
|
$rootScope = injector.get("$rootScope");
|
|
@@ -457,7 +457,7 @@ describe("ngInclude", () => {
|
|
|
457
457
|
},
|
|
458
458
|
]);
|
|
459
459
|
element = JQLite(
|
|
460
|
-
'<div><ng
|
|
460
|
+
'<div><ng-include src="tpl" autoscroll></ng-include></div>',
|
|
461
461
|
);
|
|
462
462
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
463
463
|
$rootScope = injector.get("$rootScope");
|
|
@@ -480,7 +480,7 @@ describe("ngInclude", () => {
|
|
|
480
480
|
},
|
|
481
481
|
]);
|
|
482
482
|
element = JQLite(
|
|
483
|
-
'<div><ng
|
|
483
|
+
'<div><ng-include src="tpl" autoscroll="value"></ng-include></div>',
|
|
484
484
|
);
|
|
485
485
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
486
486
|
$rootScope = injector.get("$rootScope");
|
|
@@ -506,7 +506,7 @@ describe("ngInclude", () => {
|
|
|
506
506
|
},
|
|
507
507
|
]);
|
|
508
508
|
|
|
509
|
-
element = JQLite('<div><ng
|
|
509
|
+
element = JQLite('<div><ng-include src="tpl"></ng-include></div>');
|
|
510
510
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
511
511
|
$rootScope = injector.get("$rootScope");
|
|
512
512
|
|
|
@@ -530,7 +530,7 @@ describe("ngInclude", () => {
|
|
|
530
530
|
]);
|
|
531
531
|
|
|
532
532
|
element = JQLite(
|
|
533
|
-
'<div><ng
|
|
533
|
+
'<div><ng-include src="tpl" autoscroll="value"></ng-include></div>',
|
|
534
534
|
);
|
|
535
535
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
536
536
|
$rootScope = injector.get("$rootScope");
|
|
@@ -558,7 +558,7 @@ describe("ngInclude", () => {
|
|
|
558
558
|
|
|
559
559
|
// it('should only call $anchorScroll after the "enter" animation completes', inject(
|
|
560
560
|
// compileAndLink(
|
|
561
|
-
// '<div><ng
|
|
561
|
+
// '<div><ng-include src="tpl" autoscroll></ng-include></div>',
|
|
562
562
|
// ),
|
|
563
563
|
// ($rootScope, $animate, $timeout) => {
|
|
564
564
|
// expect(autoScrollSpy).not.toHaveBeenCalled();
|
|
@@ -103,10 +103,10 @@ describe("ngSwitch", () => {
|
|
|
103
103
|
|
|
104
104
|
it("should switch on switch-when-default", () => {
|
|
105
105
|
element = $compile(
|
|
106
|
-
'<ng
|
|
107
|
-
'<div ng
|
|
108
|
-
"<div ng
|
|
109
|
-
"</ng
|
|
106
|
+
'<ng-switch on="select">' +
|
|
107
|
+
'<div ng-switch-when="1">one</div>' +
|
|
108
|
+
"<div ng-switch-default>other</div>" +
|
|
109
|
+
"</ng-switch>",
|
|
110
110
|
)($scope);
|
|
111
111
|
$scope.$apply();
|
|
112
112
|
expect(element.text()).toEqual("other");
|
package/src/shared/constants.js
CHANGED
|
@@ -7,8 +7,9 @@ export const TOUCHED_CLASS = "ng-touched";
|
|
|
7
7
|
export const EMPTY_CLASS = "ng-empty";
|
|
8
8
|
export const NOT_EMPTY_CLASS = "ng-not-empty";
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
export const
|
|
10
|
+
// x prefix is being kept for view-directive.spec lines 1550, 565
|
|
11
|
+
export const PREFIX_REGEXP = /^((?:x|data)[-])/i;
|
|
12
|
+
export const SPECIAL_CHARS_REGEXP = /[-]+(.)/g;
|
|
12
13
|
|
|
13
14
|
export const ALIASED_ATTR = {
|
|
14
15
|
ngMinlength: "minlength",
|
package/src/types.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* @typedef {function(any, any=): any} CompiledExpression
|
|
15
|
+
* @typedef {Object|function(any, any=): any} CompiledExpression
|
|
16
16
|
* @property {boolean} literal - Indicates if the expression is a literal.
|
|
17
17
|
* @property {boolean} constant - Indicates if the expression is constant.
|
|
18
18
|
* @property {function(any, any): any} assign - Assigns a value to a context. If value is not provided,
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @param {import('./lexer').Lexer} lexer
|
|
3
|
+
* @param {*} options
|
|
4
|
+
*/
|
|
5
|
+
export function AST(lexer: import("./lexer").Lexer, options: any): void;
|
|
2
6
|
export class AST {
|
|
3
|
-
|
|
4
|
-
|
|
7
|
+
/**
|
|
8
|
+
* @param {import('./lexer').Lexer} lexer
|
|
9
|
+
* @param {*} options
|
|
10
|
+
*/
|
|
11
|
+
constructor(lexer: import("./lexer").Lexer, options: any);
|
|
12
|
+
lexer: import("./lexer").Lexer;
|
|
5
13
|
options: any;
|
|
6
14
|
ast(text: any): {
|
|
7
15
|
type: string;
|
|
@@ -11,7 +19,7 @@ export class AST {
|
|
|
11
19
|
}[];
|
|
12
20
|
};
|
|
13
21
|
text: any;
|
|
14
|
-
tokens:
|
|
22
|
+
tokens: import("./lexer").Token[];
|
|
15
23
|
program(): {
|
|
16
24
|
type: string;
|
|
17
25
|
body: {
|
|
@@ -62,11 +70,11 @@ export class AST {
|
|
|
62
70
|
}[];
|
|
63
71
|
};
|
|
64
72
|
throwError(msg: any, token: any): never;
|
|
65
|
-
consume(e1: any):
|
|
66
|
-
peekToken():
|
|
67
|
-
peek(e1: any, e2: any, e3: any, e4: any):
|
|
68
|
-
peekAhead(i: any, e1: any, e2: any, e3: any, e4: any):
|
|
69
|
-
expect(e1: any, e2: any, e3: any, e4: any):
|
|
73
|
+
consume(e1: any): false | import("./lexer").Token;
|
|
74
|
+
peekToken(): import("./lexer").Token;
|
|
75
|
+
peek(e1: any, e2: any, e3: any, e4: any): false | import("./lexer").Token;
|
|
76
|
+
peekAhead(i: any, e1: any, e2: any, e3: any, e4: any): false | import("./lexer").Token;
|
|
77
|
+
expect(e1: any, e2: any, e3: any, e4: any): false | import("./lexer").Token;
|
|
70
78
|
selfReferential: {
|
|
71
79
|
this: {
|
|
72
80
|
type: string;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} LexerOptions
|
|
3
|
+
* @property {(ch: string, codePoint: number) => boolean} [isIdentifierStart] Custom function to determine if a character is a valid identifier start.
|
|
4
|
+
* @property {(ch: string, codePoint: number) => boolean} [isIdentifierContinue] Custom function to determine if a character is a valid identifier continuation.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Represents a token produced by the lexer.
|
|
8
|
+
* @typedef {Object} Token
|
|
9
|
+
* @property {number} index Index of the token.
|
|
10
|
+
* @property {string} text Text of the token.
|
|
11
|
+
* @property {boolean} [identifier] Indicates if token is an identifier.
|
|
12
|
+
* @property {boolean} [constant] Indicates if token is a constant.
|
|
13
|
+
* @property {string|number} [value] Value of the token if it's a constant.
|
|
14
|
+
* @property {boolean} [operator] Indicates if token is an operator.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Represents a lexer that tokenizes input text. The Lexer takes the original expression string and returns an array of tokens parsed from that string.
|
|
18
|
+
* For example, the string "a + b" would result in tokens for a, +, and b.
|
|
19
|
+
*/
|
|
20
|
+
export class Lexer {
|
|
21
|
+
/**
|
|
22
|
+
* Creates an instance of Lexer.
|
|
23
|
+
* @param {LexerOptions} options Lexer options.
|
|
24
|
+
*/
|
|
25
|
+
constructor(options: LexerOptions);
|
|
26
|
+
/** @type {LexerOptions} */
|
|
27
|
+
options: LexerOptions;
|
|
28
|
+
/**
|
|
29
|
+
* Tokenizes the input text.
|
|
30
|
+
* @param {string} text Input text to lex.
|
|
31
|
+
* @returns {Array<Token>} Array of tokens.
|
|
32
|
+
*/
|
|
33
|
+
lex(text: string): Array<Token>;
|
|
34
|
+
text: string;
|
|
35
|
+
index: number;
|
|
36
|
+
/** @type {Array<Token>} */
|
|
37
|
+
tokens: Array<Token>;
|
|
38
|
+
/**
|
|
39
|
+
* Checks if a character is contained in a set of characters.
|
|
40
|
+
* @param {string} ch Character to check.
|
|
41
|
+
* @param {string} chars Set of characters.
|
|
42
|
+
* @returns {boolean} True if character is in the set, false otherwise.
|
|
43
|
+
*/
|
|
44
|
+
is(ch: string, chars: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Peeks at the next character in the text.
|
|
47
|
+
* @param {number} [i=1] Number of characters to peek.
|
|
48
|
+
* @returns {string|false} Next character or false if end of text.
|
|
49
|
+
*/
|
|
50
|
+
peek(i?: number): string | false;
|
|
51
|
+
/**
|
|
52
|
+
* Checks if a character is a number.
|
|
53
|
+
* @param {string} ch Character to check.
|
|
54
|
+
* @returns {boolean} True if character is a number, false otherwise.
|
|
55
|
+
*/
|
|
56
|
+
isNumber(ch: string): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Checks if a character is whitespace.
|
|
59
|
+
* @param {string} ch Character to check.
|
|
60
|
+
* @returns {boolean} True if character is whitespace, false otherwise.
|
|
61
|
+
*/
|
|
62
|
+
isWhitespace(ch: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Checks if a character is a valid identifier start.
|
|
65
|
+
* @param {string} ch Character to check.
|
|
66
|
+
* @returns {boolean} True if character is a valid identifier start, false otherwise.
|
|
67
|
+
*/
|
|
68
|
+
isIdentifierStart(ch: string): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Checks if a character is a valid identifier continuation.
|
|
71
|
+
* @param {string} ch Character to check.
|
|
72
|
+
* @returns {boolean} True if character is a valid identifier continuation, false otherwise.
|
|
73
|
+
*/
|
|
74
|
+
isIdentifierContinue(ch: string): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Converts a character to its Unicode code point.
|
|
77
|
+
* @param {string} ch Character to convert.
|
|
78
|
+
* @returns {number} Unicode code point.
|
|
79
|
+
*/
|
|
80
|
+
codePointAt(ch: string): number;
|
|
81
|
+
/**
|
|
82
|
+
* Peeks at the next multicharacter sequence in the text.
|
|
83
|
+
* @returns {string} Next multicharacter sequence.
|
|
84
|
+
*/
|
|
85
|
+
peekMultichar(): string;
|
|
86
|
+
/**
|
|
87
|
+
* Checks if a character is an exponent operator.
|
|
88
|
+
* @param {string} ch Character to check.
|
|
89
|
+
* @returns {boolean} True if character is an exponent operator, false otherwise.
|
|
90
|
+
*/
|
|
91
|
+
isExpOperator(ch: string): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Throws a lexer error.
|
|
94
|
+
* @param {string} error Error message.
|
|
95
|
+
* @param {number} [start] Start index.
|
|
96
|
+
* @param {number} [end] End index.
|
|
97
|
+
* @throws {Error} Lexer error.
|
|
98
|
+
*/
|
|
99
|
+
throwError(error: string, start?: number, end?: number): void;
|
|
100
|
+
/**
|
|
101
|
+
* Reads and tokenizes a number from the text.
|
|
102
|
+
*/
|
|
103
|
+
readNumber(): void;
|
|
104
|
+
/**
|
|
105
|
+
* Reads and tokenizes an identifier from the text.
|
|
106
|
+
*/
|
|
107
|
+
readIdent(): void;
|
|
108
|
+
/**
|
|
109
|
+
* Reads and tokenizes a string from the text.
|
|
110
|
+
* @param {string} quote Quote character used for the string.
|
|
111
|
+
*/
|
|
112
|
+
readString(quote: string): void;
|
|
113
|
+
handleUnicodeEscape(): string;
|
|
114
|
+
}
|
|
115
|
+
export type LexerOptions = {
|
|
116
|
+
/**
|
|
117
|
+
* Custom function to determine if a character is a valid identifier start.
|
|
118
|
+
*/
|
|
119
|
+
isIdentifierStart?: (ch: string, codePoint: number) => boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Custom function to determine if a character is a valid identifier continuation.
|
|
122
|
+
*/
|
|
123
|
+
isIdentifierContinue?: (ch: string, codePoint: number) => boolean;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Represents a token produced by the lexer.
|
|
127
|
+
*/
|
|
128
|
+
export type Token = {
|
|
129
|
+
/**
|
|
130
|
+
* Index of the token.
|
|
131
|
+
*/
|
|
132
|
+
index: number;
|
|
133
|
+
/**
|
|
134
|
+
* Text of the token.
|
|
135
|
+
*/
|
|
136
|
+
text: string;
|
|
137
|
+
/**
|
|
138
|
+
* Indicates if token is an identifier.
|
|
139
|
+
*/
|
|
140
|
+
identifier?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Indicates if token is a constant.
|
|
143
|
+
*/
|
|
144
|
+
constant?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Value of the token if it's a constant.
|
|
147
|
+
*/
|
|
148
|
+
value?: string | number;
|
|
149
|
+
/**
|
|
150
|
+
* Indicates if token is an operator.
|
|
151
|
+
*/
|
|
152
|
+
operator?: boolean;
|
|
153
|
+
};
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @ngdoc provider
|
|
3
|
-
* @name $parseProvider
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @description
|
|
7
|
-
* `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse}
|
|
8
|
-
* service.
|
|
9
|
-
*/
|
|
10
1
|
export function $ParseProvider(): void;
|
|
11
2
|
export class $ParseProvider {
|
|
12
3
|
/**
|
|
@@ -40,12 +31,12 @@ export class $ParseProvider {
|
|
|
40
31
|
* Since this function will be called extensively, keep the implementation of these functions fast,
|
|
41
32
|
* as the performance of these functions have a direct impact on the expressions parsing speed.
|
|
42
33
|
*
|
|
43
|
-
* @param {function=} identifierStart The function that will decide whether the given character is
|
|
34
|
+
* @param {function(any):boolean=} identifierStart The function that will decide whether the given character is
|
|
44
35
|
* a valid identifier start character.
|
|
45
|
-
* @param {function=} identifierContinue The function that will decide whether the given character is
|
|
36
|
+
* @param {function(any):boolean=} identifierContinue The function that will decide whether the given character is
|
|
46
37
|
* a valid identifier continue character.
|
|
47
38
|
*/
|
|
48
|
-
setIdentifierFns: (identifierStart?:
|
|
39
|
+
setIdentifierFns: (identifierStart?: ((arg0: any) => boolean) | undefined, identifierContinue?: ((arg0: any) => boolean) | undefined) => this;
|
|
49
40
|
$get: (string | (($filter: any) => {
|
|
50
41
|
(exp: any, interceptorFn: any): any;
|
|
51
42
|
$$getAst: (exp: any) => {
|
|
@@ -64,8 +55,6 @@ export function chainInterceptors(first: any, second: any): {
|
|
|
64
55
|
$stateful: any;
|
|
65
56
|
$$pure: any;
|
|
66
57
|
};
|
|
67
|
-
export function expressionInputDirtyCheck(newValue: any, oldValueOfValue: any, compareObjectIdentity: any): boolean;
|
|
68
|
-
export function isAllDefined(value: any): boolean;
|
|
69
58
|
export const $parseMinErr: (arg0: string, ...arg1: any[]) => Error;
|
|
70
59
|
export namespace literals {
|
|
71
60
|
let _true: boolean;
|
|
@@ -76,4 +65,4 @@ export namespace literals {
|
|
|
76
65
|
export { _null as null };
|
|
77
66
|
export let undefined: any;
|
|
78
67
|
}
|
|
79
|
-
export type ParseService = (arg0: string | ((arg0: import("../scope/scope").Scope) => any), arg1: ((arg0: any, arg1: Scope, arg2: any) => any) | undefined, arg2: boolean | undefined) => import("../../types").CompiledExpression;
|
|
68
|
+
export type ParseService = (arg0: string | ((arg0: import("../scope/scope").Scope) => any), arg1: ((arg0: any, arg1: import("../scope/scope").Scope, arg2: any) => any) | undefined, arg2: boolean | undefined) => import("../../types").CompiledExpression;
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
* @constructor
|
|
3
3
|
*/
|
|
4
4
|
export class Parser {
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param {import('./lexer').Lexer} lexer
|
|
8
|
+
* @param {*} $filter
|
|
9
|
+
* @param {*} options
|
|
10
|
+
*/
|
|
11
|
+
constructor(lexer: import("./lexer").Lexer, $filter: any, options: any);
|
|
6
12
|
ast: AST;
|
|
7
13
|
astCompiler: ASTInterpreter | ASTCompiler;
|
|
8
14
|
parse(text: any): any;
|
|
@@ -61,7 +61,7 @@ export const $$applyAsyncQueue: Function[];
|
|
|
61
61
|
*
|
|
62
62
|
*/
|
|
63
63
|
export class $RootScopeProvider {
|
|
64
|
-
$get: (string | ((exceptionHandler: import("../exception-handler").ErrorHandler, parse:
|
|
64
|
+
$get: (string | ((exceptionHandler: import("../exception-handler").ErrorHandler, parse: import("../parser/parse").ParseService, browser: import("../../services/browser").Browser) => Scope))[];
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* DESIGN NOTES
|
|
@@ -103,9 +103,9 @@ export class Scope {
|
|
|
103
103
|
*/
|
|
104
104
|
$root: Scope | null;
|
|
105
105
|
/**
|
|
106
|
-
* @type {
|
|
106
|
+
* @type {Array<any>}
|
|
107
107
|
*/
|
|
108
|
-
$$watchers:
|
|
108
|
+
$$watchers: Array<any>;
|
|
109
109
|
/**
|
|
110
110
|
* @type {number}
|
|
111
111
|
*/
|
|
@@ -296,10 +296,10 @@ export class Scope {
|
|
|
296
296
|
* values are examined for changes on every call to `$digest`.
|
|
297
297
|
* - The `listener` is called whenever any expression in the `watchExpressions` array changes.
|
|
298
298
|
*
|
|
299
|
-
* @param {Array.<string|
|
|
299
|
+
* @param {Array.<string|((Scope)=>any)>} watchExpressions Array of expressions that will be individually
|
|
300
300
|
* watched using {@link ng.$rootScope.Scope#$watch $watch()}
|
|
301
301
|
*
|
|
302
|
-
* @param {function(
|
|
302
|
+
* @param {function(any, any, Scope): any} listener Callback called whenever the return value of any
|
|
303
303
|
* expression in `watchExpressions` changes
|
|
304
304
|
* The `newValues` array contains the current values of the `watchExpressions`, with the indexes matching
|
|
305
305
|
* those of `watchExpression`
|
|
@@ -308,7 +308,7 @@ export class Scope {
|
|
|
308
308
|
* The `scope` refers to the current scope.
|
|
309
309
|
* @returns {function()} Returns a de-registration function for all listeners.
|
|
310
310
|
*/
|
|
311
|
-
$watchGroup(watchExpressions: any
|
|
311
|
+
$watchGroup(watchExpressions: Array<string | ((Scope: any) => any)>, listener: (arg0: any, arg1: any, arg2: Scope) => any): () => any;
|
|
312
312
|
/**
|
|
313
313
|
* @ngdoc method
|
|
314
314
|
* @name $rootScope.Scope#$watchCollection
|
|
@@ -327,12 +327,12 @@ export class Scope {
|
|
|
327
327
|
*
|
|
328
328
|
*
|
|
329
329
|
*
|
|
330
|
-
* @param {string|function(
|
|
330
|
+
* @param {string|function(Scope):any} obj Evaluated as {@link guide/expression expression}. The
|
|
331
331
|
* expression value should evaluate to an object or an array which is observed on each
|
|
332
332
|
* {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the
|
|
333
333
|
* collection will trigger a call to the `listener`.
|
|
334
334
|
*
|
|
335
|
-
* @param {function(
|
|
335
|
+
* @param {function(any[], any[], Scope):any} listener a callback function called
|
|
336
336
|
* when a change is detected.
|
|
337
337
|
* - The `newCollection` object is the newly modified data obtained from the `obj` expression
|
|
338
338
|
* - The `oldCollection` object is a copy of the former collection data.
|
|
@@ -343,7 +343,7 @@ export class Scope {
|
|
|
343
343
|
* @returns {function()} Returns a de-registration function for this listener. When the
|
|
344
344
|
* de-registration function is executed, the internal watch operation is terminated.
|
|
345
345
|
*/
|
|
346
|
-
$watchCollection(obj: string | ((arg0:
|
|
346
|
+
$watchCollection(obj: string | ((arg0: Scope) => any), listener: (arg0: any[], arg1: any[], arg2: Scope) => any): () => any;
|
|
347
347
|
/**
|
|
348
348
|
* @ngdoc method
|
|
349
349
|
* @name $rootScope.Scope#$digest
|
|
@@ -630,10 +630,10 @@ export class Scope {
|
|
|
630
630
|
* - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.
|
|
631
631
|
*
|
|
632
632
|
* @param {string} name Event name to listen on.
|
|
633
|
-
* @param {function(
|
|
633
|
+
* @param {function(any): any} listener Function to call when the event is emitted witn angular.IAngularEvent
|
|
634
634
|
* @returns {function()} Returns a deregistration function for this listener.
|
|
635
635
|
*/
|
|
636
|
-
$on(name: string, listener: (arg0:
|
|
636
|
+
$on(name: string, listener: (arg0: any) => any): () => any;
|
|
637
637
|
/**
|
|
638
638
|
* @ngdoc method
|
|
639
639
|
* @name $rootScope.Scope#$eval
|
package/types/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type BootstrapConfig = any;
|
|
2
2
|
export type Injectable<T_1> = Function | Array<string | Function>;
|
|
3
|
-
export type CompiledExpression = (arg0: any, arg1: any | undefined) => any;
|
|
3
|
+
export type CompiledExpression = any | ((arg0: any, arg1: any | undefined) => any);
|
|
4
4
|
export type ComponentOptions = any;
|
|
5
5
|
export type ControllerConstructor = Function;
|
|
6
6
|
export type OnChangesObject = any;
|