@symfony/ux-cropperjs 2.32.0 → 2.33.0
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/README.md +6 -5
- package/dist/controller.d.ts +10 -12
- package/dist/controller.js +31 -26
- package/package.json +6 -9
package/README.md
CHANGED
|
@@ -6,9 +6,10 @@ JavaScript assets of the [symfony/ux-cropperjs](https://packagist.org/packages/s
|
|
|
6
6
|
|
|
7
7
|
This npm package is **reserved for advanced users** who want to decouple their JavaScript dependencies from their PHP dependencies (e.g., when building Docker images, running JavaScript-only pipelines, etc.).
|
|
8
8
|
|
|
9
|
-
We **strongly recommend not installing this package directly**, but instead
|
|
9
|
+
We **strongly recommend not installing this package directly**, but instead install the PHP package [symfony/ux-cropperjs](https://packagist.org/packages/symfony/ux-cropperjs) in your Symfony application with [Flex](https://github.com/symfony/flex) enabled.
|
|
10
10
|
|
|
11
11
|
If you still want to install this package directly, please make sure its version exactly matches [symfony/ux-cropperjs](https://packagist.org/packages/symfony/ux-cropperjs) PHP package version:
|
|
12
|
+
|
|
12
13
|
```shell
|
|
13
14
|
composer require symfony/ux-cropperjs:2.23.0
|
|
14
15
|
npm add @symfony/ux-cropperjs@2.23.0
|
|
@@ -18,7 +19,7 @@ npm add @symfony/ux-cropperjs@2.23.0
|
|
|
18
19
|
|
|
19
20
|
## Resources
|
|
20
21
|
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
- [Documentation](https://symfony.com/bundles/ux-cropperjs/current/index.html)
|
|
23
|
+
- [Report issues](https://github.com/symfony/ux/issues) and
|
|
24
|
+
[send Pull Requests](https://github.com/symfony/ux/pulls)
|
|
25
|
+
in the [main Symfony UX repository](https://github.com/symfony/ux)
|
package/dist/controller.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { Controller } from
|
|
2
|
-
|
|
1
|
+
import { Controller } from "@hotwired/stimulus";
|
|
3
2
|
declare class CropperController extends Controller {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
readonly publicUrlValue: string;
|
|
4
|
+
readonly optionsValue: object;
|
|
5
|
+
static values: {
|
|
6
|
+
publicUrl: StringConstructor;
|
|
7
|
+
options: ObjectConstructor;
|
|
8
|
+
};
|
|
9
|
+
connect(): void;
|
|
10
|
+
private dispatchEvent;
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
export { CropperController as default };
|
|
12
|
+
export { CropperController as default };
|
package/dist/controller.js
CHANGED
|
@@ -1,32 +1,37 @@
|
|
|
1
|
-
// src/controller.ts
|
|
2
1
|
import { Controller } from "@hotwired/stimulus";
|
|
3
2
|
import Cropper from "cropperjs";
|
|
4
3
|
var CropperController = class extends Controller {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
4
|
+
connect() {
|
|
5
|
+
const img = document.createElement("img");
|
|
6
|
+
img.classList.add("cropperjs-image");
|
|
7
|
+
img.src = this.publicUrlValue;
|
|
8
|
+
const parent = this.element.parentNode;
|
|
9
|
+
if (!parent) throw new Error("Missing parent node for Cropperjs");
|
|
10
|
+
parent.appendChild(img);
|
|
11
|
+
const options = this.optionsValue;
|
|
12
|
+
this.dispatchEvent("pre-connect", {
|
|
13
|
+
options,
|
|
14
|
+
img
|
|
15
|
+
});
|
|
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", {
|
|
21
|
+
cropper,
|
|
22
|
+
options,
|
|
23
|
+
img
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
dispatchEvent(name, payload) {
|
|
27
|
+
this.dispatch(name, {
|
|
28
|
+
detail: payload,
|
|
29
|
+
prefix: "cropperjs"
|
|
30
|
+
});
|
|
31
|
+
}
|
|
25
32
|
};
|
|
26
33
|
CropperController.values = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
};
|
|
30
|
-
export {
|
|
31
|
-
CropperController as default
|
|
34
|
+
publicUrl: String,
|
|
35
|
+
options: Object
|
|
32
36
|
};
|
|
37
|
+
export { CropperController as default };
|
package/package.json
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"name": "@symfony/ux-cropperjs",
|
|
3
3
|
"description": "Cropper.js integration for Symfony",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.33.0",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"symfony-ux"
|
|
8
8
|
],
|
|
9
9
|
"homepage": "https://ux.symfony.com/cropperjs",
|
|
10
|
-
"repository": "https://github.com/symfony/ux
|
|
10
|
+
"repository": "https://github.com/symfony/ux",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"files": [
|
|
13
13
|
"dist"
|
|
@@ -47,18 +47,15 @@
|
|
|
47
47
|
"cropperjs": "^1.5.9",
|
|
48
48
|
"jsdom": "^26.1.0",
|
|
49
49
|
"tslib": "^2.8.1",
|
|
50
|
-
"tsx": "^4.20.3",
|
|
51
50
|
"typescript": "^5.8.3",
|
|
52
|
-
"vitest": "^
|
|
51
|
+
"vitest": "^4.1.0"
|
|
53
52
|
},
|
|
54
53
|
"scripts": {
|
|
55
|
-
"build": "
|
|
56
|
-
"watch": "
|
|
54
|
+
"build": "node ../../../bin/build_package.ts .",
|
|
55
|
+
"watch": "node ../../../bin/build_package.ts . --watch",
|
|
57
56
|
"test": "pnpm run test:unit && pnpm run test:browser",
|
|
58
57
|
"test:unit": "../../../bin/unit_test_package.sh .",
|
|
59
58
|
"test:browser": "playwright test",
|
|
60
|
-
"test:browser:ui": "playwright test --ui"
|
|
61
|
-
"check": "biome check",
|
|
62
|
-
"ci": "biome ci"
|
|
59
|
+
"test:browser:ui": "playwright test --ui"
|
|
63
60
|
}
|
|
64
61
|
}
|