@plitzi/sdk-authoring 0.38.9 → 0.38.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/node.d.ts CHANGED
@@ -140,10 +140,20 @@ declare const AUTHORING_CODES: {
140
140
  readonly means: "a page that sends visitors it is not for to a page the space does not have";
141
141
  readonly fix: "a page's id or slug (`''` is the home page), or a full URL";
142
142
  };
143
+ readonly 'page-template': {
144
+ readonly kind: "refused";
145
+ readonly means: "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";
146
+ readonly fix: "read the record from a provider with `runtime: 'server'` on the page or its layout — `'{{ apiContainer_post.title }} — Blog'` — or words of its own";
147
+ };
148
+ readonly 'declared-callback-target': {
149
+ readonly kind: "refused";
150
+ readonly means: "a `declaredCallback` target with a key beside `on` and `params` — read nowhere, so the step runs without it";
151
+ readonly fix: "the value in `params`: `{ on: 'calendar', params: { date } }`";
152
+ };
143
153
  readonly 'folder-undeclared': {
144
154
  readonly kind: "refused";
145
155
  readonly means: "a page, a layout or a folder filed in a folder the space does not declare";
146
- readonly fix: "declare the folder, or the name it suggests";
156
+ readonly fix: "declare it on the space — `pageFolders: [{ id: 'docs', name: 'Docs' }]`, its slug starting its pages' addresses — or use the name it suggests";
147
157
  };
148
158
  readonly 'folder-cycle': {
149
159
  readonly kind: "refused";
@@ -240,6 +250,11 @@ declare const AUTHORING_CODES: {
240
250
  readonly means: "a `slots` key the element type does not have — its class would dress nothing";
241
251
  readonly fix: "one of the slots `plitzi explain <type>` lists; the element itself takes `class`";
242
252
  };
253
+ readonly 'slot-not-class': {
254
+ readonly kind: "refused";
255
+ readonly means: "a `slots` entry that is not a class — rules written in place, or nothing — which a slot cannot wear";
256
+ readonly fix: "the rules as a `styles()` declaration, handed to the slot beside its other classes";
257
+ };
243
258
  readonly 'class-conflict': {
244
259
  readonly kind: "refused";
245
260
  readonly means: "two different declarations for one class name";
@@ -253,7 +268,7 @@ declare const AUTHORING_CODES: {
253
268
  readonly 'class-and-css': {
254
269
  readonly kind: "refused";
255
270
  readonly means: "an element wearing a shared class AND `css` or `states` of its own — it has one base selector";
256
- readonly fix: "the rules on top of the class: `class: [card, { opacity: '0.5' }]` (needs an `id`) — or into the class";
271
+ readonly fix: "the rules on top of the class: `class: [card, { opacity: '0.5' }]` — or into the class";
257
272
  };
258
273
  readonly 'class-and-selector': {
259
274
  readonly kind: "refused";
@@ -265,11 +280,6 @@ declare const AUTHORING_CODES: {
265
280
  readonly means: "more than one set of rules in a class list";
266
281
  readonly fix: "one set, after the classes: `class: [card, { opacity: '0.5', 'margin-top': '8px' }]`";
267
282
  };
268
- readonly 'modifier-without-id': {
269
- readonly kind: "refused";
270
- readonly means: "rules on top of a class on an element with no `id` — the id names the class they become";
271
- readonly fix: "`id: 'hero-bg'`";
272
- };
273
283
  readonly 'selector-invalid': {
274
284
  readonly kind: "refused";
275
285
  readonly means: "a `selector` that is not a CSS class name";
@@ -315,6 +325,11 @@ declare const AUTHORING_CODES: {
315
325
  readonly means: "an ancestor condition keyed by something that is neither a class name nor `'>'` (the parent)";
316
326
  readonly fix: "`[card.name]` for a `styles()` declaration, or `'>'` for the parent whatever it wears";
317
327
  };
328
+ readonly 'focus-on-field-box': {
329
+ readonly kind: "warned";
330
+ readonly means: "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";
331
+ readonly fix: "`'focus-within'` on the same class, or the state on the `field` slot";
332
+ };
318
333
  readonly 'heading-level-overridden': {
319
334
  readonly kind: "warned";
320
335
  readonly means: "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";
@@ -545,6 +560,11 @@ declare const AUTHORING_CODES: {
545
560
  readonly means: "a `runtime: 'server'` element inside a component: the page server resolves a page's and its layouts', never a component's";
546
561
  readonly fix: "put the provider on the page, around the instance, and hand the component its rows as a prop";
547
562
  };
563
+ readonly 'template-in-value': {
564
+ readonly kind: "refused";
565
+ readonly means: "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";
566
+ readonly fix: "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>`";
567
+ };
548
568
  readonly 'not-found-in-browser': {
549
569
  readonly kind: "refused";
550
570
  readonly means: "`notFound` on a provider asked from the browser — its answer arrives after the page was sent with its status";
@@ -552,7 +572,7 @@ declare const AUTHORING_CODES: {
552
572
  };
553
573
  readonly 'not-found-not-a-template': {
554
574
  readonly kind: "refused";
555
- readonly means: "`notFound` that is not one `{{ expression }}` against the answer — never `true`, so never a 404";
575
+ readonly means: "`notFound`, a provider's or a page's, that is not one `{{ expression }}` — never `true`, so never a 404";
556
576
  readonly fix: "`notFound: '{{ source.found == false }}'`";
557
577
  };
558
578
  readonly 'server-data-in-browser': {
@@ -575,6 +595,11 @@ declare const AUTHORING_CODES: {
575
595
  readonly means: "a control in a form with no `name` — its value never reaches `values`";
576
596
  readonly fix: "`formControl({ name: 'email', … })`";
577
597
  };
598
+ readonly 'required-message-unused': {
599
+ readonly kind: "warned";
600
+ readonly means: "a `requiredMessage` on a field nothing requires — fields are optional unless `required: true`, so it is never shown and an empty answer is sent";
601
+ readonly fix: "`required: true` on the field, or no message";
602
+ };
578
603
  readonly 'form-control-name-taken': {
579
604
  readonly kind: "warned";
580
605
  readonly means: "two controls in one form with one name — one overwrites the other";
@@ -1863,8 +1888,20 @@ declare interface PageSpec {
1863
1888
  /** Route, without a leading slash. Empty is the home page. */
1864
1889
  slug: string;
1865
1890
  isDefault?: boolean;
1891
+ /**
1892
+ * The page's title and description in the head, for search engines and link previews. Either may be a template over
1893
+ * the page's server providers (`runtime: 'server'`, its layouts' too) and `navigation` — `'{{ apiContainer_post.title
1894
+ * }} — Blog'` — which the server evaluates as it writes the head.
1895
+ */
1866
1896
  seoTitle?: string;
1867
1897
  seoDescription?: string;
1898
+ /**
1899
+ * One expression over the same answers that says this address shows nothing — a record that is not there: the page is
1900
+ * sent with status 404, rendered as written. For a record read by a provider the page shares with others, in its
1901
+ * layout, whose own `notFound` cannot say it for one page: `'{{ not (apiContainer_feed.topics|find('slug',
1902
+ * navigation.routeParams.slug)) }}'`.
1903
+ */
1904
+ notFound?: string;
1868
1905
  /**
1869
1906
  * Who this page is FOR, and the trap is that omitting it is not the same as `public`.
1870
1907
  *
package/dist/node.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Gr as e, n as authorSpace, p as compactSvg, pn as e$1 } from "./index-src.js";
1
+ import { hn as e$1, n as authorSpace, p as compactSvg, qr as e } from "./index-src.js";
2
2
  import { existsSync, readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
3
3
  import m from "node:path";
4
4
  import { fileURLToPath, pathToFileURL } from "node:url";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-authoring",
3
- "version": "0.38.9",
3
+ "version": "0.38.11",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist/index.js",
@@ -53,12 +53,12 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@microsoft/api-extractor": "^7.59.3",
56
- "@plitzi/plitzi-ui": "^1.6.32",
57
- "@plitzi/sdk-elements": "0.38.9",
58
- "@plitzi/sdk-interactions": "0.38.9",
59
- "@plitzi/sdk-schema": "0.38.9",
60
- "@plitzi/sdk-shared": "0.38.9",
61
- "@plitzi/sdk-style": "0.38.9",
56
+ "@plitzi/plitzi-ui": "^1.6.33",
57
+ "@plitzi/sdk-elements": "0.38.11",
58
+ "@plitzi/sdk-interactions": "0.38.11",
59
+ "@plitzi/sdk-schema": "0.38.11",
60
+ "@plitzi/sdk-shared": "0.38.11",
61
+ "@plitzi/sdk-style": "0.38.11",
62
62
  "@types/react": "^19.3.0",
63
63
  "eslint": "^9.39.5",
64
64
  "prettier": "^3.9.9",
@@ -19,6 +19,7 @@ const space: SpaceSpec = {
19
19
  pages: [{ id, name, slug: '', layout: { id: 'shell', slot: 'main' }, body: [] }] // slot: where the body goes
20
20
  }; // slug '' is home; 'products/:slug' takes a param
21
21
  pageFamily({ folder, layout, seoTitle, body: entry => [...] }, ENTRIES) // pages of one shape, from data; ids scoped per page
22
+ pageFolders: [{ id: 'docs', name: 'Docs' }] // on the space: a `folder` is declared here, /docs/…
22
23
  const { schema, style, warnings, suggestions } = authorSpace(space, { plugins: [declaration] });
23
24
  ```
24
25
 
@@ -43,6 +44,7 @@ svg(svgFile(new URL('./logo.svg', import.meta.url))) // a file, compacted: svgF
43
44
  fontAwesome({ icon: 'fa-solid fa-xmark' })
44
45
  list({ id: 'rows', items: 'p.data.rows', row: 'row-card' }) // a <ul>; a component per row, its root an <li>
45
46
  list({ id: 'rows', items: 'p.data.rows', row: r => listItem({ children: [text({ from: `${r.item}.title` })] }) })
47
+ // typed items (site.data.rows): r.item is a path — from: r.item.title
46
48
  carousel({ id: 'hero', items: 'p.data.slides', autoplay: 5000, row: 'slide-card', children: [/* carouselNext('hero') arrows */] })
47
49
  // rows follow their item's `id`, or `itemKey: 'slug'`
48
50
  apiContainer({ id: 'p', query: '/data/x.json', cache: true, children }) // publishes p.data; no box of its own
@@ -50,7 +52,7 @@ apiContainer({ id: 'p', query: '/data/x.json', runtime: 'server', children }) //
50
52
  apiContainer({ id: 'p', action: 'report', runtime: 'server', children }) // the action's output at p's root: p.rows
51
53
  // loadingSlot: 'p-skeleton' — a child shown until it answers
52
54
  form({ id, managedByInteractions: true, flows, children })
53
- formControl({ name: 'email', label: 'Email', subType: 'email' }) // select: options: [{ label, value }]
55
+ formControl({ name: 'email', label: 'Email', subType: 'email', required: true }) // optional without required; select: options: [{ label, value }]
54
56
  modalContainer({ id, visible: false, title, children })
55
57
  component('card', { props: { title }, children: { body: [ … ] } })
56
58
  custom({ renderType: 'myPlugin' }); defineElement<Props>(declaration) // a plugin
@@ -63,7 +65,7 @@ const card = styles('card', { padding: 24, borderRadius: 16 }); // shorth
63
65
  styles('title', { fontSize: { desktop: '48px', compact: '32px' }, fontWeight: 700 }); // one property per breakpoint
64
66
  styles('card', { css: { desktop: { … }, compact: { … } }, states: { hover: { … } }, variants: { active: { … } } });
65
67
  container({ class: card }); // a shared class…
66
- container({ id: 'hero', class: [card, { opacity: '0.5' }] }); // …plus one thing (needs an id)
68
+ container({ class: [card, { opacity: '0.5' }] }); // …plus one thing
67
69
  container({ css: { padding: '8px' } }); // rules of its own — never with `class`
68
70
  ```
69
71
 
@@ -31,8 +31,6 @@ export const recipe: SpaceSpec = {
31
31
  { label: 'Graphics cards', value: 'gpu' }
32
32
  ],
33
33
  defaultValue: 'all',
34
- // A filter always has an answer: the select is not a question that must be filled in.
35
- required: false,
36
34
  flows: [
37
35
  [named('picked', on('onChange')), setState({ key: 'category', type: 'text', value: '{{ picked.value }}' })]
38
36
  ]
@@ -38,7 +38,8 @@ export const recipe: SpaceSpec = {
38
38
  [named('sent', onSubmit()), setState({ key: 'email', type: 'text', value: '{{ sent.values.email }}' })]
39
39
  ],
40
40
  children: [
41
- formControl({ name: 'email', label: 'Email', subType: 'email' }),
41
+ // Optional unless it says so, as an HTML field is: a sign-up without an address is no sign-up.
42
+ formControl({ name: 'email', label: 'Email', subType: 'email', required: true }),
42
43
  button({ content: 'Sign up', subType: 'submit' })
43
44
  ]
44
45
  }),
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Style without copies: colours are tokens with a light and a dark value, a look used twice is a class, "this class
3
- * plus one thing" is rules on top of it (`class: [card, { … }]`, which needs an `id`), and a rule for tablet AND phone
3
+ * plus one thing" is rules on top of it (`class: [card, { … }]`), and a rule for tablet AND phone
4
4
  * is written once under `compact`.
5
5
  */
6
6
  import { container, heading, styles, text } from '@plitzi/sdk-authoring';
@@ -38,6 +38,7 @@ image({ src: '/grain.png', decorative: true }) // an orname
38
38
  image({ decorative: true, bind: { src: 'post.record.cover' } }) // a cover under its own headline adds nothing
39
39
  image({ bind: { src: 'row.item.cover', alt: 'row.item.title' } }) // …unless it is alone in a link: then it names it
40
40
  fontAwesome({ icon: 'fa-solid fa-triangle-exclamation', label: 'Overdue' }) // an icon that says something alone
41
+ svg(MARK, { class: logoMark }) // no `label`: an svg or an icon decorates
41
42
  text('福', { decorative: true }) // a seal or a mark drawn for the look alone
42
43
  list({ label: 'Kinds of capsule', … }) // a group of options is named, as a group
43
44
  ```
@@ -47,7 +47,7 @@ The space is not written until these are fixed.
47
47
  | `channel-grant` | a topic of a private channel opened with no grant to it | the grant the message names, or a public channel |
48
48
  | `channel-topic` | a `channel` element with no topic | a topic a channel of the space covers |
49
49
  | `children-in-leaf` | children on a type that renders only its own attributes (`heading`, `text`, `image`…) | a `container` — for a heading made of parts, `container({ subType: 'h1', children })` |
50
- | `class-and-css` | an element wearing a shared class AND `css` or `states` of its own — it has one base selector | the rules on top of the class: `class: [card, { opacity: '0.5' }]` (needs an `id`) — or into the class |
50
+ | `class-and-css` | an element wearing a shared class AND `css` or `states` of its own — it has one base selector | the rules on top of the class: `class: [card, { opacity: '0.5' }]` — or into the class |
51
51
  | `class-and-selector` | an element with a shared class and a `selector` of its own | drop one: a shared class IS its selector |
52
52
  | `class-conflict` | two different declarations for one class name | rename one, or make them agree |
53
53
  | `class-listed-under-other-name` | a `styles()` declaration listed in `classes` under another name | list it under its own name |
@@ -64,6 +64,7 @@ The space is not written until these are fixed.
64
64
  | `css-property-twice` | one property written twice in a rule set — `paddingTop` beside `'padding-top'` — so one would silently win | keep one |
65
65
  | `css-property-unknown` | a CSS property that does not exist | the property it suggests; a custom property starts with `--` |
66
66
  | `css-value` | an empty CSS value, or one with `;` or `{}` | one value per property; leave a property out instead of writing it empty |
67
+ | `declared-callback-target` | a `declaredCallback` target with a key beside `on` and `params` — read nowhere, so the step runs without it | the value in `params`: `{ on: 'calendar', params: { date } }` |
67
68
  | `element-ids-target` | a step refreshing containers by id (`invalidateElements`, `invalidateQueries({ elements })`) naming one the space does not have, or one that is not an `apiContainer` | the id of the `apiContainer` whose data the step changes: `invalidateElements: ['posts']` |
68
69
  | `element-load-strategy` | a `loadStrategy` the element does not take | one of the values the message lists |
69
70
  | `element-rejected` | an element the schema refused to hold | the problem listed with it |
@@ -79,7 +80,7 @@ The space is not written until these are fixed.
79
80
  | `flow-empty` | a flow with no steps | `[onClick(), setState({ … })]` |
80
81
  | `flow-without-trigger` | a flow whose first step is not the event that runs it | `[onClick(), setState(…)]` |
81
82
  | `folder-cycle` | a page folder inside itself | a `parent` that leads to the top |
82
- | `folder-undeclared` | a page, a layout or a folder filed in a folder the space does not declare | declare the folder, or the name it suggests |
83
+ | `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 |
83
84
  | `font-invalid` | a font the space cannot load as declared | the field the message names |
84
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 |
85
86
  | `from-and-bind` | the main attribute bound twice, with `from` and in `bind` | keep `from`, and give `bind` the other attributes |
@@ -97,12 +98,11 @@ The space is not written until these are fixed.
97
98
  | `list-without-items` | a controlled list with nothing to render | `items: [ … ]` or `bind: { items: 'provider.data.rows' }` |
98
99
  | `loading-slot-unknown` | an `apiContainer`'s `loadingSlot` that is not the id of one of its children | the id of the child to show until the first answer — `loadingSlot: 'catalog-skeleton'` beside that child |
99
100
  | `modifier-count` | more than one set of rules in a class list | one set, after the classes: `class: [card, { opacity: '0.5', 'margin-top': '8px' }]` |
100
- | `modifier-without-id` | rules on top of a class on an element with no `id` — the id names the class they become | `id: 'hero-bg'` |
101
101
  | `motion-invalid` | a `motion` with a preset, a trigger or a timing the page cannot play | `motion: { enter: 'fade-up', on: 'view' }` — the message lists the presets |
102
102
  | `motion-no-tag` | a `motion` on an element with no tag of its own — nothing to move | the motion on what it wraps, or a `subType` on it |
103
103
  | `no-pages` | a space with no pages | `pages: [{ id: 'home', name: 'Home', slug: '', body: [] }]` |
104
104
  | `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
- | `not-found-not-a-template` | `notFound` that is not one `{{ expression }}` against the answer — never `true`, so never a 404 | `notFound: '{{ source.found == false }}'` |
105
+ | `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
106
  | `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' |
107
107
  | `outside-ancestor` | an element that reads the state of an element it is not inside | nest it in the element the message names |
108
108
  | `page-access-level` | an `accessLevel` that is not one the router reads | one of the values the message lists |
@@ -110,6 +110,7 @@ The space is not written until these are fixed.
110
110
  | `page-route-taken` | two pages at one address for the same visitors | another slug — or `accessLevel` `'public'` on one and `'authenticated'` on the other |
111
111
  | `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'`) |
112
112
  | `page-target-url` | a URL, `mailto:` or `tel:` in a link left in page mode | `mode: 'external'` |
113
+ | `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 |
113
114
  | `page-without-slug` | a page with no `slug` | `slug: ''` for the home page, its path for any other: `'about'`, `'blog/:slug'` |
114
115
  | `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) |
115
116
  | `prop-missing` | an instance without a prop its component requires | `component('card', { props: { name: … } })`, or bind it |
@@ -131,6 +132,7 @@ The space is not written until these are fixed.
131
132
  | `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 |
132
133
  | `setting-misplaced` | `settings.computed` or `settings.channels` written inside `settings` | `computed` and `channels` at the top of the space |
133
134
  | `slot-children` | children handed to an instance outside its slots | `children: { slotName: [ … ] }`; a component with no slots takes no children |
135
+ | `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 |
134
136
  | `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 |
135
137
  | `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 |
136
138
  | `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 |
@@ -145,6 +147,7 @@ The space is not written until these are fixed.
145
147
  | `style-pseudo-unknown` | a pseudo-element a class cannot dress | one of `before`, `after`, `marker`, `placeholder`, `first-letter`, `first-line`, `selection` — without the `::` |
146
148
  | `style-state-unknown` | a state a selector does not react to | one of the states it lists (`hover`, `focus`, `active`…) |
147
149
  | `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` |
150
+ | `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>` |
148
151
  | `template-short-source` | a source named without its prefix inside a template or a step | the full name: `apiContainer_stats`, `list_rows` |
149
152
  | `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` |
150
153
  | `template-text-into-value` | a template, which renders text, feeding an attribute that holds a list or an object | `bindTemplate('items', source, '{{ … }}', { returns: 'value' })` |
@@ -185,6 +188,7 @@ The space renders, and renders something you probably did not mean. Fix every on
185
188
  | `embed-without-title` | an `embed` with no `title` — a frame a screen reader cannot describe | say what it shows in `title` |
186
189
  | `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 |
187
190
  | `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 |
191
+ | `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 |
188
192
  | `FORM_SUBMIT_UNMANAGED` | a form the browser would submit itself, reloading the page | `managedByInteractions: true` |
189
193
  | `form-control-name-taken` | two controls in one form with one name — one overwrites the other | a name each |
190
194
  | `form-control-unnamed` | a control in a form with no `name` — its value never reaches `values` | `formControl({ name: 'email', … })` |
@@ -202,6 +206,7 @@ The space renders, and renders something you probably did not mean. Fix every on
202
206
  | `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` |
203
207
  | `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`) |
204
208
  | `provider-without-source` | an `apiContainer` that asks nothing | a `query` (or `action`, `connector`, `resource`) |
209
+ | `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 |
205
210
  | `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` |
206
211
  | `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 |
207
212
  | `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` |
@@ -18,6 +18,8 @@ the value), or a format the space names once in `formats: { price: "{{ source|cu
18
18
  `bindTemplate(to, source, template, { category?, returns? })` is the computed attribute — a template over the value
19
19
  at `source`. `returns: 'value'` hands over what a single `{{ expression }}` evaluates to instead of its text: a list's
20
20
  `items`, a number, a flag (see [lists](lists.md)).
21
+ A colour from data binds a custom property — `[{ to: '--who', source, category: 'style' }]` — that the class reads
22
+ (`var(--who, var(--muted))`); a value with `;` or braces is not written.
21
23
 
22
24
  **A source names the id you gave the element** — `'posts.title'`, `'postList.item.cover'` — and the prefix is
23
25
  completed from what the element publishes (`apiContainer_posts`, `list_postList`; a `form` publishes under
@@ -72,6 +74,8 @@ apiContainer({ id: 'board', runtime: 'server', action: 'queue-board' })
72
74
  `"{{ source ? apiUrl ~ '/workspaces/' ~ source ~ '/stats' : '' }}"` with `source: 'state.workspace.id'`. A server
73
75
  provider's bound `input` (`bindTemplate('input', 'state.c', '{{ { country: source } }}', { returns: 'value' })`)
74
76
  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
79
  - `isLoading` is true while it is asked again, in either runtime. A newer ask drops the older one; `cancelApi('p')` is a
76
80
  STOP: what is shown stays.
77
81
  - `runtime: 'server'` is resolved by the page server — server data is on unless a space says `rsc: { enabled: false }`.
@@ -106,9 +110,8 @@ server action answering only what is shown, its `access` checking who asks.
106
110
  - **Refreshed by writes:** a `webHook` that is not a GET refreshes every request to its own site by default
107
111
  (`invalidateQueries: 'origin'`); a `runServerAction` refreshes everything (`'all'`). Narrow it with
108
112
  `'elements'` + `invalidateElements: ['orders']`, or stop it with `'none'`.
109
- - **Say `'none'` when a refresh would move the page on.** A page that decides where to go from a provider's answer
110
- ("profile complete → leave") will act on the refreshed answer in the middle of a multi-step form that saves as it
111
- goes, and skip the last step.
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.
112
115
 
113
116
  ## Visibility
114
117
 
@@ -156,10 +159,9 @@ Rules for a condition's template:
156
159
  `'true'` or `'false'` is written as it says. A plain source, or a template that answers nothing (`''`), writes
157
160
  nothing: the element stays as it started — hidden for `visible`, shown for a binding written by hand.
158
161
  - **So a hiding flag is `visible: '!state.folded'`** (or a binding with no `visible`): on screen before anybody has set
159
- it. A condition that answers "not known yet" with `'false'` from a value that IS there — a "folded" read off
160
- something always set — hid every label of a sidebar for everybody.
161
- - **Hide the element itself.** Never wrap it in a container that is shown while the inner one is hidden: an empty
162
- visible wrapper still takes a slot in its parent's `gap`, and leaves a hole in the page.
162
+ it.
163
+ - **Hide the element itself**, not inside a wrapper left shown: an empty wrapper still takes a slot in its parent's
164
+ `gap`, a hole in the page.
163
165
 
164
166
  ### Loading, empty, error
165
167
 
@@ -183,9 +185,8 @@ shows on every load. Test for "arrived and empty" (`is defined and … is empty`
183
185
 
184
186
  ## Never ask the data for an opposite
185
187
 
186
- Both sides of one question are `visible: 'x'` and `visible: '!x'`, not an `x` and a `notX` in the server's answer.
187
- `!` reads a boolean that travelled as text (`"false"`, `"0"`) correctly. A three-state condition
188
- (`Boolean(post) && !canEdit`) still belongs where the data is made.
188
+ Both sides of one question are `visible: 'x'` and `visible: '!x'`, never a `notX` in the answer — `!` reads `"false"`
189
+ and `"0"` as false. A three-state condition still belongs where the data is made.
189
190
 
190
191
  ## State that outlives a reload
191
192
 
@@ -70,11 +70,11 @@ a row's button posts `{ jobId: '{{ list_jobRows.item.id }}' }` — the row that
70
70
 
71
71
  **Pass objects, not JSON text.** `input: { title: '{{ form.values.title }}' }` rather than `input: '{"title": …}'`:
72
72
  each value keeps its own type, and nothing depends on the quoting. (JSON text works — a value inside one of its strings
73
- is escaped for it — but an object says the same without the punctuation.)
73
+ is escaped for it — but an object needs no punctuation.)
74
74
 
75
75
  **A field left empty is not in `values`.** A form sends what was typed, and a field nobody typed in sends nothing —
76
76
  so `when({ field: 'sent.values.code', operator: '=', value: '' }, …)` never holds for it. Ask
77
- `operator: 'empty'` / `'notEmpty'`, which treat missing and `''` alike.
77
+ `operator: 'empty'` / `'notEmpty'` (no `value`), which treat missing and `''` alike.
78
78
 
79
79
  ## Writes and what they refresh
80
80
 
@@ -25,6 +25,7 @@ export const docsLayout: LayoutSpec = {
25
25
  };
26
26
 
27
27
  // in the space
28
+ pageFolders: [{ id: 'docs', name: 'Docs' }], // declared once: its slug (the id) starts its pages' addresses — /docs/quickstart
28
29
  layouts: [appLayout, docsLayout],
29
30
  pages: [{ name: 'Quickstart', slug: 'quickstart', folder: 'docs', layout: { id: 'docs-layout', slot: 'docs-slot' }, body: [ … ] }]
30
31
  ```
@@ -139,8 +140,10 @@ Every page is now its content and nothing else, and every page is guaranteed the
139
140
  suggests writing your own (`not-found-page`): say it in the space's words.
140
141
  - **A page that exists but finds nothing** — `/products/:slug` for a slug no product has — is sent with 404 too when
141
142
  its server provider says so: `notFound: "{{ not (source.data.products|find('slug', navigation.routeParams.slug)) }}"`,
142
- one expression against its answer, on a `runtime: 'server'` provider of the page (not of its layout, which every
143
- page shares). The page renders as written: show its "not found" part with `visible`.
143
+ one expression against its answer, on a `runtime: 'server'` provider of the page. When the record comes from a
144
+ provider of its layout, which every page shares, the page says it: `notFound` on the page reads its server providers
145
+ by name — `"{{ not (apiContainer_feed.products|find('slug', navigation.routeParams.slug)) }}"`. The page renders as
146
+ written: show its "not found" part with `visible`.
144
147
 
145
148
  ## Styles follow the same rule
146
149
 
@@ -9,6 +9,7 @@ list bound to its records (see the provider in data-and-visibility).
9
9
  ```ts
10
10
  list({ id: 'games', class: gameGrid, items: 'catalog.data.games', row: 'game-card' }) // a component per game
11
11
  list({ id: 'games', items: 'catalog.data.games', row: r => listItem({ children: [text({ from: `${r.item}.title` })] }) })
12
+ // typed by a sample (`items: catalog.data.games`): `r.item` is a path — `from: r.item.title`, never `${r.item}.title`
12
13
  list({ id: 'plans', items: ['Free', 'Pro'], children: [listItem({ children: [text({ from: 'plans.item' })] })] }) // fixed
13
14
  ```
14
15
 
@@ -83,8 +83,8 @@ import { elementChildren } from '@plitzi/plitzi-sdk';
83
83
  ```
84
84
 
85
85
  Never write `style` onto an element the plugin does not render: nothing promises to keep it. Its boxes share one
86
- stacking context, the plugin's. `useDisplayMode()` names the breakpoint showing — `desktop`, `tablet` or `mobile` — at
87
- the widths the space's styles use, instead of a width of the plugin's own.
86
+ stacking context, the plugin's. `useDisplayMode()` names the breakpoint showing (`desktop`, `tablet`, `mobile`) at the
87
+ space's widths; `useElementSize(ref)`, its own box (`undefined` until measured).
88
88
 
89
89
  ## Its own server code
90
90
 
@@ -108,6 +108,7 @@ import { useChannel } from '@plitzi/plitzi-sdk';
108
108
 
109
109
  const room = useChannel(roomTopic, { onMessage: message => move(message.from, message.data) });
110
110
  room.publish('pointer', { x, y }); // throttle it: ~20 a second, the latest position each time
111
+ room.publish('react', { emoji }, { echo: true }); // and heard here too
111
112
  room.members; // who is here, with the state each announced
112
113
  ```
113
114
 
@@ -14,7 +14,10 @@ channel({ id: 'room', topic: 'room:{{ id }}', keep: 0, bind: { presence: 'comput
14
14
 
15
15
  Its descendants bind `room.members`, `room.connected`, `room.last`; flows use `on('onMessage')` (`type`, `data`,
16
16
  `from`), `onJoin`/`onLeave` (`from`, `user` and the `state` the member announced — `onJoin` only for who came after
17
- this page), `publishOn('room', 'reaction', data)` and `announceOn('room', state)`. State everyone must
17
+ this page), `publishOn('room', 'reaction', data)` and `announceOn('room', state)`. What a page publishes reaches
18
+ every OTHER page on the topic: one that shows it the moment it sends — a reaction, a chat line — says
19
+ `publishOn('room', 'reaction', data, { echo: true })` and hears it back once the server took it (its `from` is
20
+ `room.me`). What a server action publishes reaches every page, the one that ran it included. State everyone must
18
21
  agree on goes through a server action whose last step is `realtime.publish` — validated and saved first, announced
19
22
  after.
20
23
 
@@ -93,7 +93,9 @@ pages: [
93
93
 
94
94
  Adding a page is adding an entry; two entries of one id or slug are refused as any two pages are. For one shape over
95
95
  records a visitor browses — a product, a post — a single page with a route param (`slug: 'posts/:postId'`) reading
96
- the record is the answer instead: one page, as many addresses as records.
96
+ the record is the answer instead: one page, as many addresses as records. Its `seoTitle` can say the record —
97
+ `'{{ apiContainer_post.title }} — Blog'` — read from a provider on the page with `runtime: 'server'`, or from
98
+ `navigation`: the server writes the head with it, so a link preview shows it. Anything else is refused (`page-template`).
97
99
 
98
100
  ## Names
99
101
 
@@ -13,10 +13,12 @@ apiContainer({ id: site.id, query: '/data/home.json', children: [
13
13
  ] })
14
14
  ```
15
15
 
16
- - A path is the source's full name (`apiContainer_site.data.hero.title`), so it goes in `from`, `items`, `bind` and
17
- `visible` as it is, and into a template through `twig` (a plain template literal writes the same text, but a
18
- type-checked lint refuses an object in one).
19
- - A list fed by a path hands its `row` the item typed: every field any item of the sample has.
16
+ - A path is the source's full name (`apiContainer_site.data.hero.title`), so it goes in `from`, `items`, `bind`,
17
+ `visible` and the binding helpers (`bindTemplate`, `visibleWhen`, `hiddenWhen`, `variantFrom`) as it is, and into a
18
+ template through `twig` (a plain template literal writes the same text, but a type-checked lint refuses an object in
19
+ one).
20
+ - A list fed by a path hands its `row` the item typed: every field any item of the sample has — `p.item`, `p.index`,
21
+ and `p.inTemplate` as an untyped row has it, so turning a list typed changes none of its templates.
20
22
  - An item of a list is read by position: `site.data.sections[1]`.
21
23
  - A provider fed by a server action publishes the action's output at its root: `actionSource('feed', sample)` types
22
24
  it — `feed.stories`, and `feed.data` is a type error — with a sample of what the action's last step answers.