diff --git a/src/lib/components/Search.svelte b/src/lib/components/Search.svelte index 722ea9dbe3..13fd6b5f50 100644 --- a/src/lib/components/Search.svelte +++ b/src/lib/components/Search.svelte @@ -2,6 +2,7 @@ import { afterNavigate, goto } from '$app/navigation'; import { layoutState } from '$lib/layouts/Docs.svelte'; import { isMac } from '$lib/utils/platform'; + import { createCombobox, melt } from '@melt-ui/svelte'; import { MeiliSearch, type Hit, type Hits } from 'meilisearch'; diff --git a/src/lib/utils/persisted.ts b/src/lib/utils/persisted.ts index 23a45e9353..ff84b40192 100644 --- a/src/lib/utils/persisted.ts +++ b/src/lib/utils/persisted.ts @@ -10,7 +10,7 @@ const localStorageAdapter: Adapter = { if (typeof window === 'undefined') return undefined; const value = localStorage.getItem(key); - console.log(key, value); + if (value === null) { return undefined; } @@ -35,7 +35,7 @@ export const persisted = ( ) => { const localValue = adapter.get(key); let initialValue: Value | undefined = defaultValue; - console.log({ localValue, initialValue, validated: validate(localValue) }); + if (validate(localValue)) { initialValue = localValue; } @@ -54,7 +54,6 @@ export const persisted = ( }; const set: typeof store.set = (v) => { - console.log('set', v); update(() => v); }; diff --git a/src/lib/utils/platform.ts b/src/lib/utils/platform.ts index faf78229af..f9ea778b49 100644 --- a/src/lib/utils/platform.ts +++ b/src/lib/utils/platform.ts @@ -2,14 +2,14 @@ export const isDom = () => typeof window !== 'undefined'; export function getPlatform() { // eslint-disable-next-line @typescript-eslint/no-explicit-any const agent = (navigator as any).userAgentData; - return agent?.platform ?? navigator.platform; + return (agent?.platform ?? navigator.platform) as string; } -const pt = (v: RegExp) => isDom() && v.test(getPlatform()); +const pt = (v: RegExp) => isDom() && v.test(getPlatform().toLowerCase()); const ua = (v: RegExp) => isDom() && v.test(navigator.userAgent); const vn = (v: RegExp) => isDom() && v.test(navigator.vendor); export const isTouchDevice = () => isDom() && !!navigator.maxTouchPoints; -export const isMac = () => pt(/^Mac/) && !isTouchDevice(); -export const isIPhone = () => pt(/^iPhone/); +export const isMac = () => pt(/^mac/) && !isTouchDevice(); +export const isIPhone = () => pt(/^iphone/); export const isSafari = () => isApple() && vn(/apple/i); export const isFirefox = () => ua(/firefox\//i); export const isApple = () => pt(/mac|iphone|ipad|ipod/i);