@jskit-ai/agent-docs 0.1.54 → 0.1.55

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.
@@ -454,7 +454,8 @@ This is the list-page container.
454
454
  Its job is usually to:
455
455
 
456
456
  - call `useCrudListScreen()`
457
- - pass page-local `listFilters` and `listBulkActions`
457
+ - pass page-local `listFilters`, `listBulkActions`, and `listRowActions` when needed
458
+ - pass `syntheticRows` when the page needs non-CRUD display rows such as an owner/master row
458
459
  - render the shared `CrudListScreen`
459
460
  - resolve list/view/edit/new URLs
460
461
  - pass route query state through when navigating deeper
@@ -470,6 +471,8 @@ Its job is usually to:
470
471
  - call `useCrudViewScreen()`
471
472
  - render the shared `CrudViewScreen`
472
473
  - resolve "back" and "edit" navigation
474
+ - pass read options such as `requestQueryParams`, `readEnabled`, and `queryKeyFactory` when the detail read needs them
475
+ - use the shared view slots for page-specific sections around the generated field list
473
476
 
474
477
  Again, the runtime behavior is mostly uphill. The page is a route-level composition layer.
475
478
 
@@ -822,6 +825,8 @@ Use this rule of thumb when deciding where to edit:
822
825
  | Change SQL, joins, parent filters, or advanced search | `repository.js` | This is the data-access layer |
823
826
  | Add cross-record or domain rules on save/delete | `service.js` | This is business logic |
824
827
  | Change shared CRUD screen chrome, load states, or retry behavior | `users-web` shared screen components | Generated pages consume the shared screen contract |
828
+ | Add per-row commands to a generated list page | page-local `listRowActions.js`, usually calling `useCommand()`-backed composables | The shared list screen renders action chrome; the page owns explicit mutation behavior |
829
+ | Add non-CRUD display rows to a generated list page | route page `syntheticRows` input | Synthetic rows are presentation rows, not repository records |
825
830
  | Change page-specific display behavior | the route pages, generated slots, and app-owned composables | This is presentation |
826
831
  | Change form field layout and inputs | `_components/CrudAddEditForm.vue` and `CrudAddEditFormFields.js` | This is the generated form field layer |
827
832
 
@@ -832,6 +837,7 @@ The baseline generator output is only the start. As the tutorial's `contacts`, `
832
837
  - `src/server/listQueryValidators.js` when a list needs extra query filters beyond `q`
833
838
  - `src/server/service.test.js` once save/delete rules stop being trivial
834
839
  - `packages/contacts/src/shared/contactListFilters.js` when the contacts CRUD gains structured list filters that both server and client should share
840
+ - `src/pages/.../contacts/listRowActions.js` when a generated list needs row-level commands such as Delete, Block, or Unblock
835
841
  - `src/composables/addresses/useAddressDisplay.js` when addresses need app-specific display formatting
836
842
  - `src/composables/comments/useCommentsListRuntime.js` when an embedded comments list needs local UI state
837
843
 
@@ -840,6 +846,55 @@ That is the right direction of growth:
840
846
  - server customizations stay in the CRUD package
841
847
  - presentation and page-specific UI state stay in app-owned client files
842
848
  - shared structured list filters live best in a CRUD-package shared module that both server and client can import
849
+ - shared generated screen chrome stays in `users-web`; adapted pages feed it definitions, slots, and explicit command handlers
850
+
851
+ ### Detail read options and extension slots
852
+
853
+ Use the shared detail screen first, even when the detail page needs includes or domain sections.
854
+
855
+ `useCrudViewScreen(...)` accepts the same read-pass-through options that adapted detail pages usually need:
856
+
857
+ - `requestQueryParams`
858
+ - `readEnabled`
859
+ - `queryKeyFactory`
860
+
861
+ For example:
862
+
863
+ ```js
864
+ const screen = useCrudViewScreen({
865
+ resource: drumResource,
866
+ apiUrlTemplate: "/drums/:recordId",
867
+ requestQueryParams() {
868
+ return {
869
+ include: "drumSpecId,locationId,contents,contents.processingLotId"
870
+ };
871
+ }
872
+ });
873
+ ```
874
+
875
+ Render domain sections through `CrudViewScreen` slots instead of replacing the shared load/error/retry chrome:
876
+
877
+ ```vue
878
+ <CrudViewScreen :screen="screen" resource-singular-title="Drum">
879
+ <template #before-fields="{ view }">
880
+ <DrumArrivalSummary :drum="view.record" />
881
+ </template>
882
+
883
+ <template #fields="{ view }">
884
+ <GeneratedDrumFields :record="view.record" />
885
+ </template>
886
+
887
+ <template #after-fields="{ view }">
888
+ <DrumProvenancePanel :drum="view.record" />
889
+ </template>
890
+
891
+ <template #supporting-content="{ view }">
892
+ <DrumContentsPanel :drum="view.record" />
893
+ </template>
894
+ </CrudViewScreen>
895
+ ```
896
+
897
+ The screen still owns loading, not-found, retry, title, back/edit actions, and responsive shell structure. The page owns only the domain panels.
843
898
 
844
899
  ## Search and filters: the deep dive
845
900
 
@@ -1146,11 +1201,96 @@ The generated runtime passes action handlers:
1146
1201
 
1147
1202
  Keep bulk action definitions page-local unless another page needs to share them.
1148
1203
 
1204
+ ### Pattern 3C: row actions and synthetic display rows
1205
+
1206
+ Generated CRUD list pages can keep the shared list screen while adding per-row actions and non-CRUD display rows.
1207
+
1208
+ Use row actions for explicit commands on one record. JSKIT renders the action menu in card and table layouts, tracks per-row execution state, and passes the handler enough context to run app-owned commands. It does not invent or auto-replay writes.
1209
+
1210
+ For example:
1211
+
1212
+ ```js
1213
+ import { defineCrudListRowActions } from "@jskit-ai/users-web/client/rowActions";
1214
+
1215
+ const listRowActions = defineCrudListRowActions([
1216
+ {
1217
+ key: "delete",
1218
+ label: "Delete",
1219
+ color: "error",
1220
+ visible: ({ record }) => record.isOwnerRow !== true,
1221
+ disabled: ({ record }) => record.isOwnerRow === true,
1222
+ loading: ({ record }) => deleteCommand.isRunningFor(record.id),
1223
+ async run({ record, reload }) {
1224
+ await deleteCommand.runFor(record);
1225
+ await reload();
1226
+ }
1227
+ }
1228
+ ]);
1229
+
1230
+ export { listRowActions };
1231
+ ```
1232
+
1233
+ Pass the actions into the generated list screen:
1234
+
1235
+ ```js
1236
+ import { listRowActions } from "./listRowActions.js";
1237
+
1238
+ const screen = useCrudListScreen({
1239
+ resource: uiResource,
1240
+ apiSuffix: "/allowed-login-emails",
1241
+ listRowActions
1242
+ });
1243
+ ```
1244
+
1245
+ The row-action handler receives:
1246
+
1247
+ - `action`
1248
+ - `record`
1249
+ - `index`
1250
+ - `recordId`
1251
+ - `records`
1252
+ - `reload`
1253
+
1254
+ Use `syntheticRows` when the page needs display rows that do not come from the CRUD list response, such as an owner row at the top of an allowlist. An array is prepended by default. Use `{ prepend, append }` when placement matters.
1255
+
1256
+ ```js
1257
+ const ownerRows = computed(() => owner.value
1258
+ ? [
1259
+ {
1260
+ key: "owner",
1261
+ record: {
1262
+ id: owner.value.id,
1263
+ email: owner.value.email,
1264
+ role: "Owner",
1265
+ isOwnerRow: true
1266
+ }
1267
+ }
1268
+ ]
1269
+ : []);
1270
+
1271
+ const screen = useCrudListScreen({
1272
+ resource: uiResource,
1273
+ apiSuffix: "/allowed-login-emails",
1274
+ listRowActions,
1275
+ syntheticRows: ownerRows
1276
+ });
1277
+ ```
1278
+
1279
+ Synthetic rows:
1280
+
1281
+ - render in the same card/table layouts as real rows
1282
+ - do not get standard Open/Edit CRUD navigation
1283
+ - are excluded from bulk selection by default
1284
+ - can still participate in row-action visibility/disabled logic
1285
+
1286
+ Use this seam for display rows only. If a row should be persisted, it should come from the CRUD list response.
1287
+
1149
1288
  #### Exact file checklist
1150
1289
 
1151
1290
  For a generated CRUD, treat this as the concrete file plan:
1152
1291
 
1153
1292
  - edit `src/pages/.../contacts/listFilters.js`
1293
+ - create `src/pages/.../contacts/listRowActions.js` when the list needs row-level commands
1154
1294
  - make sure the matching server route/action/repository code accepts and applies the declared query params when filters are server-backed
1155
1295
 
1156
1296
  If the filter contract should be shared with server code, promote it into a CRUD package module and import it from both sides:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/agent-docs",
3
- "version": "0.1.54",
3
+ "version": "0.1.55",
4
4
  "description": "Distributed JSKIT agent references, prompts, guides, and generated reference maps.",
5
5
  "type": "module",
6
6
  "files": [
package/patterns/INDEX.md CHANGED
@@ -30,7 +30,7 @@ How to use it:
30
30
  - `client-requests.md`
31
31
  - playwright, browser test, e2e, ui verification, authenticated ui test, test auth, dev login as, dev auth bypass
32
32
  - `ui-testing.md`
33
- - generated UI contract, design contract, navigation roles, density, placeholder copy, card shells, shared CRUD screens
33
+ - generated UI contract, design contract, navigation roles, density, placeholder copy, card shells, shared CRUD screens, row actions, synthetic rows, detail slots
34
34
  - `generated-ui-contract-tracking.md`
35
35
  - filter, filters, search facets, chips, date range, enum filter, lookup filter, `useCrudListFilters`, `createCrudListFilters`
36
36
  - `filters.md`
@@ -44,6 +44,14 @@ Use the shared CRUD screen wrappers when the route is a generated CRUD page:
44
44
  - `useCrudViewScreen()` plus `CrudViewScreen` for record view route pages
45
45
  - `useCrudAddEditScreen()` plus `CrudAddEditScreen` for generated new/edit route pages
46
46
 
47
+ Generated screen wrapper extension rules:
48
+
49
+ - Use `useCrudViewScreen({ requestQueryParams })` for detail includes instead of putting query strings in `apiUrlTemplate`.
50
+ - Use `readEnabled` and `queryKeyFactory` on `useCrudViewScreen()` when the detail read needs the same gating or cache identity control as `useCrudView()`.
51
+ - Use `CrudViewScreen` slots (`before-fields`, `fields`, `after-fields`, `supporting-content`) for page-specific domain sections while keeping shared load/error/retry chrome.
52
+ - Use `listRowActions` with `defineCrudListRowActions(...)` for row-level commands in `CrudListScreen`.
53
+ - Use `syntheticRows` for display-only rows that do not come from the CRUD response, such as owner/master rows.
54
+
47
55
  Use the CRUD wrappers when they fit:
48
56
 
49
57
  - `useCrudList()` for routed CRUD lists
@@ -86,5 +94,6 @@ Avoid:
86
94
  - manually concatenating scoped route params into API URLs
87
95
  - using a lower-level seam when a higher-level routed CRUD or command runtime already fits
88
96
  - smuggling query params into `apiUrlTemplate`
97
+ - replacing `CrudListScreen` or `CrudViewScreen` only to add row actions, synthetic display rows, includes, or domain detail sections
89
98
  - reporting routine resource load errors through hand-written global snackbar/banner calls
90
99
  - calling `useShellRequestRecoveryRuntime().report(...)` from normal panels just to recover an HTTP read
@@ -29,7 +29,8 @@ Rules:
29
29
  - Generated CRUD list screens need real loading, empty, and error states. Empty copy should name the resource, such as "No customers yet", and offer the create action when available.
30
30
  - Generated CRUD view/new/edit screens should use page headers plus direct sheet panels. Do not use generic card shells as the page architecture.
31
31
  - Compact CRUD actions should be reachable without a drawer. Use a mobile-visible primary action or FAB for create flows.
32
- - Row actions should collapse into an overflow/action menu on compact widths and can be inline on wider layouts.
32
+ - Row actions should be declared with `defineCrudListRowActions(...)` in a page-local `listRowActions.js` and passed into `useCrudListScreen(...)`; the shared list screen owns the compact/wide action rendering.
33
+ - Use `syntheticRows` for display-only owner/master rows that should appear inside the shared list layout without becoming CRUD records.
33
34
  - Bulk actions should be declared in the generated page-local `listBulkActions.js`. The generated list owns selection state, keeps selection controls hidden until actions exist, and exposes selected ids/records to action handlers.
34
35
  - Structured filters should use shared filter definitions and collapse to compact filter controls/sheets when they outgrow simple search. Do not stack dense desktop filter bars on phone widths.
35
36
  - Use `--navigation-role` for CRUD list placement intent. Main resources can stay `primary`; nested/detail/workflow CRUD routes should usually be `secondary`, `workflow`, or `none`.
@@ -57,6 +57,9 @@ Generated JSKIT apps should feel like real adaptive apps by default, not framewo
57
57
  - Item 6 is complete for the default shell: compact app bars use compact density and bounded top-left/top-right regions, while primary navigation remains in semantic bottom navigation instead of app-bar chrome.
58
58
  - CRUD filters are client-side by default: generated list pages create a page-local `listFilters.js` and pass it into `useCrudListScreen(...)`; the shared list screen wires `filterRuntime.queryParams` into the list request and renders `CrudListFilterSurface`. When server filtering is needed, promote the definitions into a shared package module and use `createCrudListFilterContract(...)` so route/action validators, JSON REST search schema, and repository query normalization stay derived from the same definition.
59
59
  - CRUD bulk actions are client-side by default: generated list pages create a page-local `listBulkActions.js` and pass it into `useCrudListScreen(...)`; the shared list screen wires `useCrudListBulkActions(...)` and keeps selection controls hidden until actions are declared.
60
- - Generated CRUD page templates delegate their screen chrome to shared `users-web` screen components (`CrudListScreen`, `CrudViewScreen`, and `CrudAddEditScreen`) so list/view/form load states, retry actions, responsive shell layout, filters, and bulk actions do not drift across generated pages.
60
+ - CRUD row actions are client-side by default: generated list pages can create a page-local `listRowActions.js` with `defineCrudListRowActions(...)` and pass it into `useCrudListScreen(...)`; the shared list screen renders per-row actions in card and table layouts while action handlers stay explicit and page-owned.
61
+ - CRUD synthetic rows are display-only: pass `syntheticRows` into `useCrudListScreen(...)` for owner/master rows that are not repository records. Synthetic rows render through the shared list screen, skip standard Open/Edit links, and are excluded from bulk selection unless explicitly marked selectable.
62
+ - Generated CRUD page templates delegate their screen chrome to shared `users-web` screen components (`CrudListScreen`, `CrudViewScreen`, and `CrudAddEditScreen`) so list/view/form load states, retry actions, responsive shell layout, filters, bulk actions, row actions, and detail slots do not drift across generated pages.
63
+ - Generated CRUD detail pages should use `useCrudViewScreen({ requestQueryParams, readEnabled, queryKeyFactory })` for read pass-throughs and `CrudViewScreen` slots (`before-fields`, `fields`, `after-fields`, `supporting-content`) for domain sections instead of replacing the shared detail chrome.
61
64
  - Routine resource-load errors stay local to the generated screen and retry affordance. Action feedback uses the shell error policy through `action-feedback`.
62
65
  - `page.supporting-content` is a semantic supporting region in the default shell. Compact layout renders it as a closed bottom sheet; medium/expanded layouts render it as a closed side panel.
@@ -66,6 +66,14 @@ Local functions
66
66
  - `clearChip(chip = {})`
67
67
  - `clearFilters()`
68
68
 
69
+ ### `src/client/components/CrudListRecordActionMenu.vue`
70
+ Exports
71
+ - None
72
+ Local functions
73
+ - `isRowActionLoading(action = {})`
74
+ - `isRowActionDisabled(action = {})`
75
+ - `runRowAction(action = {})`
76
+
69
77
  ### `src/client/components/CrudListScreen.vue`
70
78
  Exports
71
79
  - None
@@ -74,6 +82,12 @@ Local functions
74
82
  - `formatListCardValue(value)`
75
83
  - `resolveViewLocation(record)`
76
84
  - `resolveEditLocation(record)`
85
+ - `hasRowActionsFor(record, index)`
86
+ - `isBulkRowSelected(row = {})`
87
+ - `setBulkRowSelected(row = {}, selected = true)`
88
+ - `allSelectableRowsSelected()`
89
+ - `someSelectableRowsSelected()`
90
+ - `setSelectableRowsSelected(selected = true)`
77
91
 
78
92
  ### `src/client/components/CrudViewScreen.vue`
79
93
  Exports
@@ -484,15 +498,30 @@ Exports
484
498
  Local functions
485
499
  - `normalizeQueryKeyPrefix(value = [])`
486
500
 
501
+ ### `src/client/composables/useCrudListRowActions.js`
502
+ Exports
503
+ - `useCrudListRowActions(actions = [], { resolveRecordId = null, resolveContext = null } = {})`
504
+ Local functions
505
+ - `normalizeRowActionKey(actionOrKey = "")`
506
+ - `normalizeRowId(value = "")`
507
+ - `createExecutionKey(actionKey = "", recordId = "", index = 0)`
508
+ - `asContextObject(value = null)`
509
+
487
510
  ### `src/client/composables/useCrudListScreen.js`
488
511
  Exports
489
- - `useCrudListScreen({ adapter = null, resource = null, resourceNamespace = "resource", apiSuffix = "", recordIdParam = "recordId", recordIdSelector = null, titleFallbackFieldKey = "", viewUrlTemplate = "", editUrlTemplate = "", newUrlTemplate = "", recordChangedEvents = [], listFilters = {}, listBulkActions = [], routeQueryBlacklist = Object.freeze(["include", "cursor", "limit"]), requestRecoveryLabel = "Records", fallbackLoadError = "Unable to load records." } = {})`
512
+ - `useCrudListScreen({ adapter = null, resource = null, resourceNamespace = "resource", apiSuffix = "", recordIdParam = "recordId", recordIdSelector = null, titleFallbackFieldKey = "", viewUrlTemplate = "", editUrlTemplate = "", newUrlTemplate = "", recordChangedEvents = [], listFilters = {}, listBulkActions = [], listRowActions = [], syntheticRows = null, routeQueryBlacklist = Object.freeze(["include", "cursor", "limit"]), requestQueryParams = null, requestRecoveryLabel = "Records", fallbackLoadError = "Unable to load records." } = {})`
490
513
  Local functions
491
514
  - `formatCrudListCardValue(value)`
515
+ - `asList(value = [])`
516
+ - `hasSyntheticRowGroups(value = null)`
517
+ - `normalizeSyntheticDisplayRow(source = null, index = 0, placement = "prepend")`
518
+ - `normalizeSyntheticDisplayRows(value = [], placement = "prepend")`
519
+ - `normalizeSyntheticDisplayRowGroups(syntheticRows = null)`
520
+ - `createCrudListDisplayRow(record = {}, index = 0, records = {})`
492
521
 
493
522
  ### `src/client/composables/useCrudViewScreen.js`
494
523
  Exports
495
- - `useCrudViewScreen({ adapter = null, resource = null, resourceNamespace = "resource", apiUrlTemplate = "", recordIdParam = "recordId", titleFallbackFieldKey = "", listUrlTemplate = "", editUrlTemplate = "", recordChangedEvent = "", requestRecoveryLabel = "Record", fallbackLoadError = "Unable to load record.", notFoundMessage = "Record not found." } = {})`
524
+ - `useCrudViewScreen({ adapter = null, resource = null, resourceNamespace = "resource", apiUrlTemplate = "", recordIdParam = "recordId", titleFallbackFieldKey = "", listUrlTemplate = "", editUrlTemplate = "", recordChangedEvent = "", requestQueryParams = null, readEnabled = true, queryKeyFactory = null, requestRecoveryLabel = "Record", fallbackLoadError = "Unable to load record.", notFoundMessage = "Record not found." } = {})`
496
525
 
497
526
  ### `src/client/composables/usePagedCollection.js`
498
527
  Exports
@@ -605,6 +634,12 @@ Local functions
605
634
  Exports
606
635
  - `UsersWebClientProvider`
607
636
 
637
+ ### `src/client/rowActions.js`
638
+ Exports
639
+ - `defineCrudListRowActions(actions = [])`
640
+ Local functions
641
+ - `normalizeCrudListRowAction(rawAction = {}, index = 0)`
642
+
608
643
  ### `src/client/support/contractGuards.js`
609
644
  Exports
610
645
  - `requireRecord(value, label = "value", owner = "Contract")`