Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

rtxui

/rtxui

Buduje i sprawdza interfejsy terminalowe w C++ w bibliotece RTXUI, gdzie komponenty są szablonami HTML i CSS zapisanymi w napisie.

Repozytorium
RTXUI ↗
Licencja
MIT
Ostatnia zmiana repozytorium
22.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
1
Przestarzałość

Brak sygnałów. Repozytorium zmienione 22.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Buduje i sprawdza interfejsy terminalowe w C++ w bibliotece RTXUI, gdzie komponenty są szablonami HTML i CSS zapisanymi w napisie.

Oryginalny opis (EN)

Build and check terminal user interfaces with RTXUI, the C++ library whose components are HTML templates and CSS in a string member. Use when code includes <rtxui/rtxui.hpp>, when writing or fixing an RTXUI component, or when asked for a C++ TUI with RTXUI.

Jak działa

  1. A component
  2. Rules
  3. Check the result
Sekcje z nagłówków SKILL.md, w oryginale · 166 linii, 999 słów
Podgląd SKILL.md
---
name: rtxui
description: Build and check terminal user interfaces with RTXUI, the C++ library whose components are HTML templates and CSS in a string member. Use when code includes <rtxui/rtxui.hpp>, when writing or fixing an RTXUI component, or when asked for a C++ TUI with RTXUI.
---

# RTXUI

RTXUI templates look like HTML and Vue, and its styles like browser CSS, but
it implements its own subset. Write only the constructs below, then check the
result headlessly before saying it works.

## A component

```cpp
#include <rtxui/rtxui.hpp>

using namespace rtxui;

class Counter : public Component<Counter> {
 public:
  int count = 0;
  std::vector<std::string> items = {"a", "b"};

  int Doubled() const { return count * 2; }  // Computed: bind a const method.
  void Increment() { count++; }              // Handler: bind a method.
  void Remove(std::string index) { items.erase(items.begin() + std::stoi(index)); }

  Counter() {
    Bind(count);
    Bind(items);
    Bind(Doubled);
    Bind(Increment);
    Bind(Remove);
  }

  std::string_view view = R"html(
    <div class="card">
      <span>{count} doubled is {Doubled}</span>
      <button onclick="Increment">+1</button>
      <for each="{items}" as="item">
        <div onclick="Remove({$index})">{item}</div>
      </for>
    </div>
    <style>
      .card {
        border: rounded;
        padding: 1;
      }
    </style>
  )html";
};

int main() {
  auto app = Ref<Counter>::New();
  Screen screen(app);
  screen.Loop();
}
```

Link the CMake target `rtxui` and include only `<rtxui/rtxui.hpp>`.

## Rules

- `{name}` interpolates a bound member or const method. There are no
  expressions: no `{a + b}`, `{x == 1}`, `{ok ? "y" : "n"}`. Compute the value
  in a const method and bind it.
- Every name a template uses must be passed to `Bind(...)`. `Bind` takes a
  member name only; `Bind("Name", lambda)` does not exist.
- Conditions: `if="{flag}"` on any element, or `<if condition="{flag}">` with
  `<elif condition="...">` and `<else>`. True means the value prints as `true`
  or `1`. Never `v-if`, `:if` or `*ngIf`.
- Loops: `<for each="{list}" as="item">` with `{item}` and `{$index}`. Never
  `v-for` or `for="x in xs"`. When items move or disappear, give the loop a
  key, `<for each="{tasks}" as="task" key="{task.id}">`, so each item keeps
  its own element: its focus, its running animation.
- A loop over structs reads the fields a `Fields()` function gives, declared
  next to the struct and before the component:
  `void Fields(const Task& t, rtxui::FieldSink& out) { out("id", t.id); }`,
  then `Bind(tasks)` and `{task.id}`.
- Handlers: `onclick="Method"` or `onclick="Method(arg)"`, one string argument;
  `oncontextmenu` for the right click. No `@click`, braces, statements or
  camelCase (`onClick`). Use `class`, not `className`.
- Attributes bind like text: `title="{name}"`, never `:title="name"`.
- Slots: a component declares `<slot name="header">fallback</slot>` (and an
  unnamed `<slot>`); its user writes `<h1 slot="header">` or
  `<template slot="header">several nodes</template>`.
- Two-way binding: `<input value="{text}"/>`, `<textarea value="{text}"/>`,
  `<checkbox checked="{done}">Label</checkbox>`,
  `<radio name="group" checked="{picked}">Label</radio>`,
  `<select value="{choice}">`. Checkboxes and radios are their own tags, not
  `<input type="...">`.
- Built-in tags need no import. A custom component used in a template must be
  imported in the parent constructor: `Import<Header>();`, then `<Header/>`.
- Define the template as a `view` member or a `std::string_view Setup()`
  method (no `override`), never both.
- Put `<style>` at the top level of the view, next to the root element; a
  nested `<style>` is ignored.
- Styles are scoped to their component, selectors and `@keyframes` included:
  a rule only matches elements its own template wrote, and `.dark .title` in a
  child never sees a `.dark` set by its parent. Pass context down as a custom
  property (`--accent`, which inherits) or as a prop.
- Use only built-in tags (`div`, `span`, `p`, `h1`-`h6`, `button`, `a`,
  `input`, `textarea`, `checkbox`, `radio`, `select`, `ul`/`ol`/`li`, `table`,
  `dialog`, `tabs`, `toast`, `tree-item`, ...) and imported components. There
  is no `<View>`, `<Text>` or `<Box>`. A notification is
  `<toast open="{saved}" duration="3000">Saved</toast>`: it slides in, and
  `saved` falls back to false once it closes.
- CSS lengths are terminal cells (`width: 20`), `%`, or `vh`/`vw` (shares
  of the terminal); there is no `px`, `em` or `rem`. `font-size` and `font-family`
  do not exist; use `font-weight`, `font-style`, `text-decoration`, colors and
  `border` (`solid`, `rounded`, `double`, `tall`, ...).
- Motion: `transition: width 200ms ease-out 100ms` (property, duration, then
  optional timing function and delay), or `@keyframes slide { from { ... } }`
  with `animation: slide 300ms ease-in forwards`. Colors, `opacity`, `width`,
  `height`, `top`/`right`/`bottom`/`left`, `translate` and `flex-grow` animate.
  `translate: 0 -1` moves a box without moving anything around it, and its
  percentages are of the box's own size: `translate: calc(100% + 2)` puts it
  just out of sight. There is no `transform`. `onanimationend="Method"` runs
  once an animation finishes, for instance to remove an item that slid out.
- An app draws below the shell's lines, as `apt install` does, as tall as
  its content. For one that takes the whole terminal, as an editor does, call
  `screen.SetInline(false);` before `screen.Loop()`. `screen.Print("text")` or
  `screen.Print(rtxui::Ref<Line>::New(...))` writes lines above it that stay
  in the terminal's history; the last frame drawn stays once `Loop()` returns.
- Only the UI thread may change component state. From a worker thread, hand
  the result back with `rtxui::PostTask([...] { ... });`, which is safe to
  call from any thread.

When unsure whether a property, tag or attribute exists, check the references
rather than guessing: https://arthursonzogni.github.io/RTXUI/llms-full.txt
(the whole manual as Markdown), or `docs/css_reference.md` and
`docs/html_reference.md` in the RTXUI repository.

## Check the result

Never claim an interface works from reading the code. Build it, then run it
headless. `RTXUI_STRICT=1` aborts on anything RTXUI would silently ignore (an
unknown CSS property, an unbound name, another framework's syntax) and prints
why; `RTXUI_HEADLESS=<width>x<height>` prints the screen as text instead of
taking over the terminal:

```bash
RTXUI_STRICT=1 RTXUI_HEADLESS=80x24 ./my_app < /dev/null
```

Drive it by piping terminal input. The screen printed is the one after all of
it is handled:

```bash
printf '\t\t\r' | RTXUI_STRICT=1 RTXUI_HEADLESS=80x24 ./my_app
```

| Input | Bytes |
|---|---|
| Typed text | the text |
| Tab, Shift+Tab, Enter, Backspace | `\t`, `\x1b[Z`, `\r`, `\x7f` |
| Up, Down, Right, Left | `\x1b[A`, `\x1b[B`, `\x1b[C`, `\x1b[D` |
| Click column x, row y (1-based) | `\x1b[<0;x;yM\x1b[<0;x;ym` |

Read the printed screen and compare it with what was asked. In C++ tests,
`rtxui::HeadlessScreen screen(app, 80, 24);` offers `Input(bytes)`,
`Click(x, y)` (0-based), `Resize(w, h)` and `Text()`.

Headless runs wait for animations to end. To check what happens over time (an
animation, a transition, a `PostDelayedTask` timer), use
`rtxui::TimelineScreen screen(app, 80, 24);`: time moves only when told,
`Advance(ms)` returns the frame drawn at that moment, `Record(ms)` every
distinct frame, and `BackgroundAt(x, y)` a cell's color, which text cannot
show.

Wersje

W bazie nie ma innych skilli o nazwie rtxui.

Migawka bazy z 13.11.2026 · wersja paczki 7597a18c483c (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 96html-css-js
    Wspiera tworzenie stron w HTML, CSS i JavaScript: układy responsywne, animacje CSS i interakcje w czystym JS.
  • 100bubbletea
    Buduje interfejsy terminalowe w Go na Bubbletea, z układami dwupanelowymi, obsługą myszy i stylami Lipgloss.
  • 100building-streamlit-custom-components-v2
    Buduje dwukierunkowe komponenty Streamlit Custom Components v2 przez st.components.v2.component: komponenty inline w HTML, CSS i JS lub pakiety z asset_dir, callbacki stanu, motywy przez zmienne --st-* i bundling Vite.
  • 100ink-tui
    Buduje interfejsy terminalowe w Ink i @inkjs/ui jako kreatory wieloetapowe, z obsługą stanu sesji, układu i różnych terminali.
  • 86build-tui
    Buduje i naprawia interaktywne interfejsy terminalowe w Ink, React lub Node, także przy zdublowanych treściach i błędach po zmianie rozmiaru.
  • 100pi-tui-design
    Tworzy dopracowane komponenty interfejsu terminalowego dla pi na bazie pi-tui: nakładki, okna dialogowe, dashboardy, widżety, wizualizacje danych i animowane elementy.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.