@marianmeres/stuic 1.9.1 → 1.11.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/HoverExpandableWidth/HoverExpandableWidth.svelte +6 -0
- package/dist/components/HoverExpandableWidth/HoverExpandableWidth.svelte.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/utils/device-pointer.d.ts +5 -0
- package/dist/utils/device-pointer.js +9 -0
- package/package.json +1 -1
|
@@ -4,8 +4,10 @@ import { get } from "svelte/store";
|
|
|
4
4
|
import { twMerge } from "tailwind-merge";
|
|
5
5
|
import { prefersReducedMotionStore } from "../../utils/prefers-reduced-motion.js";
|
|
6
6
|
import { windowSize } from "../../utils/window-size.js";
|
|
7
|
+
import { DevicePointer } from "../../index.js";
|
|
7
8
|
const clog = createClog("HoverExpandableWidth");
|
|
8
9
|
const dispatch = createEventDispatcher();
|
|
10
|
+
export let enabled = DevicePointer.isFine;
|
|
9
11
|
export let shadowOpacity = 0.5;
|
|
10
12
|
export let duration = 150;
|
|
11
13
|
export let targetWidth = 256;
|
|
@@ -32,6 +34,8 @@ const _planDelayedExec = (_fn, _delay) => {
|
|
|
32
34
|
}, _delay);
|
|
33
35
|
};
|
|
34
36
|
const _expand = () => {
|
|
37
|
+
if (!enabled)
|
|
38
|
+
return;
|
|
35
39
|
if (_isExpanding || _isShrinking || _isExpanded)
|
|
36
40
|
return;
|
|
37
41
|
_isExpanded = true;
|
|
@@ -71,6 +75,8 @@ const _expand = () => {
|
|
|
71
75
|
});
|
|
72
76
|
};
|
|
73
77
|
const _shrink = () => {
|
|
78
|
+
if (!enabled)
|
|
79
|
+
return;
|
|
74
80
|
if (_isExpanding || _isShrinking || !_isExpanded)
|
|
75
81
|
return;
|
|
76
82
|
_isExpanded = false;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ export { default as Drawer, createDrawerStore } from './components/Drawer/Drawer
|
|
|
8
8
|
export { default as HoverExpandableWidth } from './components/HoverExpandableWidth/HoverExpandableWidth.svelte';
|
|
9
9
|
export { default as X } from './components/X/X.svelte';
|
|
10
10
|
export { windowSize, breakpoint } from './utils/window-size.js';
|
|
11
|
+
export { DevicePointer } from './utils/device-pointer.js';
|
package/dist/index.js
CHANGED
|
@@ -15,5 +15,6 @@ export { default as Drawer, createDrawerStore } from './components/Drawer/Drawer
|
|
|
15
15
|
export { default as HoverExpandableWidth } from './components/HoverExpandableWidth/HoverExpandableWidth.svelte';
|
|
16
16
|
//
|
|
17
17
|
export { default as X } from './components/X/X.svelte';
|
|
18
|
-
//
|
|
18
|
+
// utils
|
|
19
19
|
export { windowSize, breakpoint } from './utils/window-size.js';
|
|
20
|
+
export { DevicePointer } from './utils/device-pointer.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export class DevicePointer {
|
|
2
|
+
// none - The primary input mechanism does not include a pointing device.
|
|
3
|
+
static isNone = window?.matchMedia('(any-pointer:none)').matches;
|
|
4
|
+
// coarse - The primary input mechanism includes a pointing device of limited accuracy,
|
|
5
|
+
// such as a finger on a touchscreen.
|
|
6
|
+
static isCoarse = window?.matchMedia('(any-pointer:coarse)').matches;
|
|
7
|
+
// fine - The primary input mechanism includes an accurate pointing device, such as a mouse.
|
|
8
|
+
static isFine = window?.matchMedia('(any-pointer:fine)').matches;
|
|
9
|
+
}
|