@uniweb/core 0.2.5 → 0.3.1

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/uniweb.js +18 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/core",
3
- "version": "0.2.5",
3
+ "version": "0.3.1",
4
4
  "description": "Core classes for the Uniweb platform - Uniweb, Website, Page, Block",
5
5
  "type": "module",
6
6
  "exports": {
@@ -30,7 +30,7 @@
30
30
  "jest": "^29.7.0"
31
31
  },
32
32
  "dependencies": {
33
- "@uniweb/semantic-parser": "1.0.15"
33
+ "@uniweb/semantic-parser": "1.0.16"
34
34
  },
35
35
  "scripts": {
36
36
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
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