@divkitframework/divkit 28.13.0 → 29.0.0
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 +21 -3
- package/dist/browser/client-devtool.js +1 -1
- package/dist/browser/client-devtool.js.map +1 -1
- package/dist/browser/client-hydratable.js +1 -1
- package/dist/browser/client-hydratable.js.map +1 -1
- package/dist/browser/client.js +1 -1
- package/dist/browser/client.js.map +1 -1
- package/dist/client-devtool.js +1 -1
- package/dist/client-devtool.js.map +1 -1
- package/dist/client-hydratable.js +1 -1
- package/dist/client-hydratable.js.map +1 -1
- package/dist/client.css +1 -1
- package/dist/client.css.map +1 -1
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/esm/client-devtool.mjs +1 -1
- package/dist/esm/client-devtool.mjs.map +1 -1
- package/dist/esm/client-hydratable.mjs +1 -1
- package/dist/esm/client-hydratable.mjs.map +1 -1
- package/dist/esm/client.mjs +1 -1
- package/dist/esm/client.mjs.map +1 -1
- package/dist/esm/server.mjs +1 -1
- package/dist/esm/server.mjs.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
- package/typings/client-devtool.d.ts +1 -0
- package/typings/common.d.ts +6 -4
- package/typings/variables.d.ts +33 -17
package/package.json
CHANGED
|
@@ -18,6 +18,7 @@ import type { CustomComponentDescription } from './custom';
|
|
|
18
18
|
|
|
19
19
|
export interface DivkitDebugInstance extends DivkitInstance {
|
|
20
20
|
getDebugVariables(): Map<string, Variable>;
|
|
21
|
+
getDebugAllVariables(): Map<string, Variable>;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
export function render(opts: {
|
package/typings/common.d.ts
CHANGED
|
@@ -228,14 +228,11 @@ export type StatCallback = (details: {
|
|
|
228
228
|
export type CustomActionCallback = (action: Action & { url: string }) => void;
|
|
229
229
|
|
|
230
230
|
export type ComponentCallback = (details: {
|
|
231
|
-
type: 'mount';
|
|
231
|
+
type: 'mount' | 'update' | 'destroy';
|
|
232
232
|
node: HTMLElement;
|
|
233
233
|
json: DivBase;
|
|
234
234
|
origJson: DivBase | undefined;
|
|
235
235
|
templateContext: TemplateContext;
|
|
236
|
-
} | {
|
|
237
|
-
type: 'destroy';
|
|
238
|
-
node: HTMLElement;
|
|
239
236
|
}) => void;
|
|
240
237
|
|
|
241
238
|
export interface WrappedError extends Error {
|
|
@@ -256,7 +253,10 @@ export type FetchInit = RequestInit | ((url: string) => RequestInit);
|
|
|
256
253
|
export interface DivkitInstance {
|
|
257
254
|
$destroy(): void;
|
|
258
255
|
execAction(action: Action | VisibilityAction): void;
|
|
256
|
+
/** @deprecated */
|
|
259
257
|
setTheme(theme: Theme): void;
|
|
258
|
+
/** Experimental */
|
|
259
|
+
setData(json: DivJson): void;
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
export type Platform = 'desktop' | 'touch' | 'auto';
|
|
@@ -266,6 +266,8 @@ export type Theme = 'system' | 'light' | 'dark';
|
|
|
266
266
|
export interface Customization {
|
|
267
267
|
galleryLeftClass?: string;
|
|
268
268
|
galleryRightClass?: string;
|
|
269
|
+
pagerLeftClass?: string;
|
|
270
|
+
pagerRightClass?: string;
|
|
269
271
|
}
|
|
270
272
|
|
|
271
273
|
export interface DivExtensionContext {
|
package/typings/variables.d.ts
CHANGED
|
@@ -1,35 +1,51 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-empty-interface */
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type Subscriber<T> = (value: T) => void;
|
|
4
|
+
type Unsubscriber = () => void;
|
|
4
5
|
|
|
5
|
-
export
|
|
6
|
+
export type VariableType = 'string' | 'number' | 'integer' | 'boolean' | 'color' | 'url' | 'dict' | 'array';
|
|
7
|
+
export type VariableValue = string | number | bigint | boolean | null | undefined | object | unknown[];
|
|
8
|
+
|
|
9
|
+
export declare class Variable<ValueType = any, TypeName = VariableType> {
|
|
10
|
+
constructor(name: string, value: ValueType);
|
|
6
11
|
getName(): string;
|
|
7
|
-
subscribe(cb: Subscriber<
|
|
12
|
+
subscribe(cb: Subscriber<ValueType>): Unsubscriber;
|
|
8
13
|
set(val: string): void;
|
|
9
|
-
setValue(
|
|
10
|
-
getValue():
|
|
11
|
-
getType():
|
|
14
|
+
setValue(val: ValueType): void;
|
|
15
|
+
getValue(): ValueType;
|
|
16
|
+
getType(): TypeName;
|
|
12
17
|
}
|
|
13
18
|
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
19
|
+
export declare class StringVariable extends Variable<string, 'string'> {}
|
|
20
|
+
export declare class IntegerVariable extends Variable<number | bigint, 'integer'> {}
|
|
21
|
+
export declare class NumberVariable extends Variable<number, 'number'> {}
|
|
22
|
+
export declare class BooleanVariable extends Variable<number, 'boolean'> {}
|
|
23
|
+
export declare class ColorVariable extends Variable<string, 'color'> {}
|
|
24
|
+
export declare class UrlVariable extends Variable<string, 'url'> {}
|
|
25
|
+
export declare class DictVariable extends Variable<object, 'dict'> {}
|
|
26
|
+
export declare class ArrayVariable extends Variable<unknown[], 'array'> {}
|
|
27
|
+
|
|
28
|
+
declare const TYPE_TO_CLASS: {
|
|
29
|
+
string: typeof StringVariable;
|
|
30
|
+
number: typeof NumberVariable;
|
|
31
|
+
integer: typeof IntegerVariable;
|
|
32
|
+
boolean: typeof BooleanVariable;
|
|
33
|
+
color: typeof ColorVariable;
|
|
34
|
+
url: typeof UrlVariable;
|
|
35
|
+
dict: typeof DictVariable;
|
|
36
|
+
array: typeof ArrayVariable;
|
|
37
|
+
};
|
|
22
38
|
|
|
23
39
|
export type AnyVariable = StringVariable | NumberVariable | IntegerVariable |
|
|
24
40
|
BooleanVariable | ColorVariable | UrlVariable | DictVariable | ArrayVariable;
|
|
25
41
|
|
|
26
|
-
export type VariableType = 'string' | 'number' | 'integer' | 'boolean' | 'color' | 'url' | 'dict' | 'array';
|
|
27
|
-
|
|
28
42
|
export interface GlobalVariablesController {
|
|
29
43
|
setVariable(variable: AnyVariable): void;
|
|
30
44
|
getVariable(variableName: string): AnyVariable | undefined;
|
|
45
|
+
list(): IterableIterator<Variable>;
|
|
31
46
|
}
|
|
32
47
|
|
|
33
|
-
export function createVariable(variableName: string, type:
|
|
48
|
+
export function createVariable<T extends VariableType>(variableName: string, type: T, value: unknown):
|
|
49
|
+
InstanceType<typeof TYPE_TO_CLASS[T]>;
|
|
34
50
|
|
|
35
51
|
export function createGlobalVariablesController(): GlobalVariablesController;
|