@plitzi/sdk-authoring 0.38.11 → 0.38.13

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,115 @@
1
1
  # @plitzi/sdk-authoring
2
2
 
3
+ ## 0.38.13
4
+
5
+ ### Patch Changes
6
+
7
+ - v0.38.13
8
+
9
+ ## 0.38.12
10
+
11
+ ### Patch Changes
12
+
13
+ - 1301338: ## Builder
14
+
15
+ - **Icons in the canvas again** (`@plitzi/plitzi-builder`): the canvas inlined the SDK's Font Awesome sheet into its
16
+ `<style>`, where the sheet's `url(webfonts/…)` resolved against the editor's URL — a `srcdoc` frame takes it as its
17
+ base — so every icon was a 404 under `/spaces/<space>/webfonts/` and drew as an empty box. Only the Vite dev server,
18
+ which rewrites the URL, hid it. The canvas and the element preview now link the sheet from where the host serves it:
19
+ a new prop, `sdkIconsStylePath`, the one the host already gives the pages it renders
20
+ (`/sdk-assets/plitzi-sdk-icons.css` for sdk-server). Absent, the canvas links no icon sheet.
21
+
22
+ ## Plugins
23
+ - **A plugin's other elements, hosted by `custom`** (`@plitzi/sdk-elements`): `custom({ renderType: 'jamDisc' })` on a
24
+ space with a plugin installed whose main element is another (`plitzi plugin pack` of several folders: the first is the
25
+ plugin, the rest go in it) rendered "Custom Component jamDisc Not Found" — the page registers only the plugin's main
26
+ element, and a `custom` host looked nowhere else. It now loads the type from the installed plugin that packs it, as
27
+ an element of the type itself always did, so the two ways the docs give to place a plugin's element are the same
28
+ everywhere: in a project `plitzi create` wrote, and once the project is on Plitzi.
29
+ - **One way to place a plugin's element** (`@plitzi/sdk-authoring`, `@plitzi/cli`, docs): from its declaration,
30
+ `const seatPicker = defineElement(declaration)` then `seatPicker({ id, … })` — typed by what it
31
+ declares, and the element the builder adds when somebody drops it. The welcome space `plitzi create` writes, the
32
+ plugin package's preview, `plitzi plugin add` and `plitzi explain` all write it so (the template's
33
+ `PluginHostOptions` now takes the plugin's `type` and `declaration: { from, attributes? }`; `custom`/`element` hosting
34
+ is gone). `pluginFolders(folder)` (`@plitzi/sdk-authoring/node`) reads each plugin with the folder it is in;
35
+ `pluginDeclarations` is built on it. A `custom({ renderType })` naming a plugin the space was handed the declaration
36
+ of is offered the declaration instead — suggestion `plugin-custom-host`. `custom` stays for a component registered
37
+ by name with no declaration. The skills, the CLI README, the MCP guide, `docs/en` and the website say the same.
38
+ - **`definePlugin`** (`@plitzi/sdk-authoring/plugin`, a new entry of 3 KB with nothing else in it): a plugin's
39
+ declaration written from what only it can say —
40
+ `definePlugin<SeatPickerAttributes>()({ type, label, attributes, triggers, callbacks })` — and every other field
41
+ at the default all plugins share (the builder's gestures, the catalogue entry, each attribute bindable, an empty
42
+ style). It answers the whole declaration, branded with its attributes, so `defineElement(declaration)` is typed
43
+ without a generic. `plitzi plugin add` and `create --plugin` write declarations with it (about a third of the lines).
44
+ - **`usePluginTrigger(declaration)`** (`@plitzi/plitzi-sdk`): fires a plugin's declared event on its element — the
45
+ event name and what each hands a flow typed off the declaration's `preview` — on a live page only. The hook every
46
+ plugin wrote for itself (and `plugin add` generated as `use<Name>Events`) is gone from the scaffold.
47
+ - **Attributes as the types their defaults are** (`@plitzi/sdk-elements`): a plugin's attribute bound from text — a
48
+ state, a row, a channel message — reaches its component as the number or the flag its declared default is (`'112'`
49
+ as 112, `'true'` as true). A plugin no longer types its props `number | string` and parses them.
50
+
51
+ ## Server actions and functions
52
+ - **Task params with rules** (`@plitzi/sdk-server`, `@plitzi/sdk-shared`): a task declares `required`, a text's
53
+ `maxLength` and a number's `min`/`max`, and the runner refuses a call that breaks any of them — every rule broken at
54
+ once, in the words the page shows (`Title is required; Seconds is at most 300`) — before the code runs. A `text` param
55
+ bound to a number arrives as its digits. The manifest keeps the rules, so the platform's sandbox checks the same.
56
+ - **`taskAction(task, { trigger })`** (`@plitzi/sdk-authoring`): the action that runs one of the space's tasks and
57
+ answers its result, derived from the task — its id (`<namespace>-<action>`), name, description and input (the task's
58
+ params, once). An action of more than one step is still `defineAction`.
59
+ - **`ctx.rateLimit(bucket, { …, refuse })`**: past the limit the call is refused with those words instead of answering
60
+ `allowed: false` for the code to check — natively and in the sandbox.
61
+
62
+ ## Authoring
63
+ - **`runServerActionOrNotify(id, params, fallback)`**: a server action run and the notice the visitor reads when it
64
+ fails — the action's own refusal, or the fallback — as two steps to spread into a flow.
65
+ - **`repeated-shape` reads what copies bind**: copies whose bindings read their data in different forms (a count, a
66
+ total of a quota) and copies holding a provider resolved on the server (found by its own id) are no longer offered
67
+ as one component.
68
+ - **`element-color-inherited`** (suggestion): `elements` giving a heading, a text, a link… `color: inherit` or the
69
+ page's own colour. **A link inherits the page's colour** (`@plitzi/plitzi-sdk`, `@plitzi/sdk-elements`) rather than
70
+ holding the SDK's grey — the same by default, and the space's palette inside a card that is a link. The template
71
+ every space starts from writes its colours once, on the page.
72
+
73
+ ## Fixes
74
+ - **A dialog opened with an id** (`@plitzi/sdk-elements`): `openDialog('dialog', '{{ row.id }}')` reads the id as its
75
+ `content`, as `openModal` already did — a numeric id parsed as the number and the dialog's bindings read nothing.
76
+ - **A select's chevron** (`@plitzi/plitzi-sdk`): a drawn chevron in the field's own colour, sized by its type, in place
77
+ of the `▼` glyph — and laid out in the box, so it ends where the box's padding begins whatever that padding is, and
78
+ the chosen option stops short of it instead of running under it. A disabled select's is faded.
79
+ - **Every element has its settings** (`@plitzi/plitzi-builder`, `@plitzi/sdk-elements`): the builder found none for
80
+ `tabContainerHeader` (registered under a misspelt type), `themeToggle`, `dropdownPopup`, `loading` and `notFound`.
81
+ The theme toggle's panel sets its mode, its labels and whether it offers "System"; the registry is typed by element
82
+ type and must hold one for each.
83
+ - **A plugin's panel** (`@plitzi/cli`): `plitzi doctor` warns of a plugin with no `Settings.tsx`, or one its entry never
84
+ passes as `pluginSettings` (`plugin-settings-missing`); the example `create` writes has its panel, as every element
85
+ `plugin add` writes does, and the panels it generates are laid out as the project's Prettier lays them out.
86
+ - **A refused or failed run reaches `onFlowError` in every mode** (`@plitzi/sdk-interactions`): an awaited server
87
+ action the server refused fired no `onFlowError` on the element that started it, as `detached` and `stream` ones do
88
+ — a board rolling its edits back on a refusal never did; and a run answered `status: 'failed'` fired `onFlowEnd`
89
+ (detached) or nothing (awaited) rather than `onFlowError`.
90
+ - **A source renamed** (`@plitzi/sdk-shared`): the binding picker lists a provider, a form or a modal by the name its
91
+ element has now, not the one it had when it mounted.
92
+ - **A text's words in the builder** (`@plitzi/sdk-elements`): a `paragraph`, `text` or `heading` whose `content` is
93
+ `0` shows `0` while editing too, not its placeholder; one bound to nothing shows nothing rather than `null`.
94
+ - **Built-in declarations** (`@plitzi/sdk-shared`): `elementDeclaration` fills in what every element shares — the
95
+ builder's gestures, Plitzi's catalogue entry, a visible element with no bindings, its style named by its label —
96
+ from the defaults `definePlugin` uses; each element's declaration says only what is its own (a third of the lines).
97
+
98
+ ## Typed for plugins and hosts
99
+ - **`usePlitzi()` and `PlitziProvider`** (`@plitzi/sdk-shared/hooks/usePlitzi`, `@plitzi/plitzi-sdk`): what were
100
+ `usePlitziServiceContext()` and `PlitziServiceProvider` (and `PlitziServiceContextValue`, now `PlitziContextValue`),
101
+ holding only what the host rendering a space knows — `settings`, `root`, `utils`. Its `contexts` and
102
+ `customContexts` are gone: every context it carried is a shared one already, imported from its own module
103
+ (`@plitzi/sdk-interactions/InteractionsContext`, `@plitzi/sdk-shared/network/NetworkContext`…), and
104
+ `PluginsContext` moves to `@plitzi/sdk-shared/plugins/PluginsContext` beside the others.
105
+ - **`InteractionsManagerApi`** (`@plitzi/sdk-shared`): the interactions manager as everything outside
106
+ `@plitzi/sdk-interactions` reaches it, declared where every package can name it and implemented by
107
+ `InteractionsManager`, so `use(InteractionsContext)` is typed — `interactionTrigger`, `createChildManager`… — where it
108
+ was `any`.
109
+ - **`getPathsFromObject`** (`@plitzi/sdk-shared/helpers/utils`), spelt right; `getPathsFromObeject` is gone.
110
+ - **`ElementWords` places itself** (`@plitzi/sdk-elements`): `contentPlacement` and the element's children, so a button
111
+ and a link write their words once.
112
+
3
113
  ## 0.38.11
4
114
 
5
115
  ### Patch Changes
@@ -0,0 +1,102 @@
1
+ //#region ../sdk-shared/dist/authoring/declare.mjs
2
+ var e = () => (e) => e;
3
+ var t = () => ({
4
+ canDelete: !0,
5
+ canSelect: !0,
6
+ canDragDrop: !0,
7
+ canMove: !0,
8
+ canSnippet: !0,
9
+ itemsAllowed: [],
10
+ itemsNotAllowed: []
11
+ });
12
+ var n = (e, t) => ({
13
+ type: e,
14
+ bindings: {},
15
+ initialState: { visibility: !0 },
16
+ ...t,
17
+ styleSelectors: {
18
+ base: "",
19
+ ...t.styleSelectors
20
+ }
21
+ });
22
+ var r = () => (e) => {
23
+ let { definition: r, builder: i, market: a, defaultStyle: o, settings: s } = e.content;
24
+ return {
25
+ ...e,
26
+ content: {
27
+ ...e.content,
28
+ definition: n(e.type, r),
29
+ builder: {
30
+ ...t(),
31
+ ...i
32
+ },
33
+ market: {
34
+ owner: "Plitzi",
35
+ verified: !0,
36
+ license: "MIT",
37
+ website: "https://plitzi.com",
38
+ backgroundColor: "#4422ee",
39
+ ...a
40
+ },
41
+ defaultStyle: {
42
+ name: r.label,
43
+ displayMode: "desktop",
44
+ ...o
45
+ },
46
+ settings: s ?? {}
47
+ }
48
+ };
49
+ };
50
+ var i = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/^./, (e) => e.toUpperCase());
51
+ var a = () => ({ type: e, label: r, description: a, attributes: o, triggers: s, callbacks: c, builder: l, market: u, bindable: d, style: f, definition: p, settings: m, ...h }) => {
52
+ let g = (e, t, n) => ({
53
+ action: t,
54
+ title: n.title ?? i(t),
55
+ type: e,
56
+ params: n.params ?? {},
57
+ ...e === "trigger" ? { preview: n.preview ?? {} } : {}
58
+ }), _ = d ?? Object.keys(o);
59
+ return {
60
+ ...h,
61
+ type: e,
62
+ triggers: Object.fromEntries(Object.entries(s ?? {}).map(([e, t]) => [e, g("trigger", e, t)])),
63
+ callbacks: Object.fromEntries(Object.entries(c ?? {}).map(([e, t]) => [e, g("callback", e, t)])),
64
+ content: {
65
+ attributes: o,
66
+ definition: n(e, {
67
+ label: r,
68
+ ...a ? { description: a } : {},
69
+ items: [],
70
+ ...p
71
+ }),
72
+ builder: {
73
+ ...t(),
74
+ ...l
75
+ },
76
+ market: {
77
+ category: r,
78
+ owner: "",
79
+ license: "MIT",
80
+ website: "",
81
+ backgroundColor: "#4422ee",
82
+ icon: "",
83
+ ...u
84
+ },
85
+ defaultStyle: {
86
+ name: r,
87
+ displayMode: "desktop",
88
+ style: f ?? { base: { default: {} } },
89
+ bindingsAllowed: {
90
+ attributes: _.map((e) => ({
91
+ path: e,
92
+ label: i(e)
93
+ })),
94
+ initialState: []
95
+ }
96
+ },
97
+ settings: m ?? {}
98
+ }
99
+ };
100
+ };
101
+ //#endregion
102
+ export { e as n, r, a as t };