vgapp 1.5.7 → 1.5.8

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.
Files changed (109) hide show
  1. package/app/langs/en/buttons.json +17 -17
  2. package/app/langs/en/messages.json +36 -36
  3. package/app/langs/ru/buttons.json +17 -17
  4. package/app/langs/ru/messages.json +1 -1
  5. package/app/modules/vgalert/js/vgalert.js +7 -7
  6. package/app/modules/vgalert/scss/_variables.scss +16 -16
  7. package/app/modules/vgcollapse/scss/_variables.scss +7 -7
  8. package/app/modules/vgcollapse/scss/vgcollapse.scss +5 -5
  9. package/app/modules/vgdropdown/scss/_variables.scss +14 -14
  10. package/app/modules/vgdropdown/scss/vgdropdown.scss +5 -5
  11. package/app/modules/vgfilepreview/js/i18n.js +56 -56
  12. package/app/modules/vgfilepreview/js/renderers/image-modal.js +145 -145
  13. package/app/modules/vgfilepreview/js/renderers/image.js +92 -92
  14. package/app/modules/vgfilepreview/js/renderers/index.js +19 -19
  15. package/app/modules/vgfilepreview/js/renderers/office-modal.js +168 -168
  16. package/app/modules/vgfilepreview/js/renderers/office.js +79 -79
  17. package/app/modules/vgfilepreview/js/renderers/pdf-modal.js +260 -260
  18. package/app/modules/vgfilepreview/js/renderers/pdf.js +76 -76
  19. package/app/modules/vgfilepreview/js/renderers/playlist.js +71 -71
  20. package/app/modules/vgfilepreview/js/renderers/text-modal.js +343 -343
  21. package/app/modules/vgfilepreview/js/renderers/text.js +83 -83
  22. package/app/modules/vgfilepreview/js/renderers/zip-modal.js +522 -522
  23. package/app/modules/vgfilepreview/js/renderers/zip.js +89 -89
  24. package/app/modules/vgfilepreview/readme.md +68 -68
  25. package/app/modules/vgfiles/js/base.js +198 -198
  26. package/app/modules/vgfiles/js/droppable.js +17 -17
  27. package/app/modules/vgfiles/js/render.js +153 -153
  28. package/app/modules/vgfiles/js/sortable.js +52 -52
  29. package/app/modules/vgfiles/js/vgfiles.js +43 -43
  30. package/app/modules/vgfiles/readme.md +123 -123
  31. package/app/modules/vgfiles/scss/_mixins.scss +13 -13
  32. package/app/modules/vgfiles/scss/_variables.scss +10 -10
  33. package/app/modules/vgfiles/scss/vgfiles.scss +28 -28
  34. package/app/modules/vgformsender/js/hideshowpass.js +22 -22
  35. package/app/modules/vgformsender/readme.md +1 -1
  36. package/app/modules/vgformsender/scss/_variables.scss +5 -5
  37. package/app/modules/vgformsender/scss/vgformsender.scss +42 -42
  38. package/app/modules/vglawcookie/js/vglawcookie.js +19 -19
  39. package/app/modules/vglawcookie/scss/_variables.scss +13 -13
  40. package/app/modules/vglawcookie/scss/vglawcookie.scss +5 -5
  41. package/app/modules/vgmodal/js/vgmodal.interaction.js +216 -216
  42. package/app/modules/vgmodal/js/vgmodal.js +9 -9
  43. package/app/modules/vgmodal/js/vgmodal.minimized.js +227 -227
  44. package/app/modules/vgmodal/scss/_variables.scss +17 -17
  45. package/app/modules/vgmodal/scss/vgmodal.scss +77 -77
  46. package/app/modules/vgnav/js/vgnav.js +62 -62
  47. package/app/modules/vgnav/scss/_breakpoints.scss +36 -36
  48. package/app/modules/vgnav/scss/_hamburger.scss +5 -5
  49. package/app/modules/vgnav/scss/_placement.scss +5 -5
  50. package/app/modules/vgnav/scss/_toggle.scss +5 -5
  51. package/app/modules/vgnav/scss/_variables.scss +26 -26
  52. package/app/modules/vgnav/scss/vgnav.scss +41 -41
  53. package/app/modules/vgnestable/README.md +39 -39
  54. package/app/modules/vgrangeslider/js/skins.js +8 -8
  55. package/app/modules/vgrangeslider/js/vgrangeslider.js +29 -29
  56. package/app/modules/vgrangeslider/scss/_variables.scss +55 -55
  57. package/app/modules/vgrangeslider/scss/vgrangeslider.scss +239 -239
  58. package/app/modules/vgrollup/js/vgrollup.js +15 -15
  59. package/app/modules/vgrollup/scss/_variables.scss +15 -15
  60. package/app/modules/vgrollup/scss/vgrollup.scss +6 -6
  61. package/app/modules/vgselect/js/handlers.js +6 -6
  62. package/app/modules/vgselect/js/vgselect.js +167 -123
  63. package/app/modules/vgselect/readme.md +11 -11
  64. package/app/modules/vgselect/scss/_variables.scss +51 -51
  65. package/app/modules/vgselect/scss/vgselect.scss +1 -1
  66. package/app/modules/vgsidebar/js/vgsidebar.js +21 -21
  67. package/app/modules/vgsidebar/scss/_variables.scss +10 -10
  68. package/app/modules/vgsidebar/scss/vgsidebar.scss +5 -5
  69. package/app/modules/vgspy/js/vgspy.js +43 -43
  70. package/app/modules/vgtable/js/_filters.js +10 -6
  71. package/app/modules/vgtable/js/_options.js +16 -16
  72. package/app/modules/vgtable/js/_pagination.js +118 -118
  73. package/app/modules/vgtable/js/_responsive.js +79 -79
  74. package/app/modules/vgtable/js/_sticky-header.js +349 -280
  75. package/app/modules/vgtable/js/vgtable.js +98 -98
  76. package/app/modules/vgtable/scss/_sorting.scss +6 -6
  77. package/app/modules/vgtable/scss/_sticky-header.scss +31 -31
  78. package/app/modules/vgtable/scss/_variables.scss +6 -4
  79. package/app/modules/vgtable/scss/vgtable.scss +8 -4
  80. package/app/modules/vgtabs/js/vgtabs.js +91 -91
  81. package/app/modules/vgtabs/scss/_variables.scss +23 -23
  82. package/app/modules/vgtabs/scss/vgtabs.scss +5 -5
  83. package/app/modules/vgtoast/js/vgtoast.js +4 -4
  84. package/app/modules/vgtoast/scss/_variables.scss +13 -13
  85. package/app/modules/vgtoast/scss/vgtoast.scss +5 -5
  86. package/app/modules/vgtooltip/js/vgtooltip.js +127 -127
  87. package/app/modules/vgtooltip/scss/_variables.scss +10 -10
  88. package/app/modules/vgtooltip/scss/vgtooltip.scss +5 -5
  89. package/app/utils/js/components/audio-metadata.js +240 -240
  90. package/app/utils/js/components/backdrop.js +116 -116
  91. package/app/utils/js/components/file-icon.js +7 -7
  92. package/app/utils/js/components/file-preview.js +304 -304
  93. package/app/utils/js/components/responsive.js +165 -165
  94. package/app/utils/js/components/sanitize.js +150 -150
  95. package/app/utils/js/components/video-metadata.js +140 -140
  96. package/app/utils/scss/_backdrop.scss +5 -5
  97. package/app/utils/scss/_theme-default.scss +12 -12
  98. package/app/utils/scss/_theme.scss +7 -7
  99. package/app/utils/scss/default.scss +9 -9
  100. package/app/utils/scss/functions.scss +21 -21
  101. package/app/utils/scss/index.scss +4 -4
  102. package/app/utils/scss/mixin.scss +16 -16
  103. package/app/utils/scss/variables.scss +147 -147
  104. package/build/vgapp.css +1 -1
  105. package/build/vgapp.css.map +1 -1
  106. package/build/vgapp.js +1 -1
  107. package/build/vgapp.js.map +1 -1
  108. package/index.js +7 -7
  109. package/package.json +1 -1
@@ -7,22 +7,22 @@
7
7
  "agree": "Yeah, I agree",
8
8
  "cancel": "Cancel"
9
9
  },
10
- "filepreview": {
11
- "open_audio": "Open player",
12
- "open_image": "Open image",
13
- "open_text": "Open text",
14
- "open_video": "Open video",
15
- "open_archive": "Open archive",
16
- "open_pdf": "Open PDF",
17
- "open_office": "Open document",
18
- "download": "Download",
19
- "preview": "Preview",
20
- "prev": "Prev",
21
- "next": "Next",
22
- "zoom_in": "Zoom +",
23
- "zoom_out": "Zoom -"
24
- },
25
- "loadmore": {
10
+ "filepreview": {
11
+ "open_audio": "Open player",
12
+ "open_image": "Open image",
13
+ "open_text": "Open text",
14
+ "open_video": "Open video",
15
+ "open_archive": "Open archive",
16
+ "open_pdf": "Open PDF",
17
+ "open_office": "Open document",
18
+ "download": "Download",
19
+ "preview": "Preview",
20
+ "prev": "Prev",
21
+ "next": "Next",
22
+ "zoom_in": "Zoom +",
23
+ "zoom_out": "Zoom -"
24
+ },
25
+ "loadmore": {
26
26
  "send": "Uploading...",
27
27
  "show": "I'm showing you...",
28
28
  "text-ajax": "Upload more",
@@ -36,4 +36,4 @@
36
36
  "select": {
37
37
  "load-more": "Upload more"
38
38
  }
39
- }
39
+ }
@@ -25,42 +25,42 @@
25
25
  "description": "It will not be possible to return it",
26
26
  "drop-active": "Release to upload"
27
27
  },
28
- "filepreview": {
29
- "audio_title": "Audio file",
30
- "image_title": "Image preview",
31
- "image_thumbnail_alt": "Image thumbnail",
32
- "text_title": "Text preview",
33
- "video_title": "Video preview",
34
- "pdf_title": "PDF preview",
35
- "office_title": "Office preview",
36
- "archive_title": "Archive preview",
37
- "loading_text": "Loading...",
38
- "loading_archive": "Loading archive...",
39
- "loading_entry": "Loading entry...",
40
- "cannot_open_file": "Cannot open file",
41
- "cannot_open_archive": "Cannot open archive",
42
- "cannot_preview_entry": "Cannot preview entry",
43
- "office_fallback": "If embedded preview is unavailable, download the file.",
44
- "invalid_zip": "Invalid ZIP file",
45
- "central_directory_not_found": "Central directory not found",
46
- "archive_buffer_missing": "Archive buffer is missing",
47
- "entry_corrupted": "Archive entry is corrupted",
48
- "compression_not_supported": "Compression method is not supported",
49
- "deflate_not_supported": "Deflate decompression is not supported by the browser",
50
- "unknown_error": "Unknown error",
51
- "empty_file": "(empty file)",
52
- "archive_empty_unsupported": "Archive is empty or unsupported.",
53
- "archive_type_dir": "dir",
54
- "archive_type_file": "file",
55
- "archive_table_name": "Name",
56
- "archive_table_type": "Type",
57
- "archive_table_packed": "Packed",
58
- "archive_table_size": "Size",
59
- "archive_table_preview": "Preview",
60
- "pdf_page": "Page",
61
- "pdf_zoom": "Zoom"
62
- },
63
- "alert": {
28
+ "filepreview": {
29
+ "audio_title": "Audio file",
30
+ "image_title": "Image preview",
31
+ "image_thumbnail_alt": "Image thumbnail",
32
+ "text_title": "Text preview",
33
+ "video_title": "Video preview",
34
+ "pdf_title": "PDF preview",
35
+ "office_title": "Office preview",
36
+ "archive_title": "Archive preview",
37
+ "loading_text": "Loading...",
38
+ "loading_archive": "Loading archive...",
39
+ "loading_entry": "Loading entry...",
40
+ "cannot_open_file": "Cannot open file",
41
+ "cannot_open_archive": "Cannot open archive",
42
+ "cannot_preview_entry": "Cannot preview entry",
43
+ "office_fallback": "If embedded preview is unavailable, download the file.",
44
+ "invalid_zip": "Invalid ZIP file",
45
+ "central_directory_not_found": "Central directory not found",
46
+ "archive_buffer_missing": "Archive buffer is missing",
47
+ "entry_corrupted": "Archive entry is corrupted",
48
+ "compression_not_supported": "Compression method is not supported",
49
+ "deflate_not_supported": "Deflate decompression is not supported by the browser",
50
+ "unknown_error": "Unknown error",
51
+ "empty_file": "(empty file)",
52
+ "archive_empty_unsupported": "Archive is empty or unsupported.",
53
+ "archive_type_dir": "dir",
54
+ "archive_type_file": "file",
55
+ "archive_table_name": "Name",
56
+ "archive_table_type": "Type",
57
+ "archive_table_packed": "Packed",
58
+ "archive_table_size": "Size",
59
+ "archive_table_preview": "Preview",
60
+ "pdf_page": "Page",
61
+ "pdf_zoom": "Zoom"
62
+ },
63
+ "alert": {
64
64
  "title": "Default header",
65
65
  "description": "Description of the current action",
66
66
  "reason": "Alert already open"
@@ -7,22 +7,22 @@
7
7
  "agree": "Да",
8
8
  "cancel": "Нет"
9
9
  },
10
- "filepreview": {
11
- "open_audio": "\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u043f\u043b\u0435\u0435\u0440",
12
- "open_image": "\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435",
13
- "open_text": "\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0442\u0435\u043a\u0441\u0442",
14
- "open_video": "\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0432\u0438\u0434\u0435\u043e",
15
- "open_archive": "\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0430\u0440\u0445\u0438\u0432",
16
- "open_pdf": "\u041e\u0442\u043a\u0440\u044b\u0442\u044c PDF",
17
- "open_office": "\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442",
18
- "download": "\u0421\u043a\u0430\u0447\u0430\u0442\u044c",
19
- "preview": "\u041f\u0440\u0435\u0432\u044c\u044e",
20
- "prev": "\u041d\u0430\u0437\u0430\u0434",
21
- "next": "\u0412\u043f\u0435\u0440\u0435\u0434",
22
- "zoom_in": "\u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c",
23
- "zoom_out": "\u0423\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c"
24
- },
25
- "loadmore": {
10
+ "filepreview": {
11
+ "open_audio": "\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u043f\u043b\u0435\u0435\u0440",
12
+ "open_image": "\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435",
13
+ "open_text": "\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0442\u0435\u043a\u0441\u0442",
14
+ "open_video": "\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0432\u0438\u0434\u0435\u043e",
15
+ "open_archive": "\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0430\u0440\u0445\u0438\u0432",
16
+ "open_pdf": "\u041e\u0442\u043a\u0440\u044b\u0442\u044c PDF",
17
+ "open_office": "\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442",
18
+ "download": "\u0421\u043a\u0430\u0447\u0430\u0442\u044c",
19
+ "preview": "\u041f\u0440\u0435\u0432\u044c\u044e",
20
+ "prev": "\u041d\u0430\u0437\u0430\u0434",
21
+ "next": "\u0412\u043f\u0435\u0440\u0435\u0434",
22
+ "zoom_in": "\u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c",
23
+ "zoom_out": "\u0423\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c"
24
+ },
25
+ "loadmore": {
26
26
  "send": "Загружаю...",
27
27
  "show": "Показываю...",
28
28
  "text-ajax": "Загрузить еще",
@@ -36,4 +36,4 @@
36
36
  "select": {
37
37
  "load-more": "Загрузить еще"
38
38
  }
39
- }
39
+ }
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "files": {
18
18
  "is-count": "Превышен лимит по количеству файлов",
19
- "is-sizes": "Превышен размер файла",
19
+ "is-sizes": "Превышен размер файла",
20
20
  "is-types": "Недопустимый тип файла",
21
21
  "is-total-size": "Превышен максимально разрешённый размер для выбранных файлов",
22
22
  "titles": "Удаление файлов",
@@ -3,8 +3,8 @@
3
3
  * Возможности: modal, overlay и dropdown-рендер, компактный размер, Data API, AJAX и Promise-сценарии.
4
4
  */
5
5
  import BaseModule from "../../base-module";
6
- import VGModal from "../../vgmodal";
7
- import VGSidebar from "../../vgsidebar";
6
+ import VGModal from "../../vgmodal";
7
+ import VGSidebar from "../../vgsidebar";
8
8
  import VGDropdown from "../../vgdropdown";
9
9
 
10
10
  import { execute, isElement, isVisible, makeRandomString, mergeDeepObject, reflow } from "../../../utils/js/functions";
@@ -451,10 +451,10 @@ class VGAlert {
451
451
  };
452
452
  }
453
453
 
454
- const parent = containerWrap.classList.contains('vg-sidebar')
455
- ? VGSidebar.getOrCreateInstance(containerWrap)
456
- : VGModal.getOrCreateInstance(containerWrap);
457
- const container = Selectors.find('.vg-modal-content', containerWrap) || containerWrap;
454
+ const parent = containerWrap.classList.contains('vg-sidebar')
455
+ ? VGSidebar.getOrCreateInstance(containerWrap)
456
+ : VGModal.getOrCreateInstance(containerWrap);
457
+ const container = Selectors.find('.vg-modal-content', containerWrap) || containerWrap;
458
458
 
459
459
  const overlay = document.createElement('div');
460
460
 
@@ -466,7 +466,7 @@ class VGAlert {
466
466
 
467
467
  return {
468
468
  element: overlay,
469
- render: parent,
469
+ render: parent,
470
470
  };
471
471
  }
472
472
 
@@ -1,16 +1,16 @@
1
- @use "../../../utils/scss" as vg;
2
-
3
- $alert-map: (
4
- overlay-z-index: 1,
5
- overlay-backdrop-bg: rgba(0, 0, 0, 0),
6
- overlay-backdrop-show-bg: var(--vg-backdrop-subtle-color, rgba(0, 0, 0, .25)),
7
- overlay-backdrop-transition: background-color .05s linear,
8
- overlay-wrapper-bg: var(--vg-surface-bg, #{vg.$surface-bg}),
9
- overlay-wrapper-width: 90%,
10
- overlay-wrapper-top: 1rem,
11
- overlay-wrapper-start: 50%,
12
- overlay-wrapper-transform: translate(-50%, -1rem),
13
- overlay-wrapper-show-transform: translate(-50%, 0),
14
- overlay-wrapper-transition: transform .12s ease-out,
15
- buttons-bg: var(--vg-surface-muted-bg, #{vg.$surface-muted-bg}),
16
- ) !default;
1
+ @use "../../../utils/scss" as vg;
2
+
3
+ $alert-map: (
4
+ overlay-z-index: 1,
5
+ overlay-backdrop-bg: rgba(0, 0, 0, 0),
6
+ overlay-backdrop-show-bg: var(--vg-backdrop-subtle-color, rgba(0, 0, 0, .25)),
7
+ overlay-backdrop-transition: background-color .05s linear,
8
+ overlay-wrapper-bg: var(--vg-surface-bg, #{vg.$surface-bg}),
9
+ overlay-wrapper-width: 90%,
10
+ overlay-wrapper-top: 1rem,
11
+ overlay-wrapper-start: 50%,
12
+ overlay-wrapper-transform: translate(-50%, -1rem),
13
+ overlay-wrapper-show-transform: translate(-50%, 0),
14
+ overlay-wrapper-transition: transform .12s ease-out,
15
+ buttons-bg: var(--vg-surface-muted-bg, #{vg.$surface-muted-bg}),
16
+ ) !default;
@@ -1,7 +1,7 @@
1
- @use "../../../utils/scss" as vg;
2
-
3
- $collapse-accordion-map: (
4
- border: vg.$border-width vg.$border-style var(--vg-border-color, #{vg.$border-color}),
5
- border-radius: vg.$border-radius,
6
- padding: 1rem
7
- ) !default;
1
+ @use "../../../utils/scss" as vg;
2
+
3
+ $collapse-accordion-map: (
4
+ border: vg.$border-width vg.$border-style var(--vg-border-color, #{vg.$border-color}),
5
+ border-radius: vg.$border-radius,
6
+ padding: 1rem
7
+ ) !default;
@@ -6,13 +6,13 @@
6
6
  *--------------------------------------------------------------------------
7
7
  **/
8
8
 
9
- @forward "variables";
10
- @use "../../../utils/scss" as vg;
11
- @use "variables" as vars;
9
+ @forward "variables";
10
+ @use "../../../utils/scss" as vg;
11
+ @use "variables" as vars;
12
12
 
13
13
 
14
14
  .vg-accordion {
15
- @include vg.mix-vars('accordion', vars.$collapse-accordion-map);
15
+ @include vg.mix-vars('accordion', vars.$collapse-accordion-map);
16
16
  position: relative;
17
17
  border: var(--vg-accordion-border);
18
18
  border-radius: var(--vg-accordion-border-radius);
@@ -37,4 +37,4 @@
37
37
  display: block;
38
38
  padding: var(--vg-accordion-padding);
39
39
  }
40
- }
40
+ }
@@ -1,14 +1,14 @@
1
- @use "../../../utils/scss" as vg;
2
-
3
- $dropdown-map: (
4
- bg-color: var(--vg-surface-bg, #{vg.$surface-bg}),
5
- color: var(--vg-text-color, #{vg.$color}),
6
- box-shadow: var(--vg-box-shadow, #{vg.$box-shadow}),
7
- border-width: vg.$border-width,
8
- border-style: vg.$border-style,
9
- border-color: var(--vg-border-color, #{vg.$border-color}),
10
- border-radius: vg.$border-radius,
11
- z-index: vg.$dropdown-index,
12
- transition: vg.$transition-base,
13
- min-width: 225px
14
- ) !default;
1
+ @use "../../../utils/scss" as vg;
2
+
3
+ $dropdown-map: (
4
+ bg-color: var(--vg-surface-bg, #{vg.$surface-bg}),
5
+ color: var(--vg-text-color, #{vg.$color}),
6
+ box-shadow: var(--vg-box-shadow, #{vg.$box-shadow}),
7
+ border-width: vg.$border-width,
8
+ border-style: vg.$border-style,
9
+ border-color: var(--vg-border-color, #{vg.$border-color}),
10
+ border-radius: vg.$border-radius,
11
+ z-index: vg.$dropdown-index,
12
+ transition: vg.$transition-base,
13
+ min-width: 225px
14
+ ) !default;
@@ -6,13 +6,13 @@
6
6
  *--------------------------------------------------------------------------
7
7
  **/
8
8
 
9
- @forward "variables";
10
- @use "../../../utils/scss" as vg;
11
- @use "variables" as vars;
9
+ @forward "variables";
10
+ @use "../../../utils/scss" as vg;
11
+ @use "variables" as vars;
12
12
 
13
13
  .vg-dropdown {
14
14
  position: relative;
15
- @include vg.mix-vars('dropdown', vars.$dropdown-map);
15
+ @include vg.mix-vars('dropdown', vars.$dropdown-map);
16
16
 
17
17
  &-content {
18
18
  z-index: var(--vg-dropdown-z-index);
@@ -77,4 +77,4 @@
77
77
  border-radius: var(--vg-dropdown-border-radius);
78
78
  box-shadow: var(--vg-dropdown-box-shadow);
79
79
  }
80
- }
80
+ }
@@ -1,56 +1,56 @@
1
- import { lang_buttons, lang_messages } from "../../../utils/js/components/lang";
2
-
3
- const SUPPORTED_LANGS = new Set(["ru", "en"]);
4
-
5
- const normalizeLang = (value, fallback = "ru") => {
6
- const candidate = String(value || "").trim().toLowerCase();
7
- if (!candidate) {
8
- return fallback;
9
- }
10
-
11
- const short = candidate.split("-")[0];
12
- return SUPPORTED_LANGS.has(short) ? short : fallback;
13
- };
14
-
15
- const resolveFilePreviewLang = (paramsLang, element) => {
16
- const fromParams = normalizeLang(paramsLang, "");
17
- if (fromParams) {
18
- return fromParams;
19
- }
20
-
21
- const fromElement = normalizeLang(element?.getAttribute("lang"), "");
22
- if (fromElement) {
23
- return fromElement;
24
- }
25
-
26
- const fromClosest = normalizeLang(element?.closest("[lang]")?.getAttribute("lang"), "");
27
- if (fromClosest) {
28
- return fromClosest;
29
- }
30
-
31
- const fromHtml = normalizeLang(document?.documentElement?.getAttribute("lang"), "");
32
- if (fromHtml) {
33
- return fromHtml;
34
- }
35
-
36
- const fromNavigator = normalizeLang(window?.navigator?.language, "");
37
- if (fromNavigator) {
38
- return fromNavigator;
39
- }
40
-
41
- return "ru";
42
- };
43
-
44
- const createFilePreviewI18n = (lang = "ru") => {
45
- const normalizedLang = normalizeLang(lang, "ru");
46
- const messages = lang_messages(normalizedLang, "filepreview") || {};
47
- const buttons = lang_buttons(normalizedLang, "filepreview") || {};
48
-
49
- return {
50
- lang: normalizedLang,
51
- message: (key, fallback = "") => messages[key] || fallback,
52
- button: (key, fallback = "") => buttons[key] || fallback
53
- };
54
- };
55
-
56
- export { createFilePreviewI18n, resolveFilePreviewLang };
1
+ import { lang_buttons, lang_messages } from "../../../utils/js/components/lang";
2
+
3
+ const SUPPORTED_LANGS = new Set(["ru", "en"]);
4
+
5
+ const normalizeLang = (value, fallback = "ru") => {
6
+ const candidate = String(value || "").trim().toLowerCase();
7
+ if (!candidate) {
8
+ return fallback;
9
+ }
10
+
11
+ const short = candidate.split("-")[0];
12
+ return SUPPORTED_LANGS.has(short) ? short : fallback;
13
+ };
14
+
15
+ const resolveFilePreviewLang = (paramsLang, element) => {
16
+ const fromParams = normalizeLang(paramsLang, "");
17
+ if (fromParams) {
18
+ return fromParams;
19
+ }
20
+
21
+ const fromElement = normalizeLang(element?.getAttribute("lang"), "");
22
+ if (fromElement) {
23
+ return fromElement;
24
+ }
25
+
26
+ const fromClosest = normalizeLang(element?.closest("[lang]")?.getAttribute("lang"), "");
27
+ if (fromClosest) {
28
+ return fromClosest;
29
+ }
30
+
31
+ const fromHtml = normalizeLang(document?.documentElement?.getAttribute("lang"), "");
32
+ if (fromHtml) {
33
+ return fromHtml;
34
+ }
35
+
36
+ const fromNavigator = normalizeLang(window?.navigator?.language, "");
37
+ if (fromNavigator) {
38
+ return fromNavigator;
39
+ }
40
+
41
+ return "ru";
42
+ };
43
+
44
+ const createFilePreviewI18n = (lang = "ru") => {
45
+ const normalizedLang = normalizeLang(lang, "ru");
46
+ const messages = lang_messages(normalizedLang, "filepreview") || {};
47
+ const buttons = lang_buttons(normalizedLang, "filepreview") || {};
48
+
49
+ return {
50
+ lang: normalizedLang,
51
+ message: (key, fallback = "") => messages[key] || fallback,
52
+ button: (key, fallback = "") => buttons[key] || fallback
53
+ };
54
+ };
55
+
56
+ export { createFilePreviewI18n, resolveFilePreviewLang };