@types/nightwind 1.0.0
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.
- nightwind/LICENSE +21 -0
- nightwind/README.md +15 -0
- nightwind/helper.d.ts +88 -0
- nightwind/index.d.ts +7 -0
- nightwind/package.json +37 -0
nightwind/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
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
|
nightwind/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
> `npm install --save @types/nightwind`
|
|
3
|
+
|
|
4
|
+
# Summary
|
|
5
|
+
This package contains type definitions for nightwind (https://github.com/jjranalli/nightwind).
|
|
6
|
+
|
|
7
|
+
# Details
|
|
8
|
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nightwind.
|
|
9
|
+
|
|
10
|
+
### Additional Details
|
|
11
|
+
* Last updated: Wed, 07 Aug 2024 18:08:39 GMT
|
|
12
|
+
* Dependencies: [tailwindcss](https://npmjs.com/package/tailwindcss)
|
|
13
|
+
|
|
14
|
+
# Credits
|
|
15
|
+
These definitions were written by [Frank Elsinga](https://github.com/CommanderStorm), [Jayakorn Karikan (Bacon)](https://github.com/jayakornk), and [jacopo](https://github.com/jjranalli).
|
nightwind/helper.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nightwind relies on a fixed 'nightwind' class to manage transitions,
|
|
3
|
+
* and a toggled 'dark' class applied on a top level element in the DOM, typically the root element.
|
|
4
|
+
* You can define your own functions to manage the dark mode (or check the examples below),
|
|
5
|
+
* or use the helper functions included in 'nightwind/helper.js' to get started right away.
|
|
6
|
+
* By default, the helper functions prevent the dreaded flicker of light mode and allow the chosen color mode to persist on update.
|
|
7
|
+
*
|
|
8
|
+
* ```
|
|
9
|
+
* import nightwind from "nightwind/helper"
|
|
10
|
+
*
|
|
11
|
+
* export default function Layout() {
|
|
12
|
+
* return (
|
|
13
|
+
* <>
|
|
14
|
+
* <Head>
|
|
15
|
+
* <script dangerouslySetInnerHTML={{ __html: nightwind.init() }} />
|
|
16
|
+
* </Head>
|
|
17
|
+
* // ...
|
|
18
|
+
* </>
|
|
19
|
+
* )
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export function init(): string;
|
|
24
|
+
/**
|
|
25
|
+
* The beforeTransition function that you can leverage in case you prefer to build your own toggle functions. It prevents unwanted transitions as a side-effect of having nightwind class in the html tag.
|
|
26
|
+
* Check out the toggle function in the Nextjs example for an example of how this could be implemented.
|
|
27
|
+
*/
|
|
28
|
+
export function beforeTransition(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Toggles between dark/light mode
|
|
31
|
+
* See https://github.com/jjranalli/nightwind#examples for a more in-depth example how to use this
|
|
32
|
+
*
|
|
33
|
+
* ```
|
|
34
|
+
* import nightwind from "nightwind/helper"
|
|
35
|
+
*
|
|
36
|
+
* export default function Navbar() {
|
|
37
|
+
* return (
|
|
38
|
+
* // ...
|
|
39
|
+
* <button onClick={() => nightwind.toggle()}></button>
|
|
40
|
+
* // ...
|
|
41
|
+
* )
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export function toggle(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Enables/disables dark/light mode
|
|
48
|
+
* See https://github.com/jjranalli/nightwind#examples for an example how to use this
|
|
49
|
+
*
|
|
50
|
+
* ```
|
|
51
|
+
* import nightwind from "nightwind/helper"
|
|
52
|
+
*
|
|
53
|
+
* export default function Navbar() {
|
|
54
|
+
* return (
|
|
55
|
+
* // ...
|
|
56
|
+
* <button onClick={() => nightwind.enable(true)}></button>
|
|
57
|
+
* // ...
|
|
58
|
+
* )
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export function enable(dark: boolean): void;
|
|
63
|
+
/**
|
|
64
|
+
* Returns if the dark-mode is currently activated
|
|
65
|
+
*/
|
|
66
|
+
export function checkNightMode(): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Registers a watcher which adds/removes light/darkmode if the `prefers-color-scheme` media query changes
|
|
69
|
+
*/
|
|
70
|
+
export function watchNightMode(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Syncs the nightmode-selector with the media query
|
|
73
|
+
*/
|
|
74
|
+
export function addNightModeSelector(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Adds the class `nightwind` to the document to enable smooth transitions between dark/lightmode
|
|
77
|
+
*/
|
|
78
|
+
export function addNightTransitions(): void;
|
|
79
|
+
/**
|
|
80
|
+
* See `init()` instead
|
|
81
|
+
* @deprecated
|
|
82
|
+
*/
|
|
83
|
+
export function initNightwind(): void;
|
|
84
|
+
/**
|
|
85
|
+
* See `toggle()` instead
|
|
86
|
+
* @deprecated
|
|
87
|
+
*/
|
|
88
|
+
export function toggleNightMode(): void;
|
nightwind/index.d.ts
ADDED
nightwind/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@types/nightwind",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "TypeScript definitions for nightwind",
|
|
5
|
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nightwind",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"contributors": [
|
|
8
|
+
{
|
|
9
|
+
"name": "Frank Elsinga",
|
|
10
|
+
"githubUsername": "CommanderStorm",
|
|
11
|
+
"url": "https://github.com/CommanderStorm"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "Jayakorn Karikan (Bacon)",
|
|
15
|
+
"githubUsername": "jayakornk",
|
|
16
|
+
"url": "https://github.com/jayakornk"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "jacopo",
|
|
20
|
+
"githubUsername": "jjranalli",
|
|
21
|
+
"url": "https://github.com/jjranalli"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"main": "",
|
|
25
|
+
"types": "index.d.ts",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
|
29
|
+
"directory": "types/nightwind"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"tailwindcss": "^2.0.0 || ^3.0.0"
|
|
34
|
+
},
|
|
35
|
+
"typesPublisherContentHash": "79fd96a57d97248bcab0c24fe41a913bc0285222b1e7dacd486dc4e7eab5c284",
|
|
36
|
+
"typeScriptVersion": "4.8"
|
|
37
|
+
}
|