@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,20 +1,24 @@
1
- export type ASTType = ("Program" | "ExpressionStatement" | "AssignmentExpression" | "ConditionalExpression" | "LogicalExpression" | "BinaryExpression" | "UnaryExpression" | "CallExpression" | "MemberExpression" | "Identifier" | "Literal" | "ArrayExpression" | "Property" | "ObjectExpression" | "ThisExpression" | "LocalsExpression" | "NGValueParameter");
2
- export namespace ASTType {
3
- let Program: string;
4
- let ExpressionStatement: string;
5
- let AssignmentExpression: string;
6
- let ConditionalExpression: string;
7
- let LogicalExpression: string;
8
- let BinaryExpression: string;
9
- let UnaryExpression: string;
10
- let CallExpression: string;
11
- let MemberExpression: string;
12
- let Identifier: string;
13
- let Literal: string;
14
- let ArrayExpression: string;
15
- let Property: string;
16
- let ObjectExpression: string;
17
- let ThisExpression: string;
18
- let LocalsExpression: string;
19
- let NGValueParameter: string;
20
- }
1
+ export type ASTType = number;
2
+ /**
3
+ * @readonly
4
+ * @enum {number}
5
+ */
6
+ export const ASTType: Readonly<{
7
+ Program: 1;
8
+ ExpressionStatement: 2;
9
+ AssignmentExpression: 3;
10
+ ConditionalExpression: 4;
11
+ LogicalExpression: 5;
12
+ BinaryExpression: 6;
13
+ UnaryExpression: 7;
14
+ CallExpression: 8;
15
+ MemberExpression: 9;
16
+ Identifier: 10;
17
+ Literal: 11;
18
+ ArrayExpression: 12;
19
+ Property: 13;
20
+ ObjectExpression: 14;
21
+ ThisExpression: 15;
22
+ LocalsExpression: 16;
23
+ NGValueParameter: 17;
24
+ }>;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @typedef {Object} ASTNode
3
- * @property {string} type - The type of the AST node.
3
+ * @property {number} type - The type of the AST node.
4
4
  * @property {string} [name] - The name of the identifier.
5
5
  * @property {string} [kind] - The kind of the property (e.g., 'init').
6
6
  * @property {*} [value] - The value of the node if it is a literal.
@@ -23,23 +23,26 @@
23
23
  * @property {ASTNode} [property] - The property of a member expression.
24
24
  * @property {boolean} [computed] - Indicates if a member expression is computed.
25
25
  * @property {string} [operator] - The operator of a binary or logical expression.
26
+ * @property {boolean} [filter]
26
27
  */
28
+ /** @type {Map<string,any>} */
29
+ export const literals: Map<string, any>;
27
30
  /**
28
- * @param {import('./lexer').Lexer} lexer - The lexer instance for tokenizing input
29
- * @param {import("./parser").ParserOptions} options
31
+ * @class
30
32
  */
31
33
  export class AST {
32
- constructor(lexer: any, options: any);
34
+ /**
35
+ * @param {import('./lexer').Lexer} lexer - The lexer instance for tokenizing input
36
+ */
37
+ constructor(lexer: import("./lexer").Lexer);
33
38
  /** @type {import('./lexer').Lexer} */
34
39
  lexer: import("./lexer").Lexer;
35
- /** @type {import("./parser").ParserOptions} */
36
- options: import("./parser").ParserOptions;
37
40
  selfReferential: {
38
41
  this: {
39
- type: string;
42
+ type: 15;
40
43
  };
41
44
  $locals: {
42
- type: string;
45
+ type: 16;
43
46
  };
44
47
  };
45
48
  /**
@@ -65,11 +68,6 @@ export class AST {
65
68
  * @returns {ASTNode} The filter chain node.
66
69
  */
67
70
  filterChain(): ASTNode;
68
- /**
69
- * Parses an expression.
70
- * @returns {ASTNode} The expression node.
71
- */
72
- expression(): ASTNode;
73
71
  /**
74
72
  * Parses an assignment expression.
75
73
  * @returns {ASTNode} The assignment expression node.
@@ -192,7 +190,7 @@ export type ASTNode = {
192
190
  /**
193
191
  * - The type of the AST node.
194
192
  */
195
- type: string;
193
+ type: number;
196
194
  /**
197
195
  * - The name of the identifier.
198
196
  */
@@ -277,4 +275,5 @@ export type ASTNode = {
277
275
  * - The operator of a binary or logical expression.
278
276
  */
279
277
  operator?: string;
278
+ filter?: boolean;
280
279
  };
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @param {import("./ast").ASTNode} ast
3
+ * @returns {boolean}
4
+ */
5
+ export function isAssignable(ast: import("./ast").ASTNode): boolean;
6
+ export const PURITY_ABSOLUTE: 1;
7
+ export const PURITY_RELATIVE: 2;
1
8
  export class ASTInterpreter {
2
9
  /**
3
10
  * @param {function(any):any} $filter
@@ -7,17 +14,17 @@ export class ASTInterpreter {
7
14
  /**
8
15
  * Compiles the AST into a function.
9
16
  * @param {import("./ast").ASTNode} ast - The AST to compile.
10
- * @returns
17
+ * @returns {import("./parse").CompiledExpression}
11
18
  */
12
- compile(ast: import("./ast").ASTNode): any;
19
+ compile(ast: import("./ast").ASTNode): import("./parse").CompiledExpression;
13
20
  /**
14
21
  * Recurses the AST nodes.
15
22
  * @param {import("./ast").ASTNode} ast - The AST node.
16
23
  * @param {Object} [context] - The context.
17
- * @param {boolean|number} [create] - The create flag.
18
- * @returns {function} The recursive function.
24
+ * @param {boolean|1} [create] - The create flag.
25
+ * @returns {import("./parse").CompiledExpressionFunction} The recursive function.
19
26
  */
20
- recurse(ast: import("./ast").ASTNode, context?: any, create?: boolean | number): Function;
27
+ recurse(ast: import("./ast").ASTNode, context?: any, create?: boolean | 1): import("./parse").CompiledExpressionFunction;
21
28
  /**
22
29
  * Unary plus operation.
23
30
  * @param {function} argument - The argument function.
@@ -63,7 +70,7 @@ export class ASTInterpreter {
63
70
  * @returns {function} The binary multiplication function.
64
71
  */
65
72
  "binary*"(left: Function, right: Function, context?: any): Function;
66
- "binary/"(left: any, right: any, context: any): (scope: any, locals: any, assign: any, inputs: any) => number | {
73
+ "binary/"(left: any, right: any, context: any): (scope: any, locals: any, assign: any) => number | {
67
74
  value: number;
68
75
  };
69
76
  /**
@@ -174,33 +181,31 @@ export class ASTInterpreter {
174
181
  * Returns the value of an identifier.
175
182
  * @param {string} name - The identifier name.
176
183
  * @param {Object} [context] - The context.
177
- * @param {boolean} [create] - Whether to create the identifier if it does not exist.
184
+ * @param {boolean|1} [create] - Whether to create the identifier if it does not exist.
178
185
  * @returns {function} The function returning the identifier value.
179
186
  */
180
- identifier(name: string, context?: any, create?: boolean): Function;
187
+ identifier(name: string, context?: any, create?: boolean | 1): Function;
181
188
  /**
182
189
  * Returns the value of a computed member expression.
183
190
  * @param {function} left - The left operand function.
184
191
  * @param {function} right - The right operand function.
185
192
  * @param {Object} [context] - The context.
186
- * @param {boolean} [create] - Whether to create the member if it does not exist.
193
+ * @param {boolean|1} [create] - Whether to create the member if it does not exist.
187
194
  * @returns {function} The function returning the computed member value.
188
195
  */
189
- computedMember(left: Function, right: Function, context?: any, create?: boolean): Function;
196
+ computedMember(left: Function, right: Function, context?: any, create?: boolean | 1): Function;
190
197
  /**
191
198
  * Returns the value of a non-computed member expression.
192
199
  * @param {function} left - The left operand function.
193
200
  * @param {string} right - The right operand function.
194
201
  * @param {Object} [context] - The context.
195
- * @param {boolean} [create] - Whether to create the member if it does not exist.
202
+ * @param {boolean|1} [create] - Whether to create the member if it does not exist.
196
203
  * @returns {function} The function returning the non-computed member value.
197
204
  */
198
- nonComputedMember(left: Function, right: string, context?: any, create?: boolean): Function;
199
- /**
200
- * Returns the value of an input expression.
201
- * @param {function} input - The input function.
202
- * @param {number} watchId - The watch identifier.
203
- * @returns {function} The function returning the input value.
204
- */
205
- inputs(input: Function, watchId: number): Function;
205
+ nonComputedMember(left: Function, right: string, context?: any, create?: boolean | 1): Function;
206
206
  }
207
+ export type DecoratedASTNode = import("./ast").ASTNode & {
208
+ isPure: boolean | number;
209
+ constant: boolean;
210
+ toWatch: any[];
211
+ };
@@ -4,7 +4,7 @@
4
4
  * @property {(ch: string, codePoint: number) => boolean} [isIdentifierContinue] - Custom function to determine if a character is a valid identifier continuation.
5
5
  */
6
6
  /**
7
- * Represents a token produced by the lexer.
7
+ * Represents a token produced by the lexer, which will be used by the AST to construct an abstract syntax tree.
8
8
  * @typedef {Object} Token
9
9
  * @property {number} index - Index of the token.
10
10
  * @property {string} text - Text of the token.
@@ -99,6 +99,7 @@ export class Lexer {
99
99
  throwError(error: string, start?: number, end?: number): void;
100
100
  /**
101
101
  * Reads and tokenizes a number from the text.
102
+ * @return {void}
102
103
  */
103
104
  readNumber(): void;
104
105
  /**
@@ -110,6 +111,9 @@ export class Lexer {
110
111
  * @param {string} quote Quote character used for the string.
111
112
  */
112
113
  readString(quote: string): void;
114
+ /**
115
+ * @returns {string}
116
+ */
113
117
  handleUnicodeEscape(): string;
114
118
  }
115
119
  export type LexerOptions = {
@@ -123,7 +127,7 @@ export type LexerOptions = {
123
127
  isIdentifierContinue?: (ch: string, codePoint: number) => boolean;
124
128
  };
125
129
  /**
126
- * Represents a token produced by the lexer.
130
+ * Represents a token produced by the lexer, which will be used by the AST to construct an abstract syntax tree.
127
131
  */
128
132
  export type Token = {
129
133
  /**
@@ -1,17 +1,30 @@
1
+ /**
2
+ * @typedef {Object} CompiledExpressionProps
3
+ * @property {boolean} literal - Indicates if the expression is a literal.
4
+ * @property {boolean} constant - Indicates if the expression is constant.
5
+ * @property {boolean} isPure
6
+ * @property {boolean} oneTime
7
+ * @property {any[]} inputs
8
+ * @property {function(any, any): any} assign - Assigns a value to a context. If value is not provided,
9
+ */
10
+ /**
11
+ * @typedef {function } CompiledExpressionFunction
12
+ * @param {import('../scope/scope').Scope} context - An object against which any expressions embedded in the strings are evaluated against (typically a scope object).
13
+ * @param {object} [locals] - local variables context object, useful for overriding values in `context`.
14
+ * @param {any} [assign]
15
+ * @returns {any}
16
+ * undefined is gonna be used since the implementation
17
+ * does not check the parameter. Let's force a value for consistency. If consumer
18
+ * wants to undefine it, pass the undefined value explicitly.
19
+ */
20
+ /**
21
+ * @typedef {CompiledExpressionFunction & CompiledExpressionProps} CompiledExpression
22
+ */
23
+ /**
24
+ * @typedef {function(string|function(import('../scope/scope').Scope):any, function(any, import('../scope/scope').Scope, any):any=, boolean=): CompiledExpression} ParseService
25
+ */
1
26
  export function $ParseProvider(): void;
2
27
  export class $ParseProvider {
3
- /**
4
- * @ngdoc method
5
- * @name $parseProvider#addLiteral
6
- * @description
7
- *
8
- * Configure $parse service to add literal values that will be present as literal at expressions.
9
- *
10
- * @param {string} literalName Token for the literal value. The literal name value must be a valid literal name.
11
- * @param {*} literalValue Value for this literal. All literal values must be primitives or `undefined`.
12
- *
13
- **/
14
- addLiteral: (literalName: string, literalValue: any) => void;
15
28
  /**
16
29
  * Allows defining the set of characters that are allowed in AngularJS expressions. The function
17
30
  * `identifierStart` will get called to know if a given character is a valid character to be the
@@ -39,30 +52,23 @@ export class $ParseProvider {
39
52
  }))[];
40
53
  }
41
54
  export function constantWatchDelegate(scope: any, listener: any, objectEquality: any, parsedExpression: any): any;
42
- /**
43
- * @typedef {function} CompiledExpression
44
- * @param {import('../scope/scope').Scope} context - An object against which any expressions embedded in the strings are evaluated against (typically a scope object).
45
- * @param {object} [locals] - local variables context object, useful for overriding values in `context`.
46
- * @returns {any}
47
- * @property {boolean} literal - Indicates if the expression is a literal.
48
- * @property {boolean} constant - Indicates if the expression is constant.
49
- * @property {function(any, any): any} assign - Assigns a value to a context. If value is not provided,
50
- * undefined is gonna be used since the implementation
51
- * does not check the parameter. Let's force a value for consistency. If consumer
52
- * wants to undefine it, pass the undefined value explicitly.
53
- */
54
- /**
55
- * @typedef {function(string|function(import('../scope/scope').Scope):any, function(any, import('../scope/scope').Scope, any):any=, boolean=): CompiledExpression} ParseService
56
- */
57
- export const $parseMinErr: (arg0: string, ...arg1: any[]) => Error;
58
- export namespace literals {
59
- let _true: boolean;
60
- export { _true as true };
61
- let _false: boolean;
62
- export { _false as false };
63
- let _null: any;
64
- export { _null as null };
65
- export let undefined: any;
66
- }
67
- export type CompiledExpression = Function;
55
+ export type CompiledExpressionProps = {
56
+ /**
57
+ * - Indicates if the expression is a literal.
58
+ */
59
+ literal: boolean;
60
+ /**
61
+ * - Indicates if the expression is constant.
62
+ */
63
+ constant: boolean;
64
+ isPure: boolean;
65
+ oneTime: boolean;
66
+ inputs: any[];
67
+ /**
68
+ * - Assigns a value to a context. If value is not provided,
69
+ */
70
+ assign: (arg0: any, arg1: any) => any;
71
+ };
72
+ export type CompiledExpressionFunction = Function;
73
+ export type CompiledExpression = CompiledExpressionFunction & CompiledExpressionProps;
68
74
  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) => CompiledExpression;
@@ -3,10 +3,6 @@
3
3
  * @property {import("./ast").ASTNode} ast - AST representation of expression
4
4
  * @property {boolean} oneTime - True if expression should be evaluated only once
5
5
  */
6
- /**
7
- * @typedef {Object} ParserOptions
8
- * @property {function(string):any} literals
9
- */
10
6
  /**
11
7
  * @constructor
12
8
  */
@@ -15,9 +11,8 @@ export class Parser {
15
11
  *
16
12
  * @param {import('./lexer').Lexer} lexer
17
13
  * @param {function(any):any} $filter
18
- * @param {ParserOptions} options
19
14
  */
20
- constructor(lexer: import("./lexer").Lexer, $filter: (arg0: any) => any, options: ParserOptions);
15
+ constructor(lexer: import("./lexer").Lexer, $filter: (arg0: any) => any);
21
16
  /** @type {AST} */
22
17
  ast: AST;
23
18
  /** @type {ASTInterpreter} */
@@ -27,7 +22,7 @@ export class Parser {
27
22
  * @param {string} exp - Expression to be parsed
28
23
  * @returns
29
24
  */
30
- parse(exp: string): any;
25
+ parse(exp: string): import("./parse").CompiledExpression;
31
26
  /**
32
27
  * @param {string} exp - Expression to be parsed
33
28
  * @returns {ParsedAST}
@@ -44,8 +39,5 @@ export type ParsedAST = {
44
39
  */
45
40
  oneTime: boolean;
46
41
  };
47
- export type ParserOptions = {
48
- literals: (arg0: string) => any;
49
- };
50
42
  import { AST } from "./ast";
51
43
  import { ASTInterpreter } from "./interpreter";
@@ -0,0 +1,79 @@
1
+ export function selectDirective(): {
2
+ restrict: string;
3
+ require: string[];
4
+ controller: typeof SelectController;
5
+ priority: number;
6
+ link: {
7
+ pre: (scope: any, element: any, attr: any, ctrls: any) => void;
8
+ post: (scope: any, element: any, attrs: any, ctrls: any) => void;
9
+ };
10
+ };
11
+ export const optionDirective: (string | (($interpolate: any) => {
12
+ restrict: string;
13
+ priority: number;
14
+ compile(element: any, attr: any): (scope: any, element: any, attr: any) => void;
15
+ }))[];
16
+ declare function SelectController($element: any, $scope: any): void;
17
+ declare class SelectController {
18
+ constructor($element: any, $scope: any);
19
+ selectValueMap: {};
20
+ ngModelCtrl: {
21
+ $setViewValue: () => void;
22
+ $render: () => void;
23
+ };
24
+ multiple: boolean;
25
+ unknownOption: JQLite;
26
+ hasEmptyOption: boolean;
27
+ emptyOption: any;
28
+ renderUnknownOption: (val: any) => void;
29
+ updateUnknownOption: (val: any) => void;
30
+ generateUnknownOptionValue: (val: any) => string;
31
+ removeUnknownOption: () => void;
32
+ selectEmptyOption: () => void;
33
+ unselectEmptyOption: () => void;
34
+ readValue: () => any;
35
+ writeValue: (value: any) => void;
36
+ addOption: (value: any, element: any) => void;
37
+ removeOption: (value: any) => void;
38
+ hasOption: (value: any) => boolean;
39
+ /**
40
+ * @ngdoc method
41
+ * @name select.SelectController#$hasEmptyOption
42
+ *
43
+ * @description
44
+ *
45
+ * Returns `true` if the select element currently has an empty option
46
+ * element, i.e. an option that signifies that the select is empty / the selection is null.
47
+ *
48
+ */
49
+ $hasEmptyOption: () => boolean;
50
+ /**
51
+ * @ngdoc method
52
+ * @name select.SelectController#$isUnknownOptionSelected
53
+ *
54
+ * @description
55
+ *
56
+ * Returns `true` if the select element's unknown option is selected. The unknown option is added
57
+ * and automatically selected whenever the select model doesn't match any option.
58
+ *
59
+ */
60
+ $isUnknownOptionSelected: () => boolean;
61
+ /**
62
+ * @ngdoc method
63
+ * @name select.SelectController#$isEmptyOptionSelected
64
+ *
65
+ * @description
66
+ *
67
+ * Returns `true` if the select element has an empty option and this empty option is currently
68
+ * selected. Returns `false` if the select element has no empty option or it is not selected.
69
+ *
70
+ */
71
+ $isEmptyOptionSelected: () => boolean;
72
+ selectUnknownOrEmptyOption: (value: any) => void;
73
+ registerOption: (optionScope: any, optionElement: any, optionAttrs: any, interpolateValueFn: any, interpolateTextFn: any) => void;
74
+ }
75
+ declare namespace SelectController {
76
+ let $inject: string[];
77
+ }
78
+ import { JQLite } from "../../shared/jqlite/jqlite";
79
+ export {};