clampography 2.0.0-beta.1 → 2.0.0-beta.11

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,5 +1,7 @@
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
7
  function for fluid, responsive text scaling. It's designed as an alternative to
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clampography",
3
- "version": "2.0.0-beta.1",
3
+ "version": "2.0.0-beta.11",
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",
package/src/base.css ADDED
@@ -0,0 +1,583 @@
1
+ @layer base {
2
+ /* --------------------------------------------------------------------------
3
+ ROOT CONFIGURATION
4
+ -------------------------------------------------------------------------- */
5
+
6
+ :root {
7
+ /* Fluid spacing scale */
8
+ --spacing-xs: clamp(0.5rem, 0.375rem + 0.625vw, 0.75rem);
9
+ --spacing-sm: clamp(0.75rem, 0.5625rem + 0.9375vw, 1.25rem);
10
+ --spacing-md: clamp(1rem, 0.75rem + 1.25vw, 1.5rem);
11
+ --spacing-lg: clamp(1.5rem, 1.125rem + 1.875vw, 2.5rem);
12
+ --spacing-xl: clamp(2rem, 1.5rem + 2.5vw, 3rem);
13
+
14
+ /* Utility variables */
15
+ --scroll-offset: 5rem;
16
+
17
+ /* System font stacks - optimal performance & consistency */
18
+ --font-family-base: system-ui, -apple-system, 'Segoe UI', Roboto,
19
+ 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
20
+ --font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
21
+ 'Liberation Mono', 'Courier New', monospace;
22
+ }
23
+
24
+ /* --------------------------------------------------------------------------
25
+ BODY - Global Typography Settings
26
+ -------------------------------------------------------------------------- */
27
+
28
+ body {
29
+ font-family: var(--font-family-base);
30
+ font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
31
+ line-height: 1.75;
32
+
33
+ /* Rendering optimizations */
34
+ text-rendering: optimizeLegibility;
35
+ -webkit-font-smoothing: antialiased;
36
+ -moz-osx-font-smoothing: grayscale;
37
+
38
+ /* Progressive enhancement - better line breaks (Chrome 117+, Safari 16.4+) */
39
+ text-wrap: pretty;
40
+ }
41
+
42
+ /* --------------------------------------------------------------------------
43
+ HEADINGS (H1-H6) - Structural Hierarchy
44
+ -------------------------------------------------------------------------- */
45
+
46
+ :where(h1, h2, h3, h4, h5, h6) {
47
+ font-weight: 600;
48
+ scroll-margin-top: var(--scroll-offset);
49
+ }
50
+
51
+ h1 {
52
+ font-size: clamp(2.25rem, 1.95rem + 1.5vw, 3rem);
53
+ line-height: 1.1111;
54
+ font-weight: 800;
55
+ margin-top: 0;
56
+ margin-bottom: var(--spacing-xl);
57
+ }
58
+
59
+ h2 {
60
+ font-size: clamp(1.5rem, 1.35rem + 0.75vw, 1.875rem);
61
+ line-height: 1.3333;
62
+ font-weight: 700;
63
+ margin-top: var(--spacing-xl);
64
+ margin-bottom: var(--spacing-md);
65
+ }
66
+
67
+ h3 {
68
+ font-size: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
69
+ line-height: 1.5;
70
+ margin-top: var(--spacing-lg);
71
+ margin-bottom: var(--spacing-sm);
72
+ }
73
+
74
+ h4 {
75
+ font-size: clamp(1rem, 0.975rem + 0.125vw, 1.125rem);
76
+ line-height: 1.5;
77
+ margin-top: var(--spacing-lg);
78
+ margin-bottom: var(--spacing-sm);
79
+ }
80
+
81
+ h5 {
82
+ font-size: 1rem;
83
+ line-height: 1.5;
84
+ margin-top: var(--spacing-md);
85
+ margin-bottom: var(--spacing-xs);
86
+ }
87
+
88
+ h6 {
89
+ font-size: 0.875rem;
90
+ line-height: 1.5;
91
+ margin-top: var(--spacing-md);
92
+ margin-bottom: var(--spacing-xs);
93
+ }
94
+
95
+ :is(h1, h2, h3, h4, h5, h6):first-child {
96
+ margin-top: 0;
97
+ }
98
+
99
+ /* --------------------------------------------------------------------------
100
+ LINKS - Clickable Text (Structural Indicators)
101
+ -------------------------------------------------------------------------- */
102
+
103
+ a {
104
+ text-decoration-line: underline;
105
+ text-decoration-thickness: 0.0625em;
106
+ text-underline-offset: 0.15em;
107
+ cursor: pointer;
108
+ }
109
+
110
+ /* Remove underline from heading links */
111
+ :where(h1, h2, h3, h4, h5, h6) a {
112
+ text-decoration: none;
113
+ }
114
+
115
+ /* --------------------------------------------------------------------------
116
+ MENU - Interactive Lists (Toolbars, Navigation)
117
+ -------------------------------------------------------------------------- */
118
+
119
+ menu {
120
+ list-style: none;
121
+ margin-bottom: var(--spacing-md);
122
+ padding-left: 0;
123
+ }
124
+
125
+ /* Remove custom markers from menu items */
126
+ menu > li::before {
127
+ display: none;
128
+ }
129
+
130
+ /* --------------------------------------------------------------------------
131
+ HGROUP - Heading Groups (Title + Subtitle)
132
+ -------------------------------------------------------------------------- */
133
+
134
+ hgroup {
135
+ margin-bottom: var(--spacing-lg);
136
+ }
137
+
138
+ /* Reduce spacing between heading and subtitle */
139
+ hgroup :where(h1, h2, h3, h4, h5, h6) {
140
+ margin-bottom: var(--spacing-xs);
141
+ }
142
+
143
+ /* Subtitle/tagline styling (typically <p>) */
144
+ hgroup :where(p) {
145
+ margin-top: 0;
146
+ margin-bottom: 0;
147
+ font-size: 0.875em;
148
+ font-weight: 400;
149
+ line-height: 1.5;
150
+ }
151
+
152
+ /* --------------------------------------------------------------------------
153
+ TEXT CONTENT - Paragraphs & Inline Elements
154
+ -------------------------------------------------------------------------- */
155
+
156
+ /* Paragraphs */
157
+ p {
158
+ line-height: 1.75;
159
+ margin-bottom: var(--spacing-md);
160
+ }
161
+
162
+ /* Text modifiers - semantic emphasis */
163
+ :where(strong, b) {
164
+ font-weight: 700;
165
+ }
166
+
167
+ :where(em, i, cite, var) {
168
+ font-style: italic;
169
+ }
170
+
171
+ /* Definition term - semantic emphasis with italic */
172
+ dfn {
173
+ font-style: italic;
174
+ font-weight: 600;
175
+ }
176
+
177
+ /* Contextual sizing - uses 'em' to scale with parent */
178
+ small {
179
+ font-size: 0.875em;
180
+ line-height: 1.5;
181
+ }
182
+
183
+ /* Keyboard input - typically user actions */
184
+ kbd {
185
+ font-family: var(--font-family-mono);
186
+ font-size: 0.875em;
187
+ font-weight: 600;
188
+ }
189
+
190
+ /* Sample output - typically program/system output */
191
+ samp {
192
+ font-family: var(--font-family-mono);
193
+ font-size: 0.875em;
194
+ }
195
+
196
+ /* Data element - machine-readable values */
197
+ data {
198
+ font-variant-numeric: tabular-nums;
199
+ }
200
+
201
+ /* Superscript & subscript - essential for scientific notation */
202
+ :where(sub, sup) {
203
+ font-size: 0.75em;
204
+ line-height: 0;
205
+ position: relative;
206
+ vertical-align: baseline;
207
+ }
208
+ sup {
209
+ top: -0.5em;
210
+ }
211
+ sub {
212
+ bottom: -0.25em;
213
+ }
214
+
215
+ /* Abbreviations with titles */
216
+ abbr[title] {
217
+ text-decoration: underline dotted;
218
+ cursor: help;
219
+ }
220
+
221
+ del {
222
+ text-decoration: line-through;
223
+ }
224
+
225
+ ins {
226
+ text-decoration: underline;
227
+ }
228
+
229
+ /* Strikethrough */
230
+ s {
231
+ text-decoration: line-through;
232
+ }
233
+
234
+ /* Underline */
235
+ u {
236
+ text-decoration: underline;
237
+ }
238
+
239
+ /* Mark/Highlight element */
240
+ mark {
241
+ font-style: normal;
242
+ font-weight: inherit;
243
+ }
244
+
245
+ /* Address element */
246
+ address {
247
+ font-style: italic;
248
+ margin-top: var(--spacing-md);
249
+ margin-bottom: var(--spacing-md);
250
+ }
251
+
252
+ /* Time element */
253
+ time {
254
+ font-style: normal;
255
+ font-variant-numeric: tabular-nums;
256
+ }
257
+
258
+ /* --------------------------------------------------------------------------
259
+ BLOCKQUOTES - Structural Spacing Only
260
+ -------------------------------------------------------------------------- */
261
+
262
+ blockquote {
263
+ margin-top: var(--spacing-lg);
264
+ margin-bottom: var(--spacing-lg);
265
+ padding-left: var(--spacing-md);
266
+ }
267
+
268
+ /* Nested blockquotes - reduced spacing for hierarchy */
269
+ blockquote blockquote {
270
+ margin-top: var(--spacing-sm);
271
+ margin-bottom: var(--spacing-sm);
272
+ padding-left: var(--spacing-sm);
273
+ }
274
+
275
+ /* Inline quotes */
276
+ q {
277
+ font-style: inherit;
278
+ /* Browser adds quotation marks automatically */
279
+ }
280
+
281
+ /* --------------------------------------------------------------------------
282
+ LISTS - Custom Structured Markers (Prose-like)
283
+ -------------------------------------------------------------------------- */
284
+
285
+ /* Reset default list styles to build custom ones */
286
+ :where(ul, ol) {
287
+ list-style: none;
288
+ margin-bottom: var(--spacing-md);
289
+ padding-left: clamp(1.5rem, 1.25rem + 1.25vw, 2rem);
290
+ }
291
+
292
+ li {
293
+ position: relative;
294
+ padding-left: 0.375em; /* Space between marker and text */
295
+ }
296
+
297
+ /* Spacing between list items */
298
+ li + li {
299
+ margin-top: var(--spacing-xs);
300
+ }
301
+
302
+ /* Spacing for nested lists - proper separation from parent text */
303
+ li > ul,
304
+ li > ol {
305
+ margin-top: var(--spacing-xs);
306
+ margin-bottom: var(--spacing-sm);
307
+ padding-left: var(--spacing-md);
308
+ }
309
+
310
+ /* Perfectly centered dot relative to the first line of text */
311
+ ul > li::before {
312
+ content: '';
313
+ position: absolute;
314
+ left: -1.125em;
315
+ top: calc(
316
+ 0.875em - 0.1875em
317
+ ); /* Aligns with center of first line (assuming 1.5 line-height) */
318
+ width: 0.375em;
319
+ height: 0.375em;
320
+ background-color: currentColor;
321
+ border-radius: 50%;
322
+ }
323
+
324
+ /* Right-aligned numbers for professional look (e.g. "9." aligns with "10.") */
325
+ ol {
326
+ counter-reset: list-counter;
327
+ }
328
+
329
+ ol > li {
330
+ counter-increment: list-counter;
331
+ }
332
+
333
+ ol > li::before {
334
+ content: counter(list-counter) '.';
335
+ position: absolute;
336
+ left: -2.5em;
337
+ width: 1.75em;
338
+ text-align: right;
339
+ font-weight: 600;
340
+ color: currentColor;
341
+ }
342
+ /* --------------------------------------------------------------------------
343
+ DEFINITION LISTS - Glossaries & Key-Value Pairs
344
+ -------------------------------------------------------------------------- */
345
+
346
+ dl {
347
+ margin-top: var(--spacing-md);
348
+ margin-bottom: var(--spacing-md);
349
+ }
350
+
351
+ dt {
352
+ font-weight: 600;
353
+ margin-top: var(--spacing-sm);
354
+ }
355
+
356
+ /* First dt shouldn't have top margin */
357
+ dt:first-child {
358
+ margin-top: 0;
359
+ }
360
+
361
+ dd {
362
+ margin-left: var(--spacing-md);
363
+ }
364
+
365
+ /* Spacing between term and definition (consistent with lists) */
366
+ dt + dd {
367
+ margin-top: var(--spacing-xs);
368
+ }
369
+
370
+ /* Spacing between multiple definitions (consistent with list items) */
371
+ dd + dd {
372
+ margin-top: var(--spacing-xs);
373
+ }
374
+
375
+ /* Remove bottom margin from last dd */
376
+ dd:last-child {
377
+ margin-bottom: 0;
378
+ }
379
+
380
+ /* --------------------------------------------------------------------------
381
+ CODE BLOCKS - Monospace Typography
382
+ -------------------------------------------------------------------------- */
383
+
384
+ pre {
385
+ margin-top: var(--spacing-md);
386
+ margin-bottom: var(--spacing-md);
387
+ font-family: var(--font-family-mono);
388
+ line-height: 1.6;
389
+ overflow-x: auto;
390
+ }
391
+
392
+ /* Code inside pre blocks */
393
+ pre code {
394
+ font-size: inherit;
395
+ padding: 0;
396
+ background: none;
397
+ border-radius: 0;
398
+ }
399
+
400
+ /* --------------------------------------------------------------------------
401
+ FORMS - Basic Structure
402
+ -------------------------------------------------------------------------- */
403
+
404
+ fieldset {
405
+ margin-top: var(--spacing-md);
406
+ margin-bottom: var(--spacing-md);
407
+ padding: var(--spacing-md);
408
+ border: 0;
409
+ }
410
+
411
+ legend {
412
+ font-weight: 600;
413
+ padding: 0 var(--spacing-xs);
414
+ }
415
+
416
+ /* Form labels - structural emphasis for accessibility */
417
+ label {
418
+ display: inline-block;
419
+ font-weight: 600;
420
+ margin-bottom: var(--spacing-xs);
421
+ }
422
+
423
+ /* Form output element - typically displays calculation results */
424
+ output {
425
+ display: inline-block;
426
+ font-variant-numeric: tabular-nums;
427
+ }
428
+
429
+ /* Visual indicator elements - structural spacing only */
430
+ :where(meter, progress) {
431
+ display: inline-block;
432
+ vertical-align: middle;
433
+ }
434
+
435
+ /* --------------------------------------------------------------------------
436
+ FORM CONTROLS - Typography Inheritance
437
+ -------------------------------------------------------------------------- */
438
+
439
+ input,
440
+ button,
441
+ textarea,
442
+ select,
443
+ optgroup {
444
+ font-family: inherit;
445
+ font-size: 100%;
446
+ line-height: inherit;
447
+ }
448
+
449
+ /* Textarea - proper line height for multi-line input */
450
+ textarea {
451
+ line-height: 1.5;
452
+ }
453
+
454
+ /* Button cursor - indicates interactivity */
455
+ button,
456
+ [type='button'],
457
+ [type='reset'],
458
+ [type='submit'] {
459
+ cursor: pointer;
460
+ }
461
+
462
+ /* --------------------------------------------------------------------------
463
+ MEDIA - Images, Videos, Figures
464
+ -------------------------------------------------------------------------- */
465
+
466
+ :where(img, video, canvas, audio, iframe, svg) {
467
+ max-width: 100%;
468
+ height: auto;
469
+ vertical-align: middle;
470
+ }
471
+
472
+ figure {
473
+ margin-top: var(--spacing-lg);
474
+ margin-bottom: var(--spacing-lg);
475
+ }
476
+
477
+ figcaption {
478
+ margin-top: 0.375rem;
479
+ font-size: 0.875em;
480
+ line-height: 1.5;
481
+ }
482
+
483
+ /* --------------------------------------------------------------------------
484
+ TABLES - Structural Layout
485
+ -------------------------------------------------------------------------- */
486
+
487
+ table {
488
+ width: 100%;
489
+ margin-top: var(--spacing-md);
490
+ margin-bottom: var(--spacing-md);
491
+ border-collapse: collapse;
492
+ font-size: 1em;
493
+ line-height: 1.6;
494
+ }
495
+
496
+ caption {
497
+ margin-bottom: var(--spacing-xs);
498
+ font-size: 0.875em;
499
+ font-weight: 600;
500
+ text-align: left;
501
+ }
502
+
503
+ th,
504
+ td {
505
+ padding: var(--spacing-xs) var(--spacing-sm);
506
+ text-align: left;
507
+ }
508
+
509
+ th {
510
+ font-weight: 600;
511
+ }
512
+
513
+ /* Table sections - structural differentiation */
514
+ thead th {
515
+ vertical-align: bottom;
516
+ }
517
+
518
+ tbody th,
519
+ tbody td {
520
+ vertical-align: top;
521
+ }
522
+
523
+ tfoot th,
524
+ tfoot td {
525
+ vertical-align: top;
526
+ }
527
+
528
+ /* Add spacing between tbody sections if multiple exist */
529
+ tbody + tbody {
530
+ border-top-width: 2px;
531
+ }
532
+
533
+ /* --------------------------------------------------------------------------
534
+ SEPARATORS - Spacing Only
535
+ -------------------------------------------------------------------------- */
536
+
537
+ hr {
538
+ margin-top: var(--spacing-xl);
539
+ margin-bottom: var(--spacing-xl);
540
+ border: 0;
541
+ border-top: 1px solid;
542
+ }
543
+
544
+ /* --------------------------------------------------------------------------
545
+ INTERACTIVE ELEMENTS - Accessibility
546
+ -------------------------------------------------------------------------- */
547
+
548
+ :where(:focus, :focus-visible) {
549
+ outline-offset: 2px;
550
+ }
551
+
552
+ details {
553
+ margin-top: var(--spacing-md);
554
+ margin-bottom: var(--spacing-md);
555
+ }
556
+
557
+ summary {
558
+ cursor: pointer;
559
+ font-weight: 600;
560
+ }
561
+
562
+ details[open] > summary {
563
+ margin-bottom: var(--spacing-xs);
564
+ }
565
+
566
+ dialog {
567
+ font-size: inherit;
568
+ line-height: inherit;
569
+ }
570
+
571
+ /* --------------------------------------------------------------------------
572
+ UTILITIES - Margin Cleanup
573
+ -------------------------------------------------------------------------- */
574
+
575
+ :where(h1, h2, h3, h4, h5, h6, p, ul:not(li > ul, li > ol), ol:not(li > ul, li
576
+ > ol), dl, blockquote, figure, table, pre):first-child {
577
+ margin-top: 0;
578
+ }
579
+
580
+ :where(p, ul, ol, dl, blockquote, figure, table, pre):last-child {
581
+ margin-bottom: 0;
582
+ }
583
+ }