vgapp 1.1.6 → 1.1.7

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 (54) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/README.md +48 -48
  3. package/app/langs/en/buttons.json +17 -17
  4. package/app/langs/en/messages.json +36 -36
  5. package/app/langs/ru/buttons.json +17 -17
  6. package/app/langs/ru/messages.json +36 -36
  7. package/app/modules/vgfilepreview/js/i18n.js +56 -56
  8. package/app/modules/vgfilepreview/js/renderers/image-modal.js +145 -145
  9. package/app/modules/vgfilepreview/js/renderers/image.js +92 -92
  10. package/app/modules/vgfilepreview/js/renderers/index.js +19 -19
  11. package/app/modules/vgfilepreview/js/renderers/office-modal.js +168 -168
  12. package/app/modules/vgfilepreview/js/renderers/office.js +79 -79
  13. package/app/modules/vgfilepreview/js/renderers/pdf-modal.js +260 -260
  14. package/app/modules/vgfilepreview/js/renderers/pdf.js +76 -76
  15. package/app/modules/vgfilepreview/js/renderers/playlist.js +71 -71
  16. package/app/modules/vgfilepreview/js/renderers/text-modal.js +343 -343
  17. package/app/modules/vgfilepreview/js/renderers/text.js +83 -83
  18. package/app/modules/vgfilepreview/js/renderers/video-modal.js +272 -272
  19. package/app/modules/vgfilepreview/js/renderers/video.js +80 -80
  20. package/app/modules/vgfilepreview/js/renderers/zip-modal.js +522 -522
  21. package/app/modules/vgfilepreview/js/renderers/zip.js +89 -89
  22. package/app/modules/vgfilepreview/js/vgfilepreview.js +7 -7
  23. package/app/modules/vgfilepreview/readme.md +68 -68
  24. package/app/modules/vgfilepreview/scss/_variables.scss +113 -113
  25. package/app/modules/vgfilepreview/scss/vgfilepreview.scss +464 -464
  26. package/app/modules/vgfiles/js/base.js +26 -26
  27. package/app/modules/vgfiles/js/droppable.js +260 -260
  28. package/app/modules/vgfiles/js/render.js +153 -153
  29. package/app/modules/vgfiles/js/vgfiles.js +41 -41
  30. package/app/modules/vgfiles/readme.md +123 -123
  31. package/app/modules/vgfiles/scss/_variables.scss +18 -18
  32. package/app/modules/vgfiles/scss/vgfiles.scss +148 -148
  33. package/app/modules/vgformsender/js/vgformsender.js +1 -1
  34. package/app/modules/vgmodal/js/vgmodal.drag.js +332 -332
  35. package/app/modules/vgmodal/js/vgmodal.js +33 -33
  36. package/app/modules/vgmodal/js/vgmodal.resize.js +435 -435
  37. package/app/modules/vgnav/js/vgnav.js +135 -135
  38. package/app/modules/vgnav/readme.md +67 -67
  39. package/app/modules/vgnestable/README.md +307 -307
  40. package/app/modules/vgnestable/scss/_variables.scss +60 -60
  41. package/app/modules/vgnestable/scss/vgnestable.scss +163 -163
  42. package/app/modules/vgselect/js/vgselect.js +39 -39
  43. package/app/modules/vgselect/scss/vgselect.scss +22 -22
  44. package/app/modules/vgspy/readme.md +28 -28
  45. package/app/utils/js/components/audio-metadata.js +240 -240
  46. package/app/utils/js/components/file-icon.js +109 -109
  47. package/app/utils/js/components/file-preview.js +304 -304
  48. package/app/utils/js/components/sanitize.js +150 -150
  49. package/app/utils/js/components/video-metadata.js +140 -140
  50. package/build/vgapp.css +1 -1
  51. package/build/vgapp.css.map +1 -1
  52. package/build/vgapp.js.map +1 -1
  53. package/index.scss +9 -9
  54. package/package.json +1 -1
@@ -1,71 +1,71 @@
1
- const getPathFromElement = (element) => {
2
- const value = element?.getAttribute('data-vg-filepreview') || '';
3
- return String(value).trim();
4
- };
5
-
6
- const parseExt = (path) => {
7
- if (!path) {
8
- return '';
9
- }
10
-
11
- const clean = String(path).split('#')[0].split('?')[0];
12
- const name = clean.split('/').pop() || '';
13
- if (!name.includes('.')) {
14
- return '';
15
- }
16
-
17
- return `.${String(name.split('.').pop() || '').toLowerCase()}`;
18
- };
19
-
20
- const toAbsoluteUrl = (path) => {
21
- try {
22
- return new URL(path, window.location.origin).href;
23
- } catch {
24
- return '';
25
- }
26
- };
27
-
28
- const resolveTitle = (element, fallbackPath = '') => {
29
- const node = element?.querySelector('.name');
30
- const title = String(node?.textContent || '').trim();
31
- if (title) {
32
- return title;
33
- }
34
-
35
- const name = String(fallbackPath).split('/').pop() || '';
36
- return decodeURIComponent(name);
37
- };
38
-
39
- const resolveSubtitle = (element) => {
40
- const node = element?.querySelector('.original_name');
41
- return String(node?.textContent || '').trim();
42
- };
43
-
44
- const buildMediaPlaylist = (currentElement, acceptExt = () => true) => {
45
- const nodes = Array.from(document.querySelectorAll('[data-vg-filepreview][data-vg-filepreview-valid="true"]'));
46
- const tracks = nodes
47
- .map((element) => {
48
- const path = getPathFromElement(element);
49
- const src = toAbsoluteUrl(path);
50
- const ext = parseExt(path);
51
- return {
52
- element,
53
- path,
54
- src,
55
- ext,
56
- title: resolveTitle(element, path),
57
- subtitle: resolveSubtitle(element)
58
- };
59
- })
60
- .filter((item) => item.src && acceptExt(item.ext));
61
-
62
- const currentSrc = toAbsoluteUrl(getPathFromElement(currentElement));
63
- const currentIndex = tracks.findIndex((item) => item.src === currentSrc);
64
-
65
- return {
66
- tracks,
67
- currentIndex: currentIndex >= 0 ? currentIndex : 0
68
- };
69
- };
70
-
71
- export { buildMediaPlaylist };
1
+ const getPathFromElement = (element) => {
2
+ const value = element?.getAttribute('data-vg-filepreview') || '';
3
+ return String(value).trim();
4
+ };
5
+
6
+ const parseExt = (path) => {
7
+ if (!path) {
8
+ return '';
9
+ }
10
+
11
+ const clean = String(path).split('#')[0].split('?')[0];
12
+ const name = clean.split('/').pop() || '';
13
+ if (!name.includes('.')) {
14
+ return '';
15
+ }
16
+
17
+ return `.${String(name.split('.').pop() || '').toLowerCase()}`;
18
+ };
19
+
20
+ const toAbsoluteUrl = (path) => {
21
+ try {
22
+ return new URL(path, window.location.origin).href;
23
+ } catch {
24
+ return '';
25
+ }
26
+ };
27
+
28
+ const resolveTitle = (element, fallbackPath = '') => {
29
+ const node = element?.querySelector('.name');
30
+ const title = String(node?.textContent || '').trim();
31
+ if (title) {
32
+ return title;
33
+ }
34
+
35
+ const name = String(fallbackPath).split('/').pop() || '';
36
+ return decodeURIComponent(name);
37
+ };
38
+
39
+ const resolveSubtitle = (element) => {
40
+ const node = element?.querySelector('.original_name');
41
+ return String(node?.textContent || '').trim();
42
+ };
43
+
44
+ const buildMediaPlaylist = (currentElement, acceptExt = () => true) => {
45
+ const nodes = Array.from(document.querySelectorAll('[data-vg-filepreview][data-vg-filepreview-valid="true"]'));
46
+ const tracks = nodes
47
+ .map((element) => {
48
+ const path = getPathFromElement(element);
49
+ const src = toAbsoluteUrl(path);
50
+ const ext = parseExt(path);
51
+ return {
52
+ element,
53
+ path,
54
+ src,
55
+ ext,
56
+ title: resolveTitle(element, path),
57
+ subtitle: resolveSubtitle(element)
58
+ };
59
+ })
60
+ .filter((item) => item.src && acceptExt(item.ext));
61
+
62
+ const currentSrc = toAbsoluteUrl(getPathFromElement(currentElement));
63
+ const currentIndex = tracks.findIndex((item) => item.src === currentSrc);
64
+
65
+ return {
66
+ tracks,
67
+ currentIndex: currentIndex >= 0 ? currentIndex : 0
68
+ };
69
+ };
70
+
71
+ export { buildMediaPlaylist };