clampography 2.0.0-beta.23 → 2.0.0-beta.24

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 CHANGED
@@ -1,20 +1,20 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 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.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 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
@@ -2,19 +2,21 @@
2
2
 
3
3
  > **WARNING**: Beta 2.0.0 is in development and currently unstable.
4
4
 
5
- **Clampography** is a pure CSS typography system that uses the
6
- [clamp()](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/clamp)
7
- function for fluid, responsive text scaling. Built as a
8
- [Tailwind CSS](https://tailwindcss.com/) plugin, it delivers production-ready
9
- typography with optional theming support. With
10
- [94% global browser support](https://caniuse.com/css-math-functions), it works
11
- on nearly all modern devices.
5
+ **Clampography** is a pure 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%.
12
13
 
13
14
  - **Typography first:** Fluid, responsive text scaling without any styling
14
15
  - **Structure only:** Manages size, spacing, weight, and font-family
15
16
  - **Smart scaling:** Contextual elements use `em` (relative), blocks use
16
17
  `clamp()` (fluid)
17
- - **Optional theming:** Built-in light/dark themes or create your own with OKLCH
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)
18
20
  colors
19
21
 
20
22
  ## The purpose
@@ -26,8 +28,7 @@ delivers production-ready typography that responds to
26
28
  [viewport](https://en.wikipedia.org/wiki/Viewport) changes automatically, while
27
29
  leaving all aesthetic choices to you. Add themes only if you need them.
28
30
 
29
- Visit the temporary [demo page](https://next.dav.one/clampography/) to see how
30
- it looks.
31
+
31
32
 
32
33
  ## Requirements
33
34
 
@@ -40,6 +41,8 @@ it looks.
40
41
 
41
42
  ## Installation
42
43
 
44
+ ### Via Package Manager (Tailwind Plugin)
45
+
43
46
  ```bash
44
47
  # Install with NPM
45
48
  npm install clampography
@@ -54,6 +57,30 @@ bun install clampography
54
57
  deno install npm:clampography
55
58
  ```
56
59
 
60
+ ### Via CDN (Vanilla CSS)
61
+
62
+ If you aren't using Tailwind CSS, you can drop the pre-built stylesheet into your HTML to get all base typography, extra styles, forms, and keyboard key styling instantly.
63
+
64
+ #### Option 1: All-in-One (Recommended)
65
+ This includes `base`, `extra`, `forms`, and `kbd` in a single file.
66
+ ```html
67
+ <link rel="stylesheet" href="https://unpkg.com/clampography/css/clampography.min.css" />
68
+ <!-- or -->
69
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/clampography/css/clampography.min.css" />
70
+ ```
71
+
72
+ #### Option 2: Modular
73
+ If you only want specific modules, you can load them individually. Note that `base.min.css` is required for the fluid typography to work.
74
+ ```html
75
+ <!-- Required -->
76
+ <link rel="stylesheet" href="https://unpkg.com/clampography/css/base.min.css" />
77
+
78
+ <!-- Optional additions -->
79
+ <link rel="stylesheet" href="https://unpkg.com/clampography/css/extra.min.css" />
80
+ <link rel="stylesheet" href="https://unpkg.com/clampography/css/forms.min.css" />
81
+ <link rel="stylesheet" href="https://unpkg.com/clampography/css/kbd.min.css" />
82
+ ```
83
+
57
84
  ## Quick Start
58
85
 
59
86
  ### Typography Only
@@ -67,7 +94,7 @@ Load just the typography system without any colors:
67
94
 
68
95
  **Result:**
69
96
 
70
- - ✅ Fluid typography (headings, paragraphs, lists)
97
+ - ✅ Fluid typography (headings, paragraphs, lists, etc.)
71
98
  - ✅ Responsive spacing system
72
99
  - ✅ Structural base styles
73
100
  - ❌ No colors, borders, or decorations
@@ -88,7 +115,7 @@ Add automatic light/dark theming:
88
115
  ```css
89
116
  @import "tailwindcss";
90
117
  @plugin "clampography" {
91
- themes: all; /* Loads light, dark, retro, and cyberpunk */
118
+ themes: all; /* Loads all built-in themes */
92
119
  }
93
120
  ```
94
121
 
@@ -136,6 +163,8 @@ Create your own theme with OKLCH colors:
136
163
  themes: "all" | "light, dark" | false; /* Load themes (optional) */
137
164
  base: true | false; /* Typography styles (default: true) */
138
165
  extra: true | false; /* Enhanced styling (default: false) */
166
+ forms: true | false; /* Styled form elements (default: false) */
167
+ kbd: true | false; /* 3D keyboard key effect on <kbd> (default: false) */
139
168
  prefix: "clampography" | false; /* Utility class prefix */
140
169
  root: ":root" | "#app"; /* Scope to element */
141
170
  logs: true | false; /* Console output */
@@ -144,16 +173,22 @@ Create your own theme with OKLCH colors:
144
173
 
145
174
  ## Learn More
146
175
 
147
- 📖 **[Complete Usage Guide](USAGE.md)** - Detailed documentation:
176
+ 📖 **[Complete Usage Guide](docs/usage.md)** - Detailed documentation:
148
177
 
149
178
  - All configuration options
150
- - Built-in themes (light, dark, retro, cyberpunk)
179
+ - Built-in themes
151
180
  - Creating custom themes
152
181
  - Scoped themes for widgets
153
182
  - Advanced scenarios
154
183
  - Tailwind utilities
155
184
  - Troubleshooting
156
185
 
186
+ ## Inspirations
187
+
188
+ Two main inspirations behind this project were:
189
+ - **daisyUI** created by [Pouya Saadeghi](https://saadeghi.com/)
190
+ - The official **Typography** plugin for Tailwind CSS: [tailwindcss-typography](https://github.com/tailwindlabs/tailwindcss-typography)
191
+
157
192
  ## License
158
193
 
159
- MIT
194
+ [MIT](LICENSE)
@@ -6,6 +6,7 @@
6
6
  --spacing-md: clamp(1rem, 0.75rem + 1.25vw, 1.5rem);
7
7
  --spacing-lg: clamp(1.5rem, 1.125rem + 1.875vw, 2.5rem);
8
8
  --spacing-xl: clamp(2rem, 1.5rem + 2.5vw, 3rem);
9
+ --list-indent: clamp(1.5rem, 1.25rem + 1.25vw, 2rem);
9
10
  --scroll-offset: 5rem;
10
11
  --font-family-base: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
11
12
  --font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
@@ -213,29 +214,38 @@
213
214
  :root :where(ul, ol) {
214
215
  list-style: none;
215
216
  margin-bottom: var(--spacing-md);
216
- padding-left: clamp(1.5rem, 1.25rem + 1.25vw, 2rem);
217
+ padding-left: var(--list-indent);
217
218
  }
218
219
 
219
220
  :root li {
220
221
  position: relative;
221
- padding-left: 0.375em;
222
222
  }
223
223
 
224
224
  :root li + li {
225
225
  margin-top: var(--spacing-xs);
226
226
  }
227
227
 
228
- :root li > ul, :root li > ol {
229
- margin-top: var(--spacing-xs);
228
+ :root li > :where(p, dl, figure, table, pre) {
229
+ margin-top: 0;
230
+ margin-bottom: 0;
231
+ }
232
+
233
+ :root li > blockquote {
234
+ margin-top: var(--spacing-sm);
230
235
  margin-bottom: var(--spacing-sm);
231
- padding-left: var(--spacing-md);
236
+ }
237
+
238
+ :root li > :where(ul, ol) {
239
+ margin-top: var(--spacing-xs);
240
+ margin-bottom: 0;
232
241
  }
233
242
 
234
243
  :root ul > li::before {
235
244
  content: '';
236
245
  position: absolute;
237
- left: -1.125em;
238
- top: calc(0.875em - 0.1875em);
246
+ right: 100%;
247
+ margin-right: 0.75em;
248
+ top: 0.65em;
239
249
  width: 0.375em;
240
250
  height: 0.375em;
241
251
  background-color: currentColor;
@@ -253,10 +263,11 @@
253
263
  :root ol > li::before {
254
264
  content: counter(list-counter) '.';
255
265
  position: absolute;
256
- left: -2.5em;
257
- width: 1.75em;
258
- text-align: right;
266
+ right: 100%;
267
+ margin-right: 0.5em;
259
268
  font-weight: 600;
269
+ font-variant-numeric: tabular-nums;
270
+ text-align: right;
260
271
  color: currentColor;
261
272
  }
262
273
 
@@ -305,6 +316,20 @@
305
316
  border-radius: 0;
306
317
  }
307
318
 
319
+ :root input, :root button, :root textarea, :root select, :root optgroup {
320
+ font-family: inherit;
321
+ font-size: 100%;
322
+ line-height: inherit;
323
+ }
324
+
325
+ :root textarea {
326
+ line-height: 1.5;
327
+ }
328
+
329
+ :root button, :root [type='button'], :root [type='reset'], :root [type='submit'] {
330
+ cursor: pointer;
331
+ }
332
+
308
333
  :root fieldset {
309
334
  margin-top: var(--spacing-md);
310
335
  margin-bottom: var(--spacing-md);
@@ -332,20 +357,6 @@
332
357
  vertical-align: middle;
333
358
  }
334
359
 
335
- :root input, :root button, :root textarea, :root select, :root optgroup {
336
- font-family: inherit;
337
- font-size: 100%;
338
- line-height: inherit;
339
- }
340
-
341
- :root textarea {
342
- line-height: 1.5;
343
- }
344
-
345
- :root button, :root [type='button'], :root [type='reset'], :root [type='submit'] {
346
- cursor: pointer;
347
- }
348
-
349
360
  :root :where(img, video, canvas, audio, iframe, svg) {
350
361
  max-width: 100%;
351
362
  height: auto;
@@ -0,0 +1 @@
1
+ @layer base{:root{--spacing-xs:clamp(0.5rem, 0.375rem + 0.625vw, 0.75rem);--spacing-sm:clamp(0.75rem, 0.5625rem + 0.9375vw, 1.25rem);--spacing-md:clamp(1rem, 0.75rem + 1.25vw, 1.5rem);--spacing-lg:clamp(1.5rem, 1.125rem + 1.875vw, 2.5rem);--spacing-xl:clamp(2rem, 1.5rem + 2.5vw, 3rem);--list-indent:clamp(1.5rem, 1.25rem + 1.25vw, 2rem);--scroll-offset:5rem;--font-family-base:system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;--font-family-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;font-family:var(--font-family-base);font-size:clamp(1rem, 0.95rem + 0.25vw, 1.125rem);line-height:1.75;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-wrap:pretty}:root :where(h1, h2, h3, h4, h5, h6){font-weight:600;scroll-margin-top:var(--scroll-offset)}:root h1{font-size:clamp(2.25rem, 1.95rem + 1.5vw, 3rem);line-height:1.1111;font-weight:800;margin-top:0;margin-bottom:var(--spacing-xl)}:root h2{font-size:clamp(1.5rem, 1.35rem + 0.75vw, 1.875rem);line-height:1.3333;font-weight:700;margin-top:var(--spacing-xl);margin-bottom:var(--spacing-md)}:root h3{font-size:clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);line-height:1.5;margin-top:var(--spacing-lg);margin-bottom:var(--spacing-sm)}:root h4{font-size:clamp(1rem, 0.975rem + 0.125vw, 1.125rem);line-height:1.5;margin-top:var(--spacing-lg);margin-bottom:var(--spacing-sm)}:root h5{font-size:1rem;line-height:1.5;margin-top:var(--spacing-md);margin-bottom:var(--spacing-xs)}:root h6{font-size:0.875rem;line-height:1.5;margin-top:var(--spacing-md);margin-bottom:var(--spacing-xs)}:root :is(h1, h2, h3, h4, h5, h6):first-child{margin-top:0}:root a{text-decoration-line:underline;cursor:pointer}:root :where(h1, h2, h3, h4, h5, h6) a{text-decoration:none}:root menu{list-style:none;margin-bottom:var(--spacing-md);padding-left:0}:root menu > li::before{display:none}:root hgroup{margin-bottom:var(--spacing-lg)}:root hgroup :where(h1, h2, h3, h4, h5, h6){margin-bottom:var(--spacing-xs)}:root hgroup :where(p){margin-top:0;margin-bottom:0;font-size:0.875em;font-weight:400;line-height:1.5}:root p{line-height:1.75;margin-bottom:var(--spacing-md)}:root :where(strong, b){font-weight:700}:root :where(em, i, cite, var){font-style:italic}:root dfn{font-style:italic;font-weight:600}:root small{font-size:0.875em;line-height:1.5}:root :where(code, kbd, samp){font-family:var(--font-family-mono);font-size:0.875em}:root kbd{font-weight:600}:root data{font-variant-numeric:tabular-nums}:root :where(sub, sup){font-size:0.75em;line-height:0;position:relative;vertical-align:baseline}:root sup{top:-0.5em}:root sub{bottom:-0.25em}:root abbr[title]{text-decoration:underline dotted;cursor:help}:root del{text-decoration:line-through}:root ins{text-decoration:underline}:root s{text-decoration:line-through}:root u{text-decoration:underline}:root mark{font-style:normal;font-weight:inherit}:root address{font-style:italic;margin-top:var(--spacing-md);margin-bottom:var(--spacing-md)}:root time{font-style:normal;font-variant-numeric:tabular-nums}:root blockquote{margin-top:var(--spacing-lg);margin-bottom:var(--spacing-lg);padding-left:var(--spacing-md)}:root blockquote blockquote{margin-top:var(--spacing-sm);margin-bottom:var(--spacing-sm);padding-left:var(--spacing-sm)}:root q{font-style:inherit}:root :where(ul, ol){list-style:none;margin-bottom:var(--spacing-md);padding-left:var(--list-indent)}:root li{position:relative}:root li + li{margin-top:var(--spacing-xs)}:root li > :where(p, dl, figure, table, pre){margin-top:0;margin-bottom:0}:root li > blockquote{margin-top:var(--spacing-sm);margin-bottom:var(--spacing-sm)}:root li > :where(ul, ol){margin-top:var(--spacing-xs);margin-bottom:0}:root ul > li::before{content:'';position:absolute;right:100%;margin-right:0.75em;top:0.65em;width:0.375em;height:0.375em;background-color:currentColor;border-radius:50%}:root ol{counter-reset:list-counter}:root ol > li{counter-increment:list-counter}:root ol > li::before{content:counter(list-counter) '.';position:absolute;right:100%;margin-right:0.5em;font-weight:600;font-variant-numeric:tabular-nums;text-align:right;color:currentColor}:root dl{margin-top:var(--spacing-md);margin-bottom:var(--spacing-md)}:root dt{font-weight:600;margin-top:var(--spacing-sm)}:root dt:first-child{margin-top:0}:root dd{margin-left:var(--spacing-md)}:root dt + dd{margin-top:var(--spacing-xs)}:root dd + dd{margin-top:var(--spacing-xs)}:root dd:last-child{margin-bottom:0}:root pre{margin-top:var(--spacing-md);margin-bottom:var(--spacing-md);font-family:var(--font-family-mono);line-height:1.6;overflow-x:auto}:root pre code{font-size:inherit;padding:0;background:none;border-radius:0}:root input, :root button, :root textarea, :root select, :root optgroup{font-family:inherit;font-size:100%;line-height:inherit}:root textarea{line-height:1.5}:root button, :root [type='button'], :root [type='reset'], :root [type='submit']{cursor:pointer}:root fieldset{margin-top:var(--spacing-md);margin-bottom:var(--spacing-md);padding:var(--spacing-md)}:root legend{font-weight:600;padding:0 var(--spacing-xs)}:root label{display:inline-block;font-weight:600;margin-bottom:var(--spacing-xs)}:root output{display:inline-block;font-variant-numeric:tabular-nums}:root :where(meter, progress){display:inline-block;vertical-align:middle}:root :where(img, video, canvas, audio, iframe, svg){max-width:100%;height:auto;vertical-align:middle}:root figure{margin-top:var(--spacing-lg);margin-bottom:var(--spacing-lg)}:root figcaption{margin-top:0.375rem;font-size:0.875em;line-height:1.5}:root table{width:100%;margin-top:var(--spacing-md);margin-bottom:var(--spacing-md);border-collapse:collapse;font-size:1em;line-height:1.6}:root caption{margin-bottom:var(--spacing-xs);font-size:0.875em;font-weight:600;text-align:left}:root th, :root td{padding:var(--spacing-xs) var(--spacing-sm);text-align:left}:root th{font-weight:600}:root thead th{vertical-align:bottom}:root tbody th, :root tbody td{vertical-align:top}:root tfoot th, :root tfoot td{vertical-align:top}:root tbody + tbody{border-top-width:2px}:root hr{margin-top:var(--spacing-xl);margin-bottom:var(--spacing-xl);border:0;border-top:1px solid}:root :where(:focus, :focus-visible){outline-offset:2px}:root details{margin-top:var(--spacing-md);margin-bottom:var(--spacing-md)}:root summary{cursor:pointer;font-weight:600}:root details[open] > summary{margin-bottom:var(--spacing-xs)}:root dialog{font-size:inherit;line-height:inherit}:root :where(h1, h2, h3, h4, h5, h6, p, ul:not(li > ul, li > ol), ol:not(li > ul, li > ol), dl, blockquote, figure, table, pre):first-child{margin-top:0}:root :where(p, ul, ol, dl, blockquote, figure, table, pre):last-child{margin-bottom:0}}