├── .github
├── banner.jpg
└── clazzx.png
├── .gitignore
├── .helix
└── languages.toml
├── LICENSE
├── README.md
├── mod.ts
└── src
├── build.ts
├── clazzx.ts
└── tests.ts
/.github/banner.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b3nten/clazzx/d1bf05541d969b519b5a566ab17041a3eb01324a/.github/banner.jpg
--------------------------------------------------------------------------------
/.github/clazzx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b3nten/clazzx/d1bf05541d969b519b5a566ab17041a3eb01324a/.github/clazzx.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode
2 | npm/
--------------------------------------------------------------------------------
/.helix/languages.toml:
--------------------------------------------------------------------------------
1 | [[language]]
2 | name = "javascript"
3 | language-server = { command = "deno", args = ["lsp"] }
4 | config = { enable = true }
5 |
6 | [[language]]
7 | name = "typescript"
8 | language-server = { command = "deno", args = ["lsp"] }
9 | config = { enable = true }
10 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright 2022 Benton Boychuk-Chorney
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | 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, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 
5 |
6 |
CLazzx 💄
7 |
8 | #### A typesafe utility library for composing HTML classes
9 |
10 | [](https://npmjs.com/package/express)
11 | [](https://github.com/freeCodeCamp/freeCodeCamp)
12 | [](https://nuget.org/packages/newtonsoft.json)
13 |
14 | *ClazzX is a small typesafe utility library for composing HTML classes using state rather than variants.*
15 |
16 |
17 | ### Introduction
18 |
19 | ClazzX is a small typesafe utility library for composing HTML classes. Unlike Vanilla Extract, Stitches, or CVA (all fantastic options) ClazzX takes a different approach, using *state* rather than *variants* to compose styles.
20 |
21 | The classic approach is to create a series of variants that can be selected:
22 | ```ts
23 | className={myButton({size: "small", intent="primary"})}
24 | // AND
25 |
26 | ```
27 | In comparison, ClazzX models combinations of styles based on state.
28 | ```ts
29 | className={MyButton.compose({small: true, primary: true})}
30 | // AND
31 |
32 | ```
33 | This simplifies the logic of tying the styling of a component to complex state. Instead of a series of nested ternary operators, simple logical operators can be used to clearly define the appropriate styles.
34 |
35 | ```ts
36 | className={
37 | MyButton.compose({
38 | primary: true,
39 | loading: isLoading,
40 | error: isError
41 | })
42 | }
43 | //AND
44 |