@plitzi/sdk-authoring 0.38.24 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +146 -1
  2. package/dist/index-src.js +27619 -16681
  3. package/dist/index.d.ts +2750 -694
  4. package/dist/index.js +2 -2
  5. package/dist/node.d.ts +1283 -559
  6. package/dist/node.js +511 -289
  7. package/dist/plugin.d.ts +57 -1
  8. package/package.json +8 -8
  9. package/skills/plitzi-authoring/CHEATSHEET.md +6 -6
  10. package/skills/plitzi-authoring/SKILL.md +4 -2
  11. package/skills/plitzi-authoring/recipes/accordion.ts +2 -1
  12. package/skills/plitzi-authoring/recipes/carousel.ts +24 -3
  13. package/skills/plitzi-authoring/recipes/detail-page.ts +0 -1
  14. package/skills/plitzi-authoring/recipes/embed-and-svg.ts +3 -1
  15. package/skills/plitzi-authoring/recipes/filter-a-list.ts +0 -1
  16. package/skills/plitzi-authoring/recipes/show-data.ts +0 -1
  17. package/skills/plitzi-authoring/recipes/typed-data.ts +0 -1
  18. package/skills/plitzi-authoring/reference/accessibility.md +7 -2
  19. package/skills/plitzi-authoring/reference/auth.md +15 -4
  20. package/skills/plitzi-authoring/reference/authoring-errors.md +51 -10
  21. package/skills/plitzi-authoring/reference/colours-and-motion.md +7 -1
  22. package/skills/plitzi-authoring/reference/components.md +4 -1
  23. package/skills/plitzi-authoring/reference/data-and-visibility.md +31 -22
  24. package/skills/plitzi-authoring/reference/efficiency.md +2 -1
  25. package/skills/plitzi-authoring/reference/elements-and-styles.md +16 -15
  26. package/skills/plitzi-authoring/reference/flows.md +20 -8
  27. package/skills/plitzi-authoring/reference/kept-state.md +8 -0
  28. package/skills/plitzi-authoring/reference/layouts.md +18 -2
  29. package/skills/plitzi-authoring/reference/lists.md +20 -4
  30. package/skills/plitzi-authoring/reference/plugin-reach.md +12 -0
  31. package/skills/plitzi-authoring/reference/plugins.md +13 -2
  32. package/skills/plitzi-authoring/reference/realtime.md +8 -5
  33. package/skills/plitzi-authoring/reference/structure.md +17 -1
  34. package/skills/plitzi-authoring/reference/templates.md +11 -3
  35. package/skills/plitzi-authoring/reference/testing.md +82 -5
  36. package/skills/plitzi-authoring/reference/typed-sources.md +6 -0
  37. package/skills/plitzi-authoring/reference/validation.md +1 -1
@@ -1,6 +1,6 @@
1
1
  # When `authorSpace` refuses, warns or suggests
2
2
 
3
- <!-- Generated from AUTHORING_CODES (src/schema/codes.ts) by `yarn generate:authoring-errors`. Do not edit. -->
3
+ <!-- Generated from AUTHORING_CODES (src/schema/codes/) by `yarn generate:authoring-errors`. Do not edit. -->
4
4
 
5
5
  Search this page for the code in brackets — `[class-and-css]` — rather than reading it whole, or ask for one:
6
6
  `npx @plitzi/cli explain class-and-css`.
@@ -28,11 +28,13 @@ The space is not written until these are fixed.
28
28
  | `action-without-steps` | an action with no steps | the steps it runs |
29
29
  | `active-when-constant` | an `activeWhen` condition that reads nothing — always or never true | name what it depends on: `'{{ list_dots.index == state.slide }}'` |
30
30
  | `ancestor-not-class` | an ancestor condition keyed by something that is neither a class name nor `'>'` (the parent) | `[card.name]` for a `styles()` declaration, or `'>'` for the parent whatever it wears |
31
+ | `ancestor-shape` | an ancestor condition given keys other than `css`, `states` and `variants` — `pseudos` (an ancestor's rules reach the element, never its `::before`/`::after`) or `conditions` — which were dropped without a word | for `pseudos`, a custom property the ancestor's state sets — `ancestors: { [card.name]: { states: { hover: { '--fill-opacity': '1' } } } }` — read by the class's own pseudo-element: `pseudos: { before: { css: { opacity: 'var(--fill-opacity, 0.6)' } } }`; for `conditions`, the condition on the class's own `css` — `conditions: { 'motion-reduce': { css: { transition: 'none' } } }` |
31
32
  | `anchor-duplicate` | one anchor on two elements of the same page (layouts included) | rename all but one |
33
+ | `anchor-in-row` | a link to an anchor drawn in a list’s rows — each row’s is named after its row, so the link lands at the top | link to one row’s (`hash: 'answer-<row key>'`), the list’s own anchor, or one outside it |
32
34
  | `anchor-invalid` | an `anchor` or a link's `hash` that is not lowercase letters, digits and `-` | `anchor: 'plans'`, `hash: 'plans'` — no `#` |
33
35
  | `anchor-missing` | a link whose `hash` no element on the page it goes to carries — it would land at the top | the anchor the message lists, or give the section that `anchor` |
34
36
  | `anchor-no-tag` | an anchor on an element that renders no element of its own | the anchor on the element around it, or `subType: 'div'` on the provider |
35
- | `anchor-repeated` | an anchor inside a list row or a component — it would be in the page once per row or instance | the anchor on the list, or on the element around the instance |
37
+ | `anchor-repeated` | an anchor inside a component — it would be in the page once per instance | the anchor on the element around the instance (in a list row, an anchor is the row’s own: that one is fine) |
36
38
  | `as-without-from` | `as` with no `from` — `as` is how the source `from` names is shown | `from: 'products.item.price', as: 'price'` |
37
39
  | `attribute-kind` | text where a flag or a list is read | `disabled: true`, not `'true'`; `items: [ … ]` |
38
40
  | `attribute-value` | a value outside the attribute's list (`subType: 'h7'`) | one of the listed values |
@@ -60,6 +62,9 @@ The space is not written until these are fixed.
60
62
  | `computed-reads-element` | a computed value reading an element's source — no element is around the whole space | compute it from the globals and the variables, or bind it on the element |
61
63
  | `computed-unknown` | a computed value read before it is declared, or never declared | declare it in `computed`, above the one that reads it |
62
64
  | `condition-field-unpublished` | a `when` asking a step of its flow for a key it never publishes — `whenSucceeded` / `whenFailed` on anything but `runServerAction` | a key the step publishes (`explain <step>`): after `authLogin`, `when({ field: 'signedIn.ok', operator: '=', value: true }, …)` |
65
+ | `condition-short-source` | a step's condition reading an element's source by the element's id alone — `roomStats.locked` — which reads nothing | the source named in full, as a template names it: `apiContainer_roomStats.locked` |
66
+ | `condition-template` | a `when` rule with a template in its field or value — `value: '{{ list_genres.item.id }}'` — compared as that text, so it never holds | a path: `field: 'state.picks'`; another path as the value, `value: 'list_genres.item.id', isBinding: true`; an expression, a computed value |
67
+ | `controls-other-row` | a button's `controls` naming an element a list draws in its rows, from outside that row | the button in the same row as what it shows and hides, or `controls` naming an element outside the list |
63
68
  | `controls-unknown` | a button's `controls` naming no element of the space | the id of the element it shows and hides: `controls: 'faq-answer'` |
64
69
  | `css-property-twice` | one property written twice in a rule set — `paddingTop` beside `'padding-top'` — so one would silently win | keep one |
65
70
  | `css-property-unknown` | a CSS property that does not exist | the property it suggests; a custom property starts with `--` |
@@ -82,7 +87,7 @@ The space is not written until these are fixed.
82
87
  | `folder-cycle` | a page folder inside itself | a `parent` that leads to the top |
83
88
  | `folder-undeclared` | a page, a layout or a folder filed in a folder the space does not declare | declare it on the space — `pageFolders: [{ id: 'docs', name: 'Docs' }]`, its slug starting its pages' addresses — or use the name it suggests |
84
89
  | `font-invalid` | a font the space cannot load as declared | the field the message names |
85
- | `format-unknown` | an `as` that names no format of the space's `formats` | declare it once — `formats: { price: "{{ source\|currency('USD') }}" }` — or write the template in its place |
90
+ | `format-unknown` | an `as` that names no format of the space's `formats` | declare it once — `formats: { price: "{{ source\|currency('USD') }}" }` — or write the template in its place; words the element always shows are its `content`, with no `from` |
86
91
  | `from-and-bind` | the main attribute bound twice, with `from` and in `bind` | keep `from`, and give `bind` the other attributes |
87
92
  | `from-without-attribute` | `from` on a type with no one attribute that shows its data (a container, a form) | bind the attribute you mean: `bind: { attribute: 'source' }` |
88
93
  | `global-callback-module` | a global callback sent to a module other than the one that registers it | the step builder, which knows the module |
@@ -104,14 +109,17 @@ The space is not written until these are fixed.
104
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 |
105
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 }}'` |
106
111
  | `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
+ | `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` |
107
113
  | `outside-ancestor` | an element that reads the state of an element it is not inside | nest it in the element the message names |
108
114
  | `page-access` | a page `access` the server cannot keep: no permissions, or one that is not a name | `access: { permissions: ['…'] }` with at least one permission name, or no `access` for a page anybody may see |
109
115
  | `page-access-level` | an `accessLevel` that is not one the router reads | one of the values the message lists |
116
+ | `page-catch-all-default` | the page of every address no other answers (`slug: '*'`) marked the home | `isDefault` on the page at `''`, or left out: the page at `''` is the home |
117
+ | `page-nav-invalid` | a page's `nav` without a label, with an order that is no number, or on a page with no one address to list | `nav: { label: 'Pets', order: 3 }` on a page whose path takes no param — a page per record is reached from its list |
110
118
  | `page-route-reserved` | a page under `/fn`, where the space's functions answer | another slug |
111
119
  | `page-route-taken` | two pages at one address for the same visitors | another slug — or `accessLevel` `'public'` on one and `'authenticated'` on the other |
112
120
  | `page-target-unknown` | a link or `navigate` to a page id that does not exist | an existing page id, or a path with its slash (`'/about'`) |
113
121
  | `page-target-url` | a URL, `mailto:` or `tel:` in a link left in page mode | `mode: 'external'` |
114
- | `page-template` | a template in a page's `seoTitle`, `seoDescription` or `notFound` that reads what is not there when the server answers — anything but the page's `runtime: 'server'` providers and `navigation` — or cannot be read | read the record from a provider with `runtime: 'server'` on the page or its layout — `'{{ apiContainer_post.title }} — Blog'` — or words of its own |
122
+ | `page-template` | a template in a page's `seoTitle`, `seoDescription`, `notFound` or a text of its `structuredData` that reads what is not there when the server answers — anything but the page's `runtime: 'server'` providers and `navigation` — or cannot be read | read the record from a provider with `runtime: 'server'` on the page or its layout — `'{{ apiContainer_post.title }} — Blog'` — or words of its own |
115
123
  | `page-without-slug` | a page with no `slug` | `slug: ''` for the home page, its path for any other: `'about'`, `'blog/:slug'` |
116
124
  | `part-missing` | a compound element — a carousel, a tab container, a dropdown — without a part it renders through | the part the message names, inside it (`carousel()` writes its own track) |
117
125
  | `prop-missing` | an instance without a prop its component requires | `component('card', { props: { name: … } })`, or bind it |
@@ -120,8 +128,11 @@ The space is not written until these are fixed.
120
128
  | `prop-unknown` | a prop the component does not declare, handed in or read | the prop it suggests, or declare it: `props: { name: { type: 'text' } }` |
121
129
  | `prop-value` | a prop handed in with a value its declaration does not take | a value of the declared type, or one of its options |
122
130
  | `props-outside-component` | `props.x` read outside a component | read the source it would have come from |
131
+ | `provider-when-not-rules` | a provider's `when` that is no rule group — a string, a single rule — never read, so it never waits | `when: { combinator: 'and', rules: [{ field, operator, value }] }`, each field a source by its name |
123
132
  | `quiet-unknown` | an element's `quiet` naming something that is not a suggestion's code — a problem is never quieted | the code of the suggestion it was offered: `quiet: ['repeated-shape']` |
124
133
  | `redirect-target-unknown` | a page that sends visitors it is not for to a page the space does not have | a page's id or slug (`''` is the home page), or a full URL |
134
+ | `robots-txt-line` | a line of the space's `settings.robotsTxt` that no crawler reads, or one with no `User-agent` | `User-agent: *` then `Allow: /`, `Disallow: /overlay` — each line `Field: value`, or a comment |
135
+ | `robots-unknown` | a page's `robots` with a directive no search engine reads, or none | `robots: 'noindex'`, `'noindex, nofollow'` — or leave it out, and the page is indexed |
125
136
  | `row-and-children` | a list with a `row` and `children` — the row is what it renders | one of the two |
126
137
  | `row-component` | a list's `row` naming a component the space does not declare, or one with no prop to take the row | a declared component with an `item` prop — or a single prop — for the row |
127
138
  | `row-outside-list` | `row` on an element that is not a list | a `list` around it |
@@ -131,25 +142,38 @@ The space is not written until these are fixed.
131
142
  | `selector-taken` | a `selector` that is a declared class, or another element's | `class` to share rules; a selector of an element's own is its alone |
132
143
  | `server-data-in-browser` | a provider asking for the project's own data (`/data/…`, read by its server from `src/data/` and never served) from the browser | `runtime: 'server'` on the provider: the page arrives with the data in it |
133
144
  | `server-provider-in-component` | a `runtime: 'server'` element inside a component: the page server resolves a page's and its layouts', never a component's | put the provider on the page, around the instance, and hand the component its rows as a prop |
145
+ | `server-query-unresolved` | a `runtime: 'server'` provider whose `query` the page server cannot read — bound, a template reading what the browser alone holds (anything but the space's variables and `navigation`), the visitor's cookies (`credentials: 'include'`), another method than GET, or neither an address (`https://…`) nor a path (`/…`) — so it draws empty | write it over the space's variables and `navigation` (`'{{ apiUrl }}/posts/{{ navigation.routeParams.id }}'`); an `action` for what the browser holds; or no `runtime: 'server'`, and the browser asks it |
146
+ | `server-source-in-browser` | a provider with an `action` or a `connector` asked from the browser — only the page server resolves those, so it never asks | `runtime: 'server'` on the provider |
134
147
  | `setting-misplaced` | `settings.computed` or `settings.channels` written inside `settings` | `computed` and `channels` at the top of the space |
148
+ | `share-image-invalid` | a page's `seoImage` that is neither a file of the site, an address nor a template — or a `seoImageAlt` with no picture | `seoImage: '/og/home.png'` (in public/), `'https://…'` or `'{{ apiContainer_room.cover }}'`, with `seoImageAlt` saying what it shows |
149
+ | `shorthand-ambiguous` | a shorthand one of whose parts is a bare `var(--x)` — `background: var(--surface)` — which longhand it is depends on what the variable holds | the longhand it is: `'background-color': 'var(--x)'` for a colour, `'background-image'` for a gradient or a picture |
150
+ | `shorthand-unread` | a `font` shorthand with a part the expansion reads as none of its longhands — a `var()` size, a system font — or without the size and family CSS requires | the longhands it means: `'font-size': 'var(--size)'`, `'font-family': …`; a CSS-wide keyword (`font: inherit`) is read whole |
135
151
  | `slot-children` | children handed to an instance outside its slots | `children: { slotName: [ … ] }`; a component with no slots takes no children |
136
152
  | `slot-not-class` | a `slots` entry that is not a class — rules written in place, or nothing — which a slot cannot wear | the rules as a `styles()` declaration, handed to the slot beside its other classes |
137
153
  | `slot-unknown` | a component slot that is not an element of its tree | the id of an element inside the component — usually an empty container |
138
154
  | `source-field-unknown` | a path into a typed source that its sample does not have | read a field the sample has, or add the field to the sample |
155
+ | `source-name-missing` | a source named by nothing — most often a field read off a list row that has no types | write the row's field as text (`${r.item}.field`), or give the list `items` a typed source's path |
156
+ | `space-identity-invalid` | the space's `siteName`, `language`, `favicon`, `shareImage` or `themeColor` written as nothing a head reads | `siteName: 'My site'`, `language: 'en'`, `favicon: '/favicon.svg'`, `shareImage: '/og.png'`, `themeColor: { light: '#fbf7f0', dark: '#0b0a10' }` |
157
+ | `state-kept-and-transient` | `keptState` (the only keys kept) and `transientState` (the keys left out) both said | one of the two: `keptState` when few keys are kept, `transientState` when few are not |
139
158
  | `state-key-list` | `settings.transientState` / `paintedState` that is not a list of top-level state keys | `transientState: ['demoStep']` — a dotted path names its top key |
140
159
  | `state-painted-and-transient` | a state key both painted (kept for the server) and transient (never kept) | remove it from one of the two |
141
- | `step-duplicate` | two steps with one name in a flow or an action | a name each |
160
+ | `state-painted-not-kept` | a `paintedState` key that `keptState` does not keep — the server draws with what is kept | add it to `keptState`, or leave it out of `paintedState` |
161
+ | `state-shape` | a state given a rule set's keys (`pseudos`, `variants`, `ancestors`…): a state holds plain CSS | a pseudo-element's state goes under the pseudo-element — `pseudos: { before: { states: { hover: { opacity: '1' } } } }`; an ancestor's, under `ancestors` |
162
+ | `step-duplicate` | two steps with one name in a flow, in two flows of one element, or in an action | a name each |
142
163
  | `step-name` | a step name a later step cannot read as `{{ name.field }}` | a letter first, then letters, digits, `-` and `_` |
143
164
  | `step-params` | a step param that does not exist, or a value outside its options | the params and values it lists |
144
165
  | `step-type` | a step `type` that does not exist | the step builders — `setState(…)`, `navigate(…)` — write it |
166
+ | `structured-data-shape` | a page's `structuredData` item with no `@context` or `@type`, or a value JSON cannot carry | `structuredData: { '@context': 'https://schema.org', '@type': 'SportsEvent', name: '…' }` |
145
167
  | `style-condition-unknown` | a condition a class's rules cannot hold under | `motion-reduce`, `motion-safe`, or a container width — `container (max-width: 30rem)`, `container card (min-width: 480px)` |
168
+ | `style-key-unknown` | a style holding a key that is no part of one — `slots` written inside `styles()` — beside its `css` or states | the element's `slots` beside its `class`, each a `styles()` of its own; a style takes `css`, `states`, `variants`, `ancestors`, `pseudos`, `conditions` |
169
+ | `style-part-shape` | a condition or a pseudo-element given `variants`, `ancestors` or `conditions` — it holds its selector's own `css`, its `states` and (a condition) its `pseudos` | the class's own `css` under the condition — `{ 'motion-reduce': { css: { transition: 'none' } } }` drops what an ancestor's or a variant's rule would animate — or the rule under `ancestors`/`variants` at the top of the class |
146
170
  | `style-pseudo-content` | a `content` CSS cannot read — text without its quotes draws nothing — or a `before`/`after` with no `content`, which is not there at all | the text in quotes inside the string — `content: '"→"'`, `'""'` for an empty box — or a function such as `counter(step)` |
147
171
  | `style-pseudo-property` | a property the pseudo-element ignores — the browser drops it without a word | one it honours (`::selection` paints, `::marker` and `::placeholder` take text and font), or style the element |
148
172
  | `style-pseudo-unknown` | a pseudo-element a class cannot dress | one of `before`, `after`, `marker`, `placeholder`, `first-letter`, `first-line`, `selection` — without the `::` |
149
173
  | `style-state-unknown` | a state a selector does not react to | one of the states it lists (`hover`, `focus`, `active`…) |
150
174
  | `svg-not-svg` | an `svg` whose `content` is not one `<svg>…</svg>` — it draws nothing | the SVG markup alone; HTML around it goes in a `blockHtml` |
151
175
  | `template-in-value` | a `{{ }}` inside an attribute that is an object or a list — a provider's `input`, a list's `items`, a plugin's settings: only an attribute that is text is evaluated | a binding on the attribute (`bindTemplate(name, source, template, { returns: 'value' })`); for a provider's `input`, nothing for a route or query param — the action is already handed them as `input.<name>` |
152
- | `template-short-source` | a source named without its prefix inside a template or a step | the full name: `apiContainer_stats`, `list_rows` |
176
+ | `template-short-source` | a source named without its prefix inside a template or a step | the full name: `apiContainer_stats`, `list_rows` — a list's row, `r.inTemplate.item` |
153
177
  | `template-source-out-of-scope` | a template reading the source of an element it is not inside | move the element inside it, or share the value through `state` |
154
178
  | `template-text-into-value` | a template, which renders text, feeding an attribute that holds a list or an object | `bindTemplate('items', source, '{{ … }}', { returns: 'value' })` |
155
179
  | `template-unknown-name` | a name in a template that is not a source, a variable or a route param | the full source name (`list_rows.item`), `navigation.queryParams.x`, or `source` for the bound value |
@@ -166,9 +190,12 @@ The space is not written until these are fixed.
166
190
  | `unknown-field` | a field the space, a page, an element, a binding or a step does not have | the field it suggests; an element's attribute goes inside the factory's props (`button({ content })`) |
167
191
  | `unknown-transformer` | a transformer that does not exist | one of the transformers it lists |
168
192
  | `utility-module` | a utility sent to a module — a utility takes none | drop the `on` |
193
+ | `variant-bound-twice` | two bindings (`variantFrom`, `activeOn`, `activeWhen`) setting the variant of one class on one element — the second always wins | one `variantFrom` whose template answers every case: `{{ wide ? 'roomy' : current ? 'active' : 'idle' }}`; two things that change apart (a size, a lit state) are two classes, each with its own `variantFrom` |
169
194
  | `visibility-as-attribute` | `visibility` bound as an attribute, which no element reads | `visible: { source, template }` |
195
+ | `visible-expression` | `visible` written as an expression (`"state.plan == 'pro'"`, `"a && !b"`) — it takes a source, read as one, which resolves to nothing | `visible: { source: 'state.plan', template: "{{ state.plan == 'pro' }}" }` — or a source alone, `'state.open'`, `'!state.open'` |
170
196
  | `visitor-roles` | `settings.visitorRoles` written in a shape the runtime does not read | the shape the message gives |
171
197
  | `while-running` | `whileRunning` on a step that is not the trigger, or a mode other than `skip`, `parallel`, `queue`, `latest` | `[whileRunning('queue', onClick()), …]` |
198
+ | `withheld-page-invalid` | `settings.withheldPage` naming no page of the space, or one with an `access` of its own | the id or slug of a page every visitor may see: `withheldPage: 'no-access'` |
172
199
 
173
200
  ## Warned
174
201
 
@@ -190,32 +217,45 @@ The space renders, and renders something you probably did not mean. Fix every on
190
217
  | `flag-rule-empty` | a flag rule with no conditions — skipped, never read as "always" | give it a condition, or set the flag's `value` instead |
191
218
  | `flag-unused` | a declared flag nothing gates on and no template reads | gate what it switches (`flag: 'x'`), or remove it once the feature has shipped |
192
219
  | `focus-on-field-box` | a `focus` or `focus-visible` state on a text field's or a select's `input` slot — the box the field is drawn in, which never takes focus, so no ring is ever shown | `'focus-within'` on the same class, or the state on the `field` slot |
220
+ | `font-weight-not-loaded` | a `font-weight` no face the space loads has — the browser draws the nearest one, or fakes a bolder one | the weight in the font’s `weights`, or a weight it loads |
193
221
  | `FORM_SUBMIT_UNMANAGED` | a form the browser would submit itself, reloading the page | `managedByInteractions: true` |
194
222
  | `form-control-name-taken` | two controls in one form with one name — one overwrites the other | a name each |
195
223
  | `form-control-unnamed` | a control in a form with no `name` — its value never reaches `values` | `formControl({ name: 'email', … })` |
196
224
  | `form-value-compared-to-blank` | a `when` comparing a submitted field to `""` — a field nobody typed in is not sent | `operator: 'empty'` / `'notEmpty'` |
197
225
  | `heading-level-overridden` | a markdown's or richText's `heading` slot and a level's (`heading3`) both setting one property, the general class written later in the stylesheet — the level's value is lost | set the property on one of the two: the level slot for that level alone, `heading` for every heading |
198
226
  | `heading-level-skipped` | an `h4` right after an `h2` — the outline misses a level | the next level down; size it with its class |
227
+ | `icon-font-replaced` | a class on a `fontAwesome` icon setting `font-family` — the icon's glyphs are Font Awesome's font, and another draws a fallback character in their place | the class's `font-family` on the text around the icon, never on the icon; its size and colour on the icon are fine |
199
228
  | `image-without-alt` | an image that is not `decorative` and has no `alt` | say what it shows, or `decorative: true` |
229
+ | `journey-start-access` | a journey starts on a page its visitor may not be on: one for signed-in visitors played as a guest (sent to sign in there), or one asking permissions its test account’s roles do not give (withheld from it) | the journey played as an account that may open the page — or started on a page its visitor opens; kept as it is when the door is what it checks |
230
+ | `kept-state-without-keep-state` | `keptState` without `keepState` — nothing is kept in the first place | `settings.keepState: true`, or remove `keptState` |
200
231
  | `label-ignored` | a `label` on a container whose tag is named by what it holds (`li`, a heading) | the words inside, or a landmark tag (`nav`, `section`…) |
201
232
  | `link-current-section` | `current: 'section'` on a link that is never current (an external one) or current everywhere (to `/`) | leave `current` out — `'section'` is for a link to a section's own page, `/automations/runs` |
202
233
  | `list-item-key-missing` | a list's `itemKey` that some of its items lack, or two of them share — the rows fall back to `id`, then position | a field every item has, once each |
234
+ | `list-items-outside-answer` | a list's `items` bound to a query provider outside its answer — the provider itself, or a field read at its root, where its state is: no list, so the rows render NaN or a placeholder | the list inside the answer: `catalog.data.games`, or `catalog.records` (paginated) |
203
235
  | `list-row-not-li` | a row of a list with `items` that is not an `<li>` — that list is a `<ul>` (or `<ol>`), so the row is a box inside a list, no item to a screen reader | `container({ subType: 'li' })` — or the component's root one, or a wrapper for a link or a button |
236
+ | `login-then-leaves` | steps after `auth.login` on a page for signed-out visitors: the page sends whoever signs in on, to `?redirect=` or its `unauthorizedRedirect`, as the login succeeds — the steps race it | end the flow at the login: the page sends the visitor where `?redirect=` says; a page for everybody (no `accessLevel`) navigates itself |
237
+ | `message-while-running` | a channel's `onMessage` flow with no `whileRunning`: a message that arrives while it runs is dropped (`skip`, the default) | `[whileRunning('queue', onMessage()), …]` to hear each one, `'latest'` for the last; `whileRunning('skip', …)` when dropping is meant |
204
238
  | `overlay-never-opened` | a modal or a dialog that starts hidden and that no step opens | a flow with `openModal('id')` / `openDialog('id')` |
205
239
  | `overlay-starts-open` | a modal or a dialog open when the page loads | `visible: false`, opened by `openModal` |
240
+ | `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 |
206
241
  | `painted-state-without-keep-state` | `paintedState` without `keepState` — nothing is kept for the server to draw with | `settings.keepState: true`, or remove `paintedState` |
207
242
  | `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` |
208
- | `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 (`variant` → `kind`) |
243
+ | `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`) |
244
+ | `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 |
209
245
  | `provider-without-source` | an `apiContainer` that asks nothing | a `query` (or `action`, `connector`, `resource`) |
210
246
  | `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 |
211
247
  | `route-param-undeclared` | `navigation.routeParams.x` read on a page whose slug has no `:x` — always empty | add `:x` to the slug, or read `navigation.queryParams.x` |
212
248
  | `server-data-without-rsc` | a `runtime: 'server'` provider — `connector`, `action` or `query` — in a space that turns server data off (`rsc: { enabled: false }`) | drop `rsc: { enabled: false }`: server data is on unless a space turns it off |
213
- | `span-holds-block` | a `container` with `subType: 'span'` or `'p'` holding a heading, a paragraph, a list, a form or prose | a `div` (leave `subType` out), or words and inline elements: a `text`, a `link` |
249
+ | `server-when-unknown` | a server provider's `when` that reads what the browser alone holds — a `state`, a variable, a browser provider — so the page server resolves it whatever it says | wait on what the server knows (`navigation`, `auth`, a server provider’s answer), or ask it from the browser with a `query` |
250
+ | `span-holds-block` | a `container` with `subType: 'span'` holding a block, or with `'p'` holding anything that renders a `<div>` (a `text`, a plain `container`) — which the browser closes the paragraph before | a `div` (leave `subType` out), or words and inline elements: `paragraph(…)`, a `span` container, a `link` |
214
251
  | `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'` |
215
252
  | `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 |
216
253
  | `STYLE_WITHOUT_TAG` | style on a provider that renders no element of its own | `subType: 'div'` on the provider, or style its parent |
217
254
  | `tablet-rule-skips-mobile` | a tablet rule phones never get — mobile inherits desktop, not tablet | write it under `compact` (tablet and mobile together) |
218
255
  | `template-never-resolved` | a condition in an attribute, which only resolves `{{ name\|filter }}` — used as written | move it into `bindTemplate` |
256
+ | `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 |
257
+ | `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 |
258
+ | `test-unreadable` | a test of the space — an element check or a flow — that cannot be read as it is written: a page no page of the space answers, an element it no longer has, a relation that is none. A snapshot and a publish wait for it | the test as the message says — or the space back to what the test expects |
219
259
  | `transient-state-without-keep-state` | `transientState` without `keepState` — nothing is kept in the first place | `settings.keepState: true`, or remove `transientState` |
220
260
  | `unknown-element-type` | a type no built-in element has | the built-in it suggests; a plugin's declaration goes in `authorSpace(space, { plugins: [declaration] })` |
221
261
  | `unknown-global-callback` | a global callback no built-in source declares — it runs only if something registers it | the built-in it suggests, or make sure a plugin or module of the space registers it |
@@ -229,7 +269,7 @@ Nothing is wrong: the page renders as written. Each is a shorter way to the same
229
269
 
230
270
  | Code | Written the long way | The short way |
231
271
  | --- | --- | --- |
232
- | `class-overrides-class` | one class's shorthand erasing the longhand another class on the same element writes out — `padding` over `padding-top` — 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 — or `quiet: ['class-overrides-class']` when the shorthand is meant to win |
272
+ | `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 |
233
273
  | `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 |
234
274
  | `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 |
235
275
  | `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, … }` |
@@ -240,10 +280,11 @@ Nothing is wrong: the page renders as written. Each is a shorter way to the same
240
280
  | `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 |
241
281
  | `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: [...] }` |
242
282
  | `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 |
243
- | `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; a link marks its own page with the `current` state |
283
+ | `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 |
244
284
  | `repeated-shape` | the same structure written again and again with different words — cards, rows, tiles; copies that bind different data, read their own template or render on the server are controls, not repeats | a component with props (`components`, `component(id, { props })`), or one `list` when they are rows of data side by side — a few cards a person rewords on the canvas can stay cards |
245
285
  | `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 |
246
286
  | `unused-component` | a component no page, layout or other component places | remove it from `components`, or place it where it was meant to go |
287
+ | `unused-plugin` | a plugin the project declares that no page, layout or component places — built and shipped, drawn nowhere | place it where it was meant to go, or remove its folder from `src/plugins/` |
247
288
  | `unused-token` | a token of `variables` no `var(--…)` reads — not a class, an element, `customCss` nor another token | remove it, or write it where its colour is written out |
248
289
 
249
290
  ## UPPER_CASE codes
@@ -21,6 +21,7 @@ Only `opacity` and `transform` (`translate`, `scale`, `rotate`) animate off the
21
21
  the page hydrates and on a slow phone. Everything else repaints, or lays the page out again, on every frame.
22
22
 
23
23
  - **A preset first:** `motion: { enter: 'fade-up', on: 'view' }` on any element, `stagger: 60` for children one by one,
24
+ `easing: 'ease-in-out'` and `distance: 20` (px) for a reference's own curve and travel — not keyframes of your own —,
24
25
  `loop: 'float'` — played by the SDK, cheap and stilled for reduced motion by construction (`npx plitzi explain motion` lists them; `MOTION_ENTERS` and `MOTION_LOOPS` in code).
25
26
  `on: 'view'` plays once, the first time the element comes into view, and it stays; `on: 'scroll'` follows the scroll
26
27
  both ways — it goes back out as the reader scrolls up past it — so keep it for an effect that is about the scroll.
@@ -43,8 +44,13 @@ the page hydrates and on a slow phone. Everything else repaints, or lays the pag
43
44
  `padding` becomes a layout animation).
44
45
  - **`will-change`** only on the few elements about to move, never on every item of a list.
45
46
 
47
+ **Between pages:** `settings.viewTransitions: true` draws each move as one view becoming the next — the pages cross-fade,
48
+ and an element named the same on both (`viewTransitionName: 'product-photo'` in its class) moves from where it was to
49
+ where it lands; give that name to one element per page. None where the browser has none or motion is reduced.
50
+
46
51
  `authorSpace` suggests `heavy-animation` for keyframes a class or `customCss` runs off the compositor, naming each
47
- property and the way out.
52
+ property and the way out. Run on purpose (an original's one entrance), it is quieted on each element wearing the class
53
+ (`quiet: ['heavy-animation']`); one `customCss` runs names no element.
48
54
 
49
55
  ## Colours and themes
50
56
 
@@ -39,7 +39,8 @@ export const productCard: ComponentSpec = {
39
39
  })
40
40
  };
41
41
 
42
- // in the space
42
+ // in the space — the one list every component of it is in, whichever area it serves (a project keeps it beside
43
+ // `components.ts`, in `src/space/components/index.ts`); one area's own is written in its folder and listed there
43
44
  components: [productCard],
44
45
  pages: [{ name: 'Shop', slug: 'shop', body: [
45
46
  component('product-card', { props: { title: 'Lamp', price: 40 }, children: { 'product-card-actions': [button('Buy')] } })
@@ -58,6 +59,8 @@ pages: [{ name: 'Shop', slug: 'shop', body: [
58
59
  slot; `children: { '<slot>': [ … ] }` names the slot for each. What fills a slot is the instance's, not the
59
60
  component's: it is authored on the page and sees the page's sources. A prop's value is read as a template on the
60
61
  instance, so words that show `{{ … }}` as text (docs, a tutorial) go in a slot — a `markdown` child — not in a prop.
62
+ **A slot left empty** — the instance puts nothing in it, and it holds nothing of its own — draws nothing on the
63
+ page, nor its parent's gap; the builder keeps it, the place an author drops into.
61
64
  - **Closed.** Inside, nothing but `props` and the globals (`state`, `auth`, `navigation`, `theme`, `variables`,
62
65
  `computed`). A binding inside a component onto a provider of the page is refused — "nothing in this component answers
63
66
  to …" — because the component would render differently wherever it was placed. Put the provider inside the component,
@@ -25,11 +25,10 @@ A colour from data binds a custom property — `[{ to: '--who', source, category
25
25
  completed from what the element publishes (`apiContainer_posts`, `list_postList`; a `form` publishes under
26
26
  `apiContainer`). A name nothing answers to, or a prefix that does not match, is refused.
27
27
 
28
- **Inside a template the name is spelled in full**: `{{ apiContainer_stats.data.total }}`, `{{ list_rows.item.id }}`.
29
- The binding's `source` is completed for you; its template is read as written, so the short name there is refused.
28
+ **Inside a template the name is spelled in full** (`{{ apiContainer_stats.data.total }}`): only a `source` is
29
+ completed, so the short name in a template is refused.
30
30
 
31
- An element re-renders when anything it reads changes: the first part of each binding's `source` and every source its
32
- templates name. The globals are `variables`, `navigation` (`routeParams`, `queryParams`, `origin`, `currentPageId`,
31
+ An element re-renders when anything it reads changes. The globals are `variables`, `navigation` (`routeParams`, `queryParams`, `origin`, `currentPageId`,
33
32
  `pending` / `pendingLocation` while a link waits for its page's server data),
34
33
  `auth` (who is signed in, `status` while that is being found out), `state` (what flows wrote), `theme`
35
34
  (`mode`, `resolved`), `host` (the `hostData` an application embedding the space hands the SDK) and `computed` (below).
@@ -64,9 +63,8 @@ apiContainer({ id: 'board', runtime: 'server', action: 'queue-board' })
64
63
 
65
64
  - A provider's source is readable by its **descendants** only. Wrap what reads it; a sibling cannot see it.
66
65
  - It publishes its answer plus `isLoading`, `isEmpty`, `hasError`, `errorMessage` — bind a state to those, not to
67
- guesses. A `query`'s body is `data` in **either runtime** (`p.data.plans`), so moving a provider to the server
68
- changes no binding. A connector publishes `records` (or `record`). **An action publishes its output at the root**:
69
- `apiContainer_board.columns`, never `.data.columns` (warned `action-output-path`).
66
+ guesses. A `query`'s body is `data` in **either runtime**: moving a provider to the server changes no binding. A connector publishes `records` (or `record`). **An action publishes its output (its last step's return)
67
+ at the root**: `apiContainer_board.columns`, never `.data.columns` (warned `action-output-path`).
70
68
  `isEmpty` reads what arrived: a `query`'s body when it is missing, `null`, `''`, `[]` or `{}`; a connector list by
71
69
  its `records`; a `singleRecord` provider by its `record`. It is also true before the first answer, so pair it with
72
70
  `not isLoading` for an empty state.
@@ -74,13 +72,25 @@ apiContainer({ id: 'board', runtime: 'server', action: 'queue-board' })
74
72
  `"{{ source ? apiUrl ~ '/workspaces/' ~ source ~ '/stats' : '' }}"` with `source: 'state.workspace.id'`. A server
75
73
  provider's bound `input` (`bindTemplate('input', 'state.c', '{{ { country: source } }}', { returns: 'value' })`)
76
74
  asks again on every change; `reloadApi('p', { … })` asks once.
77
- - An action is handed the page's route and query params as input (`r/:room` → `input.room`). A written `input` is
78
- sent as is: a `{{ }}` in it is refused (`template-in-value`) — bind it.
75
+ - An action is handed the page's route and query params as input (`r/:room` → `input.room`), with the element's
76
+ `input` laid over them: a key the `input` leaves out still comes from the address — on `/orders?status=open`, an
77
+ `input` of `{{ { } }}` still sends `status: 'open'`, and a test that empties the `input` proves nothing of it. A
78
+ written `input` is sent as is: a `{{ }}` in it is refused (`template-in-value`) — bind it.
79
79
  - `isLoading` is true while it is asked again, in either runtime. A newer ask drops the older one; `cancelApi('p')` is a
80
80
  STOP: what is shown stays.
81
+ - **`when` makes it wait** (a rule group over sources: `auth.isAuthenticated`, `roomData.found`): it asks nothing
82
+ until it holds. The page server holds a server one's too — reading `navigation`, `auth` and the server providers it
83
+ names — and the browser asks it once it holds there; one on `state` is resolved regardless (`server-when-unknown`).
81
84
  - `runtime: 'server'` is resolved by the page server — server data is on unless a space says `rsc: { enabled: false }`.
82
85
  Only a page and its layouts are resolved — never inside a component: keep the provider on the page and hand the
83
86
  component its rows as a prop ([recipes/server-data.ts](../recipes/server-data.ts)).
87
+ - A server provider's `query` is read by the page server too, so the page arrives with it instead of filling in after
88
+ load: a path of the space (`/data/…`) or another site's address (`https://…`, asked with GET and the headers it
89
+ declares — never the visitor's cookies, never a private address the deployment does not name as its own). Its
90
+ template may read the space's variables and `navigation` (`'{{ apiUrl }}/posts/{{ navigation.routeParams.id }}'`);
91
+ bound, over a `state` or `auth`, with the visitor's cookies or another method it is the browser's alone
92
+ (`server-query-unresolved`): an `action` takes that as its input. What the server reads rides in the page's HTML: a
93
+ file of megabytes the page draws (a map's geometry) stays a browser `query` with `cache: true`.
84
94
 
85
95
  ### Typed by a sample
86
96
 
@@ -91,6 +101,7 @@ see [typed-sources.md](typed-sources.md).
91
101
 
92
102
  Content lives in JSON files read like any API — `apiContainer({ id: 'catalog', query: '/data/games.json', children:
93
103
  [ … ] })` — so a real endpoint later changes one `query`. `mockData` is only what the BUILDER shows. Say demo is demo.
104
+ Records written inline (`inline-records`) move to such a file, drawn by one `list`.
94
105
 
95
106
  - **Server project:** `src/data/games.json` answers `/data/games.json`, read by the server, never served. The provider
96
107
  is `runtime: 'server'` (the page arrives with it); a browser one is refused (`server-data-in-browser`).
@@ -98,25 +109,23 @@ Content lives in JSON files read like any API — `apiContainer({ id: 'catalog',
98
109
 
99
110
  **`public/` is on the internet**, and so is everything the space's documents hold (pages, variables, attributes,
100
111
  `mockData`) and what a provider reads into a page: never a secret, a key or data only some visitors may read. A secret
101
- is a credential an action or a connector names; data for some visitors, or fields a page must not carry, comes from a
102
- server action answering only what is shown, its `access` checking who asks.
112
+ is a credential an action or connector names; data for some visitors comes from a server action answering only what
113
+ is shown, its `access` checking who asks.
103
114
 
104
115
  ### Live, cached, refreshed
105
116
 
106
- - **Live:** `refreshSeconds: 15` asks again on its own (either runtime); it pauses in a hidden tab and never
107
- overlaps. Use it for queues, feeds, status boards — then mark the panel as live so the reader knows it moves.
108
- - **Cached:** `cache: true` (and `staleTime` seconds, 30 by default) shares an answer between providers asking the
109
- same thing and across page changes.
117
+ - **Live:** `refreshSeconds: 15` asks again on its own (either runtime), paused in a hidden tab, never overlapping:
118
+ queues, feeds, status boards.
119
+ - **Cached:** `cache: true` (`staleTime`, 30 s) shares an answer between providers asking the same.
110
120
  - **Refreshed by writes:** a `webHook` that is not a GET refreshes every request to its own site by default
111
121
  (`invalidateQueries: 'origin'`); a `runServerAction` refreshes everything (`'all'`). Narrow it with
112
122
  `'elements'` + `invalidateElements: ['orders']`, or stop it with `'none'`.
113
- - **Say `'none'` when a refresh would move the page on.** A page that leaves on a provider's answer ("profile complete
114
- → leave") would leave in the middle of a multi-step form that saves as it goes.
123
+ - **Say `'none'` when a refresh would move the page on** — one that leaves on an answer, mid-form.
115
124
 
116
125
  ## Visibility
117
126
 
118
- What the page's own data or state shows and hides. What a person switches on — a feature in beta, the old version
119
- kept during a rollout — is a [feature flag](feature-flags.md): gated off, an element is not rendered at all.
127
+ What the page's own data or state shows and hides. What a person switches on (a beta, a rollout) is a
128
+ [feature flag](feature-flags.md): gated off, an element is not rendered at all.
120
129
 
121
130
  ```ts
122
131
  container({ visible: 'posts.hasPosts', … }) // shown while true
@@ -150,9 +159,9 @@ Rules for a condition's template:
150
159
 
151
160
  - **A visibility binding written by hand in `bind` keeps the element on screen until it answers** — a flash for a
152
161
  condition on data (`condition-starts-visible` warns); `visible` starts it hidden.
153
- - **A hidden element stays in the DOM** (`plitzi-component--hidden`), its subtree mounted. `loadStrategy: 'visible'`
154
- mounts the subtree only while it is shown, and `'lazy'` from the first time it is shown (modals do that already).
155
- Use it on heavy panels that are usually hidden; leave the default on what is usually on screen.
162
+ - **A hidden element stays in the DOM** (`plitzi-component--hidden`), its subtree mounted — a hidden channel stays
163
+ joined, a hidden provider still asks. `loadStrategy: 'visible'` mounts what it holds only while shown (`'lazy'`: from
164
+ the first time; modals do): for a heavy panel usually hidden, or a container wrapping a channel or provider to stop it.
156
165
  - **Once its source has a value, the answer is a yes or a no**: `false`, `0`, `''` and an empty list hide it,
157
166
  anything else shows it.
158
167
  - **While its source has no value, only a definite answer is written.** `!source` is `true` — shown; a template's
@@ -65,7 +65,8 @@ And a few the suggestions do not count, because they cost styles rather than ele
65
65
  space's `elements` defaults (`elements: { heading: { color: 'var(--fg)' } }`), not a class on each.
66
66
  - **A shorthand in a class says every side.** On an element wearing two classes, one's `padding` erases the
67
67
  `padding-top` the other writes out wherever the stylesheet writes it later; write the longhands it means
68
- (`class-overrides-class` — a suggestion, quieted like the rest).
68
+ (`class-overrides-class` — a suggestion, quieted like the rest). A shared class made of repeated CSS meets the same:
69
+ its `gap` loses to `btn`'s when `btn` is written later.
69
70
  - **Inner parts are slots.** A form control's input, a modal's backdrop, a theme toggle's icons: style them with
70
71
  `slots: { input: inputClass }` on the element, or the type's `slots` in `elements` — never a `customCss` rule reaching
71
72
  into the element.
@@ -15,17 +15,17 @@ container([hero, grid]) // an array is the children
15
15
 
16
16
  | Authoring field | What it does |
17
17
  | --- | --- |
18
- | `id` | the ONE name this element answers to — its key in the document, a binding's source, a step's target. Unique across the WHOLE space |
18
+ | `id` | the ONE name it answers to — its key, a binding's source, a step's target. Unique across the WHOLE space |
19
19
  | `class` | a shared class: a `styles()` declaration or a name from the space's `classes`; a list for several. Exclusive with `css` |
20
20
  | `css` | rules of this element's own: one set, or one per breakpoint (`{ desktop, tablet, mobile }`) |
21
- | `states` | `hover`, `focus-visible`, `current` (the chosen link, toggle, tab), `expanded`, `first`/`last`/`odd`/`even`, `hidden`… |
21
+ | `states` | all there are: `hover`, `focus`, `focus-visible`, `focus-within`, `active` (the press), `disabled`, `checked`, `visited`, `current` (the chosen link, the open tab), `expanded`, `hidden`, `first`/`last`/`odd`/`even` |
22
22
  | `variant` | a variant of the class it wears (when the class declares it) or of its type |
23
- | `slots` | a class for one of the element's OTHER selectors — a form control's `input` |
23
+ | `slots` | a class for one of its OTHER selectors — a form control's `input` |
24
24
  | `bind` | where a value comes from |
25
25
  | `visible` | a condition (`'src'`, `'!src'`, `{ source, template }`), or `false` to start hidden |
26
26
  | `flows` | what happens on click, on submit, on load |
27
27
  | `runtime` | `'server'` resolves this provider's data on the server |
28
- | `loadStrategy` | when the contents mount relative to visibility: `eager`, `lazy`, `visible`. Left out, the type decides — `eager`, `lazy` for a modal or a dialog |
28
+ | `loadStrategy` | when the contents mount: `eager`, `lazy`, `visible`; left out, `eager` (`lazy` for a modal or a dialog) |
29
29
  | `children` | the tree |
30
30
  | `meta` | `meta.label` is the element's name in the builder's tree |
31
31
 
@@ -34,8 +34,7 @@ reads).
34
34
 
35
35
  **A link says where by its `href`:** a page id (`link({ href: 'reports' })`, folder included), a path within the space
36
36
  — with `{{tokens}}` if it needs them, a row's own slug (`'/games/{{ list_games.item.slug }}'`) — or a full URL
37
- (`https:`, `mailto:`, `tel:`), passed through untouched. `mode` follows from it; write it only to say otherwise. A link
38
- that opens another tab (`target: 'blank'`) gets `rel="noopener noreferrer"`. A link is an `<a>`: never put a link inside
37
+ (`https:`, `mailto:`, `tel:`), passed through untouched. `mode` follows from it; write it only to say otherwise. A link is an `<a>`: never put a link inside
39
38
  another link — make the card the link, or the button, not both.
40
39
 
41
40
  **A link's words are its `content`** and an icon its `icon`, as a button's (`link({ href: 'pricing', content:
@@ -47,8 +46,8 @@ layout lights the right item everywhere.
47
46
  **An element's `id` is not its HTML id.** It reaches the DOM as `data-plitzi-el`. For a section a URL can land on, give it
48
47
  an `anchor` (`anchor: 'plans'` → `id="plans"`: lowercase, digits, `-`) and link to it with `hash`:
49
48
  `link({ href: 'home', hash: 'plans' })` goes to `/#plans` and scrolls there, waiting for a section that renders once
50
- its data arrives. One anchor per page, layouts included; never inside a list row or a component, which would repeat
51
- it — `authorSpace` refuses each, and a `hash` no element on that page carries (`anchor-missing`). Under a fixed
49
+ its data arrives. One per page, layouts included; none in a component. In a list's row it is `<anchor>-<row key>`
50
+ (`hash: 'pick-luna'`). Under a fixed
52
51
  header, give the section `scroll-margin-top` (the header's height) so it does not land beneath it.
53
52
 
54
53
  **Some types hold no children.** A `heading`, `text`, `paragraph`, `image`, `formControl`… renders its own attributes
@@ -79,9 +78,10 @@ A plugin's type is authored the same way: `defineElement(declaration)` — see [
79
78
 
80
79
  ## CSS
81
80
 
82
- Write CSS as you write CSS, shorthands included — they are expanded to the longhands Plitzi's editor reads. Keys in
83
- kebab-case or camelCase (`paddingTop`, as a React style object), and a bare number on a length is pixels (`gap: 16`;
84
- `fontWeight: 800`, `opacity: 0.5` stay numbers). A property outside the vocabulary is refused.
81
+ Write CSS as you write CSS, shorthands included — expanded to the longhands Plitzi's editor reads. Keys in
82
+ kebab-case or camelCase (`paddingTop`), and a bare number on a length is pixels (`gap: 16`;
83
+ `opacity: 0.5` stays a number). A property outside the vocabulary is refused, as is
84
+ `background: 'var(--x)'`: write `background-color` or `background-image`.
85
85
 
86
86
  - `column(gap, extra?)`, `row(gap, extra?)`, `grid(columns, gap, extra?)` for the three layouts every space repeats.
87
87
  - **Breakpoints are ranges, not a cascade.** `tablet` is 48–64rem, `mobile` up to 48rem, and each inherits only from
@@ -117,10 +117,11 @@ container({ class: card, children: [ … ] });
117
117
  - One name declared twice with rules that disagree is refused. Declare a class once, in the module that owns it, and
118
118
  import it.
119
119
  - `ancestors: { [sidebar.name]: { variants: { collapsed: { display: 'none' } } } }` styles an element by the state or
120
- variant of an ancestor class — the way to react to a parent's hover or collapse without a flow; `'>'` is the parent,
120
+ variant of an ancestor class (a descendant selector): a parent's hover or collapse, with no flow; `'>'` is the parent,
121
121
  whatever it wears (a component's part: `{ '>': { states: { expanded: … } } }`).
122
122
  - `pseudos: { after: { content: '"→"' } }` (`before`/`after` need a quoted `content`; also `selection`, `marker`,
123
- `placeholder`, `first-letter`, `first-line`). `conditions: { 'motion-reduce': …, 'container (max-width: 30rem)': … }`.
123
+ `placeholder`, `first-letter`, `first-line`); its element's state goes inside it:
124
+ `pseudos: { before: { states: { hover: … } } }`. `conditions: { 'motion-reduce': …, 'container (max-width: 30rem)': … }`.
124
125
  - **`hidden` is how an element looks while its `visible` says no** — where it goes as it hides, and where it comes
125
126
  from as it shows. Give the class a transition that includes `display` with `allow-discrete`, and a panel fades or
126
127
  slides instead of blinking; the transition on the base is the way in, the one in `hidden` the way out:
@@ -150,8 +151,8 @@ container({ class: card, children: [ … ] });
150
151
  - Per element TYPE defaults go in `elements: { heading: { base, states, variants, pseudos, slots } }` — a whole type.
151
152
  - **Slots** are an element's parts (not `customCss`): a `formControl`'s `input` (the box), `field` (its `<input>`),
152
153
  `label`, `requiredMark`, `error`; a `markdown`'s or `richText`'s `heading`, `heading2`, `link`, `codeBlockFrame`…;
153
- a `pagination`'s `page` (the one shown: its `current` state). `plitzi explain <type>` lists them. Style one
154
- element's with `slots`, a type's with `elements.<type>.slots`.
154
+ a `pagination`'s `page` (the one shown: its `current` state). `plitzi explain <type>` lists them, and what the element
155
+ writes on its node (`aria-selected`). Style one element's with `slots`, a type's with `elements.<type>.slots`.
155
156
  - A `modalContainer` / `dialogContainer` is fixed to the viewport, as tall as its content up to the screen, and 500px
156
157
  wide up to the screen; theme its look through its slots.
157
158
 
@@ -38,6 +38,8 @@ same flags, decided on the server. Use the step builders — they fill in where
38
38
  value, and one after a `delay` or a server action sees whatever changed meanwhile. To act on the value from BEFORE
39
39
  a write, put the step that reads it first.
40
40
  - **Keys are flat names.** A dotted key (`docsClosed.start`) is split into a path; use `docsClosedStart`.
41
+ - **Back skips a replaced address.** `navigate({ urlType: 'internal', url, replace: true })` takes the place of the one
42
+ the visitor is on: a sheet a query opened (`?stats=1`), closed, is not reopened by Back.
41
43
  - **`setState` types**: `text`, `number` (decimals kept), `boolean` (the word or a real boolean), and `json` for an
42
44
  object or a list — `value: '{{ list_rows.item }}'` stores the row itself; JSON text is parsed, and text that is not
43
45
  JSON fails the step (the dev tools log it) instead of storing the text.
@@ -59,7 +61,11 @@ Name the trigger (`named('changed', on('onChange'))`) and read its payload as `{
59
61
  ## Reading what came before
60
62
 
61
63
  `named('quote', step)` is how a later step reads an earlier one: `{{ quote.output.total }}`. The trigger too:
62
- `named('submitted', onSubmit())` → `{{ submitted.values.email }}`. Unnamed steps get ids nothing can refer to.
64
+ `named('submitted', onSubmit())` → `{{ submitted.values.email }}`. Unnamed steps get ids nothing can refer to. An
65
+ element's flows share one record of steps: a name is one step's across all of them (`step-duplicate`). A
66
+ refused submit — a rule a control declares broken — starts `onInvalid()` (`{{ <id>.errors.<name> }}`) instead, and the
67
+ form's source says one was tried, valid or not, as `submitted`: a hint under a field steps aside once the field's own
68
+ error speaks — `visible: { source: '<form id>', template: '{{ not source.submitted }}' }`.
63
69
 
64
70
  `whenSucceeded` / `whenFailed` read a server action's `status` (`runServerAction` only); any other step is asked what
65
71
  it publishes (`npx @plitzi/cli explain login` lists it) — after `named('signedIn', authLogin(…))`,
@@ -99,19 +105,19 @@ where it is written.
99
105
 
100
106
  **Something every few seconds** — an autoplay, a clock — is `onInterval(ms)`, a trigger every element has:
101
107
  `[[onInterval(5000), cycleState({ key: 'slide', length: 4 })]]`. It
102
- ticks while the element is mounted and the tab is in view, never in the builder outside preview, at least every 250 ms
103
- (`trigger-interval` otherwise). To pause it, give its steps a condition — a state that `on('onMouseEnter')` sets and
104
- `on('onMouseLeave')` clears. `{{ <step>.count }}` is how many times it has ticked. No plugin needed.
108
+ ticks while mounted and the tab in view, never in the builder outside preview, every 250 ms at least
109
+ (`trigger-interval` otherwise). To pause it, give its steps a condition: a state `on('onMouseEnter')` sets,
110
+ `on('onMouseLeave')` clears. `{{ <step>.count }}` counts its ticks. No plugin needed.
105
111
 
106
112
  **A number that goes round, or stops:** `cycleState({ key: 'slide', length: 4 })` is "next" — after the last the first
107
113
  — and `by: -1` "previous"; `stepState({ key: 'shown', by: 40, max: 'apiContainer_site.data.total' })` adds and stops
108
114
  at the bound.
109
115
 
110
116
  **Scrolling** is a step on the element whose box scrolls (`overflow-x: auto` on a row of cards): `scrollBy('cards',
111
- { x: '80%' })` moves it by most of what it shows (`'-80%'` back, `'240'` pixels), `scrollTo('cards', { x: 'end' })`
112
- to an end or a place, and `scrollIntoView('answer', { block: 'center' })` brings an element into view. `onScroll()`
117
+ { x: '80%' })` moves it (`'-80%'` back, `'240'` pixels), `scrollTo('cards', { x: 'end' })` to an end or a place, and `scrollIntoView('answer', { block: 'center' })` brings one into view. `focus('chat-input')` gives it, or its first field, the keyboard. `onScroll()`
113
118
  fires as the box moves and once on mount, with `{ x, y, atStart, atEnd }` — what an arrow that hides at the end reads
114
- (recipes/scroll-a-row.ts). A link to a section needs none of this: an `anchor` and a link's `hash`.
119
+ (recipes/scroll-a-row.ts). `onView()` fires on entering and leaving. A link to a section is an
120
+ `anchor` and a link's `hash`.
115
121
 
116
122
  **A form's flow goes on the `form`**, which hands its submit over with `managedByInteractions: true`
117
123
  (`FORM_SUBMIT_UNMANAGED` otherwise — the browser submits it natively and `onSubmit` never fires):
@@ -161,7 +167,13 @@ Pages that see each other — cursors, presence, a shared board — talk over a
161
167
  ## Lists as state
162
168
 
163
169
  `toggleInState({ key: 'picks', value })` keeps a list; `when({ field: 'state.picks', operator: 'contains', value })`
164
- asks it. `appendState({ key, value, withId: true })` stores `{ id, value }` — bind `.value`, address by `.id`.
170
+ asks it. A rule reads PATHS, never templates (refused: `condition-template`): `field` is one — a named step
171
+ (`sent.values.code`), `state.*`, `computed.*`, `flags.*`, route and query params, the sources around the element the
172
+ flow is on (a row's `list_<id>.item.*` from inside the row); `value` is a literal, or another path with
173
+ `isBinding: true` — `{ field: 'state.picks', operator: 'contains', value: 'list_genres.item.id', isBinding: true }`. An
174
+ unset field holds no comparison (`=`, `contains`, `<`) and every negation (`!=`, `doesNotContain`). A list's count is
175
+ `.length`, unset until the list is: three picks at most is `when([{ field: 'state.picks', operator: 'empty' }, { field:
176
+ 'state.picks.length', operator: '<', value: 3 }], step, 'or')`; any other expression, a computed value. `appendState({ key, value, withId: true })` stores `{ id, value }` — bind `.value`, address by `.id`.
165
177
  `whenFailed` matches every outcome that is not `completed` (also `skipped`, `aborted`). A failed run gives `reason`,
166
178
  and `error` only when the server or a step wrote one for the caller (a task throwing `ActionRefusal`, `flow.fail` with
167
179
  `tellCaller`) — so show `{{ saved.error ? saved.error : "…" }}`, never the bare `error`. That pair is one call:
@@ -10,6 +10,14 @@ brought back:
10
10
  settings: { keepState: true, transientState: ['filter', 'tourStep', 'panelOpen'] }
11
11
  ```
12
12
 
13
+ When few keys are kept and many are not — a dismissed notice, and the page's every other key fresh — name the ones
14
+ kept instead, with `keptState`: only those are written and brought back. One of the two, never both (`authorSpace`
15
+ refuses it), and a `paintedState` key is one of the kept:
16
+
17
+ ```ts
18
+ settings: { keepState: true, keptState: ['dismissedShow'] }
19
+ ```
20
+
13
21
  Do not reset kept state from `onPageLoad` instead: what was kept is restored late — after hydration, once auth knows
14
22
  who this is — and lands in the middle of that flow, so half of it is undone. A filter restored on the next visit is a
15
23
  page that looks broken. Keeping state is the SPACE's setting; a page does not take `keepState`.