@uniweb/build 0.1.24 → 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 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/build",
3
- "version": "0.1.24",
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,33 +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
297
  return {
274
- // Main content section
275
- main: {
276
- header: {
277
- title: content.main?.header?.title || '',
278
- pretitle: content.main?.header?.pretitle || '',
279
- subtitle: content.main?.header?.subtitle || '',
280
- },
281
- body: {
282
- paragraphs: content.main?.body?.paragraphs || [],
283
- links: content.main?.body?.links || [],
284
- imgs: content.main?.body?.imgs || [],
285
- lists: content.main?.body?.lists || [],
286
- icons: content.main?.body?.icons || [],
287
- },
288
- },
289
- // Content items (H3 sections)
290
- items: content.items || [],
291
- // Preserve any additional fields from parser
292
- ...content,
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,
293
329
  }
294
330
  }
295
331
 
@@ -341,9 +377,9 @@ function BlockRenderer({ block, foundation }) {
341
377
 
342
378
  // Build content and params with runtime guarantees (same as runtime's BlockRenderer)
343
379
  let content, params
344
- if (block.parsedContent?.raw) {
380
+ if (block.parsedContent?._isPoc) {
345
381
  // Simple PoC format - content was passed directly
346
- content = block.parsedContent.raw
382
+ content = block.parsedContent._pocContent
347
383
  params = block.properties
348
384
  } else {
349
385
  // Apply param defaults from meta.js