pub struct Decorated<P> { /* private fields */ }Expand description
A piece with modifiers chained onto it, keeping the decorated piece’s type (§5.2).
Every Decorate modifier returns one of these rather than erasing to AnyPiece, which is
what lets a chain keep reaching the piece’s builder methods: label(…).padding(8.0) is
still a decorated Label, so .font(…) after it resolves. Modifiers applied to a Decorated
append in place (the inherent methods below shadow the trait’s), so a chain stays flat instead
of nesting Decorated<Decorated<…>>.
Modifiers fall into three classes (docs/api-style.md “Modifier classes”), and only one of them is ordered:
- Identity (
id,id_of) names the piece’s own node, the one its build returns, wherever it sits in the chain:label(t).padding(8.0).id(day_core::id!(x))andlabel(t).id(day_core::id!(x)).padding(8.0)are the same tree. - Wrapping modifiers (
padding,frame,background,grow, …) each add a node around what came before, so they compose outward in call order, as they read. - Outer-layout facts (
grid_span,grid_align) describe the piece to the container it sits in, so they land on the outermost node whatever wrappers follow them.
wrapper_id is the one way to name a wrapper deliberately: it tags whatever node is
outermost at the point it is called, for a frame assertion on a padded box.
Erase explicitly with .any() when a single AnyPiece is what’s needed (a Vec<AnyPiece>, a
-> AnyPiece signature).
Implementations§
Source§impl<P: Piece> Decorated<P>
impl<P: Piece> Decorated<P>
Sourcepub fn new(inner: P) -> Self
pub fn new(inner: P) -> Self
An undecorated piece, ready to have modifiers applied CONDITIONALLY. Starting here gives every branch the same type, so an optional modifier needs no erasure:
let leaf = Decorated::new(draw);
let leaf = match id { Some(id) => leaf.id(id), None => leaf };
let leaf = if editable { leaf.on_tap(f) } else { leaf };apply_if and apply_some are the same move as a
chain step.
Sourcepub fn map_inner<Q: Piece>(self, f: impl FnOnce(P) -> Q) -> Decorated<Q>
pub fn map_inner<Q: Piece>(self, f: impl FnOnce(P) -> Q) -> Decorated<Q>
Replace the undecorated piece, keeping the modifier chain: how a typed builder trait
reaches through a decoration (docs/api-style.md “Typed builders”). f sees the piece as
it was before any modifier, which is why modifier order stops mattering.
Sourcepub fn apply_if(self, cond: bool, f: impl FnOnce(Self) -> Self) -> Self
pub fn apply_if(self, cond: bool, f: impl FnOnce(Self) -> Self) -> Self
Apply f to the chain when cond holds, else continue unchanged: the conditional
modifier, with no let x = if c { x.m() } else { x } rebinding and no erasure.
nav(sel).apply_if(!primary, |n| n.local())cond is a plain bool resolved at build, like the arms of a match; the modifiers
f applies may themselves be reactive.
Sourcepub fn apply_some<T>(
self,
value: Option<T>,
f: impl FnOnce(Self, T) -> Self,
) -> Self
pub fn apply_some<T>( self, value: Option<T>, f: impl FnOnce(Self, T) -> Self, ) -> Self
Apply f with the value when there is one, else continue unchanged:
canvas(draw).apply_some(id, |c, id| c.id(id)).
Source§impl<P: Piece> Decorated<P>
impl<P: Piece> Decorated<P>
pub fn id(self, id: ElementId) -> Self
pub fn id_of(self, id: impl Fn() -> ElementId + 'static) -> Self
pub fn wrapper_id(self, id: ElementId) -> Self
pub fn tweak(self, f: impl FnOnce(RNode) + 'static) -> Self
pub fn selectable(self) -> Self
pub fn cursor<M>(self, cursor: impl IntoReactive<Cursor, M>) -> Self
pub fn native_ref(self, r: &NativeRef) -> Self
pub fn window_drag_region(self) -> Self
pub fn padding(self, insets: impl IntoInsets) -> Self
pub fn max_width(self, max: f64) -> Self
Sourcepub fn min_width(self, min: f64) -> Self
pub fn min_width(self, min: f64) -> Self
Never narrower than min: a stretching control keeps a usable width, and a row that
cannot give it that overflows, so a labeled row stacks the control under its label
rather than squeezing it (docs/forms.md).
pub fn reserving(self, sample: impl Into<String>) -> Self
pub fn frame(self, width: f64, height: f64) -> Self
pub fn width(self, width: f64) -> Self
pub fn height(self, height: f64) -> Self
pub fn a11y(self, f: impl FnOnce(A11yBuilder) -> A11yBuilder + 'static) -> Self
Sourcepub fn on_tap(self, f: impl Fn() + 'static) -> Self
pub fn on_tap(self, f: impl Fn() + 'static) -> Self
Handle a tap gesture on this piece.
Do not use this to activate a native button; use crate::ButtonBuilder::action.
A separate gesture recognizer can delay pressed feedback and bypass native keyboard,
accessibility, and disabled behavior. Day warns when it attaches a tap to a button.
Sourcepub fn on_tap_at(self, f: impl Fn(Point) + 'static) -> Self
pub fn on_tap_at(self, f: impl Fn(Point) + 'static) -> Self
Handle a tap with its local position. Like Self::on_tap, this is a gesture,
not native button activation; use crate::ButtonBuilder::action for buttons.
pub fn focused<M>(self, binding: impl IntoFocusBinding<M>) -> Self
pub fn on_key(self, f: impl Fn(&KeyEvent) + 'static) -> Self
pub fn focusable(self) -> Self
pub fn toolbar<M>(self, content: impl ToolbarContent<M>) -> Self
Sourcepub fn searchable(self, search: Search) -> Self
pub fn searchable(self, search: Search) -> Self
See Decorate::searchable.
Sourcepub fn drag_source(
self,
source: impl Fn(Point) -> Option<Offer> + 'static,
) -> Self
pub fn drag_source( self, source: impl Fn(Point) -> Option<Offer> + 'static, ) -> Self
Offer data through the platform’s native drag session.
Sourcepub fn drop_target(self, target: Target) -> Self
pub fn drop_target(self, target: Target) -> Self
Attach native drop acceptance policy and an owned-data receiver.
pub fn on_drag(self, f: impl Fn(Drag) + 'static) -> Self
pub fn on_pinch(self, f: impl Fn(Pinch) + 'static) -> Self
pub fn on_pan(self, f: impl Fn(Pan) + 'static) -> Self
Sourcepub fn on_hover(self, f: impl Fn(Option<Point>) + 'static) -> Self
pub fn on_hover(self, f: impl Fn(Option<Point>) + 'static) -> Self
The pointer moving over this piece: Some(point) in its own coordinates while inside,
None when it leaves (docs/canvas.md “Interaction”).
Pointer-only, which is not a gap: every desktop delivers it, an
iPad does with a trackpad or pencil, an Android device with a mouse or stylus, and a
touch-only phone delivers nothing at all. Anything reachable by hover must also be
reachable by a tap: wire on_tap_at alongside it, exactly as a chart’s selection does.
Sourcepub fn card(self) -> Self
pub fn card(self) -> Self
The platform’s card: the grouped-content surface (SurfaceRole::SectionCard) with
rounded corners and a Space::M inset. Drawn by the toolkit, so it follows the
appearance and never steals hit testing from the content.
pub fn background<M>(self, color: impl IntoReactive<Color, M>) -> Self
pub fn corner_radius(self, radius: f64) -> Self
pub fn opacity<M>(self, opacity: impl IntoReactive<f64, M>) -> Self
pub fn transform<M>(self, t: impl IntoReactive<Transform, M>) -> Self
pub fn scale<M>(self, factor: impl IntoReactive<f64, M>) -> Self
pub fn rotation<M>(self, degrees: impl IntoReactive<f64, M>) -> Self
pub fn translation<Mx, My>( self, x: impl IntoReactive<f64, Mx>, y: impl IntoReactive<f64, My>, ) -> Self
pub fn animation(self, anim: AnimSpec) -> Self
Sourcepub fn modifier(self, m: impl Modifier) -> AnyPiece
pub fn modifier(self, m: impl Modifier) -> AnyPiece
Erases, like Decorate::modifier: Modifier is defined over AnyPiece.
pub fn overlay(self, over: impl Piece) -> Self
pub fn overlay_aligned(self, align: Alignment, over: impl Piece) -> Self
pub fn aspect_ratio(self, ratio: f64) -> Self
pub fn grow(self) -> Self
pub fn grow_w(self) -> Self
pub fn grow_h(self) -> Self
pub fn grid_span(self, n: usize) -> Self
pub fn grid_align(self, a: Alignment) -> Self
pub fn defers_system_gestures(self, edges: Edges) -> Self
pub fn interactive_dismiss_disabled(self) -> Self
Trait Implementations§
Source§impl<DecoratedInner: AdaptiveBuilder + Piece> AdaptiveBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: AdaptiveBuilder + Piece> AdaptiveBuilder for Decorated<DecoratedInner>
Source§impl<DecoratedInner: ButtonBuilder + Piece> ButtonBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: ButtonBuilder + Piece> ButtonBuilder for Decorated<DecoratedInner>
Source§fn icon<M>(self, symbol: impl IntoReactive<Symbol, M>) -> Self
fn icon<M>(self, symbol: impl IntoReactive<Symbol, M>) -> Self
Source§fn image(self, name: impl Into<ImageName>) -> Self
fn image(self, name: impl Into<ImageName>) -> Self
Source§fn icon_only(self) -> Self
fn icon_only(self) -> Self
Source§fn action(self, f: impl Fn() + 'static) -> Self
fn action(self, f: impl Fn() + 'static) -> Self
Source§fn bordered(self) -> Self
fn bordered(self) -> Self
Source§fn enabled<M>(self, v: impl IntoReactive<bool, M>) -> Self
fn enabled<M>(self, v: impl IntoReactive<bool, M>) -> Self
true; false = disabled/grayed by the native
control). Reactive, so it can follow app state, e.g. .enabled(move || !busy.get()) to
lock a control while a long operation runs. Read moreSource§fn prominent(self) -> Self
fn prominent(self) -> Self
Source§fn tint<M>(self, color: impl IntoReactive<Color, M>) -> Self
fn tint<M>(self, color: impl IntoReactive<Color, M>) -> Self
Source§fn compact(self) -> Self
fn compact(self) -> Self
Source§fn plain(self) -> Self
fn plain(self) -> Self
Source§fn selected<M>(self, v: impl IntoReactive<bool, M>) -> Self
fn selected<M>(self, v: impl IntoReactive<bool, M>) -> Self
UIButton.isSelected, GTK’s :checked, a checked QPushButton, a checked
MaterialButton, aria-pressed on the web) and announces it as selected, while the
button stays enabled, focusable and activatable, which a disabled stand-in is not. Read moreSource§impl<DecoratedInner: ColumnBuilder + Piece> ColumnBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: ColumnBuilder + Piece> ColumnBuilder for Decorated<DecoratedInner>
Source§impl<R: Route, DecoratedInner: CoverBuilder<R> + Piece> CoverBuilder<R> for Decorated<DecoratedInner>
impl<R: Route, DecoratedInner: CoverBuilder<R> + Piece> CoverBuilder<R> for Decorated<DecoratedInner>
Source§fn sheet(self) -> Self
fn sheet(self) -> Self
Source§fn half_sheet(self) -> Self
fn half_sheet(self) -> Self
Cover::sheet.Source§impl<DecoratedInner: DividerBuilder + Piece> DividerBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: DividerBuilder + Piece> DividerBuilder for Decorated<DecoratedInner>
Source§impl<DecoratedInner: FormSectionBuilder + Piece> FormSectionBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: FormSectionBuilder + Piece> FormSectionBuilder for Decorated<DecoratedInner>
Source§fn title<M>(self, t: impl IntoText<M>) -> Self
fn title<M>(self, t: impl IntoText<M>) -> Self
Source§impl<DecoratedInner: GridBuilder + Piece> GridBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: GridBuilder + Piece> GridBuilder for Decorated<DecoratedInner>
Source§impl<DecoratedInner: GridRowBuilder + Piece> GridRowBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: GridRowBuilder + Piece> GridRowBuilder for Decorated<DecoratedInner>
Source§impl<DecoratedInner: ImageBuilder + Piece> ImageBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: ImageBuilder + Piece> ImageBuilder for Decorated<DecoratedInner>
Source§fn content_mode(self, m: ContentMode) -> Self
fn content_mode(self, m: ContentMode) -> Self
ContentMode::Fit).Source§fn fit(self) -> Self
fn fit(self) -> Self
Source§fn fill(self) -> Self
fn fill(self) -> Self
Source§fn aspect_ratio(self, ratio: f64) -> Self
fn aspect_ratio(self, ratio: f64) -> Self
width / height ratio (e.g. 16.0 / 9.0).Source§fn decorative(self) -> Self
fn decorative(self) -> Self
Source§impl<DecoratedInner: InspectorBuilder + Piece> InspectorBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: InspectorBuilder + Piece> InspectorBuilder for Decorated<DecoratedInner>
Source§fn width(self, width: f64) -> Self
fn width(self, width: f64) -> Self
INSPECTOR_WIDTH). Where the native
pane has a user-draggable divider this is the initial width, not a limit.Source§fn not_scrollable(self) -> Self
fn not_scrollable(self) -> Self
Source§fn sheet_done<M>(self, t: impl IntoText<M>) -> Self
fn sheet_done<M>(self, t: impl IntoText<M>) -> Self
✕). Pass a localized
“Done”; the sheet is the one home where the panel needs its own way out.Source§fn edge(self, edge: PaneEdge) -> Self
fn edge(self, edge: PaneEdge) -> Self
PaneEdge::Trailing.Source§fn half_sheet(self) -> Self
fn half_sheet(self) -> Self
Cover::half_sheet.
Default: the fullscreen sheet.Source§impl<DecoratedInner: LabelBuilder + Piece> LabelBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: LabelBuilder + Piece> LabelBuilder for Decorated<DecoratedInner>
Source§fn single_line(self) -> Self
fn single_line(self) -> Self
Source§fn max_lines(self, lines: u32) -> Self
fn max_lines(self, lines: u32) -> Self
Source§fn font(self, f: Font) -> Self
fn font(self, f: Font) -> Self
Font::Title, Font::Footnote, …) or a custom Font::System(pt).
Backends render it with the platform’s native style + accessibility text scaling.Source§fn font_scale(self, scale: f64) -> Self
fn font_scale(self, scale: f64) -> Self
Source§fn weight(self, w: FontWeight) -> Self
fn weight(self, w: FontWeight) -> Self
FontWeight::Semibold). See also Label::bold.Source§fn secondary(self) -> Self
fn secondary(self) -> Self
secondaryLabelColor on Apple, ?android:textColorSecondary, a dim label on GTK). Read moreSource§fn tabular(self) -> Self
fn tabular(self) -> Self
Source§fn monospace(self) -> Self
fn monospace(self) -> Self
Source§fn runs(self, runs: Vec<TextRun>) -> Self
fn runs(self, runs: Vec<TextRun>) -> Self
Source§fn runs_from(self, b: TextBuilder) -> Self
fn runs_from(self, b: TextBuilder) -> Self
TextBuilder, replacing whatever text the label
was built with. This is the intended entry point: the builder guarantees the ranges match
the string, which is the invariant hand-written runs get wrong.Source§fn align(self, align: TextAlign) -> Self
fn align(self, align: TextAlign) -> Self
**bold**, *italic*,
`code`, ~~strike~~ and [text](url) become styled runs, and the markers themselves
are stripped. Read morefn markdown(self) -> Self
Source§fn on_link(self, f: impl Fn(&str) + 'static) -> Self
fn on_link(self, f: impl Fn(&str) + 'static) -> Self
Source§fn color<M>(self, c: impl IntoReactive<Color, M>) -> Self
fn color<M>(self, c: impl IntoReactive<Color, M>) -> Self
Signal<Color>, or a Fn() -> Color. A reactive
source recolors the native label when it changes (theme systems ride this).Source§fn preset(self, preset: &TextPreset) -> Self
fn preset(self, preset: &TextPreset) -> Self
TextPreset: the font, weight, scale, emphasis and
color an app defined once (label(t).preset(&CAPTION)).Source§impl<DecoratedInner: LinkBuilder + Piece> LinkBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: LinkBuilder + Piece> LinkBuilder for Decorated<DecoratedInner>
Source§impl<S: RowSource + 'static, DecoratedInner: ListBuilder<S> + Piece> ListBuilder<S> for Decorated<DecoratedInner>
impl<S: RowSource + 'static, DecoratedInner: ListBuilder<S> + Piece> ListBuilder<S> for Decorated<DecoratedInner>
Source§fn row_height(self, h: RowHeight) -> Self
fn row_height(self, h: RowHeight) -> Self
Uniform(h) (fastest) or Automatic (self-sizing).Source§fn on_activate(self, f: impl Fn(S::Ref) + 'static) -> Self
fn on_activate(self, f: impl Fn(S::Ref) + 'static) -> Self
Source§fn on_select(self, f: impl Fn(S::Ref) + 'static) -> Self
fn on_select(self, f: impl Fn(S::Ref) + 'static) -> Self
Elem handle for a store source.Source§fn multi_select(self) -> Self
fn multi_select(self) -> Self
Self::on_selection with the full set of selected rows.Source§fn on_selection(self, f: impl Fn(Vec<S::Ref>) + 'static) -> Self
fn on_selection(self, f: impl Fn(Vec<S::Ref>) + 'static) -> Self
Self::on_select. Also fired by
single-selection backends with a one-element (or empty) set.Source§fn selected_rows(self, rows: impl Fn() -> Vec<usize> + 'static) -> Self
fn selected_rows(self, rows: impl Fn() -> Vec<usize> + 'static) -> Self
rows (row indices; empty clears). Re-runs
whenever the closure’s tracked reads change; the toolkit applies the sync without
re-emitting a selection event. Drive it from app state to build “Clear selection”.Source§fn selection(self, selected: impl Binding<Option<u64>>) -> Selfwhere
S::Ref: SelectionKey,
fn selection(self, selected: impl Binding<Option<u64>>) -> Selfwhere
S::Ref: SelectionKey,
selected holds
the selected row’s key (None for no selection). A row the user picks writes its key,
clearing the selection writes None, and a key the app writes selects that row and
scrolls it into view, following the row through inserts and moves. Read moreSource§fn scroll_to_end(self, trigger: Trigger) -> Self
fn scroll_to_end(self, trigger: Trigger) -> Self
trigger fires, e.g. a chat
timeline sticking to the newest message. Fire it with day_reactive::Trigger::notify
after appending. No-op while the list is empty. The scroll targets the native list
(NSTableView/UITableView/GtkListView/QListView/RecyclerView), so it respects the
platform’s own scroll physics.Source§fn stick_to_bottom(self) -> Self
fn stick_to_bottom(self) -> Self
Self::scroll_to_end for feeds that always follow the newest
row; for finer control (only stick when the user is already near the bottom) drive
scroll_to_end from your own logic instead. Off by default.Source§fn scroll_to_row(self, target: impl Binding<Option<usize>>) -> Self
fn scroll_to_row(self, target: impl Binding<Option<usize>>) -> Self
Some(row) and the native
list scrolls that row into view, realizing it if it was virtualized away: the row rail’s
counterpart to scroll(...).scroll_target(...). The signal is left as written; setting
the same row again re-fires. Takes a Signal<Option<usize>> or any other binding.Source§fn first_visible_row(self, first: impl Binding<usize>) -> Self
fn first_visible_row(self, first: impl Binding<usize>) -> Self
first (a Signal<usize> or any other binding). Use with a heading overlay for
floating group headers. No periodic timer is used.Source§fn reorderable(self, reorder: Reorder) -> Self
fn reorderable(self, reorder: Reorder) -> Self
Source§fn swipe_leading(
self,
provider: impl Fn(usize) -> Vec<SwipeAction> + 'static,
) -> Self
fn swipe_leading( self, provider: impl Fn(usize) -> Vec<SwipeAction> + 'static, ) -> Self
Cap::ListSwipeActions;
docs/list.md has the matrix; a backend without the affordance shows nothing, so pair
each action with an explicit control for the rest). provider runs at gesture time
with the row index, so the offer can reflect the row’s current state (“Mark as Read”
vs “Mark as Unread”). Keep it pure and fast; it runs inside the platform’s swipe
callback; the actions’ handlers run later, at the event drain. A full swipe across
activates the edge’s first action.Source§fn swipe_trailing(
self,
provider: impl Fn(usize) -> Vec<SwipeAction> + 'static,
) -> Self
fn swipe_trailing( self, provider: impl Fn(usize) -> Vec<SwipeAction> + 'static, ) -> Self
swipe_leading.Source§fn separators(self) -> Self
fn separators(self) -> Self
Self::no_separators for the other override. A backend without a separator mechanism
ignores this (the docs matrix says which); don’t re-create the old hand-drawn hairline
there. Rows separate by their pitch.Source§fn no_separators(self) -> Self
fn no_separators(self) -> Self
Source§fn editing<M>(self, on: impl IntoReactive<bool, M>) -> Self
fn editing<M>(self, on: impl IntoReactive<bool, M>) -> Self
Source§impl<DecoratedInner: ListItemBuilder + Piece> ListItemBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: ListItemBuilder + Piece> ListItemBuilder for Decorated<DecoratedInner>
Source§fn subtitle<M>(self, text: impl IntoText<M>) -> Self
fn subtitle<M>(self, text: impl IntoText<M>) -> Self
Source§fn detail<M>(self, text: impl IntoText<M>) -> Self
fn detail<M>(self, text: impl IntoText<M>) -> Self
Source§fn icon<M>(self, name: impl IntoReactive<VectorName, M>) -> Self
fn icon<M>(self, name: impl IntoReactive<VectorName, M>) -> Self
res::vectors::…), drawn as a template in the
foreground color unless Self::icon_tint names one. A signal or closure swaps it in
place.Source§fn icon_tint<M>(self, color: impl IntoReactive<Color, M>) -> Self
fn icon_tint<M>(self, color: impl IntoReactive<Color, M>) -> Self
Source§fn checked<M>(self, on: impl IntoReactive<bool, M>) -> Self
fn checked<M>(self, on: impl IntoReactive<bool, M>) -> Self
on holds: the platform’s mark for a chosen or completed
row, announced as selected.Source§fn refreshable<M>(
self,
refreshing: impl IntoReactive<bool, M>,
action: impl Fn() + 'static,
) -> Self
fn refreshable<M>( self, refreshing: impl IntoReactive<bool, M>, action: impl Fn() + 'static, ) -> Self
refreshing is app-owned: set it synchronously when accepting a request and clear it
on completion, failure or cancellation. Repeated pulls while busy are ignored. A
declined request stops the indicator immediately. Programmatic state writes never
call action. The handler and state bindings live only as long as this navigation.Source§fn sections(self, sections: Sections) -> Self
fn sections(self, sections: Sections) -> Self
Sections value:
nav(sel).sections(Sections::restored("nav.sections").on_change(f)).Source§fn section_id<M>(
self,
id: impl Into<String>,
title: impl IntoText<M>,
content: impl NavContent<K>,
) -> Self
fn section_id<M>( self, id: impl Into<String>, title: impl IntoText<M>, content: impl NavContent<K>, ) -> Self
content (one item, a tuple, an Option, a nav_items block, or a mix).Source§fn reorder_items(
self,
eligible: impl Fn(&K) -> bool + 'static,
moved: impl Fn(K, K) + 'static,
) -> Self
fn reorder_items( self, eligible: impl Fn(&K) -> bool + 'static, moved: impl Fn(K, K) + 'static, ) -> Self
Cap::NavReorder supports it; otherwise
retains the native navigation widget. UIKit navigation remains fixed even though
content lists support dragging. Tab/rail chrome remains fixed. Persist the order in the callback’s backing data.Source§fn retain_selection_when(self, keep: impl Fn(&K) -> bool + 'static) -> Self
fn retain_selection_when(self, keep: impl Fn(&K) -> bool + 'static) -> Self
keep returns true.
Useful for filtered sidebars: reading a feed’s last unread article can hide its row
without closing the article. The native sidebar then has no highlighted row.
Return false for deleted records to retain the normal selection-reset behavior.
Evaluated when the item list changes; pair with Self::destination for dynamic keys.Source§fn icon_progress(
self,
progress: impl Fn() -> Vec<(K, Option<f64>)> + 'static,
) -> Self
fn icon_progress( self, progress: impl Fn() -> Vec<(K, Option<f64>)> + 'static, ) -> Self
.items.fn style(self, style: NavStyle) -> Self
Source§fn section<M>(
self,
title: impl IntoText<M>,
content: impl NavContent<K>,
) -> Self
fn section<M>( self, title: impl IntoText<M>, content: impl NavContent<K>, ) -> Self
Source§fn header<P: Piece>(self, build: impl FnOnce() -> P + 'static) -> Self
fn header<P: Piece>(self, build: impl FnOnce() -> P + 'static) -> Self
Self::header, this slot applies to sidebar navigation, not tab/rail chrome.Source§fn presentation(self, presentation: NavPresentation) -> Self
fn presentation(self, presentation: NavPresentation) -> Self
Source§fn content_list(self, list: ContentList<K>) -> Self
fn content_list(self, list: ContentList<K>) -> Self
ContentList value: Read moreSource§fn item<M, P: Piece>(
self,
key: impl Into<K>,
title: impl IntoText<M>,
build: impl Fn() -> P + 'static,
) -> Self
fn item<M, P: Piece>( self, key: impl Into<K>, title: impl IntoText<M>, build: impl Fn() -> P + 'static, ) -> Self
item(key, title).page(build) in one call. key addresses it
(navigate / deep link / dayscript); title is its label; build runs when the item is
first shown. For a typed nav over Option<Section> pass the bare Section::X. For an
icon, a badge or a tint, build the item value and add it with items.Source§fn items(self, content: impl NavContent<K>) -> Self
fn items(self, content: impl NavContent<K>) -> Self
Source§fn destination<P: Piece>(self, build: impl Fn(&K) -> P + 'static) -> Self
fn destination<P: Piece>(self, build: impl Fn(&K) -> P + 'static) -> Self
page of its own (the rows
of a data-driven block). Mirrors NavStack::destination; unused for a nav whose items
all carry a page.Source§fn local(self) -> Self
fn local(self) -> Self
current_route nor intercepts navigate/deep links. Read moreSource§fn restore(self, key: impl Into<String>) -> Self
fn restore(self, key: impl Into<String>) -> Self
key on every change and restored at build (so the app reopens on the tab/section
the user last had) unless a launch deep link is pending, which wins. day::launch
installs the preferences as the store (docs/navigation.md); a stale saved
key (its item no longer exists) is ignored. Works whether or not the nav is
routed.Source§fn toolbar<M>(self, content: impl ToolbarContent<M>) -> Self
fn toolbar<M>(self, content: impl ToolbarContent<M>) -> Self
fn title<M>(self, t: impl IntoText<M>) -> Self
Source§fn toolbar<M>(self, content: impl ToolbarContent<M>) -> Self
fn toolbar<M>(self, content: impl ToolbarContent<M>) -> Self
Source§fn destination<P: Piece>(self, build: impl Fn(&K) -> P + 'static) -> Self
fn destination<P: Piece>(self, build: impl Fn(&K) -> P + 'static) -> Self
&String for raw keys, the typed value otherwise).Source§fn on_back(self, guard: impl Fn(BackRequest) -> BackResponse + 'static) -> Self
fn on_back(self, guard: impl Fn(BackRequest) -> BackResponse + 'static) -> Self
nav_back while the stack is above its root; it returns
BackResponse::Proceed to pop now or BackResponse::Handled to consume the back
(stash the BackRequest and call BackRequest::proceed later). Programmatic path
writes are never guarded. While a guard is armed the toolkit stops auto-popping on a
native gesture and routes the back through Day instead (NavPatch::GuardTop).Source§fn restore(self, key: impl Into<String>) -> Self
fn restore(self, key: impl Into<String>) -> Self
/-joined and saved under key; at build the saved path is parsed back (each
segment via Route::from_key) and restored, so the app reopens exactly where the user
left off, including after an Android process death, unless a launch deep link is pending,
which wins. day::launch installs the preferences as the store (docs/navigation.md); a
saved path with a segment that no longer parses is ignored whole.Source§impl<DecoratedInner: PickerBuilder + Piece> PickerBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: PickerBuilder + Piece> PickerBuilder for Decorated<DecoratedInner>
Source§fn enabled<M>(self, v: impl IntoReactive<bool, M>) -> Self
fn enabled<M>(self, v: impl IntoReactive<bool, M>) -> Self
true); a constant or a reactive bool.Source§fn separators_before(self, indexes: impl IntoIterator<Item = usize>) -> Self
fn separators_before(self, indexes: impl IntoIterator<Item = usize>) -> Self
fn segmented(self) -> Self
fn inline(self) -> Self
fn style(self, style: PickerStyle) -> Self
Source§impl<DecoratedInner: RowBuilder + Piece> RowBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: RowBuilder + Piece> RowBuilder for Decorated<DecoratedInner>
Source§impl<DecoratedInner: ScrollBuilder + Piece> ScrollBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: ScrollBuilder + Piece> ScrollBuilder for Decorated<DecoratedInner>
Source§fn horizontal(self) -> Self
fn horizontal(self) -> Self
Source§fn scroll_target(self, target: impl Binding<Option<ScrollTarget>>) -> Self
fn scroll_target(self, target: impl Binding<Option<ScrollTarget>>) -> Self
Some(target) written to sig scrolls
there (animated), then the signal resets to None. Write-and-forget, so the same
target can be sent twice in a row. Read moreSource§impl<DecoratedInner: ShapePieceBuilder + Piece> ShapePieceBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: ShapePieceBuilder + Piece> ShapePieceBuilder for Decorated<DecoratedInner>
fn fill<M>(self, p: impl IntoReactive<Color, M>) -> Self
Source§fn fill_linear<M>(self, g: impl IntoReactive<LinearGradient, M>) -> Self
fn fill_linear<M>(self, g: impl IntoReactive<LinearGradient, M>) -> Self
LinearGradient (unit points resolve against the shape’s bounds). Takes
precedence over Self::fill when both are set; reactive like every other property:
rectangle().fill_linear(move || sky_gradient(state.get())).Source§fn fill_radial<M>(self, g: impl IntoReactive<RadialGradient, M>) -> Self
fn fill_radial<M>(self, g: impl IntoReactive<RadialGradient, M>) -> Self
RadialGradient (center + radius in the unit space of the shape’s bounds,
stretching elliptically in non-square bounds). Precedence: radial over linear over solid.fn stroke<M1, M2>( self, color: impl IntoReactive<Color, M1>, width: impl IntoReactive<f64, M2>, ) -> Self
Source§fn inset<M>(self, v: impl IntoReactive<f64, M>) -> Self
fn inset<M>(self, v: impl IntoReactive<f64, M>) -> Self
Source§fn rotate<M>(self, deg: impl IntoReactive<f64, M>) -> Self
fn rotate<M>(self, deg: impl IntoReactive<f64, M>) -> Self
Source§fn scale<M>(self, s: impl IntoReactive<f64, M>) -> Self
fn scale<M>(self, s: impl IntoReactive<f64, M>) -> Self
Source§fn offset<M1, M2>(
self,
x: impl IntoReactive<f64, M1>,
y: impl IntoReactive<f64, M2>,
) -> Self
fn offset<M1, M2>( self, x: impl IntoReactive<f64, M1>, y: impl IntoReactive<f64, M2>, ) -> Self
Source§fn at(self, fx: f64, fy: f64, fw: f64, fh: f64) -> Self
fn at(self, fx: f64, fy: f64, fw: f64, fh: f64) -> Self
(fx, fy, fw, fh) of its bounds
(unit-space, applied before Self::inset). The workhorse for composing glyphs in a
shape_group, mirroring hand-drawn Rect::new(ox + fx * s, oy + fy * s, …) canvas code.Source§impl<DecoratedInner: SliderBuilder + Piece> SliderBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: SliderBuilder + Piece> SliderBuilder for Decorated<DecoratedInner>
Source§impl<DecoratedInner: SplitBuilder + Piece> SplitBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: SplitBuilder + Piece> SplitBuilder for Decorated<DecoratedInner>
Source§fn axis<M>(self, axis: impl IntoReactive<SplitAxis, M>) -> Self
fn axis<M>(self, axis: impl IntoReactive<SplitAxis, M>) -> Self
SplitAxis::Horizontal, the default) or stacked; a signal or a closure
turns the split live, keeping the share.Source§fn fraction(self, fraction: impl Binding<f64>) -> Self
fn fraction(self, fraction: impl Binding<f64>) -> Self
0.0..=1.0, two-way: a dragged divider writes
it, writing it moves the divider. Unbound, the split keeps a share of its own from 0.5.Source§fn min_pane(self, points: f64) -> Self
fn min_pane(self, points: f64) -> Self
SPLIT_MIN_PANE).Source§impl<DecoratedInner: TextAreaBuilder + Piece> TextAreaBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: TextAreaBuilder + Piece> TextAreaBuilder for Decorated<DecoratedInner>
Source§fn placeholder<M>(self, t: impl IntoText<M>) -> Self
fn placeholder<M>(self, t: impl IntoText<M>) -> Self
Signal<String>, or
closure, evaluated once for the initial value; not reactive after build).Source§fn min_lines(self, lines: u32) -> Self
fn min_lines(self, lines: u32) -> Self
Source§fn max_lines(self, lines: u32) -> Self
fn max_lines(self, lines: u32) -> Self
0 (the
default) means unbounded: the editor keeps growing and never scrolls.Source§fn editable<M>(self, v: impl IntoReactive<bool, M>) -> Self
fn editable<M>(self, v: impl IntoReactive<bool, M>) -> Self
true; false = read-only). Reactive.Source§fn selectable<M>(self, v: impl IntoReactive<bool, M>) -> Self
fn selectable<M>(self, v: impl IntoReactive<bool, M>) -> Self
true). Reactive. Unsupported on
backends where selection is always on (GTK).Source§fn spellcheck<M>(self, v: impl IntoReactive<bool, M>) -> Self
fn spellcheck<M>(self, v: impl IntoReactive<bool, M>) -> Self
true). Reactive.
Unsupported on backends with no built-in spell-check (GTK, Qt).Source§fn on_submit(self, f: impl Fn() + 'static) -> Self
fn on_submit(self, f: impl Fn() + 'static) -> Self
f instead of inserting a newline, the chat-composer
contract. Shift+Enter still inserts a line break on desktop and ArkUI; Android and
ArkUI show a Send action on the soft keyboard; iOS’s return key submits. Backends without
the intercept (web-dom today) keep inserting newlines, so pair this with a visible send button. The
bound text signal is already up to date when f runs.Source§impl<DecoratedInner: TextFieldBuilder + Piece> TextFieldBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: TextFieldBuilder + Piece> TextFieldBuilder for Decorated<DecoratedInner>
Source§fn enabled<M>(self, v: impl IntoReactive<bool, M>) -> Self
fn enabled<M>(self, v: impl IntoReactive<bool, M>) -> Self
true); a constant or a reactive bool. A
disabled field neither edits nor focuses; TextField::read_only keeps it selectable.fn placeholder<M>(self, t: impl IntoText<M>) -> Self
Source§fn on_submit(self, f: impl Fn() + 'static) -> Self
fn on_submit(self, f: impl Fn() + 'static) -> Self
focus.set(Some(Field::Next))
(docs/focus.md).Source§fn secure<M>(self, v: impl IntoReactive<bool, M>) -> Self
fn secure<M>(self, v: impl IntoReactive<bool, M>) -> Self
false). Reactive: bind it to a signal
for a show-password switch. The text, the placeholder and the focus carry across the
change on every backend, including the two whose secure field is a different native
class.Source§fn read_only<M>(self, v: impl IntoReactive<bool, M>) -> Self
fn read_only<M>(self, v: impl IntoReactive<bool, M>) -> Self
false).
Reactive. Unlike .disabled(true) the field keeps its ordinary look and still takes
focus.Source§fn input_purpose(self, purpose: InputPurpose) -> Self
fn input_purpose(self, purpose: InputPurpose) -> Self
Source§fn submit_label(self, label: SubmitLabel) -> Self
fn submit_label(self, label: SubmitLabel) -> Self
on_submit either way.Source§fn max_length(self, characters: u32) -> Self
fn max_length(self, characters: u32) -> Self
Source§impl<DecoratedInner: ToggleBuilder + Piece> ToggleBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: ToggleBuilder + Piece> ToggleBuilder for Decorated<DecoratedInner>
Source§fn enabled<M>(self, v: impl IntoReactive<bool, M>) -> Self
fn enabled<M>(self, v: impl IntoReactive<bool, M>) -> Self
true; false = disabled/grayed). Reactive,
e.g. .enabled(capability(Cap::TextSpellCheck) == Support::Native) to gray it out where a
backend can’t honor the thing it controls.Source§impl<S: NodeSource + 'static, DecoratedInner: TreeBuilder<S> + Piece> TreeBuilder<S> for Decorated<DecoratedInner>
impl<S: NodeSource + 'static, DecoratedInner: TreeBuilder<S> + Piece> TreeBuilder<S> for Decorated<DecoratedInner>
Source§fn row_height(self, h: RowHeight) -> Self
fn row_height(self, h: RowHeight) -> Self
Uniform(h) (fastest) or Automatic (self-sizing).Source§fn indent(self, pts: f64) -> Self
fn indent(self, pts: f64) -> Self
Source§fn section_headers(self) -> Self
fn section_headers(self) -> Self
Source§fn on_expansion(self, f: impl Fn(S::Key, bool) + 'static) -> Self
fn on_expansion(self, f: impl Fn(S::Key, bool) + 'static) -> Self
expanded do not echo this callback.Source§fn expanded(self, set: impl Binding<HashSet<S::Key>>) -> Self
fn expanded(self, set: impl Binding<HashSet<S::Key>>) -> Self
Source§fn expandable(self, f: impl Fn(&S::Key) -> bool + 'static) -> Self
fn expandable(self, f: impl Fn(&S::Key) -> bool + 'static) -> Self
Source§fn selected(self, f: impl Fn() -> Vec<S::Key> + 'static) -> Self
fn selected(self, f: impl Fn() -> Vec<S::Key> + 'static) -> Self
Self::on_selection at one signal and selection is two-way, shared with anything
else reading the same state.Source§fn on_selection(self, f: impl Fn(Vec<S::Key>) + 'static) -> Self
fn on_selection(self, f: impl Fn(Vec<S::Key>) + 'static) -> Self
Source§fn multi_select(self) -> Self
fn multi_select(self) -> Self
Source§fn type_ahead(self, f: impl Fn(&S::Key) -> String + 'static) -> Self
fn type_ahead(self, f: impl Fn(&S::Key) -> String + 'static) -> Self
Source§fn reveal(self, target: impl Binding<Option<S::Key>>) -> Self
fn reveal(self, target: impl Binding<Option<S::Key>>) -> Self
Some(key) and the row scrolls into view with
every ancestor expanded (through Self::expanded, so the app sees the change).Source§fn row_id(self, f: impl Fn(&S::Key) -> ElementId + 'static) -> Self
fn row_id(self, f: impl Fn(&S::Key) -> ElementId + 'static) -> Self
tap/assert_text address the row wherever its cell currently sits. It
is also what the expand:/tree_move: steps resolve rows by.Source§impl<DecoratedInner: VectorBuilder + Piece> VectorBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: VectorBuilder + Piece> VectorBuilder for Decorated<DecoratedInner>
Source§fn tint<M>(self, color: impl IntoReactive<Color, M>) -> Self
fn tint<M>(self, color: impl IntoReactive<Color, M>) -> Self
Source§fn weight(self, w: VectorWeight) -> Self
fn weight(self, w: VectorWeight) -> Self
VectorWeight).Source§fn decorative(self) -> Self
fn decorative(self) -> Self
Source§impl<DecoratedInner: WhenBuilder + Piece> WhenBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: WhenBuilder + Piece> WhenBuilder for Decorated<DecoratedInner>
Source§impl<DecoratedInner: ZStackBuilder + Piece> ZStackBuilder for Decorated<DecoratedInner>
impl<DecoratedInner: ZStackBuilder + Piece> ZStackBuilder for Decorated<DecoratedInner>
Source§fn align(self, a: Alignment) -> Self
fn align(self, a: Alignment) -> Self
Alignment::Center).Auto Trait Implementations§
impl<P> !RefUnwindSafe for Decorated<P>
impl<P> !Send for Decorated<P>
impl<P> !Sync for Decorated<P>
impl<P> !UnwindSafe for Decorated<P>
impl<P> Freeze for Decorated<P>where
P: Freeze,
impl<P> Unpin for Decorated<P>where
P: Unpin,
impl<P> UnsafeUnpin for Decorated<P>where
P: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<P> Decorate for Pwhere
P: Piece,
impl<P> Decorate for Pwhere
P: Piece,
Source§fn id(self, id: ElementId) -> Decorated<Self>
fn id(self, id: ElementId) -> Decorated<Self>
Source§fn wrapper_id(self, id: ElementId) -> Decorated<Self>
fn wrapper_id(self, id: ElementId) -> Decorated<Self>
id.Source§fn apply_if(
self,
cond: bool,
f: impl FnOnce(Decorated<Self>) -> Decorated<Self>,
) -> Decorated<Self>
fn apply_if( self, cond: bool, f: impl FnOnce(Decorated<Self>) -> Decorated<Self>, ) -> Decorated<Self>
f to the chain when cond holds, else continue unchanged
(see Decorated::apply_if): nav(sel).apply_if(!primary, |n| n.local()). The
closure receives the decorated piece, so forwarded builder methods and modifiers both
chain inside it.Source§fn apply_some<T>(
self,
value: Option<T>,
f: impl FnOnce(Decorated<Self>, T) -> Decorated<Self>,
) -> Decorated<Self>
fn apply_some<T>( self, value: Option<T>, f: impl FnOnce(Decorated<Self>, T) -> Decorated<Self>, ) -> Decorated<Self>
f with the value when there is one, else continue unchanged
(see Decorated::apply_some): canvas(draw).apply_some(id, |c, id| c.id(id)).Source§fn id_of(self, id: impl Fn() -> ElementId + 'static) -> Decorated<Self>
fn id_of(self, id: impl Fn() -> ElementId + 'static) -> Decorated<Self>
list. A plain
id is assigned once at build, but a recycled cell rebinds to different
items over its life (and drag-to-reorder rebinds eagerly), so a static item-derived id
keeps naming the first-bound item. This variant re-registers whenever the closure’s
value changes; read your ItemSlot inside it:
.id_of(move || day_core::id!(row_remove, slot.key())).Source§fn tweak(self, f: impl FnOnce(RNode) + 'static) -> Decorated<Self>
fn tweak(self, f: impl FnOnce(RNode) + 'static) -> Decorated<Self>
f runs once at mount, after the native widget exists, with the
realized node (docs/tweaks.md). Reach the typed native handle through the compiled
backend’s ext accessor (day_appkit::with_native, day_gtk::with_native, …), or apply
a packaged day-tweak-* crate’s modifier instead of calling this directly. If the native
change affects the widget’s intrinsic size, follow it with
day_core::invalidate_size. Day may overwrite managed properties (title, value,
enabled, frame, a11y) on its next patch; unmanaged properties are stable. Read moreSource§fn selectable(self) -> Decorated<Self>
fn selectable(self) -> Decorated<Self>
Source§fn cursor<M>(self, cursor: impl IntoReactive<Cursor, M>) -> Decorated<Self>
fn cursor<M>(self, cursor: impl IntoReactive<Cursor, M>) -> Decorated<Self>
Cursor constant, a Signal<Cursor>, or a closure, so a canvas tool or a busy state
moves the shape without rebuilding the piece. The nearest ancestor’s cursor wins, and
Cursor::Default releases the piece back to the platform. capability(Cap::Cursor)
says whether this toolkit draws the requested shapes, a nearest neighbor, or nothing;
a touch-only host never shows one, which is correct rather than a failure.Source§fn window_drag_region(self) -> Decorated<Self>
fn window_drag_region(self) -> Decorated<Self>
WindowChrome::Overlay or
WindowChrome::Frameless window needs. The piece’s own background starts the drag,
with the platform’s snapping and tiling; buttons and fields inside it keep their clicks;
a double click does what the user’s title-bar setting says (zoom, minimize, nothing).
capability(Cap::DragRegion); on a phone the piece is an ordinary view.Source§fn native_ref(self, r: &NativeRef) -> Decorated<Self>
fn native_ref(self, r: &NativeRef) -> Decorated<Self>
NativeRef to this piece’s realized node for later imperative access
(docs/tweaks.md). The ref clears automatically when the piece’s scope is disposed.fn padding(self, insets: impl IntoInsets) -> Decorated<Self>
Source§fn max_width(self, max: f64) -> Decorated<Self>
fn max_width(self, max: f64) -> Decorated<Self>
max points: the child is never PROPOSED more, so text
wraps inside the cap (chat bubbles, readable columns) while narrower content hugs.Source§fn reserving(self, sample: impl Into<String>) -> Decorated<Self>
fn reserving(self, sample: impl Into<String>) -> Decorated<Self>
sample needs, so this piece’s size stops changing with its
content. Read morefn frame(self, width: f64, height: f64) -> Decorated<Self>
Source§fn width(self, width: f64) -> Decorated<Self>
fn width(self, width: f64) -> Decorated<Self>
width points while its height stays flexible (hugging its
content or filling on the cross axis). The single-axis complement to Self::frame, e.g.
a fixed-width sidebar pane in a row whose height fills the window.Source§fn height(self, height: f64) -> Decorated<Self>
fn height(self, height: f64) -> Decorated<Self>
height points while its width stays flexible. The single-axis
complement to Self::frame, e.g. a fixed-height header/toolbar bar that fills its width.fn a11y( self, f: impl FnOnce(A11yBuilder) -> A11yBuilder + 'static, ) -> Decorated<Self>
Source§fn on_tap(self, f: impl Fn() + 'static) -> Decorated<Self>
fn on_tap(self, f: impl Fn() + 'static) -> Decorated<Self>
Source§fn focused<M>(self, binding: impl IntoFocusBinding<M>) -> Decorated<Self>
fn focused<M>(self, binding: impl IntoFocusBinding<M>) -> Decorated<Self>
Signal<bool> for one control, or (Signal<Option<K>>, K::Variant) binding one control
of a group; writing false/None resigns focus (dismissing the soft keyboard on
mobile). Focus applies asynchronously: a write is a request, resolved on the next turn,
and the signal always ends up reflecting what the platform actually did.Source§fn on_key(self, f: impl Fn(&KeyEvent) + 'static) -> Decorated<Self>
fn on_key(self, f: impl Fn(&KeyEvent) + 'static) -> Decorated<Self>
Decorate::focused or with a
piece the user can click into: a canvas takes focus on a press, and only the focused
piece hears the keys, so a nudge handler can never fire while a text field, a list or a
sidebar is the one being typed into. Read moreSource§fn toolbar<M>(self, content: impl ToolbarContent<M>) -> Decorated<Self>
fn toolbar<M>(self, content: impl ToolbarContent<M>) -> Decorated<Self>
Source§fn searchable(self, search: Search) -> Decorated<Self>
fn searchable(self, search: Search) -> Decorated<Self>
UISearchController), its app bar on Android. It shows while this page does, and
its text is the app’s query both ways. For a search the server runs, act on
crate::Search::on_submit; for a local filter, read the query. Declare it on a
nav_stack destination, as .toolbar(…) is declared; a whole navigation surface takes
crate::Nav::searchable instead.Source§fn focusable(self) -> Decorated<Self>
fn focusable(self) -> Decorated<Self>
.focused(…), and hears the arrows through .on_key(…) while focused. A composed
list column is the motivating case (docs/navigation.md). On a backend without the
set_focusable duty the piece renders normally and never takes focus.Source§fn drag_source(
self,
source: impl Fn(Point) -> Option<Offer> + 'static,
) -> Decorated<Self>
fn drag_source( self, source: impl Fn(Point) -> Option<Offer> + 'static, ) -> Decorated<Self>
menu_item/sub_menu/menu_role/
menu_separator. Passing an empty Vec removes any menu.fn drop_target(self, target: Target) -> Decorated<Self>
menu_item/sub_menu entries as everywhere else. Takes a fixed list, or a closure
built when the menu is summoned (“Dynamic context menus”): with no argument, or with the
summon point in this piece’s own coordinates, so a canvas can select what is under the
pointer and offer commands for that selection. An empty result shows nothing. Read morefn on_drag(self, f: impl Fn(Drag) + 'static) -> Decorated<Self>
Source§fn on_pinch(self, f: impl Fn(Pinch) + 'static) -> Decorated<Self>
fn on_pinch(self, f: impl Fn(Pinch) + 'static) -> Decorated<Self>
Source§fn on_pan(self, f: impl Fn(Pan) + 'static) -> Decorated<Self>
fn on_pan(self, f: impl Fn(Pan) + 'static) -> Decorated<Self>
delta is incremental; apply it
as it arrives.Source§fn on_hover(self, f: impl Fn(Option<Point>) + 'static) -> Decorated<Self>
fn on_hover(self, f: impl Fn(Option<Point>) + 'static) -> Decorated<Self>
Some(point) in its own coordinates while inside,
None when it leaves (docs/canvas.md “Interaction”). Pointer-only; wire on_tap_at
alongside it so a touch-only device can reach the same thing.Source§fn card(self) -> Decorated<Self>
fn card(self) -> Decorated<Self>
Color, a Signal<Color>, or a Fn() -> Color; a
reactive color repaints the surface when its source changes. Wraps the piece in a native
container that carries the fill, so it composes with Self::corner_radius for a rounded
colored surface and with Self::padding for interior inset.
The platform’s card around this piece: the grouped-content surface with rounded
corners and a Space::M inset (see Decorated::card).fn background<M>(self, color: impl IntoReactive<Color, M>) -> Decorated<Self>
Source§fn corner_radius(self, radius: f64) -> Decorated<Self>
fn corner_radius(self, radius: f64) -> Decorated<Self>
radius points, clipping its background and content to the
rounded rectangle. Compose after Self::background for a rounded colored surface, or use
alone to round a clipped child (e.g. an avatar image).Source§fn opacity<M>(self, opacity: impl IntoReactive<f64, M>) -> Decorated<Self>
fn opacity<M>(self, opacity: impl IntoReactive<f64, M>) -> Decorated<Self>
0.0 transparent … 1.0 opaque). Wrapped in a native
layer so it composes with .background; the change animates when made inside
with_animation or under a .animation ancestor (§8.4).Source§fn transform<M>(self, t: impl IntoReactive<Transform, M>) -> Decorated<Self>
fn transform<M>(self, t: impl IntoReactive<Transform, M>) -> Decorated<Self>
Transform (translate/scale/rotate about the center): the cheap
movement/scaling channel that never triggers relayout (§8.4). Prefer this over .offset
for animated motion.Source§fn scale<M>(self, factor: impl IntoReactive<f64, M>) -> Decorated<Self>
fn scale<M>(self, factor: impl IntoReactive<f64, M>) -> Decorated<Self>
factor about its center (animatable). Convenience over
Self::transform.Source§fn rotation<M>(self, degrees: impl IntoReactive<f64, M>) -> Decorated<Self>
fn rotation<M>(self, degrees: impl IntoReactive<f64, M>) -> Decorated<Self>
degrees clockwise about its center (animatable).Source§fn translation<Mx, My>(
self,
x: impl IntoReactive<f64, Mx>,
y: impl IntoReactive<f64, My>,
) -> Decorated<Self>
fn translation<Mx, My>( self, x: impl IntoReactive<f64, Mx>, y: impl IntoReactive<f64, My>, ) -> Decorated<Self>
x, y) points without relayout (animatable): the
animation-friendly sibling of .offset.Source§fn animation(self, anim: AnimSpec) -> Decorated<Self>
fn animation(self, anim: AnimSpec) -> Decorated<Self>
anim even outside a with_animation. SwiftUI’s
.animation. The ambient with_animation takes precedence when both apply.Source§fn overlay(self, over: impl Piece) -> Decorated<Self>
fn overlay(self, over: impl Piece) -> Decorated<Self>
over on top of this piece, centered, without affecting layout size: a badge /
annotation overlay. self is the sizing content (bottom of the z-order); over is proposed
self’s size and drawn on top. For an explicit alignment use Self::overlay_aligned; for
a stack that sizes to the union of its children use zstack.Source§fn overlay_aligned(self, align: Alignment, over: impl Piece) -> Decorated<Self>
fn overlay_aligned(self, align: Alignment, over: impl Piece) -> Decorated<Self>
Self::overlay with an explicit Alignment for the annotation (e.g. a corner badge with
Alignment::TopTrailing).Source§fn aspect_ratio(self, ratio: f64) -> Decorated<Self>
fn aspect_ratio(self, ratio: f64) -> Decorated<Self>
width / height ratio: the largest box of that shape which
fits whatever the parent offers (SwiftUI’s .aspectRatio(_:contentMode: .fit)). Read moreSource§fn grow(self) -> Decorated<Self>
fn grow(self) -> Decorated<Self>
Flex: the stack
offers it the space and it fills; no native backing, so this is a pure layout change.Source§fn grid_align(self, a: Alignment) -> Decorated<Self>
fn grid_align(self, a: Alignment) -> Decorated<Self>
grid
(docs/grid.md). Apply last (outermost), like Decorated::grid_span.Source§fn defers_system_gestures(self, edges: Edges) -> Decorated<Self>
fn defers_system_gestures(self, edges: Edges) -> Decorated<Self>
edges (docs/cover.md), the SwiftUI defersSystemGestures(on:)
analogue. Put it on a game or drawing surface whose touches run to the screen edge,
so a swipe up from the bottom doesn’t leave the app. iOS defers the chosen edges’
system gestures; Android enters swipe-to-reveal immersive mode while any subtree
requests deferral; desktop backends no-op.hidden is true, hide the system status bar, the
SwiftUI statusBarHidden(_:) analogue (docs/cover.md). hidden is a constant, a
Signal, or a closure, so a setting can turn it on and off in place. Put it on a page
that wants the whole screen (a reader, a game, a photo viewer); the bar returns when
the page unmounts. Any mounted request that answers true hides the bar. iOS, Android and
HarmonyOS hide it (Cap::StatusBarHidden); desktop and web have none and ignore it.Source§fn interactive_dismiss_disabled(self) -> Decorated<Self>
fn interactive_dismiss_disabled(self) -> Decorated<Self>
cover (or other modal surface) must
not be dismissed interactively, the SwiftUI interactiveDismissDisabled() analogue
(docs/cover.md). System back / sheet gestures are ignored; only programmatic writes
(an explicit close control) dismiss it.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more