mirror of https://github.com/linebender/xilem
parent
ef5d9afec3
commit
3d8c7950e4
|
@ -7,9 +7,10 @@ use std::collections::{HashMap, HashSet};
|
|||
use std::fmt::Display;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::Rect;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::Rect;
|
||||
|
||||
pub type MyWidgetId = u32;
|
||||
|
||||
#[derive(Clone, Copy, Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||||
|
@ -171,9 +172,10 @@ mod serde_arc {
|
|||
}
|
||||
|
||||
mod serde_rect {
|
||||
use crate::Rect;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
|
||||
use crate::Rect;
|
||||
|
||||
pub fn serialize<S: Serializer>(value: &Rect, serializer: S) -> Result<S::Ok, S::Error> {
|
||||
let value = (value.x0, value.y0, value.x1, value.y1);
|
||||
value.serialize(serializer)
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
|
||||
//! Events.
|
||||
|
||||
use crate::dpi::{LogicalPosition, PhysicalPosition, PhysicalSize};
|
||||
use crate::kurbo::Rect;
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use winit::event::{Force, Ime, KeyEvent, Modifiers};
|
||||
use winit::keyboard::ModifiersState;
|
||||
|
||||
use crate::dpi::{LogicalPosition, PhysicalPosition, PhysicalSize};
|
||||
use crate::kurbo::Rect;
|
||||
|
||||
// TODO - Occluded(bool) event
|
||||
// TODO - winit ActivationTokenDone thing
|
||||
// TODO - Suspended/Resume/NewEvents/MemoryWarning
|
||||
|
|
|
@ -7,8 +7,9 @@ use std::sync::Arc;
|
|||
use accesskit_winit::Adapter;
|
||||
use tracing::{debug, warn};
|
||||
use vello::kurbo::Affine;
|
||||
use vello::peniko::Color;
|
||||
use vello::util::{RenderContext, RenderSurface};
|
||||
use vello::{peniko::Color, AaSupport, RenderParams, Renderer, RendererOptions, Scene};
|
||||
use vello::{AaSupport, RenderParams, Renderer, RendererOptions, Scene};
|
||||
use wgpu::PresentMode;
|
||||
use winit::application::ApplicationHandler;
|
||||
use winit::error::EventLoopError;
|
||||
|
|
|
@ -103,7 +103,6 @@
|
|||
|
||||
// TODO - Add logo
|
||||
|
||||
pub use cursor_icon::{CursorIcon, ParseError as CursorIconParseError};
|
||||
pub use dpi;
|
||||
pub use parley;
|
||||
pub use vello;
|
||||
|
@ -138,6 +137,7 @@ pub use contexts::{
|
|||
AccessCtx, ComposeCtx, EventCtx, IsContext, LayoutCtx, MutateCtx, PaintCtx, QueryCtx,
|
||||
RawWrapper, RawWrapperMut, RegisterCtx, UpdateCtx,
|
||||
};
|
||||
pub use cursor_icon::{CursorIcon, ParseError as CursorIconParseError};
|
||||
pub use event::{
|
||||
AccessEvent, PointerButton, PointerEvent, PointerState, StatusChange, TextEvent, Update,
|
||||
WindowEvent, WindowTheme,
|
||||
|
@ -145,11 +145,9 @@ pub use event::{
|
|||
pub use kurbo::{Affine, Insets, Point, Rect, Size, Vec2};
|
||||
pub use parley::fontique::Weight as TextWeight;
|
||||
pub use parley::layout::Alignment as TextAlignment;
|
||||
pub use text::ArcStr;
|
||||
pub use util::{AsAny, Handled};
|
||||
pub use vello::peniko::{Color, Gradient};
|
||||
pub use widget::widget::{AllowRawMut, Widget, WidgetId};
|
||||
pub use widget::WidgetPod;
|
||||
|
||||
pub use text::ArcStr;
|
||||
|
||||
pub(crate) use widget::WidgetState;
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use vello::{
|
||||
kurbo::{self, Affine, Rect, Shape, Stroke},
|
||||
peniko::{BrushRef, Color, ColorStopsSource, Fill, Gradient},
|
||||
Scene,
|
||||
};
|
||||
use vello::kurbo::{self, Affine, Rect, Shape, Stroke};
|
||||
use vello::peniko::{BrushRef, Color, ColorStopsSource, Fill, Gradient};
|
||||
use vello::Scene;
|
||||
|
||||
// TODO - Remove this file
|
||||
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
// Copyright 2024 the Xilem Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::render_root::RenderRoot;
|
||||
use accesskit::{NodeBuilder, NodeId, TreeUpdate};
|
||||
use tracing::debug;
|
||||
use tracing::info_span;
|
||||
use tracing::trace;
|
||||
use tracing::{debug, info_span, trace};
|
||||
use vello::kurbo::Rect;
|
||||
|
||||
use crate::passes::recurse_on_children;
|
||||
use crate::render_root::RenderRootState;
|
||||
use crate::render_root::{RenderRoot, RenderRootState};
|
||||
use crate::tree_arena::ArenaMut;
|
||||
use crate::{AccessCtx, Widget, WidgetState};
|
||||
|
||||
|
|
|
@ -35,8 +35,7 @@ use crate::passes::update::{
|
|||
};
|
||||
use crate::text::TextBrush;
|
||||
use crate::tree_arena::{ArenaMut, TreeArena};
|
||||
use crate::widget::WidgetArena;
|
||||
use crate::widget::{WidgetMut, WidgetRef, WidgetState};
|
||||
use crate::widget::{WidgetArena, WidgetMut, WidgetRef, WidgetState};
|
||||
use crate::{AccessEvent, Action, CursorIcon, Handled, QueryCtx, Widget, WidgetId, WidgetPod};
|
||||
|
||||
// --- MARK: STRUCTS ---
|
||||
|
|
|
@ -23,7 +23,8 @@ use crate::dpi::{LogicalPosition, PhysicalPosition, PhysicalSize};
|
|||
use crate::event::{PointerButton, PointerEvent, PointerState, TextEvent, WindowEvent};
|
||||
use crate::passes::anim::run_update_anim_pass;
|
||||
use crate::render_root::{RenderRoot, RenderRootOptions, RenderRootSignal, WindowSizePolicy};
|
||||
use crate::testing::{screenshots::get_image_diff, snapshot_utils::get_cargo_workspace};
|
||||
use crate::testing::screenshots::get_image_diff;
|
||||
use crate::testing::snapshot_utils::get_cargo_workspace;
|
||||
use crate::tracing_backend::try_init_test_tracing;
|
||||
use crate::widget::{WidgetMut, WidgetRef};
|
||||
use crate::{Color, Handled, Point, Size, Vec2, Widget, WidgetId};
|
||||
|
|
|
@ -4,11 +4,9 @@
|
|||
//! Helper functions for working with text in Masonry.
|
||||
|
||||
use parley::Layout;
|
||||
use vello::{
|
||||
kurbo::{Affine, Line, Rect, Stroke},
|
||||
peniko::Fill,
|
||||
Scene,
|
||||
};
|
||||
use vello::kurbo::{Affine, Line, Rect, Stroke};
|
||||
use vello::peniko::Fill;
|
||||
use vello::Scene;
|
||||
|
||||
use crate::text::TextBrush;
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ use crate::action::Action;
|
|||
use crate::event::PointerButton;
|
||||
use crate::paint_scene_helpers::{fill_lin_gradient, stroke, UnitPoint};
|
||||
use crate::widget::{Label, WidgetMut, WidgetPod};
|
||||
|
||||
use crate::{
|
||||
theme, AccessCtx, AccessEvent, ArcStr, BoxConstraints, EventCtx, Insets, LayoutCtx, PaintCtx,
|
||||
PointerEvent, Size, StatusChange, TextEvent, UpdateCtx, Widget, WidgetId,
|
||||
|
|
|
@ -12,7 +12,6 @@ use vello::Scene;
|
|||
use crate::action::Action;
|
||||
use crate::paint_scene_helpers::{fill_lin_gradient, stroke, UnitPoint};
|
||||
use crate::widget::{Label, WidgetMut};
|
||||
|
||||
use crate::{
|
||||
theme, AccessCtx, AccessEvent, ArcStr, BoxConstraints, EventCtx, LayoutCtx, PaintCtx,
|
||||
PointerEvent, RegisterCtx, StatusChange, TextEvent, UpdateCtx, Widget, WidgetId, WidgetPod,
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
use accesskit::{NodeBuilder, Role};
|
||||
use smallvec::SmallVec;
|
||||
use tracing::{trace_span, Span};
|
||||
use vello::kurbo::{common::FloatExt, Affine, Line, Stroke, Vec2};
|
||||
use vello::kurbo::common::FloatExt;
|
||||
use vello::kurbo::{Affine, Line, Stroke, Vec2};
|
||||
use vello::Scene;
|
||||
|
||||
use crate::theme::get_debug_color;
|
||||
use crate::widget::WidgetMut;
|
||||
|
||||
use crate::{
|
||||
AccessCtx, AccessEvent, BoxConstraints, EventCtx, LayoutCtx, PaintCtx, Point, PointerEvent,
|
||||
Rect, Size, StatusChange, TextEvent, UpdateCtx, Widget, WidgetId, WidgetPod,
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
//! A progress bar widget.
|
||||
|
||||
use crate::Point;
|
||||
use accesskit::{NodeBuilder, Role};
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use tracing::{trace_span, Span};
|
||||
|
@ -14,7 +13,7 @@ use crate::paint_scene_helpers::{fill_lin_gradient, stroke, UnitPoint};
|
|||
use crate::text::TextLayout;
|
||||
use crate::widget::WidgetMut;
|
||||
use crate::{
|
||||
theme, AccessCtx, AccessEvent, ArcStr, BoxConstraints, EventCtx, LayoutCtx, PaintCtx,
|
||||
theme, AccessCtx, AccessEvent, ArcStr, BoxConstraints, EventCtx, LayoutCtx, PaintCtx, Point,
|
||||
PointerEvent, RegisterCtx, StatusChange, TextEvent, Update, UpdateCtx, Widget, WidgetId,
|
||||
};
|
||||
|
||||
|
|
|
@ -2,22 +2,18 @@
|
|||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use accesskit::{NodeBuilder, Role};
|
||||
use parley::{
|
||||
layout::Alignment,
|
||||
style::{FontFamily, FontStack},
|
||||
};
|
||||
use parley::layout::Alignment;
|
||||
use parley::style::{FontFamily, FontStack};
|
||||
use smallvec::SmallVec;
|
||||
use tracing::{trace_span, Span};
|
||||
use vello::{
|
||||
kurbo::{Affine, Point, Size},
|
||||
peniko::BlendMode,
|
||||
Scene,
|
||||
};
|
||||
use vello::kurbo::{Affine, Point, Size};
|
||||
use vello::peniko::BlendMode;
|
||||
use vello::Scene;
|
||||
|
||||
use crate::text::{TextBrush, TextWithSelection};
|
||||
use crate::widget::label::LABEL_X_PADDING;
|
||||
use crate::widget::{LineBreaking, WidgetMut};
|
||||
use crate::{
|
||||
text::{TextBrush, TextWithSelection},
|
||||
widget::label::LABEL_X_PADDING,
|
||||
AccessCtx, AccessEvent, ArcStr, BoxConstraints, CursorIcon, EventCtx, LayoutCtx, PaintCtx,
|
||||
PointerEvent, RegisterCtx, StatusChange, TextEvent, Update, UpdateCtx, Widget, WidgetId,
|
||||
};
|
||||
|
|
|
@ -2,17 +2,13 @@
|
|||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use accesskit::{NodeBuilder, Role};
|
||||
use parley::{
|
||||
layout::Alignment,
|
||||
style::{FontFamily, FontStack},
|
||||
};
|
||||
use parley::layout::Alignment;
|
||||
use parley::style::{FontFamily, FontStack};
|
||||
use smallvec::SmallVec;
|
||||
use tracing::{trace_span, Span};
|
||||
use vello::{
|
||||
kurbo::{Affine, Point, Size, Stroke},
|
||||
peniko::{BlendMode, Color},
|
||||
Scene,
|
||||
};
|
||||
use vello::kurbo::{Affine, Point, Size, Stroke};
|
||||
use vello::peniko::{BlendMode, Color};
|
||||
use vello::Scene;
|
||||
use winit::event::Ime;
|
||||
|
||||
use crate::text::{TextBrush, TextEditor, TextWithSelection};
|
||||
|
|
|
@ -5,12 +5,11 @@ use masonry::widget::{CrossAxisAlignment, GridParams, MainAxisAlignment};
|
|||
use winit::dpi::LogicalSize;
|
||||
use winit::error::EventLoopError;
|
||||
use winit::window::Window;
|
||||
use xilem::view::{grid, Flex, FlexSequence, FlexSpacer, GridExt, GridSequence};
|
||||
use xilem::EventLoopBuilder;
|
||||
use xilem::{
|
||||
view::{button, flex, label, sized_box, Axis},
|
||||
EventLoop, WidgetView, Xilem,
|
||||
use xilem::view::{
|
||||
button, flex, grid, label, sized_box, Axis, Flex, FlexSequence, FlexSpacer, GridExt,
|
||||
GridSequence,
|
||||
};
|
||||
use xilem::{EventLoop, EventLoopBuilder, WidgetView, Xilem};
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
enum MathOperator {
|
||||
|
|
|
@ -5,11 +5,9 @@
|
|||
|
||||
use masonry::widget::MainAxisAlignment;
|
||||
use winit::error::EventLoopError;
|
||||
use xilem::{
|
||||
core::lens,
|
||||
view::{button, flex, label, Axis},
|
||||
EventLoop, WidgetView, Xilem,
|
||||
};
|
||||
use xilem::core::lens;
|
||||
use xilem::view::{button, flex, label, Axis};
|
||||
use xilem::{EventLoop, WidgetView, Xilem};
|
||||
|
||||
#[derive(Default)]
|
||||
struct AppState {
|
||||
|
|
|
@ -7,11 +7,9 @@
|
|||
|
||||
use masonry::widget::{CrossAxisAlignment, MainAxisAlignment};
|
||||
use winit::error::EventLoopError;
|
||||
use xilem::{
|
||||
core::{adapt, map_action, MessageResult},
|
||||
view::{button, flex, label, Axis},
|
||||
EventLoop, WidgetView, Xilem,
|
||||
};
|
||||
use xilem::core::{adapt, map_action, MessageResult};
|
||||
use xilem::view::{button, flex, label, Axis};
|
||||
use xilem::{EventLoop, WidgetView, Xilem};
|
||||
|
||||
#[derive(Default)]
|
||||
struct AppState {
|
||||
|
|
|
@ -7,22 +7,16 @@
|
|||
//! Support for more custom embeddings would be welcome, but needs more design work
|
||||
use std::sync::Arc;
|
||||
|
||||
use masonry::{
|
||||
app_driver::AppDriver,
|
||||
event_loop_runner::MasonryUserEvent,
|
||||
widget::{CrossAxisAlignment, MainAxisAlignment},
|
||||
ArcStr, Color,
|
||||
};
|
||||
use winit::{
|
||||
application::ApplicationHandler,
|
||||
error::EventLoopError,
|
||||
event::ElementState,
|
||||
keyboard::{KeyCode, PhysicalKey},
|
||||
};
|
||||
use xilem::{
|
||||
view::{button, flex, label, sized_box, Axis},
|
||||
EventLoop, MasonryProxy, WidgetView, Xilem,
|
||||
};
|
||||
use masonry::app_driver::AppDriver;
|
||||
use masonry::event_loop_runner::MasonryUserEvent;
|
||||
use masonry::widget::{CrossAxisAlignment, MainAxisAlignment};
|
||||
use masonry::{ArcStr, Color};
|
||||
use winit::application::ApplicationHandler;
|
||||
use winit::error::EventLoopError;
|
||||
use winit::event::ElementState;
|
||||
use winit::keyboard::{KeyCode, PhysicalKey};
|
||||
use xilem::view::{button, flex, label, sized_box, Axis};
|
||||
use xilem::{EventLoop, MasonryProxy, WidgetView, Xilem};
|
||||
|
||||
/// A component to make a bigger than usual button
|
||||
fn big_button(
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
// Copyright 2024 the Xilem Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use masonry::{
|
||||
widget::{CrossAxisAlignment, MainAxisAlignment},
|
||||
ArcStr,
|
||||
};
|
||||
use masonry::widget::{CrossAxisAlignment, MainAxisAlignment};
|
||||
use masonry::ArcStr;
|
||||
use winit::error::EventLoopError;
|
||||
use xilem::{
|
||||
view::{button, flex, label, sized_box, Axis, FlexExt as _, FlexSpacer},
|
||||
EventLoop, WidgetView, Xilem,
|
||||
};
|
||||
use xilem::view::{button, flex, label, sized_box, Axis, FlexExt as _, FlexSpacer};
|
||||
use xilem::{EventLoop, WidgetView, Xilem};
|
||||
|
||||
/// A component to make a bigger than usual button
|
||||
fn big_button(
|
||||
|
|
|
@ -7,15 +7,16 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use vello::peniko::{Blob, Image};
|
||||
use winit::{dpi::LogicalSize, error::EventLoopError, window::Window};
|
||||
use xilem::{
|
||||
core::{fork, one_of::OneOf3},
|
||||
view::{
|
||||
button, flex, image, portal, prose, sized_box, spinner, worker, Axis, CrossAxisAlignment,
|
||||
FlexExt, FlexSpacer,
|
||||
},
|
||||
Color, EventLoop, EventLoopBuilder, TextAlignment, WidgetView, Xilem,
|
||||
use winit::dpi::LogicalSize;
|
||||
use winit::error::EventLoopError;
|
||||
use winit::window::Window;
|
||||
use xilem::core::fork;
|
||||
use xilem::core::one_of::OneOf3;
|
||||
use xilem::view::{
|
||||
button, flex, image, portal, prose, sized_box, spinner, worker, Axis, CrossAxisAlignment,
|
||||
FlexExt, FlexSpacer,
|
||||
};
|
||||
use xilem::{Color, EventLoop, EventLoopBuilder, TextAlignment, WidgetView, Xilem};
|
||||
|
||||
/// The main state of the application.
|
||||
struct HttpCats {
|
||||
|
|
|
@ -6,15 +6,13 @@
|
|||
|
||||
use std::time::Duration;
|
||||
|
||||
use xilem::{
|
||||
core::{fork, run_once},
|
||||
tokio::time,
|
||||
view::{
|
||||
button, button_any_pointer, checkbox, flex, label, prose, task, textbox, Axis,
|
||||
FlexExt as _, FlexSpacer,
|
||||
},
|
||||
Color, EventLoop, EventLoopBuilder, TextAlignment, TextWeight, WidgetView, Xilem,
|
||||
use xilem::core::{fork, run_once};
|
||||
use xilem::tokio::time;
|
||||
use xilem::view::{
|
||||
button, button_any_pointer, checkbox, flex, label, prose, task, textbox, Axis, FlexExt as _,
|
||||
FlexSpacer,
|
||||
};
|
||||
use xilem::{Color, EventLoop, EventLoopBuilder, TextAlignment, TextWeight, WidgetView, Xilem};
|
||||
const LOREM: &str = r"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi cursus mi sed euismod euismod. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam placerat efficitur tellus at semper. Morbi ac risus magna. Donec ut cursus ex. Etiam quis posuere tellus. Mauris posuere dui et turpis mollis, vitae luctus tellus consectetur. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur eu facilisis nisl.
|
||||
|
||||
Phasellus in viverra dolor, vitae facilisis est. Maecenas malesuada massa vel ultricies feugiat. Vivamus venenatis et nibh nec pharetra. Phasellus vestibulum elit enim, nec scelerisque orci faucibus id. Vivamus consequat purus sit amet orci egestas, non iaculis massa porttitor. Vestibulum ut eros leo. In fermentum convallis magna in finibus. Donec justo leo, maximus ac laoreet id, volutpat ut elit. Mauris sed leo non neque laoreet faucibus. Aliquam orci arcu, faucibus in molestie eget, ornare non dui. Donec volutpat nulla in fringilla elementum. Aliquam vitae ante egestas ligula tempus vestibulum sit amet sed ante. ";
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use std::sync::Arc;
|
||||
use xilem::{
|
||||
core::{frozen, memoize},
|
||||
view::{button, flex},
|
||||
};
|
||||
|
||||
use xilem::core::{frozen, memoize};
|
||||
use xilem::view::{button, flex};
|
||||
use xilem::{AnyWidgetView, EventLoop, WidgetView, Xilem};
|
||||
|
||||
// There are currently two ways to do memoization
|
||||
|
|
|
@ -4,11 +4,9 @@
|
|||
//! A state machine to detect whether the button was pressed an even or an odd number of times.
|
||||
|
||||
use winit::error::EventLoopError;
|
||||
use xilem::{
|
||||
core::one_of::{OneOf, OneOf3},
|
||||
view::{button, flex, label, prose, sized_box, spinner},
|
||||
EventLoop, WidgetView, Xilem,
|
||||
};
|
||||
use xilem::core::one_of::{OneOf, OneOf3};
|
||||
use xilem::view::{button, flex, label, prose, sized_box, spinner};
|
||||
use xilem::{EventLoop, WidgetView, Xilem};
|
||||
|
||||
/// The state of the entire application.
|
||||
///
|
||||
|
|
|
@ -3,20 +3,20 @@
|
|||
|
||||
//! A stopwatch to display elapsed time.
|
||||
|
||||
use std::ops::{Add, Sub};
|
||||
use std::time::{Duration, SystemTime};
|
||||
|
||||
use masonry::dpi::LogicalSize;
|
||||
use masonry::event_loop_runner::{EventLoop, EventLoopBuilder};
|
||||
use masonry::widget::{Axis, CrossAxisAlignment, MainAxisAlignment};
|
||||
use std::ops::{Add, Sub};
|
||||
use std::time::{Duration, SystemTime};
|
||||
use tokio::time;
|
||||
use tracing::warn;
|
||||
use winit::error::EventLoopError;
|
||||
use winit::window::Window;
|
||||
use xilem::{
|
||||
core::{fork, one_of::Either},
|
||||
view::{button, flex, label, task, FlexSequence, FlexSpacer},
|
||||
WidgetView, Xilem,
|
||||
};
|
||||
use xilem::core::fork;
|
||||
use xilem::core::one_of::Either;
|
||||
use xilem::view::{button, flex, label, task, FlexSequence, FlexSpacer};
|
||||
use xilem::{WidgetView, Xilem};
|
||||
|
||||
/// The state of the entire application.
|
||||
///
|
||||
|
|
|
@ -5,20 +5,17 @@
|
|||
|
||||
use std::time::Duration;
|
||||
|
||||
use masonry::parley::{
|
||||
fontique::Weight,
|
||||
style::{FontFamily, FontStack},
|
||||
};
|
||||
use time::{error::IndeterminateOffset, macros::format_description, OffsetDateTime, UtcOffset};
|
||||
use masonry::parley::fontique::Weight;
|
||||
use masonry::parley::style::{FontFamily, FontStack};
|
||||
use time::error::IndeterminateOffset;
|
||||
use time::macros::format_description;
|
||||
use time::{OffsetDateTime, UtcOffset};
|
||||
use winit::error::EventLoopError;
|
||||
use xilem::{
|
||||
core::fork,
|
||||
view::{
|
||||
button, flex, label, portal, prose, sized_box, task, variable_label, Axis, FlexExt,
|
||||
FlexSpacer,
|
||||
},
|
||||
Color, EventLoop, EventLoopBuilder, WidgetView, Xilem,
|
||||
use xilem::core::fork;
|
||||
use xilem::view::{
|
||||
button, flex, label, portal, prose, sized_box, task, variable_label, Axis, FlexExt, FlexSpacer,
|
||||
};
|
||||
use xilem::{Color, EventLoop, EventLoopBuilder, WidgetView, Xilem};
|
||||
|
||||
/// The state of the application, owned by Xilem and updated by the callbacks below.
|
||||
struct Clocks {
|
||||
|
|
|
@ -11,10 +11,8 @@ use smallvec::{smallvec, SmallVec};
|
|||
use tracing::{trace_span, Span};
|
||||
use vello::Scene;
|
||||
|
||||
use crate::{
|
||||
core::{AnyElement, AnyView, Mut, SuperElement},
|
||||
Pod, ViewCtx,
|
||||
};
|
||||
use crate::core::{AnyElement, AnyView, Mut, SuperElement};
|
||||
use crate::{Pod, ViewCtx};
|
||||
|
||||
/// A view which can have any underlying view type.
|
||||
///
|
||||
|
|
|
@ -1,18 +1,16 @@
|
|||
// Copyright 2024 the Xilem Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::{
|
||||
core::{DynMessage, Message, MessageResult, ProxyError, RawProxy, ViewId},
|
||||
ViewCtx, WidgetView,
|
||||
};
|
||||
use masonry::{
|
||||
app_driver::AppDriver,
|
||||
event_loop_runner::{self, EventLoopProxy, MasonryUserEvent},
|
||||
widget::RootWidget,
|
||||
WidgetId,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
use masonry::app_driver::AppDriver;
|
||||
use masonry::event_loop_runner::{self, EventLoopProxy, MasonryUserEvent};
|
||||
use masonry::widget::RootWidget;
|
||||
use masonry::WidgetId;
|
||||
|
||||
use crate::core::{DynMessage, Message, MessageResult, ProxyError, RawProxy, ViewId};
|
||||
use crate::{ViewCtx, WidgetView};
|
||||
|
||||
pub struct MasonryDriver<State, Logic, View, ViewState> {
|
||||
pub(crate) state: State,
|
||||
pub(crate) logic: Logic,
|
||||
|
|
|
@ -5,43 +5,35 @@
|
|||
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
|
||||
#![warn(unnameable_types, unreachable_pub)]
|
||||
#![warn(clippy::print_stdout, clippy::print_stderr, clippy::dbg_macro)]
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use masonry::dpi::LogicalSize;
|
||||
use masonry::widget::{RootWidget, WidgetMut};
|
||||
use masonry::{event_loop_runner, Widget, WidgetId, WidgetPod};
|
||||
use winit::error::EventLoopError;
|
||||
use winit::window::{Window, WindowAttributes};
|
||||
|
||||
use crate::core::{
|
||||
AsyncCtx, MessageResult, Mut, RawProxy, SuperElement, View, ViewElement, ViewId,
|
||||
ViewPathTracker, ViewSequence,
|
||||
};
|
||||
use masonry::{
|
||||
dpi::LogicalSize,
|
||||
event_loop_runner,
|
||||
widget::{RootWidget, WidgetMut},
|
||||
Widget, WidgetId, WidgetPod,
|
||||
};
|
||||
use winit::{
|
||||
error::EventLoopError,
|
||||
window::{Window, WindowAttributes},
|
||||
};
|
||||
|
||||
pub use masonry::{
|
||||
dpi,
|
||||
event_loop_runner::{EventLoop, EventLoopBuilder},
|
||||
Color, TextAlignment, TextWeight,
|
||||
};
|
||||
pub use masonry::event_loop_runner::{EventLoop, EventLoopBuilder};
|
||||
pub use masonry::{dpi, Color, TextAlignment, TextWeight};
|
||||
pub use xilem_core as core;
|
||||
|
||||
mod one_of;
|
||||
|
||||
mod any_view;
|
||||
pub use any_view::AnyWidgetView;
|
||||
|
||||
mod driver;
|
||||
pub use driver::{async_action, MasonryDriver, MasonryProxy, ASYNC_MARKER_WIDGET};
|
||||
|
||||
pub mod view;
|
||||
|
||||
/// Tokio is the async runner used with Xilem.
|
||||
pub use tokio;
|
||||
|
||||
mod any_view;
|
||||
mod driver;
|
||||
mod one_of;
|
||||
|
||||
pub mod view;
|
||||
pub use any_view::AnyWidgetView;
|
||||
pub use driver::{async_action, MasonryDriver, MasonryProxy, ASYNC_MARKER_WIDGET};
|
||||
|
||||
pub struct Xilem<State, Logic> {
|
||||
state: State,
|
||||
logic: Logic,
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
|
||||
//! Statically typed alternatives to the type-erased [`AnyView`](`crate::AnyView`).
|
||||
|
||||
use crate::{
|
||||
core::{one_of::OneOf, Mut},
|
||||
Pod, ViewCtx,
|
||||
};
|
||||
use accesskit::{NodeBuilder, Role};
|
||||
use masonry::{
|
||||
AccessCtx, AccessEvent, BoxConstraints, EventCtx, LayoutCtx, PaintCtx, Point, PointerEvent,
|
||||
|
@ -15,6 +11,10 @@ use masonry::{
|
|||
use smallvec::{smallvec, SmallVec};
|
||||
use vello::Scene;
|
||||
|
||||
use crate::core::one_of::OneOf;
|
||||
use crate::core::Mut;
|
||||
use crate::{Pod, ViewCtx};
|
||||
|
||||
impl<
|
||||
A: Widget,
|
||||
B: Widget,
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
// Copyright 2024 the Xilem Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::{
|
||||
core::{DynMessage, Mut, View, ViewMarker},
|
||||
MessageResult, Pod, ViewCtx, ViewId,
|
||||
};
|
||||
pub use masonry::PointerButton;
|
||||
use masonry::{widget, ArcStr};
|
||||
|
||||
use crate::core::{DynMessage, Mut, View, ViewMarker};
|
||||
use crate::{MessageResult, Pod, ViewCtx, ViewId};
|
||||
|
||||
/// A button which calls `callback` when the primary mouse button (normally left) is pressed.
|
||||
pub fn button<State, Action>(
|
||||
label: impl Into<ArcStr>,
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
// Copyright 2024 the Xilem Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::{
|
||||
core::{DynMessage, Mut, ViewMarker},
|
||||
MessageResult, Pod, View, ViewCtx, ViewId,
|
||||
};
|
||||
use masonry::{widget, ArcStr};
|
||||
|
||||
use crate::core::{DynMessage, Mut, ViewMarker};
|
||||
use crate::{MessageResult, Pod, View, ViewCtx, ViewId};
|
||||
|
||||
pub fn checkbox<F, State, Action>(
|
||||
label: impl Into<ArcStr>,
|
||||
checked: bool,
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
// Copyright 2024 the Xilem Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::{
|
||||
core::{
|
||||
AppendVec, DynMessage, ElementSplice, MessageResult, Mut, SuperElement, View, ViewElement,
|
||||
ViewId, ViewMarker, ViewPathTracker, ViewSequence,
|
||||
},
|
||||
AnyWidgetView, Pod, ViewCtx, WidgetView,
|
||||
};
|
||||
use masonry::{
|
||||
widget::{self, WidgetMut},
|
||||
Widget,
|
||||
};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use masonry::widget::{self, WidgetMut};
|
||||
pub use masonry::widget::{Axis, CrossAxisAlignment, FlexParams, MainAxisAlignment};
|
||||
use masonry::Widget;
|
||||
|
||||
use crate::core::{
|
||||
AppendVec, DynMessage, ElementSplice, MessageResult, Mut, SuperElement, View, ViewElement,
|
||||
ViewId, ViewMarker, ViewPathTracker, ViewSequence,
|
||||
};
|
||||
use crate::{AnyWidgetView, Pod, ViewCtx, WidgetView};
|
||||
|
||||
pub fn flex<State, Action, Seq: FlexSequence<State, Action>>(
|
||||
sequence: Seq,
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
// Copyright 2024 the Xilem Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::{
|
||||
core::{
|
||||
AppendVec, DynMessage, ElementSplice, MessageResult, Mut, SuperElement, View, ViewElement,
|
||||
ViewId, ViewMarker, ViewSequence,
|
||||
},
|
||||
Pod, ViewCtx, WidgetView,
|
||||
};
|
||||
use masonry::widget::GridParams;
|
||||
use masonry::{
|
||||
widget::{self, WidgetMut},
|
||||
Widget,
|
||||
};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use masonry::widget::{self, GridParams, WidgetMut};
|
||||
use masonry::Widget;
|
||||
|
||||
use crate::core::{
|
||||
AppendVec, DynMessage, ElementSplice, MessageResult, Mut, SuperElement, View, ViewElement,
|
||||
ViewId, ViewMarker, ViewSequence,
|
||||
};
|
||||
use crate::{Pod, ViewCtx, WidgetView};
|
||||
|
||||
pub fn grid<State, Action, Seq: GridSequence<State, Action>>(
|
||||
sequence: Seq,
|
||||
width: i32,
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
|
||||
//! The bitmap image widget.
|
||||
|
||||
use crate::{
|
||||
core::{DynMessage, Mut, ViewMarker},
|
||||
MessageResult, Pod, View, ViewCtx, ViewId,
|
||||
};
|
||||
use masonry::widget::{self, ObjectFit};
|
||||
|
||||
use crate::core::{DynMessage, Mut, ViewMarker};
|
||||
use crate::{MessageResult, Pod, View, ViewCtx, ViewId};
|
||||
|
||||
/// Displays the bitmap `image`.
|
||||
///
|
||||
/// By default, the Image will scale to fit its box constraints ([`ObjectFit::Fill`]).
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// Copyright 2024 the Xilem Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::{
|
||||
core::{DynMessage, Mut, ViewMarker},
|
||||
Color, MessageResult, Pod, TextAlignment, TextWeight, View, ViewCtx, ViewId,
|
||||
};
|
||||
use masonry::{text::TextBrush, widget, ArcStr};
|
||||
use masonry::text::TextBrush;
|
||||
use masonry::{widget, ArcStr};
|
||||
|
||||
use crate::core::{DynMessage, Mut, ViewMarker};
|
||||
use crate::{Color, MessageResult, Pod, TextAlignment, TextWeight, View, ViewCtx, ViewId};
|
||||
|
||||
pub fn label(label: impl Into<ArcStr>) -> Label {
|
||||
Label {
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
// Copyright 2024 the Xilem Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::{
|
||||
core::{DynMessage, Mut, ViewMarker},
|
||||
MessageResult, Pod, View, ViewCtx, ViewId, WidgetView,
|
||||
};
|
||||
use masonry::widget;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use masonry::widget;
|
||||
|
||||
use crate::core::{DynMessage, Mut, ViewMarker};
|
||||
use crate::{MessageResult, Pod, View, ViewCtx, ViewId, WidgetView};
|
||||
|
||||
/// A view which puts `child` into a scrollable region.
|
||||
///
|
||||
/// This corresponds to the Masonry [`Portal`](masonry::widget::Portal) widget.
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
// Copyright 2024 the Xilem Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::{
|
||||
core::{DynMessage, Mut, ViewMarker},
|
||||
MessageResult, Pod, View, ViewCtx, ViewId,
|
||||
};
|
||||
use masonry::widget;
|
||||
|
||||
use crate::core::{DynMessage, Mut, ViewMarker};
|
||||
use crate::{MessageResult, Pod, View, ViewCtx, ViewId};
|
||||
|
||||
pub fn progress_bar(progress: Option<f64>) -> ProgressBar {
|
||||
ProgressBar { progress }
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// Copyright 2024 the Xilem Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::{
|
||||
core::{DynMessage, Mut, ViewMarker},
|
||||
Color, MessageResult, Pod, TextAlignment, View, ViewCtx, ViewId,
|
||||
};
|
||||
use masonry::{text::TextBrush, widget, ArcStr};
|
||||
use masonry::text::TextBrush;
|
||||
use masonry::{widget, ArcStr};
|
||||
|
||||
use crate::core::{DynMessage, Mut, ViewMarker};
|
||||
use crate::{Color, MessageResult, Pod, TextAlignment, View, ViewCtx, ViewId};
|
||||
|
||||
pub fn prose(content: impl Into<ArcStr>) -> Prose {
|
||||
Prose {
|
||||
|
|
|
@ -7,10 +7,8 @@ use masonry::widget;
|
|||
use vello::kurbo::RoundedRectRadii;
|
||||
use vello::peniko::{Brush, Color};
|
||||
|
||||
use crate::{
|
||||
core::{DynMessage, Mut, View, ViewId, ViewMarker},
|
||||
Pod, ViewCtx, WidgetView,
|
||||
};
|
||||
use crate::core::{DynMessage, Mut, View, ViewId, ViewMarker};
|
||||
use crate::{Pod, ViewCtx, WidgetView};
|
||||
|
||||
/// A widget with predefined size.
|
||||
///
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
// Copyright 2024 the Xilem Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::{
|
||||
core::{DynMessage, Mut, ViewMarker},
|
||||
MessageResult, Pod, View, ViewCtx, ViewId,
|
||||
};
|
||||
use masonry::{widget, Color};
|
||||
|
||||
use crate::core::{DynMessage, Mut, ViewMarker};
|
||||
use crate::{MessageResult, Pod, View, ViewCtx, ViewId};
|
||||
|
||||
/// An indefinite spinner.
|
||||
///
|
||||
/// This can be used to display that progress is happening on some process,
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
// Copyright 2024 the Xilem Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::{
|
||||
core::{
|
||||
DynMessage, Message, MessageProxy, MessageResult, Mut, NoElement, View, ViewId, ViewMarker,
|
||||
ViewPathTracker,
|
||||
},
|
||||
ViewCtx,
|
||||
};
|
||||
use std::{future::Future, marker::PhantomData, sync::Arc};
|
||||
use std::future::Future;
|
||||
use std::marker::PhantomData;
|
||||
use std::sync::Arc;
|
||||
|
||||
use tokio::task::JoinHandle;
|
||||
|
||||
use crate::core::{
|
||||
DynMessage, Message, MessageProxy, MessageResult, Mut, NoElement, View, ViewId, ViewMarker,
|
||||
ViewPathTracker,
|
||||
};
|
||||
use crate::ViewCtx;
|
||||
|
||||
/// Launch a task which will run until the view is no longer in the tree.
|
||||
/// `init_future` is given a [`MessageProxy`], which it will store in the future it returns.
|
||||
/// This `MessageProxy` can be used to send a message to `on_event`, which can then update
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// Copyright 2024 the Xilem Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::{
|
||||
core::{DynMessage, Mut, View, ViewMarker},
|
||||
Color, MessageResult, Pod, TextAlignment, ViewCtx, ViewId,
|
||||
};
|
||||
use masonry::{text::TextBrush, widget};
|
||||
use masonry::text::TextBrush;
|
||||
use masonry::widget;
|
||||
|
||||
use crate::core::{DynMessage, Mut, View, ViewMarker};
|
||||
use crate::{Color, MessageResult, Pod, TextAlignment, ViewCtx, ViewId};
|
||||
|
||||
// FIXME - A major problem of the current approach (always setting the textbox contents)
|
||||
// is that if the user forgets to hook up the modify the state's contents in the callback,
|
||||
|
|
|
@ -1,18 +1,13 @@
|
|||
// Copyright 2024 the Xilem Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::{
|
||||
core::{DynMessage, Mut, ViewMarker},
|
||||
Color, MessageResult, Pod, TextAlignment, View, ViewCtx, ViewId,
|
||||
};
|
||||
use masonry::{
|
||||
parley::{
|
||||
fontique::Weight,
|
||||
style::{FontFamily, FontStack, GenericFamily},
|
||||
},
|
||||
text::TextBrush,
|
||||
widget, ArcStr,
|
||||
};
|
||||
use masonry::parley::fontique::Weight;
|
||||
use masonry::parley::style::{FontFamily, FontStack, GenericFamily};
|
||||
use masonry::text::TextBrush;
|
||||
use masonry::{widget, ArcStr};
|
||||
|
||||
use crate::core::{DynMessage, Mut, ViewMarker};
|
||||
use crate::{Color, MessageResult, Pod, TextAlignment, View, ViewCtx, ViewId};
|
||||
|
||||
/// A view for displaying non-editable text, with a variable [weight](masonry::parley::style::FontWeight).
|
||||
pub fn variable_label(label: impl Into<ArcStr>) -> VariableLabel {
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
// Copyright 2024 the Xilem Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::{
|
||||
core::{
|
||||
DynMessage, Message, MessageProxy, MessageResult, Mut, NoElement, View, ViewId, ViewMarker,
|
||||
ViewPathTracker,
|
||||
},
|
||||
ViewCtx,
|
||||
};
|
||||
use std::{future::Future, marker::PhantomData, sync::Arc};
|
||||
use tokio::{
|
||||
sync::mpsc::{UnboundedReceiver, UnboundedSender},
|
||||
task::JoinHandle,
|
||||
use std::future::Future;
|
||||
use std::marker::PhantomData;
|
||||
use std::sync::Arc;
|
||||
|
||||
use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender};
|
||||
use tokio::task::JoinHandle;
|
||||
|
||||
use crate::core::{
|
||||
DynMessage, Message, MessageProxy, MessageResult, Mut, NoElement, View, ViewId, ViewMarker,
|
||||
ViewPathTracker,
|
||||
};
|
||||
use crate::ViewCtx;
|
||||
|
||||
/// Launch a task which will run until the view is no longer in the tree.
|
||||
///
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
// Copyright 2024 the Xilem Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use std::{io::stdin, path::PathBuf};
|
||||
use std::io::stdin;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use xilem_core::{
|
||||
AnyElement, AnyView, Mut, SuperElement, View, ViewElement, ViewId, ViewMarker, ViewPathTracker,
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
|
||||
//! Support for a type erased [`View`].
|
||||
|
||||
use core::any::Any;
|
||||
|
||||
use alloc::boxed::Box;
|
||||
use core::any::Any;
|
||||
|
||||
use crate::{
|
||||
AnyElement, DynMessage, MessageResult, Mut, View, ViewElement, ViewId, ViewMarker,
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
// Copyright 2024 the Xilem Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use core::{fmt::Display, marker::PhantomData};
|
||||
|
||||
use alloc::{boxed::Box, sync::Arc};
|
||||
use alloc::boxed::Box;
|
||||
use alloc::sync::Arc;
|
||||
use core::fmt::Display;
|
||||
use core::marker::PhantomData;
|
||||
|
||||
use crate::{DynMessage, Message, NoElement, View, ViewId, ViewPathTracker};
|
||||
|
||||
|
|
|
@ -3,9 +3,10 @@
|
|||
|
||||
//! Message routing and type erasure primitives.
|
||||
|
||||
use core::{any::Any, fmt::Debug, ops::Deref};
|
||||
|
||||
use alloc::boxed::Box;
|
||||
use core::any::Any;
|
||||
use core::fmt::Debug;
|
||||
use core::ops::Deref;
|
||||
|
||||
/// The possible outcomes from a [`View::message`]
|
||||
///
|
||||
|
@ -121,9 +122,8 @@ pub trait ViewMessage<State, Action> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use core::fmt::Debug;
|
||||
|
||||
use alloc::boxed::Box;
|
||||
use core::fmt::Debug;
|
||||
|
||||
use crate::DynMessage;
|
||||
|
||||
|
|
|
@ -3,11 +3,8 @@
|
|||
|
||||
//! Support for sequences of views with a shared element type.
|
||||
|
||||
use core::sync::atomic::AtomicBool;
|
||||
use core::sync::atomic::Ordering;
|
||||
|
||||
use alloc::vec::Drain;
|
||||
use alloc::vec::Vec;
|
||||
use alloc::vec::{Drain, Vec};
|
||||
use core::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
// use crate::element::NoElement;
|
||||
use crate::{
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
|
||||
//! The primary view trait and associated trivial implementations.
|
||||
|
||||
use alloc::boxed::Box;
|
||||
use alloc::sync::Arc;
|
||||
use core::ops::Deref;
|
||||
|
||||
use alloc::{boxed::Box, sync::Arc};
|
||||
|
||||
use crate::{message::MessageResult, DynMessage, Mut, ViewElement};
|
||||
use crate::message::MessageResult;
|
||||
use crate::{DynMessage, Mut, ViewElement};
|
||||
|
||||
/// A type which can be a [`View`]. Imposes no requirements on the underlying type.
|
||||
/// Should be implemented alongside every `View` implementation:
|
||||
|
|
|
@ -3,9 +3,10 @@
|
|||
|
||||
//! Statically typed alternatives to the type-erased [`AnyView`](`crate::AnyView`).
|
||||
|
||||
use crate::{MessageResult, Mut, View, ViewElement, ViewId, ViewMarker, ViewPathTracker};
|
||||
use hidden::OneOfState;
|
||||
|
||||
use crate::{MessageResult, Mut, View, ViewElement, ViewId, ViewMarker, ViewPathTracker};
|
||||
|
||||
/// This trait allows, specifying a type as `ViewElement`, which should never be constructed or used.
|
||||
///
|
||||
/// But it allows downstream implementations to adjust the behaviour of [`PhantomElementCtx::PhantomElement`],
|
||||
|
@ -520,9 +521,8 @@ where
|
|||
// to export it. Since this (`one_of`) module is public, we create a new module, allowing it to be pub but not exposed.
|
||||
#[doc(hidden)]
|
||||
mod hidden {
|
||||
use crate::{View, ViewMarker};
|
||||
|
||||
use super::PhantomElementCtx;
|
||||
use crate::{View, ViewMarker};
|
||||
|
||||
#[allow(unreachable_pub)]
|
||||
pub enum Never {}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
//! This is an integration test so that it can use the infrastructure in [`common`].
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use xilem_core::{MessageResult, View};
|
||||
|
||||
mod common;
|
||||
|
|
|
@ -5,10 +5,8 @@
|
|||
//!
|
||||
//! This is an integration test so that it can use the infrastructure in [`common`].
|
||||
|
||||
use xilem_core::{
|
||||
one_of::{OneOf, OneOf2, OneOfCtx, PhantomElementCtx},
|
||||
MessageResult, Mut, View, ViewId,
|
||||
};
|
||||
use xilem_core::one_of::{OneOf, OneOf2, OneOfCtx, PhantomElementCtx};
|
||||
use xilem_core::{MessageResult, Mut, View, ViewId};
|
||||
|
||||
mod common;
|
||||
use common::*;
|
||||
|
|
Loading…
Reference in New Issue