@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,44 +1,46 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
export type Tool = "image" | "draw" | "erase" | "pan";
|
|
3
2
|
export type Subtool = "upload" | "paste" | "webcam" | "color" | "size" | "crop" | "remove_background" | null;
|
|
4
3
|
import type { Source, Transform } from "./types";
|
|
5
4
|
import { type Brush as BrushType, type Eraser as EraserType } from "./brush/types";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
selected_opacity?: any;
|
|
17
|
-
preview?: boolean;
|
|
18
|
-
show_brush_color?: boolean;
|
|
19
|
-
show_brush_size?: boolean;
|
|
20
|
-
show_eraser_size?: boolean;
|
|
21
|
-
sources: Source[];
|
|
22
|
-
transforms: Transform[];
|
|
5
|
+
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> {
|
|
6
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
7
|
+
$$bindings?: Bindings;
|
|
8
|
+
} & Exports;
|
|
9
|
+
(internal: unknown, props: Props & {
|
|
10
|
+
$$events?: Events;
|
|
11
|
+
$$slots?: Slots;
|
|
12
|
+
}): Exports & {
|
|
13
|
+
$set?: any;
|
|
14
|
+
$on?: any;
|
|
23
15
|
};
|
|
24
|
-
|
|
25
|
-
tool_change: CustomEvent<{
|
|
26
|
-
tool: Tool;
|
|
27
|
-
}>;
|
|
28
|
-
subtool_change: CustomEvent<{
|
|
29
|
-
tool: Tool;
|
|
30
|
-
subtool: Subtool;
|
|
31
|
-
}>;
|
|
32
|
-
} & {
|
|
33
|
-
[evt: string]: CustomEvent<any>;
|
|
34
|
-
};
|
|
35
|
-
slots: {};
|
|
36
|
-
exports?: {} | undefined;
|
|
37
|
-
bindings?: string | undefined;
|
|
38
|
-
};
|
|
39
|
-
export type ToolbarProps = typeof __propDef.props;
|
|
40
|
-
export type ToolbarEvents = typeof __propDef.events;
|
|
41
|
-
export type ToolbarSlots = typeof __propDef.slots;
|
|
42
|
-
export default class Toolbar extends SvelteComponent<ToolbarProps, ToolbarEvents, ToolbarSlots> {
|
|
16
|
+
z_$$bindings?: Bindings;
|
|
43
17
|
}
|
|
44
|
-
|
|
18
|
+
declare const Toolbar: $$__sveltets_2_IsomorphicComponent<{
|
|
19
|
+
tool?: Tool;
|
|
20
|
+
subtool?: Subtool;
|
|
21
|
+
background?: boolean;
|
|
22
|
+
brush_options: BrushType | false;
|
|
23
|
+
selected_size?: number;
|
|
24
|
+
eraser_options: EraserType;
|
|
25
|
+
selected_eraser_size?: number;
|
|
26
|
+
selected_color?: any;
|
|
27
|
+
selected_opacity?: any;
|
|
28
|
+
preview?: boolean;
|
|
29
|
+
show_brush_color?: boolean;
|
|
30
|
+
show_brush_size?: boolean;
|
|
31
|
+
show_eraser_size?: boolean;
|
|
32
|
+
sources: Source[];
|
|
33
|
+
transforms: Transform[];
|
|
34
|
+
}, {
|
|
35
|
+
tool_change: CustomEvent<{
|
|
36
|
+
tool: Tool;
|
|
37
|
+
}>;
|
|
38
|
+
subtool_change: CustomEvent<{
|
|
39
|
+
tool: Tool;
|
|
40
|
+
subtool: Subtool;
|
|
41
|
+
}>;
|
|
42
|
+
} & {
|
|
43
|
+
[evt: string]: CustomEvent<any>;
|
|
44
|
+
}, {}, {}, string>;
|
|
45
|
+
type Toolbar = InstanceType<typeof Toolbar>;
|
|
46
|
+
export default Toolbar;
|
|
@@ -1,87 +1,122 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {} from "
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export let
|
|
13
|
-
export let
|
|
14
|
-
export let
|
|
15
|
-
export let
|
|
16
|
-
export let
|
|
17
|
-
let
|
|
18
|
-
let
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createEventDispatcher, tick } from "svelte";
|
|
3
|
+
import { click_outside } from "../utils/events";
|
|
4
|
+
|
|
5
|
+
import { type Brush, type ColorTuple } from "./types";
|
|
6
|
+
import ColorPicker from "./ColorPicker.svelte";
|
|
7
|
+
import ColorSwatch from "./ColorSwatch.svelte";
|
|
8
|
+
import ColorField from "./ColorField.svelte";
|
|
9
|
+
import BrushSize from "./BrushSize.svelte";
|
|
10
|
+
import type { ColorInput } from "tinycolor2";
|
|
11
|
+
|
|
12
|
+
export let colors: (ColorInput | ColorTuple)[];
|
|
13
|
+
export let selected_color: any;
|
|
14
|
+
export let color_mode: Brush["color_mode"] | undefined = undefined;
|
|
15
|
+
export let recent_colors: (ColorInput | ColorTuple)[] = [];
|
|
16
|
+
export let selected_size: number;
|
|
17
|
+
export let selected_opacity: number;
|
|
18
|
+
export let show_swatch: boolean;
|
|
19
|
+
export let show_size: boolean;
|
|
20
|
+
export let mode: "brush" | "eraser" = "brush";
|
|
21
|
+
|
|
22
|
+
let color_picker = false;
|
|
23
|
+
let current_mode: "hex" | "rgb" | "hsl" = "hex";
|
|
24
|
+
let editing_index: number | null = null;
|
|
25
|
+
|
|
26
|
+
const dispatch = createEventDispatcher<{
|
|
27
|
+
click_outside: void;
|
|
28
|
+
}>();
|
|
29
|
+
|
|
30
|
+
function handle_color_selection(
|
|
31
|
+
{
|
|
32
|
+
index,
|
|
33
|
+
color,
|
|
34
|
+
opacity
|
|
35
|
+
}: {
|
|
36
|
+
index: number | null;
|
|
37
|
+
color: string | null;
|
|
38
|
+
opacity?: number;
|
|
39
|
+
},
|
|
40
|
+
type: "core" | "user"
|
|
41
|
+
): void {
|
|
42
|
+
if (type === "user" && !color) {
|
|
43
|
+
editing_index = index;
|
|
44
|
+
color_picker = true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (!color) return;
|
|
48
|
+
selected_color = color;
|
|
49
|
+
|
|
50
|
+
if (opacity !== undefined) {
|
|
51
|
+
selected_opacity = opacity;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (type === "core") {
|
|
55
|
+
color_picker = false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function handle_color_change(color: string): void {
|
|
60
|
+
if (editing_index === null) return;
|
|
61
|
+
recent_colors[editing_index] = color;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
$: handle_color_change(selected_color);
|
|
65
|
+
let width = 0;
|
|
66
|
+
let height = 0;
|
|
67
|
+
|
|
68
|
+
function debounce(
|
|
69
|
+
func: (...args: any[]) => void,
|
|
70
|
+
delay: number
|
|
71
|
+
): (...args: any[]) => void {
|
|
72
|
+
let timeout: NodeJS.Timeout;
|
|
73
|
+
return function (...args: any[]): void {
|
|
74
|
+
clearTimeout(timeout);
|
|
75
|
+
timeout = setTimeout(() => func(...args), delay);
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export let preview = false;
|
|
80
|
+
function handle_preview(): void {
|
|
81
|
+
if (!preview) {
|
|
82
|
+
preview = true;
|
|
83
|
+
debounced_close_preview();
|
|
84
|
+
} else {
|
|
85
|
+
debounced_close_preview();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function handle_close_preview(): void {
|
|
90
|
+
preview = false;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const debounced_close_preview = debounce(handle_close_preview, 1000);
|
|
94
|
+
|
|
95
|
+
$: (selected_size, selected_color, handle_preview());
|
|
96
|
+
|
|
97
|
+
function handle_select(color: string): void {
|
|
98
|
+
selected_color = color;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function handle_add_color(): void {
|
|
102
|
+
// limit to 5
|
|
103
|
+
if (recent_colors.length >= 5) {
|
|
104
|
+
recent_colors.pop();
|
|
105
|
+
}
|
|
106
|
+
// check if the color is already in the array
|
|
107
|
+
if (
|
|
108
|
+
recent_colors.some((color) => {
|
|
109
|
+
if (Array.isArray(color)) {
|
|
110
|
+
return color[0] === selected_color && color[1] === selected_opacity;
|
|
111
|
+
}
|
|
112
|
+
return color === selected_color;
|
|
113
|
+
})
|
|
114
|
+
) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
recent_colors.push([selected_color, selected_opacity]);
|
|
118
|
+
recent_colors = recent_colors;
|
|
119
|
+
}
|
|
85
120
|
</script>
|
|
86
121
|
|
|
87
122
|
<svelte:window bind:innerHeight={height} bind:innerWidth={width} />
|
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import { type Brush, type ColorTuple } from "./types";
|
|
3
2
|
import type { ColorInput } from "tinycolor2";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
mode?: "brush" | "eraser";
|
|
15
|
-
preview?: boolean;
|
|
3
|
+
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> {
|
|
4
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
5
|
+
$$bindings?: Bindings;
|
|
6
|
+
} & Exports;
|
|
7
|
+
(internal: unknown, props: Props & {
|
|
8
|
+
$$events?: Events;
|
|
9
|
+
$$slots?: Slots;
|
|
10
|
+
}): Exports & {
|
|
11
|
+
$set?: any;
|
|
12
|
+
$on?: any;
|
|
16
13
|
};
|
|
17
|
-
|
|
18
|
-
click_outside: CustomEvent<void>;
|
|
19
|
-
} & {
|
|
20
|
-
[evt: string]: CustomEvent<any>;
|
|
21
|
-
};
|
|
22
|
-
slots: {};
|
|
23
|
-
exports?: {} | undefined;
|
|
24
|
-
bindings?: string | undefined;
|
|
25
|
-
};
|
|
26
|
-
export type BrushOptionsProps = typeof __propDef.props;
|
|
27
|
-
export type BrushOptionsEvents = typeof __propDef.events;
|
|
28
|
-
export type BrushOptionsSlots = typeof __propDef.slots;
|
|
29
|
-
export default class BrushOptions extends SvelteComponent<BrushOptionsProps, BrushOptionsEvents, BrushOptionsSlots> {
|
|
14
|
+
z_$$bindings?: Bindings;
|
|
30
15
|
}
|
|
31
|
-
|
|
16
|
+
declare const BrushOptions: $$__sveltets_2_IsomorphicComponent<{
|
|
17
|
+
colors: (ColorInput | ColorTuple)[];
|
|
18
|
+
selected_color: any;
|
|
19
|
+
color_mode?: Brush["color_mode"] | undefined;
|
|
20
|
+
recent_colors?: (ColorInput | ColorTuple)[];
|
|
21
|
+
selected_size: number;
|
|
22
|
+
selected_opacity: number;
|
|
23
|
+
show_swatch: boolean;
|
|
24
|
+
show_size: boolean;
|
|
25
|
+
mode?: "brush" | "eraser";
|
|
26
|
+
preview?: boolean;
|
|
27
|
+
}, {
|
|
28
|
+
click_outside: CustomEvent<void>;
|
|
29
|
+
} & {
|
|
30
|
+
[evt: string]: CustomEvent<any>;
|
|
31
|
+
}, {}, {}, string>;
|
|
32
|
+
type BrushOptions = InstanceType<typeof BrushOptions>;
|
|
33
|
+
export default BrushOptions;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export let
|
|
7
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { click_outside } from "../utils/events";
|
|
3
|
+
import { createEventDispatcher } from "svelte";
|
|
4
|
+
import { BrushSize } from "@gradio/icons";
|
|
5
|
+
|
|
6
|
+
export let selected_size: number;
|
|
7
|
+
export let min: number;
|
|
8
|
+
export let max: number;
|
|
9
|
+
|
|
10
|
+
const dispatch = createEventDispatcher<{
|
|
11
|
+
click_outside: void;
|
|
12
|
+
}>();
|
|
8
13
|
</script>
|
|
9
14
|
|
|
10
15
|
<div class="wrap" use:click_outside={() => dispatch("click_outside")}>
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { BrushSize } from "@gradio/icons";
|
|
2
|
+
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> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
7
12
|
};
|
|
8
|
-
|
|
9
|
-
click_outside: CustomEvent<void>;
|
|
10
|
-
} & {
|
|
11
|
-
[evt: string]: CustomEvent<any>;
|
|
12
|
-
};
|
|
13
|
-
slots: {};
|
|
14
|
-
exports?: {} | undefined;
|
|
15
|
-
bindings?: string | undefined;
|
|
16
|
-
};
|
|
17
|
-
export type BrushSizeProps = typeof __propDef.props;
|
|
18
|
-
export type BrushSizeEvents = typeof __propDef.events;
|
|
19
|
-
export type BrushSizeSlots = typeof __propDef.slots;
|
|
20
|
-
export default class BrushSize extends SvelteComponent<BrushSizeProps, BrushSizeEvents, BrushSizeSlots> {
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
21
14
|
}
|
|
22
|
-
|
|
15
|
+
declare const BrushSize: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
selected_size: number;
|
|
17
|
+
min: number;
|
|
18
|
+
max: number;
|
|
19
|
+
}, {
|
|
20
|
+
click_outside: CustomEvent<void>;
|
|
21
|
+
} & {
|
|
22
|
+
[evt: string]: CustomEvent<any>;
|
|
23
|
+
}, {}, {}, string>;
|
|
24
|
+
type BrushSize = InstanceType<typeof BrushSize>;
|
|
25
|
+
export default BrushSize;
|
|
@@ -1,36 +1,52 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Eyedropper, Plus } from "@gradio/icons";
|
|
3
|
+
import { createEventDispatcher } from "svelte";
|
|
4
|
+
|
|
5
|
+
import tinycolor from "tinycolor2";
|
|
6
|
+
import IconButton from "../IconButton.svelte";
|
|
7
|
+
export let color: string;
|
|
8
|
+
|
|
9
|
+
export let current_mode: "hex" | "rgb" | "hsl" = "hex";
|
|
10
|
+
|
|
11
|
+
const dispatch = createEventDispatcher<{
|
|
12
|
+
selected: string;
|
|
13
|
+
close: void;
|
|
14
|
+
add_color: void;
|
|
15
|
+
}>();
|
|
16
|
+
const modes = [
|
|
17
|
+
["Hex", "hex"],
|
|
18
|
+
["RGB", "rgb"],
|
|
19
|
+
["HSL", "hsl"]
|
|
20
|
+
] as const;
|
|
21
|
+
|
|
22
|
+
function format_color(color: string, mode: "hex" | "rgb" | "hsl"): string {
|
|
23
|
+
if (mode === "hex") {
|
|
24
|
+
return tinycolor(color).toHexString();
|
|
25
|
+
} else if (mode === "rgb") {
|
|
26
|
+
return tinycolor(color).toRgbString();
|
|
27
|
+
}
|
|
28
|
+
return tinycolor(color).toHslString();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
$: color_string = format_color(color, current_mode);
|
|
32
|
+
$: color_string && dispatch("selected", color_string);
|
|
33
|
+
|
|
34
|
+
function request_eyedropper(): void {
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
const eyeDropper = new EyeDropper();
|
|
37
|
+
|
|
38
|
+
eyeDropper.open().then((result: { sRGBHex: string }) => {
|
|
39
|
+
color = result.sRGBHex;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//@ts-ignore
|
|
44
|
+
const eyedropper_supported = !!window.EyeDropper;
|
|
45
|
+
|
|
46
|
+
function handle_click(): void {
|
|
47
|
+
dispatch("selected", color_string);
|
|
48
|
+
dispatch("close");
|
|
49
|
+
}
|
|
34
50
|
</script>
|
|
35
51
|
|
|
36
52
|
<div class="input">
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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;
|
|
6
11
|
};
|
|
7
|
-
|
|
8
|
-
selected: CustomEvent<string>;
|
|
9
|
-
close: CustomEvent<void>;
|
|
10
|
-
add_color: CustomEvent<void>;
|
|
11
|
-
} & {
|
|
12
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
-
};
|
|
14
|
-
slots: {};
|
|
15
|
-
exports?: {} | undefined;
|
|
16
|
-
bindings?: string | undefined;
|
|
17
|
-
};
|
|
18
|
-
export type ColorFieldProps = typeof __propDef.props;
|
|
19
|
-
export type ColorFieldEvents = typeof __propDef.events;
|
|
20
|
-
export type ColorFieldSlots = typeof __propDef.slots;
|
|
21
|
-
export default class ColorField extends SvelteComponent<ColorFieldProps, ColorFieldEvents, ColorFieldSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
22
13
|
}
|
|
23
|
-
|
|
14
|
+
declare const ColorField: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
color: string;
|
|
16
|
+
current_mode?: "hex" | "rgb" | "hsl";
|
|
17
|
+
}, {
|
|
18
|
+
selected: CustomEvent<string>;
|
|
19
|
+
close: CustomEvent<void>;
|
|
20
|
+
add_color: CustomEvent<void>;
|
|
21
|
+
} & {
|
|
22
|
+
[evt: string]: CustomEvent<any>;
|
|
23
|
+
}, {}, {}, string>;
|
|
24
|
+
type ColorField = InstanceType<typeof ColorField>;
|
|
25
|
+
export default ColorField;
|