@sveltia/ui 0.70.2 → 0.71.0
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.
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
disabled = false,
|
|
37
37
|
label = '',
|
|
38
38
|
labelDir = undefined,
|
|
39
|
-
|
|
39
|
+
// The popup flips to the other side by itself when the submenu wouldn’t fit on this one
|
|
40
|
+
popupPosition = 'right-top',
|
|
40
41
|
children: _children,
|
|
41
42
|
startIcon: _startIcon,
|
|
42
43
|
endIcon: _endIcon,
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Dialog action button labels
|
|
2
|
+
ok: OK
|
|
3
|
+
cancel: Annulla
|
|
4
|
+
close: Chiudi
|
|
5
|
+
|
|
6
|
+
# Button to clear content, e.g. search input or calendar date
|
|
7
|
+
clear: Cancella
|
|
8
|
+
|
|
9
|
+
# Text editor dialog buttons for link/image insertion
|
|
10
|
+
insert: Inserisci
|
|
11
|
+
update: Aggiorna
|
|
12
|
+
remove: Rimuovi
|
|
13
|
+
|
|
14
|
+
# Combobox dropdown toggle button aria-labels
|
|
15
|
+
collapse: Comprimi
|
|
16
|
+
expand: Espandi
|
|
17
|
+
|
|
18
|
+
# Infobar/toast dismiss button label
|
|
19
|
+
dismiss: Ignora
|
|
20
|
+
|
|
21
|
+
# Emoji suggestion listbox aria-label, shared by the text fields and the text editor
|
|
22
|
+
emoji_suggestions: Suggerimenti Emoji
|
|
23
|
+
|
|
24
|
+
# Calendar component
|
|
25
|
+
calendar:
|
|
26
|
+
# View switcher group aria-labels and navigation button aria-labels
|
|
27
|
+
year: Anno
|
|
28
|
+
previous_decade: Decennio Precedente
|
|
29
|
+
next_decade: Decennio Successivo
|
|
30
|
+
month: Mese
|
|
31
|
+
previous_month: Mese Precedente
|
|
32
|
+
next_month: Mese Successivo
|
|
33
|
+
# “Today” button label in footer
|
|
34
|
+
today: Oggi
|
|
35
|
+
|
|
36
|
+
# Split button component
|
|
37
|
+
split_button:
|
|
38
|
+
# Wrapper aria-label, e.g. “Save Options” when primary button is “Save”
|
|
39
|
+
x_options: 'Opzioni {$name}'
|
|
40
|
+
# Dropdown toggle aria-label
|
|
41
|
+
more_options: Altre Opzioni
|
|
42
|
+
|
|
43
|
+
# Combobox component
|
|
44
|
+
combobox:
|
|
45
|
+
# Placeholder when no option is selected
|
|
46
|
+
select_an_option: Seleziona un’opzione…
|
|
47
|
+
# Filter input aria-label
|
|
48
|
+
filter_options: Filtra Opzioni
|
|
49
|
+
# Empty state message when filter has no matches
|
|
50
|
+
no_matching_options: Nessuna opzione corrispondente trovata
|
|
51
|
+
|
|
52
|
+
# Number input component
|
|
53
|
+
number_input:
|
|
54
|
+
# Spin button aria-labels for incrementing/decrementing the number value
|
|
55
|
+
increase: Aumenta
|
|
56
|
+
decrease: Diminuisci
|
|
57
|
+
|
|
58
|
+
# Password input component
|
|
59
|
+
password_input:
|
|
60
|
+
# Visibility toggle button aria-labels
|
|
61
|
+
show_password: Mostra Password
|
|
62
|
+
hide_password: Nascondi Password
|
|
63
|
+
|
|
64
|
+
# Secret input component (API keys, tokens, etc.)
|
|
65
|
+
secret_input:
|
|
66
|
+
# Visibility toggle button aria-labels
|
|
67
|
+
show_secret: Mostra Segreto
|
|
68
|
+
hide_secret: Nascondi Segreto
|
|
69
|
+
|
|
70
|
+
# Select tags component (multi-select)
|
|
71
|
+
select_tags:
|
|
72
|
+
# Listbox aria-label
|
|
73
|
+
selected_options: Opzioni Selezionate
|
|
74
|
+
# Remove button aria-label, e.g. “Remove Option 1”
|
|
75
|
+
remove_x: 'Rimuovi {$name}'
|
|
76
|
+
|
|
77
|
+
# Text editor component
|
|
78
|
+
text_editor:
|
|
79
|
+
# Toolbar aria-labels
|
|
80
|
+
text_editor: Editor di Testo
|
|
81
|
+
code_editor: Editor di Codice
|
|
82
|
+
# Block style menu button and menu aria-labels
|
|
83
|
+
text_style_options: Opzioni Stile Testo
|
|
84
|
+
show_text_style_options: Mostra Opzioni Stile Testo
|
|
85
|
+
# Block style menu items
|
|
86
|
+
paragraph: Paragrafo
|
|
87
|
+
heading_1: Titolo 1
|
|
88
|
+
heading_2: Titolo 2
|
|
89
|
+
heading_3: Titolo 3
|
|
90
|
+
heading_4: Titolo 4
|
|
91
|
+
heading_5: Titolo 5
|
|
92
|
+
heading_6: Titolo 6
|
|
93
|
+
bulleted_list: Elenco Puntato
|
|
94
|
+
numbered_list: Elenco Numerato
|
|
95
|
+
blockquote: Citazione
|
|
96
|
+
code_block: Blocco di Codice
|
|
97
|
+
# Inline style button aria-labels
|
|
98
|
+
bold: Grassetto
|
|
99
|
+
italic: Corsivo
|
|
100
|
+
strikethrough: Barrato
|
|
101
|
+
code: Codice
|
|
102
|
+
link: Link
|
|
103
|
+
# Link dialog title
|
|
104
|
+
insert_link: Inserisci Link
|
|
105
|
+
update_link: Aggiorna Link
|
|
106
|
+
# Link dialog input field labels
|
|
107
|
+
text: Testo
|
|
108
|
+
url: URL
|
|
109
|
+
# Markdown mode toggle button aria-label
|
|
110
|
+
edit_in_markdown: Modifica in Markdown
|
|
111
|
+
# Error message when rich text conversion fails
|
|
112
|
+
converter_error: Impossibile abilitare la modalità rich text. Usa l’editor di testo semplice.
|
|
113
|
+
# Language selector aria-label
|
|
114
|
+
language: Lingua
|
|
115
|
+
# Plain text mode option in language selector
|
|
116
|
+
plain_text: Testo Semplice
|
|
@@ -325,6 +325,13 @@ class Popup {
|
|
|
325
325
|
|
|
326
326
|
const topMargin = intersectionRect.top - 8;
|
|
327
327
|
const bottomMargin = rootBounds.height - intersectionRect.bottom - 8;
|
|
328
|
+
// A popup that opens beside its anchor is aligned with one of the anchor’s edges and extends
|
|
329
|
+
// across it, so its room is measured from that edge, not from the opposite one a dropdown
|
|
330
|
+
// hangs off
|
|
331
|
+
const leftMargin = intersectionRect.left - 8;
|
|
332
|
+
const rightMargin = rootBounds.width - intersectionRect.right - 8;
|
|
333
|
+
const downwardMargin = rootBounds.height - intersectionRect.top - 8;
|
|
334
|
+
const upwardMargin = intersectionRect.bottom - 8;
|
|
328
335
|
let { position } = this;
|
|
329
336
|
let height;
|
|
330
337
|
|
|
@@ -345,7 +352,6 @@ class Popup {
|
|
|
345
352
|
}
|
|
346
353
|
|
|
347
354
|
// Alter the position if the space is limited
|
|
348
|
-
// @todo Handle more overflow cases
|
|
349
355
|
if (position.startsWith('bottom-')) {
|
|
350
356
|
if (contentHeight > bottomMargin) {
|
|
351
357
|
if (topMargin > bottomMargin) {
|
|
@@ -357,6 +363,31 @@ class Popup {
|
|
|
357
363
|
}
|
|
358
364
|
}
|
|
359
365
|
|
|
366
|
+
// Only a popup that opens beside its anchor carries a `-top`/`-bottom` suffix, and it grows
|
|
367
|
+
// away from the edge it’s aligned with: down from the anchor’s top, or up from its bottom. It
|
|
368
|
+
// gets the same treatment as the dropdown above — align with the other edge when the content
|
|
369
|
+
// doesn’t fit and that edge has more room, and cap it either way, so a long submenu scrolls
|
|
370
|
+
// instead of running past the viewport
|
|
371
|
+
if (position.endsWith('-top')) {
|
|
372
|
+
if (contentHeight > downwardMargin) {
|
|
373
|
+
if (upwardMargin > downwardMargin) {
|
|
374
|
+
position = /** @type {PopupPosition} */ (position.replace('-top', '-bottom'));
|
|
375
|
+
height = upwardMargin;
|
|
376
|
+
} else {
|
|
377
|
+
height = downwardMargin;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
} else if (position.endsWith('-bottom')) {
|
|
381
|
+
if (contentHeight > upwardMargin) {
|
|
382
|
+
if (downwardMargin > upwardMargin) {
|
|
383
|
+
position = /** @type {PopupPosition} */ (position.replace('-bottom', '-top'));
|
|
384
|
+
height = downwardMargin;
|
|
385
|
+
} else {
|
|
386
|
+
height = upwardMargin;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
360
391
|
// If the popup overflows the viewport, change the position
|
|
361
392
|
if (position.endsWith('-left')) {
|
|
362
393
|
if (intersectionRect.left + contentWidth > rootBounds.width - 8) {
|
|
@@ -370,6 +401,20 @@ class Popup {
|
|
|
370
401
|
}
|
|
371
402
|
}
|
|
372
403
|
|
|
404
|
+
// The two checks above align a dropdown that opens below or above its anchor, so neither
|
|
405
|
+
// covers a popup that opens beside one — a submenu — running off the edge it opens towards.
|
|
406
|
+
// That gets the same treatment as the vertical flip above: switch to the other side, but only
|
|
407
|
+
// when it has more room, so a submenu with nowhere to go stays where the caller put it
|
|
408
|
+
if (position.startsWith('right-')) {
|
|
409
|
+
if (contentWidth > rightMargin && leftMargin > rightMargin) {
|
|
410
|
+
position = /** @type {PopupPosition} */ (position.replace('right-', 'left-'));
|
|
411
|
+
}
|
|
412
|
+
} else if (position.startsWith('left-')) {
|
|
413
|
+
if (contentWidth > leftMargin && rightMargin > leftMargin) {
|
|
414
|
+
position = /** @type {PopupPosition} */ (position.replace('left-', 'right-'));
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
373
418
|
const top = position.startsWith('bottom-')
|
|
374
419
|
? `${Math.round(intersectionRect.bottom)}px`
|
|
375
420
|
: position.endsWith('-top')
|
|
@@ -398,9 +443,15 @@ class Popup {
|
|
|
398
443
|
inset: [top, right, bottom, left].join(' '),
|
|
399
444
|
zIndex: 1000,
|
|
400
445
|
minWidth: `${Math.round(intersectionRect.width)}px`,
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
446
|
+
// A popup opening beside the anchor is capped by the room on that side, not by the width the
|
|
447
|
+
// anchor’s own edges leave, which is what the two dropdown cases below measure
|
|
448
|
+
maxWidth: position.startsWith('right-')
|
|
449
|
+
? `${Math.round(rightMargin)}px`
|
|
450
|
+
: position.startsWith('left-')
|
|
451
|
+
? `${Math.round(leftMargin)}px`
|
|
452
|
+
: position.endsWith('-left')
|
|
453
|
+
? `${Math.round(rootBounds.width - intersectionRect.left - 8)}px`
|
|
454
|
+
: `${Math.round(intersectionRect.right - 8)}px`,
|
|
404
455
|
// `undefined` removes the `max-height` the popup is given, letting it take its natural size
|
|
405
456
|
// again. `auto` would look equivalent but isn’t a valid `max-height`, so the browser would
|
|
406
457
|
// drop it and leave whatever limit was applied last in place.
|