@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 +2 -2
- package/src/analytics.js +5 -0
- package/src/block.js +14 -30
- package/src/datastore.js +2 -0
- package/src/entity-store.js +2 -0
- package/src/page.js +2 -0
- package/src/theme.js +2 -0
- package/src/uniweb.js +2 -0
- package/src/website.js +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/core",
|
|
3
|
-
"version": "0.5.
|
|
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.
|
|
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
|
|
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
|
|
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
|
-
|
|
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
package/src/entity-store.js
CHANGED
package/src/page.js
CHANGED
package/src/theme.js
CHANGED
package/src/uniweb.js
CHANGED
package/src/website.js
CHANGED