@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.
Files changed (59) hide show
  1. package/README.md +3 -1
  2. package/dist/angular-ts.esm.js +2 -2
  3. package/dist/angular-ts.umd.js +2 -2
  4. package/package.json +1 -1
  5. package/src/animations/animate-children-directive.js +19 -99
  6. package/src/animations/animate-children-directive.md +80 -0
  7. package/src/animations/animate-css-driver.js +250 -256
  8. package/src/animations/animate-css.js +646 -875
  9. package/src/animations/animate-css.md +263 -0
  10. package/src/animations/animate-js-driver.js +54 -56
  11. package/src/animations/animate-js.js +303 -306
  12. package/src/animations/animate-queue.js +707 -716
  13. package/src/animations/animate-swap.js +30 -119
  14. package/src/animations/animate-swap.md +88 -0
  15. package/src/animations/animation.js +3 -3
  16. package/src/animations/shared.js +2 -1
  17. package/src/core/animate/animate-runner.js +147 -145
  18. package/src/core/animate/animate.js +568 -582
  19. package/src/core/animate/anomate.md +13 -0
  20. package/src/core/compile/compile.spec.js +5 -6
  21. package/src/core/core.html +0 -1
  22. package/src/core/parser/ast-type.js +21 -20
  23. package/src/core/parser/ast.js +34 -35
  24. package/src/core/parser/interpreter.js +405 -136
  25. package/src/core/parser/lexer.js +14 -13
  26. package/src/core/parser/parse.js +31 -45
  27. package/src/core/parser/parse.spec.js +429 -444
  28. package/src/core/parser/parser.js +17 -9
  29. package/src/directive/select/select.js +301 -305
  30. package/src/loader.js +5 -1
  31. package/src/public.js +0 -1
  32. package/src/router/directives/state-directives.js +256 -574
  33. package/src/router/directives/state-directives.md +435 -0
  34. package/src/router/directives/view-directive.js +3 -3
  35. package/src/router/index.js +7 -7
  36. package/src/types.js +0 -13
  37. package/types/animations/animate-children-directive.d.ts +5 -80
  38. package/types/animations/animate-css-driver.d.ts +11 -0
  39. package/types/animations/animate-css.d.ts +8 -0
  40. package/types/animations/animate-js-driver.d.ts +8 -0
  41. package/types/animations/animate-js.d.ts +12 -0
  42. package/types/animations/animate-queue.d.ts +19 -0
  43. package/types/animations/animate-swap.d.ts +5 -89
  44. package/types/animations/shared.d.ts +1 -1
  45. package/types/core/animate/animate-runner.d.ts +32 -0
  46. package/types/core/animate/animate.d.ts +509 -0
  47. package/types/core/parser/ast-type.d.ts +24 -20
  48. package/types/core/parser/ast.d.ts +13 -14
  49. package/types/core/parser/interpreter.d.ts +24 -19
  50. package/types/core/parser/lexer.d.ts +6 -2
  51. package/types/core/parser/parse.d.ts +44 -38
  52. package/types/core/parser/parser.d.ts +2 -10
  53. package/types/directive/select/select.d.ts +79 -0
  54. package/types/loader.d.ts +397 -0
  55. package/types/router/directives/state-directives.d.ts +31 -0
  56. package/types/types.d.ts +0 -1
  57. package/src/core/document.spec.js +0 -52
  58. package/src/core/parser/shared.js +0 -234
  59. package/types/core/parser/shared.d.ts +0 -35
@@ -1,234 +0,0 @@
1
- import { ASTType } from "./ast-type";
2
- import { forEach, isFunction } from "../../shared/utils";
3
-
4
- const objectValueOf = {}.constructor.prototype.valueOf;
5
-
6
- /**
7
- * Converts parameter to strings property name for use as keys in an object.
8
- * Any non-string object, including a number, is typecasted into a string via the toString method.
9
- * {@link https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Property_accessors#Property_names}
10
- *
11
- * @param {!any} name
12
- * @returns {string}
13
- */
14
- export function getStringValue(name) {
15
- return `${name}`;
16
- }
17
-
18
- /// //////////////////////////////////////
19
-
20
- export function ifDefined(v, d) {
21
- return typeof v !== "undefined" ? v : d;
22
- }
23
-
24
- export function plusFn(l, r) {
25
- if (typeof l === "undefined") return r;
26
- if (typeof r === "undefined") return l;
27
- return l + r;
28
- }
29
-
30
- export function isStateless($filter, filterName) {
31
- const fn = $filter(filterName);
32
- return !fn.$stateful;
33
- }
34
-
35
- export const PURITY_ABSOLUTE = 1;
36
- export const PURITY_RELATIVE = 2;
37
-
38
- // Detect nodes which could depend on non-shallow state of objects
39
- export function isPure(node, parentIsPure) {
40
- switch (node.type) {
41
- // Computed members might invoke a stateful toString()
42
- case ASTType.MemberExpression:
43
- if (node.computed) {
44
- return false;
45
- }
46
- break;
47
-
48
- // Unary always convert to primative
49
- case ASTType.UnaryExpression:
50
- return PURITY_ABSOLUTE;
51
-
52
- // The binary + operator can invoke a stateful toString().
53
- case ASTType.BinaryExpression:
54
- return node.operator !== "+" ? PURITY_ABSOLUTE : false;
55
-
56
- // Functions / filters probably read state from within objects
57
- case ASTType.CallExpression:
58
- return false;
59
- }
60
-
61
- return undefined === parentIsPure ? PURITY_RELATIVE : parentIsPure;
62
- }
63
-
64
- /**
65
- * Decorates ast with constant, toWatch, and isPure properties
66
- * @param {import("./ast").ASTNode} ast
67
- * @param {function(any):any} $filter
68
- * @param {*} parentIsPure
69
- */
70
- export function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
71
- let allConstants;
72
- let argsToWatch;
73
- let isStatelessFilter;
74
-
75
- const astIsPure = (ast.isPure = isPure(ast, parentIsPure));
76
-
77
- switch (ast.type) {
78
- case ASTType.Program:
79
- allConstants = true;
80
- /** @type {[import("./ast").ASTNode]} */ (ast.body).forEach((expr) => {
81
- findConstantAndWatchExpressions(expr.expression, $filter, astIsPure);
82
- allConstants = allConstants && expr.expression.constant;
83
- });
84
- ast.constant = allConstants;
85
- break;
86
- case ASTType.Literal:
87
- ast.constant = true;
88
- ast.toWatch = [];
89
- break;
90
- case ASTType.UnaryExpression:
91
- findConstantAndWatchExpressions(ast.argument, $filter, astIsPure);
92
- ast.constant = ast.argument.constant;
93
- ast.toWatch = ast.argument.toWatch;
94
- break;
95
- case ASTType.BinaryExpression:
96
- findConstantAndWatchExpressions(ast.left, $filter, astIsPure);
97
- findConstantAndWatchExpressions(ast.right, $filter, astIsPure);
98
- ast.constant = ast.left.constant && ast.right.constant;
99
- ast.toWatch = ast.left.toWatch.concat(ast.right.toWatch);
100
- break;
101
- case ASTType.LogicalExpression:
102
- findConstantAndWatchExpressions(ast.left, $filter, astIsPure);
103
- findConstantAndWatchExpressions(ast.right, $filter, astIsPure);
104
- ast.constant = ast.left.constant && ast.right.constant;
105
- ast.toWatch = ast.constant ? [] : [ast];
106
- break;
107
- case ASTType.ConditionalExpression:
108
- findConstantAndWatchExpressions(ast.test, $filter, astIsPure);
109
- findConstantAndWatchExpressions(ast.alternate, $filter, astIsPure);
110
- findConstantAndWatchExpressions(ast.consequent, $filter, astIsPure);
111
- ast.constant =
112
- ast.test.constant && ast.alternate.constant && ast.consequent.constant;
113
- ast.toWatch = ast.constant ? [] : [ast];
114
- break;
115
- case ASTType.Identifier:
116
- ast.constant = false;
117
- ast.toWatch = [ast];
118
- break;
119
- case ASTType.MemberExpression:
120
- findConstantAndWatchExpressions(ast.object, $filter, astIsPure);
121
- if (ast.computed) {
122
- findConstantAndWatchExpressions(ast.property, $filter, astIsPure);
123
- }
124
- ast.constant =
125
- ast.object.constant && (!ast.computed || ast.property.constant);
126
- ast.toWatch = ast.constant ? [] : [ast];
127
- break;
128
- case ASTType.CallExpression:
129
- isStatelessFilter = ast.filter
130
- ? isStateless($filter, ast.callee.name)
131
- : false;
132
- allConstants = isStatelessFilter;
133
- argsToWatch = [];
134
- forEach(ast.arguments, (expr) => {
135
- findConstantAndWatchExpressions(expr, $filter, astIsPure);
136
- allConstants = allConstants && expr.constant;
137
- argsToWatch.push.apply(argsToWatch, expr.toWatch);
138
- });
139
- ast.constant = allConstants;
140
- ast.toWatch = isStatelessFilter ? argsToWatch : [ast];
141
- break;
142
- case ASTType.AssignmentExpression:
143
- findConstantAndWatchExpressions(ast.left, $filter, astIsPure);
144
- findConstantAndWatchExpressions(ast.right, $filter, astIsPure);
145
- ast.constant = ast.left.constant && ast.right.constant;
146
- ast.toWatch = [ast];
147
- break;
148
- case ASTType.ArrayExpression:
149
- allConstants = true;
150
- argsToWatch = [];
151
- forEach(ast.elements, (expr) => {
152
- findConstantAndWatchExpressions(expr, $filter, astIsPure);
153
- allConstants = allConstants && expr.constant;
154
- argsToWatch.push.apply(argsToWatch, expr.toWatch);
155
- });
156
- ast.constant = allConstants;
157
- ast.toWatch = argsToWatch;
158
- break;
159
- case ASTType.ObjectExpression:
160
- allConstants = true;
161
- argsToWatch = [];
162
- forEach(ast.properties, (property) => {
163
- findConstantAndWatchExpressions(property.value, $filter, astIsPure);
164
- allConstants = allConstants && property.value.constant;
165
- argsToWatch.push.apply(argsToWatch, property.value.toWatch);
166
- if (property.computed) {
167
- // `{[key]: value}` implicitly does `key.toString()` which may be non-pure
168
- findConstantAndWatchExpressions(
169
- property.key,
170
- $filter,
171
- /* parentIsPure= */ false,
172
- );
173
- allConstants = allConstants && property.key.constant;
174
- argsToWatch.push.apply(argsToWatch, property.key.toWatch);
175
- }
176
- });
177
- ast.constant = allConstants;
178
- ast.toWatch = argsToWatch;
179
- break;
180
- case ASTType.ThisExpression:
181
- ast.constant = false;
182
- ast.toWatch = [];
183
- break;
184
- case ASTType.LocalsExpression:
185
- ast.constant = false;
186
- ast.toWatch = [];
187
- break;
188
- }
189
- }
190
-
191
- export function getInputs(body) {
192
- if (body.length !== 1) return;
193
- const lastExpression = body[0].expression;
194
- const candidate = lastExpression.toWatch;
195
- if (candidate.length !== 1) return candidate;
196
- return candidate[0] !== lastExpression ? candidate : undefined;
197
- }
198
-
199
- export function isAssignable(ast) {
200
- return (
201
- ast.type === ASTType.Identifier || ast.type === ASTType.MemberExpression
202
- );
203
- }
204
-
205
- export function assignableAST(ast) {
206
- if (ast.body.length === 1 && isAssignable(ast.body[0].expression)) {
207
- return {
208
- type: ASTType.AssignmentExpression,
209
- left: ast.body[0].expression,
210
- right: { type: ASTType.NGValueParameter },
211
- operator: "=",
212
- };
213
- }
214
- }
215
-
216
- export function isLiteral(ast) {
217
- return (
218
- ast.body.length === 0 ||
219
- (ast.body.length === 1 &&
220
- (ast.body[0].expression.type === ASTType.Literal ||
221
- ast.body[0].expression.type === ASTType.ArrayExpression ||
222
- ast.body[0].expression.type === ASTType.ObjectExpression))
223
- );
224
- }
225
-
226
- export function isConstant(ast) {
227
- return ast.constant;
228
- }
229
-
230
- export function getValueOf(value) {
231
- return isFunction(value.valueOf)
232
- ? value.valueOf()
233
- : objectValueOf.call(value);
234
- }
@@ -1,35 +0,0 @@
1
- /**
2
- * Converts parameter to strings property name for use as keys in an object.
3
- * Any non-string object, including a number, is typecasted into a string via the toString method.
4
- * {@link https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Property_accessors#Property_names}
5
- *
6
- * @param {!any} name
7
- * @returns {string}
8
- */
9
- export function getStringValue(name: any): string;
10
- export function ifDefined(v: any, d: any): any;
11
- export function plusFn(l: any, r: any): any;
12
- export function isStateless($filter: any, filterName: any): boolean;
13
- export function isPure(node: any, parentIsPure: any): any;
14
- /**
15
- * Decorates ast with constant, toWatch, and isPure properties
16
- * @param {import("./ast").ASTNode} ast
17
- * @param {function(any):any} $filter
18
- * @param {*} parentIsPure
19
- */
20
- export function findConstantAndWatchExpressions(ast: import("./ast").ASTNode, $filter: (arg0: any) => any, parentIsPure: any): void;
21
- export function getInputs(body: any): any;
22
- export function isAssignable(ast: any): boolean;
23
- export function assignableAST(ast: any): {
24
- type: string;
25
- left: any;
26
- right: {
27
- type: string;
28
- };
29
- operator: string;
30
- };
31
- export function isLiteral(ast: any): boolean;
32
- export function isConstant(ast: any): any;
33
- export function getValueOf(value: any): any;
34
- export const PURITY_ABSOLUTE: 1;
35
- export const PURITY_RELATIVE: 2;