darkify-js 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022-present Emilio Romero
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2022-present Emilio Romero
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,29 +1,34 @@
1
- # Darkify js
2
- Create an easy dark mode for your site
3
- ## 📦 Installation
4
- ```bash
5
- npm install darkify-js
6
- ```
7
- ## ⚙️ Setup
8
- ```js
9
- import Darkify from 'darkify-js'
10
-
11
- const options = {
12
- autoMatchTheme: true,
13
- }
14
-
15
- // autoMatchTheme: default is true
16
- // useLocalStorage: default is true
17
- // useSessionStorage: default is false
18
- // useColorScheme: default is ['#ffffff', '#000000']
19
-
20
- var darkMode = new Darkify('#element', options)
21
- ```
22
- ### CDN
23
-
24
- ```html
25
- <script src="https://cdn.jsdelivr.net/npm/darkify-js"></script>
26
- ```
27
-
28
- ## Compatibility
29
- [Check browser compatibility](https://caniuse.com/mdn-css_properties_color-scheme)
1
+ # Darkify JS
2
+
3
+ 🌚 A simple dark mode toggle library that makes it easy to implement dark mode on your website without additional configuration
4
+
5
+ > [!NOTE]
6
+ > Please make sure to read the [Wiki] for detailed documentation and examples
7
+
8
+ ### 📦 Installation
9
+
10
+ Use npm or any other package manager:
11
+
12
+ ```bash
13
+ npm install darkify-js
14
+ ```
15
+
16
+ ### ⚙️ Setup
17
+
18
+ ```js
19
+ // main.js
20
+ import Darkify from 'darkify-js';
21
+
22
+ const options = {
23
+ autoMatchTheme: true,
24
+ };
25
+
26
+ // autoMatchTheme: default is true
27
+ // useLocalStorage: default is true
28
+ // useSessionStorage: default is false
29
+ // useColorScheme: default is ['#ffffff', '#000000']
30
+
31
+ new Darkify('#element', options);
32
+ ```
33
+
34
+ [Wiki]: https://github.com/emrocode/darkify-js/wiki
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  *
3
3
  * @author Emilio Romero <emrocode@gmail.com>
4
- * @version 1.1.3
4
+ * @version 1.1.4
5
5
  * @license MIT
6
6
  */
7
7
  'use strict';
@@ -9,24 +9,22 @@
9
9
  Object.defineProperty(exports, '__esModule', { value: true });
10
10
 
11
11
  const isBrowser = typeof window !== 'undefined';
12
+
13
+ const defaultOptions = {
14
+ autoMatchTheme: true,
15
+ useLocalStorage: true,
16
+ useSessionStorage: false,
17
+ useColorScheme: ['#ffffff', '#000000'],
18
+ };
19
+
12
20
  class Darkify {
13
21
  constructor(element, options) {
14
22
  this.options = {};
15
23
  if (!isBrowser) {
16
24
  return;
17
25
  }
18
- if (options?.useLocalStorage) {
19
- options.useSessionStorage = false;
20
- }
21
- else if (options?.useSessionStorage) {
22
- options.useLocalStorage = false;
23
- }
24
- const defaultOptions = {
25
- autoMatchTheme: true,
26
- useLocalStorage: true,
27
- useSessionStorage: false,
28
- useColorScheme: ['#ffffff', '#000000'],
29
- };
26
+ options?.useLocalStorage && (options.useSessionStorage = false);
27
+ options?.useSessionStorage && (options.useLocalStorage = false);
30
28
  options = { ...defaultOptions, ...options };
31
29
  this.options = options;
32
30
  document.addEventListener('DOMContentLoaded', () => {
@@ -39,7 +37,6 @@ class Darkify {
39
37
  .addEventListener('change', ({ matches: isDark }) => {
40
38
  this.theme.value = isDark ? 'dark' : 'light';
41
39
  this.savePreference();
42
- return window.location.reload();
43
40
  });
44
41
  this.theme = {
45
42
  value: this.getOsPreference(options) ?? 'light',
@@ -66,7 +63,7 @@ class Darkify {
66
63
  this.savePreference();
67
64
  }
68
65
  updateTags(css, useColorScheme) {
69
- const head = document.head;
66
+ const head = document.head || document.getElementsByTagName('head')[0];
70
67
  this.metaTag.setAttribute('name', 'theme-color');
71
68
  this.metaTag.setAttribute('content', this.theme.value === 'light' ? useColorScheme[0] : useColorScheme[1]);
72
69
  this.cssTag.setAttribute('type', 'text/css');
@@ -86,6 +83,6 @@ class Darkify {
86
83
  this.createAttribute();
87
84
  }
88
85
  }
89
- Darkify.storageKey = 'darkify-theme';
86
+ Darkify.storageKey = 'theme';
90
87
 
91
88
  exports.default = Darkify;
package/dist/darkify.d.ts CHANGED
@@ -1,19 +1,22 @@
1
- type Options = {
2
- autoMatchTheme?: boolean;
3
- useLocalStorage?: boolean;
4
- useSessionStorage?: boolean;
5
- useColorScheme?: string[];
1
+ type Options = {
2
+ autoMatchTheme?: boolean;
3
+ useLocalStorage?: boolean;
4
+ useSessionStorage?: boolean;
5
+ useColorScheme?: string[];
6
6
  };
7
7
 
8
8
  declare class Darkify {
9
9
  private static readonly storageKey;
10
- private options;
11
- private theme;
12
- private cssTag;
13
- private metaTag;
10
+ options: Options;
11
+ theme: {
12
+ value: string;
13
+ };
14
+ cssTag: HTMLStyleElement;
15
+ metaTag: HTMLMetaElement;
14
16
  /**
15
17
  * @param {string} element Button ID ( recommended ) or HTML element
16
18
  * @param {object} options Options
19
+ * @see {@link https://github.com/emrocode/darkify-js/wiki|Documentation}
17
20
  */
18
21
  constructor(element: string, options: Options);
19
22
  getOsPreference(options: Options): string;
@@ -1,28 +1,26 @@
1
1
  /**
2
2
  *
3
3
  * @author Emilio Romero <emrocode@gmail.com>
4
- * @version 1.1.3
4
+ * @version 1.1.4
5
5
  * @license MIT
6
6
  */
7
7
  const isBrowser = typeof window !== 'undefined';
8
+
9
+ const defaultOptions = {
10
+ autoMatchTheme: true,
11
+ useLocalStorage: true,
12
+ useSessionStorage: false,
13
+ useColorScheme: ['#ffffff', '#000000'],
14
+ };
15
+
8
16
  class Darkify {
9
17
  constructor(element, options) {
10
18
  this.options = {};
11
19
  if (!isBrowser) {
12
20
  return;
13
21
  }
14
- if (options?.useLocalStorage) {
15
- options.useSessionStorage = false;
16
- }
17
- else if (options?.useSessionStorage) {
18
- options.useLocalStorage = false;
19
- }
20
- const defaultOptions = {
21
- autoMatchTheme: true,
22
- useLocalStorage: true,
23
- useSessionStorage: false,
24
- useColorScheme: ['#ffffff', '#000000'],
25
- };
22
+ options?.useLocalStorage && (options.useSessionStorage = false);
23
+ options?.useSessionStorage && (options.useLocalStorage = false);
26
24
  options = { ...defaultOptions, ...options };
27
25
  this.options = options;
28
26
  document.addEventListener('DOMContentLoaded', () => {
@@ -35,7 +33,6 @@ class Darkify {
35
33
  .addEventListener('change', ({ matches: isDark }) => {
36
34
  this.theme.value = isDark ? 'dark' : 'light';
37
35
  this.savePreference();
38
- return window.location.reload();
39
36
  });
40
37
  this.theme = {
41
38
  value: this.getOsPreference(options) ?? 'light',
@@ -62,7 +59,7 @@ class Darkify {
62
59
  this.savePreference();
63
60
  }
64
61
  updateTags(css, useColorScheme) {
65
- const head = document.head;
62
+ const head = document.head || document.getElementsByTagName('head')[0];
66
63
  this.metaTag.setAttribute('name', 'theme-color');
67
64
  this.metaTag.setAttribute('content', this.theme.value === 'light' ? useColorScheme[0] : useColorScheme[1]);
68
65
  this.cssTag.setAttribute('type', 'text/css');
@@ -82,6 +79,6 @@ class Darkify {
82
79
  this.createAttribute();
83
80
  }
84
81
  }
85
- Darkify.storageKey = 'darkify-theme';
82
+ Darkify.storageKey = 'theme';
86
83
 
87
84
  export { Darkify as default };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  *
3
3
  * @author Emilio Romero <emrocode@gmail.com>
4
- * @version 1.1.3
4
+ * @version 1.1.4
5
5
  * @license MIT
6
6
  */
7
- var Darkify=function(){"use strict";const e="undefined"!=typeof window;class t{constructor(t,s){if(this.options={},!e)return;s?.useLocalStorage?s.useSessionStorage=!1:s?.useSessionStorage&&(s.useLocalStorage=!1);s={autoMatchTheme:!0,useLocalStorage:!0,useSessionStorage:!1,useColorScheme:["#ffffff","#000000"],...s},this.options=s,document.addEventListener("DOMContentLoaded",(()=>{this.createAttribute();const e=document.querySelector(t);e?.addEventListener("click",(()=>this.onClick()))})),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",(({matches:e})=>(this.theme.value=e?"dark":"light",this.savePreference(),window.location.reload()))),this.theme={value:this.getOsPreference(s)??"light"},this.cssTag=document.createElement("style"),this.metaTag=document.createElement("meta"),this.createAttribute()}getOsPreference(e){const{autoMatchTheme:s,useLocalStorage:a,useSessionStorage:o}=e;return a&&window.localStorage.getItem(t.storageKey)||o&&window.sessionStorage.getItem(t.storageKey)||(s&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}createAttribute(){const e=document.getElementsByTagName("html")[0],{useColorScheme:t}=this.options;let s=`/**! Darkify / A simple dark mode toggle library **/:root:is([data-theme="${this.theme.value}"]), [data-theme="${this.theme.value}"] {color-scheme: ${this.theme.value}}`;e.setAttribute("data-theme",this.theme.value),this.updateTags(s,t||[]),this.savePreference()}updateTags(e,t){const s=document.head;this.metaTag.setAttribute("name","theme-color"),this.metaTag.setAttribute("content","light"===this.theme.value?t[0]:t[1]),this.cssTag.setAttribute("type","text/css"),this.cssTag.innerHTML=e,s.appendChild(this.metaTag),s.appendChild(this.cssTag)}savePreference(){const{useLocalStorage:e}=this.options,s=e?window.localStorage:window.sessionStorage;(e?window.sessionStorage:window.localStorage).removeItem(t.storageKey),s.setItem(t.storageKey,this.theme.value)}onClick(){this.theme.value="light"===this.theme.value?"dark":"light",this.createAttribute()}}return t.storageKey="darkify-theme",t}();
7
+ var Darkify=function(){"use strict";const e="undefined"!=typeof window,t={autoMatchTheme:!0,useLocalStorage:!0,useSessionStorage:!1,useColorScheme:["#ffffff","#000000"]};class s{constructor(s,a){this.options={},e&&(a?.useLocalStorage&&(a.useSessionStorage=!1),a?.useSessionStorage&&(a.useLocalStorage=!1),a={...t,...a},this.options=a,document.addEventListener("DOMContentLoaded",(()=>{this.createAttribute();const e=document.querySelector(s);e?.addEventListener("click",(()=>this.onClick()))})),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",(({matches:e})=>{this.theme.value=e?"dark":"light",this.savePreference()})),this.theme={value:this.getOsPreference(a)??"light"},this.cssTag=document.createElement("style"),this.metaTag=document.createElement("meta"),this.createAttribute())}getOsPreference(e){const{autoMatchTheme:t,useLocalStorage:a,useSessionStorage:o}=e;return a&&window.localStorage.getItem(s.storageKey)||o&&window.sessionStorage.getItem(s.storageKey)||(t&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}createAttribute(){const e=document.getElementsByTagName("html")[0],{useColorScheme:t}=this.options;let s=`/**! Darkify / A simple dark mode toggle library **/:root:is([data-theme="${this.theme.value}"]), [data-theme="${this.theme.value}"] {color-scheme: ${this.theme.value}}`;e.setAttribute("data-theme",this.theme.value),this.updateTags(s,t||[]),this.savePreference()}updateTags(e,t){const s=document.head||document.getElementsByTagName("head")[0];this.metaTag.setAttribute("name","theme-color"),this.metaTag.setAttribute("content","light"===this.theme.value?t[0]:t[1]),this.cssTag.setAttribute("type","text/css"),this.cssTag.innerHTML=e,s.appendChild(this.metaTag),s.appendChild(this.cssTag)}savePreference(){const{useLocalStorage:e}=this.options,t=e?window.localStorage:window.sessionStorage;(e?window.sessionStorage:window.localStorage).removeItem(s.storageKey),t.setItem(s.storageKey,this.theme.value)}onClick(){this.theme.value="light"===this.theme.value?"dark":"light",this.createAttribute()}}return s.storageKey="theme",s}();
@@ -1,95 +1,7 @@
1
1
  /**
2
2
  *
3
3
  * @author Emilio Romero <emrocode@gmail.com>
4
- * @version 1.1.3
4
+ * @version 1.1.4
5
5
  * @license MIT
6
6
  */
7
- (function (global, factory) {
8
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
9
- typeof define === 'function' && define.amd ? define(factory) :
10
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Darkify = factory());
11
- })(this, (function () { 'use strict';
12
-
13
- const isBrowser = typeof window !== 'undefined';
14
- class Darkify {
15
- constructor(element, options) {
16
- this.options = {};
17
- if (!isBrowser) {
18
- return;
19
- }
20
- if (options?.useLocalStorage) {
21
- options.useSessionStorage = false;
22
- }
23
- else if (options?.useSessionStorage) {
24
- options.useLocalStorage = false;
25
- }
26
- const defaultOptions = {
27
- autoMatchTheme: true,
28
- useLocalStorage: true,
29
- useSessionStorage: false,
30
- useColorScheme: ['#ffffff', '#000000'],
31
- };
32
- options = { ...defaultOptions, ...options };
33
- this.options = options;
34
- document.addEventListener('DOMContentLoaded', () => {
35
- this.createAttribute();
36
- const htmlElement = document.querySelector(element);
37
- htmlElement?.addEventListener('click', () => this.onClick());
38
- });
39
- window
40
- .matchMedia('(prefers-color-scheme: dark)')
41
- .addEventListener('change', ({ matches: isDark }) => {
42
- this.theme.value = isDark ? 'dark' : 'light';
43
- this.savePreference();
44
- return window.location.reload();
45
- });
46
- this.theme = {
47
- value: this.getOsPreference(options) ?? 'light',
48
- };
49
- this.cssTag = document.createElement('style');
50
- this.metaTag = document.createElement('meta');
51
- this.createAttribute();
52
- }
53
- getOsPreference(options) {
54
- const { autoMatchTheme, useLocalStorage, useSessionStorage } = options;
55
- const STO = (useLocalStorage && window.localStorage.getItem(Darkify.storageKey)) ||
56
- (useSessionStorage && window.sessionStorage.getItem(Darkify.storageKey));
57
- return (STO ||
58
- (autoMatchTheme && window.matchMedia('(prefers-color-scheme: dark)').matches
59
- ? 'dark'
60
- : 'light'));
61
- }
62
- createAttribute() {
63
- const dataTheme = document.getElementsByTagName('html')[0];
64
- const { useColorScheme } = this.options;
65
- let css = `/**! Darkify / A simple dark mode toggle library **/:root:is([data-theme="${this.theme.value}"]), [data-theme="${this.theme.value}"] {color-scheme: ${this.theme.value}}`;
66
- dataTheme.setAttribute('data-theme', this.theme.value);
67
- this.updateTags(css, useColorScheme || []);
68
- this.savePreference();
69
- }
70
- updateTags(css, useColorScheme) {
71
- const head = document.head;
72
- this.metaTag.setAttribute('name', 'theme-color');
73
- this.metaTag.setAttribute('content', this.theme.value === 'light' ? useColorScheme[0] : useColorScheme[1]);
74
- this.cssTag.setAttribute('type', 'text/css');
75
- this.cssTag.innerHTML = css;
76
- head.appendChild(this.metaTag);
77
- head.appendChild(this.cssTag);
78
- }
79
- savePreference() {
80
- const { useLocalStorage } = this.options;
81
- const STO = useLocalStorage ? window.localStorage : window.sessionStorage;
82
- const OTS = useLocalStorage ? window.sessionStorage : window.localStorage;
83
- OTS.removeItem(Darkify.storageKey);
84
- STO.setItem(Darkify.storageKey, this.theme.value);
85
- }
86
- onClick() {
87
- this.theme.value = this.theme.value === 'light' ? 'dark' : 'light';
88
- this.createAttribute();
89
- }
90
- }
91
- Darkify.storageKey = 'darkify-theme';
92
-
93
- return Darkify;
94
-
95
- }));
7
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Darkify=t()}(this,(function(){"use strict";const e="undefined"!=typeof window,t={autoMatchTheme:!0,useLocalStorage:!0,useSessionStorage:!1,useColorScheme:["#ffffff","#000000"]};class s{constructor(s,a){this.options={},e&&(a?.useLocalStorage&&(a.useSessionStorage=!1),a?.useSessionStorage&&(a.useLocalStorage=!1),a={...t,...a},this.options=a,document.addEventListener("DOMContentLoaded",(()=>{this.createAttribute();const e=document.querySelector(s);e?.addEventListener("click",(()=>this.onClick()))})),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",(({matches:e})=>{this.theme.value=e?"dark":"light",this.savePreference()})),this.theme={value:this.getOsPreference(a)??"light"},this.cssTag=document.createElement("style"),this.metaTag=document.createElement("meta"),this.createAttribute())}getOsPreference(e){const{autoMatchTheme:t,useLocalStorage:a,useSessionStorage:o}=e;return a&&window.localStorage.getItem(s.storageKey)||o&&window.sessionStorage.getItem(s.storageKey)||(t&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}createAttribute(){const e=document.getElementsByTagName("html")[0],{useColorScheme:t}=this.options;let s=`/**! Darkify / A simple dark mode toggle library **/:root:is([data-theme="${this.theme.value}"]), [data-theme="${this.theme.value}"] {color-scheme: ${this.theme.value}}`;e.setAttribute("data-theme",this.theme.value),this.updateTags(s,t||[]),this.savePreference()}updateTags(e,t){const s=document.head||document.getElementsByTagName("head")[0];this.metaTag.setAttribute("name","theme-color"),this.metaTag.setAttribute("content","light"===this.theme.value?t[0]:t[1]),this.cssTag.setAttribute("type","text/css"),this.cssTag.innerHTML=e,s.appendChild(this.metaTag),s.appendChild(this.cssTag)}savePreference(){const{useLocalStorage:e}=this.options,t=e?window.localStorage:window.sessionStorage;(e?window.sessionStorage:window.localStorage).removeItem(s.storageKey),t.setItem(s.storageKey,this.theme.value)}onClick(){this.theme.value="light"===this.theme.value?"dark":"light",this.createAttribute()}}return s.storageKey="theme",s}));
package/package.json CHANGED
@@ -1,49 +1,49 @@
1
- {
2
- "name": "darkify-js",
3
- "version": "1.1.3",
4
- "description": "A simple dark mode toggle library",
5
- "type": "module",
6
- "main": "dist/darkify.cjs.js",
7
- "module": "dist/darkify.esm.js",
8
- "types": "dist/darkify.d.ts",
9
- "files": [
10
- "dist/darkify.d.ts",
11
- "dist/darkify.cjs.js",
12
- "dist/darkify.esm.js",
13
- "dist/darkify.umd.js",
14
- "dist/darkify.min.js"
15
- ],
16
- "scripts": {
17
- "_cls": "rm -rf dist",
18
- "_bundle": "rollup -c rollup.config.ts --configPlugin typescript",
19
- "prettier": "prettier --write src/",
20
- "build": "npm run _cls && npm run _bundle"
21
- },
22
- "keywords": [
23
- "color-scheme",
24
- "toggle",
25
- "dark-mode",
26
- "dark-theme"
27
- ],
28
- "author": "Emilio Romero <emrocode@gmail.com>",
29
- "repository": {
30
- "type": "git",
31
- "url": "git+https://github.com/emrocode/darkify-js"
32
- },
33
- "homepage": "https://github.com/emrocode/darkify-js#readme",
34
- "bugs": {
35
- "url": "https://github.com/emrocode/darkify-js/issues"
36
- },
37
- "license": "MIT",
38
- "devDependencies": {
39
- "@rollup/plugin-commonjs": "^25.0.8",
40
- "@rollup/plugin-terser": "^0.4.4",
41
- "@rollup/plugin-typescript": "^11.1.6",
42
- "prettier": "^3.2.5",
43
- "rollup": "^4.18.0",
44
- "rollup-plugin-cleanup": "^3.2.1",
45
- "rollup-plugin-dts": "^6.1.1",
46
- "tslib": "^2.6.2",
47
- "typescript": "^5.4.5"
48
- }
49
- }
1
+ {
2
+ "name": "darkify-js",
3
+ "version": "1.1.4",
4
+ "description": "A simple dark mode toggle library",
5
+ "type": "module",
6
+ "main": "dist/darkify.cjs.js",
7
+ "module": "dist/darkify.esm.js",
8
+ "types": "dist/darkify.d.ts",
9
+ "files": [
10
+ "dist/darkify.d.ts",
11
+ "dist/darkify.cjs.js",
12
+ "dist/darkify.esm.js",
13
+ "dist/darkify.umd.js",
14
+ "dist/darkify.min.js"
15
+ ],
16
+ "scripts": {
17
+ "_cls": "rm -rf dist",
18
+ "_bundle": "rollup -c rollup.config.ts --configPlugin typescript",
19
+ "prettier": "prettier --write src/",
20
+ "build": "npm run _cls && npm run _bundle"
21
+ },
22
+ "keywords": [
23
+ "color-scheme",
24
+ "toggle",
25
+ "dark-mode",
26
+ "dark-theme"
27
+ ],
28
+ "author": "Emilio Romero <emrocode@gmail.com>",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/emrocode/darkify-js"
32
+ },
33
+ "homepage": "https://github.com/emrocode/darkify-js#readme",
34
+ "bugs": {
35
+ "url": "https://github.com/emrocode/darkify-js/issues"
36
+ },
37
+ "license": "MIT",
38
+ "devDependencies": {
39
+ "@rollup/plugin-commonjs": "^25.0.8",
40
+ "@rollup/plugin-terser": "^0.4.4",
41
+ "@rollup/plugin-typescript": "^11.1.6",
42
+ "prettier": "^3.2.5",
43
+ "rollup": "^4.18.0",
44
+ "rollup-plugin-cleanup": "^3.2.1",
45
+ "rollup-plugin-dts": "^6.1.1",
46
+ "tslib": "^2.6.2",
47
+ "typescript": "^5.4.5"
48
+ }
49
+ }