@sveltia/ui 0.53.1 → 0.55.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.
- package/dist/components/resizable-pane/resizable-handle.svelte +12 -4
- package/dist/components/slider/slider.svelte +26 -13
- package/dist/components/tree/tree-item.svelte +243 -0
- package/dist/components/tree/tree-item.svelte.d.ts +158 -0
- package/dist/components/tree/tree.svelte +108 -0
- package/dist/components/tree/tree.svelte.d.ts +126 -0
- package/dist/components/util/app-shell.svelte +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/locales/fi.yaml +113 -0
- package/dist/locales/tr.yaml +113 -0
- package/dist/services/tree.svelte.d.ts +235 -0
- package/dist/services/tree.svelte.js +722 -0
- package/dist/styles/variables.scss +8 -0
- package/package.json +2 -2
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
export default Tree;
|
|
2
|
+
type Tree = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<KeyboardEventHandlers & MouseEventHandlers & PointerEventHandlers & FocusEventHandlers & DragEventHandlers & Props & Record<string, any>>): void;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* A tree view widget that displays a hierarchical list of items, which can be expanded, collapsed
|
|
8
|
+
* and selected.
|
|
9
|
+
* @see https://w3c.github.io/aria/#tree
|
|
10
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/treeview/
|
|
11
|
+
*/
|
|
12
|
+
declare const Tree: import("svelte").Component<import("../../typedefs").KeyboardEventHandlers & import("../../typedefs").MouseEventHandlers & import("../../typedefs").PointerEventHandlers & import("../../typedefs").FocusEventHandlers & import("../../typedefs").DragEventHandlers & {
|
|
13
|
+
/**
|
|
14
|
+
* A reference to the wrapper element.
|
|
15
|
+
*/
|
|
16
|
+
element?: HTMLElement | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* The `class` attribute on the wrapper element.
|
|
19
|
+
*/
|
|
20
|
+
class?: string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Whether to hide the widget. An alias of the `aria-hidden`
|
|
23
|
+
* attribute.
|
|
24
|
+
*/
|
|
25
|
+
hidden?: boolean | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
28
|
+
* attribute.
|
|
29
|
+
*/
|
|
30
|
+
disabled?: boolean | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to make the widget read-only. An alias of the
|
|
33
|
+
* `aria-readonly` attribute.
|
|
34
|
+
*/
|
|
35
|
+
readonly?: boolean | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to allow selecting more than one `<TreeItem>`. An alias
|
|
38
|
+
* of the `aria-multiselectable` attribute.
|
|
39
|
+
*/
|
|
40
|
+
multiple?: boolean | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Whether to select an item by clicking on it.
|
|
43
|
+
*/
|
|
44
|
+
clickToSelect?: boolean | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Whether to select an item as soon as it receives
|
|
47
|
+
* focus. Default: `true` on a single-select tree, `false` on a multi-select tree.
|
|
48
|
+
*/
|
|
49
|
+
selectionFollowsFocus?: boolean | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Whether to expand or collapse a parent item when the item
|
|
52
|
+
* itself, rather than its chevron, is clicked or activated with the Enter key.
|
|
53
|
+
*/
|
|
54
|
+
expandOnSelect?: boolean | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* The `aria-label` attribute on the wrapper element. Required
|
|
57
|
+
* unless the `aria-labelledby` attribute is provided.
|
|
58
|
+
*/
|
|
59
|
+
ariaLabel?: string | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Primary slot content.
|
|
62
|
+
*/
|
|
63
|
+
children?: Snippet<[]> | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Custom `Change` event handler.
|
|
66
|
+
*/
|
|
67
|
+
onChange?: ((event: CustomEvent) => void) | undefined;
|
|
68
|
+
} & Record<string, any>, {}, "element">;
|
|
69
|
+
type Props = {
|
|
70
|
+
/**
|
|
71
|
+
* A reference to the wrapper element.
|
|
72
|
+
*/
|
|
73
|
+
element?: HTMLElement | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* The `class` attribute on the wrapper element.
|
|
76
|
+
*/
|
|
77
|
+
class?: string | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Whether to hide the widget. An alias of the `aria-hidden`
|
|
80
|
+
* attribute.
|
|
81
|
+
*/
|
|
82
|
+
hidden?: boolean | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
85
|
+
* attribute.
|
|
86
|
+
*/
|
|
87
|
+
disabled?: boolean | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Whether to make the widget read-only. An alias of the
|
|
90
|
+
* `aria-readonly` attribute.
|
|
91
|
+
*/
|
|
92
|
+
readonly?: boolean | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* Whether to allow selecting more than one `<TreeItem>`. An alias
|
|
95
|
+
* of the `aria-multiselectable` attribute.
|
|
96
|
+
*/
|
|
97
|
+
multiple?: boolean | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Whether to select an item by clicking on it.
|
|
100
|
+
*/
|
|
101
|
+
clickToSelect?: boolean | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Whether to select an item as soon as it receives
|
|
104
|
+
* focus. Default: `true` on a single-select tree, `false` on a multi-select tree.
|
|
105
|
+
*/
|
|
106
|
+
selectionFollowsFocus?: boolean | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Whether to expand or collapse a parent item when the item
|
|
109
|
+
* itself, rather than its chevron, is clicked or activated with the Enter key.
|
|
110
|
+
*/
|
|
111
|
+
expandOnSelect?: boolean | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* The `aria-label` attribute on the wrapper element. Required
|
|
114
|
+
* unless the `aria-labelledby` attribute is provided.
|
|
115
|
+
*/
|
|
116
|
+
ariaLabel?: string | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* Primary slot content.
|
|
119
|
+
*/
|
|
120
|
+
children?: Snippet<[]> | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* Custom `Change` event handler.
|
|
123
|
+
*/
|
|
124
|
+
onChange?: ((event: CustomEvent) => void) | undefined;
|
|
125
|
+
};
|
|
126
|
+
import type { Snippet } from 'svelte';
|
|
@@ -250,6 +250,13 @@
|
|
|
250
250
|
--sui-listbox-border-color: var(--sui-control-border-color);
|
|
251
251
|
--sui-listbox-foreground-color: var(--sui-control-foreground-color);
|
|
252
252
|
--sui-listbox-background-color: hsl(var(--sui-background-color-1-hsl));
|
|
253
|
+
--sui-tree-border-radius: var(--sui-control-medium-border-radius);
|
|
254
|
+
--sui-tree-border-color: var(--sui-control-border-color);
|
|
255
|
+
--sui-tree-foreground-color: var(--sui-control-foreground-color);
|
|
256
|
+
--sui-tree-background-color: hsl(var(--sui-background-color-1-hsl));
|
|
257
|
+
--sui-tree-item-border-radius: var(--sui-control-medium-border-radius);
|
|
258
|
+
--sui-tree-item-height: var(--sui-control-medium-height);
|
|
259
|
+
--sui-tree-item-indent: 16px;
|
|
253
260
|
--sui-textbox-border-radius: var(--sui-control-medium-border-radius);
|
|
254
261
|
--sui-textbox-height: var(--sui-control-medium-height);
|
|
255
262
|
--sui-textbox-border-color: var(--sui-control-border-color);
|
package/dist/index.d.ts
CHANGED
|
@@ -72,6 +72,8 @@ export { default as TextArea } from "./components/text-field/text-area.svelte";
|
|
|
72
72
|
export { default as TextInput } from "./components/text-field/text-input.svelte";
|
|
73
73
|
export { default as Toast } from "./components/toast/toast.svelte";
|
|
74
74
|
export { default as Toolbar } from "./components/toolbar/toolbar.svelte";
|
|
75
|
+
export { default as TreeItem } from "./components/tree/tree-item.svelte";
|
|
76
|
+
export { default as Tree } from "./components/tree/tree.svelte";
|
|
75
77
|
export { default as TruncatedText } from "./components/typography/truncated-text.svelte";
|
|
76
78
|
export { default as AppShell } from "./components/util/app-shell.svelte";
|
|
77
79
|
export { default as EmptyState } from "./components/util/empty-state.svelte";
|
package/dist/index.js
CHANGED
|
@@ -72,6 +72,8 @@ export { default as TextArea } from './components/text-field/text-area.svelte';
|
|
|
72
72
|
export { default as TextInput } from './components/text-field/text-input.svelte';
|
|
73
73
|
export { default as Toast } from './components/toast/toast.svelte';
|
|
74
74
|
export { default as Toolbar } from './components/toolbar/toolbar.svelte';
|
|
75
|
+
export { default as TreeItem } from './components/tree/tree-item.svelte';
|
|
76
|
+
export { default as Tree } from './components/tree/tree.svelte';
|
|
75
77
|
export { default as TruncatedText } from './components/typography/truncated-text.svelte';
|
|
76
78
|
export { default as AppShell } from './components/util/app-shell.svelte';
|
|
77
79
|
export { default as EmptyState } from './components/util/empty-state.svelte';
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Dialog action button labels
|
|
2
|
+
ok: OK
|
|
3
|
+
cancel: Peruuta
|
|
4
|
+
close: Sulje
|
|
5
|
+
|
|
6
|
+
# Button to clear content, e.g. search input or calendar date
|
|
7
|
+
clear: Tyhjennä
|
|
8
|
+
|
|
9
|
+
# Text editor dialog buttons for link/image insertion
|
|
10
|
+
insert: Lisää
|
|
11
|
+
update: Päivitä
|
|
12
|
+
remove: Poista
|
|
13
|
+
|
|
14
|
+
# Combobox dropdown toggle button aria-labels
|
|
15
|
+
collapse: Piilota
|
|
16
|
+
expand: Näytä
|
|
17
|
+
|
|
18
|
+
# Infobar/toast dismiss button label
|
|
19
|
+
dismiss: Hylkää
|
|
20
|
+
|
|
21
|
+
# Calendar component
|
|
22
|
+
calendar:
|
|
23
|
+
# View switcher group aria-labels and navigation button aria-labels
|
|
24
|
+
year: Vuosi
|
|
25
|
+
previous_decade: Edellinen vuosikymmen
|
|
26
|
+
next_decade: Seuraava vuosikymmen
|
|
27
|
+
month: Kuukausi
|
|
28
|
+
previous_month: Edellinen kuukausi
|
|
29
|
+
next_month: Seuraava kuukausi
|
|
30
|
+
# “Today” button label in footer
|
|
31
|
+
today: Tänään
|
|
32
|
+
|
|
33
|
+
# Split button component
|
|
34
|
+
split_button:
|
|
35
|
+
# Wrapper aria-label, e.g. “Save Options” when primary button is “Save”
|
|
36
|
+
x_options: '{$name}-valinnat'
|
|
37
|
+
# Dropdown toggle aria-label
|
|
38
|
+
more_options: Lisävalinnat
|
|
39
|
+
|
|
40
|
+
# Combobox component
|
|
41
|
+
combobox:
|
|
42
|
+
# Placeholder when no option is selected
|
|
43
|
+
select_an_option: Valitse vaihtoehto…
|
|
44
|
+
# Filter input aria-label
|
|
45
|
+
filter_options: Suodata vaihtoehtoja
|
|
46
|
+
# Empty state message when filter has no matches
|
|
47
|
+
no_matching_options: Vastaavia vaihtoehtoja ei löytynyt
|
|
48
|
+
|
|
49
|
+
# Number input component
|
|
50
|
+
number_input:
|
|
51
|
+
# Spin button aria-labels for incrementing/decrementing the number value
|
|
52
|
+
increase: Lisää
|
|
53
|
+
decrease: Vähennä
|
|
54
|
+
|
|
55
|
+
# Password input component
|
|
56
|
+
password_input:
|
|
57
|
+
# Visibility toggle button aria-labels
|
|
58
|
+
show_password: Näytä salasana
|
|
59
|
+
hide_password: Piilota salasana
|
|
60
|
+
|
|
61
|
+
# Secret input component (API keys, tokens, etc.)
|
|
62
|
+
secret_input:
|
|
63
|
+
# Visibility toggle button aria-labels
|
|
64
|
+
show_secret: Näytä salaisuus
|
|
65
|
+
hide_secret: Piilota salaisuus
|
|
66
|
+
|
|
67
|
+
# Select tags component (multi-select)
|
|
68
|
+
select_tags:
|
|
69
|
+
# Listbox aria-label
|
|
70
|
+
selected_options: Valitut vaihtoehdot
|
|
71
|
+
# Remove button aria-label, e.g. “Remove Option 1”
|
|
72
|
+
remove_x: 'Poista {$name}'
|
|
73
|
+
|
|
74
|
+
# Text editor component
|
|
75
|
+
text_editor:
|
|
76
|
+
# Toolbar aria-labels
|
|
77
|
+
text_editor: Tekstieditori
|
|
78
|
+
code_editor: Koodieditori
|
|
79
|
+
# Block style menu button and menu aria-labels
|
|
80
|
+
text_style_options: Tekstimuotoilun valinnat
|
|
81
|
+
show_text_style_options: Näytä tekstimuotoilun valinnat
|
|
82
|
+
# Block style menu items
|
|
83
|
+
paragraph: Kappale
|
|
84
|
+
heading_1: Otsikko 1
|
|
85
|
+
heading_2: Otsikko 2
|
|
86
|
+
heading_3: Otsikko 3
|
|
87
|
+
heading_4: Otsikko 4
|
|
88
|
+
heading_5: Otsikko 5
|
|
89
|
+
heading_6: Otsikko 6
|
|
90
|
+
bulleted_list: Luettelomerkitty luettelo
|
|
91
|
+
numbered_list: Numeroitu luettelo
|
|
92
|
+
blockquote: Lainaus
|
|
93
|
+
code_block: Koodilohko
|
|
94
|
+
# Inline style button aria-labels
|
|
95
|
+
bold: Lihavointi
|
|
96
|
+
italic: Kursivointi
|
|
97
|
+
strikethrough: Yliviivaus
|
|
98
|
+
code: Koodi
|
|
99
|
+
link: Linkki
|
|
100
|
+
# Link dialog title
|
|
101
|
+
insert_link: Lisää linkki
|
|
102
|
+
update_link: Päivitä linkki
|
|
103
|
+
# Link dialog input field labels
|
|
104
|
+
text: Teksti
|
|
105
|
+
url: URL-osoite
|
|
106
|
+
# Markdown mode toggle button aria-label
|
|
107
|
+
edit_in_markdown: Muokkaa Markdown-muodossa
|
|
108
|
+
# Error message when rich text conversion fails
|
|
109
|
+
converter_error: Rikastettua tekstimuotoa ei voi ottaa käyttöön. Käytä sen sijaan muotoilemattoman tekstin editoria.
|
|
110
|
+
# Language selector aria-label
|
|
111
|
+
language: Kieli
|
|
112
|
+
# Plain text mode option in language selector
|
|
113
|
+
plain_text: Muotoilematon teksti
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Dialog action button labels
|
|
2
|
+
ok: Tamam
|
|
3
|
+
cancel: İptal
|
|
4
|
+
close: Kapat
|
|
5
|
+
|
|
6
|
+
# Button to clear content, e.g. search input or calendar date
|
|
7
|
+
clear: Temizle
|
|
8
|
+
|
|
9
|
+
# Text editor dialog buttons for link/image insertion
|
|
10
|
+
insert: Ekle
|
|
11
|
+
update: Güncelle
|
|
12
|
+
remove: Kaldır
|
|
13
|
+
|
|
14
|
+
# Combobox dropdown toggle button aria-labels
|
|
15
|
+
collapse: Daralt
|
|
16
|
+
expand: Genişlet
|
|
17
|
+
|
|
18
|
+
# Infobar/toast dismiss button label
|
|
19
|
+
dismiss: Kapat
|
|
20
|
+
|
|
21
|
+
# Calendar component
|
|
22
|
+
calendar:
|
|
23
|
+
# View switcher group aria-labels and navigation button aria-labels
|
|
24
|
+
year: Yıl
|
|
25
|
+
previous_decade: Önceki On Yıl
|
|
26
|
+
next_decade: Sonraki On Yıl
|
|
27
|
+
month: Ay
|
|
28
|
+
previous_month: Önceki Ay
|
|
29
|
+
next_month: Sonraki Ay
|
|
30
|
+
# “Today” button label in footer
|
|
31
|
+
today: Bugün
|
|
32
|
+
|
|
33
|
+
# Split button component
|
|
34
|
+
split_button:
|
|
35
|
+
# Wrapper aria-label, e.g. “Save Options” when primary button is “Save”
|
|
36
|
+
x_options: '{$name} Seçenekleri'
|
|
37
|
+
# Dropdown toggle aria-label
|
|
38
|
+
more_options: Diğer Seçenekler
|
|
39
|
+
|
|
40
|
+
# Combobox component
|
|
41
|
+
combobox:
|
|
42
|
+
# Placeholder when no option is selected
|
|
43
|
+
select_an_option: Bir seçenek seçin…
|
|
44
|
+
# Filter input aria-label
|
|
45
|
+
filter_options: Seçenekleri Filtrele
|
|
46
|
+
# Empty state message when filter has no matches
|
|
47
|
+
no_matching_options: Eşleşen seçenek bulunamadı
|
|
48
|
+
|
|
49
|
+
# Number input component
|
|
50
|
+
number_input:
|
|
51
|
+
# Spin button aria-labels for incrementing/decrementing the number value
|
|
52
|
+
increase: Artır
|
|
53
|
+
decrease: Azalt
|
|
54
|
+
|
|
55
|
+
# Password input component
|
|
56
|
+
password_input:
|
|
57
|
+
# Visibility toggle button aria-labels
|
|
58
|
+
show_password: Şifreyi Göster
|
|
59
|
+
hide_password: Şifreyi Gizle
|
|
60
|
+
|
|
61
|
+
# Secret input component (API keys, tokens, etc.)
|
|
62
|
+
secret_input:
|
|
63
|
+
# Visibility toggle button aria-labels
|
|
64
|
+
show_secret: Gizli Bilgiyi Göster
|
|
65
|
+
hide_secret: Gizli Bilgiyi Gizle
|
|
66
|
+
|
|
67
|
+
# Select tags component (multi-select)
|
|
68
|
+
select_tags:
|
|
69
|
+
# Listbox aria-label
|
|
70
|
+
selected_options: Seçilen Seçenekler
|
|
71
|
+
# Remove button aria-label, e.g. “Remove Option 1”
|
|
72
|
+
remove_x: '{$name} Öğesini Kaldır'
|
|
73
|
+
|
|
74
|
+
# Text editor component
|
|
75
|
+
text_editor:
|
|
76
|
+
# Toolbar aria-labels
|
|
77
|
+
text_editor: Metin Düzenleyici
|
|
78
|
+
code_editor: Kod Düzenleyici
|
|
79
|
+
# Block style menu button and menu aria-labels
|
|
80
|
+
text_style_options: Metin Stili Seçenekleri
|
|
81
|
+
show_text_style_options: Metin Stili Seçeneklerini Göster
|
|
82
|
+
# Block style menu items
|
|
83
|
+
paragraph: Paragraf
|
|
84
|
+
heading_1: Başlık 1
|
|
85
|
+
heading_2: Başlık 2
|
|
86
|
+
heading_3: Başlık 3
|
|
87
|
+
heading_4: Başlık 4
|
|
88
|
+
heading_5: Başlık 5
|
|
89
|
+
heading_6: Başlık 6
|
|
90
|
+
bulleted_list: Madde İşaretli Liste
|
|
91
|
+
numbered_list: Numaralı Liste
|
|
92
|
+
blockquote: Alıntı
|
|
93
|
+
code_block: Kod Bloğu
|
|
94
|
+
# Inline style button aria-labels
|
|
95
|
+
bold: Kalın
|
|
96
|
+
italic: İtalik
|
|
97
|
+
strikethrough: Üstü Çizili
|
|
98
|
+
code: Kod
|
|
99
|
+
link: Bağlantı
|
|
100
|
+
# Link dialog title
|
|
101
|
+
insert_link: Bağlantı Ekle
|
|
102
|
+
update_link: Bağlantıyı Güncelle
|
|
103
|
+
# Link dialog input field labels
|
|
104
|
+
text: Metin
|
|
105
|
+
url: URL
|
|
106
|
+
# Markdown mode toggle button aria-label
|
|
107
|
+
edit_in_markdown: Markdown ile Düzenle
|
|
108
|
+
# Error message when rich text conversion fails
|
|
109
|
+
converter_error: Zengin metin modu etkinleştirilemedi. Lütfen düz metin düzenleyicisini kullanın.
|
|
110
|
+
# Language selector aria-label
|
|
111
|
+
language: Dil
|
|
112
|
+
# Plain text mode option in language selector
|
|
113
|
+
plain_text: Düz Metin
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implement keyboard and mouse interactions for the `tree` composite widget, following the ARIA
|
|
3
|
+
* Tree View pattern. Unlike the other composite widgets handled by the `Group` class, a tree
|
|
4
|
+
* manages the focus (roving `tabindex`) and the selection separately, and it also supports
|
|
5
|
+
* expanding and collapsing parent nodes.
|
|
6
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/treeview/
|
|
7
|
+
*/
|
|
8
|
+
export class Tree {
|
|
9
|
+
/**
|
|
10
|
+
* Initialize a new `Tree` instance.
|
|
11
|
+
* @param {HTMLElement} parent Parent element.
|
|
12
|
+
* @param {object} [options] Options.
|
|
13
|
+
* @param {boolean} [options.clickToSelect] Whether to select an item by clicking on it.
|
|
14
|
+
* @param {boolean} [options.selectionFollowsFocus] Whether to select an item as soon as it
|
|
15
|
+
* receives focus. Default: `true` on a single-select tree, `false` on a multi-select tree.
|
|
16
|
+
* @param {boolean} [options.expandOnSelect] Whether to expand or collapse a parent item when the
|
|
17
|
+
* item itself, rather than its chevron, is clicked or activated.
|
|
18
|
+
*/
|
|
19
|
+
constructor(parent: HTMLElement, { clickToSelect, selectionFollowsFocus, expandOnSelect }?: {
|
|
20
|
+
clickToSelect?: boolean | undefined;
|
|
21
|
+
selectionFollowsFocus?: boolean | undefined;
|
|
22
|
+
expandOnSelect?: boolean | undefined;
|
|
23
|
+
} | undefined);
|
|
24
|
+
parent: HTMLElement;
|
|
25
|
+
id: string;
|
|
26
|
+
clickToSelect: boolean;
|
|
27
|
+
expandOnSelect: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the selection follows the focus. `undefined` means auto detect.
|
|
30
|
+
* @type {boolean | undefined}
|
|
31
|
+
*/
|
|
32
|
+
selectionFollowsFocusOption: boolean | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Item used as the starting point of a range selection.
|
|
35
|
+
* @type {HTMLElement | undefined}
|
|
36
|
+
*/
|
|
37
|
+
anchor: HTMLElement | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Currently accumulated type-ahead search terms.
|
|
40
|
+
* @type {string}
|
|
41
|
+
*/
|
|
42
|
+
typeAheadTerms: string;
|
|
43
|
+
/**
|
|
44
|
+
* Timer used to reset the type-ahead search terms.
|
|
45
|
+
* @type {ReturnType<typeof globalThis.setTimeout> | undefined}
|
|
46
|
+
*/
|
|
47
|
+
typeAheadTimer: ReturnType<typeof globalThis.setTimeout> | undefined;
|
|
48
|
+
/** @type {(event: MouseEvent) => void} */
|
|
49
|
+
_onClick: (event: MouseEvent) => void;
|
|
50
|
+
/** @type {(event: KeyboardEvent) => void} */
|
|
51
|
+
_onKeyDown: (event: KeyboardEvent) => void;
|
|
52
|
+
/** @type {(event: FocusEvent) => void} */
|
|
53
|
+
_onFocusIn: (event: FocusEvent) => void;
|
|
54
|
+
observer: MutationObserver;
|
|
55
|
+
/**
|
|
56
|
+
* Activate the items.
|
|
57
|
+
*/
|
|
58
|
+
activate(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Whether more than one item can be selected.
|
|
61
|
+
* @type {boolean}
|
|
62
|
+
*/
|
|
63
|
+
get multi(): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Whether an item is selected as soon as it receives focus.
|
|
66
|
+
* @type {boolean}
|
|
67
|
+
*/
|
|
68
|
+
get selectionFollowsFocus(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Whether the widget is disabled.
|
|
71
|
+
* @type {boolean}
|
|
72
|
+
*/
|
|
73
|
+
get isDisabled(): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Whether the widget is read-only.
|
|
76
|
+
* @type {boolean}
|
|
77
|
+
*/
|
|
78
|
+
get isReadOnly(): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* List of all the items, including the ones within a collapsed parent, in document order.
|
|
81
|
+
* @type {HTMLElement[]}
|
|
82
|
+
*/
|
|
83
|
+
get allItems(): HTMLElement[];
|
|
84
|
+
/**
|
|
85
|
+
* List of the items that are not hidden, either explicitly or by a collapsed ancestor.
|
|
86
|
+
* @type {HTMLElement[]}
|
|
87
|
+
*/
|
|
88
|
+
get visibleItems(): HTMLElement[];
|
|
89
|
+
/**
|
|
90
|
+
* List of the items that can receive focus.
|
|
91
|
+
* @type {HTMLElement[]}
|
|
92
|
+
*/
|
|
93
|
+
get activeItems(): HTMLElement[];
|
|
94
|
+
/**
|
|
95
|
+
* List of the selected items.
|
|
96
|
+
* @type {HTMLElement[]}
|
|
97
|
+
*/
|
|
98
|
+
get selectedItems(): HTMLElement[];
|
|
99
|
+
/**
|
|
100
|
+
* Item that is currently in the tab order, which is the item that has or last had focus.
|
|
101
|
+
* @type {HTMLElement | undefined}
|
|
102
|
+
*/
|
|
103
|
+
get currentItem(): HTMLElement | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Get the group element that contains the child items of the given item.
|
|
106
|
+
* @param {HTMLElement} item Parent item.
|
|
107
|
+
* @returns {HTMLElement | undefined} Group element, if the item has one.
|
|
108
|
+
*/
|
|
109
|
+
getGroup(item: HTMLElement): HTMLElement | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Get the child items of the given item.
|
|
112
|
+
* @param {HTMLElement} item Parent item.
|
|
113
|
+
* @returns {HTMLElement[]} Child items. Empty if the item is a leaf node.
|
|
114
|
+
*/
|
|
115
|
+
getChildItems(item: HTMLElement): HTMLElement[];
|
|
116
|
+
/**
|
|
117
|
+
* Get the items directly owned by the given group, ignoring any deeper descendants.
|
|
118
|
+
* @param {HTMLElement} group Group element or the widget root.
|
|
119
|
+
* @returns {HTMLElement[]} Child items.
|
|
120
|
+
*/
|
|
121
|
+
getItemsInGroup(group: HTMLElement): HTMLElement[];
|
|
122
|
+
/**
|
|
123
|
+
* Get the parent item of the given item.
|
|
124
|
+
* @param {HTMLElement} item Item.
|
|
125
|
+
* @returns {HTMLElement | undefined} Parent item, if the item is not at the root level.
|
|
126
|
+
*/
|
|
127
|
+
getParentItem(item: HTMLElement): HTMLElement | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* Whether the given item is a parent node that can be expanded and collapsed.
|
|
130
|
+
* @param {HTMLElement} item Item.
|
|
131
|
+
* @returns {boolean} Result.
|
|
132
|
+
*/
|
|
133
|
+
isParent(item: HTMLElement): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Whether the given parent item is expanded.
|
|
136
|
+
* @param {HTMLElement} item Item.
|
|
137
|
+
* @returns {boolean} Result.
|
|
138
|
+
*/
|
|
139
|
+
isExpanded(item: HTMLElement): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Whether any of the ancestors of the given item is collapsed, meaning the item is not displayed.
|
|
142
|
+
* @param {HTMLElement} item Item.
|
|
143
|
+
* @returns {boolean} Result.
|
|
144
|
+
*/
|
|
145
|
+
hasCollapsedAncestor(item: HTMLElement): boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Get the text label of the given item, which is used for the type-ahead search.
|
|
148
|
+
* @param {HTMLElement} item Item.
|
|
149
|
+
* @returns {string} Label.
|
|
150
|
+
*/
|
|
151
|
+
getLabel(item: HTMLElement): string;
|
|
152
|
+
/**
|
|
153
|
+
* Assign the element IDs, positional attributes and roving `tabindex` to the items. Called
|
|
154
|
+
* whenever the items are added or removed.
|
|
155
|
+
*/
|
|
156
|
+
update(): void;
|
|
157
|
+
/**
|
|
158
|
+
* Scroll the given element into view if needed.
|
|
159
|
+
* @param {HTMLElement} element Element to be scrolled into view.
|
|
160
|
+
*/
|
|
161
|
+
scrollIntoView(element: HTMLElement): void;
|
|
162
|
+
/**
|
|
163
|
+
* Move focus to the given item.
|
|
164
|
+
* @param {HTMLElement} item Item to be focused.
|
|
165
|
+
* @param {object} [options] Options.
|
|
166
|
+
* @param {boolean} [options.select] Whether to also select the item. Default: depends on the
|
|
167
|
+
* `selectionFollowsFocus` option.
|
|
168
|
+
*/
|
|
169
|
+
focusItem(item: HTMLElement, { select }?: {
|
|
170
|
+
select?: boolean | undefined;
|
|
171
|
+
} | undefined): void;
|
|
172
|
+
/**
|
|
173
|
+
* Update the selection state of the given item, and notify the change if needed.
|
|
174
|
+
* @param {HTMLElement} item Item.
|
|
175
|
+
* @param {boolean} selected Whether to select the item.
|
|
176
|
+
*/
|
|
177
|
+
setSelected(item: HTMLElement, selected: boolean): void;
|
|
178
|
+
/**
|
|
179
|
+
* Select the given item.
|
|
180
|
+
* @param {HTMLElement} item Item to be selected.
|
|
181
|
+
* @param {object} [options] Options.
|
|
182
|
+
* @param {boolean} [options.additive] Whether to toggle the item without deselecting the other
|
|
183
|
+
* items. Multi-select only.
|
|
184
|
+
* @param {boolean} [options.range] Whether to select all the items between the anchor and the
|
|
185
|
+
* given item. Multi-select only.
|
|
186
|
+
*/
|
|
187
|
+
selectItem(item: HTMLElement, { additive, range }?: {
|
|
188
|
+
additive?: boolean | undefined;
|
|
189
|
+
range?: boolean | undefined;
|
|
190
|
+
} | undefined): void;
|
|
191
|
+
/**
|
|
192
|
+
* Select all the items that are currently displayed. Multi-select only.
|
|
193
|
+
* @param {HTMLElement} item Item that triggered the action.
|
|
194
|
+
*/
|
|
195
|
+
selectAll(item: HTMLElement): void;
|
|
196
|
+
/**
|
|
197
|
+
* Expand or collapse the given parent item.
|
|
198
|
+
* @param {HTMLElement} item Item to be expanded or collapsed.
|
|
199
|
+
* @param {boolean} expanded Whether to expand the item.
|
|
200
|
+
*/
|
|
201
|
+
expandItem(item: HTMLElement, expanded: boolean): void;
|
|
202
|
+
/**
|
|
203
|
+
* Expand all the sibling parent items at the same level as the given item.
|
|
204
|
+
* @param {HTMLElement} item Item.
|
|
205
|
+
*/
|
|
206
|
+
expandSiblings(item: HTMLElement): void;
|
|
207
|
+
/**
|
|
208
|
+
* Move focus to the next item that matches the accumulated type-ahead search terms.
|
|
209
|
+
* @param {string} char Typed character.
|
|
210
|
+
* @param {HTMLElement} currentItem Currently focused item.
|
|
211
|
+
*/
|
|
212
|
+
typeAhead(char: string, currentItem: HTMLElement): void;
|
|
213
|
+
/**
|
|
214
|
+
* Handle the `focusin` event on the widget. Make the newly focused item the only one in the tab
|
|
215
|
+
* order, so that Shift+Tab and Tab move focus out of the widget.
|
|
216
|
+
* @param {FocusEvent} event `focusin` event.
|
|
217
|
+
*/
|
|
218
|
+
onFocusIn(event: FocusEvent): void;
|
|
219
|
+
/**
|
|
220
|
+
* Handle the `click` event on the widget.
|
|
221
|
+
* @param {MouseEvent} event `click` event.
|
|
222
|
+
*/
|
|
223
|
+
onClick(event: MouseEvent): void;
|
|
224
|
+
/**
|
|
225
|
+
* Handle the `keydown` event on the widget.
|
|
226
|
+
* @param {KeyboardEvent} event `keydown` event.
|
|
227
|
+
*/
|
|
228
|
+
onKeyDown(event: KeyboardEvent): void;
|
|
229
|
+
/**
|
|
230
|
+
* Clean up event listeners.
|
|
231
|
+
*/
|
|
232
|
+
destroy(): void;
|
|
233
|
+
}
|
|
234
|
+
export function activateTree(params?: object | undefined): Attachment;
|
|
235
|
+
import type { Attachment } from 'svelte/attachments';
|