clampography 2.0.0-beta.2 → 2.0.0-beta.21

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.
@@ -0,0 +1,145 @@
1
+ @layer base {
2
+
3
+ :root {
4
+ background-color: var(--clampography-background);
5
+ color: var(--clampography-text);
6
+ }
7
+
8
+ :root :where(h1, h2, h3, h4, h5, h6) {
9
+ color: var(--clampography-heading);
10
+ }
11
+
12
+ :root a {
13
+ color: var(--clampography-link);
14
+ font-weight: 600;
15
+ letter-spacing: 0.025em;
16
+ text-decoration-line: underline;
17
+ text-decoration-thickness: 2px;
18
+ text-underline-offset: 4px;
19
+ text-decoration-color: color-mix(in oklab, var(--clampography-link) 30%, transparent);
20
+ transition-property: color, text-decoration-color;
21
+ transition-duration: 150ms;
22
+ }
23
+
24
+ :root a:hover {
25
+ text-decoration-color: var(--clampography-link);
26
+ }
27
+
28
+ :root ul > li::before {
29
+ background-color: var(--clampography-primary);
30
+ }
31
+
32
+ :root ol > li::before {
33
+ color: var(--clampography-primary);
34
+ }
35
+
36
+ :root :where(code:not(pre code), kbd, samp) {
37
+ background-color: var(--clampography-surface);
38
+ color: var(--clampography-heading);
39
+ border: 1px solid var(--clampography-border);
40
+ border-radius: 0.25rem;
41
+ padding: 0.125rem var(--spacing-xs);
42
+ }
43
+
44
+ :root kbd {
45
+ transform: translateY(-0.15em);
46
+ }
47
+
48
+ :root pre {
49
+ background-color: var(--clampography-surface);
50
+ border: 1px solid var(--clampography-border);
51
+ border-radius: 0.375rem;
52
+ padding: 1rem;
53
+ }
54
+
55
+ :root table {
56
+ padding: var(--spacing-sm);
57
+ border: 1px solid var(--clampography-border);
58
+ }
59
+
60
+ :root th {
61
+ color: var(--clampography-heading);
62
+ }
63
+
64
+ :root th, :root td {
65
+ border: 1px solid var(--clampography-border);
66
+ }
67
+
68
+ :root thead th {
69
+ border-bottom-width: 2px;
70
+ }
71
+
72
+ :root tbody tr:nth-child(even) {
73
+ background-color: var(--clampography-surface);
74
+ }
75
+
76
+ :root caption, :root figcaption, :root .muted {
77
+ color: var(--clampography-muted);
78
+ }
79
+
80
+ :root hr {
81
+ height: 1px;
82
+ border-width: 0;
83
+ margin-top: 3rem;
84
+ margin-bottom: 3rem;
85
+ background-color: var(--clampography-border);
86
+ }
87
+
88
+ :root blockquote {
89
+ border-left-width: 4px;
90
+ border-left-color: var(--clampography-primary);
91
+ background-color: var(--clampography-surface);
92
+ padding: 1rem;
93
+ border-radius: 0.25rem;
94
+ font-style: italic;
95
+ color: var(--clampography-heading);
96
+ }
97
+
98
+ :root mark {
99
+ background-color: var(--clampography-primary);
100
+ color: var(--clampography-background);
101
+ padding: 0.125rem var(--spacing-xs);
102
+ border-radius: 0.25rem;
103
+ }
104
+
105
+ :root del {
106
+ text-decoration-color: var(--clampography-secondary);
107
+ text-decoration-thickness: 2px;
108
+ }
109
+
110
+ :root :where(button, [type='button'], [type='reset'], [type='submit']) {
111
+ padding: var(--spacing-xs) var(--spacing-sm);
112
+ border: 1px solid var(--clampography-border);
113
+ border-radius: 0.375rem;
114
+ }
115
+
116
+ :root :where(input:not([type='checkbox'], [type='radio']), textarea, select) {
117
+ padding: var(--spacing-xs) var(--spacing-sm);
118
+ border: 1px solid var(--clampography-border);
119
+ border-radius: 0.375rem;
120
+ }
121
+
122
+ :root fieldset {
123
+ border: 1px solid var(--clampography-border);
124
+ border-radius: 0.375rem;
125
+ }
126
+
127
+ :root legend {
128
+ color: var(--clampography-heading);
129
+ }
130
+
131
+ :root details {
132
+ border: 1px solid var(--clampography-border);
133
+ border-radius: 0.375rem;
134
+ padding: 0.5rem;
135
+ }
136
+
137
+ :root summary {
138
+ color: var(--clampography-heading);
139
+ }
140
+
141
+ :root details[open] > summary {
142
+ border-bottom: 1px solid var(--clampography-border);
143
+ padding-bottom: 0.5rem;
144
+ }
145
+ }
@@ -0,0 +1 @@
1
+ @layer base{:root{background-color:var(--clampography-background);color:var(--clampography-text)}:root :where(h1, h2, h3, h4, h5, h6){color:var(--clampography-heading)}:root a{color:var(--clampography-link);font-weight:600;letter-spacing:0.025em;text-decoration-line:underline;text-decoration-thickness:2px;text-underline-offset:4px;text-decoration-color:color-mix(in oklab, var(--clampography-link) 30%, transparent);transition-property:color, text-decoration-color;transition-duration:150ms}:root a:hover{text-decoration-color:var(--clampography-link)}:root ul > li::before{background-color:var(--clampography-primary)}:root ol > li::before{color:var(--clampography-primary)}:root :where(code:not(pre code), kbd, samp){background-color:var(--clampography-surface);color:var(--clampography-heading);border:1px solid var(--clampography-border);border-radius:0.25rem;padding:0.125rem var(--spacing-xs)}:root kbd{transform:translateY(-0.15em)}:root pre{background-color:var(--clampography-surface);border:1px solid var(--clampography-border);border-radius:0.375rem;padding:1rem}:root table{padding:var(--spacing-sm);border:1px solid var(--clampography-border)}:root th{color:var(--clampography-heading)}:root th, :root td{border:1px solid var(--clampography-border)}:root thead th{border-bottom-width:2px}:root tbody tr:nth-child(even){background-color:var(--clampography-surface)}:root caption, :root figcaption, :root .muted{color:var(--clampography-muted)}:root hr{height:1px;border-width:0;margin-top:3rem;margin-bottom:3rem;background-color:var(--clampography-border)}:root blockquote{border-left-width:4px;border-left-color:var(--clampography-primary);background-color:var(--clampography-surface);padding:1rem;border-radius:0.25rem;font-style:italic;color:var(--clampography-heading)}:root mark{background-color:var(--clampography-primary);color:var(--clampography-background);padding:0.125rem var(--spacing-xs);border-radius:0.25rem}:root del{text-decoration-color:var(--clampography-secondary);text-decoration-thickness:2px}:root :where(button, [type='button'], [type='reset'], [type='submit']){padding:var(--spacing-xs) var(--spacing-sm);border:1px solid var(--clampography-border);border-radius:0.375rem}:root :where(input:not([type='checkbox'], [type='radio']), textarea, select){padding:var(--spacing-xs) var(--spacing-sm);border:1px solid var(--clampography-border);border-radius:0.375rem}:root fieldset{border:1px solid var(--clampography-border);border-radius:0.375rem}:root legend{color:var(--clampography-heading)}:root details{border:1px solid var(--clampography-border);border-radius:0.375rem;padding:0.5rem}:root summary{color:var(--clampography-heading)}:root details[open] > summary{border-bottom:1px solid var(--clampography-border);padding-bottom:0.5rem}}
package/src/extra.js CHANGED
@@ -1,138 +1,198 @@
1
- /**
2
- * Extra opinionated styles and coloring.
3
- * Applies colors to the structural base elements.
4
- */
5
- export default {
6
- // --- Basic Coloring (Applying theme variables) ---
7
-
8
- "body": {
9
- "background-color": "var(--clampography-background)",
10
- "color": "var(--clampography-text)",
11
- },
12
-
13
- ":where(h1, h2, h3, h4, h5, h6)": {
14
- "color": "var(--clampography-heading)",
15
- },
16
-
17
- "a": {
18
- "color": "var(--clampography-link)",
19
- },
20
-
21
- // Lists
22
- "ul > li::before": {
23
- "background-color": "var(--clampography-primary)", // Bullet points
24
- },
25
-
26
- "ol > li::before": {
27
- "color": "var(--clampography-secondary)", // Numbers
28
- },
29
-
30
- // Inline Code
31
- ":where(code, kbd, samp)": {
32
- "background-color": "var(--clampography-surface)",
33
- "color": "var(--clampography-heading)",
34
- "border": "1px solid var(--clampography-border)",
35
- "border-radius": "0.25rem",
36
- },
37
-
38
- // Preformatted Code Blocks
39
- "pre": {
40
- "background-color": "var(--clampography-surface)",
41
- "border": "1px solid var(--clampography-border)",
42
- "border-radius": "0.375rem",
43
- "padding": "1rem",
44
- },
45
-
46
- // Tables
47
- "th": {
48
- "color": "var(--clampography-heading)",
49
- },
50
-
51
- "th, td": {
52
- "border-bottom": "1px solid var(--clampography-border)",
53
- },
54
-
55
- "thead th": {
56
- "border-bottom-width": "2px",
57
- },
58
-
59
- // Captions & Muted text
60
- "caption, figcaption, .muted": {
61
- "color": "var(--clampography-muted)",
62
- },
63
-
64
- // Horizontal Rule (Thematic)
65
- "hr": {
66
- "height": "1px",
67
- "border-width": "0",
68
- "margin-top": "3rem",
69
- "margin-bottom": "3rem",
70
- "background-color": "var(--clampography-border)",
71
- },
72
-
73
- // --- Opinionated Extras ---
74
-
75
- // Styled Blockquote
76
- "blockquote": {
77
- "border-left-width": "4px",
78
- "border-left-color": "var(--clampography-primary)",
79
- "background-color": "var(--clampography-surface)",
80
- "padding": "1rem",
81
- "border-radius": "0.25rem",
82
- "font-style": "italic",
83
- "color": "var(--clampography-heading)",
84
- },
85
-
86
- // Styled Links (Enhanced)
87
- "a": {
88
- "font-weight": "700",
89
- "letter-spacing": "0.025em",
90
- "text-decoration-line": "underline",
91
- "text-decoration-thickness": "2px",
92
- "text-underline-offset": "4px",
93
- "transition-property": "color, text-decoration-color",
94
- "transition-duration": "150ms",
95
- },
96
-
97
- "a:hover": {
98
- "text-decoration-color": "var(--clampography-primary)",
99
- },
100
-
101
- // Mark
102
- "mark": {
103
- "background-color": "var(--clampography-primary)",
104
- "color": "var(--clampography-background)",
105
- },
106
-
107
- // Deleted Text
108
- "del": {
109
- "text-decoration-color": "var(--clampography-secondary)",
110
- "text-decoration-thickness": "2px",
111
- },
112
-
113
- // Fieldset
114
- "fieldset": {
115
- "border": "1px solid var(--clampography-border)",
116
- "border-radius": "0.375rem",
117
- },
118
-
119
- "legend": {
120
- "color": "var(--clampography-heading)",
121
- },
122
-
123
- // Details
124
- "details": {
125
- "border": "1px solid var(--clampography-border)",
126
- "border-radius": "0.375rem",
127
- "padding": "0.5rem",
128
- },
129
-
130
- "summary": {
131
- "color": "var(--clampography-heading)",
132
- },
133
-
134
- "details[open] > summary": {
135
- "border-bottom": "1px solid var(--clampography-border)",
136
- "padding-bottom": "0.5rem",
137
- },
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
+
15
+ if (char === "," && depth === 0) {
16
+ parts.push(current.trim());
17
+ current = "";
18
+ } else {
19
+ current += char;
20
+ }
21
+ }
22
+ parts.push(current.trim());
23
+
24
+ return parts
25
+ .filter(Boolean)
26
+ .map((part) => {
27
+ if (part === ":root" || part === "body") return root;
28
+ return `${root} ${part}`;
29
+ })
30
+ .join(", ");
31
+ };
32
+
33
+ return {
34
+ // --- Basic Coloring ---
35
+ [root]: {
36
+ "background-color": "var(--clampography-background)",
37
+ "color": "var(--clampography-text)",
38
+ },
39
+
40
+ [scope(":where(h1, h2, h3, h4, h5, h6)")]: {
41
+ "color": "var(--clampography-heading)",
42
+ },
43
+
44
+ // Styled Links
45
+ [scope("a")]: {
46
+ "color": "var(--clampography-link)",
47
+ "font-weight": "600",
48
+ "letter-spacing": "0.025em",
49
+ "text-decoration-line": "underline",
50
+ "text-decoration-thickness": "2px",
51
+ "text-underline-offset": "4px",
52
+ "text-decoration-color":
53
+ "color-mix(in oklab, var(--clampography-link) 30%, transparent)",
54
+ "transition-property": "color, text-decoration-color",
55
+ "transition-duration": "150ms",
56
+ },
57
+
58
+ [scope("a:hover")]: {
59
+ "text-decoration-color": "var(--clampography-link)",
60
+ },
61
+
62
+ // Lists
63
+ [scope("ul > li::before")]: {
64
+ "background-color": "var(--clampography-primary)",
65
+ },
66
+
67
+ [scope("ol > li::before")]: {
68
+ "color": "var(--clampography-primary)",
69
+ },
70
+
71
+ // Inline Code
72
+ [scope(":where(code:not(pre code), kbd, samp)")]: {
73
+ "background-color": "var(--clampography-surface)",
74
+ "color": "var(--clampography-heading)",
75
+ "border": "1px solid var(--clampography-border)",
76
+ "border-radius": "0.25rem",
77
+ "padding": "0.125rem var(--spacing-xs)",
78
+ },
79
+
80
+ [scope("kbd")]: {
81
+ transform: "translateY(-0.15em)",
82
+ },
83
+
84
+ // Preformatted Code Blocks
85
+ [scope("pre")]: {
86
+ "background-color": "var(--clampography-surface)",
87
+ "border": "1px solid var(--clampography-border)",
88
+ "border-radius": "0.375rem",
89
+ "padding": "1rem",
90
+ },
91
+
92
+ // Tables
93
+ [scope("table")]: {
94
+ "padding": "var(--spacing-sm)",
95
+ "border": "1px solid var(--clampography-border)",
96
+ },
97
+
98
+ [scope("th")]: {
99
+ "color": "var(--clampography-heading)",
100
+ },
101
+
102
+ [scope("th, td")]: {
103
+ "border": "1px solid var(--clampography-border)",
104
+ },
105
+
106
+ [scope("thead th")]: {
107
+ "border-bottom-width": "2px",
108
+ },
109
+
110
+ [scope("tbody tr:nth-child(even)")]: {
111
+ "background-color": "var(--clampography-surface)",
112
+ },
113
+
114
+ // Captions & Muted
115
+ [scope("caption, figcaption, .muted")]: {
116
+ "color": "var(--clampography-muted)",
117
+ },
118
+
119
+ // Horizontal Rule
120
+ [scope("hr")]: {
121
+ "height": "1px",
122
+ "border-width": "0",
123
+ "margin-top": "3rem",
124
+ "margin-bottom": "3rem",
125
+ "background-color": "var(--clampography-border)",
126
+ },
127
+
128
+ // Blockquote
129
+ [scope("blockquote")]: {
130
+ "border-left-width": "4px",
131
+ "border-left-color": "var(--clampography-primary)",
132
+ "background-color": "var(--clampography-surface)",
133
+ "padding": "1rem",
134
+ "border-radius": "0.25rem",
135
+ "font-style": "italic",
136
+ "color": "var(--clampography-heading)",
137
+ },
138
+
139
+ // Mark
140
+ [scope("mark")]: {
141
+ "background-color": "var(--clampography-primary)",
142
+ "color": "var(--clampography-background)",
143
+ "padding": "0.125rem var(--spacing-xs)",
144
+ "border-radius": "0.25rem",
145
+ },
146
+
147
+ // Deleted Text
148
+ [scope("del")]: {
149
+ "text-decoration-color": "var(--clampography-secondary)",
150
+ "text-decoration-thickness": "2px",
151
+ },
152
+
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
+ // Details
183
+ [scope("details")]: {
184
+ "border": "1px solid var(--clampography-border)",
185
+ "border-radius": "0.375rem",
186
+ "padding": "0.5rem",
187
+ },
188
+
189
+ [scope("summary")]: {
190
+ "color": "var(--clampography-heading)",
191
+ },
192
+
193
+ [scope("details[open] > summary")]: {
194
+ "border-bottom": "1px solid var(--clampography-border)",
195
+ "padding-bottom": "0.5rem",
196
+ },
197
+ };
138
198
  };