@edifice.io/utilities 2.6.9-develop-enabling.20261013152718 → 2.6.9-develop.20261013171251
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.
- package/dist/add-timestamp-to-url/add-timestamp-to-url.cjs +1 -1
- package/dist/add-timestamp-to-url/add-timestamp-to-url.js +6 -6
- package/dist/custom-size/custom-size.cjs +1 -1
- package/dist/custom-size/custom-size.js +7 -12
- package/dist/get-or-generate-blobId/get-or-generate-blobId.cjs +1 -1
- package/dist/get-or-generate-blobId/get-or-generate-blobId.js +14 -14
- package/dist/get-thumbnail/get-thumbnail.cjs +1 -1
- package/dist/get-thumbnail/get-thumbnail.js +5 -5
- package/dist/image-resizer/image-resizer.cjs +1 -1
- package/dist/image-resizer/image-resizer.js +95 -40
- package/dist/index.cjs +1 -1
- package/dist/index.js +25 -13
- package/dist/library-maps/library-maps.cjs +1 -1
- package/dist/library-maps/library-maps.js +11 -11
- package/dist/mime-type-utils/mime-type-utils.cjs +1 -1
- package/dist/mime-type-utils/mime-type-utils.js +144 -48
- package/dist/noop/noop.cjs +1 -1
- package/dist/noop/noop.js +5 -4
- package/dist/string-utils/string-utils.cjs +1 -1
- package/dist/string-utils/string-utils.js +16 -16
- package/dist/time/time.cjs +1 -1
- package/dist/time/time.js +11 -10
- package/dist/video/video.cjs +1 -1
- package/dist/video/video.js +8 -8
- package/package.json +3 -3
- package/dist/mime-type-utils/index.cjs +0 -1
- package/dist/mime-type-utils/index.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function m(e){const t=new Date().getTime(),a=e.includes("?")?"&":"?";return`${e}${a}timestamp=${t}`}exports.addTimestampToImageUrl=m;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return `${e}${e.includes("?") ? "&" : "?"}timestamp=${t}`;
|
|
1
|
+
function m(t) {
|
|
2
|
+
const e = (/* @__PURE__ */ new Date()).getTime(), a = t.includes("?") ? "&" : "?";
|
|
3
|
+
return `${t}${a}timestamp=${e}`;
|
|
5
4
|
}
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
export {
|
|
6
|
+
m as addTimestampToImageUrl
|
|
7
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=(o,r)=>{if(o==0)return"0 octets";const t=1e3,i=r||2,s=["octets","Ko","Mo","Go"],e=Math.floor(Math.log(o)/Math.log(t));return parseFloat((o/Math.pow(t,e)).toFixed(i))+" "+s[e]};exports.customSize=a;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"Go"
|
|
9
|
-
], a = Math.floor(Math.log(e) / Math.log(n));
|
|
10
|
-
return parseFloat((e / n ** a).toFixed(r)) + " " + i[a];
|
|
1
|
+
const c = (o, r) => {
|
|
2
|
+
if (o == 0) return "0 octets";
|
|
3
|
+
const t = 1e3, a = r || 2, s = ["octets", "Ko", "Mo", "Go"], e = Math.floor(Math.log(o) / Math.log(t));
|
|
4
|
+
return parseFloat((o / Math.pow(t, e)).toFixed(a)) + " " + s[e];
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
c as customSize
|
|
11
8
|
};
|
|
12
|
-
//#endregion
|
|
13
|
-
export { e as customSize };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../string-utils/string-utils.cjs"),a=(e,r)=>{const t="virtualID";if(!Object.hasOwnProperty.apply(e,[t])){const i=r??`${n.StringUtils.generateVirtualId()}#${e.size}`;Object.defineProperty(e,t,{value:i,writable:!1})}return e[t]};exports.getOrGenerateBlobId=a;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { StringUtils as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { StringUtils as i } from "../string-utils/string-utils.js";
|
|
2
|
+
const s = (e, r) => {
|
|
3
|
+
const t = "virtualID";
|
|
4
|
+
if (!Object.hasOwnProperty.apply(e, [t])) {
|
|
5
|
+
const a = r ?? `${i.generateVirtualId()}#${e.size}`;
|
|
6
|
+
Object.defineProperty(e, t, {
|
|
7
|
+
value: a,
|
|
8
|
+
writable: !1
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
return e[t];
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
s as getOrGenerateBlobId
|
|
13
15
|
};
|
|
14
|
-
//#endregion
|
|
15
|
-
export { t as getOrGenerateBlobId };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function n(e,i=0,t=0){return!e.includes("data:image")&&!e.includes("thumbnail")&&(e=e+(e.includes("?")?"&thumbnail=":"?thumbnail=")+`${i}x${t}`),e}exports.getThumbnail=n;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return !e.includes("data:image") && !e.includes("thumbnail") && (e = e + (e.includes("?") ? "&thumbnail=" : "?thumbnail=") + `${t}x${n}`), e;
|
|
1
|
+
function t(i, n = 0, u = 0) {
|
|
2
|
+
return !i.includes("data:image") && !i.includes("thumbnail") && (i = i + (i.includes("?") ? "&thumbnail=" : "?thumbnail=") + `${n}x${u}`), i;
|
|
4
3
|
}
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export {
|
|
5
|
+
t as getThumbnail
|
|
6
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";class p{static changeDimension(e,n,t,r){return t>r&&(e=Math.round(e*r/t),t=r),e>n&&(t=Math.round(t*n/e),e=n),{height:e,width:t}}static renameFileNameExtension(e,n){const t=e.split(".");return t.pop(),t.join(".")+"."+n}static resizeImage(e,n,t,r,o="jpeg",g=80){const a=g/100,i=document.createElement("canvas"),l=`image/${o}`;let c=e.width,m=e.height;const h=this.changeDimension(m,r,c,t);c=h.width,m=h.height;const s=i.getContext("2d");return s&&(i.width=c,i.height=m,s.fillStyle="white",s.fillRect(0,0,i.width,i.height),s.imageSmoothingEnabled&&s.imageSmoothingQuality&&(s.imageSmoothingQuality="high"),s.drawImage(e,0,0,c,m)),new Promise((w,d)=>{i.toBlob(u=>{u?w(new File([u],n,{type:l,lastModified:new Date().getTime()})):d()},l,a)})}static async resizeImageFile(e,n=1440,t=1440,r=80){if(!e)throw Error("Image resizer: file not found!");if(!e.type||!e.type.startsWith("image/"))throw Error("Image resizer: the file given is not an image.");const o="jpeg";return new Promise(g=>{const a=new Image;a.setAttribute("style","max-width: none;"),a.src=URL.createObjectURL(e),a.onload=async()=>{const i=await this.resizeImage(a,this.renameFileNameExtension(e.name,o),n,t,o,r);g(i)},a.onerror=i=>{throw Error("Image Loading Error: "+i)}})}}module.exports=p;
|
|
@@ -1,41 +1,96 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
class p {
|
|
2
|
+
/**
|
|
3
|
+
* Adjusts the dimensions of an image to fit within the specified maximum width and height,
|
|
4
|
+
* preserving the aspect ratio.
|
|
5
|
+
*
|
|
6
|
+
* @param height - The original height of the image.
|
|
7
|
+
* @param maxHeight - The maximum allowed height for the image.
|
|
8
|
+
* @param width - The original width of the image.
|
|
9
|
+
* @param maxWidth - The maximum allowed width for the image.
|
|
10
|
+
* @returns An object containing the adjusted height and width of the image.
|
|
11
|
+
*/
|
|
12
|
+
static changeDimension(e, n, t, a) {
|
|
13
|
+
return t > a && (e = Math.round(e * a / t), t = a), e > n && (t = Math.round(t * n / e), e = n), { height: e, width: t };
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Renames the file extension of a given filename.
|
|
17
|
+
*
|
|
18
|
+
* @param filename - The original filename whose extension needs to be changed.
|
|
19
|
+
* @param newExtension - The new extension to be applied to the filename.
|
|
20
|
+
* @returns The filename with the new extension.
|
|
21
|
+
*/
|
|
22
|
+
static renameFileNameExtension(e, n) {
|
|
23
|
+
const t = e.split(".");
|
|
24
|
+
return t.pop(), t.join(".") + "." + n;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Resizes an image to the specified dimensions and compresses it to the specified format and quality.
|
|
28
|
+
*
|
|
29
|
+
* @param image - The HTMLImageElement to be resized.
|
|
30
|
+
* @param fileName - The name of the output file.
|
|
31
|
+
* @param maxWidth - The maximum width of the resized image.
|
|
32
|
+
* @param maxHeight - The maximum height of the resized image.
|
|
33
|
+
* @param compressFormat - The format to compress the image to (default is "jpeg").
|
|
34
|
+
* @param quality - The quality of the compressed image, as a percentage (default is 80).
|
|
35
|
+
* @returns A Promise that resolves to a File object containing the resized and compressed image.
|
|
36
|
+
*/
|
|
37
|
+
static resizeImage(e, n, t, a, s = "jpeg", g = 80) {
|
|
38
|
+
const r = g / 100, i = document.createElement("canvas"), l = `image/${s}`;
|
|
39
|
+
let c = e.width, m = e.height;
|
|
40
|
+
const h = this.changeDimension(
|
|
41
|
+
m,
|
|
42
|
+
a,
|
|
43
|
+
c,
|
|
44
|
+
t
|
|
45
|
+
);
|
|
46
|
+
c = h.width, m = h.height;
|
|
47
|
+
const o = i.getContext("2d");
|
|
48
|
+
return o && (i.width = c, i.height = m, o.fillStyle = "white", o.fillRect(0, 0, i.width, i.height), o.imageSmoothingEnabled && o.imageSmoothingQuality && (o.imageSmoothingQuality = "high"), o.drawImage(e, 0, 0, c, m)), new Promise((u, w) => {
|
|
49
|
+
i.toBlob(
|
|
50
|
+
(d) => {
|
|
51
|
+
d ? u(
|
|
52
|
+
new File([d], n, {
|
|
53
|
+
type: l,
|
|
54
|
+
lastModified: (/* @__PURE__ */ new Date()).getTime()
|
|
55
|
+
})
|
|
56
|
+
) : w();
|
|
57
|
+
},
|
|
58
|
+
l,
|
|
59
|
+
r
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Resize and compress Image File in JPEG format (other format don't work well with canvas.toBlob() with quality parameter)
|
|
65
|
+
* @param file The image file to resize
|
|
66
|
+
* @param maxWidth The maximum width of the resized image
|
|
67
|
+
* @param maxHeight The maximum height of the resized image
|
|
68
|
+
* @param quality The quality of the compressed image
|
|
69
|
+
* @returns The resized image file
|
|
70
|
+
*/
|
|
71
|
+
static async resizeImageFile(e, n = 1440, t = 1440, a = 80) {
|
|
72
|
+
if (!e) throw Error("Image resizer: file not found!");
|
|
73
|
+
if (!e.type || !e.type.startsWith("image/"))
|
|
74
|
+
throw Error("Image resizer: the file given is not an image.");
|
|
75
|
+
const s = "jpeg";
|
|
76
|
+
return new Promise((g) => {
|
|
77
|
+
const r = new Image();
|
|
78
|
+
r.setAttribute("style", "max-width: none;"), r.src = URL.createObjectURL(e), r.onload = async () => {
|
|
79
|
+
const i = await this.resizeImage(
|
|
80
|
+
r,
|
|
81
|
+
this.renameFileNameExtension(e.name, s),
|
|
82
|
+
n,
|
|
83
|
+
t,
|
|
84
|
+
s,
|
|
85
|
+
a
|
|
86
|
+
);
|
|
87
|
+
g(i);
|
|
88
|
+
}, r.onerror = (i) => {
|
|
89
|
+
throw Error("Image Loading Error: " + i);
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export {
|
|
95
|
+
p as default
|
|
39
96
|
};
|
|
40
|
-
//#endregion
|
|
41
|
-
export { e as default };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./add-timestamp-to-url/add-timestamp-to-url.cjs"),r=require("./custom-size/custom-size.cjs"),i=require("./get-or-generate-blobId/get-or-generate-blobId.cjs"),s=require("./get-thumbnail/get-thumbnail.cjs"),o=require("./image-resizer/image-resizer.cjs"),a=require("./library-maps/library-maps.cjs"),n=require("./mime-type-utils/mime-type-utils.cjs"),m=require("./noop/noop.cjs"),u=require("./string-utils/string-utils.cjs"),e=require("./time/time.cjs"),l=require("./video/video.cjs");exports.addTimestampToImageUrl=t.addTimestampToImageUrl;exports.customSize=r.customSize;exports.getOrGenerateBlobId=i.getOrGenerateBlobId;exports.getThumbnail=s.getThumbnail;exports.ImageResizer=o;exports.libraryMaps=a.libraryMaps;exports.MimeTypeUtils=n.MimeTypeUtils;exports.NOOP=m.NOOP;exports.StringUtils=u.StringUtils;exports.convertMsToMS=e.convertMsToMS;exports.padTo2Digits=e.padTo2Digits;exports.getBestSupportedMimeType=l.getBestSupportedMimeType;
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
|
-
import { addTimestampToImageUrl as
|
|
2
|
-
import { customSize as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import "./
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { addTimestampToImageUrl as o } from "./add-timestamp-to-url/add-timestamp-to-url.js";
|
|
2
|
+
import { customSize as m } from "./custom-size/custom-size.js";
|
|
3
|
+
import { getOrGenerateBlobId as f } from "./get-or-generate-blobId/get-or-generate-blobId.js";
|
|
4
|
+
import { getThumbnail as a } from "./get-thumbnail/get-thumbnail.js";
|
|
5
|
+
import { default as s } from "./image-resizer/image-resizer.js";
|
|
6
|
+
import { libraryMaps as l } from "./library-maps/library-maps.js";
|
|
7
|
+
import { MimeTypeUtils as d } from "./mime-type-utils/mime-type-utils.js";
|
|
8
|
+
import { NOOP as n } from "./noop/noop.js";
|
|
9
|
+
import { StringUtils as S } from "./string-utils/string-utils.js";
|
|
10
|
+
import { convertMsToMS as y, padTo2Digits as I } from "./time/time.js";
|
|
11
|
+
import { getBestSupportedMimeType as U } from "./video/video.js";
|
|
12
|
+
export {
|
|
13
|
+
s as ImageResizer,
|
|
14
|
+
d as MimeTypeUtils,
|
|
15
|
+
n as NOOP,
|
|
16
|
+
S as StringUtils,
|
|
17
|
+
o as addTimestampToImageUrl,
|
|
18
|
+
y as convertMsToMS,
|
|
19
|
+
m as customSize,
|
|
20
|
+
U as getBestSupportedMimeType,
|
|
21
|
+
f as getOrGenerateBlobId,
|
|
22
|
+
a as getThumbnail,
|
|
23
|
+
l as libraryMaps,
|
|
24
|
+
I as padTo2Digits
|
|
25
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={blog:"Blog",mindmap:"MindMap",scrapbook:"ScrapBook",collaborativewall:"CollaborativeWall",timelinegenerator:"TimelineGenerator",wiki:"Wiki",exercizer:"Exercizer"};exports.libraryMaps=e;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
const e = {
|
|
2
|
+
blog: "Blog",
|
|
3
|
+
mindmap: "MindMap",
|
|
4
|
+
scrapbook: "ScrapBook",
|
|
5
|
+
collaborativewall: "CollaborativeWall",
|
|
6
|
+
timelinegenerator: "TimelineGenerator",
|
|
7
|
+
wiki: "Wiki",
|
|
8
|
+
exercizer: "Exercizer"
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
e as libraryMaps
|
|
10
12
|
};
|
|
11
|
-
//#endregion
|
|
12
|
-
export { e as libraryMaps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
"use strict";var p=Object.defineProperty;var d=(i,t,s)=>t in i?p(i,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[t]=s;var n=(i,t,s)=>d(i,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=class o{constructor(){n(this,"wordExtensions",new Set);n(this,"excelExtensions",new Set);n(this,"pptExtensions",new Set);n(this,"fileExtensionMap",new Map);n(this,"csvContentType",new Set);n(this,"csvExtensions",new Set);n(this,"txtExtensions",new Set);n(this,"mdExtensions",new Set);n(this,"PDF","application/pdf");n(this,"OCTET_STREAM","application/octet-stream");this.txtExtensions.add("txt"),this.mdExtensions.add("md"),this.wordExtensions.add("doc"),this.wordExtensions.add("dot"),this.wordExtensions.add("docx"),this.wordExtensions.add("dotx"),this.wordExtensions.add("docm"),this.wordExtensions.add("dotm"),this.wordExtensions.add("odt"),this.wordExtensions.add("ott"),this.wordExtensions.add("oth"),this.wordExtensions.add("odm"),this.excelExtensions.add("xls"),this.excelExtensions.add("xlt"),this.excelExtensions.add("xla"),this.excelExtensions.add("xlsx"),this.excelExtensions.add("xltx"),this.excelExtensions.add("xlsm"),this.excelExtensions.add("xltm"),this.excelExtensions.add("xlam"),this.excelExtensions.add("xlsb"),this.excelExtensions.add("ods"),this.excelExtensions.add("ots"),this.pptExtensions.add("ppt"),this.pptExtensions.add("pot"),this.pptExtensions.add("pps"),this.pptExtensions.add("ppa"),this.pptExtensions.add("pptx"),this.pptExtensions.add("potx"),this.pptExtensions.add("ppsx"),this.pptExtensions.add("ppam"),this.pptExtensions.add("pptm"),this.pptExtensions.add("potm"),this.pptExtensions.add("ppsm"),this.pptExtensions.add("odp"),this.pptExtensions.add("otp"),this.csvExtensions.add("csv"),this.fileExtensionMap.set("doc","application/msword"),this.fileExtensionMap.set("dot","application/msword"),this.fileExtensionMap.set("docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"),this.fileExtensionMap.set("dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"),this.fileExtensionMap.set("docm","application/vnd.ms-word.document.macroEnabled.12"),this.fileExtensionMap.set("dotm","application/vnd.ms-word.template.macroEnabled.12"),this.fileExtensionMap.set("xls","application/vnd.ms-excel"),this.fileExtensionMap.set("xlt","application/vnd.ms-excel"),this.fileExtensionMap.set("xla","application/vnd.ms-excel"),this.fileExtensionMap.set("xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),this.fileExtensionMap.set("xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"),this.fileExtensionMap.set("xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"),this.fileExtensionMap.set("xltm","application/vnd.ms-excel.template.macroEnabled.12"),this.fileExtensionMap.set("xlam","application/vnd.ms-excel.addin.macroEnabled.12"),this.fileExtensionMap.set("xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"),this.fileExtensionMap.set("ppt","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("pot","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("pps","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("ppa","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"),this.fileExtensionMap.set("potx","application/vnd.openxmlformats-officedocument.presentationml.template"),this.fileExtensionMap.set("ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"),this.fileExtensionMap.set("ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"),this.fileExtensionMap.set("pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"),this.fileExtensionMap.set("potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"),this.fileExtensionMap.set("ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"),this.fileExtensionMap.set("odt","application/vnd.oasis.opendocument.text"),this.fileExtensionMap.set("ott","application/vnd.oasis.opendocument.text-template"),this.fileExtensionMap.set("oth","application/vnd.oasis.opendocument.text-web"),this.fileExtensionMap.set("odm","application/vnd.oasis.opendocument.text-master"),this.fileExtensionMap.set("odg","application/vnd.oasis.opendocument.graphics"),this.fileExtensionMap.set("otg","application/vnd.oasis.opendocument.graphics-template"),this.fileExtensionMap.set("odp","application/vnd.oasis.opendocument.presentation"),this.fileExtensionMap.set("otp","application/vnd.oasis.opendocument.presentation-template"),this.fileExtensionMap.set("ods","application/vnd.oasis.opendocument.spreadsheet"),this.fileExtensionMap.set("ots","application/vnd.oasis.opendocument.spreadsheet-template"),this.fileExtensionMap.set("odc","application/vnd.oasis.opendocument.chart"),this.fileExtensionMap.set("odf","application/vnd.oasis.opendocument.formula"),this.fileExtensionMap.set("odb","application/vnd.oasis.opendocument.database"),this.fileExtensionMap.set("odi","application/vnd.oasis.opendocument.image"),this.fileExtensionMap.set("oxt","application/vnd.openofficeorg.extension"),this.fileExtensionMap.set("txt","text/plain"),this.fileExtensionMap.set("md","text/markdown"),this.csvContentType.add("text/comma-separated-values"),this.csvContentType.add("text/csv"),this.csvContentType.add("application/csv")}getContentTypeForExtension(t){return this.fileExtensionMap.has(t)?this.fileExtensionMap.get(t)??null:null}getExtensionForContentType(t){for(const s of Array.from(this.fileExtensionMap.keys()))if((this.fileExtensionMap.get(s)||"").toLowerCase()==(t||"").toLowerCase())return s;return null}isWordLike(t,s){const e=this.getExtensionForContentType(t);return e?this.wordExtensions.has(e):t==this.OCTET_STREAM&&s?this.wordExtensions.has(s):!1}isExcelLike(t,s){const e=this.getExtensionForContentType(t);return e?this.excelExtensions.has(e):t==this.OCTET_STREAM&&s?this.excelExtensions.has(s):!1}isCsvLike(t,s){return this.csvContentType.has(t)?!0:t==this.OCTET_STREAM&&s?this.csvExtensions.has(s):!1}isPowerpointLike(t,s){const e=this.getExtensionForContentType(t);return e?this.pptExtensions.has(e):t==this.OCTET_STREAM&&s?this.pptExtensions.has(s):!1}isTxtLike(t,s){const e=this.getExtensionForContentType(t);return e?this.txtExtensions.has(e):t==this.OCTET_STREAM&&s?this.txtExtensions.has(s):!1}isMdLike(t,s){const e=this.getExtensionForContentType(t);return e?this.mdExtensions.has(e):t==this.OCTET_STREAM&&s?this.mdExtensions.has(s):!1}};n(o,"INSTANCE",new o);let a=o;exports.MimeTypeUtils=a;
|
|
@@ -1,49 +1,145 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var d = (i, t, s) => t in i ? p(i, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[t] = s;
|
|
3
|
+
var n = (i, t, s) => d(i, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
+
const o = class o {
|
|
5
|
+
constructor() {
|
|
6
|
+
n(this, "wordExtensions", /* @__PURE__ */ new Set());
|
|
7
|
+
n(this, "excelExtensions", /* @__PURE__ */ new Set());
|
|
8
|
+
n(this, "pptExtensions", /* @__PURE__ */ new Set());
|
|
9
|
+
n(this, "fileExtensionMap", /* @__PURE__ */ new Map());
|
|
10
|
+
n(this, "csvContentType", /* @__PURE__ */ new Set());
|
|
11
|
+
n(this, "csvExtensions", /* @__PURE__ */ new Set());
|
|
12
|
+
n(this, "txtExtensions", /* @__PURE__ */ new Set());
|
|
13
|
+
n(this, "mdExtensions", /* @__PURE__ */ new Set());
|
|
14
|
+
n(this, "PDF", "application/pdf");
|
|
15
|
+
n(this, "OCTET_STREAM", "application/octet-stream");
|
|
16
|
+
this.txtExtensions.add("txt"), this.mdExtensions.add("md"), this.wordExtensions.add("doc"), this.wordExtensions.add("dot"), this.wordExtensions.add("docx"), this.wordExtensions.add("dotx"), this.wordExtensions.add("docm"), this.wordExtensions.add("dotm"), this.wordExtensions.add("odt"), this.wordExtensions.add("ott"), this.wordExtensions.add("oth"), this.wordExtensions.add("odm"), this.excelExtensions.add("xls"), this.excelExtensions.add("xlt"), this.excelExtensions.add("xla"), this.excelExtensions.add("xlsx"), this.excelExtensions.add("xltx"), this.excelExtensions.add("xlsm"), this.excelExtensions.add("xltm"), this.excelExtensions.add("xlam"), this.excelExtensions.add("xlsb"), this.excelExtensions.add("ods"), this.excelExtensions.add("ots"), this.pptExtensions.add("ppt"), this.pptExtensions.add("pot"), this.pptExtensions.add("pps"), this.pptExtensions.add("ppa"), this.pptExtensions.add("pptx"), this.pptExtensions.add("potx"), this.pptExtensions.add("ppsx"), this.pptExtensions.add("ppam"), this.pptExtensions.add("pptm"), this.pptExtensions.add("potm"), this.pptExtensions.add("ppsm"), this.pptExtensions.add("odp"), this.pptExtensions.add("otp"), this.csvExtensions.add("csv"), this.fileExtensionMap.set("doc", "application/msword"), this.fileExtensionMap.set("dot", "application/msword"), this.fileExtensionMap.set(
|
|
17
|
+
"docx",
|
|
18
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
19
|
+
), this.fileExtensionMap.set(
|
|
20
|
+
"dotx",
|
|
21
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.template"
|
|
22
|
+
), this.fileExtensionMap.set(
|
|
23
|
+
"docm",
|
|
24
|
+
"application/vnd.ms-word.document.macroEnabled.12"
|
|
25
|
+
), this.fileExtensionMap.set(
|
|
26
|
+
"dotm",
|
|
27
|
+
"application/vnd.ms-word.template.macroEnabled.12"
|
|
28
|
+
), this.fileExtensionMap.set("xls", "application/vnd.ms-excel"), this.fileExtensionMap.set("xlt", "application/vnd.ms-excel"), this.fileExtensionMap.set("xla", "application/vnd.ms-excel"), this.fileExtensionMap.set(
|
|
29
|
+
"xlsx",
|
|
30
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
31
|
+
), this.fileExtensionMap.set(
|
|
32
|
+
"xltx",
|
|
33
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.template"
|
|
34
|
+
), this.fileExtensionMap.set(
|
|
35
|
+
"xlsm",
|
|
36
|
+
"application/vnd.ms-excel.sheet.macroEnabled.12"
|
|
37
|
+
), this.fileExtensionMap.set(
|
|
38
|
+
"xltm",
|
|
39
|
+
"application/vnd.ms-excel.template.macroEnabled.12"
|
|
40
|
+
), this.fileExtensionMap.set(
|
|
41
|
+
"xlam",
|
|
42
|
+
"application/vnd.ms-excel.addin.macroEnabled.12"
|
|
43
|
+
), this.fileExtensionMap.set(
|
|
44
|
+
"xlsb",
|
|
45
|
+
"application/vnd.ms-excel.sheet.binary.macroEnabled.12"
|
|
46
|
+
), this.fileExtensionMap.set("ppt", "application/vnd.ms-powerpoint"), this.fileExtensionMap.set("pot", "application/vnd.ms-powerpoint"), this.fileExtensionMap.set("pps", "application/vnd.ms-powerpoint"), this.fileExtensionMap.set("ppa", "application/vnd.ms-powerpoint"), this.fileExtensionMap.set(
|
|
47
|
+
"pptx",
|
|
48
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
49
|
+
), this.fileExtensionMap.set(
|
|
50
|
+
"potx",
|
|
51
|
+
"application/vnd.openxmlformats-officedocument.presentationml.template"
|
|
52
|
+
), this.fileExtensionMap.set(
|
|
53
|
+
"ppsx",
|
|
54
|
+
"application/vnd.openxmlformats-officedocument.presentationml.slideshow"
|
|
55
|
+
), this.fileExtensionMap.set(
|
|
56
|
+
"ppam",
|
|
57
|
+
"application/vnd.ms-powerpoint.addin.macroEnabled.12"
|
|
58
|
+
), this.fileExtensionMap.set(
|
|
59
|
+
"pptm",
|
|
60
|
+
"application/vnd.ms-powerpoint.presentation.macroEnabled.12"
|
|
61
|
+
), this.fileExtensionMap.set(
|
|
62
|
+
"potm",
|
|
63
|
+
"application/vnd.ms-powerpoint.presentation.macroEnabled.12"
|
|
64
|
+
), this.fileExtensionMap.set(
|
|
65
|
+
"ppsm",
|
|
66
|
+
"application/vnd.ms-powerpoint.slideshow.macroEnabled.12"
|
|
67
|
+
), this.fileExtensionMap.set("odt", "application/vnd.oasis.opendocument.text"), this.fileExtensionMap.set(
|
|
68
|
+
"ott",
|
|
69
|
+
"application/vnd.oasis.opendocument.text-template"
|
|
70
|
+
), this.fileExtensionMap.set(
|
|
71
|
+
"oth",
|
|
72
|
+
"application/vnd.oasis.opendocument.text-web"
|
|
73
|
+
), this.fileExtensionMap.set(
|
|
74
|
+
"odm",
|
|
75
|
+
"application/vnd.oasis.opendocument.text-master"
|
|
76
|
+
), this.fileExtensionMap.set(
|
|
77
|
+
"odg",
|
|
78
|
+
"application/vnd.oasis.opendocument.graphics"
|
|
79
|
+
), this.fileExtensionMap.set(
|
|
80
|
+
"otg",
|
|
81
|
+
"application/vnd.oasis.opendocument.graphics-template"
|
|
82
|
+
), this.fileExtensionMap.set(
|
|
83
|
+
"odp",
|
|
84
|
+
"application/vnd.oasis.opendocument.presentation"
|
|
85
|
+
), this.fileExtensionMap.set(
|
|
86
|
+
"otp",
|
|
87
|
+
"application/vnd.oasis.opendocument.presentation-template"
|
|
88
|
+
), this.fileExtensionMap.set(
|
|
89
|
+
"ods",
|
|
90
|
+
"application/vnd.oasis.opendocument.spreadsheet"
|
|
91
|
+
), this.fileExtensionMap.set(
|
|
92
|
+
"ots",
|
|
93
|
+
"application/vnd.oasis.opendocument.spreadsheet-template"
|
|
94
|
+
), this.fileExtensionMap.set(
|
|
95
|
+
"odc",
|
|
96
|
+
"application/vnd.oasis.opendocument.chart"
|
|
97
|
+
), this.fileExtensionMap.set(
|
|
98
|
+
"odf",
|
|
99
|
+
"application/vnd.oasis.opendocument.formula"
|
|
100
|
+
), this.fileExtensionMap.set(
|
|
101
|
+
"odb",
|
|
102
|
+
"application/vnd.oasis.opendocument.database"
|
|
103
|
+
), this.fileExtensionMap.set(
|
|
104
|
+
"odi",
|
|
105
|
+
"application/vnd.oasis.opendocument.image"
|
|
106
|
+
), this.fileExtensionMap.set("oxt", "application/vnd.openofficeorg.extension"), this.fileExtensionMap.set("txt", "text/plain"), this.fileExtensionMap.set("md", "text/markdown"), this.csvContentType.add("text/comma-separated-values"), this.csvContentType.add("text/csv"), this.csvContentType.add("application/csv");
|
|
107
|
+
}
|
|
108
|
+
getContentTypeForExtension(t) {
|
|
109
|
+
return this.fileExtensionMap.has(t) ? this.fileExtensionMap.get(t) ?? null : null;
|
|
110
|
+
}
|
|
111
|
+
getExtensionForContentType(t) {
|
|
112
|
+
for (const s of Array.from(this.fileExtensionMap.keys()))
|
|
113
|
+
if ((this.fileExtensionMap.get(s) || "").toLowerCase() == (t || "").toLowerCase())
|
|
114
|
+
return s;
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
isWordLike(t, s) {
|
|
118
|
+
const e = this.getExtensionForContentType(t);
|
|
119
|
+
return e ? this.wordExtensions.has(e) : t == this.OCTET_STREAM && s ? this.wordExtensions.has(s) : !1;
|
|
120
|
+
}
|
|
121
|
+
isExcelLike(t, s) {
|
|
122
|
+
const e = this.getExtensionForContentType(t);
|
|
123
|
+
return e ? this.excelExtensions.has(e) : t == this.OCTET_STREAM && s ? this.excelExtensions.has(s) : !1;
|
|
124
|
+
}
|
|
125
|
+
isCsvLike(t, s) {
|
|
126
|
+
return this.csvContentType.has(t) ? !0 : t == this.OCTET_STREAM && s ? this.csvExtensions.has(s) : !1;
|
|
127
|
+
}
|
|
128
|
+
isPowerpointLike(t, s) {
|
|
129
|
+
const e = this.getExtensionForContentType(t);
|
|
130
|
+
return e ? this.pptExtensions.has(e) : t == this.OCTET_STREAM && s ? this.pptExtensions.has(s) : !1;
|
|
131
|
+
}
|
|
132
|
+
isTxtLike(t, s) {
|
|
133
|
+
const e = this.getExtensionForContentType(t);
|
|
134
|
+
return e ? this.txtExtensions.has(e) : t == this.OCTET_STREAM && s ? this.txtExtensions.has(s) : !1;
|
|
135
|
+
}
|
|
136
|
+
isMdLike(t, s) {
|
|
137
|
+
const e = this.getExtensionForContentType(t);
|
|
138
|
+
return e ? this.mdExtensions.has(e) : t == this.OCTET_STREAM && s ? this.mdExtensions.has(s) : !1;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
n(o, "INSTANCE", new o());
|
|
142
|
+
let a = o;
|
|
143
|
+
export {
|
|
144
|
+
a as MimeTypeUtils
|
|
47
145
|
};
|
|
48
|
-
//#endregion
|
|
49
|
-
export { e as MimeTypeUtils };
|
package/dist/noop/noop.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=()=>{};exports.NOOP=e;
|
package/dist/noop/noop.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const o = () => {
|
|
2
|
+
};
|
|
3
|
+
export {
|
|
4
|
+
o as NOOP
|
|
5
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class r{static isLocalURL(t){return t.length>0&&t.charAt(0)==="/"}static startWithHttp(t){return/^https?:\/\//gi.test(t)}static toCounter(t){return t>999?`${Number(t/1e3).toFixed(1)} k`:""+t}static generateVirtualId(){return"xxxx-xxxx-xxx-xxxx".replace(/[x]/g,()=>Math.floor(Math.random()*16).toString(16))}}exports.StringUtils=r;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
class s {
|
|
2
|
+
static isLocalURL(t) {
|
|
3
|
+
return t.length > 0 && t.charAt(0) === "/";
|
|
4
|
+
}
|
|
5
|
+
static startWithHttp(t) {
|
|
6
|
+
return /^https?:\/\//gi.test(t);
|
|
7
|
+
}
|
|
8
|
+
static toCounter(t) {
|
|
9
|
+
return t > 999 ? `${Number(t / 1e3).toFixed(1)} k` : "" + t;
|
|
10
|
+
}
|
|
11
|
+
static generateVirtualId() {
|
|
12
|
+
return "xxxx-xxxx-xxx-xxxx".replace(/[x]/g, () => Math.floor(Math.random() * 16).toString(16));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
s as StringUtils
|
|
15
17
|
};
|
|
16
|
-
//#endregion
|
|
17
|
-
export { e as StringUtils };
|
package/dist/time/time.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=t=>{if(t>0){let o=Math.floor(t/1e3),e=Math.floor(o/60);return o=o%60,e=e%60,r(e)+":"+r(o)}return"00:00"},r=t=>t.toString().padStart(2,"0");exports.convertMsToMS=n;exports.padTo2Digits=r;
|
package/dist/time/time.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
const n = (t) => {
|
|
2
|
+
if (t > 0) {
|
|
3
|
+
let r = Math.floor(t / 1e3), o = Math.floor(r / 60);
|
|
4
|
+
return r = r % 60, o = o % 60, e(o) + ":" + e(r);
|
|
5
|
+
}
|
|
6
|
+
return "00:00";
|
|
7
|
+
}, e = (t) => t.toString().padStart(2, "0");
|
|
8
|
+
export {
|
|
9
|
+
n as convertMsToMS,
|
|
10
|
+
e as padTo2Digits
|
|
11
|
+
};
|
package/dist/video/video.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=()=>MediaRecorder.isTypeSupported?["video/webm;codecs=vp9",'video/mp4; codecs="avc1.424028, mp4a.40.2"',"video/webm;codecs=vp8,opus","video/webm"].find(e=>MediaRecorder.isTypeSupported(e)?!0:(console.error(`${e} is not Supported`),!1))||"video/ogg":"video/webm;codecs=vp8,opus";exports.getBestSupportedMimeType=o;
|
package/dist/video/video.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"video/webm"
|
|
1
|
+
const o = () => MediaRecorder.isTypeSupported ? [
|
|
2
|
+
"video/webm;codecs=vp9",
|
|
3
|
+
'video/mp4; codecs="avc1.424028, mp4a.40.2"',
|
|
4
|
+
"video/webm;codecs=vp8,opus",
|
|
5
|
+
"video/webm"
|
|
7
6
|
].find((e) => MediaRecorder.isTypeSupported(e) ? !0 : (console.error(`${e} is not Supported`), !1)) || "video/ogg" : "video/webm;codecs=vp8,opus";
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
export {
|
|
8
|
+
o as getBestSupportedMimeType
|
|
9
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/utilities",
|
|
3
|
-
"version": "2.6.9-develop
|
|
3
|
+
"version": "2.6.9-develop.20261013171251",
|
|
4
4
|
"description": "Edifice Utilities Package",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"utilities",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
],
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "22.19.8",
|
|
38
|
-
"vite": "
|
|
38
|
+
"vite": "5.4.14",
|
|
39
39
|
"vite-plugin-dts": "4.5.4"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
@@ -46,6 +46,6 @@
|
|
|
46
46
|
"fix": "eslint --fix --report-unused-disable-directives --max-warnings 0",
|
|
47
47
|
"format": "prettier --check \"src/**/*.ts\"",
|
|
48
48
|
"format:write": "prettier --write \"src/**/*.ts\"",
|
|
49
|
-
"lint": "eslint
|
|
49
|
+
"lint": "eslint"
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require("./mime-type-utils.cjs");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./mime-type-utils.js";
|