@plitzi/sdk-authoring 0.38.3 → 0.38.4
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 +193 -0
- package/dist/index.d.ts +310 -31
- package/dist/index.js +1604 -436
- package/dist/node.d.ts +8 -0
- package/dist/node.js +28 -1
- package/package.json +6 -6
- package/skills/plitzi-authoring/CHEATSHEET.md +5 -3
- package/skills/plitzi-authoring/SKILL.md +5 -2
- package/skills/plitzi-authoring/recipes/accordion.ts +58 -0
- package/skills/plitzi-authoring/recipes/link-to-a-section.ts +1 -1
- package/skills/plitzi-authoring/recipes/server-data.ts +65 -0
- package/skills/plitzi-authoring/recipes/style-a-page.ts +1 -1
- package/skills/plitzi-authoring/reference/accessibility.md +6 -2
- package/skills/plitzi-authoring/reference/authoring-errors.md +8 -3
- package/skills/plitzi-authoring/reference/colours-and-motion.md +5 -1
- package/skills/plitzi-authoring/reference/data-and-visibility.md +26 -16
- package/skills/plitzi-authoring/reference/efficiency.md +10 -1
- package/skills/plitzi-authoring/reference/elements-and-styles.md +5 -9
- package/skills/plitzi-authoring/reference/lists.md +1 -1
- package/skills/plitzi-authoring/reference/review-checklist.md +14 -2
- package/skills/plitzi-authoring/reference/snippets-and-export.md +2 -2
- package/skills/plitzi-authoring/reference/templates.md +1 -1
- package/skills/plitzi-authoring/reference/testing.md +1 -1
package/dist/node.d.ts
CHANGED
|
@@ -9,6 +9,14 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export declare const compactSvg: (markup: string) => string;
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* What a provider's `query` answers when it is a JSON file the project serves — `/data/plans.json` read from `public/` —
|
|
14
|
+
* for `authorSpace`'s `data`: every binding onto that provider is then held to the file. Anything else — another site,
|
|
15
|
+
* a path with `{{tokens}}`, one that climbs out of the folder, a file that is not there or not JSON — is `undefined`,
|
|
16
|
+
* and left unchecked. Each file is read once.
|
|
17
|
+
*/
|
|
18
|
+
export declare const publicData: (folder: string | URL) => ((query: string) => unknown);
|
|
19
|
+
|
|
12
20
|
/** One SVG file, compacted (`compactSvg`) — what `svg()` takes. Refused, with its path, when it is not an SVG. */
|
|
13
21
|
export declare const svgFile: (file: string | URL) => string;
|
|
14
22
|
|
package/dist/node.js
CHANGED
|
@@ -13,6 +13,8 @@ import { fileURLToPath } from "node:url";
|
|
|
13
13
|
* const logos = svgFiles(new URL('./logos/', import.meta.url)); // { stripe: '<svg…>', shopify: '<svg…>' }
|
|
14
14
|
* svg(logos.stripe, { label: 'Stripe' });
|
|
15
15
|
* svg(svgFile(new URL('./icons/arrow.svg', import.meta.url)));
|
|
16
|
+
*
|
|
17
|
+
* authorSpace(space, { data: publicData(new URL('../public/', import.meta.url)) }); // bindings held to the files
|
|
16
18
|
* ```
|
|
17
19
|
*/
|
|
18
20
|
var pathOf = (where) => where instanceof URL ? fileURLToPath(where) : where;
|
|
@@ -31,5 +33,30 @@ var svgFiles = (folder) => {
|
|
|
31
33
|
const at = pathOf(folder);
|
|
32
34
|
return Object.fromEntries(readdirSync(at).filter((name) => name.toLowerCase().endsWith(".svg")).sort().map((name) => [path.basename(name, path.extname(name)), svgFile(path.join(at, name))]));
|
|
33
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* What a provider's `query` answers when it is a JSON file the project serves — `/data/plans.json` read from `public/` —
|
|
38
|
+
* for `authorSpace`'s `data`: every binding onto that provider is then held to the file. Anything else — another site,
|
|
39
|
+
* a path with `{{tokens}}`, one that climbs out of the folder, a file that is not there or not JSON — is `undefined`,
|
|
40
|
+
* and left unchecked. Each file is read once.
|
|
41
|
+
*/
|
|
42
|
+
var publicData = (folder) => {
|
|
43
|
+
const root = path.resolve(pathOf(folder));
|
|
44
|
+
const read = /* @__PURE__ */ new Map();
|
|
45
|
+
return (query) => {
|
|
46
|
+
if (!query.startsWith("/") || query.startsWith("//") || query.includes("{{")) return;
|
|
47
|
+
const file = path.resolve(root, `.${query.split(/[?#]/)[0]}`);
|
|
48
|
+
if (!file.startsWith(`${root}${path.sep}`)) return;
|
|
49
|
+
if (!read.has(file)) {
|
|
50
|
+
let value;
|
|
51
|
+
try {
|
|
52
|
+
value = JSON.parse(readFileSync(file, "utf-8"));
|
|
53
|
+
} catch {
|
|
54
|
+
value = void 0;
|
|
55
|
+
}
|
|
56
|
+
read.set(file, value);
|
|
57
|
+
}
|
|
58
|
+
return read.get(file);
|
|
59
|
+
};
|
|
60
|
+
};
|
|
34
61
|
//#endregion
|
|
35
|
-
export { compactSvg, svgFile, svgFiles };
|
|
62
|
+
export { compactSvg, publicData, svgFile, svgFiles };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-authoring",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.4",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/index.js",
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@microsoft/api-extractor": "^7.59.3",
|
|
56
56
|
"@plitzi/plitzi-ui": "^1.6.29",
|
|
57
|
-
"@plitzi/sdk-elements": "0.38.
|
|
58
|
-
"@plitzi/sdk-interactions": "0.38.
|
|
59
|
-
"@plitzi/sdk-schema": "0.38.
|
|
60
|
-
"@plitzi/sdk-shared": "0.38.
|
|
61
|
-
"@plitzi/sdk-style": "0.38.
|
|
57
|
+
"@plitzi/sdk-elements": "0.38.4",
|
|
58
|
+
"@plitzi/sdk-interactions": "0.38.4",
|
|
59
|
+
"@plitzi/sdk-schema": "0.38.4",
|
|
60
|
+
"@plitzi/sdk-shared": "0.38.4",
|
|
61
|
+
"@plitzi/sdk-style": "0.38.4",
|
|
62
62
|
"@types/react": "^19.3.0",
|
|
63
63
|
"eslint": "^9.39.5",
|
|
64
64
|
"typescript": "^6.0.3",
|
|
@@ -33,7 +33,7 @@ paragraph('A paragraph.')
|
|
|
33
33
|
container([children], { subType: 'section' }) // div, section, nav, header, footer, main, article, li, h1–h6, span…
|
|
34
34
|
link({ href: 'about', content: 'About' }) // a page id, a '/path', or a URL — the mode follows from the href
|
|
35
35
|
link({ href: 'home', hash: 'plans' }) // → /#plans, onto the element with anchor: 'plans'
|
|
36
|
-
container({ motion: { enter: 'fade-up', on: 'view' }, children }) // arrives as it
|
|
36
|
+
container({ motion: { enter: 'fade-up', on: 'view' }, children }) // arrives once as it comes into view; stagger, loop too
|
|
37
37
|
button({ content: 'Save', flows }) // holds children too: then content: ''
|
|
38
38
|
image({ src, alt }) // or decorative: true
|
|
39
39
|
embed({ src, title }) // a map, a player: another page in a frame
|
|
@@ -45,6 +45,7 @@ list({ id: 'rows', items: 'p.data.rows', row: r => listItem({ children: [text({
|
|
|
45
45
|
carousel({ id: 'hero', items: 'p.data.slides', autoplay: 5000, row: 'slide-card', children: [/* carouselNext('hero') arrows */] })
|
|
46
46
|
// rows follow their item's `id`, or `itemKey: 'slug'`
|
|
47
47
|
apiContainer({ id: 'p', query: '/data/x.json', cache: true, children }) // publishes p.data; no box of its own
|
|
48
|
+
apiContainer({ id: 'p', query: '/data/x.json', runtime: 'server', children }) // read by the page server: still p.data
|
|
48
49
|
// loadingSlot: 'p-skeleton' — a child shown until it answers
|
|
49
50
|
form({ id, managedByInteractions: true, flows, children })
|
|
50
51
|
formControl({ name: 'email', label: 'Email', subType: 'email' }) // select: options: [{ label, value }]
|
|
@@ -64,7 +65,7 @@ container({ id: 'hero', class: [card, { opacity: '0.5' }] }); // …plus one th
|
|
|
64
65
|
container({ css: { padding: '8px' } }); // rules of its own — never with `class`
|
|
65
66
|
```
|
|
66
67
|
|
|
67
|
-
Breakpoints: `desktop` (base), `tablet` (48–64rem), `mobile` (
|
|
68
|
+
Breakpoints: `desktop` (base), `tablet` (48–64rem), `mobile` (≤48rem), `compact` (tablet AND mobile). Each inherits
|
|
68
69
|
from `desktop` alone. States: `hover`, `focus`, `focus-visible`, `active`, `disabled`…. An ancestor's state:
|
|
69
70
|
`ancestors: { [card.name]: { states: { hover: { … } } } }`.
|
|
70
71
|
|
|
@@ -87,7 +88,8 @@ visible: false // hidden until a
|
|
|
87
88
|
|
|
88
89
|
Inside a list row: `rows.item` in a binding, `{{ list_rows.item.x }}` in a template or an attribute,
|
|
89
90
|
`list_rows.index` is a number from 0. A provider's source in a template is `apiContainer_p`… —
|
|
90
|
-
spelled in full, as the element publishes it
|
|
91
|
+
spelled in full, as the element publishes it; an id with a `-` keeps it (`list_study-plans`: a minus takes spaces,
|
|
92
|
+
`a - b`). Globals: `state`, `navigation` (`routeParams`, `queryParams`),
|
|
91
93
|
`auth`, `variables`, `computed`, `flags`, `theme`, `host`.
|
|
92
94
|
|
|
93
95
|
## Flows
|
|
@@ -61,7 +61,7 @@ second into the first. If the MCP asks for a sign-in nobody can give, a project
|
|
|
61
61
|
1. **Name what is referred to.** Give an `id` to every element a binding, a flow or a test addresses. Ids are ONE
|
|
62
62
|
namespace for the whole space — layouts and every page share it — so a helper that runs more than once builds inside
|
|
63
63
|
`scope('promos', ref => …)`: every id in it is prefixed (`promos-panel`), and `ref('slides')` names one in full. An `id` is the element's name in the
|
|
64
|
-
space (`data-
|
|
64
|
+
space (`data-plitzi-el` in the page); the DOM id a URL's `#fragment` lands on is its `anchor`.
|
|
65
65
|
2. **Share with classes, layouts and components, never with copies.** A look used twice is a `styles()` class.
|
|
66
66
|
Chrome shown on several pages — a header, a sidebar, a footer — is a **layout** the pages name, written once. A block
|
|
67
67
|
placed many times with different content — a product card, a testimonial — is a **component** placed with
|
|
@@ -91,11 +91,12 @@ second into the first. If the MCP asks for a sign-in nobody can give, a project
|
|
|
91
91
|
checked from the first commit.
|
|
92
92
|
7. **Times in UTC, and say so.** Format with an explicit zone (`|date('j M · H:i', 'UTC')`) and print "UTC" beside it:
|
|
93
93
|
a page rendered on a server and hydrated in a browser in another zone must agree on the hour.
|
|
94
|
-
8. **Breakpoints are ranges.** `tablet` (48–64rem) and `mobile` (
|
|
94
|
+
8. **Breakpoints are ranges.** `tablet` (48–64rem) and `mobile` (up to 48rem) each inherit only from `desktop`; a rule
|
|
95
95
|
meant for both is written under `compact`.
|
|
96
96
|
9. **Never invent data.** Numbers, names and states on screen come from a source. A panel with nothing true to say is
|
|
97
97
|
an empty state, not a placeholder figure. With no backend, the data is JSON the project serves
|
|
98
98
|
(`public/data/*.json`) read by an `apiContainer` — see [data and visibility](reference/data-and-visibility.md).
|
|
99
|
+
`public/` is public: never a secret there.
|
|
99
100
|
10. **Never hand-write** `flat`, derived ids, `styleSelectors`, `beforeNode`/`afterNode`/`flowId`, or a
|
|
100
101
|
`styleVariant` binding's key — use the factories, `variantFrom` and `activeOn`.
|
|
101
102
|
11. **A switch is named for how it leaves its default.** `toggleState` turns a key nobody has set yet ON, so a key
|
|
@@ -121,6 +122,8 @@ Each is a whole file that authors with no warning — CI holds it to that. Copy
|
|
|
121
122
|
| --- | --- |
|
|
122
123
|
| Show data with no backend: a JSON file, a card per row, a count, an empty state, a computed value | [recipes/show-data.ts](recipes/show-data.ts) |
|
|
123
124
|
| Data typed by a sample of it: completed and checked paths, typed rows | [recipes/typed-data.ts](recipes/typed-data.ts) |
|
|
125
|
+
| Data read by the page server (`--mode server`) | [recipes/server-data.ts](recipes/server-data.ts) |
|
|
126
|
+
| An accordion, one answer open at a time | [recipes/accordion.ts](recipes/accordion.ts) |
|
|
124
127
|
| Filter and sort a list from a select | [recipes/filter-a-list.ts](recipes/filter-a-list.ts) |
|
|
125
128
|
| A page per record (`/products/:slug`), and "not found" | [recipes/detail-page.ts](recipes/detail-page.ts) |
|
|
126
129
|
| Link to a section of a page (`/#plans`) | [recipes/link-to-a-section.ts](recipes/link-to-a-section.ts) |
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An accordion — questions whose answers open one at a time — written once and mapped over the questions: the open one
|
|
3
|
+
* is a key in `state`, and each question reads it the same way. The button says whether its answer is open
|
|
4
|
+
* (`ariaExpanded`) and which panel it opens (`controls`, by the panel's id), so a screen reader follows it; the panel is
|
|
5
|
+
* revealed by the state, so it starts hidden.
|
|
6
|
+
*/
|
|
7
|
+
import { bindTemplate, button, container, onClick, paragraph, setState, styles } from '@plitzi/sdk-authoring';
|
|
8
|
+
|
|
9
|
+
import type { ElementSpec, SpaceSpec } from '@plitzi/sdk-authoring';
|
|
10
|
+
|
|
11
|
+
const QUESTIONS = [
|
|
12
|
+
{ id: 'shipping', question: 'How long does shipping take?', answer: 'Three working days, anywhere in Europe.' },
|
|
13
|
+
{ id: 'returns', question: 'Can I return an order?', answer: 'Within thirty days, unopened, at no cost.' },
|
|
14
|
+
{ id: 'warranty', question: 'Is there a warranty?', answer: 'Two years on every product we sell.' }
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
const question = styles('faq-question', {
|
|
18
|
+
css: {
|
|
19
|
+
display: 'flex',
|
|
20
|
+
'justify-content': 'space-between',
|
|
21
|
+
width: '100%',
|
|
22
|
+
padding: '16px 0px',
|
|
23
|
+
border: 'none',
|
|
24
|
+
'background-color': 'transparent',
|
|
25
|
+
'font-size': '16px',
|
|
26
|
+
'font-weight': '600',
|
|
27
|
+
cursor: 'pointer'
|
|
28
|
+
},
|
|
29
|
+
states: { 'focus-visible': { outline: '2px solid currentColor', 'outline-offset': '2px' } }
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const answer = styles('faq-answer', { 'padding-bottom': '16px', margin: '0px' });
|
|
33
|
+
|
|
34
|
+
/** One question: the button that opens it — closing the one open, or this one again — and the answer it opens. */
|
|
35
|
+
const faqItem = ({ id, question: words, answer: text }: (typeof QUESTIONS)[number]): ElementSpec[] => [
|
|
36
|
+
button({
|
|
37
|
+
id: `${id}-question`,
|
|
38
|
+
content: words,
|
|
39
|
+
class: question,
|
|
40
|
+
// Named by the panel's id: authoring gives the panel the anchor the page needs for `aria-controls`.
|
|
41
|
+
controls: `${id}-answer`,
|
|
42
|
+
ariaExpanded: false,
|
|
43
|
+
bind: [bindTemplate('ariaExpanded', 'state.faq', `{{ source == '${id}' }}`, { returns: 'value' })],
|
|
44
|
+
flows: [[onClick(), setState({ key: 'faq', type: 'text', value: `{{ state.faq == '${id}' ? '' : '${id}' }}` })]]
|
|
45
|
+
}),
|
|
46
|
+
// Revealed by the state, so it starts hidden: nothing flashes open before the page knows which one is.
|
|
47
|
+
container({
|
|
48
|
+
id: `${id}-answer`,
|
|
49
|
+
visible: { source: 'state.faq', template: `{{ source == '${id}' }}` },
|
|
50
|
+
children: [paragraph({ content: text, class: answer })]
|
|
51
|
+
})
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
export const recipe: SpaceSpec = {
|
|
55
|
+
name: 'Questions',
|
|
56
|
+
permanentUrl: 'questions',
|
|
57
|
+
pages: [{ id: 'home', name: 'Home', slug: '', body: QUESTIONS.flatMap(faqItem) }]
|
|
58
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Link to a section: the section carries an `anchor` — its id in the page; an element's `id` is only its name in the
|
|
3
|
-
* space, `data-
|
|
3
|
+
* space, `data-plitzi-el` in the DOM — and a link's `hash` lands on it, from any page, even when the section renders late.
|
|
4
4
|
*/
|
|
5
5
|
import { container, heading, link, text } from '@plitzi/sdk-authoring';
|
|
6
6
|
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data in a server project (`create --mode server`): a JSON file the project serves (`public/data/plans.json`), read
|
|
3
|
+
* by the page server before it answers — so the page arrives with the plans in its HTML, their anchors in place, and
|
|
4
|
+
* nothing to fetch once the browser has it.
|
|
5
|
+
*
|
|
6
|
+
* - `runtime: 'server'` on the provider is the whole switch: server data is on unless a space turns it off.
|
|
7
|
+
* - The answer is read exactly as in the browser — `plans.data.…` — so moving a provider between runtimes changes no
|
|
8
|
+
* binding.
|
|
9
|
+
* - The page server resolves what a page and its layouts hold, never inside a component: the provider stays on the page
|
|
10
|
+
* and each row reaches the card component as a prop.
|
|
11
|
+
* - `mockData` is what the builder shows while editing; the running page always reads the file.
|
|
12
|
+
*/
|
|
13
|
+
import { apiContainer, heading, list, listItem, styles, text } from '@plitzi/sdk-authoring';
|
|
14
|
+
|
|
15
|
+
import type { SpaceSpec } from '@plitzi/sdk-authoring';
|
|
16
|
+
|
|
17
|
+
const grid = styles('plan-grid', {
|
|
18
|
+
display: 'grid',
|
|
19
|
+
'grid-template-columns': 'repeat(auto-fill, minmax(220px, 1fr))',
|
|
20
|
+
gap: '16px',
|
|
21
|
+
margin: '0px',
|
|
22
|
+
padding: '0px'
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const card = styles('plan-card', { padding: '16px', 'border-radius': '12px', 'background-color': 'var(--card)' });
|
|
26
|
+
|
|
27
|
+
export const recipe: SpaceSpec = {
|
|
28
|
+
name: 'Pricing',
|
|
29
|
+
permanentUrl: 'pricing',
|
|
30
|
+
variables: { color: { card: { light: '#ffffff', dark: '#16161d', default: '#ffffff' } } },
|
|
31
|
+
components: [
|
|
32
|
+
{
|
|
33
|
+
id: 'plan-card',
|
|
34
|
+
props: { item: { type: 'json', description: 'The plan: name and price' } },
|
|
35
|
+
// The row of the list: an `<li>` reading the plan it was handed.
|
|
36
|
+
root: listItem({
|
|
37
|
+
id: 'plan-item',
|
|
38
|
+
class: card,
|
|
39
|
+
children: [heading({ subType: 'h3', from: 'props.item.name' }), text({ from: 'props.item.price' })]
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
pages: [
|
|
44
|
+
{
|
|
45
|
+
id: 'home',
|
|
46
|
+
name: 'Home',
|
|
47
|
+
slug: '',
|
|
48
|
+
body: [
|
|
49
|
+
apiContainer({
|
|
50
|
+
id: 'plans',
|
|
51
|
+
query: '/data/plans.json',
|
|
52
|
+
runtime: 'server',
|
|
53
|
+
mockData: { plans: [{ name: 'Starter', price: '$0' }] },
|
|
54
|
+
children: [
|
|
55
|
+
// `plans.data.plans` — the file's `plans` — in either runtime.
|
|
56
|
+
list({ id: 'plan-list', class: grid, items: 'plans.data.plans', row: 'plan-card' }),
|
|
57
|
+
text('No plans yet.', {
|
|
58
|
+
visible: { source: 'plans.data.plans', template: '{{ source is defined and source|length == 0 }}' }
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
};
|
|
@@ -10,7 +10,7 @@ import type { SpaceSpec } from '@plitzi/sdk-authoring';
|
|
|
10
10
|
const card = styles('card', {
|
|
11
11
|
css: {
|
|
12
12
|
desktop: { display: 'flex', 'flex-direction': 'column', gap: '8px', padding: '24px', 'border-radius': '16px' },
|
|
13
|
-
// Tablet (48–64rem) and mobile (
|
|
13
|
+
// Tablet (48–64rem) and mobile (up to 48rem) each inherit from desktop alone: `compact` is both.
|
|
14
14
|
compact: { padding: '16px' }
|
|
15
15
|
},
|
|
16
16
|
states: { hover: { 'border-color': 'var(--primary)' } }
|
|
@@ -4,7 +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
|
-
`heading-level-skipped`, `label-ignored`
|
|
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.
|
|
8
9
|
|
|
9
10
|
## Controls have words
|
|
10
11
|
|
|
@@ -75,7 +76,10 @@ button({ content: 'Grid', bind: { ariaPressed: 'computed.gridOn' }, class: chip
|
|
|
75
76
|
button({ content: 'Menu', bind: { ariaExpanded: 'state.menuOpen' }, flows: [[onClick(), toggleState({ key: 'menuOpen' })]] })
|
|
76
77
|
```
|
|
77
78
|
|
|
78
|
-
An "active" variant is for the eyes. `ariaPressed` and `ariaExpanded` are for everyone else. Use both.
|
|
79
|
+
An "active" variant is for the eyes. `ariaPressed` and `ariaExpanded` are for everyone else. Use both. A button that
|
|
80
|
+
opens a panel also names it — `controls: 'menu-panel'`, the panel's id (authoring gives the panel the anchor
|
|
81
|
+
`aria-controls` needs; [recipes/accordion.ts](../recipes/accordion.ts)). Words that change while somebody is on the page
|
|
82
|
+
— a count, a total, a status — sit in `container({ live: 'polite', … })`, so a screen reader says them when they change.
|
|
79
83
|
|
|
80
84
|
## The page has an outline
|
|
81
85
|
|
|
@@ -59,6 +59,7 @@ The space is not written until these are fixed.
|
|
|
59
59
|
| `computed-not-template` | a computed value that is not a template | `'{{ state.x * 2 }}'` |
|
|
60
60
|
| `computed-reads-element` | a computed value reading an element's source — no element is around the whole space | compute it from the globals and the variables, or bind it on the element |
|
|
61
61
|
| `computed-unknown` | a computed value read before it is declared, or never declared | declare it in `computed`, above the one that reads it |
|
|
62
|
+
| `controls-unknown` | a button's `controls` naming no element of the space | the id of the element it shows and hides: `controls: 'faq-answer'` |
|
|
62
63
|
| `css-property-twice` | one property written twice in a rule set — `paddingTop` beside `'padding-top'` — so one would silently win | keep one |
|
|
63
64
|
| `css-property-unknown` | a CSS property that does not exist | the property it suggests; a custom property starts with `--` |
|
|
64
65
|
| `css-value` | an empty CSS value, or one with `;` or `{}` | one value per property; leave a property out instead of writing it empty |
|
|
@@ -84,7 +85,7 @@ The space is not written until these are fixed.
|
|
|
84
85
|
| `global-callback-undeclared` | a global-callback step builder naming an action no source declares | one of the actions it lists |
|
|
85
86
|
| `id-invalid` | an id a binding, a template or a test cannot name | a letter first, then letters, digits, `-` and `_`: `'hero-title'` |
|
|
86
87
|
| `id-shadows-global` | an element named like a global data source (`state`, `navigation`, `auth`…) | another id |
|
|
87
|
-
| `id-taken` | two elements with one id — ids are one namespace for the whole space |
|
|
88
|
+
| `id-taken` | two elements with one id — ids are one namespace for the whole space | a name taken by a page or a layout: a name of its own; a helper called twice: `scope('promos', ref => …)`, every id inside prefixed |
|
|
88
89
|
| `layout-slot-unknown` | a layout `slot` that is not an element inside that layout | the id of the element in the shell where the body goes |
|
|
89
90
|
| `layout-undeclared` | a page or a layout inside a layout the space does not declare | the layout's id, or declare it in `layouts` |
|
|
90
91
|
| `list-items-ignored` | a list whose items nothing reads — `source: 'none'` renders its children once | `source: 'controlled'` |
|
|
@@ -109,6 +110,7 @@ The space is not written until these are fixed.
|
|
|
109
110
|
| `prop-unknown` | a prop the component does not declare, handed in or read | the prop it suggests, or declare it: `props: { name: { type: 'text' } }` |
|
|
110
111
|
| `prop-value` | a prop handed in with a value its declaration does not take | a value of the declared type, or one of its options |
|
|
111
112
|
| `props-outside-component` | `props.x` read outside a component | read the source it would have come from |
|
|
113
|
+
| `quiet-unknown` | an element's `quiet` naming something that is not a suggestion's code — a problem is never quieted | the code of the suggestion it was offered: `quiet: ['repeated-shape']` |
|
|
112
114
|
| `redirect-target-unknown` | a page that sends visitors it is not for to a page the space does not have | a page's id or slug (`''` is the home page), or a full URL |
|
|
113
115
|
| `row-and-children` | a list with a `row` and `children` — the row is what it renders | one of the two |
|
|
114
116
|
| `row-component` | a list's `row` naming a component the space does not declare, or one with no prop to take the row | a declared component with an `item` prop — or a single prop — for the row |
|
|
@@ -117,6 +119,7 @@ The space is not written until these are fixed.
|
|
|
117
119
|
| `rule-set-mixed` | a style that writes its rules beside `states`, `variants` or `ancestors` instead of under `css` | `{ css: { desktop: { … } }, states: { hover: { … } } }` — the rules under `css`, each of the others beside it |
|
|
118
120
|
| `selector-invalid` | a `selector` that is not a CSS class name | letters, digits, `-` and `_` |
|
|
119
121
|
| `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 |
|
|
122
|
+
| `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 |
|
|
120
123
|
| `setting-misplaced` | `settings.computed` or `settings.channels` written inside `settings` | `computed` and `channels` at the top of the space |
|
|
121
124
|
| `slot-children` | children handed to an instance outside its slots | `children: { slotName: [ … ] }`; a component with no slots takes no children |
|
|
122
125
|
| `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 |
|
|
@@ -161,6 +164,7 @@ The space renders, and renders something you probably did not mean. Fix every on
|
|
|
161
164
|
| `condition-starts-visible` | a computed visibility that shows until its data answers | `visible: { source, template }` |
|
|
162
165
|
| `control-in-decorative` | a control inside a `decorative` container — Tab lands on something nothing announces | move it out of the illustration |
|
|
163
166
|
| `control-without-name` | a button or a link with no words, or a field nothing names | `title` on the button, `label` on the link, `label` (with `hideLabel: true`) on the field |
|
|
167
|
+
| `controls-no-anchor` | a button's `controls` naming no anchor — `aria-controls` points at nothing | an `anchor` on the element it shows and hides, and `controls` naming it |
|
|
164
168
|
| `default-content-beside-children` | a button printing its default "Button" beside its children | `content: ''` |
|
|
165
169
|
| `dropdown-without-control` | a dropdown opened from a box or an icon — no keyboard opens it | a `button` as what opens it (`title` if it is only an icon) |
|
|
166
170
|
| `embed-without-title` | an `embed` with no `title` — a frame a screen reader cannot describe | say what it shows in `title` |
|
|
@@ -178,11 +182,12 @@ The space renders, and renders something you probably did not mean. Fix every on
|
|
|
178
182
|
| `overlay-never-opened` | a modal or a dialog that starts hidden and that no step opens | a flow with `openModal('id')` / `openDialog('id')` |
|
|
179
183
|
| `overlay-starts-open` | a modal or a dialog open when the page loads | `visible: false`, opened by `openModal` |
|
|
180
184
|
| `painted-state-without-keep-state` | `paintedState` without `keepState` — nothing is kept for the server to draw with | `settings.keepState: true`, or remove `paintedState` |
|
|
185
|
+
| `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` |
|
|
181
186
|
| `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`) |
|
|
182
187
|
| `provider-without-source` | an `apiContainer` that asks nothing | a `query` (or `action`, `connector`, `resource`) |
|
|
183
188
|
| `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` |
|
|
184
|
-
| `server-data-without-rsc` | a `runtime: 'server'` provider
|
|
185
|
-
| `span-holds-block` | a `container
|
|
189
|
+
| `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 |
|
|
190
|
+
| `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` |
|
|
186
191
|
| `state-key-has-runtime-prefix` | a state key written with `runtime.state.` in front — the state callbacks already write below it | `key: 'cart'`, not `'runtime.state.cart'` |
|
|
187
192
|
| `state-toggled-in-branches` | two `setState` of one key, each under a `when` on that key — the second flips back what the first wrote | `toggleState({ key })`; for something shown by default, a key named for hiding it |
|
|
188
193
|
| `STYLE_WITHOUT_TAG` | style on a provider that renders no element of its own | `subType: 'div'` on the provider, or style its parent |
|
|
@@ -20,7 +20,9 @@ Only `opacity` and `transform` (`translate`, `scale`, `rotate`) animate off the
|
|
|
20
20
|
the page hydrates and on a slow phone. Everything else repaints, or lays the page out again, on every frame.
|
|
21
21
|
|
|
22
22
|
- **A preset first:** `motion: { enter: 'fade-up', on: 'view' }` on any element, `stagger: 60` for children one by one,
|
|
23
|
-
`loop: 'float'` — played by the SDK, cheap and stilled for reduced motion by construction (motion
|
|
23
|
+
`loop: 'float'` — played by the SDK, cheap and stilled for reduced motion by construction (`npx plitzi explain motion` lists them; `MOTION_ENTERS` and `MOTION_LOOPS` in code).
|
|
24
|
+
`on: 'view'` plays once, the first time the element comes into view, and it stays; `on: 'scroll'` follows the scroll
|
|
25
|
+
both ways — it goes back out as the reader scrolls up past it — so keep it for an effect that is about the scroll.
|
|
24
26
|
|
|
25
27
|
- **Slide, grow, fade** with `transform` and `opacity` — never `left`, `top`, `width`, `height` or `margin`. Something
|
|
26
28
|
that travels across a box is `transform: translate(%)` on an element as large as the box.
|
|
@@ -31,6 +33,8 @@ the page hydrates and on a slow phone. Everything else repaints, or lays the pag
|
|
|
31
33
|
- **Main-thread decoration waits for hydration:** a sweep on a custom property, a `background-position` seam — start
|
|
32
34
|
it paused, run it once the SDK's root says `data-hydrated`:
|
|
33
35
|
`'.glow { animation: glow 8s linear infinite paused; } [data-hydrated] .glow { animation-play-state: running; }'`.
|
|
36
|
+
That is for loops. An entrance of your own that plays once — `transform`/`opacity` only — plays from the first paint
|
|
37
|
+
with `backwards`, as the presets do: gated on `[data-hydrated]` it jumps when the page goes live.
|
|
34
38
|
- **Entrances:** `opacity` + a small `translateY`, under ~600ms, staggered by tens of ms.
|
|
35
39
|
- **One ambient loop per screen**, slow — not one per card. `infinite` runs on every visitor's battery for as long
|
|
36
40
|
as the page is open.
|
|
@@ -50,7 +50,7 @@ text('', { bind: [bindTemplate('content', 'computed.level', 'Level {{ source }}'
|
|
|
50
50
|
|
|
51
51
|
A computed value reads the globals (`state`, `auth`, `navigation`, `variables`, `theme`, `host`) and the ones declared
|
|
52
52
|
above it — not an element's source: bind that on the element. One `{{ expression }}` gives its value (a number, a
|
|
53
|
-
list); anything else gives text. `authorSpace` refuses a name read before it is declared
|
|
53
|
+
list); anything else gives text. `authorSpace` refuses a name read before it is declared.
|
|
54
54
|
|
|
55
55
|
## Providers
|
|
56
56
|
|
|
@@ -61,12 +61,16 @@ apiContainer({ id: 'board', runtime: 'server', action: 'queue-board' })
|
|
|
61
61
|
|
|
62
62
|
- A provider's source is readable by its **descendants** only. Wrap what reads it; a sibling cannot see it.
|
|
63
63
|
- It publishes `data` plus `isLoading`, `isEmpty`, `hasError`, `errorMessage` — bind a state to those, not to guesses.
|
|
64
|
+
A `query`'s body is `data` in **either runtime** (`p.data.plans`), so moving a provider to the server changes no
|
|
65
|
+
binding. A connector publishes `records` (or `record`), an action its output.
|
|
64
66
|
`isEmpty` reads what arrived: a `query`'s body when it is missing, `null`, `''`, `[]` or `{}`; a connector list by
|
|
65
67
|
its `records`; a `singleRecord` provider by its `record`. It is also true before the first answer, so pair it with
|
|
66
68
|
`not isLoading` for an empty state.
|
|
67
69
|
- A query that depends on state is a binding on `query`; it answers `''` (and fetches nothing) until the state exists:
|
|
68
70
|
`"{{ source ? apiUrl ~ '/workspaces/' ~ source ~ '/stats' : '' }}"` with `source: 'state.workspace.id'`.
|
|
69
|
-
-
|
|
71
|
+
- `runtime: 'server'` is resolved by the page server — server data is on unless a space says `rsc: { enabled: false }`.
|
|
72
|
+
Only a page and its layouts are resolved — never inside a component: keep the provider on the page and hand the
|
|
73
|
+
component its rows as a prop ([recipes/server-data.ts](../recipes/server-data.ts)).
|
|
70
74
|
|
|
71
75
|
### Typed by a sample
|
|
72
76
|
|
|
@@ -81,11 +85,15 @@ An offline project (`offlineMode`) still never invents data: the content lives i
|
|
|
81
85
|
backend, so swapping the file for a real endpoint later changes one `query`. `mockData` is what the BUILDER shows while
|
|
82
86
|
editing; it is not a data source for the running page. Say on the page that demo content is demo content.
|
|
83
87
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
**`public/` is on the internet.** Every file in it is served to anyone who asks, as it is, once the project is deployed —
|
|
89
|
+
and so is everything the space's documents hold (pages, variables, attributes, `mockData`): they reach every visitor's
|
|
90
|
+
browser. Never put a secret, a key, a private document or data only some visitors may read in either. A secret is a
|
|
91
|
+
credential that an action or a connector names; data for some visitors only comes from a server action whose `access`
|
|
92
|
+
checks who is asking, or a `runtime: 'server'` provider behind one.
|
|
93
|
+
|
|
94
|
+
**In a server project (`create --mode server`), put the provider on the server** — `runtime: 'server'` — and the page
|
|
95
|
+
server reads the file from `public/` itself: the page arrives with those sections (and their anchors) in it. A `query`
|
|
96
|
+
with `{{tokens}}` is still read in the browser, against the visitor's route and state.
|
|
89
97
|
|
|
90
98
|
### Live, cached, refreshed
|
|
91
99
|
|
|
@@ -116,7 +124,7 @@ modalContainer({ visible: false, … }) // starts hidden; a flow opens
|
|
|
116
124
|
| The logic… | Example | Write |
|
|
117
125
|
| --- | --- | --- |
|
|
118
126
|
| reveals it: hidden until the data says so | empty state, "get started", admin-only panel, error note | `visible: 'src'`, or `visible: false` + a computed binding |
|
|
119
|
-
| hides it: shown unless a flag says otherwise | sidebar labels until the sidebar is folded, a banner until dismissed |
|
|
127
|
+
| hides it: shown unless a flag says otherwise | sidebar labels until the sidebar is folded, a banner until dismissed | `visible: '!state.folded'` — on screen while nobody has set it |
|
|
120
128
|
|
|
121
129
|
`visible` starts the element **hidden**, and it appears when its data says so. A revealing condition you have to
|
|
122
130
|
compute is `visible: { source, template }` — it starts hidden too, and the template's value is read as a yes or a
|
|
@@ -135,17 +143,19 @@ container({
|
|
|
135
143
|
|
|
136
144
|
Rules for a condition's template:
|
|
137
145
|
|
|
138
|
-
- **A
|
|
139
|
-
|
|
140
|
-
condition on data. `authorSpace` warns `condition-starts-visible` when a computed one on a provider starts on screen.
|
|
146
|
+
- **A visibility binding written by hand in `bind` keeps the element on screen until it answers** — a flash for a
|
|
147
|
+
condition on data (`condition-starts-visible` warns); `visible` starts it hidden.
|
|
141
148
|
- **A hidden element stays in the DOM** (`plitzi-component--hidden`), its subtree mounted. `loadStrategy: 'visible'`
|
|
142
149
|
mounts the subtree only while it is shown, and `'lazy'` from the first time it is shown (modals do that already).
|
|
143
150
|
Use it on heavy panels that are usually hidden; leave the default on what is usually on screen.
|
|
144
|
-
-
|
|
145
|
-
|
|
146
|
-
- **
|
|
147
|
-
|
|
148
|
-
|
|
151
|
+
- **Once its source has a value, the answer is a yes or a no**: `false`, `0`, `''` and an empty list hide it,
|
|
152
|
+
anything else shows it.
|
|
153
|
+
- **While its source has no value, only a definite answer is written.** `!source` is `true` — shown; a template's
|
|
154
|
+
`'true'` or `'false'` is written as it says. A plain source, or a template that answers nothing (`''`), writes
|
|
155
|
+
nothing: the element stays as it started — hidden for `visible`, shown for a binding written by hand.
|
|
156
|
+
- **So a hiding flag is `visible: '!state.folded'`** (or a binding with no `visible`): on screen before anybody has set
|
|
157
|
+
it. A condition that answers "not known yet" with `'false'` from a value that IS there — a "folded" read off
|
|
158
|
+
something always set — hid every label of a sidebar for everybody.
|
|
149
159
|
- **Hide the element itself.** Never wrap it in a container that is shown while the inner one is hidden: an empty
|
|
150
160
|
visible wrapper still takes a slot in its parent's `gap`, and leaves a hole in the page.
|
|
151
161
|
|
|
@@ -19,6 +19,15 @@ const { warnings, suggestions } = authorSpace(space);
|
|
|
19
19
|
is a bug to fix; a suggestion is a shorter way to the same page — take it unless you have a reason not to, and the
|
|
20
20
|
reason is usually that the copies are about to diverge. `npx @plitzi/cli explain repeated-on-pages` explains any code.
|
|
21
21
|
|
|
22
|
+
Left on purpose, say so where it is written — `quiet` on an element it is about, and it is not offered again, in the
|
|
23
|
+
builder or over MCP either (it is kept in the document):
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
const includes = (words: string) => container({ class: row, quiet: ['repeated-shape'], children: [tick, text(words)] });
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Only a suggestion's code: a problem is never quieted (`quiet-unknown`).
|
|
30
|
+
|
|
22
31
|
## The long way, and the short one
|
|
23
32
|
|
|
24
33
|
| Written the long way | The short way | Suggestion |
|
|
@@ -26,7 +35,7 @@ reason is usually that the copies are about to diverge. `npx @plitzi/cli explain
|
|
|
26
35
|
| The same header, footer or sidebar in every page | A **layout** holding it once; each page names it (`layout: { id, slot }`) — [layouts](layouts.md) | `repeated-on-pages` |
|
|
27
36
|
| A header copied per page so one link can be styled "active" | The link marks its own page: `states: { current: { … } }` on its class; `activeOn` for an entry lit on several pages | `repeated-on-pages` |
|
|
28
37
|
| The same card, row or tile written again with other words | A **component** with props, placed with `component(id, { props })` — [components](components.md) | `repeated-shape` |
|
|
29
|
-
| Rows of data written one by one, side by side | One `list` over the rows — `items: [ … ]` fixed, or bound to a source — with its row written once — [lists](lists.md). Data is the test: three cards a person rewords on the canvas read better as three cards | `repeated-shape` |
|
|
38
|
+
| Rows of data written one by one, side by side | One `list` over the rows — `items: [ … ]` fixed, or bound to a source — with its row written once — [lists](lists.md). Data is the test: three cards a person rewords on the canvas read better as three cards. Copies that read different sources or write different state keys are controls written alike, and not offered | `repeated-shape` |
|
|
30
39
|
| `button({ children: [text('Save')] })`, `link({ children: [text('Docs'), fontAwesome({ icon })] })` | `button({ content: 'Save' })`, `link({ href, content: 'Docs', icon, iconPlacement: 'after' })` — the icon's class on the `icon` slot; what the text's class adds (`whiteSpace: 'nowrap'`) moves to the box's class — never the class itself, whose `inherit` would then point past the box and whose `pointerEvents: 'none'` would switch the box off | `content-attribute` |
|
|
31
40
|
| `.card:hover { … }`, `.card .icon { … }` in `customCss` | The class's own `states` and `ancestors` | `custom-css-class` |
|
|
32
41
|
| A reduced-motion reset, or rules showing one icon of the theme toggle, in `customCss` | Nothing: the SDK does both for every space | `custom-css-sdk-default` |
|
|
@@ -25,7 +25,7 @@ container([hero, grid]) // an array is the children
|
|
|
25
25
|
| `visible` | a condition (`'src'`, `'!src'`, `{ source, template }`), or `false` to start hidden |
|
|
26
26
|
| `flows` | what happens on click, on submit, on load |
|
|
27
27
|
| `runtime` | `'server'` resolves this provider's data on the server |
|
|
28
|
-
| `loadStrategy` | when the contents mount relative to visibility: `eager`
|
|
28
|
+
| `loadStrategy` | when the contents mount relative to visibility: `eager`, `lazy`, `visible`. Left out, the type decides — `eager`, `lazy` for a modal or a dialog |
|
|
29
29
|
| `children` | the tree |
|
|
30
30
|
| `meta` | `meta.label` is the element's name in the builder's tree |
|
|
31
31
|
|
|
@@ -44,7 +44,7 @@ another link — make the card the link, or the button, not both.
|
|
|
44
44
|
link to the page being shown is `aria-current="page"`; its class's `current` state styles it, so one header in a
|
|
45
45
|
layout lights the right item everywhere.
|
|
46
46
|
|
|
47
|
-
**An element's `id` is not its HTML id.** It reaches the DOM as `data-
|
|
47
|
+
**An element's `id` is not its HTML id.** It reaches the DOM as `data-plitzi-el`. For a section a URL can land on, give it
|
|
48
48
|
an `anchor` (`anchor: 'plans'` → `id="plans"`: lowercase, digits, `-`) and link to it with `hash`:
|
|
49
49
|
`link({ href: 'home', hash: 'plans' })` goes to `/#plans` and scrolls there, waiting for a section that renders once
|
|
50
50
|
its data arrives. One anchor per page, layouts included; never inside a list row or a component, which would repeat
|
|
@@ -78,12 +78,8 @@ A type this SDK does not ship — a plugin — is authored the same way: `define
|
|
|
78
78
|
|
|
79
79
|
**What a type takes, answered by the package** instead of the 7,000-line `.d.ts`: every catalogue is exported, keyed by
|
|
80
80
|
type — `elementCatalog` (what it is for), `elementDefaultAttributes`, `elementAttributeNames`, `elementTriggers`,
|
|
81
|
-
`elementCallbacks`, `elementSlots`, `elementSourceTypes`, `elementLeafTypes`, plus `BUILTIN_TRANSFORMERS
|
|
82
|
-
prints
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
node --input-type=module -e "import * as a from '@plitzi/sdk-authoring'; const t = 'formControl'; console.log({ attributes: a.elementDefaultAttributes[t], triggers: a.elementTriggers[t], slots: a.elementSlots[t] })"
|
|
86
|
-
```
|
|
81
|
+
`elementCallbacks`, `elementSlots`, `elementSourceTypes`, `elementLeafTypes`, plus `BUILTIN_TRANSFORMERS` — and
|
|
82
|
+
`npx @plitzi/cli explain formControl` prints them for one type.
|
|
87
83
|
|
|
88
84
|
## CSS
|
|
89
85
|
|
|
@@ -92,7 +88,7 @@ kebab-case or camelCase (`paddingTop`, as a React style object), and a bare numb
|
|
|
92
88
|
`fontWeight: 800`, `opacity: 0.5` stay numbers). A property outside the vocabulary is refused.
|
|
93
89
|
|
|
94
90
|
- `column(gap, extra?)`, `row(gap, extra?)`, `grid(columns, gap, extra?)` for the three layouts every space repeats.
|
|
95
|
-
- **Breakpoints are ranges, not a cascade.** `tablet` is 48–64rem, `mobile`
|
|
91
|
+
- **Breakpoints are ranges, not a cascade.** `tablet` is 48–64rem, `mobile` up to 48rem, and each inherits only from
|
|
96
92
|
`desktop` — a rule for `tablet` never reaches a phone (`authorSpace` warns `tablet-rule-skips-mobile`). A rule for
|
|
97
93
|
everything narrower than a desktop is `compact`, written to both: `css: { desktop: { … }, compact: { 'grid-template-columns':
|
|
98
94
|
'1fr' }, mobile: { gap: '8px' } }` — what `tablet` or `mobile` say for themselves wins.
|
|
@@ -12,7 +12,7 @@ list({ id: 'games', items: 'catalog.data.games', row: r => listItem({ children:
|
|
|
12
12
|
list({ id: 'plans', items: ['Free', 'Pro'], children: [listItem({ children: [text({ from: 'plans.item' })] })] }) // fixed
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
`items` makes a list controlled: an array of its own, or the source its rows come from. `row` is what it renders once
|
|
15
|
+
`items` (or `from`) makes a list controlled: an array of its own, or the source its rows come from. `row` is what it renders once
|
|
16
16
|
per item — a component's id (placed with the row bound to its `item` prop, or its only prop), or a function handed the
|
|
17
17
|
row's names: `r.item` and `r.index` for a binding or `from`, `r.inTemplate.item` for a template
|
|
18
18
|
(`` `/games/{{ ${r.inTemplate.item}.slug }}` ``). A function needs the list's `id`, which names those sources. With
|
|
@@ -7,7 +7,8 @@ of it; each line is something that has shipped broken before.
|
|
|
7
7
|
|
|
8
8
|
- [ ] `authorSpace` returns **zero warnings**. Each one is written code that will not do what it says.
|
|
9
9
|
- [ ] Every **suggestion** is taken, or left for a reason you can say (the copies are about to diverge; three cards a
|
|
10
|
-
person rewords on the canvas)
|
|
10
|
+
person rewords on the canvas) — and then quieted where it is written, `quiet: ['repeated-shape']`, so it stops
|
|
11
|
+
burying the ones that matter. The ones your change opened up first — [efficiency.md](efficiency.md).
|
|
11
12
|
- [ ] No console errors on any page you touched.
|
|
12
13
|
|
|
13
14
|
## Nothing flashes, nothing jumps
|
|
@@ -39,7 +40,8 @@ Screen readers and browser agents (Claude in Chrome) work a page through its acc
|
|
|
39
40
|
a `label` (`hideLabel: true` when the design shows what it is).
|
|
40
41
|
- [ ] Every image has an `alt` saying what it shows, or `decorative: true`.
|
|
41
42
|
- [ ] Every click is on a `button` or a `link`; the whole page can be worked from the keyboard.
|
|
42
|
-
- [ ] A toggle binds `ariaPressed`, a button that opens something `ariaExpanded
|
|
43
|
+
- [ ] A toggle binds `ariaPressed`, a button that opens something `ariaExpanded` and names it with `controls`; words
|
|
44
|
+
that change on their own are in a `live` container.
|
|
43
45
|
- [ ] Headings step down one level at a time; parts of the page a person jumps to are landmarks (`nav`, `main`, a
|
|
44
46
|
labelled `section`).
|
|
45
47
|
- [ ] What a canvas or a plugin draws is also there as elements, with a visible way to reach them.
|
|
@@ -66,6 +68,16 @@ Screen readers and browser agents (Claude in Chrome) work a page through its acc
|
|
|
66
68
|
- [ ] What only an administrator may read is shown only to administrators — and the check is a real boolean, not
|
|
67
69
|
a template left as text.
|
|
68
70
|
|
|
71
|
+
## Nothing left behind
|
|
72
|
+
|
|
73
|
+
- [ ] Nothing you made and no longer use is still there — a page, a component, a class, a token, a data file, an
|
|
74
|
+
import, a plugin folder. No commented-out code, no debug `console.log`, no copy of a file kept "just in case".
|
|
75
|
+
- [ ] Scratch work — a one-off script, a dump, a picture to look at — went in `tmp/` (never committed) and is gone from
|
|
76
|
+
everywhere else.
|
|
77
|
+
- [ ] Nothing secret, and nothing only some visitors may read, is in `public/` or in the space's documents: both reach
|
|
78
|
+
every visitor.
|
|
79
|
+
- [ ] `typecheck`, `lint` and `format` are clean.
|
|
80
|
+
|
|
69
81
|
## Proven
|
|
70
82
|
|
|
71
83
|
- [ ] You looked at it: the visual check ran, on the pages you changed, in both themes.
|