clampography 2.0.0-beta.11 → 2.0.0-beta.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clampography",
3
- "version": "2.0.0-beta.11",
3
+ "version": "2.0.0-beta.12",
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/extra.js CHANGED
@@ -1,8 +1,3 @@
1
- /**
2
- * Extra opinionated styles and coloring.
3
- * Applies colors to the structural base elements.
4
- */
5
-
6
1
  export default {
7
2
  // --- Basic Coloring (Applying theme variables) ---
8
3
  "body": {
@@ -14,8 +9,20 @@ export default {
14
9
  "color": "oklch(var(--clampography-heading))",
15
10
  },
16
11
 
12
+ // Styled Links (Enhanced)
17
13
  "a": {
18
14
  "color": "oklch(var(--clampography-link))",
15
+ "font-weight": "700",
16
+ "letter-spacing": "0.025em",
17
+ "text-decoration-line": "underline",
18
+ "text-decoration-thickness": "2px",
19
+ "text-underline-offset": "4px",
20
+ "transition-property": "color, text-decoration-color",
21
+ "transition-duration": "150ms",
22
+ },
23
+
24
+ "a:hover": {
25
+ "text-decoration-color": "oklch(var(--clampography-primary))",
19
26
  },
20
27
 
21
28
  // Lists
@@ -86,8 +93,6 @@ export default {
86
93
  "background-color": "oklch(var(--clampography-border))",
87
94
  },
88
95
 
89
- // --- Opinionated Extras ---
90
-
91
96
  // Styled Blockquote
92
97
  "blockquote": {
93
98
  "border-left-width": "4px",
@@ -99,21 +104,6 @@ export default {
99
104
  "color": "oklch(var(--clampography-heading))",
100
105
  },
101
106
 
102
- // Styled Links (Enhanced)
103
- "a": {
104
- "font-weight": "700",
105
- "letter-spacing": "0.025em",
106
- "text-decoration-line": "underline",
107
- "text-decoration-thickness": "2px",
108
- "text-underline-offset": "4px",
109
- "transition-property": "color, text-decoration-color",
110
- "transition-duration": "150ms",
111
- },
112
-
113
- "a:hover": {
114
- "text-decoration-color": "oklch(var(--clampography-primary))",
115
- },
116
-
117
107
  // Mark
118
108
  "mark": {
119
109
  "background-color": "oklch(var(--clampography-primary))",
@@ -129,6 +119,7 @@ export default {
129
119
  },
130
120
 
131
121
  // Buttons - All types
122
+ // WILL BE REMOVED FROM THIS FILE
132
123
  ":where(button, [type='button'], [type='reset'], [type='submit'])": {
133
124
  "padding": "var(--spacing-xs) var(--spacing-sm)",
134
125
  "border": "1px solid oklch(var(--clampography-border))",
@@ -136,6 +127,7 @@ export default {
136
127
  },
137
128
 
138
129
  // Inputs - All types
130
+ // WILL BE REMOVED FROM THIS FILE
139
131
  ":where(input:not([type='checkbox'], [type='radio']), textarea, select)": {
140
132
  "padding": "var(--spacing-xs) var(--spacing-sm)",
141
133
  "border": "1px solid oklch(var(--clampography-border))",
package/src/index.js CHANGED
@@ -114,19 +114,19 @@ export default plugin.withOptions(
114
114
  theme: {
115
115
  extend: {
116
116
  colors: {
117
- background: "oklch(var(--clampography-background) / <alpha-value>)",
118
- border: "oklch(var(--clampography-border) / <alpha-value>)",
119
- error: "oklch(var(--clampography-error) / <alpha-value>)",
120
- heading: "oklch(var(--clampography-heading) / <alpha-value>)",
121
- info: "oklch(var(--clampography-info) / <alpha-value>)",
122
- link: "oklch(var(--clampography-link) / <alpha-value>)",
123
- muted: "oklch(var(--clampography-muted) / <alpha-value>)",
124
- primary: "oklch(var(--clampography-primary) / <alpha-value>)",
125
- secondary: "oklch(var(--clampography-secondary) / <alpha-value>)",
126
- success: "oklch(var(--clampography-success) / <alpha-value>)",
127
- surface: "oklch(var(--clampography-surface) / <alpha-value>)",
128
- text: "oklch(var(--clampography-text) / <alpha-value>)",
129
- warning: "oklch(var(--clampography-warning) / <alpha-value>)",
117
+ background: "var(--clampography-background)",
118
+ border: "var(--clampography-border)",
119
+ error: "var(--clampography-error)",
120
+ heading: "var(--clampography-heading)",
121
+ info: "var(--clampography-info)",
122
+ link: "var(--clampography-link)",
123
+ muted: "var(--clampography-muted)",
124
+ primary: "var(--clampography-primary)",
125
+ secondary: "var(--clampography-secondary)",
126
+ success: "var(--clampography-success)",
127
+ surface: "var(--clampography-surface)",
128
+ text: "var(--clampography-text)",
129
+ warning: "var(--clampography-warning)",
130
130
  },
131
131
  },
132
132
  },
@@ -53,10 +53,38 @@ export default plugin.withOptions((options = {}) => {
53
53
  ["name", "default", "prefersdark", "root", "color-scheme"].includes(key)
54
54
  ) return;
55
55
 
56
+ const value = options[key];
57
+
56
58
  if (keyMap[key]) {
57
- themeColors[keyMap[key]] = options[key];
59
+ // Validate color format for better DX
60
+ if (value && typeof value === "string") {
61
+ // Check if value starts with oklch() or is a valid CSS color
62
+ const isOklch = value.trim().startsWith("oklch(");
63
+ const isHex = /^#[0-9A-Fa-f]{3,8}$/.test(value.trim());
64
+ const isRgb = value.trim().startsWith("rgb(") ||
65
+ value.trim().startsWith("rgba(");
66
+
67
+ if (!isOklch && !isHex && !isRgb) {
68
+ console.warn(
69
+ `Clampography (${themeName}): Color "${key}" has value "${value}" which may not be a valid color format. ` +
70
+ `For best compatibility with opacity modifiers (e.g., bg-${key}/20), use full OKLCH format: ` +
71
+ `oklch(70% 0.2 180) or oklch(0.7 0.2 180)`,
72
+ );
73
+ }
74
+
75
+ if (isHex || isRgb) {
76
+ console.info(
77
+ `Clampography (${themeName}): Color "${key}" uses ${
78
+ isHex ? "HEX" : "RGB"
79
+ } format. ` +
80
+ `Consider using OKLCH format for better color space support and smoother gradients.`,
81
+ );
82
+ }
83
+ }
84
+
85
+ themeColors[keyMap[key]] = value;
58
86
  } else if (key.startsWith("--")) {
59
- themeColors[key] = options[key];
87
+ themeColors[key] = value;
60
88
  }
61
89
  });
62
90
 
package/src/themes.js CHANGED
@@ -1,67 +1,67 @@
1
1
  export const themes = {
2
2
  light: {
3
3
  "color-scheme": "light",
4
- "--clampography-background": "100% 0 0",
5
- "--clampography-border": "92% 0.003 264",
6
- "--clampography-error": "63% 0.22 27",
7
- "--clampography-heading": "15% 0.02 264",
8
- "--clampography-info": "63% 0.258 262",
9
- "--clampography-link": "43% 0.19 264",
10
- "--clampography-muted": "52% 0.014 258",
11
- "--clampography-primary": "63% 0.258 262",
12
- "--clampography-secondary": "55% 0.28 300",
13
- "--clampography-success": "65% 0.17 165",
14
- "--clampography-surface": "96% 0.003 264",
15
- "--clampography-text": "31% 0.02 257",
16
- "--clampography-warning": "72% 0.17 65",
4
+ "--clampography-background": "oklch(100% 0 0)",
5
+ "--clampography-border": "oklch(92% 0.003 264)",
6
+ "--clampography-error": "oklch(63% 0.22 27)",
7
+ "--clampography-heading": "oklch(15% 0.02 264)",
8
+ "--clampography-info": "oklch(63% 0.258 262)",
9
+ "--clampography-link": "oklch(43% 0.19 264)",
10
+ "--clampography-muted": "oklch(52% 0.014 258)",
11
+ "--clampography-primary": "oklch(63% 0.258 262)",
12
+ "--clampography-secondary": "oklch(55% 0.28 300)",
13
+ "--clampography-success": "oklch(65% 0.17 165)",
14
+ "--clampography-surface": "oklch(96% 0.003 264)",
15
+ "--clampography-text": "oklch(31% 0.02 257)",
16
+ "--clampography-warning": "oklch(72% 0.17 65)",
17
17
  },
18
18
  dark: {
19
19
  "color-scheme": "dark",
20
- "--clampography-background": "10% 0 0",
21
- "--clampography-border": "31% 0.03 254",
22
- "--clampography-error": "63% 0.22 27",
23
- "--clampography-heading": "98% 0.003 264",
24
- "--clampography-info": "72% 0.17 254",
25
- "--clampography-link": "72% 0.17 254",
26
- "--clampography-muted": "68% 0.024 254",
27
- "--clampography-primary": "63% 0.258 262",
28
- "--clampography-secondary": "63% 0.25 300",
29
- "--clampography-success": "65% 0.17 165",
30
- "--clampography-surface": "12% 0 0",
31
- "--clampography-text": "95% 0 0",
32
- "--clampography-warning": "72% 0.17 65",
20
+ "--clampography-background": "oklch(10% 0 0)",
21
+ "--clampography-border": "oklch(31% 0.03 254)",
22
+ "--clampography-error": "oklch(63% 0.22 27)",
23
+ "--clampography-heading": "oklch(98% 0.003 264)",
24
+ "--clampography-info": "oklch(72% 0.17 254)",
25
+ "--clampography-link": "oklch(72% 0.17 254)",
26
+ "--clampography-muted": "oklch(68% 0.024 254)",
27
+ "--clampography-primary": "oklch(63% 0.258 262)",
28
+ "--clampography-secondary": "oklch(63% 0.25 300)",
29
+ "--clampography-success": "oklch(65% 0.17 165)",
30
+ "--clampography-surface": "oklch(12% 0 0)",
31
+ "--clampography-text": "oklch(95% 0 0)",
32
+ "--clampography-warning": "oklch(72% 0.17 65)",
33
33
  },
34
34
  retro: {
35
35
  "color-scheme": "light",
36
- "--clampography-background": "91% 0.03 85",
37
- "--clampography-border": "78% 0.05 85",
38
- "--clampography-error": "52% 0.15 35",
39
- "--clampography-heading": "18% 0.02 35",
40
- "--clampography-info": "60% 0.06 230",
41
- "--clampography-link": "63% 0.13 40",
42
- "--clampography-muted": "44% 0.03 45",
43
- "--clampography-primary": "60% 0.19 35",
44
- "--clampography-secondary": "80% 0.14 85",
45
- "--clampography-success": "62% 0.10 130",
46
- "--clampography-surface": "87% 0.04 85",
47
- "--clampography-text": "28% 0.03 40",
48
- "--clampography-warning": "80% 0.14 85",
36
+ "--clampography-background": "oklch(91% 0.03 85)",
37
+ "--clampography-border": "oklch(78% 0.05 85)",
38
+ "--clampography-error": "oklch(52% 0.15 35)",
39
+ "--clampography-heading": "oklch(18% 0.02 35)",
40
+ "--clampography-info": "oklch(60% 0.06 230)",
41
+ "--clampography-link": "oklch(63% 0.13 40)",
42
+ "--clampography-muted": "oklch(44% 0.03 45)",
43
+ "--clampography-primary": "oklch(60% 0.19 35)",
44
+ "--clampography-secondary": "oklch(80% 0.14 85)",
45
+ "--clampography-success": "oklch(62% 0.10 130)",
46
+ "--clampography-surface": "oklch(87% 0.04 85)",
47
+ "--clampography-text": "oklch(28% 0.03 40)",
48
+ "--clampography-warning": "oklch(80% 0.14 85)",
49
49
  },
50
50
  cyberpunk: {
51
51
  "color-scheme": "dark",
52
- "--clampography-background": "8% 0.04 264",
53
- "--clampography-border": "27% 0.09 254",
54
- "--clampography-error": "60% 0.29 340",
55
- "--clampography-heading": "100% 0 0",
56
- "--clampography-info": "88% 0.16 195",
57
- "--clampography-link": "60% 0.29 340",
58
- "--clampography-muted": "55% 0.07 200",
59
- "--clampography-primary": "93% 0.22 105",
60
- "--clampography-secondary": "87% 0.20 165",
61
- "--clampography-success": "87% 0.20 165",
62
- "--clampography-surface": "12% 0.05 264",
63
- "--clampography-text": "88% 0.16 195",
64
- "--clampography-warning": "93% 0.22 105",
52
+ "--clampography-background": "oklch(8% 0.04 264)",
53
+ "--clampography-border": "oklch(27% 0.09 254)",
54
+ "--clampography-error": "oklch(60% 0.29 340)",
55
+ "--clampography-heading": "oklch(100% 0 0)",
56
+ "--clampography-info": "oklch(88% 0.16 195)",
57
+ "--clampography-link": "oklch(60% 0.29 340)",
58
+ "--clampography-muted": "oklch(55% 0.07 200)",
59
+ "--clampography-primary": "oklch(93% 0.22 105)",
60
+ "--clampography-secondary": "oklch(87% 0.20 165)",
61
+ "--clampography-success": "oklch(87% 0.20 165)",
62
+ "--clampography-surface": "oklch(12% 0.05 264)",
63
+ "--clampography-text": "oklch(88% 0.16 195)",
64
+ "--clampography-warning": "oklch(93% 0.22 105)",
65
65
  },
66
66
  };
67
67