@uniweb/build 0.8.6 → 0.8.8
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 +4 -4
- package/src/prerender.js +19 -3
- package/src/schema.js +17 -13
- package/src/theme/processor.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/build",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.8",
|
|
4
4
|
"description": "Build tooling for the Uniweb Component Web Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
},
|
|
52
52
|
"optionalDependencies": {
|
|
53
53
|
"@uniweb/content-reader": "1.1.4",
|
|
54
|
-
"@uniweb/
|
|
55
|
-
"@uniweb/
|
|
54
|
+
"@uniweb/schemas": "0.2.1",
|
|
55
|
+
"@uniweb/runtime": "0.6.6"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@tailwindcss/vite": "^4.0.0",
|
|
62
62
|
"@vitejs/plugin-react": "^4.0.0 || ^5.0.0",
|
|
63
63
|
"vite-plugin-svgr": "^4.0.0",
|
|
64
|
-
"@uniweb/core": "0.5.
|
|
64
|
+
"@uniweb/core": "0.5.6"
|
|
65
65
|
},
|
|
66
66
|
"peerDependenciesMeta": {
|
|
67
67
|
"vite": {
|
package/src/prerender.js
CHANGED
|
@@ -483,7 +483,7 @@ function renderBackground(background) {
|
|
|
483
483
|
* Mirrors BlockRenderer.jsx but without hooks (no runtime data fetching in SSR).
|
|
484
484
|
* block.dataLoading is always false at prerender time — runtime fetches only happen client-side.
|
|
485
485
|
*/
|
|
486
|
-
function renderBlock(block) {
|
|
486
|
+
function renderBlock(block, { pure = false } = {}) {
|
|
487
487
|
const Component = block.initComponent()
|
|
488
488
|
|
|
489
489
|
if (!Component) {
|
|
@@ -518,6 +518,13 @@ function renderBlock(block) {
|
|
|
518
518
|
}
|
|
519
519
|
}
|
|
520
520
|
|
|
521
|
+
const componentProps = { content, params, block }
|
|
522
|
+
|
|
523
|
+
// Pure mode: render component without section wrapper (used by ChildBlocks)
|
|
524
|
+
if (pure) {
|
|
525
|
+
return React.createElement(Component, componentProps)
|
|
526
|
+
}
|
|
527
|
+
|
|
521
528
|
// Background handling (mirrors BlockRenderer.jsx)
|
|
522
529
|
const { background, ...wrapperProps } = getWrapperProps(block)
|
|
523
530
|
|
|
@@ -537,8 +544,6 @@ function renderBlock(block) {
|
|
|
537
544
|
// Use Component.as as the wrapper tag (default: 'section')
|
|
538
545
|
const wrapperTag = Component.as || 'section'
|
|
539
546
|
|
|
540
|
-
const componentProps = { content, params, block }
|
|
541
|
-
|
|
542
547
|
if (hasBackground) {
|
|
543
548
|
return React.createElement(wrapperTag, wrapperProps,
|
|
544
549
|
renderBackground(background),
|
|
@@ -795,6 +800,17 @@ export async function prerenderSite(siteDir, options = {}) {
|
|
|
795
800
|
uniweb.foundationConfig.layoutMeta = foundation.default.layoutMeta
|
|
796
801
|
}
|
|
797
802
|
|
|
803
|
+
// Set childBlockRenderer so foundation components using ChildBlocks/Visual
|
|
804
|
+
// can render child blocks and insets during prerender (inline, no hooks)
|
|
805
|
+
uniweb.childBlockRenderer = function InlineChildBlocks({ blocks, from, pure = false }) {
|
|
806
|
+
const blockList = blocks || from?.childBlocks || []
|
|
807
|
+
return blockList.map((childBlock, index) =>
|
|
808
|
+
React.createElement(React.Fragment, { key: childBlock.id || index },
|
|
809
|
+
renderBlock(childBlock, { pure })
|
|
810
|
+
)
|
|
811
|
+
)
|
|
812
|
+
}
|
|
813
|
+
|
|
798
814
|
// Pre-fetch icons for SSR embedding
|
|
799
815
|
await prefetchIcons(siteContent, uniweb, onProgress)
|
|
800
816
|
|
package/src/schema.js
CHANGED
|
@@ -243,22 +243,26 @@ async function discoverSectionsInPath(srcDir, sectionsRelPath) {
|
|
|
243
243
|
// Discover directories at root
|
|
244
244
|
for (const entry of entries) {
|
|
245
245
|
if (!entry.isDirectory()) continue
|
|
246
|
-
if (!isComponentFileName(entry.name)) continue
|
|
247
246
|
|
|
248
247
|
const dirPath = join(fullPath, entry.name)
|
|
249
248
|
const relativePath = join(sectionsRelPath, entry.name)
|
|
250
|
-
const result = await loadComponentMeta(dirPath)
|
|
251
249
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
250
|
+
// PascalCase directories are addressable section types at root
|
|
251
|
+
if (isComponentFileName(entry.name)) {
|
|
252
|
+
const result = await loadComponentMeta(dirPath)
|
|
253
|
+
|
|
254
|
+
if (result && result.meta) {
|
|
255
|
+
// Has meta.js — use explicit meta
|
|
256
|
+
if (result.meta.hidden) continue
|
|
257
|
+
components[entry.name] = buildComponentEntry(entry.name, relativePath, result.meta)
|
|
258
|
+
} else if (hasEntryFile(dirPath, entry.name)) {
|
|
259
|
+
// No meta.js but has entry file — implicit section type at root
|
|
260
|
+
components[entry.name] = buildComponentEntry(entry.name, relativePath, createImplicitMeta(entry.name))
|
|
261
|
+
}
|
|
259
262
|
}
|
|
260
263
|
|
|
261
|
-
//
|
|
264
|
+
// Always recurse — lowercase directories (e.g. insets/) may contain
|
|
265
|
+
// nested section types with meta.js
|
|
262
266
|
await discoverNestedSections(srcDir, dirPath, relativePath, components)
|
|
263
267
|
}
|
|
264
268
|
|
|
@@ -338,7 +342,7 @@ export async function discoverLayoutsInPath(srcDir, layoutsRelPath = LAYOUTS_PAT
|
|
|
338
342
|
const result = await loadComponentMeta(dirPath)
|
|
339
343
|
|
|
340
344
|
if (result && result.meta) {
|
|
341
|
-
if (result.meta.
|
|
345
|
+
if (result.meta.hidden) continue
|
|
342
346
|
layouts[entry.name] = buildComponentEntry(entry.name, relativePath, result.meta)
|
|
343
347
|
} else if (hasEntryFile(dirPath, entry.name)) {
|
|
344
348
|
layouts[entry.name] = buildComponentEntry(entry.name, relativePath, createImplicitMeta(entry.name))
|
|
@@ -372,7 +376,7 @@ async function discoverNestedSections(srcDir, parentFullPath, parentRelPath, com
|
|
|
372
376
|
const result = await loadComponentMeta(dirPath)
|
|
373
377
|
|
|
374
378
|
if (result && result.meta) {
|
|
375
|
-
if (result.meta.
|
|
379
|
+
if (result.meta.hidden) continue
|
|
376
380
|
components[entry.name] = buildComponentEntry(entry.name, relativePath, result.meta)
|
|
377
381
|
}
|
|
378
382
|
|
|
@@ -406,7 +410,7 @@ async function discoverExplicitSectionsInPath(srcDir, relativePath) {
|
|
|
406
410
|
|
|
407
411
|
if (result && result.meta) {
|
|
408
412
|
// Check if explicitly hidden from discovery
|
|
409
|
-
if (result.meta.
|
|
413
|
+
if (result.meta.hidden) {
|
|
410
414
|
continue
|
|
411
415
|
}
|
|
412
416
|
|
package/src/theme/processor.js
CHANGED
|
@@ -23,11 +23,11 @@ const NEUTRAL_PRESETS = {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* Default inline text styles (content-author markdown: [text]{
|
|
26
|
+
* Default inline text styles (content-author markdown: [text]{accent})
|
|
27
27
|
* These reference semantic tokens so they adapt to context automatically
|
|
28
28
|
*/
|
|
29
29
|
const DEFAULT_INLINE = {
|
|
30
|
-
|
|
30
|
+
accent: {
|
|
31
31
|
color: 'var(--link)',
|
|
32
32
|
'font-weight': '600',
|
|
33
33
|
},
|