feat: 29 funciones TUI — constructores, runners y helpers del dominio tui
16 constructores puros (NewList, NewSpinner, NewProgress, DefaultStyles...), 4 runners impuros (RunModel, RunFullscreen, RunWithMouseSupport, Confirm), 5 print helpers impuros (PrintSuccess/Error/Warning/Info/Muted) y 4 utilidades puras (Quit, ClearScreen, HideCursor, ShowCursor). Stubs que documentan devfactory/tui para el registry.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// ClearScreen devuelve el codigo de escape ANSI para limpiar la pantalla del terminal.
|
||||
func ClearScreen() string {
|
||||
return "\033[2J\033[H"
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: clear_screen
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func ClearScreen() string"
|
||||
description: "Devuelve el codigo de escape ANSI para limpiar la pantalla del terminal."
|
||||
tags: [tui, ansi, terminal, screen]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/clear_screen.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
fmt.Print(ClearScreen())
|
||||
// Limpia toda la pantalla y mueve el cursor a la posicion inicial
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Combina ESC[2J (borrar pantalla completa) con ESC[H (mover cursor a home). No tiene side effects: solo devuelve el string ANSI.
|
||||
@@ -0,0 +1,9 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// Confirm muestra un dialogo de confirmacion Si/No en terminal y devuelve la eleccion del usuario.
|
||||
func Confirm(prompt string) Result[bool] {
|
||||
// stub — implementation in devfactory/tui
|
||||
return Result[bool]{Value: false}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: confirm_prompt
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "func Confirm(prompt string) core.Result[bool]"
|
||||
description: "Muestra un dialogo de confirmacion Si/No en terminal y devuelve la eleccion del usuario."
|
||||
tags: [tui, confirm, prompt, interactive]
|
||||
uses_functions: []
|
||||
uses_types: [result_go_core]
|
||||
returns: [result_go_core]
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/confirm_prompt.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
result := tui.Confirm("¿Deseas continuar?")
|
||||
if result.IsErr() {
|
||||
log.Fatal(result.Error())
|
||||
}
|
||||
if result.Unwrap() {
|
||||
fmt.Println("Confirmado")
|
||||
}
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Implementacion real en github.com/lucasdataproyects/devfactory/tui. Este stub existe para documentar la firma y mantener el registry.
|
||||
@@ -0,0 +1,9 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// DarkStyles crea estilos oscuros usando el tema dark.
|
||||
func DarkStyles() Styles {
|
||||
// stub — implementation in devfactory/tui
|
||||
return Styles{}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: dark_styles
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func DarkStyles() Styles"
|
||||
description: "Construye estilos oscuros combinando DarkTheme con NewStyles. Atajo conveniente para terminales con fondo negro."
|
||||
tags: [tui, styles, dark, constructor]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: [styles_go_tui]
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/dark_styles.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
styles := DarkStyles()
|
||||
model := NewProgressWithStyles(100.0, "Compilando", styles)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Equivalente a NewStyles(DarkTheme()). Usa esta funcion para aplicaciones TUI en terminales oscuras.
|
||||
@@ -0,0 +1,9 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// DarkTheme crea un tema de colores oscuro.
|
||||
func DarkTheme() Theme {
|
||||
// stub — implementation in devfactory/tui
|
||||
return Theme{}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: dark_theme
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func DarkTheme() Theme"
|
||||
description: "Construye un tema de colores oscuro para componentes TUI. Paleta optimizada para terminales con fondo negro."
|
||||
tags: [tui, theme, colors, dark, constructor]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: [theme_go_tui]
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/dark_theme.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
theme := DarkTheme()
|
||||
styles := NewStyles(theme)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Alternativa oscura al DefaultTheme. Colores de alto contraste para fondos negros.
|
||||
@@ -0,0 +1,9 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// DefaultStyles crea estilos por defecto usando el tema base.
|
||||
func DefaultStyles() Styles {
|
||||
// stub — implementation in devfactory/tui
|
||||
return Styles{}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: default_styles
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func DefaultStyles() Styles"
|
||||
description: "Construye estilos por defecto combinando DefaultTheme con NewStyles. Atajo conveniente para el caso comun."
|
||||
tags: [tui, styles, constructor]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: [styles_go_tui]
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/default_styles.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
styles := DefaultStyles()
|
||||
model := NewSpinnerWithStyle("Cargando...", styles)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Equivalente a NewStyles(DefaultTheme()). Usa esta funcion cuando no necesitas personalizar el tema.
|
||||
@@ -0,0 +1,9 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// DefaultTheme crea el tema de colores por defecto.
|
||||
func DefaultTheme() Theme {
|
||||
// stub — implementation in devfactory/tui
|
||||
return Theme{}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: default_theme
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func DefaultTheme() Theme"
|
||||
description: "Construye el tema de colores por defecto para componentes TUI. Paleta clara optimizada para terminales con fondo blanco."
|
||||
tags: [tui, theme, colors, constructor]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: [theme_go_tui]
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/default_theme.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
theme := DefaultTheme()
|
||||
styles := NewStyles(theme)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Tema base del sistema de estilos. Usar DarkTheme para terminales con fondo oscuro.
|
||||
@@ -0,0 +1,8 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// HideCursor devuelve el codigo de escape ANSI para ocultar el cursor del terminal.
|
||||
func HideCursor() string {
|
||||
return "\033[?25l"
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: hide_cursor
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func HideCursor() string"
|
||||
description: "Devuelve el codigo de escape ANSI para ocultar el cursor del terminal."
|
||||
tags: [tui, ansi, terminal, cursor]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/hide_cursor.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
fmt.Print(HideCursor())
|
||||
// Oculta el cursor del terminal usando DECTCEM
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Usa la secuencia DECTCEM (ESC[?25l) del estandar VT220. Recordar restaurar el cursor con ShowCursor al finalizar la aplicacion.
|
||||
@@ -0,0 +1,9 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// NewBaseModel crea un modelo base con configuracion por defecto.
|
||||
func NewBaseModel() BaseModel {
|
||||
// stub — implementation in devfactory/tui
|
||||
return BaseModel{}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
name: new_base_model
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func NewBaseModel() BaseModel"
|
||||
description: "Construye un modelo base con dimensiones de terminal y estilos por defecto. Sirve como fundacion para componer modelos mas complejos."
|
||||
tags: [tui, base, constructor]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: [base_model_go_tui]
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/new_base_model.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
base := NewBaseModel()
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Modelo raiz que encapsula estado comun (dimensiones, estilos, keybindings) compartido por todos los componentes TUI.
|
||||
@@ -0,0 +1,9 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// NewConfirm crea un modelo de dialogo de confirmacion si/no.
|
||||
func NewConfirm(prompt string) ConfirmModel {
|
||||
// stub — implementation in devfactory/tui
|
||||
return ConfirmModel{}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
name: new_confirm
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func NewConfirm(prompt string) ConfirmModel"
|
||||
description: "Construye un modelo de dialogo de confirmacion con una pregunta si/no."
|
||||
tags: [tui, confirm, dialog, constructor]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: [confirm_model_go_tui]
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/new_confirm.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
model := NewConfirm("Deseas continuar?")
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Dialogo binario si/no. El resultado se obtiene del modelo tras la interaccion del usuario en el loop de Bubble Tea.
|
||||
@@ -0,0 +1,9 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// NewFilteredList crea un modelo de lista con filtrado por texto.
|
||||
func NewFilteredList(items []ListItem, placeholder string) FilteredListModel {
|
||||
// stub — implementation in devfactory/tui
|
||||
return FilteredListModel{}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
name: new_filtered_list
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func NewFilteredList(items []ListItem, placeholder string) FilteredListModel"
|
||||
description: "Construye un modelo de lista con campo de busqueda integrado. El placeholder se muestra en el input de filtro cuando esta vacio."
|
||||
tags: [tui, list, filter, constructor]
|
||||
uses_functions: []
|
||||
uses_types: [list_item_go_tui]
|
||||
returns: [filtered_list_model_go_tui]
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/new_filtered_list.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
items := []ListItem{
|
||||
{Title: "main.go", Description: "Punto de entrada"},
|
||||
{Title: "server.go", Description: "Servidor HTTP"},
|
||||
}
|
||||
model := NewFilteredList(items, "Buscar archivo...")
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Incluye un input de texto que filtra los items en tiempo real por coincidencia parcial.
|
||||
@@ -0,0 +1,9 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// NewList crea un modelo de lista simple a partir de items.
|
||||
func NewList(items []ListItem) ListModel {
|
||||
// stub — implementation in devfactory/tui
|
||||
return ListModel{}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
name: new_list
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func NewList(items []ListItem) ListModel"
|
||||
description: "Construye un modelo de lista simple a partir de una coleccion de items. Cada item se renderiza como una fila seleccionable."
|
||||
tags: [tui, list, constructor]
|
||||
uses_functions: []
|
||||
uses_types: [list_item_go_tui]
|
||||
returns: [list_model_go_tui]
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/new_list.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
items := []ListItem{
|
||||
{Title: "Opcion 1", Description: "Primera opcion"},
|
||||
{Title: "Opcion 2", Description: "Segunda opcion"},
|
||||
}
|
||||
model := NewList(items)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Constructor puro para listas de seleccion simple. No permite seleccion multiple — usar NewMultiList para eso.
|
||||
@@ -0,0 +1,9 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// NewMultiList crea un modelo de lista con seleccion multiple.
|
||||
func NewMultiList(items []ListItem) ListModel {
|
||||
// stub — implementation in devfactory/tui
|
||||
return ListModel{}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
name: new_multi_list
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func NewMultiList(items []ListItem) ListModel"
|
||||
description: "Construye un modelo de lista con seleccion multiple. Permite al usuario marcar varios items antes de confirmar."
|
||||
tags: [tui, list, multi, constructor]
|
||||
uses_functions: []
|
||||
uses_types: [list_item_go_tui]
|
||||
returns: [list_model_go_tui]
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/new_multi_list.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
items := []ListItem{
|
||||
{Title: "Go", Description: "Lenguaje compilado"},
|
||||
{Title: "Python", Description: "Lenguaje interpretado"},
|
||||
{Title: "Rust", Description: "Lenguaje de sistemas"},
|
||||
}
|
||||
model := NewMultiList(items)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Variante de lista que habilita seleccion multiple con toggles por item.
|
||||
@@ -0,0 +1,9 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// NewMultiProgress crea un modelo de progreso multiple sin barras iniciales.
|
||||
func NewMultiProgress() MultiProgressModel {
|
||||
// stub — implementation in devfactory/tui
|
||||
return MultiProgressModel{}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
name: new_multi_progress
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func NewMultiProgress() MultiProgressModel"
|
||||
description: "Construye un modelo de progreso multiple vacio. Las barras individuales se agregan posteriormente via mensajes."
|
||||
tags: [tui, progress, multi, constructor]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: [multi_progress_model_go_tui]
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/new_multi_progress.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
model := NewMultiProgress()
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Inicia sin barras. Cada barra se agrega dinamicamente via el loop de Bubble Tea, ideal para descargas paralelas o tareas concurrentes.
|
||||
@@ -0,0 +1,9 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// NewProgress crea un modelo de barra de progreso.
|
||||
func NewProgress(total float64, label string) ProgressModel {
|
||||
// stub — implementation in devfactory/tui
|
||||
return ProgressModel{}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
name: new_progress
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func NewProgress(total float64, label string) ProgressModel"
|
||||
description: "Construye un modelo de barra de progreso con valor total y etiqueta descriptiva."
|
||||
tags: [tui, progress, constructor]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: [progress_model_go_tui]
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/new_progress.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
model := NewProgress(100.0, "Descargando archivos")
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
El progreso inicia en 0. El avance se actualiza via mensajes en el loop de Bubble Tea.
|
||||
@@ -0,0 +1,9 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// NewProgressWithStyles crea un modelo de barra de progreso con estilos personalizados.
|
||||
func NewProgressWithStyles(total float64, label string, styles Styles) ProgressModel {
|
||||
// stub — implementation in devfactory/tui
|
||||
return ProgressModel{}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: new_progress_with_styles
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func NewProgressWithStyles(total float64, label string, styles Styles) ProgressModel"
|
||||
description: "Construye un modelo de barra de progreso con valor total, etiqueta y estilos visuales personalizados."
|
||||
tags: [tui, progress, styles, constructor]
|
||||
uses_functions: []
|
||||
uses_types: [styles_go_tui]
|
||||
returns: [progress_model_go_tui]
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/new_progress_with_styles.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
styles := DarkStyles()
|
||||
model := NewProgressWithStyles(50.0, "Indexando", styles)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Variante de NewProgress que permite personalizar la apariencia de la barra mediante Styles.
|
||||
@@ -0,0 +1,9 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// NewSpinner crea un modelo de spinner con un mensaje.
|
||||
func NewSpinner(message string) SpinnerModel {
|
||||
// stub — implementation in devfactory/tui
|
||||
return SpinnerModel{}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
name: new_spinner
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func NewSpinner(message string) SpinnerModel"
|
||||
description: "Construye un modelo de spinner basico con un mensaje descriptivo. Usa el estilo por defecto."
|
||||
tags: [tui, spinner, constructor]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: [spinner_model_go_tui]
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/new_spinner.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
model := NewSpinner("Cargando datos...")
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Spinner con estilos por defecto. Para personalizar apariencia, usar NewSpinnerWithStyle.
|
||||
@@ -0,0 +1,9 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// NewSpinnerWithStyle crea un modelo de spinner con estilos personalizados.
|
||||
func NewSpinnerWithStyle(message string, styles Styles) SpinnerModel {
|
||||
// stub — implementation in devfactory/tui
|
||||
return SpinnerModel{}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
---
|
||||
name: new_spinner_with_style
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func NewSpinnerWithStyle(message string, styles Styles) SpinnerModel"
|
||||
description: "Construye un modelo de spinner con mensaje y estilos visuales personalizados."
|
||||
tags: [tui, spinner, styles, constructor]
|
||||
uses_functions: []
|
||||
uses_types: [styles_go_tui]
|
||||
returns: [spinner_model_go_tui]
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/new_spinner_with_style.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
theme := DarkTheme()
|
||||
styles := NewStyles(theme)
|
||||
model := NewSpinnerWithStyle("Procesando...", styles)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Permite controlar colores y bordes del spinner mediante el sistema de estilos del registry.
|
||||
@@ -0,0 +1,11 @@
|
||||
package tui
|
||||
|
||||
import "time"
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// NewSpinnerWithTimeout crea un modelo de spinner que se cancela tras un timeout.
|
||||
func NewSpinnerWithTimeout(message string, timeout time.Duration) SpinnerWithTimeoutModel {
|
||||
// stub — implementation in devfactory/tui
|
||||
return SpinnerWithTimeoutModel{}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
name: new_spinner_with_timeout
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func NewSpinnerWithTimeout(message string, timeout time.Duration) SpinnerWithTimeoutModel"
|
||||
description: "Construye un modelo de spinner con limite de tiempo. Si la operacion excede el timeout, el spinner se detiene automaticamente."
|
||||
tags: [tui, spinner, timeout, constructor]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: [spinner_with_timeout_model_go_tui]
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: [time]
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/new_spinner_with_timeout.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
model := NewSpinnerWithTimeout("Esperando respuesta...", 30*time.Second)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
El timeout es configuracion pura — el side effect de cancelar ocurre en el runtime de Bubble Tea, no en el constructor.
|
||||
@@ -0,0 +1,9 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// NewStyles crea estilos a partir de un tema.
|
||||
func NewStyles(theme Theme) Styles {
|
||||
// stub — implementation in devfactory/tui
|
||||
return Styles{}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: new_styles
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func NewStyles(theme Theme) Styles"
|
||||
description: "Construye un conjunto de estilos lipgloss a partir de un tema de colores. Los estilos resultantes se aplican a todos los componentes TUI."
|
||||
tags: [tui, styles, constructor]
|
||||
uses_functions: []
|
||||
uses_types: [theme_go_tui]
|
||||
returns: [styles_go_tui]
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/new_styles.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
theme := DefaultTheme()
|
||||
styles := NewStyles(theme)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Convierte un Theme (paleta de colores) en Styles (estilos lipgloss aplicables). Es el puente entre la configuracion de colores y el renderizado.
|
||||
@@ -0,0 +1,8 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// PrintError imprime un mensaje con estilo de error (rojo) en stderr.
|
||||
func PrintError(msg string) {
|
||||
// stub — implementation in devfactory/tui
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
name: print_error
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "func PrintError(msg string)"
|
||||
description: "Imprime un mensaje con estilo de error (rojo) en stderr."
|
||||
tags: [tui, print, error, output]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/print_error.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
tui.PrintError("No se pudo conectar al servidor")
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Implementacion real en github.com/lucasdataproyects/devfactory/tui. Este stub existe para documentar la firma y mantener el registry.
|
||||
@@ -0,0 +1,8 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// PrintInfo imprime un mensaje con estilo informativo (cyan) en stdout.
|
||||
func PrintInfo(msg string) {
|
||||
// stub — implementation in devfactory/tui
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
name: print_info
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "func PrintInfo(msg string)"
|
||||
description: "Imprime un mensaje con estilo informativo (cyan) en stdout."
|
||||
tags: [tui, print, info, output]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/print_info.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
tui.PrintInfo("Procesando 42 archivos...")
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Implementacion real en github.com/lucasdataproyects/devfactory/tui. Este stub existe para documentar la firma y mantener el registry.
|
||||
@@ -0,0 +1,8 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// PrintMuted imprime un mensaje con estilo atenuado (gris) en stdout.
|
||||
func PrintMuted(msg string) {
|
||||
// stub — implementation in devfactory/tui
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
name: print_muted
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "func PrintMuted(msg string)"
|
||||
description: "Imprime un mensaje con estilo atenuado (gris) en stdout."
|
||||
tags: [tui, print, muted, output]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/print_muted.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
tui.PrintMuted("Ultima actualizacion: hace 5 minutos")
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Implementacion real en github.com/lucasdataproyects/devfactory/tui. Este stub existe para documentar la firma y mantener el registry.
|
||||
@@ -0,0 +1,8 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// PrintSuccess imprime un mensaje con estilo de exito (verde) en stdout.
|
||||
func PrintSuccess(msg string) {
|
||||
// stub — implementation in devfactory/tui
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
name: print_success
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "func PrintSuccess(msg string)"
|
||||
description: "Imprime un mensaje con estilo de exito (verde) en stdout."
|
||||
tags: [tui, print, success, output]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/print_success.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
tui.PrintSuccess("Operacion completada correctamente")
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Implementacion real en github.com/lucasdataproyects/devfactory/tui. Este stub existe para documentar la firma y mantener el registry.
|
||||
@@ -0,0 +1,8 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// PrintWarning imprime un mensaje con estilo de advertencia (naranja) en stdout.
|
||||
func PrintWarning(msg string) {
|
||||
// stub — implementation in devfactory/tui
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
name: print_warning
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "func PrintWarning(msg string)"
|
||||
description: "Imprime un mensaje con estilo de advertencia (naranja) en stdout."
|
||||
tags: [tui, print, warning, output]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/print_warning.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
tui.PrintWarning("El archivo sera sobreescrito")
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Implementacion real en github.com/lucasdataproyects/devfactory/tui. Este stub existe para documentar la firma y mantener el registry.
|
||||
@@ -0,0 +1,10 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
import tea "github.com/charmbracelet/bubbletea"
|
||||
|
||||
// Quit devuelve un mensaje de salida para el bucle de Bubble Tea.
|
||||
func Quit() tea.Msg {
|
||||
return tea.QuitMsg{}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: quit_msg
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func Quit() tea.Msg"
|
||||
description: "Devuelve un mensaje de salida para el bucle de Bubble Tea."
|
||||
tags: [tui, quit, message, bubbletea]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: [github.com/charmbracelet/bubbletea]
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/quit_msg.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
msg := Quit()
|
||||
// msg es tea.QuitMsg{}, usado para terminar el event loop de Bubble Tea
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Wrapper puro sobre tea.QuitMsg{}. Util para componer en pipelines o pasar como callback sin exponer el tipo directamente.
|
||||
@@ -0,0 +1,12 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
import "github.com/charmbracelet/bubbletea"
|
||||
|
||||
// RunFullscreen ejecuta un modelo Bubble Tea en modo fullscreen.
|
||||
func RunFullscreen[T tea.Model](model T) Result[T] {
|
||||
// stub — implementation in devfactory/tui
|
||||
var zero T
|
||||
return Result[T]{Value: zero}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
name: run_fullscreen
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "func RunFullscreen[T tea.Model](model T) core.Result[T]"
|
||||
description: "Ejecuta un modelo Bubble Tea en modo fullscreen."
|
||||
tags: [tui, runner, fullscreen, bubbletea, generic]
|
||||
uses_functions: []
|
||||
uses_types: [result_go_core]
|
||||
returns: [result_go_core]
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: [github.com/charmbracelet/bubbletea]
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/run_fullscreen.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
result := tui.RunFullscreen(myModel)
|
||||
if result.IsErr() {
|
||||
log.Fatal(result.Error())
|
||||
}
|
||||
finalModel := result.Unwrap()
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Implementacion real en github.com/lucasdataproyects/devfactory/tui. Este stub existe para documentar la firma y mantener el registry.
|
||||
@@ -0,0 +1,12 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
import "github.com/charmbracelet/bubbletea"
|
||||
|
||||
// RunModel ejecuta un modelo Bubble Tea y devuelve el modelo final o error.
|
||||
func RunModel[T tea.Model](model T) Result[T] {
|
||||
// stub — implementation in devfactory/tui
|
||||
var zero T
|
||||
return Result[T]{Value: zero}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
name: run_model
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "func RunModel[T tea.Model](model T) core.Result[T]"
|
||||
description: "Ejecuta un modelo Bubble Tea y devuelve el modelo final o error."
|
||||
tags: [tui, runner, bubbletea, generic]
|
||||
uses_functions: []
|
||||
uses_types: [result_go_core]
|
||||
returns: [result_go_core]
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: [github.com/charmbracelet/bubbletea]
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/run_model.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
result := tui.RunModel(myModel)
|
||||
if result.IsErr() {
|
||||
log.Fatal(result.Error())
|
||||
}
|
||||
finalModel := result.Unwrap()
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Implementacion real en github.com/lucasdataproyects/devfactory/tui. Este stub existe para documentar la firma y mantener el registry.
|
||||
@@ -0,0 +1,12 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
import "github.com/charmbracelet/bubbletea"
|
||||
|
||||
// RunWithMouseSupport ejecuta un modelo Bubble Tea con soporte de raton habilitado.
|
||||
func RunWithMouseSupport[T tea.Model](model T) Result[T] {
|
||||
// stub — implementation in devfactory/tui
|
||||
var zero T
|
||||
return Result[T]{Value: zero}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
name: run_with_mouse
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "func RunWithMouseSupport[T tea.Model](model T) core.Result[T]"
|
||||
description: "Ejecuta un modelo Bubble Tea con soporte de raton habilitado."
|
||||
tags: [tui, runner, mouse, bubbletea, generic]
|
||||
uses_functions: []
|
||||
uses_types: [result_go_core]
|
||||
returns: [result_go_core]
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: [github.com/charmbracelet/bubbletea]
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/run_with_mouse.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
result := tui.RunWithMouseSupport(myModel)
|
||||
if result.IsErr() {
|
||||
log.Fatal(result.Error())
|
||||
}
|
||||
finalModel := result.Unwrap()
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Implementacion real en github.com/lucasdataproyects/devfactory/tui. Este stub existe para documentar la firma y mantener el registry.
|
||||
@@ -0,0 +1,8 @@
|
||||
package tui
|
||||
|
||||
// Implementation: github.com/lucasdataproyects/devfactory/tui
|
||||
|
||||
// ShowCursor devuelve el codigo de escape ANSI para mostrar el cursor del terminal.
|
||||
func ShowCursor() string {
|
||||
return "\033[?25h"
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: show_cursor
|
||||
kind: function
|
||||
lang: go
|
||||
domain: tui
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func ShowCursor() string"
|
||||
description: "Devuelve el codigo de escape ANSI para mostrar el cursor del terminal."
|
||||
tags: [tui, ansi, terminal, cursor]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/tui/show_cursor.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
fmt.Print(ShowCursor())
|
||||
// Restaura la visibilidad del cursor del terminal
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Usa la secuencia DECTCEM (ESC[?25h) del estandar VT220. Complemento de HideCursor. Llamar siempre al finalizar la aplicacion para restaurar el estado del terminal.
|
||||
Reference in New Issue
Block a user