1616 < h1 style ="display:inline-flex;align-items:start;gap:0.3em "> < img src ="../static/logo.svg " alt ="" style ="height:1em "> Nimble.css — HTML5 Test Page</ h1 >
1717 < p > Based on < a href ="https://cbracco.github.io/html5-test-page/ "> html5-test-page</ a > . All standard HTML elements for visual regression testing.</ p >
1818 </ header >
19+ < nav id ="sticky-toggles " style ="position:sticky;top:0;z-index:999;display:flex;gap:1.5em;padding:0.5em 1em;background:var(--nc-surface-1, white);border-bottom:1px solid var(--nc-border, #ccc) ">
20+ < label style ="display:inline-flex;align-items:center;gap:0.4em;margin:0 "> < input id ="theme-toggle " type ="checkbox " role ="switch "> Dark Mode</ label >
21+ < label style ="display:inline-flex;align-items:center;gap:0.4em;margin:0 "> < input id ="nimble-toggle " type ="checkbox " role ="switch " checked > Nimble CSS</ label >
22+ </ nav >
1923 < nav >
2024 < ul >
2125 < li >
@@ -65,7 +69,7 @@ <h1 style="display:inline-flex;align-items:start;gap:0.3em"><img src="../static/
6569 < header > < h2 > Text</ h2 > </ header >
6670
6771 < article id ="text__headings ">
68- < header > < h3 > Headings</ h3 > </ header >
72+ < header > < h3 > Headings</ h3 > < label class =" nimble-section-toggle " > < input type =" checkbox " role =" switch " checked > Nimble </ label > </ header >
6973 < div >
7074 < h1 > Heading 1</ h1 >
7175 < h2 > Heading 2</ h2 >
@@ -78,15 +82,15 @@ <h6>Heading 6</h6>
7882 </ article >
7983
8084 < article id ="text__paragraphs ">
81- < header > < h3 > Paragraphs</ h3 > </ header >
85+ < header > < h3 > Paragraphs</ h3 > < label class =" nimble-section-toggle " > < input type =" checkbox " role =" switch " checked > Nimble </ label > </ header >
8286 < div >
8387 < p > A paragraph (from the Greek paragraphos, "to write beside" or "written beside") is a self-contained unit of a discourse in writing dealing with a particular point or idea. A paragraph consists of one or more sentences. Though not required by the syntax of any language, paragraphs are usually an expected part of formal writing, used to organize longer prose.</ p >
8488 </ div >
8589 < footer > < p > < a href ="#top "> [Top]</ a > </ p > </ footer >
8690 </ article >
8791
8892 < article id ="text__lists ">
89- < header > < h3 > Lists</ h3 > </ header >
93+ < header > < h3 > Lists</ h3 > < label class =" nimble-section-toggle " > < input type =" checkbox " role =" switch " checked > Nimble </ label > </ header >
9094 < div >
9195 < h4 > Definition list</ h4 >
9296 < dl >
@@ -138,7 +142,7 @@ <h4>Unordered List</h4>
138142 </ article >
139143
140144 < article id ="text__blockquotes ">
141- < header > < h3 > Blockquotes</ h3 > </ header >
145+ < header > < h3 > Blockquotes</ h3 > < label class =" nimble-section-toggle " > < input type =" checkbox " role =" switch " checked > Nimble </ label > </ header >
142146 < div >
143147 < blockquote >
144148 < p > A block quotation (also known as a long quotation or extract) is a quotation in a written document, that is set off from the main text as a paragraph, or block of text.</ p >
@@ -150,38 +154,43 @@ <h4>Unordered List</h4>
150154 </ article >
151155
152156 < article id ="text__details ">
153- < header > < h3 > Details / Summary</ h3 > </ header >
154- < details >
155- < summary > Expand for details</ summary >
156- < p > Lorem ipsum dolor sit amet consectetur adipisicing elit. Cum, odio! Odio natus ullam ad quaerat, eaque necessitatibus, aliquid distinctio similique voluptatibus dicta consequuntur animi. Quaerat facilis quidem unde eos! Ipsa.</ p >
157- </ details >
157+ < header > < h3 > Details / Summary</ h3 > < label class ="nimble-section-toggle "> < input type ="checkbox " role ="switch " checked > Nimble</ label > </ header >
158+ < div >
159+ < details >
160+ < summary > Expand for details</ summary >
161+ < p > Lorem ipsum dolor sit amet consectetur adipisicing elit. Cum, odio! Odio natus ullam ad quaerat, eaque necessitatibus, aliquid distinctio similique voluptatibus dicta consequuntur animi. Quaerat facilis quidem unde eos! Ipsa.</ p >
162+ </ details >
163+ </ div >
158164 < footer > < p > < a href ="#top "> [Top]</ a > </ p > </ footer >
159165 </ article >
160166
161167 < article id ="text__address ">
162- < header > < h3 > Address</ h3 > </ header >
163- < address >
164- Written by < a href ="mailto:webmaster@example.com "> Jon Doe</ a > .< br >
165- Visit us at:< br >
166- Example.com< br >
167- Box 564, Disneyland< br >
168- USA
169- </ address >
168+ < header > < h3 > Address</ h3 > < label class ="nimble-section-toggle "> < input type ="checkbox " role ="switch " checked > Nimble</ label > </ header >
169+ < div >
170+ < address >
171+ Written by < a href ="mailto:webmaster@example.com "> Jon Doe</ a > .< br >
172+ Visit us at:< br >
173+ Example.com< br >
174+ Box 564, Disneyland< br >
175+ USA
176+ </ address >
177+ </ div >
170178 < footer > < p > < a href ="#top "> [Top]</ a > </ p > </ footer >
171179 </ article >
172180
173181 < article id ="text__hr ">
174- < header > < h3 > Horizontal rules</ h3 > </ header >
182+ < header > < h3 > Horizontal rules</ h3 > < label class =" nimble-section-toggle " > < input type =" checkbox " role =" switch " checked > Nimble </ label > </ header >
175183 < div >
176184 < hr >
177185 </ div >
178186 < footer > < p > < a href ="#top "> [Top]</ a > </ p > </ footer >
179187 </ article >
180188
181189 < article id ="text__tables ">
182- < header > < h3 > Tabular data</ h3 > </ header >
183- < figure >
184- < table >
190+ < header > < h3 > Tabular data</ h3 > < label class ="nimble-section-toggle "> < input type ="checkbox " role ="switch " checked > Nimble</ label > </ header >
191+ < div >
192+ < figure >
193+ < table >
185194 < caption > Table Caption</ caption >
186195 < thead >
187196 < tr >
@@ -231,13 +240,14 @@ <h4>Unordered List</h4>
231240 < td > Table Cell 5</ td >
232241 </ tr >
233242 </ tbody >
234- </ table >
235- </ figure >
243+ </ table >
244+ </ figure >
245+ </ div >
236246 < footer > < p > < a href ="#top "> [Top]</ a > </ p > </ footer >
237247 </ article >
238248
239249 < article id ="text__code ">
240- < header > < h3 > Code</ h3 > </ header >
250+ < header > < h3 > Code</ h3 > < label class =" nimble-section-toggle " > < input type =" checkbox " role =" switch " checked > Nimble </ label > </ header >
241251 < div >
242252 < p > < strong > Keyboard input:</ strong > < kbd > Cmd</ kbd > </ p >
243253 < p > < strong > Inline code:</ strong > < code > <div>code</div></ code > </ p >
@@ -255,7 +265,7 @@ <h4>Pre-formatted text</h4>
255265 </ article >
256266
257267 < article id ="text__inline ">
258- < header > < h3 > Inline elements</ h3 > </ header >
268+ < header > < h3 > Inline elements</ h3 > < label class =" nimble-section-toggle " > < input type =" checkbox " role =" switch " checked > Nimble </ label > </ header >
259269 < div >
260270 < p > < a href ="#! "> This is a text link</ a > .</ p >
261271 < p > < strong > Strong is used to indicate strong importance.</ strong > </ p >
@@ -280,7 +290,7 @@ <h4>Pre-formatted text</h4>
280290 </ article >
281291
282292 < article id ="text__comments ">
283- < header > < h3 > HTML Comments</ h3 > </ header >
293+ < header > < h3 > HTML Comments</ h3 > < label class =" nimble-section-toggle " > < input type =" checkbox " role =" switch " checked > Nimble </ label > </ header >
284294 < div >
285295 < p > There is comment here: <!--This comment should not be displayed--> </ p >
286296 < p > There is a comment spanning multiple tags and lines below here.</ p >
@@ -299,7 +309,7 @@ <h4>Pre-formatted text</h4>
299309 < header > < h2 > Embedded content</ h2 > </ header >
300310
301311 < article id ="embedded__images ">
302- < header > < h3 > Images</ h3 > </ header >
312+ < header > < h3 > Images</ h3 > < label class =" nimble-section-toggle " > < input type =" checkbox " role =" switch " checked > Nimble </ label > </ header >
303313 < div >
304314 < h4 > Plain < code > <img></ code > element</ h4 >
305315 < p > < img src ="https://picsum.photos/480/480 " alt ="Photo "> </ p >
@@ -322,13 +332,13 @@ <h4><code><figure></code> element with a <code><picture></code> elem
322332 </ article >
323333
324334 < article id ="embedded__meter ">
325- < header > < h3 > Meter</ h3 > </ header >
335+ < header > < h3 > Meter</ h3 > < label class =" nimble-section-toggle " > < input type =" checkbox " role =" switch " checked > Nimble </ label > </ header >
326336 < div > < meter value ="2 " min ="0 " max ="10 "> 2 out of 10</ meter > </ div >
327337 < footer > < p > < small > Styled by < code > nimble-meter.min.css</ code > add-on.</ small > </ p > < p > < a href ="#top "> [Top]</ a > </ p > </ footer >
328338 </ article >
329339
330340 < article id ="embedded__progress ">
331- < header > < h3 > Progress</ h3 > </ header >
341+ < header > < h3 > Progress</ h3 > < label class =" nimble-section-toggle " > < input type =" checkbox " role =" switch " checked > Nimble </ label > </ header >
332342 < div >
333343 < progress value ="25 " max ="100 "> 25%</ progress >
334344 < progress > progress</ progress >
@@ -337,7 +347,7 @@ <h4><code><figure></code> element with a <code><picture></code> elem
337347 </ article >
338348
339349 < article id ="embedded__svg ">
340- < header > < h3 > Inline SVG</ h3 > </ header >
350+ < header > < h3 > Inline SVG</ h3 > < label class =" nimble-section-toggle " > < input type =" checkbox " role =" switch " checked > Nimble </ label > </ header >
341351 < div > < svg width ="100px " height ="100px "> < circle cx ="100 " cy ="100 " r ="100 " fill ="#1fa3ec "> </ circle > </ svg > </ div >
342352 < footer > < p > < a href ="#top "> [Top]</ a > </ p > </ footer >
343353 </ article >
@@ -351,6 +361,7 @@ <h4><code><figure></code> element with a <code><picture></code> elem
351361 < section id ="forms ">
352362 < header > < h2 > Form elements</ h2 > </ header >
353363 < form >
364+ < div class ="nimble-fieldset-toggle "> < label class ="nimble-section-toggle "> < input type ="checkbox " role ="switch " checked > Nimble</ label > </ div >
354365 < fieldset id ="forms__input ">
355366 < legend > Input fields</ legend >
356367 < p >
@@ -388,6 +399,7 @@ <h4><code><figure></code> element with a <code><picture></code> elem
388399 </ fieldset >
389400 < p > < a href ="#top "> [Top]</ a > </ p >
390401
402+ < div class ="nimble-fieldset-toggle "> < label class ="nimble-section-toggle "> < input type ="checkbox " role ="switch " checked > Nimble</ label > </ div >
391403 < fieldset id ="forms__select ">
392404 < legend > Select menus</ legend >
393405 < p >
@@ -414,6 +426,7 @@ <h4><code><figure></code> element with a <code><picture></code> elem
414426 < p > < small > Enhanced picker styled by < code > nimble-select.min.css</ code > add-on (native styling works without it).</ small > </ p >
415427 < p > < a href ="#top "> [Top]</ a > </ p >
416428
429+ < div class ="nimble-fieldset-toggle "> < label class ="nimble-section-toggle "> < input type ="checkbox " role ="switch " checked > Nimble</ label > </ div >
417430 < fieldset id ="forms__checkbox ">
418431 < legend > Checkboxes</ legend >
419432 < ul >
@@ -424,6 +437,7 @@ <h4><code><figure></code> element with a <code><picture></code> elem
424437 </ fieldset >
425438 < p > < a href ="#top "> [Top]</ a > </ p >
426439
440+ < div class ="nimble-fieldset-toggle "> < label class ="nimble-section-toggle "> < input type ="checkbox " role ="switch " checked > Nimble</ label > </ div >
427441 < fieldset id ="forms__radio ">
428442 < legend > Radio buttons</ legend >
429443 < ul >
@@ -434,6 +448,7 @@ <h4><code><figure></code> element with a <code><picture></code> elem
434448 </ fieldset >
435449 < p > < a href ="#top "> [Top]</ a > </ p >
436450
451+ < div class ="nimble-fieldset-toggle "> < label class ="nimble-section-toggle "> < input type ="checkbox " role ="switch " checked > Nimble</ label > </ div >
437452 < fieldset id ="forms__textareas ">
438453 < legend > Textareas</ legend >
439454 < p >
@@ -443,6 +458,7 @@ <h4><code><figure></code> element with a <code><picture></code> elem
443458 </ fieldset >
444459 < p > < a href ="#top "> [Top]</ a > </ p >
445460
461+ < div class ="nimble-fieldset-toggle "> < label class ="nimble-section-toggle "> < input type ="checkbox " role ="switch " checked > Nimble</ label > </ div >
446462 < fieldset id ="forms__html5 ">
447463 < legend > HTML5 inputs</ legend >
448464 < p >
@@ -489,6 +505,7 @@ <h4><code><figure></code> element with a <code><picture></code> elem
489505 </ fieldset >
490506 < p > < a href ="#top "> [Top]</ a > </ p >
491507
508+ < div class ="nimble-fieldset-toggle "> < label class ="nimble-section-toggle "> < input type ="checkbox " role ="switch " checked > Nimble</ label > </ div >
492509 < fieldset id ="forms__action ">
493510 < legend > Action buttons</ legend >
494511 < p >
@@ -538,6 +555,16 @@ <h4><code><figure></code> element with a <code><picture></code> elem
538555 </ nav >
539556 </ footer >
540557 < style >
558+ article > header {
559+ display : flex;
560+ justify-content : space-between;
561+ align-items : center;
562+ }
563+ .nimble-fieldset-toggle {
564+ display : flex;
565+ justify-content : flex-end;
566+ }
567+
541568 body > footer {
542569 margin-top : 2rem ;
543570 margin-bottom : calc (-1 * var (--nc-spacing ));
@@ -552,5 +579,54 @@ <h4><code><figure></code> element with a <code><picture></code> elem
552579 body > footer a > svg { margin-left : -20px ; }
553580 </ style >
554581
582+ < script src ="../no-nimble.js "> </ script >
583+ < script >
584+ // Theme toggle
585+ const themeToggle = document . getElementById ( 'theme-toggle' ) ;
586+ const html = document . documentElement ;
587+
588+ const prefersDark = window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches ;
589+ html . setAttribute ( 'data-theme' , prefersDark ? 'dark' : 'light' ) ;
590+ themeToggle . checked = prefersDark ;
591+
592+ themeToggle . addEventListener ( 'change' , ( ) => {
593+ html . setAttribute ( 'data-theme' , themeToggle . checked ? 'dark' : 'light' ) ;
594+ } ) ;
595+
596+ // Nimble CSS toggle
597+ const nimbleToggle = document . getElementById ( 'nimble-toggle' ) ;
598+ const sectionToggles = document . querySelectorAll ( '.nimble-section-toggle input' ) ;
599+
600+ // Find the content target for a per-section toggle
601+ function getToggleTarget ( checkbox ) {
602+ const article = checkbox . closest ( 'article' ) ;
603+ if ( article ) return article . querySelector ( ':scope > div' ) ;
604+ // Form section: toggle is in a div above the fieldset
605+ const wrapper = checkbox . closest ( '.nimble-fieldset-toggle' ) ;
606+ if ( wrapper ) return wrapper . nextElementSibling ;
607+ return null ;
608+ }
609+
610+ // Per-section toggles
611+ sectionToggles . forEach ( cb => {
612+ cb . addEventListener ( 'change' , ( ) => {
613+ const target = getToggleTarget ( cb ) ;
614+ if ( target ) target . classList . toggle ( 'no-nimble' , ! cb . checked ) ;
615+ // Sync global toggle: checked only if ALL section toggles are checked
616+ nimbleToggle . checked = [ ...sectionToggles ] . every ( s => s . checked ) ;
617+ } ) ;
618+ } ) ;
619+
620+ // Global toggle syncs all per-section toggles
621+ nimbleToggle . addEventListener ( 'change' , ( ) => {
622+ const on = nimbleToggle . checked ;
623+ sectionToggles . forEach ( cb => {
624+ cb . checked = on ;
625+ const target = getToggleTarget ( cb ) ;
626+ if ( target ) target . classList . toggle ( 'no-nimble' , ! on ) ;
627+ } ) ;
628+ } ) ;
629+ </ script >
630+
555631 </ body >
556632</ html >
0 commit comments