uniweb 1.24.15 → 1.24.17

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",
3
- "version": "1.24.15",
3
+ "version": "1.24.17",
4
4
  "description": "Create structured Vite + React sites with content/code separation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -42,14 +42,14 @@
42
42
  "prompts": "^2.4.2",
43
43
  "tar": "^7.5.21",
44
44
  "@uniweb/schemas": "~1.6.7",
45
- "@uniweb/semantic-parser": "~1.13.0",
46
- "@uniweb/core": "~1.5.1",
45
+ "@uniweb/core": "~1.5.2",
46
+ "@uniweb/semantic-parser": "~1.13.1",
47
47
  "@uniweb/content-writer": "~1.3.1"
48
48
  },
49
49
  "peerDependencies": {
50
- "@uniweb/semantic-parser": "~1.13.0",
51
- "@uniweb/content-reader": "~1.5.7",
52
- "@uniweb/build": "~1.13.8"
50
+ "@uniweb/build": "~1.13.10",
51
+ "@uniweb/semantic-parser": "~1.13.1",
52
+ "@uniweb/content-reader": "~1.5.8"
53
53
  },
54
54
  "peerDependenciesMeta": {
55
55
  "@uniweb/build": {
@@ -363,7 +363,7 @@ Heading levels set *structure* (pretitle, title, subtitle), not font size — th
363
363
 
364
364
  **Markdown order ≠ rendering order.** The parser extracts content into a flat structure; the component decides how to arrange it visually. Write markdown in semantic order, not visual order — start with the heading, then add icons, images, and text in any order.
365
365
 
366
- **Placing content *before* the first heading changes the parse:** headings after body content become items, not the section title. This is by design — it's how repeating content groups are created.
366
+ **Placing content *before* the first heading changes the parse:** headings after body content become items, not the section title. This is by design — it's how repeating content groups are created. An icon counts: `![](lu-globe)` above `# Title` leaves `content.title` empty, and the heading in `items[0]`. For an icon that belongs to the title, write it under the heading, where it's still `content.icons[0]`; `uniweb inspect` flags the shape.
367
367
 
368
368
  ### The parsed object
369
369
 
@@ -378,10 +378,11 @@ content = {
378
378
  subtitle: '', // Line(s) one step below the title — each further
379
379
  // one-step descent is another line (string or string[])
380
380
  paragraphs: [], // Text blocks
381
- links: [], // { href, label, role } — standalone links (not inside lists)
382
- images: [], // { src, alt, role, href }
381
+ links: [], // { href, label, role } — the body's links, not those inside lists: standalone ones, and inline ones (no `children`)
382
+ images: [], // { url, alt, caption, role, href, target } — `url`, where a video has `src`
383
383
  icons: [], // { library, name, role }
384
- videos: [], // { src, alt, role, poster, href }
384
+ videos: [], // { src, alt, caption, role, poster, href, target }
385
+ media: [], // Images, videos and insets on their own line, in the order written, each with its `kind`
385
386
  documents: [], // { url, alt, caption, role: 'pdf', preview?, author?, description? } — from {role=pdf}
386
387
  insets: [], // Inline @Component references — { refId }
387
388
  lists: [], // [[{ paragraphs, links, lists, … }]] — each item is an object, not a string
@@ -559,7 +560,7 @@ Sizing and loading ride on the image: `{width=800 height=600 loading=lazy fit=co
559
560
 
560
561
  **Separators are forgiving.** `:` works wherever `=` does, and pairs may be separated by whitespace, a comma, or both — `{role=banner width=1200}`, `{role:banner, width:1200}` and `{role:banner,width:1200}` are identical. `=` and spaces are canonical, and that is what gets written back on save. Two rules keep it unambiguous: the separator must **touch** the key (`{note:warning}` is one pair, `{note : warning}` is two flags), and a value containing a **comma** must be quoted (`{style="a, b"}`). A value containing a colon needs no quoting — only the first colon separates, so `{href:https://example.com}` is fine.
561
562
 
562
- Standalone links (alone on a line) are promoted to `content.links[]` — usually drawn as buttons, which is the component's choice. Inline links stay as `<a>` tags inside `content.paragraphs[]`. Multiple links sharing a paragraph are all promoted:
563
+ Standalone links (alone on a line) are promoted to `content.links[]` — usually drawn as buttons, which is the component's choice. An inline link stays as an `<a>` tag inside `content.paragraphs[]`, and is listed in `content.links[]` too, without `children`: a section drawing `content.links` as buttons draws it as one unless it keeps only the links with `children`. Multiple links sharing a paragraph are all promoted:
563
564
 
564
565
  ```markdown
565
566
  [Primary](/start) ← standalone → content.links[0]
@@ -736,7 +737,7 @@ end the list with `...`.**
736
737
 
737
738
  **Content-less containers:** folders with `page.yml` but no markdown are structural groups (`hasContent: false`). Visiting one auto-redirects to the first descendant with content — this is what supports courses → modules → lessons at any depth.
738
739
 
739
- **A local folder for a mounted route should use `folder.yml`, not `page.yml`.** The filename is how you say what the folder holds — `page.yml` for a page built from sections, `folder.yml` for a folder of pages — and for a mount that answer also decides how the mounted tree is read. A `page.yml` stub over a mounted folder of pages says "sections", and top-level markdown in the mounted repo collapses into one page instead of becoming pages of its own. Keep `layout:`, `title:` and SEO in that stub; the mounted repo's own `folder.yml` supplies its ordering and title where the stub is silent.
740
+ **A local folder for a mounted route says how this site presents it.** Keep `layout:`, `title:` and SEO in a `folder.yml` there; the mounted repo's own `folder.yml` supplies its ordering and title where the stub is silent. A `page.yml` with markdown of its own makes a real page above the mounted pages, a landing page for the branch. A mount is one level under `pages/`, and a subfolder in the local folder isn't read, since the branch's pages come from the mount; the build says so. What a site can't do from outside a repo it mounts: leave a file out, title or order a nested folder, or use a `README.md` as a page. Those are the mounted repo's to do. A relative link to a markdown file (`./deploying.md#setup`), which is how docs in a repo link to each other, leads to the page that file became, built or pushed; the build names one that leads nowhere.
740
741
 
741
742
  **SEO & social cards:** set site-wide defaults in `site.yml`; any page overrides per-field in `page.yml` (page wins, site fills gaps). Each page's static `<head>` carries its own tags — Open Graph, Twitter Card, canonical, robots, and hreflang on a multilingual site — so shares and crawlers see them without running JS. The social `image` is the field most worth setting once at site level — a 1200×630 JPEG or PNG, since link previews draw 1.91:1 and most draw no SVG; the site's `description` is the home page's alone, and each page's own reads best under about 160 characters. These tags are the framework's: a `head.html` tag of the same name is replaced. `uniweb doctor` checks what a link shows: the image is there, in a format previews draw and close to 1200×630, and each page has a description of a length search results show whole.
742
743
 
@@ -1123,8 +1124,8 @@ Kit provides `H1`–`H6`. These render their own HTML tag — **don't wrap them*
1123
1124
  ```jsx
1124
1125
  import { Section, Prose } from '@uniweb/kit'
1125
1126
 
1126
- <Section block={block} width="lg" padding="md" />
1127
- <Prose content={content} block={block} />
1127
+ <Section block={block} width="lg" padding="md" /> // the whole section, on its own
1128
+ <Prose content={content} block={block} /> // or only its prose, in your own markup
1128
1129
  ```
1129
1130
 
1130
1131
  `Prose` renders from the parsed sequence — headings, paragraphs, images, snippets, lists — with prose typography. Tagged data blocks are **skipped**; access them via `content.data` for custom rendering. Pass `content` (needs `.sequence`), and `block` too if the content uses insets. Also works as a pure typography wrapper: `<Prose>{children}</Prose>`.
@@ -1197,11 +1198,11 @@ Hero.as = 'div' // changes the wrapper element
1197
1198
  export default Hero
1198
1199
  ```
1199
1200
 
1200
- **Layout components typically need `p-0`** to suppress default padding:
1201
+ **A section's wrapper is a bare `<section>`**, with no padding of its own to reset. `className` adds classes to it, and `as` changes its tag. The built-in layout already wraps the header area in `<header>` and the footer area in `<footer>`, so there `Header.as = 'header'` gives a header in a header. Use `as` to say something the layout doesn't:
1201
1202
 
1202
1203
  ```jsx
1203
- Header.className = 'p-0'
1204
- Header.as = 'header'
1204
+ Header.className = 'border-b'
1205
+ Header.as = 'div'
1205
1206
  ```
1206
1207
 
1207
1208
  **A header that stays in view is a setting, not a class.** `sticky top-0` on your component's outermost element does nothing: a sticky element moves only within its parent, and the section's wrapper and the area's are as tall as your header. (An element inside your component is different: a form beside a long list sticks within the row the two share, a box you draw.) Declare `sticky: true` in the type's `meta.js` — an author turns it off with `sticky: false` — and the runtime makes sticky the box that can stay in view. A section in the body sticks the same way and stays below the stuck header by itself: the runtime measures how far the header reaches and publishes it as `--uw-sticky-top` (a type's `top` overrides it). A link to a section lands below the stuck header too. A child section in kit's `<ChildGrid>` stays in view beside the column it sits next to, and on a phone, at one column, scrolls with the page. A sticky section inside a box with `overflow: hidden` cannot stick — clip with `overflow: clip`. A layout of your own that wraps an area in an element makes that element sticky when `page.isSticky('header')`. `uniweb dev` names a sticky element that cannot move in the console, once the page's data is in, and says which box holds it.
@@ -1556,6 +1557,8 @@ Font families are a **site** setting, under `fonts:` in `theme.yml`. A foundatio
1556
1557
 
1557
1558
  (`code` was previously named `mono`; `fonts.mono` is no longer an alias — rename it.)
1558
1559
 
1560
+ A role's face on an element it isn't wired onto, such as a wordmark in the heading face: `font-family: var(--font-heading)`, or a utility of your own with `@theme inline { --font-display: var(--font-heading); }` in `styles.css`, then `font-display`.
1561
+
1559
1562
  Because the site wires families onto real elements, **the norm is that a foundation doesn't set fonts itself** — render semantic markup (`<H1>`, `<P>`, `<code>` from the kit) and the roles apply. Everything else stays Tailwind.
1560
1563
 
1561
1564
  **In a component, weight is yours; family is the site's.** Weight/size/style utilities (`font-bold`, `italic`, `text-xl`) are ordinary design vocabulary. A font-**family** utility is different: `font-sans`/`font-serif` resolve to Tailwind's built-in stacks unless the foundation makes them site-controlled, so a bare `font-serif` silently hardcodes a typeface.
@@ -1603,14 +1606,14 @@ The build auto-adds preconnect hints for imports, emits `@font-face` + preload f
1603
1606
  @import "@uniweb/kit/theme-tokens.css";
1604
1607
  @source "./sections/**/*.{js,jsx}";
1605
1608
  @source "./components/**/*.{js,jsx}";
1606
- @source "../node_modules/@uniweb/kit/src/**/*.jsx";
1609
+ @source "./layouts/**/*.{js,jsx}";
1607
1610
 
1608
1611
  @theme {
1609
1612
  --breakpoint-xs: 30rem;
1610
1613
  }
1611
1614
  ```
1612
1615
 
1613
- Semantic tokens come from `theme-tokens.css` (populated from `theme.yml`). Use `@theme` only for values tokens don't cover. **Custom CSS is expected alongside Tailwind** — shadow systems, border hierarchies, gradients, glassmorphism. Tailwind handles layout; tokens handle context; `styles.css` handles everything else.
1616
+ Semantic tokens come from `theme-tokens.css` (populated from `theme.yml`). It also tells Tailwind to read kit's source, so kit's own classes reach your CSS wherever your package manager put kit. A foundation that skips the import names kit itself, by where kit is: `./node_modules/@uniweb/kit/src/**` under pnpm, `../node_modules/@uniweb/kit/src/**` under npm. Use `@theme` only for values tokens don't cover. **Custom CSS is expected alongside Tailwind** — shadow systems, border hierarchies, gradients, glassmorphism. Tailwind handles layout; tokens handle context; `styles.css` handles everything else.
1614
1617
 
1615
1618
  **Tokens are a floor, not a ceiling.** They solve context adaptation — the hard problem. A great foundation adds design vocabulary on top:
1616
1619
 
@@ -2984,7 +2987,7 @@ which is `$devBackend:`.
2984
2987
 
2985
2988
  Either side can publish. Nothing about this changes how you build: the same foundation and the same site run under `uniweb dev`, `uniweb export`, or a CI deploy with no account at all.
2986
2989
 
2987
- **Publishing vs registering.** Foundations on Uniweb Cloud live in the catalog as `@org/name@version` — `name` from the foundation's `main.js`. When a foundation powers a single site, **don't run `uniweb register` yourself** — `uniweb publish` from the site directory releases the local foundation to the catalog (when its code changed) and goes live in one step. A registered version is immutable, so when the foundation's code changed under a version already registered, `push` and `publish` release the change under the next version and write it into the foundation's `package.json` — commit that file (`--no-release` sends the content without the code). The version it picks is always the next patch: for a change that is not backwards compatible, set a higher minor or major version in the foundation's `package.json` yourself before you push. They stop when the registry holds a version newer than yours, released from another copy: pull that change first, or pass `--bump` to release yours above it. Register deliberately only when the foundation is a product meant for multiple sites; consuming sites then pin `foundation: '@org/name@1.2.3'`. **The catalog is private and access-segregated, not a public package registry** — people see only the foundations licensed to sites they own or edit. The *site* carries the license, and it rides along with site ownership when a developer hands a site to a client. Don't describe publishing as making a foundation publicly discoverable. Schemas can also be registered on their own from a schemas-only package (`@uniweb/schemas`, any `@org/schemas`, or a bare folder of `schemas/*.{yml,json,js}`) — that's how `@std` schemas are published. Auth via `uniweb login` (`uniweb login --server <url> --token <bearer>` without a terminal) or `UNIWEB_TOKEN`; preview with `--dry-run`.
2990
+ **Publishing vs registering.** Foundations on Uniweb Cloud live in the catalog as `@org/name@version` — `name` from the foundation's `main.js`. When a foundation powers a single site, **don't run `uniweb register` yourself** — `uniweb publish` from the site directory releases the local foundation to the catalog (when its code changed) and goes live in one step. A registered version is immutable, so when the foundation's code changed under a version already registered, `push` and `publish` release the change under the next version and write it into the foundation's `package.json`, which they commit in a git repository (`--no-release` sends the content without the code). The version it picks is always the next patch: for a change that is not backwards compatible, set a higher minor or major version in the foundation's `package.json` yourself before you push. They stop when the registry holds a version newer than yours, released from another copy: pull that change first, or pass `--bump` to release yours above it. Register deliberately only when the foundation is a product meant for multiple sites; consuming sites then pin `foundation: '@org/name@1.2.3'`. **The catalog is private and access-segregated, not a public package registry** — people see only the foundations licensed to sites they own or edit. The *site* carries the license, and it rides along with site ownership when a developer hands a site to a client. Don't describe publishing as making a foundation publicly discoverable. Schemas can also be registered on their own from a schemas-only package (`@uniweb/schemas`, any `@org/schemas`, or a bare folder of `schemas/*.{yml,json,js}`) — that's how `@std` schemas are published. Auth via `uniweb login` (`uniweb login --server <url> --token <bearer>` without a terminal) or `UNIWEB_TOKEN`; preview with `--dry-run`.
2988
2991
 
2989
2992
  ### Staying current
2990
2993
 
@@ -1142,8 +1142,10 @@ export function commitWriteBacks(siteDir, backend, { complete = false, released
1142
1142
  // ⭐ Marked with the backend and the site, so a pull reads the commit a lane names through
1143
1143
  // it (`recordedAfter`, utils/sync-point.js): the ids written back are what the backend holds.
1144
1144
  const site = readBackendState(siteDir, backend).site?.uuid
1145
+ // In a repo of several sites, the log says which one moved.
1146
+ const named = repo.prefix ? repo.prefix.replace(/\/$/, '') : 'the site'
1145
1147
  const made = commitRoots(repo, only || [...sentRoots(siteDir), SYNC_STORE_FILE, ...released], {
1146
- message: `Record what ${backend} gave the site${site ? `\n\n${RECORDED_TRAILER}: ${backend} ${site}` : ''}`,
1148
+ message: `Record what ${backend} gave ${named}${site ? `\n\n${RECORDED_TRAILER}: ${backend} ${site}` : ''}`,
1147
1149
  identity
1148
1150
  })
1149
1151
  if (made && complete) writeSyncPoint(siteDir, backend, made.commit)
@@ -217,7 +217,6 @@ export async function add(rawArgs) {
217
217
  const nonInteractive = isNonInteractive(rawArgs)
218
218
  const args = stripNonInteractiveFlag(rawArgs)
219
219
 
220
- const pm = detectPackageManager()
221
220
  const prefix = getCliPrefix()
222
221
 
223
222
  // Find workspace root
@@ -328,6 +327,11 @@ export async function add(rawArgs) {
328
327
  )
329
328
  const projectName = rootPkg.name || 'my-project'
330
329
 
330
+ // What this workspace installs with is a property of the repo (its lockfile), not of how the
331
+ // CLI happened to be launched: `npx uniweb add` in a pnpm workspace wrote `npm -w` root scripts
332
+ // and said `npm install`. The invocation decides only when there's no lockfile to read.
333
+ const pm = detectWorkspacePm(rootDir) || detectPackageManager()
334
+
331
335
  switch (parsed.subcommand) {
332
336
  case 'project':
333
337
  await addProject(rootDir, projectName, parsed, pm)
@@ -345,16 +349,7 @@ export async function add(rawArgs) {
345
349
  await addSection(rootDir, parsed)
346
350
  break
347
351
  case 'ci':
348
- // The scaffolded workflow must install the way THIS WORKSPACE
349
- // installs, which is a property of the repo (its lockfile), not of
350
- // how the CLI happened to be launched. `detectPackageManager()`
351
- // reads npm_config_user_agent, so `npx uniweb add ci` in a pnpm
352
- // workspace produced a workflow running `npm ci` — which fails on
353
- // the first CI run, because there is no package-lock.json to
354
- // install from. npx is a normal way to run the CLI, so this broke
355
- // the common case. Fall back to the invocation only when the repo
356
- // has no lockfile to read.
357
- await addCi(rootDir, parsed, detectWorkspacePm(rootDir) || pm)
352
+ await addCi(rootDir, parsed, pm)
358
353
  break
359
354
  default:
360
355
  error(`Unknown subcommand: ${parsed.subcommand}`)
@@ -925,7 +920,7 @@ async function addProject(rootDir, projectName, opts, pm = 'pnpm') {
925
920
  {
926
921
  name: foundationPkgName,
927
922
  registryName,
928
- projectName,
923
+ projectName: name,
929
924
  isExtension: false
930
925
  },
931
926
  { onProgress: progressCb }
@@ -937,7 +932,7 @@ async function addProject(rootDir, projectName, opts, pm = 'pnpm') {
937
932
  join(projectDir, 'site'),
938
933
  {
939
934
  name: sitePkgName,
940
- projectName,
935
+ projectName: name,
941
936
  foundationName: foundationPkgName,
942
937
  foundationPath: 'file:../src',
943
938
  foundationRef: foundationPkgName
@@ -951,14 +946,14 @@ async function addProject(rootDir, projectName, opts, pm = 'pnpm') {
951
946
  opts.from,
952
947
  'foundation',
953
948
  join(projectDir, 'src'),
954
- projectName
949
+ name
955
950
  )
956
951
  ensureFoundationName(join(projectDir, 'src'), registryName)
957
952
  await applyFromTemplate(
958
953
  opts.from,
959
954
  'site',
960
955
  join(projectDir, 'site'),
961
- projectName
956
+ name
962
957
  )
963
958
  }
964
959
 
@@ -36,6 +36,7 @@ import { readAgentsVersion } from '../utils/agents-stamp.js'
36
36
  import { writeJsonPreservingStyle } from '../utils/json-file.js'
37
37
  import { surveyWorkspaceDeps } from '../utils/dep-survey.js'
38
38
  import { discoverFoundations, discoverSites } from '../utils/discover.js'
39
+ import { siteAround } from '../utils/pick-site.js'
39
40
  import { checkSiteInstall } from '../utils/install-integrity.js'
40
41
  import { editWorkspaceFilePackages } from '../utils/workspace-packages.js'
41
42
  import { findWorkspaceRoot } from '../utils/workspace.js'
@@ -1295,7 +1296,7 @@ export async function checkLinkPreviews({ sitePath, siteName, issues }) {
1295
1296
  issues.push({ id, type: 'info', site: siteName, message: `${n} page${n === 1 ? ' states' : 's state'} no description` })
1296
1297
  info(`[${id}] ${n} page${n === 1 ? ' states' : 's state'} no description — search results and link previews pick their own text, or show none`)
1297
1298
  listSome(undescribed.map((p) => p.route))
1298
- log(` Give each a ${colors.green}description:${colors.reset} in its page.yml — a sentence or two, under ${DESCRIPTION_SHOWN} characters.`)
1299
+ log(` Give each a ${colors.green}description:${colors.reset} in its page.yml, or the frontmatter of a page that is one file — a sentence or two, under ${DESCRIPTION_SHOWN} characters.`)
1299
1300
  }
1300
1301
  const long = described.filter((p) => p.text.length > DESCRIPTION_SHOWN)
1301
1302
  if (long.length > 0) {
@@ -1928,10 +1929,18 @@ async function runDoctor(args = []) {
1928
1929
 
1929
1930
  // Discover sites via the canonical workspace globs (same rationale as
1930
1931
  // foundations above: respects whatever layout the user chose).
1931
- const sites = (await discoverSites(workspaceDir)).map((s) => ({
1932
+ const allSites = (await discoverSites(workspaceDir)).map((s) => ({
1932
1933
  path: join(workspaceDir, s.path),
1933
1934
  name: s.name
1934
1935
  }))
1936
+ // From inside a site, its checks are that site's, as `status` and `dev` read the folder you
1937
+ // stand in. Other sites' findings are there from the workspace root.
1938
+ const here = siteAround(allSites.map((s) => relative(workspaceDir, s.path)), workspaceDir, projectDir)
1939
+ const sites = here ? allSites.filter((s) => relative(workspaceDir, s.path) === here) : allSites
1940
+ if (here && allSites.length > sites.length) {
1941
+ log('')
1942
+ info(`Checking the site you're in. Run this from ${workspaceDir} for all ${allSites.length}.`)
1943
+ }
1935
1944
 
1936
1945
  if (sites.length === 0) {
1937
1946
  warn('No sites found')
@@ -1943,7 +1952,7 @@ async function runDoctor(args = []) {
1943
1952
  checkSiteNameIsAFolder({
1944
1953
  siteName: s.name,
1945
1954
  sitePath: relative(workspaceDir, s.path),
1946
- packagePaths: [...discovered.map((f) => f.path), ...sites.map((o) => relative(workspaceDir, o.path))],
1955
+ packagePaths: [...discovered.map((f) => f.path), ...allSites.map((o) => relative(workspaceDir, o.path))],
1947
1956
  issues
1948
1957
  })
1949
1958
  }
@@ -80,7 +80,9 @@ async function loadDependencies() {
80
80
  * Extract frontmatter and markdown body from a section file.
81
81
  * Exact match of content-collector lines 634-639.
82
82
  */
83
- function extractFrontmatter(content) {
83
+ function extractFrontmatter(raw) {
84
+ // A file saved on Windows: as the build reads it (`parseFrontmatter`, @uniweb/build).
85
+ const content = raw.replace(/\r\n/g, '\n')
84
86
  let frontMatter = {}
85
87
  let markdown = content
86
88
 
@@ -143,21 +145,27 @@ function guaranteeItemStructure(item) {
143
145
  lists: item.lists || [],
144
146
  icons: item.icons || [],
145
147
  videos: item.videos || [],
148
+ insets: item.insets || [],
149
+ media: item.media || [],
150
+ snippets: item.snippets || [],
146
151
  buttons: item.buttons || [],
147
152
  data: item.data || {},
148
153
  cards: item.cards || [],
149
154
  documents: item.documents || [],
150
155
  forms: item.forms || [],
151
156
  quotes: item.quotes || [],
152
- headings: item.headings || []
157
+ headings: item.headings || [],
158
+ ...(item.math && item.math.length ? { math: item.math } : {}),
159
+ ...(item.tables && item.tables.length ? { tables: item.tables } : {})
153
160
  }
154
161
  }
155
162
 
156
163
  /**
157
- * Guarantee content structure exists.
158
- * Keep in sync with @uniweb/runtime/src/prepare-props.js
164
+ * Guarantee content structure exists: what a component receives.
165
+ * A copy of @uniweb/runtime's, which the CLI can't load without React.
166
+ * _contracts/inspect-shows-what-a-component-receives.test.js fails when they part.
159
167
  */
160
- function guaranteeContentStructure(parsedContent) {
168
+ export function guaranteeContentStructure(parsedContent) {
161
169
  const content = parsedContent || {}
162
170
 
163
171
  return {
@@ -172,6 +180,8 @@ function guaranteeContentStructure(parsedContent) {
172
180
  icons: content.icons || [],
173
181
  videos: content.videos || [],
174
182
  insets: content.insets || [],
183
+ media: content.media || [],
184
+ snippets: content.snippets || [],
175
185
  buttons: content.buttons || [],
176
186
  data: content.data || {},
177
187
  cards: content.cards || [],
@@ -179,6 +189,8 @@ function guaranteeContentStructure(parsedContent) {
179
189
  forms: content.forms || [],
180
190
  quotes: content.quotes || [],
181
191
  headings: content.headings || [],
192
+ ...(content.math && content.math.length ? { math: content.math } : {}),
193
+ ...(content.tables && content.tables.length ? { tables: content.tables } : {}),
182
194
  items: (content.items || []).map(guaranteeItemStructure),
183
195
  sequence: content.sequence || [],
184
196
  raw: content.raw
@@ -170,6 +170,13 @@ async function updateWorkspaceManifestsForFolderMove(rootDir, oldPath, newPath)
170
170
  * foundation` / `add site` already grandfather them at scaffold time.
171
171
  */
172
172
  async function validateRenameName(rootDir, newName) {
173
+ if (newName.startsWith('@')) {
174
+ error(`A package name in a workspace has no scope, and ${newName} does.`)
175
+ log(
176
+ `What a foundation registers as is ${colors.bright}name${colors.reset} in its main.js, and the scope is part of that: name: '${newName}'`
177
+ )
178
+ process.exit(1)
179
+ }
173
180
  if (newName !== 'src' && newName !== 'site') {
174
181
  const valid = validatePackageName(newName)
175
182
  if (valid !== true) {
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-10-31T23:29:29.041Z",
3
+ "generatedAt": "2026-11-01T03:23:57.683Z",
4
4
  "packages": {
5
5
  "@uniweb/api": {
6
6
  "version": "1.6.7"
7
7
  },
8
8
  "@uniweb/build": {
9
- "version": "1.13.8"
9
+ "version": "1.13.10"
10
10
  },
11
11
  "@uniweb/content-reader": {
12
- "version": "1.5.7"
12
+ "version": "1.5.8"
13
13
  },
14
14
  "@uniweb/content-writer": {
15
15
  "version": "1.3.1"
16
16
  },
17
17
  "@uniweb/core": {
18
- "version": "1.5.1"
18
+ "version": "1.5.2"
19
19
  },
20
20
  "@uniweb/frame-bridge": {
21
21
  "version": "1.0.2"
@@ -24,7 +24,7 @@
24
24
  "version": "1.0.7"
25
25
  },
26
26
  "@uniweb/kit": {
27
- "version": "1.6.10"
27
+ "version": "1.6.12"
28
28
  },
29
29
  "@uniweb/loom": {
30
30
  "version": "1.1.2"
@@ -36,7 +36,7 @@
36
36
  "version": "1.2.9"
37
37
  },
38
38
  "@uniweb/runtime": {
39
- "version": "1.3.5"
39
+ "version": "1.3.6"
40
40
  },
41
41
  "@uniweb/scene": {
42
42
  "version": "1.0.1"
@@ -48,19 +48,19 @@
48
48
  "version": "1.1.0"
49
49
  },
50
50
  "@uniweb/semantic-parser": {
51
- "version": "1.13.0"
51
+ "version": "1.13.1"
52
52
  },
53
53
  "@uniweb/snapshot": {
54
54
  "version": "1.1.2"
55
55
  },
56
56
  "@uniweb/templates": {
57
- "version": "1.1.11"
57
+ "version": "1.1.12"
58
58
  },
59
59
  "@uniweb/theming": {
60
60
  "version": "1.2.1"
61
61
  },
62
62
  "@uniweb/unipress": {
63
- "version": "1.1.21"
63
+ "version": "1.1.23"
64
64
  }
65
65
  },
66
66
  "templates": {
@@ -388,9 +388,21 @@ export function computeRootScripts(sites, pm = 'pnpm') {
388
388
  export async function updateRootScripts(rootDir, sites, pm = 'pnpm') {
389
389
  const pkg = await readRootPackageJson(rootDir)
390
390
  const unique = sites.filter((s, i) => sites.findIndex((o) => o.path === s.path) === i)
391
- const newScripts = computeRootScripts(unique, pm)
392
391
  const scripts = { ...(pkg.scripts || {}) }
393
392
 
393
+ // ⭐ `preview` stays on the site it runs. Adding a site is no reason to move it, and
394
+ // "first" follows the listing, so a new site sorted ahead took the script over. A command the
395
+ // CLI didn't write is the person's, and only one for a site that's gone is rewritten.
396
+ const runs = unique.find((s) => cliSiteScripts('preview', s.name).includes(scripts.preview))
397
+ const newScripts = computeRootScripts(runs ? [runs, ...unique.filter((s) => s !== runs)] : unique, pm)
398
+ const previewIsCli = /^(pnpm --filter \S+ (run )?preview|npm -w \S+ run preview)$/.test(scripts.preview ?? '')
399
+ if (scripts.preview && !runs && !previewIsCli) delete newScripts.preview
400
+ // Nor is a script the workspace already has for a site added again under another name.
401
+ const held = new Set(Object.values(scripts))
402
+ for (const [key, command] of Object.entries(newScripts)) {
403
+ if (!(key in scripts) && held.has(command)) delete newScripts[key]
404
+ }
405
+
394
406
  // If we're adding a second site, rename existing dev/preview to dev:{firstName}
395
407
  if (unique.length === 2 && scripts.dev) {
396
408
  const firstName = unique[0].name
@@ -2,5 +2,5 @@
2
2
  @import "@uniweb/kit/theme-tokens.css";
3
3
 
4
4
  @source "./sections/**/*.{js,jsx}";
5
+ @source "./components/**/*.{js,jsx}";
5
6
  @source "./layouts/**/*.{js,jsx}";
6
- @source "./node_modules/@uniweb/kit/src/**/*.{js,jsx}";
@@ -1,5 +1,5 @@
1
1
  # Site Configuration
2
- # Full reference: uniweb docs site | Schema: schemas/site.schema.json
2
+ # Full reference: https://github.com/uniweb/docs/blob/main/reference/site-configuration.md
3
3
 
4
4
  name: {{projectName}}
5
5
 
@@ -30,10 +30,11 @@ index: home
30
30
  # layout: ./custom-layout # Custom layout directory
31
31
  # records: ./data # Where this site's records live
32
32
  #
33
- # To give a mounted route a layout or a title, add a local folder for it
34
- # (pages/docs/) holding a folder.yml — folder.yml, not page.yml, because the
35
- # mounted directory is a folder of pages. Whatever that stub leaves unset comes
36
- # from the mounted directory's own folder.yml, so it need only say what differs.
33
+ # A mount is one level under pages/. To give a mounted route a layout or a title,
34
+ # add a local folder for it (pages/docs/) holding a folder.yml. Whatever that stub
35
+ # leaves unset comes from the mounted directory's own folder.yml, so it need only say
36
+ # what differs. A page.yml with markdown of its own there makes a real page above the
37
+ # mounted pages. A local subfolder isn't read: its pages would come from the mount.
37
38
  #
38
39
  # A `pages/<segment>:` mount goes wherever the site goes: builds, `uniweb export`
39
40
  # and `uniweb deploy --host <adapter>`, and `uniweb push` / `uniweb publish`,
@@ -69,11 +70,8 @@ index: home
69
70
  # articles:
70
71
  # schema: '@/article'
71
72
  # sort: date desc # Sort by frontmatter field
72
- #
73
- # fetch:
74
- # - url: https://api.example.com/team # Remote JSON
75
- # as: team # Access as content.data.team
76
- # - path: /data/config.json # Local file from public/
73
+ # team:
74
+ # url: https://api.example.com/team # Remote JSON instead of your records
77
75
 
78
76
  # ─── Extensions ────────────────────────────────────────────────────────────────
79
77
  # Load additional foundations (section types) via URL.
@@ -15,6 +15,7 @@
15
15
  {{/if}}],
16
16
  "devDependencies": {
17
17
  "@types/node": "^22.0.0",
18
+ "@uniweb/build": "{{version "@uniweb/build"}}",
18
19
  "uniweb": "{{version "uniweb"}}"
19
20
  }
20
21
  }