@sveltia/ui 0.11.0 → 0.11.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.
|
@@ -11,7 +11,7 @@ export default class Drawer extends SvelteComponent<{
|
|
|
11
11
|
class?: string | undefined;
|
|
12
12
|
title?: string | undefined;
|
|
13
13
|
size?: "small" | "medium" | "large" | "x-large" | "full" | undefined;
|
|
14
|
-
position?: "top" | "
|
|
14
|
+
position?: "top" | "left" | "right" | "bottom" | undefined;
|
|
15
15
|
open?: boolean | undefined;
|
|
16
16
|
lightDismiss?: boolean | undefined;
|
|
17
17
|
keepContent?: boolean | undefined;
|
|
@@ -48,7 +48,7 @@ declare const __propDef: {
|
|
|
48
48
|
class?: string | undefined;
|
|
49
49
|
title?: string | undefined;
|
|
50
50
|
size?: "small" | "medium" | "large" | "x-large" | "full" | undefined;
|
|
51
|
-
position?: "top" | "
|
|
51
|
+
position?: "top" | "left" | "right" | "bottom" | undefined;
|
|
52
52
|
open?: boolean | undefined;
|
|
53
53
|
lightDismiss?: boolean | undefined;
|
|
54
54
|
keepContent?: boolean | undefined;
|
|
@@ -172,6 +172,8 @@
|
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
event.stopPropagation();
|
|
176
|
+
|
|
175
177
|
moveThumb(startX + (screenX - startScreenX));
|
|
176
178
|
};
|
|
177
179
|
|
|
@@ -186,6 +188,13 @@
|
|
|
186
188
|
return;
|
|
187
189
|
}
|
|
188
190
|
|
|
191
|
+
event.stopPropagation();
|
|
192
|
+
|
|
193
|
+
// Handle a click on the bars
|
|
194
|
+
if (/** @type {HTMLElement} */ (event.target).matches('.base-bar, .slider-bar')) {
|
|
195
|
+
moveThumb(/** @type {any} */ (event).layerX);
|
|
196
|
+
}
|
|
197
|
+
|
|
189
198
|
// Reset everything
|
|
190
199
|
dragging = false;
|
|
191
200
|
startX = 0;
|
|
@@ -211,6 +220,8 @@
|
|
|
211
220
|
return;
|
|
212
221
|
}
|
|
213
222
|
|
|
223
|
+
event.stopPropagation();
|
|
224
|
+
|
|
214
225
|
dragging = true;
|
|
215
226
|
startX = clientX - /** @type {HTMLElement} */ (base).getBoundingClientRect().x;
|
|
216
227
|
startScreenX = screenX;
|
|
@@ -222,18 +233,6 @@
|
|
|
222
233
|
document.addEventListener('pointercancel', onPointerUp);
|
|
223
234
|
};
|
|
224
235
|
|
|
225
|
-
/**
|
|
226
|
-
* Handle the `click` event fired on the slider.
|
|
227
|
-
* @param {MouseEvent} event - `click` event.
|
|
228
|
-
*/
|
|
229
|
-
const onClick = (event) => {
|
|
230
|
-
if (disabled || readonly || multiThumb || dragging) {
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
moveThumb(/** @type {any} */ (event).layerX);
|
|
235
|
-
};
|
|
236
|
-
|
|
237
236
|
/**
|
|
238
237
|
* Update the thumb position and fire the `change` event when the value is changed.
|
|
239
238
|
*/
|
|
@@ -303,14 +302,8 @@
|
|
|
303
302
|
class:readonly
|
|
304
303
|
hidden={hidden || undefined}
|
|
305
304
|
{...$$restProps}
|
|
306
|
-
on:click|preventDefault|stopPropagation
|
|
307
305
|
>
|
|
308
|
-
<div
|
|
309
|
-
role="none"
|
|
310
|
-
class="base"
|
|
311
|
-
bind:this={base}
|
|
312
|
-
on:click|preventDefault|stopPropagation={(event) => onClick(event)}
|
|
313
|
-
>
|
|
306
|
+
<div role="none" class="base" bind:this={base} on:pointerdown={(event) => onPointerDown(event)}>
|
|
314
307
|
<div role="none" class="base-bar" />
|
|
315
308
|
<div
|
|
316
309
|
class="slider-bar"
|
|
@@ -25,7 +25,6 @@ export default class Slider extends SvelteComponent<{
|
|
|
25
25
|
sliderLabels?: [string, string] | undefined;
|
|
26
26
|
optionLabels?: string[] | number[] | undefined;
|
|
27
27
|
}, {
|
|
28
|
-
click: MouseEvent;
|
|
29
28
|
change: CustomEvent<any>;
|
|
30
29
|
} & {
|
|
31
30
|
[evt: string]: CustomEvent<any>;
|
|
@@ -53,7 +52,6 @@ declare const __propDef: {
|
|
|
53
52
|
optionLabels?: string[] | number[] | undefined;
|
|
54
53
|
};
|
|
55
54
|
events: {
|
|
56
|
-
click: MouseEvent;
|
|
57
55
|
change: CustomEvent<any>;
|
|
58
56
|
} & {
|
|
59
57
|
[evt: string]: CustomEvent<any>;
|
|
@@ -14,7 +14,8 @@ export const isMac = () =>
|
|
|
14
14
|
* @see https://w3c.github.io/aria/#aria-keyshortcuts
|
|
15
15
|
*/
|
|
16
16
|
export const matchShortcuts = (event, shortcuts) => {
|
|
17
|
-
const { ctrlKey, metaKey, altKey, shiftKey,
|
|
17
|
+
const { ctrlKey, metaKey, altKey, shiftKey, code } = event;
|
|
18
|
+
const key = code.replace(/^(?:Digit|Key)(.)$/, '$1');
|
|
18
19
|
|
|
19
20
|
return shortcuts.split(/\s+/).some((shortcut) => {
|
|
20
21
|
const keys = shortcut.split('+');
|
|
@@ -62,13 +63,14 @@ export const activateKeyShortcuts = (element, shortcuts = '') => {
|
|
|
62
63
|
* @param {KeyboardEvent} event - `keydown` event.
|
|
63
64
|
*/
|
|
64
65
|
const handler = (event) => {
|
|
65
|
-
const { disabled, offsetParent
|
|
66
|
+
const { disabled, offsetParent } = element;
|
|
67
|
+
const { top, left } = element.getBoundingClientRect();
|
|
66
68
|
|
|
67
69
|
// Check if the element is enabled, visible and clickable (not behind a modal dialog)
|
|
68
70
|
if (
|
|
69
71
|
!disabled &&
|
|
70
72
|
!!offsetParent &&
|
|
71
|
-
document.elementsFromPoint(
|
|
73
|
+
document.elementsFromPoint(left + 4, top + 4).includes(element) &&
|
|
72
74
|
matchShortcuts(event, /** @type {string} */ (platformKeyShortcuts))
|
|
73
75
|
) {
|
|
74
76
|
event.preventDefault();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltia/ui",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -23,27 +23,27 @@
|
|
|
23
23
|
"test:unit": "vitest"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"svelte": "^4.2.
|
|
26
|
+
"svelte": "^4.2.14"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@playwright/test": "^1.43.
|
|
29
|
+
"@playwright/test": "^1.43.1",
|
|
30
30
|
"@sveltejs/adapter-auto": "^3.2.0",
|
|
31
31
|
"@sveltejs/kit": "^2.5.5",
|
|
32
32
|
"@sveltejs/package": "^2.3.1",
|
|
33
|
-
"@sveltejs/vite-plugin-svelte": "^3.0
|
|
34
|
-
"cspell": "^8.
|
|
33
|
+
"@sveltejs/vite-plugin-svelte": "^3.1.0",
|
|
34
|
+
"cspell": "^8.7.0",
|
|
35
35
|
"eslint": "^8.57.0",
|
|
36
36
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
37
37
|
"eslint-config-prettier": "^9.1.0",
|
|
38
38
|
"eslint-plugin-import": "^2.29.1",
|
|
39
39
|
"eslint-plugin-jsdoc": "^48.2.3",
|
|
40
|
-
"eslint-plugin-svelte": "^2.
|
|
40
|
+
"eslint-plugin-svelte": "^2.37.0",
|
|
41
41
|
"npm-run-all": "^4.1.5",
|
|
42
42
|
"postcss": "^8.4.38",
|
|
43
43
|
"postcss-html": "^1.6.0",
|
|
44
44
|
"prettier": "^3.2.5",
|
|
45
|
-
"prettier-plugin-svelte": "^3.2.
|
|
46
|
-
"sass": "^1.
|
|
45
|
+
"prettier-plugin-svelte": "^3.2.3",
|
|
46
|
+
"sass": "^1.75.0",
|
|
47
47
|
"stylelint": "^16.3.1",
|
|
48
48
|
"stylelint-config-recommended-scss": "^14.0.0",
|
|
49
49
|
"stylelint-scss": "^6.2.1",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"svelte-preprocess": "^5.1.3",
|
|
53
53
|
"tslib": "^2.6.2",
|
|
54
54
|
"vite": "^5.2.8",
|
|
55
|
-
"vitest": "^1.
|
|
55
|
+
"vitest": "^1.5.0"
|
|
56
56
|
},
|
|
57
57
|
"exports": {
|
|
58
58
|
"./package.json": "./package.json",
|