uniweb 1.27.1 → 1.27.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": "1.27.1",
3
+ "version": "1.27.3",
4
4
  "description": "Create structured Vite + React sites with content/code separation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -41,13 +41,13 @@
41
41
  "js-yaml": "^4.3.2",
42
42
  "prompts": "^2.4.2",
43
43
  "tar": "^7.5.21",
44
+ "@uniweb/content-writer": "~1.3.1",
44
45
  "@uniweb/core": "~1.6.4",
45
- "@uniweb/schemas": "~1.6.8",
46
- "@uniweb/semantic-parser": "~1.13.2",
47
- "@uniweb/content-writer": "~1.3.1"
46
+ "@uniweb/schemas": "~1.6.10",
47
+ "@uniweb/semantic-parser": "~1.13.2"
48
48
  },
49
49
  "peerDependencies": {
50
- "@uniweb/build": "~1.16.0",
50
+ "@uniweb/build": "~1.16.1",
51
51
  "@uniweb/content-reader": "~1.5.9",
52
52
  "@uniweb/semantic-parser": "~1.13.2"
53
53
  },
@@ -292,7 +292,7 @@ import { H1, P, Prose, Visual, Icon, Link, ChildBlocks, Overlay, PlainText } fro
292
292
  export default {
293
293
  title: 'Feature Grid', description: 'Grid of feature cards with icons',
294
294
  family: 'features', // the standard kind it is (`uniweb families`); a name like `Hero` resolves on its own
295
- // hidden: true · inset: true · section: true · children: true · background: 'self' · sticky: true
295
+ // hidden: true · inset: true · area: 'header' · section: true · children: true · background: 'self' · sticky: true
296
296
  content: { title: 'Heading', paragraphs: 'Intro [0-1]', media: 'Photo [1]',
297
297
  items: { label: 'Cards [3-6]', content: { icon: 'Icon [1]', title: 'Name', paragraphs: 'Text' } } },
298
298
  params: { columns: { type: 'number', default: 3 },
@@ -4,7 +4,7 @@ Lane guide — AGENTS.md procedure step 6 loads it before any content is written
4
4
 
5
5
  ## Sections
6
6
 
7
- **A section with no `type:` renders through the foundation's default section type** — a component named `Section`, unless the foundation's `main.js` sets `defaultSection`. This is what lets a folder of plain markdown with no frontmatter become pages: mounted documentation, an imported wiki. If such content renders blank, the foundation has no `Section` — that, not the markdown, is what to fix.
7
+ **A section with no `type:` renders through the foundation's default section type** — the `defaultSection` its `main.js` sets, else a section type named `Section` where the foundation has one, the fallback for foundations that declare none. This is what lets a folder of plain markdown with no frontmatter become pages: mounted documentation, an imported wiki. If such content shows "Component not found", the foundation has neither: declare `defaultSection` in its `main.js`, naming the type that content should render with. `uniweb doctor` states each foundation's default, and suggests one where a type stands out.
8
8
 
9
9
  **Content before the first heading changes the parse:** headings after body content become items, not the section title. That's how repeating groups are made. An icon counts: `![](lu-globe)` above `# Title` leaves `content.title` empty and puts the heading in `items[0]`. For an icon that belongs to the title, write it under the heading, where it is still `content.icons[0]`; `uniweb inspect` shows the shape, and warns about an icon above one heading. An image above the title empties it too, with the heading in `content.headings` and no warning.
10
10
 
@@ -226,7 +226,7 @@ Colors, tokens, light and dark, fonts and `styles.css` are in `uniweb guide them
226
226
 
227
227
  **A data block whose value is a schema** — an author-designed form at `content.data.form` — is the inverse of every other component: declare the key, receive the fields, draw what you're given. You may declare a schema of the *envelope* (`title`, `description`, `fields`) for validation, never of the form's own fields.
228
228
 
229
- **Insets** are full section types: `{ content, params, block }`, alt text → `content.title`, attributes → `params`. `inset: true` in `meta.js`; add `section: true` for a component placed both ways. The hosting section declares a `media` slot and renders `<Visual>`, so one type works whether the author supplies an image, a video or an interactive component. Don't use `hidden: true` on insets — that means "never export".
229
+ **Insets** are full section types: `{ content, params, block }`, alt text → `content.title`, attributes → `params`. `inset: true` in `meta.js`; add `section: true` for a component placed both ways. A component meant for a layout area names it, `area: 'header'` (a list for several, `true` for any, names as the layouts' `areas:` call them), and an editor offers it there, never among a page's sections; `section: true` again for both. The hosting section declares a `media` slot and renders `<Visual>`, so one type works whether the author supplies an image, a video or an interactive component. Don't use `hidden: true` on insets — that means "never export".
230
230
 
231
231
  **Block insets** get their whole body parsed (`title`, `paragraphs`, `items`, `sequence`); render with `<Prose content={content} block={block} />` or read fields. Prefer a child section when the author needs their own type and independent editing; a block inset when the wrapper is presentational and inline.
232
232
 
@@ -76,7 +76,7 @@ const { submit, status, error, canSubmit } = useFormSubmit({
76
76
  if (!canSubmit) return null // check at render, not on the button press
77
77
  ```
78
78
 
79
- `status`: `idle → submitting → success | error`; a non-2xx becomes a thrown `Error` carrying the endpoint's `error` message. File fields: pass `files`; the endpoint replies with `uploadUrls`, and bytes never ride inside the JSON. `submitForm()` / `resolveSubmitTarget(website)` are the same without React. A failed read leaves its key `null`, with the message on `block.dataError[key]`; a write that 404s loses what a person typed, so it gets no silent fallback.
79
+ `status`: `idle → submitting → success | error`; a non-2xx becomes a thrown `Error` carrying the endpoint's `error` message. File fields: pass `files`; the endpoint replies with `uploadUrls`, and bytes never ride inside the JSON. `submitForm()` / `resolveSubmitTarget(website)` are the same without React. A host that protects its address names a `challenge` beside `endpoint`; the hook then solves an ALTCHA v1 puzzle and sends `X-Proof` itself, so a form needs no change (`sendWithProof` + `resolveServiceAddress(website, name, 'challenge')` for any other service). A failed read leaves its key `null`, with the message on `block.dataError[key]`; a write that 404s loses what a person typed, so it gets no silent fallback.
80
80
 
81
81
  **Rendering an author-designed form** (`yaml:form` at `content.data.form`): you don't declare the fields, you receive them. `useFormValues` owns what's identical in every such component:
82
82
 
@@ -692,6 +692,107 @@ export function checkSectionFamilies({
692
692
  }
693
693
  }
694
694
 
695
+ /**
696
+ * The foundation's default section type — what renders a section that names none — said for every
697
+ * foundation, as a fact: declared, the fallback, or none [Diego, 2026-11-05: "It can list the default
698
+ * section type and show if there is none"].
699
+ *
700
+ * The rule is core's (`@uniweb/core/section-type`): the foundation's `defaultSection`, else `Section`.
701
+ * ⭐ `Section` is only a legacy fallback: the name every foundation was once expected to provide. The
702
+ * runtime ships no component by that name, so where the foundation has no type by it, a section that
703
+ * names no type shows "Component not found" where an author composes it.
704
+ *
705
+ * ⛔ "None" IS NOT A WARNING. Many vocabularies have no natural default (Hero, Features, …), and their
706
+ * sections each name a type — 32 of 56 workspace foundations, measured 2026-11-05, with no site of theirs
707
+ * leaving a section without one. Warning there would be noise, and would push an arbitrary default. Only
708
+ * a declared `defaultSection` that names no type is a mistake, and warned. Here rather than in the build,
709
+ * which would print it on every build while a developer works [Diego, 2026-11-05].
710
+ *
711
+ * The suggestion, for none or a mistake: the type a mistyped name meant, else the foundation's only type
712
+ * in the `article` or `rich-text` family, declared or by its name (`resolveFamily`). ⚠️ Reads the built
713
+ * `schema.json`, as `checkSectionFamilies` does, so it says nothing before a build.
714
+ *
715
+ * @returns {{ type: string|null, declared: boolean, exists: boolean }|null} null with no built schema
716
+ */
717
+ export function checkDefaultSection({ foundationName, folderName, foundationDir, issues }) {
718
+ const schema = loadSchemaJson(foundationDir)
719
+ if (!schema) return null
720
+ const types = Object.keys(schema).filter((key) => !key.startsWith('_') && key !== 'dataSchemas' && schema[key] && typeof schema[key] === 'object')
721
+ if (types.length === 0) return null
722
+
723
+ const named = schema._self?.defaultSection
724
+ const declared = typeof named === 'string' && named !== ''
725
+ const fallback = declared ? named : 'Section'
726
+ const exists = types.includes(fallback)
727
+ if (exists) {
728
+ info(
729
+ `${folderName}: default section type ${fallback} ` +
730
+ (declared ? `${colors.dim}(defaultSection in main.js)${colors.reset}` : `${colors.dim}(the fallback: main.js declares no defaultSection)${colors.reset}`)
731
+ )
732
+ if (!declared) log(` ${colors.dim}Declare defaultSection in main.js to choose it by name.${colors.reset}`)
733
+ return { type: fallback, declared, exists }
734
+ }
735
+
736
+ const prose = types.filter((name) => ['article', 'rich-text'].includes(resolveFamily({ name, family: schema[name]?.family }).id))
737
+ const meant = declared ? types.find((name) => name.toLowerCase() === named.toLowerCase()) : null
738
+ const suggestion = meant || (prose.length === 1 ? prose[0] : null)
739
+ const proposal = suggestion ? `defaultSection: '${suggestion}' in main.js would make ${suggestion} the default.` : null
740
+ if (declared) {
741
+ const id = 'default-section-missing'
742
+ const message = `defaultSection names '${named}', which is not a section type of this foundation`
743
+ issues.push({ id, type: 'warn', foundation: foundationName, message, ...(suggestion ? { suggested: suggestion } : {}) })
744
+ warn(`[${id}] ${folderName}: ${message}`)
745
+ log(` A section that names no type shows "Component not found" where an author composes it.`)
746
+ if (proposal) log(` ${colors.blue}${proposal}${colors.reset}`)
747
+ return { type: null, declared, exists }
748
+ }
749
+ issues.push({ id: 'default-section-none', type: 'info', foundation: foundationName, message: 'no default section type: each section names its own', ...(suggestion ? { suggested: suggestion } : {}) })
750
+ info(`${folderName}: no default section type ${colors.dim}(each section names its own; one that names none shows "Component not found")${colors.reset}`)
751
+ if (proposal) log(` ${colors.dim}${proposal}${colors.reset}`)
752
+ return { type: null, declared, exists }
753
+ }
754
+
755
+ /**
756
+ * The section types an editor would offer only for their area, and leave out of a page's sections,
757
+ * if they named it — those whose family is `header` or `footer`, declared or by their name — with
758
+ * the `area:` each could say: suggested, never applied.
759
+ *
760
+ * `area` is a placement, beside `inset` (`describePlacement`, `@uniweb/schemas/component`): a type
761
+ * meant for the layout areas it names (`area: 'header'`), or for any (`area: true`), offered where an
762
+ * author fills one and left out of a page's sections. The suggestion names the area the family is
763
+ * named for, the header's or the footer's, unless every layout of the foundation declares its `areas`
764
+ * and none is called that; then it is `true`.
765
+ * ⭐ A family is a claim about a type's shape, not about where it goes, so it never places a type on its
766
+ * own: it is only why doctor asks [Diego, 2026-11-05: "maybe a family that makes it predictable that they
767
+ * are layout only components. or some mix of that"]. Only `header` and `footer`: a `toc` or a `pathways`
768
+ * type is as often a page's own section. A type that says `area` or `section` either way has decided.
769
+ *
770
+ * @returns {Array<{ type: string, area: string|true }>} the types suggested, each with its `area:`;
771
+ * [] with no built schema
772
+ */
773
+ export function checkAreaTypes({ foundationName, folderName, foundationDir, issues }) {
774
+ const schema = loadSchemaJson(foundationDir)
775
+ if (!schema) return []
776
+ const layouts = Object.values(schema._layouts || {})
777
+ const declared = layouts.length > 0 && layouts.every((layout) => Array.isArray(layout?.areas))
778
+ ? new Set(layouts.flatMap((layout) => layout.areas))
779
+ : null
780
+ const suggested = Object.entries(schema)
781
+ .filter(([key, entry]) => !key.startsWith('_') && key !== 'dataSchemas' && entry && typeof entry === 'object')
782
+ .filter(([, entry]) => entry.area === undefined && entry.section === undefined && entry.inset !== true)
783
+ .map(([name, entry]) => ({ type: name, family: resolveFamily({ name, family: entry.family }).id }))
784
+ .filter(({ family }) => family === 'header' || family === 'footer')
785
+ .map(({ type, family }) => ({ type, area: !declared || declared.has(family) ? family : true }))
786
+ if (suggested.length === 0) return []
787
+ const spell = ({ area }) => (area === true ? 'area: true' : `area: '${area}'`)
788
+ const say = (paint) =>
789
+ suggested.map((s, i) => `${s.type}${i === 0 ? ' could say' : ''} ${paint(spell(s))}`).join(', ')
790
+ issues.push({ id: 'section-area-suggested', type: 'info', foundation: foundationName, message: say((s) => s), details: suggested })
791
+ info(`${folderName}: ${say((s) => `${colors.blue}${s}${colors.reset}`)} in meta.js`)
792
+ log(` ${colors.dim}A type meant only for a layout area (a header, a footer, a side panel) names it, and an editor offers it there, not among a page's sections; area: true is any area. With section: true beside it, it is offered for both; section: true alone says it is a page's.${colors.reset}`)
793
+ return suggested
794
+ }
795
+
695
796
  /**
696
797
  * Insert `family: '<id>'` as the first key of a meta.js default export.
697
798
  *
@@ -1886,6 +1987,19 @@ async function runDoctor(args = []) {
1886
1987
  shouldFixExplicitly,
1887
1988
  fixed
1888
1989
  })
1990
+ // A foundation's own default — not an extension's, whose types join a site's primary foundation.
1991
+ checkDefaultSection({
1992
+ foundationName: f.name,
1993
+ folderName: f.folderName,
1994
+ foundationDir: f.path,
1995
+ issues
1996
+ })
1997
+ checkAreaTypes({
1998
+ foundationName: f.name,
1999
+ folderName: f.folderName,
2000
+ foundationDir: f.path,
2001
+ issues
2002
+ })
1889
2003
  checkRetiredMetaKeys({
1890
2004
  foundationName: f.name,
1891
2005
  folderName: f.folderName,
@@ -1924,6 +2038,12 @@ async function runDoctor(args = []) {
1924
2038
  shouldFixExplicitly,
1925
2039
  fixed
1926
2040
  })
2041
+ checkAreaTypes({
2042
+ foundationName: e.name,
2043
+ folderName: e.folderName,
2044
+ foundationDir: e.path,
2045
+ issues
2046
+ })
1927
2047
  checkRetiredMetaKeys({
1928
2048
  foundationName: e.name,
1929
2049
  folderName: e.folderName,
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-11-05T01:35:06.410Z",
3
+ "generatedAt": "2026-11-05T20:23:08.274Z",
4
4
  "packages": {
5
5
  "@uniweb/api": {
6
6
  "version": "1.6.9"
7
7
  },
8
8
  "@uniweb/build": {
9
- "version": "1.16.0"
9
+ "version": "1.16.1"
10
10
  },
11
11
  "@uniweb/content-reader": {
12
12
  "version": "1.5.9"
@@ -42,7 +42,7 @@
42
42
  "version": "1.0.1"
43
43
  },
44
44
  "@uniweb/schemas": {
45
- "version": "1.6.8"
45
+ "version": "1.6.10"
46
46
  },
47
47
  "@uniweb/scholar": {
48
48
  "version": "1.1.0"
@@ -54,7 +54,7 @@
54
54
  "version": "1.1.2"
55
55
  },
56
56
  "@uniweb/templates": {
57
- "version": "1.2.6"
57
+ "version": "1.2.8"
58
58
  },
59
59
  "@uniweb/theming": {
60
60
  "version": "1.2.1"