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.
- package/LICENSE +21 -0
- package/README.md +875 -0
- package/carousel.js +86 -0
- package/components/accessibility.css +51 -0
- package/components/actions.css +76 -0
- package/components/alert.css +122 -0
- package/components/application-patterns.css +122 -0
- package/components/badge.css +125 -0
- package/components/box-extra.css +220 -0
- package/components/box.css +75 -0
- package/components/card.css +130 -0
- package/components/carousel.css +76 -0
- package/components/chip.css +71 -0
- package/components/container.css +55 -0
- package/components/content-patterns.css +234 -0
- package/components/disclosure.css +581 -0
- package/components/divider.css +68 -0
- package/components/flex.css +59 -0
- package/components/form-patterns.css +273 -0
- package/components/form.css +130 -0
- package/components/grid.css +82 -0
- package/components/identity.css +59 -0
- package/components/img-container.css +141 -0
- package/components/img-container.js +75 -0
- package/components/list.css +69 -0
- package/components/loading.css +112 -0
- package/components/masonry.css +48 -0
- package/components/modal.css +73 -0
- package/components/navigation-patterns.css +245 -0
- package/components/navigation.css +200 -0
- package/components/popover.css +49 -0
- package/components/site-shell.css +180 -0
- package/components/status.css +110 -0
- package/components/table.css +98 -0
- package/components/tabs.css +103 -0
- package/components/tooltip.css +87 -0
- package/components/tooltips.css +73 -0
- package/components/view-transition.css +73 -0
- package/core/base.css +62 -0
- package/core/defaults.css +490 -0
- package/core/engine.css +32 -0
- package/core/mixins.css +376 -0
- package/core/palette-accent.css +8 -0
- package/core/palette-base.css +107 -0
- package/core/palette-extended.css +142 -0
- package/core/palette-feedback.css +62 -0
- package/core/palette.css +7 -0
- package/core/reset.css +270 -0
- package/core/text.css +171 -0
- package/core/theme.css +608 -0
- package/core/tokens.css +488 -0
- package/core/typography.css +327 -0
- package/index.css +66 -0
- package/layouts/layout-extra.css +204 -0
- package/layouts/layout-extras-helpers.css +19 -0
- package/layouts/layout.css +348 -0
- package/package.json +66 -0
- package/theme-generator.css +979 -0
- package/themes/example-brand.css +59 -0
- package/themes/theme-packs.css +31 -0
- package/types/css-tags.d.ts +482 -0
- package/utilities/utilities.css +564 -0
- package/view-transition.js +111 -0
package/core/text.css
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* text.css
|
|
3
|
+
*
|
|
4
|
+
* A declarative typography primitive.
|
|
5
|
+
* Supports <text>, [data-text], and .text hosts.
|
|
6
|
+
* ------------------------------------------------------------------------------
|
|
7
|
+
* Uses the Lea Verou auto-contrast trick: oklch relative color syntax reads
|
|
8
|
+
* the inherited --bg lightness and flips text between light/dark automatically.
|
|
9
|
+
*
|
|
10
|
+
* The color="" attribute accepts:
|
|
11
|
+
* - Keywords: "muted", "subtle", "default", "overt" (auto-contrast levels)
|
|
12
|
+
* - Semantic: "success", "warning", "error", "info", "link", "accent"
|
|
13
|
+
* - Raw CSS values: "var(--text-muted)", "oklch(50% 0.2 250)", etc.
|
|
14
|
+
*
|
|
15
|
+
* @feature {attr()} - Used for direct property control.
|
|
16
|
+
* @feature {Lea Verou Auto-Contrast} - oklch(from var(--bg) ...) for automatic
|
|
17
|
+
* readable text color against any background.
|
|
18
|
+
* @feature {Line-Clamp} - Supports both single-line and multi-line truncation.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
:is(text, [data-text], .text) {
|
|
22
|
+
/* --- Base Styles & Defaults --- */
|
|
23
|
+
--_text-align: attr(align type(*), start);
|
|
24
|
+
--_text-transform: attr(transform type(*), none);
|
|
25
|
+
/* `style` is a native global attribute; use `font-style` for this API. */
|
|
26
|
+
--_font-style: attr(font-style type(*), normal);
|
|
27
|
+
--_text-wrap: attr(wrap type(*), pretty);
|
|
28
|
+
--_tracking: attr(tracking type(*), normal);
|
|
29
|
+
|
|
30
|
+
/* --- Inherited Background for Auto-Contrast --- */
|
|
31
|
+
/* --bg inherits from the nearest ancestor that sets it (box, body, etc.).
|
|
32
|
+
Falls back to --base when no ancestor has set --bg. */
|
|
33
|
+
--_bg: var(--bg, var(--base));
|
|
34
|
+
|
|
35
|
+
display: inline-block;
|
|
36
|
+
margin: 0;
|
|
37
|
+
|
|
38
|
+
/* --- Apply variables to actual CSS properties --- */
|
|
39
|
+
font-size: var(--_fs, var(--font-size-base));
|
|
40
|
+
font-weight: var(--_fw, var(--font-weight-normal));
|
|
41
|
+
line-height: var(--_lh, var(--line-height-normal));
|
|
42
|
+
letter-spacing: var(--_tracking);
|
|
43
|
+
text-align: var(--_text-align);
|
|
44
|
+
text-transform: var(--_text-transform);
|
|
45
|
+
font-style: var(--_font-style);
|
|
46
|
+
text-wrap: var(--_text-wrap);
|
|
47
|
+
|
|
48
|
+
/* Default color: auto-contrast "default" level against --bg.
|
|
49
|
+
clamp flips lightness: dark bg → high l (light text), light bg → low l (dark text).
|
|
50
|
+
The clamp range [0.15, 0.85] controls how extreme the contrast is. */
|
|
51
|
+
color: var(--_color, oklch(from var(--_bg) clamp(0.15, (0.65 / l - 1) * 999, 0.85) min(c, 0.03) h));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Preserve the expected box behavior of semantic block content. */
|
|
55
|
+
:is(p, h1, h2, h3, h4, h5, h6, blockquote):is([data-text], .text) {
|
|
56
|
+
display: block;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* --- Size Variants (Maps to --font-size tokens) --- */
|
|
60
|
+
:is(text, [data-text], .text)[size="xs"] { --_fs: var(--font-size-xs); }
|
|
61
|
+
:is(text, [data-text], .text)[size="sm"] { --_fs: var(--font-size-sm); }
|
|
62
|
+
:is(text, [data-text], .text)[size="base"] { --_fs: var(--font-size-base); }
|
|
63
|
+
:is(text, [data-text], .text)[size="lg"] { --_fs: var(--font-size-lg); }
|
|
64
|
+
:is(text, [data-text], .text)[size="xl"] { --_fs: var(--font-size-xl); }
|
|
65
|
+
:is(text, [data-text], .text)[size="2xl"] { --_fs: var(--font-size-2xl); }
|
|
66
|
+
:is(text, [data-text], .text)[size="3xl"] { --_fs: var(--font-size-3xl); }
|
|
67
|
+
:is(text, [data-text], .text)[size="4xl"] { --_fs: var(--font-size-4xl); }
|
|
68
|
+
:is(text, [data-text], .text)[size="5xl"] { --_fs: var(--font-size-5xl); }
|
|
69
|
+
:is(text, [data-text], .text)[size="6xl"] { --_fs: var(--font-size-6xl); }
|
|
70
|
+
|
|
71
|
+
/* --- Weight Variants (Maps to --font-weight tokens) --- */
|
|
72
|
+
:is(text, [data-text], .text)[weight="thin"] { --_fw: var(--font-weight-thin); }
|
|
73
|
+
:is(text, [data-text], .text)[weight="light"] { --_fw: var(--font-weight-light); }
|
|
74
|
+
:is(text, [data-text], .text)[weight="normal"] { --_fw: var(--font-weight-normal); }
|
|
75
|
+
:is(text, [data-text], .text)[weight="medium"] { --_fw: var(--font-weight-medium); }
|
|
76
|
+
:is(text, [data-text], .text)[weight="semibold"] { --_fw: var(--font-weight-semibold); }
|
|
77
|
+
:is(text, [data-text], .text)[weight="bold"] { --_fw: var(--font-weight-bold); }
|
|
78
|
+
:is(text, [data-text], .text)[weight="black"] { --_fw: var(--font-weight-black); }
|
|
79
|
+
|
|
80
|
+
/* --- Letter Spacing (tracking) Variants --- */
|
|
81
|
+
:is(text, [data-text], .text)[tracking="tighter"] { --_tracking: var(--letter-spacing-tighter); }
|
|
82
|
+
:is(text, [data-text], .text)[tracking="tight"] { --_tracking: var(--letter-spacing-tight); }
|
|
83
|
+
:is(text, [data-text], .text)[tracking="normal"] { --_tracking: var(--letter-spacing-normal); }
|
|
84
|
+
:is(text, [data-text], .text)[tracking="wide"] { --_tracking: var(--letter-spacing-wide); }
|
|
85
|
+
:is(text, [data-text], .text)[tracking="wider"] { --_tracking: var(--letter-spacing-wider); }
|
|
86
|
+
:is(text, [data-text], .text)[tracking="widest"] { --_tracking: var(--letter-spacing-widest); }
|
|
87
|
+
|
|
88
|
+
/* ======================================================= */
|
|
89
|
+
/* == COLOR SYSTEM == */
|
|
90
|
+
/* ======================================================= */
|
|
91
|
+
|
|
92
|
+
/* --- Raw CSS value pass-through ---
|
|
93
|
+
Any color="" value that doesn't match a keyword below flows through
|
|
94
|
+
attr() directly, e.g. color="var(--text-muted)" or color="red". */
|
|
95
|
+
:is(text, [data-text], .text)[color] {
|
|
96
|
+
--_color: attr(color type(*));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* --- Auto-Contrast Keyword Levels ---
|
|
100
|
+
Each level adjusts the clamp range to control contrast intensity.
|
|
101
|
+
On light bg (l>0.6): text gets the LOW end of the range (dark text).
|
|
102
|
+
On dark bg (l<0.6): text gets the HIGH end of the range (light text). */
|
|
103
|
+
:is(text, [data-text], .text)[color="muted"] {
|
|
104
|
+
--_color: oklch(from var(--_bg) clamp(0.35, (0.65 / l - 1) * 999, 0.65) min(c, 0.02) h);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
:is(text, [data-text], .text)[color="subtle"] {
|
|
108
|
+
--_color: oklch(from var(--_bg) clamp(0.25, (0.65 / l - 1) * 999, 0.75) min(c, 0.03) h);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
:is(text, [data-text], .text)[color="default"] {
|
|
112
|
+
--_color: oklch(from var(--_bg) clamp(0.15, (0.65 / l - 1) * 999, 0.85) min(c, 0.03) h);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
:is(text, [data-text], .text)[color="overt"] {
|
|
116
|
+
--_color: oklch(from var(--_bg) clamp(0.05, (0.65 / l - 1) * 999, 0.95) min(c, 0.04) h);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* --- Semantic & Brand Colors --- */
|
|
120
|
+
:is(text, [data-text], .text)[color="link"] { --_color: var(--text-link); }
|
|
121
|
+
:is(text, [data-text], .text)[color="accent"] { --_color: var(--accent); }
|
|
122
|
+
:is(text, [data-text], .text)[color="secondary"] { --_color: var(--secondary); }
|
|
123
|
+
:is(text, [data-text], .text)[color="tertiary"] { --_color: var(--tertiary); }
|
|
124
|
+
|
|
125
|
+
/* --- Feedback Colors --- */
|
|
126
|
+
:is(text, [data-text], .text)[color="success"] { --_color: var(--text-success); }
|
|
127
|
+
:is(text, [data-text], .text)[color="warning"] { --_color: var(--text-warning); }
|
|
128
|
+
:is(text, [data-text], .text)[color="error"] { --_color: var(--text-error); }
|
|
129
|
+
:is(text, [data-text], .text)[color="info"] { --_color: var(--text-info); }
|
|
130
|
+
|
|
131
|
+
/* --- Line Height (leading) Variants --- */
|
|
132
|
+
:is(text, [data-text], .text)[leading="none"] { --_lh: var(--line-height-none); }
|
|
133
|
+
:is(text, [data-text], .text)[leading="tight"] { --_lh: var(--line-height-tight); }
|
|
134
|
+
:is(text, [data-text], .text)[leading="snug"] { --_lh: var(--line-height-snug); }
|
|
135
|
+
:is(text, [data-text], .text)[leading="normal"] { --_lh: var(--line-height-normal); }
|
|
136
|
+
:is(text, [data-text], .text)[leading="relaxed"] { --_lh: var(--line-height-relaxed); }
|
|
137
|
+
:is(text, [data-text], .text)[leading="loose"] { --_lh: var(--line-height-loose); }
|
|
138
|
+
|
|
139
|
+
/* --- Display Override --- */
|
|
140
|
+
:is(text, [data-text], .text)[display="inline"] { display: inline; }
|
|
141
|
+
:is(text, [data-text], .text)[display="block"] { display: block; }
|
|
142
|
+
|
|
143
|
+
/* --- Readable line-length constraints --- */
|
|
144
|
+
:is(text, [data-text], .text)[measure="body"] { max-inline-size: var(--measure-body); }
|
|
145
|
+
:is(text, [data-text], .text)[measure="heading"] { max-inline-size: var(--measure-heading); }
|
|
146
|
+
:is(text, [data-text], .text)[measure="wide"] { max-inline-size: var(--measure-wide, var(--measure-code)); }
|
|
147
|
+
|
|
148
|
+
/* ======================================================= */
|
|
149
|
+
/* == TRUNCATION LOGIC == */
|
|
150
|
+
/* ======================================================= */
|
|
151
|
+
|
|
152
|
+
/* --- Common styles for all line-clamping --- */
|
|
153
|
+
:is(text, [data-text], .text):is([truncate], [lines]) {
|
|
154
|
+
display: -webkit-box;
|
|
155
|
+
-webkit-box-orient: vertical;
|
|
156
|
+
overflow: hidden;
|
|
157
|
+
text-overflow: ellipsis;
|
|
158
|
+
/* text-wrap: balance or pretty breaks line-clamp, so it MUST be disabled. */
|
|
159
|
+
text-wrap: initial !important;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* --- Single-line truncation (shorthand for lines="1") --- */
|
|
163
|
+
:is(text, [data-text], .text)[truncate] {
|
|
164
|
+
-webkit-line-clamp: 1;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/* --- Multi-line truncation --- */
|
|
168
|
+
:is(text, [data-text], .text)[lines="2"] { -webkit-line-clamp: 2; }
|
|
169
|
+
:is(text, [data-text], .text)[lines="3"] { -webkit-line-clamp: 3; }
|
|
170
|
+
:is(text, [data-text], .text)[lines="4"] { -webkit-line-clamp: 4; }
|
|
171
|
+
:is(text, [data-text], .text)[lines="5"] { -webkit-line-clamp: 5; }
|