@plitzi/plitzi-builder 0.38.10 → 0.38.12

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,314 @@
1
1
  # @plitzi/plitzi-builder
2
2
 
3
+ ## 0.38.12
4
+
5
+ ### Patch Changes
6
+
7
+ - 1301338: ## Builder
8
+
9
+ - **Icons in the canvas again** (`@plitzi/plitzi-builder`): the canvas inlined the SDK's Font Awesome sheet into its
10
+ `<style>`, where the sheet's `url(webfonts/…)` resolved against the editor's URL — a `srcdoc` frame takes it as its
11
+ base — so every icon was a 404 under `/spaces/<space>/webfonts/` and drew as an empty box. Only the Vite dev server,
12
+ which rewrites the URL, hid it. The canvas and the element preview now link the sheet from where the host serves it:
13
+ a new prop, `sdkIconsStylePath`, the one the host already gives the pages it renders
14
+ (`/sdk-assets/plitzi-sdk-icons.css` for sdk-server). Absent, the canvas links no icon sheet.
15
+
16
+ ## Plugins
17
+ - **A plugin's other elements, hosted by `custom`** (`@plitzi/sdk-elements`): `custom({ renderType: 'jamDisc' })` on a
18
+ space with a plugin installed whose main element is another (`plitzi plugin pack` of several folders: the first is the
19
+ plugin, the rest go in it) rendered "Custom Component jamDisc Not Found" — the page registers only the plugin's main
20
+ element, and a `custom` host looked nowhere else. It now loads the type from the installed plugin that packs it, as
21
+ an element of the type itself always did, so the two ways the docs give to place a plugin's element are the same
22
+ everywhere: in a project `plitzi create` wrote, and once the project is on Plitzi.
23
+ - **One way to place a plugin's element** (`@plitzi/sdk-authoring`, `@plitzi/cli`, docs): from its declaration,
24
+ `const seatPicker = defineElement(declaration)` then `seatPicker({ id, … })` — typed by what it
25
+ declares, and the element the builder adds when somebody drops it. The welcome space `plitzi create` writes, the
26
+ plugin package's preview, `plitzi plugin add` and `plitzi explain` all write it so (the template's
27
+ `PluginHostOptions` now takes the plugin's `type` and `declaration: { from, attributes? }`; `custom`/`element` hosting
28
+ is gone). `pluginFolders(folder)` (`@plitzi/sdk-authoring/node`) reads each plugin with the folder it is in;
29
+ `pluginDeclarations` is built on it. A `custom({ renderType })` naming a plugin the space was handed the declaration
30
+ of is offered the declaration instead — suggestion `plugin-custom-host`. `custom` stays for a component registered
31
+ by name with no declaration. The skills, the CLI README, the MCP guide, `docs/en` and the website say the same.
32
+ - **`definePlugin`** (`@plitzi/sdk-authoring/plugin`, a new entry of 3 KB with nothing else in it): a plugin's
33
+ declaration written from what only it can say —
34
+ `definePlugin<SeatPickerAttributes>()({ type, label, attributes, triggers, callbacks })` — and every other field
35
+ at the default all plugins share (the builder's gestures, the catalogue entry, each attribute bindable, an empty
36
+ style). It answers the whole declaration, branded with its attributes, so `defineElement(declaration)` is typed
37
+ without a generic. `plitzi plugin add` and `create --plugin` write declarations with it (about a third of the lines).
38
+ - **`usePluginTrigger(declaration)`** (`@plitzi/plitzi-sdk`): fires a plugin's declared event on its element — the
39
+ event name and what each hands a flow typed off the declaration's `preview` — on a live page only. The hook every
40
+ plugin wrote for itself (and `plugin add` generated as `use<Name>Events`) is gone from the scaffold.
41
+ - **Attributes as the types their defaults are** (`@plitzi/sdk-elements`): a plugin's attribute bound from text — a
42
+ state, a row, a channel message — reaches its component as the number or the flag its declared default is (`'112'`
43
+ as 112, `'true'` as true). A plugin no longer types its props `number | string` and parses them.
44
+
45
+ ## Server actions and functions
46
+ - **Task params with rules** (`@plitzi/sdk-server`, `@plitzi/sdk-shared`): a task declares `required`, a text's
47
+ `maxLength` and a number's `min`/`max`, and the runner refuses a call that breaks any of them — every rule broken at
48
+ once, in the words the page shows (`Title is required; Seconds is at most 300`) — before the code runs. A `text` param
49
+ bound to a number arrives as its digits. The manifest keeps the rules, so the platform's sandbox checks the same.
50
+ - **`taskAction(task, { trigger })`** (`@plitzi/sdk-authoring`): the action that runs one of the space's tasks and
51
+ answers its result, derived from the task — its id (`<namespace>-<action>`), name, description and input (the task's
52
+ params, once). An action of more than one step is still `defineAction`.
53
+ - **`ctx.rateLimit(bucket, { …, refuse })`**: past the limit the call is refused with those words instead of answering
54
+ `allowed: false` for the code to check — natively and in the sandbox.
55
+
56
+ ## Authoring
57
+ - **`runServerActionOrNotify(id, params, fallback)`**: a server action run and the notice the visitor reads when it
58
+ fails — the action's own refusal, or the fallback — as two steps to spread into a flow.
59
+ - **`repeated-shape` reads what copies bind**: copies whose bindings read their data in different forms (a count, a
60
+ total of a quota) and copies holding a provider resolved on the server (found by its own id) are no longer offered
61
+ as one component.
62
+ - **`element-color-inherited`** (suggestion): `elements` giving a heading, a text, a link… `color: inherit` or the
63
+ page's own colour. **A link inherits the page's colour** (`@plitzi/plitzi-sdk`, `@plitzi/sdk-elements`) rather than
64
+ holding the SDK's grey — the same by default, and the space's palette inside a card that is a link. The template
65
+ every space starts from writes its colours once, on the page.
66
+
67
+ ## Fixes
68
+ - **A dialog opened with an id** (`@plitzi/sdk-elements`): `openDialog('dialog', '{{ row.id }}')` reads the id as its
69
+ `content`, as `openModal` already did — a numeric id parsed as the number and the dialog's bindings read nothing.
70
+ - **A select's chevron** (`@plitzi/plitzi-sdk`): a drawn chevron in the field's own colour, sized by its type, in place
71
+ of the `▼` glyph — and laid out in the box, so it ends where the box's padding begins whatever that padding is, and
72
+ the chosen option stops short of it instead of running under it. A disabled select's is faded.
73
+ - **Every element has its settings** (`@plitzi/plitzi-builder`, `@plitzi/sdk-elements`): the builder found none for
74
+ `tabContainerHeader` (registered under a misspelt type), `themeToggle`, `dropdownPopup`, `loading` and `notFound`.
75
+ The theme toggle's panel sets its mode, its labels and whether it offers "System"; the registry is typed by element
76
+ type and must hold one for each.
77
+ - **A plugin's panel** (`@plitzi/cli`): `plitzi doctor` warns of a plugin with no `Settings.tsx`, or one its entry never
78
+ passes as `pluginSettings` (`plugin-settings-missing`); the example `create` writes has its panel, as every element
79
+ `plugin add` writes does, and the panels it generates are laid out as the project's Prettier lays them out.
80
+ - **A refused or failed run reaches `onFlowError` in every mode** (`@plitzi/sdk-interactions`): an awaited server
81
+ action the server refused fired no `onFlowError` on the element that started it, as `detached` and `stream` ones do
82
+ — a board rolling its edits back on a refusal never did; and a run answered `status: 'failed'` fired `onFlowEnd`
83
+ (detached) or nothing (awaited) rather than `onFlowError`.
84
+ - **A source renamed** (`@plitzi/sdk-shared`): the binding picker lists a provider, a form or a modal by the name its
85
+ element has now, not the one it had when it mounted.
86
+ - **A text's words in the builder** (`@plitzi/sdk-elements`): a `paragraph`, `text` or `heading` whose `content` is
87
+ `0` shows `0` while editing too, not its placeholder; one bound to nothing shows nothing rather than `null`.
88
+ - **Built-in declarations** (`@plitzi/sdk-shared`): `elementDeclaration` fills in what every element shares — the
89
+ builder's gestures, Plitzi's catalogue entry, a visible element with no bindings, its style named by its label —
90
+ from the defaults `definePlugin` uses; each element's declaration says only what is its own (a third of the lines).
91
+
92
+ ## Typed for plugins and hosts
93
+ - **`usePlitzi()` and `PlitziProvider`** (`@plitzi/sdk-shared/hooks/usePlitzi`, `@plitzi/plitzi-sdk`): what were
94
+ `usePlitziServiceContext()` and `PlitziServiceProvider` (and `PlitziServiceContextValue`, now `PlitziContextValue`),
95
+ holding only what the host rendering a space knows — `settings`, `root`, `utils`. Its `contexts` and
96
+ `customContexts` are gone: every context it carried is a shared one already, imported from its own module
97
+ (`@plitzi/sdk-interactions/InteractionsContext`, `@plitzi/sdk-shared/network/NetworkContext`…), and
98
+ `PluginsContext` moves to `@plitzi/sdk-shared/plugins/PluginsContext` beside the others.
99
+ - **`InteractionsManagerApi`** (`@plitzi/sdk-shared`): the interactions manager as everything outside
100
+ `@plitzi/sdk-interactions` reaches it, declared where every package can name it and implemented by
101
+ `InteractionsManager`, so `use(InteractionsContext)` is typed — `interactionTrigger`, `createChildManager`… — where it
102
+ was `any`.
103
+ - **`getPathsFromObject`** (`@plitzi/sdk-shared/helpers/utils`), spelt right; `getPathsFromObeject` is gone.
104
+ - **`ElementWords` places itself** (`@plitzi/sdk-elements`): `contentPlacement` and the element's children, so a button
105
+ and a link write their words once.
106
+
107
+ - Updated dependencies [1301338]
108
+ - @plitzi/plitzi-sdk@0.38.12
109
+ - @plitzi/sdk-auth@0.38.12
110
+ - @plitzi/sdk-authoring@0.38.12
111
+ - @plitzi/sdk-dev-tools@0.38.12
112
+ - @plitzi/sdk-elements@0.38.12
113
+ - @plitzi/sdk-event-bridge@0.38.12
114
+ - @plitzi/sdk-interactions@0.38.12
115
+ - @plitzi/sdk-navigation@0.38.12
116
+ - @plitzi/sdk-plugins@0.38.12
117
+ - @plitzi/sdk-schema@0.38.12
118
+ - @plitzi/sdk-shared@0.38.12
119
+ - @plitzi/sdk-style@0.38.12
120
+ - @plitzi/sdk-variables@0.38.12
121
+
122
+ ## 0.38.11
123
+
124
+ ### Patch Changes
125
+
126
+ - cadf70a: - **`server.cache.invalidate` drops what a page is rendered from** (`@plitzi/sdk-server`): the pages, the RSC answers
127
+ and the schema data they are rendered from go together. It dropped the pages alone, and the next request rendered
128
+ the same page again from the schema still cached under the same key — a publish that invalidated the space changed
129
+ nothing until the schema's TTL ran out. `clear()` and `size` cover the three. A filter on `hostname` drops the schema
130
+ data too, which belongs to no one host. `server.cache` is `null` only when nothing is cached (`cacheTtlMs: 0` and
131
+ `rsc.cacheTtlMs: 0`).
132
+
133
+ ## Style inspector
134
+ - **Finds a property** (`@plitzi/sdk-style`): a search above the categories narrows them to the ones that edit what was
135
+ typed — a CSS name in any order of its words (`border radius` finds the four corners), a category's title, or a
136
+ common word for it (`bg`, `rounded`) — opens them, and shows the advanced rows when the match lives there. Escape
137
+ clears it. The categories' properties live in one list (`categoryKeys.ts`) that the dots, the advanced hint and the
138
+ search all read.
139
+ - **Rows that fit**: a section with more than two controls puts its label above them and lays them out in as many
140
+ columns as the panel is wide, instead of one row where every label was cut (`Appearan…`, `Cell Spaci…`, the five
141
+ scroll-snap controls). A row's label column is 80px.
142
+ - **Where a value comes from, said quietly**: the label's tint keeps its four meanings — set here, from a token, bound
143
+ to data, inherited — without the solid blocks of colour; hovering says which (an inherited one names its selector and
144
+ breakpoint) and that a click resets it, the click shows it by striking the label through. The footer's info icon
145
+ holds the legend, and its arrow folds every category.
146
+ - **What is being edited**: an "Editing … › Hover" line under the pickers whenever the rules being written are not the
147
+ selector's plain ones, with a button back to them. Ancestor, pseudo-element and condition fold behind a toggle —
148
+ never while one is in use.
149
+ - The class being edited is the panel's one strong mark (violet), the element's type defaults a softer one; the tools'
150
+ tabs fit the panel and are reachable from the keyboard.
151
+
152
+ - **Lists edited in a popover, all alike**: box and text shadows, transforms, transitions and filters share one row
153
+ (the CSS it writes, a swatch, a remove button) and one popover (a title, a close button, Escape, the focus moved
154
+ into it). What none of them could read is now kept and edited as text instead of being replaced with a default — a
155
+ token for the whole value, `drop-shadow(…)`, `url(#…)`.
156
+ - **Values read the way CSS writes them**: a shadow with two, three or four lengths and its color on either end;
157
+ `rgba(…)` inside text shadows and filters no longer split; negative shadow offsets accepted; a transition with any
158
+ of its parts left out; brightness, contrast and saturation past 1. Transition presets are written as CSS — the
159
+ preset names (`easeInQuad`) made the browser drop the whole declaration — the curve can be dragged into one of your
160
+ own, and the preview stops with the editor. `font-color` (not CSS) became `color`.
161
+ - **Background layers keep what they hold**: a repeating gradient (now a switch), a radial gradient's explicit size, a
162
+ token or `image-set()` as a layer (a "Custom (CSS)" layer), a one-value position read as CSS reads it (`20%` is
163
+ `20% center`), lists shorter than the layers repeated as CSS repeats them, an unset repeat read as tiling, two-position
164
+ stops, negative angles — every one of them was rewritten on the next edit of any layer. Defaults are no longer
165
+ written back, and "Token values" no longer bakes resolved tokens into the layers.
166
+ - **A layer's editor in two halves** — what it draws, then where it goes (size, position, tile, attachment, clip,
167
+ which now offers `text`). The gradient's stops sit on one bar, each a handle that drags or moves with the arrow keys;
168
+ the stop's color and position below it. Previews and swatches resolve the space's tokens.
169
+ - Spacing tells margin (dashed, outside) from padding; Border's sides are labelled and readable in the dark theme; a
170
+ class's menu says what each action does to whom; the Style Manager opens at a size that holds both columns.
171
+
172
+ ## Builder
173
+ - **Shortcuts**: `?` shows every shortcut the builder answers to — the same list the "Nothing selected" card teaches
174
+ from — and ⌘\ / Ctrl+\ hides both side panels for the canvas alone and brings back the ones that were open. Both
175
+ work with the canvas focused.
176
+ - **Panels keep their width**: each side panel opens at the width it was left at; the right one starts at 380px.
177
+ - **Text no smaller than 11px** across the builder's panels (it went down to 10px in fifty places).
178
+
179
+ ## Realtime
180
+ - **A page hears what it sent when it asks to** (`@plitzi/sdk-shared`, `@plitzi/sdk-server`, `@plitzi/sdk-elements`):
181
+ `publishOn('room', 'react', data, { echo: true })`, `useChannel().publish(type, data, { echo: true })` and the
182
+ channel's `publish` callback (`echo`) hand the message back to the page that sent it too, once the server took it —
183
+ stamped like everyone's, with `echo: true`, its `from` the channel's `me`. Without it a page still never hears its
184
+ own messages, and the docs said "every page on its topic hears it": they now say every OTHER page. Presence never
185
+ echoes.
186
+ - **A topic is opened only once it names one** (`@plitzi/sdk-elements`): `useChannel` — and so the `channel` element —
187
+ opens a topic only when a channel of the space covers it, by the same `matchChannel` the server decides by. A topic
188
+ written from data that has not arrived (`room:` while its provider loads, or its template still as text) asked the
189
+ server for both, was refused with a 403 and a console error on every load, and is now waited for.
190
+ - **Pages that watch** (`@plitzi/sdk-server`, `@plitzi/cli`): a connection whose page carries the `plitzi-observer`
191
+ cookie hears its topics and says nothing on them — no `$join`, no presence, its publishes taken and dropped.
192
+ `page check`, `page shot` and `verify` load pages that way, so checking a live site is no longer a visitor walking
193
+ into a room (`X walked in`, a member more in every picture). `--presence` takes part as a visitor does.
194
+
195
+ ## Authoring
196
+ - **`template-in-value`** (refused): a `{{ }}` inside an attribute that is an object or a list — a provider's
197
+ `input`, a list's `items`, a plugin's settings — is never evaluated: only an attribute that is text is interpolated,
198
+ and the page server reads attributes as saved. A provider's `input` also replaced the route param of the same name
199
+ the action was already given, so `input: { room: '{{ navigation.routeParams.room }}' }` reached the task as `""` and
200
+ the page answered 404; its refusal says the action is handed the page's route and query params already. Anything
201
+ else is a binding on the attribute. `mockData`, a sample, is not held to it.
202
+ - **Rules on top of a class need no `id`** (`class: [card, { gap: '6px' }]`): they are named after the id the element
203
+ is given, written or not. `modifier-without-id` is gone; a one-off tweak no longer needs a name nothing reads.
204
+ - **Typed list rows have `inTemplate`**, as untyped ones do, and `bindTemplate`, `visibleWhen`, `hiddenWhen` and
205
+ `variantFrom` take a typed source's path as well as a name: turning a list typed broke every template of its rows.
206
+ - **`when({ field, operator: 'empty' })`** takes no `value` (nor `notEmpty`), as flows.md recommends; it did not
207
+ type-check.
208
+ - **Data-driven colours**: a style binding on a custom property (`{ to: '--who', category: 'style' }`) is written as
209
+ named — it was camel-cased into `who` — so a class reads `var(--who, var(--muted))`. A style binding's value carrying
210
+ `;` or braces is not written: the page server writes inline styles as text, and such a value added declarations of
211
+ its own. `binding-target-unknown` on `style` or a CSS property says to bind it in the `style` category.
212
+ - `unknown-attribute` for `decorative` on an `svg` or a `fontAwesome` says what it means: without a `label` it is
213
+ already hidden from screen readers.
214
+
215
+ - **A folder nobody declared says where to declare it**: `folder-undeclared` (a page, a layout, a folder's parent)
216
+ ends with `pageFolders: [{ id, name }]` on the space, and with the line of the `pageFamily` that wrote the page. A
217
+ folder starts its pages' addresses (`/docs/quickstart`), so a misspelt one is never declared on the author's behalf.
218
+ The skill's `pageFamily` example declares its folder.
219
+ - **A tag is an element**: a `subType` this element has not but another has — `container({ subType: 'ol' })` — names
220
+ that element (`list({ subType: 'ol' })`) instead of the value two letters away (`dl`). Read off the elements'
221
+ declarations, for every element and tag.
222
+ - **A `pageFamily`'s body is written once**: `repeated-shape` and `repeated-on-pages` no longer count the same part of
223
+ each page of one family as copies — they were offering a component for exactly what the docs recommend. Copies within
224
+ one page, or across pages written one by one, are still offered.
225
+ - **Colour emoji are not text to `page check`**: a character painted in its own colours (🎲, `❤️`, a keycap, a ZWJ
226
+ sequence) is left out of the contrast measure, which compared `color` with the tile behind it and failed `verify`
227
+ in the theme whose text colour was close to the tile. A symbol drawn as text (✓, ★) is still measured.
228
+
229
+ - **`declared-callback-target`** (refused): a value beside `on` in `declaredCallback(…, { on, date })` — written as
230
+ `openModal`'s target reads — was read nowhere, and the step ran without it. Refused, with the `params` it goes in
231
+ (`{ on: 'calendar', params: { date } }`) and whether it is one of the callback's declared params.
232
+ - The skill's list rows show the typed form beside the untyped one: with `items` typed by a sample, `r.item` is a path
233
+ (`from: r.item.title`), not text to put in a template string.
234
+ - **`slot-not-class`** (refused): rules written in place in a slot — `slots: { error: [fieldError, { color }] }`, past
235
+ the type in JavaScript or a spec rebuilt from JSON — were taken for a declaration with no rules, and `authorSpace`
236
+ failed later with `Cannot read properties of undefined (reading 'desktop')`, naming nothing. Refused where the slot
237
+ is written, naming the slot and the element, with the `styles()` declaration to hand instead.
238
+
239
+ ## CLI
240
+ - **`page shot --click` (and `--clip`, `--wait-for`, `--scroll-to`, `--steps`) takes any selector**: a value that is
241
+ not an element's name (letters, digits, `-`, `_`) is a selector, CSS or Playwright's own (`button:has-text("Orbit")`).
242
+ It was wrapped as a name, and an invalid selector ended the command with Playwright's stack trace; it is now refused
243
+ with the reason.
244
+
245
+ - **`plitzi functions add <package>`**: a package the functions use comes with them, as a function carries its
246
+ dependencies. Installed in the project, it is bundled (web APIs only, minified, its licence kept) into
247
+ `src/functions/vendor/<package>.js`, with a `.d.ts` re-exporting the installed package's types, imported as
248
+ `./vendor/<package>.js` and pushed, built and run with the rest — nothing is resolved anywhere else, so the builder,
249
+ the sandbox and the push are unchanged. A package that reaches Node (`fs`, `node:*`) is refused, naming what it
250
+ reached; one past the functions' 1 MB is too; one that reads `process`/`Buffer` is warned about. The build's refusal
251
+ of a package import now names the command.
252
+ - **`page shot` targets**: a bare word is an element's name, or — no element named so — a tag (`textarea`); resolved on
253
+ the loaded page for `--click`, `--clip`, `--scroll-to`, `--wait-for` and `--steps`. In `--steps`, `type` takes a
254
+ quoted element with spaces (`type ".panel textarea" hola`) — it was cut at its first space and typed the rest — and
255
+ fails when the click leaves no field focused, rather than sending the keys to the page's shortcuts.
256
+
257
+ ## Server
258
+ - **`server.listen()` resolves once the port answers** (`@plitzi/sdk-server`) — in a fleet, once the first worker
259
+ does. `serveProject` writes `tmp/dev-server.json` and says `pages on …` after it, not on the line after `listen`:
260
+ for about 0.4 s a tool trusting the line (CI, Playwright's `webServer`, `page check`) was refused. A port it cannot
261
+ take still ends the process, or goes to `onListenError`, and the promise is then never resolved.
262
+ - **Runs set for later** (`@plitzi/sdk-server`, `@plitzi/sdk-shared`, `@plitzi/sdk-authoring`, `@plitzi/plitzi-builder`):
263
+ a turn that runs out, a bot's move, a hold that lapses — one run starting one of the space's actions in N seconds,
264
+ whether or not a page is still open. The action says it may be with a **`later` trigger** (no access rule: the run
265
+ that set it was let in); a flow sets it with `flow.later { action, in, input, key }`, a function with
266
+ `ctx.later({ … })`, and `flow.cancelLater` / `ctx.cancelLater(key)` drops it. A `key` names it: set again under the
267
+ same key, the one still waiting is replaced — the newer of two set at once, on every replica — and a running one is
268
+ left. It is a job of the queue schedules use: due by the store's clock (0 s to 30 days, about a second late at most),
269
+ once across replicas, retried, shown in Automations → Queue. Refused before anything is queued, with why: no `later`
270
+ trigger, one switched off, a time out of range, a key that is not one, a server with no jobs. A plugin's functions
271
+ set none. `ActionJobQueue` gains `cancelPending({ spaceId, key, olderThan? })` and jobs a `key`: the memory, Mongo
272
+ and MySQL queues implement it, and the shared contract tests it. **MySQL**: `action_jobs` gains `job_key` (and the
273
+ `action_jobs_key` index), added on first use; with `createTables: false`, run that statement of
274
+ `mysqlJobSchemaUpgrades()`. A queue of a deployment's own implements `cancelPending` (`09-schedules` shows one).
275
+ - **A project's `kv` file has one holder** (`@plitzi/sdk-server`): `createFileKv` takes `<file>.lock` with its pid;
276
+ a second process — another `npm start`, a `--watch` left running — is refused, naming the first (`the server of
277
+ "orbita", on port 8080`) instead of both writing their whole map over each other's changes, and a lock whose process
278
+ is gone is taken over. `close()` writes what is pending and lets go. A server with `workers` opens the file once, in
279
+ the primary, and its workers reach it through the fleet (`fleetKv`): each used to open a copy of its own.
280
+ - **A self-hosted project's credentials** (`@plitzi/sdk-server`, `@plitzi/cli`): `serveProject` answers
281
+ `getCredential` from `PLITZI_CREDENTIALS` in `.env` — one JSON object, credential id → its keys — so
282
+ `ctx.fetch({ credential })`, a connector and an `http.request` step work on the project's own server, not only in
283
+ `functions dev`. The same variable for both (it was `PLITZI_FUNCTIONS_CREDENTIALS`, read by the CLI alone); a value
284
+ that is not that object is refused with how to write it, instead of every credential going missing.
285
+ - **`HOST` beyond loopback says where to open it**: with `HOST=0.0.0.0`, `serveProject` prints the machine's network
286
+ addresses — what a tablet on the same Wi-Fi opens — and that anyone on that network can. `.env.example` names `HOST`
287
+ and `PLITZI_CREDENTIALS`.
288
+
289
+ ## SDK
290
+ - **`useElementSize(ref)`** (`@plitzi/plitzi-sdk`): the size a plugin's own box is drawn at, followed as it changes —
291
+ what `useDisplayMode()` cannot say: a tablet held upright is `mobile` by the window and still a week wide by the
292
+ plugin's box. `undefined` until measured, so the server's page and the hydrated one agree. The breakpoints are
293
+ unchanged.
294
+ - The functions docs say how a task's `params` types (how the builder edits them: `codemirror-json`) and an action's
295
+ `input` types (what the value is: `json`) correspond.
296
+
297
+ - Updated dependencies [cadf70a]
298
+ - @plitzi/plitzi-sdk@0.38.11
299
+ - @plitzi/sdk-auth@0.38.11
300
+ - @plitzi/sdk-authoring@0.38.11
301
+ - @plitzi/sdk-dev-tools@0.38.11
302
+ - @plitzi/sdk-elements@0.38.11
303
+ - @plitzi/sdk-event-bridge@0.38.11
304
+ - @plitzi/sdk-interactions@0.38.11
305
+ - @plitzi/sdk-navigation@0.38.11
306
+ - @plitzi/sdk-plugins@0.38.11
307
+ - @plitzi/sdk-schema@0.38.11
308
+ - @plitzi/sdk-shared@0.38.11
309
+ - @plitzi/sdk-style@0.38.11
310
+ - @plitzi/sdk-variables@0.38.11
311
+
3
312
  ## 0.38.10
4
313
 
5
314
  ### Patch Changes
package/dist/App.d.ts CHANGED
@@ -13,6 +13,11 @@ export type AppProps = {
13
13
  * of this package, from wherever the host serves the builder's files. Absent, the panel edits and saves without it.
14
14
  */
15
15
  functionsWorkerUrl?: string;
16
+ /**
17
+ * Where the SDK's Font Awesome sheet (`plitzi-sdk-icons.css`) is served, with its `webfonts/` beside it — the one
18
+ * the host already gives the pages it renders. The canvas links it; absent, its icons draw as empty boxes.
19
+ */
20
+ sdkIconsStylePath?: string;
16
21
  };
17
22
  declare const App: (props: AppProps) => import('react').JSX.Element;
18
23
  export default App;
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ import { default as PluginRemote } from '@plitzi/sdk-elements/Element/PluginRemo
8
8
  import { default as ReplicaProvider } from '@plitzi/sdk-elements/Element/ReplicaProvider';
9
9
  import { default as RootElement } from '@plitzi/sdk-elements/Element/RootElement';
10
10
  import { default as ComponentContext } from '@plitzi/sdk-shared/elements/ComponentContext';
11
- import { default as usePlitziServiceContext, PlitziServiceProvider } from '@plitzi/sdk-shared/hooks/usePlitziServiceContext';
11
+ import { default as usePlitzi, PlitziProvider } from '@plitzi/sdk-shared/hooks/usePlitzi';
12
12
  import { useBuilderStore } from '@plitzi/sdk-shared/store';
13
13
  import { AppProps } from './App';
14
14
  import { ComponentPlugin, RenderMode, Server } from '@plitzi/sdk-shared';
@@ -29,11 +29,12 @@ export type PlitziBuilderProps = {
29
29
  state?: object;
30
30
  debugMode?: boolean;
31
31
  functionsWorkerUrl?: AppProps['functionsWorkerUrl'];
32
+ sdkIconsStylePath?: AppProps['sdkIconsStylePath'];
32
33
  };
33
34
  declare const PlitziBuilder: {
34
35
  (props: PlitziBuilderProps): import('react').JSX.Element;
35
36
  Plugin: (_props: import('./modules/Builder/BuilderPlugin').BuilderPluginProps) => undefined;
36
37
  };
37
38
  export declare const version: string;
38
- export { useBuilderStore, ComponentProvider, ComponentContext, usePlitziServiceContext, PlitziServiceProvider, RootElement, withElement, JsxManager, PluginManager, PluginRemote, ReplicaProvider, useElement, useRscData };
39
+ export { useBuilderStore, ComponentProvider, ComponentContext, usePlitzi, PlitziProvider, RootElement, withElement, JsxManager, PluginManager, PluginRemote, ReplicaProvider, useElement, useRscData };
39
40
  export default PlitziBuilder;
package/dist/index.html CHANGED
@@ -53,9 +53,10 @@
53
53
  webKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxIiwib3JpZ2lucyI6WyJodHRwczovL3dlYnNpdGUucGxpdHppLmFwcCIsImh0dHBzOi8vcGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsOjMwMDAiLCJodHRwczovL2FwcC5wbGl0emkubG9jYWw6MzAwMSIsImh0dHBzOi8vc3NyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc2VydmVyLnBsaXR6aS5sb2NhbCIsImh0dHA6Ly9sb2NhbGhvc3Q6MzAwMCIsImh0dHA6Ly9sb2NhbGhvc3Q6ODA4MCIsImh0dHA6Ly8xMjcuMC4wLjE6ODA4MCIsImh0dHBzOi8vZGV2LnBsaXR6aS5jb20iLCJodHRwczovL3BsaXR6aS5jb20iLCJodHRwczovL3N0Zy5wbGl0emkuY29tIl0sImlzcyI6Imh0dHBzOi8vc2VydmVyLnBsaXR6aS5sb2NhbCIsImF1ZCI6WyJodHRwczovL3BsaXR6aS5sb2NhbCIsImh0dHBzOi8vYXBwLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vYXBwLnBsaXR6aS5sb2NhbDozMDAwIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsOjMwMDEiLCJodHRwczovL2FwaS5wbGl0emkubG9jYWwiLCJodHRwczovL3Nzci5wbGl0emkubG9jYWwiLCJodHRwczovL3NlcnZlci5wbGl0emkubG9jYWwiLCJodHRwczovL21jcC5wbGl0emkubG9jYWwiLCJodHRwczovL2F1dGgucGxpdHppLmxvY2FsIiwiaHR0cDovLzEyNy4wLjAuMTo1MzAwIiwiaHR0cDovL2xvY2FsaG9zdDo1MTgwIl0sInNjb3BlIjoic3BhY2U6cmVuZGVyIiwiaWF0IjoxNzkwMjEzMjg5LCJqdGkiOiJhZDgyN2EyMjliZjhlMzk3IiwibmJmIjoxNzkwMjEzMjg5fQ.dedpVVA5Nv3Xr7nEOZ8UmEJcIamF9AHGnLgqQyDV8-k',
54
54
  // The actor. Without it the builder loads and every write is refused, since authorization is
55
55
  // can(actor, space, permission). Both halves come from `yarn token 1 --user admin` in plitzi-sdk-server.
56
- userKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxIiwiaXNzIjoiaHR0cHM6Ly9zZXJ2ZXIucGxpdHppLmxvY2FsIiwiYXVkIjpbImh0dHBzOi8vcGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsOjMwMDAiLCJodHRwczovL2FwcC5wbGl0emkubG9jYWw6MzAwMSIsImh0dHBzOi8vYXBpLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc3NyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc2VydmVyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vbWNwLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vYXV0aC5wbGl0emkubG9jYWwiLCJodHRwOi8vMTI3LjAuMC4xOjUzMDAiLCJodHRwOi8vbG9jYWxob3N0OjUxODAiXSwic2NvcGUiOiJ1c2VyIiwiZXhwIjoxNzkxMzg4NjQxLCJpYXQiOjE3OTEzMDIyNDEsImp0aSI6IjcwMjBkM2IyNjhmODcxNGQiLCJuYmYiOjE3OTEzMDIyNDF9.J5Ou41_K-nr12D3JP4wCVf0bZsorEVbvOgQ6WQTN54Y',
56
+ userKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxIiwiaXNzIjoiaHR0cHM6Ly9zZXJ2ZXIucGxpdHppLmxvY2FsIiwiYXVkIjpbImh0dHBzOi8vcGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsOjMwMDAiLCJodHRwczovL2FwcC5wbGl0emkubG9jYWw6MzAwMSIsImh0dHBzOi8vYXBpLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc3NyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc2VydmVyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vbWNwLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vYXV0aC5wbGl0emkubG9jYWwiLCJodHRwOi8vMTI3LjAuMC4xOjUzMDAiLCJodHRwOi8vbG9jYWxob3N0OjUxODAiXSwic2NvcGUiOiJ1c2VyIiwiZXhwIjoxNzkxNTQ1ODcxLCJpYXQiOjE3OTE0NTk0NzEsImp0aSI6IjMwNjQ3NmFlN2YzOTgwMmMiLCJuYmYiOjE3OTE0NTk0NzF9.1yw4JxzN9qkssRYSHAqg4hjFRvatT82PkYVGwF3SP_I',
57
57
  environment: 'main',
58
58
  functionsWorkerUrl: '/plitzi-functions-worker.js',
59
+ sdkIconsStylePath: '',
59
60
  server: {
60
61
  basePath: '',
61
62
  // Dashboard
@@ -27,6 +27,8 @@ export type AppContextValue = {
27
27
  setMobilePreview: Dispatch<SetStateAction<boolean>>;
28
28
  /** Where the Functions panel's TypeScript worker is served; empty when the host serves none. */
29
29
  functionsWorkerUrl: string;
30
+ /** Where the SDK's icon sheet is served, for the canvases to link; empty when the host serves none. */
31
+ sdkIconsStylePath: string;
30
32
  };
31
33
  declare const AppContext: import('react').Context<AppContextValue>;
32
34
  export default AppContext;
@@ -14,6 +14,7 @@ export type AppMainProps = {
14
14
  children?: ReactNode;
15
15
  debugMode?: boolean;
16
16
  functionsWorkerUrl?: string;
17
+ sdkIconsStylePath?: string;
17
18
  };
18
- declare const AppMain: ({ webKey, webId, userKey, instanceId, server, environment, includeSubscriptions, includeRealTime, externalStyle, debugMode, functionsWorkerUrl }: AppMainProps) => import('react').JSX.Element;
19
+ declare const AppMain: ({ webKey, webId, userKey, instanceId, server, environment, includeSubscriptions, includeRealTime, externalStyle, debugMode, functionsWorkerUrl, sdkIconsStylePath }: AppMainProps) => import('react').JSX.Element;
19
20
  export default AppMain;
@@ -0,0 +1,10 @@
1
+ import { Asset } from '@plitzi/sdk-shared';
2
+ /**
3
+ * The SDK's Font Awesome sheet in a canvas: linked, never inlined.
4
+ *
5
+ * The sheet names its fonts relative to itself (`webfonts/…`), so they are found wherever the sheet is served from.
6
+ * Inlined into the canvas's `<style>` they resolved against the document instead — a `srcdoc` frame takes the editor's
7
+ * URL as its base — and every icon was a 404 under `/spaces/<space>/webfonts/`. Only the Vite dev server, which
8
+ * rewrites the URL, hid it.
9
+ */
10
+ export declare const canvasIconsAssets: (href: string) => Record<string, Asset>;
@@ -0,0 +1 @@
1
+ export {};
@@ -3,7 +3,7 @@ export type BuilderSubscriptionsContextValue = {
3
3
  includeSubscriptions: boolean;
4
4
  supportRealTime: boolean;
5
5
  subscriptionsPush: (data: RTMessageManagedClient) => void;
6
- subscriptionsRegisterCallback: (type: RTEvent, callback: RTCallback, subscriberId?: string) => void;
6
+ subscriptionsRegisterCallback: <E extends RTEvent>(type: E, callback: RTCallback<E>, subscriberId?: string) => void;
7
7
  subscriptionsUnregisterCallback: (type: RTEvent, subscriberId?: string) => void;
8
8
  };
9
9
  declare const BuilderSubscriptionsContext: import('react').Context<BuilderSubscriptionsContextValue>;
@@ -3,14 +3,23 @@ import { SchemaReducerActions } from '@plitzi/sdk-schema/SchemaReducer';
3
3
  import { Schema, Style } from '@plitzi/sdk-shared';
4
4
  import { StyleReducerActions } from '@plitzi/sdk-style/StyleReducer';
5
5
  import { ActionDispatch } from 'react';
6
- export type QueueItem<TState = any, TDispatchAction = any> = {
6
+ export type QueueItem<TState, TDispatchAction> = {
7
7
  action: TDispatchAction;
8
8
  prevState: TState;
9
9
  state: TState;
10
10
  dispatch: ActionDispatch<[action: TDispatchAction]>;
11
11
  };
12
+ /** A change the queue sends: to the schema or to the style, each with its own reducer's state and action. */
13
+ export type QueuedChange = ({
14
+ kind: 'schema';
15
+ } & QueueItem<Schema, SchemaReducerActions>) | ({
16
+ kind: 'style';
17
+ } & QueueItem<Style, StyleReducerActions>);
12
18
  export type QueueContextValue = {
13
- enqueueMiddleware: ReducerMiddlewareCallback<Schema | Style, [action: StyleReducerActions | SchemaReducerActions]>;
19
+ /** What queues the schema reducer's changes, as its middleware. */
20
+ enqueueSchema: ReducerMiddlewareCallback<Schema, [action: SchemaReducerActions]>;
21
+ /** What queues the style reducer's changes, as its middleware. */
22
+ enqueueStyle: ReducerMiddlewareCallback<Style, [action: StyleReducerActions]>;
14
23
  };
15
24
  declare const QueueContext: import('react').Context<QueueContextValue>;
16
25
  export default QueueContext;
@@ -1,4 +1,4 @@
1
- import { QueueItem } from '../QueueContext';
1
+ import { QueuedChange } from '../QueueContext';
2
2
  import { BuilderMutationsMap, BuilderQueriesMap } from '@plitzi/sdk-shared';
3
3
  import { NetworkContextValue } from '@plitzi/sdk-shared/network/NetworkContext';
4
4
  export type UseQueueManagerProps = {
@@ -9,7 +9,7 @@ export type UseQueueManagerProps = {
9
9
  disabled?: boolean;
10
10
  };
11
11
  declare const useQueueManager: ({ delay, mutate, maxRetries, retryTimeout, disabled }: UseQueueManagerProps) => {
12
- enqueue: (item: QueueItem) => void;
12
+ enqueue: (item: QueuedChange) => void;
13
13
  processing: boolean;
14
14
  };
15
15
  export default useQueueManager;
@@ -0,0 +1,12 @@
1
+ export type ShortcutsContextValue = {
2
+ /** Opens the sheet listing every shortcut. */
3
+ openHelp: () => void;
4
+ /** Hides both side panels for the canvas alone — or, when they are hidden, brings back the ones that were open. */
5
+ togglePanels: () => void;
6
+ };
7
+ /**
8
+ * The canvas is an iframe, and a key pressed inside it never reaches the document the shortcuts listen on: the canvas
9
+ * forwards the ones it sees through here, as it does ⌘P through the search.
10
+ */
11
+ declare const ShortcutsContext: import('react').Context<ShortcutsContextValue>;
12
+ export default ShortcutsContext;
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ export type ShortcutsProviderProps = {
3
+ children?: ReactNode;
4
+ };
5
+ /**
6
+ * The builder's own shortcuts — the ones that act on the workspace rather than on the canvas: the help sheet and the
7
+ * side panels. Inside the popup provider, whose panels it hides and brings back.
8
+ */
9
+ declare const ShortcutsProvider: ({ children }: ShortcutsProviderProps) => import('react').JSX.Element;
10
+ export default ShortcutsProvider;
@@ -0,0 +1,7 @@
1
+ export type ShortcutsHelpProps = {
2
+ open: boolean;
3
+ onClose: () => void;
4
+ };
5
+ /** Every key the builder answers to, grouped by where it acts. Opened with `?` from anywhere but a text field. */
6
+ declare const ShortcutsHelp: ({ open, onClose }: ShortcutsHelpProps) => import('react').JSX.Element;
7
+ export default ShortcutsHelp;
@@ -0,0 +1,3 @@
1
+ import { default as ShortcutsHelp } from './ShortcutsHelp';
2
+ export * from './ShortcutsHelp';
3
+ export default ShortcutsHelp;
@@ -0,0 +1,22 @@
1
+ /** One key of a shortcut as its keycap reads — `command` puts the platform's modifier (⌘ / Ctrl) in front of it. */
2
+ export type ShortcutKey = {
3
+ char: string;
4
+ command?: boolean;
5
+ };
6
+ export type Shortcut = {
7
+ label: string;
8
+ keys: ShortcutKey[];
9
+ };
10
+ export type ShortcutGroup = {
11
+ title: string;
12
+ shortcuts: Shortcut[];
13
+ };
14
+ /**
15
+ * Every shortcut the builder answers to, and only those: the help sheet (`?`) and the card shown while nothing is
16
+ * selected both read this list, so a key that is listed is a key that works.
17
+ */
18
+ export declare const SHORTCUT_GROUPS: ShortcutGroup[];
19
+ /** Where a key is text being typed, not a command: an input, a textarea, a select or anything editable. */
20
+ export declare const isTypingTarget: (target: EventTarget | null) => boolean;
21
+ export declare const isHelpShortcut: (e: KeyboardEvent) => boolean;
22
+ export declare const isPanelsShortcut: (e: KeyboardEvent) => boolean;
@@ -0,0 +1,6 @@
1
+ import { default as ShortcutsProvider } from './ShortcutsProvider';
2
+ export * from './helpers';
3
+ export * from './ShortcutsProvider';
4
+ export { default as ShortcutsContext } from './ShortcutsContext';
5
+ export type * from './ShortcutsContext';
6
+ export default ShortcutsProvider;
@@ -4,21 +4,30 @@ import { SchemaReducerActions } from '@plitzi/sdk-schema/SchemaReducer';
4
4
  import { Schema, Style } from '@plitzi/sdk-shared';
5
5
  import { StyleReducerActions } from '@plitzi/sdk-style/StyleReducer';
6
6
  import { ActionDispatch } from 'react';
7
- export type UndoableItem<TState = any, TDispatchAction = any> = {
7
+ export type UndoableItem<TState, TDispatchAction> = {
8
8
  action: TDispatchAction;
9
9
  dispatch: ActionDispatch<[action: TDispatchAction]>;
10
10
  nextState: TState;
11
11
  prevState: TState;
12
12
  };
13
+ /** A change the history keeps: to the schema or to the style, each with its own reducer's state and action. */
14
+ export type UndoableChange = ({
15
+ kind: 'schema';
16
+ } & UndoableItem<Schema, SchemaReducerActions>) | ({
17
+ kind: 'style';
18
+ } & UndoableItem<Style, StyleReducerActions>);
13
19
  export type UndoableContextValue = {
14
20
  canUndo: boolean;
15
21
  canRedo: boolean;
16
22
  dispatchUndoable: ActionDispatch<[action: UndoableReducerActions]>;
17
- undoableAddUndo: (prevState: UndoableItem['prevState'], action: UndoableItem['action'], nextState: UndoableItem['nextState'], dispatch: UndoableItem['dispatch']) => void;
23
+ undoableAddUndo: (change: UndoableChange) => void;
18
24
  undoableUndo: () => void;
19
25
  undoableRedo: () => void;
20
26
  undoableClearHistory: () => void;
21
- undoableMiddleware: ReducerMiddlewareCallback<Schema | Style, [action: StyleReducerActions | SchemaReducerActions]>;
27
+ /** What remembers the schema reducer's changes, as its middleware. */
28
+ undoableSchema: ReducerMiddlewareCallback<Schema, [action: SchemaReducerActions]>;
29
+ /** What remembers the style reducer's changes, as its middleware. */
30
+ undoableStyle: ReducerMiddlewareCallback<Style, [action: StyleReducerActions]>;
22
31
  };
23
32
  declare const UndoableContext: import('react').Context<UndoableContextValue>;
24
33
  export default UndoableContext;
@@ -1,20 +1,21 @@
1
- import { UndoableItem } from './UndoableContext';
2
- export type UndoableReducerActions = ({
1
+ import { UndoableChange } from './UndoableContext';
2
+ export type UndoableReducerActions = {
3
3
  type: 'undoableAddUndo';
4
- } & UndoableItem) | {
4
+ change: UndoableChange;
5
+ } | {
5
6
  type: 'undoableUndo';
6
- past: UndoableItem[];
7
- future: UndoableItem[];
7
+ past: UndoableChange[];
8
+ future: UndoableChange[];
8
9
  } | {
9
10
  type: 'undoableRedo';
10
- past: UndoableItem[];
11
- future: UndoableItem[];
11
+ past: UndoableChange[];
12
+ future: UndoableChange[];
12
13
  } | {
13
14
  type: 'undoableClearHistory';
14
15
  };
15
16
  export type UndoableState = {
16
- past: UndoableItem[];
17
- future: UndoableItem[];
17
+ past: UndoableChange[];
18
+ future: UndoableChange[];
18
19
  canUndo: boolean;
19
20
  canRedo: boolean;
20
21
  };
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "@plitzi/plitzi-builder",
3
- "version": "0.38.10",
3
+ "version": "0.38.12",
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.32",
37
+ "@plitzi/plitzi-ui": "^1.6.33",
38
38
  "@plitzi/sdk-auth": "workspace:*",
39
39
  "@plitzi/sdk-authoring": "workspace:*",
40
40
  "@plitzi/sdk-dev-tools": "workspace:*",