@plitzi/sdk-authoring 0.37.0 → 0.37.2

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/dist/index.d.ts CHANGED
@@ -206,6 +206,29 @@ export declare type ActionTriggerSpec = (TriggerCommon & {
206
206
  timezone?: string;
207
207
  });
208
208
 
209
+ /**
210
+ * Marks a navigation entry as the current one on the pages it stands for.
211
+ *
212
+ * The page being shown is \`navigation.currentPageId\`, so an entry lights up when that is one of its pages — one
213
+ * binding, the same on every entry of a menu that lives in a layout, instead of a copy of the menu per page with the
214
+ * right entry styled by hand. Several ids for one entry: a section and the pages beneath it (\`['spaces',
215
+ * 'space-record']\`). Every other page wears \`idle\`, a name the class need not declare.
216
+ *
217
+ * \`\`\`ts
218
+ * const navLink = styles('nav-link', { css: { … }, variants: { active: { color: 'var(--accent)' } } });
219
+ * link({ href: 'docs-data', class: navLink, bind: [activeOn(navLink, 'docs-data')] });
220
+ * \`\`\`
221
+ */
222
+ export declare const activeOn: (cls: ClassRef, pages: string | readonly string[], options?: ActiveOnOptions) => BindingSpec;
223
+
224
+ /** What {@link activeOn} takes beyond the class and the pages. */
225
+ export declare interface ActiveOnOptions {
226
+ /** The variant worn on those pages. `active` unless the class calls it something else. */
227
+ variant?: string;
228
+ /** Which of the element's selectors wears the class, as in {@link variantFrom}. */
229
+ slot?: string;
230
+ }
231
+
209
232
  export declare const addNotification: (params: {
210
233
  content: string;
211
234
  placement?: "top-right" | "top-center" | "top-left" | "bottom-right" | "bottom-center" | "bottom-left";
@@ -310,6 +333,15 @@ declare type ApiContainerProps = {
310
333
  staleTime?: number | string;
311
334
  /** With `cache`: seconds an answer nobody renders is kept, so coming back within it paints at once. */
312
335
  gcTime?: number | string;
336
+ /**
337
+ * Asks again on its own every this many seconds — for a page showing something that keeps moving: a queue, a
338
+ * feed, a status board. Off (`0`) by default.
339
+ *
340
+ * The same refresh `performQuery` runs, for either runtime: a browser request is re-sent, a server provider
341
+ * asks the server for its own slice again. Skipped while the tab is hidden and never stacked on one still in
342
+ * flight. A text field in the builder, hence the string.
343
+ */
344
+ refreshSeconds?: number | string;
313
345
  };
314
346
 
315
347
  /**
@@ -490,6 +522,8 @@ export declare interface AuthoringProps {
490
522
  css?: CssSpec;
491
523
  /** How the element's own rules react — `hover`, `focus` — beside {@link AuthoringProps.css}. */
492
524
  states?: StatesSpec;
525
+ /** The name of the element's own selector; derived from where it sits when left out. */
526
+ selector?: string;
493
527
  /** Style variant of the element's own vocabulary, e.g. a heading's `title`. */
494
528
  variant?: string;
495
529
  /** A class for one of the element's other selectors — a form control's `input`, `label`, `error`. */
@@ -518,8 +552,10 @@ export declare interface AuthoringProps {
518
552
  * Deliberately shadows the one re-exported above — an explicit export wins over a star — so that everybody who
519
553
  * imports from this package gets both checks that need to know what this SDK ships.
520
554
  *
521
- * **Flows.** A step naming a callback on the wrong module is refused; one naming an action no built-in source
522
- * declares comes back in `warnings`, since a plugin is free to register a module this process cannot see.
555
+ * **Flows.** A step naming a callback on the wrong module is refused, and so is a flow starting on a trigger its
556
+ * built-in element never fires, or an element callback aimed at a built-in element that does not answer to it; one
557
+ * naming an action no built-in source declares comes back in `warnings`, since a plugin is free to register a
558
+ * module this process cannot see.
523
559
  *
524
560
  * **Bindings.** A source may name the element alone and the prefix it publishes under is filled in — which
525
561
  * is the half an author cannot see, and is not always the element's own type.
@@ -537,6 +573,18 @@ export declare interface AuthorSpaceOptions {
537
573
  * prefix that does not match the element it names goes unnoticed.
538
574
  */
539
575
  sourceTypes?: SourceTypes;
576
+ /**
577
+ * Element type → its other style selectors (a modal's `rootContainer`). Every element carries a class for each, so a
578
+ * per-type `slots` style reaches all of them; left out, only the slots an element styles itself are addressable.
579
+ */
580
+ slotNames?: Record<string, readonly string[]>;
581
+ /** Element type → the type it only works inside. Left out, a sub-element is placed wherever it is written. */
582
+ ancestorTypes?: Record<string, string>;
583
+ /**
584
+ * Element type → the attributes its component reads, `null` for one that reads any. Left out, an attribute
585
+ * nothing reads is written without a word.
586
+ */
587
+ attributeNames?: Readonly<Record<string, readonly string[] | null>>;
540
588
  }
541
589
 
542
590
  /**
@@ -647,7 +695,7 @@ declare type BlockJsxProps = {
647
695
  /** The breakpoints a rule set can be written for, widest first — the order they cascade in. */
648
696
  export declare const BREAKPOINTS: DisplayMode[];
649
697
 
650
- export declare const buildHandles: (pages: Record<string, PageHandle>) => SpaceHandles;
698
+ export declare const buildHandles: (pages: Record<string, PageHandle>, layouts?: Record<string, LayoutHandle>) => SpaceHandles;
651
699
 
652
700
  export declare const BUILTIN_ELEMENT_CALLBACKS: Record<string, BuiltinElementCallback>;
653
701
 
@@ -783,6 +831,12 @@ export declare const clearState: (params?: {
783
831
  key?: string;
784
832
  }) => StepSpec;
785
833
 
834
+ /** Closes a `dialogContainer`, by id. */
835
+ export declare const closeDialog: (target: string) => StepSpec;
836
+
837
+ /** Closes a `modalContainer`, by id — from a button inside it or anywhere else. */
838
+ export declare const closeModal: (target: string) => StepSpec;
839
+
786
840
  /**
787
841
  * The answer, once `system` has been put to the machine: what is actually on screen.
788
842
  *
@@ -1013,7 +1067,10 @@ declare type Element_2<TAttributes extends Record<string, unknown> = Record<stri
1013
1067
  * export drops without a word. `specFields.test.ts` refuses to compile until it is listed here — and once it is, it is
1014
1068
  * written like any other, so growing the authoring surface needs nothing more from the emitter than this line.
1015
1069
  */
1016
- export declare const ELEMENT_FIELDS: readonly ["type", "id", "attributes", "class", "css", "states", "variant", "slots", "bind", "visible", "flows", "runtime", "loadStrategy", "meta", "children"];
1070
+ export declare const ELEMENT_FIELDS: readonly ["type", "id", "attributes", "class", "css", "states", "selector", "variant", "slots", "bind", "visible", "flows", "runtime", "loadStrategy", "meta", "children"];
1071
+
1072
+ /** The sub-elements that only work inside another type, and that type — see `ElementDeclarationData.ancestorType`. */
1073
+ export declare const elementAncestorTypes: Record<string, string>;
1017
1074
 
1018
1075
  /**
1019
1076
  * The attributes each built-in element can be authored with, by type — `null` for an element that takes any.
@@ -1022,7 +1079,7 @@ export declare const ELEMENT_FIELDS: readonly ["type", "id", "attributes", "clas
1022
1079
  * a builder that has since moved on, and nothing renders it.
1023
1080
  */
1024
1081
  export declare const elementAttributeNames: {
1025
- readonly apiContainer: readonly ["accessToken", "action", "cache", "connector", "credentials", "endpoint", "filters", "gcTime", "headers", "input", "limit", "method", "mockData", "pageParam", "pagination", "query", "renderWhileLoading", "resource", "singleRecord", "staleTime", "subType", "when"];
1082
+ readonly apiContainer: readonly ["accessToken", "action", "cache", "connector", "credentials", "endpoint", "filters", "gcTime", "headers", "input", "limit", "method", "mockData", "pageParam", "pagination", "query", "refreshSeconds", "renderWhileLoading", "resource", "singleRecord", "staleTime", "subType", "when"];
1026
1083
  readonly blockHtml: readonly ["content"];
1027
1084
  readonly blockJsx: readonly ["allowEmptyRender", "content", "contentCache", "props"];
1028
1085
  readonly button: readonly ["ariaExpanded", "ariaPressed", "content", "contentPlacement", "disabled", "subType", "title"];
@@ -1085,6 +1142,15 @@ declare type ElementBinding = {
1085
1142
  to: string;
1086
1143
  };
1087
1144
 
1145
+ /**
1146
+ * Every element callback each built-in type answers to: `setState` and `toggleState`, which every element registers,
1147
+ * and the ones its declaration adds.
1148
+ *
1149
+ * A callback runs on the element it names, so aiming it at one of the wrong type is the same silent dead end as a
1150
+ * trigger on the wrong element — the builder offers `openModal` only on a modal, and a hand-written step does not.
1151
+ */
1152
+ export declare const elementCallbacks: Record<string, string[]>;
1153
+
1088
1154
  /** Keyed by the schema `type`, which is what a document and every catalog address a type by. */
1089
1155
  export declare const elementCatalog: Record<string, ElementSemantics>;
1090
1156
 
@@ -1105,6 +1171,26 @@ export declare interface ElementDeclarationData {
1105
1171
  * reads it to resolve a binding that named the element alone.
1106
1172
  */
1107
1173
  sourceType?: string;
1174
+ /**
1175
+ * The triggers this type fires on top of the ones every element does (`onClick`, `onLoad`…), by action name.
1176
+ *
1177
+ * Declared here for the reason `sourceType` is: the component registers exactly these, and the authoring surface
1178
+ * reads them to refuse a flow that starts on a trigger its element never fires — an `onSubmit` on the submit
1179
+ * button rather than on the form is a flow that is written, saved and silently never runs.
1180
+ */
1181
+ triggers?: Record<string, InteractionCallback>;
1182
+ /**
1183
+ * The callbacks this type runs on itself on top of the ones every element does (`setState`, `toggleState`) —
1184
+ * their static half. The component adds what only a mounted element has: the function, a title naming its label,
1185
+ * options drawn from its children. Read by the authoring surface to refuse a step aimed at an element that does not
1186
+ * answer to it — an `openModal` sent to a plain container is a button that does nothing.
1187
+ */
1188
+ callbacks?: Record<string, InteractionCallback>;
1189
+ /**
1190
+ * The type this one only works somewhere inside: it reads its state from that element's context, and anywhere
1191
+ * else it throws on its first render. A dropdown's panel, a tab container's header and body.
1192
+ */
1193
+ ancestorType?: string;
1108
1194
  content?: {
1109
1195
  attributes?: Record<string, unknown>;
1110
1196
  definition?: {
@@ -1119,6 +1205,81 @@ declare const elementDeclarations: {
1119
1205
  readonly ApiContainer: {
1120
1206
  readonly type: "apiContainer";
1121
1207
  readonly sourceType: "apiContainer";
1208
+ readonly triggers: {
1209
+ readonly onApiError: {
1210
+ readonly action: "onApiError";
1211
+ readonly title: "On Api Error";
1212
+ readonly type: "trigger";
1213
+ readonly params: {};
1214
+ readonly preview: {
1215
+ readonly url: "";
1216
+ readonly method: "";
1217
+ readonly status: "";
1218
+ readonly data: "";
1219
+ };
1220
+ };
1221
+ readonly onApiSuccess: {
1222
+ readonly action: "onApiSuccess";
1223
+ readonly title: "On Api Success";
1224
+ readonly type: "trigger";
1225
+ readonly params: {};
1226
+ readonly preview: {
1227
+ readonly url: "";
1228
+ readonly method: "";
1229
+ readonly status: "";
1230
+ readonly data: "";
1231
+ };
1232
+ };
1233
+ };
1234
+ readonly callbacks: {
1235
+ readonly performQuery: {
1236
+ readonly action: "performQuery";
1237
+ readonly title: "Perform Query";
1238
+ readonly type: "callback";
1239
+ readonly preview: {};
1240
+ readonly params: {};
1241
+ };
1242
+ readonly loadMore: {
1243
+ readonly action: "loadMore";
1244
+ readonly title: "Load More";
1245
+ readonly type: "callback";
1246
+ readonly preview: {};
1247
+ readonly params: {};
1248
+ };
1249
+ readonly goToPage: {
1250
+ readonly action: "goToPage";
1251
+ readonly title: "Go To Page";
1252
+ readonly type: "callback";
1253
+ readonly preview: {};
1254
+ readonly params: {
1255
+ readonly page: {
1256
+ readonly label: "Page";
1257
+ readonly defaultValue: "1";
1258
+ readonly type: "text";
1259
+ };
1260
+ };
1261
+ };
1262
+ readonly writeRecord: {
1263
+ readonly action: "writeRecord";
1264
+ readonly title: "Write Record";
1265
+ readonly type: "callback";
1266
+ readonly preview: {
1267
+ readonly action: "create";
1268
+ };
1269
+ readonly params: {
1270
+ readonly action: {
1271
+ readonly label: "Endpoint";
1272
+ readonly defaultValue: "create";
1273
+ readonly type: "text";
1274
+ };
1275
+ readonly recordId: {
1276
+ readonly label: "Record Id";
1277
+ readonly defaultValue: "";
1278
+ readonly type: "text";
1279
+ };
1280
+ };
1281
+ };
1282
+ };
1122
1283
  readonly content: {
1123
1284
  readonly attributes: {
1124
1285
  readonly query: "";
@@ -1516,6 +1677,87 @@ declare const elementDeclarations: {
1516
1677
  readonly DialogContainer: {
1517
1678
  readonly type: "dialogContainer";
1518
1679
  readonly sourceType: "dialogContainer";
1680
+ readonly triggers: {
1681
+ readonly onDialogAccept: {
1682
+ readonly action: "onDialogAccept";
1683
+ readonly title: "On Dialog Accept";
1684
+ readonly type: "trigger";
1685
+ readonly params: {
1686
+ readonly metadata: {
1687
+ readonly type: "text";
1688
+ readonly defaultValue: "";
1689
+ };
1690
+ };
1691
+ readonly preview: {
1692
+ readonly metadata: "";
1693
+ };
1694
+ };
1695
+ readonly onDialogReject: {
1696
+ readonly action: "onDialogReject";
1697
+ readonly title: "On Dialog Reject";
1698
+ readonly type: "trigger";
1699
+ readonly params: {
1700
+ readonly metadata: {
1701
+ readonly type: "text";
1702
+ readonly defaultValue: "";
1703
+ };
1704
+ };
1705
+ readonly preview: {
1706
+ readonly metadata: "";
1707
+ };
1708
+ };
1709
+ readonly onDialogOpen: {
1710
+ readonly action: "onDialogOpen";
1711
+ readonly title: "On Dialog Open";
1712
+ readonly type: "trigger";
1713
+ readonly params: {
1714
+ readonly metadata: {
1715
+ readonly type: "text";
1716
+ readonly defaultValue: "";
1717
+ };
1718
+ };
1719
+ readonly preview: {
1720
+ readonly metadata: "";
1721
+ };
1722
+ };
1723
+ readonly onDialogClose: {
1724
+ readonly action: "onDialogClose";
1725
+ readonly title: "On Dialog Close";
1726
+ readonly type: "trigger";
1727
+ readonly params: {
1728
+ readonly metadata: {
1729
+ readonly type: "text";
1730
+ readonly defaultValue: "";
1731
+ };
1732
+ };
1733
+ readonly preview: {
1734
+ readonly metadata: "";
1735
+ };
1736
+ };
1737
+ };
1738
+ readonly callbacks: {
1739
+ readonly openDialog: {
1740
+ readonly action: "openDialog";
1741
+ readonly title: "Open Dialog";
1742
+ readonly type: "callback";
1743
+ readonly params: {
1744
+ readonly metadata: {
1745
+ readonly type: "text";
1746
+ readonly defaultValue: "";
1747
+ };
1748
+ };
1749
+ readonly preview: {
1750
+ readonly metadata: "";
1751
+ };
1752
+ };
1753
+ readonly closeDialog: {
1754
+ readonly action: "closeDialog";
1755
+ readonly title: "Close Dialog";
1756
+ readonly type: "callback";
1757
+ readonly preview: {};
1758
+ readonly params: {};
1759
+ };
1760
+ };
1519
1761
  readonly content: {
1520
1762
  readonly attributes: {
1521
1763
  readonly headerLabel: "Dialog Header";
@@ -1597,7 +1839,7 @@ declare const elementDeclarations: {
1597
1839
  readonly left: "50%";
1598
1840
  readonly width: "500px";
1599
1841
  readonly height: "300px";
1600
- readonly 'background-color': "white";
1842
+ readonly 'background-color': "light-dark(white, oklch(0.21 0.006 285.885))";
1601
1843
  readonly transform: "translate3d(-50%, -50%, 0px)";
1602
1844
  readonly 'padding-top': "20px";
1603
1845
  readonly 'padding-bottom': "20px";
@@ -1746,6 +1988,7 @@ declare const elementDeclarations: {
1746
1988
  }>>;
1747
1989
  readonly DropdownPopup: {
1748
1990
  readonly type: "dropdownPopup";
1991
+ readonly ancestorType: "dropdown";
1749
1992
  readonly content: {
1750
1993
  readonly attributes: {};
1751
1994
  readonly definition: {
@@ -1783,7 +2026,7 @@ declare const elementDeclarations: {
1783
2026
  readonly style: {
1784
2027
  readonly base: {
1785
2028
  readonly default: {
1786
- readonly 'background-color': "white";
2029
+ readonly 'background-color': "light-dark(white, oklch(0.21 0.006 285.885))";
1787
2030
  readonly 'padding-right': "4px";
1788
2031
  readonly 'padding-bottom': "4px";
1789
2032
  readonly 'padding-left': "4px";
@@ -1866,6 +2109,63 @@ declare const elementDeclarations: {
1866
2109
  readonly Form: {
1867
2110
  readonly type: "form";
1868
2111
  readonly sourceType: "apiContainer";
2112
+ readonly triggers: {
2113
+ readonly onSubmit: {
2114
+ readonly action: "onSubmit";
2115
+ readonly title: "On Form Submit";
2116
+ readonly type: "trigger";
2117
+ readonly params: {};
2118
+ readonly preview: {
2119
+ readonly values: {};
2120
+ readonly actionUrl: "";
2121
+ readonly method: "";
2122
+ };
2123
+ };
2124
+ };
2125
+ readonly callbacks: {
2126
+ readonly performReset: {
2127
+ readonly action: "performReset";
2128
+ readonly title: "Reset Form";
2129
+ readonly type: "callback";
2130
+ readonly params: {};
2131
+ };
2132
+ readonly setFieldValue: {
2133
+ readonly action: "setFieldValue";
2134
+ readonly title: "Set Field Value";
2135
+ readonly type: "callback";
2136
+ readonly preview: {};
2137
+ readonly params: {
2138
+ readonly name: {
2139
+ readonly label: "Field Name";
2140
+ readonly defaultValue: undefined;
2141
+ readonly type: "select";
2142
+ readonly options: [];
2143
+ };
2144
+ readonly value: {
2145
+ readonly type: "text";
2146
+ readonly defaultValue: "";
2147
+ };
2148
+ };
2149
+ };
2150
+ readonly setFieldError: {
2151
+ readonly action: "setFieldError";
2152
+ readonly title: "Set Field Error";
2153
+ readonly type: "callback";
2154
+ readonly preview: {};
2155
+ readonly params: {
2156
+ readonly name: {
2157
+ readonly label: "Field Name";
2158
+ readonly defaultValue: undefined;
2159
+ readonly type: "select";
2160
+ readonly options: [];
2161
+ };
2162
+ readonly error: {
2163
+ readonly type: "text";
2164
+ readonly defaultValue: "";
2165
+ };
2166
+ };
2167
+ };
2168
+ };
1869
2169
  readonly content: {
1870
2170
  readonly attributes: {
1871
2171
  readonly method: "get";
@@ -1926,6 +2226,18 @@ declare const elementDeclarations: {
1926
2226
  }>>;
1927
2227
  readonly FormControl: {
1928
2228
  readonly type: "formControl";
2229
+ readonly triggers: {
2230
+ readonly onChange: {
2231
+ readonly action: "onChange";
2232
+ readonly title: "On Change";
2233
+ readonly type: "trigger";
2234
+ readonly params: {};
2235
+ readonly preview: {
2236
+ readonly value: "";
2237
+ readonly name: "";
2238
+ };
2239
+ };
2240
+ };
1929
2241
  readonly content: {
1930
2242
  readonly attributes: {
1931
2243
  readonly subType: "text";
@@ -2971,6 +3283,52 @@ declare const elementDeclarations: {
2971
3283
  readonly ModalContainer: {
2972
3284
  readonly type: "modalContainer";
2973
3285
  readonly sourceType: "modalContainer";
3286
+ readonly triggers: {
3287
+ readonly onModalOpen: {
3288
+ readonly action: "onModalOpen";
3289
+ readonly title: "On Modal Open";
3290
+ readonly type: "trigger";
3291
+ readonly params: {
3292
+ readonly metadata: {
3293
+ readonly type: "text";
3294
+ readonly defaultValue: "";
3295
+ };
3296
+ };
3297
+ readonly preview: {
3298
+ readonly metadata: "";
3299
+ };
3300
+ };
3301
+ readonly onModalClose: {
3302
+ readonly action: "onModalClose";
3303
+ readonly title: "On Modal Close";
3304
+ readonly type: "trigger";
3305
+ readonly preview: {};
3306
+ readonly params: {};
3307
+ };
3308
+ };
3309
+ readonly callbacks: {
3310
+ readonly openModal: {
3311
+ readonly action: "openModal";
3312
+ readonly title: "Open Modal";
3313
+ readonly type: "callback";
3314
+ readonly params: {
3315
+ readonly metadata: {
3316
+ readonly type: "text";
3317
+ readonly defaultValue: "";
3318
+ };
3319
+ };
3320
+ readonly preview: {
3321
+ readonly metadata: "";
3322
+ };
3323
+ };
3324
+ readonly closeModal: {
3325
+ readonly action: "closeModal";
3326
+ readonly title: "Close Modal";
3327
+ readonly type: "callback";
3328
+ readonly params: {};
3329
+ readonly preview: {};
3330
+ };
3331
+ };
2974
3332
  readonly content: {
2975
3333
  readonly attributes: {
2976
3334
  readonly title: "Modal Header";
@@ -3047,7 +3405,7 @@ declare const elementDeclarations: {
3047
3405
  readonly left: "50%";
3048
3406
  readonly width: "500px";
3049
3407
  readonly height: "300px";
3050
- readonly 'background-color': "white";
3408
+ readonly 'background-color': "light-dark(white, oklch(0.21 0.006 285.885))";
3051
3409
  readonly transform: "translate3d(-50%, -50%, 0px)";
3052
3410
  readonly 'border-top-left-radius': "8px";
3053
3411
  readonly 'border-top-right-radius': "8px";
@@ -3061,7 +3419,7 @@ declare const elementDeclarations: {
3061
3419
  readonly 'align-items': "center";
3062
3420
  readonly 'justify-content': "space-between";
3063
3421
  readonly 'border-bottom-width': "1px";
3064
- readonly 'border-bottom-color': "#d1d5db";
3422
+ readonly 'border-bottom-color': "light-dark(#d1d5db, oklch(0.37 0.013 285.805))";
3065
3423
  readonly 'border-bottom-style': "solid";
3066
3424
  readonly 'padding-left': "20px";
3067
3425
  readonly 'padding-right': "20px";
@@ -3498,6 +3856,19 @@ declare const elementDeclarations: {
3498
3856
  } & ElementAttributesBrand<unknown>;
3499
3857
  readonly Page: {
3500
3858
  readonly type: "page";
3859
+ readonly triggers: {
3860
+ readonly onPageLoad: {
3861
+ readonly action: "onPageLoad";
3862
+ readonly title: "On Page Load";
3863
+ readonly type: "trigger";
3864
+ readonly params: {};
3865
+ readonly preview: {
3866
+ readonly pageId: "";
3867
+ readonly routeParams: "";
3868
+ readonly queryParams: "";
3869
+ };
3870
+ };
3871
+ };
3501
3872
  readonly content: {
3502
3873
  readonly attributes: {
3503
3874
  readonly enabled: true;
@@ -3573,6 +3944,17 @@ declare const elementDeclarations: {
3573
3944
  }>>;
3574
3945
  readonly Pagination: {
3575
3946
  readonly type: "pagination";
3947
+ readonly triggers: {
3948
+ readonly onPageChange: {
3949
+ readonly action: "onPageChange";
3950
+ readonly title: "On Page Change";
3951
+ readonly type: "trigger";
3952
+ readonly params: {};
3953
+ readonly preview: {
3954
+ readonly page: "1";
3955
+ };
3956
+ };
3957
+ };
3576
3958
  readonly content: {
3577
3959
  readonly attributes: {
3578
3960
  readonly pageInfo: {};
@@ -3857,6 +4239,7 @@ declare const elementDeclarations: {
3857
4239
  } & ElementAttributesBrand<unknown>;
3858
4240
  readonly TabContainerBody: {
3859
4241
  readonly type: "tabContainerBody";
4242
+ readonly ancestorType: "tabContainer";
3860
4243
  readonly content: {
3861
4244
  readonly attributes: {};
3862
4245
  readonly definition: {
@@ -3906,6 +4289,7 @@ declare const elementDeclarations: {
3906
4289
  } & ElementAttributesBrand<unknown>;
3907
4290
  readonly TabContainerHeader: {
3908
4291
  readonly type: "tabContainerHeader";
4292
+ readonly ancestorType: "tabContainer";
3909
4293
  readonly content: {
3910
4294
  readonly attributes: {};
3911
4295
  readonly definition: {
@@ -4057,6 +4441,17 @@ declare const elementDeclarations: {
4057
4441
  }>>;
4058
4442
  readonly ThemeToggle: {
4059
4443
  readonly type: "themeToggle";
4444
+ readonly triggers: {
4445
+ readonly onThemeChange: {
4446
+ readonly action: "onThemeChange";
4447
+ readonly title: "On Theme Change";
4448
+ readonly type: "trigger";
4449
+ readonly params: {};
4450
+ readonly preview: {
4451
+ readonly theme: "dark";
4452
+ };
4453
+ };
4454
+ };
4060
4455
  readonly content: {
4061
4456
  readonly attributes: {
4062
4457
  readonly subType: "switch";
@@ -4068,7 +4463,7 @@ declare const elementDeclarations: {
4068
4463
  readonly definition: {
4069
4464
  readonly label: "Theme Toggle";
4070
4465
  readonly type: "themeToggle";
4071
- readonly description: "Lets a visitor choose light or dark. It writes the choice on the document root, where a space stylesheet is already looking for it, and remembers it — so the machine decides until somebody says otherwise. It ships no colours of its own: style it with the space own classes, and use `data-theme-icon` to decide which icon each scheme shows.";
4466
+ readonly description: "Lets a visitor choose light or dark. It writes the choice on the document root, where a space stylesheet is already looking for it, and remembers it — so the machine decides until somebody says otherwise. It ships no colours of its own: style it with the space own classes. It shows the icon of the scheme in use by default; key a rule off `data-theme-icon` to change that.";
4072
4467
  readonly items: readonly [];
4073
4468
  readonly bindings: {};
4074
4469
  readonly styleSelectors: {
@@ -4234,7 +4629,10 @@ export declare interface ElementHandle {
4234
4629
  /** The one name this element answers to: its key in the document, and what `data-plitzi-el` carries. */
4235
4630
  id: string;
4236
4631
  type: string;
4237
- /** The page it lives on, by that page's id. */
4632
+ /**
4633
+ * The root it lives on, by id: its page — or, for an element of a layout shell, that layout, since it renders on
4634
+ * every page that names the layout rather than on one of them.
4635
+ */
4238
4636
  pageId: string;
4239
4637
  /** A CSS selector matching exactly this element in a rendered page. */
4240
4638
  selector: string;
@@ -4333,6 +4731,15 @@ export declare interface ElementSemantics {
4333
4731
  */
4334
4732
  export declare const elementsFromManifest: <A extends Record<string, object> = Record<string, Record<string, unknown>>>(manifest: PluginManifest) => { [Type in keyof A]: ElementFactory<A[Type]>; };
4335
4733
 
4734
+ /**
4735
+ * The OTHER selectors each type dresses — a modal's `rootContainer`, a form control's `input` — by type.
4736
+ *
4737
+ * Every element carries a class per slot (`plitzi__<type>-<slot>`), and that is what a space's per-type `slots` style
4738
+ * addresses. A document that names only the slots its author styled leaves the rest of them classless, so the style
4739
+ * the space wrote for the TYPE reaches some of its elements and not others — which is a themed modal beside a white one.
4740
+ */
4741
+ export declare const elementSlots: Record<string, string[]>;
4742
+
4336
4743
  /**
4337
4744
  * Which types publish a data source, and under what name.
4338
4745
  *
@@ -4358,13 +4765,26 @@ export declare interface ElementSpec {
4358
4765
  */
4359
4766
  id?: string;
4360
4767
  attributes?: Record<string, unknown>;
4361
- /** Style variant of the element's own vocabulary, e.g. a heading's `title`. */
4768
+ /**
4769
+ * A style variant the element starts in, e.g. a heading's `title`.
4770
+ *
4771
+ * The element TYPE's vocabulary by default. When the element wears a class that declares a variant of this name and
4772
+ * the type declares none, it is that CLASS's variant — `text({ class: avatar, variant: 'violet' })` wears
4773
+ * `avatar--violet`. Keyed by the type instead, it named a selector the element does not wear and rendered plain.
4774
+ * For a variant that follows the data, bind it with `variantFrom`.
4775
+ */
4362
4776
  variant?: string;
4363
4777
  /**
4364
4778
  * A rule set of this element's own. Shorthands are expanded and every property is checked before it is written,
4365
4779
  * so what reaches the document is what the style editor can read back.
4366
4780
  */
4367
4781
  css?: CssSpec;
4782
+ /**
4783
+ * The name of this element's own selector — the one {@link ElementSpec.css} writes to. Left out, it is derived from
4784
+ * where the element sits; given, it is kept exactly, which is how a space read back from the builder keeps the
4785
+ * names its style editor, its `customCss` and anything outside the document already know it by.
4786
+ */
4787
+ selector?: string;
4368
4788
  /**
4369
4789
  * How this element's own selector reacts — `hover`, `focus`, `active` — beside {@link ElementSpec.css}. A state
4370
4790
  * is part of the element's selector, not a second one, so it is refused alongside a shared `class` for the same
@@ -4444,6 +4864,15 @@ export declare interface ElementStyleSpec {
4444
4864
  */
4445
4865
  export declare type ElementTriggerName = keyof typeof interactionBasicTriggers;
4446
4866
 
4867
+ /**
4868
+ * Every trigger each built-in type fires: the ones all elements share, and the ones its declaration adds.
4869
+ *
4870
+ * What lets a flow on the wrong element be refused instead of written. The trigger names an event, and only the
4871
+ * element that fires it ever starts the flow — an `onSubmit` on a form's submit button is saved, looks right beside
4872
+ * the form, and never runs, which is how a working form reads as "forms do not work outside the builder".
4873
+ */
4874
+ export declare const elementTriggers: Record<string, string[]>;
4875
+
4447
4876
  /** Every built-in element type, by the name a document stores — `heading`, `apiContainer`, `formControl`. */
4448
4877
  export declare type ElementTypeName = keyof DeclarationByType;
4449
4878
 
@@ -4619,6 +5048,9 @@ export declare const grid: (columns: string, gap: string, extra?: CssProps) => S
4619
5048
 
4620
5049
  export declare const groupBindings: (path: string, bind: BindingsSpec, sources?: SourceIndex, where?: string) => Partial<Record<BindingCategory, ElementBinding[]>>;
4621
5050
 
5051
+ /** Whether any of these bindings decides the element's visibility — which makes it a condition, authored hidden. */
5052
+ export declare const hasVisibilityBinding: (bindings: BindingSpec[] | undefined) => boolean;
5053
+
4622
5054
  export declare const heading: ElementFactory<Partial<{
4623
5055
  content?: string | undefined;
4624
5056
  subType?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | undefined;
@@ -4823,6 +5255,12 @@ export declare const isRuleSetSpec: (spec: StyleSpec) => spec is RuleSetSpec;
4823
5255
  */
4824
5256
  export declare const isStyleDeclaration: (value: StyleSpec | StyleDeclaration) => value is StyleDeclaration;
4825
5257
 
5258
+ /** A layout shell: what pages render inside, so its elements are on screen wherever a page names it. */
5259
+ export declare interface LayoutHandle extends ElementHandle {
5260
+ /** Everything in the shell, by id — the header and the navigation a test reaches for on any page. */
5261
+ elements: Record<string, ElementHandle>;
5262
+ }
5263
+
4826
5264
  /**
4827
5265
  * Which layout a page — or another layout — renders inside, and where in it.
4828
5266
  *
@@ -4856,6 +5294,8 @@ export declare interface LayoutSpec {
4856
5294
  attributes?: Record<string, unknown>;
4857
5295
  css?: CssSpec;
4858
5296
  states?: StatesSpec;
5297
+ /** As {@link ElementSpec.selector}. */
5298
+ selector?: string;
4859
5299
  class?: ClassList;
4860
5300
  bind?: BindingsSpec;
4861
5301
  flows?: StepSpec[][];
@@ -5252,13 +5692,6 @@ export declare const nodeHtml: ElementFactory<Partial<{
5252
5692
  subType?: "span" | undefined;
5253
5693
  }>>;
5254
5694
 
5255
- /**
5256
- * `on('onClick')`, and the same for every other trigger.
5257
- *
5258
- * The basic set every element registers is named and autocompletes; any other string is accepted because a TYPE
5259
- * may publish triggers of its own — a form's `onSubmit`, a provider's page change — and refusing those would make
5260
- * the builders useless for exactly the flows that matter most.
5261
- */
5262
5695
  export declare const on: (trigger: ElementTriggerName | (string & {}), params?: Record<string, unknown>) => StepSpec;
5263
5696
 
5264
5697
  export declare const onClick: (params?: {
@@ -5277,6 +5710,15 @@ export declare const onFlowProgress: () => StepSpec;
5277
5710
 
5278
5711
  export declare const onLoad: () => StepSpec;
5279
5712
 
5713
+ /**
5714
+ * A page has this second load event in addition to {@link onLoad}.
5715
+ *
5716
+ * `onLoad` runs for every mounted element, including a page. `onPageLoad` belongs only to the page and carries its
5717
+ * id plus the current route and query params, so it is the one to use when a flow needs to make a decision from the
5718
+ * address that brought the visitor here.
5719
+ */
5720
+ export declare const onPageLoad: () => StepSpec;
5721
+
5280
5722
  /**
5281
5723
  * A form submitting itself, with the values keyed by each control's `name`.
5282
5724
  *
@@ -5286,6 +5728,18 @@ export declare const onLoad: () => StepSpec;
5286
5728
  */
5287
5729
  export declare const onSubmit: () => StepSpec;
5288
5730
 
5731
+ /** Opens a `dialogContainer`, by id, the way {@link openModal} opens a modal — it starts open too. */
5732
+ export declare const openDialog: (target: string, metadata?: string) => StepSpec;
5733
+
5734
+ /**
5735
+ * Opens a `modalContainer`, by id.
5736
+ *
5737
+ * A modal starts OPEN: declare it `visible: false` — its starting state, not a condition — and open it with this.
5738
+ * `metadata` travels into the modal, which publishes it as its source, so the content can read what opened it
5739
+ * (`{{ modalContainer_<id>.content }}` for a plain value). An element callback, so `target` is the MODAL's id.
5740
+ */
5741
+ export declare const openModal: (target: string, metadata?: string) => StepSpec;
5742
+
5289
5743
  declare type Operator = '' | '=' | '!=' | '<' | '>' | '<=' | '>=' | 'contains' | 'doesNotContain' | 'beginsWith' | 'doesNotBeginWith' | 'endsWith' | 'doesNotEndWith' | 'empty' | 'notEmpty' | 'in' | 'notIn' | 'between' | 'notBetween';
5290
5744
 
5291
5745
  declare type PageFolder = {
@@ -5365,6 +5819,8 @@ export declare interface PageSpec {
5365
5819
  keepState?: boolean;
5366
5820
  stateStorage?: Schema['settings']['stateStorage'];
5367
5821
  css?: CssSpec;
5822
+ /** As {@link ElementSpec.selector}. */
5823
+ selector?: string;
5368
5824
  /** As {@link ElementSpec.class} — a shared class instead of a selector of this page's own. */
5369
5825
  class?: ClassList;
5370
5826
  flows?: StepSpec[][];
@@ -5843,7 +6299,9 @@ declare type SpaceFont = SystemFont | GoogleFont | RemoteFont | HostedFont;
5843
6299
  export declare interface SpaceHandles {
5844
6300
  /** The pages, by id. */
5845
6301
  pages: Record<string, PageHandle>;
5846
- /** Every element of every page, by id — ids are unique across the whole document. */
6302
+ /** The layout shells, by id. */
6303
+ layouts: Record<string, LayoutHandle>;
6304
+ /** Every element of every page and every layout, by id — ids are unique across the whole document. */
5847
6305
  elements: Record<string, ElementHandle>;
5848
6306
  /**
5849
6307
  * One element, by id, or a throw naming what does exist.
@@ -5925,7 +6383,7 @@ export declare interface SpecCorrection {
5925
6383
  * Rather than refusing them, what can be repaired is repaired and every repair is reported in `corrections`, so a
5926
6384
  * person can read what changed. Nothing is changed silently, and nothing that renders is dropped.
5927
6385
  */
5928
- export declare type SpecCorrectionCode = 'legacy-element-type' | 'unknown-element-type' | 'dropped-field' | 'dropped-attribute' | 'fixed-attribute' | 'dropped-setting' | 'missing-element' | 'unreachable-element' | 'folded-state-selector' | 'dropped-selector' | 'unwritable-css' | 'folded-custom-css' | 'unknown-style-state' | 'broken-binding' | 'fixed-binding-source' | 'broken-flow' | 'fixed-global-callback' | 'dropped-initial-state' | 'missing-folder' | 'broken-layout';
6386
+ export declare type SpecCorrectionCode = 'legacy-element-type' | 'unknown-element-type' | 'dropped-field' | 'dropped-attribute' | 'fixed-attribute' | 'dropped-setting' | 'missing-element' | 'unreachable-element' | 'folded-state-selector' | 'dropped-selector' | 'unwritable-css' | 'folded-custom-css' | 'unknown-style-state' | 'broken-binding' | 'fixed-binding-source' | 'broken-flow' | 'dead-flow' | 'dead-step' | 'fixed-global-callback' | 'dropped-initial-state' | 'missing-folder' | 'broken-layout';
5929
6387
 
5930
6388
  export declare interface SpecFromSpace {
5931
6389
  spec: SpaceSpec;
@@ -6047,6 +6505,13 @@ export declare interface StepVocabulary {
6047
6505
  }>;
6048
6506
  /** Utility actions. A utility is resolved by action alone and runs on no module at all. */
6049
6507
  utilities: Record<string, unknown>;
6508
+ /**
6509
+ * Element type → every trigger it fires, the ones all elements share included. A type that is not listed is a
6510
+ * plugin's, whose triggers nobody here can know, and its flows are left alone.
6511
+ */
6512
+ triggers?: Record<string, readonly string[]>;
6513
+ /** Element type → every element callback it answers to, the shared `setState`/`toggleState` included. */
6514
+ callbacks?: Record<string, readonly string[]>;
6050
6515
  }
6051
6516
 
6052
6517
  declare type Style = {
@@ -6569,6 +7034,9 @@ export declare const twigTemplate: (params: {
6569
7034
  template: string;
6570
7035
  }) => StepSpec;
6571
7036
 
7037
+ /** The triggers only some types fire, by action name — for a step builder that wants the title the builder shows. */
7038
+ export declare const typeTriggerDefinitions: Record<string, InteractionCallback>;
7039
+
6572
7040
  /**
6573
7041
  * Changes one element's own attribute or state — the element `setState`, which is NOT the global one that writes
6574
7042
  * `runtime.state`. Left without a target it runs against the element the flow is declared on.
@@ -6599,6 +7067,31 @@ export declare const validateSpace: (space: SpaceDocuments, options?: SchemaVali
6599
7067
  /** `validateTemplate`, holding this SDK's own source catalog — for a manifest authored elsewhere. */
6600
7068
  export declare const validateTemplate: (template: Template, options?: SchemaValidationOptions) => SchemaValidationResult;
6601
7069
 
7070
+ /**
7071
+ * Switches one of a CLASS's variants from a value the data answered — a status pill that turns amber, green or red
7072
+ * as the job it describes moves.
7073
+ *
7074
+ * The variant map is keyed by the SELECTOR the variants belong to, and the obvious guess names a different one:
7075
+ * `text.base` selects the text TYPE's own variants (`text--done`), not the class the element wears
7076
+ * (`statusPill--done`), so the element renders with no variant at all and nothing reports it. Taken from the class
7077
+ * declaration, the key cannot drift from the class it means. The value at `source` names the variant, or `template`
7078
+ * turns it into one.
7079
+ */
7080
+ export declare const variantFrom: (cls: ClassRef, source: string, options?: VariantFromOptions) => BindingSpec;
7081
+
7082
+ /** What {@link variantFrom} takes beyond the class and the source. */
7083
+ export declare interface VariantFromOptions {
7084
+ /** Which of the element's selectors wears the class — `base` for nearly everything, `input` for a form control. */
7085
+ slot?: string;
7086
+ /**
7087
+ * A twig expression turning the value into a variant name, with the value as `source` — for when the data does not
7088
+ * already speak in variant names: `"{{ source == 'completed' ? 'ok' : 'failed' }}"`, or `"{{ source == 'code' ?
7089
+ * 'on' : 'off' }}"` for a control that lights up when a state names it. A name the class does not declare wears no
7090
+ * variant, so the other branch can simply name one nothing styles.
7091
+ */
7092
+ template?: string;
7093
+ }
7094
+
6602
7095
  /** One variant of a selector: what it changes, and how it reacts on its own. A variant cannot carry variants. */
6603
7096
  export declare interface VariantSpec {
6604
7097
  css?: CssSpec;
@@ -6718,13 +7211,6 @@ export declare const whenFailed: (stepId: string, step: StepSpec) => StepSpec;
6718
7211
  */
6719
7212
  export declare const whenSucceeded: (stepId: string, step: StepSpec) => StepSpec;
6720
7213
 
6721
- /**
6722
- * The bindings an element declared, with its visibility condition among them.
6723
- *
6724
- * Appended rather than prepended so a `visible` written as a field lands where the same condition written into the
6725
- * list would have: a binding's id carries its position, and a space that moves to the field should not move its
6726
- * ids.
6727
- */
6728
7214
  export declare const withVisibility: (spec: {
6729
7215
  bind?: BindingsSpec;
6730
7216
  visible?: string | false;