next-yak 0.0.1 → 0.0.2
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/README.md +5 -5
- package/dist/atoms.d.ts +18 -0
- package/dist/atoms.d.ts.map +1 -0
- package/dist/atoms.js +19 -0
- package/dist/atoms.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/runtime/atoms.tsx +18 -0
- package/runtime/index.ts +3 -2
package/README.md
CHANGED
|
@@ -56,9 +56,9 @@ Therefore you have to create a `postcss.config.js` file in your project root:
|
|
|
56
56
|
// postcss.config.js
|
|
57
57
|
module.exports = {
|
|
58
58
|
plugins: {
|
|
59
|
-
'postcss-nested':{},
|
|
60
|
-
|
|
61
|
-
}
|
|
59
|
+
'postcss-nested': {},
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
## Example
|
|
@@ -82,13 +82,13 @@ const App = () => (
|
|
|
82
82
|
|
|
83
83
|
## Performance Gains
|
|
84
84
|
|
|
85
|
-
[](https://raw.githubusercontent.com/jantimon/next-yak/main/css-extract.gif)
|
|
86
86
|
|
|
87
87
|
## How it works
|
|
88
88
|
|
|
89
89
|
next-yak converts css-in-js into css modules. This allows to use the full power of postcss and its plugins. It also allows to use the same optimizations for css files and css-in-js.
|
|
90
90
|
|
|
91
|
-
[](https://raw.githubusercontent.com/jantimon/next-yak/main/compile-flow.webp)
|
|
92
92
|
|
|
93
93
|
|
|
94
94
|
### Atomic CSS
|
package/dist/atoms.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allows to use atomic CSS classes in a styled or css block
|
|
3
|
+
*
|
|
4
|
+
* @usage
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* import { styled, atoms } from "next-yak";
|
|
8
|
+
*
|
|
9
|
+
* const Button = styled.button<{ $primary?: boolean }>`
|
|
10
|
+
* ${atoms("text-teal-600", "text-base", "rounded-md")}
|
|
11
|
+
* ${props => props.$primary && atoms("shadow-md")}
|
|
12
|
+
* `;
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare const atoms: (...atoms: string[]) => () => {
|
|
16
|
+
className: string;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=atoms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atoms.d.ts","sourceRoot":"","sources":["../runtime/atoms.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK,aAAc,MAAM,EAAE;;CAGvC,CAAC"}
|
package/dist/atoms.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allows to use atomic CSS classes in a styled or css block
|
|
3
|
+
*
|
|
4
|
+
* @usage
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* import { styled, atoms } from "next-yak";
|
|
8
|
+
*
|
|
9
|
+
* const Button = styled.button<{ $primary?: boolean }>`
|
|
10
|
+
* ${atoms("text-teal-600", "text-base", "rounded-md")}
|
|
11
|
+
* ${props => props.$primary && atoms("shadow-md")}
|
|
12
|
+
* `;
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export const atoms = (...atoms) => {
|
|
16
|
+
const className = atoms.join(" ");
|
|
17
|
+
return () => ({ className });
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=atoms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atoms.js","sourceRoot":"","sources":["../runtime/atoms.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,GAAG,KAAe,EAAE,EAAE;IACxC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,GAAG,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;AACjC,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allows to use atomic CSS classes in a styled or css block
|
|
3
|
+
*
|
|
4
|
+
* @usage
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* import { styled, atoms } from "next-yak";
|
|
8
|
+
*
|
|
9
|
+
* const Button = styled.button<{ $primary?: boolean }>`
|
|
10
|
+
* ${atoms("text-teal-600", "text-base", "rounded-md")}
|
|
11
|
+
* ${props => props.$primary && atoms("shadow-md")}
|
|
12
|
+
* `;
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export const atoms = (...atoms: string[]) => {
|
|
16
|
+
const className = atoms.join(" ");
|
|
17
|
+
return () => ({ className });
|
|
18
|
+
};
|
package/runtime/index.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export {css} from "./cssLiteral";
|
|
2
|
-
export
|
|
1
|
+
export { css } from "./cssLiteral";
|
|
2
|
+
export { styled } from "./styled";
|
|
3
|
+
export { atoms } from "./atoms";
|