@plitzi/sdk-authoring 0.38.8 → 0.38.10
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 +143 -0
- package/dist/index-src.js +1083 -642
- package/dist/index.d.ts +131 -51
- package/dist/index.js +2 -2
- package/dist/node.d.ts +46 -0
- package/dist/node.js +10 -0
- package/package.json +6 -6
- package/skills/plitzi-authoring/CHEATSHEET.md +1 -1
- package/skills/plitzi-authoring/recipes/detail-page.ts +4 -2
- package/skills/plitzi-authoring/recipes/filter-a-list.ts +0 -2
- package/skills/plitzi-authoring/recipes/forms-and-modals.ts +2 -1
- package/skills/plitzi-authoring/reference/accessibility.md +2 -0
- package/skills/plitzi-authoring/reference/authoring-errors.md +6 -0
- package/skills/plitzi-authoring/reference/flows.md +2 -2
- package/skills/plitzi-authoring/reference/layouts.md +20 -0
- package/skills/plitzi-authoring/reference/recipes.md +1 -1
- package/skills/plitzi-authoring/reference/structure.md +3 -1
package/dist/node.d.ts
CHANGED
|
@@ -140,6 +140,11 @@ declare const AUTHORING_CODES: {
|
|
|
140
140
|
readonly means: "a page that sends visitors it is not for to a page the space does not have";
|
|
141
141
|
readonly fix: "a page's id or slug (`''` is the home page), or a full URL";
|
|
142
142
|
};
|
|
143
|
+
readonly 'page-template': {
|
|
144
|
+
readonly kind: "refused";
|
|
145
|
+
readonly means: "a template in a page's `seoTitle`, `seoDescription` or `notFound` that reads what is not there when the server answers — anything but the page's `runtime: 'server'` providers and `navigation` — or cannot be read";
|
|
146
|
+
readonly fix: "read the record from a provider with `runtime: 'server'` on the page or its layout — `'{{ apiContainer_post.title }} — Blog'` — or words of its own";
|
|
147
|
+
};
|
|
143
148
|
readonly 'folder-undeclared': {
|
|
144
149
|
readonly kind: "refused";
|
|
145
150
|
readonly means: "a page, a layout or a folder filed in a folder the space does not declare";
|
|
@@ -315,6 +320,11 @@ declare const AUTHORING_CODES: {
|
|
|
315
320
|
readonly means: "an ancestor condition keyed by something that is neither a class name nor `'>'` (the parent)";
|
|
316
321
|
readonly fix: "`[card.name]` for a `styles()` declaration, or `'>'` for the parent whatever it wears";
|
|
317
322
|
};
|
|
323
|
+
readonly 'focus-on-field-box': {
|
|
324
|
+
readonly kind: "warned";
|
|
325
|
+
readonly means: "a `focus` or `focus-visible` state on a text field's or a select's `input` slot — the box the field is drawn in, which never takes focus, so no ring is ever shown";
|
|
326
|
+
readonly fix: "`'focus-within'` on the same class, or the state on the `field` slot";
|
|
327
|
+
};
|
|
318
328
|
readonly 'heading-level-overridden': {
|
|
319
329
|
readonly kind: "warned";
|
|
320
330
|
readonly means: "a markdown's or richText's `heading` slot and a level's (`heading3`) both setting one property, the general class written later in the stylesheet — the level's value is lost";
|
|
@@ -545,6 +555,16 @@ declare const AUTHORING_CODES: {
|
|
|
545
555
|
readonly means: "a `runtime: 'server'` element inside a component: the page server resolves a page's and its layouts', never a component's";
|
|
546
556
|
readonly fix: "put the provider on the page, around the instance, and hand the component its rows as a prop";
|
|
547
557
|
};
|
|
558
|
+
readonly 'not-found-in-browser': {
|
|
559
|
+
readonly kind: "refused";
|
|
560
|
+
readonly means: "`notFound` on a provider asked from the browser — its answer arrives after the page was sent with its status";
|
|
561
|
+
readonly fix: "`runtime: 'server'` on the provider, or `visible` on the page's \"not found\" part instead";
|
|
562
|
+
};
|
|
563
|
+
readonly 'not-found-not-a-template': {
|
|
564
|
+
readonly kind: "refused";
|
|
565
|
+
readonly means: "`notFound`, a provider's or a page's, that is not one `{{ expression }}` — never `true`, so never a 404";
|
|
566
|
+
readonly fix: "`notFound: '{{ source.found == false }}'`";
|
|
567
|
+
};
|
|
548
568
|
readonly 'server-data-in-browser': {
|
|
549
569
|
readonly kind: "refused";
|
|
550
570
|
readonly means: "a provider asking for the project's own data (`/data/…`, read by its server from `src/data/` and never served) from the browser";
|
|
@@ -565,6 +585,11 @@ declare const AUTHORING_CODES: {
|
|
|
565
585
|
readonly means: "a control in a form with no `name` — its value never reaches `values`";
|
|
566
586
|
readonly fix: "`formControl({ name: 'email', … })`";
|
|
567
587
|
};
|
|
588
|
+
readonly 'required-message-unused': {
|
|
589
|
+
readonly kind: "warned";
|
|
590
|
+
readonly means: "a `requiredMessage` on a field nothing requires — fields are optional unless `required: true`, so it is never shown and an empty answer is sent";
|
|
591
|
+
readonly fix: "`required: true` on the field, or no message";
|
|
592
|
+
};
|
|
568
593
|
readonly 'form-control-name-taken': {
|
|
569
594
|
readonly kind: "warned";
|
|
570
595
|
readonly means: "two controls in one form with one name — one overwrites the other";
|
|
@@ -1030,6 +1055,11 @@ declare const AUTHORING_CODES: {
|
|
|
1030
1055
|
readonly means: "a colour written out in a class where the space has a token of that value — it stays put in the dark scheme";
|
|
1031
1056
|
readonly fix: "`var(--token)` when it should follow the scheme; a token of one value of its own when it must stay the same in both";
|
|
1032
1057
|
};
|
|
1058
|
+
readonly 'not-found-page': {
|
|
1059
|
+
readonly kind: "suggested";
|
|
1060
|
+
readonly means: "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";
|
|
1061
|
+
readonly fix: "a page whose slug is `'*'`: `{ id: 'not-found', name: 'Not found', slug: '*', layout: …, body: [...] }`";
|
|
1062
|
+
};
|
|
1033
1063
|
readonly 'unused-component': {
|
|
1034
1064
|
readonly kind: "suggested";
|
|
1035
1065
|
readonly means: "a component no page, layout or other component places";
|
|
@@ -1848,8 +1878,20 @@ declare interface PageSpec {
|
|
|
1848
1878
|
/** Route, without a leading slash. Empty is the home page. */
|
|
1849
1879
|
slug: string;
|
|
1850
1880
|
isDefault?: boolean;
|
|
1881
|
+
/**
|
|
1882
|
+
* The page's title and description in the head, for search engines and link previews. Either may be a template over
|
|
1883
|
+
* the page's server providers (`runtime: 'server'`, its layouts' too) and `navigation` — `'{{ apiContainer_post.title
|
|
1884
|
+
* }} — Blog'` — which the server evaluates as it writes the head.
|
|
1885
|
+
*/
|
|
1851
1886
|
seoTitle?: string;
|
|
1852
1887
|
seoDescription?: string;
|
|
1888
|
+
/**
|
|
1889
|
+
* One expression over the same answers that says this address shows nothing — a record that is not there: the page is
|
|
1890
|
+
* sent with status 404, rendered as written. For a record read by a provider the page shares with others, in its
|
|
1891
|
+
* layout, whose own `notFound` cannot say it for one page: `'{{ not (apiContainer_feed.topics|find('slug',
|
|
1892
|
+
* navigation.routeParams.slug)) }}'`.
|
|
1893
|
+
*/
|
|
1894
|
+
notFound?: string;
|
|
1853
1895
|
/**
|
|
1854
1896
|
* Who this page is FOR, and the trap is that omitting it is not the same as `public`.
|
|
1855
1897
|
*
|
|
@@ -1940,6 +1982,7 @@ export declare const pluginDeclarations: (folder: string | URL) => Promise<Plugi
|
|
|
1940
1982
|
export declare type ProjectAuthoring = {
|
|
1941
1983
|
plugins: PluginDeclarationData[];
|
|
1942
1984
|
pluginTypes: string[];
|
|
1985
|
+
stylesheets: string[];
|
|
1943
1986
|
serverData?: (query: string) => unknown;
|
|
1944
1987
|
data: (query: string) => unknown;
|
|
1945
1988
|
};
|
|
@@ -1950,6 +1993,7 @@ export declare type ProjectAuthoring = {
|
|
|
1950
1993
|
*
|
|
1951
1994
|
* - `plugins`: every plugin folder's declaration (`src/plugins/<Name>/declaration.ts`, `pluginDeclarations`);
|
|
1952
1995
|
* - `pluginTypes`: the element types of the plugins it runs as they were built (`vendor/plugins/`);
|
|
1996
|
+
* - `stylesheets`: its plugins' own CSS, every `.css` under `src/plugins/`, for the tokens they read;
|
|
1953
1997
|
* - `serverData`: the project's own data, which only its server reads (`src/data/`, `projectData`) — a server-mode
|
|
1954
1998
|
* project's; one with no server has no such folder, and its providers read `public/data/` from the browser;
|
|
1955
1999
|
* - `data`: the JSON files it serves (`public/`, `publicData`).
|
|
@@ -2741,6 +2785,8 @@ declare const styleConstants: {
|
|
|
2741
2785
|
readonly TEXT_INDENT: "text-indent";
|
|
2742
2786
|
readonly TEXT_TRANSFORM: "text-transform";
|
|
2743
2787
|
readonly DIRECTION: "direction";
|
|
2788
|
+
readonly WRITING_MODE: "writing-mode";
|
|
2789
|
+
readonly TEXT_ORIENTATION: "text-orientation";
|
|
2744
2790
|
readonly WHITE_SPACE: "white-space";
|
|
2745
2791
|
readonly TEXT_WRAP: "text-wrap";
|
|
2746
2792
|
readonly WORD_BREAK: "word-break";
|
package/dist/node.js
CHANGED
|
@@ -575,11 +575,20 @@ var builtPluginTypes = (folder) => existsSync(folder) ? readdirSync(folder, { wi
|
|
|
575
575
|
return [entry.name, ...e(pluginSchema) ? Object.keys(pluginSchema) : []];
|
|
576
576
|
}) : [];
|
|
577
577
|
/**
|
|
578
|
+
* The stylesheets of the plugins under `folder` — every `.css` in a plugin's folder, at any depth — as their text, for
|
|
579
|
+
* `authorSpace`'s `stylesheets`: the tokens a plugin's own CSS reads are tokens the space uses.
|
|
580
|
+
*/
|
|
581
|
+
var pluginStylesheets = (folder) => existsSync(folder) ? readdirSync(folder, {
|
|
582
|
+
recursive: true,
|
|
583
|
+
withFileTypes: true
|
|
584
|
+
}).filter((entry) => entry.isFile() && entry.name.endsWith(".css")).map((entry) => m.join(entry.parentPath, entry.name)).sort().map((file) => readFileSync(file, "utf-8")) : [];
|
|
585
|
+
/**
|
|
578
586
|
* What `authorSpace` checks the space of a project `@plitzi/cli` writes against, read from the project the process runs
|
|
579
587
|
* — so its server, `npm run author` and the CLI's checks hold the space to the same thing:
|
|
580
588
|
*
|
|
581
589
|
* - `plugins`: every plugin folder's declaration (`src/plugins/<Name>/declaration.ts`, `pluginDeclarations`);
|
|
582
590
|
* - `pluginTypes`: the element types of the plugins it runs as they were built (`vendor/plugins/`);
|
|
591
|
+
* - `stylesheets`: its plugins' own CSS, every `.css` under `src/plugins/`, for the tokens they read;
|
|
583
592
|
* - `serverData`: the project's own data, which only its server reads (`src/data/`, `projectData`) — a server-mode
|
|
584
593
|
* project's; one with no server has no such folder, and its providers read `public/data/` from the browser;
|
|
585
594
|
* - `data`: the JSON files it serves (`public/`, `publicData`).
|
|
@@ -606,6 +615,7 @@ var projectAuthoringAt = async (root) => {
|
|
|
606
615
|
return {
|
|
607
616
|
plugins: await pluginDeclarations(m.join(at, o$1)),
|
|
608
617
|
pluginTypes: builtPluginTypes(m.join(at, u)),
|
|
618
|
+
stylesheets: pluginStylesheets(m.join(at, o$1)),
|
|
609
619
|
...existsSync(serverData) ? { serverData: projectData(serverData) } : {},
|
|
610
620
|
data: publicData(m.join(at, p))
|
|
611
621
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-authoring",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.10",
|
|
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.32",
|
|
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.10",
|
|
58
|
+
"@plitzi/sdk-interactions": "0.38.10",
|
|
59
|
+
"@plitzi/sdk-schema": "0.38.10",
|
|
60
|
+
"@plitzi/sdk-shared": "0.38.10",
|
|
61
|
+
"@plitzi/sdk-style": "0.38.10",
|
|
62
62
|
"@types/react": "^19.3.0",
|
|
63
63
|
"eslint": "^9.39.5",
|
|
64
64
|
"prettier": "^3.9.9",
|
|
@@ -50,7 +50,7 @@ apiContainer({ id: 'p', query: '/data/x.json', runtime: 'server', children }) //
|
|
|
50
50
|
apiContainer({ id: 'p', action: 'report', runtime: 'server', children }) // the action's output at p's root: p.rows
|
|
51
51
|
// loadingSlot: 'p-skeleton' — a child shown until it answers
|
|
52
52
|
form({ id, managedByInteractions: true, flows, children })
|
|
53
|
-
formControl({ name: 'email', label: 'Email', subType: 'email' })
|
|
53
|
+
formControl({ name: 'email', label: 'Email', subType: 'email', required: true }) // optional without required; select: options: [{ label, value }]
|
|
54
54
|
modalContainer({ id, visible: false, title, children })
|
|
55
55
|
component('card', { props: { title }, children: { body: [ … ] } })
|
|
56
56
|
custom({ renderType: 'myPlugin' }); defineElement<Props>(declaration) // a plugin
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* eslint-disable quotes -- templates quote their own strings, and read best in the other quotes */
|
|
2
2
|
/**
|
|
3
3
|
* A page per record: a card links to `/products/<slug>`, and the detail page narrows the same file to the product its
|
|
4
|
-
* address names — with a message, not an empty page, when no product has that name
|
|
4
|
+
* address names — with a message, not an empty page, when no product has that name, and status 404: the provider is
|
|
5
|
+
* resolved on the server, and `notFound` says when its answer holds nothing for this address.
|
|
5
6
|
*/
|
|
6
7
|
import { apiContainer, heading, link, list, text, listItem } from '@plitzi/sdk-authoring';
|
|
7
8
|
|
|
@@ -48,7 +49,8 @@ export const recipe: SpaceSpec = {
|
|
|
48
49
|
apiContainer({
|
|
49
50
|
id: 'catalog-one',
|
|
50
51
|
query: '/data/products.json',
|
|
51
|
-
|
|
52
|
+
runtime: 'server',
|
|
53
|
+
notFound: "{{ not (source.data.products|find('slug', navigation.routeParams.slug)) }}",
|
|
52
54
|
children: [
|
|
53
55
|
list({
|
|
54
56
|
id: 'this-product',
|
|
@@ -31,8 +31,6 @@ export const recipe: SpaceSpec = {
|
|
|
31
31
|
{ label: 'Graphics cards', value: 'gpu' }
|
|
32
32
|
],
|
|
33
33
|
defaultValue: 'all',
|
|
34
|
-
// A filter always has an answer: the select is not a question that must be filled in.
|
|
35
|
-
required: false,
|
|
36
34
|
flows: [
|
|
37
35
|
[named('picked', on('onChange')), setState({ key: 'category', type: 'text', value: '{{ picked.value }}' })]
|
|
38
36
|
]
|
|
@@ -38,7 +38,8 @@ export const recipe: SpaceSpec = {
|
|
|
38
38
|
[named('sent', onSubmit()), setState({ key: 'email', type: 'text', value: '{{ sent.values.email }}' })]
|
|
39
39
|
],
|
|
40
40
|
children: [
|
|
41
|
-
|
|
41
|
+
// Optional unless it says so, as an HTML field is: a sign-up without an address is no sign-up.
|
|
42
|
+
formControl({ name: 'email', label: 'Email', subType: 'email', required: true }),
|
|
42
43
|
button({ content: 'Sign up', subType: 'submit' })
|
|
43
44
|
]
|
|
44
45
|
}),
|
|
@@ -38,6 +38,8 @@ image({ src: '/grain.png', decorative: true }) // an orname
|
|
|
38
38
|
image({ decorative: true, bind: { src: 'post.record.cover' } }) // a cover under its own headline adds nothing
|
|
39
39
|
image({ bind: { src: 'row.item.cover', alt: 'row.item.title' } }) // …unless it is alone in a link: then it names it
|
|
40
40
|
fontAwesome({ icon: 'fa-solid fa-triangle-exclamation', label: 'Overdue' }) // an icon that says something alone
|
|
41
|
+
text('福', { decorative: true }) // a seal or a mark drawn for the look alone
|
|
42
|
+
list({ label: 'Kinds of capsule', … }) // a group of options is named, as a group
|
|
41
43
|
```
|
|
42
44
|
|
|
43
45
|
## Clicks go on controls
|
|
@@ -101,6 +101,8 @@ The space is not written until these are fixed.
|
|
|
101
101
|
| `motion-invalid` | a `motion` with a preset, a trigger or a timing the page cannot play | `motion: { enter: 'fade-up', on: 'view' }` — the message lists the presets |
|
|
102
102
|
| `motion-no-tag` | a `motion` on an element with no tag of its own — nothing to move | the motion on what it wraps, or a `subType` on it |
|
|
103
103
|
| `no-pages` | a space with no pages | `pages: [{ id: 'home', name: 'Home', slug: '', body: [] }]` |
|
|
104
|
+
| `not-found-in-browser` | `notFound` on a provider asked from the browser — its answer arrives after the page was sent with its status | `runtime: 'server'` on the provider, or `visible` on the page's "not found" part instead |
|
|
105
|
+
| `not-found-not-a-template` | `notFound`, a provider's or a page's, that is not one `{{ expression }}` — never `true`, so never a 404 | `notFound: '{{ source.found == false }}'` |
|
|
104
106
|
| `notifications-shape` | `notifications` with a field it does not have, or a value that is not one CSS value | the field it suggests, or one it lists; one CSS value, like 'var(--card)', '12px' or '500' |
|
|
105
107
|
| `outside-ancestor` | an element that reads the state of an element it is not inside | nest it in the element the message names |
|
|
106
108
|
| `page-access-level` | an `accessLevel` that is not one the router reads | one of the values the message lists |
|
|
@@ -108,6 +110,7 @@ The space is not written until these are fixed.
|
|
|
108
110
|
| `page-route-taken` | two pages at one address for the same visitors | another slug — or `accessLevel` `'public'` on one and `'authenticated'` on the other |
|
|
109
111
|
| `page-target-unknown` | a link or `navigate` to a page id that does not exist | an existing page id, or a path with its slash (`'/about'`) |
|
|
110
112
|
| `page-target-url` | a URL, `mailto:` or `tel:` in a link left in page mode | `mode: 'external'` |
|
|
113
|
+
| `page-template` | a template in a page's `seoTitle`, `seoDescription` or `notFound` that reads what is not there when the server answers — anything but the page's `runtime: 'server'` providers and `navigation` — or cannot be read | read the record from a provider with `runtime: 'server'` on the page or its layout — `'{{ apiContainer_post.title }} — Blog'` — or words of its own |
|
|
111
114
|
| `page-without-slug` | a page with no `slug` | `slug: ''` for the home page, its path for any other: `'about'`, `'blog/:slug'` |
|
|
112
115
|
| `part-missing` | a compound element — a carousel, a tab container, a dropdown — without a part it renders through | the part the message names, inside it (`carousel()` writes its own track) |
|
|
113
116
|
| `prop-missing` | an instance without a prop its component requires | `component('card', { props: { name: … } })`, or bind it |
|
|
@@ -183,6 +186,7 @@ The space renders, and renders something you probably did not mean. Fix every on
|
|
|
183
186
|
| `embed-without-title` | an `embed` with no `title` — a frame a screen reader cannot describe | say what it shows in `title` |
|
|
184
187
|
| `flag-rule-empty` | a flag rule with no conditions — skipped, never read as "always" | give it a condition, or set the flag's `value` instead |
|
|
185
188
|
| `flag-unused` | a declared flag nothing gates on and no template reads | gate what it switches (`flag: 'x'`), or remove it once the feature has shipped |
|
|
189
|
+
| `focus-on-field-box` | a `focus` or `focus-visible` state on a text field's or a select's `input` slot — the box the field is drawn in, which never takes focus, so no ring is ever shown | `'focus-within'` on the same class, or the state on the `field` slot |
|
|
186
190
|
| `FORM_SUBMIT_UNMANAGED` | a form the browser would submit itself, reloading the page | `managedByInteractions: true` |
|
|
187
191
|
| `form-control-name-taken` | two controls in one form with one name — one overwrites the other | a name each |
|
|
188
192
|
| `form-control-unnamed` | a control in a form with no `name` — its value never reaches `values` | `formControl({ name: 'email', … })` |
|
|
@@ -200,6 +204,7 @@ The space renders, and renders something you probably did not mean. Fix every on
|
|
|
200
204
|
| `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` |
|
|
201
205
|
| `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`) |
|
|
202
206
|
| `provider-without-source` | an `apiContainer` that asks nothing | a `query` (or `action`, `connector`, `resource`) |
|
|
207
|
+
| `required-message-unused` | a `requiredMessage` on a field nothing requires — fields are optional unless `required: true`, so it is never shown and an empty answer is sent | `required: true` on the field, or no message |
|
|
203
208
|
| `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` |
|
|
204
209
|
| `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 |
|
|
205
210
|
| `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` |
|
|
@@ -229,6 +234,7 @@ Nothing is wrong: the page renders as written. Each is a shorter way to the same
|
|
|
229
234
|
| `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 |
|
|
230
235
|
| `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]` |
|
|
231
236
|
| `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 |
|
|
237
|
+
| `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: [...] }` |
|
|
232
238
|
| `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; a link marks its own page with the `current` state |
|
|
233
239
|
| `repeated-shape` | the same structure written again and again with different words — cards, rows, tiles | a component with props (`components`, `component(id, { props })`), or one `list` when they are rows of data side by side — a few cards a person rewords on the canvas can stay cards |
|
|
234
240
|
| `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 |
|
|
@@ -131,8 +131,8 @@ form({
|
|
|
131
131
|
});
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
-
A `formControl` is `required
|
|
135
|
-
|
|
134
|
+
A `formControl` is optional unless it says `required: true`, as an HTML field is. A required field that is empty stops
|
|
135
|
+
the submit, and the browser says which.
|
|
136
136
|
|
|
137
137
|
## Notifications
|
|
138
138
|
|
|
@@ -124,6 +124,26 @@ pages: pageFamily(
|
|
|
124
124
|
|
|
125
125
|
Every page is now its content and nothing else, and every page is guaranteed the same structure.
|
|
126
126
|
|
|
127
|
+
## The page for an address nothing answers
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
{ id: 'not-found', name: 'Not found', slug: '*', layout: { id: 'site', slot: 'site-main' }, body: [ … ] }
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
- **`slug: '*'`** is the page of every address no other page answers — a mistyped link, a page taken down — sent with
|
|
134
|
+
status 404, in the layout you give it, so the visitor is still on the site with a way back. Its own address answers
|
|
135
|
+
404 too.
|
|
136
|
+
- **One per folder, if a section wants its own.** In a folder (`folder: 'docs'`) it answers that folder's unknown
|
|
137
|
+
addresses; the deepest folder's wins, the space's takes the rest. A page whose `flag` is off shows it too.
|
|
138
|
+
- **A space with none is given a plain one** — a title and a link home, in the home page's layout — and `author`
|
|
139
|
+
suggests writing your own (`not-found-page`): say it in the space's words.
|
|
140
|
+
- **A page that exists but finds nothing** — `/products/:slug` for a slug no product has — is sent with 404 too when
|
|
141
|
+
its server provider says so: `notFound: "{{ not (source.data.products|find('slug', navigation.routeParams.slug)) }}"`,
|
|
142
|
+
one expression against its answer, on a `runtime: 'server'` provider of the page. When the record comes from a
|
|
143
|
+
provider of its layout, which every page shares, the page says it: `notFound` on the page reads its server providers
|
|
144
|
+
by name — `"{{ not (apiContainer_feed.products|find('slug', navigation.routeParams.slug)) }}"`. The page renders as
|
|
145
|
+
written: show its "not found" part with `visible`.
|
|
146
|
+
|
|
127
147
|
## Styles follow the same rule
|
|
128
148
|
|
|
129
149
|
- A role used on several pages is ONE class (`panelCard`, `pageTitle`), declared in the module that owns the area and
|
|
@@ -9,7 +9,7 @@ Each is a whole file that authors with no warning — CI holds it to that. Copy
|
|
|
9
9
|
| Data read by the page server (`--mode server`) | [recipes/server-data.ts](../recipes/server-data.ts) |
|
|
10
10
|
| An accordion, one answer open at a time | [recipes/accordion.ts](../recipes/accordion.ts) |
|
|
11
11
|
| Filter and sort a list from a select | [recipes/filter-a-list.ts](../recipes/filter-a-list.ts) |
|
|
12
|
-
| A page per record (`/products/:slug`), and "not found" | [recipes/detail-page.ts](../recipes/detail-page.ts) |
|
|
12
|
+
| A page per record (`/products/:slug`), and "not found" sent with 404 | [recipes/detail-page.ts](../recipes/detail-page.ts) |
|
|
13
13
|
| Link to a section of a page (`/#plans`) | [recipes/link-to-a-section.ts](../recipes/link-to-a-section.ts) |
|
|
14
14
|
| A carousel: slides with arrows, dots and autoplay; a marquee; a row that swipes | [recipes/carousel.ts](../recipes/carousel.ts) |
|
|
15
15
|
| Do something every few seconds — a ticker, a poll, a slideshow by hand | [recipes/every-few-seconds.ts](../recipes/every-few-seconds.ts) |
|
|
@@ -93,7 +93,9 @@ pages: [
|
|
|
93
93
|
|
|
94
94
|
Adding a page is adding an entry; two entries of one id or slug are refused as any two pages are. For one shape over
|
|
95
95
|
records a visitor browses — a product, a post — a single page with a route param (`slug: 'posts/:postId'`) reading
|
|
96
|
-
the record is the answer instead: one page, as many addresses as records.
|
|
96
|
+
the record is the answer instead: one page, as many addresses as records. Its `seoTitle` can say the record —
|
|
97
|
+
`'{{ apiContainer_post.title }} — Blog'` — read from a provider on the page with `runtime: 'server'`, or from
|
|
98
|
+
`navigation`: the server writes the head with it, so a link preview shows it. Anything else is refused (`page-template`).
|
|
97
99
|
|
|
98
100
|
## Names
|
|
99
101
|
|