@uniweb/core 0.2.4 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/core",
3
- "version": "0.2.4",
3
+ "version": "0.3.0",
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.14"
33
+ "@uniweb/semantic-parser": "1.0.15"
34
34
  },
35
35
  "scripts": {
36
36
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
package/src/block.js CHANGED
@@ -52,9 +52,6 @@ export default class Block {
52
52
  ? blockData.subsections.map((block, i) => new Block(block, `${id}_${i}`))
53
53
  : []
54
54
 
55
- // Input data
56
- this.input = blockData.input || null
57
-
58
55
  // Fetch configuration (from section frontmatter)
59
56
  // Supports local files (path) or remote URLs (url)
60
57
  this.fetch = blockData.fetch || null
package/src/page.js CHANGED
@@ -26,7 +26,6 @@ export default class Page {
26
26
  this.description = pageData.description || ''
27
27
  this.label = pageData.label || null // Short label for navigation (null = use title)
28
28
  this.keywords = pageData.keywords || null
29
- this.order = pageData.order ?? 0
30
29
  this.lastModified = pageData.lastModified || null
31
30
 
32
31
  // Navigation visibility options
@@ -38,11 +37,8 @@ export default class Page {
38
37
  this.layout = {
39
38
  header: pageData.layout?.header !== false,
40
39
  footer: pageData.layout?.footer !== false,
41
- left: pageData.layout?.left !== false,
42
- right: pageData.layout?.right !== false,
43
- // Aliases for backwards compatibility
44
- leftPanel: pageData.layout?.left !== false,
45
- rightPanel: pageData.layout?.right !== false,
40
+ leftPanel: pageData.layout?.leftPanel !== false,
41
+ rightPanel: pageData.layout?.rightPanel !== false,
46
42
  }
47
43
 
48
44
  // SEO configuration
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
package/src/website.js CHANGED
@@ -167,12 +167,8 @@ export default class Website {
167
167
  }
168
168
  }
169
169
 
170
- // Sort children by order
171
- for (const page of this.pages) {
172
- if (page.children.length > 0) {
173
- page.children.sort((a, b) => (a.order || 0) - (b.order || 0))
174
- }
175
- }
170
+ // Note: Pages arrive pre-sorted from build time.
171
+ // The hierarchy is hydrated from that order - no runtime sorting needed.
176
172
 
177
173
  // Build page ID map for makeHref() resolution
178
174
  // Supports both explicit IDs and route-based lookup
@@ -743,7 +739,7 @@ export default class Website {
743
739
  *
744
740
  * // Custom filtering
745
741
  * const topLevel = website.getPageHierarchy({
746
- * filter: (page) => page.order < 10
742
+ * filter: (page) => !page.route.startsWith('/admin')
747
743
  * })
748
744
  */
749
745
  getPageHierarchy(options = {}) {
@@ -799,7 +795,6 @@ export default class Website {
799
795
  title: page.title,
800
796
  label: page.getLabel(),
801
797
  description: page.description,
802
- order: page.order,
803
798
  hasContent: page.hasContent(),
804
799
  children: nested && page.hasChildren()
805
800
  ? page.children.filter(isPageVisible).map(buildPageInfo)