techfreakworm commited on
Commit
1a3b62d
·
unverified ·
1 Parent(s): 0592951

feat(theme): css rules for param info tooltips and custom model selector

Browse files
Files changed (2) hide show
  1. tests/test_theme.py +22 -0
  2. theme.py +96 -0
tests/test_theme.py CHANGED
@@ -44,3 +44,25 @@ def test_fonts_geist_and_geist_mono():
44
  assert "--font-mono:" in css, "--font-mono CSS variable missing from generated theme CSS"
45
  assert "Geist" in css, "Geist font name missing from generated theme CSS"
46
  assert "Geist Mono" in css, "Geist Mono font name missing from generated theme CSS"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  assert "--font-mono:" in css, "--font-mono CSS variable missing from generated theme CSS"
45
  assert "Geist" in css, "Geist font name missing from generated theme CSS"
46
  assert "Geist Mono" in css, "Geist Mono font name missing from generated theme CSS"
47
+
48
+
49
+ def test_css_includes_param_tooltip_rule():
50
+ css = theme.CSS
51
+ assert ".zis-info" in css
52
+ assert "data-info" in css # attr() reference in ::after
53
+ assert "::after" in css
54
+
55
+
56
+ def test_css_includes_model_selector_rules():
57
+ css = theme.CSS
58
+ assert ".zis-models" in css
59
+ assert ".zis-model" in css
60
+ assert ".zis-model.on" in css
61
+ assert ".zis-model.soon" in css
62
+
63
+
64
+ def test_css_model_grid_is_responsive():
65
+ css = theme.CSS
66
+ assert "grid-template-columns" in css
67
+ assert "@media" in css
68
+ assert "min-width: 768px" in css or "min-width:768px" in css
theme.py CHANGED
@@ -117,4 +117,100 @@ body, .gradio-container {
117
  .zis-lora.loaded {
118
  border: 1px solid #FFB02E !important;
119
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  """.strip()
 
117
  .zis-lora.loaded {
118
  border: 1px solid #FFB02E !important;
119
  }
120
+
121
+ /* ===== Param tooltip — (i) icon next to labels (spec § 4.6) ===== */
122
+
123
+ .zis-row-label {
124
+ display: inline-flex; align-items: center;
125
+ font-size: 11px; color: #A89478; font-weight: 500;
126
+ margin-bottom: 6px;
127
+ }
128
+ .zis-info {
129
+ display: inline-flex; align-items: center; justify-content: center;
130
+ width: 12px; height: 12px;
131
+ font: italic 600 8px 'Geist', system-ui, sans-serif;
132
+ border: 1px solid #2A2218; border-radius: 50%;
133
+ color: #A89478; vertical-align: super;
134
+ margin-left: 3px; cursor: help; position: relative;
135
+ transition: border-color 0.12s, color 0.12s;
136
+ }
137
+ .zis-info:hover { border-color: #FFB02E; color: #FFB02E; }
138
+ .zis-info::after {
139
+ content: attr(data-info);
140
+ position: absolute; bottom: 100%; left: 50%;
141
+ transform: translateX(-50%) translateY(-4px);
142
+ background: #1C170F; color: #FAF1E3;
143
+ border: 1px solid #2A2218; border-radius: 6px;
144
+ padding: 6px 10px;
145
+ font: 400 11px 'Geist', system-ui, sans-serif; line-height: 1.4;
146
+ width: 200px; white-space: normal;
147
+ opacity: 0; pointer-events: none;
148
+ transition: opacity 0.12s; z-index: 50;
149
+ box-shadow: 0 4px 16px rgba(0,0,0,0.4);
150
+ }
151
+ .zis-info:hover::after, .zis-info.shown::after { opacity: 1; }
152
+
153
+ /* ===== Custom model selector — 2-col phone / 4-col tablet+ (spec § 4.7) ===== */
154
+
155
+ .zis-models {
156
+ display: grid;
157
+ grid-template-columns: 1fr 1fr;
158
+ gap: 8px;
159
+ margin-bottom: 10px;
160
+ }
161
+ @media (min-width: 768px) {
162
+ .zis-models { grid-template-columns: repeat(4, 1fr); }
163
+ }
164
+ .zis-model {
165
+ display: flex; align-items: center; gap: 8px;
166
+ padding: 10px 12px;
167
+ border: 1px solid #2A2218; border-radius: 8px;
168
+ background: transparent; cursor: pointer;
169
+ color: #FAF1E3;
170
+ font: 500 12px 'Geist', system-ui, sans-serif;
171
+ text-decoration: none;
172
+ transition: opacity 0.15s, border-color 0.15s, background 0.15s;
173
+ }
174
+ .zis-model .dot {
175
+ width: 10px; height: 10px; border-radius: 50%;
176
+ border: 1px solid #2A2218; flex-shrink: 0;
177
+ }
178
+ .zis-model .name { flex: 1; text-align: left; }
179
+ .zis-model.on {
180
+ background: #FFB02E; color: #1A1208; border-color: #FFB02E;
181
+ }
182
+ .zis-model.on .dot { background: #1A1208; border-color: #1A1208; }
183
+ .zis-model.soon {
184
+ opacity: 0.55;
185
+ background: rgba(255,176,46,0.04);
186
+ border-style: dashed;
187
+ position: relative;
188
+ }
189
+ .zis-model.soon .name { color: #A89478; }
190
+ .zis-model.soon .name .ext {
191
+ font-size: 10px; color: #FFB02E;
192
+ margin-left: 4px; vertical-align: super;
193
+ }
194
+ .zis-model.soon .soon-tag {
195
+ font-family: 'Geist Mono', ui-monospace, monospace;
196
+ font-size: 8.5px; letter-spacing: 0.12em; text-transform: uppercase;
197
+ background: rgba(255,176,46,0.18); color: #FFB02E;
198
+ padding: 2px 6px; border-radius: 100px;
199
+ flex-shrink: 0;
200
+ }
201
+ .zis-model.soon:hover { opacity: 0.78; border-color: #FFB02E; }
202
+ .zis-model.soon::after {
203
+ content: "Coming soon — opens GitHub";
204
+ position: absolute; bottom: 100%; left: 50%;
205
+ transform: translateX(-50%) translateY(-4px);
206
+ background: #1C170F; color: #FAF1E3;
207
+ border: 1px solid #2A2218; border-radius: 6px;
208
+ padding: 6px 10px;
209
+ font: 400 11px 'Geist', system-ui, sans-serif;
210
+ white-space: nowrap;
211
+ opacity: 0; pointer-events: none;
212
+ transition: opacity 0.12s; z-index: 50;
213
+ box-shadow: 0 4px 16px rgba(0,0,0,0.4);
214
+ }
215
+ .zis-model.soon:hover::after { opacity: 1; }
216
  """.strip()