@plitzi/plitzi-builder 0.38.6 → 0.38.8

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 CHANGED
@@ -1,5 +1,236 @@
1
1
  # @plitzi/plitzi-builder
2
2
 
3
+ ## 0.38.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [1b45aae]
8
+ - @plitzi/sdk-authoring@0.38.8
9
+ - @plitzi/sdk-elements@0.38.8
10
+ - @plitzi/sdk-interactions@0.38.8
11
+ - @plitzi/sdk-schema@0.38.8
12
+ - @plitzi/sdk-shared@0.38.8
13
+ - @plitzi/plitzi-sdk@0.38.8
14
+ - @plitzi/sdk-dev-tools@0.38.8
15
+ - @plitzi/sdk-auth@0.38.8
16
+ - @plitzi/sdk-event-bridge@0.38.8
17
+ - @plitzi/sdk-navigation@0.38.8
18
+ - @plitzi/sdk-plugins@0.38.8
19
+ - @plitzi/sdk-style@0.38.8
20
+ - @plitzi/sdk-variables@0.38.8
21
+
22
+ ## 0.38.7
23
+
24
+ ### Patch Changes
25
+
26
+ - c7bbc2b: ## A server project's `src/main.ts` is a few lines
27
+
28
+ - **`serveProject` from `@plitzi/sdk-server/project`**: the generated `src/main.ts` hands the space, its actions and
29
+ its options to the server, and the rest comes with the package — the port, the plugins of `src/plugins` and
30
+ `vendor/plugins`, the functions and runtime, `public/`, `src/data/`, the `kv` in `state/kv.json`, `/health`,
31
+ `tmp/dev-server.json` and the reloads while developing. A fix there arrives with `npm update`, not `plitzi upgrade`.
32
+ - **No more `tmp/space.json` while developing**: a saved space is authored again in its own process and handed to the
33
+ server over IPC (`plitzi/author.ts --ipc`, in place of `--out`); the server swaps it in memory and the open pages
34
+ reload, and a refused space keeps the last one that authored. `plitzi doctor` reports a leftover `tmp/space.json`.
35
+ - **`projectAuthoring()` in `@plitzi/sdk-authoring/node`**: what a project's space is checked against — its plugins'
36
+ declarations, its built plugins, its data files — once, for the server and `npm run author` alike. Neither it nor
37
+ `serveProject` takes a root: it is the working directory, where every script runs (`projectAuthoringAt(root)` for a
38
+ tool working on another folder).
39
+ - **`authorProjectSpace` and `projectSpace()` in `@plitzi/sdk-authoring/node`**: the project's space read from
40
+ `src/space/index.ts` — `dist/space/index.js` when the server runs built — once its root and layout are checked, and
41
+ authored. `src/main.ts` is `serveProject({ space: authorProjectSpace, actions, connectors, serverOptions })`, with no
42
+ import of the space; `plitzi/author.ts`, the visual tests and the CLI's checks read it the same way. A module that
43
+ exports no `space` is refused saying what to export (`ProjectSpaceError`).
44
+ - **`.env` lives at the root and Node reads it** as each script starts (`--env-file-if-exists=.env`; `start:dev`
45
+ preloads `@plitzi/sdk-server/env`, since a watched process would restart on every change beside the file). Settings
46
+ read at the top level of `src/config/serverOptions.ts` or the actions are set. Every project gets `.env` and
47
+ `.env.example`; `plitzi upgrade` removes the old `src/env.ts`.
48
+ - **One check of a project's layout** (`@plitzi/sdk-shared/project/layout`): a plugin folder with no entry, a
49
+ JavaScript entry, `src/plugin/` for `src/plugins/`, a `.env` inside `src/`, a space exported by default, a broken
50
+ `vendor/` plugin… The server refuses to boot listing every error with its fix, `npm run author` and the CLI's checks
51
+ refuse with the same words, `plitzi doctor` lists them under `layout` and `--fix` makes the ones with a single fix,
52
+ and `plitzi lint` points at doctor. A plugin folder added broken while developing is reported in the terminal
53
+ instead of failing in esbuild. Plugins may start at `index.tsx`.
54
+ - **`createJsonAdapters` serves documents held in memory**: `offlineData` may be a function returning them, not only a
55
+ path.
56
+ - **One source for a project's layout**, `@plitzi/sdk-shared/project/paths`; `src/config/serverOptions.ts` is typed
57
+ `ProjectServerOptions`. `plitzi upgrade files --write` brings an existing project's `main.ts` and `author.ts` up.
58
+ - **`npm run build` no longer fails on a plugin's stylesheet**: `tsconfig.build.json` includes `plitzi/assets.d.ts`,
59
+ which a space importing a plugin's declaration reaches through its component.
60
+
61
+ ## A write refreshes what shows it
62
+ - **Writes now refresh server-driven providers.** `runServerAction`, `webHook`, `writeRecord` and the
63
+ `invalidateQueries` step reach `runtime: 'server'` api containers by id, by `query` URL, or all of them, just as
64
+ they reach cached browser requests. Before, they reached only the browser's query cache, so a saved write left the
65
+ page showing the old value until a reload. Hidden providers refresh when they are shown.
66
+ - **A refresh because something changed asks around every cache.** `performQuery`, writes and invalidations send
67
+ `Cache-Control: no-cache`; `/_rsc` resolves such a request again instead of serving its cached slice, and keeps the
68
+ new answer. A `refreshSeconds` timer and a "load more" page still go through the caches.
69
+ - **`refreshRsc`'s fourth argument is an options object**, `{ location?, fresh? }`.
70
+
71
+ ## A space's functions read its data
72
+ - **`ctx.data('products.json')`** reads one file of the space's data (a project's `src/data/`), parsed and read-only,
73
+ as of the run's version. Plugins' functions are refused it.
74
+ - **Self-hosted servers read `dataDir` through the same lookup as the platform**, so `/data/<file>` providers and
75
+ `ctx.data` read the same files; `plitzi functions dev` reads `src/data`. `/data/../x.json` is now the provider's
76
+ error state instead of falling through to `publicDir`.
77
+ - **Importing a file outside `functions/` names the boundary and the fix**: read the space's data with
78
+ `ctx.data('<file>')`.
79
+
80
+ ## Signing in on a self-hosted server
81
+ - **`createServer({ auth })` tells the pages it renders where to sign in** (`server.auth`: provider, endpoints and
82
+ the session hint cookie), so a space signs in with no auth settings declared. Settings a space does declare still
83
+ win, and a space that names another provider ignores the server's description. New `pageAuth` server option, for a
84
+ deployment whose `/auth` flows are served by another host.
85
+ - **A page with no auth provider no longer offers `auth.login` / `auth.logout`**, and a sign-in that cannot work says
86
+ why in the console (`[plitzi] auth.login: …`) instead of failing silently. What a visitor keeps there
87
+ (`keepState`, `paintedState`) is the browser's, as on any space without accounts: what was kept as a guest's on such
88
+ a page before is let go once, on the first visit after the upgrade.
89
+ - **Renewal verifies the refresh token itself.** `findByRefreshToken` no longer has to report `refreshExpiresAt`; when
90
+ it does, it overrides the token's own expiry.
91
+ - **New authoring reference `auth.md`**: providers, `authLogin` and its result, `authLogout`, `{{ auth.* }}`,
92
+ `accessLevel`, visitor roles, action `access` and `ctx.user`.
93
+
94
+ ## Flows
95
+ - **Authoring refuses a `when` that asks a step for a key it never publishes** (`condition-field-unpublished`).
96
+ `whenSucceeded` / `whenFailed` after `authLogin` always ran the failure branch: they read a server action's
97
+ `status`. The message names what the step publishes and suggests testing `signedIn.ok` with `when`.
98
+ - **`explain` lists what a step publishes** (`Reads:`) and finds the auth steps by their builders (`authLogin`,
99
+ `authLogout`, `authRefreshDetails`). `authLogin({ username, password })` no longer needs `mode`.
100
+
101
+ ## Elements
102
+ - **Images no longer default to a 140×140 square**: they are 140px wide and as tall as their ratio, so `width` or
103
+ `aspect-ratio` on a class just works. `object-fit` shows in the builder too.
104
+ - **`formControl` with `subType: 'switch'` renders an on/off switch** (`role="switch"`) — it rendered only its label.
105
+ Checkboxes and switches show a `true` default or binding as ticked.
106
+ - **The theme toggle drops the native button look**, and the **`current` style state covers the chosen item of any
107
+ set**: the link to the page shown, a pressed toggle, a selected tab. The exported `CURRENT_PAGE_SELECTOR` is now
108
+ `CURRENT_SELECTOR`.
109
+ - **Element defaults in the style inspector and the MCP catalogue match what the SDK renders**, held by a test. The
110
+ dialog's `bodyContainer` and `headerCloseButton` slots now reach the page; pagination lays out as declared.
111
+ - **Markdown takes a class for each part of the document** through its own slot (`heading`, `paragraph`, `link`,
112
+ `list`, `listItem`, `quote`, `code`, `codeBlock`, `image`, `table`, `anchor`), and `headingLinks: false` drops the
113
+ link each heading offers to itself while keeping its id, so `/page#anchor` links still work. Its description spells
114
+ out the HTML it outputs.
115
+ - **Tabs show every trigger.** The SDK hid every inactive tab item, the header's included, so a set of tabs showed
116
+ one tab and no way to the others; only the body's panels take turns now.
117
+ - **A link that names a query is current only on that query**: of `/?window=6h` and `/?window=24h`, the one shown
118
+ carries `aria-current` — with the path alone, every one of them did. A link with no query is still current on its
119
+ page whatever the query.
120
+
121
+ ## The style language says what `customCss` used to
122
+ - **Pseudo-elements on a class**: `pseudos: { after: { css: { content: '"→"' }, states: { hover: { … } } } }` —
123
+ `before`, `after`, `marker`, `placeholder`, `first-letter`, `first-line`, `selection`, each in the class's states and
124
+ variants. Authoring refuses what draws nothing: a `before`/`after` with no `content`, a `content` without its quotes,
125
+ a property the browser drops on that pseudo-element.
126
+ - **Conditions on a class**: `conditions: { 'motion-reduce': { … }, 'container card (max-width: 30rem)': { … } }` —
127
+ reduced or allowed motion, and container widths, each with its states and pseudo-elements.
128
+ - **The space's `keyframes`**, validated and written at the top of `customCss`; an `animation-name` no keyframes declare
129
+ is warned (`animation-name-unknown`).
130
+ - **New states**: `expanded` (`aria-expanded`), `first`, `last`, `odd`, `even`; the tab panel on show is `current`, and
131
+ the theme toggle's icon of the scheme in use is `current` on its `icon` slot.
132
+ - **`ancestors['>']`** is the parent, whatever it wears — a closed component's part reacting to the element around it.
133
+ - The builder's style inspector, the MCP's definition ops (`pseudos`, `conditions`, and variants with their states) and
134
+ the export to code read and write all of it; an MCP `patchDefinition` no longer drops what it did not name. Rules in
135
+ `customCss` a class can hold now — `.link::after`, one under `@media (prefers-reduced-motion: reduce)`, `.row:first-child`,
136
+ `.row:nth-child(even)`, `.toggle[aria-expanded='true']` — are folded into the class on export and suggested by
137
+ `custom-css-class`.
138
+
139
+ ## Elements take a class for each part
140
+ - **`formControl`**: `field` (the `<input>` itself), `icon` (the show-password button) and `requiredMark` slots; a switch's
141
+ knob reads in dark mode and takes `--plitzi-switch-thumb`, `--plitzi-switch-thumb-checked`, `--plitzi-switch-thumb-shadow`.
142
+ - **`pagination`**: `previous`, `page` (the one shown is its `current` state), `next`, `loadMore`.
143
+ - **`richText`** and **`markdown`**: a slot per part — `heading` and `heading1`…`heading6`, `strong`, `emphasis`,
144
+ `divider`, `tableHead`, `tableRow`, `tableHeaderCell`, `tableCell`, and the code block's frame, header, language and
145
+ copy button. Both heading slots dress one `<h3>`, so `heading-level-overridden` warns when they set the same property
146
+ and the stylesheet's order makes the general one win. A document is drawn by the SDK's own renderer
147
+ (`MarkdownDocument` in `@plitzi/sdk-elements`) — plitzi-ui's `Markdown` keeps GitHub's stylesheet for a library's
148
+ consumers — and reads as a document unstyled: headings, lists, code, tables and quotes get their type from the SDK's
149
+ base layer, at no weight (`:where()`), so a class on a part's slot replaces what it sets property by property. A
150
+ `richText` body reads the same.
151
+ - `custom-css-slot` suggests the slot for a `customCss` rule on a part's SDK class — only where a class on the slot can
152
+ say the rest of the selector (a state, a pseudo-element); `element-slot-unknown` warns of a slot an element does not
153
+ have.
154
+
155
+ ## Links, refreshes and toasts
156
+ - **`current: 'section'` on a link** keeps it current on its page and every page under its path (`aria-current="true"`
157
+ there), styled by the `current` state — no `activeOn` binding for a section.
158
+ - **A refresh asks only about elements the page shown holds**: a provider on the page being left no longer sends a
159
+ `/_rsc` about the new address.
160
+ - **The toasts' parts are `notifications` fields**: `minHeight`, `fontWeight`, `lineHeight`, `iconSize`, `iconGap`,
161
+ `closeColor`, `closeOpacity`, `progressHeight`.
162
+ - **A page asked for with its space's token hydrates its own space.** On a host serving many spaces
163
+ (`?access-token=`), the space document fetched beside the page went without the token, so the host's own space
164
+ answered it and the browser hydrated another space's document over the page — a hydration error, and its tree
165
+ rebuilt. The document's address now carries the token the page was asked for with.
166
+ - **The SDK's stylesheet carries the space's variables from the server's HTML.** It read them from what a provider
167
+ below it publishes while the page renders, which the server had not done yet when it wrote the sheet; it now
168
+ resolves them from the document itself (`useResolvedVariables` of `@plitzi/sdk-shared/dataSource/hooks`), the same
169
+ on both sides.
170
+ - **A realtime message the pub/sub cannot deliver is answered, not fatal.** A publish that Redis refuses — a timeout under
171
+ load — is answered `503` with `reason: 'unavailable'`, by the `POST` and in the WebSocket's `ack` alike; a connect,
172
+ a disconnect or a revoke that fails is logged, on either transport. Each used to reject with nobody waiting, and the server's `unhandledRejection` handler
173
+ shut the whole process down.
174
+
175
+ ## Reporting to Plitzi
176
+ - **`plitzi feedback`** starts a report of what broke, misled or cost time: it writes the page the report is laid out
177
+ in (`tmp/feedback/`) with the installed versions, the project and what `doctor` finds already in it, and tells the
178
+ agent how to fill it — each finding reproduced first, with evidence, impact, workaround and fix, no secrets — and to
179
+ publish it as an artifact whose link the developer sends. `--previous <url>` continues an earlier report.
180
+
181
+ ## Pages that load on every browser
182
+ - **The import map comes before anything that loads a module**, in the page server's HTML, a published site's
183
+ (`index.hbs` on the platform), the SDK's and the builder's. React's `modulepreload` links came first, and a browser
184
+ that had fetched a module already — Chrome before 133 — ignored the map: every bare `import "react"` failed
185
+ ("Failed to resolve module specifier") and the page never hydrated.
186
+
187
+ ## The dev tools
188
+ - **A page loads the React its dev tools need.** The development build only while the visitor has the dev tools on
189
+ (shift+F12, within what the deployment allows); turned off, the next load is a production page, React included. It
190
+ followed the authorization alone, so a space that allowed debugging always shipped development React.
191
+
192
+ ## check and lint
193
+ - **`plitzi check`, `push`, `lint` and `fix` hold the space to what `npm run author` and the server do**: its data
194
+ files too, so `push` no longer sends a space whose browser provider reads `src/data/` (`server-data-in-browser`).
195
+ - **`plitzi check` lists each list's rows as drawn and as held in its source** (`feed 4 of 8 rows`,
196
+ `hits not rendered (16 in its source)`). In `--json`, `lists` is now `{ id: { rendered, source } }`.
197
+ - **`plitzi check` no longer reports bindings inside a container the page isn't showing**, nor text "in the colour
198
+ behind it" because of a bar painted over it or a pane that clips it.
199
+ - **`window.__plitzi.sources()` no longer turns a shared array into `'[…]'`**, and a list row no longer replaces its
200
+ list's `items`.
201
+ - **`plitzi lint` says authoring suggestions are quieted with `quiet` on the element**, and reports a
202
+ `plitzi-lint-disable` comment that names one (`disable-names-suggestion`).
203
+ - **`plitzi check` says when a page sent the browser elsewhere** (a page for signed-in visitors, to the sign-in) instead
204
+ of reporting every element missing, and `--as <username>` signs in first through the server's `/auth` routes, the
205
+ password from `PLITZI_CHECK_PASSWORD`.
206
+ - **`plitzi upgrade` never replaces @plitzi packages installed locally** — a tarball, a link, a portal, an override: it
207
+ leaves them and the install, and says which and the command that would install the registry's.
208
+ - **`plitzi explain` covers every code**: authoring's, `plitzi lint`'s and the project layout's.
209
+ - **Authoring reads the global sources' fields**: `auth.authenticated` in a condition is refused with "did you mean
210
+ `isAuthenticated`?" (`global-field-unknown`), and `invalidateElements` must name providers that exist
211
+ (`element-ids-target`). A template's reads of `computed`, `flags` and the global sources come off the parsed
212
+ template: a string inside it (`'https://auth.acme.com'`) is no longer read as `auth.acme`.
213
+ - **`custom-css-notifications` no longer reads the rules `notifications` itself writes** as toasts dressed by hand.
214
+ - **A refused space or layout is a report, not a stack**: the server's entry point imports the space once the layout is
215
+ checked, and `npm start` and `npm run author` print every problem and exit with 1.
216
+ - **New authoring suggestion `class-overrides-class`**: one class's shorthand (`padding`) silently erases a longhand
217
+ (`padding-top`) another class on the same element writes out.
218
+
219
+ - Updated dependencies [c7bbc2b]
220
+ - @plitzi/sdk-auth@0.38.7
221
+ - @plitzi/sdk-authoring@0.38.7
222
+ - @plitzi/sdk-dev-tools@0.38.7
223
+ - @plitzi/sdk-elements@0.38.7
224
+ - @plitzi/sdk-event-bridge@0.38.7
225
+ - @plitzi/sdk-interactions@0.38.7
226
+ - @plitzi/sdk-navigation@0.38.7
227
+ - @plitzi/sdk-plugins@0.38.7
228
+ - @plitzi/sdk-schema@0.38.7
229
+ - @plitzi/sdk-shared@0.38.7
230
+ - @plitzi/sdk-style@0.38.7
231
+ - @plitzi/sdk-variables@0.38.7
232
+ - @plitzi/plitzi-sdk@0.38.7
233
+
3
234
  ## 0.38.6
4
235
 
5
236
  ### Patch Changes
package/dist/index.html CHANGED
@@ -13,10 +13,10 @@
13
13
  <link rel="preconnect" href="https://api.plitzi.local" />
14
14
  <link rel="preconnect" href="https://ssr.plitzi.local" />
15
15
 
16
- <link rel="modulepreload" href="/plitzi-builder-vendor.js" crossorigin />
17
- <link rel="modulepreload" href="/plitzi-builder-vendor.js" crossorigin />
18
- <link rel="modulepreload" href="/plitzi-builder.js" />
19
-
16
+ <!--
17
+ The import map before anything that loads a module: a browser that fetched one already (a modulepreload counts)
18
+ ignores a map that comes after it, and the SDK's `import "react"` then resolves to nothing.
19
+ -->
20
20
  <script type="importmap">
21
21
  {
22
22
  "imports": {
@@ -28,6 +28,11 @@
28
28
  }
29
29
  }
30
30
  </script>
31
+
32
+ <link rel="modulepreload" href="/plitzi-builder-vendor.js" crossorigin />
33
+ <link rel="modulepreload" href="/plitzi-builder-vendor.js" crossorigin />
34
+ <link rel="modulepreload" href="/plitzi-builder.js" />
35
+
31
36
  <link href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap" rel="stylesheet" />
32
37
 
33
38
  <link href="/plitzi-builder.css" rel="preload" as="style" />
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The space's own data: JSON files its pages read on the server, edited here and saved as the draft — whole, against
3
- * the copy this panel read, so one saved since from elsewhere (an agent, a project's `plitzi push`) is never
3
+ * the copy this panel read, so one saved since from elsewhere (an agent, a project's `plitzi space push`) is never
4
4
  * overwritten unseen. The live site reads what the space was last published with.
5
5
  */
6
6
  declare const Data: () => import('react').JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { DataDraft, DataSaveResult } from '@plitzi/sdk-shared';
2
2
  /**
3
- * The space's data draft, and saving it — through the same operation an agent's MCP and a project's `plitzi push` end
3
+ * The space's data draft, and saving it — through the same operation an agent's MCP and a project's `plitzi space push` end
4
4
  * in (`SpaceSaveData`): whole, against the version it was read at.
5
5
  */
6
6
  declare const useData: () => {
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "@plitzi/plitzi-builder",
3
- "version": "0.38.6",
3
+ "version": "0.38.8",
4
4
  "homepage": "./",
5
5
  "license": "AGPL-3.0",
6
6
  "files": [
@@ -34,7 +34,7 @@ declare const _default: {
34
34
  "@fortawesome/fontawesome-free": "^7.3.1",
35
35
  "@plitzi/nexus": "^1.4.0",
36
36
  "@plitzi/plitzi-sdk": "workspace:*",
37
- "@plitzi/plitzi-ui": "^1.6.31",
37
+ "@plitzi/plitzi-ui": "^1.6.32",
38
38
  "@plitzi/sdk-auth": "workspace:*",
39
39
  "@plitzi/sdk-authoring": "workspace:*",
40
40
  "@plitzi/sdk-dev-tools": "workspace:*",