Los botones no traen código: traen una nota. Siete tipos de nota, y el host de cada plataforma pone el cómo.
navigate — caminar a una pantalla (este funciona):
{
"type": "button",
"props": {
"action": {
"type": "navigate",
"target": "treceui/text"
},
"style": "prominent",
"title": "Ir a Texto"
}
}
sale esto:
Ir a Texto
presentation: replace — la pantalla se cambia en el lugar (un chip que re-reparte no es un paso más adentro):
{
"type": "button",
"props": {
"action": {
"type": "navigate",
"presentation": "replace",
"target": "treceui/actions"
}
},
"children": [
{
"type": "stack",
"props": {
"axis": "horizontal",
"background": "surface",
"corner_radius": 999,
"padding": 10
},
"children": [
{
"type": "label",
"props": {
"color": "text_primary",
"content": "Re-repartir",
"role": "secondary"
}
}
]
}
]
}
sale esto:
Re-repartir
open_url — salir de la app hacia el navegador:
{
"type": "button",
"props": {
"action": {
"type": "open_url",
"url": "https://trece.store"
},
"style": "prominent",
"title": "Ver el contrato en GitHub"
}
}
sale esto:
Ver el contrato en GitHub
set_variable — escribir lo que el dispositivo guarda, sin red. Toca y mira el contador (es $var:demo.count, leído al pintar):
{
"type": "stack",
"props": {
"spacing": 8
},
"children": [
{
"type": "stack",
"props": {
"alignment": "center",
"axis": "horizontal",
"spacing": 12
},
"children": [
{
"type": "button",
"props": {
"action": {
"type": "set_variable",
"add": 1,
"path": "count",
"role": "demo"
},
"size": "compact",
"style": "prominent",
"title": "+1"
}
},
{
"type": "text",
"props": {
"content": "$var:demo.count",
"style": "headline",
"tabular": true
}
},
{
"type": "button",
"props": {
"action": {
"type": "set_variable",
"add": -1,
"path": "count",
"role": "demo"
},
"size": "compact",
"style": "prominent",
"title": "−1"
}
}
]
},
{
"type": "text",
"props": {
"color": "text_secondary",
"content": "El servidor nunca ve este número.",
"style": "caption"
}
}
]
}
sale esto:
El servidor nunca ve este número.
expand — traer un fragmento e injertarlo donde estaba el botón (así crece el feed del Muro):
{
"type": "button",
"props": {
"action": {
"type": "expand",
"target": "muro/feed/2"
},
"style": "prominent",
"title": "Cargar más"
}
}
sale esto:
install — el flujo de Obtener de la Store:
{
"type": "button",
"props": {
"action": {
"type": "install",
"app": "treceui"
},
"style": "prominent",
"title": "Obtener"
}
}
sale esto: