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
//! Icon configuration for customizing icon asset paths.
//!
//! This module provides global configuration for icon asset paths, allowing
//! users to provide their own icon assets instead of bundling them with the library.
use OnceCell;
use RwLock;
static ICON_BASE_PATH: = new;
/// Sets the base path for icon assets.
///
/// This should be called once at application startup, before any icons are loaded.
/// The path will be used as a prefix when loading named icons.
///
/// # Example
///
/// ```rust
/// use kael_ui::set_icon_base_path;
///
/// // Set icons to be loaded from your application's assets directory
/// set_icon_base_path("assets/icons");
///
/// // Now icons will be loaded from assets/icons/{icon-name}.svg
/// // instead of crates/kael_ui/assets/icons/{icon-name}.svg
/// ```
///
/// # Arguments
///
/// * `path` - The base path where icon SVG files are located (without trailing slash)
/// Gets the current icon base path.
///
/// Returns the configured icon base path, or a default path if none has been set.
///
/// # Returns
///
/// The base path for loading icon assets.
pub
/// Resolves a named icon to its full path.
///
/// This function combines the configured base path with the icon name.
///
/// # Arguments
///
/// * `name` - The icon name (e.g., "arrow-up", "search")
///
/// # Returns
///
/// The full path to the icon SVG file.
///
/// # Example
///
/// ```rust
/// use kael_ui::icon_config::resolve_icon_path;
///
/// let path = resolve_icon_path("arrow-up");
/// // Returns "assets/icons/arrow-up.svg" (or your configured path)
/// ```