css-tags 0.1.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.
Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +875 -0
  3. package/carousel.js +86 -0
  4. package/components/accessibility.css +51 -0
  5. package/components/actions.css +76 -0
  6. package/components/alert.css +122 -0
  7. package/components/application-patterns.css +122 -0
  8. package/components/badge.css +125 -0
  9. package/components/box-extra.css +220 -0
  10. package/components/box.css +75 -0
  11. package/components/card.css +130 -0
  12. package/components/carousel.css +76 -0
  13. package/components/chip.css +71 -0
  14. package/components/container.css +55 -0
  15. package/components/content-patterns.css +234 -0
  16. package/components/disclosure.css +581 -0
  17. package/components/divider.css +68 -0
  18. package/components/flex.css +59 -0
  19. package/components/form-patterns.css +273 -0
  20. package/components/form.css +130 -0
  21. package/components/grid.css +82 -0
  22. package/components/identity.css +59 -0
  23. package/components/img-container.css +141 -0
  24. package/components/img-container.js +75 -0
  25. package/components/list.css +69 -0
  26. package/components/loading.css +112 -0
  27. package/components/masonry.css +48 -0
  28. package/components/modal.css +73 -0
  29. package/components/navigation-patterns.css +245 -0
  30. package/components/navigation.css +200 -0
  31. package/components/popover.css +49 -0
  32. package/components/site-shell.css +180 -0
  33. package/components/status.css +110 -0
  34. package/components/table.css +98 -0
  35. package/components/tabs.css +103 -0
  36. package/components/tooltip.css +87 -0
  37. package/components/tooltips.css +73 -0
  38. package/components/view-transition.css +73 -0
  39. package/core/base.css +62 -0
  40. package/core/defaults.css +490 -0
  41. package/core/engine.css +32 -0
  42. package/core/mixins.css +376 -0
  43. package/core/palette-accent.css +8 -0
  44. package/core/palette-base.css +107 -0
  45. package/core/palette-extended.css +142 -0
  46. package/core/palette-feedback.css +62 -0
  47. package/core/palette.css +7 -0
  48. package/core/reset.css +270 -0
  49. package/core/text.css +171 -0
  50. package/core/theme.css +608 -0
  51. package/core/tokens.css +488 -0
  52. package/core/typography.css +327 -0
  53. package/index.css +66 -0
  54. package/layouts/layout-extra.css +204 -0
  55. package/layouts/layout-extras-helpers.css +19 -0
  56. package/layouts/layout.css +348 -0
  57. package/package.json +66 -0
  58. package/theme-generator.css +979 -0
  59. package/themes/example-brand.css +59 -0
  60. package/themes/theme-packs.css +31 -0
  61. package/types/css-tags.d.ts +482 -0
  62. package/utilities/utilities.css +564 -0
  63. package/view-transition.js +111 -0
@@ -0,0 +1,564 @@
1
+ /**
2
+ * Improved Utilities
3
+ * ==================
4
+ *
5
+ * Comprehensive utility classes that work with the improved theme system.
6
+ * Includes all the theme generator utilities plus framework compatibility.
7
+ */
8
+
9
+ @layer utilities {
10
+ /* ============================================ */
11
+ /* BACKGROUND COLORS */
12
+ /* ============================================ */
13
+
14
+ .bg-base { background-color: var(--base); --bg: var(--base); }
15
+ .bg-bedrock { background-color: var(--bedrock); --bg: var(--bedrock); }
16
+ .bg-surface-muted { background-color: var(--surface-muted); --bg: var(--surface-muted); }
17
+ .bg-surface-subtle { background-color: var(--surface-subtle); --bg: var(--surface-subtle); }
18
+ .bg-surface { background-color: var(--surface); --bg: var(--surface); }
19
+ .bg-surface-overt { background-color: var(--surface-overt); --bg: var(--surface-overt); }
20
+
21
+ /* Legacy framework compatibility */
22
+ .surface-bg { background-color: var(--surface); }
23
+ .surface-bg-subtle { background-color: var(--surface-subtle); }
24
+ .surface-bg-muted { background-color: var(--surface-muted); }
25
+
26
+ /* ============================================ */
27
+ /* TEXT COLORS */
28
+ /* ============================================ */
29
+
30
+ .text-muted { color: var(--text-muted); }
31
+ .text-subtle { color: var(--text-subtle); }
32
+ /* `.text` is the class host for core/text.css. Its default color is
33
+ derived from the inherited --bg value rather than duplicated here. */
34
+ .text-overt { color: var(--text-overt); }
35
+ .text-link { color: var(--text-link); }
36
+ .text-link:hover { color: var(--text-link-hover); }
37
+ .text-link:visited { color: var(--text-link-visited); }
38
+ .text-highlight-subtle { color: var(--text-highlight-subtle); }
39
+ .text-highlight-overt { color: var(--text-highlight-overt); }
40
+
41
+ /* Text on surfaces */
42
+ .text-on-base { color: var(--text-on-base); }
43
+ .text-on-bedrock { color: var(--text-on-bedrock); }
44
+ .text-on-surface-muted { color: var(--text-on-surface-muted); }
45
+ .text-on-surface-subtle { color: var(--text-on-surface-subtle); }
46
+ .text-on-surface { color: var(--text-on-surface); }
47
+ .text-on-surface-overt { color: var(--text-on-surface-overt); }
48
+
49
+ /* Legacy framework compatibility */
50
+ .text-color-muted { color: var(--text-muted); }
51
+ .text-color-subtle { color: var(--text-subtle); }
52
+ .text-color { color: var(--text); }
53
+ .text-color-overt { color: var(--text-overt); }
54
+
55
+ /* ============================================ */
56
+ /* AUTOMATIC TEXT COLOR ADJUSTMENTS */
57
+ /* ============================================ */
58
+
59
+ /* On dark bedrock background, use light text */
60
+ .bg-bedrock .text-muted,
61
+ .bg-bedrock .text-subtle,
62
+ .bg-bedrock .text-overt,
63
+ .bg-bedrock .text-link,
64
+ .bg-bedrock .text-link:hover,
65
+ .bg-bedrock .text-link:visited {
66
+ color: var(--text-on-bedrock);
67
+ }
68
+
69
+ /* On dark bedrock background, buttons need light text */
70
+ .bg-bedrock .button {
71
+ color: var(--text-on-bedrock);
72
+ border-color: var(--outline-overt);
73
+ }
74
+ .bg-bedrock .button-primary {
75
+ color: var(--text-on-bedrock);
76
+ }
77
+
78
+ /* On accent background, use appropriate text */
79
+ .bg-accent .text-muted,
80
+ .bg-accent .text-subtle,
81
+ .bg-accent .text-overt {
82
+ color: var(--accent-on-base);
83
+ }
84
+
85
+ /* On accent background, buttons need appropriate colors */
86
+ .bg-accent .button {
87
+ color: var(--accent-on-base);
88
+ border-color: var(--accent-overt);
89
+ }
90
+ .bg-accent .button-primary {
91
+ color: var(--accent-on-base);
92
+ }
93
+
94
+ /* On secondary background, use appropriate text */
95
+ .bg-secondary .text-muted,
96
+ .bg-secondary .text-subtle,
97
+ .bg-secondary .text-overt {
98
+ color: var(--text-on-secondary);
99
+ }
100
+
101
+ .bg-secondary .button {
102
+ color: var(--text-on-secondary);
103
+ border-color: var(--secondary-overt);
104
+ }
105
+ .bg-secondary .button-secondary {
106
+ color: var(--text-on-secondary);
107
+ }
108
+
109
+ /* On tertiary background, use appropriate text */
110
+ .bg-tertiary .text-muted,
111
+ .bg-tertiary .text-subtle,
112
+ .bg-tertiary .text-overt {
113
+ color: var(--text-on-tertiary);
114
+ }
115
+
116
+ .bg-tertiary .button {
117
+ color: var(--text-on-tertiary);
118
+ border-color: var(--tertiary-overt);
119
+ }
120
+ .bg-tertiary .button-secondary {
121
+ color: var(--text-on-tertiary);
122
+ }
123
+
124
+ /* ============================================ */
125
+ /* OUTLINE/BORDER COLORS */
126
+ /* ============================================ */
127
+
128
+ .border-muted { border-color: var(--outline-muted); }
129
+ .border-subtle { border-color: var(--outline-subtle); }
130
+ .border { border-color: var(--outline); }
131
+ .border-overt { border-color: var(--outline-overt); }
132
+ .border-focus { border-color: var(--outline-focus); }
133
+ .border-active { border-color: var(--outline-active); }
134
+ .border-error { border-color: var(--outline-error); }
135
+ .border-warning { border-color: var(--outline-warning); }
136
+ .border-success { border-color: var(--outline-success); }
137
+ .border-info { border-color: var(--outline-info); }
138
+
139
+ /* ============================================ */
140
+ /* HIGHLIGHT BACKGROUNDS */
141
+ /* ============================================ */
142
+
143
+ .bg-highlight-muted { background-color: var(--highlight-muted); }
144
+ .bg-highlight-subtle { background-color: var(--highlight-subtle); }
145
+ .bg-highlight-overt { background-color: var(--highlight-overt); }
146
+ .bg-text-highlight { background-color: var(--text-highlight-bg); }
147
+
148
+ /* ============================================ */
149
+ /* ACCENT COLORS */
150
+ /* ============================================ */
151
+
152
+ .bg-accent { background-color: var(--accent); --bg: var(--accent); }
153
+ .bg-accent-muted { background-color: var(--accent-muted); --bg: var(--accent-muted); }
154
+ .bg-accent-subtle { background-color: var(--accent-subtle); --bg: var(--accent-subtle); }
155
+ .bg-accent-surface { background-color: var(--accent-surface); --bg: var(--accent-surface); }
156
+ .bg-accent-overt { background-color: var(--accent-overt); --bg: var(--accent-overt); }
157
+ .bg-accent-highlight { background-color: var(--accent-highlight); --bg: var(--accent-highlight); }
158
+
159
+ .text-accent { color: var(--accent); }
160
+ .text-accent-muted { color: var(--accent-muted); }
161
+ .text-accent-subtle { color: var(--accent-subtle); }
162
+ .text-accent-overt { color: var(--accent-overt); }
163
+
164
+ .text-accent-on-base { color: var(--accent-on-base); }
165
+ .text-accent-on-bedrock { color: var(--accent-on-bedrock); }
166
+ .text-accent-on-surface { color: var(--accent-on-surface); }
167
+
168
+ /* ============================================ */
169
+ /* SECONDARY COLORS */
170
+ /* ============================================ */
171
+
172
+ .bg-secondary { background-color: var(--secondary); --bg: var(--secondary); }
173
+ .bg-secondary-muted { background-color: var(--secondary-muted); --bg: var(--secondary-muted); }
174
+ .bg-secondary-subtle { background-color: var(--secondary-subtle); --bg: var(--secondary-subtle); }
175
+ .bg-secondary-overt { background-color: var(--secondary-overt); --bg: var(--secondary-overt); }
176
+ .bg-secondary-highlight { background-color: var(--secondary-highlight); --bg: var(--secondary-highlight); }
177
+
178
+ .text-secondary { color: var(--secondary); }
179
+ .text-secondary-muted { color: var(--secondary-muted); }
180
+ .text-secondary-subtle { color: var(--secondary-subtle); }
181
+ .text-secondary-overt { color: var(--secondary-overt); }
182
+ .text-on-secondary { color: var(--text-on-secondary); }
183
+
184
+ /* ============================================ */
185
+ /* TERTIARY COLORS */
186
+ /* ============================================ */
187
+
188
+ .bg-tertiary { background-color: var(--tertiary); --bg: var(--tertiary); }
189
+ .bg-tertiary-muted { background-color: var(--tertiary-muted); --bg: var(--tertiary-muted); }
190
+ .bg-tertiary-subtle { background-color: var(--tertiary-subtle); --bg: var(--tertiary-subtle); }
191
+ .bg-tertiary-overt { background-color: var(--tertiary-overt); --bg: var(--tertiary-overt); }
192
+ .bg-tertiary-highlight { background-color: var(--tertiary-highlight); --bg: var(--tertiary-highlight); }
193
+
194
+ .text-tertiary { color: var(--tertiary); }
195
+ .text-tertiary-muted { color: var(--tertiary-muted); }
196
+ .text-tertiary-subtle { color: var(--tertiary-subtle); }
197
+ .text-tertiary-overt { color: var(--tertiary-overt); }
198
+ .text-on-tertiary { color: var(--text-on-tertiary); }
199
+
200
+ /* ============================================ */
201
+ /* SEMANTIC COLORS */
202
+ /* ============================================ */
203
+
204
+ .bg-success { background-color: var(--surface-success); --bg: var(--surface-success); }
205
+ .bg-warning { background-color: var(--surface-warning); --bg: var(--surface-warning); }
206
+ .bg-error { background-color: var(--surface-error); --bg: var(--surface-error); }
207
+ .bg-info { background-color: var(--surface-info); --bg: var(--surface-info); }
208
+
209
+ .text-success { color: var(--text-success); }
210
+ .text-warning { color: var(--text-warning); }
211
+ .text-error { color: var(--text-error); }
212
+ .text-info { color: var(--text-info); }
213
+
214
+ .border-success { border-color: var(--outline-success); }
215
+ .border-warning { border-color: var(--outline-warning); }
216
+ .border-error { border-color: var(--outline-error); }
217
+ .border-info { border-color: var(--outline-info); }
218
+
219
+ /* ============================================ */
220
+ /* IMPROVED BUTTON SYSTEM */
221
+ /* ============================================ */
222
+
223
+ .button {
224
+ display: inline-flex;
225
+ align-items: center;
226
+ justify-content: center;
227
+ padding: 0.5rem 1rem;
228
+ font-family: var(--font-family);
229
+ font-weight: var(--font-weight-medium);
230
+ font-size: var(--font-size-base);
231
+ line-height: var(--line-height-base);
232
+ border: var(--border-width) solid var(--outline);
233
+ border-radius: var(--border-radius-md);
234
+ background-color: var(--surface);
235
+ color: var(--text-on-surface);
236
+ cursor: pointer;
237
+ transition: all 0.15s ease;
238
+ text-decoration: none;
239
+ }
240
+
241
+ .button:hover { background-color: var(--highlight-subtle); }
242
+ .button:active { background-color: var(--highlight-overt); }
243
+ .button:disabled {
244
+ background-color: var(--surface-muted);
245
+ cursor: not-allowed;
246
+ opacity: 0.6;
247
+ }
248
+
249
+ .button-primary {
250
+ background-color: var(--accent);
251
+ border-color: var(--accent);
252
+ color: var(--text-on-accent);
253
+ }
254
+ .button-primary:hover { background-color: var(--accent-overt); color: var(--text-on-accent); }
255
+ .button-primary:active { background-color: var(--accent-highlight); color: var(--text-on-accent); }
256
+ .button-primary:disabled { background-color: var(--accent-muted); color: var(--text-on-accent); }
257
+
258
+ .button-secondary {
259
+ background-color: var(--secondary);
260
+ border-color: var(--secondary);
261
+ color: var(--text-on-secondary);
262
+ }
263
+ .button-secondary:hover { background-color: var(--secondary-overt); color: var(--text-on-secondary); }
264
+ .button-secondary:active { background-color: var(--secondary-highlight); color: var(--text-on-secondary); }
265
+ .button-secondary:disabled { background-color: var(--secondary-muted); color: var(--text-on-secondary); }
266
+
267
+ .button-outline {
268
+ background-color: transparent;
269
+ border-color: var(--outline);
270
+ color: var(--text);
271
+ }
272
+ .button-outline:hover { background-color: var(--highlight-subtle); }
273
+ .button-outline:active { background-color: var(--highlight-overt); }
274
+ .button-outline:disabled { background-color: transparent; }
275
+
276
+ .button-ghost {
277
+ background-color: transparent;
278
+ border-color: transparent;
279
+ color: var(--text);
280
+ }
281
+ .button-ghost:hover { background-color: var(--highlight-subtle); }
282
+ .button-ghost:active { background-color: var(--highlight-overt); }
283
+ .button-ghost:disabled { background-color: transparent; }
284
+
285
+ .button-text {
286
+ background-color: transparent;
287
+ border-color: transparent;
288
+ color: var(--accent);
289
+ padding: 0.5rem 1rem;
290
+ }
291
+ .button-text:hover { color: var(--accent-overt); }
292
+ .button-text:active { color: var(--accent-highlight); }
293
+ .button-text:disabled { color: var(--text-muted); }
294
+
295
+ /* ============================================ */
296
+ /* IMPROVED FORM ELEMENTS */
297
+ /* ============================================ */
298
+
299
+ .input, .textarea, .select {
300
+ padding: 0.5rem;
301
+ font-family: var(--font-family);
302
+ font-size: var(--font-size-base);
303
+ line-height: var(--line-height-base);
304
+ border: var(--border-width) solid var(--outline);
305
+ border-radius: var(--border-radius-md);
306
+ background-color: var(--surface);
307
+ color: var(--text-on-surface);
308
+ transition: border-color 0.15s ease;
309
+ }
310
+
311
+ .input:focus, .textarea:focus, .select:focus {
312
+ outline: none;
313
+ border-color: var(--outline-focus);
314
+ box-shadow: 0 0 0 2px var(--outline-focus);
315
+ }
316
+
317
+ .input:hover, .textarea:hover, .select:hover {
318
+ border-color: var(--outline-overt);
319
+ }
320
+
321
+ .input:disabled, .textarea:disabled, .select:disabled {
322
+ background-color: var(--surface-muted);
323
+ color: var(--text-muted);
324
+ cursor: not-allowed;
325
+ }
326
+
327
+ /* ============================================ */
328
+ /* IMPROVED FOCUS STATES */
329
+ /* ============================================ */
330
+
331
+ .focus-ring:focus {
332
+ outline: var(--focus-ring-width) var(--focus-ring-style) var(--focus-ring-color);
333
+ outline-offset: var(--focus-ring-offset);
334
+ }
335
+
336
+ .focus-ring-inset:focus {
337
+ outline: none;
338
+ box-shadow: inset 0 0 0 var(--focus-ring-width) var(--focus-ring-color);
339
+ }
340
+
341
+ /* ============================================ */
342
+ /* IMPROVED TYPOGRAPHY UTILITIES */
343
+ /* ============================================ */
344
+
345
+ .text-xs { font-size: var(--font-size-xs, 0.75rem); }
346
+ .text-sm { font-size: var(--font-size-sm, 0.875rem); }
347
+ .text-base { font-size: var(--font-size-base, 1rem); }
348
+ .text-lg { font-size: var(--font-size-lg, 1.125rem); }
349
+ .text-xl { font-size: var(--font-size-xl, 1.25rem); }
350
+ .text-2xl { font-size: var(--font-size-2xl, 1.5rem); }
351
+ .text-3xl { font-size: var(--font-size-3xl, 1.875rem); }
352
+ .text-4xl { font-size: var(--font-size-4xl, 2.25rem); }
353
+ .text-5xl { font-size: var(--font-size-5xl, 3rem); }
354
+ .text-6xl { font-size: var(--font-size-6xl, 3.75rem); }
355
+
356
+ .font-normal { font-weight: var(--font-weight-normal); }
357
+ .font-medium { font-weight: var(--font-weight-medium); }
358
+ .font-semibold { font-weight: var(--font-weight-semibold); }
359
+ .font-bold { font-weight: var(--font-weight-bold); }
360
+
361
+ /* ============================================ */
362
+ /* IMPROVED SPACING UTILITIES */
363
+ /* ============================================ */
364
+
365
+ .p-xs { padding: var(--spacing-xs, 0.25rem); }
366
+ .p-sm { padding: var(--spacing-sm, 0.5rem); }
367
+ .p-md { padding: var(--spacing-md, 1rem); }
368
+ .p-lg { padding: var(--spacing-lg, 1.5rem); }
369
+ .p-xl { padding: var(--spacing-xl, 2rem); }
370
+
371
+ .m-xs { margin: var(--spacing-xs, 0.25rem); }
372
+ .m-sm { margin: var(--spacing-sm, 0.5rem); }
373
+ .m-md { margin: var(--spacing-md, 1rem); }
374
+ .m-lg { margin: var(--spacing-lg, 1.5rem); }
375
+ .m-xl { margin: var(--spacing-xl, 2rem); }
376
+
377
+ /* ============================================ */
378
+ /* IMPROVED BORDER RADIUS */
379
+ /* ============================================ */
380
+
381
+ .rounded-sm { border-radius: var(--border-radius-sm); }
382
+ .rounded { border-radius: var(--border-radius-md); }
383
+ .rounded-md { border-radius: var(--border-radius-md); }
384
+ .rounded-lg { border-radius: var(--border-radius-lg); }
385
+ .rounded-xl { border-radius: var(--border-radius-xl); }
386
+ .rounded-full { border-radius: var(--border-radius-full); }
387
+
388
+ /* ============================================ */
389
+ /* IMPROVED SHADOWS */
390
+ /* ============================================ */
391
+
392
+ .shadow-sm { box-shadow: var(--shadow-sm); }
393
+ .shadow { box-shadow: var(--shadow-md); }
394
+ .shadow-md { box-shadow: var(--shadow-md); }
395
+ .shadow-lg { box-shadow: var(--shadow-lg); }
396
+ .shadow-xl { box-shadow: var(--shadow-xl); }
397
+ .shadow-inner { box-shadow: var(--shadow-inner); }
398
+
399
+ /* ============================================ */
400
+ /* IMPROVED DISPLAY UTILITIES */
401
+ /* ============================================ */
402
+
403
+ .d-block { display: block; }
404
+ .d-inline { display: inline; }
405
+ .d-inline-block { display: inline-block; }
406
+ .d-flex { display: flex; }
407
+ .d-grid { display: grid; }
408
+ .d-none { display: none; }
409
+
410
+ /* ============================================ */
411
+ /* IMPROVED FLEX UTILITIES */
412
+ /* ============================================ */
413
+
414
+ .flex-row { flex-direction: row; }
415
+ .flex-col { flex-direction: column; }
416
+ .flex-wrap { flex-wrap: wrap; }
417
+ .items-center { align-items: center; }
418
+ .justify-center { justify-content: center; }
419
+ .justify-between { justify-content: space-between; }
420
+ .justify-around { justify-content: space-around; }
421
+ .justify-end { justify-content: flex-end; }
422
+
423
+ /* ============================================ */
424
+ /* IMPROVED POSITION UTILITIES */
425
+ /* ============================================ */
426
+
427
+ .pos-static { position: static; }
428
+ .pos-relative { position: relative; }
429
+ .pos-absolute { position: absolute; }
430
+ .pos-fixed { position: fixed; }
431
+ .pos-sticky { position: sticky; }
432
+
433
+ /* ============================================ */
434
+ /* IMPROVED OVERFLOW UTILITIES */
435
+ /* ============================================ */
436
+
437
+ .overflow-auto { overflow: auto; }
438
+ .overflow-hidden { overflow: hidden; }
439
+ .overflow-scroll { overflow: scroll; }
440
+ .overflow-visible { overflow: visible; }
441
+
442
+ /* ============================================ */
443
+ /* IMPROVED INTERACTIVE STATE UTILITIES */
444
+ /* ============================================ */
445
+
446
+ .hover-highlight:hover { background-color: var(--highlight-bg-subtle); }
447
+ .active-press:active { transform: scale(0.98); }
448
+ .focus-ring:focus { outline: var(--focus-ring-width) var(--focus-ring-style) var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }
449
+
450
+ /* ============================================ */
451
+ /* IMPROVED ANCHOR POSITIONING UTILITIES */
452
+ /* ============================================ */
453
+ /*
454
+ * CSS Anchor Positioning utilities for creating positioned elements
455
+ * that tether to other elements (anchors) with automatic collision detection.
456
+ *
457
+ * Usage:
458
+ * 1. Add .anchor-name-* to the element you want to anchor to
459
+ * 2. Add .position-anchor-* to the positioned element
460
+ * 3. Add .position-area-* to control the positioning relative to the anchor
461
+ * 4. Optionally add .position-try-fallback for automatic repositioning
462
+ *
463
+ * Example:
464
+ * <button class="anchor-name-tooltip">Hover me</button>
465
+ * <div class="position-anchor-tooltip position-area-bottom position-try-fallback">
466
+ * Tooltip content
467
+ * </div>
468
+ */
469
+
470
+ /* Anchor name utilities for creating anchor references */
471
+ .anchor-name-top { anchor-name: --anchor-top; }
472
+ .anchor-name-bottom { anchor-name: --anchor-bottom; }
473
+ .anchor-name-left { anchor-name: --anchor-left; }
474
+ .anchor-name-right { anchor-name: --anchor-right; }
475
+ .anchor-name-center { anchor-name: --anchor-center; }
476
+
477
+ /* Position anchor utilities for referencing anchors */
478
+ .position-anchor-top { position-anchor: --anchor-top; }
479
+ .position-anchor-bottom { position-anchor: --anchor-bottom; }
480
+ .position-anchor-left { position-anchor: --anchor-left; }
481
+ .position-anchor-right { position-anchor: --anchor-right; }
482
+ .position-anchor-center { position-anchor: --anchor-center; }
483
+
484
+ /* Position area utilities for common anchor positions */
485
+ @supports (position-area: top center) {
486
+ .position-area-top { position-area: top center; }
487
+ .position-area-bottom { position-area: bottom center; }
488
+ .position-area-left { position-area: left center; }
489
+ .position-area-right { position-area: right center; }
490
+ .position-area-top-left { position-area: top left; }
491
+ .position-area-top-right { position-area: top right; }
492
+ .position-area-bottom-left { position-area: bottom left; }
493
+ .position-area-bottom-right { position-area: bottom right; }
494
+ .position-area-center { position-area: center; }
495
+ }
496
+
497
+ /* Position try utilities for fallback positioning */
498
+ .position-try-fallback { position-try: --fallback-positions; }
499
+
500
+ @position-try --fallback-positions {
501
+ @try not media(viewport-right: 0px) { position-area: bottom center; }
502
+ @try { position-area: top center; }
503
+ @try not media(viewport-bottom: 0px) { position-area: right center; }
504
+ @try { position-area: left center; }
505
+ }
506
+
507
+ /* ============================================ */
508
+ /* IMPROVED SCRIM UTILITIES */
509
+ /* ============================================ */
510
+
511
+ .scrim { background-color: var(--scrim); }
512
+ .scrim-light { background-color: var(--scrim-light); }
513
+
514
+ /* ============================================ */
515
+ /* OUTLINE AND RING UTILITIES */
516
+ /* ============================================ */
517
+
518
+ .outline-thin { outline-width: 1px; outline-style: solid; }
519
+ .outline { outline-width: 2px; outline-style: solid; }
520
+ .outline-thick { outline-width: 3px; outline-style: solid; }
521
+ .ring-1 { box-shadow: 0 0 0 1px var(--outline-focus); }
522
+ .ring-2 { box-shadow: 0 0 0 2px var(--outline-focus); }
523
+ .ring-3 { box-shadow: 0 0 0 3px var(--outline-focus); }
524
+
525
+ /* ============================================ */
526
+ /* GAP UTILITIES */
527
+ /* ============================================ */
528
+
529
+ .gap-x-xs { column-gap: var(--spacing-xs); }
530
+ .gap-x-sm { column-gap: var(--spacing-sm); }
531
+ .gap-x-md { column-gap: var(--spacing-md); }
532
+ .gap-x-lg { column-gap: var(--spacing-lg); }
533
+ .gap-x-xl { column-gap: var(--spacing-xl); }
534
+ .gap-y-xs { row-gap: var(--spacing-xs); }
535
+ .gap-y-sm { row-gap: var(--spacing-sm); }
536
+ .gap-y-md { row-gap: var(--spacing-md); }
537
+ .gap-y-lg { row-gap: var(--spacing-lg); }
538
+ .gap-y-xl { row-gap: var(--spacing-xl); }
539
+
540
+ /* ============================================ */
541
+ /* GRID SHORTHANDS */
542
+ /* ============================================ */
543
+
544
+ .grid-cols-1 { grid-template-columns: var(--grid-cols-1); }
545
+ .grid-cols-2 { grid-template-columns: var(--grid-cols-2); }
546
+ .grid-cols-3 { grid-template-columns: var(--grid-cols-3); }
547
+ .grid-cols-4 { grid-template-columns: var(--grid-cols-4); }
548
+ .grid-cols-6 { grid-template-columns: var(--grid-cols-6); }
549
+ .grid-cols-12 { grid-template-columns: var(--grid-cols-12); }
550
+
551
+ /* ============================================ */
552
+ /* LEGACY FRAMEWORK COMPATIBILITY */
553
+ /* ============================================ */
554
+
555
+ /* Map to original framework class names */
556
+ .btn { @extend .button; }
557
+ .btn-primary { @extend .button-primary; }
558
+ .btn-secondary { @extend .button-secondary; }
559
+ .btn-outline { @extend .button-outline; }
560
+ .btn-ghost { @extend .button-ghost; }
561
+ .btn-text { @extend .button-text; }
562
+
563
+ .form-control { @extend .input; }
564
+ }
@@ -0,0 +1,111 @@
1
+ /** A scoped, progressively enhanced router for the View Transitions API. */
2
+
3
+ const ROUTER_SELECTOR = ':is(view-transitions, view-transition, [data-view-transitions], .view-transitions)';
4
+ const PAGE_SELECTOR = ':is(view-page, [data-view-page], .view-page)';
5
+ const TRIGGER_SELECTOR = ':is(nav-trigger, [data-view-trigger], .view-trigger)';
6
+
7
+ function initializeViewTransitions(root = document) {
8
+ root.querySelectorAll(ROUTER_SELECTOR).forEach(router => {
9
+ if (router.dataset.viewTransitionsInitialized === 'true') return;
10
+
11
+ const pages = Array.from(router.querySelectorAll(PAGE_SELECTOR));
12
+ const triggers = Array.from(router.querySelectorAll(TRIGGER_SELECTOR));
13
+ if (pages.length === 0) return;
14
+
15
+ router.dataset.viewTransitionsInitialized = 'true';
16
+
17
+ const targetFor = trigger => {
18
+ const explicitTarget = trigger.getAttribute('to');
19
+ if (explicitTarget) return explicitTarget.replace(/^#/, '');
20
+
21
+ const href = trigger.getAttribute('href');
22
+ return href?.startsWith('#') ? href.slice(1) : '';
23
+ };
24
+
25
+ const setActivePage = pageId => {
26
+ const nextPage = pages.find(page => page.id === pageId);
27
+ if (!nextPage) return null;
28
+
29
+ pages.forEach(page => page.toggleAttribute('active', page === nextPage));
30
+ triggers.forEach(trigger => {
31
+ const isCurrent = targetFor(trigger) === pageId;
32
+ if (isCurrent) trigger.setAttribute('aria-current', 'page');
33
+ else trigger.removeAttribute('aria-current');
34
+ });
35
+
36
+ return nextPage;
37
+ };
38
+
39
+ const showPage = (pageId, options = {}) => {
40
+ const { updateHistory = true, focus = true } = options;
41
+ const nextPage = pages.find(page => page.id === pageId);
42
+ if (!nextPage) return;
43
+
44
+ const update = () => setActivePage(pageId);
45
+ const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
46
+
47
+ let transition;
48
+
49
+ if (!reduceMotion && typeof document.startViewTransition === 'function') {
50
+ transition = document.startViewTransition(update);
51
+ } else {
52
+ update();
53
+ }
54
+
55
+ if (updateHistory && window.location.hash !== `#${pageId}`) {
56
+ window.history.pushState(null, '', `#${pageId}`);
57
+ }
58
+
59
+ const focusPage = () => {
60
+ if (!nextPage.hasAttribute('tabindex')) nextPage.setAttribute('tabindex', '-1');
61
+ nextPage.focus({ preventScroll: true });
62
+ };
63
+
64
+ if (focus) {
65
+ if (transition?.updateCallbackDone) transition.updateCallbackDone.then(focusPage);
66
+ else focusPage();
67
+ }
68
+ };
69
+
70
+ triggers.forEach(trigger => {
71
+ const pageId = targetFor(trigger);
72
+ if (!pageId) return;
73
+
74
+ if (!trigger.hasAttribute('aria-controls')) trigger.setAttribute('aria-controls', pageId);
75
+
76
+ trigger.addEventListener('click', event => {
77
+ event.preventDefault();
78
+ showPage(pageId);
79
+ });
80
+
81
+ if (trigger.matches('nav-trigger')) {
82
+ trigger.addEventListener('keydown', event => {
83
+ if (event.key === 'Enter' || event.key === ' ') {
84
+ event.preventDefault();
85
+ showPage(pageId);
86
+ }
87
+ });
88
+ }
89
+ });
90
+
91
+ const syncFromLocation = () => {
92
+ const hashTarget = window.location.hash.slice(1);
93
+ const initialPage = pages.find(page => page.id === hashTarget)
94
+ || pages.find(page => page.hasAttribute('active'))
95
+ || pages[0];
96
+
97
+ if (initialPage) showPage(initialPage.id, { updateHistory: false, focus: false });
98
+ };
99
+
100
+ window.addEventListener('popstate', syncFromLocation);
101
+ syncFromLocation();
102
+ });
103
+ }
104
+
105
+ if (document.readyState === 'loading') {
106
+ document.addEventListener('DOMContentLoaded', () => initializeViewTransitions(), { once: true });
107
+ } else {
108
+ initializeViewTransitions();
109
+ }
110
+
111
+ export { initializeViewTransitions };