@uniweb/core 0.5.7 → 0.5.9

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.5.7",
3
+ "version": "0.5.9",
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.1.5"
33
+ "@uniweb/semantic-parser": "1.1.6"
34
34
  },
35
35
  "scripts": {
36
36
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
package/src/analytics.js CHANGED
@@ -48,11 +48,16 @@ export default class Analytics {
48
48
  this.sessionId = this.generateSessionId()
49
49
  this.sessionStart = Date.now()
50
50
 
51
+ // Flush interval ID (for cleanup)
52
+ this.flushIntervalId = null
53
+
51
54
  // Only set up browser handlers if in browser and configured
52
55
  if (isBrowser && this.isEnabled()) {
53
56
  this.setupFlushInterval()
54
57
  this.setupUnloadHandler()
55
58
  }
59
+
60
+ Object.seal(this)
56
61
  }
57
62
 
58
63
  /**
package/src/block.js CHANGED
@@ -106,19 +106,18 @@ export default class Block {
106
106
  if (insetData?.length > 0) {
107
107
  for (let i = 0; i < insetData.length; i++) {
108
108
  const ref = insetData[i]
109
- const description = ref.description || ''
109
+ const title = ref.title || ''
110
110
  const child = new Block(
111
111
  {
112
112
  type: ref.type,
113
113
  params: ref.params || {},
114
- content: { title: description },
114
+ content: { title },
115
115
  stableId: ref.refId,
116
+ refId: ref.refId,
116
117
  },
117
118
  `${id}_inset_${i}`,
118
119
  this.page
119
120
  )
120
- child.inline = true
121
- child.refId = ref.refId
122
121
  this.insets.push(child)
123
122
  }
124
123
  }
@@ -131,6 +130,13 @@ export default class Block {
131
130
  // Components check this to show loading UI (spinners, skeletons)
132
131
  this.dataLoading = false
133
132
 
133
+ // Whether engine-level background is active (set by BlockRenderer/prerender)
134
+ // Components check this to skip their own opaque background
135
+ this.hasBackground = false
136
+
137
+ // Inset identity — set on inset blocks for lookup via getInset()
138
+ this.refId = blockData.refId || null
139
+
134
140
  // Dynamic route context (params from URL matching)
135
141
  // Set when accessing a dynamic page like /blog/:slug -> /blog/my-post
136
142
  this.dynamicContext = blockData.dynamicContext || null
@@ -142,6 +148,8 @@ export default class Block {
142
148
 
143
149
  // Context (static, defined per component type)
144
150
  this.context = null
151
+
152
+ Object.seal(this)
145
153
  }
146
154
 
147
155
  /**
@@ -279,31 +287,6 @@ export default class Block {
279
287
  return this.Component
280
288
  }
281
289
 
282
- /**
283
- * Get structured block content for components
284
- * Returns flat content structure
285
- */
286
- getBlockContent() {
287
- const c = this.parsedContent || {}
288
-
289
- return {
290
- pretitle: c.pretitle || '',
291
- title: c.title || '',
292
- subtitle: c.subtitle || '',
293
- description: c.subtitle2 || '',
294
- paragraphs: c.paragraphs || [],
295
- images: c.images || [],
296
- links: c.links || [],
297
- icons: c.icons || [],
298
- properties: c.propertyBlocks?.[0] || c.properties || {},
299
- videos: c.videos || [],
300
- lists: c.lists || [],
301
- buttons: c.buttons || [],
302
- items: c.items || [],
303
- data: c.data || {}
304
- }
305
- }
306
-
307
290
  /**
308
291
  * Get block properties
309
292
  */
@@ -480,7 +463,8 @@ export default class Block {
480
463
  }
481
464
 
482
465
  // Anything else → CSS color (hex, rgb, hsl, oklch, named color, var())
483
- return { mode: 'color', color: raw }
466
+ // Resolve bare palette refs (e.g. "primary-900" → "var(--primary-900)")
467
+ return { mode: 'color', color: resolveOverrideValue(raw) }
484
468
  }
485
469
 
486
470
  // Object with explicit mode — pass through
package/src/datastore.js CHANGED
@@ -25,6 +25,8 @@ export default class DataStore {
25
25
  this._cache = new Map()
26
26
  this._inflight = new Map()
27
27
  this._fetcher = null
28
+
29
+ Object.seal(this)
28
30
  }
29
31
 
30
32
  /**
@@ -18,6 +18,8 @@ export default class EntityStore {
18
18
  */
19
19
  constructor({ dataStore }) {
20
20
  this.dataStore = dataStore
21
+
22
+ Object.seal(this)
21
23
  }
22
24
 
23
25
  /**
package/src/page.js CHANGED
@@ -74,6 +74,8 @@ export default class Page {
74
74
  // Layout panels (header, footer, left, right) are shared at Website level
75
75
  this._bodySections = pageData.sections
76
76
  this._bodyBlocks = null
77
+
78
+ Object.seal(this)
77
79
  }
78
80
 
79
81
  /**
package/src/theme.js CHANGED
@@ -61,6 +61,8 @@ export default class Theme {
61
61
  this._appearance = themeData.appearance || { default: 'light' }
62
62
  this._foundationVars = themeData.foundationVars || {}
63
63
  this._css = themeData.css || null
64
+
65
+ Object.seal(this)
64
66
  }
65
67
 
66
68
  /**
package/src/uniweb.js CHANGED
@@ -29,6 +29,8 @@ export default class Uniweb {
29
29
 
30
30
  // Initialize analytics (disabled by default, configure via site config)
31
31
  this.analytics = new Analytics(configData.analytics || {})
32
+
33
+ Object.seal(this)
32
34
  }
33
35
 
34
36
  /**
package/src/website.js CHANGED
@@ -94,6 +94,8 @@ export default class Website {
94
94
  // Versioned scopes: route → { versions, latestId }
95
95
  // Scopes are routes where versioning starts (e.g., '/docs')
96
96
  this.versionedScopes = versionedScopes
97
+
98
+ Object.seal(this)
97
99
  }
98
100
 
99
101
  /**