Repository navigation
Releases
Releases · DEEIX-AI/cpui
CPUI 0.1.2
Visual caret movement in right-to-left text, CJK punctuation that follows the text around it, less copying per frame on Windows and Wayland, and fixes for windows that stayed hidden on Windows, crashes, quitting on macOS, non-Latin keyboard layouts and input methods.
Added
Frame::text_in,Frame::measure_inandFrame::advances_inlay out part of a text with its punctuation decided from all of it. (#43)
Changed
- Left and Right move the caret in visual order in right-to-left and mixed text, by character and by word, and reach every position. (#32, #38, #39)
- Text is shaped word by word from a cache, so long text measures faster, and kerning no longer applies across spaces. (#43)
- On Windows and Wayland, a frame now hands only the areas it changed to the system instead of the whole window, and in browsers each changed area is sent on its own. (#49)
Fixed
- On Windows, application windows no longer stay hidden at startup. (#18)
- Animations no longer crash on displays that report a 0 Hz refresh rate, as in virtual machines or over Remote Desktop. (#19)
- With a screen reader on, items that share a key no longer crash the application. (#20)
- On macOS, the Quit menu item, Command + Q and the Dock ask
App::close_requestedfor each window before quitting. (#21) - On Windows and X11, keys still held when a window gains focus no longer act in it. (#22)
- Shortcuts such as Ctrl + C work on Russian, Greek, Hebrew and other non-Latin keyboard layouts. (#24)
- On Windows and X11, the input method's candidate window stays at the text after a scale change, and on Windows after switching windows. (#26)
- Modal dialogs keep keyboard and assistive technology input inside the active dialog. (#29)
- Read-only text inputs no longer offer assistive technology a set-value action. (#37)
- On Linux, the dark appearance applies even when the desktop portal answers late, as at the first launch after login. (#23)
- On Windows, the title bar and the content follow appearance changes made at run time. (#25)
- On Windows, a minimized window with a running animation no longer keeps a processor core busy. (#34)
Frame::cell_charkeeps glyphs wider than their cells inside them, such as ambiguous-width symbols in CJK monospaced fonts. (#36)- Sliders reach their upper end when the step does not divide the range, and keep large integer values apart. (#31)
- Calendars leave cells before year 1 and after year 9999 blank. (#30)
- On the web, clicks land on the control under the pointer when the browser emulates a device. (#28)
- On Linux, file dialog results no longer reach another window after the one that opened the dialog closed. (#33)
- Punctuation such as
—and“ ”now takes the font of the CJK text around it, whether or not the line also has Latin letters. (#43) - Screen readers and other assistive tools can now set a number input to a number, not only to text. (#46)
CPUI 0.1.1
Faster long trees, selects and text inputs, input method text for editors that draw their own text, platform font sizes, and fixes.
Added
FontSystem::revision, which changes whenever the fonts change, for caches of measurements.- Canvases take text with
Canvas::ime: typing, pasting and input methods such as Pinyin, read withUi::ime_onand drawn withPainter::ime.Painter::ime_caretplaces the candidate window, so an editor that draws its own text needs no hidden text input.
Changed
- Trees build and draw only the rows near their visible part, so a tree of 100,000 items takes about 3 ms a frame instead of 690 ms.
- Open selects and comboboxes build only the options near view, and a select or combobox without a width measures its options only when they change, so a thousand options no longer cost several milliseconds a frame.
- Multiline inputs keep their wrapped lines between frames and wrap again only the paragraphs an edit changes, so a text of 100,000 lines takes about 1 ms a frame instead of 65 ms, and about 1.5 ms per keystroke instead of 200 ms.
- Frames that lay out more than about 500 lines of text, such as a long tree or an open select with many options, keep their shaped text between frames instead of shaping it again every frame.
- A field with an error frames its control in the danger color, border and focus ring, as well as showing the message: text inputs, selects, comboboxes and pickers.
Field::error_frame(false)keeps only the message. - Switches, checkboxes and radios respond to the pointer: their edge or track deepens on hover, and a held switch stretches its knob.
- An empty state sets its icon in a tile and its title in a larger, medium weight, with more room before its actions.
- The default font sizes follow the platform: 13, 11, 17 and 22 on macOS, as in its own interface, and 14, 12, 18 and 24 elsewhere as before. Control and row heights are unchanged.
with_font_sizesets one size on every platform. Theme::with_font_sizerounds the note, heading and title sizes to whole pixels, and keeps control and row heights for text smaller than 14 px instead of shrinking them. An application that sets text below 14 px gets the default control heights; setcontrol_heightandrow_heightto keep smaller ones.
Fixed
- A multiline input no longer wraps its text one character per line in its first frame, which took time and kept memory for every character.
- Screen readers announce tree items at their real level; each item was reported one level deeper.
- Text in tinted badges and alerts meets the 4.5:1 contrast of WCAG AA in every tone; success and warning text was below 3:1 in the light theme.
- Without fontconfig, as on Windows and Android, a font set by name uses its family's regular face. A family with one file per weight, such as MiSans, loaded its bold file, or its medium one when its weights are numbered unusually, so regular text rendered heavier.
CPUI 0.1.0
The first release.
Added
Framework
- Immediate mode. The interface is declared every frame, and a frame is rebuilt until it settles, so what is presented always matches the state.
- Efficient redraws. Nothing is drawn while idle, only changed regions are redrawn, large redraws use several threads, and a stable frame allocates no memory.
- Windows and applications. Window options, full screen, window icons, several windows per application, wake-ups from background threads, close confirmation and system file dialogs on macOS, Windows and Linux.
- Offscreen rendering for tests and screenshots through
Offscreen.
Layout
- Rows, columns and stacks whose children fit their content, fill the remaining space or take a fixed size, with minimum and maximum sizes and aspect ratios.
- Alignment along and across the main axis, including baselines and even spacing; per-child alignment, layout priority and offset; separate horizontal and vertical gaps.
- Wrapping flows, adaptive and fixed-column grids with spans, layouts chosen by available width, overlays, scrolling in either direction, virtual lists and resizable panes.
Widgets
- Text and display: text, headings and titles; icons (290 built in, in 17 categories) and images; avatars and avatar groups; badges, alerts, key hints, skeletons, spinners, progress bars and empty states.
- Inputs: buttons in six variants and three sizes; text inputs (single-line, multi-line, password, read-only, with icons and a clear button); number inputs; checkboxes with an indeterminate state; radio buttons; switches; toggles and toggle groups; sliders and range sliders; color pickers; selects and comboboxes with single or multiple selection; calendars and date pickers for single days or ranges.
- Navigation: tabs in two variants, sidebar items, collapsible sections and accordions.
- Forms: fields with a label, description and error, and forms that align their labels.
- Data: tables with sorting, multiple selection and resizable columns; trees; virtual lists.
- Overlays and menus: popovers, dialogs, sheets, drawers, alert dialogs, dropdown menus, context menus, a menu bar, tooltips, and toasts at any of six positions.
- Custom drawing: canvases and custom-drawn areas.
Text
- Line breaking for Chinese, Japanese and Korean with punctuation rules, and by word for Thai, Lao, Khmer and Myanmar behind the
word-breakfeature. - Shaping and bidirectional layout for Arabic, Hebrew and similar scripts; kerning and ligatures for Latin, Greek and Cyrillic, with ligatures disabled in monospaced text.
- Emoji, nine font weights from thin to black, and automatic fallback to system fonts for characters the configured fonts lack. On Linux, fonts are found through fontconfig.
- Truncation, selection, the clipboard and input methods, with touch selection handles and an edit menu on phones.
Fonts
Options::fontandOptions::mono_fontadd fonts by name, file, bytes or generic family ahead of the system fonts.Options::fontstakes a completeFontSet, including the language used for Han glyph forms (cjk_language) and additionalFontStacks for other kinds of text.- Text widgets choose a font kind with
.fontand a weight with.font_weightor.font_thinto.font_black. AFontdraws and measures text in aPainterorFrame. installed_fontslists the installed families, andOutlineFontsprovides glyph outlines.
Input
- Mouse, wheel, and touch with inertia and long press; keyboard focus and navigation; dropped files.
- Actions with user-configurable keymaps.
Themes
- Light and dark themes built from design tokens, following the system appearance as it changes, including through the XDG desktop portal on Linux.
- Custom themes, five gray families (
BaseColor), accent color, font size, radius and compact density. - A shared control height, row height, radius and focus ring for every widget, with transitions for hover, focus, state and theme changes.
Accessibility
- Roles, names and states for every widget through AccessKit, and actions from assistive technology: clicking, focusing and setting values.
aria_labelandaltset names. - Arrow-key navigation within radio and toggle groups, each a single Tab stop. Focus returns to the trigger when a dialog or sheet closes.
Internationalization
- The framework's own text comes from a
Locale, with English, Simplified Chinese, Traditional Chinese, Japanese and Korean built in.Locale::for_languageandLocale::systemselect one by language tag or system language, andpreferred_languagesreturns the user's languages. - Application text is translated with Fluent files behind the
i18nfeature.Translationsinstalls them in the user's language,t!looks up messages with arguments and plural forms,Ui::set_languageswitches languages at runtime, andTranslations::checkreports missing or inconsistent messages. Messages without arguments do not allocate.
Custom widgets
- A canvas can take keyboard focus and keys (
focusable,keys,Ui::key_pressed_on) and describe itself to assistive technology (aria_role,aria_value,aria_range, also available on anyElement). Element::withlets widget libraries add chained settings,Ui::tooltipshows a tooltip that follows the pointer, andStyle::focus_ring,Style::itemandStyle::dimmedprovide the built-in looks.
Icons
cpui-icons, a crate with no dependencies that supportsno_std: 290 line icons on a 24 × 24 grid asShapes (lines, circles and arcs), each with a name, search keywords and aCategory, and, with thestdfeature, SVG output. CPUI re-exportsIconNameandIconCategoryand draws the icons from them.
Images and dates
Bitmap::from_pngandBitmap::from_jpeg, behind thepngandjpegfeatures.Date, a calendar day without a time or time zone.
Rendering (cpui-render)
- Monospaced cell drawing for terminals and editors:
Frame::cell_char,cell_text,cell_sequenceandcell_ligatures, withclustersreturningTextClusters and the number of cells each needs. - Window background images through
WallpaperandRenderer::set_wallpaper. - Effects:
Frame::captureto restore or blend drawn pixels,with_fade,checkerfor transparency backdrops,Renderer::set_zoom, anddraw_transparentfor icons with alpha. FontSystemloads fonts and measures text independently of any window, and can be shared between renderers.
Platforms
- macOS, Windows and Linux.
- Experimental iOS and Android support, including input methods and system insets, with Xcode and Gradle projects to copy for packaging.
Documentation
- Guides in English and Chinese, published at cpui.io, and a runnable example for every public item.