mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 00:57:26 +00:00
docs: regenerate contract-api for the drag payloads, CollectionEvent::Picked and CollectionKind::Picked
This commit is contained in:
@@ -2017,13 +2017,14 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st
|
||||
- `pub const fn new() -> Self`. A collapsible body that starts open, animated.
|
||||
- `pub const fn initially_open(mut self, on: bool) -> Self`. Whether the body starts open.
|
||||
- `pub const fn animated(mut self, on: bool) -> Self`. Whether opening and closing animate.
|
||||
- `craft_ui::contract::CollectionEvent`: `pub enum CollectionEvent<K, E> { Selection { change: SelectionChange<K>, by: LeadSource, mods: craft_keymap::Mods }, LeadMoved { key: K, by: LeadSource }, Activate(K), Rested(K), EmptyActivated, EmptyContextMenu { at: Pos2 }, Preview(K), ContextMenu(ContextMenuRequest<K>), EdgePressed { above: K, below: K, mods: craft_keymap::Mods }, CommandClick { key: K, mods: craft_keymap::Mods }, Delete(Vec<K>), Open(OpenChange<K>), Reorder(EditEvent<ReorderMove<K>>), Move(EditEvent<Vec2>), Dropped { at: DropAt<K>, op: DropOperation, payload: DropPayload }, Zoom { factor: f32, about: Pos2 }, Rename(EditEvent<Rename<K>>), Toggle(EditEvent<ToggleEdit<K>>), Column(ColumnEvent), Item(K, E) }`. What a collection reports, in drawing order.
|
||||
- `craft_ui::contract::CollectionProps`: `pub struct CollectionProps { pub select: SelectMode, pub reorder: Option<ReorderRule>, pub rename: bool, pub rename_column: Option<ColumnKey>, pub slow_click_rename: bool, pub columns: Vec<ColumnSpec>, pub sort: Option<ColumnSort>, pub empty: Option<Label>, pub activate: ActivateOn, pub striped: bool, pub allow_empty: bool, pub lead_on_open: LeadOnOpen, pub hover_lead: HoverLead, pub arrows_select: bool, pub focus_on_press: bool, pub rows_stamp: Option<u64>, pub space: SpaceAction, pub type_ahead: bool, pub arrows_wrap: bool, pub header: bool, pub digit_keys: bool, pub menu_on_click: bool, pub item_keys: ItemKeys, pub marquee: bool, pub deletable: bool, pub drag_payload: Option<DragPayload>, pub drag_count: Option<Counted>, pub natural_height: bool, pub min_rows: u16, pub max_rows: Option<u16>, pub row_height: RowHeight, pub command_click: bool, pub notch: Option<Notch>, pub overflow: Axis, pub pages: bool, pub current: Option<Arc<dyn Any + Send + Sync>>, pub select_under_drag: bool, pub scroll_anchor: ScrollAnchor }`. What a collection reads from the app: plain data. A new builder's name is added to the forwarder list in
|
||||
- `craft_ui::contract::CollectionEvent`: `pub enum CollectionEvent<K, E> { Selection { change: SelectionChange<K>, by: LeadSource, mods: craft_keymap::Mods }, Picked { key: K, mods: craft_keymap::Mods }, LeadMoved { key: K, by: LeadSource }, Activate(K), Rested(K), EmptyActivated, EmptyContextMenu { at: Pos2 }, Preview(K), ContextMenu(ContextMenuRequest<K>), EdgePressed { above: K, below: K, mods: craft_keymap::Mods }, CommandClick { key: K, mods: craft_keymap::Mods }, Delete(Vec<K>), Open(OpenChange<K>), Reorder(EditEvent<ReorderMove<K>>), Move(EditEvent<Vec2>), Dropped { at: DropAt<K>, op: DropOperation, payload: DropPayload }, Zoom { factor: f32, about: Pos2 }, Rename(EditEvent<Rename<K>>), Toggle(EditEvent<ToggleEdit<K>>), Column(ColumnEvent), Item(K, E) }`. What a collection reports, in drawing order.
|
||||
- `craft_ui::contract::CollectionProps`: `pub struct CollectionProps { pub select: SelectMode, pub reorder: Option<ReorderRule>, pub rename: bool, pub rename_column: Option<ColumnKey>, pub slow_click_rename: bool, pub columns: Vec<ColumnSpec>, pub sort: Option<ColumnSort>, pub empty: Option<Label>, pub activate: ActivateOn, pub striped: bool, pub allow_empty: bool, pub lead_on_open: LeadOnOpen, pub hover_lead: HoverLead, pub arrows_select: bool, pub focus_on_press: bool, pub rows_stamp: Option<u64>, pub space: SpaceAction, pub type_ahead: bool, pub arrows_wrap: bool, pub header: bool, pub digit_keys: bool, pub menu_on_click: bool, pub item_keys: ItemKeys, pub marquee: bool, pub deletable: bool, pub drag_payloads: Vec<DragPayload>, pub drag_count: Option<Counted>, pub natural_height: bool, pub min_rows: u16, pub max_rows: Option<u16>, pub row_height: RowHeight, pub command_click: bool, pub notch: Option<Notch>, pub overflow: Axis, pub pages: bool, pub current: Option<Arc<dyn Any + Send + Sync>>, pub select_under_drag: bool, pub scroll_anchor: ScrollAnchor }`. What a collection reads from the app: plain data. A new builder's name is added to the forwarder list in
|
||||
- `pub const fn new() -> Self`. Collection props with every setting at its default.
|
||||
- `pub const fn select_under_drag(mut self, on: bool) -> Self`. Whether a foreign drag resting over an unselected item selects it (`select_under_drag`).
|
||||
- `pub fn select(mut self, mode: SelectMode) -> Self`. What can be selected.
|
||||
- `pub fn reorder(mut self, rule: ReorderRule) -> Self`. Items reorder by `rule`.
|
||||
- `pub fn drag_payload<K: 'static, P: Send + Sync + 'static>(mut self, map: impl Fn(&ListDrag<K>) -> Option<P> + Send + Sync + 'static) -> Self`. A row drag carries `map` of it, for the drop targets of type `P`; a row the map gives `None` for does not drag
|
||||
- `pub fn drag_payload<K: 'static, P: Send + Sync + 'static>(self, map: impl Fn(&ListDrag<K>) -> Option<P> + Send + Sync + 'static) -> Self`. A row drag carries `map` of it, for the drop targets of type `P`; a row the map gives `None` for does not drag
|
||||
- `pub fn carry(mut self, payload: DragPayload) -> Self`. A row drag carries `payload` of it too, beside the payloads given before: a host adds its own payload type to a
|
||||
- `pub const fn drag_count(mut self, count: Counted) -> Self`. The drag badge reads `count` for the number of dragged items.
|
||||
- `pub const fn pages(mut self, on: bool) -> Self`. The items are pages (`CollectionProps::pages`).
|
||||
- `pub fn rename(mut self, on: bool) -> Self`. Rename runs through the collection's editor.
|
||||
@@ -2522,7 +2523,7 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st
|
||||
- `fn cursor(&mut self, cursor: impl Into<Cursor>, priority: CursorPriority)`. Requests `cursor` at `priority`; the highest priority of the pass wins.
|
||||
- `fn cancel_press(&mut self, reason: PressCancel)`. Ends every captured press of this viewport.
|
||||
- `fn start_drag<P: Clone + Send + Sync + 'static>(&mut self, payload: P, preview: DragPreview)`. Starts the drag session with `payload`; the context holds one session at a time, and a running one stays.
|
||||
- `fn start_drag_also<P: Clone + Send + Sync + 'static>(&mut self, payload: P, also: Arc<dyn std::any::Any + Send + Sync>, preview: DragPreview)`. Starts the drag session with `payload`, which also carries `also`: targets of either type see the one drag.
|
||||
- `fn start_drag_also<P: Clone + Send + Sync + 'static>(&mut self, payload: P, also: Vec<Arc<dyn std::any::Any + Send + Sync>>, preview: DragPreview,)`. Starts the drag session with `payload`, which also carries the payloads `also`, one per type: targets of any of
|
||||
- `fn dragging<P: Send + Sync + 'static>(&self) -> Option<(Arc<P>, Pos2)>`. The active drag payload of type `P` and the pointer position in this component's egui layer space (8.3), from any
|
||||
- `fn drop_target<P: Send + Sync + 'static, T: DropTarget<P>>(&mut self, target: &T) -> Option<T::Drop>`. Registers `target` over this component's rect for this pass, in `update`. Returns the drop released over it this
|
||||
- `fn window_drop_target<P: Send + Sync + 'static, T: WindowDropTarget<P>>(&mut self, target: &T) -> Option<T::Drop>`. Registers `target` over the whole window of the running viewport for this pass, in `update`; a target over a
|
||||
@@ -3650,7 +3651,7 @@ The drag session (8.4): one per context. It holds the payload, the preview, the
|
||||
- `fn accept(&self, payload: &P, op: DropOperation) -> Option<Self::Drop>`. `None` rejects. `op` is the operation the held modifiers pick, which a target may refuse.
|
||||
- `fn mark(&self, drop: &Self::Drop) -> DropMark`. Where `drop` would land, a value the ghost layer paints.
|
||||
- `craft_ui::runtime::drag::active`: `pub fn active<P: Send + Sync + 'static>(ctx: &Context) -> Option<Arc<P>>`. The active drag payload of type `P`, from any viewport. For code without a `Cx`.
|
||||
- `craft_ui::runtime::drag::amend`: `pub fn amend<P: Clone + Send + Sync + 'static>(ctx: &Context, change: impl FnOnce(&mut P)) -> bool`. Changes the running session's payload of type `P` (or its second payload of that type) with `change`, in the frame
|
||||
- `craft_ui::runtime::drag::amend`: `pub fn amend<P: Clone + Send + Sync + 'static>(ctx: &Context, change: impl FnOnce(&mut P)) -> bool`. Changes the running session's payload of type `P` (or its further payload of that type) with `change`, in the frame
|
||||
- `craft_ui::runtime::drag::cancel`: `pub fn cancel(ctx: &Context, reason: CancelReason)`. Ends the session without a drop; the source's press ends with it, so nobody gets a drop.
|
||||
- `craft_ui::runtime::drag::mark`: `pub fn mark(ctx: &Context) -> Option<DropMark>`. The mark of the target that would take a drop now, in screen space: `None` while no target accepts the payload.
|
||||
- `craft_ui::runtime::drag::zone_target`: `pub fn zone_target<P: Send + Sync + 'static, T: DropTarget<P>>(ui: &egui::Ui, owner: Id, zone: DropZone, target: &T) -> Option<T::Drop>`. `Pointer::drop_target` over a zone the caller names instead of its own visible rect: the drop of a payload of type
|
||||
@@ -5134,7 +5135,7 @@ Stories rendered to images offscreen: egui's wgpu test renderer over what [`Fram
|
||||
|
||||
Stories: named ways to show one registered type, and the data and output the runner reads from them.
|
||||
|
||||
- `craft_ui::testing::story::CollectionKind`: `pub enum CollectionKind { Selection, LeadMoved, Rested, Activate, EmptyActivated, EmptyContextMenu, EdgePressed, Preview, ContextMenu, CommandClick, Delete, Open, Reorder(EditKind), Move(EditKind), Dropped, Zoom, Rename(EditKind), Toggle(EditKind), Column, Item }`. The kind of a collection event, with the edit kind of the events that carry one.
|
||||
- `craft_ui::testing::story::CollectionKind`: `pub enum CollectionKind { Selection, Picked, LeadMoved, Rested, Activate, EmptyActivated, EmptyContextMenu, EdgePressed, Preview, ContextMenu, CommandClick, Delete, Open, Reorder(EditKind), Move(EditKind), Dropped, Zoom, Rename(EditKind), Toggle(EditKind), Column, Item }`. The kind of a collection event, with the edit kind of the events that carry one.
|
||||
- `pub fn of<K, E>(event: &CollectionEvent<K, E>) -> Option<CollectionKind>`. The kind of `event`, `None` for an edit event of a kind the runner does not know.
|
||||
- `craft_ui::testing::story::Drive`: `pub enum Drive { Auto, Activate, Step, Drag(Grip), DragChild(Grip), Type(&'static str), Pick { row: usize }, Custom(fn(&mut Fixture)), Never }`. How the runner changes the value a story shows.
|
||||
- `craft_ui::testing::story::EditKind`: `pub enum EditKind { Begin, Update, Commit, Cancel, Set }`. The kind of an edit event.
|
||||
|
||||
Reference in New Issue
Block a user