tokimeki-image-editor 0.2.5 → 0.2.6

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.
@@ -3,12 +3,12 @@ import { _ } from 'svelte-i18n';
3
3
  import { screenToImageCoords } from '../utils/canvas';
4
4
  import { Pencil, Eraser, ArrowRight, Square, Brush } from 'lucide-svelte';
5
5
  import ToolPanel from './ToolPanel.svelte';
6
- let { canvas, image, viewport, transform, annotations, cropArea, onUpdate, onClose, onViewportChange } = $props();
6
+ let { canvas, image, viewport, transform, annotations, cropArea, initialStrokeWidth, initialColor, onUpdate, onClose, onViewportChange } = $props();
7
7
  let containerElement = $state(null);
8
8
  // Tool settings
9
9
  let currentTool = $state('pen');
10
- let currentColor = $state('#FF6B6B');
11
- let strokeWidth = $state(10);
10
+ let currentColor = $state(initialColor ?? '#FF6B6B');
11
+ let strokeWidth = $state(initialStrokeWidth ?? 10);
12
12
  let shadowEnabled = $state(false);
13
13
  // Preset colors - modern bright tones
14
14
  const colorPresets = ['#FF6B6B', '#FFA94D', '#FFD93D', '#6BCB77', '#4D96FF', '#9B72F2', '#F8F9FA', '#495057'];
@@ -6,6 +6,8 @@ interface Props {
6
6
  transform: TransformState;
7
7
  annotations: Annotation[];
8
8
  cropArea?: CropArea | null;
9
+ initialStrokeWidth?: number;
10
+ initialColor?: string;
9
11
  onUpdate: (annotations: Annotation[]) => void;
10
12
  onClose: () => void;
11
13
  onViewportChange?: (viewport: Partial<Viewport>) => void;
@@ -13,7 +13,7 @@ import BlurTool from './BlurTool.svelte';
13
13
  import StampTool from './StampTool.svelte';
14
14
  import AnnotationTool from './AnnotationTool.svelte';
15
15
  import ExportTool from './ExportTool.svelte';
16
- let { initialImage, initialMode = null, width = 800, height = 600, isStandalone = false, onComplete, onCancel, onExport } = $props();
16
+ let { initialImage, initialMode = null, initialStrokeWidth, initialColor, width = 800, height = 600, isStandalone = false, onComplete, onCancel, onExport } = $props();
17
17
  let state = $state({
18
18
  mode: null,
19
19
  imageData: {
@@ -486,6 +486,8 @@ function handleKeyDown(event) {
486
486
  transform={state.transform}
487
487
  annotations={state.annotations}
488
488
  cropArea={state.cropArea}
489
+ {initialStrokeWidth}
490
+ {initialColor}
489
491
  onUpdate={handleAnnotationsChange}
490
492
  onClose={() => state.mode = null}
491
493
  onViewportChange={handleViewportChange}
@@ -3,6 +3,8 @@ import type { EditorMode } from '../types';
3
3
  interface Props {
4
4
  initialImage?: File | string;
5
5
  initialMode?: EditorMode;
6
+ initialStrokeWidth?: number;
7
+ initialColor?: string;
6
8
  width?: number;
7
9
  height?: number;
8
10
  isStandalone?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokimeki-image-editor",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "A image editor for svelte.",
5
5
  "type": "module",
6
6
  "license": "MIT",