@plitzi/plitzi-sdk 0.38.12 → 0.38.14

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,181 @@
1
1
  # @plitzi/plitzi-sdk
2
2
 
3
+ ## 0.38.14
4
+
5
+ ### Patch Changes
6
+
7
+ - 493955a: ## SDK
8
+
9
+ - **An embedded space leaves the page's theme alone** (`@plitzi/plitzi-sdk`, `@plitzi/plitzi-builder`): plitzi-ui's
10
+ `Provider` stamps `dark` on `<html>` by default — and, being `light`, takes it off — so every space mounted with
11
+ `themeScope: 'container'` turned the page around it light, and nothing put it back. The SDK and the builder now leave
12
+ the class to their own theme provider (`applyColorModeClass={false}`).
13
+ - **A space inside a space** (`@plitzi/plitzi-sdk`, `@plitzi/sdk-shared`): one drawn inside another — the `plitziSdk`
14
+ element, a plugin rendering one, the builder's canvas — knows it (`render.enclosed`). It is `container` unless it
15
+ says otherwise, wears its theme on its own root and starts from the page's when its own is `system`, keeps its
16
+ stylesheet to its own root (`@scope` — its `:root` palette and `.dark` rules repainted the outer page, its
17
+ `.plitzi-sdk` rule restyled the outer root), writes no `<title>` (`ownsHead`) and no `theme` cookie.
18
+ - **The `plitziSdk` element draws** (`@plitzi/plitzi-sdk`): it rendered in `widget` mode with no page to show, so it
19
+ drew nothing. A widget with no `currentPageId` now shows the page its home address would. And it takes a space's
20
+ documents as well as a key: `offlineData`, bound whole (an `apiContainer`'s answer, a runtime's route, what
21
+ `plitzi_render` returns) or as `offlineData.schema` and `offlineData.style` from two elements — waiting, without an
22
+ error, for the half that has not answered; one that cannot be drawn is said why, in the console and on the canvas.
23
+ - **`<PlitziSdk>` inside a plugin draws** (`@plitzi/plitzi-sdk`): it mounted a router of its own inside the page's, and
24
+ React Router refused it — `routing: 'memory'` or not. A space inside another is a widget: `raw` becomes `widget`
25
+ there, one page and no router (a frame of its own, `iframe` or `shadow`, is left as asked).
26
+ - **A space inside another is as tall as what it holds** (`@plitzi/plitzi-sdk`): its root was `min-h-screen`, as a
27
+ space that IS the page is, so a card of three lines drawn in a panel took the window's height.
28
+ - **`<PlitziSdk.Plugin component>` takes a component with its own props** (`@plitzi/plitzi-sdk`), as `render()`'s
29
+ plugins do: typed `ComponentPluginFC`, it refused any component that read its attributes.
30
+ - **An edited page keeps its address in step** (`@plitzi/plitzi-sdk`): the routes are built from the pages' own
31
+ elements, and those were read again only when the list of pages changed — an edit to one page (its slug, its flag)
32
+ leaves that list the same, and the routes kept its old address until something else rebuilt them.
33
+ - **Packages declare only what they use** (`@plitzi/sdk-dev-tools`, `@plitzi/sdk-shared`): `@plitzi/sdk-plugins`, which
34
+ the dev tools no longer import, and `terser`, which no build here runs, are no longer dependencies.
35
+ - **An edited page keeps its route up to date** (`@plitzi/plitzi-sdk`): the routes are built from the pages' own
36
+ elements, which were read again only when the list of pages changed — an edit to one page (its slug, its flag) left
37
+ the list the same and the route at the old address. They follow every edit to a page now, and stay the same object
38
+ while no page changes.
39
+ - **`@plitzi/sdk-dev-tools` no longer depends on `@plitzi/sdk-plugins`**, which nothing in it imports.
40
+ - **A dropdown's menu opens inside a card that lifts or clips** (`@plitzi/sdk-elements`, `@plitzi/sdk-shared`): drawn
41
+ inside the dropdown, an ancestor with a `transform` — a card lifting on hover — made itself the containing block of
42
+ the menu's `position: fixed`, and one with `overflow: hidden` cut it off: the menu opened and nobody saw it. The open
43
+ menu and its backdrop are drawn at the space's root (`spaceRootOf`, `@plitzi/sdk-shared/helpers/spaceRoot`); a
44
+ style written for the popup by an ancestor's selector no longer reaches it — its own classes do.
45
+ - **A copy button says when it could not copy** (`@plitzi/sdk-elements`, `@plitzi/sdk-shared`,
46
+ `@plitzi/sdk-interactions`, `@plitzi/sdk-variables`, `@plitzi/sdk-dev-tools`): a page not served over https has no
47
+ clipboard — a phone opening a development server by its address — and a code block's "Copy" threw there. It reads
48
+ "Not copied", and says why. `clipboardWriter` and `copyText` (`@plitzi/sdk-shared/helpers/clipboard`) are the one
49
+ check, the `copyToClipboard` step's too.
50
+
51
+ ## Authoring
52
+ - **`plitziSdk` is authored like any element** (`@plitzi/sdk-authoring`, `@plitzi/sdk-elements`): its declaration moved
53
+ to `@plitzi/sdk-elements` beside the others, so it has a factory — `plitziSdk({ id, bind: { offlineData: 'view.data'
54
+ } })` —, its attributes typed, and `plitzi explain` knows it.
55
+ - **A binding may write part of an attribute** (`@plitzi/sdk-authoring`): `offlineData.schema` writes into
56
+ `offlineData`, as the runtime always did; authoring refused it as an attribute nothing reads.
57
+ - **`choosesChildren`** (`@plitzi/sdk-shared`, `@plitzi/sdk-authoring`): a plugin that shows only some of the elements
58
+ put inside it — a dashboard's panels, a wizard's step — says so in its declaration, and the page checks owe none of
59
+ them on screen; what it draws is still read by the checks of the whole page (images, sideways scroll, legibility).
60
+ `verify` was red on every such page.
61
+
62
+ - **A page says how the document scrolls** (`@plitzi/sdk-elements`, `@plitzi/sdk-authoring`, `@plitzi/sdk-mcp`):
63
+ `documentScroll: 'locked'` holds the document still while the page is open — a dashboard or a board used with a
64
+ finger, where the whole page was dragged and bounced back though nothing in it scrolls — and `'noBounce'` keeps the
65
+ scroll without the rubber band or pull-to-refresh. The page draws the rule itself, so it is in the server's HTML and
66
+ leaves with the page; never inside a widget, a space drawn in another, or the builder's canvas. A Settings select,
67
+ `PageSpec.documentScroll`, `upsertPage`'s `documentScroll` (`null` undoes it) and the page read; an unknown value is
68
+ refused (`attribute-value`). `upsertPage` is now held to the lint of the page it writes, as element writes are.
69
+
70
+ ## MCP
71
+ - **`@plitzi/sdk-mcp/render`** (`@plitzi/sdk-mcp`): `plitzi_render`'s widget render on its own — no MCP server, no SSR,
72
+ no OAuth — for a project whose own agent draws in its own pages: `render`, `renderWidgetShape` to declare it as a
73
+ tool, `renderGuideText` for the agent. `base`, the style of the project's space, brings its tokens, classes and fonts
74
+ to the widget.
75
+
76
+ ## Server
77
+ - **`publicUrl` says where people reach the server** (`@plitzi/sdk-server`): it was `http://127.0.0.1:<port>` whatever
78
+ the server was. It is `https` once `serverOptions.tls` gives it a certificate, and this machine's network address
79
+ with `HOST` open to the network (what a tablet opens, what an OAuth provider sends it back to); `PUBLIC_URL` still
80
+ wins. The network addresses it prints say `https` too.
81
+ - **A server serving TLS reaches itself** (`@plitzi/sdk-server`): with a local certificate (mkcert) Node trusts nothing
82
+ the browsers were told to, so a runtime calling its own MCP failed. Its requests to its own address now connect to its
83
+ listener and are taken when it presents exactly its certificate (`reachOwnServer`, exported from `/runtime`).
84
+ - **A runtime reads compressed answers again** (`@plitzi/sdk-server`): the dispatcher `reachOwnServer` (and the
85
+ platform's `reachSpaceInside`) installs reached every other host with an undici connector that offers HTTP/2, and an
86
+ answer that came back over h2 reached Node's `fetch` without its `content-encoding` — every API that compresses read
87
+ as Brotli bytes. Other hosts are reached over HTTP/1.1 now, as Node's own `fetch` reaches them.
88
+ - **A project's server serves HTTPS from `.env`** (`@plitzi/sdk-server`, `@plitzi/sdk-shared`): `TLS_CERT` and
89
+ `TLS_KEY`, the certificate's and the key's paths — what `plitzi cert` writes — with no code of the project's;
90
+ `serverOptions.tls` still wins. A network address the certificate does not name is said at boot, the machine's
91
+ `.local` name is printed among the addresses when it is named, and a server on loopback alone says how to open it to
92
+ the network.
93
+ - **A session survives a phone on the Wi-Fi** (`@plitzi/sdk-server`): a private network address (`192.168.…`, `10.…`,
94
+ Tailscale's `100.64/10`, IPv6 unique- and link-local) and a machine's mDNS name (`studio.local`) get the local
95
+ cookie profile — `SameSite=Lax`, no `Secure`, no `Domain`. They got `SameSite=None; Secure`, which a browser drops
96
+ over http: nobody could sign in from a tablet. A deployment's own `.local` sub-domains (`app.example.local`) keep the
97
+ strict profile.
98
+ - **Hiding the dev tools on a server over HTTPS hydrates** (`@plitzi/sdk-server`): a server with a certificate speaks
99
+ HTTP/2, which sends no `Host` — only `:authority` — and the cookies named for the origin's port (the dev tools'
100
+ `plitzi_debug_<port>`, forced flags, painted state) were looked for without it. Shift+F12 hid the dev tools in the
101
+ browser, the server rendered them back, and the page failed to hydrate. Every one is read off `requestAuthority`.
102
+ - **A rebuild of plugins says it finished** (`@plitzi/sdk-server`): bundles removed under a running server (`tmp/`
103
+ deleted) were each a warning, "rebuilding…", and their "ready" at a level a project's terminal does not show. It is
104
+ one episode now: said when noticed, and again when the last is built — how many, how long, which failed.
105
+ - **`tmp/dev-server.json` records the scheme** (`@plitzi/sdk-server`): `url` is `https` with a certificate, and the
106
+ file adds the network addresses and the `publicUrl`.
107
+ - **`public/` is asked about every time** (`@plitzi/sdk-server`): it was cached for an hour — a `.js` or `.css` in it
108
+ for a year, `immutable` — so a file a project rewrites while it runs arrived stale. It is `no-cache` now, answered
109
+ `304` by its `ETag` while unchanged; `immutable` stays for what is versioned (the SDK, the plugins).
110
+
111
+ ## CLI
112
+ - **`check`, `shot`, `verify` and `visual` find a server on HTTPS** (`@plitzi/cli`): they rebuilt
113
+ `http://127.0.0.1:<port>`, so a project serving a certificate had no page checked. They read the URL `npm start`
114
+ recorded, and take a local certificate on this machine only. A project's `playwright.config.ts` comes from
115
+ `plitzi upgrade`.
116
+ - **`verify` runs the project's tests** (`@plitzi/cli`): a step `test`, after the lint, when `package.json` has a
117
+ `test` script.
118
+ - **`tsconfig.json` is the project's** (`@plitzi/cli`): the compiler options moved to `plitzi/tsconfig.base.json`, which
119
+ the CLI keeps up and `tsconfig.json` extends — so a folder of the project's own (`scripts/`, `tools/`) goes in its
120
+ `include` without changing a file of the CLI's. `plitzi doctor --fix` makes an older `tsconfig.json` extend it,
121
+ keeping only the options the project changed.
122
+ - **`doctor --fix` and `upgrade` write as the project's Prettier does** (`@plitzi/cli`): a repaired `tsconfig.json` or
123
+ `package.json` left `verify`'s format step red.
124
+ - **`upgrade` renames `usePlitziServiceContext`** (`@plitzi/cli`): with `PlitziServiceProvider` and
125
+ `PlitziServiceContextValue`, renamed in 0.38.12 with no alias — import, use and the module path that named it.
126
+ - **`skills update` compares every file** (`@plitzi/cli`): only `SKILL.md` was, so a change in a reference alone was
127
+ "up to date".
128
+ - **`NOTES.md`, the project's notes for agents** (`@plitzi/cli`): `AGENTS.md` and `CLAUDE.md` are the CLI's and
129
+ `upgrade` replaces them, so what a project's own sessions had to know had nowhere to live. `CLAUDE.md` imports
130
+ `NOTES.md`, `AGENTS.md` sends every agent to it, and nothing the CLI does touches it; `doctor --fix` writes one for
131
+ a project that has none.
132
+
133
+ - **`start:dev-inspect`** (`@plitzi/cli`): a server project's `start:dev` with Node's inspector open on
134
+ 127.0.0.1:9229, so a debugger (VS Code, `chrome://inspect`) attaches to the server, and again after each restart.
135
+ `plitzi upgrade` adds it; `plitzi runtime add` has it restart on the runtime too.
136
+ - **`plitzi cert`** (`@plitzi/cli`): HTTPS while developing, for a phone or a tablet on the Wi-Fi — over http its
137
+ browser gives a page no microphone, camera or clipboard. A certificate from mkcert's local authority for this machine,
138
+ its network addresses and its `.local` name, in `tmp/tls/`, named in `.env`; what to install on the phone, said.
139
+ - **A browser project opens to the network** (`@plitzi/cli`): its `vite.config.ts` reads `HOST`, `TLS_CERT` and
140
+ `TLS_KEY` from `.env`, as a server project does, and writes `tmp/dev-server.json` — the port Vite took and the scheme
141
+ — so `page check`, `page shot` and `visual` find it on another port or over HTTPS. `plitzi upgrade` brings it.
142
+
143
+ ## Docs
144
+ - **Two plugins share through `state`** (`@plitzi/sdk-authoring` skill): each plugin is a bundle of its own, so a module
145
+ both import is two copies, and what one keeps there the other never sees.
146
+ - **`verify --help`** names the project's tests among its steps.
147
+
148
+ - Updated dependencies [493955a]
149
+ - @plitzi/sdk-auth@0.38.14
150
+ - @plitzi/sdk-dev-tools@0.38.14
151
+ - @plitzi/sdk-elements@0.38.14
152
+ - @plitzi/sdk-event-bridge@0.38.14
153
+ - @plitzi/sdk-interactions@0.38.14
154
+ - @plitzi/sdk-navigation@0.38.14
155
+ - @plitzi/sdk-plugins@0.38.14
156
+ - @plitzi/sdk-schema@0.38.14
157
+ - @plitzi/sdk-shared@0.38.14
158
+ - @plitzi/sdk-style@0.38.14
159
+ - @plitzi/sdk-variables@0.38.14
160
+
161
+ ## 0.38.13
162
+
163
+ ### Patch Changes
164
+
165
+ - v0.38.13
166
+ - Updated dependencies
167
+ - @plitzi/sdk-auth@0.38.13
168
+ - @plitzi/sdk-dev-tools@0.38.13
169
+ - @plitzi/sdk-elements@0.38.13
170
+ - @plitzi/sdk-event-bridge@0.38.13
171
+ - @plitzi/sdk-interactions@0.38.13
172
+ - @plitzi/sdk-navigation@0.38.13
173
+ - @plitzi/sdk-plugins@0.38.13
174
+ - @plitzi/sdk-schema@0.38.13
175
+ - @plitzi/sdk-shared@0.38.13
176
+ - @plitzi/sdk-style@0.38.13
177
+ - @plitzi/sdk-variables@0.38.13
178
+
3
179
  ## 0.38.12
4
180
 
5
181
  ### Patch Changes
package/dist/App.d.ts CHANGED
@@ -39,6 +39,9 @@ export type AppProps = {
39
39
  * a theme of its own (the desktop window, a component mounted in a host): it wears the class on its own root and
40
40
  * keeps a theme store of its own, so toggling it never reaches the application around it, and two spaces in one
41
41
  * document do not answer for each other.
42
+ *
43
+ * Left out, it is `container` for a space drawn inside another (the `plitziSdk` element, a plugin rendering one) and
44
+ * `document` otherwise.
42
45
  */
43
46
  themeScope?: ThemeScope;
44
47
  /** The theme the host already settled — from the cookie a server read before it rendered the document. */
@@ -60,5 +63,5 @@ export type AppProps = {
60
63
  onInitStateManager?: (instance: RuntimeStateInstance) => void;
61
64
  onInitEventBridge?: (instance: EventBridgeContextValue) => void;
62
65
  };
63
- declare const App: ({ className, children, webKey, server, renderMode, routing, debugMode: debugModeProp, themeScope, theme, state, forcedFlags, ...sdkProps }: AppProps) => import('react').JSX.Element;
66
+ declare const App: ({ className: classNameProp, children, webKey, server, renderMode: renderModeProp, routing, debugMode: debugModeProp, themeScope: themeScopeProp, theme, state, forcedFlags, ...sdkProps }: AppProps) => import('react').JSX.Element;
64
67
  export default App;
package/dist/index.d.ts CHANGED
@@ -144,11 +144,13 @@ export type PlitziSdkProps = {
144
144
  */
145
145
  hostActions?: HostActions;
146
146
  /**
147
- * Whose theme this space follows and repaints. `document` (the default) is a space that IS the page.
147
+ * Whose theme this space follows and repaints. `document` (the default for a space on its own) is a space that IS
148
+ * the page.
148
149
  *
149
150
  * `container` is a space EMBEDDED in an application with a theme of its own: it wears the class on its own root
150
151
  * and keeps a theme store of its own, so toggling it never reaches the application around it, and two spaces in
151
- * one document do not answer for each other.
152
+ * one document do not answer for each other. A space drawn inside another one — the `plitziSdk` element, a plugin
153
+ * rendering a space — is `container` unless it says otherwise.
152
154
  */
153
155
  themeScope?: ThemeScope;
154
156
  /** The theme the host already settled — from the cookie a server read before it rendered the document. */
@@ -1,12 +1,10 @@
1
- import { Environment } from '@plitzi/sdk-shared';
1
+ import { PlitziSdkAttributes } from '@plitzi/sdk-elements/elements/advanced/PlitziSdk/declaration';
2
2
  import { RefObject } from 'react';
3
- export type PlitziSdkProps = {
3
+ export type PlitziSdkProps = PlitziSdkAttributes & {
4
4
  ref?: RefObject<HTMLElement>;
5
5
  className?: string;
6
- spaceKey?: string;
7
- environment?: Environment;
8
6
  };
9
- declare const PlitziSdk: ({ ref, className, spaceKey, environment }: PlitziSdkProps) => import('react').JSX.Element;
7
+ declare const PlitziSdk: ({ ref, className, spaceKey, environment, offlineData }: PlitziSdkProps) => import('react').JSX.Element;
10
8
  declare const _default: {
11
9
  (props: import('@plitzi/sdk-elements/Element/hocs/withElement').WithElementProps<PlitziSdkProps>): import('react').JSX.Element;
12
10
  displayName: string;
@@ -18,6 +18,7 @@ declare const PlitziSdk: {
18
18
  };
19
19
  definition: {
20
20
  readonly label: "Plitzi Sdk";
21
+ readonly description: "Another space drawn inside this one, as a widget \u2014 its home page, no router of its own: by its key, or from its documents (`offlineData`), bound to UI generated on the fly.";
21
22
  } & {
22
23
  type: string;
23
24
  bindings: NonNullable<import('@plitzi/sdk-shared').ElementDefinition["bindings"]>;
@@ -40,9 +41,6 @@ declare const PlitziSdk: {
40
41
  settings: Record<string, string | number | boolean>;
41
42
  };
42
43
  type: "plitziSdk";
43
- __attributes: Partial<{
44
- environment?: import('@plitzi/sdk-shared').Environment | undefined;
45
- spaceKey?: string | undefined;
46
- }>;
44
+ __attributes: import('@plitzi/sdk-elements/elements/advanced/PlitziSdk/declaration').PlitziSdkAttributes;
47
45
  };
48
46
  export default PlitziSdk;
@@ -0,0 +1,18 @@
1
+ import { OfflineDataRaw } from '@plitzi/sdk-shared';
2
+ export type OfflineDocuments = {
3
+ documents: OfflineDataRaw;
4
+ }
5
+ /** Bound from two sources, one has not answered yet: nothing to draw, and nothing wrong. */
6
+ | {
7
+ waiting: ('schema' | 'style')[];
8
+ } | {
9
+ problem: string;
10
+ };
11
+ /**
12
+ * The documents a `plitziSdk` element was handed, whether they are still on their way, or why they cannot be drawn.
13
+ *
14
+ * They arrive from bindings as often as from an author — an `apiContainer`'s answer whole, or `schema` and `style` from
15
+ * two elements, one answering before the other — so anything may come in, and a half-built value fed to the SDK fails
16
+ * deep inside it, far from the element that was given it.
17
+ */
18
+ export declare const offlineDocuments: (value: unknown) => OfflineDocuments;
@@ -1,8 +1,10 @@
1
- import { Asset, ComponentDefinition, ComponentPluginFC } from '@plitzi/sdk-shared';
1
+ import { PluginComponent } from './deferredPlugins';
2
+ import { Asset, ComponentDefinition } from '@plitzi/sdk-shared';
2
3
  import { FC } from 'react';
3
4
  export type SdkPluginProps = {
4
5
  renderType: string;
5
- component: ComponentPluginFC;
6
+ /** The component, taking its element's attributes as props — as `render()`'s plugins do (see `RenderPlugins`). */
7
+ component: PluginComponent;
6
8
  settings?: FC<any>;
7
9
  definition?: ComponentDefinition;
8
10
  assets?: Asset[];
@@ -0,0 +1,11 @@
1
+ /**
2
+ * A space's stylesheet, kept to the space when it is drawn inside another one.
3
+ *
4
+ * Every space writes its palette on `:root` and its classes — `.dark`, `.plitzi-sdk`, its own — for the whole
5
+ * document, which is right for a space that IS the page and wrong for one inside it: the inner space's `:root` and
6
+ * `.dark` rules repainted the page around it, its `.plitzi-sdk` rule restyled the outer space's root.
7
+ *
8
+ * `@scope` with no prelude limits the rules to the element the `<style>` hangs from — the SDK's own root, which also
9
+ * wears the inner space's theme class — so `:root` is written `:scope` there, and `.dark` matches only inside.
10
+ */
11
+ export declare const scopeSpaceCss: (css: string) => string;
@@ -0,0 +1 @@
1
+ export {};