refactor(toolkit): type source any with proper types
Genuinely type composable any usages (useStepper/useStorage/useForm/ createEventHook/useSorted/etc.) as proper generics/unknown; keep idiomatic any-function and overload-impl signatures with comments; skipped test -> .todo.
This commit is contained in:
@@ -5,6 +5,7 @@ import { defaultWindow } from '@/types';
|
||||
import type { ConfigurableWindow } from '@/types';
|
||||
import { useSupported } from '@/composables/utilities/useSupported';
|
||||
import { useEventListener } from '@/composables/browser/useEventListener';
|
||||
import { pxValue } from '@robonen/platform/browsers';
|
||||
|
||||
export interface UseMediaQueryOptions extends ConfigurableWindow {
|
||||
/**
|
||||
@@ -20,22 +21,6 @@ export interface UseMediaQueryOptions extends ConfigurableWindow {
|
||||
ssrWidth?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a CSS length token (e.g. `"1024px"`, `"48em"`, `"30rem"`) to pixels.
|
||||
* Falls back to treating `em`/`rem` as the conventional 16px root size.
|
||||
*/
|
||||
function pxValue(value: string): number {
|
||||
const number = Number.parseFloat(value);
|
||||
|
||||
if (Number.isNaN(number))
|
||||
return Number.NaN;
|
||||
|
||||
if (/(?:em|rem)\s*$/i.test(value))
|
||||
return number * 16;
|
||||
|
||||
return number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Best-effort evaluation of `min-width` / `max-width` media queries against a
|
||||
* known viewport width, for SSR. Comma-separated queries are OR-combined and
|
||||
|
||||
Reference in New Issue
Block a user