Guía de Rune-Web
Estilos y diseño adaptable
Da a una estantería una cuadrícula adaptable con tokens, presets y rules de @Style. Toda la presentación se escribe en Rune.
i18n.Guide.syntax
tokens: nombra valores compartidos; presets: agrupa declaraciones reutilizables. .panel utiliza el preset panel y style = guide aplica el estilo a la página.
Las reglas incluyen focus-visible y una cuadrícula ajustada al espacio disponible. Referencias como brand mantienen colores coherentes. Son declaraciones de estilo, no estado reactivo.
Cambia el tamaño de la vista previa o del navegador. Abre parts/style.rune, modifica brand y exporta localmente para probar tu paleta.
Ejecuta esta lección localmente
cargo run -- examples/rune-web/guide/styling.rune
cargo run -- examples/rune-web/guide/styling.rune -o html > index.htmlCada ejemplo es una aplicación Rune-Web completa e importa parts/style.rune. Abre el código para ver ambos archivos. Los datos de demostración permanecen en este navegador y se reinician al recargar la vista previa.
Estilos y diseño adaptable
Esta vista se compila a partir del ejemplo Rune real, incluidos sus estilos y acciones. Prueba la aplicación y abre el código fuente.
Ver código fuente
No hay archivos coincidentes.
styling.rune
#!RUNE
# Inspect parts/style.rune for tokens, presets, selector rules and a fluid grid.
import "parts/style.rune"
@App
name = Responsive reading shelf
type = REST
@Frontend
type = rune-web
path = %ROOT%
page = shelf
@Page/shelf
title = Responsive reading shelf
style = guide
view:
main:
h1 "A little reading shelf"
p "Resize the preview: these cards flow into the space available."
div .grid:
article .panel:
h2 "Discover"
p "Start with a small Rune document."
article .panel:
h2 "Build"
p "Compose a page from reusable pieces."
article .panel:
h2 "Share"
p "Export your page and let someone try it."
parts/style.rune
@Style/guide
tokens:
brand = #166b73
ink = #143841
surface = #ffffff
space = 1rem
presets:
panel:
background = {surface}
border = 1px solid #c7e2e4
border-radius = 16px
padding = {space}
rules:
body:
margin = 0
font-family = system-ui, sans-serif
color = {ink}
background = #edf7f7
main:
max-width = 900px
margin = 0 auto
padding = 1rem
.grid:
display = grid
grid-template-columns = repeat(auto-fit, minmax(min(100%, 220px), 1fr))
gap = {space}
.panel:
use = (panel)
margin-bottom = 1rem
.choices:
display = flex
flex-wrap = wrap
gap = 0.5rem
margin-bottom = 1rem
button:
padding = 0.75rem 1rem
background = {brand}
color = white
border = 0
border-radius = 8px
cursor = pointer
font = inherit
button:focus-visible:
outline = 3px solid #d56c45
outline-offset = 3px
button.active:
background = #a94022
input, select:
display = block
box-sizing = border-box
width = 100%
padding = 0.75rem
margin = 0.5rem 0 1rem
font = inherit
border = 1px solid #8baeb3
border-radius = 8px
.muted:
color = #44646b
.done:
text-decoration = line-through
h1:
font-size = clamp(1.5rem, 5vw, 2.2rem)
p, li:
line-height = 1.6