@dorsk/tsumikit 0.23.0 → 0.24.0

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.
@@ -1,300 +1,10 @@
1
1
  /*
2
- * Base reset + element defaults + a small generic utility layer + the
3
- * syntax-highlight token mapping (which must be global to reach {@html} output).
4
- * Component styling lives in each component's own scoped <style>, never here.
5
- * Consumes ONLY tokens from variables.css never a raw color/size.
6
- * Mobile-first: base styles target phones; `min-width` queries enhance up.
2
+ * All-in-one stylesheet: tokens + built-in themes, reset + element defaults,
3
+ * generic utilities and the syntax-highlight token mapping (global so it
4
+ * reaches {@html} output). Import the parts individually to compose your own
5
+ * stacksee README "Theming".
7
6
  */
8
7
  @import './variables.css';
9
-
10
- *,
11
- *::before,
12
- *::after {
13
- box-sizing: border-box;
14
- }
15
-
16
- html {
17
- -webkit-text-size-adjust: 100%;
18
- text-size-adjust: 100%;
19
- /* The font scaler drives --fs-scale, so only --fs-* text tokens grow — chrome
20
- rem dimensions stay fixed. A scaled-up token can still push a min-width child
21
- past the viewport; clip sideways so the page never gains a horizontal bar. */
22
- overflow-x: hidden;
23
- max-width: 100%;
24
- scrollbar-gutter: stable;
25
- }
26
-
27
- body {
28
- margin: 0;
29
- background: var(--bg);
30
- color: var(--text);
31
- font-family: var(--font-sans);
32
- font-size: var(--fs-base);
33
- line-height: var(--lh-normal);
34
- -webkit-font-smoothing: antialiased;
35
- text-rendering: optimizeLegibility;
36
- overflow-x: hidden;
37
- scrollbar-gutter: stable;
38
- }
39
-
40
- h1,
41
- h2,
42
- h3,
43
- h4,
44
- h5,
45
- h6,
46
- p,
47
- figure {
48
- margin: 0;
49
- }
50
-
51
- a {
52
- color: var(--link);
53
- text-decoration: none;
54
- }
55
- a:hover {
56
- text-decoration: underline;
57
- }
58
-
59
- button {
60
- font: inherit;
61
- color: inherit;
62
- cursor: pointer;
63
- }
64
-
65
- input,
66
- textarea,
67
- select {
68
- font: inherit;
69
- color: inherit;
70
- }
71
-
72
- /* iOS: inputs <16px trigger an auto-zoom on focus — never let that happen. */
73
- input,
74
- textarea,
75
- select {
76
- font-size: max(16px, var(--fs-base));
77
- }
78
-
79
- code,
80
- pre {
81
- font-family: var(--font-mono);
82
- font-size: 0.875em;
83
- }
84
-
85
- /* Visible focus ring for keyboard users only (mouse clicks don't trigger it). */
86
- :focus-visible {
87
- outline: 2px solid var(--accent);
88
- outline-offset: 2px;
89
- border-radius: var(--r-sm);
90
- }
91
-
92
- ::-webkit-scrollbar {
93
- width: 8px;
94
- height: 8px;
95
- }
96
- ::-webkit-scrollbar-thumb {
97
- background: var(--border-strong);
98
- border-radius: var(--r-pill);
99
- }
100
-
101
- /* ---------- generic utilities ----------
102
- * Small, content-agnostic helpers (NOT component styling — components own that in
103
- * their own scope). Layout components (Container/Stack/Cluster/AutoGrid) are the
104
- * recommended API; these stay for ad-hoc markup and as documented escape hatches. */
105
- .container {
106
- width: 100%;
107
- max-width: var(--content-max);
108
- margin-inline: auto;
109
- padding-inline: max(var(--sp-4), var(--safe-left)) max(var(--sp-4), var(--safe-right));
110
- }
111
- .stack {
112
- display: flex;
113
- flex-direction: column;
114
- gap: var(--sp-3);
115
- }
116
- .row {
117
- display: flex;
118
- align-items: center;
119
- gap: var(--sp-2);
120
- }
121
- .row-wrap {
122
- flex-wrap: wrap;
123
- }
124
- .spacer {
125
- flex: 1;
126
- }
127
- .faint {
128
- /* `--faint-color` lets a parent retint slotted `.faint` text via inheritance
129
- (custom props cross the slot boundary, so no :global needed). */
130
- color: var(--faint-color, var(--text-faint));
131
- }
132
- .mono {
133
- font-family: var(--font-mono);
134
- }
135
- .truncate {
136
- overflow: hidden;
137
- text-overflow: ellipsis;
138
- white-space: nowrap;
139
- min-width: 0;
140
- }
141
- .nowrap {
142
- white-space: nowrap;
143
- }
144
- /* Opt a wrapper into container queries so descendants can respond to THIS box's
145
- width (not the viewport). Pair with `@container (…)` in a component's scope,
146
- or with the .cq-* utilities below. */
147
- .cq {
148
- container-type: inline-size;
149
- }
150
- /* Container-responsive utilities — they react to the nearest ancestor query
151
- container (any `.cq`, or an AppShell region), NOT the viewport. Put them on
152
- children of a container so a component degrades when ITS box is tight,
153
- wherever it lives. The breakpoints are container widths. */
154
- @container (max-width: 30rem) {
155
- .cq-hide {
156
- display: none !important;
157
- } /* e.g. wrap a button's label to drop it → icon-only */
158
- .cq-stack {
159
- flex-direction: column !important;
160
- align-items: stretch !important;
161
- }
162
- .cq-truncate {
163
- overflow: hidden;
164
- text-overflow: ellipsis;
165
- white-space: nowrap;
166
- min-width: 0;
167
- }
168
- }
169
- @container (max-width: 18rem) {
170
- .cq-hide-xs {
171
- display: none !important;
172
- }
173
- }
174
-
175
- /* ---------- icon sizing ----------
176
- * Components own their own button/control styling in scope (Button, IconButton,
177
- * Modal, Toaster, Dot, …). This single rule stays global because it also sizes
178
- * raw decorative SVGs that callers drop in outside any component. */
179
- .icon,
180
- svg[aria-hidden='true'] {
181
- flex: none;
182
- width: 1em;
183
- height: 1em;
184
- min-width: 1em;
185
- min-height: 1em;
186
- }
187
-
188
- /* ---------- misc ---------- */
189
- .divider {
190
- height: 1px;
191
- background: var(--border);
192
- border: 0;
193
- margin: var(--sp-2) 0;
194
- }
195
- .sr-only {
196
- position: absolute;
197
- width: 1px;
198
- height: 1px;
199
- padding: 0;
200
- margin: -1px;
201
- overflow: hidden;
202
- clip: rect(0, 0, 0, 0);
203
- white-space: nowrap;
204
- border: 0;
205
- }
206
-
207
- /* ---------- syntax-highlight token mapping ----------
208
- * CodeBlock doesn't bundle a highlighter; it renders whatever HTML you pass.
209
- * Class-based highlighters (highlight.js `hljs-*`, Prism `token.*`) are themed
210
- * here by mapping their token classes onto the --syn-* theme tokens, so colors
211
- * track every theme. This must be GLOBAL: Svelte scoped styles don't reach
212
- * {@html} content. (Shiki emits inline colors instead — see the README for how
213
- * to theme it via its css-variables theme.) */
214
- .hljs-keyword,
215
- .hljs-built_in,
216
- .hljs-type,
217
- .hljs-literal,
218
- .hljs-symbol,
219
- .hljs-selector-tag,
220
- .token.keyword,
221
- .token.builtin,
222
- .token.tag {
223
- color: var(--syn-keyword);
224
- }
225
- .hljs-string,
226
- .hljs-char,
227
- .hljs-regexp,
228
- .token.string,
229
- .token.char,
230
- .token.regex,
231
- .token.attr-value {
232
- color: var(--syn-string);
233
- }
234
- .hljs-number,
235
- .hljs-attr,
236
- .hljs-attribute,
237
- .hljs-variable,
238
- .hljs-template-variable,
239
- .token.number,
240
- .token.boolean,
241
- .token.attr-name {
242
- color: var(--syn-number);
243
- }
244
- .hljs-comment,
245
- .hljs-quote,
246
- .token.comment,
247
- .token.prolog {
248
- color: var(--syn-comment);
249
- font-style: italic;
250
- }
251
- .hljs-title,
252
- .hljs-title.function_,
253
- .hljs-section,
254
- .hljs-name,
255
- .hljs-meta,
256
- .hljs-property,
257
- .token.function,
258
- .token.class-name {
259
- color: var(--syn-function);
260
- }
261
- .hljs-punctuation,
262
- .token.punctuation,
263
- .token.operator {
264
- color: var(--syn-punct);
265
- }
266
- .hljs-addition {
267
- color: var(--syn-string);
268
- }
269
- .hljs-deletion {
270
- color: var(--danger);
271
- }
272
-
273
- @media (prefers-reduced-motion: reduce) {
274
- *,
275
- *::before,
276
- *::after {
277
- animation-duration: 0.01ms !important;
278
- animation-iteration-count: 1 !important;
279
- transition-duration: 0.01ms !important;
280
- scroll-behavior: auto !important;
281
- }
282
- }
283
-
284
- /* Forced colors (Windows High Contrast). The OS replaces our palette with its
285
- own; our job is to not fight it and to keep affordances visible. Keep the
286
- focus ring mapped to a system color, and make sure the focus outline shows
287
- even where we'd normally rely on a token border. */
288
- @media (forced-colors: active) {
289
- :focus-visible {
290
- outline: 2px solid Highlight;
291
- outline-offset: 2px;
292
- }
293
- }
294
-
295
- /* Stronger separators when the user asks for more contrast. */
296
- @media (prefers-contrast: more) {
297
- :root {
298
- --border: var(--border-strong);
299
- }
300
- }
8
+ @import './reset.css';
9
+ @import './utilities.css';
10
+ @import './syntax.css';
@@ -0,0 +1,97 @@
1
+ /*
2
+ * RESET + element defaults. Consumes ONLY tokens from tokens.css — never a raw
3
+ * color/size. Mobile-first: base styles target phones; `min-width` queries
4
+ * enhance up.
5
+ */
6
+
7
+ *,
8
+ *::before,
9
+ *::after {
10
+ box-sizing: border-box;
11
+ }
12
+
13
+ html {
14
+ -webkit-text-size-adjust: 100%;
15
+ text-size-adjust: 100%;
16
+ /* The font scaler drives --fs-scale, so only --fs-* text tokens grow — chrome
17
+ rem dimensions stay fixed. A scaled-up token can still push a min-width child
18
+ past the viewport; clip sideways so the page never gains a horizontal bar. */
19
+ overflow-x: hidden;
20
+ max-width: 100%;
21
+ scrollbar-gutter: stable;
22
+ }
23
+
24
+ body {
25
+ margin: 0;
26
+ background: var(--bg);
27
+ color: var(--text);
28
+ font-family: var(--font-sans);
29
+ font-size: var(--fs-base);
30
+ line-height: var(--lh-normal);
31
+ -webkit-font-smoothing: antialiased;
32
+ text-rendering: optimizeLegibility;
33
+ overflow-x: hidden;
34
+ scrollbar-gutter: stable;
35
+ }
36
+
37
+ h1,
38
+ h2,
39
+ h3,
40
+ h4,
41
+ h5,
42
+ h6,
43
+ p,
44
+ figure {
45
+ margin: 0;
46
+ }
47
+
48
+ a {
49
+ color: var(--link);
50
+ text-decoration: none;
51
+ }
52
+ a:hover {
53
+ text-decoration: underline;
54
+ }
55
+
56
+ button {
57
+ font: inherit;
58
+ color: inherit;
59
+ cursor: pointer;
60
+ }
61
+
62
+ input,
63
+ textarea,
64
+ select {
65
+ font: inherit;
66
+ color: inherit;
67
+ }
68
+
69
+ /* iOS: inputs <16px trigger an auto-zoom on focus — never let that happen. */
70
+ input,
71
+ textarea,
72
+ select {
73
+ font-size: max(16px, var(--fs-base));
74
+ }
75
+
76
+ code,
77
+ pre {
78
+ font-family: var(--font-mono);
79
+ font-size: 0.875em;
80
+ }
81
+
82
+ /* Visible focus ring for keyboard users only (mouse clicks don't trigger it). */
83
+ :focus-visible {
84
+ outline: 2px solid var(--accent);
85
+ outline-offset: 2px;
86
+ border-radius: var(--r-sm);
87
+ }
88
+
89
+ ::-webkit-scrollbar {
90
+ width: 8px;
91
+ height: 8px;
92
+ }
93
+ ::-webkit-scrollbar-thumb {
94
+ background: var(--border-strong);
95
+ border-radius: var(--r-pill);
96
+ }
97
+
@@ -0,0 +1,94 @@
1
+ /* ---------- syntax-highlight token mapping ----------
2
+ * CodeBlock doesn't bundle a highlighter; it renders whatever HTML you pass.
3
+ * Class-based highlighters (highlight.js `hljs-*`, Prism `token.*`) are themed
4
+ * here by mapping their token classes onto the --syn-* theme tokens, so colors
5
+ * track every theme. This must be GLOBAL: Svelte scoped styles don't reach
6
+ * {@html} content. (Shiki emits inline colors instead — see the README for how
7
+ * to theme it via its css-variables theme.) */
8
+ .hljs-keyword,
9
+ .hljs-built_in,
10
+ .hljs-type,
11
+ .hljs-literal,
12
+ .hljs-symbol,
13
+ .hljs-selector-tag,
14
+ .token.keyword,
15
+ .token.builtin,
16
+ .token.tag {
17
+ color: var(--syn-keyword);
18
+ }
19
+ .hljs-string,
20
+ .hljs-char,
21
+ .hljs-regexp,
22
+ .token.string,
23
+ .token.char,
24
+ .token.regex,
25
+ .token.attr-value {
26
+ color: var(--syn-string);
27
+ }
28
+ .hljs-number,
29
+ .hljs-attr,
30
+ .hljs-attribute,
31
+ .hljs-variable,
32
+ .hljs-template-variable,
33
+ .token.number,
34
+ .token.boolean,
35
+ .token.attr-name {
36
+ color: var(--syn-number);
37
+ }
38
+ .hljs-comment,
39
+ .hljs-quote,
40
+ .token.comment,
41
+ .token.prolog {
42
+ color: var(--syn-comment);
43
+ font-style: italic;
44
+ }
45
+ .hljs-title,
46
+ .hljs-title.function_,
47
+ .hljs-section,
48
+ .hljs-name,
49
+ .hljs-meta,
50
+ .hljs-property,
51
+ .token.function,
52
+ .token.class-name {
53
+ color: var(--syn-function);
54
+ }
55
+ .hljs-punctuation,
56
+ .token.punctuation,
57
+ .token.operator {
58
+ color: var(--syn-punct);
59
+ }
60
+ .hljs-addition {
61
+ color: var(--syn-string);
62
+ }
63
+ .hljs-deletion {
64
+ color: var(--danger);
65
+ }
66
+
67
+ @media (prefers-reduced-motion: reduce) {
68
+ *,
69
+ *::before,
70
+ *::after {
71
+ animation-duration: 0.01ms !important;
72
+ animation-iteration-count: 1 !important;
73
+ transition-duration: 0.01ms !important;
74
+ scroll-behavior: auto !important;
75
+ }
76
+ }
77
+
78
+ /* Forced colors (Windows High Contrast). The OS replaces our palette with its
79
+ own; our job is to not fight it and to keep affordances visible. Keep the
80
+ focus ring mapped to a system color, and make sure the focus outline shows
81
+ even where we'd normally rely on a token border. */
82
+ @media (forced-colors: active) {
83
+ :focus-visible {
84
+ outline: 2px solid Highlight;
85
+ outline-offset: 2px;
86
+ }
87
+ }
88
+
89
+ /* Stronger separators when the user asks for more contrast. */
90
+ @media (prefers-contrast: more) {
91
+ :root {
92
+ --border: var(--border-strong);
93
+ }
94
+ }