@dosgato/dialog 0.0.33 → 0.0.35
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/Button.svelte.d.ts +7 -7
- package/ButtonGroup.svelte.d.ts +5 -5
- package/Checkbox.svelte.d.ts +4 -4
- package/Container.svelte.d.ts +2 -2
- package/Dialog.svelte +3 -2
- package/Dialog.svelte.d.ts +14 -14
- package/FieldAutocomplete.svelte +7 -2
- package/FieldAutocomplete.svelte.d.ts +9 -9
- package/FieldCheckbox.svelte.d.ts +4 -4
- package/FieldChoices.svelte.d.ts +6 -6
- package/FieldChooserLink.svelte +7 -2
- package/FieldChooserLink.svelte.d.ts +8 -8
- package/FieldCodeEditor.svelte +2 -2
- package/FieldCodeEditor.svelte.d.ts +7 -7
- package/FieldDate.svelte.d.ts +4 -4
- package/FieldDateTime.svelte.d.ts +3 -3
- package/FieldDualListbox.svelte.d.ts +6 -6
- package/FieldHidden.svelte +1 -1
- package/FieldHidden.svelte.d.ts +2 -2
- package/FieldMultiple.svelte.d.ts +7 -7
- package/FieldMultiselect.svelte +5 -1
- package/FieldMultiselect.svelte.d.ts +5 -5
- package/FieldNumber.svelte.d.ts +5 -5
- package/FieldRadio.svelte.d.ts +13 -13
- package/FieldSelect.svelte.d.ts +15 -15
- package/FieldStandard.svelte +2 -1
- package/FieldStandard.svelte.d.ts +11 -10
- package/FieldText.svelte +1 -1
- package/FieldText.svelte.d.ts +8 -8
- package/FieldTextArea.svelte +1 -1
- package/FieldTextArea.svelte.d.ts +6 -6
- package/FileIcon.svelte.d.ts +5 -5
- package/Form.svelte +3 -3
- package/Form.svelte.d.ts +5 -5
- package/FormDialog.svelte +2 -2
- package/FormDialog.svelte.d.ts +24 -21
- package/Icon.svelte.d.ts +5 -5
- package/Input.svelte.d.ts +8 -8
- package/Listbox.svelte +2 -2
- package/Listbox.svelte.d.ts +6 -6
- package/Radio.svelte.d.ts +4 -4
- package/Switcher.svelte.d.ts +11 -11
- package/TabStore.d.ts +3 -3
- package/TabStore.js +7 -6
- package/Tabs.svelte +6 -6
- package/Tabs.svelte.d.ts +2 -2
- package/chooser/Chooser.svelte +4 -3
- package/chooser/Chooser.svelte.d.ts +12 -12
- package/chooser/ChooserStore.d.ts +4 -4
- package/chooser/ChooserStore.js +3 -3
- package/colorpicker/FieldColorPicker.svelte.d.ts +5 -5
- package/cropper/FieldCropper.svelte +219 -0
- package/cropper/FieldCropper.svelte.d.ts +24 -0
- package/cropper/cropper.d.ts +78 -0
- package/cropper/cropper.js +220 -0
- package/cropper/index.d.ts +2 -0
- package/cropper/index.js +2 -0
- package/helpers.d.ts +1 -1
- package/iconpicker/FieldIconPicker.svelte +5 -5
- package/iconpicker/FieldIconPicker.svelte.d.ts +3 -3
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +13 -14
- package/tree/LoadIcon.svelte.d.ts +2 -2
- package/tree/Tree.svelte.d.ts +11 -11
- package/tree/TreeNode.svelte +4 -1
- package/tree/TreeNode.svelte.d.ts +4 -4
- package/tree/treestore.d.ts +16 -16
- package/tree/treestore.js +3 -3
- package/imagecropper/FieldImageCropper.svelte +0 -380
- package/imagecropper/FieldImageCropper.svelte.d.ts +0 -25
- package/imagecropper/ImageCropperStore.d.ts +0 -16
- package/imagecropper/ImageCropperStore.js +0 -104
- package/imagecropper/imagecropper.d.ts +0 -21
- package/imagecropper/imagecropper.js +0 -1
- package/imagecropper/index.d.ts +0 -1
- package/imagecropper/index.js +0 -1
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { Store, derivedStore } from '@txstate-mws/svelte-store';
|
|
2
|
-
export class ImageCropperStore extends Store {
|
|
3
|
-
selection = derivedStore(this, 'selection');
|
|
4
|
-
crop = derivedStore(this, 'crop');
|
|
5
|
-
setSrc(src, imageWidth, imageHeight, selectionAspectRatio) {
|
|
6
|
-
this.maximize(imageWidth, imageHeight, selectionAspectRatio);
|
|
7
|
-
this.update(v => ({
|
|
8
|
-
...v,
|
|
9
|
-
src
|
|
10
|
-
}));
|
|
11
|
-
}
|
|
12
|
-
draw(left, top, width, height, imageWidth, imageHeight) {
|
|
13
|
-
// calculate new values for crop
|
|
14
|
-
const cropLeft = left / imageWidth;
|
|
15
|
-
const cropTop = top / imageHeight;
|
|
16
|
-
const cropRight = (left + width) / imageWidth;
|
|
17
|
-
const cropBottom = (top + height) / imageHeight;
|
|
18
|
-
this.update(v => ({
|
|
19
|
-
...v,
|
|
20
|
-
selection: { ...v.selection, left, top, width, height, visible: true },
|
|
21
|
-
crop: { imagecropleft: cropLeft, imagecroptop: cropTop, imagecropright: cropRight, imagecropbottom: cropBottom }
|
|
22
|
-
}));
|
|
23
|
-
}
|
|
24
|
-
setCrop(cropLeft, cropTop, cropRight, cropBottom, imageWidth, imageHeight) {
|
|
25
|
-
// calculate values for left, top, width, height
|
|
26
|
-
const left = Math.round(cropLeft * imageWidth);
|
|
27
|
-
const top = Math.round(cropTop * imageHeight);
|
|
28
|
-
const cr = cropRight <= 0 ? 1 : cropRight;
|
|
29
|
-
const width = imageWidth * cr - left;
|
|
30
|
-
const cb = cropBottom <= 0 ? 1 : cropBottom;
|
|
31
|
-
const height = imageHeight * cb - top;
|
|
32
|
-
this.update(v => ({
|
|
33
|
-
...v,
|
|
34
|
-
selection: { ...v.selection, left, top, width, height, visible: true, shieldVisible: true },
|
|
35
|
-
crop: { imagecropleft: cropLeft, imagecroptop: cropTop, imagecropright: cropRight, imagecropbottom: cropBottom }
|
|
36
|
-
}));
|
|
37
|
-
}
|
|
38
|
-
setTrack(track) {
|
|
39
|
-
this.update(v => ({ ...v, selection: { ...v.selection, track } }));
|
|
40
|
-
}
|
|
41
|
-
setShieldVisibility(vis) {
|
|
42
|
-
this.update(v => ({ ...v, selection: { ...v.selection, shieldVisible: vis } }));
|
|
43
|
-
}
|
|
44
|
-
setDrag(drag) {
|
|
45
|
-
this.update(v => ({ ...v, selection: { ...v.selection, drag } }));
|
|
46
|
-
}
|
|
47
|
-
setSelectionVisibility(visible) {
|
|
48
|
-
this.update(v => ({ ...v, selection: { ...v.selection, visible } }));
|
|
49
|
-
}
|
|
50
|
-
moveSelectionTo(left, top, imageWidth, imageHeight) {
|
|
51
|
-
// calculate crop values using new left and right, current selection width and height
|
|
52
|
-
const cropLeft = left / imageWidth;
|
|
53
|
-
const cropTop = top / imageHeight;
|
|
54
|
-
const cropRight = (left + this.value.selection.width) / imageWidth;
|
|
55
|
-
const cropBottom = (top + this.value.selection.height) / imageHeight;
|
|
56
|
-
this.update(v => ({
|
|
57
|
-
...v,
|
|
58
|
-
selection: { ...v.selection, left, top },
|
|
59
|
-
crop: { imagecropleft: cropLeft, imagecroptop: cropTop, imagecropright: cropRight, imagecropbottom: cropBottom }
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
62
|
-
maximize(imageWidth, imageHeight, selectionAspectRatio) {
|
|
63
|
-
let cropLeft, cropRight, cropTop, cropBottom;
|
|
64
|
-
const imageAspectRatio = imageWidth / imageHeight;
|
|
65
|
-
if (imageAspectRatio > selectionAspectRatio) {
|
|
66
|
-
const targetWidth = selectionAspectRatio * imageHeight;
|
|
67
|
-
cropLeft = (Math.round(imageWidth - targetWidth) / 2) / imageWidth;
|
|
68
|
-
cropTop = 0;
|
|
69
|
-
cropRight = ((Math.round(imageWidth - targetWidth) / 2) + targetWidth) / imageWidth;
|
|
70
|
-
cropBottom = 1;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
const targetHeight = imageWidth / selectionAspectRatio;
|
|
74
|
-
cropLeft = 0;
|
|
75
|
-
cropTop = (Math.round(imageHeight - targetHeight) / 2) / imageHeight;
|
|
76
|
-
cropRight = 1;
|
|
77
|
-
cropBottom = ((Math.round(imageHeight - targetHeight) / 2) + targetHeight) / imageHeight;
|
|
78
|
-
}
|
|
79
|
-
this.setCrop(cropLeft, cropTop, cropRight, cropBottom, imageWidth, imageHeight);
|
|
80
|
-
this.setSelectionVisibility(true);
|
|
81
|
-
this.setShieldVisibility(true);
|
|
82
|
-
}
|
|
83
|
-
reset() {
|
|
84
|
-
this.update(v => ({
|
|
85
|
-
...v,
|
|
86
|
-
selection: {
|
|
87
|
-
left: undefined,
|
|
88
|
-
top: undefined,
|
|
89
|
-
width: undefined,
|
|
90
|
-
height: undefined,
|
|
91
|
-
visible: false,
|
|
92
|
-
shieldVisible: false,
|
|
93
|
-
track: false,
|
|
94
|
-
drag: false
|
|
95
|
-
},
|
|
96
|
-
crop: {
|
|
97
|
-
imagecropbottom: 0,
|
|
98
|
-
imagecropleft: 0,
|
|
99
|
-
imagecropright: 0,
|
|
100
|
-
imagecroptop: 0
|
|
101
|
-
}
|
|
102
|
-
}));
|
|
103
|
-
}
|
|
104
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export interface ImageCropperOutput {
|
|
2
|
-
imagecropleft: number;
|
|
3
|
-
imagecropright: number;
|
|
4
|
-
imagecroptop: number;
|
|
5
|
-
imagecropbottom: number;
|
|
6
|
-
}
|
|
7
|
-
export interface ICropSelection {
|
|
8
|
-
left: number | undefined;
|
|
9
|
-
top: number | undefined;
|
|
10
|
-
width: number | undefined;
|
|
11
|
-
height: number | undefined;
|
|
12
|
-
visible: boolean;
|
|
13
|
-
shieldVisible: boolean;
|
|
14
|
-
track: boolean;
|
|
15
|
-
drag: boolean;
|
|
16
|
-
}
|
|
17
|
-
export interface ICropperStore {
|
|
18
|
-
src: string;
|
|
19
|
-
selection: ICropSelection;
|
|
20
|
-
crop: ImageCropperOutput;
|
|
21
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/imagecropper/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as FieldImageCropper } from './FieldImageCropper.svelte';
|
package/imagecropper/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as FieldImageCropper } from './FieldImageCropper.svelte';
|