@gradio/imageeditor 0.18.1 → 0.18.2-dev.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/CHANGELOG.md +35 -0
- package/Index.svelte +123 -162
- package/InteractiveImageEditor.svelte +1 -0
- package/dist/Example.svelte +7 -4
- package/dist/Example.svelte.d.ts +20 -18
- package/dist/Index.svelte +153 -139
- package/dist/Index.svelte.d.ts +18 -210
- package/dist/InteractiveImageEditor.svelte +205 -148
- package/dist/InteractiveImageEditor.svelte.d.ts +55 -51
- package/dist/shared/Anchor.svelte +210 -136
- package/dist/shared/Anchor.svelte.d.ts +18 -16
- package/dist/shared/Controls.svelte +55 -36
- package/dist/shared/Controls.svelte.d.ts +35 -33
- package/dist/shared/IconButton.svelte +19 -17
- package/dist/shared/IconButton.svelte.d.ts +34 -32
- package/dist/shared/ImageEditor.svelte +673 -466
- package/dist/shared/ImageEditor.svelte.d.ts +4 -79
- package/dist/shared/Layers.svelte +52 -30
- package/dist/shared/Layers.svelte.d.ts +39 -36
- package/dist/shared/Resize.svelte +42 -21
- package/dist/shared/Resize.svelte.d.ts +29 -27
- package/dist/shared/SecondaryToolbar.svelte +17 -5
- package/dist/shared/SecondaryToolbar.svelte.d.ts +38 -36
- package/dist/shared/Toolbar.svelte +123 -69
- package/dist/shared/Toolbar.svelte.d.ts +40 -38
- package/dist/shared/brush/BrushOptions.svelte +119 -84
- package/dist/shared/brush/BrushOptions.svelte.d.ts +29 -27
- package/dist/shared/brush/BrushSize.svelte +12 -7
- package/dist/shared/brush/BrushSize.svelte.d.ts +23 -20
- package/dist/shared/brush/ColorField.svelte +49 -33
- package/dist/shared/brush/ColorField.svelte.d.ts +23 -21
- package/dist/shared/brush/ColorPicker.svelte +152 -108
- package/dist/shared/brush/ColorPicker.svelte.d.ts +19 -17
- package/dist/shared/brush/ColorSwatch.svelte +78 -46
- package/dist/shared/brush/ColorSwatch.svelte.d.ts +34 -32
- package/dist/types.d.ts +40 -0
- package/dist/types.js +25 -0
- package/package.json +12 -12
- package/shared/ImageEditor.svelte +1 -3
- package/shared/brush/BrushOptions.svelte +1 -1
- package/shared/brush/ColorPicker.svelte +2 -1
- package/types.ts +74 -0
|
@@ -1,139 +1,213 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { spring } from "svelte/motion";
|
|
3
|
+
import { Image } from "@gradio/icons";
|
|
4
|
+
import { onMount, createEventDispatcher } from "svelte";
|
|
5
|
+
|
|
6
|
+
const positions = [
|
|
7
|
+
"top-left",
|
|
8
|
+
"top",
|
|
9
|
+
"top-right",
|
|
10
|
+
"left",
|
|
11
|
+
"center",
|
|
12
|
+
"right",
|
|
13
|
+
"bottom-left",
|
|
14
|
+
"bottom",
|
|
15
|
+
"bottom-right"
|
|
16
|
+
] as const;
|
|
17
|
+
const dispatch = createEventDispatcher<{
|
|
18
|
+
position: (typeof positions)[number];
|
|
19
|
+
}>();
|
|
20
|
+
|
|
21
|
+
const spring_opt = {
|
|
22
|
+
stiffness: 0.1,
|
|
23
|
+
precision: 0.5
|
|
24
|
+
};
|
|
25
|
+
const pos = spring([5, 5], spring_opt);
|
|
26
|
+
const init = [(120 - 10) / 3, (120 - 10) / 3];
|
|
27
|
+
const dimensions = spring(init, spring_opt);
|
|
28
|
+
type Arrow = {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
x_dir: number;
|
|
32
|
+
y_dir: number;
|
|
33
|
+
rotation: number;
|
|
34
|
+
type: number;
|
|
35
|
+
};
|
|
36
|
+
const arrow_spring = spring<Arrow[]>([], spring_opt);
|
|
37
|
+
|
|
38
|
+
let last_i = 0;
|
|
39
|
+
let expanded = true;
|
|
40
|
+
const box_size = (120 - 5 * 2) / 3;
|
|
41
|
+
|
|
42
|
+
async function handle_box_hover(i: number): Promise<void> {
|
|
43
|
+
expanded = false;
|
|
44
|
+
last_i = i;
|
|
45
|
+
const y = Math.floor(i / 3);
|
|
46
|
+
const x = i % 3;
|
|
47
|
+
pos.set([x * box_size + 5 * x + 5, y * box_size + 5 * y + 5]);
|
|
48
|
+
|
|
49
|
+
dimensions.set(init);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let last_pos = 0;
|
|
53
|
+
async function handle_box_click(i: number, stagger = false): Promise<void> {
|
|
54
|
+
if (expanded && stagger) return;
|
|
55
|
+
|
|
56
|
+
const y = Math.floor(i / 3);
|
|
57
|
+
const x = i % 3;
|
|
58
|
+
|
|
59
|
+
const [initial_arrows, eventual_arrows] = get_valid_offsets({
|
|
60
|
+
x: x,
|
|
61
|
+
y: y
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
if (stagger && last_i !== i) {
|
|
65
|
+
await Promise.all([
|
|
66
|
+
pos.set([x * box_size + 5 * x + 5, y * box_size + 5 * y + 5]),
|
|
67
|
+
arrow_spring.set(initial_arrows, { hard: true }),
|
|
68
|
+
dimensions.set(init)
|
|
69
|
+
]);
|
|
70
|
+
} else {
|
|
71
|
+
await arrow_spring.set(initial_arrows, { hard: true });
|
|
72
|
+
}
|
|
73
|
+
last_pos = i;
|
|
74
|
+
expanded = true;
|
|
75
|
+
|
|
76
|
+
pos.set([0, 0]);
|
|
77
|
+
dimensions.set([120 + 10, 120 + 10]);
|
|
78
|
+
arrow_spring.set(eventual_arrows);
|
|
79
|
+
|
|
80
|
+
dispatch("position", positions[i]);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function get_valid_offsets(anchorPoint: {
|
|
84
|
+
x: number;
|
|
85
|
+
y: number;
|
|
86
|
+
}): [Arrow[], Arrow[]] {
|
|
87
|
+
const destination_points: { x: number; y: number }[] = [
|
|
88
|
+
{ x: 0, y: 0 },
|
|
89
|
+
{ x: 1, y: 0 },
|
|
90
|
+
{ x: 2, y: 0 },
|
|
91
|
+
{ x: 0, y: 1 },
|
|
92
|
+
{ x: 1, y: 1 },
|
|
93
|
+
{ x: 2, y: 1 },
|
|
94
|
+
{ x: 0, y: 2 },
|
|
95
|
+
{ x: 1, y: 2 },
|
|
96
|
+
{ x: 2, y: 2 }
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
const offsets = destination_points
|
|
100
|
+
.map((dest) => ({
|
|
101
|
+
x: dest.x - anchorPoint.x,
|
|
102
|
+
y: dest.y - anchorPoint.y,
|
|
103
|
+
dest
|
|
104
|
+
}))
|
|
105
|
+
.filter((offset) => !(offset.x === 0 && offset.y === 0));
|
|
106
|
+
|
|
107
|
+
const normalized_offsets = offsets
|
|
108
|
+
.map((offset) => {
|
|
109
|
+
// cardinal
|
|
110
|
+
if (offset.x === 0 || offset.y === 0) {
|
|
111
|
+
const magnitude = Math.max(Math.abs(offset.x), Math.abs(offset.y));
|
|
112
|
+
return {
|
|
113
|
+
magnitude,
|
|
114
|
+
x: offset.x / magnitude,
|
|
115
|
+
y: offset.y / magnitude,
|
|
116
|
+
dest: offset.dest,
|
|
117
|
+
original: offset,
|
|
118
|
+
type: "cardinal" as const
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// ordinal
|
|
123
|
+
if (Math.abs(offset.x) === Math.abs(offset.y)) {
|
|
124
|
+
const magnitude = Math.abs(offset.x);
|
|
125
|
+
return {
|
|
126
|
+
magnitude,
|
|
127
|
+
x: offset.x / magnitude,
|
|
128
|
+
y: offset.y / magnitude,
|
|
129
|
+
dest: offset.dest,
|
|
130
|
+
original: offset,
|
|
131
|
+
type: "ordinal" as const
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// skip the rest
|
|
136
|
+
return null;
|
|
137
|
+
})
|
|
138
|
+
.filter((offset) => offset !== null);
|
|
139
|
+
|
|
140
|
+
const directions = new Map<
|
|
141
|
+
string,
|
|
142
|
+
{
|
|
143
|
+
x: number;
|
|
144
|
+
y: number;
|
|
145
|
+
dest: { x: number; y: number };
|
|
146
|
+
original: { x: number; y: number };
|
|
147
|
+
magnitude: number;
|
|
148
|
+
type: "cardinal" | "ordinal";
|
|
149
|
+
}[]
|
|
150
|
+
>();
|
|
151
|
+
|
|
152
|
+
normalized_offsets.forEach((offset) => {
|
|
153
|
+
if (directions.has(`${offset.x}-${offset.y}`)) {
|
|
154
|
+
directions.get(`${offset.x}-${offset.y}`)?.push(offset);
|
|
155
|
+
} else {
|
|
156
|
+
directions.set(`${offset.x}-${offset.y}`, [offset]);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
const unique_directions = Array.from(directions.values()).map(
|
|
161
|
+
(direction) => {
|
|
162
|
+
return direction.sort((a, b) => b.magnitude - a.magnitude)[0];
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
const eventual_arrows = unique_directions.map((arrow) => ({
|
|
167
|
+
x:
|
|
168
|
+
arrow.dest.x * box_size +
|
|
169
|
+
14 * arrow.dest.x +
|
|
170
|
+
14 +
|
|
171
|
+
10 +
|
|
172
|
+
(arrow.type === "ordinal" ? 0 : 12 * arrow.x),
|
|
173
|
+
y:
|
|
174
|
+
arrow.dest.y * box_size +
|
|
175
|
+
14 * arrow.dest.y +
|
|
176
|
+
14 +
|
|
177
|
+
10 +
|
|
178
|
+
(arrow.type === "ordinal" ? 0 : 12 * arrow.y),
|
|
179
|
+
x_dir: arrow.x,
|
|
180
|
+
y_dir: arrow.y,
|
|
181
|
+
rotation:
|
|
182
|
+
Math.atan2(arrow.original.y, arrow.original.x) * (180 / Math.PI) + 180,
|
|
183
|
+
type: arrow.type === "ordinal" ? 1 : 2
|
|
184
|
+
}));
|
|
185
|
+
|
|
186
|
+
const initial_arrows = eventual_arrows.map((arrow) => ({
|
|
187
|
+
...arrow,
|
|
188
|
+
x:
|
|
189
|
+
anchorPoint.x * box_size +
|
|
190
|
+
14 * anchorPoint.x + // gaps
|
|
191
|
+
14 + // padding
|
|
192
|
+
10 + // arrow head
|
|
193
|
+
(arrow.x_dir * box_size) / 2 +
|
|
194
|
+
arrow.x_dir * (arrow.type === 1 ? 0 : 10), // offset based on direction
|
|
195
|
+
|
|
196
|
+
y:
|
|
197
|
+
anchorPoint.y * box_size +
|
|
198
|
+
14 * anchorPoint.y +
|
|
199
|
+
14 +
|
|
200
|
+
10 +
|
|
201
|
+
(arrow.y_dir * box_size) / 2 +
|
|
202
|
+
arrow.y_dir * (arrow.type === 1 ? 0 : 10)
|
|
203
|
+
}));
|
|
204
|
+
|
|
205
|
+
return [initial_arrows, eventual_arrows];
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
onMount(() => {
|
|
209
|
+
handle_box_click(0);
|
|
210
|
+
});
|
|
137
211
|
</script>
|
|
138
212
|
|
|
139
213
|
<div class="wrap" class:expanded>
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
8
11
|
};
|
|
9
|
-
|
|
10
|
-
exports?: {} | undefined;
|
|
11
|
-
bindings?: string | undefined;
|
|
12
|
-
};
|
|
13
|
-
export type AnchorProps = typeof __propDef.props;
|
|
14
|
-
export type AnchorEvents = typeof __propDef.events;
|
|
15
|
-
export type AnchorSlots = typeof __propDef.slots;
|
|
16
|
-
export default class Anchor extends SvelteComponent<AnchorProps, AnchorEvents, AnchorSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
17
13
|
}
|
|
18
|
-
|
|
14
|
+
declare const Anchor: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
position: CustomEvent<"center" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top" | "bottom">;
|
|
16
|
+
} & {
|
|
17
|
+
[evt: string]: CustomEvent<any>;
|
|
18
|
+
}, {}, {}, string>;
|
|
19
|
+
type Anchor = InstanceType<typeof Anchor>;
|
|
20
|
+
export default Anchor;
|
|
@@ -1,39 +1,58 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export let
|
|
17
|
-
export let
|
|
18
|
-
export let
|
|
19
|
-
export let
|
|
20
|
-
export let
|
|
21
|
-
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createEventDispatcher } from "svelte";
|
|
3
|
+
import { IconButton, IconButtonWrapper } from "@gradio/atoms";
|
|
4
|
+
import {
|
|
5
|
+
Check,
|
|
6
|
+
Trash,
|
|
7
|
+
ZoomIn,
|
|
8
|
+
ZoomOut,
|
|
9
|
+
Pan,
|
|
10
|
+
Download,
|
|
11
|
+
Undo,
|
|
12
|
+
Redo
|
|
13
|
+
} from "@gradio/icons";
|
|
14
|
+
import type { Writable } from "svelte/store";
|
|
15
|
+
|
|
16
|
+
export let can_save = false;
|
|
17
|
+
export let changeable = false;
|
|
18
|
+
export let current_zoom = 1;
|
|
19
|
+
export let tool: string;
|
|
20
|
+
export let min_zoom = true;
|
|
21
|
+
export let enable_download = false;
|
|
22
|
+
export let can_undo: boolean;
|
|
23
|
+
export let can_redo: boolean;
|
|
24
|
+
|
|
25
|
+
const dispatch = createEventDispatcher<{
|
|
26
|
+
remove_image: void;
|
|
27
|
+
undo: void;
|
|
28
|
+
redo: void;
|
|
29
|
+
save: void;
|
|
30
|
+
zoom_in: void;
|
|
31
|
+
zoom_out: void;
|
|
32
|
+
set_zoom: number | "fit";
|
|
33
|
+
pan: void;
|
|
34
|
+
download: void;
|
|
35
|
+
}>();
|
|
36
|
+
|
|
37
|
+
let show_zoom_popup = false;
|
|
38
|
+
|
|
39
|
+
function handle_zoom_click(e: MouseEvent): void {
|
|
40
|
+
e.stopPropagation();
|
|
41
|
+
show_zoom_popup = !show_zoom_popup;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function handle_zoom_change(zoom: number | "fit"): void {
|
|
45
|
+
dispatch("set_zoom", zoom);
|
|
46
|
+
show_zoom_popup = false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function handle_zoom_keydown(e: KeyboardEvent): void {
|
|
50
|
+
if (e.key === "Enter") {
|
|
51
|
+
handle_zoom_change(current_zoom);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
$: formatted_zoom = Math.round(current_zoom * 100);
|
|
37
56
|
</script>
|
|
38
57
|
|
|
39
58
|
<IconButtonWrapper>
|
|
@@ -1,35 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
can_redo: boolean;
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: Props & {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
12
11
|
};
|
|
13
|
-
|
|
14
|
-
remove_image: CustomEvent<void>;
|
|
15
|
-
undo: CustomEvent<void>;
|
|
16
|
-
redo: CustomEvent<void>;
|
|
17
|
-
save: CustomEvent<void>;
|
|
18
|
-
zoom_in: CustomEvent<void>;
|
|
19
|
-
zoom_out: CustomEvent<void>;
|
|
20
|
-
set_zoom: CustomEvent<number | "fit">;
|
|
21
|
-
pan: CustomEvent<void>;
|
|
22
|
-
download: CustomEvent<void>;
|
|
23
|
-
} & {
|
|
24
|
-
[evt: string]: CustomEvent<any>;
|
|
25
|
-
};
|
|
26
|
-
slots: {};
|
|
27
|
-
exports?: {} | undefined;
|
|
28
|
-
bindings?: string | undefined;
|
|
29
|
-
};
|
|
30
|
-
export type ControlsProps = typeof __propDef.props;
|
|
31
|
-
export type ControlsEvents = typeof __propDef.events;
|
|
32
|
-
export type ControlsSlots = typeof __propDef.slots;
|
|
33
|
-
export default class Controls extends SvelteComponent<ControlsProps, ControlsEvents, ControlsSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
34
13
|
}
|
|
35
|
-
|
|
14
|
+
declare const Controls: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
can_save?: boolean;
|
|
16
|
+
changeable?: boolean;
|
|
17
|
+
current_zoom?: number;
|
|
18
|
+
tool: string;
|
|
19
|
+
min_zoom?: boolean;
|
|
20
|
+
enable_download?: boolean;
|
|
21
|
+
can_undo: boolean;
|
|
22
|
+
can_redo: boolean;
|
|
23
|
+
}, {
|
|
24
|
+
remove_image: CustomEvent<void>;
|
|
25
|
+
undo: CustomEvent<void>;
|
|
26
|
+
redo: CustomEvent<void>;
|
|
27
|
+
save: CustomEvent<void>;
|
|
28
|
+
zoom_in: CustomEvent<void>;
|
|
29
|
+
zoom_out: CustomEvent<void>;
|
|
30
|
+
set_zoom: CustomEvent<number | "fit">;
|
|
31
|
+
pan: CustomEvent<void>;
|
|
32
|
+
download: CustomEvent<void>;
|
|
33
|
+
} & {
|
|
34
|
+
[evt: string]: CustomEvent<any>;
|
|
35
|
+
}, {}, {}, string>;
|
|
36
|
+
type Controls = InstanceType<typeof Controls>;
|
|
37
|
+
export default Controls;
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export let
|
|
5
|
-
export let
|
|
6
|
-
export let
|
|
7
|
-
export let
|
|
8
|
-
export let
|
|
9
|
-
export let
|
|
10
|
-
export let
|
|
11
|
-
export let
|
|
12
|
-
export let
|
|
13
|
-
export let
|
|
14
|
-
export let
|
|
15
|
-
export let
|
|
16
|
-
export let
|
|
17
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { type ComponentType } from "svelte";
|
|
3
|
+
import type { ColorInput } from "tinycolor2";
|
|
4
|
+
export let Icon: ComponentType;
|
|
5
|
+
export let label = "";
|
|
6
|
+
export let show_label = false;
|
|
7
|
+
export let pending = false;
|
|
8
|
+
export let size: "small" | "large" | "medium" = "small";
|
|
9
|
+
export let padded = true;
|
|
10
|
+
export let highlight = false;
|
|
11
|
+
export let disabled = false;
|
|
12
|
+
export let hasPopup = false;
|
|
13
|
+
export let color: string | ColorInput = "var(--block-label-text-color)";
|
|
14
|
+
export let transparent = false;
|
|
15
|
+
export let background = "var(--background-fill-primary)";
|
|
16
|
+
export let offset = 0;
|
|
17
|
+
export let label_position: "left" | "right" = "left";
|
|
18
|
+
export let roundedness: "quite" | "very" = "quite";
|
|
19
|
+
$: _color = highlight ? "var(--color-accent)" : color.toString();
|
|
18
20
|
</script>
|
|
19
21
|
|
|
20
22
|
<button
|