vgapp 1.1.4 → 1.1.5

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 (55) hide show
  1. package/CHANGELOG.md +32 -13
  2. package/README.md +48 -48
  3. package/agents.md +2 -1
  4. package/app/langs/en/buttons.json +17 -17
  5. package/app/langs/en/messages.json +36 -36
  6. package/app/langs/ru/buttons.json +17 -17
  7. package/app/langs/ru/messages.json +36 -36
  8. package/app/modules/vgfilepreview/js/i18n.js +56 -56
  9. package/app/modules/vgfilepreview/js/renderers/image-modal.js +145 -145
  10. package/app/modules/vgfilepreview/js/renderers/image.js +92 -92
  11. package/app/modules/vgfilepreview/js/renderers/index.js +19 -19
  12. package/app/modules/vgfilepreview/js/renderers/office-modal.js +168 -168
  13. package/app/modules/vgfilepreview/js/renderers/office.js +79 -79
  14. package/app/modules/vgfilepreview/js/renderers/pdf-modal.js +260 -260
  15. package/app/modules/vgfilepreview/js/renderers/pdf.js +76 -76
  16. package/app/modules/vgfilepreview/js/renderers/playlist.js +71 -71
  17. package/app/modules/vgfilepreview/js/renderers/text-modal.js +343 -343
  18. package/app/modules/vgfilepreview/js/renderers/text.js +83 -83
  19. package/app/modules/vgfilepreview/js/renderers/video-modal.js +272 -272
  20. package/app/modules/vgfilepreview/js/renderers/video.js +80 -80
  21. package/app/modules/vgfilepreview/js/renderers/zip-modal.js +522 -522
  22. package/app/modules/vgfilepreview/js/renderers/zip.js +89 -89
  23. package/app/modules/vgfilepreview/js/vgfilepreview.js +965 -592
  24. package/app/modules/vgfilepreview/readme.md +68 -68
  25. package/app/modules/vgfilepreview/scss/_variables.scss +113 -113
  26. package/app/modules/vgfilepreview/scss/vgfilepreview.scss +464 -460
  27. package/app/modules/vgfiles/js/base.js +463 -463
  28. package/app/modules/vgfiles/js/droppable.js +260 -260
  29. package/app/modules/vgfiles/js/render.js +153 -153
  30. package/app/modules/vgfiles/js/vgfiles.js +41 -41
  31. package/app/modules/vgfiles/readme.md +123 -123
  32. package/app/modules/vgfiles/scss/_variables.scss +18 -18
  33. package/app/modules/vgfiles/scss/vgfiles.scss +148 -148
  34. package/app/modules/vgformsender/js/vgformsender.js +13 -13
  35. package/app/modules/vgmodal/js/vgmodal.drag.js +332 -0
  36. package/app/modules/vgmodal/js/vgmodal.js +116 -14
  37. package/app/modules/vgmodal/js/vgmodal.resize.js +435 -0
  38. package/app/modules/vgnav/js/vgnav.js +135 -135
  39. package/app/modules/vgnav/readme.md +67 -67
  40. package/app/modules/vgnestable/README.md +307 -307
  41. package/app/modules/vgnestable/scss/_variables.scss +60 -60
  42. package/app/modules/vgnestable/scss/vgnestable.scss +163 -163
  43. package/app/modules/vgselect/js/vgselect.js +39 -39
  44. package/app/modules/vgselect/scss/vgselect.scss +22 -22
  45. package/app/modules/vgspy/readme.md +28 -28
  46. package/app/utils/js/components/audio-metadata.js +240 -240
  47. package/app/utils/js/components/file-icon.js +109 -109
  48. package/app/utils/js/components/file-preview.js +304 -304
  49. package/app/utils/js/components/sanitize.js +150 -150
  50. package/app/utils/js/components/video-metadata.js +140 -0
  51. package/build/vgapp.css +1 -1
  52. package/build/vgapp.css.map +1 -1
  53. package/build/vgapp.js.map +1 -1
  54. package/index.scss +9 -9
  55. package/package.json +1 -1
@@ -1,83 +1,83 @@
1
- import TextModal from "./text-modal";
2
-
3
- const TEXT_EXTENSIONS = new Set([
4
- '.txt',
5
- '.md',
6
- '.csv',
7
- '.json',
8
- '.xml',
9
- '.yml',
10
- '.yaml',
11
- '.log',
12
- '.ini',
13
- '.conf',
14
- '.env'
15
- ]);
16
-
17
- class TextFilePreviewRenderer {
18
- constructor() {
19
- this.name = 'text';
20
- this._modal = TextModal.getInstance();
21
- }
22
-
23
- canRender(context = {}) {
24
- const ext = String(context?.fileMeta?.ext || '').toLowerCase();
25
- return TEXT_EXTENSIONS.has(ext);
26
- }
27
-
28
- render(context = {}) {
29
- const container = context?.previewContainer;
30
- const nameOnly = Boolean(context?.ui?.nameOnly);
31
- const i18n = context?.i18n;
32
-
33
- const src = context?.fileUrl?.href || context?.filePath || '';
34
- if (!src) {
35
- return false;
36
- }
37
-
38
- const openText = (event) => {
39
- if (event) {
40
- event.preventDefault();
41
- }
42
-
43
- this._modal.open({
44
- src,
45
- title: context?.fileMeta?.name || i18n?.message('text_title') || '',
46
- defaultTitle: i18n?.message('text_title') || '',
47
- ext: context?.fileMeta?.ext || '',
48
- labels: {
49
- loading: i18n?.message('loading_text') || '',
50
- cannotOpen: i18n?.message('cannot_open_file') || '',
51
- unknownError: i18n?.message('unknown_error') || '',
52
- emptyFile: i18n?.message('empty_file') || ''
53
- }
54
- });
55
- };
56
-
57
- const titleLink = context?.element?.querySelector('.name');
58
- if (titleLink && !titleLink.hasAttribute('data-vg-filepreview-text-bind')) {
59
- titleLink.setAttribute('data-vg-filepreview-text-bind', 'true');
60
- titleLink.classList.add('is-preview-action');
61
- titleLink.addEventListener('click', openText);
62
- }
63
-
64
- if (nameOnly) {
65
- return Boolean(titleLink);
66
- }
67
-
68
- if (!container) {
69
- return false;
70
- }
71
-
72
- const trigger = document.createElement('button');
73
- trigger.type = 'button';
74
- trigger.className = 'vg-filepreview-text-trigger';
75
- trigger.textContent = i18n?.button('open_text') || '';
76
- trigger.addEventListener('click', openText);
77
- container.appendChild(trigger);
78
-
79
- return true;
80
- }
81
- }
82
-
83
- export default TextFilePreviewRenderer;
1
+ import TextModal from "./text-modal";
2
+
3
+ const TEXT_EXTENSIONS = new Set([
4
+ '.txt',
5
+ '.md',
6
+ '.csv',
7
+ '.json',
8
+ '.xml',
9
+ '.yml',
10
+ '.yaml',
11
+ '.log',
12
+ '.ini',
13
+ '.conf',
14
+ '.env'
15
+ ]);
16
+
17
+ class TextFilePreviewRenderer {
18
+ constructor() {
19
+ this.name = 'text';
20
+ this._modal = TextModal.getInstance();
21
+ }
22
+
23
+ canRender(context = {}) {
24
+ const ext = String(context?.fileMeta?.ext || '').toLowerCase();
25
+ return TEXT_EXTENSIONS.has(ext);
26
+ }
27
+
28
+ render(context = {}) {
29
+ const container = context?.previewContainer;
30
+ const nameOnly = Boolean(context?.ui?.nameOnly);
31
+ const i18n = context?.i18n;
32
+
33
+ const src = context?.fileUrl?.href || context?.filePath || '';
34
+ if (!src) {
35
+ return false;
36
+ }
37
+
38
+ const openText = (event) => {
39
+ if (event) {
40
+ event.preventDefault();
41
+ }
42
+
43
+ this._modal.open({
44
+ src,
45
+ title: context?.fileMeta?.name || i18n?.message('text_title') || '',
46
+ defaultTitle: i18n?.message('text_title') || '',
47
+ ext: context?.fileMeta?.ext || '',
48
+ labels: {
49
+ loading: i18n?.message('loading_text') || '',
50
+ cannotOpen: i18n?.message('cannot_open_file') || '',
51
+ unknownError: i18n?.message('unknown_error') || '',
52
+ emptyFile: i18n?.message('empty_file') || ''
53
+ }
54
+ });
55
+ };
56
+
57
+ const titleLink = context?.element?.querySelector('.name');
58
+ if (titleLink && !titleLink.hasAttribute('data-vg-filepreview-text-bind')) {
59
+ titleLink.setAttribute('data-vg-filepreview-text-bind', 'true');
60
+ titleLink.classList.add('is-preview-action');
61
+ titleLink.addEventListener('click', openText);
62
+ }
63
+
64
+ if (nameOnly) {
65
+ return Boolean(titleLink);
66
+ }
67
+
68
+ if (!container) {
69
+ return false;
70
+ }
71
+
72
+ const trigger = document.createElement('button');
73
+ trigger.type = 'button';
74
+ trigger.className = 'vg-filepreview-text-trigger';
75
+ trigger.textContent = i18n?.button('open_text') || '';
76
+ trigger.addEventListener('click', openText);
77
+ container.appendChild(trigger);
78
+
79
+ return true;
80
+ }
81
+ }
82
+
83
+ export default TextFilePreviewRenderer;