@plitzi/sdk-shared 0.36.2 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,60 @@
1
1
  # @plitzi/sdk-shared
2
2
 
3
+ ## 0.37.0
4
+
5
+ ### Minor Changes
6
+
7
+ - - A `button` takes a `title`: shown as a tooltip, and its accessible name when it has no text of its own — an
8
+ icon-only button without one was announced as nothing. The builder's settings offer it as "Tooltip". The JSON export
9
+ is two files, `schema.json` and `style.json`, shown as tabs; each group of changes in the export folds away.
10
+
11
+ - `BindingTransformer.params` is `Record<string, string | number | boolean>`: a param the builder draws as a checkbox
12
+ (`styleVariant`'s `append`) is stored as the boolean it is and read as one, so the type now says so. The MCP compares
13
+ such a param with its catalog options as text. A `container` may be an `li`, for the rows of a list. The export
14
+ keeps every element id with `keepIds`, and the header's Publish dialog opens wider.
15
+
16
+ - **The builder exports the space on screen — on paid plans.** **Export** in the header opens a wide dialog: the
17
+ format as tabs (TypeScript in one file, TypeScript with a file per page as a `.zip`, or JSON), generated as soon as
18
+ it is picked, shown read-only in CodeMirror — beside a file list when there are several — with one row of actions,
19
+ **Copy** and **Download**. What the export tidied is a one-line note that unfolds into readable groups. On the free
20
+ plan the dialog explains what export is instead; the server refuses the code with a 402 (`limit: 'spaceExport'`)
21
+ whatever the builder shows. `useSpaceExport` is the one way into it, for anything else that needs the space as files.
22
+
23
+ - **A space document can be read back into code.** `specFromSpace(documents)` turns a `{ schema, style }` pair — a
24
+ builder export, a seed checked in as JSON — into the `SpaceSpec` that authors it, and `specToSource(spec, { exportName })`
25
+ writes that spec out as the TypeScript a person would write: one factory call per element, the attributes a type
26
+ already defaults to left out, the longhands the document stores written back as `padding: 10px 20px`, and every class
27
+ something names as a `styles()` declaration held in a variable. `split: true` writes one file per page and per layout.
28
+ `compareSpaces(expected, actual)` proves the round trip: it lists every way two pairs render differently — the tree,
29
+ the attributes, the rules that apply to each element whatever its selector is called, bindings, flows, pages, layouts
30
+ and settings — and nothing else. A selector used by one element becomes that element's own `css`; one shared, or
31
+ spelled out anywhere in the document (a `customCss` rule, a template), stays a class under its own name; an element id
32
+ nothing refers to is left out and derived again.
33
+
34
+ What an older builder left behind is repaired on the way, and every repair is reported in `corrections` rather than
35
+ made silently: element types that no longer exist (`navbar` → a `list` laid out in a row, `navbarItem` → `listItem`),
36
+ a hover stored as a class of its own (`card:hover`) folded into the class, fields and attributes no component reads,
37
+ a setting nothing reads, a link `target` of `_blank` (the component adds the underscore, so it rendered as `__blank`),
38
+ `null` or an empty list where an attribute is unset, a binding to a source nothing publishes, a flow with a step that
39
+ runs nothing, and a global callback registered on the wrong module. A CSS property the style editor cannot hold is
40
+ kept in `customCss` under the same selector, so the page still renders it.
41
+
42
+ - **What a spec can say grew to what a document holds.** A selector carries its states and variants beside its rules —
43
+ `styles('card', { css, states: { hover }, variants: { active } })`, and `states` on an element's own `css` — and the
44
+ selector cache is now written by `processSelector`, the function the style editor writes it with. An element type's
45
+ defaults (`elements`) take states, variants, per-breakpoint rules and `slots` for its other selectors (a modal's
46
+ `rootContainer`). A space declares `layouts` — shells that pages render inside, named by `layout: { id, slot }` on a
47
+ page or on another layout, with the slot checked to be inside the shell — and a page takes `keepState` and
48
+ `stateStorage`. `visible: false` starts an element hidden for a flow to reveal, and `loadStrategy` is carried through.
49
+ An element's own selector never takes the name of a declared class any more, however that class happens to be called.
50
+
51
+ - `elementAttributeNames` lists, as data, the attributes each built-in element can be authored with — `null` for one
52
+ that takes any. It is generated from the elements' attribute types (`yarn generate:attribute-names`) and a type test
53
+ fails when the two disagree. `defaultAttributes(type)` and `defaultLabel(type)` expose what a factory fills in.
54
+
55
+ - `CustomAttributes` accepts any attribute, because the component a custom element's `renderType` names reads its own
56
+ attributes off it; and `FormControlAttributes` declares `previewError`, which `withFieldValue` reads.
57
+
3
58
  ## 0.36.2
4
59
 
5
60
  ### Patch Changes
package/dist/index.mjs CHANGED
@@ -39,28 +39,29 @@ import { fontLinkAssets as ye } from "./style/fontAssets.mjs";
39
39
  import { SYSTEM_FONTS as be, availableFonts as xe, familiesInCss as Se, fontFamilyStack as Ce, fontUrlResolver as we, fontsToHead as Te, googleCss2Url as Ee, googleTextSubsetUrl as De, isSafeFontUrl as Oe, primaryFamily as ke } from "./style/fonts.mjs";
40
40
  import { FontValidationError as Ae, parseSpaceFont as je } from "./style/fontValidation.mjs";
41
41
  import { fallbackForFamily as Me, fontsFromCss as Ne } from "./style/fontsFromCss.mjs";
42
- import Pe from "./schema/SchemaContext.mjs";
43
- import { EMPTY_SCHEMA as Fe, VARIABLE_REGEX as Ie } from "./schema/schemaConstants.mjs";
44
- import { findLayoutCycle as Le, resolveLayoutChain as Re } from "./schema/layoutChain.mjs";
45
- import { collectServerElements as ze, hasServerElements as Be } from "./schema/serverElements.mjs";
46
- import Ve from "./network/NetworkContext.mjs";
47
- import He from "./network/NetworkInternalContext.mjs";
48
- import { SpaceEvents as Ue, spaceEventSchemas as We, validateSpaceEvent as Ge } from "./network/spaceEvents.mjs";
49
- import Ke from "./network/graphql/builder/Mutations/index.mjs";
50
- import qe from "./network/graphql/builder/Queries/index.mjs";
51
- import Je from "./network/graphql/builder/Subscriptions/index.mjs";
52
- import Ye from "./network/graphql/sdk/Mutations/index.mjs";
53
- import Xe from "./network/graphql/sdk/Queries/index.mjs";
54
- import Ze from "./segments/SegmentsContext.mjs";
55
- import Qe, { RTEvent as $e, RTEventCloseCode as et, getInstance as tt, isRTEvent as nt, setInstance as rt } from "./websockets/RTCodec.mjs";
56
- import { THEME_CLASSES as it, THEME_COOKIE_NAME as at, applyThemeClass as ot, isTheme as st, readThemeCookie as ct, themeFromCookies as lt, writeThemeCookie as ut } from "./theme/themeCookie.mjs";
57
- import dt, { createThemeState as ft, createThemeStore as pt, resolveScheme as mt, setAreaTheme as ht, setMachineScheme as gt, setThemeMode as _t, themeFor as vt } from "./theme/themeStore.mjs";
58
- import { useThemeStore as yt } from "./theme/ThemeScope.mjs";
59
- import bt from "./theme/ThemeProvider.mjs";
60
- import xt, { SPACE_THEME_AREA as St } from "./theme/useTheme.mjs";
61
- import Ct from "./server/actions/useActionsSync.mjs";
62
- import wt, { currentRscLocation as Tt, rscDataPath as Et } from "./server/rsc/refreshRsc.mjs";
63
- import Dt from "./server/rsc/useRscRefresh.mjs";
64
- import Ot from "./server/rsc/useRscSync.mjs";
65
- import { runtimeStatePersist as kt } from "./state/runtimeStatePersist.mjs";
66
- export { d as BODYLESS_METHODS, l as BuilderContext, Ke as BuilderMutations, qe as BuilderQueries, f as CONNECTOR_HTTP_METHODS, oe as ComponentContext, p as DEFAULT_READ_ENDPOINT, ee as DevToolsContext, m as EMPTY_RESPONSE_METHODS, Fe as EMPTY_SCHEMA, he as EMPTY_STYLE_SCHEMA, Ae as FontValidationError, Ve as NetworkContext, He as NetworkInternalContext, I as ParamsFromURL, re as PlitziConsole, ue as PlitziServiceContext, de as PlitziServiceProvider, h as READ_ENDPOINT_NAMES, Qe as RTCodec, $e as RTEvent, et as RTEventCloseCode, St as SPACE_THEME_AREA, be as SYSTEM_FONTS, Pe as SchemaContext, Ye as SdkMutations, Xe as SdkQueries, Ze as SegmentsContext, Je as SpaceEventSubscription, Ue as SpaceEvents, ge as StyleBindingsAllowed, pe as StyleVariableCategory, it as THEME_CLASSES, at as THEME_COOKIE_NAME, bt as ThemeProvider, Ie as VARIABLE_REGEX, g as WRITE_ENDPOINT_NAMES, ot as applyThemeClass, e as authFailureFromResponse, xe as availableFonts, _e as baseDefaultValue, ze as collectServerElements, y as connectorPresets, _ as connectorTokens, u as contexts, i as createAuthFailureLink, ie as createStoreDevToolsLogger, K as createStripTypenameLink, ft as createThemeState, pt as createThemeStore, Tt as currentRscLocation, te as debugCookieName, L as delay, G as disableReactDevTools, b as emptyManifest, R as emptyObject, F as evaluateRuleGroup, Me as fallbackForFamily, Se as familiesInCss, S as fetchManifest, a as filters, Le as findLayoutCycle, Ce as fontFamilyStack, ye as fontLinkAssets, we as fontUrlResolver, Ne as fontsFromCss, Te as fontsToHead, T as formatDate, E as formatDateUTC, D as formatFromNow, O as formatUTCToLocal, C as generateFacade, X as getBindingsDetails, v as getConnectorTokens, z as getDisplayName, k as getDurationMs, tt as getInstance, B as getKeyDecoded, V as getPathsFromObeject, Z as getSourceName, Ee as googleCss2Url, De as googleTextSubsetUrl, Be as hasServerElements, s as hasValidToken, H as hexToRGB, ve as inheritableAttributesBase, A as isDate, U as isInViewport, ne as isInteractionFlow, nt as isRTEvent, Oe as isSafeFontUrl, st as isTheme, P as isUserEdit, j as isValidFormat, W as makeId, t as onAuthFailure, ae as pConsole, M as parseDate, je as parseSpaceFont, ke as primaryFamily, o as processTwig, ct as readThemeCookie, wt as refreshRsc, n as reportAuthFailure, Re as resolveLayoutChain, mt as resolveScheme, $ as resolveVariables, Et as rscDataPath, kt as runtimeStatePersist, r as sameRegistrableDomain, ht as setAreaTheme, rt as setInstance, gt as setMachineScheme, _t as setThemeMode, We as spaceEventSchemas, q as stripTypenameDeep, me as styleConstants, w as syntaxHighlight, c as templateRootNames, vt as themeFor, lt as themeFromCookies, dt as themeStore, N as toUnixSeconds, Ct as useActionsSync, se as useFontHead, ce as useNetwork, le as usePlitziServiceContext, Q as useRegisterSource, Dt as useRscRefresh, Ot as useRscSync, fe as useStableValue, xt as useTheme, yt as useThemeStore, J as utility, Y as utilityOptions, x as validateConnectorManifest, Ge as validateSpaceEvent, ut as writeThemeCookie };
42
+ import { STYLE_STATES as Pe, STYLE_STATE_LABELS as Fe, inCascadeOrder as Ie, isKnownState as Le } from "./style/styleStates.mjs";
43
+ import Re from "./schema/SchemaContext.mjs";
44
+ import { EMPTY_SCHEMA as ze, VARIABLE_REGEX as Be } from "./schema/schemaConstants.mjs";
45
+ import { findLayoutCycle as Ve, resolveLayoutChain as He } from "./schema/layoutChain.mjs";
46
+ import { collectServerElements as Ue, hasServerElements as We } from "./schema/serverElements.mjs";
47
+ import Ge from "./network/NetworkContext.mjs";
48
+ import Ke from "./network/NetworkInternalContext.mjs";
49
+ import { SpaceEvents as qe, spaceEventSchemas as Je, validateSpaceEvent as Ye } from "./network/spaceEvents.mjs";
50
+ import Xe from "./network/graphql/builder/Mutations/index.mjs";
51
+ import Ze from "./network/graphql/builder/Queries/index.mjs";
52
+ import Qe from "./network/graphql/builder/Subscriptions/index.mjs";
53
+ import $e from "./network/graphql/sdk/Mutations/index.mjs";
54
+ import et from "./network/graphql/sdk/Queries/index.mjs";
55
+ import tt from "./segments/SegmentsContext.mjs";
56
+ import nt, { RTEvent as rt, RTEventCloseCode as it, getInstance as at, isRTEvent as ot, setInstance as st } from "./websockets/RTCodec.mjs";
57
+ import { THEME_CLASSES as ct, THEME_COOKIE_NAME as lt, applyThemeClass as ut, isTheme as dt, readThemeCookie as ft, themeFromCookies as pt, writeThemeCookie as mt } from "./theme/themeCookie.mjs";
58
+ import ht, { createThemeState as gt, createThemeStore as _t, resolveScheme as vt, setAreaTheme as yt, setMachineScheme as bt, setThemeMode as xt, themeFor as St } from "./theme/themeStore.mjs";
59
+ import { useThemeStore as Ct } from "./theme/ThemeScope.mjs";
60
+ import wt from "./theme/ThemeProvider.mjs";
61
+ import Tt, { SPACE_THEME_AREA as Et } from "./theme/useTheme.mjs";
62
+ import Dt from "./server/actions/useActionsSync.mjs";
63
+ import Ot, { currentRscLocation as kt, rscDataPath as At } from "./server/rsc/refreshRsc.mjs";
64
+ import jt from "./server/rsc/useRscRefresh.mjs";
65
+ import Mt from "./server/rsc/useRscSync.mjs";
66
+ import { runtimeStatePersist as Nt } from "./state/runtimeStatePersist.mjs";
67
+ export { d as BODYLESS_METHODS, l as BuilderContext, Xe as BuilderMutations, Ze as BuilderQueries, f as CONNECTOR_HTTP_METHODS, oe as ComponentContext, p as DEFAULT_READ_ENDPOINT, ee as DevToolsContext, m as EMPTY_RESPONSE_METHODS, ze as EMPTY_SCHEMA, he as EMPTY_STYLE_SCHEMA, Ae as FontValidationError, Ge as NetworkContext, Ke as NetworkInternalContext, I as ParamsFromURL, re as PlitziConsole, ue as PlitziServiceContext, de as PlitziServiceProvider, h as READ_ENDPOINT_NAMES, nt as RTCodec, rt as RTEvent, it as RTEventCloseCode, Et as SPACE_THEME_AREA, Pe as STYLE_STATES, Fe as STYLE_STATE_LABELS, be as SYSTEM_FONTS, Re as SchemaContext, $e as SdkMutations, et as SdkQueries, tt as SegmentsContext, Qe as SpaceEventSubscription, qe as SpaceEvents, ge as StyleBindingsAllowed, pe as StyleVariableCategory, ct as THEME_CLASSES, lt as THEME_COOKIE_NAME, wt as ThemeProvider, Be as VARIABLE_REGEX, g as WRITE_ENDPOINT_NAMES, ut as applyThemeClass, e as authFailureFromResponse, xe as availableFonts, _e as baseDefaultValue, Ue as collectServerElements, y as connectorPresets, _ as connectorTokens, u as contexts, i as createAuthFailureLink, ie as createStoreDevToolsLogger, K as createStripTypenameLink, gt as createThemeState, _t as createThemeStore, kt as currentRscLocation, te as debugCookieName, L as delay, G as disableReactDevTools, b as emptyManifest, R as emptyObject, F as evaluateRuleGroup, Me as fallbackForFamily, Se as familiesInCss, S as fetchManifest, a as filters, Ve as findLayoutCycle, Ce as fontFamilyStack, ye as fontLinkAssets, we as fontUrlResolver, Ne as fontsFromCss, Te as fontsToHead, T as formatDate, E as formatDateUTC, D as formatFromNow, O as formatUTCToLocal, C as generateFacade, X as getBindingsDetails, v as getConnectorTokens, z as getDisplayName, k as getDurationMs, at as getInstance, B as getKeyDecoded, V as getPathsFromObeject, Z as getSourceName, Ee as googleCss2Url, De as googleTextSubsetUrl, We as hasServerElements, s as hasValidToken, H as hexToRGB, Ie as inCascadeOrder, ve as inheritableAttributesBase, A as isDate, U as isInViewport, ne as isInteractionFlow, Le as isKnownState, ot as isRTEvent, Oe as isSafeFontUrl, dt as isTheme, P as isUserEdit, j as isValidFormat, W as makeId, t as onAuthFailure, ae as pConsole, M as parseDate, je as parseSpaceFont, ke as primaryFamily, o as processTwig, ft as readThemeCookie, Ot as refreshRsc, n as reportAuthFailure, He as resolveLayoutChain, vt as resolveScheme, $ as resolveVariables, At as rscDataPath, Nt as runtimeStatePersist, r as sameRegistrableDomain, yt as setAreaTheme, st as setInstance, bt as setMachineScheme, xt as setThemeMode, Je as spaceEventSchemas, q as stripTypenameDeep, me as styleConstants, w as syntaxHighlight, c as templateRootNames, St as themeFor, pt as themeFromCookies, ht as themeStore, N as toUnixSeconds, Dt as useActionsSync, se as useFontHead, ce as useNetwork, le as usePlitziServiceContext, Q as useRegisterSource, jt as useRscRefresh, Mt as useRscSync, fe as useStableValue, Tt as useTheme, Ct as useThemeStore, J as utility, Y as utilityOptions, x as validateConnectorManifest, Ye as validateSpaceEvent, mt as writeThemeCookie };
@@ -103,13 +103,16 @@ export declare const spaceEventSchemas: {
103
103
  styleSelector: z.ZodOptional<z.ZodString>;
104
104
  styleState: z.ZodOptional<z.ZodEnum<{
105
105
  hover: "hover";
106
- active: "active";
107
106
  focus: "focus";
107
+ "focus-visible": "focus-visible";
108
+ "focus-within": "focus-within";
109
+ active: "active";
108
110
  disabled: "disabled";
109
111
  checked: "checked";
110
112
  visited: "visited";
111
113
  }>>;
112
114
  styleVariant: z.ZodOptional<z.ZodString>;
115
+ styleAncestor: z.ZodOptional<z.ZodString>;
113
116
  }, z.core.$strip>;
114
117
  }, z.core.$strip>;
115
118
  readonly STYLE_UPDATE_SELECTOR: z.ZodObject<{
@@ -125,13 +128,16 @@ export declare const spaceEventSchemas: {
125
128
  componentType: z.ZodOptional<z.ZodString>;
126
129
  styleState: z.ZodOptional<z.ZodEnum<{
127
130
  hover: "hover";
128
- active: "active";
129
131
  focus: "focus";
132
+ "focus-visible": "focus-visible";
133
+ "focus-within": "focus-within";
134
+ active: "active";
130
135
  disabled: "disabled";
131
136
  checked: "checked";
132
137
  visited: "visited";
133
138
  }>>;
134
139
  styleVariant: z.ZodOptional<z.ZodString>;
140
+ styleAncestor: z.ZodOptional<z.ZodString>;
135
141
  styleSelector: z.ZodString;
136
142
  }, z.core.$strip>;
137
143
  }, z.core.$strip>;
@@ -292,13 +298,16 @@ export declare const spaceEventSchemas: {
292
298
  styleSelector: z.ZodOptional<z.ZodString>;
293
299
  styleState: z.ZodOptional<z.ZodEnum<{
294
300
  hover: "hover";
295
- active: "active";
296
301
  focus: "focus";
302
+ "focus-visible": "focus-visible";
303
+ "focus-within": "focus-within";
304
+ active: "active";
297
305
  disabled: "disabled";
298
306
  checked: "checked";
299
307
  visited: "visited";
300
308
  }>>;
301
309
  styleVariant: z.ZodOptional<z.ZodString>;
310
+ styleAncestor: z.ZodOptional<z.ZodString>;
302
311
  }, z.core.$strip>;
303
312
  contextId: z.ZodString;
304
313
  }, z.core.$strip>;
@@ -315,13 +324,16 @@ export declare const spaceEventSchemas: {
315
324
  componentType: z.ZodOptional<z.ZodString>;
316
325
  styleState: z.ZodOptional<z.ZodEnum<{
317
326
  hover: "hover";
318
- active: "active";
319
327
  focus: "focus";
328
+ "focus-visible": "focus-visible";
329
+ "focus-within": "focus-within";
330
+ active: "active";
320
331
  disabled: "disabled";
321
332
  checked: "checked";
322
333
  visited: "visited";
323
334
  }>>;
324
335
  styleVariant: z.ZodOptional<z.ZodString>;
336
+ styleAncestor: z.ZodOptional<z.ZodString>;
325
337
  styleSelector: z.ZodString;
326
338
  }, z.core.$strip>;
327
339
  contextId: z.ZodString;