Skip to content

gpuicn v0.9.7

Choose a tag to compare

@github-actions github-actions released this 05 Nov 11:34
· 20 commits to main since this release
59c4d58

gpuicn v0.9.7

Matty's request for translated and right-to-left interfaces (#143, for
matty#225): every built-in string can be replaced without forking a
component, and one setting lays the whole library out right to left. Also a
one-line Sortable bookmarks bar with its own gap (#145), pasted one-time
codes (#147), menus that rebuild from their own clicks (#148) and animated
GIFs (#149). The
runtime pins are unchanged: GPUI Kit 0.9.0 on gpui-pre 0.3.11 and
gpui-icons 0.6.0.

Added

  • Strings (theme::locale): UiText names each string a component
    writes for you, including the emoji picker's search, section, category
    and skin tone names, "Close" on dialogs, drawers, toasts and the
    lightbox, empty and loading states, the calendar's months, weekdays and
    dates, AM/PM, the text edit menu, and accessible labels and
    announcements. locale::set_strings(cx, |text| ...) returns a
    translation or None for English; UiText::key() is a stable id for a
    catalog and UiText::english() the default.
  • Direction: locale::set_direction(cx, Direction::Rtl) mirrors rows,
    start and end paddings, insets, borders and corners; flips chevrons and
    arrows; opens menus, submenus, popovers, date pickers and composer
    suggestions from the mirrored edge; moves left drawers, sidebars and
    toast stacks to the right; aligns single-line inputs, popovers and
    tooltips to the start; and makes Left and Right (with their word and
    selection variants) follow the reading direction in inputs, menus,
    menubars, tabs, toolbars, toggle groups, the calendar, the emoji picker,
    the lightbox and sortable lists. theme.direction carries it and
    survives UiTheme::set and UiTheme::switch.
  • Bidi isolation: locale::isolate(text) wraps a name in
    first-strong isolates so mixed-script text keeps its order; a quoted
    message's "Originally posted in" uses it.
  • Helpers: DirectionalStyled (flex_row_in, mirror_row,
    padding_start/end, inset_start/end, border_start_1,
    rounded_start/end, ...) and Direction::{placement, align, anchor, icon, logical_key} for your own views. DrawerSide, SidebarSide and
    ToastPlacement gain physical(direction).
  • Sortable: wrap(false) keeps a horizontal list on one line at its
    content width, so a bookmarks bar scrolls sideways instead of wrapping,
    and gap(px) sets the space between items, with the drop line centred in
    it (#145).
  • OtpField paste: Cmd/Ctrl+V, or a Paste action from the Edit menu,
    fills the cells from the clipboard's digits, ignoring spaces, dashes and
    other text. A full code replaces the value and a partial one continues
    it; the state emits Change, then Complete when the last cell fills.
    otp_field::paste_code(&state, text, window, cx) does the same from your
    own code (#147).
  • Animated pictures: primitives::image(source) is an img with an id
    derived from its source, which GPUI needs before it advances GIF and WebP
    frames. clipped_image, round_image, attachments, avatars, custom
    emoji in Markdown, messages and the emoji picker, Markdown pictures and
    the lightbox use it, so animated pictures play instead of showing their
    first frame. Reduced motion still holds them still (#149).
  • Site: ?dir=rtl on a component page previews it right to left.

See Strings and layout direction.

Fixed

  • MenuItem::on_click handlers run after the menu closes and its state
    update returns, so a handler can call MenuState::set_items, directly or
    through your own entity, to redraw radio items. It used to panic with a
    double lease (#148).

Changed

  • Disabled calendar days, command items and sidebar items read
    ", Unavailable", matching the other unavailable controls, instead of
    ", unavailable".

Not mirrored yet

The carousel track, slider and multi-line text areas belong to GPUI Kit and
stay left to right. Shortcut key caps and the time field's segment order
stay left to right on purpose.

Compatibility

UiTheme gains a public direction field, so code that builds UiTheme
with a struct literal needs direction: Direction::Ltr. Nothing else
changes for left-to-right apps: every default string is the same English as
before.

Upgrading

cargo install gpuicn-cli --version 0.9.7 --locked
gpuicn update --to 0.9.7

Crate users: cargo update -p gpuicn.