Changelog

for the component gventino/cydui v1.0.0
# Changelog

Versions are tagged per iteration. The API has been frozen since 0.4.0 (see `docs/11-api.md`); every change is listed under "API changes".

## 1.0.0

The release. The code is the one of 1.0.0-rc.2 (nothing in `src/`, `include/` or the backends changed), and what 1.0.0 adds is a promise: **the public API of `docs/11-api.md` is stable**, and from here it changes only by additions (a new minor version) or by a new major version. The first real application, `cyd-todo`, was written on it, proved it on the board (its 37 scenes and the library's own 42 gallery hashes are the PC's, bit for bit) and sent back the findings that 1.0.0-rc.2 resolved.

Also in this release, no change to the library: `tools/new-project.sh <dir>` makes a ready ESP-IDF project for the CYD pointing at this copy of the library (`templates/cyd-starter`: a label, a button, the calibration at the first start; `ci.sh` builds it), `tools/doctor.sh` says what a computer is missing and how to get it, `tools/publish-registry.sh` publishes to the ESP Component Registry, `docs/13-troubleshooting.md` is a table of symptoms and the option that fixes each, `tools/env.sh` no longer needs the uv Python of the author, the manifest carries its links, tags and a file exclude list, and the README starts with what the library is for and the five-minute way to a button on a board.

## 1.0.0-rc.2 — the findings of the first real application

`cyd-todo` (a quest log and calendar on the CYD, with a server and a phone) found what the library made hard. Everything here is an **addition**: no function, enumerator, flag bit or documented behavior changed, `sizeof(cydui_cmd)` is still 48, and every existing picture (the goldens and the gallery hashes) is byte-identical.

### Added
- `cydui_ui_stats_get`, `cydui_ui_stats_reset` and `cydui_ui_stats`: the peaks of commands, text bytes, tweens and widgets in any frame, the state entries in use and the configured sizes. `CYDUI_ERR_STATE_FULL` (bit 2048): a state entry that was still in use had to be replaced, or none could be made (not raised for a table of no entries or for a tween that finds no room).
- `cydui_theme.user`, a `const void *` for the application's own data that painters find as `theme->user`.
- `cydui_text_fit` (the bytes of the longest start of a text that fits a width as drawn) and `cydui_text_ellipsize` (the same with an ellipsis, into a buffer that is never overrun).
- `cydui_style.font_small` and `font_title` (optional, NULL = the body font), `cydui_font_role` and `cydui_theme_font`; `cydui_next_font`, `cydui_next_color` and `cydui_next_alpha`, one-shot modifiers honoured by `cydui_label` and `cydui_label_wrapped`.
- `CYDUI_BITMAP_A1` and `cydui_draw_bitmap_a1`: one bit per pixel, tinted, every bit a `scale` x `scale` square (1 to 8); `cydui_cmd.u.bitmap.scale`. A QR code of 33 modules is 165 bytes of mask instead of 13.4 KB. The rasterizer, the plain reference rasterizer, `cydui_bitmap_size` and `fuzz_cmds` know it; it is pixel for pixel the A4 mask of the drawn size.
- Guide section 9 (patterns from a real application), with code that is compiled with `-std=c99 -pedantic -Wall -Wextra -Werror` and the sanitizers.
- Tests: `test_ui_stats`, `test_text_fit`, `test_ui_label_mods`, `test_bitmap_a1`, and a test for `theme.user` in `test_theme`.

### API changes (all additions; see `docs/11-api.md`)
`cydui_style` grew at its end (`font_small`, `font_title`), `cydui_theme` grew at its end (`user`), `cydui_cmd.u.bitmap` got `scale` in what was padding, and enumerators were appended (`CYDUI_BITMAP_A1`, `CYDUI_FONT_*`, `CYDUI_ERR_STATE_FULL`). An application that builds its themes with `cydui_theme_default` (or zero-initialises them) needs no change.

### Documented
Findings that needed words and not code: a bitmap redrawn into the same buffer needs `cydui_invalidate`; the two-rectangle painter idiom; the root margin is `style.spacing`; a wide but short target is one `cydui_interact` over the grid; wrapping `poll_event` to learn about touches; animating once per occurrence with an id salted by a counter; what the return value of `cydui_ui_end` means for a sleeping loop. The header comments of `cydui_draw_bitmap` and `cydui_set_spacing` say so too.

## 1.0.0-rc.1 — iteration 8: hardening and the release candidate

The API is the one of 0.7.0; this release is checks, fuzzing, documentation and the pre-release number.

### Added
- `docs/12-guide.md`, a practical guide (memory budget, writing a theme, a painter, a post-effect, a widget and a backend, animation, text fields); `SECURITY.md`, `CONTRIBUTING.md`; "Security and limits" in the README.
- `tools/check_docs.py` (every public function has a documentation comment: 133 of 133).
- `tests/test_raster_equiv.c` and `tests/ref_raster.c`: the rasterizer against its plain reference on 20 000 random strips and the corner cases of rounded rectangles in every run.
- Two libFuzzer harnesses: `fuzz_touch` (the touch filter for any readings and configuration, the calibration fit, a stored blob, the latency ring) and `fuzz_anim` (the easings and the interpolation), with seeds; the three that existed run longer in the local script.
- `docs/05` has a review of the threat model against the code (what the implementation does for each threat, with the test that shows it, and the findings), `docs/04` four new abuse cases (typed text from any source, a frame that costs too much, trusted plug-ins, a popup or focus nothing dismisses), `docs/06` the missing controls.

### Changed
- The version is 1.0.0-rc.1 (`CYDUI_VERSION_MAJOR/MINOR/PATCH` 1.0.0 and the string with the suffix); `idf_component.yml` was left at 0.5.0 and now follows it.
- The comment of `backend.h` about `now_ms` said that animation was not used yet.
- Measured: the tests cover 97.5 % of the 3690 lines of `src/` and `themes/` (NFR-23 asks 80 %); no log of the library prints user text (CT-20).
- Every text the user can see is in English: the gallery, the examples, the calibration screen of the ESP32 backend, the tests and the goldens, and the pictures of the README. Accented letters remain only as UTF-8 test data (Café, naïve, Zoë, Ångström, €). The board self-test types "Hi 1".

### Not verified on the hardware (unchanged since 0.6.0 and 0.7.0)
Typing with real fingers on the keyboard of the screen, how the glow, the scanlines and the glitch of `cyberpunk` look on the real panel, the 80 MHz clock by eye, rotation 180, the touch with a bare finger, a disconnected touch controller (NFR-60).

## 0.7.0 — iteration 7: a faster renderer, animation, post-effects and the `retro` and `cyberpunk` themes

### Added
- `cydui_animate` and the easing curves (`anim.h`), `cydui_now`, `cydui_theme_age`; `CYDUI_MAX_TWEENS`, `CYDUI_ANIM_MAX_MS`, `CYDUI_ERR_TWEEN_LIMIT`. Buttons, check boxes, switches, tabs and the dimming of a popup change their look over `cydui_style.anim_ms` (0 for every theme before).
- `cydui_post_effect` and `cydui_set_post_effect`: a hook per strip, with a key that takes part in the dirty regions; `cydui_theme.post`; `cydui_set_effects_level` (`CYDUI_FX_*`).
- `cydui_paint_look` and `cydui_paint_amount` for painters that want to take part in the transitions.
- The themes `retro` (silver, 3D edges, `cydui_mono_16`, a 1-bit monospaced font made from Liberation Mono: `fontgen.py --hinting mono`) and `cyberpunk` (neon, glow, scanlines, a glitch, an entrance sweep). The gallery has five themes (a tab bar instead of three buttons) and 30 hashes on the PC and on the board, plus 12 more at the times of the effects of cyberpunk; `--at MS` for the headless run.

### Changed
- The rasterizer is 3 to 10 times faster on the board and the output is the same, pixel by pixel (rounded rectangles by runs, spans filled by words, lines near the segment only, a glyph skips its empty bytes): a full frame draws in 11.5 ms instead of 26.
- The shadow of a card or a popup is four layers of alpha 16, not eight of alpha 8: the old one turned green over a dark or dimmed page (a test pins the new one). The goldens `clean_panel`, `clean_card` and `clean_popup` changed.
- `cydui_ui_init` clears the state table it is given. A theme set again with the same pointer is not a new entrance.

### API changes
- `cydui_style` (+2 bytes), `cydui_paint_info` and `cydui_theme` (+1 pointer) grew at their end; `cydui_ui` and `cydui_ctx` are bigger. `CYDUI_ERR_TWEEN_LIMIT` is a new bit.
- `cydui_ui_end` also returns true while a tween moves.
- `tools/gen_fonts.sh` makes one more font (`fonts/cydui_mono_16`); a theme that uses many widgets with a duration needs a state table that holds one more entry for each of them (a tween never replaces other state: with none free the value is the target at once).
- Not done: a pixel font with the check mark, a theme with entrance animations per widget (the entrance of cyberpunk is the sweep of the whole screen), a Kconfig default for the level of effects.

## 0.6.0 — iteration 6: text fields, popups and the keyboard on the screen

### Added
- `cydui_text_input` (one line, `CYDUI_TEXT_PASSWORD`) and `cydui_text_area` (several lines that wrap), `cydui_focus_set/_clear`, `cydui_has_focus`; `CYDUI_TEXT_CHANGED` / `CYDUI_TEXT_CONFIRMED`.
- `cydui_textedit_*` (`cydui/textedit.h`): the editing of a UTF-8 string in a buffer, with no UI.
- `cydui_popup_begin/_end` and `CYDUI_POPUP_MODAL`: a panel above everything that takes the touch while it is shown.
- The keyboard on the screen (letters, numbers, symbols, Latin-1 accents), shown by the library while a field has the focus; `cydui_keyboard_top`, `cydui_keyboard_enable`. A field inside a scroll area is scrolled to stay above it.
- `CYDUI_EVENT_CHAR`, `CYDUI_EVENT_KEY`, `cydui_key` and `cydui_event.key`; the SDL backend types with the keyboard of the computer; `CYDUI_KEY_QUEUE` (32).
- Theme kinds `CYDUI_WIDGET_TEXT_INPUT`, `CYDUI_WIDGET_POPUP`, `CYDUI_WIDGET_KEY`, filled by the default and both `clean` themes.
- The gallery has a page "Text" (18 hashes instead of 15 on the PC and on the board) and the board firmware a self-test that types on the keyboard of the screen.

### API changes
- `sizeof(cydui_event)` goes from 8 to 12 (the new field `key`); code that builds events with `{type, x, y}` still works.
- `cydui_theme` is bigger (three more kinds of widget, 360 bytes); `cydui_ui` too (a queue of keys and the state of the focus, the popup and the keyboard); the storage of an application that uses the keyboard needs about 120 more commands.
- The touch under a popup or under the keyboard does not reach the widgets there (`cydui_interact` returns nothing for them).
- Not done: Tab navigation and the BOOT button (FR-44 in part), long press for accents, the QR code / web page for typing from a phone (the applications).

## 0.5.0 — iteration 5: the ESP32 backend

### Added
- The ESP32 backend (`backends/esp32/`): SPI + DMA with two strip buffers, PWM backlight, XPT2046 on a task of its own with a filter, a 5-point calibration kept in NVS, Kconfig for controller, pins, clock and rotation, the task watchdog, timeouts and the touch-to-picture latency (`cydui_esp32_*`, see `cydui_esp32.h`; this is not part of the frozen core API).
- `examples/theme-gallery` runs on the board (Touch and Animation pages, a guided acceptance test), with the hash of every page printed to compare with the PC (15 of 15 equal), and measurements of speed, memory and idle CPU in `docs/09-hardware-notes.md`.
- `cydui_config.strip_buffers` (2 = two strip buffers used in turn, so a backend can send a strip while the next one is drawn; the contract is in `backend.h`), `cydui_config.dirty_mem` and `cydui_invalidate` (dirty regions: a strip whose commands did not change is neither drawn nor sent), `cydui_ui_config.frame_budget_ms` and `CYDUI_ERR_FRAME_BUDGET` (a frame that takes too long skips the widgets that are left).
- Version macros are no longer frozen by value in `tests/test_api_surface.c` (only that they exist).

## 0.4.0 — iteration 4: themes, composite widgets, scrolling; the API is frozen

### API changes
- `cydui_ui_config.style` is now `cydui_ui_config.theme` (a `const cydui_theme *`); `cydui_style` moved to `theme.h`, `CYDUI_CONFIG(storage, backend, &theme)`. `cydui_theme_default(&t, font)` builds the old dark look.
- `cydui_state` grew from 24 to 32 bytes (`c` and `d` are new); the storage arrays computed with `sizeof(cydui_state)` follow by themselves.
- The cursor and origin of containers are signed (they may be negative inside a scrolled area).
- Fields of `struct cydui_ui`, `cydui_region` and `cydui_input` are declared private.
- The public API is now frozen by `tests/test_api_surface.c`.

### Added
- Themes: `cydui_theme` (palette, table of looks per widget kind, state and selection, optional painters), `cydui_set_theme`, `cydui_theme_validate`, `cydui_paint`, `cydui_wstyle_of`, soft shadows; the `clean` and `clean_dark` themes in `themes/`.
- Widgets: `cydui_slider`, `cydui_progress`, `cydui_tabs`.
- Scrolling: `cydui_scroll_begin/end`, `cydui_scroll_to`, virtual lists (`cydui_list_begin`, `cydui_begin/end_list_item`, `cydui_list_end`), kinetic scrolling with a scroll bar painted by the theme.
- Layout: `cydui_set_cross_align`, `cydui_set_main_align`, cards (`cydui_begin_card`/`cydui_end_card`).
- Writing widgets: `cydui_widget_begin`, `cydui_label_len`, `cydui_draw_text_in`, `cydui_state_of`, `CYDUI_CAPTURE`, and the pointer position (`x`, `y`) in `cydui_response`; `examples/theme-gallery/rating.c` as the example.
- `CYDUI_VERSION_*` and `cydui_version()`.
- `examples/theme-gallery`: all widgets in each theme with a run-time switch, a list of 200 tasks, a custom widget.

### Tunable defaults (not frozen)
- `CYDUI_SCROLL_FLING_MIN` 50, `CYDUI_SCROLL_MIN_V` 10, `CYDUI_SCROLL_FRICTION_MS` 325, `CYDUI_SCROLL_MAX_V` 6000; the feel is tuned on the board in iteration 5.

### Fixed
- Layout positions were clamped to 0, so everything after the first child above the top of a scrolled area landed in the wrong place.
- The sanitizer builds let undefined behavior print and continue; it now stops the program.

## 0.3.0 and earlier
Iterations 0 to 3: see `docs/07-iterations.md`. They were not tagged.