vgapp 1.3.4 → 1.3.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 (88) 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 +36 -36
  5. package/app/modules/base-module.js +111 -111
  6. package/app/modules/vgalert/js/vgalert.js +52 -52
  7. package/app/modules/vgalert/readme.md +105 -105
  8. package/app/modules/vgdynamictable/index.js +5 -5
  9. package/app/modules/vgdynamictable/js/editable.js +19 -19
  10. package/app/modules/vgdynamictable/js/filters.js +21 -21
  11. package/app/modules/vgdynamictable/js/fixed.js +179 -179
  12. package/app/modules/vgdynamictable/js/pagination.js +1 -1
  13. package/app/modules/vgdynamictable/js/search.js +12 -12
  14. package/app/modules/vgdynamictable/js/sortable.js +71 -71
  15. package/app/modules/vgdynamictable/js/summary-footer.js +28 -28
  16. package/app/modules/vgdynamictable/js/table-remote.js +79 -79
  17. package/app/modules/vgdynamictable/js/table-url-state.js +31 -31
  18. package/app/modules/vgdynamictable/js/utils/common.js +48 -48
  19. package/app/modules/vgdynamictable/js/vgdynamictable.js +268 -268
  20. package/app/modules/vgdynamictable/readme.md +250 -250
  21. package/app/modules/vgdynamictable/scss/_skeleton.scss +6 -6
  22. package/app/modules/vgdynamictable/scss/_sortable.scss +24 -24
  23. package/app/modules/vgdynamictable/scss/_table.scss +4 -4
  24. package/app/modules/vgdynamictable/scss/_variables.scss +79 -79
  25. package/app/modules/vgdynamictable/scss/vgdynamictable.scss +27 -27
  26. package/app/modules/vgfilepreview/js/i18n.js +56 -56
  27. package/app/modules/vgfilepreview/js/renderers/image-modal.js +145 -145
  28. package/app/modules/vgfilepreview/js/renderers/image.js +92 -92
  29. package/app/modules/vgfilepreview/js/renderers/index.js +19 -19
  30. package/app/modules/vgfilepreview/js/renderers/office-modal.js +168 -168
  31. package/app/modules/vgfilepreview/js/renderers/office.js +79 -79
  32. package/app/modules/vgfilepreview/js/renderers/pdf-modal.js +260 -260
  33. package/app/modules/vgfilepreview/js/renderers/pdf.js +76 -76
  34. package/app/modules/vgfilepreview/js/renderers/playlist.js +71 -71
  35. package/app/modules/vgfilepreview/js/renderers/text-modal.js +343 -343
  36. package/app/modules/vgfilepreview/js/renderers/text.js +83 -83
  37. package/app/modules/vgfilepreview/js/renderers/video-modal.js +272 -272
  38. package/app/modules/vgfilepreview/js/renderers/video.js +80 -80
  39. package/app/modules/vgfilepreview/js/renderers/zip-modal.js +522 -522
  40. package/app/modules/vgfilepreview/js/renderers/zip.js +89 -89
  41. package/app/modules/vgfilepreview/js/vgfilepreview.js +7 -7
  42. package/app/modules/vgfilepreview/readme.md +68 -68
  43. package/app/modules/vgfilepreview/scss/_variables.scss +113 -113
  44. package/app/modules/vgfilepreview/scss/vgfilepreview.scss +464 -464
  45. package/app/modules/vgfiles/js/base.js +26 -26
  46. package/app/modules/vgfiles/js/droppable.js +260 -260
  47. package/app/modules/vgfiles/js/render.js +153 -153
  48. package/app/modules/vgfiles/js/vgfiles.js +104 -104
  49. package/app/modules/vgfiles/readme.md +123 -123
  50. package/app/modules/vgfiles/scss/_variables.scss +18 -18
  51. package/app/modules/vgfiles/scss/vgfiles.scss +148 -148
  52. package/app/modules/vgformsender/js/hideshowpass.js +16 -16
  53. package/app/modules/vgformsender/scss/vgformsender.scss +34 -34
  54. package/app/modules/vgmodal/js/vgmodal.drag.js +332 -332
  55. package/app/modules/vgmodal/js/vgmodal.js +188 -188
  56. package/app/modules/vgmodal/js/vgmodal.resize.js +27 -27
  57. package/app/modules/vgmodal/scss/vgmodal.scss +14 -14
  58. package/app/modules/vgnav/js/vgnav.js +135 -135
  59. package/app/modules/vgnav/readme.md +67 -67
  60. package/app/modules/vgnestable/README.md +307 -307
  61. package/app/modules/vgnestable/scss/_variables.scss +60 -60
  62. package/app/modules/vgnestable/scss/vgnestable.scss +163 -163
  63. package/app/modules/vgrangeslider/js/skins.js +222 -222
  64. package/app/modules/vgrangeslider/js/vgrangeslider.js +704 -704
  65. package/app/modules/vgrangeslider/readme.md +523 -523
  66. package/app/modules/vgrangeslider/scss/_variables.scss +53 -53
  67. package/app/modules/vgrangeslider/scss/vgrangeslider.scss +240 -240
  68. package/app/modules/vgselect/js/vgselect.js +39 -39
  69. package/app/modules/vgselect/scss/vgselect.scss +22 -22
  70. package/app/modules/vgspy/readme.md +28 -28
  71. package/app/modules/vgtoast/readme.md +18 -18
  72. package/app/modules/vgtoast/scss/vgtoast.scss +48 -48
  73. package/app/modules/vgtooltip/js/vgtooltip.js +89 -89
  74. package/app/modules/vgtooltip/readme.md +181 -181
  75. package/app/utils/js/components/ajax.js +117 -117
  76. package/app/utils/js/components/audio-metadata.js +240 -240
  77. package/app/utils/js/components/backdrop.js +17 -17
  78. package/app/utils/js/components/file-icon.js +109 -109
  79. package/app/utils/js/components/file-preview.js +304 -304
  80. package/app/utils/js/components/sanitize.js +150 -150
  81. package/app/utils/js/components/video-metadata.js +140 -140
  82. package/app/vgapp.js +46 -46
  83. package/build/vgapp.css +1 -1
  84. package/build/vgapp.css.map +1 -1
  85. package/build/vgapp.js +1 -1
  86. package/build/vgapp.js.map +1 -1
  87. package/index.js +14 -14
  88. package/package.json +3 -2
@@ -1,150 +1,150 @@
1
- const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
2
- const DEFAULT_ALLOWED_SVG_TAGS = new Set([
3
- "svg",
4
- "g",
5
- "path",
6
- "line",
7
- "polyline",
8
- "polygon",
9
- "circle",
10
- "ellipse",
11
- "rect",
12
- "defs",
13
- "symbol",
14
- "title",
15
- "use"
16
- ]);
17
- const DEFAULT_ALLOWED_SVG_ATTRS = new Set([
18
- "xmlns",
19
- "viewbox",
20
- "width",
21
- "height",
22
- "fill",
23
- "stroke",
24
- "stroke-width",
25
- "stroke-linecap",
26
- "stroke-linejoin",
27
- "stroke-miterlimit",
28
- "stroke-dasharray",
29
- "stroke-dashoffset",
30
- "opacity",
31
- "transform",
32
- "class",
33
- "x",
34
- "y",
35
- "x1",
36
- "y1",
37
- "x2",
38
- "y2",
39
- "cx",
40
- "cy",
41
- "r",
42
- "rx",
43
- "ry",
44
- "points",
45
- "d",
46
- "role",
47
- "focusable",
48
- "aria-hidden",
49
- "href",
50
- "xlink:href"
51
- ]);
52
-
53
- function escapeHtml(value) {
54
- return String(value)
55
- .replace(/&/g, "&")
56
- .replace(/</g, "&lt;")
57
- .replace(/>/g, "&gt;")
58
- .replace(/"/g, "&quot;")
59
- .replace(/'/g, "&#39;");
60
- }
61
-
62
- function sanitizeSvgNode(node, allowedTags = DEFAULT_ALLOWED_SVG_TAGS, allowedAttrs = DEFAULT_ALLOWED_SVG_ATTRS) {
63
- if (!node) {
64
- return null;
65
- }
66
-
67
- if (node.nodeType === Node.TEXT_NODE) {
68
- return document.createTextNode(node.textContent || "");
69
- }
70
-
71
- if (node.nodeType !== Node.ELEMENT_NODE) {
72
- return null;
73
- }
74
-
75
- const tagName = node.tagName.toLowerCase();
76
- if (!allowedTags.has(tagName)) {
77
- return null;
78
- }
79
-
80
- const safeNode = document.createElementNS(SVG_NAMESPACE, tagName);
81
-
82
- Array.from(node.attributes || []).forEach((attr) => {
83
- const name = attr.name.toLowerCase();
84
- const attrValue = attr.value || "";
85
-
86
- if (!allowedAttrs.has(name) || name.startsWith("on")) {
87
- return;
88
- }
89
-
90
- if ((name === "href" || name === "xlink:href") && attrValue && !attrValue.startsWith("#")) {
91
- return;
92
- }
93
-
94
- safeNode.setAttribute(name, attrValue);
95
- });
96
-
97
- Array.from(node.childNodes || []).forEach((child) => {
98
- const safeChild = sanitizeSvgNode(child, allowedTags, allowedAttrs);
99
- if (safeChild) {
100
- safeNode.append(safeChild);
101
- }
102
- });
103
-
104
- return safeNode;
105
- }
106
-
107
- export function toSafeHtmlString(value, {
108
- allowedSvgTags = DEFAULT_ALLOWED_SVG_TAGS,
109
- allowedSvgAttrs = DEFAULT_ALLOWED_SVG_ATTRS
110
- } = {}) {
111
- if (value === null || value === undefined) {
112
- return "";
113
- }
114
-
115
- const content = String(value).trim();
116
- if (!content) {
117
- return "";
118
- }
119
-
120
- if (!content.includes("<")) {
121
- return escapeHtml(content);
122
- }
123
-
124
- const template = document.createElement("template");
125
- template.innerHTML = content;
126
-
127
- const sanitizedParts = Array.from(template.content.childNodes)
128
- .map((node) => sanitizeSvgNode(node, allowedSvgTags, allowedSvgAttrs))
129
- .filter(Boolean)
130
- .map((node) => {
131
- if (node.nodeType === Node.TEXT_NODE) {
132
- return escapeHtml(node.textContent || "");
133
- }
134
- if (node.nodeType === Node.ELEMENT_NODE) {
135
- return node.outerHTML;
136
- }
137
- return "";
138
- });
139
-
140
- const sanitized = sanitizedParts.join("");
141
- return sanitized || escapeHtml(content);
142
- }
143
-
144
- class Sanitize {
145
- static toSafeHtmlString(value, options) {
146
- return toSafeHtmlString(value, options);
147
- }
148
- }
149
-
150
- export default Sanitize;
1
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
2
+ const DEFAULT_ALLOWED_SVG_TAGS = new Set([
3
+ "svg",
4
+ "g",
5
+ "path",
6
+ "line",
7
+ "polyline",
8
+ "polygon",
9
+ "circle",
10
+ "ellipse",
11
+ "rect",
12
+ "defs",
13
+ "symbol",
14
+ "title",
15
+ "use"
16
+ ]);
17
+ const DEFAULT_ALLOWED_SVG_ATTRS = new Set([
18
+ "xmlns",
19
+ "viewbox",
20
+ "width",
21
+ "height",
22
+ "fill",
23
+ "stroke",
24
+ "stroke-width",
25
+ "stroke-linecap",
26
+ "stroke-linejoin",
27
+ "stroke-miterlimit",
28
+ "stroke-dasharray",
29
+ "stroke-dashoffset",
30
+ "opacity",
31
+ "transform",
32
+ "class",
33
+ "x",
34
+ "y",
35
+ "x1",
36
+ "y1",
37
+ "x2",
38
+ "y2",
39
+ "cx",
40
+ "cy",
41
+ "r",
42
+ "rx",
43
+ "ry",
44
+ "points",
45
+ "d",
46
+ "role",
47
+ "focusable",
48
+ "aria-hidden",
49
+ "href",
50
+ "xlink:href"
51
+ ]);
52
+
53
+ function escapeHtml(value) {
54
+ return String(value)
55
+ .replace(/&/g, "&amp;")
56
+ .replace(/</g, "&lt;")
57
+ .replace(/>/g, "&gt;")
58
+ .replace(/"/g, "&quot;")
59
+ .replace(/'/g, "&#39;");
60
+ }
61
+
62
+ function sanitizeSvgNode(node, allowedTags = DEFAULT_ALLOWED_SVG_TAGS, allowedAttrs = DEFAULT_ALLOWED_SVG_ATTRS) {
63
+ if (!node) {
64
+ return null;
65
+ }
66
+
67
+ if (node.nodeType === Node.TEXT_NODE) {
68
+ return document.createTextNode(node.textContent || "");
69
+ }
70
+
71
+ if (node.nodeType !== Node.ELEMENT_NODE) {
72
+ return null;
73
+ }
74
+
75
+ const tagName = node.tagName.toLowerCase();
76
+ if (!allowedTags.has(tagName)) {
77
+ return null;
78
+ }
79
+
80
+ const safeNode = document.createElementNS(SVG_NAMESPACE, tagName);
81
+
82
+ Array.from(node.attributes || []).forEach((attr) => {
83
+ const name = attr.name.toLowerCase();
84
+ const attrValue = attr.value || "";
85
+
86
+ if (!allowedAttrs.has(name) || name.startsWith("on")) {
87
+ return;
88
+ }
89
+
90
+ if ((name === "href" || name === "xlink:href") && attrValue && !attrValue.startsWith("#")) {
91
+ return;
92
+ }
93
+
94
+ safeNode.setAttribute(name, attrValue);
95
+ });
96
+
97
+ Array.from(node.childNodes || []).forEach((child) => {
98
+ const safeChild = sanitizeSvgNode(child, allowedTags, allowedAttrs);
99
+ if (safeChild) {
100
+ safeNode.append(safeChild);
101
+ }
102
+ });
103
+
104
+ return safeNode;
105
+ }
106
+
107
+ export function toSafeHtmlString(value, {
108
+ allowedSvgTags = DEFAULT_ALLOWED_SVG_TAGS,
109
+ allowedSvgAttrs = DEFAULT_ALLOWED_SVG_ATTRS
110
+ } = {}) {
111
+ if (value === null || value === undefined) {
112
+ return "";
113
+ }
114
+
115
+ const content = String(value).trim();
116
+ if (!content) {
117
+ return "";
118
+ }
119
+
120
+ if (!content.includes("<")) {
121
+ return escapeHtml(content);
122
+ }
123
+
124
+ const template = document.createElement("template");
125
+ template.innerHTML = content;
126
+
127
+ const sanitizedParts = Array.from(template.content.childNodes)
128
+ .map((node) => sanitizeSvgNode(node, allowedSvgTags, allowedSvgAttrs))
129
+ .filter(Boolean)
130
+ .map((node) => {
131
+ if (node.nodeType === Node.TEXT_NODE) {
132
+ return escapeHtml(node.textContent || "");
133
+ }
134
+ if (node.nodeType === Node.ELEMENT_NODE) {
135
+ return node.outerHTML;
136
+ }
137
+ return "";
138
+ });
139
+
140
+ const sanitized = sanitizedParts.join("");
141
+ return sanitized || escapeHtml(content);
142
+ }
143
+
144
+ class Sanitize {
145
+ static toSafeHtmlString(value, options) {
146
+ return toSafeHtmlString(value, options);
147
+ }
148
+ }
149
+
150
+ export default Sanitize;
@@ -1,140 +1,140 @@
1
- const VIDEO_EXTENSIONS = new Set([
2
- 'mp4',
3
- 'webm',
4
- 'mov',
5
- 'mkv',
6
- 'avi',
7
- 'm4v',
8
- 'ogv'
9
- ]);
10
-
11
- const getFileExtension = (file) => {
12
- const fileName = String(file?.name || '').toLowerCase();
13
- const dot = fileName.lastIndexOf('.');
14
- if (dot < 0 || dot >= fileName.length - 1) {
15
- return '';
16
- }
17
- return fileName.slice(dot + 1);
18
- };
19
-
20
- const waitEvent = (node, eventName) => new Promise((resolve, reject) => {
21
- const onResolve = () => {
22
- cleanup();
23
- resolve(true);
24
- };
25
-
26
- const onReject = () => {
27
- cleanup();
28
- reject(new Error(eventName));
29
- };
30
-
31
- const cleanup = () => {
32
- node.removeEventListener(eventName, onResolve);
33
- node.removeEventListener('error', onReject);
34
- };
35
-
36
- node.addEventListener(eventName, onResolve, { once: true });
37
- node.addEventListener('error', onReject, { once: true });
38
- });
39
-
40
- const seekVideo = (video, time) => new Promise((resolve, reject) => {
41
- const onSeeked = () => {
42
- cleanup();
43
- resolve(true);
44
- };
45
-
46
- const onError = () => {
47
- cleanup();
48
- reject(new Error('seek'));
49
- };
50
-
51
- const cleanup = () => {
52
- video.removeEventListener('seeked', onSeeked);
53
- video.removeEventListener('error', onError);
54
- };
55
-
56
- video.addEventListener('seeked', onSeeked, { once: true });
57
- video.addEventListener('error', onError, { once: true });
58
- video.currentTime = time;
59
- });
60
-
61
- const canvasToBlob = (canvas, type = 'image/jpeg', quality = 0.92) => new Promise((resolve) => {
62
- canvas.toBlob((blob) => resolve(blob || null), type, quality);
63
- });
64
-
65
- const extractVideoMetadata = async (file) => {
66
- if (!(file instanceof File)) {
67
- return null;
68
- }
69
-
70
- const ext = getFileExtension(file);
71
- const isVideoType = String(file.type || '').toLowerCase().startsWith('video/');
72
- if (!isVideoType && !VIDEO_EXTENSIONS.has(ext)) {
73
- return null;
74
- }
75
-
76
- if (!file.size) {
77
- return null;
78
- }
79
-
80
- let objectUrl = '';
81
- try {
82
- objectUrl = URL.createObjectURL(file);
83
-
84
- const video = document.createElement('video');
85
- video.preload = 'metadata';
86
- video.muted = true;
87
- video.playsInline = true;
88
- video.crossOrigin = 'anonymous';
89
- video.src = objectUrl;
90
-
91
- await waitEvent(video, 'loadedmetadata');
92
-
93
- const width = Number(video.videoWidth || 0);
94
- const height = Number(video.videoHeight || 0);
95
- const duration = Number(video.duration || 0);
96
-
97
- if (!width || !height || !Number.isFinite(width) || !Number.isFinite(height)) {
98
- return {
99
- duration: Number.isFinite(duration) ? duration : 0,
100
- width: 0,
101
- height: 0
102
- };
103
- }
104
-
105
- const seekTime = duration > 1 ? Math.min(1, Math.max(0, duration / 2)) : 0;
106
- await seekVideo(video, seekTime);
107
-
108
- const canvas = document.createElement('canvas');
109
- canvas.width = width;
110
- canvas.height = height;
111
- const ctx = canvas.getContext('2d');
112
- if (!ctx) {
113
- return {
114
- duration: Number.isFinite(duration) ? duration : 0,
115
- width,
116
- height
117
- };
118
- }
119
-
120
- ctx.drawImage(video, 0, 0, width, height);
121
- const posterBlob = await canvasToBlob(canvas, 'image/jpeg', 0.92);
122
-
123
- return {
124
- duration: Number.isFinite(duration) ? duration : 0,
125
- width,
126
- height,
127
- posterBlob: posterBlob || null
128
- };
129
- } catch {
130
- return null;
131
- } finally {
132
- if (objectUrl) {
133
- URL.revokeObjectURL(objectUrl);
134
- }
135
- }
136
- };
137
-
138
- export {
139
- extractVideoMetadata
140
- };
1
+ const VIDEO_EXTENSIONS = new Set([
2
+ 'mp4',
3
+ 'webm',
4
+ 'mov',
5
+ 'mkv',
6
+ 'avi',
7
+ 'm4v',
8
+ 'ogv'
9
+ ]);
10
+
11
+ const getFileExtension = (file) => {
12
+ const fileName = String(file?.name || '').toLowerCase();
13
+ const dot = fileName.lastIndexOf('.');
14
+ if (dot < 0 || dot >= fileName.length - 1) {
15
+ return '';
16
+ }
17
+ return fileName.slice(dot + 1);
18
+ };
19
+
20
+ const waitEvent = (node, eventName) => new Promise((resolve, reject) => {
21
+ const onResolve = () => {
22
+ cleanup();
23
+ resolve(true);
24
+ };
25
+
26
+ const onReject = () => {
27
+ cleanup();
28
+ reject(new Error(eventName));
29
+ };
30
+
31
+ const cleanup = () => {
32
+ node.removeEventListener(eventName, onResolve);
33
+ node.removeEventListener('error', onReject);
34
+ };
35
+
36
+ node.addEventListener(eventName, onResolve, { once: true });
37
+ node.addEventListener('error', onReject, { once: true });
38
+ });
39
+
40
+ const seekVideo = (video, time) => new Promise((resolve, reject) => {
41
+ const onSeeked = () => {
42
+ cleanup();
43
+ resolve(true);
44
+ };
45
+
46
+ const onError = () => {
47
+ cleanup();
48
+ reject(new Error('seek'));
49
+ };
50
+
51
+ const cleanup = () => {
52
+ video.removeEventListener('seeked', onSeeked);
53
+ video.removeEventListener('error', onError);
54
+ };
55
+
56
+ video.addEventListener('seeked', onSeeked, { once: true });
57
+ video.addEventListener('error', onError, { once: true });
58
+ video.currentTime = time;
59
+ });
60
+
61
+ const canvasToBlob = (canvas, type = 'image/jpeg', quality = 0.92) => new Promise((resolve) => {
62
+ canvas.toBlob((blob) => resolve(blob || null), type, quality);
63
+ });
64
+
65
+ const extractVideoMetadata = async (file) => {
66
+ if (!(file instanceof File)) {
67
+ return null;
68
+ }
69
+
70
+ const ext = getFileExtension(file);
71
+ const isVideoType = String(file.type || '').toLowerCase().startsWith('video/');
72
+ if (!isVideoType && !VIDEO_EXTENSIONS.has(ext)) {
73
+ return null;
74
+ }
75
+
76
+ if (!file.size) {
77
+ return null;
78
+ }
79
+
80
+ let objectUrl = '';
81
+ try {
82
+ objectUrl = URL.createObjectURL(file);
83
+
84
+ const video = document.createElement('video');
85
+ video.preload = 'metadata';
86
+ video.muted = true;
87
+ video.playsInline = true;
88
+ video.crossOrigin = 'anonymous';
89
+ video.src = objectUrl;
90
+
91
+ await waitEvent(video, 'loadedmetadata');
92
+
93
+ const width = Number(video.videoWidth || 0);
94
+ const height = Number(video.videoHeight || 0);
95
+ const duration = Number(video.duration || 0);
96
+
97
+ if (!width || !height || !Number.isFinite(width) || !Number.isFinite(height)) {
98
+ return {
99
+ duration: Number.isFinite(duration) ? duration : 0,
100
+ width: 0,
101
+ height: 0
102
+ };
103
+ }
104
+
105
+ const seekTime = duration > 1 ? Math.min(1, Math.max(0, duration / 2)) : 0;
106
+ await seekVideo(video, seekTime);
107
+
108
+ const canvas = document.createElement('canvas');
109
+ canvas.width = width;
110
+ canvas.height = height;
111
+ const ctx = canvas.getContext('2d');
112
+ if (!ctx) {
113
+ return {
114
+ duration: Number.isFinite(duration) ? duration : 0,
115
+ width,
116
+ height
117
+ };
118
+ }
119
+
120
+ ctx.drawImage(video, 0, 0, width, height);
121
+ const posterBlob = await canvasToBlob(canvas, 'image/jpeg', 0.92);
122
+
123
+ return {
124
+ duration: Number.isFinite(duration) ? duration : 0,
125
+ width,
126
+ height,
127
+ posterBlob: posterBlob || null
128
+ };
129
+ } catch {
130
+ return null;
131
+ } finally {
132
+ if (objectUrl) {
133
+ URL.revokeObjectURL(objectUrl);
134
+ }
135
+ }
136
+ };
137
+
138
+ export {
139
+ extractVideoMetadata
140
+ };