compote-ui 0.23.4 → 0.24.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.
@@ -7,7 +7,7 @@
7
7
  import { PhArrowClockwise, PhArrowCounterClockwise } from '../../icons';
8
8
 
9
9
  let {
10
- src,
10
+ src = $bindable(),
11
11
  alt = 'Image',
12
12
  aspectRatio = $bindable(),
13
13
  rotation = $bindable(0),
@@ -30,6 +30,7 @@
30
30
  ];
31
31
 
32
32
  let imageAspectRatio = $state<number | undefined>(undefined);
33
+ let trimming = $state(false);
33
34
 
34
35
  $effect(() => {
35
36
  if (!src) return;
@@ -63,6 +64,17 @@
63
64
  cropImage(src, imageCropper().getCropData(), opts);
64
65
 
65
66
  let cropData = $derived(imageCropper().getCropData());
67
+
68
+ async function handleTrim() {
69
+ trimming = true;
70
+ try {
71
+ const blob = await cropImage(src, imageCropper().getCropData(), { trim: true });
72
+ src = URL.createObjectURL(blob);
73
+ rotation = 0;
74
+ } finally {
75
+ trimming = false;
76
+ }
77
+ }
66
78
  </script>
67
79
 
68
80
  <div>
@@ -100,6 +112,9 @@
100
112
  >
101
113
  <PhArrowClockwise class="size-4" />
102
114
  </Button>
115
+ <Button variant="outline" size="sm" onclick={handleTrim} disabled={trimming}>
116
+ Trim
117
+ </Button>
103
118
  </div>
104
119
  </div>
105
120
  <p>Width: {cropData.width}px / Height: {cropData.height}px</p>
@@ -1,5 +1,5 @@
1
1
  import { ImageCropper } from '@ark-ui/svelte/image-cropper';
2
2
  import type { ImageCropperProps } from './types';
3
- declare const ImageCropper: import("svelte").Component<ImageCropperProps, {}, "getCropData" | "aspectRatio" | "rotation" | "getCroppedImage" | "getProcessedImage">;
3
+ declare const ImageCropper: import("svelte").Component<ImageCropperProps, {}, "src" | "getCropData" | "aspectRatio" | "rotation" | "getCroppedImage" | "getProcessedImage">;
4
4
  type ImageCropper = ReturnType<typeof ImageCropper>;
5
5
  export default ImageCropper;
@@ -30,7 +30,6 @@
30
30
  value={value?.toString()}
31
31
  readOnly={readonly}
32
32
  onValueChange={(valueChangeDetails) => {
33
- console.log(valueChangeDetails);
34
33
  if (isNaN(valueChangeDetails.valueAsNumber)) {
35
34
  return;
36
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compote-ui",
3
- "version": "0.23.4",
3
+ "version": "0.24.0",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -35,28 +35,28 @@
35
35
  "svelte": "^5.0.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@eslint/compat": "^2.0.4",
38
+ "@eslint/compat": "^2.0.5",
39
39
  "@eslint/js": "^10.0.1",
40
40
  "@iconify-json/ph": "^1.2.2",
41
41
  "@sveltejs/adapter-auto": "^7.0.0",
42
- "@sveltejs/kit": "^2.56.1",
42
+ "@sveltejs/kit": "^2.57.1",
43
43
  "@sveltejs/package": "^2.5.7",
44
44
  "@sveltejs/vite-plugin-svelte": "6.2.4",
45
45
  "@tailwindcss/vite": "^4.1.18",
46
46
  "@types/node": "^22",
47
- "eslint": "^10.2.0",
47
+ "eslint": "^10.2.1",
48
48
  "eslint-config-prettier": "^10.1.8",
49
49
  "eslint-plugin-svelte": "^3.17.0",
50
- "globals": "^17.4.0",
51
- "prettier": "^3.8.1",
50
+ "globals": "^17.5.0",
51
+ "prettier": "^3.8.3",
52
52
  "prettier-plugin-svelte": "^3.4.1",
53
53
  "prettier-plugin-tailwindcss": "^0.7.2",
54
54
  "publint": "^0.3.17",
55
- "svelte": "^5.55.1",
55
+ "svelte": "^5.55.4",
56
56
  "svelte-check": "^4.4.6",
57
57
  "tailwindcss": "^4.1.18",
58
58
  "typescript": "^5.9.3",
59
- "typescript-eslint": "^8.57.0",
59
+ "typescript-eslint": "^8.58.2",
60
60
  "unplugin-icons": "^23.0.1",
61
61
  "vite": "^7.3.1",
62
62
  "vite-plugin-devtools-json": "^1.0.0"
@@ -65,7 +65,7 @@
65
65
  "svelte"
66
66
  ],
67
67
  "dependencies": {
68
- "@ark-ui/svelte": "^5.20.0",
68
+ "@ark-ui/svelte": "^5.21.1",
69
69
  "@fontsource-variable/wix-madefor-text": "^5.2.8",
70
70
  "@iconify/svelte": "^5.2.1",
71
71
  "runed": "^0.37.1",