@plitzi/sdk-authoring 0.38.1 → 0.38.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/dist/index-compactSvg.js +13 -0
  3. package/dist/index.d.ts +162 -6
  4. package/dist/index.js +1410 -1020
  5. package/dist/node.d.ts +21 -0
  6. package/dist/node.js +35 -0
  7. package/package.json +14 -6
  8. package/skills/plitzi-authoring/CHEATSHEET.md +5 -3
  9. package/skills/plitzi-authoring/SKILL.md +1 -0
  10. package/skills/plitzi-authoring/recipes/carousel.ts +14 -9
  11. package/skills/plitzi-authoring/recipes/detail-page.ts +10 -6
  12. package/skills/plitzi-authoring/recipes/every-few-seconds.ts +13 -8
  13. package/skills/plitzi-authoring/recipes/filter-a-list.ts +2 -2
  14. package/skills/plitzi-authoring/recipes/forms-and-modals.ts +1 -2
  15. package/skills/plitzi-authoring/recipes/from-tailwind.ts +1 -1
  16. package/skills/plitzi-authoring/recipes/link-to-a-section.ts +2 -2
  17. package/skills/plitzi-authoring/recipes/link-with-data.ts +12 -7
  18. package/skills/plitzi-authoring/recipes/marquee.ts +2 -2
  19. package/skills/plitzi-authoring/recipes/scroll-a-row.ts +5 -6
  20. package/skills/plitzi-authoring/recipes/show-data.ts +12 -7
  21. package/skills/plitzi-authoring/recipes/typed-data.ts +9 -6
  22. package/skills/plitzi-authoring/recipes/usable-without-sight.ts +2 -2
  23. package/skills/plitzi-authoring/reference/accessibility.md +2 -2
  24. package/skills/plitzi-authoring/reference/authoring-errors.md +5 -0
  25. package/skills/plitzi-authoring/reference/colours-and-motion.md +3 -0
  26. package/skills/plitzi-authoring/reference/components.md +2 -1
  27. package/skills/plitzi-authoring/reference/drawing.md +22 -0
  28. package/skills/plitzi-authoring/reference/elements-and-styles.md +2 -2
  29. package/skills/plitzi-authoring/reference/lists.md +11 -6
  30. package/skills/plitzi-authoring/reference/plugins.md +5 -0
  31. package/skills/plitzi-authoring/reference/structure.md +1 -1
  32. package/skills/plitzi-authoring/reference/testing.md +9 -4
  33. package/skills/plitzi-authoring/reference/typed-sources.md +1 -1
  34. package/skills/plitzi-authoring/reference/validation.md +3 -2
@@ -8,8 +8,8 @@ list bound to its records (see the provider in data-and-visibility).
8
8
 
9
9
  ```ts
10
10
  list({ id: 'games', class: gameGrid, items: 'catalog.data.games', row: 'game-card' }) // a component per game
11
- list({ id: 'games', items: 'catalog.data.games', row: r => text({ from: `${r.item}.title` }) }) // or a tree of its own
12
- list({ id: 'plans', items: ['Free', 'Pro'], children: [text({ from: 'plans.item' })] }) // fixed items
11
+ list({ id: 'games', items: 'catalog.data.games', row: r => listItem({ children: [text({ from: `${r.item}.title` })] }) })
12
+ list({ id: 'plans', items: ['Free', 'Pro'], children: [listItem({ children: [text({ from: 'plans.item' })] })] }) // fixed
13
13
  ```
14
14
 
15
15
  `items` makes a list controlled: an array of its own, or the source its rows come from. `row` is what it renders once
@@ -17,15 +17,20 @@ per item — a component's id (placed with the row bound to its `item` prop, or
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
19
19
  `items` a typed source's path (`items: site.data.games`, see typed-sources.md), the row is typed too:
20
- `row: g => text({ from: g.item.title })`, and a field the sample's games lack is a type error.
20
+ `row: g => listItem({ children: [text({ from: g.item.title })] })`, and a field the sample's games lack is a type error.
21
21
 
22
22
  - Each row publishes **`list_<id>.item`** (the row) and **`list_<id>.index`** (its position, a number from 0 —
23
23
  `index + 1` counts, and `==` compares it with text or a number alike). Inside the row,
24
24
  bindings read the short form (`'games.item.title'`), templates and attribute tokens the full one
25
25
  (`{{ list_games.item.slug }}`).
26
26
  - A **nested list** sees the outer row: inside `list_features`, `list_games.item` is still the game.
27
- - The list is a `<ul>` and its `class` styles that root; each child is rendered straight into it, with no wrapper.
28
- A card grid needs `{ margin: '0px', padding: '0px', 'list-style-type': 'none' }` in its class.
27
+ - A list is a `<ul>` (`subType: 'ol'` for a numbered one) and its `class` styles that root; each row is rendered
28
+ straight into it, with no wrapper — so **a row is an `<li>`**: `listItem({ class, children })`, a
29
+ `container({ subType: 'li' })`, or a component whose root is one. Anything else is a box inside a list, no item to a
30
+ screen reader (`list-row-not-li`; `fixSpace` makes a plain container one). A link or a button is wrapped in a
31
+ `listItem`, which is then what the list lays out: a card that is a link fills its item with `display: 'grid'` on the
32
+ `listItem`. Every list is indented (40px) with 10px below it, and one without `items` is bulleted too:
33
+ `{ margin: '0px', padding: '0px' }` on the root takes the space off. A grid of cards is the root's class.
29
34
  - Fixed data is `items: [ … ]` on the list itself — no provider needed. Worth it when the rows ARE data — written from
30
35
  an array, or rows that come and go (`repeated-shape` points at sibling copies). Three cards a person rewords on the
31
36
  canvas are easier to edit as three cards than as a JSON array.
@@ -68,7 +73,7 @@ apiContainer({ id: 'catalog', query: '/data/games.json', cache: true, children:
68
73
  source: 'controlled',
69
74
  bind: [bindTemplate('items', 'catalog.data.games',
70
75
  '{{ source|filter(g => g.slug == navigation.routeParams.slug) }}', { returns: 'value' })],
71
- children: [gameDossier()] // reads list_game.item
76
+ children: [listItem({ children: [gameDossier()] })] // reads list_game.item
72
77
  }),
73
78
  text('Signal lost — no game by that name.', {
74
79
  id: 'game-missing',
@@ -107,6 +107,11 @@ const newChart = useFlag('newChart'); // false for a flag the space does not dec
107
107
  Gating the whole plugin needs no code: give its element `flag: 'newChart'`. `useFlag` is for a plugin that changes
108
108
  inside — a new mode, an extra panel.
109
109
 
110
+ ## Drawing and animating
111
+
112
+ A canvas, WebGL or a loop of its own: `useCanvas2d`, `useWebGL`, `useWebGL2` and `useAnimationFrame` — see
113
+ [drawing](drawing.md).
114
+
110
115
  ## Registering
111
116
 
112
117
  A project `plitzi create` wrote registers every folder of `src/plugins` by itself, under the folder's name in
@@ -39,7 +39,7 @@ export const panel = (params: { id: string; title: string; sub?: string; link?:
39
39
  children: [
40
40
  heading(params.title, { id: 'title', subType: 'h3', class: panelTitle }),
41
41
  ...(params.sub ? [text(params.sub, { id: 'sub', class: panelSub })] : []),
42
- ...(params.link ? [link({ id: 'link', href: params.link.href, class: panelLink, children: [text(params.link.label)] })] : [])
42
+ ...(params.link ? [link({ id: 'link', href: params.link.href, class: panelLink, content: params.link.label })] : [])
43
43
  ]
44
44
  }),
45
45
  ...params.children
@@ -13,8 +13,11 @@ expect((await inspectPage(page, handles)).problems).toEqual([]);
13
13
  It checks the open page and returns EVERY problem at once, one sentence each, naming the element and the reason:
14
14
 
15
15
  - every element the page owes is present and visible — its own and those of the layouts around it
16
- (`heading "hero-title" is on the page but not visible: display:none on "hero"`);
17
- - every image arrived — an image element that failed says so (`data-plitzi-failed`), though its fallback loads;
16
+ (`heading "hero-title" is on the page but not visible: display:none on "hero"`). One a breakpoint hides at this
17
+ width (`mobile: { display: 'none' }`, or shown only at another width) is laid out by width, not missing: listed in
18
+ `hiddenAtWidth`, and checked at the width it shows at — run the check at each width you author for;
19
+ - every image arrived — an image element that failed says so (`data-plitzi-failed`), though its fallback loads. A lazy
20
+ image out of sight (below the fold, or beside the screen in a carousel's track) has not been asked for yet, and waits;
18
21
  - nothing scrolls sideways (`the page scrolls sideways by 37px — widest: "cards"`);
19
22
  - no text is drawn in the colour painted behind it.
20
23
 
@@ -33,10 +36,12 @@ the list `inspectPage` holds a page to.
33
36
 
34
37
  Three flags say what a bare visit cannot promise, and `onScreen` leaves out:
35
38
 
36
- - `conditional` — on screen only under a condition of its own or of an ancestor;
39
+ - `conditional` — on screen only under a condition of its own or of an ancestor, or with every child conditional (a
40
+ list of flyouts at rest);
37
41
  - `repeated` — inside a list row, so rendered once per row: several copies, or none while the list is empty. Address
38
42
  one with `.first()` / `.nth(i)`, in a test that knows the data;
39
- - `boxless` — a provider with no tag, which renders its children and no element of its own.
43
+ - `boxless` — a provider with no tag, which renders its children and no element of its own; or a plugin whose
44
+ declaration says `drawsNothing: true` — behaviour rather than content, a clock that fires a flow.
40
45
 
41
46
  A `formControl`'s id names its wrapper: type into `locate('email').locator('input')`.
42
47
 
@@ -9,7 +9,7 @@ const site = source('site', home);
9
9
  apiContainer({ id: site.id, query: '/data/home.json', children: [
10
10
  heading({ from: site.data.hero.title }),
11
11
  text({ content: twig`{{ ${site.data.products}|length }} products` }),
12
- list({ id: 'products', items: site.data.products, row: p => text({ from: p.item.title }) })
12
+ list({ id: 'products', items: site.data.products, row: p => listItem({ children: [text({ from: p.item.title })] }) })
13
13
  ] })
14
14
  ```
15
15
 
@@ -47,8 +47,9 @@ bar.
47
47
 
48
48
  2. **Fix, re-run, until it prints zero warnings.** What has one fix (`author` says how many) is written for you: `npx
49
49
  plitzi fix` shows it as a diff of your source, `--write` writes it and keeps it only if the space authors with each
50
- fix gone and nothing new — a fix it cannot place, or that would add a problem, is said with the reason. Then
51
- typecheck the project.
50
+ fix gone and nothing new — a fix it cannot place, or that would add a problem, is said with the reason. A
51
+ suggestion with one reading is written the same way (`content-attribute`: words and an icon held as children become
52
+ the button's or link's own `content` and `icon`). Then typecheck the project.
52
53
  3. **Look at it** — in a browser, at desktop and phone width, in both themes (see [testing](testing.md)). Stage 3 is
53
54
  thorough about MEANING and blind to what follows.
54
55