clampography 2.0.0-beta.22 → 2.0.0-beta.23
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 +7 -7
- package/package.json +1 -1
- package/src/base.js +10 -14
- package/src/extra.js +1 -29
- package/src/forms.js +115 -0
package/README.md
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
**Clampography** is a pure CSS typography system that uses the
|
|
6
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
|
-
delivers production-ready
|
|
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
|
|
9
10
|
[94% global browser support](https://caniuse.com/css-math-functions), it works
|
|
10
11
|
on nearly all modern devices.
|
|
11
12
|
|
|
@@ -15,16 +16,15 @@ on nearly all modern devices.
|
|
|
15
16
|
`clamp()` (fluid)
|
|
16
17
|
- **Optional theming:** Built-in light/dark themes or create your own with OKLCH
|
|
17
18
|
colors
|
|
18
|
-
- **Tailwind plugin:** Requires Tailwind CSS v4
|
|
19
19
|
|
|
20
20
|
## The purpose
|
|
21
21
|
|
|
22
22
|
[CSS resets](https://en.wikipedia.org/wiki/Reset_style_sheet) like
|
|
23
23
|
[Tailwind's Preflight](https://tailwindcss.com/docs/preflight) remove all
|
|
24
24
|
browser typography defaults, leaving you with unstyled text. **Clampography**
|
|
25
|
-
delivers production-ready typography that responds to
|
|
26
|
-
automatically, while
|
|
27
|
-
you need them.
|
|
25
|
+
delivers production-ready typography that responds to
|
|
26
|
+
[viewport](https://en.wikipedia.org/wiki/Viewport) changes automatically, while
|
|
27
|
+
leaving all aesthetic choices to you. Add themes only if you need them.
|
|
28
28
|
|
|
29
29
|
Visit the temporary [demo page](https://next.dav.one/clampography/) to see how
|
|
30
30
|
it looks.
|
|
@@ -56,7 +56,7 @@ deno install npm:clampography
|
|
|
56
56
|
|
|
57
57
|
## Quick Start
|
|
58
58
|
|
|
59
|
-
### Typography Only
|
|
59
|
+
### Typography Only
|
|
60
60
|
|
|
61
61
|
Load just the typography system without any colors:
|
|
62
62
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clampography",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.23",
|
|
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.js
CHANGED
|
@@ -379,20 +379,6 @@ export default (options = {}) => {
|
|
|
379
379
|
"vertical-align": "middle",
|
|
380
380
|
},
|
|
381
381
|
|
|
382
|
-
[scope("input, button, textarea, select, optgroup")]: {
|
|
383
|
-
"font-family": "inherit",
|
|
384
|
-
"font-size": "100%",
|
|
385
|
-
"line-height": "inherit",
|
|
386
|
-
},
|
|
387
|
-
|
|
388
|
-
[scope("textarea")]: {
|
|
389
|
-
"line-height": "1.5",
|
|
390
|
-
},
|
|
391
|
-
|
|
392
|
-
[scope("button, [type='button'], [type='reset'], [type='submit']")]: {
|
|
393
|
-
cursor: "pointer",
|
|
394
|
-
},
|
|
395
|
-
|
|
396
382
|
// MEDIA
|
|
397
383
|
[scope(":where(img, video, canvas, audio, iframe, svg)")]: {
|
|
398
384
|
"max-width": "100%",
|
|
@@ -485,6 +471,16 @@ export default (options = {}) => {
|
|
|
485
471
|
"line-height": "inherit",
|
|
486
472
|
},
|
|
487
473
|
|
|
474
|
+
// TEST!!!!!!!
|
|
475
|
+
[
|
|
476
|
+
scope(
|
|
477
|
+
"input:not([type='checkbox'], [type='radio']), button, textarea, select",
|
|
478
|
+
)
|
|
479
|
+
]: {
|
|
480
|
+
"background-color": "var(--clampography-background)",
|
|
481
|
+
"color": "var(--clampography-text)",
|
|
482
|
+
},
|
|
483
|
+
|
|
488
484
|
// UTILITIES
|
|
489
485
|
[
|
|
490
486
|
scope(
|
package/src/extra.js
CHANGED
|
@@ -75,6 +75,7 @@ export default (options = {}) => {
|
|
|
75
75
|
"border": "1px solid var(--clampography-border)",
|
|
76
76
|
"border-radius": "0.25rem",
|
|
77
77
|
"padding": "0.125rem var(--spacing-xs)",
|
|
78
|
+
"white-space": "nowrap",
|
|
78
79
|
},
|
|
79
80
|
|
|
80
81
|
[scope("kbd")]: {
|
|
@@ -150,35 +151,6 @@ export default (options = {}) => {
|
|
|
150
151
|
"text-decoration-thickness": "2px",
|
|
151
152
|
},
|
|
152
153
|
|
|
153
|
-
// Buttons
|
|
154
|
-
[scope(":where(button, [type='button'], [type='reset'], [type='submit'])")]:
|
|
155
|
-
{
|
|
156
|
-
"padding": "var(--spacing-xs) var(--spacing-sm)",
|
|
157
|
-
"border": "1px solid var(--clampography-border)",
|
|
158
|
-
"border-radius": "0.375rem",
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
// Inputs
|
|
162
|
-
[
|
|
163
|
-
scope(
|
|
164
|
-
":where(input:not([type='checkbox'], [type='radio']), textarea, select)",
|
|
165
|
-
)
|
|
166
|
-
]: {
|
|
167
|
-
"padding": "var(--spacing-xs) var(--spacing-sm)",
|
|
168
|
-
"border": "1px solid var(--clampography-border)",
|
|
169
|
-
"border-radius": "0.375rem",
|
|
170
|
-
},
|
|
171
|
-
|
|
172
|
-
// Fieldset
|
|
173
|
-
[scope("fieldset")]: {
|
|
174
|
-
"border": "1px solid var(--clampography-border)",
|
|
175
|
-
"border-radius": "0.375rem",
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
[scope("legend")]: {
|
|
179
|
-
"color": "var(--clampography-heading)",
|
|
180
|
-
},
|
|
181
|
-
|
|
182
154
|
// Details
|
|
183
155
|
[scope("details")]: {
|
|
184
156
|
"border": "1px solid var(--clampography-border)",
|
package/src/forms.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
export default (options = {}) => {
|
|
2
|
+
const root = options.root || ":root";
|
|
3
|
+
|
|
4
|
+
// Helper to scope selectors safely
|
|
5
|
+
const scope = (selector) => {
|
|
6
|
+
const parts = [];
|
|
7
|
+
let current = "";
|
|
8
|
+
let depth = 0;
|
|
9
|
+
|
|
10
|
+
for (let i = 0; i < selector.length; i++) {
|
|
11
|
+
const char = selector[i];
|
|
12
|
+
if (char === "(") depth++;
|
|
13
|
+
if (char === ")") depth--;
|
|
14
|
+
if (char === "," && depth === 0) {
|
|
15
|
+
parts.push(current.trim());
|
|
16
|
+
current = "";
|
|
17
|
+
} else {
|
|
18
|
+
current += char;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
parts.push(current.trim());
|
|
22
|
+
|
|
23
|
+
return parts
|
|
24
|
+
.filter(Boolean)
|
|
25
|
+
.map((part) => {
|
|
26
|
+
if (part === ":root" || part === "body") return root;
|
|
27
|
+
return `${root} ${part}`;
|
|
28
|
+
})
|
|
29
|
+
.join(", ");
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
// Forms
|
|
34
|
+
[scope("input, button, textarea, select, optgroup")]: {
|
|
35
|
+
"font-family": "inherit",
|
|
36
|
+
"font-size": "100%",
|
|
37
|
+
"line-height": "inherit",
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
[scope("textarea")]: {
|
|
41
|
+
"line-height": "1.5",
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
[scope("button, [type='button'], [type='reset'], [type='submit']")]: {
|
|
45
|
+
cursor: "pointer",
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
// Buttons
|
|
49
|
+
[scope(":where(button, [type='button'], [type='reset'], [type='submit'])")]:
|
|
50
|
+
{
|
|
51
|
+
"padding": "var(--spacing-xs) var(--spacing-sm)",
|
|
52
|
+
"background-color": "var(--clampography-background)",
|
|
53
|
+
"color": "var(--clampography-text)",
|
|
54
|
+
"border": "1px solid var(--clampography-border)",
|
|
55
|
+
"border-radius": "0.375rem",
|
|
56
|
+
"transition-property": "background-color, border-color",
|
|
57
|
+
"transition-duration": "150ms",
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
[
|
|
61
|
+
scope(
|
|
62
|
+
":where(button, [type='button'], [type='reset'], [type='submit']):hover",
|
|
63
|
+
)
|
|
64
|
+
]: {
|
|
65
|
+
"background-color": "var(--clampography-surface)",
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
// Inputs
|
|
69
|
+
[
|
|
70
|
+
scope(
|
|
71
|
+
":where(input:not([type='checkbox'], [type='radio']), textarea, select)",
|
|
72
|
+
)
|
|
73
|
+
]: {
|
|
74
|
+
"padding": "var(--spacing-xs) var(--spacing-sm)",
|
|
75
|
+
"background-color": "var(--clampography-background)",
|
|
76
|
+
"color": "var(--clampography-text)",
|
|
77
|
+
"border": "1px solid var(--clampography-border)",
|
|
78
|
+
"border-radius": "0.375rem",
|
|
79
|
+
"transition-property": "border-color, box-shadow",
|
|
80
|
+
"transition-duration": "150ms",
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
[
|
|
84
|
+
scope(
|
|
85
|
+
":where(input:not([type='checkbox'], [type='radio']), textarea, select):focus",
|
|
86
|
+
)
|
|
87
|
+
]: {
|
|
88
|
+
"outline": "none",
|
|
89
|
+
"border-color": "var(--clampography-primary)",
|
|
90
|
+
"box-shadow":
|
|
91
|
+
"0 0 0 3px color-mix(in oklab, var(--clampography-primary) 20%, transparent)",
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
// Select
|
|
95
|
+
[scope("select")]: {
|
|
96
|
+
"appearance": "none",
|
|
97
|
+
"background-image":
|
|
98
|
+
`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E")`,
|
|
99
|
+
"background-position": "right 0.5rem center",
|
|
100
|
+
"background-repeat": "no-repeat",
|
|
101
|
+
"background-size": "1.5em 1.5em",
|
|
102
|
+
"padding-right": "2.5rem",
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
// Fieldset & Legend
|
|
106
|
+
[scope("fieldset")]: {
|
|
107
|
+
"border": "1px solid var(--clampography-border)",
|
|
108
|
+
"border-radius": "0.375rem",
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
[scope("legend")]: {
|
|
112
|
+
"color": "var(--clampography-heading)",
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
};
|