@plitzi/sdk-shared 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/authoring/declare.d.ts +6 -0
- package/dist/authoring/elementCallbacks.d.ts +2 -2
- package/dist/helpers/twigWrapper/Parser/ExpressionParser.mjs +11 -1
- package/dist/network/graphql/builder/Queries/InitQuery.d.ts +1 -1
- package/dist/network/graphql/builder/Queries/InitQuery.mjs +1 -1
- package/dist/network/graphql/sdk/Queries/InitQuery.d.ts +1 -1
- package/dist/network/graphql/sdk/Queries/InitQuery.mjs +1 -1
- package/dist/schema/motion.d.ts +77 -0
- package/dist/schema/motion.mjs +95 -0
- package/dist/schema/wire.mjs +24 -16
- package/dist/style/styleConstants.d.ts +10 -2
- package/dist/style/styleConstants.mjs +16 -0
- package/dist/types/SchemaTypes.d.ts +10 -2
- package/dist/types/ServerTypes.d.ts +13 -0
- package/package.json +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,129 @@
|
|
|
1
1
|
# @plitzi/sdk-shared
|
|
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
|
|
@@ -61,6 +61,12 @@ export interface ElementDeclarationData {
|
|
|
61
61
|
* surface to refuse a value outside it.
|
|
62
62
|
*/
|
|
63
63
|
attributeValues?: Record<string, readonly string[]>;
|
|
64
|
+
/**
|
|
65
|
+
* Whether the element is behaviour rather than content — a clock that fires a flow, a listener — and draws nothing on
|
|
66
|
+
* a page (at most a tag in the builder, to have something to select). Read by the page checks (`inspectPage`,
|
|
67
|
+
* `plitzi check`), which would otherwise wait for it to be on screen and report it hidden.
|
|
68
|
+
*/
|
|
69
|
+
drawsNothing?: boolean;
|
|
64
70
|
content?: {
|
|
65
71
|
attributes?: Record<string, unknown>;
|
|
66
72
|
definition?: {
|
|
@@ -53,13 +53,13 @@ export declare const SCROLL_CALLBACKS: {
|
|
|
53
53
|
type: "select";
|
|
54
54
|
description: string;
|
|
55
55
|
default: string;
|
|
56
|
-
options: ("
|
|
56
|
+
options: ("end" | "start" | "center" | "nearest")[];
|
|
57
57
|
};
|
|
58
58
|
inline: {
|
|
59
59
|
type: "select";
|
|
60
60
|
description: string;
|
|
61
61
|
default: string;
|
|
62
|
-
options: ("
|
|
62
|
+
options: ("end" | "start" | "center" | "nearest")[];
|
|
63
63
|
};
|
|
64
64
|
behavior: BuiltinParam;
|
|
65
65
|
};
|
|
@@ -234,6 +234,16 @@ var r = (e, t) => {
|
|
|
234
234
|
right: this.parsePower()
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
|
+
parseSignedAtom() {
|
|
238
|
+
return this.peek() === e.Minus && t(this.at(1)) ? this.maybeTrailingFilters({
|
|
239
|
+
type: "literal",
|
|
240
|
+
value: this.scanNumber()
|
|
241
|
+
}) : this.peek() === e.Minus ? (this.pos++, this.skipWs(), {
|
|
242
|
+
type: "unary",
|
|
243
|
+
operator: "-",
|
|
244
|
+
operand: this.parseSignedAtom()
|
|
245
|
+
}) : this.parseAtom();
|
|
246
|
+
}
|
|
237
247
|
parseDefault() {
|
|
238
248
|
if (this.skipWs(), this.peek() === e.Minus && t(this.at(1))) return this.maybeTrailingFilters({
|
|
239
249
|
type: "literal",
|
|
@@ -248,7 +258,7 @@ var r = (e, t) => {
|
|
|
248
258
|
for (this.skipWs(); this.peek() === e.Question && this.at(1) === e.Question;) this.pos += 2, this.skipWs(), n = {
|
|
249
259
|
type: "default",
|
|
250
260
|
value: n,
|
|
251
|
-
defaultExpr: this.
|
|
261
|
+
defaultExpr: this.parseSignedAtom()
|
|
252
262
|
}, this.skipWs();
|
|
253
263
|
return n;
|
|
254
264
|
}
|
|
@@ -9,5 +9,5 @@ export type TInitQuery = {
|
|
|
9
9
|
style: Style;
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
declare const InitQuery = "\n query InitQuery($environment: String!, $revision: Int) {\n PlatformFlags\n Space(environment: $environment, revision: $revision) {\n definition {\n name\n permanentUrl\n }\n schema {\n settings\n rsc\n flat {\n id\n definition {\n label\n type\n initialState\n styleSelectors\n bindings\n interactions\n parentId\n rootId\n items\n runtime\n loadStrategy\n flag {\n name\n is\n }\n anchor\n }\n attributes\n }\n pages\n components\n flags\n pageFolders {\n id\n name\n slug\n parentId\n }\n variables {\n name\n category\n type\n value\n subValues {\n when\n value\n }\n }\n }\n plugins {\n type\n resource\n settings\n }\n style {\n id\n platform\n variables\n mode\n fonts\n cache\n }\n }\n }\n";
|
|
12
|
+
declare const InitQuery = "\n query InitQuery($environment: String!, $revision: Int) {\n PlatformFlags\n Space(environment: $environment, revision: $revision) {\n definition {\n name\n permanentUrl\n }\n schema {\n settings\n rsc\n flat {\n id\n definition {\n label\n type\n initialState\n styleSelectors\n bindings\n interactions\n parentId\n rootId\n items\n runtime\n loadStrategy\n flag {\n name\n is\n }\n anchor\n motion {\n enter\n on\n duration\n delay\n stagger\n loop\n }\n }\n attributes\n }\n pages\n components\n flags\n pageFolders {\n id\n name\n slug\n parentId\n }\n variables {\n name\n category\n type\n value\n subValues {\n when\n value\n }\n }\n }\n plugins {\n type\n resource\n settings\n }\n style {\n id\n platform\n variables\n mode\n fonts\n cache\n }\n }\n }\n";
|
|
13
13
|
export default InitQuery;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
//#region src/network/graphql/builder/Queries/InitQuery.ts
|
|
2
|
-
var e = "\n query InitQuery($environment: String!, $revision: Int) {\n PlatformFlags\n Space(environment: $environment, revision: $revision) {\n definition {\n name\n permanentUrl\n }\n schema {\n settings\n rsc\n flat {\n id\n definition {\n label\n type\n initialState\n styleSelectors\n bindings\n interactions\n parentId\n rootId\n items\n runtime\n loadStrategy\n flag {\n name\n is\n }\n anchor\n }\n attributes\n }\n pages\n components\n flags\n pageFolders {\n id\n name\n slug\n parentId\n }\n variables {\n name\n category\n type\n value\n subValues {\n when\n value\n }\n }\n }\n plugins {\n type\n resource\n settings\n }\n style {\n id\n platform\n variables\n mode\n fonts\n cache\n }\n }\n }\n";
|
|
2
|
+
var e = "\n query InitQuery($environment: String!, $revision: Int) {\n PlatformFlags\n Space(environment: $environment, revision: $revision) {\n definition {\n name\n permanentUrl\n }\n schema {\n settings\n rsc\n flat {\n id\n definition {\n label\n type\n initialState\n styleSelectors\n bindings\n interactions\n parentId\n rootId\n items\n runtime\n loadStrategy\n flag {\n name\n is\n }\n anchor\n motion {\n enter\n on\n duration\n delay\n stagger\n loop\n }\n }\n attributes\n }\n pages\n components\n flags\n pageFolders {\n id\n name\n slug\n parentId\n }\n variables {\n name\n category\n type\n value\n subValues {\n when\n value\n }\n }\n }\n plugins {\n type\n resource\n settings\n }\n style {\n id\n platform\n variables\n mode\n fonts\n cache\n }\n }\n }\n";
|
|
3
3
|
//#endregion
|
|
4
4
|
export { e as default };
|
|
@@ -10,5 +10,5 @@ export type TInitQuery = {
|
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
declare const InitQuery = "\n query InitQuery($environment: String!, $revision: Int) {\n Space(environment: $environment, revision: $revision) {\n schema {\n settings\n rsc\n flat {\n id\n definition {\n label\n type\n initialState\n styleSelectors\n bindings\n interactions\n parentId\n rootId\n items\n runtime\n loadStrategy\n flag {\n name\n is\n }\n anchor\n }\n attributes\n }\n pages\n components\n flags\n pageFolders {\n id\n name\n slug\n parentId\n }\n variables {\n name\n type\n value\n subValues {\n when\n value\n }\n }\n }\n plugins {\n type\n resource\n settings\n }\n style {\n variables\n cache\n }\n # The schema fetch is the one moment a client-side render hears from the server at all, so the decision it\n # would have been handed in an SSR bootstrap travels here instead.\n render {\n overQuota\n }\n }\n }\n";
|
|
13
|
+
declare const InitQuery = "\n query InitQuery($environment: String!, $revision: Int) {\n Space(environment: $environment, revision: $revision) {\n schema {\n settings\n rsc\n flat {\n id\n definition {\n label\n type\n initialState\n styleSelectors\n bindings\n interactions\n parentId\n rootId\n items\n runtime\n loadStrategy\n flag {\n name\n is\n }\n anchor\n motion {\n enter\n on\n duration\n delay\n stagger\n loop\n }\n }\n attributes\n }\n pages\n components\n flags\n pageFolders {\n id\n name\n slug\n parentId\n }\n variables {\n name\n type\n value\n subValues {\n when\n value\n }\n }\n }\n plugins {\n type\n resource\n settings\n }\n style {\n variables\n cache\n }\n # The schema fetch is the one moment a client-side render hears from the server at all, so the decision it\n # would have been handed in an SSR bootstrap travels here instead.\n render {\n overQuota\n }\n }\n }\n";
|
|
14
14
|
export default InitQuery;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
//#region src/network/graphql/sdk/Queries/InitQuery.ts
|
|
2
|
-
var e = "\n query InitQuery($environment: String!, $revision: Int) {\n Space(environment: $environment, revision: $revision) {\n schema {\n settings\n rsc\n flat {\n id\n definition {\n label\n type\n initialState\n styleSelectors\n bindings\n interactions\n parentId\n rootId\n items\n runtime\n loadStrategy\n flag {\n name\n is\n }\n anchor\n }\n attributes\n }\n pages\n components\n flags\n pageFolders {\n id\n name\n slug\n parentId\n }\n variables {\n name\n type\n value\n subValues {\n when\n value\n }\n }\n }\n plugins {\n type\n resource\n settings\n }\n style {\n variables\n cache\n }\n # The schema fetch is the one moment a client-side render hears from the server at all, so the decision it\n # would have been handed in an SSR bootstrap travels here instead.\n render {\n overQuota\n }\n }\n }\n";
|
|
2
|
+
var e = "\n query InitQuery($environment: String!, $revision: Int) {\n Space(environment: $environment, revision: $revision) {\n schema {\n settings\n rsc\n flat {\n id\n definition {\n label\n type\n initialState\n styleSelectors\n bindings\n interactions\n parentId\n rootId\n items\n runtime\n loadStrategy\n flag {\n name\n is\n }\n anchor\n motion {\n enter\n on\n duration\n delay\n stagger\n loop\n }\n }\n attributes\n }\n pages\n components\n flags\n pageFolders {\n id\n name\n slug\n parentId\n }\n variables {\n name\n type\n value\n subValues {\n when\n value\n }\n }\n }\n plugins {\n type\n resource\n settings\n }\n style {\n variables\n cache\n }\n # The schema fetch is the one moment a client-side render hears from the server at all, so the decision it\n # would have been handed in an SSR bootstrap travels here instead.\n render {\n overQuota\n }\n }\n }\n";
|
|
3
3
|
//#endregion
|
|
4
4
|
export { e as default };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An element's declared motion — how it arrives, when, and whether it keeps moving — which the SDK's own stylesheet
|
|
3
|
+
* plays (`_motion.scss`). Every preset moves only `opacity` and `transform`, which the compositor animates without
|
|
4
|
+
* laying the page out again, and every one is stilled for a visitor who asked for less motion: the motion good
|
|
5
|
+
* practices, kept by construction rather than by the author.
|
|
6
|
+
*
|
|
7
|
+
* The one description the authoring package, the builder's Motion tab, the MCP and the validator all read; the
|
|
8
|
+
* stylesheet mirrors its presets and frames, and a test in `apps/sdk` holds the two together.
|
|
9
|
+
*/
|
|
10
|
+
export declare const MOTION_ENTERS: readonly ["fade", "fade-up", "fade-down", "slide-left", "slide-right", "scale"];
|
|
11
|
+
export type MotionEnter = (typeof MOTION_ENTERS)[number];
|
|
12
|
+
/** As the page loads, or as the element scrolls into view — tied to the scroll, so it plays at the reader's pace. */
|
|
13
|
+
export declare const MOTION_TRIGGERS: readonly ["load", "view"];
|
|
14
|
+
export type MotionTrigger = (typeof MOTION_TRIGGERS)[number];
|
|
15
|
+
/** A motion that repeats: a gentle rise and fall, a breath, a turn, a sway. Held until the page is live. */
|
|
16
|
+
export declare const MOTION_LOOPS: readonly ["float", "pulse", "spin", "sway"];
|
|
17
|
+
export type MotionLoop = (typeof MOTION_LOOPS)[number];
|
|
18
|
+
export interface ElementMotion {
|
|
19
|
+
/** How it arrives. */
|
|
20
|
+
enter?: MotionEnter;
|
|
21
|
+
/** When it arrives: `load` (the default) or `view`. */
|
|
22
|
+
on?: MotionTrigger;
|
|
23
|
+
/** How long it takes to arrive, in ms (600 by default). Ignored under `view`, which follows the scroll. */
|
|
24
|
+
duration?: number;
|
|
25
|
+
/** How long it waits before it does, in ms. */
|
|
26
|
+
delay?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Its CHILDREN arrive one after another, this many ms apart — a grid of cards, a list's rows — rather than the
|
|
29
|
+
* element itself. Up to the first 24; the rest arrive with the 24th.
|
|
30
|
+
*/
|
|
31
|
+
stagger?: number;
|
|
32
|
+
/** Keeps moving after it arrived. */
|
|
33
|
+
loop?: MotionLoop;
|
|
34
|
+
}
|
|
35
|
+
/** How long an arrival takes when it does not say, and the curve every arrival follows: quick out, gentle in. */
|
|
36
|
+
export declare const MOTION_DEFAULT_DURATION = 600;
|
|
37
|
+
export declare const MOTION_ENTER_EASING = "cubic-bezier(0.2, 0.7, 0.2, 1)";
|
|
38
|
+
/** Where each arrival starts from; it ends where the element is. */
|
|
39
|
+
export declare const MOTION_ENTER_FROM: Record<MotionEnter, {
|
|
40
|
+
opacity: number;
|
|
41
|
+
translate?: string;
|
|
42
|
+
scale?: string;
|
|
43
|
+
}>;
|
|
44
|
+
/**
|
|
45
|
+
* Each loop's one moving frame — its `transform` halfway through the period and back (`middle`), or at the end of
|
|
46
|
+
* one that keeps turning (`end`) — and its period and curve.
|
|
47
|
+
*/
|
|
48
|
+
export declare const MOTION_LOOP_FRAMES: Record<MotionLoop, {
|
|
49
|
+
transform: string;
|
|
50
|
+
at: 'middle' | 'end';
|
|
51
|
+
periodMs: number;
|
|
52
|
+
easing: string;
|
|
53
|
+
}>;
|
|
54
|
+
/** The longest a duration, a delay or a stagger may be: past it, a page is waiting on its decoration. */
|
|
55
|
+
export declare const MOTION_MAX_MS = 10000;
|
|
56
|
+
/** What is wrong with a value given as an element's `motion`, one sentence each — empty when it is one. */
|
|
57
|
+
export declare const motionProblems: (value: unknown) => string[];
|
|
58
|
+
export declare const isMotion: (value: unknown) => value is ElementMotion;
|
|
59
|
+
/**
|
|
60
|
+
* What an element with `motion` carries in the DOM: the presets as `data-motion-*` — what the stylesheet animates by —
|
|
61
|
+
* and its timings as custom properties. Nothing at all for an element with none, so its markup stays as it was.
|
|
62
|
+
*/
|
|
63
|
+
export declare const motionAttributes: (motion: ElementMotion | undefined) => {
|
|
64
|
+
attributes: Record<string, string>;
|
|
65
|
+
style: Record<string, string>;
|
|
66
|
+
};
|
|
67
|
+
/** Every element the SDK's stylesheet moves: an arrival, a staggered child, a loop. */
|
|
68
|
+
export declare const MOVING_SELECTOR = "[data-motion-enter], [data-motion-stagger] > *, [data-motion-loop]";
|
|
69
|
+
/**
|
|
70
|
+
* The builder's canvas, held still: what is being edited is shown as it ends up, rather than arriving again on every
|
|
71
|
+
* change. `MOTION_PLAY_CSS` is the canvas playing — loops included, which a page holds until it is live and an editor
|
|
72
|
+
* never is.
|
|
73
|
+
*/
|
|
74
|
+
export declare const MOTION_STILL_CSS = "[data-motion-enter], [data-motion-stagger] > *, [data-motion-loop] { animation: none !important; }";
|
|
75
|
+
export declare const MOTION_PLAY_CSS: string;
|
|
76
|
+
/** Whether an animation is one of the declared motion's — what replaying the canvas restarts, and nothing else. */
|
|
77
|
+
export declare const isMotionAnimation: (animation: object) => boolean;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { isRecord as e } from "../helpers/isRecord.mjs";
|
|
2
|
+
//#region src/schema/motion.ts
|
|
3
|
+
var t = [
|
|
4
|
+
"fade",
|
|
5
|
+
"fade-up",
|
|
6
|
+
"fade-down",
|
|
7
|
+
"slide-left",
|
|
8
|
+
"slide-right",
|
|
9
|
+
"scale"
|
|
10
|
+
], n = ["load", "view"], r = [
|
|
11
|
+
"float",
|
|
12
|
+
"pulse",
|
|
13
|
+
"spin",
|
|
14
|
+
"sway"
|
|
15
|
+
], i = 600, a = "cubic-bezier(0.2, 0.7, 0.2, 1)", o = {
|
|
16
|
+
fade: { opacity: 0 },
|
|
17
|
+
"fade-up": {
|
|
18
|
+
opacity: 0,
|
|
19
|
+
translate: "0 24px"
|
|
20
|
+
},
|
|
21
|
+
"fade-down": {
|
|
22
|
+
opacity: 0,
|
|
23
|
+
translate: "0 -24px"
|
|
24
|
+
},
|
|
25
|
+
"slide-left": {
|
|
26
|
+
opacity: 0,
|
|
27
|
+
translate: "32px 0"
|
|
28
|
+
},
|
|
29
|
+
"slide-right": {
|
|
30
|
+
opacity: 0,
|
|
31
|
+
translate: "-32px 0"
|
|
32
|
+
},
|
|
33
|
+
scale: {
|
|
34
|
+
opacity: 0,
|
|
35
|
+
scale: "0.94"
|
|
36
|
+
}
|
|
37
|
+
}, s = {
|
|
38
|
+
float: {
|
|
39
|
+
transform: "translateY(-8px)",
|
|
40
|
+
at: "middle",
|
|
41
|
+
periodMs: 6e3,
|
|
42
|
+
easing: "ease-in-out"
|
|
43
|
+
},
|
|
44
|
+
pulse: {
|
|
45
|
+
transform: "scale(1.04)",
|
|
46
|
+
at: "middle",
|
|
47
|
+
periodMs: 3e3,
|
|
48
|
+
easing: "ease-in-out"
|
|
49
|
+
},
|
|
50
|
+
spin: {
|
|
51
|
+
transform: "rotate(360deg)",
|
|
52
|
+
at: "end",
|
|
53
|
+
periodMs: 12e3,
|
|
54
|
+
easing: "linear"
|
|
55
|
+
},
|
|
56
|
+
sway: {
|
|
57
|
+
transform: "rotate(2deg)",
|
|
58
|
+
at: "middle",
|
|
59
|
+
periodMs: 5e3,
|
|
60
|
+
easing: "ease-in-out"
|
|
61
|
+
}
|
|
62
|
+
}, c = 1e4, l = (e, t) => typeof t == "string" && e.includes(t), u = /* @__PURE__ */ new Set([
|
|
63
|
+
"enter",
|
|
64
|
+
"on",
|
|
65
|
+
"duration",
|
|
66
|
+
"delay",
|
|
67
|
+
"stagger",
|
|
68
|
+
"loop"
|
|
69
|
+
]), d = (i) => {
|
|
70
|
+
if (!e(i)) return ["motion is an object: `{ enter: 'fade-up', on: 'view' }`"];
|
|
71
|
+
let a = [];
|
|
72
|
+
for (let e of Object.keys(i)) u.has(e) || a.push(`motion has no "${e}" — it takes enter, on, duration, delay, stagger and loop`);
|
|
73
|
+
i.enter !== void 0 && !l(t, i.enter) && a.push(`motion.enter is one of ${t.join(", ")}`), i.on !== void 0 && !l(n, i.on) && a.push(`motion.on is ${n.join(" or ")}`), i.loop !== void 0 && !l(r, i.loop) && a.push(`motion.loop is one of ${r.join(", ")}`);
|
|
74
|
+
for (let e of [
|
|
75
|
+
"duration",
|
|
76
|
+
"delay",
|
|
77
|
+
"stagger"
|
|
78
|
+
]) {
|
|
79
|
+
let t = i[e];
|
|
80
|
+
t !== void 0 && (typeof t != "number" || !Number.isFinite(t) || t < 0 || t > 1e4) && a.push(`motion.${e} is a number of ms from 0 to ${String(c)}`);
|
|
81
|
+
}
|
|
82
|
+
return i.enter === void 0 && i.loop === void 0 && a.push("motion says nothing to play: give it an `enter`, a `loop`, or both"), i.stagger !== void 0 && i.enter === void 0 && a.push("motion.stagger staggers the children’s `enter`: give it one"), a;
|
|
83
|
+
}, f = (e) => d(e).length === 0, p = (e) => {
|
|
84
|
+
if (!e) return {
|
|
85
|
+
attributes: {},
|
|
86
|
+
style: {}
|
|
87
|
+
};
|
|
88
|
+
let t = {}, n = {};
|
|
89
|
+
return e.enter && (t[e.stagger === void 0 ? "data-motion-enter" : "data-motion-stagger"] = e.enter, t["data-motion-on"] = e.on ?? "load"), e.loop && (t["data-motion-loop"] = e.loop), e.duration !== void 0 && (n["--plitzi-motion-duration"] = `${String(e.duration)}ms`), e.delay !== void 0 && (n["--plitzi-motion-delay"] = `${String(e.delay)}ms`), e.stagger !== void 0 && (n["--plitzi-motion-stagger"] = `${String(e.stagger)}ms`), {
|
|
90
|
+
attributes: t,
|
|
91
|
+
style: n
|
|
92
|
+
};
|
|
93
|
+
}, m = "[data-motion-enter], [data-motion-stagger] > *, [data-motion-loop]", h = `${m} { animation: none !important; }`, g = ["[data-motion-loop] { animation-play-state: running, running !important; }", "[data-motion-on=\"view\"][data-motion-enter], [data-motion-on=\"view\"][data-motion-stagger] > * { animation-timeline: auto, auto !important; }"].join("\n"), _ = (e) => "animationName" in e && typeof e.animationName == "string" && e.animationName.startsWith("plitzi-motion-");
|
|
94
|
+
//#endregion
|
|
95
|
+
export { i as MOTION_DEFAULT_DURATION, t as MOTION_ENTERS, a as MOTION_ENTER_EASING, o as MOTION_ENTER_FROM, r as MOTION_LOOPS, s as MOTION_LOOP_FRAMES, c as MOTION_MAX_MS, g as MOTION_PLAY_CSS, h as MOTION_STILL_CSS, n as MOTION_TRIGGERS, m as MOVING_SELECTOR, f as isMotion, _ as isMotionAnimation, p as motionAttributes, d as motionProblems };
|
package/dist/schema/wire.mjs
CHANGED
|
@@ -2,26 +2,34 @@
|
|
|
2
2
|
var e = (e) => ({
|
|
3
3
|
...e,
|
|
4
4
|
flat: Object.values(e.flat)
|
|
5
|
-
}), t = (
|
|
6
|
-
|
|
5
|
+
}), t = (e) => ({
|
|
6
|
+
...e.enter ? { enter: e.enter } : {},
|
|
7
|
+
...e.on ? { on: e.on } : {},
|
|
8
|
+
...typeof e.duration == "number" ? { duration: e.duration } : {},
|
|
9
|
+
...typeof e.delay == "number" ? { delay: e.delay } : {},
|
|
10
|
+
...typeof e.stagger == "number" ? { stagger: e.stagger } : {},
|
|
11
|
+
...e.loop ? { loop: e.loop } : {}
|
|
12
|
+
}), n = ({ definition: e, ...n }) => {
|
|
13
|
+
let { parentId: r, items: i, bindings: a, interactions: o, initialState: s, runtime: c, loadStrategy: l, flag: u, anchor: d, motion: f, ...p } = e;
|
|
7
14
|
return {
|
|
8
|
-
...
|
|
15
|
+
...n,
|
|
9
16
|
definition: {
|
|
10
|
-
...
|
|
11
|
-
...
|
|
12
|
-
...
|
|
13
|
-
...
|
|
14
|
-
...
|
|
15
|
-
...
|
|
16
|
-
...
|
|
17
|
-
...
|
|
18
|
-
...
|
|
19
|
-
...
|
|
17
|
+
...p,
|
|
18
|
+
...r == null ? {} : { parentId: r },
|
|
19
|
+
...i == null ? {} : { items: i },
|
|
20
|
+
...a == null ? {} : { bindings: a },
|
|
21
|
+
...o == null ? {} : { interactions: o },
|
|
22
|
+
...s == null ? {} : { initialState: s },
|
|
23
|
+
...c == null ? {} : { runtime: c },
|
|
24
|
+
...l == null ? {} : { loadStrategy: l },
|
|
25
|
+
...u == null ? {} : { flag: u },
|
|
26
|
+
...d == null ? {} : { anchor: d },
|
|
27
|
+
...f == null ? {} : { motion: t(f) }
|
|
20
28
|
}
|
|
21
29
|
};
|
|
22
|
-
},
|
|
30
|
+
}, r = (e) => ({
|
|
23
31
|
...e,
|
|
24
|
-
flat: Object.fromEntries(e.flat.map((e) => [e.id,
|
|
32
|
+
flat: Object.fromEntries(e.flat.map((e) => [e.id, n(e)]))
|
|
25
33
|
});
|
|
26
34
|
//#endregion
|
|
27
|
-
export {
|
|
35
|
+
export { n as elementFromWire, r as schemaFromWire, e as schemaToWire };
|
|
@@ -42,6 +42,11 @@ declare const styleConstants: {
|
|
|
42
42
|
readonly BACKGROUND_ATTACHMENT: "background-attachment";
|
|
43
43
|
readonly BACKGROUND_BLEND_MODE: "background-blend-mode";
|
|
44
44
|
readonly MASK_IMAGE: "mask-image";
|
|
45
|
+
readonly MASK_SIZE: "mask-size";
|
|
46
|
+
readonly MASK_POSITION: "mask-position";
|
|
47
|
+
readonly MASK_REPEAT: "mask-repeat";
|
|
48
|
+
readonly MASK_COMPOSITE: "mask-composite";
|
|
49
|
+
readonly WEBKIT_MASK_IMAGE: "-webkit-mask-image";
|
|
45
50
|
readonly BORDER_TOP_STYLE: "border-top-style";
|
|
46
51
|
readonly BORDER_TOP_WIDTH: "border-top-width";
|
|
47
52
|
readonly BORDER_TOP_COLOR: "border-top-color";
|
|
@@ -176,14 +181,17 @@ declare const styleConstants: {
|
|
|
176
181
|
readonly WEBKIT_LINE_CLAMP: "-webkit-line-clamp";
|
|
177
182
|
readonly WEBKIT_BOX_ORIENT: "-webkit-box-orient";
|
|
178
183
|
readonly WEBKIT_TEXT_FILL_COLOR: "-webkit-text-fill-color";
|
|
184
|
+
readonly WEBKIT_BACKGROUND_CLIP: "-webkit-background-clip";
|
|
185
|
+
readonly BOX_DECORATION_BREAK: "box-decoration-break";
|
|
186
|
+
readonly WEBKIT_BOX_DECORATION_BREAK: "-webkit-box-decoration-break";
|
|
179
187
|
readonly FILL: "fill";
|
|
180
188
|
readonly STROKE: "stroke";
|
|
181
189
|
readonly STROKE_WIDTH: "stroke-width";
|
|
182
190
|
};
|
|
183
191
|
export declare const inheritableAttributesBase: StyleCategory[];
|
|
184
192
|
export declare const StyleBindingsAllowed: {
|
|
185
|
-
path: "color" | "cursor" | "filter" | "fill" | "display" | "flex-wrap" | "flex-direction" | "align-items" | "justify-items" | "justify-content" | "align-content" | "row-gap" | "column-gap" | "grid-row-gap" | "grid-column-gap" | "grid-template-areas" | "grid-template-columns" | "grid-template-rows" | "grid-auto-flow" | "grid-auto-rows" | "grid-auto-columns" | "grid-row-start" | "grid-column-start" | "grid-row-end" | "grid-column-end" | "align-self" | "justify-self" | "order" | "flex-grow" | "flex-shrink" | "flex-basis" | "list-style" | "list-style-type" | "list-style-position" | "list-style-image" | "background-color" | "background-image" | "background-position" | "background-size" | "background-repeat" | "background-origin" | "background-clip" | "background-attachment" | "background-blend-mode" | "mask-image" | "border-top-style" | "border-top-width" | "border-top-color" | "border-bottom-style" | "border-bottom-width" | "border-bottom-color" | "border-left-style" | "border-left-width" | "border-left-color" | "border-right-style" | "border-right-width" | "border-right-color" | "border-top-left-radius" | "border-top-right-radius" | "border-bottom-left-radius" | "border-bottom-right-radius" | "border-collapse" | "border-spacing" | "table-layout" | "opacity" | "visibility" | "transition" | "transition-property" | "transition-duration" | "transition-timing-function" | "transition-delay" | "transition-behavior" | "animation" | "animation-name" | "animation-duration" | "animation-timing-function" | "animation-delay" | "animation-iteration-count" | "animation-direction" | "animation-fill-mode" | "animation-play-state" | "animation-timeline" | "animation-range" | "box-shadow" | "backdrop-filter" | "mix-blend-mode" | "isolation" | "clip-path" | "transform" | "transform-origin" | "perspective" | "will-change" | "outline-width" | "outline-style" | "outline-color" | "outline-offset" | "pointer-events" | "user-select" | "touch-action" | "resize" | "appearance" | "scroll-behavior" | "overscroll-behavior" | "scroll-snap-type" | "scroll-snap-align" | "scroll-snap-stop" | "scroll-padding-top" | "scroll-margin-top" | "accent-color" | "caret-color" | "color-scheme" | "position" | "float" | "clear" | "z-index" | "top" | "bottom" | "left" | "right" | "box-sizing" | "aspect-ratio" | "width" | "height" | "min-width" | "min-height" | "max-width" | "max-height" | "overflow" | "overflow-x" | "overflow-y" | "scrollbar-width" | "scrollbar-color" | "object-fit" | "object-position" | "column-width" | "column-count" | "margin-top" | "margin-bottom" | "margin-left" | "margin-right" | "padding-top" | "padding-bottom" | "padding-left" | "padding-right" | "font-family" | "font-weight" | "font-size" | "line-height" | "text-align" | "font-style" | "font-variant" | "font-variant-numeric" | "font-feature-settings" | "text-decoration" | "text-decoration-line" | "text-decoration-color" | "text-decoration-style" | "text-decoration-thickness" | "text-underline-offset" | "letter-spacing" | "word-spacing" | "text-indent" | "text-transform" | "direction" | "white-space" | "text-wrap" | "word-break" | "overflow-wrap" | "hyphens" | "vertical-align" | "text-overflow" | "text-shadow" | "line-clamp" | "-webkit-line-clamp" | "-webkit-box-orient" | "-webkit-text-fill-color" | "stroke" | "stroke-width";
|
|
186
|
-
label: "color" | "cursor" | "filter" | "fill" | "display" | "flex-wrap" | "flex-direction" | "align-items" | "justify-items" | "justify-content" | "align-content" | "row-gap" | "column-gap" | "grid-row-gap" | "grid-column-gap" | "grid-template-areas" | "grid-template-columns" | "grid-template-rows" | "grid-auto-flow" | "grid-auto-rows" | "grid-auto-columns" | "grid-row-start" | "grid-column-start" | "grid-row-end" | "grid-column-end" | "align-self" | "justify-self" | "order" | "flex-grow" | "flex-shrink" | "flex-basis" | "list-style" | "list-style-type" | "list-style-position" | "list-style-image" | "background-color" | "background-image" | "background-position" | "background-size" | "background-repeat" | "background-origin" | "background-clip" | "background-attachment" | "background-blend-mode" | "mask-image" | "border-top-style" | "border-top-width" | "border-top-color" | "border-bottom-style" | "border-bottom-width" | "border-bottom-color" | "border-left-style" | "border-left-width" | "border-left-color" | "border-right-style" | "border-right-width" | "border-right-color" | "border-top-left-radius" | "border-top-right-radius" | "border-bottom-left-radius" | "border-bottom-right-radius" | "border-collapse" | "border-spacing" | "table-layout" | "opacity" | "visibility" | "transition" | "transition-property" | "transition-duration" | "transition-timing-function" | "transition-delay" | "transition-behavior" | "animation" | "animation-name" | "animation-duration" | "animation-timing-function" | "animation-delay" | "animation-iteration-count" | "animation-direction" | "animation-fill-mode" | "animation-play-state" | "animation-timeline" | "animation-range" | "box-shadow" | "backdrop-filter" | "mix-blend-mode" | "isolation" | "clip-path" | "transform" | "transform-origin" | "perspective" | "will-change" | "outline-width" | "outline-style" | "outline-color" | "outline-offset" | "pointer-events" | "user-select" | "touch-action" | "resize" | "appearance" | "scroll-behavior" | "overscroll-behavior" | "scroll-snap-type" | "scroll-snap-align" | "scroll-snap-stop" | "scroll-padding-top" | "scroll-margin-top" | "accent-color" | "caret-color" | "color-scheme" | "position" | "float" | "clear" | "z-index" | "top" | "bottom" | "left" | "right" | "box-sizing" | "aspect-ratio" | "width" | "height" | "min-width" | "min-height" | "max-width" | "max-height" | "overflow" | "overflow-x" | "overflow-y" | "scrollbar-width" | "scrollbar-color" | "object-fit" | "object-position" | "column-width" | "column-count" | "margin-top" | "margin-bottom" | "margin-left" | "margin-right" | "padding-top" | "padding-bottom" | "padding-left" | "padding-right" | "font-family" | "font-weight" | "font-size" | "line-height" | "text-align" | "font-style" | "font-variant" | "font-variant-numeric" | "font-feature-settings" | "text-decoration" | "text-decoration-line" | "text-decoration-color" | "text-decoration-style" | "text-decoration-thickness" | "text-underline-offset" | "letter-spacing" | "word-spacing" | "text-indent" | "text-transform" | "direction" | "white-space" | "text-wrap" | "word-break" | "overflow-wrap" | "hyphens" | "vertical-align" | "text-overflow" | "text-shadow" | "line-clamp" | "-webkit-line-clamp" | "-webkit-box-orient" | "-webkit-text-fill-color" | "stroke" | "stroke-width";
|
|
193
|
+
path: "color" | "cursor" | "filter" | "fill" | "display" | "flex-wrap" | "flex-direction" | "align-items" | "justify-items" | "justify-content" | "align-content" | "row-gap" | "column-gap" | "grid-row-gap" | "grid-column-gap" | "grid-template-areas" | "grid-template-columns" | "grid-template-rows" | "grid-auto-flow" | "grid-auto-rows" | "grid-auto-columns" | "grid-row-start" | "grid-column-start" | "grid-row-end" | "grid-column-end" | "align-self" | "justify-self" | "order" | "flex-grow" | "flex-shrink" | "flex-basis" | "list-style" | "list-style-type" | "list-style-position" | "list-style-image" | "background-color" | "background-image" | "background-position" | "background-size" | "background-repeat" | "background-origin" | "background-clip" | "background-attachment" | "background-blend-mode" | "mask-image" | "mask-size" | "mask-position" | "mask-repeat" | "mask-composite" | "-webkit-mask-image" | "border-top-style" | "border-top-width" | "border-top-color" | "border-bottom-style" | "border-bottom-width" | "border-bottom-color" | "border-left-style" | "border-left-width" | "border-left-color" | "border-right-style" | "border-right-width" | "border-right-color" | "border-top-left-radius" | "border-top-right-radius" | "border-bottom-left-radius" | "border-bottom-right-radius" | "border-collapse" | "border-spacing" | "table-layout" | "opacity" | "visibility" | "transition" | "transition-property" | "transition-duration" | "transition-timing-function" | "transition-delay" | "transition-behavior" | "animation" | "animation-name" | "animation-duration" | "animation-timing-function" | "animation-delay" | "animation-iteration-count" | "animation-direction" | "animation-fill-mode" | "animation-play-state" | "animation-timeline" | "animation-range" | "box-shadow" | "backdrop-filter" | "mix-blend-mode" | "isolation" | "clip-path" | "transform" | "transform-origin" | "perspective" | "will-change" | "outline-width" | "outline-style" | "outline-color" | "outline-offset" | "pointer-events" | "user-select" | "touch-action" | "resize" | "appearance" | "scroll-behavior" | "overscroll-behavior" | "scroll-snap-type" | "scroll-snap-align" | "scroll-snap-stop" | "scroll-padding-top" | "scroll-margin-top" | "accent-color" | "caret-color" | "color-scheme" | "position" | "float" | "clear" | "z-index" | "top" | "bottom" | "left" | "right" | "box-sizing" | "aspect-ratio" | "width" | "height" | "min-width" | "min-height" | "max-width" | "max-height" | "overflow" | "overflow-x" | "overflow-y" | "scrollbar-width" | "scrollbar-color" | "object-fit" | "object-position" | "column-width" | "column-count" | "margin-top" | "margin-bottom" | "margin-left" | "margin-right" | "padding-top" | "padding-bottom" | "padding-left" | "padding-right" | "font-family" | "font-weight" | "font-size" | "line-height" | "text-align" | "font-style" | "font-variant" | "font-variant-numeric" | "font-feature-settings" | "text-decoration" | "text-decoration-line" | "text-decoration-color" | "text-decoration-style" | "text-decoration-thickness" | "text-underline-offset" | "letter-spacing" | "word-spacing" | "text-indent" | "text-transform" | "direction" | "white-space" | "text-wrap" | "word-break" | "overflow-wrap" | "hyphens" | "vertical-align" | "text-overflow" | "text-shadow" | "line-clamp" | "-webkit-line-clamp" | "-webkit-box-orient" | "-webkit-text-fill-color" | "-webkit-background-clip" | "box-decoration-break" | "-webkit-box-decoration-break" | "stroke" | "stroke-width";
|
|
194
|
+
label: "color" | "cursor" | "filter" | "fill" | "display" | "flex-wrap" | "flex-direction" | "align-items" | "justify-items" | "justify-content" | "align-content" | "row-gap" | "column-gap" | "grid-row-gap" | "grid-column-gap" | "grid-template-areas" | "grid-template-columns" | "grid-template-rows" | "grid-auto-flow" | "grid-auto-rows" | "grid-auto-columns" | "grid-row-start" | "grid-column-start" | "grid-row-end" | "grid-column-end" | "align-self" | "justify-self" | "order" | "flex-grow" | "flex-shrink" | "flex-basis" | "list-style" | "list-style-type" | "list-style-position" | "list-style-image" | "background-color" | "background-image" | "background-position" | "background-size" | "background-repeat" | "background-origin" | "background-clip" | "background-attachment" | "background-blend-mode" | "mask-image" | "mask-size" | "mask-position" | "mask-repeat" | "mask-composite" | "-webkit-mask-image" | "border-top-style" | "border-top-width" | "border-top-color" | "border-bottom-style" | "border-bottom-width" | "border-bottom-color" | "border-left-style" | "border-left-width" | "border-left-color" | "border-right-style" | "border-right-width" | "border-right-color" | "border-top-left-radius" | "border-top-right-radius" | "border-bottom-left-radius" | "border-bottom-right-radius" | "border-collapse" | "border-spacing" | "table-layout" | "opacity" | "visibility" | "transition" | "transition-property" | "transition-duration" | "transition-timing-function" | "transition-delay" | "transition-behavior" | "animation" | "animation-name" | "animation-duration" | "animation-timing-function" | "animation-delay" | "animation-iteration-count" | "animation-direction" | "animation-fill-mode" | "animation-play-state" | "animation-timeline" | "animation-range" | "box-shadow" | "backdrop-filter" | "mix-blend-mode" | "isolation" | "clip-path" | "transform" | "transform-origin" | "perspective" | "will-change" | "outline-width" | "outline-style" | "outline-color" | "outline-offset" | "pointer-events" | "user-select" | "touch-action" | "resize" | "appearance" | "scroll-behavior" | "overscroll-behavior" | "scroll-snap-type" | "scroll-snap-align" | "scroll-snap-stop" | "scroll-padding-top" | "scroll-margin-top" | "accent-color" | "caret-color" | "color-scheme" | "position" | "float" | "clear" | "z-index" | "top" | "bottom" | "left" | "right" | "box-sizing" | "aspect-ratio" | "width" | "height" | "min-width" | "min-height" | "max-width" | "max-height" | "overflow" | "overflow-x" | "overflow-y" | "scrollbar-width" | "scrollbar-color" | "object-fit" | "object-position" | "column-width" | "column-count" | "margin-top" | "margin-bottom" | "margin-left" | "margin-right" | "padding-top" | "padding-bottom" | "padding-left" | "padding-right" | "font-family" | "font-weight" | "font-size" | "line-height" | "text-align" | "font-style" | "font-variant" | "font-variant-numeric" | "font-feature-settings" | "text-decoration" | "text-decoration-line" | "text-decoration-color" | "text-decoration-style" | "text-decoration-thickness" | "text-underline-offset" | "letter-spacing" | "word-spacing" | "text-indent" | "text-transform" | "direction" | "white-space" | "text-wrap" | "word-break" | "overflow-wrap" | "hyphens" | "vertical-align" | "text-overflow" | "text-shadow" | "line-clamp" | "-webkit-line-clamp" | "-webkit-box-orient" | "-webkit-text-fill-color" | "-webkit-background-clip" | "box-decoration-break" | "-webkit-box-decoration-break" | "stroke" | "stroke-width";
|
|
187
195
|
}[];
|
|
188
196
|
export declare const baseDefaultValue: Record<StyleCategory, StyleValue>;
|
|
189
197
|
export default styleConstants;
|
|
@@ -55,6 +55,11 @@ var e = {
|
|
|
55
55
|
BACKGROUND_ATTACHMENT: "background-attachment",
|
|
56
56
|
BACKGROUND_BLEND_MODE: "background-blend-mode",
|
|
57
57
|
MASK_IMAGE: "mask-image",
|
|
58
|
+
MASK_SIZE: "mask-size",
|
|
59
|
+
MASK_POSITION: "mask-position",
|
|
60
|
+
MASK_REPEAT: "mask-repeat",
|
|
61
|
+
MASK_COMPOSITE: "mask-composite",
|
|
62
|
+
WEBKIT_MASK_IMAGE: "-webkit-mask-image",
|
|
58
63
|
BORDER_TOP_STYLE: "border-top-style",
|
|
59
64
|
BORDER_TOP_WIDTH: "border-top-width",
|
|
60
65
|
BORDER_TOP_COLOR: "border-top-color",
|
|
@@ -189,6 +194,9 @@ var e = {
|
|
|
189
194
|
WEBKIT_LINE_CLAMP: "-webkit-line-clamp",
|
|
190
195
|
WEBKIT_BOX_ORIENT: "-webkit-box-orient",
|
|
191
196
|
WEBKIT_TEXT_FILL_COLOR: "-webkit-text-fill-color",
|
|
197
|
+
WEBKIT_BACKGROUND_CLIP: "-webkit-background-clip",
|
|
198
|
+
BOX_DECORATION_BREAK: "box-decoration-break",
|
|
199
|
+
WEBKIT_BOX_DECORATION_BREAK: "-webkit-box-decoration-break",
|
|
192
200
|
FILL: "fill",
|
|
193
201
|
STROKE: "stroke",
|
|
194
202
|
STROKE_WIDTH: "stroke-width"
|
|
@@ -260,6 +268,11 @@ var e = {
|
|
|
260
268
|
[t.BACKGROUND_ATTACHMENT]: "scroll",
|
|
261
269
|
[t.BACKGROUND_BLEND_MODE]: "normal",
|
|
262
270
|
[t.MASK_IMAGE]: "none",
|
|
271
|
+
[t.MASK_SIZE]: "auto",
|
|
272
|
+
[t.MASK_POSITION]: "0% 0%",
|
|
273
|
+
[t.MASK_REPEAT]: "repeat",
|
|
274
|
+
[t.MASK_COMPOSITE]: "add",
|
|
275
|
+
[t.WEBKIT_MASK_IMAGE]: "none",
|
|
263
276
|
[t.BORDER_TOP_STYLE]: "solid",
|
|
264
277
|
[t.BORDER_TOP_WIDTH]: "0px",
|
|
265
278
|
[t.BORDER_TOP_COLOR]: "#000000",
|
|
@@ -394,6 +407,9 @@ var e = {
|
|
|
394
407
|
[t.WEBKIT_LINE_CLAMP]: "none",
|
|
395
408
|
[t.WEBKIT_BOX_ORIENT]: "horizontal",
|
|
396
409
|
[t.WEBKIT_TEXT_FILL_COLOR]: "currentcolor",
|
|
410
|
+
[t.WEBKIT_BACKGROUND_CLIP]: "border-box",
|
|
411
|
+
[t.BOX_DECORATION_BREAK]: "slice",
|
|
412
|
+
[t.WEBKIT_BOX_DECORATION_BREAK]: "slice",
|
|
397
413
|
[t.FILL]: "currentColor",
|
|
398
414
|
[t.STROKE]: "none",
|
|
399
415
|
[t.STROKE_WIDTH]: "1"
|
|
@@ -2,6 +2,7 @@ import { InteractionCallbackParamValues, InteractionCallbackType } from './Inter
|
|
|
2
2
|
import { ChannelDeclarations } from './RealtimeTypes';
|
|
3
3
|
import { SnippetStyle } from './SnippetTypes';
|
|
4
4
|
import { BuiltinParam } from '../authoring/paramSpec';
|
|
5
|
+
import { ElementMotion } from '../schema/motion';
|
|
5
6
|
import { RuleGroup } from '@plitzi/plitzi-ui/QueryBuilder';
|
|
6
7
|
export type ElementRuntime = 'server' | 'client' | 'shared';
|
|
7
8
|
/**
|
|
@@ -114,6 +115,8 @@ export type ElementDefinition = {
|
|
|
114
115
|
* for the platform, this names it for the URL. One per rendered page, layouts included (`isAnchor`).
|
|
115
116
|
*/
|
|
116
117
|
anchor?: string;
|
|
118
|
+
/** How it arrives and whether it keeps moving, played by the SDK's stylesheet. See {@link ElementMotion}. */
|
|
119
|
+
motion?: ElementMotion;
|
|
117
120
|
};
|
|
118
121
|
/**
|
|
119
122
|
* An element, keyed by the one name it answers to.
|
|
@@ -337,14 +340,19 @@ export type SchemaContextValue = {
|
|
|
337
340
|
schemaUpdateSettings?: (value: string | number | boolean, path?: string, fromSubscriptions?: boolean) => void;
|
|
338
341
|
};
|
|
339
342
|
/** The fields of a definition an element may go without — absent in a document, `null` from GraphQL. */
|
|
340
|
-
type OptionalDefinitionKey = 'parentId' | 'items' | 'bindings' | 'interactions' | 'initialState' | 'runtime' | 'loadStrategy' | 'flag' | 'anchor';
|
|
343
|
+
type OptionalDefinitionKey = 'parentId' | 'items' | 'bindings' | 'interactions' | 'initialState' | 'runtime' | 'loadStrategy' | 'flag' | 'anchor' | 'motion';
|
|
341
344
|
/**
|
|
342
345
|
* An element as it arrives on the wire. GraphQL answers every field a query names, so one the element does not have
|
|
343
346
|
* comes back `null` — where the element itself has nothing. `schemaFromWire` drops them on arrival.
|
|
344
347
|
*/
|
|
345
348
|
export type WireElement = Omit<Element, 'definition'> & {
|
|
346
349
|
definition: Omit<ElementDefinition, OptionalDefinitionKey> & {
|
|
347
|
-
[K in OptionalDefinitionKey]?: ElementDefinition[K] | null;
|
|
350
|
+
[K in Exclude<OptionalDefinitionKey, 'motion'>]?: ElementDefinition[K] | null;
|
|
351
|
+
} & {
|
|
352
|
+
/** Every field the query names, `null` where the motion has none. */
|
|
353
|
+
motion?: {
|
|
354
|
+
[K in keyof ElementMotion]?: ElementMotion[K] | null;
|
|
355
|
+
} | null;
|
|
348
356
|
};
|
|
349
357
|
};
|
|
350
358
|
export type SchemaRaw = {
|
|
@@ -136,6 +136,8 @@ export type SSRTemplateProps = {
|
|
|
136
136
|
reactCompilerRuntime?: string;
|
|
137
137
|
/** When true the client-side <script> block is omitted — useful for inspecting raw SSR HTML. */
|
|
138
138
|
ssrOnly?: boolean;
|
|
139
|
+
/** The page listens for the server saying the space changed, and loads again — with `devReload` on (`reloadPages`). */
|
|
140
|
+
devReload?: boolean;
|
|
139
141
|
debugMode?: boolean;
|
|
140
142
|
/**
|
|
141
143
|
* The theme class this document wears on `<html>` — `dark`, `light`, or nothing at all.
|
|
@@ -904,6 +906,12 @@ export type SSRServerConfig = {
|
|
|
904
906
|
publicDir?: string;
|
|
905
907
|
static?: Record<string, string>;
|
|
906
908
|
devMode?: boolean;
|
|
909
|
+
/**
|
|
910
|
+
* Every page this server renders listens for `reloadPages` and loads again — the edit loop of a project that authors
|
|
911
|
+
* its space in code and re-authors it on save. Off unless asked for, `devMode` included: each open page holds a
|
|
912
|
+
* connection to the server for it, which a server that never calls `reloadPages` would only pay for.
|
|
913
|
+
*/
|
|
914
|
+
devReload?: boolean;
|
|
907
915
|
/** Authorizes debugging on the pages this server renders. An SSR page loads the very same SDK, so this is the
|
|
908
916
|
* server-side face of the SDK's `debugMode` prop: the page decides, and the visitor's 'plitzi_debug' cookie can
|
|
909
917
|
* only narrow it. Left unset, `devMode` authorizes it — a development server debugs without being told to — and
|
|
@@ -1128,6 +1136,11 @@ export type SSRServer = {
|
|
|
1128
1136
|
close: () => Promise<void>;
|
|
1129
1137
|
readonly cache: CacheManager | null;
|
|
1130
1138
|
readonly plugins: PluginRegistry;
|
|
1139
|
+
/**
|
|
1140
|
+
* With `devReload` on, every page open on this server loads again — what a project that authors its space in code
|
|
1141
|
+
* calls once it wrote the new documents, instead of restarting the server. Nothing otherwise.
|
|
1142
|
+
*/
|
|
1143
|
+
reloadPages: () => void;
|
|
1131
1144
|
};
|
|
1132
1145
|
/** A key/value store with per-entry expiry, backing the OAuth layer's short-lived protocol state (registered
|
|
1133
1146
|
* clients, authorization codes, refresh grants). Values are opaque strings the SDK serialises itself. A
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-shared",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.3",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -1135,6 +1135,10 @@
|
|
|
1135
1135
|
"types": "./dist/schema/layoutChain.d.ts",
|
|
1136
1136
|
"import": "./dist/schema/layoutChain.mjs"
|
|
1137
1137
|
},
|
|
1138
|
+
"./schema/motion": {
|
|
1139
|
+
"types": "./dist/schema/motion.d.ts",
|
|
1140
|
+
"import": "./dist/schema/motion.mjs"
|
|
1141
|
+
},
|
|
1138
1142
|
"./schema/schemaConstants": {
|
|
1139
1143
|
"types": "./dist/schema/schemaConstants.d.ts",
|
|
1140
1144
|
"import": "./dist/schema/schemaConstants.mjs"
|