vgapp 1.3.0 → 1.3.2

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 (89) hide show
  1. package/README.md +133 -133
  2. package/app/langs/en/buttons.json +17 -17
  3. package/app/langs/en/messages.json +36 -36
  4. package/app/langs/ru/buttons.json +17 -17
  5. package/app/langs/ru/messages.json +36 -36
  6. package/app/modules/base-module.js +111 -111
  7. package/app/modules/vgalert/js/vgalert.js +52 -29
  8. package/app/modules/vgalert/readme.md +105 -105
  9. package/app/modules/vgdynamictable/index.js +5 -5
  10. package/app/modules/vgdynamictable/js/editable.js +19 -19
  11. package/app/modules/vgdynamictable/js/filters.js +21 -21
  12. package/app/modules/vgdynamictable/js/fixed.js +179 -179
  13. package/app/modules/vgdynamictable/js/pagination.js +1 -1
  14. package/app/modules/vgdynamictable/js/search.js +12 -12
  15. package/app/modules/vgdynamictable/js/sortable.js +71 -71
  16. package/app/modules/vgdynamictable/js/summary-footer.js +28 -28
  17. package/app/modules/vgdynamictable/js/table-remote.js +79 -79
  18. package/app/modules/vgdynamictable/js/table-url-state.js +31 -31
  19. package/app/modules/vgdynamictable/js/utils/common.js +48 -48
  20. package/app/modules/vgdynamictable/js/vgdynamictable.js +268 -268
  21. package/app/modules/vgdynamictable/readme.md +250 -250
  22. package/app/modules/vgdynamictable/scss/_skeleton.scss +6 -6
  23. package/app/modules/vgdynamictable/scss/_sortable.scss +24 -24
  24. package/app/modules/vgdynamictable/scss/_table.scss +4 -4
  25. package/app/modules/vgdynamictable/scss/_variables.scss +79 -79
  26. package/app/modules/vgdynamictable/scss/vgdynamictable.scss +27 -27
  27. package/app/modules/vgfilepreview/js/i18n.js +56 -56
  28. package/app/modules/vgfilepreview/js/renderers/image-modal.js +145 -145
  29. package/app/modules/vgfilepreview/js/renderers/image.js +92 -92
  30. package/app/modules/vgfilepreview/js/renderers/index.js +19 -19
  31. package/app/modules/vgfilepreview/js/renderers/office-modal.js +168 -168
  32. package/app/modules/vgfilepreview/js/renderers/office.js +79 -79
  33. package/app/modules/vgfilepreview/js/renderers/pdf-modal.js +260 -260
  34. package/app/modules/vgfilepreview/js/renderers/pdf.js +76 -76
  35. package/app/modules/vgfilepreview/js/renderers/playlist.js +71 -71
  36. package/app/modules/vgfilepreview/js/renderers/text-modal.js +343 -343
  37. package/app/modules/vgfilepreview/js/renderers/text.js +83 -83
  38. package/app/modules/vgfilepreview/js/renderers/video-modal.js +272 -272
  39. package/app/modules/vgfilepreview/js/renderers/video.js +80 -80
  40. package/app/modules/vgfilepreview/js/renderers/zip-modal.js +522 -522
  41. package/app/modules/vgfilepreview/js/renderers/zip.js +89 -89
  42. package/app/modules/vgfilepreview/js/vgfilepreview.js +7 -7
  43. package/app/modules/vgfilepreview/readme.md +68 -68
  44. package/app/modules/vgfilepreview/scss/_variables.scss +113 -113
  45. package/app/modules/vgfilepreview/scss/vgfilepreview.scss +464 -464
  46. package/app/modules/vgfiles/js/base.js +26 -26
  47. package/app/modules/vgfiles/js/droppable.js +260 -260
  48. package/app/modules/vgfiles/js/render.js +153 -153
  49. package/app/modules/vgfiles/js/vgfiles.js +104 -104
  50. package/app/modules/vgfiles/readme.md +123 -123
  51. package/app/modules/vgfiles/scss/_variables.scss +18 -18
  52. package/app/modules/vgfiles/scss/vgfiles.scss +148 -148
  53. package/app/modules/vgformsender/js/hideshowpass.js +16 -16
  54. package/app/modules/vgformsender/scss/vgformsender.scss +34 -34
  55. package/app/modules/vgmodal/js/vgmodal.drag.js +332 -332
  56. package/app/modules/vgmodal/js/vgmodal.js +188 -188
  57. package/app/modules/vgmodal/js/vgmodal.resize.js +27 -27
  58. package/app/modules/vgmodal/scss/vgmodal.scss +14 -14
  59. package/app/modules/vgnav/js/vgnav.js +135 -135
  60. package/app/modules/vgnav/readme.md +67 -67
  61. package/app/modules/vgnestable/README.md +307 -307
  62. package/app/modules/vgnestable/scss/_variables.scss +60 -60
  63. package/app/modules/vgnestable/scss/vgnestable.scss +163 -163
  64. package/app/modules/vgrangeslider/js/skins.js +222 -222
  65. package/app/modules/vgrangeslider/js/vgrangeslider.js +704 -704
  66. package/app/modules/vgrangeslider/readme.md +523 -523
  67. package/app/modules/vgrangeslider/scss/_variables.scss +53 -53
  68. package/app/modules/vgrangeslider/scss/vgrangeslider.scss +240 -240
  69. package/app/modules/vgselect/js/vgselect.js +39 -39
  70. package/app/modules/vgselect/scss/vgselect.scss +22 -22
  71. package/app/modules/vgspy/readme.md +28 -28
  72. package/app/modules/vgtoast/readme.md +18 -18
  73. package/app/modules/vgtoast/scss/vgtoast.scss +48 -48
  74. package/app/modules/vgtooltip/js/vgtooltip.js +89 -89
  75. package/app/modules/vgtooltip/readme.md +181 -181
  76. package/app/utils/js/components/ajax.js +117 -117
  77. package/app/utils/js/components/audio-metadata.js +240 -240
  78. package/app/utils/js/components/backdrop.js +17 -17
  79. package/app/utils/js/components/file-icon.js +109 -109
  80. package/app/utils/js/components/file-preview.js +304 -304
  81. package/app/utils/js/components/sanitize.js +150 -150
  82. package/app/utils/js/components/video-metadata.js +140 -140
  83. package/app/vgapp.js +130 -107
  84. package/build/vgapp.css +1 -1
  85. package/build/vgapp.css.map +1 -1
  86. package/build/vgapp.js +1 -1
  87. package/build/vgapp.js.map +1 -1
  88. package/index.js +14 -14
  89. package/package.json +1 -1
@@ -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
+ };