@divkitframework/divkit 28.2.0 → 28.3.0-canary-da9cf43499f3d307ba355f062037f7f8ebd4615a

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@divkitframework/divkit",
3
- "version": "28.2.0",
3
+ "version": "28.3.0-canary-da9cf43499f3d307ba355f062037f7f8ebd4615a",
4
4
  "description": "DivKit for the web",
5
5
  "keywords": [
6
6
  "server-driven-ui",
@@ -114,3 +114,100 @@ export function evalExpressionWithFullResult(expr: string, opts?: {
114
114
  export function valToString(val: EvalValue): string;
115
115
 
116
116
  export function functionNames(): string[];
117
+
118
+ export type Node = BinaryExpression | LogicalExpression |
119
+ UnaryExpression |
120
+ StringLiteral | NumberLiteral | IntegerLiteral | BooleanLiteral |
121
+ TemplateLiteral |
122
+ ConditionalExpression |
123
+ CallExpression |
124
+ VariableIdentifier;
125
+
126
+ export type UnaryOperator = '!' | '+' | '-';
127
+
128
+ export type EqualityOperator = '==' | '!=';
129
+
130
+ export type CompareOperator = '>' | '>=' | '<' | '<=';
131
+
132
+ export type SumOperator = '+' | '-';
133
+
134
+ export type FactorOperator = '/' | '*' | '%';
135
+
136
+ export type LogicalOperator = '&&' | '||';
137
+
138
+ export interface BinaryExpression {
139
+ type: 'BinaryExpression',
140
+ operator: EqualityOperator | CompareOperator | SumOperator | FactorOperator;
141
+ left: Node;
142
+ right: Node;
143
+ }
144
+
145
+ export interface LogicalExpression {
146
+ type: 'LogicalExpression',
147
+ operator: LogicalOperator;
148
+ left: Node;
149
+ right: Node;
150
+ }
151
+
152
+ export interface StringLiteral {
153
+ type: 'StringLiteral';
154
+ value: string;
155
+ }
156
+
157
+ export interface TemplateLiteral {
158
+ type: 'TemplateLiteral';
159
+ quasis: StringLiteral[];
160
+ expressions: Node[];
161
+ }
162
+
163
+ export interface NumberLiteral {
164
+ type: 'NumberLiteral';
165
+ value: number;
166
+ }
167
+
168
+ export interface IntegerLiteral {
169
+ type: 'IntegerLiteral';
170
+ value: number | bigint;
171
+ }
172
+
173
+ export interface BooleanLiteral {
174
+ type: 'BooleanLiteral';
175
+ value: boolean;
176
+ }
177
+
178
+ export interface ConditionalExpression {
179
+ type: 'ConditionalExpression';
180
+ test: Node;
181
+ consequent: Node;
182
+ alternate: Node;
183
+ }
184
+
185
+ export interface Identifier {
186
+ type: 'Identifier';
187
+ name: string;
188
+ }
189
+
190
+ export interface VariableIdentifier {
191
+ type: 'Variable';
192
+ id: Identifier;
193
+ }
194
+
195
+ export interface UnaryExpression {
196
+ type: 'UnaryExpression';
197
+ operator: UnaryOperator;
198
+ argument: Node;
199
+ }
200
+
201
+ export interface CallExpression {
202
+ type: 'CallExpression';
203
+ callee: Identifier;
204
+ arguments: Node[];
205
+ }
206
+
207
+ export function parseExpression(expr: string, opts?: {
208
+ type?: 'exact' | 'json';
209
+ }): Node;
210
+
211
+ export function walkExpression(ast: Node, visitors: {
212
+ [Type in Node['type']]?: (node: Extract<Node, { type: Type }>) => void;
213
+ }): void;
@@ -138,14 +138,11 @@ export type StatCallback = (details: {
138
138
  export type CustomActionCallback = (action: Action & { url: string }) => void;
139
139
 
140
140
  export type ComponentCallback = (details: {
141
- type: 'mount';
141
+ type: 'mount' | 'update' | 'destroy';
142
142
  node: HTMLElement;
143
143
  json: DivBase;
144
144
  origJson: DivBase | undefined;
145
145
  templateContext: TemplateContext;
146
- } | {
147
- type: 'destroy';
148
- node: HTMLElement;
149
146
  }) => void;
150
147
 
151
148
  export interface WrappedError extends Error {