| "use strict";var a=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var g=(e,t)=>{for(var r in t)a(e,r,{get:t[r],enumerable:!0})},k=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of u(t))!f.call(e,n)&&n!==r&&a(e,n,{get:()=>t[n],enumerable:!(i=h(t,n))||i.enumerable});return e};var T=e=>k(a({},"__esModule",{value:!0}),e);var E={};g(E,{setTheme:()=>s,setupTheme:()=>v});module.exports=T(E);var c="theme",m="themeSet",l=window.matchMedia("(prefers-color-scheme: dark)");function v(){o(),!d()&&(window.addEventListener("storage",e=>{e.key===c&&o()}),document.addEventListener(m,o),l.addEventListener("change",({matches:e})=>{s(e?"dark":"light")}))}function s(e){d()||(localStorage.setItem(c,e),document.dispatchEvent(new Event(m)))}function o(){let e=p();document.documentElement.classList[e==="dark"?"add":"remove"]("dark")}function p(){if(d())return"light";let e=localStorage.getItem(c);if(e&&(e==="light"||e==="dark"))return e;let t="light";return l.matches&&(t="dark"),s(t),t}function d(){return typeof localStorage>"u"} |
| type Theme = 'light' | 'dark'; | ||
| declare function setupTheme(): void; | ||
| declare function setTheme(theme: Theme): void; | ||
| export { setTheme, setupTheme }; |
| type Theme = 'light' | 'dark'; | ||
| declare function setupTheme(): void; | ||
| declare function setTheme(theme: Theme): void; | ||
| export { setTheme, setupTheme }; |
| var r="theme",o="themeSet",c=window.matchMedia("(prefers-color-scheme: dark)");function i(){n(),!a()&&(window.addEventListener("storage",e=>{e.key===r&&n()}),document.addEventListener(o,n),c.addEventListener("change",({matches:e})=>{s(e?"dark":"light")}))}function s(e){a()||(localStorage.setItem(r,e),document.dispatchEvent(new Event(o)))}function n(){let e=d();document.documentElement.classList[e==="dark"?"add":"remove"]("dark")}function d(){if(a())return"light";let e=localStorage.getItem(r);if(e&&(e==="light"||e==="dark"))return e;let t="light";return c.matches&&(t="dark"),s(t),t}function a(){return typeof localStorage>"u"}export{s as setTheme,i as setupTheme}; |
+39
-6
| { | ||
| "name": "light-dark", | ||
| "version": "0.0.0", | ||
| "version": "0.1.0", | ||
| "type": "module", | ||
| "description": "🔦 Manage light-dark mode with ease", | ||
| "author": "Furkan Emin Can", | ||
| "homepage": "https://github.com/femincan/light-dark#readme", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/femincan/light-dark.git" | ||
| }, | ||
| "bugs": "https://github.com/femincan/light-dark/issues", | ||
| "main": "./dist/index.js", | ||
| "types": "./dist/index.d.ts", | ||
| "exports": { | ||
| ".": { | ||
| "import": { | ||
| "default": "./dist/index.js", | ||
| "types": "./dist/index.d.ts" | ||
| }, | ||
| "require": { | ||
| "default": "./dist/index.cjs", | ||
| "types": "./dist/index.d.cts" | ||
| } | ||
| } | ||
| }, | ||
| "keywords": [ | ||
@@ -17,9 +37,22 @@ "css", | ||
| ], | ||
| "files": [ | ||
| "./dist" | ||
| ], | ||
| "license": "MIT", | ||
| "homepage": "https://github.com/femincan/light-dark#readme", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/femincan/light-dark.git" | ||
| "devDependencies": { | ||
| "@eslint/js": "^8.57.0", | ||
| "@types/eslint__js": "^8.42.3", | ||
| "@types/node": "^20.12.7", | ||
| "eslint": "^8.57.0", | ||
| "prettier": "^3.2.5", | ||
| "tsup": "^8.0.2", | ||
| "typescript": "^5.4.5", | ||
| "typescript-eslint": "^7.7.0" | ||
| }, | ||
| "bugs": "https://github.com/femincan/light-dark/issues" | ||
| "scripts": { | ||
| "build": "tsup", | ||
| "format": "prettier --write --ignore-unknown src", | ||
| "lint": "eslint .", | ||
| "lint:fix": "eslint . --fix" | ||
| } | ||
| } |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
4469
174.68%7
133.33%12
Infinity%0
-100%8
Infinity%3
200%