@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.
Files changed (77) hide show
  1. package/Button.svelte.d.ts +7 -7
  2. package/ButtonGroup.svelte.d.ts +5 -5
  3. package/Checkbox.svelte.d.ts +4 -4
  4. package/Container.svelte.d.ts +2 -2
  5. package/Dialog.svelte +3 -2
  6. package/Dialog.svelte.d.ts +14 -14
  7. package/FieldAutocomplete.svelte +7 -2
  8. package/FieldAutocomplete.svelte.d.ts +9 -9
  9. package/FieldCheckbox.svelte.d.ts +4 -4
  10. package/FieldChoices.svelte.d.ts +6 -6
  11. package/FieldChooserLink.svelte +7 -2
  12. package/FieldChooserLink.svelte.d.ts +8 -8
  13. package/FieldCodeEditor.svelte +2 -2
  14. package/FieldCodeEditor.svelte.d.ts +7 -7
  15. package/FieldDate.svelte.d.ts +4 -4
  16. package/FieldDateTime.svelte.d.ts +3 -3
  17. package/FieldDualListbox.svelte.d.ts +6 -6
  18. package/FieldHidden.svelte +1 -1
  19. package/FieldHidden.svelte.d.ts +2 -2
  20. package/FieldMultiple.svelte.d.ts +7 -7
  21. package/FieldMultiselect.svelte +5 -1
  22. package/FieldMultiselect.svelte.d.ts +5 -5
  23. package/FieldNumber.svelte.d.ts +5 -5
  24. package/FieldRadio.svelte.d.ts +13 -13
  25. package/FieldSelect.svelte.d.ts +15 -15
  26. package/FieldStandard.svelte +2 -1
  27. package/FieldStandard.svelte.d.ts +11 -10
  28. package/FieldText.svelte +1 -1
  29. package/FieldText.svelte.d.ts +8 -8
  30. package/FieldTextArea.svelte +1 -1
  31. package/FieldTextArea.svelte.d.ts +6 -6
  32. package/FileIcon.svelte.d.ts +5 -5
  33. package/Form.svelte +3 -3
  34. package/Form.svelte.d.ts +5 -5
  35. package/FormDialog.svelte +2 -2
  36. package/FormDialog.svelte.d.ts +24 -21
  37. package/Icon.svelte.d.ts +5 -5
  38. package/Input.svelte.d.ts +8 -8
  39. package/Listbox.svelte +2 -2
  40. package/Listbox.svelte.d.ts +6 -6
  41. package/Radio.svelte.d.ts +4 -4
  42. package/Switcher.svelte.d.ts +11 -11
  43. package/TabStore.d.ts +3 -3
  44. package/TabStore.js +7 -6
  45. package/Tabs.svelte +6 -6
  46. package/Tabs.svelte.d.ts +2 -2
  47. package/chooser/Chooser.svelte +4 -3
  48. package/chooser/Chooser.svelte.d.ts +12 -12
  49. package/chooser/ChooserStore.d.ts +4 -4
  50. package/chooser/ChooserStore.js +3 -3
  51. package/colorpicker/FieldColorPicker.svelte.d.ts +5 -5
  52. package/cropper/FieldCropper.svelte +219 -0
  53. package/cropper/FieldCropper.svelte.d.ts +24 -0
  54. package/cropper/cropper.d.ts +78 -0
  55. package/cropper/cropper.js +220 -0
  56. package/cropper/index.d.ts +2 -0
  57. package/cropper/index.js +2 -0
  58. package/helpers.d.ts +1 -1
  59. package/iconpicker/FieldIconPicker.svelte +5 -5
  60. package/iconpicker/FieldIconPicker.svelte.d.ts +3 -3
  61. package/index.d.ts +1 -1
  62. package/index.js +1 -1
  63. package/package.json +13 -14
  64. package/tree/LoadIcon.svelte.d.ts +2 -2
  65. package/tree/Tree.svelte.d.ts +11 -11
  66. package/tree/TreeNode.svelte +4 -1
  67. package/tree/TreeNode.svelte.d.ts +4 -4
  68. package/tree/treestore.d.ts +16 -16
  69. package/tree/treestore.js +3 -3
  70. package/imagecropper/FieldImageCropper.svelte +0 -380
  71. package/imagecropper/FieldImageCropper.svelte.d.ts +0 -25
  72. package/imagecropper/ImageCropperStore.d.ts +0 -16
  73. package/imagecropper/ImageCropperStore.js +0 -104
  74. package/imagecropper/imagecropper.d.ts +0 -21
  75. package/imagecropper/imagecropper.js +0 -1
  76. package/imagecropper/index.d.ts +0 -1
  77. 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 {};
@@ -1 +0,0 @@
1
- export { default as FieldImageCropper } from './FieldImageCropper.svelte';
@@ -1 +0,0 @@
1
- export { default as FieldImageCropper } from './FieldImageCropper.svelte';