@plitzi/sdk-authoring 0.38.2 → 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.
- package/CHANGELOG.md +124 -0
- package/dist/index-compactSvg.js +13 -0
- package/dist/index.d.ts +162 -6
- package/dist/index.js +1410 -1020
- package/dist/node.d.ts +21 -0
- package/dist/node.js +35 -0
- package/package.json +14 -6
- package/skills/plitzi-authoring/CHEATSHEET.md +5 -3
- package/skills/plitzi-authoring/SKILL.md +1 -0
- package/skills/plitzi-authoring/recipes/carousel.ts +14 -9
- package/skills/plitzi-authoring/recipes/detail-page.ts +10 -6
- package/skills/plitzi-authoring/recipes/every-few-seconds.ts +13 -8
- package/skills/plitzi-authoring/recipes/filter-a-list.ts +2 -2
- package/skills/plitzi-authoring/recipes/forms-and-modals.ts +1 -2
- package/skills/plitzi-authoring/recipes/from-tailwind.ts +1 -1
- package/skills/plitzi-authoring/recipes/link-to-a-section.ts +2 -2
- package/skills/plitzi-authoring/recipes/link-with-data.ts +12 -7
- package/skills/plitzi-authoring/recipes/marquee.ts +2 -2
- package/skills/plitzi-authoring/recipes/scroll-a-row.ts +5 -6
- package/skills/plitzi-authoring/recipes/show-data.ts +12 -7
- package/skills/plitzi-authoring/recipes/typed-data.ts +9 -6
- package/skills/plitzi-authoring/recipes/usable-without-sight.ts +2 -2
- package/skills/plitzi-authoring/reference/accessibility.md +2 -2
- package/skills/plitzi-authoring/reference/authoring-errors.md +5 -0
- package/skills/plitzi-authoring/reference/colours-and-motion.md +3 -0
- package/skills/plitzi-authoring/reference/components.md +2 -1
- package/skills/plitzi-authoring/reference/drawing.md +22 -0
- package/skills/plitzi-authoring/reference/elements-and-styles.md +2 -2
- package/skills/plitzi-authoring/reference/lists.md +11 -6
- package/skills/plitzi-authoring/reference/plugins.md +5 -0
- package/skills/plitzi-authoring/reference/structure.md +1 -1
- package/skills/plitzi-authoring/reference/testing.md +9 -4
- package/skills/plitzi-authoring/reference/typed-sources.md +1 -1
- package/skills/plitzi-authoring/reference/validation.md +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,129 @@
|
|
|
1
1
|
# @plitzi/sdk-authoring
|
|
2
2
|
|
|
3
|
+
## 0.38.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e047e1d: ## `plitzi upgrade`: a project brought up to its CLI
|
|
8
|
+
|
|
9
|
+
A project written by an older CLI had no way up but `plitzi create` in a scratch folder and a file-by-file comparison:
|
|
10
|
+
`skills update` brought the skills and nothing else, so the `check` and `shot` scripts they teach did not exist.
|
|
11
|
+
`plitzi upgrade` (also `update`) shows what this CLI writes today for what is the CLI's in the project, and `--write`
|
|
12
|
+
makes it. One part or several: `plitzi upgrade skills`, `plitzi upgrade files packages`.
|
|
13
|
+
|
|
14
|
+
- **`files`:** the CLI's machinery — `author.ts`, `main.ts`, the Playwright, TypeScript and lint configs, AGENTS.md. One
|
|
15
|
+
nobody changed since the CLI wrote it is replaced, a missing one added; one the project made its own is shown as a
|
|
16
|
+
diff and left, until `--take <file>` (or `all`). `plitzi create` now records what it wrote, by digest, in
|
|
17
|
+
`.plitzi/scaffold.json`; a project made before that sees every file that differs as its own.
|
|
18
|
+
- **`packages`:** `package.json` merged, never replaced — the scripts and dependencies it lacks added, `@plitzi/*`
|
|
19
|
+
raised to this version, then the install (`--no-install` to leave it). A script of the project's own stays.
|
|
20
|
+
- **`skills`:** `.claude/skills/plitzi-*` from the packages installed, each replaced whole, and the ones a newer CLI
|
|
21
|
+
writes added. `plitzi skills update` is `plitzi upgrade skills --write`.
|
|
22
|
+
- **`renames`:** a name a version renamed with no alias, at its file and line — `canTemplate` → `canSnippet`,
|
|
23
|
+
`authorTemplate` → `authorSnippet` and its kin (renamed only where imported from `@plitzi/sdk-authoring`) — renamed
|
|
24
|
+
with `--write`.
|
|
25
|
+
|
|
26
|
+
`npm run author` says when the skills or the CLI's files are older than the SDK installed, and `plitzi --version`
|
|
27
|
+
prints the CLI's.
|
|
28
|
+
|
|
29
|
+
## Page checks that can be the definition of done
|
|
30
|
+
|
|
31
|
+
`inspectPage`, `plitzi check` and the scaffold's visual test failed pages that were whole, so an agent learnt to ignore
|
|
32
|
+
them:
|
|
33
|
+
|
|
34
|
+
- **A breakpoint hiding an element on purpose** — the desktop navigation on a phone, a bottom bar only a phone shows —
|
|
35
|
+
is no longer "not visible": an element whose `display` or `visibility` a breakpoint rule sets is checked at the width
|
|
36
|
+
it shows at.
|
|
37
|
+
- **A lazy image out of sight** waits whichever side it is out of: below the fold, as before, or beside the screen in a
|
|
38
|
+
carousel's track — cut off by any ancestor that clips, as the browser decides when to fetch it.
|
|
39
|
+
- **A plugin that draws nothing** says so: `drawsNothing: true` in its declaration (a clock that fires a flow), and its
|
|
40
|
+
handle is `boxless`, so no check waits for it on screen.
|
|
41
|
+
|
|
42
|
+
`plitzi check --json` and `PageReport` carry `issues` beside `problems`: each with its `code` (`element-hidden`,
|
|
43
|
+
`image-not-loaded`, `sideways-scroll`…), the `elementId` it is about and, in `check`, the `width`.
|
|
44
|
+
|
|
45
|
+
## Authoring
|
|
46
|
+
- **A link's `content` names it.** `control-without-name` read only a link's `label`, so applying the
|
|
47
|
+
`content-attribute` suggestion as written turned every link into a warning.
|
|
48
|
+
- **`plitzi fix` writes `content-attribute`** where it has one reading: a button's or link's children that are only
|
|
49
|
+
`text(…)` and `fontAwesome({ icon })` become its own `content` and `icon` — the words kept as written, an import left
|
|
50
|
+
unused taken out. A child with an id, options or a class of the space's own stays, and is said. `npm run author`'s
|
|
51
|
+
`[fix]` line counts these too.
|
|
52
|
+
- **The recipes, the skill's examples and the catalog template** hold to the suggestions as well as the warnings, and
|
|
53
|
+
their tests say so: six recipes and the template wrote a link's or a button's words as a child.
|
|
54
|
+
|
|
55
|
+
## Declared motion — in code, in the builder and over MCP
|
|
56
|
+
|
|
57
|
+
An element says how it arrives and whether it keeps moving with `motion`, and the SDK's stylesheet plays it — no
|
|
58
|
+
keyframes to write: `{ enter: 'fade-up', on: 'view' }` arrives as it scrolls into view, `{ enter: 'scale', stagger:
|
|
59
|
+
60 }` brings its children one by one (a grid, a list's rows), `{ loop: 'float' }` keeps it moving. Enters: `fade`,
|
|
60
|
+
`fade-up`, `fade-down`, `slide-left`, `slide-right`, `scale`; loops: `float`, `pulse`, `spin`, `sway`; `duration`,
|
|
61
|
+
`delay`, `stagger` in ms. Opacity and the transforms only — an arrival on `translate`/`scale`, so it composes with an
|
|
62
|
+
element's own `transform` — a loop held until the page is live (`data-hydrated`), and none of it for a visitor who asked
|
|
63
|
+
for less motion. `view` follows the scroll where the browser has scroll timelines and plays on load where not.
|
|
64
|
+
|
|
65
|
+
- **Authoring:** `motion` on any factory; refused where it cannot play (`motion-invalid`, `motion-no-tag`), and carried
|
|
66
|
+
by `specFromSpace` and `compareSpaces`.
|
|
67
|
+
- **Builder:** a **Motion** tab in an element's tools: the presets as chips, a stage that plays the one pointed at (a
|
|
68
|
+
loop shown stronger than the page plays it, and saying so), when and how long, children one by one, and the choices
|
|
69
|
+
read back as a sentence — laid out side by side once the sidebar is wide enough. The canvas holds motion still while
|
|
70
|
+
editing; **▶** in the header (or **Play on the canvas** in the tab) plays it from the start, restarting what already
|
|
71
|
+
played, and an arrival tied to the scroll plays by the clock there, where it is usually in view already.
|
|
72
|
+
- **MCP:** `motion` on `upsertElement` and `patchElement`, checked the same way; the guide names the presets.
|
|
73
|
+
- **Schema:** `definition.motion` (`ElementMotion`, `@plitzi/sdk-shared/schema/motion` — the presets, `motionProblems`,
|
|
74
|
+
`motionAttributes`, `isMotionAnimation`, and each preset's frames, which the stylesheet is tested against), in both
|
|
75
|
+
init queries. **The platform's GraphQL schema has to declare `SpaceElementMotion`
|
|
76
|
+
before this version's builder or SDK queries it.**
|
|
77
|
+
|
|
78
|
+
## Dev tools QA: x-ray and motion
|
|
79
|
+
|
|
80
|
+
The **QA** tab gains an **X-ray**: every element the document wires something to — bound to data, shown on a condition,
|
|
81
|
+
running a flow, moving, behind a flag — outlined in its colour and named on the page, read from the space's document by
|
|
82
|
+
the element's name; its legend counts each kind on the page and picks one to show alone. Beside **Pause**, **Slow**
|
|
83
|
+
plays every animation at a quarter of its speed and **Replay** plays the declared motion again from the start, without
|
|
84
|
+
reloading the page.
|
|
85
|
+
|
|
86
|
+
## Plugins that draw
|
|
87
|
+
|
|
88
|
+
`useCanvas2d`, `useWebGL`, `useWebGL2` and `useAnimationFrame` (`@plitzi/plitzi-sdk`): a canvas sized to the device (at
|
|
89
|
+
most 2×), followed as it resizes, animating only while somebody can see it move — a live page, no reduced motion, the
|
|
90
|
+
tab in front, the canvas on screen — and one still frame otherwise (the builder included). `createShaderProgram`
|
|
91
|
+
compiles and links, and a shader that fails throws a `ShaderError` with the driver's log, printed as
|
|
92
|
+
`[plugin <type> "<id>"] fragment shader failed: …` instead of an empty canvas; `error` and `ready` say where it is.
|
|
93
|
+
`useReducedMotion` for the rest.
|
|
94
|
+
|
|
95
|
+
## A space re-authored without a restart
|
|
96
|
+
|
|
97
|
+
A project's `npm run start:dev` restarts for its server code and its plugins only: a save to the space is re-authored
|
|
98
|
+
in a process of its own and every open page loads again (`server.reloadPages()` over an SSE endpoint, on with
|
|
99
|
+
`createServer({ devReload: true })` — never by `devMode` alone, since every open page holds a connection for it); an
|
|
100
|
+
edit authoring refuses is printed and the page keeps the last space that authored. A shutdown also ends WebSockets at
|
|
101
|
+
once (`1001`, going away) rather than waiting out the grace — the ten seconds a restart used to wait on an open page.
|
|
102
|
+
|
|
103
|
+
## Checks and authoring, from the stripe.com experiment
|
|
104
|
+
- **A component's instance** is found by its own name: its root carries `data-plitzi-instance`, and the instance's
|
|
105
|
+
handle selects it — `inspectPage` no longer reports every named instance as missing.
|
|
106
|
+
- **Hidden at this width on purpose** — the burger on a desktop, the desktop menu on a phone — is listed apart
|
|
107
|
+
(`hiddenAtWidth`, and a dim line under `plitzi check`'s ✓) rather than as a problem.
|
|
108
|
+
- **An element whose every child is conditional** — four flyouts in one list, each opening on the state that names
|
|
109
|
+
it — is conditional too: at rest it shows nothing, and that is it working.
|
|
110
|
+
- **A carousel that scrolls by itself** (`overflow-x: auto`) is not the page scrolling sideways; the page's own pane
|
|
111
|
+
still is.
|
|
112
|
+
- **Templates:** `{{ state.faq ?? -1 }}` — a sign on the right of `??` — reads.
|
|
113
|
+
- **A plugin attribute named as an element field** (`variant`, `class`, `id`…) is warned about
|
|
114
|
+
(`plugin-attribute-reserved`): a factory never hands it to the plugin. A `variant` no class or type style declares is
|
|
115
|
+
`unknown-variant`.
|
|
116
|
+
- **Lists:** a list with `items` renders as the `<ul>` (or `<ol>`) its `subType` says — it was a `<div>` — with no
|
|
117
|
+
markers and the same spacing, so a page looks as it did; the builder offers the list type for it too. Its rows are
|
|
118
|
+
`<li>`s: `list-row-not-li` warns of one that is not — a plain container is made one by `fixSpace`, a link or a button
|
|
119
|
+
is wrapped — and the recipes, the catalog template and the docs write rows as `listItem`.
|
|
120
|
+
- **CSS:** `mask-size`, `mask-position`, `mask-repeat`, `mask-composite`, `-webkit-mask-image`,
|
|
121
|
+
`-webkit-background-clip`, `box-decoration-break` and `-webkit-box-decoration-break`.
|
|
122
|
+
- **`plitzi shot`:** `--clip <element>`, `--scroll-to <element>` and `--viewport`; `--frames` takes the same framing.
|
|
123
|
+
- **SVG from files:** `svgFile` and `svgFiles` (`@plitzi/sdk-authoring/node`) read a logo or a folder of them,
|
|
124
|
+
compacted (`compactSvg`, also on the main entry), instead of strings in the space's source.
|
|
125
|
+
- The plugin scaffolds say that an inline `style` on `RootElement` outranks the element's classes.
|
|
126
|
+
|
|
3
127
|
## 0.38.2
|
|
4
128
|
|
|
5
129
|
### Patch Changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/svg/compactSvg.ts
|
|
2
|
+
/**
|
|
3
|
+
* An SVG as it is worth carrying in a space: what a design tool wrote for itself taken out — the XML prolog and doctype,
|
|
4
|
+
* comments, `<metadata>`, an editor's own elements and attributes (Inkscape, Sodipodi, Sketch, Figma's `data-name`) —
|
|
5
|
+
* and the whitespace between tags. What draws, and its `<title>`, stay as they were.
|
|
6
|
+
*
|
|
7
|
+
* Every byte of an inline SVG is in the space's documents and in every page that shows it, so a logo exported from a
|
|
8
|
+
* design tool with half its size in notes to itself is that much heavier for nothing. `svg()` checks and sanitises
|
|
9
|
+
* what it is given; this only makes it smaller.
|
|
10
|
+
*/
|
|
11
|
+
var compactSvg = (markup) => markup.replace(/<\?xml[\s\S]*?\?>/g, "").replace(/<!DOCTYPE[\s\S]*?>/gi, "").replace(/<!--[\s\S]*?-->/g, "").replace(/<metadata[\s\S]*?<\/metadata>/gi, "").replace(/<(sodipodi|inkscape|sketch):[\w-]+[^>]*\/>/g, "").replace(/<(sodipodi|inkscape|sketch):([\w-]+)[^>]*>[\s\S]*?<\/\1:\2>/g, "").replace(/\s(?:sodipodi|inkscape|sketch):[\w-]+="[^"]*"/g, "").replace(/\sxmlns:(?:sodipodi|inkscape|sketch|dc|cc|rdf)="[^"]*"/g, "").replace(/\sdata-name="[^"]*"/g, "").replace(/>\s+</g, "><").trim();
|
|
12
|
+
//#endregion
|
|
13
|
+
export { compactSvg as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -709,6 +709,16 @@ export declare const AUTHORING_CODES: {
|
|
|
709
709
|
readonly means: "a layout `slot` that is not an element inside that layout";
|
|
710
710
|
readonly fix: "the id of the element in the shell where the body goes";
|
|
711
711
|
};
|
|
712
|
+
readonly 'motion-invalid': {
|
|
713
|
+
readonly kind: "refused";
|
|
714
|
+
readonly means: "a `motion` with a preset, a trigger or a timing the page cannot play";
|
|
715
|
+
readonly fix: "`motion: { enter: 'fade-up', on: 'view' }` — the message lists the presets";
|
|
716
|
+
};
|
|
717
|
+
readonly 'motion-no-tag': {
|
|
718
|
+
readonly kind: "refused";
|
|
719
|
+
readonly means: "a `motion` on an element with no tag of its own — nothing to move";
|
|
720
|
+
readonly fix: "the motion on what it wraps, or a `subType` on it";
|
|
721
|
+
};
|
|
712
722
|
readonly 'anchor-invalid': {
|
|
713
723
|
readonly kind: "refused";
|
|
714
724
|
readonly means: "an `anchor` or a link's `hash` that is not lowercase letters, digits and `-`";
|
|
@@ -879,6 +889,16 @@ export declare const AUTHORING_CODES: {
|
|
|
879
889
|
readonly means: "a type no built-in element has";
|
|
880
890
|
readonly fix: "the built-in it suggests; a plugin's declaration goes in `authorSpace(space, { plugins: [declaration] })`";
|
|
881
891
|
};
|
|
892
|
+
readonly 'plugin-attribute-reserved': {
|
|
893
|
+
readonly kind: "warned";
|
|
894
|
+
readonly means: "a plugin attribute named as one of the element’s own fields — a factory never hands it to the plugin";
|
|
895
|
+
readonly fix: "rename it in the plugin (`variant` → `kind`)";
|
|
896
|
+
};
|
|
897
|
+
readonly 'unknown-variant': {
|
|
898
|
+
readonly kind: "warned";
|
|
899
|
+
readonly means: "a variant no class of the element and no style of its type declares — nothing applies";
|
|
900
|
+
readonly fix: "declare it (`styles(name, { variants: { … } })`), or name one that is";
|
|
901
|
+
};
|
|
882
902
|
readonly 'unknown-attribute': {
|
|
883
903
|
readonly kind: "refused";
|
|
884
904
|
readonly means: "an attribute the element does not have";
|
|
@@ -969,6 +989,11 @@ export declare const AUTHORING_CODES: {
|
|
|
969
989
|
readonly means: "a controlled list with nothing to render";
|
|
970
990
|
readonly fix: "`items: [ … ]` or `bind: { items: 'provider.data.rows' }`";
|
|
971
991
|
};
|
|
992
|
+
readonly 'list-row-not-li': {
|
|
993
|
+
readonly kind: "warned";
|
|
994
|
+
readonly means: "a row of a list with `items` that is not an `<li>` — that list is a `<ul>` (or `<ol>`), so the row is a box inside a list, no item to a screen reader";
|
|
995
|
+
readonly fix: "`container({ subType: 'li' })` — or the component's root one, or a wrapper for a link or a button";
|
|
996
|
+
};
|
|
972
997
|
readonly 'list-item-key-missing': {
|
|
973
998
|
readonly kind: "warned";
|
|
974
999
|
readonly means: "a list's `itemKey` that some of its items lack, or two of them share — the rows fall back to `id`, then position";
|
|
@@ -1542,6 +1567,8 @@ export declare interface AuthoringProps {
|
|
|
1542
1567
|
loadStrategy?: ElementLoadStrategy;
|
|
1543
1568
|
/** Its `id` in the DOM, so `/page#anchor` lands on it. One per page; not inside a list row or a component. */
|
|
1544
1569
|
anchor?: string;
|
|
1570
|
+
/** How it arrives and whether it keeps moving: `{ enter: 'fade-up', on: 'view' }`. Played by the SDK's stylesheet. */
|
|
1571
|
+
motion?: ElementMotion;
|
|
1545
1572
|
/** The feature flag it exists under: `'newCheckout'` while on, `'!newCheckout'` while off. Not a visibility. */
|
|
1546
1573
|
flag?: string;
|
|
1547
1574
|
children?: ElementSpec[];
|
|
@@ -1601,6 +1628,16 @@ export declare interface AuthorSpaceOptions {
|
|
|
1601
1628
|
attributeNames?: Readonly<Record<string, readonly string[] | null>>;
|
|
1602
1629
|
/** The types that hold no children. Left out, children written into one are dropped at render time unreported. */
|
|
1603
1630
|
leafTypes?: readonly string[];
|
|
1631
|
+
/**
|
|
1632
|
+
* The types that draw nothing on a page (a plugin's `drawsNothing`), under the name a space uses them by — their own
|
|
1633
|
+
* type or `custom:<renderType>`. Their handles are `boxless`, so a page check does not wait for them on screen.
|
|
1634
|
+
*/
|
|
1635
|
+
drawsNothingTypes?: readonly string[];
|
|
1636
|
+
/**
|
|
1637
|
+
* Plugin type → the attributes it declares under a name authoring keeps for the element itself (`variant`, `class`,
|
|
1638
|
+
* `id`…): a factory reads those as the element's, so the plugin is never handed them. Derived from `plugins`.
|
|
1639
|
+
*/
|
|
1640
|
+
reservedPluginAttributes?: Readonly<Record<string, readonly string[]>>;
|
|
1604
1641
|
/**
|
|
1605
1642
|
* Element type → the attributes it starts with. What tells a default `content` rendered beside children apart from
|
|
1606
1643
|
* one the author wrote, and an attribute that holds a list from one that holds text.
|
|
@@ -2055,6 +2092,17 @@ export declare const column: (gap: string, extra?: CssProps) => StyleRules;
|
|
|
2055
2092
|
|
|
2056
2093
|
declare type Combinator = 'and' | 'or';
|
|
2057
2094
|
|
|
2095
|
+
/**
|
|
2096
|
+
* An SVG as it is worth carrying in a space: what a design tool wrote for itself taken out — the XML prolog and doctype,
|
|
2097
|
+
* comments, `<metadata>`, an editor's own elements and attributes (Inkscape, Sodipodi, Sketch, Figma's `data-name`) —
|
|
2098
|
+
* and the whitespace between tags. What draws, and its `<title>`, stay as they were.
|
|
2099
|
+
*
|
|
2100
|
+
* Every byte of an inline SVG is in the space's documents and in every page that shows it, so a logo exported from a
|
|
2101
|
+
* design tool with half its size in notes to itself is that much heavier for nothing. `svg()` checks and sanitises
|
|
2102
|
+
* what it is given; this only makes it smaller.
|
|
2103
|
+
*/
|
|
2104
|
+
export declare const compactSvg: (markup: string) => string;
|
|
2105
|
+
|
|
2058
2106
|
/** Two pictures compared in a page the driver holds — any page will do, nothing of it is read. */
|
|
2059
2107
|
export declare const comparePictures: (driver: PictureDriver, a: string, b: string, regions?: PictureRegion[], tolerance?: number) => Promise<PictureDiff>;
|
|
2060
2108
|
|
|
@@ -2440,7 +2488,7 @@ export { Element_2 as Element }
|
|
|
2440
2488
|
* export drops without a word. `specFields.test.ts` refuses to compile until it is listed here — and once it is, it is
|
|
2441
2489
|
* written like any other, so growing the authoring surface needs nothing more from the emitter than this line.
|
|
2442
2490
|
*/
|
|
2443
|
-
export declare const ELEMENT_FIELDS: readonly ["type", "id", "attributes", "class", "css", "states", "selector", "variant", "slots", "bind", "from", "as", "row", "visible", "flows", "runtime", "loadStrategy", "anchor", "flag", "meta", "children"];
|
|
2491
|
+
export declare const ELEMENT_FIELDS: readonly ["type", "id", "attributes", "class", "css", "states", "selector", "variant", "slots", "bind", "from", "as", "row", "visible", "flows", "runtime", "loadStrategy", "anchor", "motion", "flag", "meta", "children"];
|
|
2444
2492
|
|
|
2445
2493
|
/** The sub-elements that only work inside another type, and that type — see `ElementDeclarationData.ancestorType`. */
|
|
2446
2494
|
export declare const elementAncestorTypes: Record<string, string>;
|
|
@@ -2590,6 +2638,12 @@ export declare interface ElementDeclarationData {
|
|
|
2590
2638
|
* surface to refuse a value outside it.
|
|
2591
2639
|
*/
|
|
2592
2640
|
attributeValues?: Record<string, readonly string[]>;
|
|
2641
|
+
/**
|
|
2642
|
+
* Whether the element is behaviour rather than content — a clock that fires a flow, a listener — and draws nothing on
|
|
2643
|
+
* a page (at most a tag in the builder, to have something to select). Read by the page checks (`inspectPage`,
|
|
2644
|
+
* `plitzi check`), which would otherwise wait for it to be on screen and report it hidden.
|
|
2645
|
+
*/
|
|
2646
|
+
drawsNothing?: boolean;
|
|
2593
2647
|
content?: {
|
|
2594
2648
|
attributes?: Record<string, unknown>;
|
|
2595
2649
|
definition?: {
|
|
@@ -6526,6 +6580,8 @@ export declare type ElementDefinition = {
|
|
|
6526
6580
|
* for the platform, this names it for the URL. One per rendered page, layouts included (`isAnchor`).
|
|
6527
6581
|
*/
|
|
6528
6582
|
anchor?: string;
|
|
6583
|
+
/** How it arrives and whether it keeps moving, played by the SDK's stylesheet. See {@link ElementMotion}. */
|
|
6584
|
+
motion?: ElementMotion;
|
|
6529
6585
|
};
|
|
6530
6586
|
|
|
6531
6587
|
/**
|
|
@@ -6590,6 +6646,9 @@ export declare interface ElementHandle {
|
|
|
6590
6646
|
* and they are correctly NOT on a page somebody has only just opened. A suite asserting "everything named is
|
|
6591
6647
|
* visible" skips these, or it forces the author to leave unnamed exactly what a flow needs to point at.
|
|
6592
6648
|
*
|
|
6649
|
+
* Also an element whose every child is conditional: with none of them shown it shows nothing either — a list of
|
|
6650
|
+
* flyouts at rest, a `display: contents` wrapper of panels.
|
|
6651
|
+
*
|
|
6593
6652
|
* Present only when true: almost nothing on a page is conditional, and the handles are serialized.
|
|
6594
6653
|
*/
|
|
6595
6654
|
conditional?: true;
|
|
@@ -6654,6 +6713,24 @@ export declare const elementLeafTypes: string[];
|
|
|
6654
6713
|
*/
|
|
6655
6714
|
export declare type ElementLoadStrategy = 'eager' | 'lazy' | 'visible';
|
|
6656
6715
|
|
|
6716
|
+
declare interface ElementMotion {
|
|
6717
|
+
/** How it arrives. */
|
|
6718
|
+
enter?: MotionEnter;
|
|
6719
|
+
/** When it arrives: `load` (the default) or `view`. */
|
|
6720
|
+
on?: MotionTrigger;
|
|
6721
|
+
/** How long it takes to arrive, in ms (600 by default). Ignored under `view`, which follows the scroll. */
|
|
6722
|
+
duration?: number;
|
|
6723
|
+
/** How long it waits before it does, in ms. */
|
|
6724
|
+
delay?: number;
|
|
6725
|
+
/**
|
|
6726
|
+
* Its CHILDREN arrive one after another, this many ms apart — a grid of cards, a list's rows — rather than the
|
|
6727
|
+
* element itself. Up to the first 24; the rest arrive with the 24th.
|
|
6728
|
+
*/
|
|
6729
|
+
stagger?: number;
|
|
6730
|
+
/** Keeps moving after it arrived. */
|
|
6731
|
+
loop?: MotionLoop;
|
|
6732
|
+
}
|
|
6733
|
+
|
|
6657
6734
|
/**
|
|
6658
6735
|
* The parts each compound type renders through — a carousel's `carouselTrack`, a tab container's header and body: the
|
|
6659
6736
|
* types it starts with (`initialItems`) that work only inside it. Without one it renders nothing of what it holds.
|
|
@@ -6844,6 +6921,12 @@ export declare interface ElementSpec {
|
|
|
6844
6921
|
* would repeat it.
|
|
6845
6922
|
*/
|
|
6846
6923
|
anchor?: string;
|
|
6924
|
+
/**
|
|
6925
|
+
* How it arrives and whether it keeps moving — `{ enter: 'fade-up', on: 'view' }`, `{ loop: 'float' }`,
|
|
6926
|
+
* `{ enter: 'scale', stagger: 60 }` for children that arrive one after another. Played by the SDK's stylesheet,
|
|
6927
|
+
* opacity and transforms only, and stilled for a visitor who asked for less motion. See motion.md.
|
|
6928
|
+
*/
|
|
6929
|
+
motion?: ElementMotion;
|
|
6847
6930
|
/**
|
|
6848
6931
|
* The feature flag this exists under: `'newCheckout'` exists only while the flag is on, `'!newCheckout'` only while
|
|
6849
6932
|
* it is off — the old version, kept until the new one ships. Not a visibility: gated off, it is not rendered at all,
|
|
@@ -7508,6 +7591,12 @@ export declare const inspectPage: (driver: PageEvaluator, handles: SpaceHandles,
|
|
|
7508
7591
|
*/
|
|
7509
7592
|
export declare const inspectRenders: (page: RenderEvaluator, act: () => Promise<unknown>, options?: RenderOptions) => Promise<RenderReport>;
|
|
7510
7593
|
|
|
7594
|
+
/**
|
|
7595
|
+
* A component's instance, which has no node of its own: the component's root is drawn where it is placed and carries
|
|
7596
|
+
* the instance's name beside the component's (`data-plitzi-instance`, see `RootElement`).
|
|
7597
|
+
*/
|
|
7598
|
+
export declare const instanceSelectorFor: (id: string) => string;
|
|
7599
|
+
|
|
7511
7600
|
declare const interactionBasicTriggers: Record<string, InteractionCallback>;
|
|
7512
7601
|
|
|
7513
7602
|
export declare type InteractionCallback<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
@@ -7847,6 +7936,29 @@ export declare const modalContainer: {
|
|
|
7847
7936
|
/** The name of the class an element's own rules on top of its classes become. */
|
|
7848
7937
|
export declare const modifierClassName: (elementId: string) => string;
|
|
7849
7938
|
|
|
7939
|
+
/**
|
|
7940
|
+
* An element's declared motion — how it arrives, when, and whether it keeps moving — which the SDK's own stylesheet
|
|
7941
|
+
* plays (`_motion.scss`). Every preset moves only `opacity` and `transform`, which the compositor animates without
|
|
7942
|
+
* laying the page out again, and every one is stilled for a visitor who asked for less motion: the motion good
|
|
7943
|
+
* practices, kept by construction rather than by the author.
|
|
7944
|
+
*
|
|
7945
|
+
* The one description the authoring package, the builder's Motion tab, the MCP and the validator all read; the
|
|
7946
|
+
* stylesheet mirrors its presets and frames, and a test in `apps/sdk` holds the two together.
|
|
7947
|
+
*/
|
|
7948
|
+
declare const MOTION_ENTERS: readonly ["fade", "fade-up", "fade-down", "slide-left", "slide-right", "scale"];
|
|
7949
|
+
|
|
7950
|
+
/** A motion that repeats: a gentle rise and fall, a breath, a turn, a sway. Held until the page is live. */
|
|
7951
|
+
declare const MOTION_LOOPS: readonly ["float", "pulse", "spin", "sway"];
|
|
7952
|
+
|
|
7953
|
+
/** As the page loads, or as the element scrolls into view — tied to the scroll, so it plays at the reader's pace. */
|
|
7954
|
+
declare const MOTION_TRIGGERS: readonly ["load", "view"];
|
|
7955
|
+
|
|
7956
|
+
declare type MotionEnter = (typeof MOTION_ENTERS)[number];
|
|
7957
|
+
|
|
7958
|
+
declare type MotionLoop = (typeof MOTION_LOOPS)[number];
|
|
7959
|
+
|
|
7960
|
+
declare type MotionTrigger = (typeof MOTION_TRIGGERS)[number];
|
|
7961
|
+
|
|
7850
7962
|
/**
|
|
7851
7963
|
* Moves one entry between two lists, and does nothing if it is not in the first.
|
|
7852
7964
|
*
|
|
@@ -8337,6 +8449,17 @@ export declare interface PageHandle extends ElementHandle {
|
|
|
8337
8449
|
elements: Record<string, ElementHandle>;
|
|
8338
8450
|
}
|
|
8339
8451
|
|
|
8452
|
+
export declare interface PageIssue {
|
|
8453
|
+
code: PageIssueCode;
|
|
8454
|
+
/** The sentence, as `problems` holds it. */
|
|
8455
|
+
message: string;
|
|
8456
|
+
/** The space's element it is about, by id — absent for one about the page as a whole, or outside every element. */
|
|
8457
|
+
elementId?: string;
|
|
8458
|
+
}
|
|
8459
|
+
|
|
8460
|
+
/** What kind of problem a page check found: what a tool branches on, where `message` is what a person reads. */
|
|
8461
|
+
export declare type PageIssueCode = 'not-rendered' | 'element-missing' | 'element-hidden' | 'image-not-loaded' | 'sideways-scroll' | 'illegible-text';
|
|
8462
|
+
|
|
8340
8463
|
/**
|
|
8341
8464
|
* Runs in the page that was pictured: its parts, where they are on the full page — its landmarks (header, nav, main,
|
|
8342
8465
|
* footer, each section and aside), or, on a page that has none, the named blocks right inside the page. Each named by
|
|
@@ -8356,6 +8479,13 @@ export declare interface PageReport {
|
|
|
8356
8479
|
* together, instead of stopping at the first locator that timed out and saying only that it did.
|
|
8357
8480
|
*/
|
|
8358
8481
|
problems: string[];
|
|
8482
|
+
/** The same problems as data — each with its `code` and the element it is about — for a tool to act on. */
|
|
8483
|
+
issues: PageIssue[];
|
|
8484
|
+
/**
|
|
8485
|
+
* Owed, and hidden at this width on purpose — a breakpoint's `display: none`, the menu a phone shows instead: not a
|
|
8486
|
+
* problem, and said so a reader knows they were looked at. Checked at the width they show at.
|
|
8487
|
+
*/
|
|
8488
|
+
hiddenAtWidth: string[];
|
|
8359
8489
|
}
|
|
8360
8490
|
|
|
8361
8491
|
export declare interface PageSpec {
|
|
@@ -8589,6 +8719,8 @@ export declare interface PluginDeclarationData {
|
|
|
8589
8719
|
type: string;
|
|
8590
8720
|
/** The source name it publishes under, when it publishes one. */
|
|
8591
8721
|
sourceType?: string;
|
|
8722
|
+
/** Behaviour rather than content: it draws nothing on a page, so no check waits for it on screen. */
|
|
8723
|
+
drawsNothing?: boolean;
|
|
8592
8724
|
/** The events it fires beyond the ones every element does, by action. */
|
|
8593
8725
|
triggers?: Readonly<Record<string, {
|
|
8594
8726
|
action: string;
|
|
@@ -8707,12 +8839,23 @@ export declare interface ProbeFindings {
|
|
|
8707
8839
|
id: string;
|
|
8708
8840
|
reason: string;
|
|
8709
8841
|
}[];
|
|
8710
|
-
|
|
8842
|
+
/** Owed, and hidden at this width by a breakpoint on purpose — checked at the width it shows at, not a problem. */
|
|
8843
|
+
byWidth: string[];
|
|
8844
|
+
/** Each with the element it is in, by id, when one of the space's holds it. */
|
|
8845
|
+
brokenImages: {
|
|
8846
|
+
source: string;
|
|
8847
|
+
elementId?: string;
|
|
8848
|
+
}[];
|
|
8849
|
+
/** `elementIds`: the widest ones the space named, for a tool to point at. */
|
|
8711
8850
|
overflow: {
|
|
8712
8851
|
pixels: number;
|
|
8713
8852
|
widest: string[];
|
|
8853
|
+
elementIds: string[];
|
|
8714
8854
|
} | null;
|
|
8715
|
-
illegible:
|
|
8855
|
+
illegible: {
|
|
8856
|
+
text: string;
|
|
8857
|
+
elementId?: string;
|
|
8858
|
+
}[];
|
|
8716
8859
|
}
|
|
8717
8860
|
|
|
8718
8861
|
/**
|
|
@@ -9209,13 +9352,13 @@ export declare const SCROLL_CALLBACKS: {
|
|
|
9209
9352
|
type: "select";
|
|
9210
9353
|
description: string;
|
|
9211
9354
|
default: string;
|
|
9212
|
-
options: ("
|
|
9355
|
+
options: ("end" | "start" | "center" | "nearest")[];
|
|
9213
9356
|
};
|
|
9214
9357
|
inline: {
|
|
9215
9358
|
type: "select";
|
|
9216
9359
|
description: string;
|
|
9217
9360
|
default: string;
|
|
9218
|
-
options: ("
|
|
9361
|
+
options: ("end" | "start" | "center" | "nearest")[];
|
|
9219
9362
|
};
|
|
9220
9363
|
behavior: BuiltinParam;
|
|
9221
9364
|
};
|
|
@@ -9684,12 +9827,17 @@ export declare type SpecCorrectionCode = 'legacy-element-id' | 'legacy-element-t
|
|
|
9684
9827
|
* it — or on one of its steps, by the flow it is in and its place there.
|
|
9685
9828
|
*/
|
|
9686
9829
|
export declare interface SpecEdit extends Omit<FixChange, 'on'> {
|
|
9687
|
-
|
|
9830
|
+
/** `children`: the children it holds — only its words and an icon — written as its own `content` and `icon`. */
|
|
9831
|
+
on: 'attribute' | 'field' | 'binding' | 'step' | 'children';
|
|
9688
9832
|
/** For a step: which of the element's `flows`, and which step in it. */
|
|
9689
9833
|
step?: {
|
|
9690
9834
|
flow: number;
|
|
9691
9835
|
index: number;
|
|
9692
9836
|
};
|
|
9837
|
+
/** For `children`: the icon's class, when one of them is an icon. */
|
|
9838
|
+
icon?: string;
|
|
9839
|
+
/** For `children`: where the icon goes, when it came after the words. */
|
|
9840
|
+
iconPlacement?: 'after';
|
|
9693
9841
|
}
|
|
9694
9842
|
|
|
9695
9843
|
export declare interface SpecFromSpace {
|
|
@@ -9971,6 +10119,11 @@ declare const styleConstants: {
|
|
|
9971
10119
|
readonly BACKGROUND_ATTACHMENT: "background-attachment";
|
|
9972
10120
|
readonly BACKGROUND_BLEND_MODE: "background-blend-mode";
|
|
9973
10121
|
readonly MASK_IMAGE: "mask-image";
|
|
10122
|
+
readonly MASK_SIZE: "mask-size";
|
|
10123
|
+
readonly MASK_POSITION: "mask-position";
|
|
10124
|
+
readonly MASK_REPEAT: "mask-repeat";
|
|
10125
|
+
readonly MASK_COMPOSITE: "mask-composite";
|
|
10126
|
+
readonly WEBKIT_MASK_IMAGE: "-webkit-mask-image";
|
|
9974
10127
|
readonly BORDER_TOP_STYLE: "border-top-style";
|
|
9975
10128
|
readonly BORDER_TOP_WIDTH: "border-top-width";
|
|
9976
10129
|
readonly BORDER_TOP_COLOR: "border-top-color";
|
|
@@ -10105,6 +10258,9 @@ declare const styleConstants: {
|
|
|
10105
10258
|
readonly WEBKIT_LINE_CLAMP: "-webkit-line-clamp";
|
|
10106
10259
|
readonly WEBKIT_BOX_ORIENT: "-webkit-box-orient";
|
|
10107
10260
|
readonly WEBKIT_TEXT_FILL_COLOR: "-webkit-text-fill-color";
|
|
10261
|
+
readonly WEBKIT_BACKGROUND_CLIP: "-webkit-background-clip";
|
|
10262
|
+
readonly BOX_DECORATION_BREAK: "box-decoration-break";
|
|
10263
|
+
readonly WEBKIT_BOX_DECORATION_BREAK: "-webkit-box-decoration-break";
|
|
10108
10264
|
readonly FILL: "fill";
|
|
10109
10265
|
readonly STROKE: "stroke";
|
|
10110
10266
|
readonly STROKE_WIDTH: "stroke-width";
|