@widgetic/canvas 0.5.18 → 0.5.20

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 (48) hide show
  1. package/README.md +110 -0
  2. package/dist/canvas/Canvas.svelte +174 -50
  3. package/dist/canvas/Canvas.svelte.d.ts +6 -0
  4. package/dist/canvas/CanvasToolbar.svelte +146 -178
  5. package/dist/canvas/CanvasToolbar.svelte.d.ts +2 -2
  6. package/dist/canvas/ContextMenu.svelte +52 -28
  7. package/dist/canvas/PanZoomPanel.svelte +32 -23
  8. package/dist/canvas/WidgetSelectionLayer.svelte +1 -1
  9. package/dist/canvas/eventScope.d.ts +56 -0
  10. package/dist/canvas/eventScope.js +89 -0
  11. package/dist/canvas/props-panel/PropsPanel.svelte +117 -146
  12. package/dist/canvas/props-panel/TextPropsICSection.svelte +18 -14
  13. package/dist/canvas/shadowRootText.d.ts +5 -0
  14. package/dist/canvas/shadowRootText.js +43 -0
  15. package/dist/canvas/shapes/FrameShape.js +4 -2
  16. package/dist/canvas/shapes/ImageShape.js +9 -11
  17. package/dist/canvas/shapes/ShapeLibrary.d.ts +3 -1
  18. package/dist/canvas/shapes/ShapeLibrary.js +26 -26
  19. package/dist/canvas/shapes/WidgetShape.js +6 -3
  20. package/dist/components/Tooltip.svelte +4 -1
  21. package/dist/components/index.d.ts +3 -0
  22. package/dist/components/index.js +4 -0
  23. package/dist/components/input-controls/ColorIC.svelte +15 -10
  24. package/dist/components/input-controls/ColorIC.svelte.d.ts +1 -1
  25. package/dist/components/input-controls/FontSelectorIC.svelte +12 -3
  26. package/dist/components/input-controls/SliderUnitIC.svelte +21 -7
  27. package/dist/components/input-controls/SliderUnitIC.svelte.d.ts +1 -1
  28. package/dist/components/input-controls/TextAlignIC.svelte +10 -5
  29. package/dist/components/input-controls/TextStyleIC.svelte +11 -7
  30. package/dist/components/preferenceStorage.d.ts +14 -0
  31. package/dist/components/preferenceStorage.js +25 -0
  32. package/dist/i18n/index.d.ts +2 -0
  33. package/dist/i18n/index.js +2 -0
  34. package/dist/i18n/labels.d.ts +23 -0
  35. package/dist/i18n/labels.js +75 -0
  36. package/dist/i18n/language.d.ts +23 -0
  37. package/dist/i18n/language.js +33 -0
  38. package/dist/i18n/messages.d.ts +277 -0
  39. package/dist/i18n/messages.js +292 -0
  40. package/dist/i18n/shapeWords.d.ts +30 -0
  41. package/dist/i18n/shapeWords.js +36 -0
  42. package/dist/i18n/shortcuts.d.ts +52 -0
  43. package/dist/i18n/shortcuts.js +104 -0
  44. package/dist/i18n/slots.d.ts +20 -0
  45. package/dist/i18n/slots.js +40 -0
  46. package/dist/index.d.ts +4 -0
  47. package/dist/index.js +5 -0
  48. package/package.json +11 -2
@@ -6,6 +6,11 @@
6
6
  import FontSelectorIC from '../../components/input-controls/FontSelectorIC.svelte';
7
7
  import TextStyleIC from '../../components/input-controls/TextStyleIC.svelte';
8
8
  import Tooltip from '../../components/Tooltip.svelte';
9
+ import { useCanvasLanguage } from '../../i18n/language.js';
10
+ import { displayTypeText } from '../../i18n/labels.js';
11
+
12
+ // The words of the panel, in the language of the canvas it is on (English when it is used on its own)
13
+ const { t } = useCanvasLanguage();
9
14
 
10
15
  let className = '';
11
16
  export { className as class };
@@ -192,43 +197,8 @@
192
197
  // Arrows and lines remain excluded (they are stroke-only by nature).
193
198
  $: hasFill = selectedObject && ('fill' in selectedObject || isFrame) && !isLine && !isArrow;
194
199
 
195
- // Get display name for object type
196
- $: displayType = getDisplayType(selectedObject);
197
-
198
- function getDisplayType(obj: any): string {
199
- if (!obj) return 'None';
200
- if (obj._isWidgetImage) return 'Widget';
201
- if (obj._customType === 'frame') return 'Frame';
202
- if (obj._customType === 'arrow') return 'Arrow';
203
- if (obj._customType === 'triangle') return 'Triangle';
204
- if (obj._customType === 'video') return 'Video';
205
- if (obj._customType === 'image' || obj.type === 'image') return 'Image';
206
- // Library shapes: derive a readable name from _shapeKey (e.g. 'arrow-right' → 'Arrow Right')
207
- // Fall back to 'Custom Shape (Drawing)' if _shapeKey is missing (old saves).
208
- if (obj._customType === 'libraryShape') {
209
- if (obj._shapeKey) {
210
- const name = (obj._shapeKey as string)
211
- .split('-')
212
- .map((w: string) => w.charAt(0).toUpperCase() + w.slice(1))
213
- .join(' ');
214
- return `${name} (Drawing)`;
215
- }
216
- return 'Custom Shape (Drawing)';
217
- }
218
- const typeMap: Record<string, string> = {
219
- 'rect': 'Rectangle',
220
- 'circle': 'Circle',
221
- 'ellipse': 'Ellipse',
222
- 'triangle': 'Triangle',
223
- 'textbox': 'Text',
224
- 'path': 'Drawing',
225
- 'line': 'Line',
226
- 'group': 'Group',
227
- 'activeSelection': 'Selection',
228
- 'activeselection': 'Selection'
229
- };
230
- return typeMap[obj.type] || obj.type;
231
- }
200
+ // Get display name for object type, in the page's language (the names are in i18n/labels.ts)
201
+ $: displayType = displayTypeText(selectedObject, $t);
232
202
 
233
203
  // Get current values from selected object
234
204
  // For Frames (Group-based), read fill/stroke from custom properties (_frameFill, _frameStroke)
@@ -276,7 +246,7 @@
276
246
  $: currentTextPadding = firstTextboxInGroup?._textPadding ?? selectedObject?._textPadding ?? 0;
277
247
 
278
248
  // Frame label properties (using new custom properties)
279
- $: currentFrameLabel = selectedObject?._labelText ?? 'Frame';
249
+ $: currentFrameLabel = selectedObject?._labelText ?? $t('canvas.defaults.frameLabel');
280
250
  $: frameLabelFontSize = selectedObject?._labelFontSize ?? 16;
281
251
  $: frameLabelFontFamily = selectedObject?._labelFontFamily ?? 'Arial';
282
252
  $: frameLabelTextAlign = selectedObject?._labelTextAlign ?? 'left';
@@ -443,12 +413,13 @@
443
413
  <!-- Sticky Header: Selected Object Type + Children count + minimize toggle -->
444
414
  <div class="props-panel-sticky-header">
445
415
  <div class="header">
446
- <span class="header-label">SHAPE:</span>
416
+ <span class="header-label">{$t('canvas.props.shape')}</span>
447
417
  <span class="header-type" title={displayType}>{displayType}</span>
448
- <Tooltip text={isMinimized ? 'Show all properties' : 'Show fewer properties'}>
418
+ <Tooltip text={$t(isMinimized ? 'canvas.props.showAll' : 'canvas.props.showFewer')}>
449
419
  <button
450
420
  class="minimize-toggle-bt"
451
421
  onclick={() => isMinimized = !isMinimized}
422
+ aria-label={$t(isMinimized ? 'canvas.props.showAll' : 'canvas.props.showFewer')}
452
423
  >
453
424
  {#if isMinimized}
454
425
  <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@@ -465,9 +436,9 @@
465
436
 
466
437
  <button
467
438
  type="button"
468
- class="props-panel-close-button absolute right-0 top-0 flex h-5 w-5 items-center justify-center rounded text-grey5 hover:bg-grey2 hover:text-dark focus:outline-none focus:shadow-none focus-visible:bg-grey2 focus-visible:text-dark focus-visible:outline-none focus-visible:shadow-none"
469
- aria-label="Close properties panel"
470
- title="Close properties panel"
439
+ class="props-panel-close-button absolute end-0 top-0 flex h-5 w-5 items-center justify-center rounded text-grey5 hover:bg-grey2 hover:text-dark focus:outline-none focus:shadow-none focus-visible:bg-grey2 focus-visible:text-dark focus-visible:outline-none focus-visible:shadow-none"
440
+ aria-label={$t('canvas.props.close')}
441
+ title={$t('canvas.props.close')}
471
442
  onclick={dismissPanel}
472
443
  >
473
444
  <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="m6 6 12 12M18 6 6 18" /></svg>
@@ -483,22 +454,22 @@
483
454
  <line x1="10" y1="11" x2="14" y2="7"/>
484
455
  <line x1="10" y1="11" x2="14" y2="17"/>
485
456
  </svg>
486
- <span class="prop-label">Children: {childrenCount}</span>
457
+ <span class="prop-label">{$t('canvas.props.children', { count: String(childrenCount) })}</span>
487
458
  </div>
488
459
  {/if}
489
460
  </div>
490
461
 
491
462
  <!-- Scrollable content: all property sections -->
492
- <div class="props-panel-scrollable" use:overlayScrollbar style={needsScroll ? `margin-right: -${panelPaddingX}px` : ''}>
463
+ <div class="props-panel-scrollable" use:overlayScrollbar style={needsScroll ? `margin-inline-end: -${panelPaddingX}px` : ''}>
493
464
  <div class="props-panel-scrollable-content flex flex-col gap-4">
494
465
  <!-- Actions section: Capture, Convert to Widget, Layer Order (first section, no top border) -->
495
466
  {#if onCapture || onConvertToWidget || selectedObject}
496
467
  <div class="section-divider no-top-border">
497
- <span class="section-title">Actions</span>
468
+ <span class="section-title">{$t('canvas.props.actions')}</span>
498
469
  </div>
499
470
  {#if onCapture && !(onConvertToWidget && selectedObject)}
500
471
  <div class="prop-section">
501
- <span class="prop-label">Create Preview</span>
472
+ <span class="prop-label">{$t('canvas.widget.createPreview')}</span>
502
473
  <div class="capture-section">
503
474
  <button class="capture-btn" onclick={onCapture}>
504
475
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@@ -506,7 +477,7 @@
506
477
  <circle cx="8.5" cy="8.5" r="1.5"/>
507
478
  <polyline points="21 15 16 10 5 21"/>
508
479
  </svg>
509
- Capture
480
+ {$t('canvas.widget.capture')}
510
481
  </button>
511
482
  </div>
512
483
  </div>
@@ -515,17 +486,16 @@
515
486
  <div class="prop-section">
516
487
  {#if showWidgetLoader}
517
488
  <!-- Loading state: duplicate/convert in progress -->
518
- <span class="prop-label">Widget Linked</span>
489
+ <span class="prop-label">{$t('canvas.widget.linked')}</span>
519
490
  <div class="widget-linking-loader">
520
491
  <div class="widget-linking-spinner"></div>
521
- <span class="widget-linking-text">{isConverting ? 'Converting...' : isDuplicating ? 'Duplicating...' : 'Linking widget...'}</span>
492
+ <span class="widget-linking-text">{$t(isConverting ? 'canvas.widget.converting' : isDuplicating ? 'canvas.widget.duplicating' : 'canvas.widget.linking')}</span>
522
493
  </div>
523
494
  {:else if hasWidgetId}
524
495
  {#if isOrphanedWidgetShape}
525
- <span class="prop-label">Unlinked Widget Shape</span>
496
+ <span class="prop-label">{$t('canvas.widget.unlinkedTitle')}</span>
526
497
  <p class="widget-orphan-notice">
527
- This shape points to a widget that was deleted or moved to another canvas.
528
- Remove it from the canvas to avoid confusion.
498
+ {$t('canvas.widget.orphanNotice')}
529
499
  </p>
530
500
  <span class="widget-id-label" title={widgetId}>{widgetId}</span>
531
501
  {#if onRemoveOrphanedShape}
@@ -534,17 +504,17 @@
534
504
  type="button"
535
505
  onclick={() => onRemoveOrphanedShape?.()}
536
506
  >
537
- Remove from canvas
507
+ {$t('canvas.widget.removeFromCanvas')}
538
508
  </button>
539
509
  {/if}
540
510
  {:else}
541
- <span class="prop-label">Widget Linked</span>
511
+ <span class="prop-label">{$t('canvas.widget.linked')}</span>
542
512
  <div class="widget-linked-section">
543
513
  <input
544
514
  class="widget-rename-input"
545
515
  type="text"
546
516
  value={resolvedWidgetName || ''}
547
- placeholder="Widget name"
517
+ placeholder={$t('canvas.widget.namePlaceholder')}
548
518
  onfocus={(e) => { widgetRenameValue = e.currentTarget.value; }}
549
519
  onblur={(e) => {
550
520
  const val = e.currentTarget.value.trim();
@@ -564,7 +534,7 @@
564
534
  class="widget-id-label"
565
535
  class:widget-id-clickable={!!onWidgetClick}
566
536
  onclick={() => onWidgetClick && widgetId && onWidgetClick(widgetId)}
567
- title={onWidgetClick ? 'Click to open Widget Details' : widgetId}
537
+ title={onWidgetClick ? $t('canvas.widget.openDetails') : widgetId}
568
538
  >
569
539
  {#if onWidgetClick}
570
540
  <svg class="widget-id-link-icon" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
@@ -577,7 +547,7 @@
577
547
  {#if onRefreshScreenshot && widgetId}
578
548
  <button
579
549
  class="refresh-screenshot-btn"
580
- title="Refresh preview image"
550
+ title={$t('canvas.widget.refreshPreview')}
581
551
  onclick={() => onRefreshScreenshot && widgetId && onRefreshScreenshot(widgetId)}
582
552
  >
583
553
  <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
@@ -585,26 +555,26 @@
585
555
  <polyline points="1 20 1 14 7 14"/>
586
556
  <path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/>
587
557
  </svg>
588
- Refresh Preview Image
558
+ {$t('canvas.widget.refreshPreview')}
589
559
  </button>
590
560
  {/if}
591
561
  {#if onSetAsPrimary && widgetId}
592
562
  {#if selectedObject?._isPrimaryWidget}
593
- <span class="primary-widget-badge">Primary widget</span>
563
+ <span class="primary-widget-badge">{$t('canvas.widget.primary')}</span>
594
564
  {:else}
595
565
  <button
596
566
  class="set-primary-btn"
597
567
  type="button"
598
- title="Use this widget as the canvas primary (red stroke)"
568
+ title={$t('canvas.widget.primaryTitle')}
599
569
  onclick={() => onSetAsPrimary && widgetId && onSetAsPrimary(widgetId)}
600
570
  >
601
- Set as primary
571
+ {$t('canvas.widget.setPrimary')}
602
572
  </button>
603
573
  {/if}
604
574
  {/if}
605
575
  {/if}
606
576
  {:else}
607
- <span class="prop-label">Convert to Widget</span>
577
+ <span class="prop-label">{$t('canvas.widget.convertLabel')}</span>
608
578
  <div class="capture-section">
609
579
  <button class="convert-widget-btn" onclick={onConvertToWidget}>
610
580
  <svg class="convert-widget-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@@ -613,7 +583,7 @@
613
583
  <line x1="17" y1="2" x2="17" y2="22"/>
614
584
  <line x1="2" y1="12" x2="22" y2="12"/>
615
585
  </svg>
616
- CONVERT TO WIDGET
586
+ {$t('canvas.widget.convertButton')}
617
587
  </button>
618
588
  </div>
619
589
  {/if}
@@ -621,35 +591,35 @@
621
591
  {/if}
622
592
  {#if selectedObject && !isMinimized}
623
593
  <div class="prop-section layer-order-section">
624
- <span class="prop-label">Layer Order</span>
594
+ <span class="prop-label">{$t('canvas.layer.title')}</span>
625
595
  <div class="layer-order-buttons">
626
596
  <!-- svelte-ignore a11y-click-events-have-key-events -->
627
597
  <!-- svelte-ignore a11y-no-static-element-interactions -->
628
- <button class="layer-btn" onclick={onBringToFront} title="Bring to Front">
598
+ <button class="layer-btn" onclick={onBringToFront} title={$t('canvas.layer.front')}>
629
599
  <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
630
600
  <polyline points="17 11 12 6 7 11"/>
631
601
  <polyline points="17 18 12 13 7 18"/>
632
602
  </svg>
633
- <span class="layer-btn-label">Front</span>
603
+ <span class="layer-btn-label">{$t('canvas.layer.frontShort')}</span>
634
604
  </button>
635
- <button class="layer-btn" onclick={onBringForward} title="Bring Forward">
605
+ <button class="layer-btn" onclick={onBringForward} title={$t('canvas.layer.forward')}>
636
606
  <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
637
607
  <polyline points="18 15 12 9 6 15"/>
638
608
  </svg>
639
- <span class="layer-btn-label">Up</span>
609
+ <span class="layer-btn-label">{$t('canvas.layer.upShort')}</span>
640
610
  </button>
641
- <button class="layer-btn" onclick={onSendBackward} title="Send Backward">
611
+ <button class="layer-btn" onclick={onSendBackward} title={$t('canvas.layer.backward')}>
642
612
  <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
643
613
  <polyline points="6 9 12 15 18 9"/>
644
614
  </svg>
645
- <span class="layer-btn-label">Down</span>
615
+ <span class="layer-btn-label">{$t('canvas.layer.downShort')}</span>
646
616
  </button>
647
- <button class="layer-btn" onclick={onSendToBack} title="Send to Back">
617
+ <button class="layer-btn" onclick={onSendToBack} title={$t('canvas.layer.back')}>
648
618
  <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
649
619
  <polyline points="7 13 12 18 17 13"/>
650
620
  <polyline points="7 6 12 11 17 6"/>
651
621
  </svg>
652
- <span class="layer-btn-label">Back</span>
622
+ <span class="layer-btn-label">{$t('canvas.layer.backShort')}</span>
653
623
  </button>
654
624
  </div>
655
625
  </div>
@@ -658,44 +628,45 @@
658
628
  <!-- Alignment: visible in both minimized and expanded modes -->
659
629
  {#if selectedObject}
660
630
  <div class="prop-section align-section">
661
- <span class="prop-label">Align</span>
662
- <div class="align-buttons">
663
- <button class="align-btn" onclick={onAlignLeft} title="Align Left">
631
+ <span class="prop-label">{$t('canvas.arrange.title')}</span>
632
+ <!-- The buttons draw a side of the board (left, centre, right, top ...), so they keep their order on every screen. -->
633
+ <div class="align-buttons" dir="ltr">
634
+ <button class="align-btn" onclick={onAlignLeft} title={$t('canvas.arrange.left')}>
664
635
  <svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
665
636
  <rect x="3" y="4" width="2" height="16" rx="1"/>
666
637
  <rect x="7" y="7" width="10" height="4" rx="1"/>
667
638
  <rect x="7" y="13" width="14" height="4" rx="1"/>
668
639
  </svg>
669
640
  </button>
670
- <button class="align-btn" onclick={onAlignCenterH} title="Align Center (horizontal)">
641
+ <button class="align-btn" onclick={onAlignCenterH} title={$t('canvas.arrange.centerH')}>
671
642
  <svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
672
643
  <rect x="11" y="3" width="2" height="18" rx="1"/>
673
644
  <rect x="5" y="7" width="14" height="4" rx="1"/>
674
645
  <rect x="8" y="13" width="8" height="4" rx="1"/>
675
646
  </svg>
676
647
  </button>
677
- <button class="align-btn" onclick={onAlignRight} title="Align Right">
648
+ <button class="align-btn" onclick={onAlignRight} title={$t('canvas.arrange.right')}>
678
649
  <svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
679
650
  <rect x="19" y="4" width="2" height="16" rx="1"/>
680
651
  <rect x="7" y="7" width="10" height="4" rx="1"/>
681
652
  <rect x="3" y="13" width="14" height="4" rx="1"/>
682
653
  </svg>
683
654
  </button>
684
- <button class="align-btn" onclick={onAlignTop} title="Align Top">
655
+ <button class="align-btn" onclick={onAlignTop} title={$t('canvas.arrange.top')}>
685
656
  <svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
686
657
  <rect x="4" y="3" width="16" height="2" rx="1"/>
687
658
  <rect x="7" y="7" width="4" height="10" rx="1"/>
688
659
  <rect x="13" y="7" width="4" height="14" rx="1"/>
689
660
  </svg>
690
661
  </button>
691
- <button class="align-btn" onclick={onAlignMiddleV} title="Align Middle (vertical)">
662
+ <button class="align-btn" onclick={onAlignMiddleV} title={$t('canvas.arrange.middleV')}>
692
663
  <svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
693
664
  <rect x="3" y="11" width="18" height="2" rx="1"/>
694
665
  <rect x="7" y="5" width="4" height="14" rx="1"/>
695
666
  <rect x="13" y="8" width="4" height="8" rx="1"/>
696
667
  </svg>
697
668
  </button>
698
- <button class="align-btn" onclick={onAlignBottom} title="Align Bottom">
669
+ <button class="align-btn" onclick={onAlignBottom} title={$t('canvas.arrange.bottom')}>
699
670
  <svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
700
671
  <rect x="4" y="19" width="16" height="2" rx="1"/>
701
672
  <rect x="7" y="7" width="4" height="10" rx="1"/>
@@ -710,25 +681,25 @@
710
681
  <!-- ==================== IMAGE SOURCE (always visible for image shapes, even in reduced mode) ==================== -->
711
682
  {#if !isWidgetImage && (isImagePlaceholder || hasLoadedImage)}
712
683
  <div class="prop-section image-source-section">
713
- <span class="section-title-inline">IMAGE SOURCE</span>
684
+ <span class="section-title-inline">{$t('canvas.image.source')}</span>
714
685
  <!-- File source option -->
715
686
  <div class="source-row">
716
- <span class="source-label">File:</span>
687
+ <span class="source-label">{$t('canvas.image.file')}</span>
717
688
  {#if hasLoadedImage && imageFilename && !imageUrl}
718
689
  <span class="source-value" title={imageFilename}>{imageFilename}</span>
719
690
  {:else if isImagePlaceholder}
720
- <span class="source-placeholder">No file selected</span>
691
+ <span class="source-placeholder">{$t('canvas.image.noFile')}</span>
721
692
  {:else}
722
693
  <span class="source-placeholder">-</span>
723
694
  {/if}
724
695
  </div>
725
696
  <button class="source-btn" onclick={onImageSourceChange}>
726
- {hasLoadedImage ? 'Change File' : 'Choose File'}
697
+ {$t(hasLoadedImage ? 'canvas.image.changeFile' : 'canvas.image.chooseFile')}
727
698
  </button>
728
699
 
729
700
  <!-- URL source option -->
730
701
  <div class="source-row url-row">
731
- <span class="source-label">URL:</span>
702
+ <span class="source-label">{$t('canvas.image.url')}</span>
732
703
  {#if hasLoadedImage && imageUrl}
733
704
  <span class="source-value url" title={imageUrl}>{imageUrl}</span>
734
705
  {:else}
@@ -736,7 +707,7 @@
736
707
  <input
737
708
  type="text"
738
709
  class="url-input"
739
- placeholder="Paste URL..."
710
+ placeholder={$t('canvas.image.pasteUrl')}
740
711
  bind:value={imageUrlInput}
741
712
  onkeydown={(e) => {
742
713
  if (e.key === 'Enter' && imageUrlInput.trim()) {
@@ -754,7 +725,7 @@
754
725
  }
755
726
  }}
756
727
  >
757
- Load
728
+ {$t('canvas.image.load')}
758
729
  </button>
759
730
  </div>
760
731
  {/if}
@@ -764,7 +735,7 @@
764
735
  <input
765
736
  type="text"
766
737
  class="url-input"
767
- placeholder="New URL..."
738
+ placeholder={$t('canvas.image.newUrl')}
768
739
  bind:value={imageUrlInput}
769
740
  onkeydown={(e) => {
770
741
  if (e.key === 'Enter' && imageUrlInput.trim()) {
@@ -782,7 +753,7 @@
782
753
  }
783
754
  }}
784
755
  >
785
- Load
756
+ {$t('canvas.image.load')}
786
757
  </button>
787
758
  </div>
788
759
  {/if}
@@ -791,12 +762,12 @@
791
762
 
792
763
  <!-- ==================== GENERAL PROPERTIES (all objects) ==================== -->
793
764
  <div class="section-divider">
794
- <span class="section-title">General Properties</span>
765
+ <span class="section-title">{$t('canvas.props.general')}</span>
795
766
  </div>
796
767
 
797
768
  <!-- Dimensions: width × height in real canvas pixels -->
798
769
  <div class="prop-section dimensions-section">
799
- <span class="prop-label dimensions-label">Dimensions</span>
770
+ <span class="prop-label dimensions-label">{$t('canvas.props.dimensions')}</span>
800
771
  <div class="dimensions-row">
801
772
  <input
802
773
  class="dimension-input"
@@ -804,10 +775,10 @@
804
775
  min="1"
805
776
  value={displayWidth}
806
777
  oninput={handleWidthInput}
807
- aria-label="Width"
778
+ aria-label={$t('canvas.props.width')}
808
779
  />
809
780
  <!-- Lock / unlock button between inputs -->
810
- <Tooltip text={forcedLock ? 'Proportions locked (shape constraint)' : effectiveDimensionLock ? 'Unlock proportions' : 'Lock proportions'}>
781
+ <Tooltip text={$t(forcedLock ? 'canvas.props.proportionsFixed' : effectiveDimensionLock ? 'canvas.props.proportionsUnlock' : 'canvas.props.proportionsLock')}>
811
782
  <!-- svelte-ignore a11y-click-events-have-key-events -->
812
783
  <!-- svelte-ignore a11y-no-static-element-interactions -->
813
784
  <span
@@ -831,7 +802,7 @@
831
802
  min="1"
832
803
  value={displayHeight}
833
804
  oninput={handleHeightInput}
834
- aria-label="Height"
805
+ aria-label={$t('canvas.props.height')}
835
806
  />
836
807
  <span class="dimension-unit">px</span>
837
808
  </div>
@@ -841,7 +812,7 @@
841
812
  Useful for hiding/showing objects without deleting them. -->
842
813
  <div class="prop-section">
843
814
  <SliderUnitIC
844
- label="Opacity"
815
+ label={$t('canvas.field.opacity')}
845
816
  value={currentOpacity}
846
817
  min={0}
847
818
  max={100}
@@ -854,7 +825,7 @@
854
825
  <!-- Corner Roundness: in General Properties, visible even when minimized -->
855
826
  {#if !isWidgetImage && (isRect || isTriangle || isPath || isImagePlaceholder || hasLoadedImage || isTextbox || isFrame || isMultiSelect || isLibraryShape)}
856
827
  <SliderUnitIC
857
- label="Corner Roundness"
828
+ label={$t('canvas.field.cornerRoundness')}
858
829
  value={isTriangle ? currentTriangleRoundness : currentRoundness}
859
830
  min={0}
860
831
  max={100}
@@ -869,7 +840,7 @@
869
840
  {#if wireframeMode || !isMinimized}
870
841
  <div class="prop-section widget-bg-section">
871
842
  <ColorIC
872
- label="Background Color"
843
+ label={$t('canvas.field.backgroundColor')}
873
844
  value={currentBackgroundColor === 'transparent' ? '#FFFFFF' : currentBackgroundColor}
874
845
  onChange={onBackgroundColorChange}
875
846
  showPicker={!wireframeMode}
@@ -878,7 +849,7 @@
878
849
  </div>
879
850
  {/if}
880
851
  <SliderUnitIC
881
- label="Background Opacity"
852
+ label={$t('canvas.field.backgroundOpacity')}
882
853
  value={currentBackgroundOpacity}
883
854
  min={0}
884
855
  max={100}
@@ -892,14 +863,14 @@
892
863
  {#if isTextbox}
893
864
  {#if !wireframeMode}
894
865
  <ColorIC
895
- label="Fill Color"
866
+ label={$t('canvas.field.fillColor')}
896
867
  value={textboxBoxFill === 'transparent' ? '#FFFFFF' : textboxBoxFill}
897
868
  onChange={onTextboxBoxFillChange}
898
869
  />
899
870
  {/if}
900
871
 
901
872
  <SliderUnitIC
902
- label="Fill Opacity"
873
+ label={$t('canvas.field.fillOpacity')}
903
874
  value={textboxBoxFillOpacity}
904
875
  min={0}
905
876
  max={100}
@@ -910,14 +881,14 @@
910
881
 
911
882
  {#if !wireframeMode}
912
883
  <ColorIC
913
- label="Stroke Color"
884
+ label={$t('canvas.field.strokeColor')}
914
885
  value={textboxBoxStroke || '#000000'}
915
886
  onChange={onTextboxBoxStrokeChange}
916
887
  />
917
888
  {/if}
918
889
 
919
890
  <SliderUnitIC
920
- label="Stroke Width"
891
+ label={$t('canvas.field.strokeWidth')}
921
892
  value={textboxBoxStrokeWidth}
922
893
  min={0}
923
894
  max={5}
@@ -928,28 +899,28 @@
928
899
 
929
900
  {#if !isMinimized}
930
901
  <div class="prop-section">
931
- <span class="prop-label">Stroke Type</span>
902
+ <span class="prop-label">{$t('canvas.field.strokeType')}</span>
932
903
  <div class="stroke-type-buttons">
933
904
  <button
934
905
  class="stroke-type-btn {textboxBoxStrokeType === 'solid' ? 'active' : ''}"
935
906
  onclick={() => onTextboxBoxStrokeTypeChange('solid')}
936
907
  >
937
908
  <span class="stroke-preview solid"></span>
938
- Solid
909
+ {$t('canvas.field.strokeSolid')}
939
910
  </button>
940
911
  <button
941
912
  class="stroke-type-btn {textboxBoxStrokeType === 'dashed' ? 'active' : ''}"
942
913
  onclick={() => onTextboxBoxStrokeTypeChange('dashed')}
943
914
  >
944
915
  <span class="stroke-preview dashed"></span>
945
- Dashed
916
+ {$t('canvas.field.strokeDashed')}
946
917
  </button>
947
918
  <button
948
919
  class="stroke-type-btn {textboxBoxStrokeType === 'dotted' ? 'active' : ''}"
949
920
  onclick={() => onTextboxBoxStrokeTypeChange('dotted')}
950
921
  >
951
922
  <span class="stroke-preview dotted"></span>
952
- Dotted
923
+ {$t('canvas.field.strokeDotted')}
953
924
  </button>
954
925
  </div>
955
926
  </div>
@@ -959,11 +930,11 @@
959
930
  <!-- ==================== TEXT PROPERTIES ==================== -->
960
931
  {#if isTextbox}
961
932
  <div class="section-divider">
962
- <span class="section-title">Text Properties</span>
933
+ <span class="section-title">{$t('canvas.props.textProperties')}</span>
963
934
  </div>
964
935
 
965
936
  <SliderUnitIC
966
- label="Font Size"
937
+ label={$t('canvas.field.fontSize')}
967
938
  value={currentFontSize}
968
939
  min={8}
969
940
  max={200}
@@ -973,7 +944,7 @@
973
944
  />
974
945
 
975
946
  <SliderUnitIC
976
- label="Text Padding"
947
+ label={$t('canvas.field.textPadding')}
977
948
  value={currentTextPadding}
978
949
  min={0}
979
950
  max={50}
@@ -984,21 +955,21 @@
984
955
 
985
956
  {#if !wireframeMode}
986
957
  <ColorIC
987
- label="Text Color"
958
+ label={$t('canvas.field.textColor')}
988
959
  value={currentFill || '#000000'}
989
960
  onChange={onTextColorChange}
990
961
  />
991
962
 
992
963
  <!-- Text Stroke Properties -->
993
964
  <ColorIC
994
- label="Text Stroke Color"
965
+ label={$t('canvas.field.textStrokeColor')}
995
966
  value={textStrokeColor || '#000000'}
996
967
  onChange={onTextStrokeColorChange}
997
968
  />
998
969
  {/if}
999
970
 
1000
971
  <SliderUnitIC
1001
- label="Text Stroke Width"
972
+ label={$t('canvas.field.textStrokeWidth')}
1002
973
  value={textStrokeWidth}
1003
974
  min={0}
1004
975
  max={5}
@@ -1032,17 +1003,17 @@
1032
1003
  <!-- ==================== FRAME: Text / Description (always visible for frames) ==================== -->
1033
1004
  {#if isFrame}
1034
1005
  <div class="section-divider">
1035
- <span class="section-title">Label Properties</span>
1006
+ <span class="section-title">{$t('canvas.props.labelProperties')}</span>
1036
1007
  </div>
1037
1008
 
1038
1009
  <div class="prop-section">
1039
- <span class="prop-label">Text/Description</span>
1010
+ <span class="prop-label">{$t('canvas.props.labelText')}</span>
1040
1011
  <input
1041
1012
  type="text"
1042
1013
  value={currentFrameLabel}
1043
1014
  oninput={handleFrameLabelInput}
1044
1015
  class="text-input"
1045
- placeholder="Describe this frame (used as widget description & prompt context)"
1016
+ placeholder={$t('canvas.props.labelPlaceholder')}
1046
1017
  />
1047
1018
  </div>
1048
1019
  {/if}
@@ -1050,7 +1021,7 @@
1050
1021
  <!-- ==================== FRAME: Label styling (expanded only) ==================== -->
1051
1022
  {#if !isMinimized && isFrame}
1052
1023
  <SliderUnitIC
1053
- label="Font Size"
1024
+ label={$t('canvas.field.fontSize')}
1054
1025
  value={frameLabelFontSize}
1055
1026
  min={8}
1056
1027
  max={72}
@@ -1080,20 +1051,20 @@
1080
1051
 
1081
1052
  {#if !wireframeMode}
1082
1053
  <ColorIC
1083
- label="Text Color"
1054
+ label={$t('canvas.field.textColor')}
1084
1055
  value={frameLabelTextColor}
1085
1056
  onChange={onFrameLabelTextColorChange}
1086
1057
  />
1087
1058
 
1088
1059
  <ColorIC
1089
- label="Text Background"
1060
+ label={$t('canvas.props.textBackground')}
1090
1061
  value={frameLabelBackgroundColor}
1091
1062
  onChange={onFrameLabelBackgroundColorChange}
1092
1063
  />
1093
1064
  {/if}
1094
1065
 
1095
1066
  <div class="section-divider">
1096
- <span class="section-title">Box Properties</span>
1067
+ <span class="section-title">{$t('canvas.props.boxProperties')}</span>
1097
1068
  </div>
1098
1069
 
1099
1070
  {/if}
@@ -1103,7 +1074,7 @@
1103
1074
  {#if wireframeMode || !isMinimized}
1104
1075
  <div class="prop-section">
1105
1076
  <ColorIC
1106
- label="Fill Color"
1077
+ label={$t('canvas.field.fillColor')}
1107
1078
  value={currentFill || '#FFFFFF'}
1108
1079
  onChange={onFillChange}
1109
1080
  showPicker={!wireframeMode}
@@ -1114,7 +1085,7 @@
1114
1085
 
1115
1086
  <!-- Fill Opacity stays visible even when minimized -->
1116
1087
  <SliderUnitIC
1117
- label="Fill Opacity"
1088
+ label={$t('canvas.field.fillOpacity')}
1118
1089
  value={currentFillOpacity}
1119
1090
  min={0}
1120
1091
  max={100}
@@ -1129,7 +1100,7 @@
1129
1100
  {#if wireframeMode || !isMinimized}
1130
1101
  <div class="prop-section">
1131
1102
  <ColorIC
1132
- label="Stroke Color"
1103
+ label={$t('canvas.field.strokeColor')}
1133
1104
  value={currentStroke || '#000000'}
1134
1105
  onChange={onStrokeChange}
1135
1106
  showPicker={!wireframeMode}
@@ -1140,7 +1111,7 @@
1140
1111
 
1141
1112
  <!-- Stroke Width stays visible even when minimized -->
1142
1113
  <SliderUnitIC
1143
- label="Stroke Width"
1114
+ label={$t('canvas.field.strokeWidth')}
1144
1115
  value={currentStrokeWidth}
1145
1116
  min={0}
1146
1117
  max={20}
@@ -1151,28 +1122,28 @@
1151
1122
 
1152
1123
  {#if !isMinimized}
1153
1124
  <div class="prop-section">
1154
- <span class="prop-label">Stroke Type</span>
1125
+ <span class="prop-label">{$t('canvas.field.strokeType')}</span>
1155
1126
  <div class="stroke-type-buttons">
1156
1127
  <button
1157
1128
  class="stroke-type-btn {currentStrokeType === 'solid' ? 'active' : ''}"
1158
1129
  onclick={() => onStrokeTypeChange('solid')}
1159
1130
  >
1160
1131
  <span class="stroke-preview solid"></span>
1161
- Solid
1132
+ {$t('canvas.field.strokeSolid')}
1162
1133
  </button>
1163
1134
  <button
1164
1135
  class="stroke-type-btn {currentStrokeType === 'dashed' ? 'active' : ''}"
1165
1136
  onclick={() => onStrokeTypeChange('dashed')}
1166
1137
  >
1167
1138
  <span class="stroke-preview dashed"></span>
1168
- Dashed
1139
+ {$t('canvas.field.strokeDashed')}
1169
1140
  </button>
1170
1141
  <button
1171
1142
  class="stroke-type-btn {currentStrokeType === 'dotted' ? 'active' : ''}"
1172
1143
  onclick={() => onStrokeTypeChange('dotted')}
1173
1144
  >
1174
1145
  <span class="stroke-preview dotted"></span>
1175
- Dotted
1146
+ {$t('canvas.field.strokeDotted')}
1176
1147
  </button>
1177
1148
  </div>
1178
1149
  </div>
@@ -1182,12 +1153,12 @@
1182
1153
  <!-- ==================== GROUP BOX (chrome around children, like Frame) ==================== -->
1183
1154
  {#if isPlainGroup && !isWidgetImage}
1184
1155
  <div class="section-divider">
1185
- <span class="section-title">Group Box</span>
1156
+ <span class="section-title">{$t('canvas.props.groupBox')}</span>
1186
1157
  </div>
1187
1158
  {#if wireframeMode || !isMinimized}
1188
1159
  <div class="prop-section">
1189
1160
  <ColorIC
1190
- label="Group Fill Color"
1161
+ label={$t('canvas.field.groupFillColor')}
1191
1162
  value={groupFill || '#FFFFFF'}
1192
1163
  onChange={onGroupFillChange}
1193
1164
  showPicker={!wireframeMode}
@@ -1196,7 +1167,7 @@
1196
1167
  </div>
1197
1168
  {/if}
1198
1169
  <SliderUnitIC
1199
- label="Group Fill Opacity"
1170
+ label={$t('canvas.field.groupFillOpacity')}
1200
1171
  value={groupFillOpacity}
1201
1172
  min={0}
1202
1173
  max={100}
@@ -1207,7 +1178,7 @@
1207
1178
  {#if wireframeMode || !isMinimized}
1208
1179
  <div class="prop-section">
1209
1180
  <ColorIC
1210
- label="Group Stroke Color"
1181
+ label={$t('canvas.field.groupStrokeColor')}
1211
1182
  value={groupStroke || '#000000'}
1212
1183
  onChange={onGroupStrokeChange}
1213
1184
  showPicker={!wireframeMode}
@@ -1216,7 +1187,7 @@
1216
1187
  </div>
1217
1188
  {/if}
1218
1189
  <SliderUnitIC
1219
- label="Group Stroke Width"
1190
+ label={$t('canvas.field.groupStrokeWidth')}
1220
1191
  value={groupStrokeWidth}
1221
1192
  min={0}
1222
1193
  max={20}
@@ -1226,28 +1197,28 @@
1226
1197
  />
1227
1198
  {#if !isMinimized}
1228
1199
  <div class="prop-section">
1229
- <span class="prop-label">Group Stroke Type</span>
1200
+ <span class="prop-label">{$t('canvas.field.groupStrokeType')}</span>
1230
1201
  <div class="stroke-type-buttons">
1231
1202
  <button
1232
1203
  class="stroke-type-btn {groupStrokeType === 'solid' ? 'active' : ''}"
1233
1204
  onclick={() => onGroupStrokeTypeChange('solid')}
1234
1205
  >
1235
1206
  <span class="stroke-preview solid"></span>
1236
- Solid
1207
+ {$t('canvas.field.strokeSolid')}
1237
1208
  </button>
1238
1209
  <button
1239
1210
  class="stroke-type-btn {groupStrokeType === 'dashed' ? 'active' : ''}"
1240
1211
  onclick={() => onGroupStrokeTypeChange('dashed')}
1241
1212
  >
1242
1213
  <span class="stroke-preview dashed"></span>
1243
- Dashed
1214
+ {$t('canvas.field.strokeDashed')}
1244
1215
  </button>
1245
1216
  <button
1246
1217
  class="stroke-type-btn {groupStrokeType === 'dotted' ? 'active' : ''}"
1247
1218
  onclick={() => onGroupStrokeTypeChange('dotted')}
1248
1219
  >
1249
1220
  <span class="stroke-preview dotted"></span>
1250
- Dotted
1221
+ {$t('canvas.field.strokeDotted')}
1251
1222
  </button>
1252
1223
  </div>
1253
1224
  </div>
@@ -1257,11 +1228,11 @@
1257
1228
  <!-- ==================== TEXT PROPERTIES (for selection/group containing textboxes or frames) ==================== -->
1258
1229
  {#if !isMinimized && hasTextboxInSelection}
1259
1230
  <div class="section-divider">
1260
- <span class="section-title">Text Properties</span>
1231
+ <span class="section-title">{$t('canvas.props.textProperties')}</span>
1261
1232
  </div>
1262
1233
 
1263
1234
  <SliderUnitIC
1264
- label="Font Size"
1235
+ label={$t('canvas.field.fontSize')}
1265
1236
  value={currentFontSize}
1266
1237
  min={8}
1267
1238
  max={200}
@@ -1290,7 +1261,7 @@
1290
1261
  />
1291
1262
 
1292
1263
  <SliderUnitIC
1293
- label="Text Padding"
1264
+ label={$t('canvas.field.textPadding')}
1294
1265
  value={currentTextPadding}
1295
1266
  min={0}
1296
1267
  max={50}
@@ -1300,20 +1271,20 @@
1300
1271
  />
1301
1272
 
1302
1273
  <ColorIC
1303
- label="Text Color"
1274
+ label={$t('canvas.field.textColor')}
1304
1275
  value={currentFill || '#000000'}
1305
1276
  onChange={onTextColorChange}
1306
1277
  />
1307
1278
 
1308
1279
  <!-- Text Stroke Properties for Selection/Group -->
1309
1280
  <ColorIC
1310
- label="Text Stroke Color"
1281
+ label={$t('canvas.field.textStrokeColor')}
1311
1282
  value={textStrokeColor || '#000000'}
1312
1283
  onChange={onTextStrokeColorChange}
1313
1284
  />
1314
1285
 
1315
1286
  <SliderUnitIC
1316
- label="Text Stroke Width"
1287
+ label={$t('canvas.field.textStrokeWidth')}
1317
1288
  value={textStrokeWidth}
1318
1289
  min={0}
1319
1290
  max={5}
@@ -1339,7 +1310,7 @@
1339
1310
  border: 2px solid #e5e7eb;
1340
1311
  position: absolute;
1341
1312
  top: 8px;
1342
- right: 8px;
1313
+ inset-inline-end: 8px;
1343
1314
  background: white;
1344
1315
  border-radius: 8px;
1345
1316
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
@@ -1401,9 +1372,9 @@
1401
1372
  }
1402
1373
 
1403
1374
  .minimize-toggle-bt {
1404
- margin-left: auto;
1375
+ margin-inline-start: auto;
1405
1376
  /* Clear the corner close button parked beside the panel edge. */
1406
- margin-right: 0px;
1377
+ margin-inline-end: 0px;
1407
1378
  margin-bottom: -2px;
1408
1379
  display: flex;
1409
1380
  align-items: center;