@plitzi/sdk-authoring 0.39.3 → 0.39.6

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/index-src.js +1776 -1145
  3. package/dist/index.d.ts +139 -15
  4. package/dist/index.js +2 -2
  5. package/dist/node.d.ts +81 -6
  6. package/dist/node.js +1 -1
  7. package/dist/plugin.d.ts +2 -2
  8. package/package.json +9 -9
  9. package/skills/plitzi-authoring/recipes/accordion.ts +3 -1
  10. package/skills/plitzi-authoring/recipes/carousel.ts +68 -63
  11. package/skills/plitzi-authoring/recipes/detail-page.ts +43 -33
  12. package/skills/plitzi-authoring/recipes/embed-and-svg.ts +16 -11
  13. package/skills/plitzi-authoring/recipes/every-few-seconds.ts +52 -42
  14. package/skills/plitzi-authoring/recipes/feature-flag.ts +7 -2
  15. package/skills/plitzi-authoring/recipes/filter-a-list.ts +39 -31
  16. package/skills/plitzi-authoring/recipes/forms-and-modals.ts +34 -28
  17. package/skills/plitzi-authoring/recipes/from-tailwind.ts +11 -6
  18. package/skills/plitzi-authoring/recipes/link-to-a-section.ts +11 -6
  19. package/skills/plitzi-authoring/recipes/link-with-data.ts +21 -16
  20. package/skills/plitzi-authoring/recipes/marquee.ts +17 -12
  21. package/skills/plitzi-authoring/recipes/plugin.ts +16 -10
  22. package/skills/plitzi-authoring/recipes/scroll-a-row.ts +30 -25
  23. package/skills/plitzi-authoring/recipes/server-data.ts +15 -10
  24. package/skills/plitzi-authoring/recipes/show-data.ts +32 -24
  25. package/skills/plitzi-authoring/recipes/style-a-page.ts +9 -4
  26. package/skills/plitzi-authoring/recipes/typed-data.ts +26 -21
  27. package/skills/plitzi-authoring/recipes/usable-without-sight.ts +16 -11
  28. package/skills/plitzi-authoring/reference/authoring-errors.md +11 -4
  29. package/skills/plitzi-authoring/reference/efficiency.md +3 -1
  30. package/skills/plitzi-authoring/reference/layouts.md +2 -1
@@ -40,12 +40,17 @@ export const recipe: SpaceSpec = {
40
40
  slug: '',
41
41
  body: [
42
42
  container({
43
- class: grid,
44
- children: ['Fast', 'Typed', 'Yours'].map(name =>
45
- container({ class: card, children: [heading(name, { subType: 'h3', class: title }), text('…')] })
46
- )
47
- }),
48
- link({ href: '/start', class: cta, content: 'Get started' })
43
+ subType: 'main',
44
+ children: [
45
+ container({
46
+ class: grid,
47
+ children: ['Fast', 'Typed', 'Yours'].map(name =>
48
+ container({ class: card, children: [heading(name, { subType: 'h3', class: title }), text('…')] })
49
+ )
50
+ }),
51
+ link({ href: '/start', class: cta, content: 'Get started' })
52
+ ]
53
+ })
49
54
  ]
50
55
  }
51
56
  ]
@@ -15,12 +15,17 @@ export const recipe: SpaceSpec = {
15
15
  name: 'Home',
16
16
  slug: '',
17
17
  body: [
18
- link({ href: 'home', hash: 'plans', content: 'See the plans' }),
19
18
  container({
20
- id: 'plans-section',
21
- subType: 'section',
22
- anchor: 'plans',
23
- children: [heading('Plans', { subType: 'h2' }), text('Three of them.')]
19
+ subType: 'main',
20
+ children: [
21
+ link({ href: 'home', hash: 'plans', content: 'See the plans' }),
22
+ container({
23
+ id: 'plans-section',
24
+ subType: 'section',
25
+ anchor: 'plans',
26
+ children: [heading('Plans', { subType: 'h2' }), text('Three of them.')]
27
+ })
28
+ ]
24
29
  })
25
30
  ]
26
31
  },
@@ -29,7 +34,7 @@ export const recipe: SpaceSpec = {
29
34
  name: 'About',
30
35
  slug: 'about',
31
36
  // → /#plans
32
- body: [link({ href: 'home', hash: 'plans', content: 'Plans' })]
37
+ body: [container({ subType: 'main', children: [link({ href: 'home', hash: 'plans', content: 'Plans' })] })]
33
38
  }
34
39
  ]
35
40
  };
@@ -2,7 +2,7 @@
2
2
  * A link built from the row it is in — here "ask about this product" on WhatsApp, with the product's name in the
3
3
  * message. An attribute resolves a name with filters, so the text is encoded with `url_encode`.
4
4
  */
5
- import { apiContainer, link, list, listItem } from '@plitzi/sdk-authoring';
5
+ import { apiContainer, container, link, list, listItem } from '@plitzi/sdk-authoring';
6
6
 
7
7
  import type { SpaceSpec } from '@plitzi/sdk-authoring';
8
8
 
@@ -15,24 +15,29 @@ export const recipe: SpaceSpec = {
15
15
  name: 'Home',
16
16
  slug: '',
17
17
  body: [
18
- apiContainer({
19
- id: 'catalog',
20
- query: '/data/products.json',
21
- cache: true,
18
+ container({
19
+ subType: 'main',
22
20
  children: [
23
- list({
24
- id: 'products',
25
- items: 'catalog.data.products',
21
+ apiContainer({
22
+ id: 'catalog',
23
+ query: '/data/products.json',
24
+ cache: true,
26
25
  children: [
27
- listItem({
26
+ list({
27
+ id: 'products',
28
+ items: 'catalog.data.products',
28
29
  children: [
29
- link({
30
- target: 'blank',
31
- href: 'https://wa.me/34600000000?text={{ list_products.item.title|url_encode }}',
32
- icon: 'fa-brands fa-whatsapp',
33
- content: 'Ask about it'
34
- }),
35
- link({ href: 'mailto:shop@example.com', content: 'Write to us' })
30
+ listItem({
31
+ children: [
32
+ link({
33
+ target: 'blank',
34
+ href: 'https://wa.me/34600000000?text={{ list_products.item.title|url_encode }}',
35
+ icon: 'fa-brands fa-whatsapp',
36
+ content: 'Ask about it'
37
+ }),
38
+ link({ href: 'mailto:shop@example.com', content: 'Write to us' })
39
+ ]
40
+ })
36
41
  ]
37
42
  })
38
43
  ]
@@ -32,20 +32,25 @@ export const recipe: SpaceSpec = {
32
32
  name: 'Home',
33
33
  slug: '',
34
34
  body: [
35
- apiContainer({
36
- id: 'catalog',
37
- query: '/data/brands.json',
38
- cache: true,
35
+ container({
36
+ subType: 'main',
39
37
  children: [
40
- container({
41
- class: marquee,
38
+ apiContainer({
39
+ id: 'catalog',
40
+ query: '/data/brands.json',
41
+ cache: true,
42
42
  children: [
43
- list({
44
- id: 'brands',
45
- class: track,
46
- from: 'catalog.data.brands',
47
- as: '{{ source|merge(source)|merge(source) }}',
48
- children: [listItem({ children: [text({ from: 'brands.item' })] })]
43
+ container({
44
+ class: marquee,
45
+ children: [
46
+ list({
47
+ id: 'brands',
48
+ class: track,
49
+ from: 'catalog.data.brands',
50
+ as: '{{ source|merge(source)|merge(source) }}',
51
+ children: [listItem({ children: [text({ from: 'brands.item' })] })]
52
+ })
53
+ ]
49
54
  })
50
55
  ]
51
56
  })
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import {
6
6
  button,
7
+ container,
7
8
  declaredCallback,
8
9
  declaredTrigger,
9
10
  defineElement,
@@ -38,17 +39,22 @@ export const recipe: SpaceSpec = {
38
39
  name: 'Home',
39
40
  slug: '',
40
41
  body: [
41
- seatPicker({
42
- id: 'seats',
43
- rows: 12,
44
- flows: [
45
- [
46
- named('picked', declaredTrigger(declaration, 'onPick')),
47
- setState({ key: 'seat', type: 'text', value: '{{ picked.seat }}' })
48
- ]
42
+ container({
43
+ subType: 'main',
44
+ children: [
45
+ seatPicker({
46
+ id: 'seats',
47
+ rows: 12,
48
+ flows: [
49
+ [
50
+ named('picked', declaredTrigger(declaration, 'onPick')),
51
+ setState({ key: 'seat', type: 'text', value: '{{ picked.seat }}' })
52
+ ]
53
+ ]
54
+ }),
55
+ button({ content: 'Clear', flows: [[onClick(), declaredCallback(declaration, 'reset', { on: 'seats' })]] })
49
56
  ]
50
- }),
51
- button({ content: 'Clear', flows: [[onClick(), declaredCallback(declaration, 'reset', { on: 'seats' })]] })
57
+ })
52
58
  ]
53
59
  }
54
60
  ]
@@ -43,32 +43,37 @@ export const recipe: SpaceSpec = {
43
43
  slug: '',
44
44
  body: [
45
45
  container({
46
+ subType: 'main',
46
47
  children: [
47
- // Shown until the row says it is at that end: the arrows are there before anybody scrolls.
48
- button({
49
- content: '‹',
50
- title: 'Previous categories',
51
- visible: '!state.rowAtStart',
52
- flows: [[onClick(), scrollBy('categories', { x: '-80%' })]]
53
- }),
54
- list({
55
- id: 'categories',
56
- class: row,
57
- items: CATEGORIES,
58
- flows: [
59
- [
60
- named('moved', onScroll()),
61
- setState({ key: 'rowAtStart', type: 'boolean', value: '{{ moved.atStart }}' }),
62
- setState({ key: 'rowAtEnd', type: 'boolean', value: '{{ moved.atEnd }}' })
63
- ]
64
- ],
65
- children: [listItem({ class: card, children: [text({ from: 'categories.item' })] })]
66
- }),
67
- button({
68
- content: '›',
69
- title: 'More categories',
70
- visible: '!state.rowAtEnd',
71
- flows: [[onClick(), scrollBy('categories', { x: '80%' })]]
48
+ container({
49
+ children: [
50
+ // Shown until the row says it is at that end: the arrows are there before anybody scrolls.
51
+ button({
52
+ content: '‹',
53
+ title: 'Previous categories',
54
+ visible: '!state.rowAtStart',
55
+ flows: [[onClick(), scrollBy('categories', { x: '-80%' })]]
56
+ }),
57
+ list({
58
+ id: 'categories',
59
+ class: row,
60
+ items: CATEGORIES,
61
+ flows: [
62
+ [
63
+ named('moved', onScroll()),
64
+ setState({ key: 'rowAtStart', type: 'boolean', value: '{{ moved.atStart }}' }),
65
+ setState({ key: 'rowAtEnd', type: 'boolean', value: '{{ moved.atEnd }}' })
66
+ ]
67
+ ],
68
+ children: [listItem({ class: card, children: [text({ from: 'categories.item' })] })]
69
+ }),
70
+ button({
71
+ content: '›',
72
+ title: 'More categories',
73
+ visible: '!state.rowAtEnd',
74
+ flows: [[onClick(), scrollBy('categories', { x: '80%' })]]
75
+ })
76
+ ]
72
77
  })
73
78
  ]
74
79
  })
@@ -14,7 +14,7 @@
14
14
  * - An API's answer for the signed-in visitor (`credentials: 'include'`) is asked with their cookies only where the
15
15
  * server names that API and trusts the space (`rsc.visitorCredentials`); anywhere else the provider's error says so.
16
16
  */
17
- import { apiContainer, heading, list, listItem, styles, text } from '@plitzi/sdk-authoring';
17
+ import { apiContainer, container, heading, list, listItem, styles, text } from '@plitzi/sdk-authoring';
18
18
 
19
19
  import type { SpaceSpec } from '@plitzi/sdk-authoring';
20
20
 
@@ -50,16 +50,21 @@ export const recipe: SpaceSpec = {
50
50
  name: 'Home',
51
51
  slug: '',
52
52
  body: [
53
- apiContainer({
54
- id: 'plans',
55
- query: '/data/plans.json',
56
- runtime: 'server',
57
- mockData: { plans: [{ name: 'Starter', price: '$0' }] },
53
+ container({
54
+ subType: 'main',
58
55
  children: [
59
- // `plans.data.plans` — the file's `plans` — in either runtime.
60
- list({ id: 'plan-list', class: grid, items: 'plans.data.plans', row: 'plan-card' }),
61
- text('No plans yet.', {
62
- visible: { source: 'plans.data.plans', template: '{{ source is defined and source|length == 0 }}' }
56
+ apiContainer({
57
+ id: 'plans',
58
+ query: '/data/plans.json',
59
+ runtime: 'server',
60
+ mockData: { plans: [{ name: 'Starter', price: '$0' }] },
61
+ children: [
62
+ // `plans.data.plans` — the file's `plans` — in either runtime.
63
+ list({ id: 'plan-list', class: grid, items: 'plans.data.plans', row: 'plan-card' }),
64
+ text('No plans yet.', {
65
+ visible: { source: 'plans.data.plans', template: '{{ source is defined and source|length == 0 }}' }
66
+ })
67
+ ]
63
68
  })
64
69
  ]
65
70
  })
@@ -39,36 +39,44 @@ export const recipe: SpaceSpec = {
39
39
  name: 'Home',
40
40
  slug: '',
41
41
  body: [
42
- text({ from: 'computed.cartCount', as: '{{ source }} in the cart' }),
43
- apiContainer({
44
- id: 'catalog',
45
- query: '/data/products.json',
46
- cache: true,
47
- // Shown in place of the rest until the first answer, and gone after it.
48
- loadingSlot: 'catalog-skeleton',
42
+ container({
43
+ subType: 'main',
49
44
  children: [
50
- container({ id: 'catalog-skeleton', class: skeleton }),
51
- // Inside a template a source is spelled in full; a binding's own source is `source`.
52
- text({ from: 'catalog.data.products', as: '{{ source|length }} products' }),
53
- list({
54
- id: 'products',
55
- class: grid,
56
- items: 'catalog.data.products',
45
+ text({ from: 'computed.cartCount', as: '{{ source }} in the cart' }),
46
+ apiContainer({
47
+ id: 'catalog',
48
+ query: '/data/products.json',
49
+ cache: true,
50
+ // Shown in place of the rest until the first answer, and gone after it.
51
+ loadingSlot: 'catalog-skeleton',
57
52
  children: [
58
- // One `<li>` per product. Inside a row, a binding names the row short (`products.item`), a template in
59
- // full (`list_products`).
60
- listItem({
61
- class: card,
53
+ container({ id: 'catalog-skeleton', class: skeleton }),
54
+ // Inside a template a source is spelled in full; a binding's own source is `source`.
55
+ text({ from: 'catalog.data.products', as: '{{ source|length }} products' }),
56
+ list({
57
+ id: 'products',
58
+ class: grid,
59
+ items: 'catalog.data.products',
62
60
  children: [
63
- heading({ subType: 'h3', from: 'products.item.title' }),
64
- text({ from: 'products.item.price', as: 'price' })
61
+ // One `<li>` per product. Inside a row, a binding names the row short (`products.item`), a template in
62
+ // full (`list_products`).
63
+ listItem({
64
+ class: card,
65
+ children: [
66
+ heading({ subType: 'h3', from: 'products.item.title' }),
67
+ text({ from: 'products.item.price', as: 'price' })
68
+ ]
69
+ })
65
70
  ]
71
+ }),
72
+ // Revealed by the data, so it starts hidden: nothing flashes while the file loads.
73
+ text('No products yet.', {
74
+ visible: {
75
+ source: 'catalog.data.products',
76
+ template: '{{ source is defined and source|length == 0 }}'
77
+ }
66
78
  })
67
79
  ]
68
- }),
69
- // Revealed by the data, so it starts hidden: nothing flashes while the file loads.
70
- text('No products yet.', {
71
- visible: { source: 'catalog.data.products', template: '{{ source is defined and source|length == 0 }}' }
72
80
  })
73
81
  ]
74
82
  })
@@ -33,11 +33,16 @@ export const recipe: SpaceSpec = {
33
33
  slug: '',
34
34
  css: { 'background-color': 'var(--card)', color: 'var(--foreground)', padding: '48px 24px' },
35
35
  body: [
36
- container({ class: card, children: [heading('Plain', { subType: 'h2' }), text('The class as it is.')] }),
37
36
  container({
38
- id: 'featured',
39
- class: [card, { 'border-width': '2px', 'border-style': 'solid', 'border-color': 'var(--primary)' }],
40
- children: [heading('Featured', { subType: 'h2' }), text('The class, plus one thing.')]
37
+ subType: 'main',
38
+ children: [
39
+ container({ class: card, children: [heading('Plain', { subType: 'h2' }), text('The class as it is.')] }),
40
+ container({
41
+ id: 'featured',
42
+ class: [card, { 'border-width': '2px', 'border-style': 'solid', 'border-color': 'var(--primary)' }],
43
+ children: [heading('Featured', { subType: 'h2' }), text('The class, plus one thing.')]
44
+ })
45
+ ]
41
46
  })
42
47
  ]
43
48
  }
@@ -3,7 +3,7 @@
3
3
  * `site.data.hero.titel` is a type error, not an empty heading. In a project the sample is the file itself:
4
4
  * `import home from '../data/home.json' with { type: 'json' }` — `src/data/`, or `public/data/` with no server.
5
5
  */
6
- import { apiContainer, heading, list, source, styles, text, twig, listItem } from '@plitzi/sdk-authoring';
6
+ import { apiContainer, container, heading, list, listItem, source, styles, text, twig } from '@plitzi/sdk-authoring';
7
7
 
8
8
  import type { SpaceSpec } from '@plitzi/sdk-authoring';
9
9
 
@@ -35,28 +35,33 @@ export const recipe: SpaceSpec = {
35
35
  name: 'Home',
36
36
  slug: '',
37
37
  body: [
38
- apiContainer({
39
- id: site.id,
40
- query: '/data/home.json',
41
- cache: true,
38
+ container({
39
+ subType: 'main',
42
40
  children: [
43
- heading({ from: site.data.hero.title }),
44
- text({ from: site.data.hero.subtitle }),
45
- // A template takes the paths through `twig`, each written in full.
46
- text({ content: twig`{{ ${site.data.products}|length }} products` }),
47
- list({
48
- id: 'products',
49
- class: grid,
50
- items: site.data.products,
51
- // The row's item is typed as the sample's: every field any product has.
52
- row: product =>
53
- listItem({
54
- children: [
55
- text({ from: product.item.title }),
56
- text({ from: product.item.price, as: 'price' }),
57
- text({ from: product.item.badge, visible: product.item.badge })
58
- ]
41
+ apiContainer({
42
+ id: site.id,
43
+ query: '/data/home.json',
44
+ cache: true,
45
+ children: [
46
+ heading({ from: site.data.hero.title }),
47
+ text({ from: site.data.hero.subtitle }),
48
+ // A template takes the paths through `twig`, each written in full.
49
+ text({ content: twig`{{ ${site.data.products}|length }} products` }),
50
+ list({
51
+ id: 'products',
52
+ class: grid,
53
+ items: site.data.products,
54
+ // The row's item is typed as the sample's: every field any product has.
55
+ row: product =>
56
+ listItem({
57
+ children: [
58
+ text({ from: product.item.title }),
59
+ text({ from: product.item.price, as: 'price' }),
60
+ text({ from: product.item.badge, visible: product.item.badge })
61
+ ]
62
+ })
59
63
  })
64
+ ]
60
65
  })
61
66
  ]
62
67
  })
@@ -3,7 +3,7 @@
3
3
  * button, a field keeps its label out of sight rather than dropping it, a picture says what it shows or that it only
4
4
  * decorates.
5
5
  */
6
- import { button, formControl, image, setState, styles, text, onClick } from '@plitzi/sdk-authoring';
6
+ import { button, container, formControl, image, onClick, setState, styles, text } from '@plitzi/sdk-authoring';
7
7
 
8
8
  import type { SpaceSpec } from '@plitzi/sdk-authoring';
9
9
 
@@ -23,16 +23,21 @@ export const recipe: SpaceSpec = {
23
23
  name: 'Home',
24
24
  slug: '',
25
25
  body: [
26
- button({ content: '', title: 'Search', icon: 'fa-solid fa-magnifying-glass' }),
27
- button({
28
- content: '',
29
- class: card,
30
- children: [text('Pro'), text('12 € a month')],
31
- flows: [[onClick(), setState({ key: 'plan', type: 'text', value: 'pro' })]]
32
- }),
33
- formControl({ name: 'q', label: 'Search the docs', hideLabel: true, placeholder: 'Search…' }),
34
- image({ src: '/team.jpg', alt: 'The team at the 2026 offsite' }),
35
- image({ src: '/grain.png', decorative: true })
26
+ container({
27
+ subType: 'main',
28
+ children: [
29
+ button({ content: '', title: 'Search', icon: 'fa-solid fa-magnifying-glass' }),
30
+ button({
31
+ content: '',
32
+ class: card,
33
+ children: [text('Pro'), text('12 € a month')],
34
+ flows: [[onClick(), setState({ key: 'plan', type: 'text', value: 'pro' })]]
35
+ }),
36
+ formControl({ name: 'q', label: 'Search the docs', hideLabel: true, placeholder: 'Search…' }),
37
+ image({ src: '/team.jpg', alt: 'The team at the 2026 offsite' }),
38
+ image({ src: '/grain.png', decorative: true })
39
+ ]
40
+ })
36
41
  ]
37
42
  }
38
43
  ]
@@ -108,6 +108,7 @@ The space is not written until these are fixed.
108
108
  | `no-pages` | a space with no pages | `pages: [{ id: 'home', name: 'Home', slug: '', body: [] }]` |
109
109
  | `not-found-in-browser` | `notFound` on a provider asked from the browser — its answer arrives after the page was sent with its status | `runtime: 'server'` on the provider, or `visible` on the page's "not found" part instead |
110
110
  | `not-found-not-a-template` | `notFound`, a provider's or a page's, that is not one `{{ expression }}` — never `true`, so never a 404 | `notFound: '{{ source.found == false }}'` |
111
+ | `not-found-twice` | two pages answering every address nothing else does (`slug: '*'`) in the same place — the space, or one folder: the router would pick one, and an address land on whichever it picked | one per place: the other given a slug of its own, or moved to the folder whose addresses it answers (a folder's answers its own, the space's the rest) |
111
112
  | `notifications-shape` | `notifications` with a field it does not have, or a value that is not one CSS value | the field it suggests, or one it lists; one CSS value, like 'var(--card)', '12px' or '500' |
112
113
  | `og-type-unknown` | a page's `seoType` that Open Graph does not name | `seoType: 'article'`, `'profile'`, `'music.playlist'` — or leave it out, and the page is a `website` |
113
114
  | `outside-ancestor` | an element that reads the state of an element it is not inside | nest it in the element the message names |
@@ -242,7 +243,7 @@ The space renders, and renders something you probably did not mean. Fix every on
242
243
  | `page-path-unknown` | a link or `navigate` to a path no page of the space answers — a page not made yet, or a typo | a path a page answers (its folder and slug), the page's id, or `mode: 'external'` for one the server answers itself |
243
244
  | `painted-state-without-keep-state` | `paintedState` without `keepState` — nothing is kept for the server to draw with | `settings.keepState: true`, or remove `paintedState` |
244
245
  | `path-not-in-data` | a binding onto a provider whose answer the author could read (`data`), through a path that answer does not have | the path the message lists the keys for — `p.data.plans`, not `p.data.landing.plans` |
245
- | `plugin-attribute-reserved` | a plugin attribute named as one of the element’s own fields — a factory never hands it to the plugin | rename it in the plugin, as the warning names it (`variant` → `kind`, `from` → `start`) |
246
+ | `plugin-attribute-reserved` | a plugin attribute named as one of the element’s own fields — a factory never hands it to the plugin — said by `author` alone, which reads the plugin's own declaration, which authoring is handed and a space's documents do not hold | rename it in the plugin, as the warning names it (`variant` → `kind`, `from` → `start`) |
246
247
  | `popup-position-set` | a class on a `dropdownPopup` setting where it is drawn — `position`, `top`, `left`, `right`, `bottom`, `inset` or `transform` — over the place its dropdown puts it at, at the space's root | its look on the class, its place on the dropdown: `popupPlacement`, `containerTopOffset`, `containerLeftOffset`, and `popupWidth: "trigger"` for its width |
247
248
  | `provider-without-source` | an `apiContainer` that asks nothing | a `query` (or `action`, `connector`, `resource`) |
248
249
  | `required-message-unused` | a `requiredMessage` on a field nothing requires — fields are optional unless `required: true`, so it is never shown and an empty answer is sent | `required: true` on the field, or no message |
@@ -253,7 +254,7 @@ The space renders, and renders something you probably did not mean. Fix every on
253
254
  | `state-key-has-runtime-prefix` | a state key written with `runtime.state.` in front — the state callbacks already write below it | `key: 'cart'`, not `'runtime.state.cart'` |
254
255
  | `state-toggled-in-branches` | two `setState` of one key, each under a `when` on that key — the second flips back what the first wrote | `toggleState({ key })`; for something shown by default, a key named for hiding it |
255
256
  | `STYLE_WITHOUT_TAG` | style on a provider that renders no element of its own | `subType: 'div'` on the provider, or style its parent |
256
- | `tablet-rule-skips-mobile` | a tablet rule phones never get — mobile inherits desktop, not tablet | write it under `compact` (tablet and mobile together) |
257
+ | `tablet-rule-skips-mobile` | a tablet rule phones never get — mobile inherits desktop, not tablet (a grid’s columns are left alone where the phone is not a grid) | write it under `compact` (tablet and mobile together) |
257
258
  | `template-never-resolved` | a condition in an attribute, which only resolves `{{ name\|filter }}` — used as written | move it into `bindTemplate` |
258
259
  | `template-or-value` | a template's `or` (or `and`) beside a text or a number — `sort or 'listeners'` — which answers true or false, never the value | a fallback value with `??`: `sort ?? 'listeners'`; a test with `or` between two conditions |
259
260
  | `test-account-role-gone` | a test account holds a visitor role the space does not declare in `settings.visitorRoles` — removed since, or never there: a journey plays it without that role, and one that needed what it gave fails | one of the space’s roles for the account — or the role declared again |
@@ -271,18 +272,24 @@ Nothing is wrong: the page renders as written. Each is a shorter way to the same
271
272
 
272
273
  | Code | Written the long way | The short way |
273
274
  | --- | --- | --- |
274
- | `class-overrides-class` | one class's shorthand erasing the longhand another class on the same element writes out — `padding` over `padding-top` — or the same property set over the class listed after it — `gap` over `gap` — because the stylesheet writes it later: classes in the order they are first met, a breakpoint's rules after the base, never the order of a class list | the longhands the shorthand means instead of it (`padding-left`, `padding-right`), so it leaves the other class's alone; the same property, left to one of the two or written on the element itself — or `quiet: ['class-overrides-class']` when the winner is meant to win |
275
+ | `class-overrides-class` | one class's shorthand erasing the longhand another class on the same element writes out — `padding` over `padding-top` — or the same property set over the class listed after it — `gap` over `gap` — because the stylesheet writes it later: classes in the order they are first met, a breakpoint's rules after the base, never the order of a class list — said by `author` alone, which reads the shorthand a rule was written with — the stylesheet holds the longhands it stands for | the longhands the shorthand means instead of it (`padding-left`, `padding-right`), so it leaves the other class's alone; the same property, left to one of the two or written on the element itself — or `quiet: ['class-overrides-class']` when the winner is meant to win |
275
276
  | `content-attribute` | a button or a link whose children are only its words and an icon — a `text`, a `fontAwesome` — elements more than it needs | its own `content` and `icon` (`link({ href, content: 'Docs', icon: 'fa-solid fa-arrow-right', iconPlacement: 'after' })`); the icon's class goes on the `icon` slot, and what the text's class adds on the box's class, never the class itself |
276
277
  | `custom-css-class` | a `customCss` rule a class can hold — `.card:hover`, `.panel .icon` | the class's own `states` or `ancestors`, where the style editor reads it back and a breakpoint can change it |
277
278
  | `custom-css-notifications` | the toasts or their icon, close button or progress bar dressed with `.Toastify__*` rules in `customCss` | `notifications: { font, fontSize, fontWeight, minHeight, iconSize, closeColor, progressHeight, … }` |
278
279
  | `custom-css-sdk-default` | `customCss` repeating what the SDK already does for every space — less motion when asked, the theme toggle showing one icon | nothing: remove it |
279
280
  | `custom-css-slot` | a part of a built-in element dressed in `customCss` by the SDK's markup — a form control's `<input>`, a pager's buttons, a heading inside a markdown | a class on the slot of that part — `slots: { field: input }`, `elements.<type>.slots` — with its states |
281
+ | `desktop-only` | a page, layout or component styled for the desktop alone where a phone (390 px) breaks — a width past 480 px with no `max-width` holding it; a grid whose fixed columns and gaps are wider than a phone, or three or more columns sharing its width a page’s parts apart (a gap of 16 px or more) and left narrower than 120 px each; type past 64 px — that no `mobile` rule of the classes on it sets again (a style’s `mobile` is laid over its `desktop` alone, so a `tablet` rule does not reach a phone). What a `mobile` rule hides is left out, as is a grid it lays out otherwise (`display: flex`), a width inside a box that clips or scrolls it sideways (`overflow-x: auto` round a table), a layout fluid on its own — wrapping flex, `%`, `min()`, `clamp()`, `repeat(auto-fit, minmax(…))` —, a row whose one column grows (`48px 1fr auto`), a dense widget’s many thin columns, and a space written mobile first | the phone's value in the class's `mobile` rules (`styles('card', { css: { desktop: { … }, mobile: { gridTemplateColumns: '1fr' } } })`), or a value fluid on its own — `width: 'min(960px, 100%)'`, `font-size: 'clamp(32px, 6vw, 72px)'`, `grid-template-columns: 'repeat(auto-fit, minmax(240px, 1fr))'` — or, for a surface only a desktop opens, `quiet: ['desktop-only']` on it, with why |
280
282
  | `element-color-inherited` | `elements` giving a type — a heading, a text, a link — `color: inherit` or the page's own colour, which it takes by itself | remove it, and name the colour once on `elements.page`: every element reads in the page’s colour, a link’s words included |
281
283
  | `heading-level-skipped` | an `h4` right after an `h2` on a page as it is drawn — inside its layouts, with the headings a `markdown` writes, and without those that start hidden (`visible: false`): the outline misses a level (Lighthouse: "not in a sequentially-descending order") | the next level down; size it with its class |
282
284
  | `heavy-animation` | keyframes animating what the browser repaints or lays out again on every frame — a size, a position, a blur, a shadow, or a colour in a loop — which stutters whenever the page is busy, most of all while it loads | `opacity` and `transform`: a size or a position is `translate`/`scale`, a blur or a shadow is the `opacity` of a layer carrying it; a loop that must animate anything else starts `paused` and runs under `[data-hydrated]` |
285
+ | `heavy-layout` | one layout whose own part of the document passes 250 KB — every page drawn in it is downloaded with it, the first a visitor opens at least — with how many pages carry it and what 10,000 first visits move for it | what only some of its pages show moved into those pages, or into a component they place; rows of data as one `list` of a component (`list({ items, row })`) — or, for a shell heavy on purpose, `quiet: ['heavy-layout']` on the layout, with why |
286
+ | `heavy-page` | one page whose part of the document passes 250 KB — every visitor downloads it before the page is theirs — with the shapes written again most inside it, by what they weigh | the rows of data as one `list` of a component, read from the data (`list({ items, row })`), and a block written per state as one element whose state picks its content: the document then holds one copy — or, for an app's page heavy for how many elements it has, `quiet: ['heavy-page']` on the page, with why |
283
287
  | `literal-colour` | a colour written out in a class where the space has a token of that value — it stays put in the dark scheme | `var(--token)` when it should follow the scheme; a token of one value of its own when it must stay the same in both |
284
- | `not-found-page` | a space with no page of its own for an address no other page answers — a plain one was added, in the home page’s layout, sent with status 404 | a page whose slug is `'*'`: `{ id: 'not-found', name: 'Not found', slug: '*', layout: …, body: [...] }` |
288
+ | `many-elements` | a page that builds more than 1,500 elements as it opens — its own, its layouts’ and its components’ once per instance, not those that start hidden with `loadStrategy` `lazy` or `visible` — with what a visit downloads for them: a phone builds, styles and lays out each before the page answers (Lighthouse flags a page past about 1,400) | `loadStrategy: 'lazy'` on what starts hidden until something shows it (`visible: false`) — a tab, a panel, a dialog — so it is built the first time it is shown (one a condition shows may be on screen at once, and is not named); rows of data as one `list`; a part few visitors reach as a page of its own — or, for an app's page rich on purpose, `quiet: ['many-elements']` on the page, with why |
289
+ | `not-found-page` | a space with no page of its own for an address no other page answers — a plain one was added, in the home page’s layout, sent with status 404 — said by `author` alone, which reads that the page was added: written, it is a page like any other | a page whose slug is `'*'`: `{ id: 'not-found', name: 'Not found', slug: '*', layout: …, body: [...] }` |
290
+ | `page-without-main` | a page that draws no `main` landmark — neither it nor its layouts: a screen reader skipping to the content and a browser agent find no place where the page's own content starts (Lighthouse: "Document does not have a main landmark") | the container holding the page's content drawn as `main` (`container({ subType: 'main', children })`) — in the layout's slot when its pages share the shell — once a page |
285
291
  | `plugin-custom-host` | a `custom` element naming, by `renderType`, a plugin whose declaration the space was handed | place it from its declaration — `const seatPicker = defineElement(declaration)`, then `seatPicker({ id, … })`: typed by what it declares (a `definePlugin` declaration carries its attributes), the element the builder adds too |
292
+ | `repeated-expression` | the same long expression — its numbers and words aside — written into many bindings, steps or attributes: a sum or a choice worked out again in every copy, and carried by the document once per copy | what the copies share as a computed value (`computed: { chosen: '{{ … }}' }`, read as `computed.chosen`), answering `null` off the page that reads it (`navigation.currentPageId`), each copy keeping what differs; copies side by side as one `list` whose rows carry what differs (`list({ items, row })`) |
286
293
  | `repeated-on-pages` | the same block — a header, a footer, a side panel — written into several pages | a layout holding it once (`layouts`, and `layout: { id, slot }` on each page) — a component when only some pages of a layout carry it, written in its area’s folder and listed in the space’s `components`; a link marks its own page with the `current` state |
287
294
  | `repeated-shape` | the same structure written again and again with different words — cards, rows, tiles. Copies that read their data in a form of their own (their template) or render on the server are no repeats, and neither are copies side by side wired to different sources or state keys — controls written alike; copies apart that read different sources are one component, each instance handed its own | a component with props (`components`, `component(id, { props })`) — a source a copy reads handed in as a bound `json` prop (`component(id, { bind: [{ to: 'items', source }] })`, read inside as `props.items`) — or one `list` when they are rows of data side by side; a few cards a person rewords on the canvas can stay cards |
288
295
  | `unused-class` | a class declared in `classes` that no element, binding, flow or other class names | remove it from `classes` — or wear it where it was meant to go |
@@ -20,7 +20,9 @@ is a bug to fix; a suggestion is a shorter way to the same page — take it unle
20
20
  reason is usually that the copies are about to diverge. `npx @plitzi/cli explain repeated-on-pages` explains any code.
21
21
 
22
22
  Left on purpose, say so where it is written — `quiet` on an element it is about (a component's instance too:
23
- `component(id, { quiet })`), and it is not offered again, in the builder or over MCP either (it is kept in the
23
+ `component(id, { quiet })`; a page for `heavy-page`, an app's page heavy for how many elements it has; the one element
24
+ every element it is about sits in, for copies side by side — a row of plan cards), and it is not
25
+ offered again, in the builder or over MCP either (it is kept in the
24
26
  document):
25
27
 
26
28
  ```ts
@@ -151,7 +151,8 @@ Every page is now its content and nothing else, and every page is guaranteed the
151
151
  status 404, in the layout you give it, so the visitor is still on the site with a way back. Its own address answers
152
152
  404 too.
153
153
  - **One per folder, if a section wants its own.** In a folder (`folder: 'docs'`) it answers that folder's unknown
154
- addresses; the deepest folder's wins, the space's takes the rest. A page whose `flag` is off shows it too.
154
+ addresses; the deepest folder's wins, the space's takes the rest. A page whose `flag` is off shows it too. Never two
155
+ in one place — the space, or one folder: the router would pick one, so `author` refuses it (`not-found-twice`).
155
156
  - **A space with none is given a plain one** — a title and a link home, in the home page's layout — and `author`
156
157
  suggests writing your own (`not-found-page`): say it in the space's words.
157
158
  - **A page that exists but finds nothing** — `/products/:slug` for a slug no product has — is sent with 404 too when