@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
package/dist/plugin.d.ts CHANGED
@@ -115,6 +115,19 @@ export declare interface ElementDeclarationData {
115
115
  * reads it to resolve a binding that named the element alone.
116
116
  */
117
117
  sourceType?: string;
118
+ /**
119
+ * What its source holds, field by field — `atEnd: 'At its last slide…'` — for whoever writes a binding to it: what
120
+ * `plitzi explain <type>` says and its search finds, where an author otherwise read the bundle's types to learn a
121
+ * carousel could say where it stands. The fields the element writes itself; a provider's answer is the
122
+ * service's, and is said as `…`.
123
+ */
124
+ publishes?: Record<string, string>;
125
+ /**
126
+ * What it writes on its node that a style or a check reads it by — `role="tab"`, `aria-selected`, a class it adds —
127
+ * and how a class styles it: what `plitzi explain <type>` says under "On the page". A run's developer read the
128
+ * served HTML to learn a tab says `aria-selected`, and lit the open tab with a state that never matched it.
129
+ */
130
+ marks?: Record<string, string>;
118
131
  /**
119
132
  * The triggers this type fires on top of the ones every element does (`onClick`, `onLoad`…), by action name.
120
133
  *
@@ -165,8 +178,17 @@ export declare interface ElementDeclarationData {
165
178
  * authoring lint, which holds them to that context.
166
179
  */
167
180
  serverTemplates?: readonly string[];
181
+ /**
182
+ * The attributes that are the element's content — what it says or shows, never how: its words, a link's address, an
183
+ * image's source and its text alternative, a field's label. A space role that edits the content and not the design
184
+ * (`spaceContent`, a client editing a site an agency built) changes these alone, in the builder and at the server; an
185
+ * element that names none has nothing such a role may change.
186
+ */
187
+ contentAttributes?: readonly string[];
168
188
  content?: {
169
189
  attributes?: Record<string, unknown>;
190
+ /** The attributes whose default is the builder's placeholder words, never a value ({@link ElementContentSpec}). */
191
+ placeholders?: readonly string[];
170
192
  definition?: {
171
193
  label?: string;
172
194
  };
@@ -279,6 +301,16 @@ declare interface ElementMotion {
279
301
  stagger?: number;
280
302
  /** Keeps moving after it arrived. */
281
303
  loop?: MotionLoop;
304
+ /**
305
+ * The curve it arrives along, as CSS says one — `ease-in-out`, `cubic-bezier(0.4, 0, 0.2, 1)`, `steps(4)` — for a
306
+ * copy whose arrivals must be the original's (`MOTION_ENTER_EASING` when left out).
307
+ */
308
+ easing?: string;
309
+ /**
310
+ * How far it travels to arrive, in px, for an arrival that travels (`MOTION_ENTER_TRAVEL`): `fade-up` rises 24 px
311
+ * unless this says 20.
312
+ */
313
+ distance?: number;
282
314
  }
283
315
 
284
316
  declare type ElementRuntime = 'server' | 'client' | 'shared';
@@ -357,6 +389,15 @@ declare type InteractionCallbackParam<T extends Record<string, unknown> = Record
357
389
  } | {
358
390
  type: 'boolean';
359
391
  defaultValue?: boolean;
392
+ }
393
+ /**
394
+ * Several values, handed to a task as a list of text: bound to a list it is that list, and written by hand it is one
395
+ * a line (or separated by commas) — at most `maxItems`. A run's room took its genres as comma text before it.
396
+ */
397
+ | {
398
+ type: 'list';
399
+ defaultValue?: string[];
400
+ maxItems?: number;
360
401
  } | {
361
402
  /**
362
403
  * Several elements of the space, stored as their ids. The editor offers the elements of `elementType` to pick
@@ -399,7 +440,7 @@ export declare type InteractionCallbackPreviews = Record<string, InteractionCall
399
440
 
400
441
  declare type InteractionCallbackType = 'trigger' | 'globalCallback' | 'callback' | 'utility' | 'task';
401
442
 
402
- declare type InteractionParamType = 'boolean' | 'select' | 'text' | 'number' | 'textarea' | 'codemirror-text' | 'codemirror-json' | 'elements';
443
+ declare type InteractionParamType = 'boolean' | 'select' | 'text' | 'number' | 'textarea' | 'codemirror-text' | 'codemirror-json' | 'elements' | 'list';
403
444
 
404
445
  declare type InteractionPostCallback<T extends Record<string, unknown> = Record<string, unknown>> = (params: InteractionCallbackParamValues<T>, callbackResult?: unknown) => unknown;
405
446
 
@@ -492,6 +533,8 @@ declare type PluginSchema = {
492
533
  builder: PluginBuilder;
493
534
  initialItems?: string[];
494
535
  definition: Element_2['definition'];
536
+ /** The attributes a role that edits the content and not the design may change; none, it may change none. */
537
+ contentAttributes?: string[];
495
538
  defaultStyle: {
496
539
  name: string;
497
540
  displayMode: DisplayMode;
@@ -528,6 +571,9 @@ export declare interface PluginSpec<A extends object, T extends Record<string, P
528
571
  market?: Partial<PluginContent<A>['market']>;
529
572
  /** The attributes a data source may be pointed at. Left out, every one. */
530
573
  bindable?: readonly (keyof A & string)[];
574
+ /** The attributes a role that edits the content and not the design may change — its words, a link, a
575
+ * picture. Left out, none: a content editor changes nothing on it. */
576
+ contentAttributes?: readonly (keyof A & string)[];
531
577
  /** Its style before anybody styles it. */
532
578
  style?: PluginSchema['defaultStyle']['style'];
533
579
  /** More of the element's definition — children it starts with (`items`), its style selectors. */
@@ -694,6 +740,7 @@ declare const styleConstants: {
694
740
  readonly BORDER_TOP_RIGHT_RADIUS: "border-top-right-radius";
695
741
  readonly BORDER_BOTTOM_LEFT_RADIUS: "border-bottom-left-radius";
696
742
  readonly BORDER_BOTTOM_RIGHT_RADIUS: "border-bottom-right-radius";
743
+ readonly BORDER_IMAGE: "border-image";
697
744
  readonly BORDER_COLLAPSE: "border-collapse";
698
745
  readonly BORDER_SPACING: "border-spacing";
699
746
  readonly TABLE_LAYOUT: "table-layout";
@@ -733,6 +780,7 @@ declare const styleConstants: {
733
780
  readonly PERSPECTIVE_ORIGIN: "perspective-origin";
734
781
  readonly BACKFACE_VISIBILITY: "backface-visibility";
735
782
  readonly WILL_CHANGE: "will-change";
783
+ readonly VIEW_TRANSITION_NAME: "view-transition-name";
736
784
  readonly OUTLINE_WIDTH: "outline-width";
737
785
  readonly OUTLINE_STYLE: "outline-style";
738
786
  readonly OUTLINE_COLOR: "outline-color";
@@ -744,11 +792,19 @@ declare const styleConstants: {
744
792
  readonly APPEARANCE: "appearance";
745
793
  readonly SCROLL_BEHAVIOR: "scroll-behavior";
746
794
  readonly OVERSCROLL_BEHAVIOR: "overscroll-behavior";
795
+ readonly OVERSCROLL_BEHAVIOR_X: "overscroll-behavior-x";
796
+ readonly OVERSCROLL_BEHAVIOR_Y: "overscroll-behavior-y";
747
797
  readonly SCROLL_SNAP_TYPE: "scroll-snap-type";
748
798
  readonly SCROLL_SNAP_ALIGN: "scroll-snap-align";
749
799
  readonly SCROLL_SNAP_STOP: "scroll-snap-stop";
750
800
  readonly SCROLL_PADDING_TOP: "scroll-padding-top";
801
+ readonly SCROLL_PADDING_RIGHT: "scroll-padding-right";
802
+ readonly SCROLL_PADDING_BOTTOM: "scroll-padding-bottom";
803
+ readonly SCROLL_PADDING_LEFT: "scroll-padding-left";
751
804
  readonly SCROLL_MARGIN_TOP: "scroll-margin-top";
805
+ readonly SCROLL_MARGIN_RIGHT: "scroll-margin-right";
806
+ readonly SCROLL_MARGIN_BOTTOM: "scroll-margin-bottom";
807
+ readonly SCROLL_MARGIN_LEFT: "scroll-margin-left";
752
808
  readonly ACCENT_COLOR: "accent-color";
753
809
  readonly CARET_COLOR: "caret-color";
754
810
  readonly COLOR_SCHEME: "color-scheme";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-authoring",
3
- "version": "0.38.24",
3
+ "version": "0.39.0",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist/index.js",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "type": "module",
45
45
  "engines": {
46
- "node": ">=22.18"
46
+ "node": "^24.22.1 || >=26.12.1"
47
47
  },
48
48
  "sideEffects": false,
49
49
  "scripts": {
@@ -66,12 +66,12 @@
66
66
  },
67
67
  "devDependencies": {
68
68
  "@microsoft/api-extractor": "^7.59.4",
69
- "@plitzi/plitzi-ui": "^1.6.34",
70
- "@plitzi/sdk-elements": "0.38.24",
71
- "@plitzi/sdk-interactions": "0.38.24",
72
- "@plitzi/sdk-schema": "0.38.24",
73
- "@plitzi/sdk-shared": "0.38.24",
74
- "@plitzi/sdk-style": "0.38.24",
69
+ "@plitzi/plitzi-ui": "^1.6.36",
70
+ "@plitzi/sdk-elements": "0.39.0",
71
+ "@plitzi/sdk-interactions": "0.39.0",
72
+ "@plitzi/sdk-schema": "0.39.0",
73
+ "@plitzi/sdk-shared": "0.39.0",
74
+ "@plitzi/sdk-style": "0.39.0",
75
75
  "@types/react": "^19.3.0",
76
76
  "eslint": "^9.39.5",
77
77
  "prettier": "^3.9.10",
@@ -1,8 +1,8 @@
1
1
  # Plitzi authoring — cheatsheet
2
2
 
3
3
  What most changes need, on one page. Everything is imported from `@plitzi/sdk-authoring`. For the rest, ask by name —
4
- `npx @plitzi/cli explain navigate` (an element, a step, a trigger, a problem's code), `--list steps` for every one of a
5
- kind — rather than reading its `.d.ts`.
4
+ `npx @plitzi/cli explain navigate` (an element, step, server step, trigger, code, filter), `--list steps` for every one
5
+ of a kind — rather than reading its `.d.ts`.
6
6
 
7
7
  ## The space
8
8
 
@@ -49,10 +49,10 @@ carousel({ id: 'hero', items: 'p.data.slides', autoplay: 5000, row: 'slide-card'
49
49
  // rows follow their item's `id`, or `itemKey: 'slug'`
50
50
  apiContainer({ id: 'p', query: '/data/x.json', cache: true, children }) // publishes p.data; no box of its own
51
51
  apiContainer({ id: 'p', query: '/data/x.json', runtime: 'server', children }) // read by the page server: still p.data
52
- apiContainer({ id: 'p', action: 'report', runtime: 'server', children }) // the action's output at p's root: p.rows
52
+ apiContainer({ id: 'p', action: 'report', runtime: 'server', children }) // its output at p's root: p.rows
53
53
  // loadingSlot: 'p-skeleton' — a child shown until it answers
54
54
  form({ id, managedByInteractions: true, flows, children })
55
- formControl({ name: 'email', label: 'Email', subType: 'email', required: true }) // optional without required; select: options: [{ label, value }]
55
+ formControl({ name: 'email', label: 'Email', subType: 'email', required: true }) // optional without required; select: options: [{ label, value }]; number: min, max
56
56
  modalContainer({ id, visible: false, title, children })
57
57
  component('card', { props: { title }, children: { body: [ … ] } })
58
58
  const seats = defineElement(seatsDeclaration); seats({ id }) // a plugin
@@ -104,8 +104,8 @@ A flow is `[trigger, …steps]`, in an element's `flows`.
104
104
  [onClick(), setState({ key: 'saved', type: 'boolean', value: true })] // types: boolean, number, text, json
105
105
  [named('sent', onSubmit()), setState({ key: 'email', type: 'text', value: '{{ sent.values.email }}' })]
106
106
  [on('onChange'), …]; [on('onMouseEnter'), …]; [onPageLoad(), …]; [onKey('mod+k, escape'), …]
107
- [onInterval(5000), …] // every 5 s, while the tab is in view
108
- [onClick(), scrollBy('cards', { x: '80%' })]; scrollTo('cards', { x: 'end' }); scrollIntoView('answer')
107
+ [onInterval(5000), …] // every 5 s, the tab in view
108
+ [onClick(), scrollBy('cards', { x: '80%' })]; scrollTo('cards', { x: 'end' }); scrollIntoView('answer'); focus('field')
109
109
  [named('row', onScroll()), …] // { x, y, atStart, atEnd } of its own box
110
110
  [onClick(), toggleState({ key: 'menuOpen' })]
111
111
  [onClick(), cycleState({ key: 'slide', length: 3, by: -1 })] // goes round; stepState({ key, by, min, max }) stops
@@ -24,7 +24,8 @@ export const space = {
24
24
  };
25
25
  ```
26
26
 
27
- A space on Plitzi — edited in the builder — is edited through the Plitzi MCP server instead, never both on one space.
27
+ A change to a space on Plitzi itself — the builder's — is the Plitzi MCP server's instead. One taken out as a project
28
+ (`plitzi create --from`) and changed through the MCP meanwhile refuses `space push` until `space pull`.
28
29
 
29
30
  ## How to work
30
31
 
@@ -37,7 +38,8 @@ A space on Plitzi — edited in the builder — is edited through the Plitzi MCP
37
38
  4. **Before saying done:** `npm run lint:space` clean, and the [review checklist](reference/review-checklist.md).
38
39
 
39
40
  What a name means — an element, a step, a trigger, a code, any `@plitzi` export (`pageFamily`, `createServer`): `npx plitzi explain
40
- <name>`, in a few lines. Never read the `.d.ts`.
41
+ <name>`, in a few lines; whether there is a way at all — a field an element publishes, a state — `npx plitzi explain
42
+ --search "<words>"`. Never read the `.d.ts`.
41
43
 
42
44
  ## Five rules authoring cannot check for you
43
45
 
@@ -1,5 +1,6 @@
1
1
  /**
2
- * An accordion — questions whose answers open one at a time — written once and mapped over the questions: the open one
2
+ * An accordion — questions whose answers open one at a time, a disclosure that expands and collapses, as `<details>`
3
+ * would — written once and mapped over the questions: the open one
3
4
  * is a key in `state`, and each question reads it the same way. The button says whether its answer is open
4
5
  * (`ariaExpanded`) and which panel it opens (`controls`, by the panel's id), so a screen reader follows it; the panel is
5
6
  * revealed by the state, so it starts hidden.
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * Three carousels from one element: slides that change on their own with arrows and dots, a marquee of logos that
3
3
  * never ends, and a row of cards a visitor swipes. The slides, the dots and anything else inside read the carousel's
4
- * source — `carousel_<id>.index`, `.count`, `.item`, `.items` — and the arrows and dots are steps on it.
4
+ * source — `carousel_<id>.index`, `.count`, `.item`, `.items`, and `.atStart`, `.atEnd`, `.shown` for where it stands —
5
+ * and the arrows and dots are steps on it.
5
6
  */
6
7
  import {
7
8
  activeWhen,
@@ -40,6 +41,12 @@ const dots = styles('hero-dots', { display: 'flex', gap: 8, margin: '0px', paddi
40
41
  // Several slides at once: the carousel's class says how wide each is and the gap between them.
41
42
  const cards = styles('picks-row', { '--plitzi-carousel-slide-width': '240px', '--plitzi-carousel-gap': '16px' });
42
43
 
44
+ // An arrow with nowhere to go is hidden and passes the pointer on, as a shop's arrows do at a row's ends.
45
+ const arrow = styles('picks-arrow', {
46
+ css: { transition: 'opacity 0.2s' },
47
+ variants: { spent: { opacity: 0, pointerEvents: 'none' } }
48
+ });
49
+
43
50
  export const recipe: SpaceSpec = {
44
51
  name: 'Carousels',
45
52
  permanentUrl: 'carousels',
@@ -100,7 +107,8 @@ export const recipe: SpaceSpec = {
100
107
  items: ['Acme', 'Globex', 'Initech', 'Umbrella', 'Hooli'],
101
108
  row: r => text({ from: r.item, css: { padding: '0px 24px', fontWeight: 600 } })
102
109
  }),
103
- // A row that swipes on a phone and snaps to each card; the arrows move it a card at a time.
110
+ // A row that swipes on a phone and snaps to each card; the arrows move it a page — as many cards as it shows —
111
+ // and each hides at its end.
104
112
  carousel({
105
113
  id: 'picks',
106
114
  label: 'Picks',
@@ -109,7 +117,20 @@ export const recipe: SpaceSpec = {
109
117
  items: SLIDES,
110
118
  row: r => container({ class: slide, children: [text({ from: `${r.item}.title` })] }),
111
119
  children: [
112
- button({ content: '›', title: 'More picks', flows: [[onClick(), carouselNext('picks')]] }),
120
+ button({
121
+ content: '‹',
122
+ title: 'Earlier picks',
123
+ class: arrow,
124
+ bind: [activeWhen(arrow, '{{ carousel_picks.atStart }}', { variant: 'spent' })],
125
+ flows: [[onClick(), carouselPrevious('picks', 'page')]]
126
+ }),
127
+ button({
128
+ content: '›',
129
+ title: 'More picks',
130
+ class: arrow,
131
+ bind: [activeWhen(arrow, '{{ carousel_picks.atEnd }}', { variant: 'spent' })],
132
+ flows: [[onClick(), carouselNext('picks', 'page')]]
133
+ }),
113
134
  text({ from: 'picks.index', as: '{{ source + 1 }} of {{ carousel_picks.count }}' })
114
135
  ]
115
136
  })
@@ -1,4 +1,3 @@
1
- /* eslint-disable quotes -- templates quote their own strings, and read best in the other quotes */
2
1
  /**
3
2
  * A page per record: a card links to `/products/<slug>`, and the detail page narrows the same file to the product its
4
3
  * address names — with a message, not an empty page, when no product has that name, and status 404: the provider is
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * Something drawn elsewhere — a map, a video player — in an `embed`, and a drawing of your own in an `svg`.
3
3
  *
4
- * An embed says what it shows in `title`, which is what a screen reader announces, and loads lazily. An `svg` takes
4
+ * An embed says what it shows in `title`, which is what a screen reader announces, and loads lazily — and hidden (its
5
+ * `visible`, a player behind its poster) it loads nothing until it is first shown: no `src` binding to the play state
6
+ * is needed. An `svg` takes
5
7
  * the markup alone, checked to be an SVG and with anything that runs taken out; drawn with `currentColor`, it follows
6
8
  * the colour of its class in both themes. Without a `label` it is decoration, hidden from readers; with one it is an
7
9
  * image that says it.
@@ -1,4 +1,3 @@
1
- /* eslint-disable quotes -- templates quote their own strings, and read best in the other quotes */
2
1
  /**
3
2
  * Filter and sort a list: a select writes the chosen category to `state`, and the list is bound through a template
4
3
  * that hands over its VALUE — only the matching rows are rendered, with a count and an empty state over the same rows.
@@ -1,4 +1,3 @@
1
- /* eslint-disable quotes -- templates quote their own strings, and read best in the other quotes */
2
1
  /**
3
2
  * Show data with no backend, in a project with no server: a JSON file the browser fetches (`public/data/products.json`,
4
3
  * public), read by a provider — one card per product, a skeleton while it loads, a count, a computed value, and an
@@ -1,4 +1,3 @@
1
- /* eslint-disable quotes -- templates quote their own strings, and read best in the other quotes */
2
1
  /**
3
2
  * Data typed by a sample of it: `source()` turns the JSON the page reads into names the editor completes and checks —
4
3
  * `site.data.hero.titel` is a type error, not an empty heading. In a project the sample is the file itself:
@@ -19,7 +19,8 @@ button({ content: '', title: 'Close', icon: 'fa-solid fa-xmark' })
19
19
  // Words that do not say what it does — a key hint, a count: `label` is read in their place.
20
20
  button({ content: 'V', label: 'Select (V)', title: 'Select — V', icon: 'fa-solid fa-arrow-pointer' })
21
21
 
22
- // A link around a whole card: without `label` it is announced as every word inside the card.
22
+ // A link around a whole card: without `label` it is announced as every word inside the card — and around an
23
+ // `article`, Playwright reads no name at all (accname takes none from an article): name it, and a test finds it.
23
24
  link({ href: '/posts/field-notes', label: 'Read “Field notes”', children: [ /* cover, topic, title, byline */ ] })
24
25
 
25
26
  // A field whose design says what it is: the label stays, out of sight.
@@ -81,8 +82,12 @@ button({ content: 'Menu', bind: { ariaExpanded: 'state.menuOpen' }, flows: [[onC
81
82
 
82
83
  An "active" variant is for the eyes. `ariaPressed` and `ariaExpanded` are for everyone else. Use both. A button that
83
84
  opens a panel also names it — `controls: 'menu-panel'`, the panel's id (authoring gives the panel the anchor
84
- `aria-controls` needs; [recipes/accordion.ts](../recipes/accordion.ts)). Words that change while somebody is on the page
85
+ `aria-controls` needs; [recipes/accordion.ts](../recipes/accordion.ts)). In a list's row, both are the row's own: each
86
+ row's panel is drawn as `<id>-<row>`, and the row's button points at its own. Words that change while somebody is on the page
85
87
  — a count, a total, a status — sit in `container({ live: 'polite', … })`, so a screen reader says them when they change.
88
+ A part that opens and closes on its own — a question and its answer, many open at once — needs no state at all:
89
+ `container({ subType: 'details', children: [container({ subType: 'summary', children: [text('Question')] }), …] })`
90
+ (`open: true` to start open), the browser's own disclosure, announced as one. The accordion recipe is for one-at-a-time.
86
91
 
87
92
  ## The page has an outline
88
93
 
@@ -48,7 +48,8 @@ form({
48
48
  - What it answers: `ok`; when not, `reason` (`unverified`, `inactive`, `network`, `missing`…) and, for `reason: 'mfa'`,
49
49
  `mfaToken` — the challenge `mode: 'mfa'` completes. Test it on `<step>.ok` with `when`, never `whenSucceeded` /
50
50
  `whenFailed`, which are a server action's ([flows](flows.md)).
51
- - `authLogout()` ends the session; `authRefreshDetails()` reloads who is signed in.
51
+ - `authLogout()` ends the session; `authLogoutEverywhere('site' | 'all')` ends it on every device too — this space's
52
+ sessions, or every one of the account; `authRefreshDetails()` reloads who is signed in.
52
53
 
53
54
  ## Who is signed in
54
55
 
@@ -61,13 +62,23 @@ being found out), `{{ auth.details.username }}` — `details` carries `id`, `use
61
62
  A page's `accessLevel`: `'authenticated'` (signed in), `'public'` (signed OUT only — the sign-in page), or nothing
62
63
  (everybody). A lone `public` page vanishes the moment anyone signs in, so leave it out unless the page has a signed-in
63
64
  twin on the same slug. `unauthorizedRedirect` names where a visitor the page is not for goes — a page's id or slug
64
- (`''` is the home page), or a URL; without it they are answered 403.
65
+ (`''` is the home page), or a URL; without it they are answered 403. A visitor not signed in is sent with the address
66
+ they asked for as `?redirect=`. A `public` sign-in with `unauthorizedRedirect` sends whoever signs in on it there
67
+ itself — back to `?redirect=` when it is on this site, else to its `unauthorizedRedirect` — the moment `authLogin`
68
+ succeeds, so steps after the login race the page leaving: end the flow at the login (`login-then-leaves` says so). A
69
+ sign-in for everybody sends them back itself: `navigate({ urlType: 'external', url: "{{ navigation.queryParams.redirect | default('/') }}" })`.
70
+
71
+ Which page an address draws, and for whom, is the router's decision — a tool or a test asks it, never the pages' paths:
72
+ `pageAt(schema, '/sign-in', { signedIn: true })` (the page, or where it sends them), `audienceAt(schema, '/sign-in')`
73
+ (`everyone`, `gated` — one page drawn apart by sign-in —, `guests`, `members`, `both-apart`, `nobody`).
65
74
 
66
75
  A page for some permissions says so: `access: { permissions: ['postPublish'] }` — every one held, by a signed-in visitor
67
76
  (the permissions of their visitor roles; on Plitzi's own spaces, their account's). The server keeps it: anybody else is
68
77
  answered 401 or 403 and the page's refusal, and its content is never sent to them — not in the page, not in the space
69
- the browser fetches. Signed out, they go to `unauthorizedRedirect` when the page names one. Hiding a part of a page on
70
- `auth.details.permissions` is not this: the part was still sent.
78
+ the browser fetches. Signed out, they go to `unauthorizedRedirect` when the page names one. The refusal is a few words
79
+ of Plitzi's unless `settings.withheldPage` names a page of the space (id or slug, with no `access`): it is drawn
80
+ instead, in the same layout, with the same status — `auth.isAuthenticated` tells "sign in" from "not yours". Hiding a
81
+ part of a page on `auth.details.permissions` is not this: the part was still sent.
71
82
 
72
83
  ## What a visitor may do
73
84