@plitzi/sdk-authoring 0.36.2 → 0.37.0
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 +55 -0
- package/dist/index.d.ts +431 -56
- package/dist/index.js +3367 -460
- package/package.json +7 -6
- package/skills/plitzi-authoring/SKILL.md +20 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-authoring",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/index.js",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"test": "vitest run",
|
|
32
32
|
"test:watch": "vitest",
|
|
33
33
|
"build:dev": "vite build --mode development",
|
|
34
|
+
"generate:attribute-names": "node scripts/generate-attribute-names.ts",
|
|
34
35
|
"build:prod": "vite build"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
@@ -44,11 +45,11 @@
|
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"@microsoft/api-extractor": "^7.59.1",
|
|
46
47
|
"@plitzi/plitzi-ui": "^1.6.21",
|
|
47
|
-
"@plitzi/sdk-elements": "0.
|
|
48
|
-
"@plitzi/sdk-interactions": "0.
|
|
49
|
-
"@plitzi/sdk-schema": "0.
|
|
50
|
-
"@plitzi/sdk-shared": "0.
|
|
51
|
-
"@plitzi/sdk-style": "0.
|
|
48
|
+
"@plitzi/sdk-elements": "0.37.0",
|
|
49
|
+
"@plitzi/sdk-interactions": "0.37.0",
|
|
50
|
+
"@plitzi/sdk-schema": "0.37.0",
|
|
51
|
+
"@plitzi/sdk-shared": "0.37.0",
|
|
52
|
+
"@plitzi/sdk-style": "0.37.0",
|
|
52
53
|
"@types/react": "^19.3.0",
|
|
53
54
|
"eslint": "^9.39.5",
|
|
54
55
|
"typescript": "^6.0.3",
|
|
@@ -99,7 +99,11 @@ property outside the vocabulary is an error naming the correct key (`paddingTop`
|
|
|
99
99
|
- **Fonts are declared, not assumed.** A `font-family` loads only if the space lists the face in `fonts`
|
|
100
100
|
(`{ source: 'google', family: 'Fraunces', fallback: 'Georgia, serif', weights: [400, 600], styles: ['normal'] }`);
|
|
101
101
|
the page server writes exactly that list into the document, and anything else renders in the fallback.
|
|
102
|
-
- Per element TYPE defaults go in `elements: { heading: { base: …, variants: { … } } }
|
|
102
|
+
- Per element TYPE defaults go in `elements: { heading: { base: …, states: { … }, variants: { … }, slots: { … } } }`
|
|
103
|
+
— `slots` dresses the type's other selectors (a modal's `rootContainer`) for every element of the type.
|
|
104
|
+
- **`:hover` is part of the selector, not a rule in `customCss`.** `styles('card', { css: { … }, states: { hover: { … } },
|
|
105
|
+
variants: { active: { … } } })`, and `states` beside an element's own `css`. Written in `customCss` it renders and
|
|
106
|
+
then cannot be read back or edited per breakpoint.
|
|
103
107
|
|
|
104
108
|
**Share a rule as a class, never as a spread.** Writing a rule set once in a `const` and spreading it into each
|
|
105
109
|
element's `css` shares the source and duplicates the document — one selector per element, so re-theming the card
|
|
@@ -115,8 +119,13 @@ Accepted anywhere a class name is — `class`, a `slot`, a page's `class` — an
|
|
|
115
119
|
names it. One name declared twice with rules that disagree is refused. `classes` at the top of the space is the
|
|
116
120
|
same mechanism for what describes the space rather than one section of it.
|
|
117
121
|
|
|
118
|
-
An element has exactly ONE base selector, so a
|
|
119
|
-
(`styles('button-primary', { ...base, … })`), never two classes layered on top of each other.
|
|
122
|
+
An element has exactly ONE base selector, so a look that never changes is its own class over a shared plain object
|
|
123
|
+
(`styles('button-primary', { ...base, … })`), never two classes layered on top of each other. A class's `variants`
|
|
124
|
+
are for what the page switches while it runs — a binding with the `styleVariant` transformer picks one.
|
|
125
|
+
|
|
126
|
+
**Shells go in `layouts`.** A header or a sidebar every page shows is a layout the pages name —
|
|
127
|
+
`layout: { id: 'app-shell', slot: 'main' }`, the slot being the element in the shell where the body goes — never a
|
|
128
|
+
copy on each page. `visible: false` starts an element hidden for a flow to reveal.
|
|
120
129
|
|
|
121
130
|
## Data
|
|
122
131
|
|
|
@@ -254,6 +263,14 @@ Everything a space is held to still applies, and two more things apply because a
|
|
|
254
263
|
`validateTemplate(template)` runs the same gate over a manifest you did not author here — one exported by the
|
|
255
264
|
builder, or edited by hand — before you publish it.
|
|
256
265
|
|
|
266
|
+
## From an exported JSON
|
|
267
|
+
|
|
268
|
+
Never rewrite an exported space by hand. `specFromSpace({ schema, style })` reads it into the spec that authors it,
|
|
269
|
+
repairing what an older builder left behind and listing each repair in `corrections`; `specToSource(spec,
|
|
270
|
+
{ exportName })` writes that spec as factory calls; `compareSpaces(original, authorSpace(spec))` must list nothing but
|
|
271
|
+
what `corrections` explains. The builder's **Export** (and `POST /utils/transform-to-authoring`) does all three. Edit
|
|
272
|
+
the code it writes from then on, not the JSON.
|
|
273
|
+
|
|
257
274
|
## Rules
|
|
258
275
|
|
|
259
276
|
1. **Never hand-write `flat`, element ids, `styleSelectors`, `beforeNode`/`afterNode`/`flowId`.** They are derived.
|