2022-08-11 12:38:08 +00:00
|
|
|
//@ts-check
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a helper to add or remove global classes that begin with `is-`
|
|
|
|
* @param {string} name
|
|
|
|
*/
|
|
|
|
export const documentMode = (name) => ({
|
|
|
|
on: () => document.body.classList.add(`is-${name}`),
|
|
|
|
off: () => document.body.classList.remove(`is-${name}`),
|
|
|
|
toggle: () => document.body.classList.toggle(`is-${name}`),
|
2023-05-09 02:00:53 +00:00
|
|
|
has: () => document.body.classList.contains(`is-${name}`),
|
2022-08-11 12:38:08 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
export default documentMode;
|