@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.
Files changed (2) hide show
  1. package/package.json +2 -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.25",
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.11"
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 paths guaranteed to exist
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
- // Preserve any additional fields from parser
277
- ...content,
278
- // Main content section (override with guarantees)
279
- main: {
280
- header: {
281
- title: content.main?.header?.title || '',
282
- pretitle: content.main?.header?.pretitle || '',
283
- subtitle: content.main?.header?.subtitle || '',
284
- },
285
- body: {
286
- paragraphs: content.main?.body?.paragraphs || [],
287
- links: content.main?.body?.links || [],
288
- imgs: content.main?.body?.imgs || [],
289
- lists: content.main?.body?.lists || [],
290
- icons: content.main?.body?.icons || [],
291
- },
292
- },
293
- // Content items (H3 sections)
294
- items: content.items || [],
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?.raw) {
380
+ if (block.parsedContent?._isPoc) {
347
381
  // Simple PoC format - content was passed directly
348
- content = block.parsedContent.raw
382
+ content = block.parsedContent._pocContent
349
383
  params = block.properties
350
384
  } else {
351
385
  // Apply param defaults from meta.js