@uniweb/core 0.2.5 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/uniweb.js +18 -0
package/package.json
CHANGED
package/src/uniweb.js
CHANGED
|
@@ -18,10 +18,28 @@ export default class Uniweb {
|
|
|
18
18
|
this.meta = {} // Per-component runtime metadata (from meta.js)
|
|
19
19
|
this.language = 'en'
|
|
20
20
|
|
|
21
|
+
// Icon resolver: (library, name) => Promise<string|null>
|
|
22
|
+
// Set by runtime based on site config
|
|
23
|
+
this.iconResolver = null
|
|
24
|
+
|
|
21
25
|
// Initialize analytics (disabled by default, configure via site config)
|
|
22
26
|
this.analytics = new Analytics(configData.analytics || {})
|
|
23
27
|
}
|
|
24
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Resolve an icon by library and name
|
|
31
|
+
* @param {string} library - Icon family (lucide, heroicons, etc.)
|
|
32
|
+
* @param {string} name - Icon name (check, arrow-right, etc.)
|
|
33
|
+
* @returns {Promise<string|null>} SVG string or null
|
|
34
|
+
*/
|
|
35
|
+
async resolveIcon(library, name) {
|
|
36
|
+
if (!this.iconResolver) {
|
|
37
|
+
console.warn('[Uniweb] No icon resolver configured')
|
|
38
|
+
return null
|
|
39
|
+
}
|
|
40
|
+
return this.iconResolver(library, name)
|
|
41
|
+
}
|
|
42
|
+
|
|
25
43
|
/**
|
|
26
44
|
* Set the foundation module after loading
|
|
27
45
|
* @param {Object} foundation - The loaded ESM foundation module
|