@uniweb/runtime 0.8.41 → 0.9.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/runtime",
3
- "version": "0.8.41",
3
+ "version": "0.9.0",
4
4
  "description": "Minimal runtime for loading Uniweb foundations",
5
5
  "type": "module",
6
6
  "exports": {
@@ -35,15 +35,15 @@
35
35
  "node": ">=20.19"
36
36
  },
37
37
  "dependencies": {
38
- "@uniweb/core": "0.7.33",
39
- "@uniweb/theming": "0.1.14"
38
+ "@uniweb/core": "0.8.0",
39
+ "@uniweb/theming": "0.1.15"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@vitejs/plugin-react": "^4.5.2",
43
43
  "esbuild": "^0.21.0 || ^0.23.0 || ^0.24.0 || ^0.25.0 || ^0.27.0",
44
44
  "vite": "^7.3.1",
45
45
  "vitest": "^4.1.7",
46
- "@uniweb/build": "0.15.11"
46
+ "@uniweb/build": "0.15.14"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "react": "^19.0.0",
package/src/setup.js CHANGED
@@ -218,11 +218,16 @@ function createIconResolver(iconConfig = {}) {
218
218
 
219
219
  function buildDefaultFetcher(content) {
220
220
  // Base for resolving local absolute paths (e.g. /data/*.json). Prefer the base
221
- // the PAYLOAD carries (`content.config.base`) — a backend-hosted SPA is served
222
- // under a subpath the payload declares (e.g. /gateway/site/<uuid>/) that the
223
- // gateway-delivered runtime bundle can't know via Vite's build-time BASE_URL.
224
- // This is the SAME base routing uses; without it local fetches hit the origin
225
- // root and 404. Falls back to Vite's BASE_URL for a statically built site.
221
+ // the PAYLOAD carries (`content.config.base`) — a host-served SPA runs under
222
+ // whatever subpath its host declares, which a host-delivered runtime bundle
223
+ // cannot know from Vite's build-time BASE_URL. This is the SAME base routing
224
+ // uses; without it local fetches hit the origin root and 404. Falls back to
225
+ // Vite's BASE_URL for a statically built site.
226
+ //
227
+ // The runtime models NO host route shape, and must not start: every request it
228
+ // makes is `{base}/…` against a base it was handed. That is what lets a host
229
+ // serve data wherever it likes — including intercepting a site-local path and
230
+ // proxying it onward — with no framework change.
226
231
  const basePath = content?.config?.base || import.meta.env?.BASE_URL || ''
227
232
  // Per-site transport config from `site.yml fetcher:`. The default fetcher
228
233
  // recognizes `baseUrl` and `envelope`; foundations with their own fetchers
@@ -18,7 +18,7 @@ import React from 'react'
18
18
  import { renderToString } from 'react-dom/server'
19
19
  import { createUniweb, resolveDefaultLocale } from '@uniweb/core'
20
20
  import { sectionDomId } from '@uniweb/core/section-id'
21
- import { buildSectionOverrides } from '@uniweb/theming'
21
+ import { buildSectionOverrides, FONT_LINKS_MARKER } from '@uniweb/theming'
22
22
  import { prepareProps, getComponentMeta } from './prepare-props.js'
23
23
  import { default404Html } from './default-404.js'
24
24
  import {
@@ -679,7 +679,8 @@ export function injectPageContent(html, renderedContent, page, options = {}) {
679
679
  // the appearance script above was moved out of, four lines below the
680
680
  // comment warning about it — see the note in build/src/prerender.js.
681
681
  // Idempotent, so a shell that already carries the tag is left alone.
682
- const themeCss = page?.website?.themeData?.css
682
+ const themeData = page?.website?.themeData
683
+ const themeCss = themeData?.css
683
684
  if (themeCss && !result.includes('id="uniweb-theme"')) {
684
685
  result = result.replace(
685
686
  '</head>',
@@ -687,6 +688,18 @@ export function injectPageContent(html, renderedContent, page, options = {}) {
687
688
  )
688
689
  }
689
690
 
691
+ // The theme's font <link> tags — same seam, same reasoning. Graph-derived,
692
+ // so a lane that never runs @uniweb/build still gets its webfonts instead of
693
+ // falling back to system faces. Deduped on FONT_LINKS_MARKER rather than an
694
+ // id because <link> tags have none; the marker is owned by @uniweb/theming,
695
+ // which generates the block, so this and @uniweb/build read one literal.
696
+ if (themeData?.links && !result.includes(FONT_LINKS_MARKER)) {
697
+ result = result.replace(
698
+ '</head>',
699
+ ` ${FONT_LINKS_MARKER}\n${themeData.links}\n</head>`
700
+ )
701
+ }
702
+
690
703
  // Inject per-page section override CSS before </head>
691
704
  if (options.sectionOverrideCSS) {
692
705
  const overrideStyle = `<style id="uniweb-page-overrides">\n${options.sectionOverrideCSS}\n</style>`