clampography 2.0.0-beta.2 → 2.0.0-beta.21

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
@@ -1,39 +1,42 @@
1
1
  # 🙌 Clampography
2
2
 
3
+ > **WARNING**: Beta 2.0.0 is in development and currently unstable.
4
+
3
5
  **Clampography** is a pure CSS typography system that uses the
4
6
  [clamp()](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/clamp)
5
- function for fluid, responsive text scaling. It's designed as an alternative to
6
- [@tailwindcss/typography](https://github.com/tailwindlabs/tailwindcss-typography),
7
- but works with or without [Tailwind CSS](https://tailwindcss.com/). With
7
+ function for fluid, responsive text scaling. Built as a Tailwind CSS plugin, it
8
+ delivers production-ready typography with optional theming support. With
8
9
  [94% global browser support](https://caniuse.com/css-math-functions), it works
9
10
  on nearly all modern devices.
10
11
 
11
- - **No default styling:** No colors, borders, transforms, or decorations.
12
- - **Structure only:** Manages size, spacing, weight, and font-family.
12
+ - **Typography first:** Fluid, responsive text scaling without any styling
13
+ - **Structure only:** Manages size, spacing, weight, and font-family
13
14
  - **Smart scaling:** Contextual elements use `em` (relative), blocks use
14
- `clamp()` (fluid).
15
+ `clamp()` (fluid)
16
+ - **Optional theming:** Built-in light/dark themes or create your own with OKLCH
17
+ colors
18
+ - **Tailwind plugin:** Requires Tailwind CSS v4
15
19
 
16
20
  ## The purpose
17
21
 
18
22
  [CSS resets](https://en.wikipedia.org/wiki/Reset_style_sheet) like
19
23
  [Tailwind's Preflight](https://tailwindcss.com/docs/preflight) remove all
20
24
  browser typography defaults, leaving you with unstyled text. **Clampography**
21
- delivers production-ready text scaling that responds to viewport changes
22
- automatically, while leaving all aesthetic choices to you.
25
+ delivers production-ready typography that responds to viewport changes
26
+ automatically, while leaving all aesthetic choices to you. Add themes only if
27
+ you need them.
23
28
 
24
29
  Visit the temporary [demo page](https://next.dav.one/clampography/) to see how
25
30
  it looks.
26
31
 
27
32
  ## Requirements
28
33
 
29
- Use [Vite](https://vitejs.dev/), [Webpack](https://webpack.js.org/), or similar
30
- build tool for CSS bundling. Popular frameworks like
31
- [Astro](https://astro.build/), [Next.js](https://nextjs.org/),
32
- [Remix](https://remix.run/), and
33
- [SvelteKit](https://svelte.dev/docs/kit/introduction) include CSS bundling by
34
- default and work seamlessly with **Clampography**. Without a build tool, native
35
- CSS `@import` combined with `@layer` has about 91% browser coverage and only
36
- works in browsers released since early 2022.
34
+ - **Tailwind CSS v4** (required)
35
+ - A build tool like [Vite](https://vitejs.dev/),
36
+ [Webpack](https://webpack.js.org/), or framework with CSS bundling like
37
+ [Astro](https://astro.build/), [Next.js](https://nextjs.org/),
38
+ [Remix](https://remix.run/),
39
+ [SvelteKit](https://svelte.dev/docs/kit/introduction)
37
40
 
38
41
  ## Installation
39
42
 
@@ -51,21 +54,106 @@ bun install clampography
51
54
  deno install npm:clampography
52
55
  ```
53
56
 
54
- ## Usage
57
+ ## Quick Start
58
+
59
+ ### Typography Only (Recommended)
60
+
61
+ Load just the typography system without any colors:
55
62
 
56
63
  ```css
57
- /* First import Tailwind CSS */
58
64
  @import "tailwindcss";
65
+ @plugin "clampography";
66
+ ```
67
+
68
+ **Result:**
69
+
70
+ - ✅ Fluid typography (headings, paragraphs, lists)
71
+ - ✅ Responsive spacing system
72
+ - ✅ Structural base styles
73
+ - ❌ No colors, borders, or decorations
74
+
75
+ Use your own color system with Tailwind utilities:
76
+
77
+ ```html
78
+ <div class="bg-white text-gray-900 dark:bg-gray-900 dark:text-white">
79
+ <h1>Fluid Typography</h1>
80
+ <p>Text scales automatically based on viewport size.</p>
81
+ </div>
82
+ ```
83
+
84
+ ### Typography + Built-in Themes (Optional)
59
85
 
60
- /* Then import Clampography */
61
- @import "clampography";
86
+ Add automatic light/dark theming:
62
87
 
63
- /* Then you can override Clampography's base styles */
64
- @layer base {
65
- h1 {
66
- font-size: clamp(2.35rem, 1.95rem + 1.5vw, 4rem);
67
- font-weight: 400;
68
- line-height: 1.15;
69
- }
88
+ ```css
89
+ @import "tailwindcss";
90
+ @plugin "clampography" {
91
+ themes: all; /* Loads light, dark, retro, and cyberpunk */
70
92
  }
71
93
  ```
94
+
95
+ **What this adds:**
96
+
97
+ - Automatic light/dark switching based on `prefers-color-scheme`
98
+ - Manual theme switching via `data-theme` attribute
99
+ - Tailwind utilities like `bg-clampography-primary`
100
+
101
+ ```html
102
+ <div class="bg-clampography-background text-clampography-text">
103
+ <h1 class="text-clampography-heading">Hello World</h1>
104
+ <button class="bg-clampography-primary">Click Me</button>
105
+ </div>
106
+
107
+ <!-- Manual theme switching -->
108
+ <body data-theme="dark">...</body>
109
+ ```
110
+
111
+ ### Custom Theme (Optional)
112
+
113
+ Create your own theme with OKLCH colors:
114
+
115
+ ```css
116
+ @import "tailwindcss";
117
+ @plugin "clampography" {
118
+ themes: false;
119
+ }
120
+
121
+ @plugin "clampography/theme" {
122
+ name: "brand";
123
+ default: true;
124
+
125
+ primary: "oklch(60% 0.25 270)";
126
+ background: "oklch(99% 0.005 270)";
127
+ text: "oklch(20% 0.02 270)";
128
+ /* Missing colors auto-filled from fallback */
129
+ }
130
+ ```
131
+
132
+ ## Configuration Options
133
+
134
+ ```css
135
+ @plugin "clampography" {
136
+ themes: "all" | "light, dark" | false; /* Load themes (optional) */
137
+ base: true | false; /* Typography styles (default: true) */
138
+ extra: true | false; /* Enhanced styling (default: false) */
139
+ prefix: "clampography" | false; /* Utility class prefix */
140
+ root: ":root" | "#app"; /* Scope to element */
141
+ logs: true | false; /* Console output */
142
+ }
143
+ ```
144
+
145
+ ## Learn More
146
+
147
+ 📖 **[Complete Usage Guide](USAGE.md)** - Detailed documentation:
148
+
149
+ - All configuration options
150
+ - Built-in themes (light, dark, retro, cyberpunk)
151
+ - Creating custom themes
152
+ - Scoped themes for widgets
153
+ - Advanced scenarios
154
+ - Tailwind utilities
155
+ - Troubleshooting
156
+
157
+ ## License
158
+
159
+ MIT
package/package.json CHANGED
@@ -1,12 +1,23 @@
1
1
  {
2
2
  "name": "clampography",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.21",
4
4
  "description": "Fluid typography system based on CSS clamp() with optional themes and extra styles. A feature-rich alternative to Tailwind CSS Typography plugin.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
7
7
  "exports": {
8
- ".": "./src/index.js",
9
- "./theme": "./src/theme-plugin.js"
8
+ ".": {
9
+ "types": "./src/types/index.d.ts",
10
+ "import": "./src/index.js"
11
+ },
12
+ "./theme": {
13
+ "types": "./src/types/theme-plugin.d.ts",
14
+ "import": "./src/theme-plugin.js"
15
+ },
16
+ "./themes": {
17
+ "types": "./src/types/themes.d.ts",
18
+ "import": "./src/themes.js"
19
+ },
20
+ "./package.json": "./package.json"
10
21
  },
11
22
  "files": [
12
23
  "src"
@@ -45,6 +56,6 @@
45
56
  "tailwindcss": ">=4.0.0"
46
57
  },
47
58
  "devDependencies": {
48
- "tailwindcss": "^4.0.0"
59
+ "tailwindcss": "^4.1.18"
49
60
  }
50
61
  }