@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.
- package/README.md +110 -0
- package/dist/canvas/Canvas.svelte +174 -50
- package/dist/canvas/Canvas.svelte.d.ts +6 -0
- package/dist/canvas/CanvasToolbar.svelte +146 -178
- package/dist/canvas/CanvasToolbar.svelte.d.ts +2 -2
- package/dist/canvas/ContextMenu.svelte +52 -28
- package/dist/canvas/PanZoomPanel.svelte +32 -23
- package/dist/canvas/WidgetSelectionLayer.svelte +1 -1
- package/dist/canvas/eventScope.d.ts +56 -0
- package/dist/canvas/eventScope.js +89 -0
- package/dist/canvas/props-panel/PropsPanel.svelte +117 -146
- package/dist/canvas/props-panel/TextPropsICSection.svelte +18 -14
- package/dist/canvas/shadowRootText.d.ts +5 -0
- package/dist/canvas/shadowRootText.js +43 -0
- package/dist/canvas/shapes/FrameShape.js +4 -2
- package/dist/canvas/shapes/ImageShape.js +9 -11
- package/dist/canvas/shapes/ShapeLibrary.d.ts +3 -1
- package/dist/canvas/shapes/ShapeLibrary.js +26 -26
- package/dist/canvas/shapes/WidgetShape.js +6 -3
- package/dist/components/Tooltip.svelte +4 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +4 -0
- package/dist/components/input-controls/ColorIC.svelte +15 -10
- package/dist/components/input-controls/ColorIC.svelte.d.ts +1 -1
- package/dist/components/input-controls/FontSelectorIC.svelte +12 -3
- package/dist/components/input-controls/SliderUnitIC.svelte +21 -7
- package/dist/components/input-controls/SliderUnitIC.svelte.d.ts +1 -1
- package/dist/components/input-controls/TextAlignIC.svelte +10 -5
- package/dist/components/input-controls/TextStyleIC.svelte +11 -7
- package/dist/components/preferenceStorage.d.ts +14 -0
- package/dist/components/preferenceStorage.js +25 -0
- package/dist/i18n/index.d.ts +2 -0
- package/dist/i18n/index.js +2 -0
- package/dist/i18n/labels.d.ts +23 -0
- package/dist/i18n/labels.js +75 -0
- package/dist/i18n/language.d.ts +23 -0
- package/dist/i18n/language.js +33 -0
- package/dist/i18n/messages.d.ts +277 -0
- package/dist/i18n/messages.js +292 -0
- package/dist/i18n/shapeWords.d.ts +30 -0
- package/dist/i18n/shapeWords.js +36 -0
- package/dist/i18n/shortcuts.d.ts +52 -0
- package/dist/i18n/shortcuts.js +104 -0
- package/dist/i18n/slots.d.ts +20 -0
- package/dist/i18n/slots.js +40 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -0
- package/package.json +11 -2
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onMount } from 'svelte';
|
|
3
3
|
import Tooltip from '../components/Tooltip.svelte';
|
|
4
|
+
import { eventIsForScope, getEventOrigin, getFocusedElementIn } from './eventScope';
|
|
4
5
|
import { SHAPE_LIBRARY, getShapesByCategory, type LibraryShape } from './shapes/ShapeLibrary';
|
|
6
|
+
import { useCanvasLanguage } from '../i18n/language.js';
|
|
7
|
+
import { categoryLabel, toolTitle } from '../i18n/labels.js';
|
|
8
|
+
import type { CanvasMessageKey } from '../i18n/messages.js';
|
|
9
|
+
import { TOOL_KEYS, shortcutGroups } from '../i18n/shortcuts.js';
|
|
10
|
+
import { sentenceParts } from '../i18n/slots.js';
|
|
11
|
+
|
|
12
|
+
// The words of the toolbar, in the language of the canvas it is on (English when it is used on its own)
|
|
13
|
+
const { t } = useCanvasLanguage();
|
|
5
14
|
|
|
6
15
|
/**
|
|
7
16
|
* COMPONENT PROPS
|
|
@@ -79,6 +88,8 @@
|
|
|
79
88
|
|
|
80
89
|
// Pre-group shapes for the dropdown
|
|
81
90
|
const libraryShapesByCategory = getShapesByCategory();
|
|
91
|
+
// The category the menu shows first, as a grid with the two media tools. A name the shape library saves (not a word a person reads: categoryLabel says it).
|
|
92
|
+
const GEOMETRIC_CATEGORY = 'Geometric Shapes';
|
|
82
93
|
|
|
83
94
|
// add shapes handler functions
|
|
84
95
|
export let addText: () => void = () => {};
|
|
@@ -111,63 +122,64 @@
|
|
|
111
122
|
// True when the dropdown should open ABOVE the button (toolbar is at bottom of canvas)
|
|
112
123
|
let dropdownOpenAbove = false;
|
|
113
124
|
let dropdownTriggerEl: HTMLElement | null = null;
|
|
125
|
+
// The toolbar's own element: tells which tree the toolbar lives in (the page, or a shadow root on a partner's page),
|
|
126
|
+
// which decides what its keyboard shortcuts and zoom brakes may react to. See eventScope.ts.
|
|
127
|
+
let toolbarRootEl: HTMLElement | null = null;
|
|
114
128
|
|
|
115
129
|
// Map shape type to display info (Arrow is a dedicated button, not in this map).
|
|
116
|
-
const shapeInfo: Record<ShapeToolName, { icon: string; iconSvg: string;
|
|
130
|
+
const shapeInfo: Record<ShapeToolName, { icon: string; iconSvg: string; nameKey: CanvasMessageKey; key: string }> = {
|
|
117
131
|
rect: {
|
|
118
132
|
icon: '⬜',
|
|
119
133
|
iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="16" rx="1" fill="none" stroke="currentColor" stroke-width="1.5"/></svg>`,
|
|
120
|
-
|
|
121
|
-
key:
|
|
134
|
+
nameKey: 'canvas.tool.rectangle',
|
|
135
|
+
key: TOOL_KEYS.rectangle,
|
|
122
136
|
},
|
|
123
137
|
triangle: {
|
|
124
138
|
icon: '△',
|
|
125
139
|
iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><polygon points="12,3 22,21 2,21" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>`,
|
|
126
|
-
|
|
127
|
-
key:
|
|
140
|
+
nameKey: 'canvas.tool.triangle',
|
|
141
|
+
key: TOOL_KEYS.triangle,
|
|
128
142
|
},
|
|
129
143
|
circle: {
|
|
130
144
|
icon: '⚪',
|
|
131
145
|
iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><ellipse cx="12" cy="12" rx="10" ry="7" fill="none" stroke="currentColor" stroke-width="1.5"/></svg>`,
|
|
132
|
-
|
|
133
|
-
key:
|
|
146
|
+
nameKey: 'canvas.tool.ellipse',
|
|
147
|
+
key: TOOL_KEYS.ellipse,
|
|
134
148
|
},
|
|
135
149
|
'circle-true': {
|
|
136
150
|
icon: '⚪',
|
|
137
151
|
iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" fill="none" stroke="currentColor" stroke-width="1.5"/></svg>`,
|
|
138
|
-
|
|
152
|
+
nameKey: 'canvas.tool.circle',
|
|
139
153
|
key: '',
|
|
140
154
|
},
|
|
141
155
|
arrow: {
|
|
142
156
|
icon: '↗',
|
|
143
157
|
iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path d="M6 18C6 18 6.06617 12.5162 8.00001 10.5521C10.862 7.64522 19 9 19 9M19 9L15 5M19 9L15 13" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
|
144
|
-
|
|
145
|
-
key:
|
|
158
|
+
nameKey: 'canvas.tool.arrow',
|
|
159
|
+
key: TOOL_KEYS.arrow,
|
|
146
160
|
},
|
|
147
161
|
};
|
|
148
162
|
|
|
149
163
|
// Image dropdown entry — placed at the bottom of the shapes dropdown with a divider
|
|
150
164
|
const imageDropdownInfo = {
|
|
151
165
|
iconSvg: `<svg class="icon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><rect x="1" y="2" width="14" height="12" rx="1.5" fill="white" stroke="#9ca3af" stroke-width="1.5"/><polyline points="1.5,10.5 5,6.5 8,9 11,6.5 14.5,10.5" fill="none" stroke="#9ca3af" stroke-width="1.2"/><circle cx="11.5" cy="5" r="1.2" fill="#9ca3af"/></svg>`,
|
|
152
|
-
label: 'Image',
|
|
153
|
-
key: 'I',
|
|
154
166
|
};
|
|
155
167
|
|
|
156
168
|
// The currently displayed tool in the dropdown button (active tool if it's a dropdown tool, else last selected)
|
|
157
|
-
const mediaToolInfo: Record<'frame' | 'image' | 'video', { iconSvg: string;
|
|
169
|
+
const mediaToolInfo: Record<'frame' | 'image' | 'video', { iconSvg: string; nameKey: CanvasMessageKey; key: string }> = {
|
|
158
170
|
frame: {
|
|
159
171
|
iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M9 3v6"/></svg>`,
|
|
160
|
-
|
|
161
|
-
key:
|
|
172
|
+
nameKey: 'canvas.tool.frame',
|
|
173
|
+
key: TOOL_KEYS.frame,
|
|
162
174
|
},
|
|
163
175
|
image: {
|
|
164
176
|
iconSvg: imageDropdownInfo.iconSvg,
|
|
165
|
-
|
|
166
|
-
key:
|
|
177
|
+
nameKey: 'canvas.tool.image',
|
|
178
|
+
key: TOOL_KEYS.image,
|
|
167
179
|
},
|
|
168
180
|
video: {
|
|
169
181
|
iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="6" width="14" height="12" rx="2"/><path d="M16 10l6-3v10l-6-3z"/></svg>`,
|
|
170
|
-
|
|
182
|
+
nameKey: 'canvas.tool.video',
|
|
171
183
|
key: '',
|
|
172
184
|
},
|
|
173
185
|
};
|
|
@@ -232,16 +244,21 @@
|
|
|
232
244
|
? mediaToolInfo[activeDropdownTool]
|
|
233
245
|
: null;
|
|
234
246
|
|
|
247
|
+
// The tool the main button of the shapes menu stands for: the message that names it, and the key that chooses it
|
|
248
|
+
// (a shape of the library has no key)
|
|
249
|
+
$: dropdownToolNameKey = (activeDropdownTool === 'library-shape' && lastSelectedLibraryShape)
|
|
250
|
+
? lastSelectedLibraryShape.labelKey
|
|
251
|
+
: mediaTrigger
|
|
252
|
+
? mediaTrigger.nameKey
|
|
253
|
+
: shapeInfo[activeDropdownTool as ShapeToolName]?.nameKey ?? 'canvas.tool.shapes';
|
|
254
|
+
$: dropdownToolKey = (activeDropdownTool === 'library-shape' && lastSelectedLibraryShape)
|
|
255
|
+
? ''
|
|
256
|
+
: mediaTrigger
|
|
257
|
+
? mediaTrigger.key
|
|
258
|
+
: shapeInfo[activeDropdownTool as ShapeToolName]?.key ?? '';
|
|
259
|
+
|
|
235
260
|
// Tooltip text for the main dropdown button
|
|
236
|
-
$: dropdownButtonTooltip =
|
|
237
|
-
? lastSelectedLibraryShape.label
|
|
238
|
-
: mediaTrigger
|
|
239
|
-
? (mediaTrigger.key ? `${mediaTrigger.label} (${mediaTrigger.key})` : mediaTrigger.label)
|
|
240
|
-
: shapeInfo[activeDropdownTool as ShapeToolName]?.label
|
|
241
|
-
? (shapeInfo[activeDropdownTool as ShapeToolName].key
|
|
242
|
-
? `${shapeInfo[activeDropdownTool as ShapeToolName].label} (${shapeInfo[activeDropdownTool as ShapeToolName].key})`
|
|
243
|
-
: shapeInfo[activeDropdownTool as ShapeToolName].label)
|
|
244
|
-
: 'Shapes';
|
|
261
|
+
$: dropdownButtonTooltip = toolTitle(dropdownToolNameKey, dropdownToolKey, $t);
|
|
245
262
|
|
|
246
263
|
// Dropdown width — sized to fit 3 × 40px icon grid with minimal side padding
|
|
247
264
|
const DROPDOWN_WIDTH = 152;
|
|
@@ -283,8 +300,9 @@
|
|
|
283
300
|
|
|
284
301
|
// Close dropdown when clicking outside
|
|
285
302
|
function handleOutsideClick(e: MouseEvent) {
|
|
286
|
-
|
|
287
|
-
|
|
303
|
+
// Where the click really started: a listener on window is told the shadow root's host for a click from inside it
|
|
304
|
+
const target = getEventOrigin(e);
|
|
305
|
+
if (!target?.closest('.shapes-split-ct') && !target?.closest('.shapes-dropdown-menu-fixed')) {
|
|
288
306
|
shapesDropdownOpen = false;
|
|
289
307
|
}
|
|
290
308
|
}
|
|
@@ -299,88 +317,21 @@
|
|
|
299
317
|
export let shortcutsPanelOpen = false;
|
|
300
318
|
export let onShortcutsToggle: () => void = () => { shortcutsPanelOpen = !shortcutsPanelOpen; };
|
|
301
319
|
|
|
302
|
-
//
|
|
303
|
-
//
|
|
304
|
-
|
|
305
|
-
//
|
|
306
|
-
|
|
307
|
-
{
|
|
308
|
-
title: 'Tools',
|
|
309
|
-
shortcuts: [
|
|
310
|
-
{ keys: ['V'], label: 'Select' },
|
|
311
|
-
{ keys: ['H'], label: 'Hand / Pan' },
|
|
312
|
-
{ keys: ['E'], label: 'Erase' },
|
|
313
|
-
{ keys: ['D'], label: 'Draw' },
|
|
314
|
-
{ keys: ['A'], label: 'Arrow' },
|
|
315
|
-
{ keys: ['R'], label: 'Rectangle' },
|
|
316
|
-
{ keys: ['G'], label: 'Triangle' },
|
|
317
|
-
{ keys: ['O'], label: 'Ellipse' },
|
|
318
|
-
{ keys: ['F'], label: 'Frame' },
|
|
319
|
-
{ keys: ['T'], label: 'Text' },
|
|
320
|
-
{ keys: ['I'], label: 'Image' },
|
|
321
|
-
],
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
title: 'Selection',
|
|
325
|
-
shortcuts: [
|
|
326
|
-
{ keys: ['Ctrl/Cmd', null, 'A'], label: 'Select All' },
|
|
327
|
-
{ keys: ['Alt', null, 'Click'], label: 'Drill-through Select' },
|
|
328
|
-
{ keys: ['Ctrl/Cmd', null, 'D'], label: 'Duplicate' },
|
|
329
|
-
{ keys: ['Ctrl/Cmd', null, 'C'], label: 'Copy' },
|
|
330
|
-
{ keys: ['Ctrl/Cmd', null, 'V'], label: 'Paste' },
|
|
331
|
-
{ keys: ['Del'], label: 'Delete' },
|
|
332
|
-
{ keys: ['Ctrl/Cmd', null, 'G'], label: 'Group' },
|
|
333
|
-
{ keys: ['Ctrl/Cmd', null, 'Shift', null, 'G'], label: 'Ungroup' },
|
|
334
|
-
],
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
title: 'History',
|
|
338
|
-
shortcuts: [
|
|
339
|
-
{ keys: ['Ctrl/Cmd', null, 'Z'], label: 'Undo' },
|
|
340
|
-
{ keys: ['Ctrl/Cmd', null, 'Shift', null, 'Z'], label: 'Redo' },
|
|
341
|
-
{ keys: ['Ctrl/Cmd', null, 'Y'], label: 'Redo (alt)' },
|
|
342
|
-
{ keys: ['Ctrl/Cmd', null, 'S'], label: 'Save' },
|
|
343
|
-
],
|
|
344
|
-
},
|
|
345
|
-
{
|
|
346
|
-
title: 'Zoom & Canvas',
|
|
347
|
-
shortcuts: [
|
|
348
|
-
// null = '+' separator; the final '+' here is the actual key badge
|
|
349
|
-
{ keys: ['Ctrl/Cmd', null, '+'], label: 'Zoom In' },
|
|
350
|
-
{ keys: ['Ctrl/Cmd', null, '−'], label: 'Zoom Out' },
|
|
351
|
-
{ keys: ['Ctrl/Cmd', null, '0'], label: 'Reset Zoom (100%)' },
|
|
352
|
-
{ keys: ['Ctrl/Cmd', null, '9'], label: 'Fit to screen' },
|
|
353
|
-
{ keys: ['Space', null, 'Drag'], label: 'Pan canvas' },
|
|
354
|
-
// Four arrow keys shown as individual square badges (no separator between them)
|
|
355
|
-
{ keys: ['↑', '↓', '←', '→'], label: 'Move selected (1px)' },
|
|
356
|
-
{ keys: ['Shift', null, '↑', '↓', '←', '→'], label: 'Move selected (10px)' },
|
|
357
|
-
],
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
title: 'Layer Order',
|
|
361
|
-
shortcuts: [
|
|
362
|
-
{ keys: [']'], label: 'Bring Forward' },
|
|
363
|
-
{ keys: ['['], label: 'Send Backward' },
|
|
364
|
-
{ keys: ['Ctrl/Cmd', null, ']'], label: 'Bring to Front' },
|
|
365
|
-
{ keys: ['Ctrl/Cmd', null, '['], label: 'Send to Back' },
|
|
366
|
-
],
|
|
367
|
-
},
|
|
368
|
-
{
|
|
369
|
-
title: 'Frame',
|
|
370
|
-
shortcuts: [
|
|
371
|
-
{ keys: ['Alt', null, 'Drag corner'], label: 'Resize, keep children size' },
|
|
372
|
-
{ keys: ['Double-click'], label: 'Enter / exit frame edit' },
|
|
373
|
-
],
|
|
374
|
-
},
|
|
375
|
-
];
|
|
320
|
+
// The shortcuts are listed in i18n/shortcuts.ts: each key is a key cap, a word (a message) or the '+' between two keys.
|
|
321
|
+
// Here they are said in the language of the canvas, and said again when the page sets another language.
|
|
322
|
+
$: translatedShortcutGroups = shortcutGroups($t);
|
|
323
|
+
// The line under the list is a sentence with three parts drawn as keys: the translation says where each one goes
|
|
324
|
+
$: footerParts = sentenceParts('canvas.shortcuts.footer', ['key', 'hint', 'icon'], $t);
|
|
376
325
|
|
|
377
326
|
/**
|
|
378
327
|
* Handle keyboard shortcuts
|
|
379
328
|
*/
|
|
380
329
|
function handleKeydown(event: KeyboardEvent) {
|
|
330
|
+
// Not for a key pressed elsewhere on a page that has this toolbar in a shadow root
|
|
331
|
+
if (!eventIsForScope(event, toolbarRootEl)) return;
|
|
381
332
|
// Toggle shortcuts panel with '?'
|
|
382
333
|
if (event.key === '?' && !event.ctrlKey && !event.metaKey) {
|
|
383
|
-
const activeElement =
|
|
334
|
+
const activeElement = getFocusedElementIn(toolbarRootEl) as HTMLElement | null;
|
|
384
335
|
if (activeElement) {
|
|
385
336
|
const tagName = activeElement.tagName;
|
|
386
337
|
if (tagName === 'INPUT' || tagName === 'TEXTAREA' || activeElement.isContentEditable) {
|
|
@@ -426,7 +377,7 @@
|
|
|
426
377
|
}
|
|
427
378
|
|
|
428
379
|
// Skip if focus is on text input
|
|
429
|
-
const activeElement =
|
|
380
|
+
const activeElement = getFocusedElementIn(toolbarRootEl) as HTMLElement | null;
|
|
430
381
|
if (activeElement) {
|
|
431
382
|
const tagName = activeElement.tagName;
|
|
432
383
|
const isTextInput = tagName === 'INPUT' || tagName === 'TEXTAREA';
|
|
@@ -461,6 +412,9 @@
|
|
|
461
412
|
// We check both event.key (character-based) AND event.code (physical key-based)
|
|
462
413
|
// so this works across keyboard layouts and Numpad keys.
|
|
463
414
|
function preventBrowserZoom(event: KeyboardEvent) {
|
|
415
|
+
// Only the zoom of a visitor who is in the canvas: on a partner's page (a canvas in a shadow root) the page's own
|
|
416
|
+
// zoom keys are the visitor's, wherever else on the page they are pressed.
|
|
417
|
+
if (!eventIsForScope(event, toolbarRootEl)) return;
|
|
464
418
|
if (event.ctrlKey || event.metaKey) {
|
|
465
419
|
const key = event.key;
|
|
466
420
|
const code = event.code;
|
|
@@ -482,6 +436,8 @@
|
|
|
482
436
|
// Prevent browser pinch-to-zoom and Ctrl+wheel zoom (trackpad gesture).
|
|
483
437
|
// passive:false is required so we can call preventDefault().
|
|
484
438
|
function preventWheelZoom(event: WheelEvent) {
|
|
439
|
+
// Only over the canvas (see preventBrowserZoom)
|
|
440
|
+
if (!eventIsForScope(event, toolbarRootEl)) return;
|
|
485
441
|
if (event.ctrlKey || event.metaKey) {
|
|
486
442
|
event.preventDefault();
|
|
487
443
|
}
|
|
@@ -520,7 +476,7 @@
|
|
|
520
476
|
|
|
521
477
|
</script>
|
|
522
478
|
|
|
523
|
-
<div class="{className ? className + ' ' : ''}canvas-toolbar-el flex flex-col justify-between gap-2" style={style}>
|
|
479
|
+
<div bind:this={toolbarRootEl} class="{className ? className + ' ' : ''}canvas-toolbar-el flex flex-col justify-between gap-2" style={style}>
|
|
524
480
|
<!-- Tools Bar -->
|
|
525
481
|
<div class="tools-bar-el flex flex-row gap-2 w-full">
|
|
526
482
|
<!-- Scrollable container for tools — overflow-x-auto clips absolute children,
|
|
@@ -528,30 +484,30 @@
|
|
|
528
484
|
<div class="tools-ct flex flex-row">
|
|
529
485
|
{#if advancedFeatures}
|
|
530
486
|
<!-- ── Utility cluster: Undo, Redo, Hand, Lock | Divider ── -->
|
|
531
|
-
<Tooltip text=
|
|
487
|
+
<Tooltip text={$t('canvas.tool.undoTitle')}>
|
|
532
488
|
<div class="disabled-tooltip-wrap">
|
|
533
489
|
<button
|
|
534
490
|
class="undo-bt {buttonClass} {inactiveClass}"
|
|
535
491
|
onclick={onUndo}
|
|
536
492
|
disabled={!canUndo}
|
|
537
|
-
aria-label=
|
|
493
|
+
aria-label={$t('canvas.tool.undo')}
|
|
538
494
|
>
|
|
539
|
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
495
|
+
<svg class="rtl:-scale-x-100" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
540
496
|
<path d="M3 7v6h6"/>
|
|
541
497
|
<path d="M3 13C3 13 5.5 7 12 7c4.42 0 8 3.13 8 7s-3.58 7-8 7a8.23 8.23 0 0 1-5.66-2.34"/>
|
|
542
498
|
</svg>
|
|
543
499
|
</button>
|
|
544
500
|
</div>
|
|
545
501
|
</Tooltip>
|
|
546
|
-
<Tooltip text=
|
|
502
|
+
<Tooltip text={$t('canvas.tool.redoTitle')}>
|
|
547
503
|
<div class="disabled-tooltip-wrap">
|
|
548
504
|
<button
|
|
549
505
|
class="redo-bt {buttonClass} {inactiveClass}"
|
|
550
506
|
onclick={onRedo}
|
|
551
507
|
disabled={!canRedo}
|
|
552
|
-
aria-label=
|
|
508
|
+
aria-label={$t('canvas.tool.redo')}
|
|
553
509
|
>
|
|
554
|
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
510
|
+
<svg class="rtl:-scale-x-100" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
555
511
|
<path d="M21 7v6h-6"/>
|
|
556
512
|
<path d="M21 13C21 13 18.5 7 12 7c-4.42 0-8 3.13-8 7s3.58 7 8 7a8.23 8.23 0 0 0 5.66-2.34"/>
|
|
557
513
|
</svg>
|
|
@@ -571,10 +527,10 @@
|
|
|
571
527
|
</svg>
|
|
572
528
|
</button>
|
|
573
529
|
</Tooltip> -->
|
|
574
|
-
<Tooltip text={stickyToolEnabled ? '
|
|
530
|
+
<Tooltip text={$t(stickyToolEnabled ? 'canvas.tool.stickyOn' : 'canvas.tool.stickyOff')}>
|
|
575
531
|
<button class="sticky-tool-bt {buttonClass} {stickyToolEnabled ? activeClass : inactiveClass}"
|
|
576
532
|
onclick={onToggleStickyTool}
|
|
577
|
-
aria-label=
|
|
533
|
+
aria-label={$t('canvas.tool.stickyLabel')}
|
|
578
534
|
aria-pressed={stickyToolEnabled}>
|
|
579
535
|
{#if stickyToolEnabled}
|
|
580
536
|
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
@@ -597,14 +553,14 @@
|
|
|
597
553
|
<!-- Each tool is wrapped in a mask container that clips its body at rest.
|
|
598
554
|
When active, overflow becomes visible so the tool "pops out" above the toolbar. -->
|
|
599
555
|
<div class="wdg-illustrated-mask {activeTool === 'draw' ? 'wdg-illustrated-mask-active' : ''}">
|
|
600
|
-
<Tooltip text=
|
|
556
|
+
<Tooltip text={toolTitle('canvas.tool.draw', TOOL_KEYS.draw, $t)} offsetY={8}>
|
|
601
557
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
602
558
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
603
559
|
<div class="wdg-illustrated-bt {activeTool === 'draw' ? 'wdg-illustrated-active' : ''}"
|
|
604
560
|
onclick={onSelectDrawTool}
|
|
605
561
|
role="button"
|
|
606
562
|
tabindex="-1"
|
|
607
|
-
aria-label=
|
|
563
|
+
aria-label={$t('canvas.tool.draw')}>
|
|
608
564
|
<svg class="wdg-pencil-svg" viewBox="0 0 32 159" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
609
565
|
<path d="M20.8823 15.927L18.439 3.29447C17.3288 0.137968 14.6702 0.137967 13.5604 3.29374L11.114 15.927H20.8823Z" fill="#4A4A4C"/>
|
|
610
566
|
<path d="M32 88.8211L32 68.6342C32 66.2211 31.7486 63.9551 31.3079 61.9972L20.8785 15.927H11.1176L0.841019 61.3789L0.692138 61.9972C0.251452 63.9551 6.10352e-05 66.2211 6.10352e-05 68.6342L0.000481631 88.8221L32 88.8211Z" fill="url(#pencilBody)"/>
|
|
@@ -623,14 +579,14 @@
|
|
|
623
579
|
</Tooltip>
|
|
624
580
|
</div>
|
|
625
581
|
<div class="wdg-illustrated-mask {activeTool === 'erase' ? 'wdg-illustrated-mask-active' : ''}">
|
|
626
|
-
<Tooltip text=
|
|
582
|
+
<Tooltip text={toolTitle('canvas.tool.erase', TOOL_KEYS.erase, $t)} offsetY={8}>
|
|
627
583
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
628
584
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
629
585
|
<div class="wdg-illustrated-bt {activeTool === 'erase' ? 'wdg-illustrated-active' : ''}"
|
|
630
586
|
onclick={onSelectEraseTool}
|
|
631
587
|
role="button"
|
|
632
588
|
tabindex="-1"
|
|
633
|
-
aria-label=
|
|
589
|
+
aria-label={$t('canvas.tool.erase')}>
|
|
634
590
|
<svg class="wdg-eraser-svg" viewBox="0 0 32 127" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
635
591
|
<path d="M31.9959 29.9282L1.3e-06 29.9282L0 36.9282L31.9959 36.9282L31.9959 29.9282Z" fill="#ABB1B4"/>
|
|
636
592
|
<path d="M4.4e-05 36.9241L0 36.5283H10.6654V36.9241L4.4e-05 36.9241Z" fill="white"/>
|
|
@@ -657,28 +613,28 @@
|
|
|
657
613
|
</div>
|
|
658
614
|
|
|
659
615
|
<!-- ══ Standard icon-only tool buttons ══ -->
|
|
660
|
-
<Tooltip text=
|
|
616
|
+
<Tooltip text={toolTitle('canvas.tool.select', TOOL_KEYS.select, $t)}>
|
|
661
617
|
<button class="select-bt {buttonClass} {activeTool === 'select' ? activeClass : inactiveClass}"
|
|
662
618
|
onclick={onSelectSelectTool}
|
|
663
|
-
aria-label=
|
|
619
|
+
aria-label={$t('canvas.tool.select')}>
|
|
664
620
|
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
665
621
|
<path d="M5 3L5 18.5L9.5 14L14.5 21L17 19.5L12 12.5L18 12.5L5 3Z" fill="currentColor" stroke="currentColor" stroke-width="1" stroke-linejoin="round"/>
|
|
666
622
|
</svg>
|
|
667
623
|
</button>
|
|
668
624
|
</Tooltip>
|
|
669
|
-
<Tooltip text=
|
|
625
|
+
<Tooltip text={toolTitle('canvas.tool.arrow', TOOL_KEYS.arrow, $t)}>
|
|
670
626
|
<button class="arrow-bt {buttonClass} {activeTool === 'arrow' ? activeClass : inactiveClass}"
|
|
671
627
|
onclick={() => onSelectShapeTool('arrow')}
|
|
672
|
-
aria-label=
|
|
628
|
+
aria-label={$t('canvas.tool.arrow')}>
|
|
673
629
|
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
674
630
|
<path d="M6 18C6 18 6.06617 12.5162 8.00001 10.5521C10.862 7.64522 19 9 19 9M19 9L15 5M19 9L15 13" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
675
631
|
</svg>
|
|
676
632
|
</button>
|
|
677
633
|
</Tooltip>
|
|
678
|
-
<Tooltip text=
|
|
634
|
+
<Tooltip text={toolTitle('canvas.tool.text', TOOL_KEYS.text, $t)}>
|
|
679
635
|
<button class="text-bt {buttonClass} {activeTool === 'text' ? activeClass : inactiveClass}"
|
|
680
636
|
onclick={onSelectTextTool}
|
|
681
|
-
aria-label=
|
|
637
|
+
aria-label={$t('canvas.tool.text')}>
|
|
682
638
|
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
683
639
|
<path d="M6 7V5H18V7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
684
640
|
<path d="M12 5V19" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -690,10 +646,10 @@
|
|
|
690
646
|
{#if showMediaOnBar}
|
|
691
647
|
<div class="toolbar-divider"></div>
|
|
692
648
|
|
|
693
|
-
<Tooltip text=
|
|
649
|
+
<Tooltip text={toolTitle('canvas.tool.frame', TOOL_KEYS.frame, $t)}>
|
|
694
650
|
<button class="frame-bt {buttonClass} {activeTool === 'frame' ? activeClass : inactiveClass}"
|
|
695
651
|
onclick={onSelectFrameTool}
|
|
696
|
-
aria-label=
|
|
652
|
+
aria-label={$t('canvas.tool.frame')}>
|
|
697
653
|
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
698
654
|
<rect x="3" y="3" width="18" height="18" rx="2"/>
|
|
699
655
|
<path d="M3 9h18"/>
|
|
@@ -702,10 +658,10 @@
|
|
|
702
658
|
</button>
|
|
703
659
|
</Tooltip>
|
|
704
660
|
|
|
705
|
-
<Tooltip text=
|
|
661
|
+
<Tooltip text={toolTitle('canvas.tool.image', TOOL_KEYS.image, $t)}>
|
|
706
662
|
<button class="image-bt {buttonClass} {activeTool === 'image' ? activeClass : inactiveClass}"
|
|
707
663
|
onclick={() => { onSelectImageTool(); }}
|
|
708
|
-
aria-label=
|
|
664
|
+
aria-label={$t('canvas.tool.image')}>
|
|
709
665
|
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
710
666
|
<rect x="3" y="3" width="18" height="18" rx="2"/>
|
|
711
667
|
<circle cx="8.5" cy="8.5" r="1.5"/>
|
|
@@ -714,10 +670,10 @@
|
|
|
714
670
|
</button>
|
|
715
671
|
</Tooltip>
|
|
716
672
|
|
|
717
|
-
<Tooltip text=
|
|
673
|
+
<Tooltip text={$t('canvas.tool.video')}>
|
|
718
674
|
<button class="video-bt {buttonClass} {activeTool === 'video' ? activeClass : inactiveClass}"
|
|
719
675
|
onclick={onSelectVideoTool}
|
|
720
|
-
aria-label=
|
|
676
|
+
aria-label={$t('canvas.tool.video')}>
|
|
721
677
|
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
722
678
|
<rect x="2" y="6" width="14" height="12" rx="2"/>
|
|
723
679
|
<path d="M16 10l6-3v10l-6-3z"/>
|
|
@@ -732,7 +688,7 @@
|
|
|
732
688
|
<button
|
|
733
689
|
class="shapes-main-bt {buttonClass} {activeDropdownIsActive ? activeClass : inactiveClass}"
|
|
734
690
|
onclick={activateDropdownTool}
|
|
735
|
-
aria-label={
|
|
691
|
+
aria-label={$t(dropdownToolNameKey)}
|
|
736
692
|
>
|
|
737
693
|
{#if activeDropdownTool === 'library-shape' && lastSelectedLibraryShape}
|
|
738
694
|
{@html lastSelectedLibraryShape.iconSvg}
|
|
@@ -745,11 +701,11 @@
|
|
|
745
701
|
{/if}
|
|
746
702
|
</button>
|
|
747
703
|
</Tooltip>
|
|
748
|
-
<Tooltip text=
|
|
704
|
+
<Tooltip text={$t('canvas.tool.moreShapes')} disabled={shapesDropdownOpen}>
|
|
749
705
|
<button
|
|
750
706
|
class="shapes-caret-bt {buttonClass} {activeDropdownIsActive ? activeClass : inactiveClass}"
|
|
751
707
|
onclick={(e) => toggleShapesDropdown(e)}
|
|
752
|
-
aria-label=
|
|
708
|
+
aria-label={$t('canvas.tool.moreShapes')}
|
|
753
709
|
>
|
|
754
710
|
<svg width="10" height="10" viewBox="0 0 10 10" fill="none">
|
|
755
711
|
<path d="M2 4L5 7L8 4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -764,19 +720,19 @@
|
|
|
764
720
|
<div class="actions-bar-el relative hidden flex-row gap-2 w-full">
|
|
765
721
|
<div class="actions-ct flex flex-row gap-2 overflow-x-auto rounded-xl p-2 bg-white/80 shadow-md border border-gray-100">
|
|
766
722
|
<!-- Grouping Actions -->
|
|
767
|
-
<button class="add-group-selection-bt {buttonClass}" onclick={onGroupSelection}><span class="icon">📦</span>
|
|
768
|
-
<button class="add-ungroup-selection-bt {buttonClass}" onclick={onUngroupSelection}><span class="icon">📤</span>
|
|
769
|
-
<button class="add-duplicate-selection-bt {buttonClass}" onclick={onDuplicateSelection}><span class="icon">📋</span>
|
|
770
|
-
<button class="add-select-all-bt {buttonClass}" onclick={onSelectAllObjects}><span class="icon">🎯</span>
|
|
771
|
-
<button class="add-clear-all-bt {buttonClass}" onclick={onClearAllObjects}><span class="icon">🗑️</span>
|
|
723
|
+
<button class="add-group-selection-bt {buttonClass}" onclick={onGroupSelection}><span class="icon">📦</span> {$t('canvas.action.group')}</button>
|
|
724
|
+
<button class="add-ungroup-selection-bt {buttonClass}" onclick={onUngroupSelection}><span class="icon">📤</span> {$t('canvas.action.ungroup')}</button>
|
|
725
|
+
<button class="add-duplicate-selection-bt {buttonClass}" onclick={onDuplicateSelection}><span class="icon">📋</span> {$t('canvas.action.duplicate')}</button>
|
|
726
|
+
<button class="add-select-all-bt {buttonClass}" onclick={onSelectAllObjects}><span class="icon">🎯</span> {$t('canvas.action.selectAll')}</button>
|
|
727
|
+
<button class="add-clear-all-bt {buttonClass}" onclick={onClearAllObjects}><span class="icon">🗑️</span> {$t('canvas.action.clearAll')}</button>
|
|
772
728
|
|
|
773
729
|
<!-- Add Objects Actions -->
|
|
774
|
-
<button class="add-text-bt {buttonClass}" onclick={addText}><span class="icon">📝</span>
|
|
775
|
-
<button class="add-rext-bt {buttonClass}" onclick={addRect}><span class="icon">⬜</span>
|
|
776
|
-
<button class="add-triangle-bt {buttonClass}" onclick={addTriangle}><span class="icon">🔺</span>
|
|
777
|
-
<button class="add-circle-bt {buttonClass}" onclick={addCircle}><span class="icon">🔴</span>
|
|
778
|
-
<button class="add-frame-bt {buttonClass}" onclick={addFrame}><span class="icon frame-icon">▢</span>
|
|
779
|
-
<button class="add-image-bt {buttonClass}" onclick={addImage}><span class="icon">🖼️</span>
|
|
730
|
+
<button class="add-text-bt {buttonClass}" onclick={addText}><span class="icon">📝</span> {$t('canvas.tool.text')}</button>
|
|
731
|
+
<button class="add-rext-bt {buttonClass}" onclick={addRect}><span class="icon">⬜</span> {$t('canvas.tool.rectangle')}</button>
|
|
732
|
+
<button class="add-triangle-bt {buttonClass}" onclick={addTriangle}><span class="icon">🔺</span> {$t('canvas.tool.triangle')}</button>
|
|
733
|
+
<button class="add-circle-bt {buttonClass}" onclick={addCircle}><span class="icon">🔴</span> {$t('canvas.tool.circle')}</button>
|
|
734
|
+
<button class="add-frame-bt {buttonClass}" onclick={addFrame}><span class="icon frame-icon">▢</span> {$t('canvas.tool.frame')}</button>
|
|
735
|
+
<button class="add-image-bt {buttonClass}" onclick={addImage}><span class="icon">🖼️</span> {$t('canvas.tool.image')}</button>
|
|
780
736
|
</div>
|
|
781
737
|
</div>
|
|
782
738
|
</div>
|
|
@@ -794,29 +750,29 @@
|
|
|
794
750
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
795
751
|
<div
|
|
796
752
|
class="shapes-dropdown-menu-fixed"
|
|
797
|
-
style="position:absolute; left:{dropdownLeft}px; {dropdownOpenAbove ? `bottom:${dropdownBottomOffset}px` : `top:${dropdownTopOffset}px`}; width:{dropdownMinWidth}px; max-height:{dropdownMaxHeight}px; z-index:9999;"
|
|
753
|
+
style="position:absolute; left:{dropdownLeft}px; /* rtl-ok: worked out from where the button is on the screen, in pixels from the left edge of the canvas */ {dropdownOpenAbove ? `bottom:${dropdownBottomOffset}px` : `top:${dropdownTopOffset}px`}; width:{dropdownMinWidth}px; max-height:{dropdownMaxHeight}px; z-index:9999;"
|
|
798
754
|
>
|
|
799
755
|
<div
|
|
800
756
|
class="shapes-dropdown-scroll"
|
|
801
757
|
use:overlayScrollbar
|
|
802
|
-
style={shapesDropdownNeedsScroll ? 'margin-
|
|
758
|
+
style={shapesDropdownNeedsScroll ? 'margin-inline-end: -6px' : ''}
|
|
803
759
|
>
|
|
804
760
|
<!-- Media Shapes — first so Frame / Image / Video are easy to reach when not on the bar -->
|
|
805
761
|
{#if showMediaInDropdown}
|
|
806
|
-
<div class="shapes-category-label">
|
|
762
|
+
<div class="shapes-category-label">{$t('canvas.menu.mediaShapes')}</div>
|
|
807
763
|
<div class="shapes-library-grid">
|
|
808
|
-
<Tooltip text=
|
|
809
|
-
<button class="shape-library-bt {activeTool === 'frame' ? 'active' : ''}" onclick={selectFrameFromDropdown} aria-label=
|
|
764
|
+
<Tooltip text={toolTitle('canvas.tool.frame', TOOL_KEYS.frame, $t)} position="above">
|
|
765
|
+
<button class="shape-library-bt {activeTool === 'frame' ? 'active' : ''}" onclick={selectFrameFromDropdown} aria-label={$t('canvas.tool.frame')}>
|
|
810
766
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M9 3v6"/></svg>
|
|
811
767
|
</button>
|
|
812
768
|
</Tooltip>
|
|
813
|
-
<Tooltip text=
|
|
814
|
-
<button class="shape-library-bt {activeTool === 'image' ? 'active' : ''}" onclick={selectImageFromDropdown} aria-label=
|
|
769
|
+
<Tooltip text={toolTitle('canvas.tool.image', TOOL_KEYS.image, $t)} position="above">
|
|
770
|
+
<button class="shape-library-bt {activeTool === 'image' ? 'active' : ''}" onclick={selectImageFromDropdown} aria-label={$t('canvas.tool.image')}>
|
|
815
771
|
{@html imageDropdownInfo.iconSvg}
|
|
816
772
|
</button>
|
|
817
773
|
</Tooltip>
|
|
818
|
-
<Tooltip text=
|
|
819
|
-
<button class="shape-library-bt {activeTool === 'video' ? 'active' : ''}" onclick={selectVideoFromDropdown} aria-label=
|
|
774
|
+
<Tooltip text={$t('canvas.tool.video')} position="above">
|
|
775
|
+
<button class="shape-library-bt {activeTool === 'video' ? 'active' : ''}" onclick={selectVideoFromDropdown} aria-label={$t('canvas.tool.video')}>
|
|
820
776
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="6" width="14" height="12" rx="2"/><path d="M16 10l6-3v10l-6-3z"/></svg>
|
|
821
777
|
</button>
|
|
822
778
|
</Tooltip>
|
|
@@ -825,38 +781,38 @@
|
|
|
825
781
|
{/if}
|
|
826
782
|
|
|
827
783
|
<!-- Geometric Shapes — 3×2 grid -->
|
|
828
|
-
<div class="shapes-category-label">
|
|
784
|
+
<div class="shapes-category-label">{categoryLabel(GEOMETRIC_CATEGORY, $t)}</div>
|
|
829
785
|
<div class="shapes-library-grid">
|
|
830
|
-
<Tooltip text=
|
|
831
|
-
<button class="shape-library-bt" onclick={() => selectShape('triangle')} aria-label=
|
|
786
|
+
<Tooltip text={toolTitle('canvas.tool.triangle', TOOL_KEYS.triangle, $t)} position="above">
|
|
787
|
+
<button class="shape-library-bt" onclick={() => selectShape('triangle')} aria-label={$t('canvas.tool.triangle')}>
|
|
832
788
|
{@html shapeInfo.triangle.iconSvg}
|
|
833
789
|
</button>
|
|
834
790
|
</Tooltip>
|
|
835
|
-
<Tooltip text=
|
|
836
|
-
<button class="shape-library-bt" onclick={() => selectShape('rect')} aria-label=
|
|
791
|
+
<Tooltip text={toolTitle('canvas.tool.rectangle', TOOL_KEYS.rectangle, $t)} position="above">
|
|
792
|
+
<button class="shape-library-bt" onclick={() => selectShape('rect')} aria-label={$t('canvas.tool.rectangle')}>
|
|
837
793
|
{@html shapeInfo.rect.iconSvg}
|
|
838
794
|
</button>
|
|
839
795
|
</Tooltip>
|
|
840
|
-
{#each (libraryShapesByCategory.get(
|
|
841
|
-
<Tooltip text={shape.
|
|
842
|
-
<button class="shape-library-bt" onclick={() => selectLibraryShape(shape)} aria-label={shape.
|
|
796
|
+
{#each (libraryShapesByCategory.get(GEOMETRIC_CATEGORY) ?? []).filter(s => s.key === 'hexagon') as shape}
|
|
797
|
+
<Tooltip text={$t(shape.labelKey)} position="above">
|
|
798
|
+
<button class="shape-library-bt" onclick={() => selectLibraryShape(shape)} aria-label={$t(shape.labelKey)}>
|
|
843
799
|
{@html shape.iconSvg}
|
|
844
800
|
</button>
|
|
845
801
|
</Tooltip>
|
|
846
802
|
{/each}
|
|
847
|
-
<Tooltip text=
|
|
848
|
-
<button class="shape-library-bt" onclick={() => selectShape('circle-true')} aria-label=
|
|
803
|
+
<Tooltip text={$t('canvas.tool.circle')} position="above">
|
|
804
|
+
<button class="shape-library-bt" onclick={() => selectShape('circle-true')} aria-label={$t('canvas.tool.circle')}>
|
|
849
805
|
{@html shapeInfo['circle-true'].iconSvg}
|
|
850
806
|
</button>
|
|
851
807
|
</Tooltip>
|
|
852
|
-
<Tooltip text=
|
|
853
|
-
<button class="shape-library-bt" onclick={() => selectShape('circle')} aria-label=
|
|
808
|
+
<Tooltip text={toolTitle('canvas.tool.ellipse', TOOL_KEYS.ellipse, $t)} position="above">
|
|
809
|
+
<button class="shape-library-bt" onclick={() => selectShape('circle')} aria-label={$t('canvas.tool.ellipse')}>
|
|
854
810
|
{@html shapeInfo.circle.iconSvg}
|
|
855
811
|
</button>
|
|
856
812
|
</Tooltip>
|
|
857
|
-
{#each (libraryShapesByCategory.get(
|
|
858
|
-
<Tooltip text={shape.
|
|
859
|
-
<button class="shape-library-bt" onclick={() => selectLibraryShape(shape)} aria-label={shape.
|
|
813
|
+
{#each (libraryShapesByCategory.get(GEOMETRIC_CATEGORY) ?? []).filter(s => s.key === 'oval') as shape}
|
|
814
|
+
<Tooltip text={$t(shape.labelKey)} position="above">
|
|
815
|
+
<button class="shape-library-bt" onclick={() => selectLibraryShape(shape)} aria-label={$t(shape.labelKey)}>
|
|
860
816
|
{@html shape.iconSvg}
|
|
861
817
|
</button>
|
|
862
818
|
</Tooltip>
|
|
@@ -864,16 +820,16 @@
|
|
|
864
820
|
</div>
|
|
865
821
|
|
|
866
822
|
<!-- Library shape categories (skip Geometric, already rendered above) -->
|
|
867
|
-
{#each [...libraryShapesByCategory.entries()].filter(([cat]) => cat !==
|
|
823
|
+
{#each [...libraryShapesByCategory.entries()].filter(([cat]) => cat !== GEOMETRIC_CATEGORY) as [category, shapes]}
|
|
868
824
|
<div class="shapes-dropdown-divider"></div>
|
|
869
|
-
<div class="shapes-category-label">{category}</div>
|
|
825
|
+
<div class="shapes-category-label">{categoryLabel(category, $t)}</div>
|
|
870
826
|
<div class="shapes-library-grid">
|
|
871
827
|
{#each shapes as shape}
|
|
872
|
-
<Tooltip text={shape.
|
|
828
|
+
<Tooltip text={$t(shape.labelKey)} position="above">
|
|
873
829
|
<button
|
|
874
830
|
class="shape-library-bt"
|
|
875
831
|
onclick={() => selectLibraryShape(shape)}
|
|
876
|
-
aria-label={shape.
|
|
832
|
+
aria-label={$t(shape.labelKey)}
|
|
877
833
|
>
|
|
878
834
|
{@html shape.iconSvg}
|
|
879
835
|
</button>
|
|
@@ -901,17 +857,18 @@
|
|
|
901
857
|
<div class="shortcuts-panel-header">
|
|
902
858
|
<div class="shortcuts-panel-title-ct">
|
|
903
859
|
<span class="shortcuts-panel-icon">⌨</span>
|
|
904
|
-
<h2 class="shortcuts-panel-title">
|
|
860
|
+
<h2 class="shortcuts-panel-title">{$t('canvas.shortcuts.title')}</h2>
|
|
905
861
|
</div>
|
|
906
862
|
<button
|
|
907
863
|
class="close-shortcuts-bt"
|
|
908
864
|
onclick={() => shortcutsPanelOpen = false}
|
|
865
|
+
aria-label={$t('canvas.shortcuts.close')}
|
|
909
866
|
>✕</button>
|
|
910
867
|
</div>
|
|
911
868
|
|
|
912
869
|
<div class="shortcuts-panel-body">
|
|
913
870
|
<div class="shortcuts-column">
|
|
914
|
-
{#each
|
|
871
|
+
{#each translatedShortcutGroups.filter((_, i) => i % 2 === 0) as group}
|
|
915
872
|
<div class="shortcut-group">
|
|
916
873
|
<h3 class="shortcut-group-title">{group.title}</h3>
|
|
917
874
|
<ul class="shortcut-list">
|
|
@@ -934,7 +891,7 @@
|
|
|
934
891
|
{/each}
|
|
935
892
|
</div>
|
|
936
893
|
<div class="shortcuts-column">
|
|
937
|
-
{#each
|
|
894
|
+
{#each translatedShortcutGroups.filter((_, i) => i % 2 === 1) as group}
|
|
938
895
|
<div class="shortcut-group">
|
|
939
896
|
<h3 class="shortcut-group-title">{group.title}</h3>
|
|
940
897
|
<ul class="shortcut-list">
|
|
@@ -959,7 +916,18 @@
|
|
|
959
916
|
</div>
|
|
960
917
|
|
|
961
918
|
<div class="shortcuts-panel-footer flex items-center justify-center gap-2">
|
|
962
|
-
|
|
919
|
+
<!-- A sentence with three parts drawn as keys: each part goes where the translation puts it -->
|
|
920
|
+
{#each footerParts as part}
|
|
921
|
+
{#if 'text' in part}
|
|
922
|
+
{part.text}
|
|
923
|
+
{:else if part.slot === 'key'}
|
|
924
|
+
<kbd class="shortcut-key font-medium">?</kbd>
|
|
925
|
+
{:else if part.slot === 'hint'}
|
|
926
|
+
<span class="shortcuts-footer-hint">{$t('canvas.shortcuts.footerHint')}</span>
|
|
927
|
+
{:else if part.slot === 'icon'}
|
|
928
|
+
<kbd class="shortcut-key" style="font-size: 31px;">⌨</kbd>
|
|
929
|
+
{/if}
|
|
930
|
+
{/each}
|
|
963
931
|
</div>
|
|
964
932
|
</div>
|
|
965
933
|
{/if}
|
|
@@ -1128,7 +1096,7 @@ button:disabled {
|
|
|
1128
1096
|
flex-shrink: 0;
|
|
1129
1097
|
position: absolute;
|
|
1130
1098
|
bottom: 0;
|
|
1131
|
-
|
|
1099
|
+
inset-inline-start: 0;
|
|
1132
1100
|
filter: none;
|
|
1133
1101
|
}
|
|
1134
1102
|
/* Pencil: SVG ~149px tall, mask 48px.
|
|
@@ -1458,7 +1426,7 @@ button:disabled {
|
|
|
1458
1426
|
align-items: center;
|
|
1459
1427
|
gap: 3px;
|
|
1460
1428
|
flex-shrink: 0;
|
|
1461
|
-
margin-
|
|
1429
|
+
margin-inline-start: 8px;
|
|
1462
1430
|
}
|
|
1463
1431
|
.shortcut-sep {
|
|
1464
1432
|
font-size: 0.6875rem;
|