@angular-wave/angular.ts 0.0.49 → 0.0.50
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/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +1 -1
- package/src/core/interpolate/interpolate.js +1 -18
- package/src/core/parser/ast.js +232 -71
- package/src/core/parser/interpreter.js +246 -50
- package/src/core/parser/lexer.js +9 -10
- package/src/core/parser/parse.js +29 -229
- package/src/core/parser/parse.md +0 -13
- package/src/core/parser/parser.js +28 -8
- package/src/core/parser/shared.js +7 -1
- package/src/directive/csp.md +0 -26
- package/src/shared/jqlite/jqlite.js +2 -2
- package/src/types.js +4 -1
- package/types/core/parser/ast.d.ts +267 -73
- package/types/core/parser/interpreter.d.ts +202 -53
- package/types/core/parser/lexer.d.ts +17 -17
- package/types/core/parser/parse.d.ts +23 -23
- package/types/core/parser/parser.d.ts +39 -16
- package/types/core/parser/shared.d.ts +7 -1
- package/types/shared/jqlite/jqlite.d.ts +4 -4
- package/types/types.d.ts +1 -1
- package/src/core/parser/compiler.js +0 -561
- package/types/core/parser/compiler.d.ts +0 -49
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
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.
|
|
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
5
|
*/
|
|
6
6
|
/**
|
|
7
7
|
* Represents a token produced by the lexer.
|
|
8
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.
|
|
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
15
|
*/
|
|
16
16
|
/**
|
|
17
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.
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
export class Lexer {
|
|
21
21
|
/**
|
|
22
22
|
* Creates an instance of Lexer.
|
|
23
|
-
* @param {LexerOptions} options Lexer options.
|
|
23
|
+
* @param {LexerOptions} options - Lexer options.
|
|
24
24
|
*/
|
|
25
25
|
constructor(options: LexerOptions);
|
|
26
26
|
/** @type {LexerOptions} */
|
|
@@ -114,11 +114,11 @@ export class Lexer {
|
|
|
114
114
|
}
|
|
115
115
|
export type LexerOptions = {
|
|
116
116
|
/**
|
|
117
|
-
* Custom function to determine if a character is a valid identifier start.
|
|
117
|
+
* - Custom function to determine if a character is a valid identifier start.
|
|
118
118
|
*/
|
|
119
119
|
isIdentifierStart?: (ch: string, codePoint: number) => boolean;
|
|
120
120
|
/**
|
|
121
|
-
* Custom function to determine if a character is a valid identifier continuation.
|
|
121
|
+
* - Custom function to determine if a character is a valid identifier continuation.
|
|
122
122
|
*/
|
|
123
123
|
isIdentifierContinue?: (ch: string, codePoint: number) => boolean;
|
|
124
124
|
};
|
|
@@ -127,27 +127,27 @@ export type LexerOptions = {
|
|
|
127
127
|
*/
|
|
128
128
|
export type Token = {
|
|
129
129
|
/**
|
|
130
|
-
* Index of the token.
|
|
130
|
+
* - Index of the token.
|
|
131
131
|
*/
|
|
132
132
|
index: number;
|
|
133
133
|
/**
|
|
134
|
-
* Text of the token.
|
|
134
|
+
* - Text of the token.
|
|
135
135
|
*/
|
|
136
136
|
text: string;
|
|
137
137
|
/**
|
|
138
|
-
* Indicates if token is an identifier.
|
|
138
|
+
* - Indicates if token is an identifier.
|
|
139
139
|
*/
|
|
140
140
|
identifier?: boolean;
|
|
141
141
|
/**
|
|
142
|
-
* Indicates if token is a constant.
|
|
142
|
+
* - Indicates if token is a constant.
|
|
143
143
|
*/
|
|
144
144
|
constant?: boolean;
|
|
145
145
|
/**
|
|
146
|
-
* Value of the token if it's a constant.
|
|
146
|
+
* - Value of the token if it's a constant.
|
|
147
147
|
*/
|
|
148
148
|
value?: string | number;
|
|
149
149
|
/**
|
|
150
|
-
* Indicates if token is an operator.
|
|
150
|
+
* - Indicates if token is an operator.
|
|
151
151
|
*/
|
|
152
152
|
operator?: boolean;
|
|
153
153
|
};
|
|
@@ -13,11 +13,6 @@ export class $ParseProvider {
|
|
|
13
13
|
**/
|
|
14
14
|
addLiteral: (literalName: string, literalValue: any) => void;
|
|
15
15
|
/**
|
|
16
|
-
* @ngdoc method
|
|
17
|
-
* @name $parseProvider#setIdentifierFns
|
|
18
|
-
*
|
|
19
|
-
* @description
|
|
20
|
-
*
|
|
21
16
|
* Allows defining the set of characters that are allowed in AngularJS expressions. The function
|
|
22
17
|
* `identifierStart` will get called to know if a given character is a valid character to be the
|
|
23
18
|
* first character for an identifier. The function `identifierContinue` will get called to know if
|
|
@@ -31,30 +26,34 @@ export class $ParseProvider {
|
|
|
31
26
|
* Since this function will be called extensively, keep the implementation of these functions fast,
|
|
32
27
|
* as the performance of these functions have a direct impact on the expressions parsing speed.
|
|
33
28
|
*
|
|
34
|
-
* @param {function(any):boolean
|
|
29
|
+
* @param {function(any):boolean} [identifierStart] The function that will decide whether the given character is
|
|
35
30
|
* a valid identifier start character.
|
|
36
|
-
* @param {function(any):boolean
|
|
31
|
+
* @param {function(any):boolean} [identifierContinue] The function that will decide whether the given character is
|
|
37
32
|
* a valid identifier continue character.
|
|
33
|
+
* @returns {$ParseProvider}
|
|
38
34
|
*/
|
|
39
|
-
setIdentifierFns: (identifierStart?: (
|
|
35
|
+
setIdentifierFns: (identifierStart?: (arg0: any) => boolean, identifierContinue?: (arg0: any) => boolean) => $ParseProvider;
|
|
40
36
|
$get: (string | (($filter: any) => {
|
|
41
37
|
(exp: any, interceptorFn: any): any;
|
|
42
|
-
$$getAst: (exp:
|
|
43
|
-
type: string;
|
|
44
|
-
body: {
|
|
45
|
-
type: string;
|
|
46
|
-
expression: any;
|
|
47
|
-
}[];
|
|
48
|
-
};
|
|
38
|
+
$$getAst: (exp: string) => import("./ast").ASTNode;
|
|
49
39
|
}))[];
|
|
50
40
|
}
|
|
51
|
-
export function
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
41
|
+
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
|
+
*/
|
|
58
57
|
export const $parseMinErr: (arg0: string, ...arg1: any[]) => Error;
|
|
59
58
|
export namespace literals {
|
|
60
59
|
let _true: boolean;
|
|
@@ -65,4 +64,5 @@ export namespace literals {
|
|
|
65
64
|
export { _null as null };
|
|
66
65
|
export let undefined: any;
|
|
67
66
|
}
|
|
68
|
-
export type
|
|
67
|
+
export type CompiledExpression = Function;
|
|
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) => CompiledExpression;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} ParsedAST
|
|
3
|
+
* @property {import("./ast").ASTNode} ast - AST representation of expression
|
|
4
|
+
* @property {boolean} oneTime - True if expression should be evaluated only once
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Object} ParserOptions
|
|
8
|
+
* @property {function(string):any} literals
|
|
9
|
+
*/
|
|
1
10
|
/**
|
|
2
11
|
* @constructor
|
|
3
12
|
*/
|
|
@@ -5,24 +14,38 @@ export class Parser {
|
|
|
5
14
|
/**
|
|
6
15
|
*
|
|
7
16
|
* @param {import('./lexer').Lexer} lexer
|
|
8
|
-
* @param {
|
|
9
|
-
* @param {
|
|
17
|
+
* @param {function(any):any} $filter
|
|
18
|
+
* @param {ParserOptions} options
|
|
10
19
|
*/
|
|
11
|
-
constructor(lexer: import("./lexer").Lexer, $filter: any, options:
|
|
20
|
+
constructor(lexer: import("./lexer").Lexer, $filter: (arg0: any) => any, options: ParserOptions);
|
|
21
|
+
/** @type {AST} */
|
|
12
22
|
ast: AST;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
/** @type {ASTInterpreter} */
|
|
24
|
+
astCompiler: ASTInterpreter;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @param {string} exp - Expression to be parsed
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
parse(exp: string): any;
|
|
31
|
+
/**
|
|
32
|
+
* @param {string} exp - Expression to be parsed
|
|
33
|
+
* @returns {ParsedAST}
|
|
34
|
+
*/
|
|
35
|
+
getAst(exp: string): ParsedAST;
|
|
25
36
|
}
|
|
37
|
+
export type ParsedAST = {
|
|
38
|
+
/**
|
|
39
|
+
* - AST representation of expression
|
|
40
|
+
*/
|
|
41
|
+
ast: import("./ast").ASTNode;
|
|
42
|
+
/**
|
|
43
|
+
* - True if expression should be evaluated only once
|
|
44
|
+
*/
|
|
45
|
+
oneTime: boolean;
|
|
46
|
+
};
|
|
47
|
+
export type ParserOptions = {
|
|
48
|
+
literals: (arg0: string) => any;
|
|
49
|
+
};
|
|
26
50
|
import { AST } from "./ast";
|
|
27
51
|
import { ASTInterpreter } from "./interpreter";
|
|
28
|
-
import { ASTCompiler } from "./compiler";
|
|
@@ -11,7 +11,13 @@ export function ifDefined(v: any, d: any): any;
|
|
|
11
11
|
export function plusFn(l: any, r: any): any;
|
|
12
12
|
export function isStateless($filter: any, filterName: any): boolean;
|
|
13
13
|
export function isPure(node: any, parentIsPure: any): any;
|
|
14
|
-
|
|
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;
|
|
15
21
|
export function getInputs(body: any): any;
|
|
16
22
|
export function isAssignable(ast: any): boolean;
|
|
17
23
|
export function assignableAST(ast: any): {
|
|
@@ -66,16 +66,16 @@ export class JQLite {
|
|
|
66
66
|
/**
|
|
67
67
|
* Gets or sets data on a parent element
|
|
68
68
|
* @param {string} name
|
|
69
|
-
* @param {any} value
|
|
69
|
+
* @param {any} [value]
|
|
70
70
|
* @returns {JQLite|any}
|
|
71
71
|
*/
|
|
72
|
-
inheritedData(name: string, value
|
|
72
|
+
inheritedData(name: string, value?: any): JQLite | any;
|
|
73
73
|
/**
|
|
74
74
|
* Gets or sets innerHTML on the first element in JQLite collection
|
|
75
|
-
* @param {string} value
|
|
75
|
+
* @param {string} [value]
|
|
76
76
|
* @returns {JQLite|any|undefined}
|
|
77
77
|
*/
|
|
78
|
-
html(value
|
|
78
|
+
html(value?: string): JQLite | any | undefined;
|
|
79
79
|
/**
|
|
80
80
|
* Get the combined text contents of each element in the JQLite collection
|
|
81
81
|
* or set the text contents of all elements.
|
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 =
|
|
3
|
+
export type CompiledExpression = Function;
|
|
4
4
|
export type ComponentOptions = any;
|
|
5
5
|
export type ControllerConstructor = Function;
|
|
6
6
|
export type OnChangesObject = any;
|