@uniweb/build 0.1.25 → 0.1.26
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/prerender.js +58 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/build",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.26",
|
|
4
4
|
"description": "Build tooling for the Uniweb Component Web Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@tailwindcss/vite": "^4.0.0",
|
|
60
60
|
"@vitejs/plugin-react": "^4.0.0 || ^5.0.0",
|
|
61
61
|
"vite-plugin-svgr": "^4.0.0",
|
|
62
|
-
"@uniweb/core": "0.1.
|
|
62
|
+
"@uniweb/core": "0.1.12"
|
|
63
63
|
},
|
|
64
64
|
"peerDependenciesMeta": {
|
|
65
65
|
"vite": {
|
package/src/prerender.js
CHANGED
|
@@ -263,35 +263,69 @@ function PageRenderer({ page, foundation }) {
|
|
|
263
263
|
)
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
+
/**
|
|
267
|
+
* Guarantee item has flat content structure
|
|
268
|
+
*/
|
|
269
|
+
function guaranteeItemStructure(item) {
|
|
270
|
+
return {
|
|
271
|
+
title: item.title || '',
|
|
272
|
+
pretitle: item.pretitle || '',
|
|
273
|
+
subtitle: item.subtitle || '',
|
|
274
|
+
paragraphs: item.paragraphs || [],
|
|
275
|
+
links: item.links || [],
|
|
276
|
+
imgs: item.imgs || [],
|
|
277
|
+
lists: item.lists || [],
|
|
278
|
+
icons: item.icons || [],
|
|
279
|
+
videos: item.videos || [],
|
|
280
|
+
buttons: item.buttons || [],
|
|
281
|
+
properties: item.properties || {},
|
|
282
|
+
cards: item.cards || [],
|
|
283
|
+
documents: item.documents || [],
|
|
284
|
+
forms: item.forms || [],
|
|
285
|
+
quotes: item.quotes || [],
|
|
286
|
+
headings: item.headings || [],
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
266
290
|
/**
|
|
267
291
|
* Guarantee content structure exists (mirrors runtime/prepare-props.js)
|
|
268
|
-
* Returns a content object with all standard
|
|
292
|
+
* Returns a flat content object with all standard fields guaranteed to exist
|
|
269
293
|
*/
|
|
270
294
|
function guaranteeContentStructure(parsedContent) {
|
|
271
295
|
const content = parsedContent || {}
|
|
272
296
|
|
|
273
|
-
// Spread content first, then override with guaranteed structure
|
|
274
|
-
// This ensures main.body.paragraphs etc. are always arrays
|
|
275
297
|
return {
|
|
276
|
-
//
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
298
|
+
// Flat header fields
|
|
299
|
+
title: content.title || '',
|
|
300
|
+
pretitle: content.pretitle || '',
|
|
301
|
+
subtitle: content.subtitle || '',
|
|
302
|
+
subtitle2: content.subtitle2 || '',
|
|
303
|
+
alignment: content.alignment || null,
|
|
304
|
+
|
|
305
|
+
// Flat body fields
|
|
306
|
+
paragraphs: content.paragraphs || [],
|
|
307
|
+
links: content.links || [],
|
|
308
|
+
imgs: content.imgs || [],
|
|
309
|
+
lists: content.lists || [],
|
|
310
|
+
icons: content.icons || [],
|
|
311
|
+
videos: content.videos || [],
|
|
312
|
+
buttons: content.buttons || [],
|
|
313
|
+
properties: content.properties || {},
|
|
314
|
+
propertyBlocks: content.propertyBlocks || [],
|
|
315
|
+
cards: content.cards || [],
|
|
316
|
+
documents: content.documents || [],
|
|
317
|
+
forms: content.forms || [],
|
|
318
|
+
quotes: content.quotes || [],
|
|
319
|
+
headings: content.headings || [],
|
|
320
|
+
|
|
321
|
+
// Items with guaranteed structure
|
|
322
|
+
items: (content.items || []).map(guaranteeItemStructure),
|
|
323
|
+
|
|
324
|
+
// Sequence for ordered rendering
|
|
325
|
+
sequence: content.sequence || [],
|
|
326
|
+
|
|
327
|
+
// Preserve raw content if present
|
|
328
|
+
raw: content.raw,
|
|
295
329
|
}
|
|
296
330
|
}
|
|
297
331
|
|
|
@@ -343,9 +377,9 @@ function BlockRenderer({ block, foundation }) {
|
|
|
343
377
|
|
|
344
378
|
// Build content and params with runtime guarantees (same as runtime's BlockRenderer)
|
|
345
379
|
let content, params
|
|
346
|
-
if (block.parsedContent?.
|
|
380
|
+
if (block.parsedContent?._isPoc) {
|
|
347
381
|
// Simple PoC format - content was passed directly
|
|
348
|
-
content = block.parsedContent.
|
|
382
|
+
content = block.parsedContent._pocContent
|
|
349
383
|
params = block.properties
|
|
350
384
|
} else {
|
|
351
385
|
// Apply param defaults from meta.js
|