clampography 2.0.0-beta.3 → 2.0.0-beta.30
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/LICENSE +20 -20
- package/README.md +133 -35
- package/css/base.css +501 -0
- package/css/base.min.css +1 -0
- package/css/clampography.css +1050 -0
- package/css/clampography.min.css +1 -0
- package/css/extra.css +189 -0
- package/css/extra.min.css +1 -0
- package/css/figma-tokens.json +110 -0
- package/css/forms.css +244 -0
- package/css/forms.min.css +1 -0
- package/css/kbd.css +28 -0
- package/css/kbd.min.css +1 -0
- package/css/theme.css +73 -0
- package/css/theme.min.css +1 -0
- package/package.json +42 -22
- package/src/base.js +628 -428
- package/src/convert.js +285 -0
- package/src/export-figma.js +89 -0
- package/src/extra.js +256 -137
- package/src/forms.js +298 -0
- package/src/index.js +254 -90
- package/src/kbd.js +88 -0
- package/src/print.js +92 -0
- package/src/theme-plugin.js +68 -14
- package/src/theme.js +34 -0
- package/src/themes.js +43 -48
- package/src/types/index.d.ts +22 -0
- package/src/types/theme-plugin.d.ts +32 -0
- package/src/types/themes.d.ts +28 -0
package/LICENSE
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c)
|
|
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.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dawid Wąsowski
|
|
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.
|
package/README.md
CHANGED
|
@@ -1,42 +1,46 @@
|
|
|
1
1
|
# 🙌 Clampography
|
|
2
2
|
|
|
3
|
-
**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
|
|
3
|
+
> **WARNING**: Beta 2.0.0 is in development.
|
|
4
|
+
|
|
5
|
+
**Clampography** is a CSS typography system designed mainly for blogs and
|
|
6
|
+
documentation sites. It uses the CSS `clamp()` function for fluid, responsive
|
|
7
|
+
text scaling. Built as a [Tailwind CSS](https://tailwindcss.com/) plugin, it
|
|
8
|
+
delivers production-ready typography with optional theming support. Basic
|
|
9
|
+
features work in about 95% of browsers using standard CSS
|
|
10
|
+
[clamp()](https://caniuse.com/css-math-functions). When you enable Themes with
|
|
11
|
+
[oklch()](https://caniuse.com/wf-oklab) colors, browser support decreases to
|
|
12
|
+
about 92%.
|
|
13
|
+
|
|
14
|
+
- **Typography first:** Fluid, responsive text scaling without any styling
|
|
15
|
+
- **Structure only:** Manages size, spacing, weight, and font-family
|
|
13
16
|
- **Smart scaling:** Contextual elements use `em` (relative), blocks use
|
|
14
|
-
`clamp()` (fluid)
|
|
17
|
+
`clamp()` (fluid)
|
|
18
|
+
- **Optional theming:** Built-in light/dark themes or create your own with
|
|
19
|
+
[OKLCH](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/color_value/oklch)
|
|
20
|
+
colors
|
|
15
21
|
|
|
16
22
|
## The purpose
|
|
17
23
|
|
|
18
24
|
[CSS resets](https://en.wikipedia.org/wiki/Reset_style_sheet) like
|
|
19
25
|
[Tailwind's Preflight](https://tailwindcss.com/docs/preflight) remove all
|
|
20
26
|
browser typography defaults, leaving you with unstyled text. **Clampography**
|
|
21
|
-
delivers production-ready
|
|
22
|
-
automatically, while
|
|
23
|
-
|
|
24
|
-
Visit the temporary [demo page](https://next.dav.one/clampography/) to see how
|
|
25
|
-
it looks.
|
|
27
|
+
delivers production-ready typography that responds to
|
|
28
|
+
[viewport](https://en.wikipedia.org/wiki/Viewport) changes automatically, while
|
|
29
|
+
leaving all aesthetic choices to you. Add themes only if you need them.
|
|
26
30
|
|
|
27
31
|
## Requirements
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
build tool
|
|
31
|
-
[
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
|
|
35
|
-
CSS `@import` combined with `@layer` has about 91% browser coverage and only
|
|
36
|
-
works in browsers released since early 2022.
|
|
33
|
+
- **[Tailwind CSS](https://tailwindcss.com/)** v4
|
|
34
|
+
- A build tool like [Vite](https://vitejs.dev/),
|
|
35
|
+
[Webpack](https://webpack.js.org/), or framework with CSS bundling like
|
|
36
|
+
[Astro](https://astro.build/), [Next.js](https://nextjs.org/),
|
|
37
|
+
[Remix](https://remix.run/),
|
|
38
|
+
[SvelteKit](https://svelte.dev/docs/kit/introduction)
|
|
37
39
|
|
|
38
40
|
## Installation
|
|
39
41
|
|
|
42
|
+
### Via Package Manager (Tailwind Plugin)
|
|
43
|
+
|
|
40
44
|
```bash
|
|
41
45
|
# Install with NPM
|
|
42
46
|
npm install clampography
|
|
@@ -51,21 +55,115 @@ bun install clampography
|
|
|
51
55
|
deno install npm:clampography
|
|
52
56
|
```
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
|
|
59
|
+
## Quick Start
|
|
60
|
+
|
|
61
|
+
### Typography Only
|
|
62
|
+
|
|
63
|
+
Load just the typography system without any colors:
|
|
55
64
|
|
|
56
65
|
```css
|
|
57
|
-
/* First import Tailwind CSS */
|
|
58
66
|
@import "tailwindcss";
|
|
67
|
+
@plugin "clampography";
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Result:**
|
|
71
|
+
|
|
72
|
+
- ✅ Fluid typography (headings, paragraphs, lists, etc.)
|
|
73
|
+
- ✅ Responsive spacing system
|
|
74
|
+
- ✅ Structural base styles
|
|
75
|
+
- ❌ No colors, borders, or decorations
|
|
76
|
+
|
|
77
|
+
Use your own color system with Tailwind utilities:
|
|
78
|
+
|
|
79
|
+
```html
|
|
80
|
+
<div class="bg-white text-gray-900 dark:bg-gray-900 dark:text-white">
|
|
81
|
+
<h1>Fluid Typography</h1>
|
|
82
|
+
<p>Text scales automatically based on viewport size.</p>
|
|
83
|
+
</div>
|
|
84
|
+
```
|
|
59
85
|
|
|
60
|
-
|
|
61
|
-
@import "clampography";
|
|
86
|
+
### Typography + Built-in Themes (Optional)
|
|
62
87
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
88
|
+
Add automatic light/dark theming:
|
|
89
|
+
|
|
90
|
+
```css
|
|
91
|
+
@import "tailwindcss";
|
|
92
|
+
@plugin "clampography" {
|
|
93
|
+
themes: all; /* Loads all built-in themes */
|
|
70
94
|
}
|
|
71
95
|
```
|
|
96
|
+
|
|
97
|
+
**What this adds:**
|
|
98
|
+
|
|
99
|
+
- Automatic light/dark switching based on `prefers-color-scheme`
|
|
100
|
+
- Manual theme switching via `data-theme` attribute
|
|
101
|
+
- Tailwind utilities like `bg-clampography-primary`
|
|
102
|
+
|
|
103
|
+
```html
|
|
104
|
+
<div class="bg-clampography-background text-clampography-text">
|
|
105
|
+
<h1 class="text-clampography-heading">Hello World</h1>
|
|
106
|
+
<button class="bg-clampography-primary">Click Me</button>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<!-- Manual theme switching -->
|
|
110
|
+
<body data-theme="dark">...</body>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Custom Theme (Optional)
|
|
114
|
+
|
|
115
|
+
Create your own theme with OKLCH colors:
|
|
116
|
+
|
|
117
|
+
```css
|
|
118
|
+
@import "tailwindcss";
|
|
119
|
+
@plugin "clampography" {
|
|
120
|
+
themes: false;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@plugin "clampography/theme" {
|
|
124
|
+
name: "brand";
|
|
125
|
+
default: true;
|
|
126
|
+
|
|
127
|
+
primary: "oklch(60% 0.25 270)";
|
|
128
|
+
background: "oklch(99% 0.005 270)";
|
|
129
|
+
text: "oklch(20% 0.02 270)";
|
|
130
|
+
/* Missing colors auto-filled from fallback */
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Configuration Options
|
|
135
|
+
|
|
136
|
+
```css
|
|
137
|
+
@plugin "clampography" {
|
|
138
|
+
themes: "all" | "light, dark" | false; /* Load themes (optional) */
|
|
139
|
+
base: true | false; /* Typography styles (default: true) */
|
|
140
|
+
extra: true | false; /* Enhanced styling (default: false) */
|
|
141
|
+
forms: true | false; /* Styled form elements (default: false) */
|
|
142
|
+
kbd: true | false; /* 3D keyboard key effect on <kbd> (default: false) */
|
|
143
|
+
prefix: "clampography" | false; /* Utility class prefix */
|
|
144
|
+
root: ":root" | "#app"; /* Scope to element */
|
|
145
|
+
logs: true | false; /* Console output */
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Learn More
|
|
150
|
+
|
|
151
|
+
📖 **[Complete Usage Guide](docs/usage.md)** - Detailed documentation covering:
|
|
152
|
+
|
|
153
|
+
- Installation (NPM & CDN)
|
|
154
|
+
- Basic configuration options
|
|
155
|
+
- Built-in themes
|
|
156
|
+
- Creating custom themes
|
|
157
|
+
- Scoped themes for widgets
|
|
158
|
+
- Form styles & Tailwind utilities
|
|
159
|
+
- Troubleshooting
|
|
160
|
+
|
|
161
|
+
## Inspirations
|
|
162
|
+
|
|
163
|
+
Two main inspirations behind this project were:
|
|
164
|
+
- **daisyUI** created by [Pouya Saadeghi](https://saadeghi.com/)
|
|
165
|
+
- The official **Typography** plugin for Tailwind CSS: [tailwindcss-typography](https://github.com/tailwindlabs/tailwindcss-typography)
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
[MIT](LICENSE)
|