@symfony/ux-cropperjs 2.27.0 → 2.28.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.
- package/dist/controller.d.ts +4 -1
- package/dist/controller.js +29 -28
- package/package.json +17 -9
package/dist/controller.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Controller } from '@hotwired/stimulus';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
declare class CropperController extends Controller {
|
|
3
4
|
readonly publicUrlValue: string;
|
|
4
5
|
readonly optionsValue: object;
|
|
5
6
|
static values: {
|
|
@@ -9,3 +10,5 @@ export default class CropperController extends Controller {
|
|
|
9
10
|
connect(): void;
|
|
10
11
|
private dispatchEvent;
|
|
11
12
|
}
|
|
13
|
+
|
|
14
|
+
export { CropperController as default };
|
package/dist/controller.js
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
parent.appendChild(img);
|
|
14
|
-
const options = this.optionsValue;
|
|
15
|
-
this.dispatchEvent('pre-connect', { options, img });
|
|
16
|
-
const cropper = new Cropper(img, options);
|
|
17
|
-
img.addEventListener('crop', (event) => {
|
|
18
|
-
this.element.value = JSON.stringify(event.detail);
|
|
19
|
-
});
|
|
20
|
-
this.dispatchEvent('connect', { cropper, options, img });
|
|
1
|
+
// src/controller.ts
|
|
2
|
+
import { Controller } from "@hotwired/stimulus";
|
|
3
|
+
import Cropper from "cropperjs";
|
|
4
|
+
var CropperController = class extends Controller {
|
|
5
|
+
connect() {
|
|
6
|
+
const img = document.createElement("img");
|
|
7
|
+
img.classList.add("cropperjs-image");
|
|
8
|
+
img.src = this.publicUrlValue;
|
|
9
|
+
const parent = this.element.parentNode;
|
|
10
|
+
if (!parent) {
|
|
11
|
+
throw new Error("Missing parent node for Cropperjs");
|
|
21
12
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
13
|
+
parent.appendChild(img);
|
|
14
|
+
const options = this.optionsValue;
|
|
15
|
+
this.dispatchEvent("pre-connect", { options, img });
|
|
16
|
+
const cropper = new Cropper(img, options);
|
|
17
|
+
img.addEventListener("crop", (event) => {
|
|
18
|
+
this.element.value = JSON.stringify(event.detail);
|
|
19
|
+
});
|
|
20
|
+
this.dispatchEvent("connect", { cropper, options, img });
|
|
21
|
+
}
|
|
22
|
+
dispatchEvent(name, payload) {
|
|
23
|
+
this.dispatch(name, { detail: payload, prefix: "cropperjs" });
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
26
|
CropperController.values = {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
publicUrl: String,
|
|
28
|
+
options: Object
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
CropperController as default
|
|
29
32
|
};
|
|
30
|
-
|
|
31
|
-
export { CropperController as default };
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@symfony/ux-cropperjs",
|
|
3
3
|
"description": "Cropper.js integration for Symfony",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.28.2",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"symfony-ux"
|
|
8
8
|
],
|
|
@@ -17,13 +17,6 @@
|
|
|
17
17
|
"config": {
|
|
18
18
|
"css_source": "src/style.css"
|
|
19
19
|
},
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "node ../../../bin/build_package.js .",
|
|
22
|
-
"watch": "node ../../../bin/build_package.js . --watch",
|
|
23
|
-
"test": "../../../bin/test_package.sh .",
|
|
24
|
-
"check": "biome check",
|
|
25
|
-
"ci": "biome ci"
|
|
26
|
-
},
|
|
27
20
|
"symfony": {
|
|
28
21
|
"controllers": {
|
|
29
22
|
"cropper": {
|
|
@@ -48,6 +41,21 @@
|
|
|
48
41
|
},
|
|
49
42
|
"devDependencies": {
|
|
50
43
|
"@hotwired/stimulus": "^3.0.0",
|
|
51
|
-
"
|
|
44
|
+
"@testing-library/dom": "^10.4.0",
|
|
45
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
46
|
+
"@testing-library/user-event": "^14.6.1",
|
|
47
|
+
"cropperjs": "^1.5.9",
|
|
48
|
+
"jsdom": "^26.1.0",
|
|
49
|
+
"tslib": "^2.8.1",
|
|
50
|
+
"tsx": "^4.20.3",
|
|
51
|
+
"typescript": "^5.8.3",
|
|
52
|
+
"vitest": "^3.2.4"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "tsx ../../../bin/build_package.ts .",
|
|
56
|
+
"watch": "tsx ../../../bin/build_package.ts . --watch",
|
|
57
|
+
"test": "../../../bin/test_package.sh .",
|
|
58
|
+
"check": "biome check",
|
|
59
|
+
"ci": "biome ci"
|
|
52
60
|
}
|
|
53
61
|
}
|