slint
slint copied to clipboard
Multiple component in the interpreter
Multiple component export is implemented in Rust and C++ to open different window. But the interpreter still can only generate one componenet and so only one component can be exposed to JS and Python at the moment.
We need to
- Deprecate the
slint_interpreter::ComponentCompiler
, and replace it by aCompiler
// (pseudo-code)
pub struct CompilationResult {
components: HashMap<String, ComponentDefinition>,
diagnostics: BuildDiagnostics,
}
pub impl Compiler {
// all the options setters
pub fn build_from_path(...) -> CompilationResult
}
impl CompilationResult {
pub fn has_error(&self) -> bool
/// only exported ones
pub fn component_names(&self) -> impl Iterator<Output = String>
/// Will lazily do the later passes and may report further errors.
/// Can also be used on non-exported component? (for the preview)
pub fn component(&str) -> Option<ComponentDefinition>
pub fn diagnostics(&self) -> ...
}
-
Adapt JS and python to support mutiple components.
-
Adapt the LSP's live preview to generate a particular component instead of using the hack. We might still want to tell the Compiler to only generate one particular component to be faster.