@sveltia/ui 0.91.0 → 0.92.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/bottom-navigation/bottom-navigation.svelte +3 -9
- package/dist/components/bottom-navigation/bottom-navigation.svelte.d.ts +4 -39
- package/dist/components/button/button-group.svelte +2 -4
- package/dist/components/button/button-group.svelte.d.ts +3 -19
- package/dist/components/button/select-button-group.svelte +2 -13
- package/dist/components/button/select-button-group.svelte.d.ts +5 -67
- package/dist/components/calendar/calendar.d.ts +9 -0
- package/dist/components/calendar/calendar.js +43 -0
- package/dist/components/calendar/calendar.svelte +26 -27
- package/dist/components/checkbox/checkbox-group.svelte +2 -8
- package/dist/components/checkbox/checkbox-group.svelte.d.ts +4 -39
- package/dist/components/dialog/alert-dialog.svelte.d.ts +2 -3
- package/dist/components/dialog/confirmation-dialog.svelte.d.ts +2 -3
- package/dist/components/dialog/dialog.svelte +6 -7
- package/dist/components/dialog/dialog.svelte.d.ts +2 -3
- package/dist/components/dialog/prompt-dialog.svelte +2 -2
- package/dist/components/dialog/prompt-dialog.svelte.d.ts +2 -3
- package/dist/components/disclosure/disclosure.svelte +14 -16
- package/dist/components/disclosure/disclosure.svelte.d.ts +4 -38
- package/dist/components/drawer/drawer.svelte +22 -39
- package/dist/components/drawer/drawer.svelte.d.ts +3 -24
- package/dist/components/grid/grid-body.svelte +2 -3
- package/dist/components/grid/grid-body.svelte.d.ts +3 -18
- package/dist/components/grid/grid-cell.svelte +2 -8
- package/dist/components/grid/grid-cell.svelte.d.ts +3 -22
- package/dist/components/grid/grid-col-header.svelte +2 -4
- package/dist/components/grid/grid-col-header.svelte.d.ts +3 -19
- package/dist/components/grid/grid-foot.svelte +4 -9
- package/dist/components/grid/grid-foot.svelte.d.ts +3 -22
- package/dist/components/grid/grid-head.svelte +4 -9
- package/dist/components/grid/grid-head.svelte.d.ts +3 -22
- package/dist/components/grid/grid-row-header.svelte +2 -8
- package/dist/components/grid/grid-row-header.svelte.d.ts +3 -22
- package/dist/components/grid/grid-row.svelte +4 -5
- package/dist/components/grid/grid-row.svelte.d.ts +3 -19
- package/dist/components/grid/grid.d.ts +10 -0
- package/dist/components/grid/grid.js +11 -0
- package/dist/components/grid/grid.svelte +6 -7
- package/dist/components/grid/grid.svelte.d.ts +5 -21
- package/dist/components/listbox/listbox.svelte +34 -15
- package/dist/components/listbox/listbox.svelte.d.ts +5 -69
- package/dist/components/listbox/option-group.svelte +2 -8
- package/dist/components/listbox/option-group.svelte.d.ts +4 -39
- package/dist/components/listbox/option.svelte +2 -1
- package/dist/components/menu/menu-item-group.svelte +2 -6
- package/dist/components/menu/menu-item-group.svelte.d.ts +3 -22
- package/dist/components/menu/menu-item.svelte +5 -1
- package/dist/components/menu/menu.svelte +2 -8
- package/dist/components/menu/menu.svelte.d.ts +4 -39
- package/dist/components/radio/radio-group.svelte +2 -17
- package/dist/components/radio/radio-group.svelte.d.ts +5 -67
- package/dist/components/radio/radio.svelte +19 -22
- package/dist/components/radio/radio.svelte.d.ts +10 -40
- package/dist/components/resizable-pane/resizable-handle.svelte +42 -49
- package/dist/components/resizable-pane/resizable-pane-group.svelte +44 -58
- package/dist/components/resizable-pane/resizable-pane-group.svelte.d.ts +3 -19
- package/dist/components/resizable-pane/resizable-pane.svelte +2 -5
- package/dist/components/resizable-pane/resizable-pane.svelte.d.ts +3 -19
- package/dist/components/resizable-pane/sizing.d.ts +24 -0
- package/dist/components/resizable-pane/sizing.js +83 -0
- package/dist/components/select/combobox.svelte +35 -39
- package/dist/components/select/select-tags.svelte +3 -13
- package/dist/components/select/select-tags.svelte.d.ts +5 -67
- package/dist/components/slider/slider.d.ts +5 -4
- package/dist/components/slider/slider.js +28 -23
- package/dist/components/slider/slider.svelte +64 -62
- package/dist/components/slider/slider.svelte.d.ts +4 -37
- package/dist/components/switch/switch.svelte +2 -13
- package/dist/components/switch/switch.svelte.d.ts +5 -67
- package/dist/components/table/table-body.svelte +2 -4
- package/dist/components/table/table-body.svelte.d.ts +3 -19
- package/dist/components/table/table-cell.svelte +2 -8
- package/dist/components/table/table-cell.svelte.d.ts +3 -22
- package/dist/components/table/table-col-header.svelte +2 -8
- package/dist/components/table/table-col-header.svelte.d.ts +3 -22
- package/dist/components/table/table-foot.svelte +2 -8
- package/dist/components/table/table-foot.svelte.d.ts +3 -22
- package/dist/components/table/table-head.svelte +2 -8
- package/dist/components/table/table-head.svelte.d.ts +3 -22
- package/dist/components/table/table-part.svelte +2 -4
- package/dist/components/table/table-part.svelte.d.ts +3 -19
- package/dist/components/table/table-row-header.svelte +2 -8
- package/dist/components/table/table-row-header.svelte.d.ts +3 -22
- package/dist/components/table/table-row.svelte +2 -8
- package/dist/components/table/table-row.svelte.d.ts +3 -22
- package/dist/components/table/table.svelte +2 -4
- package/dist/components/table/table.svelte.d.ts +3 -19
- package/dist/components/tabs/tab-box.svelte +2 -4
- package/dist/components/tabs/tab-box.svelte.d.ts +3 -19
- package/dist/components/tabs/tab-list.svelte +2 -7
- package/dist/components/tabs/tab-list.svelte.d.ts +4 -37
- package/dist/components/tabs/tab-panel.svelte +2 -8
- package/dist/components/tabs/tab-panel.svelte.d.ts +3 -22
- package/dist/components/tabs/tab-panels.svelte +2 -8
- package/dist/components/tabs/tab-panels.svelte.d.ts +3 -22
- package/dist/components/text-editor/code-editor.js +14 -7
- package/dist/components/text-editor/code-editor.svelte +14 -22
- package/dist/components/text-editor/code-editor.svelte.d.ts +5 -103
- package/dist/components/text-editor/config.d.ts +73 -0
- package/dist/components/text-editor/config.js +110 -0
- package/dist/components/text-editor/conversion/editor-components.js +4 -4
- package/dist/components/text-editor/conversion/html/export.js +1 -1
- package/dist/components/text-editor/conversion/import.js +32 -26
- package/dist/components/text-editor/conversion/markdown/block-conversion.d.ts +4 -0
- package/dist/components/text-editor/conversion/markdown/block-conversion.js +154 -0
- package/dist/components/text-editor/conversion/markdown/block-structure.d.ts +16 -0
- package/dist/components/text-editor/conversion/markdown/block-structure.js +254 -0
- package/dist/components/text-editor/conversion/markdown/code-blocks.d.ts +57 -0
- package/dist/components/text-editor/conversion/markdown/code-blocks.js +279 -0
- package/dist/components/text-editor/conversion/markdown/code-spans.d.ts +19 -0
- package/dist/components/text-editor/conversion/markdown/code-spans.js +71 -0
- package/dist/components/text-editor/conversion/markdown/formatting.d.ts +22 -0
- package/dist/components/text-editor/conversion/markdown/formatting.js +451 -0
- package/dist/components/text-editor/conversion/markdown/index.d.ts +10 -0
- package/dist/components/text-editor/conversion/markdown/index.js +55 -0
- package/dist/components/text-editor/conversion/markdown/placeholders.d.ts +2 -0
- package/dist/components/text-editor/conversion/markdown/placeholders.js +229 -0
- package/dist/components/text-editor/conversion/markdown/syntax.d.ts +99 -0
- package/dist/components/text-editor/conversion/markdown/syntax.js +206 -0
- package/dist/components/text-editor/conversion/placeholder-chars.d.ts +43 -0
- package/dist/components/text-editor/conversion/placeholder-chars.js +51 -0
- package/dist/components/text-editor/conversion/transformers/block-escape.d.ts +1 -0
- package/dist/components/text-editor/conversion/transformers/block-escape.js +53 -26
- package/dist/components/text-editor/conversion/transformers/code.d.ts +3 -14
- package/dist/components/text-editor/conversion/transformers/code.js +78 -16
- package/dist/components/text-editor/conversion/transformers/formatted-code.js +3 -18
- package/dist/components/text-editor/conversion/transformers/inline-code.js +3 -1
- package/dist/components/text-editor/conversion/transformers/link.js +3 -1
- package/dist/components/text-editor/conversion/transformers/raw-syntax.d.ts +0 -19
- package/dist/components/text-editor/conversion/transformers/raw-syntax.js +22 -93
- package/dist/components/text-editor/conversion/transformers/table.js +57 -16
- package/dist/components/text-editor/conversion/update.d.ts +19 -2
- package/dist/components/text-editor/conversion/update.js +63 -39
- package/dist/components/text-editor/core.d.ts +12 -51
- package/dist/components/text-editor/core.js +44 -66
- package/dist/components/text-editor/editing/raw-markdown.d.ts +3 -0
- package/dist/components/text-editor/editing/raw-markdown.js +46 -2
- package/dist/components/text-editor/lexical-root.svelte +49 -47
- package/dist/components/text-editor/lexical-root.svelte.d.ts +4 -67
- package/dist/components/text-editor/shiki/{facade.d.ts → engine.d.ts} +8 -8
- package/dist/components/text-editor/shiki/{facade.js → engine.js} +53 -156
- package/dist/components/text-editor/shiki/highlighter.js +5 -5
- package/dist/components/text-editor/shiki/lexical.d.ts +6 -0
- package/dist/components/text-editor/shiki/lexical.js +165 -0
- package/dist/components/text-editor/shiki/preload.js +1 -1
- package/dist/components/text-editor/shiki/source-highlight.svelte.d.ts +15 -0
- package/dist/components/text-editor/shiki/source-highlight.svelte.js +120 -0
- package/dist/components/text-editor/shiki/version.d.ts +1 -1
- package/dist/components/text-editor/shiki/version.js +1 -1
- package/dist/components/text-editor/store.svelte.js +65 -16
- package/dist/components/text-editor/text-editor.svelte +53 -145
- package/dist/components/text-editor/text-editor.svelte.d.ts +5 -103
- package/dist/components/text-editor/toolbar/actions.d.ts +25 -0
- package/dist/components/text-editor/toolbar/actions.js +107 -0
- package/dist/components/text-editor/toolbar/align-menu-button.svelte +16 -14
- package/dist/components/text-editor/toolbar/format-text-button.svelte +26 -24
- package/dist/components/text-editor/toolbar/insert-horizontal-rule-button.svelte +23 -23
- package/dist/components/text-editor/toolbar/insert-item-button.svelte +1 -1
- package/dist/components/text-editor/toolbar/insert-link-button.svelte +47 -51
- package/dist/components/text-editor/toolbar/insert-menu-button.svelte +1 -1
- package/dist/components/text-editor/toolbar/insert-table-button.svelte +35 -52
- package/dist/components/text-editor/toolbar/table-action-menu.svelte +19 -17
- package/dist/components/text-editor/toolbar/text-editor-toolbar.svelte +16 -4
- package/dist/components/text-editor/toolbar/text-editor-toolbar.svelte.d.ts +0 -8
- package/dist/components/text-editor/toolbar/toggle-block-menu-item.svelte +34 -33
- package/dist/components/text-editor/widgets/emoji-autocomplete.svelte +7 -6
- package/dist/components/text-editor/widgets/floating-link-editor.svelte +19 -32
- package/dist/components/text-editor/widgets/table-cell-menu-button.svelte +28 -32
- package/dist/components/text-field/date-time-input.svelte +7 -8
- package/dist/components/text-field/date-time-input.svelte.d.ts +3 -32
- package/dist/components/text-field/number-input.d.ts +0 -2
- package/dist/components/text-field/number-input.js +25 -25
- package/dist/components/text-field/number-input.svelte +18 -9
- package/dist/components/text-field/number-input.svelte.d.ts +1 -1
- package/dist/components/text-field/text-area.d.ts +2 -0
- package/dist/components/text-field/text-area.js +31 -0
- package/dist/components/text-field/text-area.svelte +12 -25
- package/dist/components/text-field/text-area.svelte.d.ts +5 -67
- package/dist/components/toast/toast.svelte +31 -8
- package/dist/components/toast/toast.svelte.d.ts +6 -6
- package/dist/components/toolbar/toolbar.svelte +2 -7
- package/dist/components/toolbar/toolbar.svelte.d.ts +4 -37
- package/dist/components/tree/tree-item.svelte +2 -6
- package/dist/components/tree/tree-item.svelte.d.ts +3 -22
- package/dist/components/tree/tree.svelte +3 -10
- package/dist/components/tree/tree.svelte.d.ts +4 -39
- package/dist/components/util/group.svelte +2 -7
- package/dist/components/util/group.svelte.d.ts +4 -37
- package/dist/components/util/modal.d.ts +9 -0
- package/dist/components/util/modal.js +30 -0
- package/dist/components/util/modal.svelte +16 -12
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/locales/hu.yaml +176 -0
- package/dist/services/composite-widget.svelte.d.ts +76 -0
- package/dist/services/composite-widget.svelte.js +157 -0
- package/dist/services/focus.d.ts +2 -0
- package/dist/services/focus.js +68 -0
- package/dist/services/group.svelte.d.ts +17 -69
- package/dist/services/group.svelte.js +128 -391
- package/dist/services/label.d.ts +9 -0
- package/dist/services/label.js +22 -0
- package/dist/services/menu.d.ts +8 -0
- package/dist/services/menu.js +237 -0
- package/dist/services/navigation.d.ts +9 -0
- package/dist/services/navigation.js +13 -0
- package/dist/services/number.d.ts +2 -0
- package/dist/services/number.js +27 -0
- package/dist/services/pointer-drag.d.ts +14 -0
- package/dist/services/pointer-drag.js +89 -0
- package/dist/services/popup.svelte.js +123 -103
- package/dist/services/text.d.ts +3 -0
- package/dist/services/text.js +17 -0
- package/dist/services/tree.svelte.d.ts +29 -43
- package/dist/services/tree.svelte.js +58 -105
- package/dist/services/type-ahead.d.ts +10 -1
- package/dist/services/type-ahead.js +56 -34
- package/dist/typedefs.d.ts +103 -4
- package/dist/typedefs.js +60 -4
- package/package.json +1 -1
- package/dist/components/text-editor/conversion/markdown.d.ts +0 -56
- package/dist/components/text-editor/conversion/markdown.js +0 -949
- package/dist/components/text-editor/toolbar/code-editor-toolbar.svelte +0 -28
- package/dist/components/text-editor/toolbar/code-editor-toolbar.svelte.d.ts +0 -37
- package/dist/components/text-editor/toolbar/insert-component.d.ts +0 -3
- package/dist/components/text-editor/toolbar/insert-component.js +0 -37
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default DateTimeInput;
|
|
2
2
|
type DateTimeInput = {
|
|
3
3
|
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
-
$set?(props: Partial<KeyboardEventHandlers & MouseEventHandlers & PointerEventHandlers & FocusEventHandlers & DragEventHandlers & InputEventHandlers & Props & Record<string, any>>): void;
|
|
4
|
+
$set?(props: Partial<KeyboardEventHandlers & MouseEventHandlers & PointerEventHandlers & FocusEventHandlers & DragEventHandlers & InputEventHandlers & FormFieldStateProps & Props & Record<string, any>>): void;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
7
|
* A date and/or time field. The equivalent of the HTML `<input type="date">`,
|
|
@@ -13,7 +13,7 @@ type DateTimeInput = {
|
|
|
13
13
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local
|
|
14
14
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time
|
|
15
15
|
*/
|
|
16
|
-
declare const DateTimeInput: import("svelte").Component<import("../../typedefs.js").KeyboardEventHandlers & import("../../typedefs.js").MouseEventHandlers & import("../../typedefs.js").PointerEventHandlers & import("../../typedefs.js").FocusEventHandlers & import("../../typedefs.js").DragEventHandlers & InputEventHandlers & {
|
|
16
|
+
declare const DateTimeInput: import("svelte").Component<import("../../typedefs.js").KeyboardEventHandlers & import("../../typedefs.js").MouseEventHandlers & import("../../typedefs.js").PointerEventHandlers & import("../../typedefs.js").FocusEventHandlers & import("../../typedefs.js").DragEventHandlers & InputEventHandlers & FormFieldStateProps & {
|
|
17
17
|
/**
|
|
18
18
|
* Input value, in the native input’s format: `YYYY-MM-DD` for `date`,
|
|
19
19
|
* `YYYY-MM-DDTHH:mm` (with optional seconds) for `datetime-local`, and `HH:mm` (with optional
|
|
@@ -50,21 +50,6 @@ declare const DateTimeInput: import("svelte").Component<import("../../typedefs.j
|
|
|
50
50
|
* attribute.
|
|
51
51
|
*/
|
|
52
52
|
disabled?: boolean | undefined;
|
|
53
|
-
/**
|
|
54
|
-
* Whether to make the widget read-only. An alias of the
|
|
55
|
-
* `aria-readonly` attribute.
|
|
56
|
-
*/
|
|
57
|
-
readonly?: boolean | undefined;
|
|
58
|
-
/**
|
|
59
|
-
* Whether to mark the widget required. An alias of the
|
|
60
|
-
* `aria-required` attribute.
|
|
61
|
-
*/
|
|
62
|
-
required?: boolean | undefined;
|
|
63
|
-
/**
|
|
64
|
-
* Whether to mark the widget invalid. An alias of the
|
|
65
|
-
* `aria-invalid` attribute.
|
|
66
|
-
*/
|
|
67
|
-
invalid?: boolean | undefined;
|
|
68
53
|
/**
|
|
69
54
|
* `aria-label` attribute.
|
|
70
55
|
*/
|
|
@@ -107,24 +92,10 @@ type Props = {
|
|
|
107
92
|
* attribute.
|
|
108
93
|
*/
|
|
109
94
|
disabled?: boolean | undefined;
|
|
110
|
-
/**
|
|
111
|
-
* Whether to make the widget read-only. An alias of the
|
|
112
|
-
* `aria-readonly` attribute.
|
|
113
|
-
*/
|
|
114
|
-
readonly?: boolean | undefined;
|
|
115
|
-
/**
|
|
116
|
-
* Whether to mark the widget required. An alias of the
|
|
117
|
-
* `aria-required` attribute.
|
|
118
|
-
*/
|
|
119
|
-
required?: boolean | undefined;
|
|
120
|
-
/**
|
|
121
|
-
* Whether to mark the widget invalid. An alias of the
|
|
122
|
-
* `aria-invalid` attribute.
|
|
123
|
-
*/
|
|
124
|
-
invalid?: boolean | undefined;
|
|
125
95
|
/**
|
|
126
96
|
* `aria-label` attribute.
|
|
127
97
|
*/
|
|
128
98
|
ariaLabel?: string | undefined;
|
|
129
99
|
};
|
|
130
100
|
import type { InputEventHandlers } from '../../typedefs.js';
|
|
101
|
+
import type { FormFieldStateProps } from '../../typedefs.js';
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
* Step value that turns stepping off: the spin buttons are hidden and the arrow keys are ignored.
|
|
7
7
|
*/
|
|
8
8
|
export const STEP_DISABLED: -1;
|
|
9
|
-
export function normalizeStep(step: number | null | undefined): number;
|
|
10
|
-
export function getMaximumFractionDigits(step: number): number;
|
|
11
9
|
export function getInputMode({ fractional, min }: {
|
|
12
10
|
fractional: boolean;
|
|
13
11
|
min?: number | undefined;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getMaximumFractionDigits } from '../../services/number.js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Logic behind `<NumberInput>`, kept apart from the component so the number handling can be tested
|
|
3
5
|
* without rendering anything.
|
|
@@ -8,29 +10,6 @@
|
|
|
8
10
|
*/
|
|
9
11
|
export const STEP_DISABLED = -1;
|
|
10
12
|
|
|
11
|
-
/**
|
|
12
|
-
* Get the step to use, falling back to `1` for a value that isn’t a positive number, like `0`,
|
|
13
|
-
* `null` or `NaN`, which would leave the spin buttons and the arrow keys with nowhere to go.
|
|
14
|
-
* @param {number | null | undefined} step Step value.
|
|
15
|
-
* @returns {number} Positive step.
|
|
16
|
-
*/
|
|
17
|
-
export const normalizeStep = (step) =>
|
|
18
|
-
typeof step === 'number' && Number.isFinite(step) && step > 0 ? step : 1;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Get the number of fraction digits a value should be formatted with, so stepping by `0.1` yields
|
|
22
|
-
* `0.3` rather than `0.30000000000000004`.
|
|
23
|
-
* @param {number} step Step value.
|
|
24
|
-
* @returns {number} Number of fraction digits, `0` for an integer step.
|
|
25
|
-
*/
|
|
26
|
-
export const getMaximumFractionDigits = (step) => {
|
|
27
|
-
// A small step like `0.0000001` is stringified in exponent notation as `1e-7`
|
|
28
|
-
const [mantissa, exponent = '0'] = String(step).toLowerCase().split('e');
|
|
29
|
-
const digits = (mantissa.split('.')[1]?.length ?? 0) - Number(exponent);
|
|
30
|
-
|
|
31
|
-
return Math.max(digits, 0);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
13
|
/**
|
|
35
14
|
* Get the `inputmode` attribute for the field. The numeric and decimal keypads on iOS have no minus
|
|
36
15
|
* key, so a field that accepts a negative number gets the full keyboard instead.
|
|
@@ -159,8 +138,29 @@ export const stepNumber = (inputValue, { step, direction, min, max }) => {
|
|
|
159
138
|
return undefined;
|
|
160
139
|
}
|
|
161
140
|
|
|
162
|
-
|
|
163
|
-
|
|
141
|
+
// Snap to the step grid, which starts at the minimum if any, otherwise at zero, as the native
|
|
142
|
+
// `<input type="number">` does: with a step of `1`, `2.5` goes up to `3` and down to `2` rather
|
|
143
|
+
// than moving by the full step and then being rounded
|
|
144
|
+
const base = typeof min === 'number' ? min : 0;
|
|
145
|
+
|
|
146
|
+
const maximumFractionDigits = Math.max(
|
|
147
|
+
getMaximumFractionDigits(step),
|
|
148
|
+
getMaximumFractionDigits(base),
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
const position = (toNumber(inputValue) - base) / step;
|
|
152
|
+
const nearestPosition = Math.round(position);
|
|
153
|
+
// Allow for floating-point errors, like `(0.3 - 0) / 0.1` being `2.9999999999999996`
|
|
154
|
+
const isOnGrid = Math.abs(position - nearestPosition) < 1e-9;
|
|
155
|
+
let newPosition;
|
|
156
|
+
|
|
157
|
+
if (isOnGrid) {
|
|
158
|
+
newPosition = nearestPosition + direction;
|
|
159
|
+
} else {
|
|
160
|
+
newPosition = direction > 0 ? Math.ceil(position) : Math.floor(position);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const newValue = Number((base + newPosition * step).toFixed(maximumFractionDigits));
|
|
164
164
|
|
|
165
165
|
// Stop at the limit rather than stepping past it, as the native `<input type="number">` does
|
|
166
166
|
if (typeof max === 'number' && newValue > max) {
|
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
<script>
|
|
8
8
|
import { _, locale } from '@sveltia/i18n';
|
|
9
9
|
import { untrack } from 'svelte';
|
|
10
|
+
import { hasModifier } from '../../services/navigation.js';
|
|
11
|
+
import { getMaximumFractionDigits, normalizeStep } from '../../services/number.js';
|
|
10
12
|
import Button from '../button/button.svelte';
|
|
11
13
|
import Icon from '../icon/icon.svelte';
|
|
12
14
|
import {
|
|
13
15
|
STEP_DISABLED,
|
|
14
16
|
getInputMode,
|
|
15
|
-
getMaximumFractionDigits,
|
|
16
17
|
isAtMax,
|
|
17
18
|
isAtMin,
|
|
18
19
|
isInvalidNumber,
|
|
19
20
|
normalizeNumber,
|
|
20
|
-
normalizeStep,
|
|
21
21
|
parseNumber,
|
|
22
22
|
stepNumber,
|
|
23
23
|
} from './number-input.js';
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
/* eslint-disable prefer-const */
|
|
55
55
|
value = $bindable(),
|
|
56
56
|
invalid = $bindable(false),
|
|
57
|
+
element = $bindable(),
|
|
57
58
|
flex = false,
|
|
58
59
|
min = undefined,
|
|
59
60
|
max = undefined,
|
|
@@ -68,7 +69,6 @@
|
|
|
68
69
|
children,
|
|
69
70
|
increaseIcon,
|
|
70
71
|
decreaseIcon,
|
|
71
|
-
onChange,
|
|
72
72
|
onkeydown,
|
|
73
73
|
oninput,
|
|
74
74
|
...restProps
|
|
@@ -144,8 +144,18 @@
|
|
|
144
144
|
const stepValue = (direction) => {
|
|
145
145
|
const newInputValue = stepNumber(numberValue, { step: stepSize, direction, min, max });
|
|
146
146
|
|
|
147
|
-
if (newInputValue
|
|
148
|
-
|
|
147
|
+
if (newInputValue === undefined) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
inputValue = newInputValue;
|
|
152
|
+
|
|
153
|
+
if (element) {
|
|
154
|
+
// Fire the `input` and `change` events, as the native `<input type="number">` does when
|
|
155
|
+
// stepped, so a consumer listening for them rather than binding the value sees the change
|
|
156
|
+
element.value = newInputValue;
|
|
157
|
+
element.dispatchEvent(new Event('input', { bubbles: true }));
|
|
158
|
+
element.dispatchEvent(new Event('change', { bubbles: true }));
|
|
149
159
|
}
|
|
150
160
|
};
|
|
151
161
|
|
|
@@ -218,6 +228,7 @@
|
|
|
218
228
|
{...restProps}
|
|
219
229
|
role={stepEnabled ? 'spinbutton' : 'textbox'}
|
|
220
230
|
{id}
|
|
231
|
+
bind:element
|
|
221
232
|
bind:value={inputValue}
|
|
222
233
|
spellcheck="false"
|
|
223
234
|
{flex}
|
|
@@ -232,10 +243,9 @@
|
|
|
232
243
|
inputmode={inputmode ?? getInputMode({ fractional: isFractional, min })}
|
|
233
244
|
aria-describedby={describedBy}
|
|
234
245
|
onkeydown={(event) => {
|
|
235
|
-
const { key
|
|
236
|
-
const hasModifier = shiftKey || altKey || ctrlKey || metaKey;
|
|
246
|
+
const { key } = event;
|
|
237
247
|
// A read-only field can’t be stepped, just like the spin buttons
|
|
238
|
-
const canStep = stepEnabled && !disabled && !readonly && !hasModifier;
|
|
248
|
+
const canStep = stepEnabled && !disabled && !readonly && !hasModifier(event);
|
|
239
249
|
|
|
240
250
|
if (key === 'ArrowDown' && canStep) {
|
|
241
251
|
event.preventDefault();
|
|
@@ -260,7 +270,6 @@
|
|
|
260
270
|
|
|
261
271
|
oninput?.(event);
|
|
262
272
|
}}
|
|
263
|
-
{onChange}
|
|
264
273
|
/>
|
|
265
274
|
</div>
|
|
266
275
|
|
|
@@ -48,7 +48,7 @@ declare const NumberInput: import("svelte").Component<TextInputProps & import(".
|
|
|
48
48
|
* Decrease icon slot content.
|
|
49
49
|
*/
|
|
50
50
|
decreaseIcon?: Snippet<[]> | undefined;
|
|
51
|
-
} & Record<string, any>, {}, "
|
|
51
|
+
} & Record<string, any>, {}, "element" | "invalid" | "value">;
|
|
52
52
|
type Props = {
|
|
53
53
|
/**
|
|
54
54
|
* Input value.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logic behind `<TextArea>`, kept apart from the component so the syntax highlighting can be tested
|
|
3
|
+
* without rendering anything.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @import { HighlightedToken } from '../../typedefs.js';
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Get the syntax-highlighted tokens of the value, flattened with line breaks in between, plus a
|
|
12
|
+
* trailing one, like the content of the clone element that measures the auto-resized height.
|
|
13
|
+
* They’re only used when they add up to the value exactly, since stale tokens would show text
|
|
14
|
+
* different from what’s being edited.
|
|
15
|
+
* @param {string | undefined} value Value of the `<textarea>`.
|
|
16
|
+
* @param {((value: string) => HighlightedToken[][] | undefined) | undefined} highlight Function to
|
|
17
|
+
* tokenize the value, returning one array of tokens per line.
|
|
18
|
+
* @returns {HighlightedToken[] | undefined} Tokens, or `undefined` if there’s no `highlight`
|
|
19
|
+
* function, it returns no tokens, or the tokens don’t add up to the value.
|
|
20
|
+
*/
|
|
21
|
+
export const getHighlightedTokens = (value, highlight) => {
|
|
22
|
+
const lines = highlight?.(value ?? '');
|
|
23
|
+
|
|
24
|
+
if (!lines) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const tokens = lines.flatMap((line) => [...line, { content: '\n' }]);
|
|
29
|
+
|
|
30
|
+
return tokens.map(({ content }) => content).join('') === `${value}\n` ? tokens : undefined;
|
|
31
|
+
};
|
|
@@ -7,10 +7,17 @@
|
|
|
7
7
|
-->
|
|
8
8
|
<script>
|
|
9
9
|
import EmojiAutocomplete from './emoji-autocomplete.svelte';
|
|
10
|
+
import { getHighlightedTokens } from './text-area.js';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
|
-
* @import {
|
|
13
|
-
*
|
|
13
|
+
* @import {
|
|
14
|
+
* CommonEventHandlers,
|
|
15
|
+
* ContainerProps,
|
|
16
|
+
* FormFieldStateProps,
|
|
17
|
+
* HighlightedToken,
|
|
18
|
+
* InputEventHandlers,
|
|
19
|
+
* WidgetStateProps,
|
|
20
|
+
* } from '../../typedefs.js';
|
|
14
21
|
*/
|
|
15
22
|
|
|
16
23
|
/**
|
|
@@ -29,21 +36,11 @@
|
|
|
29
36
|
* `undefined` to show the text as is, for example while a grammar is still loading. The tokens
|
|
30
37
|
* are painted behind the text, which is made transparent, so the `<textarea>` keeps working as
|
|
31
38
|
* usual. Only styles that keep the text width can be applied, so the glyphs stay aligned.
|
|
32
|
-
* @property {string} [class] The `class` attribute on the wrapper element.
|
|
33
|
-
* @property {boolean} [hidden] Whether to hide the widget.
|
|
34
|
-
* @property {boolean} [disabled] Whether to disable the widget. An alias of the `aria-disabled`
|
|
35
|
-
* attribute.
|
|
36
|
-
* @property {boolean} [readonly] Whether to make the widget read-only. An alias of the
|
|
37
|
-
* `aria-readonly` attribute.
|
|
38
|
-
* @property {boolean} [required] Whether to mark the widget required. An alias of the
|
|
39
|
-
* `aria-required` attribute.
|
|
40
|
-
* @property {boolean} [invalid] Whether to mark the widget invalid. An alias of the
|
|
41
|
-
* `aria-invalid` attribute.
|
|
42
|
-
* @property {Snippet} [children] Primary slot content.
|
|
43
39
|
*/
|
|
44
40
|
|
|
45
41
|
/**
|
|
46
|
-
* @type {CommonEventHandlers & InputEventHandlers &
|
|
42
|
+
* @type {CommonEventHandlers & InputEventHandlers & ContainerProps & WidgetStateProps &
|
|
43
|
+
* FormFieldStateProps & Props & Record<string, any>}
|
|
47
44
|
*/
|
|
48
45
|
let {
|
|
49
46
|
/* eslint-disable prefer-const */
|
|
@@ -79,17 +76,7 @@
|
|
|
79
76
|
* stale tokens would show text different from what’s being edited.
|
|
80
77
|
* @type {HighlightedToken[] | undefined}
|
|
81
78
|
*/
|
|
82
|
-
const highlightedTokens = $derived
|
|
83
|
-
const lines = highlight?.(value ?? '');
|
|
84
|
-
|
|
85
|
-
if (!lines) {
|
|
86
|
-
return undefined;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const tokens = lines.flatMap((line) => [...line, { content: '\n' }]);
|
|
90
|
-
|
|
91
|
-
return tokens.map(({ content }) => content).join('') === cloneValue ? tokens : undefined;
|
|
92
|
-
});
|
|
79
|
+
const highlightedTokens = $derived(getHighlightedTokens(value, highlight));
|
|
93
80
|
/** A reference to the clone element. */
|
|
94
81
|
let cloneElement = $state();
|
|
95
82
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default TextArea;
|
|
2
2
|
type TextArea = {
|
|
3
3
|
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
-
$set?(props: Partial<KeyboardEventHandlers & MouseEventHandlers & PointerEventHandlers & FocusEventHandlers & DragEventHandlers & InputEventHandlers & Props & Record<string, any>>): void;
|
|
4
|
+
$set?(props: Partial<KeyboardEventHandlers & MouseEventHandlers & PointerEventHandlers & FocusEventHandlers & DragEventHandlers & InputEventHandlers & ContainerProps & WidgetStateProps & FormFieldStateProps & Props & Record<string, any>>): void;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
7
|
* A multi-line text field based on the HTML `<textarea>` element, providing the auto-resize support.
|
|
@@ -9,7 +9,7 @@ type TextArea = {
|
|
|
9
9
|
* @see https://w3c.github.io/aria/#textbox
|
|
10
10
|
* @see https://css-tricks.com/the-cleanest-trick-for-autogrowing-textareas/
|
|
11
11
|
*/
|
|
12
|
-
declare const TextArea: import("svelte").Component<import("../../typedefs.js").KeyboardEventHandlers & import("../../typedefs.js").MouseEventHandlers & import("../../typedefs.js").PointerEventHandlers & import("../../typedefs.js").FocusEventHandlers & import("../../typedefs.js").DragEventHandlers & InputEventHandlers & {
|
|
12
|
+
declare const TextArea: import("svelte").Component<import("../../typedefs.js").KeyboardEventHandlers & import("../../typedefs.js").MouseEventHandlers & import("../../typedefs.js").PointerEventHandlers & import("../../typedefs.js").FocusEventHandlers & import("../../typedefs.js").DragEventHandlers & InputEventHandlers & ContainerProps & WidgetStateProps & FormFieldStateProps & {
|
|
13
13
|
/**
|
|
14
14
|
* Input value.
|
|
15
15
|
*/
|
|
@@ -48,38 +48,6 @@ declare const TextArea: import("svelte").Component<import("../../typedefs.js").K
|
|
|
48
48
|
* usual. Only styles that keep the text width can be applied, so the glyphs stay aligned.
|
|
49
49
|
*/
|
|
50
50
|
highlight?: ((value: string) => HighlightedToken[][] | undefined) | undefined;
|
|
51
|
-
/**
|
|
52
|
-
* The `class` attribute on the wrapper element.
|
|
53
|
-
*/
|
|
54
|
-
class?: string | undefined;
|
|
55
|
-
/**
|
|
56
|
-
* Whether to hide the widget.
|
|
57
|
-
*/
|
|
58
|
-
hidden?: boolean | undefined;
|
|
59
|
-
/**
|
|
60
|
-
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
61
|
-
* attribute.
|
|
62
|
-
*/
|
|
63
|
-
disabled?: boolean | undefined;
|
|
64
|
-
/**
|
|
65
|
-
* Whether to make the widget read-only. An alias of the
|
|
66
|
-
* `aria-readonly` attribute.
|
|
67
|
-
*/
|
|
68
|
-
readonly?: boolean | undefined;
|
|
69
|
-
/**
|
|
70
|
-
* Whether to mark the widget required. An alias of the
|
|
71
|
-
* `aria-required` attribute.
|
|
72
|
-
*/
|
|
73
|
-
required?: boolean | undefined;
|
|
74
|
-
/**
|
|
75
|
-
* Whether to mark the widget invalid. An alias of the
|
|
76
|
-
* `aria-invalid` attribute.
|
|
77
|
-
*/
|
|
78
|
-
invalid?: boolean | undefined;
|
|
79
|
-
/**
|
|
80
|
-
* Primary slot content.
|
|
81
|
-
*/
|
|
82
|
-
children?: Snippet<[]> | undefined;
|
|
83
51
|
} & Record<string, any>, {}, "element" | "value">;
|
|
84
52
|
type Props = {
|
|
85
53
|
/**
|
|
@@ -120,39 +88,9 @@ type Props = {
|
|
|
120
88
|
* usual. Only styles that keep the text width can be applied, so the glyphs stay aligned.
|
|
121
89
|
*/
|
|
122
90
|
highlight?: ((value: string) => HighlightedToken[][] | undefined) | undefined;
|
|
123
|
-
/**
|
|
124
|
-
* The `class` attribute on the wrapper element.
|
|
125
|
-
*/
|
|
126
|
-
class?: string | undefined;
|
|
127
|
-
/**
|
|
128
|
-
* Whether to hide the widget.
|
|
129
|
-
*/
|
|
130
|
-
hidden?: boolean | undefined;
|
|
131
|
-
/**
|
|
132
|
-
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
133
|
-
* attribute.
|
|
134
|
-
*/
|
|
135
|
-
disabled?: boolean | undefined;
|
|
136
|
-
/**
|
|
137
|
-
* Whether to make the widget read-only. An alias of the
|
|
138
|
-
* `aria-readonly` attribute.
|
|
139
|
-
*/
|
|
140
|
-
readonly?: boolean | undefined;
|
|
141
|
-
/**
|
|
142
|
-
* Whether to mark the widget required. An alias of the
|
|
143
|
-
* `aria-required` attribute.
|
|
144
|
-
*/
|
|
145
|
-
required?: boolean | undefined;
|
|
146
|
-
/**
|
|
147
|
-
* Whether to mark the widget invalid. An alias of the
|
|
148
|
-
* `aria-invalid` attribute.
|
|
149
|
-
*/
|
|
150
|
-
invalid?: boolean | undefined;
|
|
151
|
-
/**
|
|
152
|
-
* Primary slot content.
|
|
153
|
-
*/
|
|
154
|
-
children?: Snippet<[]> | undefined;
|
|
155
91
|
};
|
|
156
92
|
import type { InputEventHandlers } from '../../typedefs.js';
|
|
93
|
+
import type { ContainerProps } from '../../typedefs.js';
|
|
94
|
+
import type { WidgetStateProps } from '../../typedefs.js';
|
|
95
|
+
import type { FormFieldStateProps } from '../../typedefs.js';
|
|
157
96
|
import type { HighlightedToken } from '../../typedefs.js';
|
|
158
|
-
import type { Snippet } from 'svelte';
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
@see https://github.com/whatwg/html/issues/9936
|
|
7
7
|
-->
|
|
8
8
|
<script module>
|
|
9
|
+
import { openModalDialogs } from '../util/modal.js';
|
|
10
|
+
|
|
9
11
|
/**
|
|
10
12
|
* Modal dialogs currently open, the topmost last. While a modal dialog is open, the rest of the
|
|
11
13
|
* document is inert, including a popover stacked on top of the dialog, so the toast base has to
|
|
@@ -171,7 +173,16 @@
|
|
|
171
173
|
base.setAttribute('role', 'none');
|
|
172
174
|
base.className = 'sui toast-base enabled';
|
|
173
175
|
base.popover = 'manual';
|
|
174
|
-
|
|
176
|
+
|
|
177
|
+
// The dialogs are in the document in no particular order, so put those shown by `<Modal>` in
|
|
178
|
+
// the order they were opened, on top of any others
|
|
179
|
+
const dialogs = [...document.querySelectorAll(/** @type {'dialog'} */ ('dialog:modal'))];
|
|
180
|
+
|
|
181
|
+
modals.push(
|
|
182
|
+
...dialogs.filter((dialog) => !openModalDialogs.includes(dialog)),
|
|
183
|
+
...openModalDialogs.filter((dialog) => dialogs.includes(dialog)),
|
|
184
|
+
);
|
|
185
|
+
|
|
175
186
|
// These events don’t bubble, so listen in the capture phase
|
|
176
187
|
document.addEventListener('toggle', onToggle, true);
|
|
177
188
|
document.addEventListener('beforetoggle', onClose, true);
|
|
@@ -215,9 +226,9 @@
|
|
|
215
226
|
* @property {string | number} [id] The toast ID. If updated, the timer that hides
|
|
216
227
|
* the toast will be reset, meaning the same toast can be displayed for a longer period of time.
|
|
217
228
|
* @property {boolean} [show] Whether to show the toast.
|
|
218
|
-
* @property {number} [duration] Duration to automatically hide the toast. Use `0`
|
|
219
|
-
* manually from the consumer. The countdown is held while the pointer is over the
|
|
220
|
-
* focus is inside it, and starts over once it leaves.
|
|
229
|
+
* @property {number} [duration] Duration to automatically hide the toast. Use `0` or `Infinity`
|
|
230
|
+
* to hide it manually from the consumer. The countdown is held while the pointer is over the
|
|
231
|
+
* toast or the focus is inside it, and starts over once it leaves.
|
|
221
232
|
* @property {ToastPosition} [position] Position of the toast.
|
|
222
233
|
* @property {Snippet} [children] Primary slot content.
|
|
223
234
|
*/
|
|
@@ -269,6 +280,11 @@
|
|
|
269
280
|
*/
|
|
270
281
|
let rendered = $state(false);
|
|
271
282
|
|
|
283
|
+
/**
|
|
284
|
+
* The longest delay `setTimeout()` accepts, in milliseconds.
|
|
285
|
+
*/
|
|
286
|
+
const MAX_TIMEOUT = 2_147_483_647;
|
|
287
|
+
|
|
272
288
|
onMount(() => {
|
|
273
289
|
popover = acquireBase();
|
|
274
290
|
|
|
@@ -363,13 +379,20 @@
|
|
|
363
379
|
void duration;
|
|
364
380
|
void held;
|
|
365
381
|
|
|
366
|
-
|
|
382
|
+
// An infinite duration keeps the toast like `0` does: `setTimeout()` would take it as `0` and
|
|
383
|
+
// hide the toast at once
|
|
384
|
+
if (!show || !duration || !Number.isFinite(duration) || held) {
|
|
367
385
|
return undefined;
|
|
368
386
|
}
|
|
369
387
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
388
|
+
// `setTimeout()` fires at once when the delay is longer than its 32-bit maximum (about 24.8
|
|
389
|
+
// days), so cap it there
|
|
390
|
+
const timer = globalThis.setTimeout(
|
|
391
|
+
() => {
|
|
392
|
+
show = false;
|
|
393
|
+
},
|
|
394
|
+
Math.min(duration, MAX_TIMEOUT),
|
|
395
|
+
);
|
|
373
396
|
|
|
374
397
|
// Stop the countdown when any of the above changes, so the previous timer can’t fire, or when
|
|
375
398
|
// the toast is destroyed, or it would still hide the toast later
|
|
@@ -20,9 +20,9 @@ declare const Toast: import("svelte").Component<{
|
|
|
20
20
|
*/
|
|
21
21
|
show?: boolean | undefined;
|
|
22
22
|
/**
|
|
23
|
-
* Duration to automatically hide the toast. Use `0`
|
|
24
|
-
* manually from the consumer. The countdown is held while the pointer is over the
|
|
25
|
-
* focus is inside it, and starts over once it leaves.
|
|
23
|
+
* Duration to automatically hide the toast. Use `0` or `Infinity`
|
|
24
|
+
* to hide it manually from the consumer. The countdown is held while the pointer is over the
|
|
25
|
+
* toast or the focus is inside it, and starts over once it leaves.
|
|
26
26
|
*/
|
|
27
27
|
duration?: number | undefined;
|
|
28
28
|
/**
|
|
@@ -45,9 +45,9 @@ type Props = {
|
|
|
45
45
|
*/
|
|
46
46
|
show?: boolean | undefined;
|
|
47
47
|
/**
|
|
48
|
-
* Duration to automatically hide the toast. Use `0`
|
|
49
|
-
* manually from the consumer. The countdown is held while the pointer is over the
|
|
50
|
-
* focus is inside it, and starts over once it leaves.
|
|
48
|
+
* Duration to automatically hide the toast. Use `0` or `Infinity`
|
|
49
|
+
* to hide it manually from the consumer. The countdown is held while the pointer is over the
|
|
50
|
+
* toast or the focus is inside it, and starts over once it leaves.
|
|
51
51
|
*/
|
|
52
52
|
duration?: number | undefined;
|
|
53
53
|
/**
|
|
@@ -6,24 +6,19 @@
|
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
8
|
/**
|
|
9
|
-
* @import {
|
|
9
|
+
* @import { ContainerProps, WidgetStateProps } from '../../typedefs.js';
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @typedef {object} Props
|
|
14
|
-
* @property {string} [class] The `class` attribute on the wrapper element.
|
|
15
|
-
* @property {boolean} [hidden] Whether to hide the widget.
|
|
16
|
-
* @property {boolean} [disabled] Whether to disable the widget. An alias of the `aria-disabled`
|
|
17
|
-
* attribute.
|
|
18
14
|
* @property {'horizontal' | 'vertical'} [orientation] Orientation of the widget. An alias of the
|
|
19
15
|
* `aria-orientation` attribute.
|
|
20
16
|
* @property {'primary' | 'secondary'} [variant] The style variant of the toolbar.
|
|
21
17
|
* @property {string} [ariaLabel] The `aria-label` attribute on the wrapper element.
|
|
22
|
-
* @property {Snippet} [children] Primary slot content.
|
|
23
18
|
*/
|
|
24
19
|
|
|
25
20
|
/**
|
|
26
|
-
* @type {Props & Record<string, any>}
|
|
21
|
+
* @type {ContainerProps & WidgetStateProps & Props & Record<string, any>}
|
|
27
22
|
*/
|
|
28
23
|
let {
|
|
29
24
|
/* eslint-disable prefer-const */
|
|
@@ -1,27 +1,14 @@
|
|
|
1
1
|
export default Toolbar;
|
|
2
2
|
type Toolbar = {
|
|
3
3
|
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
-
$set?(props: Partial<Props & Record<string, any>>): void;
|
|
4
|
+
$set?(props: Partial<ContainerProps & WidgetStateProps & Props & Record<string, any>>): void;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
7
|
* A toolbar layout that can contain `<Button>`, `<Select>` and other widgets.
|
|
8
8
|
* @see https://w3c.github.io/aria/#toolbar
|
|
9
9
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/
|
|
10
10
|
*/
|
|
11
|
-
declare const Toolbar: import("svelte").Component<{
|
|
12
|
-
/**
|
|
13
|
-
* The `class` attribute on the wrapper element.
|
|
14
|
-
*/
|
|
15
|
-
class?: string | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Whether to hide the widget.
|
|
18
|
-
*/
|
|
19
|
-
hidden?: boolean | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
22
|
-
* attribute.
|
|
23
|
-
*/
|
|
24
|
-
disabled?: boolean | undefined;
|
|
11
|
+
declare const Toolbar: import("svelte").Component<ContainerProps & WidgetStateProps & {
|
|
25
12
|
/**
|
|
26
13
|
* Orientation of the widget. An alias of the
|
|
27
14
|
* `aria-orientation` attribute.
|
|
@@ -35,25 +22,8 @@ declare const Toolbar: import("svelte").Component<{
|
|
|
35
22
|
* The `aria-label` attribute on the wrapper element.
|
|
36
23
|
*/
|
|
37
24
|
ariaLabel?: string | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* Primary slot content.
|
|
40
|
-
*/
|
|
41
|
-
children?: Snippet<[]> | undefined;
|
|
42
25
|
} & Record<string, any>, {}, "">;
|
|
43
26
|
type Props = {
|
|
44
|
-
/**
|
|
45
|
-
* The `class` attribute on the wrapper element.
|
|
46
|
-
*/
|
|
47
|
-
class?: string | undefined;
|
|
48
|
-
/**
|
|
49
|
-
* Whether to hide the widget.
|
|
50
|
-
*/
|
|
51
|
-
hidden?: boolean | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* Whether to disable the widget. An alias of the `aria-disabled`
|
|
54
|
-
* attribute.
|
|
55
|
-
*/
|
|
56
|
-
disabled?: boolean | undefined;
|
|
57
27
|
/**
|
|
58
28
|
* Orientation of the widget. An alias of the
|
|
59
29
|
* `aria-orientation` attribute.
|
|
@@ -67,9 +37,6 @@ type Props = {
|
|
|
67
37
|
* The `aria-label` attribute on the wrapper element.
|
|
68
38
|
*/
|
|
69
39
|
ariaLabel?: string | undefined;
|
|
70
|
-
/**
|
|
71
|
-
* Primary slot content.
|
|
72
|
-
*/
|
|
73
|
-
children?: Snippet<[]> | undefined;
|
|
74
40
|
};
|
|
75
|
-
import type {
|
|
41
|
+
import type { ContainerProps } from '../../typedefs.js';
|
|
42
|
+
import type { WidgetStateProps } from '../../typedefs.js';
|
|
@@ -14,16 +14,12 @@
|
|
|
14
14
|
/**
|
|
15
15
|
* @import { Snippet } from 'svelte';
|
|
16
16
|
* @import { Attachment } from 'svelte/attachments';
|
|
17
|
-
* @import { CommonEventHandlers } from '../../typedefs.js';
|
|
17
|
+
* @import { CommonEventHandlers, WidgetStateProps } from '../../typedefs.js';
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* @typedef {object} Props
|
|
22
22
|
* @property {string} [class] The `class` attribute on the wrapper element.
|
|
23
|
-
* @property {boolean} [hidden] Whether to hide the widget. An alias of the `aria-hidden`
|
|
24
|
-
* attribute.
|
|
25
|
-
* @property {boolean} [disabled] Whether to disable the widget. An alias of the `aria-disabled`
|
|
26
|
-
* attribute.
|
|
27
23
|
* @property {boolean} [selected] Whether to select the item. An alias of the `aria-selected`
|
|
28
24
|
* attribute.
|
|
29
25
|
* @property {boolean} [expanded] Whether to expand the item. An alias of the `aria-expanded`
|
|
@@ -46,7 +42,7 @@
|
|
|
46
42
|
*/
|
|
47
43
|
|
|
48
44
|
/**
|
|
49
|
-
* @type {CommonEventHandlers & Props & Record<string, any>}
|
|
45
|
+
* @type {CommonEventHandlers & WidgetStateProps & Props & Record<string, any>}
|
|
50
46
|
*/
|
|
51
47
|
let {
|
|
52
48
|
/* eslint-disable prefer-const */
|