1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
//! # Neon Design System — Slint UI library for Rust
//!
//! Reusable Slint components + theme tokens for Rust desktop apps.
//! 35+ components, dark/light theme switch, neon accents, glass
//! surfaces.
//!
//! ## What this crate ships
//!
//! * **Slint components** — `.slint` files under `ui/` that consumer
//! apps import via Slint's `library_paths` mechanism (see
//! [`SLINT_LIBRARY_PATH`]).
//! * **Rust helpers** — theme switching, hex color parsing, the
//! [`neon_ui_setup!`](crate::neon_ui_setup) macro.
//!
//! ## Consumer setup (3 steps)
//!
//! ### 1. Add the dependency in **both** `[dependencies]` and `[build-dependencies]`
//!
//! ```toml
//! [dependencies]
//! slint = "1.9"
//! slint-ui-system = { git = "https://github.com/wilmercampagna/slint-ui-system" }
//!
//! [build-dependencies]
//! slint-build = "1.9"
//! slint-ui-system = { git = "https://github.com/wilmercampagna/slint-ui-system" }
//! ```
//!
//! The build script reads [`SLINT_LIBRARY_PATH`] to wire up Slint's
//! library resolver; the runtime side gets the Rust helpers.
//!
//! ### 2. Wire up `build.rs`
//!
//! ```ignore
//! use slint_build::CompilerConfiguration;
//!
//! fn main() {
//! let neon = format!("{}/index.slint",
//! slint_ui_system::SLINT_LIBRARY_PATH);
//! let cfg = CompilerConfiguration::new()
//! .with_library_paths(
//! [("neon".to_string(), neon.into())]
//! .into_iter().collect(),
//! );
//! slint_build::compile_with_config("ui/app.slint", cfg).unwrap();
//! }
//! ```
//!
//! ### 3. Import in your `.slint` file
//!
//! ```slint
//! import { Theme, NeonButton, NeonCard } from "@neon";
//!
//! export component AppWindow inherits Window {
//! background: Theme.bg-base;
//! NeonButton {
//! text: "Hello Neon";
//! clicked => { /* … */ }
//! }
//! }
//! ```
//!
//! ## Theme switch from Rust
//!
//! ```ignore
//! use slint::ComponentHandle;
//! use slint_ui_system::theme;
//! slint::include_modules!();
//!
//! fn main() -> Result<(), slint::PlatformError> {
//! let win = AppWindow::new()?;
//! theme::set_dark_mode(&win, false); // light
//! win.run()
//! }
//! ```
//!
//! ## License
//!
//! MIT or Apache-2.0 at the consumer's option.
/// Absolute path to the directory containing this crate's `.slint`
/// library files. Used by consumer build scripts to set up Slint's
/// `library_paths` resolver so they can write
/// `import { … } from "@neon";` in their `.slint` sources.
///
/// This is `<crate_root>/ui` captured at this crate's compile
/// time — Cargo's path resolution (whether the crate lives as a
/// path dep, in `~/.cargo/registry`, or as a git checkout) is
/// handled transparently by `env!`.
///
/// # Example
///
/// In your build script:
///
/// ```ignore
/// fn main() {
/// let neon = format!("{}/index.slint",
/// slint_ui_system::SLINT_LIBRARY_PATH);
/// let cfg = slint_build::CompilerConfiguration::new()
/// .with_library_paths(
/// [("neon".to_string(), neon.into())]
/// .into_iter().collect(),
/// );
/// slint_build::compile_with_config("ui/app.slint", cfg).unwrap();
/// }
/// ```
pub const SLINT_LIBRARY_PATH: &str = concat!;