@divkitframework/divkit 29.14.0 → 30.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@divkitframework/divkit",
3
- "version": "29.14.0",
3
+ "version": "30.0.0",
4
4
  "description": "DivKit for the web",
5
5
  "keywords": [
6
6
  "server-driven-ui",
@@ -12,6 +12,7 @@ import type {
12
12
  FetchInit
13
13
  } from './common';
14
14
  import type { CustomComponentDescription } from './custom';
15
+ import type { Store } from './store';
15
16
  import type { GlobalVariablesController } from './variables';
16
17
 
17
18
  export function render(opts: {
@@ -34,6 +35,7 @@ export function render(opts: {
34
35
  fetchInit?: FetchInit;
35
36
  tooltipRoot?: HTMLElement;
36
37
  customComponents?: Map<string, CustomComponentDescription> | undefined;
38
+ store?: Store;
37
39
  }): DivkitInstance;
38
40
 
39
41
  export { createVariable, createGlobalVariablesController } from './variables';
@@ -12,6 +12,7 @@ import type {
12
12
  FetchInit
13
13
  } from './common';
14
14
  import type { CustomComponentDescription } from './custom';
15
+ import type { Store } from './store';
15
16
  import type { GlobalVariablesController } from './variables';
16
17
 
17
18
  export function render(opts: {
@@ -33,6 +34,7 @@ export function render(opts: {
33
34
  fetchInit?: FetchInit;
34
35
  tooltipRoot?: HTMLElement;
35
36
  customComponents?: Map<string, CustomComponentDescription> | undefined;
37
+ store?: Store;
36
38
  }): DivkitInstance;
37
39
 
38
40
  export { createVariable, createGlobalVariablesController } from './variables';
@@ -199,7 +199,14 @@ export interface ActionBase {
199
199
  is_enabled?: BooleanInt;
200
200
  }
201
201
 
202
+ export interface ActionMenuItem {
203
+ text: string;
204
+ action?: Action;
205
+ actions?: Action[];
206
+ }
207
+
202
208
  export interface Action extends ActionBase {
209
+ menu_items?: ActionMenuItem[];
203
210
  log_url?: string;
204
211
  target?: string;
205
212
  }
@@ -268,6 +275,8 @@ export interface Customization {
268
275
  galleryRightClass?: string;
269
276
  pagerLeftClass?: string;
270
277
  pagerRightClass?: string;
278
+ menuPopupClass?: string;
279
+ menuItemClass?: string;
271
280
  }
272
281
 
273
282
  export interface DivExtensionContext {
@@ -6,6 +6,7 @@ import type {
6
6
  TypefaceProvider
7
7
  } from './common';
8
8
  import type { CustomComponentDescription } from './custom';
9
+ import type { Store } from './store';
9
10
 
10
11
  export function render(opts: {
11
12
  json: DivJson;
@@ -17,4 +18,5 @@ export function render(opts: {
17
18
  onError?: ErrorCallback;
18
19
  typefaceProvider?: TypefaceProvider;
19
20
  customComponents?: Map<string, CustomComponentDescription> | undefined;
21
+ store?: Store;
20
22
  }): string;
@@ -0,0 +1,27 @@
1
+ export type StoreTypes = 'string' | 'number' | 'boolean';
2
+
3
+ export interface Store {
4
+ /**
5
+ * Fetches primitive from the store
6
+ * @param name
7
+ * @param type Expected value tpye
8
+ */
9
+ getValue(
10
+ name: string,
11
+ type: StoreTypes
12
+ ): string | number | boolean | undefined;
13
+
14
+ /**
15
+ * Save primitive into the store
16
+ * @param name
17
+ * @param type Value type (for example, can be url)
18
+ * @param value
19
+ * @param lifetime Value lifetime in seconds
20
+ */
21
+ setValue(
22
+ name: string,
23
+ type: StoreTypes,
24
+ value: string | number | boolean,
25
+ lifetime: number
26
+ ): void;
27
+ }