typewritingclass 0.3.3 → 0.3.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/README.md CHANGED
@@ -5,7 +5,7 @@ Core library for the Typewriting Class CSS-in-TS framework. Provides utility fun
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- bun add typewritingclass
8
+ pnpm add typewritingclass
9
9
  ```
10
10
 
11
11
  ## Usage
@@ -16,13 +16,54 @@ bun add typewritingclass
16
16
  import { tw } from 'typewritingclass'
17
17
 
18
18
  const card = tw
19
- .bg('white').rounded('lg').p(6).flex.gap(4)
19
+ .bg.white.rounded.lg.p(6).flex.gap(4)
20
20
  .hover(tw.bg('blue-50'))
21
21
  .md.p(8)
22
22
  .dark(tw.bg('slate-800'))
23
23
  ```
24
24
 
25
- ### Individual imports
25
+ ### Property-access tokens
26
+
27
+ Design tokens are accessed via property names — no strings needed:
28
+
29
+ ```ts
30
+ tw.bg.blue500 // background-color: #3b82f6
31
+ tw.textColor.slate900 // color: #0f172a
32
+ tw.rounded.lg // border-radius: 0.5rem
33
+ tw.shadow.md // box-shadow: ...
34
+ tw.text.lg // font-size: 1.125rem; line-height: 1.75rem
35
+ tw.font.bold // font-weight: 700
36
+ tw.items.center // align-items: center
37
+ tw.justify.between // justify-content: space-between
38
+ tw.cursor.pointer // cursor: pointer
39
+ ```
40
+
41
+ Color tokens support opacity via callable syntax:
42
+
43
+ ```ts
44
+ tw.bg.blue500(50) // background-color: rgb(59 130 246 / 0.5)
45
+ ```
46
+
47
+ ### Individual imports with property-access tokens
48
+
49
+ ```ts
50
+ import { cx, bg, rounded, p, when, hover } from 'typewritingclass'
51
+
52
+ cx(bg.blue500, rounded.lg, p(4))
53
+
54
+ // With opacity
55
+ cx(bg.blue500(25), rounded.lg, p(4))
56
+ ```
57
+
58
+ ### Arbitrary / custom values
59
+
60
+ Pass any CSS value as a string argument:
61
+
62
+ ```ts
63
+ tw.bg('white').rounded('lg').p(6).shadow('md')
64
+ ```
65
+
66
+ ### Individual imports (functional style)
26
67
 
27
68
  ```ts
28
69
  import { cx, p, bg, textColor, rounded, flex, gap, when } from 'typewritingclass'
@@ -43,9 +84,11 @@ const card = cx(
43
84
  ### Chainable builder
44
85
 
45
86
  - **`tw`** — proxy-based chainable API with access to all utilities and modifiers via a single import
46
- - Property syntax for modifiers: `tw.hover.bg('blue-500')`
47
- - Function syntax for multi-utility modifiers: `tw.hover(tw.bg('blue-500').textColor('white'))`
87
+ - Property-access tokens: `tw.bg.blue500`, `tw.rounded.lg`, `tw.font.bold`
88
+ - Property syntax for modifiers: `tw.hover.bg.blue500`
89
+ - Function syntax for multi-utility modifiers: `tw.hover(tw.bg.blue500.textColor.white)`
48
90
  - Value-less utilities as properties: `tw.flex.flexCol.relative`
91
+ - Arbitrary values: `tw.bg('custom-color').p(6)`
49
92
  - Resolves to class string via `.toString()`, `.value`, `.className`, or template literals
50
93
 
51
94
  ### Composition