#![cfg_attr(docsrs, feature(doc_cfg))]
extern crate self as rok_ui;
pub mod bidi;
#[cfg(feature = "bloc")]
pub mod bloc;
pub mod components;
pub mod context;
pub mod cx;
#[cfg(feature = "db")]
pub mod db;
#[cfg(feature = "devtools")]
pub mod devtools;
pub mod fonts;
#[cfg(feature = "form")]
pub mod form;
pub mod hooks;
#[cfg(feature = "http")]
pub mod http;
pub mod icon;
pub mod keyed;
pub mod motion;
#[cfg(feature = "persist")]
pub mod persist;
pub mod platform;
pub mod prelude;
#[cfg(feature = "query")]
pub mod query;
#[cfg(feature = "router")]
pub mod router;
#[cfg(feature = "runtime")]
pub mod runtime;
mod scope;
#[cfg(feature = "state")]
pub mod state;
pub mod styles;
pub mod sx;
pub mod theme;
pub use cx::Cx;
pub use gpui;
pub use icon::{Assets, AssetsWithFallback, Icon, IconName};
pub use keyed::Keyed;
pub use rok_ui_macros::{children, component, keyframes, style, styles, view};
#[cfg(feature = "query")]
pub use rok_ui_macros::{memoize, procedure};
#[doc(hidden)]
pub mod __private {
use std::cell::Cell;
use gpui::{AnyElement, IntoElement, SharedString};
pub struct Child<T>(Cell<Option<T>>);
impl<T> Child<T> {
pub fn new(value: T) -> Self {
Self(Cell::new(Some(value)))
}
fn take(&self) -> T {
self.0.take().expect("a markup child is converted once")
}
}
pub trait TextChild {
fn take_child(&self) -> AnyElement;
}
impl<T: Into<SharedString>> TextChild for Child<T> {
fn take_child(&self) -> AnyElement {
crate::components::BidiText::new(self.take()).into_any_element()
}
}
pub trait ElementChild {
fn take_child(&self) -> AnyElement;
}
impl<T: IntoElement> ElementChild for &Child<T> {
fn take_child(&self) -> AnyElement {
self.take().into_any_element()
}
}
}
pub fn init(cx: &mut gpui::App) {
theme::init(cx);
cx.observe_keystrokes(|_, window, _| {
if sx::set_keyboard_modality(true) {
window.refresh();
}
})
.detach();
components::app_root::bind_focus_navigation_keys(cx);
#[cfg(feature = "input")]
components::input::bind_text_editing_keys(cx);
#[cfg(feature = "router")]
router::init(cx);
#[cfg(feature = "state")]
state::init(cx);
#[cfg(feature = "devtools")]
devtools::init(cx);
}