@marianmeres/stuic 1.10.0 → 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.
@@ -4,9 +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();
9
- export let enabled = true;
10
+ export let enabled = DevicePointer.isFine;
10
11
  export let shadowOpacity = 0.5;
11
12
  export let duration = 150;
12
13
  export let targetWidth = 256;
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,5 @@
1
+ export declare class DevicePointer {
2
+ static readonly isNone: boolean;
3
+ static readonly isCoarse: boolean;
4
+ static readonly isFine: boolean;
5
+ }
@@ -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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",