@divkitframework/divkit 28.3.0 → 28.4.0-canary-e47c2ef9d22ab2eb691bf9f62e8843880b8aad07
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/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/variables.d.ts +28 -16
package/package.json
CHANGED
package/typings/variables.d.ts
CHANGED
|
@@ -2,34 +2,46 @@
|
|
|
2
2
|
|
|
3
3
|
import type { Subscriber, Unsubscriber } from 'svelte/store';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export type VariableType = 'string' | 'number' | 'integer' | 'boolean' | 'color' | 'url' | 'dict';
|
|
6
|
+
export type VariableValue = string | number | bigint | boolean | null | undefined | object;
|
|
7
|
+
|
|
8
|
+
export declare class Variable<ValueType = any, TypeName = VariableType> {
|
|
9
|
+
constructor(name: string, value: ValueType);
|
|
6
10
|
getName(): string;
|
|
7
|
-
subscribe(cb: Subscriber<
|
|
11
|
+
subscribe(cb: Subscriber<ValueType>): Unsubscriber;
|
|
8
12
|
set(val: string): void;
|
|
9
|
-
setValue(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
getType(): string;
|
|
13
|
+
setValue(val: ValueType): void;
|
|
14
|
+
getValue(): ValueType;
|
|
15
|
+
getType(): TypeName;
|
|
13
16
|
}
|
|
14
17
|
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
18
|
+
export declare class StringVariable extends Variable<string, 'string'> {}
|
|
19
|
+
export declare class IntegerVariable extends Variable<number | bigint, 'integer'> {}
|
|
20
|
+
export declare class NumberVariable extends Variable<number, 'number'> {}
|
|
21
|
+
export declare class BooleanVariable extends Variable<number, 'boolean'> {}
|
|
22
|
+
export declare class ColorVariable extends Variable<string, 'color'> {}
|
|
23
|
+
export declare class UrlVariable extends Variable<string, 'url'> {}
|
|
24
|
+
export declare class DictVariable extends Variable<object, 'dict'> {}
|
|
25
|
+
|
|
26
|
+
declare const TYPE_TO_CLASS: {
|
|
27
|
+
string: typeof StringVariable;
|
|
28
|
+
number: typeof NumberVariable;
|
|
29
|
+
integer: typeof IntegerVariable;
|
|
30
|
+
boolean: typeof BooleanVariable;
|
|
31
|
+
color: typeof ColorVariable;
|
|
32
|
+
url: typeof UrlVariable;
|
|
33
|
+
dict: typeof DictVariable;
|
|
34
|
+
};
|
|
22
35
|
|
|
23
36
|
export type AnyVariable = StringVariable | NumberVariable | IntegerVariable |
|
|
24
37
|
BooleanVariable | ColorVariable | UrlVariable | DictVariable;
|
|
25
38
|
|
|
26
|
-
export type VariableType = 'string' | 'number' | 'integer' | 'boolean' | 'color' | 'url' | 'dict';
|
|
27
|
-
|
|
28
39
|
export interface GlobalVariablesController {
|
|
29
40
|
setVariable(variable: AnyVariable): void;
|
|
30
41
|
getVariable(variableName: string): AnyVariable | undefined;
|
|
31
42
|
}
|
|
32
43
|
|
|
33
|
-
export function createVariable(variableName: string, type:
|
|
44
|
+
export function createVariable<T extends VariableType>(variableName: string, type: T, value: unknown):
|
|
45
|
+
InstanceType<typeof TYPE_TO_CLASS[T]>;
|
|
34
46
|
|
|
35
47
|
export function createGlobalVariablesController(): GlobalVariablesController;
|