@plitzi/sdk-authoring 0.39.0 → 0.39.2
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/CHANGELOG.md +14 -0
- package/dist/index-declare.js +1 -2
- package/dist/index-src.js +3116 -3698
- package/dist/index.d.ts +251 -47
- package/dist/index.js +2 -2
- package/dist/node.d.ts +64 -9
- package/dist/node.js +162 -146
- package/dist/plugin.d.ts +5 -0
- package/package.json +12 -12
- package/skills/plitzi-authoring/recipes/server-data.ts +4 -0
- package/skills/plitzi-authoring/reference/accessibility.md +9 -2
- package/skills/plitzi-authoring/reference/auth.md +6 -1
- package/skills/plitzi-authoring/reference/authoring-errors.md +7 -4
- package/skills/plitzi-authoring/reference/flows.md +9 -9
- package/skills/plitzi-authoring/reference/kept-state.md +12 -0
- package/skills/plitzi-authoring/reference/lists.md +7 -1
- package/skills/plitzi-authoring/reference/plugins.md +5 -2
- package/skills/plitzi-authoring/reference/testing.md +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-authoring",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.2",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/index.js",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
},
|
|
48
48
|
"sideEffects": false,
|
|
49
49
|
"scripts": {
|
|
50
|
-
"lint": "eslint ./src ./skills ./templates",
|
|
51
|
-
"typecheck": "tsc -p tsconfig.app.json --noEmit",
|
|
50
|
+
"lint": "eslint --cache --cache-location .eslintcache --cache-strategy content ./src ./skills ./templates",
|
|
51
|
+
"typecheck": "tsc -p tsconfig.app.json --noEmit --incremental --tsBuildInfoFile .tsbuildinfo/app.tsbuildinfo",
|
|
52
52
|
"test": "vitest run",
|
|
53
53
|
"test:watch": "vitest",
|
|
54
54
|
"build:dev": "vite build --mode development",
|
|
@@ -65,19 +65,19 @@
|
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@microsoft/api-extractor": "^7.
|
|
69
|
-
"@plitzi/plitzi-ui": "^1.6.
|
|
70
|
-
"@plitzi/sdk-elements": "0.39.
|
|
71
|
-
"@plitzi/sdk-interactions": "0.39.
|
|
72
|
-
"@plitzi/sdk-schema": "0.39.
|
|
73
|
-
"@plitzi/sdk-shared": "0.39.
|
|
74
|
-
"@plitzi/sdk-style": "0.39.
|
|
68
|
+
"@microsoft/api-extractor": "^7.60.1",
|
|
69
|
+
"@plitzi/plitzi-ui": "^1.6.38",
|
|
70
|
+
"@plitzi/sdk-elements": "0.39.2",
|
|
71
|
+
"@plitzi/sdk-interactions": "0.39.2",
|
|
72
|
+
"@plitzi/sdk-schema": "0.39.2",
|
|
73
|
+
"@plitzi/sdk-shared": "0.39.2",
|
|
74
|
+
"@plitzi/sdk-style": "0.39.2",
|
|
75
75
|
"@types/react": "^19.3.0",
|
|
76
76
|
"eslint": "^9.39.5",
|
|
77
77
|
"prettier": "^3.9.10",
|
|
78
78
|
"typescript": "^6.0.3",
|
|
79
|
-
"vite": "^8.3.
|
|
79
|
+
"vite": "^8.3.7",
|
|
80
80
|
"vite-plugin-dts": "^5.1.2",
|
|
81
|
-
"vitest": "^5.0
|
|
81
|
+
"vitest": "^5.1.0"
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
* - The page server resolves what a page and its layouts hold, never inside a component: the provider stays on the page
|
|
10
10
|
* and each row reaches the card component as a prop.
|
|
11
11
|
* - `mockData` is what the builder shows while editing; the running page always reads the file.
|
|
12
|
+
* - A `query` template reads the space's variables, `navigation` and the state the space paints (`state.<key>` for a
|
|
13
|
+
* key in `settings.paintedState`); the browser asks again when what it reads changes. Anything else is the browser's.
|
|
14
|
+
* - An API's answer for the signed-in visitor (`credentials: 'include'`) is asked with their cookies only where the
|
|
15
|
+
* server names that API and trusts the space (`rsc.visitorCredentials`); anywhere else the provider's error says so.
|
|
12
16
|
*/
|
|
13
17
|
import { apiContainer, heading, list, listItem, styles, text } from '@plitzi/sdk-authoring';
|
|
14
18
|
|
|
@@ -4,8 +4,8 @@ A screen reader and a browser agent (Claude in Chrome) read a page the same way.
|
|
|
4
4
|
tree** the browser builds from the markup, where every control is a role and a name. If a control has no name, or a
|
|
5
5
|
click sits on a box that is not a control, those readers can't find it, even though the page looks fine. The linter
|
|
6
6
|
warns about each case below (`control-without-name`, `image-without-alt`, `click-on-static-element`,
|
|
7
|
-
`dropdown-without-control`, `
|
|
8
|
-
|
|
7
|
+
`dropdown-without-control`, `label-ignored`, `control-in-decorative`, `embed-without-title`, `controls-no-anchor`). Fix
|
|
8
|
+
them the same way you fix any other warning. A page's heading outline is a suggestion instead (`heading-level-skipped`).
|
|
9
9
|
|
|
10
10
|
## Controls have words
|
|
11
11
|
|
|
@@ -88,10 +88,17 @@ row's panel is drawn as `<id>-<row>`, and the row's button points at its own. Wo
|
|
|
88
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
89
|
`container({ subType: 'details', children: [container({ subType: 'summary', children: [text('Question')] }), …] })`
|
|
90
90
|
(`open: true` to start open), the browser's own disclosure, announced as one. The accordion recipe is for one-at-a-time.
|
|
91
|
+
Results, a menu or a set of options someone goes through with the keyboard sit in `focusGroup({ label, children })`:
|
|
92
|
+
↑/↓ move between the controls inside, ←/→ to the first of the next or previous list, and ↓ from a search field inside
|
|
93
|
+
goes down into them — Tab alone took a stop per result.
|
|
91
94
|
|
|
92
95
|
## The page has an outline
|
|
93
96
|
|
|
94
97
|
- Headings go down one level at a time: h1, then h2, then h3. The class sets the size, so an `h2` can look small.
|
|
98
|
+
The outline is the page as it is drawn: a layout's `h1` is the page's too, so a page inside it opens at `h2`. A
|
|
99
|
+
heading that starts hidden (`visible: false`) is not there until it shows, so the levels around it must not need
|
|
100
|
+
it. `heading-level-skipped` (a suggestion) points out each skip — Lighthouse's "not in a sequentially-descending
|
|
101
|
+
order".
|
|
95
102
|
- Landmarks are containers with a tag: `header`, `nav`, `main`, `aside`, `footer`. When a page has two of one kind,
|
|
96
103
|
give each a `label`: `container({ subType: 'nav', label: 'Docs sections' })`. A `section` with a `label` becomes a
|
|
97
104
|
region an assistant can jump to.
|
|
@@ -63,7 +63,8 @@ A page's `accessLevel`: `'authenticated'` (signed in), `'public'` (signed OUT on
|
|
|
63
63
|
(everybody). A lone `public` page vanishes the moment anyone signs in, so leave it out unless the page has a signed-in
|
|
64
64
|
twin on the same slug. `unauthorizedRedirect` names where a visitor the page is not for goes — a page's id or slug
|
|
65
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
|
|
66
|
+
they asked for as `?redirect=` — except one who just signed out on that page, who is sent with none: the page they left
|
|
67
|
+
is not where to return. A `public` sign-in with `unauthorizedRedirect` sends whoever signs in on it there
|
|
67
68
|
itself — back to `?redirect=` when it is on this site, else to its `unauthorizedRedirect` — the moment `authLogin`
|
|
68
69
|
succeeds, so steps after the login race the page leaving: end the flow at the login (`login-then-leaves` says so). A
|
|
69
70
|
sign-in for everybody sends them back itself: `navigate({ urlType: 'external', url: "{{ navigation.queryParams.redirect | default('/') }}" })`.
|
|
@@ -79,6 +80,10 @@ the browser fetches. Signed out, they go to `unauthorizedRedirect` when the page
|
|
|
79
80
|
of Plitzi's unless `settings.withheldPage` names a page of the space (id or slug, with no `access`): it is drawn
|
|
80
81
|
instead, in the same layout, with the same status — `auth.isAuthenticated` tells "sign in" from "not yours". Hiding a
|
|
81
82
|
part of a page on `auth.details.permissions` is not this: the part was still sent.
|
|
83
|
+
`whenRefused: 'notFound'` (with `access` or `accessLevel: 'authenticated'`) keeps even its existence from them — a
|
|
84
|
+
back-office: anybody it is not for is answered the space's 404, as for a path it does not have, and sent nothing of it,
|
|
85
|
+
not its name nor its path (a 401 or 403 tells whoever probes the path that something is there). Not beside
|
|
86
|
+
`unauthorizedRedirect`: a visitor is sent on or answered not found. The builder's "Unauthorized Behaviour".
|
|
82
87
|
|
|
83
88
|
## What a visitor may do
|
|
84
89
|
|
|
@@ -142,7 +142,7 @@ The space is not written until these are fixed.
|
|
|
142
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 |
|
|
143
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 |
|
|
144
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
|
|
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, `navigation` and the state the space paints, `state.<key>`), 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
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 |
|
|
147
147
|
| `setting-misplaced` | `settings.computed` or `settings.channels` written inside `settings` | `computed` and `channels` at the top of the space |
|
|
148
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 |
|
|
@@ -154,8 +154,9 @@ The space is not written until these are fixed.
|
|
|
154
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
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
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-browser-not-kept` | a `browserState` key the space does not keep — transient, or not in `keptState` | keep it, or leave it out of `browserState` |
|
|
157
158
|
| `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 |
|
|
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 |
|
|
159
|
+
| `state-key-list` | `settings.transientState` / `paintedState` / `browserState` that is not a list of top-level state keys | `transientState: ['demoStep']` — a dotted path names its top key |
|
|
159
160
|
| `state-painted-and-transient` | a state key both painted (kept for the server) and transient (never kept) | remove it from one of the two |
|
|
160
161
|
| `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
162
|
| `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` |
|
|
@@ -194,6 +195,7 @@ The space is not written until these are fixed.
|
|
|
194
195
|
| `visibility-as-attribute` | `visibility` bound as an attribute, which no element reads | `visible: { source, template }` |
|
|
195
196
|
| `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'` |
|
|
196
197
|
| `visitor-roles` | `settings.visitorRoles` written in a shape the runtime does not read | the shape the message gives |
|
|
198
|
+
| `when-refused-conflict` | a page's `whenRefused: 'notFound'` beside `unauthorizedRedirect`, or on a page nobody is refused | keep the redirect or the not found; give the page `access` or `accessLevel: 'authenticated'` |
|
|
197
199
|
| `while-running` | `whileRunning` on a step that is not the trigger, or a mode other than `skip`, `parallel`, `queue`, `latest` | `[whileRunning('queue', onClick()), …]` |
|
|
198
200
|
| `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'` |
|
|
199
201
|
|
|
@@ -205,6 +207,7 @@ The space renders, and renders something you probably did not mean. Fix every on
|
|
|
205
207
|
| --- | --- | --- |
|
|
206
208
|
| `action-output-path` | a read of `.data` on a provider fed by a server action — it publishes the action’s output at its root, and `.data` is a `query` provider’s answer | the output’s own field — `apiContainer_feed.stories`, not `apiContainer_feed.data.stories` |
|
|
207
209
|
| `animation-name-unknown` | `animation-name` naming keyframes the space does not declare — nothing plays | declare them in the space's `keyframes`, or name one it has |
|
|
210
|
+
| `browser-state-without-keep-state` | `browserState` without `keepState` — nothing is kept in the first place | `settings.keepState: true`, or remove `browserState` |
|
|
208
211
|
| `click-on-static-element` | a click flow on a container, text, heading, image or list item — no keyboard reaches it | the flow on a `button` (it holds children) or a `link` |
|
|
209
212
|
| `colour-without-dark` | a colour token with no dark value | `{ light, dark, default }` |
|
|
210
213
|
| `condition-starts-visible` | a computed visibility that shows until its data answers | `visible: { source, template }` |
|
|
@@ -223,7 +226,6 @@ The space renders, and renders something you probably did not mean. Fix every on
|
|
|
223
226
|
| `form-control-unnamed` | a control in a form with no `name` — its value never reaches `values` | `formControl({ name: 'email', … })` |
|
|
224
227
|
| `form-value-compared-to-blank` | a `when` comparing a submitted field to `""` — a field nobody typed in is not sent | `operator: 'empty'` / `'notEmpty'` |
|
|
225
228
|
| `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 |
|
|
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
229
|
| `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 |
|
|
228
230
|
| `image-without-alt` | an image that is not `decorative` and has no `alt` | say what it shows, or `decorative: true` |
|
|
229
231
|
| `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 |
|
|
@@ -276,12 +278,13 @@ Nothing is wrong: the page renders as written. Each is a shorter way to the same
|
|
|
276
278
|
| `custom-css-sdk-default` | `customCss` repeating what the SDK already does for every space — less motion when asked, the theme toggle showing one icon | nothing: remove it |
|
|
277
279
|
| `custom-css-slot` | a part of a built-in element dressed in `customCss` by the SDK's markup — a form control's `<input>`, a pager's buttons, a heading inside a markdown | a class on the slot of that part — `slots: { field: input }`, `elements.<type>.slots` — with its states |
|
|
278
280
|
| `element-color-inherited` | `elements` giving a type — a heading, a text, a link — `color: inherit` or the page's own colour, which it takes by itself | remove it, and name the colour once on `elements.page`: every element reads in the page’s colour, a link’s words included |
|
|
281
|
+
| `heading-level-skipped` | an `h4` right after an `h2` on a page as it is drawn — inside its layouts, with the headings a `markdown` writes, and without those that start hidden (`visible: false`): the outline misses a level (Lighthouse: "not in a sequentially-descending order") | the next level down; size it with its class |
|
|
279
282
|
| `heavy-animation` | keyframes animating what the browser repaints or lays out again on every frame — a size, a position, a blur, a shadow, or a colour in a loop — which stutters whenever the page is busy, most of all while it loads | `opacity` and `transform`: a size or a position is `translate`/`scale`, a blur or a shadow is the `opacity` of a layer carrying it; a loop that must animate anything else starts `paused` and runs under `[data-hydrated]` |
|
|
280
283
|
| `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 |
|
|
281
284
|
| `not-found-page` | a space with no page of its own for an address no other page answers — a plain one was added, in the home page’s layout, sent with status 404 | a page whose slug is `'*'`: `{ id: 'not-found', name: 'Not found', slug: '*', layout: …, body: [...] }` |
|
|
282
285
|
| `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 |
|
|
283
286
|
| `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 |
|
|
284
|
-
| `repeated-shape` | the same structure written again and again with different words — cards, rows, tiles
|
|
287
|
+
| `repeated-shape` | the same structure written again and again with different words — cards, rows, tiles. Copies that read their data in a form of their own (their template) or render on the server are no repeats, and neither are copies side by side wired to different sources or state keys — controls written alike; copies apart that read different sources are one component, each instance handed its own | a component with props (`components`, `component(id, { props })`) — a source a copy reads handed in as a bound `json` prop (`component(id, { bind: [{ to: 'items', source }] })`, read inside as `props.items`) — or one `list` when they are rows of data side by side; a few cards a person rewords on the canvas can stay cards |
|
|
285
288
|
| `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 |
|
|
286
289
|
| `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
290
|
| `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/` |
|
|
@@ -48,15 +48,15 @@ same flags, decided on the server. Use the step builders — they fill in where
|
|
|
48
48
|
|
|
49
49
|
Name the trigger (`named('changed', on('onChange'))`) and read its payload as `{{ changed.<field> }}`:
|
|
50
50
|
|
|
51
|
-
| Trigger | Payload
|
|
52
|
-
| ------------------------------------------------------------------------------------------------------ |
|
|
53
|
-
| `onChange` (formControl) | `value` (a boolean for a checkbox or switch), `name`
|
|
54
|
-
| `onSubmit` (form) | `values` (by control `name`), `actionUrl`, `method`
|
|
55
|
-
| `onPageLoad` (page) | `pageId`, `routeParams`, `queryParams`
|
|
56
|
-
| `onApiSuccess` / `onApiError` (apiContainer) | `url`, `method`, `status`, `data`
|
|
57
|
-
| `onModalOpen` / `onModalClose`, `onDialogOpen` / `onDialogClose` / `onDialogAccept` / `onDialogReject` | `metadata` — what `openModal` / `openDialog` was handed
|
|
58
|
-
| `onPageChange` (pagination) | `page`
|
|
59
|
-
| `onThemeChange` (themeToggle) | `theme`
|
|
51
|
+
| Trigger | Payload |
|
|
52
|
+
| ------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------- |
|
|
53
|
+
| `onChange` (formControl) | `value` (a boolean for a checkbox or switch, the `File` for a file), `name` |
|
|
54
|
+
| `onSubmit` (form) | `values` (by control `name`), `actionUrl`, `method` |
|
|
55
|
+
| `onPageLoad` (page) | `pageId`, `routeParams`, `queryParams` |
|
|
56
|
+
| `onApiSuccess` / `onApiError` (apiContainer) | `url`, `method`, `status`, `data` |
|
|
57
|
+
| `onModalOpen` / `onModalClose`, `onDialogOpen` / `onDialogClose` / `onDialogAccept` / `onDialogReject` | `metadata` — what `openModal` / `openDialog` was handed |
|
|
58
|
+
| `onPageChange` (pagination) | `page` |
|
|
59
|
+
| `onThemeChange` (themeToggle) | `theme` |
|
|
60
60
|
|
|
61
61
|
## Reading what came before
|
|
62
62
|
|
|
@@ -34,3 +34,15 @@ settings: { keepState: true, paintedState: ['shapesPick', 'name', 'color'], tran
|
|
|
34
34
|
Only what the first paint shows, and small values: the cookie travels with every request and holds a few kilobytes
|
|
35
35
|
(over that, the page falls back to the defaults and the dev tools say so). Never a secret — a key, a token — and never
|
|
36
36
|
a key that is also in `transientState` (`authorSpace` refuses it).
|
|
37
|
+
|
|
38
|
+
Filed under whoever is signed in, what was kept goes when somebody else signs in — the guest's, too, when they sign
|
|
39
|
+
in. A choice made of the BROWSER rather than of the person — the cookie consent — is then asked again on every change
|
|
40
|
+
of account. List those keys in `browserState`: kept in an entry of their own that signing in, out or as somebody else
|
|
41
|
+
does not take away, and restored without waiting for auth. A key of the browser's is a kept one (`authorSpace` refuses
|
|
42
|
+
one that is transient or not in `keptState`), and may be painted too:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
settings: { keepState: true, paintedState: ['consent'], browserState: ['consent'] }
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Never something that belongs to an account — a workspace, a name: the next person on the browser would be handed it.
|
|
@@ -122,4 +122,10 @@ See recipes/carousel.ts.
|
|
|
122
122
|
A `chart` draws rows too — bars, a line, an area or a donut, SVG of its own: bind `items` as a list's
|
|
123
123
|
(`bindTemplate('items', 'stats.data', '{{ source.days }}', { returns: 'value' })`), name the fields (`labelField`,
|
|
124
124
|
`valueField`) and say what it shows (`label`, read aloud with its rows as a table). It takes the colour of the text
|
|
125
|
-
around it; its parts (`bar`, `line`, `grid`, `axisLabel`…) restyle it.
|
|
125
|
+
around it; its parts (`bar`, `line`, `grid`, `axisLabel`, `tooltip`…) restyle it. Several values a row — a line per
|
|
126
|
+
server — are `series: [{ field, label }]` instead of `valueField`: each in a colour of its own
|
|
127
|
+
(`--plitzi-chart-series-1`…`-8`), with a legend of its last and highest value — a click on it hides or shows that series,
|
|
128
|
+
⌘ or Ctrl + click shows it alone; a row without one is a gap. Pointed at,
|
|
129
|
+
or moved through with the arrow keys, it reads every series at that row — by `titleField` when the axis says less
|
|
130
|
+
(an empty `labelField` is not written there) — and charts with the same `sync` point together, at the row with the same
|
|
131
|
+
title. Never a plugin for a bar chart.
|
|
@@ -58,7 +58,8 @@ const NebulaRun = ({ shipColor = 'amber', best = 0, className }: NebulaRunProps)
|
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
- **Render `RootElement`**, not a `div`: it carries the element's id, classes and `data-plitzi-el`, so the CSS
|
|
61
|
-
authored on the element applies, the builder can select it and a test can find it.
|
|
61
|
+
authored on the element applies, the builder can select it and a test can find it. It is a `div` unless `tag` says
|
|
62
|
+
otherwise — `tag="span"` for an effect inside a line of text, `tag="section"`, `tag="button"`.
|
|
62
63
|
- **Render the same thing on the server and on the first client pass** — a plugin is drawn on the server first. A
|
|
63
64
|
clock, a random number or anything read from `window` belongs in an effect; a hydration mismatch discards the whole
|
|
64
65
|
tree, not the plugin. A preference per device (a tab, muted) is never read from `localStorage` while rendering: write
|
|
@@ -196,7 +197,9 @@ belongs to the editor.
|
|
|
196
197
|
|
|
197
198
|
A plugin's stylesheet ships in a layer below the space's (`plitzi-sdk-plugin`): the space's classes and `customCss`
|
|
198
199
|
win over it whatever their specificity. Write it as
|
|
199
|
-
`.css` files the plugin imports (in the server's head, its tokens seen) — never a CSS string in TypeScript.
|
|
200
|
+
`.css` files the plugin imports (in the server's head, its tokens seen) — never a CSS string in TypeScript. It comes
|
|
201
|
+
with the plugin: linked on the pages that draw it, on no other. A stylesheet several plugins need — a design system's —
|
|
202
|
+
is imported by each that uses it, never by one for the rest: those go unstyled on every page without that one.
|
|
200
203
|
|
|
201
204
|
A file a library needs whole is imported as Vite imports it, and travels inside the bundle: `worker.js?raw` is its
|
|
202
205
|
text (a worker, started from `URL.createObjectURL(new Blob([source]))`), `engine.wasm?inline` a data URI. Images and
|
|
@@ -38,8 +38,7 @@ export const space: SpaceSpec = {
|
|
|
38
38
|
};
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
no browser.
|
|
41
|
+
`plitzi test --unit` runs the element checks alone, no browser.
|
|
43
42
|
|
|
44
43
|
- **Read with the space.** A test the space no longer answers — a page renamed, an element removed, a relation that is
|
|
45
44
|
none — is the warning `test-unreadable` of `lintSpace` and `author`, wherever the space was changed: a `plitzi space
|
|
@@ -55,7 +54,8 @@ no browser.
|
|
|
55
54
|
`settings.visitorRoles` — give; a page for signed-in visitors opens). A role the space removed since is warned. Declared in the tests alone — no real account, no password — so the API answers it as a
|
|
56
55
|
guest: a journey with an account reads and moves, never writes.
|
|
57
56
|
- **A `type` step names the element** — a form control's id — and replaces what the field inside it held; a select is
|
|
58
|
-
chosen from (its option's value or label), a date, a time or a range set whole
|
|
57
|
+
chosen from (its option's value or label), a date, a time or a range set whole, a file field given a real file of the
|
|
58
|
+
kind it names: `e2e.type('photo', 'me.png')`.
|
|
59
59
|
- **A point of an element**: `e2e.click('map', { x: 30, y: 60 })` (and `hover`) lands at that percent of its box — a
|
|
60
60
|
marker a canvas draws has no element of its own. `e2e.scroll(id)` brings it into view; with `{ dx, dy }` its own
|
|
61
61
|
content scrolls.
|