pub mod animation;
pub mod app_theme;
pub mod asset;
pub mod behaviors;
pub mod binding;
pub mod caret;
pub mod components;
pub mod convert;
pub mod device;
pub mod dialog;
pub mod dynamic;
pub mod error;
pub mod events;
pub mod fonts;
pub mod hit_test;
pub mod icons;
pub mod instantiate;
pub mod items;
pub mod navigation;
pub mod overlay;
pub mod perf;
pub mod plugin;
pub mod provider;
pub mod query;
pub mod resources;
pub mod selector;
pub mod shapes;
#[cfg(feature = "vector_gpu")]
pub mod shapes_gpu;
pub mod themes;
pub mod toast;
pub mod triggers;
pub mod util;
pub use bevy_pf_macros::{Bindable, include_xaml, xaml};
pub use bevy_pf_xaml as xaml_ast;
pub use app_theme::{AppTheme, PfAppTheme, PfAppThemeRefs, app_theme, set_user_app_theme};
pub use asset::{XamlAsset, XamlView};
pub use binding::{
Bindable, BoundValue, DataContext, DataContextScope, PfBindings, SelectionMatch,
};
pub use components::{ButtonVisual, PfAttachedProps, PfElementKind, PfName, XamlNames};
pub use device::{DeviceIdiom, DevicePlatform, PfDevice};
pub use dynamic::{
PfApplicationResources, PfDynamicResources, PfResources, merge_application_resources,
set_application_resources_dict,
};
pub use error::PfError;
pub use events::{PfEventAppExt, PfEventHandlers, PfPointerInfo};
pub use hit_test::{PfHitFilter, PfHitTest, PfHitTestVisible};
pub use instantiate::{
InstantiateResult, XamlEnv, instantiate_document, instantiate_document_env,
set_application_resources,
};
pub use items::PfItemsSource;
pub use overlay::{PfPlacement, PfPopup, PfToolTip};
pub use plugin::{PfCommandsExt, PfUiPlugin};
pub use provider::{PfPropertyStore, PropertyTarget, ValueSource};
pub use triggers::PfTriggers;
pub mod prelude {
pub use crate::app_theme::{AppTheme, PfAppTheme, set_user_app_theme};
pub use crate::asset::{XamlAsset, XamlView};
pub use crate::behaviors::{clear_focus, find_editable_in, focus_control};
pub use crate::binding::{
Bindable, DataContext, DataContextScope, PfConverterAppExt, PfMultiValueConverter,
PfValueConverter,
};
pub use crate::components::PfControlTheme;
pub use crate::components::{PfAutomationId, PfElementKind, PfName, PfUid, XamlNames};
pub use crate::device::{DeviceIdiom, DevicePlatform, PfDevice};
pub use crate::events::{PfEventAppExt, PfPointerInfo};
pub use crate::hit_test::{PfHitFilter, PfHitTest, PfHitTestVisible};
pub use crate::instantiate::PfElementAppExt;
pub use crate::navigation::{PfNavigated, PfNavigationAppExt};
pub use crate::plugin::{PfCommandsExt, PfFocusRingColor, PfUiPlugin};
pub use crate::query::PfQuery;
pub use crate::{XamlScene, include_xaml, xaml};
pub use bevy_pf_macros::Bindable;
}
#[derive(Debug, Clone)]
pub struct XamlScene {
source: SceneSource,
}
#[derive(Debug, Clone)]
enum SceneSource {
Static(&'static str),
Owned(std::sync::Arc<str>),
}
impl XamlScene {
#[doc(hidden)]
pub const fn from_static_validated(source: &'static str) -> Self {
Self {
source: SceneSource::Static(source),
}
}
pub fn parse(source: impl Into<String>) -> Result<Self, PfError> {
let source: String = source.into();
bevy_pf_xaml::parse(&source)?;
Ok(Self {
source: SceneSource::Owned(source.into()),
})
}
pub fn source(&self) -> &str {
match &self.source {
SceneSource::Static(s) => s,
SceneSource::Owned(s) => s,
}
}
pub fn document(&self) -> bevy_pf_xaml::XamlDocument {
bevy_pf_xaml::parse(self.source()).expect("validated XAML failed to re-parse")
}
}