clampography 0.9.9 → 2.0.0-beta.1

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
@@ -15,10 +15,12 @@ on nearly all modern devices.
15
15
 
16
16
  ## The purpose
17
17
 
18
- CSS resets like [Tailwind's Preflight](https://tailwindcss.com/docs/preflight)
19
- remove all browser typography defaults, leaving you with unstyled text.
20
- **Clampography** delivers production-ready text scaling that responds to
21
- viewport changes automatically, while leaving all aesthetic choices to you.
18
+ [CSS resets](https://en.wikipedia.org/wiki/Reset_style_sheet) like
19
+ [Tailwind's Preflight](https://tailwindcss.com/docs/preflight) remove all
20
+ 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.
23
+
22
24
  Visit the temporary [demo page](https://next.dav.one/clampography/) to see how
23
25
  it looks.
24
26
 
package/package.json CHANGED
@@ -1,22 +1,21 @@
1
1
  {
2
2
  "name": "clampography",
3
- "version": "0.9.9",
4
- "description": "Fluid typography system based on CSS clamp(). Alternative to Tailwind CSS Typography plugin.",
5
- "main": "clampography.css",
6
- "style": "clampography.css",
7
- "files": [
8
- "clampography.css",
9
- "presets/"
10
- ],
3
+ "version": "2.0.0-beta.1",
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
+ "main": "src/index.js",
6
+ "type": "module",
11
7
  "exports": {
12
- ".": "./clampography.css",
13
- "./base": "./clampography.css",
14
- "./*": "./presets/*.css"
8
+ ".": "./src/index.js",
9
+ "./theme": "./src/theme-plugin.js"
15
10
  },
11
+ "files": [
12
+ "src"
13
+ ],
16
14
  "keywords": [
17
15
  "alternative",
18
16
  "blog",
19
17
  "clamp",
18
+ "clampography",
20
19
  "content",
21
20
  "css",
22
21
  "fluid",
@@ -25,11 +24,14 @@
25
24
  "font-size",
26
25
  "markdown",
27
26
  "style",
27
+ "styles",
28
28
  "tailwind",
29
29
  "tailwind-css",
30
30
  "tailwind-plugin",
31
31
  "tailwindcss",
32
32
  "text",
33
+ "theme",
34
+ "themes",
33
35
  "typography"
34
36
  ],
35
37
  "repository": {
@@ -38,5 +40,11 @@
38
40
  },
39
41
  "homepage": "https://next.dav.one/clampography/",
40
42
  "author": "Dawid Wąsowski",
41
- "license": "MIT"
43
+ "license": "MIT",
44
+ "peerDependencies": {
45
+ "tailwindcss": ">=4.0.0"
46
+ },
47
+ "devDependencies": {
48
+ "tailwindcss": "^4.0.0"
49
+ }
42
50
  }
package/src/base.js ADDED
@@ -0,0 +1,426 @@
1
+ /**
2
+ * Base typography and reset styles converted from base.css
3
+ */
4
+ export default {
5
+ // Global CSS Variables
6
+ "@layer base": {
7
+ ":root": {
8
+ "--spacing-sm": "clamp(0.75rem, 0.5625rem + 0.9375vw, 1.25rem)",
9
+ "--spacing-md": "clamp(1rem, 0.75rem + 1.25vw, 1.5rem)",
10
+ "--spacing-lg": "clamp(1.5rem, 1.125rem + 1.875vw, 2.5rem)",
11
+ "--spacing-xl": "clamp(2rem, 1.5rem + 2.5vw, 3rem)",
12
+ "--scroll-offset": "5rem",
13
+ "--font-family-base":
14
+ "system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif",
15
+ "--font-family-mono":
16
+ "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace",
17
+ },
18
+ },
19
+
20
+ // Typography & Resets
21
+ "body": {
22
+ "font-family": "var(--font-family-base)",
23
+ "font-size": "clamp(1rem, 0.95rem + 0.25vw, 1.125rem)",
24
+ "line-height": "1.75",
25
+ "text-rendering": "optimizeLegibility",
26
+ "-webkit-font-smoothing": "antialiased",
27
+ "-moz-osx-font-smoothing": "grayscale",
28
+ "text-wrap": "pretty",
29
+ },
30
+
31
+ ":where(h1, h2, h3, h4, h5, h6)": {
32
+ "font-weight": "700",
33
+ "scroll-margin-top": "var(--scroll-offset)",
34
+ "font-size": "1rem",
35
+ "line-height": "1.5",
36
+ "margin-top": "0",
37
+ "margin-bottom": "var(--spacing-xs)",
38
+ "text-decoration": "none",
39
+ "break-after": "avoid",
40
+ },
41
+
42
+ "h1": {
43
+ "font-size": "clamp(2.25rem, 1.95rem + 1.5vw, 3rem)",
44
+ "line-height": "1.1111",
45
+ "font-weight": "800",
46
+ "margin-top": "0",
47
+ "margin-bottom": "var(--spacing-xl)",
48
+ },
49
+
50
+ "h6": {
51
+ "font-size": "0.875rem",
52
+ "line-height": "1.5",
53
+ "margin-top": "0",
54
+ "margin-bottom": "var(--spacing-xs)",
55
+ },
56
+
57
+ "a": {
58
+ "text-decoration-line": "underline",
59
+ "text-decoration-thickness": "0.0625em",
60
+ "text-underline-offset": "0.15em",
61
+ "cursor": "pointer",
62
+ "text-decoration": "underline",
63
+ },
64
+
65
+ ":where(h1, h2, h3, h4, h5, h6) a": {
66
+ "text-decoration": "none",
67
+ },
68
+
69
+ "menu": {
70
+ "list-style": "none",
71
+ "margin-bottom": "var(--spacing-md)",
72
+ "padding-left": "0",
73
+ },
74
+
75
+ "menu > li::before": {
76
+ "display": "none",
77
+ },
78
+
79
+ "hgroup": {
80
+ "margin-bottom": "var(--spacing-lg)",
81
+ },
82
+
83
+ "hgroup :where(h1, h2, h3, h4, h5, h6)": {
84
+ "margin-bottom": "var(--spacing-xs)",
85
+ },
86
+
87
+ "hgroup :where(p)": {
88
+ "margin-top": "0",
89
+ "margin-bottom": "0",
90
+ "font-size": "0.875em",
91
+ "font-weight": "400",
92
+ "line-height": "1.5",
93
+ },
94
+
95
+ "p": {
96
+ "line-height": "1.75",
97
+ "margin-bottom": "var(--spacing-md)",
98
+ "margin-top": "0",
99
+ },
100
+
101
+ ":where(strong, b)": {
102
+ "font-weight": "700",
103
+ },
104
+
105
+ ":where(em, i, cite, var)": {
106
+ "font-style": "italic",
107
+ },
108
+
109
+ "dfn": {
110
+ "font-style": "normal",
111
+ "font-weight": "600",
112
+ },
113
+
114
+ "small": {
115
+ "font-size": "0.875em",
116
+ "line-height": "1.5",
117
+ },
118
+
119
+ ":where(code, kbd, samp)": {
120
+ "font-family": "var(--font-family-mono)",
121
+ "padding":
122
+ "clamp(0.0625rem, 0.05rem + 0.0625vw, 0.125rem) clamp(0.1875rem, 0.15rem + 0.1875vw, 0.3125rem)",
123
+ },
124
+
125
+ ":where(code:not(pre code))": {
126
+ "padding":
127
+ "clamp(0.0625rem, 0.05rem + 0.0625vw, 0.125rem) clamp(0.1875rem, 0.15rem + 0.1875vw, 0.3125rem)",
128
+ },
129
+
130
+ ":where(sub, sup)": {
131
+ "font-size": "0.75em",
132
+ "line-height": "0",
133
+ "position": "relative",
134
+ "vertical-align": "baseline",
135
+ },
136
+
137
+ "sup": {
138
+ "top": "-0.5em",
139
+ },
140
+
141
+ "sub": {
142
+ "bottom": "-0.25em",
143
+ },
144
+
145
+ "abbr[title]": {
146
+ "text-decoration": "underline dotted",
147
+ "cursor": "help",
148
+ },
149
+
150
+ "del": {
151
+ "text-decoration": "line-through",
152
+ },
153
+
154
+ "ins": {
155
+ "text-decoration": "underline",
156
+ },
157
+
158
+ "s": {
159
+ "text-decoration": "line-through",
160
+ },
161
+
162
+ "u": {
163
+ "text-decoration": "underline",
164
+ },
165
+
166
+ "mark": {
167
+ "font-style": "normal",
168
+ "font-weight": "inherit",
169
+ },
170
+
171
+ "address": {
172
+ "font-style": "normal",
173
+ "margin-top": "var(--spacing-md)",
174
+ "margin-bottom": "var(--spacing-md)",
175
+ },
176
+
177
+ "time": {
178
+ "font-style": "normal",
179
+ "font-variant-numeric": "tabular-nums",
180
+ },
181
+
182
+ "blockquote": {
183
+ "margin-top": "0",
184
+ "margin-bottom": "0",
185
+ "padding-left": "var(--spacing-md)",
186
+ },
187
+
188
+ "blockquote blockquote": {
189
+ "margin-top": "var(--spacing-sm)",
190
+ "margin-bottom": "var(--spacing-sm)",
191
+ "padding-left": "var(--spacing-sm)",
192
+ },
193
+
194
+ "q": {
195
+ "font-style": "inherit",
196
+ },
197
+
198
+ ":where(ul, ol)": {
199
+ "list-style": "none",
200
+ "margin-bottom": "0",
201
+ "padding-left": "var(--spacing-md)",
202
+ "margin-top": "var(--spacing-xs)",
203
+ },
204
+
205
+ "li": {
206
+ "position": "relative",
207
+ "padding-left": "0.375em",
208
+ },
209
+
210
+ "li + li": {
211
+ "margin-top": "var(--spacing-xs)",
212
+ },
213
+
214
+ "li > :where(ul, ol):first-child": {
215
+ "margin-top": "var(--spacing-xs)",
216
+ },
217
+
218
+ "ul > li::before": {
219
+ "content": "''",
220
+ "position": "absolute",
221
+ "left": "-1.125em",
222
+ "top": "calc(0.875em - 0.1875em)",
223
+ "width": "0.375em",
224
+ "height": "0.375em",
225
+ "background-color": "currentColor",
226
+ "border-radius": "50%",
227
+ },
228
+
229
+ "ol": {
230
+ "counter-reset": "list-counter",
231
+ "margin-top": "0",
232
+ "margin-bottom": "0",
233
+ },
234
+
235
+ "ol > li": {
236
+ "counter-increment": "list-counter",
237
+ },
238
+
239
+ "ol > li::before": {
240
+ "content": "counter(list-counter) '.'",
241
+ "position": "absolute",
242
+ "left": "-2.5em",
243
+ "width": "1.75em",
244
+ "text-align": "right",
245
+ "font-weight": "600",
246
+ "color": "currentColor",
247
+ },
248
+
249
+ ":where(ul, ol) :where(ul, ol)": {
250
+ "margin-bottom": "0",
251
+ "padding-left": "var(--spacing-md)",
252
+ },
253
+
254
+ "dl": {
255
+ "margin-top": "0",
256
+ "margin-bottom": "0",
257
+ },
258
+
259
+ "dt": {
260
+ "font-weight": "600",
261
+ "margin-top": "var(--spacing-sm)",
262
+ },
263
+
264
+ "dt:first-child": {
265
+ "margin-top": "0",
266
+ },
267
+
268
+ "dd": {
269
+ "margin-left": "var(--spacing-md)",
270
+ },
271
+
272
+ "dt + dd": {
273
+ "margin-top": "var(--spacing-xs)",
274
+ },
275
+
276
+ "dd + dd": {
277
+ "margin-top": "var(--spacing-xs)",
278
+ },
279
+
280
+ "dd:last-child": {
281
+ "margin-bottom": "0",
282
+ },
283
+
284
+ "pre": {
285
+ "margin-top": "var(--spacing-md)",
286
+ "margin-bottom": "var(--spacing-md)",
287
+ "font-family": "var(--font-family-mono)",
288
+ "line-height": "1.6",
289
+ "overflow-x": "auto",
290
+ "break-inside": "avoid",
291
+ },
292
+
293
+ "pre code": {
294
+ "font-size": "inherit",
295
+ "padding": "0",
296
+ "background": "none",
297
+ "border-radius": "0",
298
+ },
299
+
300
+ "fieldset": {
301
+ "margin-top": "var(--spacing-md)",
302
+ "margin-bottom": "var(--spacing-md)",
303
+ "padding": "var(--spacing-md)",
304
+ "border": "0",
305
+ },
306
+
307
+ "legend": {
308
+ "font-weight": "600",
309
+ "padding": "0 var(--spacing-xs)",
310
+ },
311
+
312
+ "output": {
313
+ "display": "inline-block",
314
+ "font-variant-numeric": "tabular-nums",
315
+ },
316
+
317
+ ":where(meter, progress)": {
318
+ "display": "inline-block",
319
+ "vertical-align": "middle",
320
+ },
321
+
322
+ ":where(img, video)": {
323
+ "max-width": "100%",
324
+ "height": "auto",
325
+ "break-inside": "avoid",
326
+ },
327
+
328
+ "figure": {
329
+ "margin-top": "0",
330
+ "margin-bottom": "0",
331
+ "break-inside": "avoid",
332
+ },
333
+
334
+ "figcaption": {
335
+ "margin-top": "0.375rem",
336
+ "font-size": "0.875em",
337
+ "line-height": "1.5",
338
+ },
339
+
340
+ "table": {
341
+ "width": "100%",
342
+ "margin-top": "0",
343
+ "margin-bottom": "0",
344
+ "border-collapse": "collapse",
345
+ "font-size": "0.9375em",
346
+ "line-height": "1.6",
347
+ },
348
+
349
+ "caption": {
350
+ "margin-bottom": "var(--spacing-xs)",
351
+ "font-size": "0.875em",
352
+ "font-weight": "600",
353
+ "text-align": "left",
354
+ },
355
+
356
+ "th, td": {
357
+ "padding": "var(--spacing-xs) var(--spacing-sm)",
358
+ "text-align": "left",
359
+ "font-weight": "600",
360
+ },
361
+
362
+ "thead th, tbody th, tbody td, tfoot th, tfoot td": {
363
+ "vertical-align": "top",
364
+ },
365
+
366
+ "thead th": {
367
+ "vertical-align": "bottom",
368
+ },
369
+
370
+ "tbody + tbody": {
371
+ "border-top-width": "2px",
372
+ },
373
+
374
+ "hr": {
375
+ "margin-top": "var(--spacing-xl)",
376
+ "margin-bottom": "var(--spacing-xl)",
377
+ "border": "0",
378
+ },
379
+
380
+ ":where(:focus, :focus-visible)": {
381
+ "outline-offset": "2px",
382
+ },
383
+
384
+ "details": {
385
+ "margin-top": "var(--spacing-md)",
386
+ "margin-bottom": "var(--spacing-md)",
387
+ },
388
+
389
+ "summary": {
390
+ "cursor": "pointer",
391
+ "font-weight": "600",
392
+ },
393
+
394
+ "details[open] > summary": {
395
+ "margin-bottom": "var(--spacing-xs)",
396
+ },
397
+
398
+ "dialog": {
399
+ "font-size": "inherit",
400
+ "line-height": "inherit",
401
+ },
402
+
403
+ "ul": {
404
+ "margin-top": "0",
405
+ "margin-bottom": "0",
406
+ },
407
+
408
+ ":where(p, pre):first-child": {
409
+ "margin-top": "0",
410
+ },
411
+
412
+ ":where(p, pre):last-child": {
413
+ "margin-bottom": "0",
414
+ },
415
+
416
+ "@media print": {
417
+ "body": {
418
+ "font-size": "12pt",
419
+ "line-height": "1.5",
420
+ "color": "#000",
421
+ },
422
+ "table": {
423
+ "break-inside": "avoid",
424
+ },
425
+ },
426
+ };
package/src/extra.js ADDED
@@ -0,0 +1,34 @@
1
+ export default {
2
+ "hr": {
3
+ "height": "1px",
4
+ "border-width": "0",
5
+ "margin-top": "3rem", /* my-12 (12 * 0.25rem) */
6
+ "margin-bottom": "3rem", /* my-12 */
7
+ "background-color": "var(--clampography-secondary)",
8
+ },
9
+
10
+ "blockquote": {
11
+ "border-left-width": "4px",
12
+ "border-color": "var(--clampography-primary)",
13
+ "padding-left": "1rem", /* pl-4 */
14
+ "padding-top": "0.5rem", /* py-2 */
15
+ "padding-bottom": "0.5rem", /* py-2 */
16
+ "padding-right": "0.5rem", /* pr-2 */
17
+ },
18
+
19
+ "a": {
20
+ "color": "var(--clampography-link)",
21
+ "font-weight": "700", /* font-bold */
22
+ "letter-spacing": "0.025em", /* tracking-wide */
23
+ "text-decoration-line": "underline",
24
+ "text-decoration-thickness": "2px", /* decoration-2 */
25
+ "text-underline-offset": "4px", /* underline-offset-4 */
26
+ "transition-property": "color, text-decoration-color",
27
+ "transition-duration": "150ms", /* duration-150 */
28
+ },
29
+
30
+ "a:hover": {
31
+ // Używamy zmiennej zdefiniowanej w themes.js (bez prefixu --color-)
32
+ "text-decoration-color": "var(--clampography-primary)",
33
+ },
34
+ };
package/src/index.js ADDED
@@ -0,0 +1,101 @@
1
+ import plugin from "tailwindcss/plugin";
2
+ import { themes as builtInThemes } from "./themes.js";
3
+ import baseStyles from "./base.js";
4
+ import extraStyles from "./extra.js";
5
+
6
+ /**
7
+ * Main plugin function.
8
+ */
9
+ export default plugin.withOptions((options = {}) => {
10
+ return ({ addBase }) => {
11
+ // 1. Load Base and Extra styles
12
+ const includeBase = options.base ?? true;
13
+ const includeExtra = options.extra ?? false;
14
+
15
+ if (includeBase) addBase(baseStyles);
16
+ if (includeExtra) addBase(extraStyles);
17
+
18
+ // 2. Parse themes configuration
19
+ let configThemes = options.themes;
20
+
21
+ // Default values
22
+ let themesToInclude = [];
23
+ let defaultThemeName = "light";
24
+ let prefersDarkTheme = false;
25
+ let rootSelector = options.root ?? ":root";
26
+
27
+ // Normalize input to an array of strings
28
+ // CSS might pass this as a single long string separated by commas
29
+ let rawThemeList = [];
30
+
31
+ if (typeof configThemes === "string") {
32
+ if (configThemes.trim() === "all") {
33
+ // Special case: themes: all
34
+ rawThemeList = Object.keys(builtInThemes);
35
+ } else if (configThemes.trim() === "false") {
36
+ rawThemeList = [];
37
+ } else {
38
+ // Split by comma: "light --default, dark --prefersdark"
39
+ rawThemeList = configThemes.split(",");
40
+ }
41
+ } else if (Array.isArray(configThemes)) {
42
+ rawThemeList = configThemes;
43
+ } else {
44
+ // Default fallback if nothing provided
45
+ rawThemeList = ["light", "dark"];
46
+ }
47
+
48
+ // 3. Process the list and look for flags (--default, --prefersdark)
49
+ // If "all" was used, we don't look for flags (we use default light/dark logic) unless implemented otherwise.
50
+ // Here we focus on the explicit list.
51
+
52
+ rawThemeList.forEach((rawItem) => {
53
+ let themeName = rawItem.trim();
54
+
55
+ // Ignore empty entries
56
+ if (!themeName) return;
57
+
58
+ // Check for --default flag
59
+ if (themeName.includes("--default")) {
60
+ themeName = themeName.replace("--default", "").trim();
61
+ defaultThemeName = themeName;
62
+ }
63
+
64
+ // Check for --prefersdark flag (case insensitive just in case)
65
+ if (themeName.toLowerCase().includes("--prefersdark")) {
66
+ themeName = themeName.replace(/--prefersdark/i, "").trim();
67
+ prefersDarkTheme = themeName;
68
+ }
69
+
70
+ // Check if theme exists in the database
71
+ if (builtInThemes[themeName]) {
72
+ themesToInclude.push(themeName);
73
+ }
74
+ });
75
+
76
+ // If list is empty after filtering, stop here
77
+ if (themesToInclude.length === 0) return;
78
+
79
+ // 4. Generate CSS
80
+ const themeStyles = {};
81
+
82
+ // A. Default theme (:root)
83
+ if (builtInThemes[defaultThemeName]) {
84
+ themeStyles[rootSelector] = builtInThemes[defaultThemeName];
85
+ }
86
+
87
+ // B. Theme for prefers-color-scheme: dark
88
+ if (prefersDarkTheme && builtInThemes[prefersDarkTheme]) {
89
+ themeStyles["@media (prefers-color-scheme: dark)"] = {
90
+ [rootSelector]: builtInThemes[prefersDarkTheme],
91
+ };
92
+ }
93
+
94
+ // C. Scoped styles [data-theme="..."]
95
+ themesToInclude.forEach((themeName) => {
96
+ themeStyles[`[data-theme="${themeName}"]`] = builtInThemes[themeName];
97
+ });
98
+
99
+ addBase(themeStyles);
100
+ };
101
+ });
@@ -0,0 +1,72 @@
1
+ import plugin from "tailwindcss/plugin";
2
+
3
+ // List of required color keys for validation (optional but good practice)
4
+ const REQUIRED_KEYS = [
5
+ "--clampography-background",
6
+ "--clampography-text",
7
+ "--clampography-link",
8
+ "--clampography-primary",
9
+ "--clampography-secondary",
10
+ ];
11
+
12
+ export default plugin.withOptions((options = {}) => {
13
+ return ({ addBase }) => {
14
+ // 1. Extract metadata
15
+ const themeName = options.name;
16
+ const isDefault = options.default ?? false;
17
+ const isPrefersDark = options.prefersdark ?? false; // lowercase because CSS might force it
18
+ const rootSelector = options.root ?? ":root";
19
+
20
+ if (!themeName) {
21
+ console.warn("Clampography: Theme definition missing 'name' property.");
22
+ return;
23
+ }
24
+
25
+ // 2. Extract colors from options
26
+ // We iterate over the options object and pick anything that looks like our CSS variable
27
+ // or simply take all known keys.
28
+ const themeColors = {};
29
+
30
+ // You can also support short aliases here if you want (e.g., 'primary' -> '--clampography-primary')
31
+ // For now, let's assume user passes full variable names or mapped keys.
32
+
33
+ // Helper to map simplified keys to full CSS vars (optional convenience)
34
+ const keyMap = {
35
+ "background": "--clampography-background",
36
+ "text": "--clampography-text",
37
+ "link": "--clampography-link",
38
+ "primary": "--clampography-primary",
39
+ "secondary": "--clampography-secondary",
40
+ };
41
+
42
+ Object.keys(options).forEach((key) => {
43
+ // Check if it's one of our mapped short keys
44
+ if (keyMap[key]) {
45
+ themeColors[keyMap[key]] = options[key];
46
+ } // Or if it is already a custom property key (starts with --)
47
+ else if (key.startsWith("--")) {
48
+ themeColors[key] = options[key];
49
+ }
50
+ });
51
+
52
+ // 3. Generate Styles
53
+ const styles = {};
54
+
55
+ // A. Define the theme as a named data-theme (always available)
56
+ styles[`[data-theme="${themeName}"]`] = themeColors;
57
+
58
+ // B. If marked as default, apply to :root
59
+ if (isDefault) {
60
+ styles[rootSelector] = themeColors;
61
+ }
62
+
63
+ // C. If marked as prefers-dark, apply to media query
64
+ if (isPrefersDark) {
65
+ styles["@media (prefers-color-scheme: dark)"] = {
66
+ [rootSelector]: themeColors,
67
+ };
68
+ }
69
+
70
+ addBase(styles);
71
+ };
72
+ });
package/src/themes.js ADDED
@@ -0,0 +1,32 @@
1
+ export const themes = {
2
+ light: {
3
+ "--clampography-background": "#ffffff",
4
+ "--clampography-text": "#1f2937",
5
+ "--clampography-link": "#2563eb",
6
+ "--clampography-primary": "#3b82f6",
7
+ "--clampography-secondary": "#9333ea",
8
+ },
9
+ dark: {
10
+ "--clampography-background": "#0f172a",
11
+ "--clampography-text": "#f3f4f6",
12
+ "--clampography-link": "#60a5fa",
13
+ "--clampography-primary": "#3b82f6",
14
+ "--clampography-secondary": "#a855f7",
15
+ },
16
+ retro: {
17
+ "--clampography-background": "#ece3ca",
18
+ "--clampography-text": "#2c2420",
19
+ "--clampography-link": "#d97757",
20
+ "--clampography-primary": "#e45f2b",
21
+ "--clampography-secondary": "#f6c342",
22
+ },
23
+ cyberpunk: {
24
+ "--clampography-background": "#000b1e",
25
+ "--clampography-text": "#00f0ff",
26
+ "--clampography-link": "#ff0099",
27
+ "--clampography-primary": "#fcee0a",
28
+ "--clampography-secondary": "#05ffa1",
29
+ },
30
+ };
31
+
32
+ export const themesList = Object.keys(themes);
package/clampography.css DELETED
@@ -1,571 +0,0 @@
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.6;
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
- /* --------------------------------------------------------------------------
96
- LINKS - Clickable Text (Structural Indicators)
97
- -------------------------------------------------------------------------- */
98
-
99
- a {
100
- text-decoration-line: underline;
101
- text-decoration-thickness: 0.0625em;
102
- text-underline-offset: 0.15em;
103
- cursor: pointer;
104
- }
105
-
106
- /* Remove underline from heading links */
107
- :where(h1, h2, h3, h4, h5, h6) a {
108
- text-decoration: none;
109
- }
110
-
111
- /* --------------------------------------------------------------------------
112
- MENU - Interactive Lists (Toolbars, Navigation)
113
- -------------------------------------------------------------------------- */
114
-
115
- menu {
116
- list-style: none;
117
- margin-bottom: var(--spacing-md);
118
- padding-left: 0;
119
- }
120
-
121
- /* Remove custom markers from menu items */
122
- menu > li::before {
123
- display: none;
124
- }
125
-
126
- /* --------------------------------------------------------------------------
127
- HGROUP - Heading Groups (Title + Subtitle)
128
- -------------------------------------------------------------------------- */
129
-
130
- hgroup {
131
- margin-bottom: var(--spacing-lg);
132
- }
133
-
134
- /* Reduce spacing between heading and subtitle */
135
- hgroup :where(h1, h2, h3, h4, h5, h6) {
136
- margin-bottom: var(--spacing-xs);
137
- }
138
-
139
- /* Subtitle/tagline styling (typically <p>) */
140
- hgroup :where(p) {
141
- margin-top: 0;
142
- margin-bottom: 0;
143
- font-size: 0.875em;
144
- font-weight: 400;
145
- line-height: 1.5;
146
- }
147
-
148
- /* --------------------------------------------------------------------------
149
- TEXT CONTENT - Paragraphs & Inline Elements
150
- -------------------------------------------------------------------------- */
151
-
152
- /* Paragraphs */
153
- p {
154
- line-height: 1.75;
155
- margin-bottom: var(--spacing-md);
156
- }
157
-
158
- /* Text modifiers - semantic emphasis */
159
- :where(strong, b) {
160
- font-weight: 700;
161
- }
162
-
163
- :where(em, i, cite, var) {
164
- font-style: italic;
165
- }
166
-
167
- /* Definition term - structural emphasis without forcing italic */
168
- dfn {
169
- font-style: normal;
170
- font-weight: 600;
171
- }
172
-
173
- /* Contextual sizing - uses 'em' to scale with parent */
174
- small {
175
- font-size: 0.875em;
176
- line-height: 1.5;
177
- }
178
-
179
- /* Code-related elements */
180
- :where(code, kbd, samp) {
181
- font-family: var(--font-family-mono);
182
- padding: clamp(0.0625rem, 0.05rem + 0.0625vw, 0.125rem)
183
- clamp(0.1875rem, 0.15rem + 0.1875vw, 0.7125rem);
184
- }
185
-
186
- /* Inline code - minimal, scaled padding */
187
- :where(code:not(pre code), kbd, samp) {
188
- padding: clamp(0.0625rem, 0.05rem + 0.0625vw, 0.125rem)
189
- clamp(0.1875rem, 0.15rem + 0.1875vw, 0.3125rem);
190
- }
191
-
192
- /* Superscript & subscript - essential for scientific notation */
193
- :where(sub, sup) {
194
- font-size: 0.75em;
195
- line-height: 0;
196
- position: relative;
197
- vertical-align: baseline;
198
- }
199
- sup {
200
- top: -0.5em;
201
- }
202
- sub {
203
- bottom: -0.25em;
204
- }
205
-
206
- /* Abbreviations with titles */
207
- abbr[title] {
208
- text-decoration: underline dotted;
209
- cursor: help;
210
- }
211
-
212
- del {
213
- text-decoration: line-through;
214
- }
215
-
216
- ins {
217
- text-decoration: underline;
218
- }
219
-
220
- /* Strikethrough */
221
- s {
222
- text-decoration: line-through;
223
- }
224
-
225
- /* Underline */
226
- u {
227
- text-decoration: underline;
228
- }
229
-
230
- /* Mark/Highlight element */
231
- mark {
232
- font-style: normal;
233
- font-weight: inherit;
234
- }
235
-
236
- /* Address element */
237
- address {
238
- font-style: normal; /* Reset browser default italic */
239
- margin-top: var(--spacing-md);
240
- margin-bottom: var(--spacing-md);
241
- }
242
-
243
- /* Time element */
244
- time {
245
- font-style: normal;
246
- font-variant-numeric: tabular-nums; /* Monospace numbers for alignment */
247
- }
248
-
249
- /* --------------------------------------------------------------------------
250
- BLOCKQUOTES - Structural Spacing Only
251
- -------------------------------------------------------------------------- */
252
-
253
- blockquote {
254
- margin-top: var(--spacing-lg);
255
- margin-bottom: var(--spacing-lg);
256
- padding-left: var(--spacing-md);
257
- }
258
-
259
- /* Nested blockquotes - reduced spacing for hierarchy */
260
- blockquote blockquote {
261
- margin-top: var(--spacing-sm);
262
- margin-bottom: var(--spacing-sm);
263
- padding-left: var(--spacing-sm);
264
- }
265
-
266
- /* Inline quotes */
267
- q {
268
- font-style: inherit;
269
- /* Browser adds quotation marks automatically */
270
- }
271
-
272
- /* --------------------------------------------------------------------------
273
- LISTS - Custom Structured Markers (Prose-like)
274
- -------------------------------------------------------------------------- */
275
-
276
- /* Reset default list styles to build custom ones */
277
- :where(ul, ol) {
278
- list-style: none;
279
- margin-bottom: var(--spacing-md);
280
- padding-left: clamp(1.5rem, 1.25rem + 1.25vw, 2rem);
281
- }
282
-
283
- li {
284
- position: relative;
285
- padding-left: 0.375em; /* Space between marker and text */
286
- }
287
-
288
- /* Spacing between list items */
289
- li + li {
290
- margin-top: var(--spacing-xs);
291
- }
292
-
293
- /* Spacing before nested lists */
294
- li > :where(ul, ol),
295
- li > :where(ul, ol):first-child {
296
- margin-top: var(--spacing-xs);
297
- }
298
-
299
- /* Spacing before nested lists */
300
- li > :where(ul, ol) {
301
- margin-top: var(--spacing-xs);
302
- }
303
-
304
- /* Perfectly centered dot relative to the first line of text */
305
- ul > li::before {
306
- content: '';
307
- position: absolute;
308
- left: -1.125em;
309
- top: calc(0.875em - 0.1875em);
310
- width: 0.375em;
311
- height: 0.375em;
312
- background-color: currentColor;
313
- border-radius: 50%;
314
- opacity: 0.4;
315
- }
316
-
317
- /* Right-aligned numbers for professional look (e.g. "9." aligns with "10.") */
318
- ol {
319
- counter-reset: list-counter;
320
- }
321
-
322
- ol > li {
323
- counter-increment: list-counter;
324
- }
325
-
326
- ol > li::before {
327
- content: counter(list-counter) '.';
328
- position: absolute;
329
- left: -2.5em;
330
- width: 1.75em;
331
- text-align: right;
332
- font-weight: 600;
333
- color: currentColor;
334
- opacity: 0.6;
335
- }
336
-
337
- /* Nested lists - indentation only, spacing handled by li rules above */
338
- :where(ul, ol) :where(ul, ol) {
339
- margin-bottom: 0; /* Parent li spacing already handles this */
340
- padding-left: var(--spacing-md);
341
- }
342
-
343
- /* --------------------------------------------------------------------------
344
- DEFINITION LISTS - Glossaries & Key-Value Pairs
345
- -------------------------------------------------------------------------- */
346
-
347
- dl {
348
- margin-top: var(--spacing-md);
349
- margin-bottom: var(--spacing-md);
350
- }
351
-
352
- dt {
353
- font-weight: 600;
354
- margin-top: var(--spacing-sm);
355
- }
356
-
357
- /* First dt shouldn't have top margin */
358
- dt:first-child {
359
- margin-top: 0;
360
- }
361
-
362
- dd {
363
- margin-left: var(--spacing-md);
364
- }
365
-
366
- /* Spacing between term and definition (consistent with lists) */
367
- dt + dd {
368
- margin-top: var(--spacing-xs);
369
- }
370
-
371
- /* Spacing between multiple definitions (consistent with list items) */
372
- dd + dd {
373
- margin-top: var(--spacing-xs);
374
- }
375
-
376
- /* Remove bottom margin from last dd */
377
- dd:last-child {
378
- margin-bottom: 0;
379
- }
380
-
381
- /* --------------------------------------------------------------------------
382
- CODE BLOCKS - Monospace Typography
383
- -------------------------------------------------------------------------- */
384
-
385
- pre {
386
- margin-top: var(--spacing-md);
387
- margin-bottom: var(--spacing-md);
388
- font-family: var(--font-family-mono);
389
- line-height: 1.6;
390
- overflow-x: auto;
391
- }
392
-
393
- /* Code inside pre blocks */
394
- pre code {
395
- font-size: inherit;
396
- padding: 0;
397
- background: none;
398
- border-radius: 0;
399
- }
400
-
401
- /* --------------------------------------------------------------------------
402
- FORMS - Basic Structure
403
- -------------------------------------------------------------------------- */
404
-
405
- fieldset {
406
- margin-top: var(--spacing-md);
407
- margin-bottom: var(--spacing-md);
408
- padding: var(--spacing-md);
409
- border: 0;
410
- }
411
-
412
- legend {
413
- font-weight: 600;
414
- padding: 0 var(--spacing-xs);
415
- }
416
-
417
- /* Form output element - typically displays calculation results */
418
- output {
419
- display: inline-block;
420
- font-variant-numeric: tabular-nums;
421
- }
422
-
423
- /* Visual indicator elements - structural spacing only */
424
- :where(meter, progress) {
425
- display: inline-block;
426
- vertical-align: middle;
427
- }
428
-
429
- /* --------------------------------------------------------------------------
430
- MEDIA - Images, Videos, Figures
431
- -------------------------------------------------------------------------- */
432
-
433
- :where(img, video) {
434
- max-width: 100%;
435
- height: auto;
436
- }
437
-
438
- figure {
439
- margin-top: var(--spacing-lg);
440
- margin-bottom: var(--spacing-lg);
441
- }
442
-
443
- figcaption {
444
- margin-top: 0.375rem;
445
- font-size: 0.875em;
446
- line-height: 1.5;
447
- }
448
-
449
- /* --------------------------------------------------------------------------
450
- TABLES - Structural Layout
451
- -------------------------------------------------------------------------- */
452
-
453
- table {
454
- width: 100%;
455
- margin-top: var(--spacing-md);
456
- margin-bottom: var(--spacing-md);
457
- border-collapse: collapse;
458
- font-size: 0.9375em;
459
- line-height: 1.6;
460
- }
461
-
462
- caption {
463
- margin-bottom: var(--spacing-xs);
464
- font-size: 0.875em;
465
- font-weight: 600;
466
- text-align: left;
467
- }
468
-
469
- th,
470
- td {
471
- padding: var(--spacing-xs) var(--spacing-sm);
472
- text-align: left;
473
- }
474
-
475
- th {
476
- font-weight: 600;
477
- }
478
-
479
- /* Table sections - structural differentiation */
480
- thead th {
481
- vertical-align: bottom;
482
- }
483
-
484
- tbody th,
485
- tbody td {
486
- vertical-align: top;
487
- }
488
-
489
- tfoot th,
490
- tfoot td {
491
- vertical-align: top;
492
- }
493
-
494
- /* Add spacing between tbody sections if multiple exist */
495
- tbody + tbody {
496
- border-top-width: 2px;
497
- }
498
-
499
- /* --------------------------------------------------------------------------
500
- SEPARATORS - Spacing Only
501
- -------------------------------------------------------------------------- */
502
-
503
- hr {
504
- margin-top: var(--spacing-xl);
505
- margin-bottom: var(--spacing-xl);
506
- border: 0;
507
- }
508
-
509
- /* --------------------------------------------------------------------------
510
- INTERACTIVE ELEMENTS - Accessibility
511
- -------------------------------------------------------------------------- */
512
-
513
- :where(:focus, :focus-visible) {
514
- outline-offset: 2px;
515
- }
516
-
517
- details {
518
- margin-top: var(--spacing-md);
519
- margin-bottom: var(--spacing-md);
520
- }
521
-
522
- summary {
523
- cursor: pointer;
524
- font-weight: 600;
525
- }
526
-
527
- details[open] > summary {
528
- margin-bottom: var(--spacing-xs);
529
- }
530
-
531
- dialog {
532
- font-size: inherit;
533
- line-height: inherit;
534
- }
535
-
536
- /* --------------------------------------------------------------------------
537
- UTILITIES - Margin Cleanup
538
- -------------------------------------------------------------------------- */
539
-
540
- :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl, blockquote, figure, table, pre):first-child {
541
- margin-top: 0;
542
- }
543
-
544
- :where(p, ul, ol, dl, blockquote, figure, table, pre):last-child {
545
- margin-bottom: 0;
546
- }
547
-
548
- /* --------------------------------------------------------------------------
549
- PRINT STYLES - Optimized for Paper
550
- -------------------------------------------------------------------------- */
551
-
552
- @media print {
553
- body {
554
- font-size: 12pt;
555
- line-height: 1.5;
556
- color: #000;
557
- }
558
-
559
- :where(h1, h2, h3, h4, h5, h6) {
560
- break-after: avoid;
561
- }
562
-
563
- :where(img, figure, pre, table) {
564
- break-inside: avoid;
565
- }
566
-
567
- a {
568
- text-decoration: underline;
569
- }
570
- }
571
- }
@@ -1,19 +0,0 @@
1
- /* You need daisyUI for this preset. Make sure its colors are accessible. */
2
-
3
- @import '../clampography.css';
4
-
5
- @layer base {
6
- a {
7
- @apply text-primary font-bold tracking-wider underline decoration-2 underline-offset-4 transition-colors duration-150;
8
-
9
- text-decoration-color: color-mix(
10
- in srgb,
11
- var(--color-primary) 30%,
12
- transparent
13
- );
14
- }
15
-
16
- a:hover {
17
- text-decoration-color: var(--color-primary);
18
- }
19
- }