@divkitframework/jsonbuilder 32.61.0 → 33.1.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 CHANGED
@@ -82,21 +82,6 @@ In the result `JSON.stringify(divCard(...))` will return JSON below:
82
82
  }
83
83
  ```
84
84
 
85
- ## Typesafe templates with compile-time validation
86
-
87
- You can use `templateHelper` helper function to achieve compile time template parameters validation. Type safety works only when you enable [strictNullChecks](https://www.typescriptlang.org/docs/handbook/compiler-options.html) in tsconfig.json
88
-
89
- ```typescript
90
- const block = template('header', {
91
- title: 'Some Title'
92
- });
93
-
94
- // using templateHelper for checking template parameters at compile-time
95
- const safeBlock = tHelper.header({
96
- title: 'Some Title'
97
- });
98
- ```
99
-
100
85
  ## Validity guarantees
101
86
 
102
87
  While developing cards you need to make sure that:
@@ -730,7 +730,6 @@ class DivGallery {
730
730
  this.functions = props === null || props === void 0 ? void 0 : props.functions;
731
731
  this.height = props === null || props === void 0 ? void 0 : props.height;
732
732
  this.id = props === null || props === void 0 ? void 0 : props.id;
733
- this.infinite_scroll = props === null || props === void 0 ? void 0 : props.infinite_scroll;
734
733
  this.item_builder = props === null || props === void 0 ? void 0 : props.item_builder;
735
734
  this.item_spacing = props === null || props === void 0 ? void 0 : props.item_spacing;
736
735
  this.items = props === null || props === void 0 ? void 0 : props.items;
@@ -768,58 +767,58 @@ class DivGallery {
768
767
  class DivGifImage {
769
768
  constructor(props) {
770
769
  this.type = 'gif';
771
- this.accessibility = props.accessibility;
772
- this.action = props.action;
773
- this.action_animation = props.action_animation;
774
- this.actions = props.actions;
775
- this.alignment_horizontal = props.alignment_horizontal;
776
- this.alignment_vertical = props.alignment_vertical;
777
- this.alpha = props.alpha;
778
- this.animators = props.animators;
779
- this.aspect = props.aspect;
780
- this.background = props.background;
781
- this.border = props.border;
782
- this.capture_focus_on_action = props.capture_focus_on_action;
783
- this.column_span = props.column_span;
784
- this.content_alignment_horizontal = props.content_alignment_horizontal;
785
- this.content_alignment_vertical = props.content_alignment_vertical;
786
- this.disappear_actions = props.disappear_actions;
787
- this.doubletap_actions = props.doubletap_actions;
788
- this.extensions = props.extensions;
789
- this.focus = props.focus;
790
- this.functions = props.functions;
791
- this.gif_url = props.gif_url;
792
- this.height = props.height;
793
- this.hover_end_actions = props.hover_end_actions;
794
- this.hover_start_actions = props.hover_start_actions;
795
- this.id = props.id;
796
- this.layout_provider = props.layout_provider;
797
- this.longtap_actions = props.longtap_actions;
798
- this.margins = props.margins;
799
- this.paddings = props.paddings;
800
- this.placeholder_color = props.placeholder_color;
801
- this.preload_required = props.preload_required;
802
- this.press_end_actions = props.press_end_actions;
803
- this.press_start_actions = props.press_start_actions;
804
- this.preview = props.preview;
805
- this.preview_url = props.preview_url;
806
- this.reuse_id = props.reuse_id;
807
- this.row_span = props.row_span;
808
- this.scale = props.scale;
809
- this.selected_actions = props.selected_actions;
810
- this.tooltips = props.tooltips;
811
- this.transform = props.transform;
812
- this.transformations = props.transformations;
813
- this.transition_change = props.transition_change;
814
- this.transition_in = props.transition_in;
815
- this.transition_out = props.transition_out;
816
- this.transition_triggers = props.transition_triggers;
817
- this.variable_triggers = props.variable_triggers;
818
- this.variables = props.variables;
819
- this.visibility = props.visibility;
820
- this.visibility_action = props.visibility_action;
821
- this.visibility_actions = props.visibility_actions;
822
- this.width = props.width;
770
+ this.accessibility = props === null || props === void 0 ? void 0 : props.accessibility;
771
+ this.action = props === null || props === void 0 ? void 0 : props.action;
772
+ this.action_animation = props === null || props === void 0 ? void 0 : props.action_animation;
773
+ this.actions = props === null || props === void 0 ? void 0 : props.actions;
774
+ this.alignment_horizontal = props === null || props === void 0 ? void 0 : props.alignment_horizontal;
775
+ this.alignment_vertical = props === null || props === void 0 ? void 0 : props.alignment_vertical;
776
+ this.alpha = props === null || props === void 0 ? void 0 : props.alpha;
777
+ this.animators = props === null || props === void 0 ? void 0 : props.animators;
778
+ this.aspect = props === null || props === void 0 ? void 0 : props.aspect;
779
+ this.background = props === null || props === void 0 ? void 0 : props.background;
780
+ this.border = props === null || props === void 0 ? void 0 : props.border;
781
+ this.capture_focus_on_action = props === null || props === void 0 ? void 0 : props.capture_focus_on_action;
782
+ this.column_span = props === null || props === void 0 ? void 0 : props.column_span;
783
+ this.content_alignment_horizontal = props === null || props === void 0 ? void 0 : props.content_alignment_horizontal;
784
+ this.content_alignment_vertical = props === null || props === void 0 ? void 0 : props.content_alignment_vertical;
785
+ this.disappear_actions = props === null || props === void 0 ? void 0 : props.disappear_actions;
786
+ this.doubletap_actions = props === null || props === void 0 ? void 0 : props.doubletap_actions;
787
+ this.extensions = props === null || props === void 0 ? void 0 : props.extensions;
788
+ this.focus = props === null || props === void 0 ? void 0 : props.focus;
789
+ this.functions = props === null || props === void 0 ? void 0 : props.functions;
790
+ this.gif_url = props === null || props === void 0 ? void 0 : props.gif_url;
791
+ this.height = props === null || props === void 0 ? void 0 : props.height;
792
+ this.hover_end_actions = props === null || props === void 0 ? void 0 : props.hover_end_actions;
793
+ this.hover_start_actions = props === null || props === void 0 ? void 0 : props.hover_start_actions;
794
+ this.id = props === null || props === void 0 ? void 0 : props.id;
795
+ this.layout_provider = props === null || props === void 0 ? void 0 : props.layout_provider;
796
+ this.longtap_actions = props === null || props === void 0 ? void 0 : props.longtap_actions;
797
+ this.margins = props === null || props === void 0 ? void 0 : props.margins;
798
+ this.paddings = props === null || props === void 0 ? void 0 : props.paddings;
799
+ this.placeholder_color = props === null || props === void 0 ? void 0 : props.placeholder_color;
800
+ this.preload_required = props === null || props === void 0 ? void 0 : props.preload_required;
801
+ this.press_end_actions = props === null || props === void 0 ? void 0 : props.press_end_actions;
802
+ this.press_start_actions = props === null || props === void 0 ? void 0 : props.press_start_actions;
803
+ this.preview = props === null || props === void 0 ? void 0 : props.preview;
804
+ this.preview_url = props === null || props === void 0 ? void 0 : props.preview_url;
805
+ this.reuse_id = props === null || props === void 0 ? void 0 : props.reuse_id;
806
+ this.row_span = props === null || props === void 0 ? void 0 : props.row_span;
807
+ this.scale = props === null || props === void 0 ? void 0 : props.scale;
808
+ this.selected_actions = props === null || props === void 0 ? void 0 : props.selected_actions;
809
+ this.tooltips = props === null || props === void 0 ? void 0 : props.tooltips;
810
+ this.transform = props === null || props === void 0 ? void 0 : props.transform;
811
+ this.transformations = props === null || props === void 0 ? void 0 : props.transformations;
812
+ this.transition_change = props === null || props === void 0 ? void 0 : props.transition_change;
813
+ this.transition_in = props === null || props === void 0 ? void 0 : props.transition_in;
814
+ this.transition_out = props === null || props === void 0 ? void 0 : props.transition_out;
815
+ this.transition_triggers = props === null || props === void 0 ? void 0 : props.transition_triggers;
816
+ this.variable_triggers = props === null || props === void 0 ? void 0 : props.variable_triggers;
817
+ this.variables = props === null || props === void 0 ? void 0 : props.variables;
818
+ this.visibility = props === null || props === void 0 ? void 0 : props.visibility;
819
+ this.visibility_action = props === null || props === void 0 ? void 0 : props.visibility_action;
820
+ this.visibility_actions = props === null || props === void 0 ? void 0 : props.visibility_actions;
821
+ this.width = props === null || props === void 0 ? void 0 : props.width;
823
822
  }
824
823
  }
825
824
 
@@ -887,62 +886,62 @@ class DivGrid {
887
886
  class DivImage {
888
887
  constructor(props) {
889
888
  this.type = 'image';
890
- this.accessibility = props.accessibility;
891
- this.action = props.action;
892
- this.action_animation = props.action_animation;
893
- this.actions = props.actions;
894
- this.alignment_horizontal = props.alignment_horizontal;
895
- this.alignment_vertical = props.alignment_vertical;
896
- this.alpha = props.alpha;
897
- this.animators = props.animators;
898
- this.appearance_animation = props.appearance_animation;
899
- this.aspect = props.aspect;
900
- this.background = props.background;
901
- this.border = props.border;
902
- this.capture_focus_on_action = props.capture_focus_on_action;
903
- this.column_span = props.column_span;
904
- this.content_alignment_horizontal = props.content_alignment_horizontal;
905
- this.content_alignment_vertical = props.content_alignment_vertical;
906
- this.disappear_actions = props.disappear_actions;
907
- this.doubletap_actions = props.doubletap_actions;
908
- this.extensions = props.extensions;
909
- this.filters = props.filters;
910
- this.focus = props.focus;
911
- this.functions = props.functions;
912
- this.height = props.height;
913
- this.high_priority_preview_show = props.high_priority_preview_show;
914
- this.hover_end_actions = props.hover_end_actions;
915
- this.hover_start_actions = props.hover_start_actions;
916
- this.id = props.id;
917
- this.image_url = props.image_url;
918
- this.layout_provider = props.layout_provider;
919
- this.longtap_actions = props.longtap_actions;
920
- this.margins = props.margins;
921
- this.paddings = props.paddings;
922
- this.placeholder_color = props.placeholder_color;
923
- this.preload_required = props.preload_required;
924
- this.press_end_actions = props.press_end_actions;
925
- this.press_start_actions = props.press_start_actions;
926
- this.preview = props.preview;
927
- this.reuse_id = props.reuse_id;
928
- this.row_span = props.row_span;
929
- this.scale = props.scale;
930
- this.selected_actions = props.selected_actions;
931
- this.tint_color = props.tint_color;
932
- this.tint_mode = props.tint_mode;
933
- this.tooltips = props.tooltips;
934
- this.transform = props.transform;
935
- this.transformations = props.transformations;
936
- this.transition_change = props.transition_change;
937
- this.transition_in = props.transition_in;
938
- this.transition_out = props.transition_out;
939
- this.transition_triggers = props.transition_triggers;
940
- this.variable_triggers = props.variable_triggers;
941
- this.variables = props.variables;
942
- this.visibility = props.visibility;
943
- this.visibility_action = props.visibility_action;
944
- this.visibility_actions = props.visibility_actions;
945
- this.width = props.width;
889
+ this.accessibility = props === null || props === void 0 ? void 0 : props.accessibility;
890
+ this.action = props === null || props === void 0 ? void 0 : props.action;
891
+ this.action_animation = props === null || props === void 0 ? void 0 : props.action_animation;
892
+ this.actions = props === null || props === void 0 ? void 0 : props.actions;
893
+ this.alignment_horizontal = props === null || props === void 0 ? void 0 : props.alignment_horizontal;
894
+ this.alignment_vertical = props === null || props === void 0 ? void 0 : props.alignment_vertical;
895
+ this.alpha = props === null || props === void 0 ? void 0 : props.alpha;
896
+ this.animators = props === null || props === void 0 ? void 0 : props.animators;
897
+ this.appearance_animation = props === null || props === void 0 ? void 0 : props.appearance_animation;
898
+ this.aspect = props === null || props === void 0 ? void 0 : props.aspect;
899
+ this.background = props === null || props === void 0 ? void 0 : props.background;
900
+ this.border = props === null || props === void 0 ? void 0 : props.border;
901
+ this.capture_focus_on_action = props === null || props === void 0 ? void 0 : props.capture_focus_on_action;
902
+ this.column_span = props === null || props === void 0 ? void 0 : props.column_span;
903
+ this.content_alignment_horizontal = props === null || props === void 0 ? void 0 : props.content_alignment_horizontal;
904
+ this.content_alignment_vertical = props === null || props === void 0 ? void 0 : props.content_alignment_vertical;
905
+ this.disappear_actions = props === null || props === void 0 ? void 0 : props.disappear_actions;
906
+ this.doubletap_actions = props === null || props === void 0 ? void 0 : props.doubletap_actions;
907
+ this.extensions = props === null || props === void 0 ? void 0 : props.extensions;
908
+ this.filters = props === null || props === void 0 ? void 0 : props.filters;
909
+ this.focus = props === null || props === void 0 ? void 0 : props.focus;
910
+ this.functions = props === null || props === void 0 ? void 0 : props.functions;
911
+ this.height = props === null || props === void 0 ? void 0 : props.height;
912
+ this.high_priority_preview_show = props === null || props === void 0 ? void 0 : props.high_priority_preview_show;
913
+ this.hover_end_actions = props === null || props === void 0 ? void 0 : props.hover_end_actions;
914
+ this.hover_start_actions = props === null || props === void 0 ? void 0 : props.hover_start_actions;
915
+ this.id = props === null || props === void 0 ? void 0 : props.id;
916
+ this.image_url = props === null || props === void 0 ? void 0 : props.image_url;
917
+ this.layout_provider = props === null || props === void 0 ? void 0 : props.layout_provider;
918
+ this.longtap_actions = props === null || props === void 0 ? void 0 : props.longtap_actions;
919
+ this.margins = props === null || props === void 0 ? void 0 : props.margins;
920
+ this.paddings = props === null || props === void 0 ? void 0 : props.paddings;
921
+ this.placeholder_color = props === null || props === void 0 ? void 0 : props.placeholder_color;
922
+ this.preload_required = props === null || props === void 0 ? void 0 : props.preload_required;
923
+ this.press_end_actions = props === null || props === void 0 ? void 0 : props.press_end_actions;
924
+ this.press_start_actions = props === null || props === void 0 ? void 0 : props.press_start_actions;
925
+ this.preview = props === null || props === void 0 ? void 0 : props.preview;
926
+ this.reuse_id = props === null || props === void 0 ? void 0 : props.reuse_id;
927
+ this.row_span = props === null || props === void 0 ? void 0 : props.row_span;
928
+ this.scale = props === null || props === void 0 ? void 0 : props.scale;
929
+ this.selected_actions = props === null || props === void 0 ? void 0 : props.selected_actions;
930
+ this.tint_color = props === null || props === void 0 ? void 0 : props.tint_color;
931
+ this.tint_mode = props === null || props === void 0 ? void 0 : props.tint_mode;
932
+ this.tooltips = props === null || props === void 0 ? void 0 : props.tooltips;
933
+ this.transform = props === null || props === void 0 ? void 0 : props.transform;
934
+ this.transformations = props === null || props === void 0 ? void 0 : props.transformations;
935
+ this.transition_change = props === null || props === void 0 ? void 0 : props.transition_change;
936
+ this.transition_in = props === null || props === void 0 ? void 0 : props.transition_in;
937
+ this.transition_out = props === null || props === void 0 ? void 0 : props.transition_out;
938
+ this.transition_triggers = props === null || props === void 0 ? void 0 : props.transition_triggers;
939
+ this.variable_triggers = props === null || props === void 0 ? void 0 : props.variable_triggers;
940
+ this.variables = props === null || props === void 0 ? void 0 : props.variables;
941
+ this.visibility = props === null || props === void 0 ? void 0 : props.visibility;
942
+ this.visibility_action = props === null || props === void 0 ? void 0 : props.visibility_action;
943
+ this.visibility_actions = props === null || props === void 0 ? void 0 : props.visibility_actions;
944
+ this.width = props === null || props === void 0 ? void 0 : props.width;
946
945
  }
947
946
  }
948
947
 
@@ -1038,6 +1037,7 @@ class DivInput {
1038
1037
  this.accessibility = props.accessibility;
1039
1038
  this.alignment_horizontal = props.alignment_horizontal;
1040
1039
  this.alignment_vertical = props.alignment_vertical;
1040
+ this.allow_suggestions_bar = props.allow_suggestions_bar;
1041
1041
  this.alpha = props.alpha;
1042
1042
  this.animators = props.animators;
1043
1043
  this.autocapitalization = props.autocapitalization;
@@ -1058,7 +1058,6 @@ class DivInput {
1058
1058
  this.font_weight_value = props.font_weight_value;
1059
1059
  this.functions = props.functions;
1060
1060
  this.height = props.height;
1061
- this.hide_suggestions_bar = props.hide_suggestions_bar;
1062
1061
  this.highlight_color = props.highlight_color;
1063
1062
  this.hint_color = props.hint_color;
1064
1063
  this.hint_text = props.hint_text;
@@ -1303,6 +1302,7 @@ class DivPager {
1303
1302
  this.layout_mode = props.layout_mode;
1304
1303
  this.layout_provider = props.layout_provider;
1305
1304
  this.margins = props.margins;
1305
+ this.multi_page_scroll = props.multi_page_scroll;
1306
1306
  this.orientation = props.orientation;
1307
1307
  this.paddings = props.paddings;
1308
1308
  this.page_transformation = props.page_transformation;
@@ -1950,6 +1950,7 @@ class DivText {
1950
1950
  this.transition_out = props.transition_out;
1951
1951
  this.transition_triggers = props.transition_triggers;
1952
1952
  this.truncate = props.truncate;
1953
+ this.truncate_policy = props.truncate_policy;
1953
1954
  this.underline = props.underline;
1954
1955
  this.variable_triggers = props.variable_triggers;
1955
1956
  this.variables = props.variables;
@@ -2357,7 +2358,6 @@ function copyTemplates(templates) {
2357
2358
  return copy;
2358
2359
  }
2359
2360
 
2360
- /* eslint-disable @typescript-eslint/ban-types */
2361
2361
  class TemplatePropertyReference {
2362
2362
  constructor(name) {
2363
2363
  this.templatePropertyName = name;
@@ -2419,7 +2419,6 @@ function divCard(templates, card) {
2419
2419
  return new Card(templates, card);
2420
2420
  }
2421
2421
 
2422
- /* eslint-disable @typescript-eslint/ban-types */
2423
2422
  /**
2424
2423
  * Creates typed functions for templates instance construction
2425
2424
  * @param templates templates map of the form { template_name: template }
@@ -2528,6 +2527,7 @@ function thelperWithMemo(options) {
2528
2527
  get(_, templateName) {
2529
2528
  const templateRenamed = (options === null || options === void 0 ? void 0 : options.customName) ? options.customName(templateName) : templateName;
2530
2529
  used.add(templateName);
2530
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2531
2531
  return (props) => (Object.assign(Object.assign({}, props), { type: templateRenamed }));
2532
2532
  },
2533
2533
  };
@@ -2554,6 +2554,7 @@ function rewriteNames(templates, rename, resolvedNames = {}) {
2554
2554
  resolvedNames = runResolveDeps(templates, ({ name, template, depsResolved }) => {
2555
2555
  treeWalkDFS(template, (node) => {
2556
2556
  if (node instanceof TemplateBlock) {
2557
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2557
2558
  node.type = depsResolved[node.type];
2558
2559
  }
2559
2560
  });
@@ -2567,13 +2568,14 @@ function rewriteRefsTemplate(template) {
2567
2568
  while (stack.length > 0) {
2568
2569
  const obj = stack.pop();
2569
2570
  if (obj && typeof obj === 'object') {
2570
- for (const key in obj) {
2571
- const objChild = obj[key];
2571
+ const castedObj = obj;
2572
+ for (const key in castedObj) {
2573
+ const objChild = castedObj[key];
2572
2574
  if (objChild && typeof objChild === 'object') {
2573
2575
  if (objChild instanceof TemplatePropertyReference) {
2574
- obj[key] = undefined;
2576
+ castedObj[key] = undefined;
2575
2577
  if (objChild.templatePropertyName !== key) {
2576
- obj['$' + key] = objChild.templatePropertyName;
2578
+ castedObj['$' + key] = objChild.templatePropertyName;
2577
2579
  }
2578
2580
  }
2579
2581
  else {