@sveltia/ui 0.78.4 → 0.79.1
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/alert/alert-content.svelte +51 -0
- package/dist/components/alert/alert-content.svelte.d.ts +39 -0
- package/dist/components/alert/alert.d.ts +3 -0
- package/dist/components/alert/alert.js +21 -0
- package/dist/components/alert/alert.svelte +6 -30
- package/dist/components/alert/infobar.svelte +7 -21
- package/dist/components/alert/infobar.svelte.d.ts +2 -2
- package/dist/components/button/button.svelte +11 -11
- package/dist/components/button/button.svelte.d.ts +2 -2
- package/dist/components/button/select-button.svelte +1 -1
- package/dist/components/button/select-button.svelte.d.ts +2 -2
- package/dist/components/button/split-button.svelte +1 -1
- package/dist/components/button/split-button.svelte.d.ts +3 -3
- package/dist/components/calendar/calendar.d.ts +2 -0
- package/dist/components/calendar/calendar.js +34 -0
- package/dist/components/calendar/calendar.svelte +49 -5
- package/dist/components/checkbox/checkbox.svelte +11 -4
- package/dist/components/checkbox/checkbox.svelte.d.ts +2 -2
- package/dist/components/dialog/alert-dialog.svelte +1 -1
- package/dist/components/dialog/alert-dialog.svelte.d.ts +2 -2
- package/dist/components/dialog/confirmation-dialog.svelte +1 -1
- package/dist/components/dialog/confirmation-dialog.svelte.d.ts +2 -2
- package/dist/components/dialog/dialog.svelte +8 -18
- package/dist/components/dialog/dialog.svelte.d.ts +2 -2
- package/dist/components/dialog/modal-close-button.svelte +50 -0
- package/dist/components/dialog/modal-close-button.svelte.d.ts +43 -0
- package/dist/components/dialog/prompt-dialog.svelte +1 -1
- package/dist/components/dialog/prompt-dialog.svelte.d.ts +4 -4
- package/dist/components/disclosure/disclosure.svelte +1 -1
- package/dist/components/drawer/drawer.svelte +12 -34
- package/dist/components/drawer/drawer.svelte.d.ts +1 -1
- package/dist/components/emoji/caret.d.ts +1 -1
- package/dist/components/emoji/caret.js +1 -1
- package/dist/components/emoji/emoji-suggestions.svelte +1 -1
- package/dist/components/emoji/emoji-suggestions.svelte.d.ts +3 -3
- package/dist/components/emoji/emoji.d.ts +2 -2
- package/dist/components/emoji/emoji.js +1 -1
- package/dist/components/emoji/position.d.ts +2 -2
- package/dist/components/emoji/position.js +1 -1
- package/dist/components/grid/grid-body.svelte +6 -2
- package/dist/components/grid/grid-cell.svelte +3 -9
- package/dist/components/grid/grid-col-header.svelte +3 -9
- package/dist/components/grid/grid-foot.svelte +4 -11
- package/dist/components/grid/grid-head.svelte +4 -11
- package/dist/components/grid/grid-row-header.svelte +3 -10
- package/dist/components/grid/grid-row.svelte +3 -16
- package/dist/components/listbox/listbox.svelte +1 -1
- package/dist/components/listbox/listbox.svelte.d.ts +1 -1
- package/dist/components/listbox/option.svelte +1 -1
- package/dist/components/listbox/option.svelte.d.ts +2 -2
- package/dist/components/menu/menu-button.svelte +2 -2
- package/dist/components/menu/menu-button.svelte.d.ts +4 -4
- package/dist/components/menu/menu-item-checkable.svelte +71 -0
- package/dist/components/menu/menu-item-checkable.svelte.d.ts +25 -0
- package/dist/components/menu/menu-item-checkbox.svelte +3 -36
- package/dist/components/menu/menu-item-checkbox.svelte.d.ts +3 -3
- package/dist/components/menu/menu-item-group.svelte +8 -5
- package/dist/components/menu/menu-item-group.svelte.d.ts +9 -1
- package/dist/components/menu/menu-item-radio.svelte +3 -36
- package/dist/components/menu/menu-item-radio.svelte.d.ts +3 -3
- package/dist/components/menu/menu-item.svelte +22 -6
- package/dist/components/menu/menu-item.svelte.d.ts +4 -4
- package/dist/components/radio/radio.svelte +12 -1
- package/dist/components/resizable-pane/resizable-handle.svelte +14 -18
- package/dist/components/resizable-pane/resizable-pane-group.svelte +9 -6
- package/dist/components/resizable-pane/resizable-pane.svelte +4 -4
- package/dist/components/resizable-pane/resizable-pane.svelte.d.ts +7 -6
- package/dist/components/resizable-pane/sizing.d.ts +5 -4
- package/dist/components/resizable-pane/sizing.js +84 -25
- package/dist/components/scroll/infinite-scroll.svelte +16 -21
- package/dist/components/select/combobox.svelte +43 -52
- package/dist/components/select/combobox.svelte.d.ts +2 -2
- package/dist/components/select/select-tags.svelte +7 -1
- package/dist/components/select/select.svelte +2 -22
- package/dist/components/select/select.svelte.d.ts +1 -1
- package/dist/components/slider/slider.d.ts +6 -0
- package/dist/components/slider/slider.js +55 -2
- package/dist/components/slider/slider.svelte +63 -32
- package/dist/components/table/table-cell.svelte +3 -9
- package/dist/components/table/table-col-header.svelte +3 -9
- package/dist/components/table/table-foot.svelte +4 -11
- package/dist/components/table/table-head.svelte +4 -11
- package/dist/components/table/table-part.svelte +69 -0
- package/dist/components/table/table-part.svelte.d.ts +48 -0
- package/dist/components/table/table-row-header.svelte +3 -10
- package/dist/components/table/table-row.svelte +3 -10
- package/dist/components/tabs/tab-list.svelte +12 -0
- package/dist/components/tabs/tab.svelte +1 -1
- package/dist/components/tabs/tab.svelte.d.ts +2 -2
- package/dist/components/text-editor/constants.d.ts +5 -5
- package/dist/components/text-editor/constants.js +1 -1
- package/dist/components/text-editor/core.d.ts +4 -5
- package/dist/components/text-editor/core.js +372 -285
- package/dist/components/text-editor/emoji-autocomplete.svelte +1 -1
- package/dist/components/text-editor/lexical-root.svelte +4 -2
- package/dist/components/text-editor/raw-markdown.d.ts +6 -33
- package/dist/components/text-editor/raw-markdown.js +63 -8
- package/dist/components/text-editor/shiki/facade.d.ts +1 -1
- package/dist/components/text-editor/shiki/facade.js +63 -48
- package/dist/components/text-editor/shiki/generated.d.ts +1 -1
- package/dist/components/text-editor/shiki/generated.js +1 -1
- package/dist/components/text-editor/shiki/highlighter.d.ts +6 -1
- package/dist/components/text-editor/shiki/highlighter.js +3 -4
- package/dist/components/text-editor/shiki/loader.d.ts +1 -1
- package/dist/components/text-editor/shiki/loader.js +1 -1
- 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.d.ts +1 -1
- package/dist/components/text-editor/store.svelte.js +29 -2
- package/dist/components/text-editor/text-editor.svelte +2 -2
- package/dist/components/text-editor/text-editor.svelte.d.ts +3 -3
- package/dist/components/text-editor/toolbar/code-language-switcher.svelte +24 -16
- package/dist/components/text-editor/toolbar/format-text-button.svelte +7 -31
- package/dist/components/text-editor/toolbar/format-text-button.svelte.d.ts +1 -1
- package/dist/components/text-editor/toolbar/insert-component.d.ts +3 -0
- package/dist/components/text-editor/toolbar/insert-component.js +34 -0
- package/dist/components/text-editor/toolbar/insert-item-button.svelte +4 -24
- package/dist/components/text-editor/toolbar/insert-item-button.svelte.d.ts +1 -1
- package/dist/components/text-editor/toolbar/insert-link-button.svelte +9 -25
- package/dist/components/text-editor/toolbar/insert-menu-button.svelte +4 -24
- package/dist/components/text-editor/toolbar/insert-menu-button.svelte.d.ts +1 -1
- package/dist/components/text-editor/toolbar/text-editor-toolbar.svelte +1 -1
- package/dist/components/text-editor/toolbar/toggle-block-menu-item.svelte +31 -35
- package/dist/components/text-editor/toolbar/toggle-block-menu-item.svelte.d.ts +1 -1
- package/dist/components/text-editor/toolbar/toolbar-wrapper.svelte +0 -10
- package/dist/components/text-editor/toolbar/toolbar-wrapper.svelte.d.ts +1 -11
- package/dist/components/text-editor/transformers/table.d.ts +0 -1
- package/dist/components/text-editor/transformers/table.js +1 -2
- package/dist/components/text-field/emoji-autocomplete.svelte +1 -1
- package/dist/components/text-field/masked-input.svelte +179 -0
- package/dist/components/text-field/masked-input.svelte.d.ts +42 -0
- package/dist/components/text-field/number-input.js +7 -1
- package/dist/components/text-field/number-input.svelte +13 -5
- package/dist/components/text-field/number-input.svelte.d.ts +3 -3
- package/dist/components/text-field/password-input.svelte +3 -116
- package/dist/components/text-field/password-input.svelte.d.ts +3 -3
- package/dist/components/text-field/search-bar.svelte +1 -1
- package/dist/components/text-field/search-bar.svelte.d.ts +3 -3
- package/dist/components/text-field/secret-input.svelte +3 -119
- package/dist/components/text-field/secret-input.svelte.d.ts +3 -3
- package/dist/components/text-field/text-area.svelte +1 -1
- package/dist/components/text-field/text-area.svelte.d.ts +3 -3
- package/dist/components/text-field/text-input.svelte +1 -1
- package/dist/components/text-field/text-input.svelte.d.ts +3 -3
- package/dist/components/toast/toast.svelte +11 -20
- package/dist/components/toast/toast.svelte.d.ts +1 -1
- package/dist/components/tree/tree-item.svelte +1 -1
- package/dist/components/tree/tree-item.svelte.d.ts +1 -1
- package/dist/components/tree/tree.svelte +1 -1
- package/dist/components/tree/tree.svelte.d.ts +1 -1
- package/dist/components/util/font-links.svelte +1 -0
- package/dist/components/util/modal.svelte +37 -1
- package/dist/components/util/modal.svelte.d.ts +1 -1
- package/dist/components/util/popup.svelte +2 -5
- package/dist/components/util/popup.svelte.d.ts +2 -2
- package/dist/components/util/visibility-observer.svelte +1 -0
- package/dist/locales/ar.yaml +1 -1
- package/dist/locales/sk.yaml +136 -0
- package/dist/services/group.svelte.d.ts +10 -1
- package/dist/services/group.svelte.js +361 -251
- package/dist/services/navigation.d.ts +19 -0
- package/dist/services/navigation.js +84 -0
- package/dist/services/popup-position.d.ts +90 -0
- package/dist/services/popup-position.js +275 -0
- package/dist/services/popup.svelte.d.ts +16 -17
- package/dist/services/popup.svelte.js +25 -169
- package/dist/services/scroll.d.ts +1 -0
- package/dist/services/scroll.js +17 -0
- package/dist/services/select.svelte.d.ts +2 -2
- package/dist/services/select.svelte.js +1 -1
- package/dist/services/text.d.ts +2 -0
- package/dist/services/text.js +28 -0
- package/dist/services/tree.svelte.d.ts +3 -11
- package/dist/services/tree.svelte.js +35 -77
- package/dist/services/type-ahead.d.ts +0 -4
- package/dist/services/type-ahead.js +3 -1
- package/dist/services/widget.d.ts +8 -0
- package/dist/services/widget.js +39 -0
- package/dist/shiki-engine.js +15 -15
- package/dist/styles/mixins.scss +126 -0
- package/dist/typedefs.d.ts +5 -0
- package/dist/typedefs.js +2 -0
- package/package.json +24 -20
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
import { onMount } from 'svelte';
|
|
13
13
|
import {
|
|
14
14
|
findNearestStepIndex,
|
|
15
|
+
getNearestThumbIndex,
|
|
16
|
+
getSliderCurrentIndex,
|
|
17
|
+
getSliderKeyDirection,
|
|
15
18
|
getSliderKeyTargetIndex,
|
|
16
19
|
getSliderSteps,
|
|
17
20
|
toLogicalX,
|
|
@@ -106,6 +109,29 @@
|
|
|
106
109
|
let targetPointerId = $state(0);
|
|
107
110
|
let targetValueIndex = $state(0);
|
|
108
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Set the value of a thumb, and fire the `change` event if it’s actually changed. This is only
|
|
114
|
+
* called for user actions, so the event doesn’t fire when the slider is mounted or resized.
|
|
115
|
+
* @param {number} valueIndex Index in the {@link values} array, `0` for a single-thumb slider.
|
|
116
|
+
* @param {number} newValue New value.
|
|
117
|
+
*/
|
|
118
|
+
const setValue = (valueIndex, newValue) => {
|
|
119
|
+
const _values = /** @type {[number, number]} */ (values);
|
|
120
|
+
|
|
121
|
+
if ((multiThumb ? _values[valueIndex] : value) === newValue) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (multiThumb) {
|
|
126
|
+
_values[valueIndex] = newValue;
|
|
127
|
+
values = [..._values];
|
|
128
|
+
onChange?.({ values });
|
|
129
|
+
} else {
|
|
130
|
+
value = newValue;
|
|
131
|
+
onChange?.({ value });
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
109
135
|
/**
|
|
110
136
|
* Move a thumb with mouse.
|
|
111
137
|
* @param {number} physicalX Physical X position in pixels from the left edge.
|
|
@@ -114,23 +140,17 @@
|
|
|
114
140
|
const index = findNearestStepIndex(positionList, toLogicalX(physicalX, barWidth, isRTL()));
|
|
115
141
|
|
|
116
142
|
if (
|
|
117
|
-
|
|
118
|
-
(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}))
|
|
143
|
+
multiThumb &&
|
|
144
|
+
wouldCrossThumbs({
|
|
145
|
+
valueIndex: targetValueIndex,
|
|
146
|
+
targetPosition: positionList[index],
|
|
147
|
+
sliderPositions,
|
|
148
|
+
})
|
|
124
149
|
) {
|
|
125
150
|
return;
|
|
126
151
|
}
|
|
127
152
|
|
|
128
|
-
|
|
129
|
-
/** @type {[number, number]} */ (values)[targetValueIndex] = valueList[index];
|
|
130
|
-
values = [.../** @type {[number, number]} */ (values)];
|
|
131
|
-
} else {
|
|
132
|
-
value = valueList[index];
|
|
133
|
-
}
|
|
153
|
+
setValue(targetValueIndex, valueList[index]);
|
|
134
154
|
};
|
|
135
155
|
|
|
136
156
|
/**
|
|
@@ -147,11 +167,16 @@
|
|
|
147
167
|
}
|
|
148
168
|
|
|
149
169
|
const _value = multiThumb ? /** @type {[number, number]} */ (values)[valueIndex] : value;
|
|
170
|
+
const rtl = isRTL();
|
|
150
171
|
|
|
151
172
|
const index = getSliderKeyTargetIndex({
|
|
152
173
|
key,
|
|
153
|
-
rtl
|
|
154
|
-
currentIndex:
|
|
174
|
+
rtl,
|
|
175
|
+
currentIndex: getSliderCurrentIndex({
|
|
176
|
+
valueList,
|
|
177
|
+
value: _value,
|
|
178
|
+
decreasing: key === 'PageDown' || getSliderKeyDirection(key, rtl) === -1,
|
|
179
|
+
}),
|
|
155
180
|
length: valueList.length,
|
|
156
181
|
});
|
|
157
182
|
|
|
@@ -174,12 +199,7 @@
|
|
|
174
199
|
return;
|
|
175
200
|
}
|
|
176
201
|
|
|
177
|
-
|
|
178
|
-
/** @type {[number, number]} */ (values)[valueIndex] = valueList[index];
|
|
179
|
-
values = [.../** @type {[number, number]} */ (values)];
|
|
180
|
-
} else {
|
|
181
|
-
value = valueList[index];
|
|
182
|
-
}
|
|
202
|
+
setValue(valueIndex, valueList[index]);
|
|
183
203
|
};
|
|
184
204
|
|
|
185
205
|
/**
|
|
@@ -244,8 +264,9 @@
|
|
|
244
264
|
* Handle the `pointerdown` event fired on the slider.
|
|
245
265
|
* @param {PointerEvent} event `pointerdown` event.
|
|
246
266
|
* @param {number} [valueIndex] Index in the {@link values} array to be used to get/set the value.
|
|
267
|
+
* Omitted when the track is pressed, so the thumb nearest to the pointer is used.
|
|
247
268
|
*/
|
|
248
|
-
const onPointerDown = (event, valueIndex
|
|
269
|
+
const onPointerDown = (event, valueIndex) => {
|
|
249
270
|
if (disabled || readonly) {
|
|
250
271
|
return;
|
|
251
272
|
}
|
|
@@ -263,7 +284,11 @@
|
|
|
263
284
|
startX = clientX - rect.left;
|
|
264
285
|
startScreenX = screenX;
|
|
265
286
|
targetPointerId = pointerId;
|
|
266
|
-
targetValueIndex =
|
|
287
|
+
targetValueIndex =
|
|
288
|
+
valueIndex ??
|
|
289
|
+
(multiThumb
|
|
290
|
+
? getNearestThumbIndex(sliderPositions, toLogicalX(startX, barWidth, isRTL()))
|
|
291
|
+
: 0);
|
|
267
292
|
slider.setPointerCapture(pointerId);
|
|
268
293
|
|
|
269
294
|
document.addEventListener('pointermove', onPointerMove);
|
|
@@ -272,18 +297,24 @@
|
|
|
272
297
|
};
|
|
273
298
|
|
|
274
299
|
/**
|
|
275
|
-
*
|
|
300
|
+
* Get the thumb position for a value. A value that doesn’t sit on a step, such as `55` with a
|
|
301
|
+
* step of `10`, is kept as is until the user moves the thumb, but drawn at the nearest step.
|
|
302
|
+
* @param {number} _value Value.
|
|
303
|
+
* @returns {number} Position in pixels.
|
|
304
|
+
*/
|
|
305
|
+
const getPosition = (_value) => positionList[findNearestStepIndex(valueList, _value)] ?? 0;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Update the thumb positions when the value or the track is changed.
|
|
276
309
|
*/
|
|
277
|
-
const
|
|
310
|
+
const updatePositions = () => {
|
|
278
311
|
if (multiThumb) {
|
|
279
312
|
const [value0, value1] = /** @type {[number, number]} */ (values);
|
|
280
313
|
|
|
281
|
-
sliderPositions[0] =
|
|
282
|
-
sliderPositions[1] =
|
|
283
|
-
onChange?.({ values });
|
|
314
|
+
sliderPositions[0] = getPosition(value0);
|
|
315
|
+
sliderPositions[1] = getPosition(value1);
|
|
284
316
|
} else {
|
|
285
|
-
sliderPositions[0] =
|
|
286
|
-
onChange?.({ value });
|
|
317
|
+
sliderPositions[0] = getPosition(value);
|
|
287
318
|
}
|
|
288
319
|
};
|
|
289
320
|
|
|
@@ -299,7 +330,7 @@
|
|
|
299
330
|
|
|
300
331
|
barWidth = base.clientWidth;
|
|
301
332
|
({ valueList, positionList } = getSliderSteps({ min, max, step, barWidth }));
|
|
302
|
-
|
|
333
|
+
updatePositions();
|
|
303
334
|
};
|
|
304
335
|
|
|
305
336
|
onMount(() => {
|
|
@@ -323,7 +354,7 @@
|
|
|
323
354
|
$effect(() => {
|
|
324
355
|
void value;
|
|
325
356
|
void values;
|
|
326
|
-
|
|
357
|
+
updatePositions();
|
|
327
358
|
});
|
|
328
359
|
</script>
|
|
329
360
|
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
@see https://w3c.github.io/aria/#cell
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
|
+
import TablePart from './table-part.svelte';
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* @import { Snippet } from 'svelte';
|
|
10
12
|
*/
|
|
@@ -20,17 +22,9 @@
|
|
|
20
22
|
*/
|
|
21
23
|
let {
|
|
22
24
|
/* eslint-disable prefer-const */
|
|
23
|
-
class: className,
|
|
24
|
-
children,
|
|
25
25
|
...restProps
|
|
26
26
|
/* eslint-enable prefer-const */
|
|
27
27
|
} = $props();
|
|
28
28
|
</script>
|
|
29
29
|
|
|
30
|
-
<
|
|
31
|
-
{@render children?.()}
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
<style>.table-cell {
|
|
35
|
-
display: table-cell;
|
|
36
|
-
}</style>
|
|
30
|
+
<TablePart {...restProps} role="cell" kind="table-cell" />
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
@see https://w3c.github.io/aria/#columnheader
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
|
+
import TablePart from './table-part.svelte';
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* @import { Snippet } from 'svelte';
|
|
10
12
|
*/
|
|
@@ -20,17 +22,9 @@
|
|
|
20
22
|
*/
|
|
21
23
|
let {
|
|
22
24
|
/* eslint-disable prefer-const */
|
|
23
|
-
class: className,
|
|
24
|
-
children,
|
|
25
25
|
...restProps
|
|
26
26
|
/* eslint-enable prefer-const */
|
|
27
27
|
} = $props();
|
|
28
28
|
</script>
|
|
29
29
|
|
|
30
|
-
<
|
|
31
|
-
{@render children?.()}
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
<style>.table-col-header {
|
|
35
|
-
display: table-cell;
|
|
36
|
-
}</style>
|
|
30
|
+
<TablePart {...restProps} role="columnheader" kind="table-col-header" />
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
8
|
import { _ } from '@sveltia/i18n';
|
|
9
|
+
import TablePart from './table-part.svelte';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* @import { Snippet } from 'svelte';
|
|
@@ -22,22 +23,14 @@
|
|
|
22
23
|
*/
|
|
23
24
|
let {
|
|
24
25
|
/* eslint-disable prefer-const */
|
|
25
|
-
class: className,
|
|
26
|
-
children,
|
|
27
26
|
...restProps
|
|
28
27
|
/* eslint-enable prefer-const */
|
|
29
28
|
} = $props();
|
|
30
29
|
</script>
|
|
31
30
|
|
|
32
|
-
<
|
|
31
|
+
<TablePart
|
|
33
32
|
{...restProps}
|
|
34
33
|
role="rowgroup"
|
|
35
|
-
|
|
34
|
+
kind="table-foot"
|
|
36
35
|
aria-roledescription={_('_sui.role_descriptions.table_foot')}
|
|
37
|
-
|
|
38
|
-
{@render children?.()}
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<style>.table-foot {
|
|
42
|
-
display: table-footer-group;
|
|
43
|
-
}</style>
|
|
36
|
+
/>
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
8
|
import { _ } from '@sveltia/i18n';
|
|
9
|
+
import TablePart from './table-part.svelte';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* @import { Snippet } from 'svelte';
|
|
@@ -22,22 +23,14 @@
|
|
|
22
23
|
*/
|
|
23
24
|
let {
|
|
24
25
|
/* eslint-disable prefer-const */
|
|
25
|
-
class: className,
|
|
26
|
-
children,
|
|
27
26
|
...restProps
|
|
28
27
|
/* eslint-enable prefer-const */
|
|
29
28
|
} = $props();
|
|
30
29
|
</script>
|
|
31
30
|
|
|
32
|
-
<
|
|
31
|
+
<TablePart
|
|
33
32
|
{...restProps}
|
|
34
33
|
role="rowgroup"
|
|
35
|
-
|
|
34
|
+
kind="table-head"
|
|
36
35
|
aria-roledescription={_('_sui.role_descriptions.table_head')}
|
|
37
|
-
|
|
38
|
-
{@render children?.()}
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<style>.table-head {
|
|
42
|
-
display: table-header-group;
|
|
43
|
-
}</style>
|
|
36
|
+
/>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
The row group, row or cell behind the leaf components of `<Table>` and `<Grid>`, which only differ
|
|
4
|
+
in their role, class name and `display`. Internal; not exported.
|
|
5
|
+
-->
|
|
6
|
+
<script>
|
|
7
|
+
/**
|
|
8
|
+
* @import { Snippet } from 'svelte';
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {'head' | 'foot' | 'row' | 'col-header' | 'row-header' | 'cell'} PartName
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {object} Props
|
|
17
|
+
* @property {string} role The `role` attribute on the wrapper element.
|
|
18
|
+
* @property {`table-${PartName}` | `grid-${PartName}`} kind The component class name, which also
|
|
19
|
+
* determines the `display` style.
|
|
20
|
+
* @property {string} [class] The `class` attribute on the wrapper element.
|
|
21
|
+
* @property {Snippet} [children] Primary slot content.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @type {Props & Record<string, any>}
|
|
26
|
+
*/
|
|
27
|
+
let {
|
|
28
|
+
/* eslint-disable prefer-const */
|
|
29
|
+
role,
|
|
30
|
+
kind,
|
|
31
|
+
class: className,
|
|
32
|
+
children,
|
|
33
|
+
...restProps
|
|
34
|
+
/* eslint-enable prefer-const */
|
|
35
|
+
} = $props();
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<div {...restProps} {role} class="sui {kind} {className}">
|
|
39
|
+
{@render children?.()}
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<style>.table-head,
|
|
43
|
+
.grid-head {
|
|
44
|
+
display: table-header-group;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.table-foot,
|
|
48
|
+
.grid-foot {
|
|
49
|
+
display: table-footer-group;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.table-row,
|
|
53
|
+
.grid-row {
|
|
54
|
+
display: table-row;
|
|
55
|
+
height: var(--sui-primary-row-height);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.table-col-header,
|
|
59
|
+
.grid-col-header,
|
|
60
|
+
.table-cell,
|
|
61
|
+
.grid-cell {
|
|
62
|
+
display: table-cell;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.table-row-header,
|
|
66
|
+
.grid-row-header {
|
|
67
|
+
display: table-cell;
|
|
68
|
+
height: var(--sui-secondary-row-height);
|
|
69
|
+
}</style>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export default TablePart;
|
|
2
|
+
type TablePart = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Props & Record<string, any>>): void;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* The row group, row or cell behind the leaf components of `<Table>` and `<Grid>`, which only differ
|
|
8
|
+
* in their role, class name and `display`. Internal; not exported.
|
|
9
|
+
*/
|
|
10
|
+
declare const TablePart: import("svelte").Component<{
|
|
11
|
+
/**
|
|
12
|
+
* The `role` attribute on the wrapper element.
|
|
13
|
+
*/
|
|
14
|
+
role: string;
|
|
15
|
+
/**
|
|
16
|
+
* The component class name, which also
|
|
17
|
+
* determines the `display` style.
|
|
18
|
+
*/
|
|
19
|
+
kind: `table-${"head" | "row" | "foot" | "col-header" | "row-header" | "cell"}` | `grid-${"head" | "row" | "foot" | "col-header" | "row-header" | "cell"}`;
|
|
20
|
+
/**
|
|
21
|
+
* The `class` attribute on the wrapper element.
|
|
22
|
+
*/
|
|
23
|
+
class?: string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Primary slot content.
|
|
26
|
+
*/
|
|
27
|
+
children?: Snippet<[]> | undefined;
|
|
28
|
+
} & Record<string, any>, {}, "">;
|
|
29
|
+
type Props = {
|
|
30
|
+
/**
|
|
31
|
+
* The `role` attribute on the wrapper element.
|
|
32
|
+
*/
|
|
33
|
+
role: string;
|
|
34
|
+
/**
|
|
35
|
+
* The component class name, which also
|
|
36
|
+
* determines the `display` style.
|
|
37
|
+
*/
|
|
38
|
+
kind: `table-${"head" | "row" | "foot" | "col-header" | "row-header" | "cell"}` | `grid-${"head" | "row" | "foot" | "col-header" | "row-header" | "cell"}`;
|
|
39
|
+
/**
|
|
40
|
+
* The `class` attribute on the wrapper element.
|
|
41
|
+
*/
|
|
42
|
+
class?: string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Primary slot content.
|
|
45
|
+
*/
|
|
46
|
+
children?: Snippet<[]> | undefined;
|
|
47
|
+
};
|
|
48
|
+
import type { Snippet } from 'svelte';
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
@see https://w3c.github.io/aria/#rowheader
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
|
+
import TablePart from './table-part.svelte';
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* @import { Snippet } from 'svelte';
|
|
10
12
|
*/
|
|
@@ -20,18 +22,9 @@
|
|
|
20
22
|
*/
|
|
21
23
|
let {
|
|
22
24
|
/* eslint-disable prefer-const */
|
|
23
|
-
class: className,
|
|
24
|
-
children,
|
|
25
25
|
...restProps
|
|
26
26
|
/* eslint-enable prefer-const */
|
|
27
27
|
} = $props();
|
|
28
28
|
</script>
|
|
29
29
|
|
|
30
|
-
<
|
|
31
|
-
{@render children?.()}
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
<style>.table-row-header {
|
|
35
|
-
display: table-cell;
|
|
36
|
-
height: var(--sui-secondary-row-height);
|
|
37
|
-
}</style>
|
|
30
|
+
<TablePart {...restProps} role="rowheader" kind="table-row-header" />
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
@see https://w3c.github.io/aria/#row
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
|
+
import TablePart from './table-part.svelte';
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* @import { Snippet } from 'svelte';
|
|
10
12
|
*/
|
|
@@ -20,18 +22,9 @@
|
|
|
20
22
|
*/
|
|
21
23
|
let {
|
|
22
24
|
/* eslint-disable prefer-const */
|
|
23
|
-
class: className,
|
|
24
|
-
children,
|
|
25
25
|
...restProps
|
|
26
26
|
/* eslint-enable prefer-const */
|
|
27
27
|
} = $props();
|
|
28
28
|
</script>
|
|
29
29
|
|
|
30
|
-
<
|
|
31
|
-
{@render children?.()}
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
<style>.table-row {
|
|
35
|
-
display: table-row;
|
|
36
|
-
height: var(--sui-primary-row-height);
|
|
37
|
-
}</style>
|
|
30
|
+
<TablePart {...restProps} role="row" kind="table-row" />
|
|
@@ -73,10 +73,22 @@
|
|
|
73
73
|
updateIndicator();
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
+
// A tab can also be selected from code through its `selected` prop, which doesn’t go through
|
|
77
|
+
// the `Change` event below
|
|
78
|
+
const selectionObserver = new MutationObserver(() => {
|
|
79
|
+
updateIndicator();
|
|
80
|
+
});
|
|
81
|
+
|
|
76
82
|
observer.observe(/** @type {HTMLElement} */ (wrapper));
|
|
83
|
+
selectionObserver.observe(/** @type {HTMLElement} */ (wrapper), {
|
|
84
|
+
subtree: true,
|
|
85
|
+
attributes: true,
|
|
86
|
+
attributeFilter: ['aria-selected'],
|
|
87
|
+
});
|
|
77
88
|
|
|
78
89
|
return () => {
|
|
79
90
|
observer.disconnect();
|
|
91
|
+
selectionObserver.disconnect();
|
|
80
92
|
};
|
|
81
93
|
});
|
|
82
94
|
</script>
|
|
@@ -8,7 +8,7 @@ type Tab = {
|
|
|
8
8
|
* @see https://w3c.github.io/aria/#tab
|
|
9
9
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/tabs/
|
|
10
10
|
*/
|
|
11
|
-
declare const Tab: import("svelte").Component<ButtonProps & import("../../typedefs").KeyboardEventHandlers & import("../../typedefs").MouseEventHandlers & import("../../typedefs").PointerEventHandlers & import("../../typedefs").FocusEventHandlers & import("../../typedefs").DragEventHandlers & {
|
|
11
|
+
declare const Tab: import("svelte").Component<ButtonProps & import("../../typedefs.js").KeyboardEventHandlers & import("../../typedefs.js").MouseEventHandlers & import("../../typedefs.js").PointerEventHandlers & import("../../typedefs.js").FocusEventHandlers & import("../../typedefs.js").DragEventHandlers & {
|
|
12
12
|
/**
|
|
13
13
|
* Whether to select the widget. An alias of the `aria-selected`
|
|
14
14
|
* attribute.
|
|
@@ -22,4 +22,4 @@ type Props = {
|
|
|
22
22
|
*/
|
|
23
23
|
selected?: boolean | undefined;
|
|
24
24
|
};
|
|
25
|
-
import type { ButtonProps } from '../../typedefs';
|
|
25
|
+
import type { ButtonProps } from '../../typedefs.js';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* TextEditorFormatType,
|
|
7
7
|
* TextEditorInlineType,
|
|
8
8
|
* TextEditorNodeType,
|
|
9
|
-
* } from '../../typedefs';
|
|
9
|
+
* } from '../../typedefs.js';
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
12
|
* @type {EditorThemeClasses}
|
|
@@ -62,8 +62,8 @@ export const DISABLED_MARKDOWN_TAGS: string[];
|
|
|
62
62
|
*/
|
|
63
63
|
export const IMPORT_UPDATE_TAG: "sui-import";
|
|
64
64
|
import type { EditorThemeClasses } from 'lexical';
|
|
65
|
-
import type { TextEditorFormatType } from '../../typedefs';
|
|
66
|
-
import type { TextEditorInlineType } from '../../typedefs';
|
|
67
|
-
import type { TextEditorBlockType } from '../../typedefs';
|
|
68
|
-
import type { TextEditorNodeType } from '../../typedefs';
|
|
65
|
+
import type { TextEditorFormatType } from '../../typedefs.js';
|
|
66
|
+
import type { TextEditorInlineType } from '../../typedefs.js';
|
|
67
|
+
import type { TextEditorBlockType } from '../../typedefs.js';
|
|
68
|
+
import type { TextEditorNodeType } from '../../typedefs.js';
|
|
69
69
|
import type { Transformer } from '@lexical/markdown';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export function isStaticDecoratorContent(target: EventTarget | null): boolean;
|
|
2
|
-
export function $moveCaretIntoBlock(): boolean;
|
|
3
2
|
export function handleEditorMouseDown(editor: LexicalEditor, event: MouseEvent): boolean;
|
|
4
3
|
export function isSafeLinkURL(url: string): boolean;
|
|
5
4
|
export function getSelectionTypes(): TextEditorSelectionState;
|
|
@@ -8,7 +7,7 @@ export function onEditorUpdate(editor: LexicalEditor, enabledTransformers: Trans
|
|
|
8
7
|
export function getComponentMarkdown({ node, createNode, transformer, createMarkdown }: TextEditorComponent): string;
|
|
9
8
|
export function initEditor({ enabledButtons, components, useMarkdownShortcuts, isCodeEditor, defaultLanguage, }: TextEditorConfig): InitEditorResult;
|
|
10
9
|
export function loadCodeHighlighter(lang: string): Promise<void>;
|
|
11
|
-
export function convertMarkdownToLexical(editor: LexicalEditor, value: string, enabledTransformers: Transformer[]): Promise<string>;
|
|
10
|
+
export function convertMarkdownToLexical(editor: LexicalEditor, value: string, enabledTransformers: Transformer[]): Promise<string | undefined>;
|
|
12
11
|
export function focusEditor(editor: LexicalEditor): Promise<void>;
|
|
13
12
|
export type InitEditorResult = {
|
|
14
13
|
/**
|
|
@@ -25,7 +24,7 @@ export type InitEditorResult = {
|
|
|
25
24
|
dispose: () => void;
|
|
26
25
|
};
|
|
27
26
|
import type { LexicalEditor } from 'lexical';
|
|
28
|
-
import type { TextEditorSelectionState } from '../../typedefs';
|
|
27
|
+
import type { TextEditorSelectionState } from '../../typedefs.js';
|
|
29
28
|
import type { Transformer } from '@lexical/markdown';
|
|
30
|
-
import type { TextEditorComponent } from '../../typedefs';
|
|
31
|
-
import type { TextEditorConfig } from '../../typedefs';
|
|
29
|
+
import type { TextEditorComponent } from '../../typedefs.js';
|
|
30
|
+
import type { TextEditorConfig } from '../../typedefs.js';
|