@hai-dev/ui-kit 1.0.8 → 1.0.9
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/components/photo-crop-uploader/index.d.ts +2 -0
- package/dist/components/photo-crop-uploader/index.js +3 -1
- package/dist/components/photo-crop-uploader/photo-crop-uploader.js +1 -1
- package/dist/components/photo-crop-uploader/utils/draw-cropped-image.d.ts +3 -0
- package/dist/components/photo-crop-uploader/utils/draw-cropped-image.js +33 -0
- package/dist/components/photo-crop-uploader/utils/get-cropped-source.d.ts +4 -0
- package/dist/components/photo-crop-uploader/utils/{get-croped-photo.js → get-cropped-source.js} +1 -1
- package/dist/components/photo-crop-uploader/utils/get-default-cropped-photo.js +4 -4
- package/dist/components/photo-crop-uploader/utils/index.d.ts +2 -1
- package/dist/components/photo-crop-uploader/utils/index.js +8 -6
- package/package.json +1 -1
- package/dist/components/photo-crop-uploader/utils/get-croped-photo.d.ts +0 -4
|
@@ -11,7 +11,7 @@ import { ErrorUploadDialog as Ro } from "./components/error-upload-dialog/error-
|
|
|
11
11
|
import { validatePhotoFile as X } from "./utils/validate-photo-file.js";
|
|
12
12
|
import { readPhoto as Z } from "./utils/read-photo.js";
|
|
13
13
|
import { getPhotoCrop as bo } from "./utils/get-photo-crop.js";
|
|
14
|
-
import {
|
|
14
|
+
import { getCroppedSource as Ho } from "./utils/get-cropped-source.js";
|
|
15
15
|
import { getDefaultCroppedPhoto as zo } from "./utils/get-default-cropped-photo.js";
|
|
16
16
|
import '../../assets/photo-crop-uploader.css';const ko = "_photoCropCanvas_1i4lr_1", Vo = {
|
|
17
17
|
photoCropCanvas: ko
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { D as h } from "../../../index-BiffjjQq.js";
|
|
2
|
+
import { localizedText as w } from "../locale.js";
|
|
3
|
+
import { EN_LOCALE as l } from "../../../constants.js";
|
|
4
|
+
import { PHOTO_CANVAS_CONTEXT as x } from "../constants.js";
|
|
5
|
+
const O = async (o, n, a, m = l) => {
|
|
6
|
+
new Promise((d, s) => {
|
|
7
|
+
const r = new Image();
|
|
8
|
+
r.src = n, r.addEventListener("load", () => {
|
|
9
|
+
const { width: e, height: c } = o, { naturalWidth: p, naturalHeight: g } = r, i = o.getContext(x);
|
|
10
|
+
if (i) {
|
|
11
|
+
const t = h(a, p, g);
|
|
12
|
+
i.drawImage(
|
|
13
|
+
r,
|
|
14
|
+
t.x,
|
|
15
|
+
t.y,
|
|
16
|
+
t.width,
|
|
17
|
+
t.height,
|
|
18
|
+
0,
|
|
19
|
+
0,
|
|
20
|
+
e,
|
|
21
|
+
c
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
d("");
|
|
25
|
+
}), r.addEventListener("error", () => {
|
|
26
|
+
const e = new Error(w[m]["paint-error"]);
|
|
27
|
+
s(e);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
O as drawCroppedImage
|
|
33
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { D as g } from "../../../index-BiffjjQq.js";
|
|
2
|
-
import { getPhotoCrop as
|
|
3
|
-
import {
|
|
2
|
+
import { getPhotoCrop as u } from "./get-photo-crop.js";
|
|
3
|
+
import { getCroppedSource as C } from "./get-cropped-source.js";
|
|
4
4
|
import { localizedText as l } from "../locale.js";
|
|
5
5
|
const x = async (a, s, i, e, m) => new Promise((n, c) => {
|
|
6
6
|
const o = new Image(), d = document.createElement("canvas");
|
|
7
7
|
o.src = a, o.addEventListener("load", () => {
|
|
8
8
|
const { width: r, height: p } = o;
|
|
9
9
|
try {
|
|
10
|
-
const t =
|
|
10
|
+
const t = u(
|
|
11
11
|
r,
|
|
12
12
|
p,
|
|
13
13
|
s,
|
|
@@ -19,7 +19,7 @@ const x = async (a, s, i, e, m) => new Promise((n, c) => {
|
|
|
19
19
|
n(f);
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
const h =
|
|
22
|
+
const h = C(
|
|
23
23
|
o,
|
|
24
24
|
d,
|
|
25
25
|
t,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { readPhoto } from './read-photo';
|
|
2
2
|
export { getPhotoCrop } from './get-photo-crop';
|
|
3
|
-
export {
|
|
3
|
+
export { getCroppedSource } from './get-cropped-source';
|
|
4
4
|
export { validatePhotoFile } from './validate-photo-file';
|
|
5
5
|
export { getDefaultCroppedPhoto } from './get-default-cropped-photo';
|
|
6
|
+
export { drawCroppedImage } from './draw-cropped-image';
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { readPhoto as e } from "./read-photo.js";
|
|
2
2
|
import { getPhotoCrop as p } from "./get-photo-crop.js";
|
|
3
|
-
import {
|
|
4
|
-
import { validatePhotoFile as
|
|
5
|
-
import { getDefaultCroppedPhoto as
|
|
3
|
+
import { getCroppedSource as m } from "./get-cropped-source.js";
|
|
4
|
+
import { validatePhotoFile as d } from "./validate-photo-file.js";
|
|
5
|
+
import { getDefaultCroppedPhoto as g } from "./get-default-cropped-photo.js";
|
|
6
|
+
import { drawCroppedImage as C } from "./draw-cropped-image.js";
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
C as drawCroppedImage,
|
|
9
|
+
m as getCroppedSource,
|
|
10
|
+
g as getDefaultCroppedPhoto,
|
|
9
11
|
p as getPhotoCrop,
|
|
10
12
|
e as readPhoto,
|
|
11
|
-
|
|
13
|
+
d as validatePhotoFile
|
|
12
14
|
};
|
package/package.json
CHANGED