tokimeki-image-editor 0.1.1 → 0.1.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/dist/components/AdjustTool.svelte +317 -0
- package/dist/components/AdjustTool.svelte.d.ts +9 -0
- package/dist/components/BlurTool.svelte +613 -0
- package/dist/components/BlurTool.svelte.d.ts +15 -0
- package/dist/components/Canvas.svelte +214 -0
- package/dist/components/Canvas.svelte.d.ts +17 -0
- package/dist/components/CropTool.svelte +942 -0
- package/dist/components/CropTool.svelte.d.ts +14 -0
- package/dist/components/ExportTool.svelte +191 -0
- package/dist/components/ExportTool.svelte.d.ts +10 -0
- package/dist/components/FilterTool.svelte +492 -0
- package/dist/components/FilterTool.svelte.d.ts +12 -0
- package/dist/components/ImageEditor.svelte +735 -0
- package/dist/components/ImageEditor.svelte.d.ts +12 -0
- package/dist/components/RotateTool.svelte +157 -0
- package/dist/components/RotateTool.svelte.d.ts +9 -0
- package/dist/components/StampTool.svelte +678 -0
- package/dist/components/StampTool.svelte.d.ts +15 -0
- package/dist/components/Toolbar.svelte +136 -0
- package/dist/components/Toolbar.svelte.d.ts +10 -0
- package/dist/config/stamps.d.ts +2 -0
- package/dist/config/stamps.js +22 -0
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/index.js +9 -0
- package/dist/i18n/locales/en.json +68 -0
- package/dist/i18n/locales/ja.json +68 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -0
- package/dist/types.d.ts +97 -0
- package/dist/types.js +1 -0
- package/dist/utils/adjustments.d.ts +26 -0
- package/dist/utils/adjustments.js +525 -0
- package/dist/utils/canvas.d.ts +30 -0
- package/dist/utils/canvas.js +293 -0
- package/dist/utils/filters.d.ts +18 -0
- package/dist/utils/filters.js +114 -0
- package/dist/utils/history.d.ts +15 -0
- package/dist/utils/history.js +67 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
initialImage?: File | string;
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
isStandalone?: boolean;
|
|
6
|
+
onComplete?: (dataUrl: string, blob: Blob) => void;
|
|
7
|
+
onCancel?: () => void;
|
|
8
|
+
onExport?: (dataUrl: string) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const ImageEditor: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type ImageEditor = ReturnType<typeof ImageEditor>;
|
|
12
|
+
export default ImageEditor;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<script lang="ts">import { _ } from 'svelte-i18n';
|
|
2
|
+
import { RotateCw, RotateCcw, FlipHorizontal, FlipVertical } from 'lucide-svelte';
|
|
3
|
+
let { transform, onChange, onClose } = $props();
|
|
4
|
+
function rotateLeft() {
|
|
5
|
+
const newRotation = (transform.rotation - 90 + 360) % 360;
|
|
6
|
+
onChange({ rotation: newRotation });
|
|
7
|
+
}
|
|
8
|
+
function rotateRight() {
|
|
9
|
+
const newRotation = (transform.rotation + 90) % 360;
|
|
10
|
+
onChange({ rotation: newRotation });
|
|
11
|
+
}
|
|
12
|
+
function toggleFlipHorizontal() {
|
|
13
|
+
onChange({ flipHorizontal: !transform.flipHorizontal });
|
|
14
|
+
}
|
|
15
|
+
function toggleFlipVertical() {
|
|
16
|
+
onChange({ flipVertical: !transform.flipVertical });
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<div class="rotate-tool">
|
|
21
|
+
<div class="tool-header">
|
|
22
|
+
<h3>{$_('editor.rotate')}</h3>
|
|
23
|
+
<button class="close-btn" onclick={onClose}>✕</button>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div class="tool-content">
|
|
27
|
+
<div class="tool-group">
|
|
28
|
+
<label>{$_('editor.rotate')}</label>
|
|
29
|
+
<div class="button-group">
|
|
30
|
+
<button class="tool-btn" onclick={rotateLeft} title={$_('editor.rotateLeft')}>
|
|
31
|
+
<RotateCcw size={20} />
|
|
32
|
+
<span>{$_('editor.rotateLeft')}</span>
|
|
33
|
+
</button>
|
|
34
|
+
<button class="tool-btn" onclick={rotateRight} title={$_('editor.rotateRight')}>
|
|
35
|
+
<RotateCw size={20} />
|
|
36
|
+
<span>{$_('editor.rotateRight')}</span>
|
|
37
|
+
</button>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="rotation-info">
|
|
40
|
+
Current: {transform.rotation}°
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<div class="tool-group">
|
|
45
|
+
<label>{$_('editor.flip')}</label>
|
|
46
|
+
<div class="button-group">
|
|
47
|
+
<button
|
|
48
|
+
class="tool-btn"
|
|
49
|
+
class:active={transform.flipHorizontal}
|
|
50
|
+
onclick={toggleFlipHorizontal}
|
|
51
|
+
title={$_('editor.flipHorizontal')}
|
|
52
|
+
>
|
|
53
|
+
<FlipHorizontal size={20} />
|
|
54
|
+
<span>{$_('editor.flipHorizontal')}</span>
|
|
55
|
+
</button>
|
|
56
|
+
<button
|
|
57
|
+
class="tool-btn"
|
|
58
|
+
class:active={transform.flipVertical}
|
|
59
|
+
onclick={toggleFlipVertical}
|
|
60
|
+
title={$_('editor.flipVertical')}
|
|
61
|
+
>
|
|
62
|
+
<FlipVertical size={20} />
|
|
63
|
+
<span>{$_('editor.flipVertical')}</span>
|
|
64
|
+
</button>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<style>
|
|
71
|
+
.rotate-tool {
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
gap: 1rem;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.tool-header {
|
|
78
|
+
display: flex;
|
|
79
|
+
justify-content: space-between;
|
|
80
|
+
align-items: center;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.tool-header h3 {
|
|
84
|
+
margin: 0;
|
|
85
|
+
font-size: 1.1rem;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.close-btn {
|
|
89
|
+
background: none;
|
|
90
|
+
border: none;
|
|
91
|
+
color: #fff;
|
|
92
|
+
font-size: 1.5rem;
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
padding: 0;
|
|
95
|
+
width: 30px;
|
|
96
|
+
height: 30px;
|
|
97
|
+
display: flex;
|
|
98
|
+
align-items: center;
|
|
99
|
+
justify-content: center;
|
|
100
|
+
border-radius: 4px;
|
|
101
|
+
transition: background 0.2s;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.close-btn:hover {
|
|
105
|
+
background: #444;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.tool-content {
|
|
109
|
+
display: flex;
|
|
110
|
+
flex-direction: column;
|
|
111
|
+
gap: 1.5rem;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.tool-group {
|
|
115
|
+
display: flex;
|
|
116
|
+
flex-direction: column;
|
|
117
|
+
gap: 0.5rem;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.tool-group label {
|
|
121
|
+
font-size: 0.9rem;
|
|
122
|
+
color: #ccc;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.button-group {
|
|
126
|
+
display: flex;
|
|
127
|
+
gap: 0.5rem;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.tool-btn {
|
|
131
|
+
display: flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
gap: 0.5rem;
|
|
134
|
+
padding: 0.5rem 1rem;
|
|
135
|
+
background: #333;
|
|
136
|
+
color: #fff;
|
|
137
|
+
border: 1px solid #444;
|
|
138
|
+
border-radius: 4px;
|
|
139
|
+
cursor: pointer;
|
|
140
|
+
transition: all 0.2s;
|
|
141
|
+
font-size: 0.9rem;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.tool-btn:hover {
|
|
145
|
+
background: #444;
|
|
146
|
+
border-color: #555;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.tool-btn.active {
|
|
150
|
+
background: var(--primary-color, #63b97b);
|
|
151
|
+
border-color: var(--primary-color, #63b97b);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.rotation-info {
|
|
155
|
+
font-size: 0.85rem;
|
|
156
|
+
color: #999;
|
|
157
|
+
}</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TransformState } from '../types';
|
|
2
|
+
interface Props {
|
|
3
|
+
transform: TransformState;
|
|
4
|
+
onChange: (transform: Partial<TransformState>) => void;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
}
|
|
7
|
+
declare const RotateTool: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type RotateTool = ReturnType<typeof RotateTool>;
|
|
9
|
+
export default RotateTool;
|