nuxt-glorious 1.3.3-1 → 1.3.3

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/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "nuxt-glorious",
3
3
  "configKey": "glorious",
4
- "version": "1.3.3-1"
4
+ "version": "1.3.3"
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { GloriousStore } from "../stores/GloriousStore.mjs";
2
- import compressImage from "../core/compressImage.mjs";
2
+ import compressImage from "../../core/compressImage";
3
3
  const numbersWithSeparateSamePrice = (value) => {
4
4
  if (typeof value === "undefined") return "";
5
5
  let nStr = value.match(/\d+/g)?.join("") + "";
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.3-1",
2
+ "version": "1.3.3",
3
3
  "name": "nuxt-glorious",
4
4
  "description": "This package provides many things needed by a project, including server requests and authentication, SEO and other requirements of a project.",
5
5
  "repository": "sajadhzj/nuxt-glorious",
@@ -1,2 +0,0 @@
1
- declare const _default: (file: any, MAX_WIDTH?: number, MAX_HEIGHT?: number, QUALITY?: number) => Promise<Blob>;
2
- export default _default;
@@ -1,33 +0,0 @@
1
- export default (file, MAX_WIDTH = 600, MAX_HEIGHT = 600, QUALITY = 1) => {
2
- return new Promise(function(resolve) {
3
- const blobURL = URL.createObjectURL(file);
4
- const img = new Image();
5
- img.src = blobURL;
6
- img.onload = function() {
7
- URL.revokeObjectURL(this.src);
8
- const [newWidth, newHeight] = calculateSize(img, MAX_WIDTH, MAX_HEIGHT);
9
- const canvas = document.createElement("canvas");
10
- canvas.width = newWidth;
11
- canvas.height = newHeight;
12
- const ctx = canvas.getContext("2d");
13
- ctx.drawImage(img, 0, 0, newWidth, newHeight);
14
- canvas.toBlob((blob) => resolve(blob), "image/jpeg", QUALITY);
15
- };
16
- });
17
- };
18
- function calculateSize(img, maxWidth, maxHeight) {
19
- let width = img.width;
20
- let height = img.height;
21
- if (width > height) {
22
- if (width > maxWidth) {
23
- height = Math.round(height * maxWidth / width);
24
- width = maxWidth;
25
- }
26
- } else {
27
- if (height > maxHeight) {
28
- width = Math.round(width * maxHeight / height);
29
- height = maxHeight;
30
- }
31
- }
32
- return [width, height];
33
- }