@plitzi/sdk-authoring 0.39.1 → 0.39.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-authoring",
3
- "version": "0.39.1",
3
+ "version": "0.39.3",
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.59.4",
69
- "@plitzi/plitzi-ui": "^1.6.36",
70
- "@plitzi/sdk-elements": "0.39.1",
71
- "@plitzi/sdk-interactions": "0.39.1",
72
- "@plitzi/sdk-schema": "0.39.1",
73
- "@plitzi/sdk-shared": "0.39.1",
74
- "@plitzi/sdk-style": "0.39.1",
68
+ "@microsoft/api-extractor": "^7.60.1",
69
+ "@plitzi/plitzi-ui": "^1.6.38",
70
+ "@plitzi/sdk-elements": "0.39.3",
71
+ "@plitzi/sdk-interactions": "0.39.3",
72
+ "@plitzi/sdk-schema": "0.39.3",
73
+ "@plitzi/sdk-shared": "0.39.3",
74
+ "@plitzi/sdk-style": "0.39.3",
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.4",
79
+ "vite": "^8.3.7",
80
80
  "vite-plugin-dts": "^5.1.2",
81
- "vitest": "^5.0.5"
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`, `heading-level-skipped`, `label-ignored`, `control-in-decorative`, `embed-without-title`,
8
- `controls-no-anchor`). Fix them the same way you fix any other warning.
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
 
@@ -95,6 +95,10 @@ goes down into them — Tab alone took a stop per result.
95
95
  ## The page has an outline
96
96
 
97
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".
98
102
  - Landmarks are containers with a tag: `header`, `nav`, `main`, `aside`, `footer`. When a page has two of one kind,
99
103
  give each a `label`: `container({ subType: 'nav', label: 'Docs sections' })`. A `section` with a `label` becomes a
100
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=`. A `public` sign-in with `unauthorizedRedirect` sends whoever signs in on it there
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 and `navigation`), the visitor's cookies (`credentials: 'include'`), another method than GET, or neither an address (`https://…`) nor a path (`/…`) — so it draws empty | write it over the space's variables and `navigation` (`'{{ apiUrl }}/posts/{{ navigation.routeParams.id }}'`); an `action` for what the browser holds; or no `runtime: 'server'`, and the browser asks it |
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 |
@@ -195,6 +195,7 @@ The space is not written until these are fixed.
195
195
  | `visibility-as-attribute` | `visibility` bound as an attribute, which no element reads | `visible: { source, template }` |
196
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'` |
197
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'` |
198
199
  | `while-running` | `whileRunning` on a step that is not the trigger, or a mode other than `skip`, `parallel`, `queue`, `latest` | `[whileRunning('queue', onClick()), …]` |
199
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'` |
200
201
 
@@ -225,7 +226,6 @@ The space renders, and renders something you probably did not mean. Fix every on
225
226
  | `form-control-unnamed` | a control in a form with no `name` — its value never reaches `values` | `formControl({ name: 'email', … })` |
226
227
  | `form-value-compared-to-blank` | a `when` comparing a submitted field to `""` — a field nobody typed in is not sent | `operator: 'empty'` / `'notEmpty'` |
227
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 |
228
- | `heading-level-skipped` | an `h4` right after an `h2` — the outline misses a level | the next level down; size it with its class |
229
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 |
230
230
  | `image-without-alt` | an image that is not `decorative` and has no `alt` | say what it shows, or `decorative: true` |
231
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 |
@@ -278,6 +278,7 @@ Nothing is wrong: the page renders as written. Each is a shorter way to the same
278
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 |
279
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 |
280
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 |
281
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]` |
282
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 |
283
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: [...] }` |
@@ -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. Never a plugin for a bar chart.
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.