@cratis/pi 8.5.0 → 8.7.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.
Files changed (217) hide show
  1. package/package/corpus/harnesses/copilot/instructions/glossary.instructions.md +5 -3
  2. package/package/corpus/harnesses/copilot/instructions/react.instructions.md +3 -1
  3. package/package/corpus/harnesses/copilot/instructions/reactors.instructions.md +3 -1
  4. package/package/corpus/harnesses/copilot/instructions/specs.csharp.instructions.md +6 -3
  5. package/package/corpus/harnesses/copilot/instructions/vertical-slices.instructions.md +5 -2
  6. package/package/corpus/rules/glossary.md +5 -3
  7. package/package/corpus/rules/react.md +3 -1
  8. package/package/corpus/rules/reactors.md +3 -1
  9. package/package/corpus/rules/specs.csharp.md +6 -3
  10. package/package/corpus/rules/vertical-slices.md +5 -2
  11. package/package/corpus/skills/cratis-application-growth/SKILL.md +1 -2
  12. package/package/corpus/skills/cratis-application-growth/references/csharp.md +0 -2
  13. package/package/corpus/skills/cratis-application-growth/references/move-and-untangle.md +1 -2
  14. package/package/corpus/skills/cratis-application-growth/references/rename-window.md +1 -3
  15. package/package/corpus/skills/cratis-application-growth/references/service-and-delivery.md +3 -2
  16. package/package/corpus/skills/cratis-application-growth/references/stages.md +2 -2
  17. package/package/corpus/skills/cratis-arc-authorize-request/SKILL.md +2 -2
  18. package/package/corpus/skills/cratis-arc-authorize-request/references/authproxy.md +19 -0
  19. package/package/corpus/skills/cratis-arc-authorize-request/references/csharp-query-security.md +15 -0
  20. package/package/corpus/skills/cratis-arc-authorize-request/references/csharp.md +12 -3
  21. package/package/corpus/skills/cratis-arc-declare-command/SKILL.md +2 -0
  22. package/package/corpus/skills/cratis-arc-declare-command/references/csharp-chronicle.md +46 -7
  23. package/package/corpus/skills/cratis-arc-declare-command/references/csharp-controller.md +3 -1
  24. package/package/corpus/skills/cratis-arc-declare-command/references/csharp-history.md +4 -1
  25. package/package/corpus/skills/cratis-arc-declare-command/references/csharp.md +31 -4
  26. package/package/corpus/skills/cratis-arc-declare-command/references/go.md +1 -1
  27. package/package/corpus/skills/cratis-arc-diagnose-live-query/references/csharp.md +24 -2
  28. package/package/corpus/skills/cratis-arc-expose-mcp-operation/references/csharp.md +49 -0
  29. package/package/corpus/skills/cratis-arc-expose-query/SKILL.md +3 -1
  30. package/package/corpus/skills/cratis-arc-expose-query/references/csharp.md +27 -4
  31. package/package/corpus/skills/cratis-arc-generate-proxies/SKILL.md +1 -0
  32. package/package/corpus/skills/cratis-arc-generate-proxies/references/csharp.md +49 -2
  33. package/package/corpus/skills/cratis-arc-generate-proxies/references/typescript.md +9 -0
  34. package/package/corpus/skills/cratis-arc-host-application/SKILL.md +1 -1
  35. package/package/corpus/skills/cratis-arc-host-application/references/csharp-configuration.md +54 -0
  36. package/package/corpus/skills/cratis-arc-host-application/references/csharp-deployment.md +98 -0
  37. package/package/corpus/skills/cratis-arc-host-application/references/csharp-http.md +9 -1
  38. package/package/corpus/skills/cratis-arc-host-application/references/csharp-identity.md +84 -2
  39. package/package/corpus/skills/cratis-arc-host-application/references/csharp.md +2 -0
  40. package/package/corpus/skills/cratis-arc-invoke-command/references/csharp.md +2 -1
  41. package/package/corpus/skills/cratis-arc-isolate-tenant/SKILL.md +18 -1
  42. package/package/corpus/skills/cratis-arc-page-query/references/csharp.md +2 -0
  43. package/package/corpus/skills/cratis-arc-react-bind-slice/SKILL.md +18 -16
  44. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-commands.md +8 -3
  45. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-host.md +84 -16
  46. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-identity.md +22 -2
  47. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-instant-feedback.md +81 -0
  48. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-localization.md +80 -0
  49. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-navigation.md +103 -0
  50. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-queries.md +40 -1
  51. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-structure.md +117 -0
  52. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript.md +7 -3
  53. package/package/corpus/skills/cratis-arc-react-separate-view-model/SKILL.md +3 -3
  54. package/package/corpus/skills/cratis-arc-react-separate-view-model/references/typescript.md +27 -6
  55. package/package/corpus/skills/cratis-arc-validate-command/references/csharp-rules.md +23 -2
  56. package/package/corpus/skills/cratis-arc-validate-command/references/csharp.md +28 -2
  57. package/package/corpus/skills/cratis-authproxy-configure/SKILL.md +136 -0
  58. package/package/corpus/skills/cratis-authproxy-configure/references/admission.md +125 -0
  59. package/package/corpus/skills/cratis-authproxy-configure/references/aspire.md +154 -0
  60. package/package/corpus/skills/cratis-authproxy-configure/references/operations.md +122 -0
  61. package/package/corpus/skills/cratis-authproxy-configure/references/services-and-routing.md +114 -0
  62. package/package/corpus/skills/cratis-authproxy-configure/references/sessions-and-logout.md +126 -0
  63. package/package/corpus/skills/cratis-authproxy-configure/references/sign-in-providers.md +116 -0
  64. package/package/corpus/skills/cratis-authproxy-configure/references/tenant-resolution.md +135 -0
  65. package/package/corpus/skills/cratis-choreography-run-workflow/SKILL.md +117 -0
  66. package/package/corpus/skills/cratis-choreography-run-workflow/references/csharp-chronicle.md +164 -0
  67. package/package/corpus/skills/cratis-choreography-run-workflow/references/csharp.md +354 -0
  68. package/package/corpus/skills/cratis-chronicle-cli-operations/SKILL.md +2 -2
  69. package/package/corpus/skills/cratis-chronicle-cli-operations/references/project-tooling.md +28 -0
  70. package/package/corpus/skills/cratis-chronicle-connect-application/references/csharp-services.md +13 -2
  71. package/package/corpus/skills/cratis-chronicle-connect-application/references/csharp.md +12 -0
  72. package/package/corpus/skills/cratis-chronicle-connect-application/references/kotlin.md +2 -0
  73. package/package/corpus/skills/cratis-chronicle-connect-application/references/typescript.md +10 -1
  74. package/package/corpus/skills/cratis-chronicle-constrain-append/SKILL.md +8 -1
  75. package/package/corpus/skills/cratis-chronicle-constrain-append/references/csharp.md +35 -3
  76. package/package/corpus/skills/cratis-chronicle-constrain-append/references/go.md +1 -1
  77. package/package/corpus/skills/cratis-chronicle-constrain-append/references/operations.md +70 -0
  78. package/package/corpus/skills/cratis-chronicle-deploy-kernel/SKILL.md +2 -0
  79. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/configuration.md +27 -0
  80. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/container-and-kubernetes.md +293 -0
  81. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/kernel-options.md +13 -6
  82. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/network-and-tls.md +45 -0
  83. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/storage.md +91 -1
  84. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/upgrade-and-recovery.md +9 -0
  85. package/package/corpus/skills/cratis-chronicle-evolve-event/SKILL.md +12 -0
  86. package/package/corpus/skills/cratis-chronicle-inspect-observer/SKILL.md +11 -1
  87. package/package/corpus/skills/cratis-chronicle-inspect-observer/references/csharp.md +1 -1
  88. package/package/corpus/skills/cratis-chronicle-project-view/SKILL.md +1 -1
  89. package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-fluent.md +14 -3
  90. package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-model-bound.md +3 -0
  91. package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-reading.md +3 -2
  92. package/package/corpus/skills/cratis-chronicle-project-view/references/csharp.md +23 -0
  93. package/package/corpus/skills/cratis-chronicle-project-view/references/elixir.md +1 -0
  94. package/package/corpus/skills/cratis-chronicle-project-view/references/go.md +2 -1
  95. package/package/corpus/skills/cratis-chronicle-project-view/references/java.md +2 -0
  96. package/package/corpus/skills/cratis-chronicle-project-view/references/kotlin.md +1 -0
  97. package/package/corpus/skills/cratis-chronicle-project-view/references/typescript.md +1 -1
  98. package/package/corpus/skills/cratis-chronicle-protect-decision/SKILL.md +2 -0
  99. package/package/corpus/skills/cratis-chronicle-protect-decision/references/csharp-scopes.md +40 -3
  100. package/package/corpus/skills/cratis-chronicle-protect-decision/references/csharp.md +20 -2
  101. package/package/corpus/skills/cratis-chronicle-protect-decision/references/elixir.md +7 -0
  102. package/package/corpus/skills/cratis-chronicle-protect-decision/references/go.md +9 -1
  103. package/package/corpus/skills/cratis-chronicle-protect-decision/references/java.md +8 -0
  104. package/package/corpus/skills/cratis-chronicle-protect-decision/references/kotlin.md +9 -0
  105. package/package/corpus/skills/cratis-chronicle-protect-decision/references/typescript.md +7 -0
  106. package/package/corpus/skills/cratis-chronicle-protect-personal-data/references/csharp.md +24 -1
  107. package/package/corpus/skills/cratis-chronicle-publish-contract/SKILL.md +1 -1
  108. package/package/corpus/skills/cratis-chronicle-publish-contract/references/csharp.md +41 -0
  109. package/package/corpus/skills/cratis-chronicle-publish-contract/references/webhook-signature-wire-format.md +82 -0
  110. package/package/corpus/skills/cratis-chronicle-react-to-fact/SKILL.md +17 -0
  111. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/csharp-outputs.md +3 -1
  112. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/csharp.md +35 -2
  113. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/elixir.md +11 -0
  114. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/java.md +1 -0
  115. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/kotlin.md +1 -0
  116. package/package/corpus/skills/cratis-chronicle-record-event/SKILL.md +1 -1
  117. package/package/corpus/skills/cratis-chronicle-record-event/references/csharp-coordination.md +31 -2
  118. package/package/corpus/skills/cratis-chronicle-record-event/references/csharp-history.md +21 -4
  119. package/package/corpus/skills/cratis-chronicle-record-event/references/csharp.md +20 -2
  120. package/package/corpus/skills/cratis-chronicle-record-event/references/go.md +1 -1
  121. package/package/corpus/skills/cratis-chronicle-record-event/references/java.md +1 -1
  122. package/package/corpus/skills/cratis-chronicle-record-event/references/kotlin.md +3 -0
  123. package/package/corpus/skills/cratis-chronicle-reduce-state/SKILL.md +2 -1
  124. package/package/corpus/skills/cratis-chronicle-reduce-state/references/csharp.md +3 -1
  125. package/package/corpus/skills/cratis-chronicle-reduce-state/references/java.md +10 -1
  126. package/package/corpus/skills/cratis-chronicle-reduce-state/references/kotlin.md +10 -1
  127. package/package/corpus/skills/cratis-chronicle-reduce-state/references/typescript.md +27 -5
  128. package/package/corpus/skills/cratis-chronicle-select-client/SKILL.md +18 -0
  129. package/package/corpus/skills/cratis-chronicle-select-client/references/elixir.md +21 -1
  130. package/package/corpus/skills/cratis-chronicle-select-client/references/go.md +13 -0
  131. package/package/corpus/skills/cratis-chronicle-select-client/references/java.md +15 -0
  132. package/package/corpus/skills/cratis-chronicle-select-client/references/kotlin.md +15 -0
  133. package/package/corpus/skills/cratis-chronicle-select-client/references/typescript.md +16 -0
  134. package/package/corpus/skills/cratis-code-review/references/csharp-diagnostics.md +28 -2
  135. package/package/corpus/skills/cratis-code-review/references/csharp.md +1 -1
  136. package/package/corpus/skills/cratis-components-accessibility/SKILL.md +6 -8
  137. package/package/corpus/skills/cratis-components-accessibility/references/typescript.md +32 -14
  138. package/package/corpus/skills/cratis-components-build-canvas/SKILL.md +4 -3
  139. package/package/corpus/skills/cratis-components-build-canvas/references/typescript-props.md +1 -1
  140. package/package/corpus/skills/cratis-components-build-canvas/references/typescript.md +4 -2
  141. package/package/corpus/skills/cratis-components-choose-control/SKILL.md +13 -7
  142. package/package/corpus/skills/cratis-components-choose-control/references/from-primereact.md +116 -0
  143. package/package/corpus/skills/cratis-components-choose-control/references/menu.md +90 -0
  144. package/package/corpus/skills/cratis-components-choose-control/references/typescript-composition.md +48 -0
  145. package/package/corpus/skills/cratis-components-choose-control/references/typescript.md +2 -2
  146. package/package/corpus/skills/cratis-components-compose-toolbar/SKILL.md +2 -1
  147. package/package/corpus/skills/cratis-components-compose-toolbar/references/floating-toolbar.md +146 -0
  148. package/package/corpus/skills/cratis-components-diagnose-screen/SKILL.md +102 -0
  149. package/package/corpus/skills/cratis-components-display-list/SKILL.md +10 -10
  150. package/package/corpus/skills/cratis-components-display-list/references/typescript-custom-panel.md +74 -0
  151. package/package/corpus/skills/cratis-components-display-list/references/typescript-datatables.md +2 -7
  152. package/package/corpus/skills/cratis-components-display-list/references/typescript.md +3 -2
  153. package/package/corpus/skills/cratis-components-submit-form/references/typescript-commandform.md +72 -2
  154. package/package/corpus/skills/cratis-components-submit-form/references/typescript.md +5 -3
  155. package/package/corpus/skills/cratis-components-theme-application/SKILL.md +17 -15
  156. package/package/corpus/skills/cratis-components-theme-application/references/localization.md +166 -0
  157. package/package/corpus/skills/cratis-components-theme-application/references/typescript.md +18 -14
  158. package/package/corpus/skills/cratis-components-theme-application/references/upgrade-from-previous-major.md +141 -0
  159. package/package/corpus/skills/cratis-engineering-csharp-conventions/SKILL.md +2 -0
  160. package/package/corpus/skills/cratis-engineering-csharp-conventions/references/csharp-domain-philosophy.md +31 -3
  161. package/package/corpus/skills/cratis-engineering-csharp-conventions/references/csharp-fundamentals-helpers.md +119 -0
  162. package/package/corpus/skills/cratis-engineering-csharp-conventions/references/csharp.md +4 -0
  163. package/package/corpus/skills/cratis-fundamentals-concept/references/csharp-serialization.md +70 -0
  164. package/package/corpus/skills/cratis-fundamentals-concept/references/csharp.md +8 -0
  165. package/package/corpus/skills/cratis-fundamentals-concept/references/go.md +1 -0
  166. package/package/corpus/skills/cratis-fundamentals-concept/references/typescript-serialization.md +33 -0
  167. package/package/corpus/skills/cratis-fundamentals-name-value/references/csharp.md +2 -1
  168. package/package/corpus/skills/cratis-fundamentals-type-discovery/references/csharp-diagnostics.md +5 -0
  169. package/package/corpus/skills/cratis-fundamentals-type-discovery/references/go-dependency-injection.md +3 -0
  170. package/package/corpus/skills/cratis-modeling-design-event-model/SKILL.md +6 -4
  171. package/package/corpus/skills/cratis-modeling-design-event-model/references/command-inventory.md +7 -1
  172. package/package/corpus/skills/cratis-modeling-design-event-model/references/model-first.md +13 -1
  173. package/package/corpus/skills/cratis-modeling-design-event-model/references/review-one-slice.md +6 -0
  174. package/package/corpus/skills/cratis-multi-service-local-orchestration/SKILL.md +6 -6
  175. package/package/corpus/skills/cratis-multi-service-local-orchestration/references/csharp-aspire.md +116 -28
  176. package/package/corpus/skills/cratis-multi-service-local-orchestration/references/docker-compose.md +2 -2
  177. package/package/corpus/skills/cratis-observability/references/chronicle-kernel-export.md +46 -0
  178. package/package/corpus/skills/cratis-orleans-jobs/SKILL.md +4 -2
  179. package/package/corpus/skills/cratis-platform-build-application/SKILL.md +8 -0
  180. package/package/corpus/skills/cratis-platform-build-application/references/cratis-identity.md +71 -0
  181. package/package/corpus/skills/cratis-platform-build-application/references/studio-repository.md +96 -0
  182. package/package/corpus/skills/cratis-platform-deliver-slice/SKILL.md +14 -8
  183. package/package/corpus/skills/cratis-platform-deliver-slice/references/csharp.md +167 -3
  184. package/package/corpus/skills/cratis-platform-deliver-slice/references/eventual-consistency.md +150 -0
  185. package/package/corpus/skills/cratis-platform-diagnose-slice/SKILL.md +1 -1
  186. package/package/corpus/skills/cratis-platform-start-application/SKILL.md +21 -0
  187. package/package/corpus/skills/cratis-platform-start-application/references/csharp.md +77 -3
  188. package/package/corpus/skills/cratis-platform-upgrade-application/SKILL.md +118 -0
  189. package/package/corpus/skills/cratis-platform-upgrade-application/references/csharp.md +117 -0
  190. package/package/corpus/skills/cratis-platform-upgrade-application/references/java.md +53 -0
  191. package/package/corpus/skills/cratis-platform-upgrade-application/references/kotlin.md +53 -0
  192. package/package/corpus/skills/cratis-platform-upgrade-application/references/typescript.md +71 -0
  193. package/package/corpus/skills/cratis-screenplay-accept-model/references/csharp.md +29 -0
  194. package/package/corpus/skills/cratis-screenplay-accept-model/references/read-the-evidence.md +82 -1
  195. package/package/corpus/skills/cratis-screenplay-declare-slice/SKILL.md +1 -1
  196. package/package/corpus/skills/cratis-screenplay-declare-slice/references/structure-and-imports.md +10 -0
  197. package/package/corpus/skills/cratis-screenplay-onboard-workspace/SKILL.md +5 -4
  198. package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/cli.md +19 -2
  199. package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/smallest-model.md +87 -0
  200. package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/typescript.md +13 -0
  201. package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/workspace-mcp.md +5 -0
  202. package/package/corpus/skills/cratis-specifications-exercise-backend/SKILL.md +2 -0
  203. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-colocated.md +101 -0
  204. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-command-results.md +3 -1
  205. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-decision-reads.md +1 -0
  206. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-events.md +1 -0
  207. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-integration.md +4 -2
  208. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-reactors.md +3 -3
  209. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp.md +34 -1
  210. package/package/corpus/skills/cratis-specifications-exercise-backend/references/elixir.md +2 -0
  211. package/package/corpus/skills/cratis-specifications-isolate-behavior/SKILL.md +1 -1
  212. package/package/corpus/skills/cratis-specifications-isolate-behavior/references/csharp-running.md +10 -3
  213. package/package/corpus/skills/cratis-specifications-test-application-ui/references/typescript.md +22 -4
  214. package/package/corpus/skills/cratis-specifications-test-typescript-behavior/SKILL.md +2 -1
  215. package/package/corpus/skills/cratis-specifications-test-typescript-behavior/references/typescript.md +40 -0
  216. package/package/profile-catalog.json +15 -0
  217. package/package.json +1 -1
@@ -6,6 +6,7 @@
6
6
  - Remote ComboBox search
7
7
  - ToggleGroup
8
8
  - ActionMenubar
9
+ - Menu
9
10
  - Badge
10
11
  - MarkdownEditor
11
12
  - IconPicker
@@ -123,6 +124,53 @@ import { ActionMenubar } from '@cratis/components/Common';
123
124
  />
124
125
  ```
125
126
 
127
+ ## Menu
128
+
129
+ Row actions. Spread the trigger props onto the element that opens the menu. In a table whose rows select or respond to a click, a click on the trigger or on an item also reaches the row, so stop it at an element around the whole `Menu`; that leaves the trigger's own handler in place. `RowActions`, `onRename` and `onRemove` are illustrative.
130
+
131
+ ```tsx
132
+ import { Button } from '@cratis/components/Common';
133
+ import { Menu, MenuItem } from '@cratis/components/Menu';
134
+
135
+ export function RowActions({ onRename, onRemove }: { onRename: () => void; onRemove: () => void }) {
136
+ return (
137
+ <span onClick={event => event.stopPropagation()}>
138
+ <Menu label="Row actions" align="end" trigger={props => <Button {...props}>Actions</Button>}>
139
+ {() => <>
140
+ <MenuItem onSelect={onRename}>Rename</MenuItem>
141
+ <MenuItem onSelect={onRemove}>Remove</MenuItem>
142
+ </>}
143
+ </Menu>
144
+ </span>
145
+ );
146
+ }
147
+ ```
148
+
149
+ A small form: set `role="dialog"`, use ordinary inputs and buttons, read the named input on submit, and close from your handler. `RenameAction`, `name` and `onRename` are illustrative.
150
+
151
+ ```tsx
152
+ export function RenameAction({ name, onRename }: { name: string; onRename: (name: string) => void }) {
153
+ return (
154
+ <Menu label="Rename" role="dialog" width={260} trigger={props => <Button {...props}>Rename</Button>}>
155
+ {close => (
156
+ <form onSubmit={event => {
157
+ event.preventDefault();
158
+ onRename(String(new FormData(event.currentTarget).get('name')));
159
+ close();
160
+ }}>
161
+ <input name="name" aria-label="Name" defaultValue={name} />
162
+ <button type="submit">Save</button>
163
+ </form>
164
+ )}
165
+ </Menu>
166
+ );
167
+ }
168
+ ```
169
+
170
+ Host-controlled: hold `const [open, setOpen] = useState(false)` and pass `open={open} onOpenChange={setOpen}`.
171
+
172
+ Types from `@cratis/components/Menu`: `MenuProps`, `MenuItemProps`, `MenuTriggerProps`, `MenuRole` (`'menu' | 'dialog'`), `MenuSide` (`'below' | 'right'`), `MenuAlign` (`'start' | 'end'`) and `CloseMenu` (`(restoreFocus?: boolean) => void`). The area stylesheet is `@cratis/components/Menu/styles`. Behaviour is in the neutral [Menu](menu.md) reference.
173
+
126
174
  ## Badge
127
175
 
128
176
  ```tsx
@@ -4,7 +4,7 @@ Cratis Components ships only for React. Names such as `StationFields`, `price` a
4
4
 
5
5
  ## Imports
6
6
 
7
- - Controls come from their subpath: `@cratis/components/Common`, `@cratis/components/Dropdown`, `@cratis/components/Display`, `@cratis/components/MarkdownEditor`, `@cratis/components/IconPicker`. Each subpath also exports the props, option, part, label, enum and helper types of its controls.
7
+ - Controls come from their subpath: `@cratis/components/Common`, `@cratis/components/Dropdown`, `@cratis/components/Display`, `@cratis/components/Menu`, `@cratis/components/MarkdownEditor`, `@cratis/components/IconPicker`. Each subpath also exports the props, option, part, label, enum and helper types of its controls.
8
8
  - `CratisComponentsProvider` comes from `@cratis/components`; `ChangeHandler` and `ChangeMeta` come from `@cratis/components/types`.
9
9
  - Styles: in the application's CSS entry file, `@import '@cratis/components/tokens';` then `@import '@cratis/components/styles';` once, or `@cratis/components/styles/base` plus each used area's `@cratis/components/<Area>/styles`. Import them from CSS, not from TypeScript; the full entry is in `cratis-components-theme-application`.
10
10
 
@@ -57,7 +57,7 @@ When a plain HTML form post must carry such a value, serialize it yourself, for
57
57
  - [Display components](typescript-display.md): status and loading component props.
58
58
  - [MarkdownEditor](typescript-markdowneditor.md): editor, completion, part, label and formatting types.
59
59
  - [IconPicker](typescript-iconpicker.md): value, catalog, part, label and helper types.
60
- - [Composition examples](typescript-composition.md): native form fields, remote `ComboBox` search, `ToggleGroup`, `ActionMenubar`, `Badge`, `MarkdownEditor` and `IconPicker`.
60
+ - [Composition examples](typescript-composition.md): native form fields, remote `ComboBox` search, `ToggleGroup`, `ActionMenubar`, `Menu`, `Badge`, `MarkdownEditor` and `IconPicker`.
61
61
 
62
62
  ## When it goes off the usual path
63
63
 
@@ -31,6 +31,7 @@ Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Nod
31
31
  | Icon actions or on/off toggles for a screen's view (zoom, undo, show grid) | `Toolbar` with one-off buttons, and `active` only on the toggles |
32
32
  | A standalone, keyboard-navigable row of labeled screen commands (Save, Export) | `ActionMenubar` from the Components Common area: one labeled button per action, the same three focus modes; see `cratis-components-choose-control` |
33
33
  | Page commands such as Add or Edit over a list | the page's built-in action bar (`cratis-components-display-list`) |
34
+ | Contextual actions next to one selected item (copy, delete) | `FloatingToolbar`: [floating toolbar](references/floating-toolbar.md) |
34
35
  | Placing, moving or zooming items on the surface | `cratis-components-build-canvas` |
35
36
  | Clusters that users move between with arrow keys | one `Toolbar` containing several `ToolbarGroup`s |
36
37
  | Palettes for separate tasks, each with its own name and arrow-key scope | separate `Toolbar` instances, laid out with your own CSS |
@@ -61,7 +62,7 @@ A disabled drawer tile stays focusable so its reason can be read, but arrows alw
61
62
 
62
63
  **Panels (folder, fan-out, drawer).** Clicking the trigger toggles the panel without moving focus, and a closed panel is inert and hidden from assistive technology. Dismissal is separate from navigation and works in every focus mode, `None` included: Escape anywhere on the page closes an open panel and returns focus to its trigger, and a pointer press outside closes it. Compact folder panels and fan-outs open in their fixed direction and never flip, so point them away from the screen edge the palette sits against. A drawer prefers its side (below a horizontal toolbar) but is not guaranteed it: it flips, slides or scrolls to stay in the viewport.
63
64
 
64
- The complete rules for focus, disabled tools, dismissal, placement, contexts, slots and drag data are in [runtime behaviour](references/behavior.md).
65
+ Complete rules: [runtime behaviour](references/behavior.md).
65
66
 
66
67
  **Contexts.** `ToolbarSection` shows the `ToolbarContext` whose `name` equals `activeContext`: the first when it is omitted, none when nothing matches. Inactive contexts stay mounted and keep their component state, but they are inert and `aria-hidden` with tooltips disabled. The section does not move focus when the mode changes. If the change hides the focused tool, move focus yourself.
67
68
 
@@ -0,0 +1,146 @@
1
+ # FloatingToolbar: actions for one selected item
2
+
3
+ ## Contents
4
+
5
+ - When to use it
6
+ - Default path
7
+ - Actions
8
+ - Placement
9
+ - Following the item
10
+ - Overflow menu
11
+ - Keyboard and events
12
+ - Pitfalls
13
+
14
+ ## When to use it
15
+
16
+ | Need | Use |
17
+ |---|---|
18
+ | Actions that apply to one selected item, shown next to it (copy, pin, a colour choice, delete) | `FloatingToolbar` |
19
+ | A persistent palette of tools or modes for the whole surface | `Toolbar` |
20
+ | A row of labeled page commands | `ActionMenubar` (see `cratis-components-choose-control`) |
21
+
22
+ `FloatingToolbar` is React-only and is a separate component from the `Toolbar` family: it takes a list of action objects, not `ToolbarButton` children. It is most often used on a canvas item, but it works against any element.
23
+
24
+ ## Default path
25
+
26
+ 1. Load the Components stylesheets as for `Toolbar`. With per-area loading, add `@cratis/components/FloatingToolbar/styles` after `@cratis/components/styles/base`.
27
+ 2. Render `FloatingToolbar` inside the item it belongs to, and mount it only while that item is selected and the surface is editable. On a `Canvas` with `readOnly`, unmount it: the toolbar is rendered outside the read-only surface, so its actions would still respond.
28
+ 3. Give it a `label` (the toolbar's accessible name) and an `actions` array.
29
+ 4. On a canvas, pass `track={canvasTransformActivity.subscribe}` so the toolbar follows pan and zoom.
30
+
31
+ ```tsx
32
+ import { CanvasItem, canvasTransformActivity } from '@cratis/components/Canvas';
33
+ import { FloatingToolbar, type FloatingToolbarAction } from '@cratis/components/FloatingToolbar';
34
+
35
+ type NoteProps = { selected: boolean; readOnly: boolean; pinned: boolean; onCopy: () => void; onTogglePin: () => void; onDelete: () => void };
36
+
37
+ export const Note = ({ selected, readOnly, pinned, onCopy, onTogglePin, onDelete }: NoteProps) => {
38
+ const actions: FloatingToolbarAction[] = [
39
+ { id: 'copy', label: 'Copy', icon: <span aria-hidden='true'>⧉</span>, onClick: onCopy },
40
+ { id: 'pin', label: 'Pin', icon: <span aria-hidden='true'>⚑</span>, active: pinned, onClick: onTogglePin },
41
+ { id: 'delete', label: 'Delete', icon: <span aria-hidden='true'>✕</span>, danger: true, separated: true, onClick: onDelete },
42
+ ];
43
+ return (
44
+ <CanvasItem x={100} y={80}>
45
+ <div className='note'>Note</div>
46
+ {selected && !readOnly && <FloatingToolbar label='Note actions' actions={actions} track={canvasTransformActivity.subscribe} />}
47
+ </CanvasItem>
48
+ );
49
+ };
50
+ ```
51
+
52
+ The toolbar owns presentation, position and keyboard focus. The application owns selection, the read-only state it also passes to the canvas, the toggle state behind `active`, and what each `onClick` does. Item names and glyphs here are illustrative.
53
+
54
+ Exports from `@cratis/components/FloatingToolbar`: the `FloatingToolbar` component and the types `FloatingToolbarProps`, `FloatingToolbarAction`, `FloatingToolbarSide` and `FloatingToolbarAlign`.
55
+
56
+ ## Actions
57
+
58
+ Each entry of `actions` renders one icon button with a tooltip, in array order.
59
+
60
+ | Field | Effect |
61
+ |---|---|
62
+ | `id` (required) | Identifies the action; unique within the toolbar. |
63
+ | `label` (required) | The button's accessible name and its tooltip. |
64
+ | `icon` | The glyph: a React node or an icon-font class string. |
65
+ | `swatch` | A colour chip shown instead of the icon. Any CSS colour value, such as `#facc15` or `var(--my-color)`. |
66
+ | `onClick` | Activation callback, typed as `() => void`, run when the button is pressed. Do not depend on an argument. |
67
+ | `active` | Makes the action a toggle that announces as pressed or not pressed. Pass `true` or `false` on a toggle; leave it undefined on a plain action. |
68
+ | `danger` | Styles the action as destructive. |
69
+ | `separated` | Draws a divider before the action. Ignored on the first action. |
70
+ | `disabled` | Blocks `onClick` and keeps the button out of arrow-key navigation. |
71
+
72
+ Give every action either an `icon` or a `swatch`. With both, the swatch is shown.
73
+
74
+ ## Placement
75
+
76
+ | Prop | Values | Effect |
77
+ |---|---|---|
78
+ | `side` | `'above'` (default), `'below'` | The side of the item the toolbar sits on. It flips to the other side only when the preferred side lacks room and the other side has it. When neither side fits it keeps the preferred side and is shifted towards the viewport. A toolbar larger than the viewport still overflows it. |
79
+ | `align` | `'center'` (default), `'start'`, `'end'` | The edge of the item it lines up with. These are physical edges and do not flip in right-to-left layouts. |
80
+ | `anchor` | a ref to an element | Edge case: positions against that element instead of the item the toolbar is rendered in. |
81
+
82
+ - By default the toolbar positions against its parent element, the element it is rendered directly inside. It never positions against the viewport.
83
+ - It is rendered through a portal into the application's overlay container, not inside the item, so the item does not need `position: relative`.
84
+ - A scrolling or `overflow: hidden` ancestor of the item does not clip it, and canvas zoom does not scale it, as long as the overlay container lies outside those elements. By default that container is the document body.
85
+ - It is hidden while its anchor (the parent element, or the `anchor` element when given) lies wholly outside the visible area: the nearest scrolling or clipping ancestor of the anchor, limited to the viewport.
86
+ - It stacks just below the dialog layer; inside a dialog it stacks above that dialog.
87
+ - `className` adds a class to the toolbar element.
88
+
89
+ ## Following the item
90
+
91
+ The toolbar re-positions on its own when a render that includes the toolbar moves the item, when the item or the toolbar changes size, when anything scrolls and when the window resizes.
92
+
93
+ Any other move needs `track`: a host render that does not re-render the toolbar, or a move made outside React. A canvas pans and zooms by updating the DOM directly, which does not re-render its items, so on a canvas pass `track={canvasTransformActivity.subscribe}`.
94
+
95
+ Edge case, for another host that moves items without re-rendering: `track` is a function that receives an `update` callback, calls it on every movement and returns the function that unsubscribes.
96
+
97
+ ## Overflow menu
98
+
99
+ Pass `children` to add content after the actions. Put less common actions in a `Menu` (from `@cratis/components/Menu`) given as the child. With per-area style loading, also add `@cratis/components/Menu/styles`.
100
+
101
+ An open menu panel does not follow canvas pan or zoom, even when the toolbar has `track`. On a canvas, control the menu and close it when the camera moves:
102
+
103
+ ```tsx
104
+ const [menuOpen, setMenuOpen] = useState(false);
105
+ useEffect(() => canvasTransformActivity.subscribe(() => setMenuOpen(false)), []);
106
+
107
+ <FloatingToolbar label='Note actions' actions={actions} track={canvasTransformActivity.subscribe}>
108
+ <Menu
109
+ label='More actions'
110
+ open={menuOpen}
111
+ onOpenChange={setMenuOpen}
112
+ trigger={props => <button type='button' {...props}>More</button>}
113
+ >
114
+ {() => (
115
+ <>
116
+ <MenuItem onSelect={onArchive}>Archive</MenuItem>
117
+ <MenuItem onSelect={onMove}>Move</MenuItem>
118
+ </>
119
+ )}
120
+ </Menu>
121
+ </FloatingToolbar>
122
+ ```
123
+
124
+ Off a canvas, omit `track`, `open` and `onOpenChange`; the menu then manages its own open state.
125
+
126
+ The menu's trigger takes part in the toolbar's arrow-key navigation, after the actions. A pointer press on another action closes an open menu; moving to an action with the keyboard is not such a press.
127
+
128
+ ## Keyboard and events
129
+
130
+ - The toolbar has the toolbar role, named by `label`. A toggle exposes its pressed state.
131
+ - The actions share one Tab stop. Left and Right arrow keys (swapped in right-to-left layouts), Home and End move between the enabled buttons, including focusable `children`. Up and Down do nothing.
132
+ - A focusable element passed as `children`, such as the plain `button` trigger in the menu example, keeps its own Tab stop, so that toolbar has two.
133
+ - Tab order follows the item: Tab reaches the toolbar at the item's place in the page, although the toolbar is rendered elsewhere in the DOM. Leaving is best-effort: Tab pressed on the toolbar's last enabled button, or Shift+Tab on its first, continues to the next focusable control from the item's place. From any other button, or with no such control, the browser's own Tab order applies, counted from where the toolbar is rendered. Do not rely on a particular control receiving focus after the toolbar.
134
+ - `pointerdown`, `mousedown`, `click` and `dblclick` on the toolbar do not bubble to the item or the canvas, so pressing an action does not start a pan, a drag, a deselect or a marquee. Other pointer and mouse events, such as `pointerup` and `pointermove`, still bubble.
135
+ - Enter and Space pressed in the toolbar do not reach the host, with or without modifier keys. Left, Right, Home, End and Tab are kept from the host only when they move focus; one that has nowhere to go still bubbles.
136
+ - A key press that a control inside the toolbar has already handled and default-prevented does not reach the host either.
137
+ - Escape and other shortcuts pressed on a toolbar button reach the host, so the host can still deselect on Escape. Escape pressed inside an open `Menu` panel closes the menu and does not reach the host.
138
+
139
+ ## Pitfalls
140
+
141
+ - Do not keep the toolbar mounted for unselected items or on a read-only canvas. It has no `visible` prop; mounting is what shows it, and a mounted toolbar stays clickable on a read-only canvas.
142
+ - Do not wrap it in an element of its own or position it yourself. Its parent element is the anchor, so a wrapper becomes the anchor. Render it directly inside the item, or pass `anchor`.
143
+ - On a canvas, omitting `track` leaves the toolbar behind while the user pans or zooms. A `Menu` inside it needs closing on camera movement as well; see Overflow menu.
144
+ - An off toggle needs `active: false`. With `active` undefined the button is a plain action and announces no pressed state.
145
+ - Do not use it as the surface's tool palette. Tools and modes that stay on screen belong in `Toolbar`.
146
+ - Do not rely on a click handler on the item or canvas to observe toolbar presses; press and click events are stopped at the toolbar. Act in the action's `onClick`.
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: cratis-components-diagnose-screen
3
+ description: "Use when a screen built with Cratis Components misbehaves and the cause is unknown: renders unstyled, sends no request, Confirm stays disabled or does nothing, a row is missing after a successful command, details show the previous row, the page collapses. Routes the symptom to the first check. Not for a slice whose backend outcome is missing (`cratis-platform-diagnose-slice`) or a stale live query (`cratis-arc-diagnose-live-query`)."
4
+ ---
5
+
6
+ # Diagnose a screen: route the symptom to the first check
7
+
8
+ ## Contents
9
+
10
+ - Three separate checks
11
+ - Default path
12
+ - Symptom to first check
13
+ - Confirm does nothing
14
+ - A successful command does not show in the list
15
+ - Avoid
16
+ - Related skills
17
+
18
+ ## Three separate checks
19
+
20
+ A screen works when three independent things work. Decide which one failed before changing anything.
21
+
22
+ | Check | Proven by | Owned by |
23
+ | --- | --- | --- |
24
+ | The command succeeded | A request left the browser and its result is successful | The form (`cratis-components-submit-form`), then the backend |
25
+ | The query returned the row | A successful, ready query result contains the expected identity | The list (`cratis-components-display-list`), then the read model |
26
+ | The screen is styled and laid out | The rendered layout and the computed styles in the browser's inspector are the intended ones | `cratis-components-theme-application` |
27
+
28
+ - `Arc` (from Arc React) executes commands and runs queries through the generated proxies. `CratisComponentsProvider` supplies UI configuration only; it never replaces `Arc`.
29
+ - An empty-state message is not a diagnosis: a failed, unauthorized or pending query can look like "no rows". Read the query status.
30
+ - A `CommandDialog` that closes on its normal submit path ran its command successfully; that does not prove the list has the row yet. A plain `Dialog` runs no command of its own, so its closing proves nothing about one. The reverse does not hold either: a successful command can leave `CommandDialog` open, so read the command result, not the dialog.
31
+
32
+ ## Default path
33
+
34
+ 1. **Observe, do not guess.** Open the browser's network panel and console. Note whether the button is disabled, whether a request leaves, and what its result says.
35
+ 2. **Find the symptom** in the table below and do its first check only.
36
+ 3. **Follow the hand-off** to the owning skill for the fix. This skill does not repeat their content.
37
+ 4. **Leave the evidence intact.** Do not resubmit a command that succeeded, and do not remove validation or styles to see whether the symptom goes away.
38
+
39
+ ## Symptom to first check
40
+
41
+ | Symptom | First check | Then |
42
+ | --- | --- | --- |
43
+ | A generated command or query import is missing | The backend slice exists, builds, and proxy generation has run. Never hand-write the command or query class. | `cratis-arc-generate-proxies` |
44
+ | A component import from the package root does not compile | The package root is setup-only (provider, configuration, messages, icons). Import each component from its own subpath. | `cratis-components-theme-application` (`references/upgrade-from-previous-major.md`) |
45
+ | Type check rejects a stylesheet import | The package stylesheets are imported from TypeScript. Import them from one local CSS file instead. | `cratis-components-theme-application` |
46
+ | Components render unstyled | One local CSS file imports `@cratis/components/tokens`, then `@cratis/components/styles`, and the application entry imports that file once. | `cratis-components-theme-application` |
47
+ | Product CSS loses to Components styles | The product stylesheet loads after the package imports. Unlayered product CSS beats the layered structural rules whatever its specificity; a product with its own cascade layers must declare the layer order. The token and theme defaults are unlayered too, so an override of those wins only on equal or higher selector specificity and later order. Confirm which rule won in the inspector's computed styles. | `cratis-components-theme-application`, Cascade layers |
48
+ | No command or query request appears in the network panel | The request was never sent, so look at the client guards. A command that fails client validation or lacks a required property returns a validation result without a request. A query sends nothing while it is disabled or a required argument has no value. Also check that `Arc` wraps the application. | `cratis-components-submit-form`, `cratis-arc-react-bind-slice` |
49
+ | A request leaves but goes to the wrong place or is not found | The request URL against the host: `Arc`'s `origin` and `apiBasePath`, and a dev server that forwards both `/api` and `/.cratis` to the backend. The deprecated `basePath` prop affects neither requests nor routing; set the router's own basename for client routes. | `cratis-arc-react-bind-slice` (`references/typescript-host.md`) |
50
+ | A request reaches the backend but is rejected or unauthorized | The request's arguments and credentials, and the result it returns; then backend and authentication logs. | `cratis-arc-validate-command`, `cratis-arc-authorize-request` |
51
+ | Confirm stays disabled | Client validity. Every required command property must have a value, including ones the person never types: seed them in `initialValues`, or keep custom controls in sync through `currentValues`. A value first created in `onBeforeExecute` arrives too late. Also check that the dialog's own `isValid` is not `false`. With `autoServerValidate` enabled the server's validation result disables Confirm too: read the validation request's response in the network panel. | `cratis-components-submit-form` |
52
+ | Confirm is enabled but does nothing | Work through "Confirm does nothing" below, in order. | `cratis-components-submit-form` |
53
+ | The command succeeded but the row is absent | Work through "A successful command does not show in the list" below. Do not resubmit. | `cratis-arc-diagnose-live-query`, `cratis-platform-diagnose-slice` |
54
+ | Details show the previous row | Compare three values: the selected item's identity, the argument passed to the detail query, and the result that is rendered. They must refer to the same row. Give row-specific children a `key` of the row identity. | `cratis-components-display-list` |
55
+ | A row action runs without a row | `disableOnUnselected` only enables or disables the action. Read the row from the selection passed to the item's `command`. | `cratis-components-display-list` |
56
+ | `DataPage` collapses or its paginator is off-screen | `DataPage` fills the height it is given. An ancestor needs a definite height: a viewport height, a sized container, or a flex child that receives a definite height from a sized parent, with `min-height: 0` so it can shrink. Without one the page falls back to a small minimum height. | `cratis-components-display-list` |
57
+ | An adapter still shows a built-in control | Adapters replace only the slots they declare; every other slot uses the built-in renderer. `rendererFallback='throw'` turns that fallback into an error; it adds no coverage. | `cratis-components-theme-application` (`references/renderer-adapters.md`) |
58
+ | Server rendering crashes on a browser global | The stack trace: it names the code that touched the global. When it points at a custom `overlayEnvironment.getContainer`, that setup reads `document` eagerly; resolve it inside the function and return `null` when there is no DOM. Otherwise the trace names another browser-only surface, such as a portal, canvas or worker, which needs its own browser setup. | `cratis-components-theme-application` |
59
+ | Strict Yarn PnP cannot resolve `rxjs` from Arc React (edge case) | An outdated Arc React imports `rxjs` without declaring it. Upgrade `@cratis/arc.react`; the current release needs no workaround. | `cratis-platform-upgrade-application` |
60
+
61
+ Keying a row-specific child remounts it and resets its React state. It does not guarantee a fresh query result, so the detail view must still tell pending, failed and unauthorized apart from an empty result.
62
+
63
+ ## Confirm does nothing
64
+
65
+ The button is enabled, it is clicked, and the dialog stays open. First read the command result: when a request left and its result is successful, the command ran, and the dialog stayed open because `onConfirm` did not return exactly `true` or `onClose` returned `false`. Fix that callback and do not retry. Otherwise check in this order:
66
+
67
+ 1. **A command is already running.** While a submission is in flight Confirm ignores clicks and shows a spinner. Look for a request that never returns.
68
+ 2. **`onBeforeExecute` stopped the submission or returned nothing.** It runs first, before any confirmation. A throw or a rejected promise stops the submission before `confirmBeforeExecute` is asked, and so does a change to the command values while it is running. It is a transformer and must return the values to run with. When it returns nothing, a warning is written to the console and the submission continues with the draft it was handed, including any changes it made to that draft in place; a value it built on a new object and did not return is missing.
69
+ 3. **`confirmBeforeExecute` did not approve.** It runs after the transform. Only a return value of exactly `true` runs the command. Approval is also discarded when the command values change while the confirmation is pending. Log what the callback returns.
70
+ 4. **A field is invalid.** Submission is refused and the refusal is announced. When there are validation results, the announcement names the problem and focus moves to the first element marked `aria-invalid`, or to the first focusable control inside it. When no element is marked, or the marked one offers nothing focusable, focus returns to Confirm, or to the dialog title when Confirm is disabled. A disabled Confirm does not submit at all: that is the "Confirm stays disabled" row. Field messages appear on blur by default; look at that field or set `validateOn='change'`.
71
+ 5. **The command failed without field messages.** An exception or an authorization failure leaves the dialog open. Handle `onFailed`, `onException` and `onUnauthorized`, or read the response in the network panel.
72
+ 6. **No request left at all.** Use the "No command or query request appears in the network panel" row.
73
+
74
+ ## A successful command does not show in the list
75
+
76
+ 1. Confirm the command result is successful. A disabled button or a rejected request is a different row.
77
+ 2. Check that the list is bound to an observable query, that it is the intended one, and that its arguments match the new data (filter, parent identity, page).
78
+ 3. Check that the query is connected and its status is successful, not pending, failed or unauthorized.
79
+ 4. Decide whether the open subscription has delivered the row. If it has and the table does not show it, the cause is on the screen: a column or global filter, the sort, the current page, or the row key. That stays with `cratis-components-display-list`.
80
+ 5. If it has not, compare with an independent read of the same query: same signed-in caller, same arguments, same sort and same page. It must be a new network read. Mounting the query a second time in the same application proves nothing, because it shares the open subscription and its cached result; reload the screen, or open it in a second window, and watch the new request in the network panel. Only a ready, successful result is evidence; a not-ready, failed or unauthorized result proves nothing.
81
+ 6. A ready, successful independent read that still lacks the row proves only that this query, with these arguments, for this caller, leaves it out. Before blaming the projection, check that the row is stored in the read model, then the query's filters, its authorization and its paging. Components does not read the event store, and an accepted command is not a promise that a query shows the row.
82
+
83
+ Hand off by what steps 5 and 6 show. An independent read that contains the row while the open subscription never delivered it does not by itself prove live delivery is broken; it is the case `cratis-arc-diagnose-live-query` examines. A row missing from the query goes to `cratis-platform-diagnose-slice`. What to show the person while the read model catches up is in `cratis-platform-deliver-slice` (`references/eventual-consistency.md`).
84
+
85
+ ## Avoid
86
+
87
+ - **Resubmitting to force a refresh.** Each submission is a new command; a dialog that creates an identifier per opening creates another record.
88
+ - **Removing validation, or loosening a required property,** to enable Confirm. Seed the value instead.
89
+ - **Removing Components styles or adding a vendor theme** to fix a styling symptom. Fix the CSS entry or the layer order.
90
+ - **Debugging the backend when no request left the browser.** Find the client guard or host setting that held it back first.
91
+ - **Hand-writing a command or query class** because a generated import is missing.
92
+ - **Patching the list locally** to show the new row. The observable query delivers the row once the read model and the query include it; the edge case that needs instant feedback is in `cratis-arc-react-bind-slice` (`references/typescript-instant-feedback.md`).
93
+
94
+ ## Related skills
95
+
96
+ - `cratis-components-submit-form`: seeding values, validation timing, confirmation, what closes the dialog.
97
+ - `cratis-components-display-list`: `DataPage`, query-bound tables, selection, query status.
98
+ - `cratis-components-theme-application`: CSS entry, cascade layers, provider configuration, renderer adapters, overlay container.
99
+ - `cratis-arc-react-bind-slice`: the `Arc` host, dev proxy, query and command result state.
100
+ - `cratis-arc-generate-proxies`: missing or stale generated files.
101
+ - `cratis-arc-diagnose-live-query`: the query returns the row but the open view does not show it.
102
+ - `cratis-platform-diagnose-slice`: the command succeeded but the row never reaches the query.
@@ -20,10 +20,10 @@ Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Nod
20
20
 
21
21
  ## What the list surfaces are
22
22
 
23
- - **DataPage** is a complete list screen: an action toolbar, a query-bound table with paginator and, optionally, a resizable details pane for the selected row.
23
+ - **DataPage** is a full list screen: an action toolbar, a query-bound table with paginator and, optionally, a resizable details pane for the selected row.
24
24
  - **The DataTables family** is the table alone: `DataTableForQuery` (snapshot query), `DataTableForObservableQuery` (live query) and `DataTableCore` (rows the host already holds). They share `Column`, `ColumnFilterMenu` and `TablePaginator`.
25
25
 
26
- Give a query-bound surface the generated query **type**, never rows fetched elsewhere; it runs the request or subscription, pages it, reports loading and failure, and keeps the selection matched to refreshed rows. `Column`, `DataPage.Columns`, `DataPage.MenuItems` and `DataPage.MenuItem` are markers: they render nothing alone; their parent reads their options.
26
+ Give a query-bound surface the generated query **type**, never rows fetched elsewhere; it runs the request or subscription, pages it, reports loading and failure, and keeps the selection matched to refreshed rows. `Column` and `DataPage.MenuItem` are markers: they render nothing; their parent reads their options.
27
27
 
28
28
  ## When to use which surface
29
29
 
@@ -34,6 +34,7 @@ Give a query-bound surface the generated query **type**, never rows fetched else
34
34
  | Rows the host holds, or a query it runs itself (see `cratis-arc-react-bind-slice`) for another page size or state layout | `DataTableCore`, plus `TablePaginator` if it pages |
35
35
  | Search, filters or sorting must cover the whole collection | `serverQuery` on the query-bound surface |
36
36
  | Opening a record on its own screen | A DataPage action that navigates with the selected row's identity |
37
+ | A count, summary or custom cards, not a table | The query hook: `references/typescript-custom-panel.md` |
37
38
  | Grouping, row expansion, multi-column sort, grouped cards, dated snapshots | An application-owned table, or `cratis-components-explore-data` |
38
39
 
39
40
  DataPage picks the snapshot or live table from the query type; use an observable query when the list must follow changes; DataPage cannot refetch a snapshot list. A new row shows once the query delivers it on the shown page, perhaps after its command succeeds.
@@ -52,11 +53,11 @@ DataPage picks the snapshot or live table from the query type; use an observable
52
53
 
53
54
  ## How it behaves at runtime
54
55
 
55
- **Paging.** Query-bound tables request 20 rows per page; no option changes that. Pages are zero-based. The paginator appears only with more than one page and shows Arc's totals. A page past the last one (rows removed or narrowed) is corrected to the last page, showing loading meanwhile. The paginator is a named navigation; its current numbered button carries `aria-current="page"`, and focus on a button that becomes disabled moves to an enabled one.
56
+ **Paging.** Query-bound tables request 20 rows per page; no option changes that. Pages are zero-based. The paginator appears only with more than one page and shows Arc's totals. A page past the last one (rows removed or narrowed) is corrected to the last page, loading meanwhile. The paginator is a named navigation; its current numbered button carries `aria-current="page"`, and focus on a button that becomes disabled moves to an enabled one.
56
57
 
57
58
  **Arguments.** Nothing is sent until every required argument has a value (`undefined`, `null` and empty text count as missing); meanwhile a snapshot table shows `emptyMessage` and an observable table its loading row. Changing an argument reruns or resubscribes and keeps the current page.
58
59
 
59
- **States.** Rerunning the same request keeps the rows, marked busy. A new page or argument set (in server mode also a sort or settled search) is a new request: it shows the loading row unless Arc still caches its result (such as a page just left), shown busy until fresh. A failed, invalid or otherwise unsuccessful query shows a failure row; an unauthorized one an access-denied row. An empty result shows `emptyMessage`; a search or filter with no matches shows `filteredEmptyMessage`, whose default says only the loaded page was searched (neutral in server mode).
60
+ **States.** Rerunning the same request keeps the rows, marked busy. A new page or argument set (in server mode also a sort or settled search) is a new request: it shows the loading row unless Arc still caches its result (such as a page just left), shown busy until fresh. A failed, invalid or unsuccessful query shows a failure row; an unauthorized one an access-denied row. An empty result shows `emptyMessage`; a search or filter with no matches shows `filteredEmptyMessage`, whose default says only the loaded page was searched (neutral in server mode).
60
61
 
61
62
  **Loaded-page processing (default).** Sorting, column filters and search apply only to the 20 loaded rows; the paginator keeps the server total.
62
63
 
@@ -87,7 +88,6 @@ DataPage picks the snapshot or live table from the query type; use an observable
87
88
  | Option | What it does and when to use it |
88
89
  | --- | --- |
89
90
  | `query`, `title`, `emptyMessage` | Required. Generated snapshot or observable query type; page title (not rendered); empty-result text. |
90
- | `children` | `DataPage.MenuItems` and `DataPage.Columns`. |
91
91
  | `dataKey` | Row identity property; set it whenever rows have one. |
92
92
  | `queryArguments` | Generated query arguments. |
93
93
  | `detailsComponent` | Beside the table for the selected row; receives `item` and `onRefresh`. |
@@ -107,7 +107,7 @@ DataPage picks the snapshot or live table from the query type; use an observable
107
107
 
108
108
  | Marker or type | What it does and when to use it |
109
109
  | --- | --- |
110
- | `DataPage.Columns`, `DataPage.MenuItems` | Hold the `Column` markers and the toolbar's items (omit for no toolbar). |
110
+ | `DataPage.Columns`, `DataPage.MenuItems` | DataPage `children`: wrappers for the `Column` markers and for the toolbar's items (omit only the latter). |
111
111
  | `DataPage.MenuItem` `label`, `command` | Button text and accessible name; runs with the selection snapshot. |
112
112
  | `DataPage.MenuItem` `icon` | Icon component **type** (not an element or CSS class); receives a spacing class name. |
113
113
  | `DataPage.MenuItem` `disabled` | Boolean or pure predicate over the selection snapshot. |
@@ -135,10 +135,10 @@ As on DataPage: `query`, `queryArguments`, `emptyMessage`, `dataKey`, selection
135
135
  | `status` | `DataTableStatus` of a host-run query: Ready (default), Loading, Failed, Unauthorized. |
136
136
  | `loadingMessage`, `failureMessage`, `unauthorizedMessage`, `filteredEmptyMessage` | State texts. |
137
137
  | `selectionMode` | Single or multiple; without it rows are not selectable. |
138
- | `selection`, `onSelectionChange` / `selectedItems`, `onSelectedItemsChange` | As on DataPage. |
139
138
  | `selectionAriaLabel`, `selectAllAriaLabel` | Names of the row and select-all controls. |
140
139
  | `onRowClick` | Row clicked or keyboard-activated; receives row and loaded-page index. |
141
140
  | `rowClassName` | Extra class per row (also on cards). |
141
+ | `selection`, `onSelectionChange` / `selectedItems`, `onSelectedItemsChange` | Host-held selection: store each change and pass it back. |
142
142
  | `globalFilterFields`, `globalSearchPlaceholder`, `globalSearchAriaLabel` | As on DataPage. |
143
143
  | `globalFilter`, `onGlobalFilterChange` | Control or observe the search text. |
144
144
  | `defaultFilters`; `filters`, `onFilter` | Initial filters; control or observe applied filters. |
@@ -148,7 +148,7 @@ As on DataPage: `query`, `queryArguments`, `emptyMessage`, `dataKey`, selection
148
148
  | `className`, `style`, `pt` | Style the root or parts. |
149
149
  | `mobileLayout`, `mobileBreakpoint` | Mobile cards. |
150
150
 
151
- Deprecated options (listed in [parts-and-messages.md](references/parts-and-messages.md)) have no effect; omit them.
151
+ Deprecated options ([parts-and-messages.md](references/parts-and-messages.md)) have no effect; omit them.
152
152
 
153
153
  ### Column
154
154
 
@@ -207,9 +207,9 @@ Custom names start with a letter and use letters, digits, `.`, `:`, `_` or `-`;
207
207
  | `DataTableSort`, `DataTableSortDirection` | Controlled sort: field plus Ascending or Descending. |
208
208
  | `DataTableSelectionChangeEvent`, `DataTableRowClickEvent` | New row or `null`, with the triggering event unless from a refresh; activated row and loaded-page index. |
209
209
  | Table, paginator and column-filter parts | Style or label one element through `pt`, `tablePt`, `paginatorPt` or `filterPt`; every part name is in [parts-and-messages.md](references/parts-and-messages.md). |
210
- | Provider `dataTable`, `paginator`, `columnFilter` messages and icons | Product-wide texts and sort and paging glyphs; every key is in [parts-and-messages.md](references/parts-and-messages.md). |
210
+ | Provider `dataTable`, `paginator`, `columnFilter` messages and icons | Product-wide texts and sort and paging glyphs; every key is in the same reference. |
211
211
 
212
- Set product-wide texts once on the provider (see `cratis-components-theme-application`). Other type names are under Types in your language reference.
212
+ Set product-wide texts once on the provider (see `cratis-components-theme-application`). Other types: see Types in your language reference.
213
213
 
214
214
  ## Limits and alternatives
215
215
 
@@ -0,0 +1,74 @@
1
+ # Custom panel over a query in TypeScript (React)
2
+
3
+ ## Contents
4
+
5
+ - When to use it
6
+ - Default: the query hook and the tables' state order
7
+ - What each state shows
8
+ - Avoid
9
+
10
+ Names (`AllShipments`) and generated import paths are illustrative.
11
+
12
+ ## When to use it
13
+
14
+ Use this when the screen needs the query's values rather than a table: a count, a summary, custom cards. Call the hook on the generated query and render the values yourself. For rows in a table, use DataPage or a query table instead; they run the query and show these states themselves.
15
+
16
+ The hook itself (arguments, conditional queries, paging, Suspense) is covered by `cratis-arc-react-bind-slice`, `references/typescript-queries.md`. This reference covers only how a custom panel shows the same states as the tables.
17
+
18
+ ## Default: the query hook and the tables' state order
19
+
20
+ `resolveDataTableStatus` from `@cratis/components/DataTables` turns a query result into a `DataTableStatus` with the mapping the query tables use. It accepts the result of a snapshot or an observable query hook.
21
+
22
+ ```tsx
23
+ import { DataTableStatus, resolveDataTableStatus } from '@cratis/components/DataTables';
24
+ import { AllShipments } from './AllShipments';
25
+
26
+ export const ShipmentCount = () => {
27
+ const [shipments] = AllShipments.use();
28
+ const status = resolveDataTableStatus(shipments);
29
+ const hasValues = shipments.isReady && shipments.isSuccess;
30
+
31
+ if (status === DataTableStatus.Unauthorized) return <p role="alert">You do not have access to shipments.</p>;
32
+ if (status === DataTableStatus.Failed) return <p role="alert">Shipments could not be loaded.</p>;
33
+ if (status === DataTableStatus.Loading && !hasValues) return <p role="status">Loading shipments…</p>;
34
+
35
+ return <p aria-busy={status === DataTableStatus.Loading}>{shipments.data.length} shipments</p>;
36
+ };
37
+ ```
38
+
39
+ The function checks the result in this order and returns the first match:
40
+
41
+ | Order | Result | Status |
42
+ | --- | --- | --- |
43
+ | 1 | `isAuthorized` is false | Unauthorized |
44
+ | 2 | `hasExceptions` is true, or `isValid` is false | Failed |
45
+ | 3 | `isPerforming` is true, or `isReady` is false | Loading |
46
+ | 4 | `isSuccess` is false | Failed |
47
+ | 5 | Anything else | Ready |
48
+
49
+ A panel that branches on the flags by hand must keep this order: a result that is unauthorized, has exceptions or is invalid is shown as denied or failed even while it is still performing. `isSuccess` being false is different: while the query is performing it is Loading, and only on a settled result is it a failure (never an empty result).
50
+
51
+ `QueryStatusFlags` (same import) is the parameter type, for a helper of your own that takes a result.
52
+
53
+ ## What each state shows
54
+
55
+ - **Unauthorized, Failed:** a message instead of the values. Never show server exception text to the user.
56
+ - **Loading before a result** (`isReady` is false): a loading indicator. The first result of a query, and of a new argument set that is not cached, is not ready: it is loading, never zero items. Test `isReady`, not `hasData`: a single-item query starts from an empty placeholder object, which `hasData` counts as data, so the panel would render blank values. `hasData` only tells you whether a collection holds items.
57
+ - **Loading with a successful result** (`isReady` and `isSuccess` are both true): keep the values on screen and mark them busy. This is a rerun, for example after the snapshot hook's perform delegate is called.
58
+ - **Loading with an unsuccessful result** (`isReady` is true, `isSuccess` is false): a loading indicator. This is a retry after a settled failure, such as a response that could not be read. Its data is the query's default value, not a result, so showing it would read as zero items.
59
+ - **Ready:** the values. Show the empty text only here, when the successful result holds no items.
60
+
61
+ To refresh the same request, pass the perform delegate the arguments the hook was given. The delegate sends only the arguments it receives, so call it without arguments only for a query that takes none; a query with a required argument fails when refreshed that way. Called with other arguments it keeps the previous values on screen while the new request runs. Pass changed arguments to the hook instead, so a new selection shows loading and not the previous selection's values.
62
+
63
+ A query that still waits for a required argument is not one of these states. Check the argument first and show a prompt before reading the result (the conditional form is in `cratis-arc-react-bind-slice`, `references/typescript-queries.md`). The result alone cannot tell you: without its required argument a snapshot query resolves to Failed and an observable one stays Loading, and a conditional query that is switched off resolves to Ready with the query's default value.
64
+
65
+ ## Avoid
66
+
67
+ - Treating a result that is not ready as an empty one ("0 shipments" while the first result is pending).
68
+ - Showing the empty text for a failed or unauthorized result.
69
+ - Checking loading before unauthorized and failed.
70
+ - Replacing a successful result's values with a loading indicator on every refresh.
71
+ - Keeping the values on screen while a failed result is retried.
72
+ - Calling the perform delegate without arguments on a query that takes arguments.
73
+ - Using `hasData` to decide whether a single-item result has arrived.
74
+ - Passing a new selection's arguments to the perform delegate instead of to the hook.
@@ -34,17 +34,12 @@ Import from `@cratis/components/DataTables` unless noted. Names are illustrative
34
34
 
35
35
  ## DataTableCore with TablePaginator
36
36
 
37
- Use this when the host runs the query itself, for example with another page size. A snapshot query's paged hook returns the result, perform, set-sorting, set-page and set-page-size delegates in that order; an observable query's has no perform, so set-page is third. Map the result to `DataTableStatus` in the same order the query tables do, ending with the unsuccessful check so a settled failure never renders as an empty success. A snapshot query that was not sent because a required argument is missing also settles as unsuccessful; show it as waiting (for example `emptyMessage` with Ready) rather than failed. `TablePaginator` only reports page requests; the current page and totals come from the result.
37
+ Use this when the host runs the query itself, for example with another page size. A snapshot query's paged hook returns the result, perform, set-sorting, set-page and set-page-size delegates in that order; an observable query's has no perform, so set-page is third. Derive `status` with `resolveDataTableStatus(result)`, the mapping the query tables use, so a settled failure never renders as an empty success (the order is in [typescript-custom-panel.md](typescript-custom-panel.md)). A snapshot query that was not sent because a required argument is missing also settles as unsuccessful; show it as waiting (for example `emptyMessage` with Ready) rather than failed. `TablePaginator` only reports page requests; the current page and totals come from the result.
38
38
 
39
39
  ```tsx
40
40
  const [result, , , setPage] = AllReadings.useWithPaging(50);
41
- const status = result.isAuthorized === false ? DataTableStatus.Unauthorized
42
- : result.hasExceptions || result.isValid === false ? DataTableStatus.Failed
43
- : result.isPerforming || !result.isReady ? DataTableStatus.Loading
44
- : !result.isSuccess ? DataTableStatus.Failed
45
- : DataTableStatus.Ready;
46
41
 
47
- <DataTableCore<Reading> data={result.data} dataKey="id" emptyMessage="No readings" status={status}
42
+ <DataTableCore<Reading> data={result.data} dataKey="id" emptyMessage="No readings" status={resolveDataTableStatus(result)}
48
43
  pt={{ table: { 'aria-label': 'Readings' } }}>
49
44
  <Column field="sensor" header="Sensor" sortable />
50
45
  <Column field="value" header="Value" dataType="numeric" filter />
@@ -19,7 +19,7 @@ Names (`AllShipments`, `Shipment`, `SearchShipments`, host callbacks) and genera
19
19
 
20
20
  ```tsx
21
21
  import { DataPage, Column, type DataPageSelection, type IDetailsComponentProps } from '@cratis/components/DataPage';
22
- import { DataTableForQuery, DataTableForObservableQuery, DataTableCore, TablePaginator, DataTableStatus } from '@cratis/components/DataTables';
22
+ import { DataTableForQuery, DataTableForObservableQuery, DataTableCore, TablePaginator, DataTableStatus, resolveDataTableStatus } from '@cratis/components/DataTables';
23
23
  import { CratisComponentsProvider } from '@cratis/components';
24
24
  ```
25
25
 
@@ -197,8 +197,9 @@ A `sortFields` value (or the column `field` when unlisted) is sent as the server
197
197
 
198
198
  From `@cratis/components/DataPage`: `DataPageProps`, `MenuItemProps`, `MenuItemsProps`, `ColumnsProps`, `IDetailsComponentProps`, `DataPageSelection`, `ColumnProps`.
199
199
 
200
- From `@cratis/components/DataTables`: `ColumnProps`, `DataTableCoreProps`, `DataTableForQueryProps`, `DataTableForObservableQueryProps`, `DataTableMobileLayoutProps`, `DataTableServerQuery`, `DataTableServerQueryState`, `DataTableFilterMeta`, `DataTableFilterEntry`, `DataTableFilterConstraint`, `DataTableOperatorFilterConstraint`, `DataTableFilterMatchMode` (a constant object and its type), `DataTableFilterMatcher`, `DataTableCustomFilterMatchMode`, `DataTableFilterMatcherRegistration`, `ColumnFilterDataType` (`'text' | 'numeric' | 'date' | 'boolean'`), `ColumnFilterOption`, `ColumnFilterElement`, `ColumnFilterElementOptions`, `ColumnFilterMenuProps`, `ColumnFilterMenuLabels`, `ColumnFilterMenuParts`, `TablePaginatorProps`, `TablePaginatorParts`, `PaginatorPageItem`, `DataTableParts`, `DataTableSort`, `DataTableSelectionChangeEvent`, `DataTableRowClickEvent`. Enums: `DataTableStatus`, `DataTableRowProcessing`, `DataTableSortDirection`.
200
+ From `@cratis/components/DataTables`: `ColumnProps`, `DataTableCoreProps`, `DataTableForQueryProps`, `DataTableForObservableQueryProps`, `DataTableMobileLayoutProps`, `DataTableServerQuery`, `DataTableServerQueryState`, `DataTableFilterMeta`, `DataTableFilterEntry`, `DataTableFilterConstraint`, `DataTableOperatorFilterConstraint`, `DataTableFilterMatchMode` (a constant object and its type), `DataTableFilterMatcher`, `DataTableCustomFilterMatchMode`, `DataTableFilterMatcherRegistration`, `ColumnFilterDataType` (`'text' | 'numeric' | 'date' | 'boolean'`), `ColumnFilterOption`, `ColumnFilterElement`, `ColumnFilterElementOptions`, `ColumnFilterMenuProps`, `ColumnFilterMenuLabels`, `ColumnFilterMenuParts`, `TablePaginatorProps`, `TablePaginatorParts`, `PaginatorPageItem`, `DataTableParts`, `DataTableSort`, `DataTableSelectionChangeEvent`, `DataTableRowClickEvent`, `QueryStatusFlags`. Enums: `DataTableStatus`, `DataTableRowProcessing`, `DataTableSortDirection`.
201
201
 
202
202
  ## Topic references
203
203
 
204
204
  - [typescript-datatables.md](typescript-datatables.md): query tables, `DataTableCore` with `TablePaginator`, rows from a view model, server-driven `DataTableCore`, column filters, `ColumnFilterMenu`, custom matchers, mobile cards, and provider texts and icons.
205
+ - [typescript-custom-panel.md](typescript-custom-panel.md): read when the screen needs a query's values rather than a table (a count, a summary, custom cards) and must show the same unauthorized, failed, loading and ready states as the tables.