Skip to main content

lumen_core/
lib.rs

1//! Lumen UI framework core crate.
2//!
3//! - Owns the tick loop, [`command`] queue, ECS components, and the two ECS worlds (main + render). See [`render_world`] for the cross-world flow.
4//! - Backend roles are traits in [`traits`]; concrete backends implement them and register systems via [`app::Plugin`].
5//! - Hierarchy uses [`bevy_ecs::hierarchy::ChildOf`] and [`bevy_ecs::hierarchy::Children`], re-exported from [`prelude`].
6
7#![forbid(unsafe_code)]
8#![warn(missing_docs)]
9
10pub mod app;
11pub mod app_paths;
12pub mod backends;
13pub mod command;
14pub mod components;
15pub mod i18n;
16pub mod input;
17pub mod introspect;
18pub mod layout_backend;
19pub mod native;
20pub mod nav;
21pub mod net_capture;
22pub mod node;
23pub mod node_ir;
24pub mod output;
25pub mod palette;
26pub mod plugin_events;
27pub mod property_store;
28pub mod render_backend;
29pub mod render_world;
30pub mod request;
31pub mod signals;
32pub mod style_overrides;
33pub mod task;
34pub mod text_events;
35pub mod text_model;
36pub mod tick;
37pub mod time;
38pub mod traits;
39pub mod window;
40pub mod window_backend;
41pub mod window_state;
42
43/// Crate prelude re-exporting the common types. Glob-import with `use lumen_core::prelude::*;`.
44pub mod prelude {
45    pub use crate::app::{App, AppError, EventLoopWaker, Plugin, PluginMetadata};
46    pub use crate::command::{
47        Command, CommandHandlerFn, CommandQueue, CommandQueueOverflow, CommandRegistry,
48        apply_property_commands,
49    };
50    #[allow(deprecated)]
51    pub use crate::components::OsTheme;
52    pub use crate::components::{
53        A11yAnnouncement, A11yAnnouncementQueue, A11yContextMenuRequests, A11yDescription,
54        A11yLabel, A11yLevel, A11yLive, A11yRelations, A11yRole, A11yRootLabel,
55        A11yScrollIntoViewRequests, A11ySetSize, A11yState, A11yValue, AlignContent, BindChecked,
56        BindDisabled, BindParentChecked, BindParentText, BindParentValue, BindSelfChecked,
57        BindSelfText, BindSelfValue, BindText, BindTextLabels, BindValue, Border, BoxSizing,
58        CaretBlink, Color, ColorScheme, DefaultLayoutDirection, DirtyA11y, DirtyLayout, Disabled,
59        DocumentOrder, DropHovered, DropTarget, Edges, Fill, FlexAlign, FlexDirection, FlexJustify,
60        FlexWrap, FocusBoundary, ImageBlob, ImageComponent, ImageFit, ImeState, Lang,
61        LayoutDirection, Length, LumenClasses, LumenId, LumenTag, MemoryBudget, Opacity, Overflow,
62        PendingA11yUpdate, Position, RelayoutBoundary, ResolvedDirection, RootWindowEntity,
63        Selected, ShadowSpec, SliderValue, Style, StyleManager, StyleVersion, SvgPayload, TabIndex,
64        TextAlign, TextContent, TextInput, TextInputPaint, TextInputScroll, TextStyle, TextWrap,
65        TitleBarDraggable, Toggleable, Transform, Validation, Visible, Visuals, WindowDragRequest,
66        ZIndex, apply_bind_parent_checked, apply_bind_parent_text, apply_bind_parent_value,
67        apply_bind_self_checked, apply_bind_self_text, apply_bind_self_value, hidden_via_ancestors,
68        resolve_layout_direction,
69    };
70    pub use crate::input::{
71        ClickEvent, CursorRequest, CursorShape, DoubleClickEvent, DragEndEvent, DragMoveEvent,
72        DragStartEvent, EscapePressCancel, FileDropped, FileHoverCancelled, FileHovered,
73        FocusTracker, Focused, FocusedKey, Hovered, ImeEvent, ImeRequest, Key, KeyPressed,
74        KeyReleased, LongPressEvent, Modifiers, ModifiersState, MouseWheel, NamedKey,
75        PointerButton, PointerLeft, PointerMoved, PointerPressed, PointerReleased, PointerState,
76        Pressed, SCROLLBAR_MARGIN, SCROLLBAR_MIN_THUMB, SCROLLBAR_THICKNESS,
77        SCROLLBAR_THICKNESS_THIN, Scroll, ScrollAxis, ScrollOffset, ScrollbarAxisPick,
78        ScrollbarDrag, ScrollbarGeometry, ScrollbarInteraction, ScrollbarMetrics, ScrollbarPart,
79        ScrollbarState, ScrollbarStyle, ScrollbarWidthMode, ShowContextMenu, TextInputCommitted,
80        horizontal_scrollbar, vertical_scrollbar,
81    };
82    pub use crate::native::{
83        ExtractedNative, NativeExtract, NativePaintCtx, NativePainter, NativePainters,
84        NativePlacement, next_revision, upsert_native_leaves,
85    };
86    pub use crate::nav::{NavOp, navigate as nav_navigate, request as nav_request};
87    pub use crate::node::{
88        DomIndex, DomRecord, NodeHandle, NodeHandles, dom_index_snapshot, intern_node,
89        publish_dom_index, resolve_node,
90    };
91    pub use crate::node_ir::{
92        Affine2, ClipShape, DrawEntry, Node, PreviousScene, RetainedScene,
93        transform_extracted_to_nodes,
94    };
95    pub use crate::palette::Palette;
96    pub use crate::property_store::{
97        BindingId, ListenerId, Property, PropertyCell, PropertyKey, PropertyStore, PropertyValue,
98        clear_property_store_dirty,
99    };
100    pub use crate::render_world::{
101        AnimationsActive, Brush, ExtractFn, ExtractSchedule, ExtractSet, ExtractedClipBox,
102        ExtractedImage, ExtractedOpacityGroup, ExtractedOutline, ExtractedRect, ExtractedScrollbar,
103        ExtractedShadow, ExtractedText, FrameDirty, Rect, Render, RenderStage, ScrollbarDrawRect,
104        SurfaceCapture, SurfaceFrame, Viewport, install_extract_pipeline,
105    };
106    #[allow(deprecated)]
107    pub use crate::signals::Signals;
108    pub use crate::signals::{
109        ArrayItem, ArraySignals, ExternalMutation, apply_text_bindings, drain_external_signals,
110        init_external_signals, push_external_array, push_external_clear, push_external_signal,
111        push_textinput_to_signal,
112    };
113    pub use crate::task::{BoxFuture, SpawnService, TimerService};
114    pub use crate::text_events::{
115        Anchor, AppliedKind, CursorMotion, ImeSurroundingRequested, ImeSurroundingResponse,
116        MoveMode, RejectReason, TextEditApplied, TextEditRejected, TextEditRequest, TextEditSet,
117    };
118    pub use crate::text_model::{
119        Affinity, Bias, ImePreedit, MarkId, TagKind, TextBuffer, TextBufferKind, TextCursor,
120        TextEditable, TextMark, TextPos, TextTagRange,
121    };
122    pub use crate::tick::{Tick, TickStage, WakeDeadline};
123    pub use crate::traits::{
124        A11yBackend, A11yBridgeFactory, Bindable, FrameRequest, FrameTarget, LayoutEngine,
125        RenderError, RenderTarget, Renderer, Spawn, Timer, WindowBackend, WindowError,
126    };
127
128    // Re-export the bevy_ecs hierarchy components used across the crate.
129    pub use bevy_ecs::hierarchy::{ChildOf, Children};
130    pub use bevy_ecs::prelude::*;
131}