refactor: split into explicit facets

This commit is contained in:
drendog 2025-12-03 23:16:15 +01:00
parent ccf0c9caf8
commit 6c564d95b5
Signed by: dwenya
GPG key ID: 8DD77074645332D0
7 changed files with 63 additions and 33 deletions

1
src/event.rs Normal file
View file

@ -0,0 +1 @@
pub use layer_shika_composition::{EventContext, EventLoopHandle, ShellEventLoopHandle};

View file

@ -17,6 +17,17 @@
//! the internal architecture to evolve without breaking semver guarantees on the //! the internal architecture to evolve without breaking semver guarantees on the
//! public API. //! public API.
//! //!
//! # Module Organization
//!
//! The API is organized into conceptual facets:
//!
//! - [`shell`] Main runtime and shell composition types
//! - [`window`] Window configuration, layers, anchors, and popup types
//! - [`output`] Output (monitor) info, geometry, and policies
//! - [`event`] Event loop handles and contexts
//! - [`slint_integration`] Slint framework re-exports and wrappers
//! - [`calloop`] Event loop types for custom event sources
//!
//! # Quick Start //! # Quick Start
//! //!
//! ```rust,no_run //! ```rust,no_run
@ -50,36 +61,36 @@
//! shell.run()?; //! shell.run()?;
//! # Ok::<(), layer_shika::Error>(()) //! # Ok::<(), layer_shika::Error>(())
//! ``` //! ```
//!
//! # Re-exports
//!
//! This crate re-exports commonly needed types from its dependencies:
//! - [`slint`]: The Slint UI framework (compiled API)
//! - [`slint_interpreter`]: Runtime Slint component loading
//! - [`calloop`]: Event loop types for custom event sources
#![allow(clippy::pub_use)] #![allow(clippy::pub_use)]
pub mod prelude; pub mod prelude;
pub use layer_shika_composition::{ pub mod event;
AnchorEdges, AnchorStrategy, DEFAULT_WINDOW_NAME, Error, EventContext, EventLoopHandle, pub mod output;
KeyboardInteractivity, Layer, LayerShika, OutputGeometry, OutputHandle, OutputInfo, pub mod shell;
OutputPolicy, OutputRegistry, PopupHandle, PopupPlacement, PopupPositioningMode, PopupRequest, pub mod slint_integration;
PopupSize, PopupWindow, Result, ShellControl, ShellRuntime, SingleWindowShell, pub mod window;
pub use layer_shika_composition::{Error, Result};
pub use shell::{
DEFAULT_WINDOW_NAME, LayerShika, LayerSurfaceHandle, Shell, ShellComposition, ShellControl,
ShellEventContext, ShellRuntime, ShellWindowConfigHandler, ShellWindowDefinition,
ShellWindowHandle, SingleWindowShell,
}; };
pub use layer_shika_composition::{ pub use window::{
LayerSurfaceHandle, Shell, ShellComposition, ShellEventContext, ShellEventLoopHandle, AnchorEdges, AnchorStrategy, KeyboardInteractivity, Layer, PopupHandle, PopupPlacement,
ShellWindowConfigHandler, ShellWindowDefinition, ShellWindowHandle, PopupPositioningMode, PopupRequest, PopupSize,
}; };
pub use layer_shika_composition::{slint, slint_interpreter}; pub use output::{OutputGeometry, OutputHandle, OutputInfo, OutputPolicy, OutputRegistry};
pub use event::{EventContext, EventLoopHandle, ShellEventLoopHandle};
pub use slint_integration::{PopupWindow, slint, slint_interpreter};
/// Re-exported calloop types for event loop integration
///
/// These types allow users to register custom event sources on the
/// layer-shika event loop via [`EventLoopHandle`].
pub mod calloop { pub mod calloop {
pub use layer_shika_composition::calloop::*; pub use layer_shika_composition::calloop::*;
} }

3
src/output.rs Normal file
View file

@ -0,0 +1,3 @@
pub use layer_shika_composition::{
OutputGeometry, OutputHandle, OutputInfo, OutputPolicy, OutputRegistry,
};

View file

@ -8,26 +8,27 @@
#![allow(clippy::pub_use)] #![allow(clippy::pub_use)]
pub use crate::{ pub use crate::shell::{
DEFAULT_WINDOW_NAME, Error, EventContext, EventLoopHandle, LayerShika, PopupWindow, Result, DEFAULT_WINDOW_NAME, LayerShika, LayerSurfaceHandle, Shell, ShellComposition, ShellControl,
ShellControl, ShellRuntime, SingleWindowShell, ShellEventContext, ShellEventLoopHandle, ShellRuntime, ShellWindowConfigHandler,
ShellWindowDefinition, ShellWindowHandle, SingleWindowShell,
}; };
pub use crate::{ pub use crate::window::{
LayerSurfaceHandle, Shell, ShellComposition, ShellEventContext, ShellEventLoopHandle, AnchorEdges, AnchorStrategy, KeyboardInteractivity, Layer, PopupHandle, PopupPlacement,
ShellWindowConfigHandler, ShellWindowDefinition, ShellWindowHandle, PopupPositioningMode, PopupRequest, PopupSize,
}; };
pub use crate::{ pub use crate::output::{OutputGeometry, OutputHandle, OutputInfo, OutputPolicy, OutputRegistry};
AnchorEdges, KeyboardInteractivity, Layer, OutputGeometry, OutputHandle, OutputInfo,
OutputPolicy, OutputRegistry, PopupHandle, PopupPlacement, PopupPositioningMode, PopupRequest, pub use crate::event::{EventContext, EventLoopHandle};
PopupSize,
}; pub use crate::slint_integration::{PopupWindow, slint, slint_interpreter};
pub use crate::{Error, Result};
pub use layer_shika_composition::prelude::{ pub use layer_shika_composition::prelude::{
Anchor, LogicalSize, Margins, PhysicalSize, ScaleFactor, WindowConfig, WindowDimension, Anchor, LogicalSize, Margins, PhysicalSize, ScaleFactor, WindowConfig, WindowDimension,
}; };
pub use crate::calloop; pub use crate::calloop;
pub use crate::{slint, slint_interpreter};

5
src/shell.rs Normal file
View file

@ -0,0 +1,5 @@
pub use layer_shika_composition::{
DEFAULT_WINDOW_NAME, LayerShika, LayerSurfaceHandle, Shell, ShellComposition, ShellControl,
ShellEventContext, ShellEventLoopHandle, ShellRuntime, ShellWindowConfigHandler,
ShellWindowDefinition, ShellWindowHandle, SingleWindowShell,
};

3
src/slint_integration.rs Normal file
View file

@ -0,0 +1,3 @@
pub use layer_shika_composition::{slint, slint_interpreter};
pub use layer_shika_composition::PopupWindow;

6
src/window.rs Normal file
View file

@ -0,0 +1,6 @@
pub use layer_shika_composition::{
AnchorEdges, AnchorStrategy, KeyboardInteractivity, Layer, PopupHandle, PopupPlacement,
PopupPositioningMode, PopupRequest, PopupSize,
};
pub use layer_shika_composition::DEFAULT_WINDOW_NAME;