-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ef9937
commit 3865796
Showing
8 changed files
with
20 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export { mql } from './mql'; | ||
export { nav_open, on_this_page_open, overlay_open, should_nav_autohide } from './nav'; | ||
export { reduced_motion } from './reduced-motion'; | ||
export { search_query, search_recent, searching } from './search'; | ||
export { theme } from './theme'; |
11 changes: 4 additions & 7 deletions
11
packages/site-kit/src/lib/stores/mql.js → packages/site-kit/src/lib/stores/mql.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,16 @@ | ||
import { browser } from '$app/environment'; | ||
import { readable } from 'svelte/store'; | ||
|
||
/** | ||
* @param {string} query | ||
*/ | ||
export const mql = (query) => | ||
readable(browser ? window.matchMedia(query).matches : false, (set) => { | ||
export function mql(query: string) { | ||
return readable(browser ? window.matchMedia(query).matches : false, (set) => { | ||
if (!browser) return set(false); | ||
|
||
const mediaQueryList = window.matchMedia(query); | ||
|
||
/** @param {MediaQueryListEvent} event */ | ||
const listener = (event) => set(event.matches); | ||
const listener = (event: MediaQueryListEvent) => set(event.matches); | ||
|
||
mediaQueryList.addEventListener('change', listener); | ||
|
||
return () => mediaQueryList.removeEventListener('change', listener); | ||
}); | ||
} |
File renamed without changes.
1 change: 0 additions & 1 deletion
1
...site-kit/src/lib/stores/reduced-motion.js → ...site-kit/src/lib/stores/reduced-motion.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import { mql } from './mql'; | ||
|
||
/** @type {import('svelte/store').Readable<boolean>} */ | ||
export const reduced_motion = mql('(prefers-reduced-motion: reduce)'); |
10 changes: 5 additions & 5 deletions
10
packages/site-kit/src/lib/stores/theme.js → packages/site-kit/src/lib/stores/theme.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters