Skip to content

CPUI 0.1.0

Choose a tag to compare

@github-actions github-actions released this 29 Nov 04:56
· 59 commits to dev since this release

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-break feature.
  • 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::font and Options::mono_font add fonts by name, file, bytes or generic family ahead of the system fonts. Options::fonts takes a complete FontSet, including the language used for Han glyph forms (cjk_language) and additional FontStacks for other kinds of text.
  • Text widgets choose a font kind with .font and a weight with .font_weight or .font_thin to .font_black. A Font draws and measures text in a Painter or Frame.
  • installed_fonts lists the installed families, and OutlineFonts provides 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_label and alt set 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_language and Locale::system select one by language tag or system language, and preferred_languages returns the user's languages.
  • Application text is translated with Fluent files behind the i18n feature. Translations installs them in the user's language, t! looks up messages with arguments and plural forms, Ui::set_language switches languages at runtime, and Translations::check reports 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 any Element).
  • Element::with lets widget libraries add chained settings, Ui::tooltip shows a tooltip that follows the pointer, and Style::focus_ring, Style::item and Style::dimmed provide the built-in looks.

Icons

  • cpui-icons, a crate with no dependencies that supports no_std: 290 line icons on a 24 × 24 grid as Shapes (lines, circles and arcs), each with a name, search keywords and a Category, and, with the std feature, SVG output. CPUI re-exports IconName and IconCategory and draws the icons from them.

Images and dates

  • Bitmap::from_png and Bitmap::from_jpeg, behind the png and jpeg features.
  • 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_sequence and cell_ligatures, with clusters returning TextClusters and the number of cells each needs.
  • Window background images through Wallpaper and Renderer::set_wallpaper.
  • Effects: Frame::capture to restore or blend drawn pixels, with_fade, checker for transparency backdrops, Renderer::set_zoom, and draw_transparent for icons with alpha.
  • FontSystem loads 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.