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 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
- [![CSS Extract](https://raw.githubusercontent.com/jantimon/yacijs/main/css-extract.gif)](https://raw.githubusercontent.com/jantimon/yacijs/main/css-extract.gif)
85
+ [![CSS Extract](https://raw.githubusercontent.com/jantimon/next-yak/main/css-extract.gif)](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
- [![Compile Flow](https://raw.githubusercontent.com/jantimon/yacijs/main/compile-flow.webp)](https://raw.githubusercontent.com/jantimon/yacijs/main/compile-flow.webp)
91
+ [![Compile Flow](https://raw.githubusercontent.com/jantimon/next-yak/main/compile-flow.webp)](https://raw.githubusercontent.com/jantimon/next-yak/main/compile-flow.webp)
92
92
 
93
93
 
94
94
  ### Atomic CSS
@@ -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
@@ -1,3 +1,4 @@
1
1
  export { css } from "./cssLiteral";
2
- export * from "./styled";
2
+ export { styled } from "./styled";
3
+ export { atoms } from "./atoms";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,cAAc,CAAC;AACjC,cAAc,UAAU,CAAC"}
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
@@ -1,3 +1,4 @@
1
1
  export { css } from "./cssLiteral";
2
- export * from "./styled";
2
+ export { styled } from "./styled";
3
+ export { atoms } from "./atoms";
3
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,cAAc,CAAC;AACjC,cAAc,UAAU,CAAC"}
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-yak",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
@@ -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 * from "./styled";
1
+ export { css } from "./cssLiteral";
2
+ export { styled } from "./styled";
3
+ export { atoms } from "./atoms";