uniweb 0.79.1 → 0.79.3

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": "0.79.1",
3
+ "version": "0.79.3",
4
4
  "description": "Create structured Vite + React sites with content/code separation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -41,17 +41,17 @@
41
41
  "js-yaml": "^4.1.0",
42
42
  "prompts": "^2.4.2",
43
43
  "tar": "^7.0.0",
44
- "@uniweb/kit": "^0.19.11",
45
- "@uniweb/schemas": "^0.9.2",
44
+ "@uniweb/content-writer": "^0.3.4",
46
45
  "@uniweb/core": "^0.35.0",
47
46
  "@uniweb/runtime": "^0.28.3",
48
- "@uniweb/content-writer": "^0.3.4",
49
- "@uniweb/semantic-parser": "^1.4.1"
47
+ "@uniweb/kit": "^0.19.12",
48
+ "@uniweb/schemas": "^0.9.4",
49
+ "@uniweb/semantic-parser": "^1.5.0"
50
50
  },
51
51
  "peerDependencies": {
52
+ "@uniweb/build": "^0.73.3",
52
53
  "@uniweb/content-reader": "^1.2.7",
53
- "@uniweb/semantic-parser": "^1.4.1",
54
- "@uniweb/build": "^0.73.1"
54
+ "@uniweb/semantic-parser": "^1.5.0"
55
55
  },
56
56
  "peerDependenciesMeta": {
57
57
  "@uniweb/build": {
@@ -366,6 +366,7 @@ content = {
366
366
  images: [], // { src, alt, role, href }
367
367
  icons: [], // { library, name, role }
368
368
  videos: [], // { src, alt, role, poster, href }
369
+ documents: [], // { url, alt, caption, role: 'pdf', preview?, author?, description? } — from {role=pdf}
369
370
  insets: [], // Inline @Component references — { refId }
370
371
  lists: [], // [[{ paragraphs, links, lists, … }]] — each item is an object, not a string
371
372
  quotes: [], // Blockquotes
@@ -524,12 +525,13 @@ Optional attributes: `{size=20}`, `{color=red}`. Custom SVGs: `![Logo](./logo.sv
524
525
  ```markdown
525
526
  [text](url){target=_blank} <!-- Open in new tab -->
526
527
  [text](./file.pdf){download} <!-- Download -->
527
- ![alt](./img.jpg){role=banner} <!-- Role determines array: images, icons, or videos -->
528
+ ![alt](./img.jpg){role=banner} <!-- Role determines array: images, icons, videos or documents -->
528
529
  ![alt](./demo.mp4){role=video} <!-- → content.videos[], not content.images[] -->
530
+ ![alt](./report.pdf){role=pdf} <!-- → content.documents[] — a file, drawn as a link -->
529
531
  ![alt](./img.jpg){href=/products} <!-- Clickable media: href + target ride along -->
530
532
  ```
531
533
 
532
- Sizing and loading ride on the image: `{width=800 height=600 loading=lazy fit=cover position=center}`. A video adds `{poster=./thumb.jpg autoplay muted loop controls}`; a `{role=pdf}` document adds `{preview=./cover.jpg author=… description=…}`.
534
+ Sizing and loading ride on the image: `{width=800 height=600 loading=lazy fit=cover position=center}`. A video adds `{poster=./thumb.jpg autoplay muted loop controls}`; a `{role=pdf}` document adds `{preview=./cover.jpg author=… description=…}` and arrives in `content.documents` — declare it in `content:` as `documents`.
533
535
 
534
536
  **Quote values containing spaces:** `{note="Ready to go"}`, not `{note=Ready to go}` — unquoted values end at the first space.
535
537
 
@@ -1041,9 +1043,17 @@ function MyComponent({ content, params, block }) {
1041
1043
  }
1042
1044
  ```
1043
1045
 
1044
- Frontmatter becomes `params`, minus the keys the framework takes for itself: `type`, `id`, `hidden`, `query`, `fetch` (a `data:` key is refused — it was `query:`'s old name; `preset:` and `input:` are ignored with a warning). `props:` is the one that isn't dropped but merged *into* params.
1046
+ **Frontmatter becomes `params` — except the names framework keeps for itself.** Every section can be given these, whatever its type, and none of them reaches your component as a param. So **never declare one in `meta.js` `params:`** — a component that does never receives what an author writes.
1045
1047
 
1046
- **The section's own settings are not params either.** `theme`, `background`, `grid` and `vars` are framework's: it applies them — the color context and the background around your component, the section's theme and your component's CSS variables in the page stylesheet, the child layout through `ChildGrid` — so your component never receives them in `params`, and the build warns on a param declared with one of those names. When a component needs one for its own logic, it reads it from `block`: `useColorContext(block)` for the context (a light vs. dark logo, say), `<SectionBackground block={block} />` to draw the background itself, `<ChildGrid from={block} />` for the grid. Every other key is a param, declared or not; components ignore the ones they don't use.
1048
+ | in a section's frontmatter | what it is | a component reads it from |
1049
+ |---|---|---|
1050
+ | `type`, `id`, `hidden` | the section itself — its section type, its id, and a draft (`hidden: true`: left out of a published build, kept by `uniweb dev`) | — |
1051
+ | `query`, `fetch` | the section's data | `content.data`, under the keys its `meta.js` `data:` declares |
1052
+ | `theme`, `background`, `grid`, `vars` | the section's settings, which framework applies — the color context and the background around your component, the section's theme and your component's CSS variables in the page stylesheet, the child layout | `block`, when the component needs one for its own logic: `useColorContext(block)` for the context (a light vs. dark logo, say), `<SectionBackground block={block} />` to draw the background itself, `<ChildGrid from={block} />` for the grid |
1053
+ | `props` | params written as one map | `params` — its keys are merged in, one by one |
1054
+ | `data`, `preset`, `input` | nothing: `data:` is refused (it was `query:`'s old name); `preset:` and `input:` are ignored with a warning | — |
1055
+
1056
+ The build warns when `params:` declares any of them. A preset may still set `theme` or `background` — a preset's params are written into the section's frontmatter when an author starts a section from it, so `dark: { label: 'Dark', params: { theme: 'dark' } }` is a dark section. Every other key is a param, declared or not; components ignore the ones they don't use.
1047
1057
 
1048
1058
  ### Rendering content with Kit
1049
1059
 
@@ -1090,7 +1100,7 @@ Names only — for signatures and props, read the package: it's on disk at `node
1090
1100
  @import "@uniweb/kit/prose-tokens.css"; /* the plugin, wired to theme.yml */
1091
1101
  ```
1092
1102
 
1093
- Nothing to install — the import brings the plugin with it. **Skip the import and prose is completely unstyled**, silently: the class is there and no rules are behind it. `uniweb doctor` flags that. Use **one** `prose` container per subtree — the `--tw-prose-*` variables are inherited, so a nested one silently resets them and the outer container goes on looking correct. The section that renders the document is usually the better owner; a layout should supply column width and padding.
1103
+ Nothing to install — the import brings the plugin with it. **Skip the import and prose is completely unstyled** — lists lose their bullets and numbers, and text its typography — while the markup looks right. The foundation build warns about it, and `uniweb doctor` flags it. Use **one** `prose` container per subtree — the `--tw-prose-*` variables are inherited, so a nested one silently resets them and the outer container goes on looking correct. The section that renders the document is usually the better owner; a layout should supply column width and padding.
1094
1104
 
1095
1105
  **Documentation shells:** `useHeadings()` (the page's headings + the one being read, derived from content so it prerenders), `website.getBranchHierarchy({ route, for })` (the page tree for one branch). Kit ships no ready-made layout — a layout is your foundation's design; write it in `src/layouts/` and use these for the behaviour.
1096
1106
  **Layout helpers:** `useGridLayout(columns, { gap })`, `useAccordion({ multiple, defaultOpen })`
@@ -2415,7 +2425,7 @@ For cases the factory doesn't cover, write handlers directly using `Loom`, `inst
2415
2425
 
2416
2426
  > **`instantiateContent` resolves `{placeholders}` in text nodes only** — not in link `href`s or other node/mark attributes. So `[{email}](mailto:{email})` fills the visible label but leaves the `mailto:` URL literal. For dynamic URLs, emit the value as plain text and let the component linkify it, or build the href in the handler yourself.
2417
2427
 
2418
- **Reserved frontmatter:** `source` and `where` are convention-level reserved fields — they flow to both `block.properties` (for handler access) and `params` (visible to components), consistent with `background` and `theme`. Components can ignore them. List them in `meta.js` params with descriptions so the editor and schema recognize them.
2428
+ **`source` and `where` are ordinary params** that the Loom handler reads — they reach both `block.properties` (for handler access) and `params` (visible to components). Components can ignore them. List them in `meta.js` params with descriptions so the editor and schema recognize them. (Unlike `theme` and `background`, which are the section's own settings and never reach `params` — see the table under *Frontmatter becomes `params`*.)
2419
2429
  <!-- /template:loom -->
2420
2430
 
2421
2431
  ---
@@ -189,6 +189,24 @@ function loadSiteYml(dir) {
189
189
  * `node_modules` — this answers "did the developer write this", so a match
190
190
  * inside a dependency is the wrong answer.
191
191
  */
192
+ /**
193
+ * Does this foundation render kit's <Prose> or <Article> — under its own name or an alias?
194
+ *
195
+ * The JSX tag alone missed `import { Article as ArticleBody } from '@uniweb/kit'`, which
196
+ * renders `<ArticleBody>`: two official templates shipped that way with no prose styles
197
+ * until 2026-09-29. So the import counts too. (The foundation build checks the same thing
198
+ * from its module graph, which no alias can hide from.)
199
+ *
200
+ * @param {string} dir - the foundation's source directory
201
+ * @returns {boolean}
202
+ */
203
+ export function rendersKitProse(dir) {
204
+ return (
205
+ sourceMatches(dir, /<(Prose|Article)\b/) ||
206
+ sourceMatches(dir, /import\s*\{[^}]*\b(Prose|Article)\b[^}]*\}\s*from\s*['"]@uniweb\/kit['"]/)
207
+ )
208
+ }
209
+
192
210
  function sourceMatches(dir, pattern) {
193
211
  let found = false
194
212
  forEachSourceFile(dir, (text) => {
@@ -1217,8 +1235,8 @@ export async function doctor(args = []) {
1217
1235
 
1218
1236
  // Does anything here actually ask for prose? Either the class in the
1219
1237
  // stylesheet, or kit's components, which render it.
1238
+ const usesProseComponent = rendersKitProse(f.path)
1220
1239
  const usesProseClass = /(^|[\s"'`])prose(\s|["'`]|$)/m.test(styles)
1221
- const usesProseComponent = sourceMatches(f.path, /<(Prose|Article)\b/)
1222
1240
 
1223
1241
  if (!usesProseClass && !usesProseComponent) continue
1224
1242
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-09-28T21:05:39.664Z",
3
+ "generatedAt": "2026-09-29T17:52:46.126Z",
4
4
  "packages": {
5
5
  "@uniweb/api": {
6
6
  "version": "0.6.8",
@@ -10,7 +10,7 @@
10
10
  ]
11
11
  },
12
12
  "@uniweb/build": {
13
- "version": "0.73.1",
13
+ "version": "0.73.3",
14
14
  "path": "framework/build",
15
15
  "deps": [
16
16
  "@uniweb/content-reader",
@@ -55,7 +55,7 @@
55
55
  ]
56
56
  },
57
57
  "@uniweb/kit": {
58
- "version": "0.19.11",
58
+ "version": "0.19.12",
59
59
  "path": "framework/kit",
60
60
  "deps": [
61
61
  "@uniweb/core",
@@ -71,7 +71,7 @@
71
71
  "deps": []
72
72
  },
73
73
  "@uniweb/press": {
74
- "version": "0.4.17",
74
+ "version": "0.4.18",
75
75
  "path": "framework/press",
76
76
  "deps": []
77
77
  },
@@ -97,7 +97,7 @@
97
97
  "deps": []
98
98
  },
99
99
  "@uniweb/schemas": {
100
- "version": "0.9.2",
100
+ "version": "0.9.4",
101
101
  "path": "framework/schemas",
102
102
  "deps": []
103
103
  },
@@ -107,7 +107,7 @@
107
107
  "deps": []
108
108
  },
109
109
  "@uniweb/semantic-parser": {
110
- "version": "1.4.1",
110
+ "version": "1.5.0",
111
111
  "path": "framework/semantic-parser",
112
112
  "deps": []
113
113
  },
@@ -117,7 +117,7 @@
117
117
  "deps": []
118
118
  },
119
119
  "@uniweb/templates": {
120
- "version": "0.17.7",
120
+ "version": "0.17.8",
121
121
  "path": "framework/templates",
122
122
  "deps": []
123
123
  },
@@ -14,7 +14,16 @@
14
14
  "#components/*": "./components/*",
15
15
  "#utils/*": "./utils/*"
16
16
  },
17
- "files": ["dist", "sections", "components", "layouts", "utils", "main.js", "styles.css", "_entry.generated.js"],
17
+ "files": [
18
+ "dist",
19
+ "sections",
20
+ "components",
21
+ "layouts",
22
+ "utils",
23
+ "main.js",
24
+ "styles.css",
25
+ "_entry.generated.js"
26
+ ],
18
27
  "scripts": {
19
28
  "dev": "vite",
20
29
  "build": "uniweb build",