@angular-wave/angular.ts 0.0.50 → 0.0.52
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/README.md +3 -1
- 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-children-directive.js +19 -99
- package/src/animations/animate-children-directive.md +80 -0
- package/src/animations/animate-css-driver.js +250 -256
- package/src/animations/animate-css.js +646 -875
- package/src/animations/animate-css.md +263 -0
- package/src/animations/animate-js-driver.js +54 -56
- package/src/animations/animate-js.js +303 -306
- package/src/animations/animate-queue.js +707 -716
- package/src/animations/animate-swap.js +30 -119
- package/src/animations/animate-swap.md +88 -0
- package/src/animations/animation.js +3 -3
- package/src/animations/shared.js +2 -1
- package/src/core/animate/animate-runner.js +147 -145
- package/src/core/animate/animate.js +568 -582
- package/src/core/animate/anomate.md +13 -0
- package/src/core/compile/compile.spec.js +5 -6
- package/src/core/core.html +0 -1
- package/src/core/parser/ast-type.js +21 -20
- package/src/core/parser/ast.js +34 -35
- package/src/core/parser/interpreter.js +405 -136
- package/src/core/parser/lexer.js +14 -13
- package/src/core/parser/parse.js +31 -45
- package/src/core/parser/parse.spec.js +429 -444
- package/src/core/parser/parser.js +17 -9
- package/src/directive/select/select.js +301 -305
- package/src/loader.js +5 -1
- package/src/public.js +0 -1
- package/src/router/directives/state-directives.js +256 -574
- package/src/router/directives/state-directives.md +435 -0
- package/src/router/directives/view-directive.js +3 -3
- package/src/router/index.js +7 -7
- package/src/types.js +0 -13
- package/types/animations/animate-children-directive.d.ts +5 -80
- package/types/animations/animate-css-driver.d.ts +11 -0
- package/types/animations/animate-css.d.ts +8 -0
- package/types/animations/animate-js-driver.d.ts +8 -0
- package/types/animations/animate-js.d.ts +12 -0
- package/types/animations/animate-queue.d.ts +19 -0
- package/types/animations/animate-swap.d.ts +5 -89
- package/types/animations/shared.d.ts +1 -1
- package/types/core/animate/animate-runner.d.ts +32 -0
- package/types/core/animate/animate.d.ts +509 -0
- package/types/core/parser/ast-type.d.ts +24 -20
- package/types/core/parser/ast.d.ts +13 -14
- package/types/core/parser/interpreter.d.ts +24 -19
- package/types/core/parser/lexer.d.ts +6 -2
- package/types/core/parser/parse.d.ts +44 -38
- package/types/core/parser/parser.d.ts +2 -10
- package/types/directive/select/select.d.ts +79 -0
- package/types/loader.d.ts +397 -0
- package/types/router/directives/state-directives.d.ts +31 -0
- package/types/types.d.ts +0 -1
- package/src/core/document.spec.js +0 -52
- package/src/core/parser/shared.js +0 -234
- package/types/core/parser/shared.d.ts +0 -35
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/\*\*
|
|
2
|
+
|
|
3
|
+
- @ngdoc provider
|
|
4
|
+
- @name $animateProvider
|
|
5
|
+
-
|
|
6
|
+
- @description
|
|
7
|
+
- Default implementation of $animate that doesn't perform any animations, instead just
|
|
8
|
+
- synchronously performs DOM updates and resolves the returned runner promise.
|
|
9
|
+
-
|
|
10
|
+
- In order to enable animations the `ngAnimate` module has to be loaded.
|
|
11
|
+
-
|
|
12
|
+
- To see the functional implementation check out `src/ngAnimate/animate.js`.
|
|
13
|
+
\*/
|
|
@@ -4995,37 +4995,36 @@ describe("$compile", () => {
|
|
|
4995
4995
|
// We compile the contents of element (i.e. not element itself)
|
|
4996
4996
|
// Then delete these contents and check the cache has been reset to zero
|
|
4997
4997
|
// Clear cache
|
|
4998
|
-
// Update: THIS TEST IS IRRELEVANT IF WE DONT POLLUTE THE CACHE
|
|
4999
4998
|
CACHE.clear();
|
|
5000
4999
|
window.angular.module("test1", ["ng"]);
|
|
5001
5000
|
createInjector(["test1"]).invoke(($compile) => {
|
|
5002
|
-
expect(CACHE.size).toEqual(
|
|
5001
|
+
expect(CACHE.size).toEqual(0);
|
|
5003
5002
|
// First with only elements at the top level
|
|
5004
5003
|
element = JQLite("<div><div></div></div>");
|
|
5005
5004
|
$compile(element[0].childNodes)($rootScope);
|
|
5006
5005
|
// expect(CACHE.size).toEqual(2);
|
|
5007
5006
|
element.empty();
|
|
5008
|
-
expect(CACHE.size).toEqual(
|
|
5007
|
+
expect(CACHE.size).toEqual(0);
|
|
5009
5008
|
|
|
5010
5009
|
// Next with non-empty text nodes at the top level
|
|
5011
5010
|
// (in this case the compiler will wrap them in a <span>)
|
|
5012
5011
|
element = JQLite("<div>xxx</div>");
|
|
5013
5012
|
$compile(element[0].childNodes)($rootScope);
|
|
5014
5013
|
element.empty();
|
|
5015
|
-
expect(CACHE.size).toEqual(
|
|
5014
|
+
expect(CACHE.size).toEqual(0);
|
|
5016
5015
|
|
|
5017
5016
|
// Next with comment nodes at the top level
|
|
5018
5017
|
element = JQLite("<div><!-- comment --></div>");
|
|
5019
5018
|
$compile(element[0].childNodes)($rootScope);
|
|
5020
5019
|
element.empty();
|
|
5021
|
-
expect(CACHE.size).toEqual(
|
|
5020
|
+
expect(CACHE.size).toEqual(0);
|
|
5022
5021
|
|
|
5023
5022
|
// Finally with empty text nodes at the top level
|
|
5024
5023
|
element = JQLite("<div> \n<div></div> </div>");
|
|
5025
5024
|
$compile(element[0].childNodes)($rootScope);
|
|
5026
5025
|
//expect(CACHE.size).toEqual(2);
|
|
5027
5026
|
element.empty();
|
|
5028
|
-
expect(CACHE.size).toEqual(
|
|
5027
|
+
expect(CACHE.size).toEqual(0);
|
|
5029
5028
|
});
|
|
5030
5029
|
});
|
|
5031
5030
|
|
package/src/core/core.html
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
<script src="/jasmine/jasmine-5.1.2/boot0.js"></script>
|
|
12
12
|
<script src="/jasmine/jasmine-5.1.2/boot1.js"></script>
|
|
13
13
|
<script type="module" src="/src/core/cookie-reader.spec.js"></script>
|
|
14
|
-
<script type="module" src="/src/core/document.spec.js"></script>
|
|
15
14
|
<script type="module" src="/src/core/on.spec.js"></script>
|
|
16
15
|
<script type="module" src="/src/core/prop.spec.js"></script>
|
|
17
16
|
<script type="module" src="/src/core/root-element.spec.js"></script>
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
2
|
+
* @readonly
|
|
3
|
+
* @enum {number}
|
|
3
4
|
*/
|
|
4
|
-
export const ASTType = {
|
|
5
|
-
Program:
|
|
6
|
-
ExpressionStatement:
|
|
7
|
-
AssignmentExpression:
|
|
8
|
-
ConditionalExpression:
|
|
9
|
-
LogicalExpression:
|
|
10
|
-
BinaryExpression:
|
|
11
|
-
UnaryExpression:
|
|
12
|
-
CallExpression:
|
|
13
|
-
MemberExpression:
|
|
14
|
-
Identifier:
|
|
15
|
-
Literal:
|
|
16
|
-
ArrayExpression:
|
|
17
|
-
Property:
|
|
18
|
-
ObjectExpression:
|
|
19
|
-
ThisExpression:
|
|
20
|
-
LocalsExpression:
|
|
21
|
-
NGValueParameter:
|
|
22
|
-
};
|
|
5
|
+
export const ASTType = Object.freeze({
|
|
6
|
+
Program: 1,
|
|
7
|
+
ExpressionStatement: 2,
|
|
8
|
+
AssignmentExpression: 3,
|
|
9
|
+
ConditionalExpression: 4,
|
|
10
|
+
LogicalExpression: 5,
|
|
11
|
+
BinaryExpression: 6,
|
|
12
|
+
UnaryExpression: 7,
|
|
13
|
+
CallExpression: 8,
|
|
14
|
+
MemberExpression: 9,
|
|
15
|
+
Identifier: 10,
|
|
16
|
+
Literal: 11,
|
|
17
|
+
ArrayExpression: 12,
|
|
18
|
+
Property: 13,
|
|
19
|
+
ObjectExpression: 14,
|
|
20
|
+
ThisExpression: 15,
|
|
21
|
+
LocalsExpression: 16,
|
|
22
|
+
NGValueParameter: 17,
|
|
23
|
+
});
|
package/src/core/parser/ast.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isAssignable } from "./shared";
|
|
1
|
+
import { isAssignable } from "./interpreter";
|
|
3
2
|
import { ASTType } from "./ast-type";
|
|
3
|
+
import { minErr } from "../../shared/utils";
|
|
4
|
+
|
|
5
|
+
const $parseMinErr = minErr("$parse");
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* @typedef {Object} ASTNode
|
|
7
|
-
* @property {
|
|
9
|
+
* @property {number} type - The type of the AST node.
|
|
8
10
|
* @property {string} [name] - The name of the identifier.
|
|
9
11
|
* @property {string} [kind] - The kind of the property (e.g., 'init').
|
|
10
12
|
* @property {*} [value] - The value of the node if it is a literal.
|
|
@@ -27,19 +29,30 @@ import { ASTType } from "./ast-type";
|
|
|
27
29
|
* @property {ASTNode} [property] - The property of a member expression.
|
|
28
30
|
* @property {boolean} [computed] - Indicates if a member expression is computed.
|
|
29
31
|
* @property {string} [operator] - The operator of a binary or logical expression.
|
|
32
|
+
* @property {boolean} [filter]
|
|
30
33
|
*/
|
|
31
34
|
|
|
35
|
+
// Keep this exported in case modification is required
|
|
36
|
+
/** @type {Map<string,any>} */
|
|
37
|
+
export const literals = new Map(
|
|
38
|
+
Object.entries({
|
|
39
|
+
true: true,
|
|
40
|
+
false: false,
|
|
41
|
+
null: null,
|
|
42
|
+
undefined,
|
|
43
|
+
}),
|
|
44
|
+
);
|
|
45
|
+
|
|
32
46
|
/**
|
|
33
|
-
* @
|
|
34
|
-
* @param {import("./parser").ParserOptions} options
|
|
47
|
+
* @class
|
|
35
48
|
*/
|
|
36
49
|
export class AST {
|
|
37
|
-
|
|
50
|
+
/**
|
|
51
|
+
* @param {import('./lexer').Lexer} lexer - The lexer instance for tokenizing input
|
|
52
|
+
*/
|
|
53
|
+
constructor(lexer) {
|
|
38
54
|
/** @type {import('./lexer').Lexer} */
|
|
39
55
|
this.lexer = lexer;
|
|
40
|
-
|
|
41
|
-
/** @type {import("./parser").ParserOptions} */
|
|
42
|
-
this.options = options;
|
|
43
56
|
this.selfReferential = {
|
|
44
57
|
this: { type: ASTType.ThisExpression },
|
|
45
58
|
$locals: { type: ASTType.LocalsExpression },
|
|
@@ -54,13 +67,10 @@ export class AST {
|
|
|
54
67
|
ast(text) {
|
|
55
68
|
this.text = text;
|
|
56
69
|
this.tokens = this.lexer.lex(text);
|
|
57
|
-
|
|
58
70
|
const value = this.program();
|
|
59
|
-
|
|
60
71
|
if (this.tokens.length !== 0) {
|
|
61
72
|
this.throwError("is an unexpected token", this.tokens[0]);
|
|
62
73
|
}
|
|
63
|
-
|
|
64
74
|
return value;
|
|
65
75
|
}
|
|
66
76
|
|
|
@@ -97,21 +107,13 @@ export class AST {
|
|
|
97
107
|
* @returns {ASTNode} The filter chain node.
|
|
98
108
|
*/
|
|
99
109
|
filterChain() {
|
|
100
|
-
let left = this.
|
|
110
|
+
let left = this.assignment();
|
|
101
111
|
while (this.expect("|")) {
|
|
102
112
|
left = this.filter(left);
|
|
103
113
|
}
|
|
104
114
|
return left;
|
|
105
115
|
}
|
|
106
116
|
|
|
107
|
-
/**
|
|
108
|
-
* Parses an expression.
|
|
109
|
-
* @returns {ASTNode} The expression node.
|
|
110
|
-
*/
|
|
111
|
-
expression() {
|
|
112
|
-
return this.assignment();
|
|
113
|
-
}
|
|
114
|
-
|
|
115
117
|
/**
|
|
116
118
|
* Parses an assignment expression.
|
|
117
119
|
* @returns {ASTNode} The assignment expression node.
|
|
@@ -142,9 +144,9 @@ export class AST {
|
|
|
142
144
|
let alternate;
|
|
143
145
|
let consequent;
|
|
144
146
|
if (this.expect("?")) {
|
|
145
|
-
alternate = this.
|
|
147
|
+
alternate = this.assignment();
|
|
146
148
|
if (this.consume(":")) {
|
|
147
|
-
consequent = this.
|
|
149
|
+
consequent = this.assignment();
|
|
148
150
|
return {
|
|
149
151
|
type: ASTType.ConditionalExpression,
|
|
150
152
|
test,
|
|
@@ -300,14 +302,11 @@ export class AST {
|
|
|
300
302
|
) {
|
|
301
303
|
primary = structuredClone(this.selfReferential[this.consume().text]);
|
|
302
304
|
} else if (
|
|
303
|
-
|
|
304
|
-
this.options.literals,
|
|
305
|
-
/** @type {import("./lexer").Token} */ (this.peek()).text,
|
|
306
|
-
)
|
|
305
|
+
literals.has(/** @type {import("./lexer").Token} */ (this.peek()).text)
|
|
307
306
|
) {
|
|
308
307
|
primary = {
|
|
309
308
|
type: ASTType.Literal,
|
|
310
|
-
value:
|
|
309
|
+
value: literals.get(this.consume().text),
|
|
311
310
|
};
|
|
312
311
|
} else if (
|
|
313
312
|
/** @type {import("./lexer").Token} */ (this.peek()).identifier
|
|
@@ -335,7 +334,7 @@ export class AST {
|
|
|
335
334
|
primary = {
|
|
336
335
|
type: ASTType.MemberExpression,
|
|
337
336
|
object: primary,
|
|
338
|
-
property: this.
|
|
337
|
+
property: this.assignment(),
|
|
339
338
|
computed: true,
|
|
340
339
|
};
|
|
341
340
|
this.consume("]");
|
|
@@ -369,7 +368,7 @@ export class AST {
|
|
|
369
368
|
};
|
|
370
369
|
|
|
371
370
|
while (this.expect(":")) {
|
|
372
|
-
args.push(this.
|
|
371
|
+
args.push(this.assignment());
|
|
373
372
|
}
|
|
374
373
|
|
|
375
374
|
return result;
|
|
@@ -424,7 +423,7 @@ export class AST {
|
|
|
424
423
|
// Support trailing commas per ES5.1.
|
|
425
424
|
break;
|
|
426
425
|
}
|
|
427
|
-
elements.push(this.
|
|
426
|
+
elements.push(this.assignment());
|
|
428
427
|
} while (this.expect(","));
|
|
429
428
|
}
|
|
430
429
|
this.consume("]");
|
|
@@ -452,7 +451,7 @@ export class AST {
|
|
|
452
451
|
property.key = this.constant();
|
|
453
452
|
property.computed = false;
|
|
454
453
|
this.consume(":");
|
|
455
|
-
property.value = this.
|
|
454
|
+
property.value = this.assignment();
|
|
456
455
|
} else if (
|
|
457
456
|
/** @type {import("./lexer").Token} */ (this.peek()).identifier
|
|
458
457
|
) {
|
|
@@ -460,17 +459,17 @@ export class AST {
|
|
|
460
459
|
property.computed = false;
|
|
461
460
|
if (this.peek(":")) {
|
|
462
461
|
this.consume(":");
|
|
463
|
-
property.value = this.
|
|
462
|
+
property.value = this.assignment();
|
|
464
463
|
} else {
|
|
465
464
|
property.value = property.key;
|
|
466
465
|
}
|
|
467
466
|
} else if (this.peek("[")) {
|
|
468
467
|
this.consume("[");
|
|
469
|
-
property.key = this.
|
|
468
|
+
property.key = this.assignment();
|
|
470
469
|
this.consume("]");
|
|
471
470
|
property.computed = true;
|
|
472
471
|
this.consume(":");
|
|
473
|
-
property.value = this.
|
|
472
|
+
property.value = this.assignment();
|
|
474
473
|
} else {
|
|
475
474
|
this.throwError(
|
|
476
475
|
"invalid key",
|