Repository navigation
feat(tokens): tema claro opt-in vía data-theme - #148
Merged
Merged
Conversation
Generated with [Devin](https://devin.ai)
Generated with [Devin](https://devin.ai)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implementa el soporte multi-theme discutido en #24, dividido en los issues #145 (paleta + contraste), #146 (build dual con toki) y #147 (documentación). El enfoque es aditivo: el tema oscuro sigue siendo el default en
:rooty el tema claro se activa condata-theme="light"en<html>o cualquier ancestro — CSS puro, seguro para SSR, sin JS de cliente.chucao-tokens.light.json: paleta clara completa con contraste AA verificado (acento#0f766ea 4.98:1 sobre el fondo; la familia#2dd4bforiginal no llega a AA sobre fondo claro). Tokens de marca sin cambios entre temas.toki.config.ts+scripts/build-tokens.mjs:toki1.12.1 ya soportathemesde primera clase. El script corretoki build --theme <name>una vez por tema en directorios separados (un run multi-tema limpia el output compartido entre temas y pierde artefactos), copia los artefactosdarkasrc/tokens/con sus nombres actuales, y reescribe el:rootdel CSS claro a[data-theme="light"]ensrc/global/themes/light.css.src/global/chucao.css: importa el tema claro, así que viaja en el mismochucao.cssde siempre — el consumidor solo escribe el atributo, sin imports extra.docs/using-the-library.md: nueva subsección «Themes» con ejemplo de uso.package.json:pnpm run tokensdelega en el script nuevo;pnpm run tokens:checkvalida ambos archivos de tokens.AGENTS.md: sección de design tokens actualizada para reflejar los dos archivos y el output del tema claro.Closes #145
Closes #146
Closes #147
Refs #24
Test plan
pnpm run tokensregenera ambos temas de forma determinística (src/tokens/sin cambios con la paleta dark actual)pnpm run tokens:checkvalidachucao-tokens.jsonychucao-tokens.light.jsonpnpm test— 486 tests en verde (incluye build de producción)pnpm lint,pnpm run format:check,pnpm run check:ai,pnpm run check:releaseden verdedist/chucao/chucao.css: bloque:root(dark) + bloque[data-theme='light']presenteslatest/solo se actualiza con release)Generated with Devin
Actualización: toggle en el docs site
El gallery y
forms.htmlahora incluyen un toggle de tema en la navegación superior (Tema: oscuro/Tema: claro):docs-site/assets/js/theme.jscrea el botón en.top-nav(patrón del sitio: el control se genera por JS, así sin JavaScript no hay botón muerto) y alternadata-themeen<html>, persistiendo la elección enlocalStorage.<head>de ambas páginas restaura el tema guardado antes del primer paint (sin flash).styles.cssya era casi todo token-driven; los overlays oscuros hardcodeados (rgba(0,0,0,…)) pasaron a variables locales--docs-wash/--docs-inset/--docs-code-bgcon overrides en[data-theme='light'], y el backdrop del drawer usavar(--color-scrim-default).Verificado con Playwright contra el build local: dark
rgb(16,10,28)→ click → lightrgb(246,243,250), persiste tras reload. Ojo: en producción el toggle cobrará efecto visual completo recién cuando el release publique elchucao.csscon el tema claro en el CDN.