@cratis/pi 7.99.0 → 7.100.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.
@@ -204,6 +204,10 @@ consumer, ordered ascending by `order` (default `0`). `useToolbarSlot(slotName)`
204
204
  returns the current content for a custom consumer. `ToolbarContext` also accepts
205
205
  a `slotName`.
206
206
 
207
+ In a Screenplay model the same idea is authored, not coded: a `feature` or `module` adds buttons to the `toolbar` slot of every
208
+ screen beneath it and links each to a command of the feature (see `cratis-screenplay-ui-composition`, "Feature and module
209
+ toolbars"). Use the slot components above only when writing the React application by hand.
210
+
207
211
  ## Props
208
212
 
209
213
  ### `Toolbar`
@@ -170,6 +170,15 @@ open, read, propose, review, apply, reopen loop; the syntax and rules are in
170
170
  5. Switching a module from inherit to override copies the application's items; retarget each copy to the module's own
171
171
  features first or the proposal is refused.
172
172
 
173
+ ### Feature and module toolbars
174
+
175
+ A feature (or module) toolbar is a `ScreenToolbarSyntax` in the `toolbars` member of its `FeatureSyntax` (or `ModuleSyntax`);
176
+ `syntax-schema` for `FeatureSyntax` lists `toolbars`. `add` a `ScreenToolbarSyntax` with `name`, `items` and `buttons` to the
177
+ feature, and `replace` a `ToolbarButtonSyntax` or `ToolbarItemSyntax` to set its `confirm` text; `remove` takes a button away.
178
+ Read the proposal's diagnostics: a warning says an `item ... action` names a command no slice of that feature (or module)
179
+ declares. The syntax, the `confirm` rule and when to prefer the feature toolbar are in `cratis-screenplay-ui-composition`
180
+ (`references/application-shell.md`, "Feature and module toolbars"; Screenplay 4.238.0 or later).
181
+
173
182
  ### The profile's shell
174
183
 
175
184
  `ui-profiles` (Screenplay 4.201.0 or later) reads each `ui profile`'s root template, shell options, appearance, new screens default and
@@ -225,7 +225,8 @@ module Sales
225
225
  ```
226
226
 
227
227
  Read [references/application-shell.md](references/application-shell.md) before writing any of it: the inherit/extend/override
228
- choice, item target and slot, the module-only target rule (`PLAY0750`), buttons, blueprint ranges, sample data, MCP editing
228
+ choice, item target and slot, the module-only target rule (`PLAY0750`), buttons, feature and module toolbars (`toolbar` in a
229
+ `feature` or `module`, `confirm`), blueprint ranges, sample data, MCP editing
229
230
  and the review checklist. `contribute to Navigation` stays the flat contribution; a new application uses regions.
230
231
 
231
232
  ## Interactions — what a click does
@@ -297,7 +298,7 @@ Localized text lives in companion `.strings` files and is referenced unquoted as
297
298
  - [ ] No `file` reference is doing work the declaration should be doing.
298
299
  - [ ] Every click, submit and screen entry that does something has an `on` or
299
300
  `uses`; continuations sit only on actions that can fail.
300
- - [ ] Navigation regions, slice buttons, blueprint references and sample data follow `references/application-shell.md`: each module's mode is deliberate, no module item targets another module, every button names a State Change slice, every template has a `category`, and the active sample data pack is chosen once in the `ui profile`.
301
+ - [ ] Navigation regions, slice buttons, blueprint references and sample data follow `references/application-shell.md`: each module's mode is deliberate, no module item targets another module, every button names a State Change slice, buttons shared by a feature's screens sit in a feature `toolbar` linked to its commands (`confirm` on destructive ones), every template has a `category`, and the active sample data pack is chosen once in the `ui profile`.
301
302
  - [ ] Component bindings, exposed template values, manual form columns, toolbar items, outlets and routes all trace to typed data; no runtime fallback counts as delivery. Report authoring acceptance, executable admission and runtime
302
303
  implementation separately.
303
304
 
@@ -6,6 +6,7 @@
6
6
  - One complete shell
7
7
  - Navigation regions: inherit, extend or override
8
8
  - Toolbar buttons that invoke a State Change slice
9
+ - Feature and module toolbars
9
10
  - Template references, categories and blueprints
10
11
  - Sample data packs
11
12
  - Shapes the compiler refuses
@@ -195,6 +196,41 @@ layout AppShell
195
196
  ⚠️ When a screen uses a `template`, put the `toolbar` inside a slot body (`body` above). Stage refuses a screen that
196
197
  mixes a top-level `template` directive with other top-level directives.
197
198
 
199
+ ## Feature and module toolbars
200
+
201
+ Requires Screenplay 4.238.0 or later (`screenplay --version`); an older compiler refuses `toolbar` in a `feature` or `module`.
202
+
203
+ A template declares a `toolbar` slot. When the same actions belong to every screen of a feature, write the toolbar once on the
204
+ `feature` (or on the `module` for every feature below it) instead of repeating it on each screen: the entries are contributed to
205
+ the `toolbar` slot of every screen beneath it, sub features included, after the screen's own entries (the nearer toolbar comes
206
+ later), and each entry runs one command of the feature. A screen that needs its own buttons keeps its own `toolbar`.
207
+
208
+ ```text
209
+ module Merchandising
210
+ feature Publication
211
+ toolbar actions
212
+ button approve title "Approve product" slice Merchandising.Publication.ApproveProductForSale emphasis primary icon check
213
+ button withdraw title "Withdraw product" slice Merchandising.Publication.WithdrawProduct emphasis quiet icon ban
214
+ confirm "Take this product off sale?"
215
+ item archive action ArchiveProduct
216
+ label "Archive"
217
+ icon archive
218
+ ```
219
+
220
+ - The lines are the ones of a screen toolbar: `item <id> action <Command>` and `button <id> title "<text>" slice <Slice>`, with
221
+ the `PLAY0761`-`PLAY0765` rules above.
222
+ - `confirm "<text>"` (or a `$strings.<key>` token) is an optional child line of an `item` and of a `button`: the user confirms
223
+ before the command runs or before the button's dialog opens. Use it for destructive or hard-to-undo commands, not for every entry.
224
+ - An `item ... action <Command>` must name a command that a slice of the feature (or module) declares; otherwise the compiler
225
+ warns that the command is not the feature's. Fix the name or move the toolbar to the feature that owns the command; never silence the warning.
226
+ - Choose the feature toolbar when the buttons act on the feature as a whole (approve, withdraw, new). A button that needs the row
227
+ the user picked (a row action) stays an `item ... action` on the screen's table or list, because the toolbar has no row.
228
+ - Preview and Play open the command's form dialog for an entry (or run it after the confirmation); Studio's feature editor has a
229
+ Toolbar section that adds a button and links it to a command of the feature. All of it is authoring syntax like every screen
230
+ construct: the printer writes it back where it was written.
231
+ - Verify: `screenplay <model> --warnaserror` is clean (no warning about a command the feature does not declare), then Preview or Play a screen of the feature and see the
232
+ buttons in the template's toolbar; a destructive one asks first.
233
+
198
234
  ## Template references, categories and blueprints
199
235
 
200
236
  - Every `layout`, `screen template` and `dialog template` declares a `category`; a template picker groups by it, and a
@@ -323,5 +359,6 @@ pass. Propose, show the difference, apply, reopen. Details: `cratis-screenplay-m
323
359
  - [ ] Hierarchy is in the sidebar; sub-items target features of the parent's module.
324
360
  - [ ] Every button names a State Change slice; none is left without a slice.
325
361
  - [ ] A screen with a `template` keeps its toolbar inside a slot body.
362
+ - [ ] Buttons shared by every screen of a feature sit in a feature `toolbar`, each linked to a command of that feature, with `confirm` on the destructive ones.
326
363
  - [ ] Every template has a `category`; every blueprint reference has a valid range and is listed in a profile's `packages`.
327
364
  - [ ] The active sample data pack is selected once, in the `ui profile`, and no sample value sits in a component.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/pi",
3
- "version": "7.99.0",
3
+ "version": "7.100.0",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [