docblocks-react-ui 0.27.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # docblocks-react-ui
2
2
 
3
+ ## 0.29.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ec77e46: The enum catalog is the consumer's structure: `createColumn` carries the
8
+ column's initial `enumOptions`, and the consumer creates the hidden
9
+ dictionary (plus the `many` junction where it keeps one) inside that one
10
+ operation, returning the ids in the column's reference (`tableId` /
11
+ `displayColumnId` / `colorColumnId` / `junctionTableId`). The client no
12
+ longer creates, names, or slug-derives catalog tables, and reads the
13
+ catalog's label / color columns by the declared ids instead of the `name` /
14
+ `color` convention.
15
+ - 8fc81cd: The grid surfaces failed writes: the bridge's typed rejection stands an
16
+ overlay note with the consumer's localized message (the reader closes it
17
+ with the ×; no auto-hide), and the machine code stays on the `data-code`
18
+ hook. `useDatabaseTable`'s `error` / `errorCode` remain the same state for
19
+ consumer-owned surfaces.
20
+ - 2bb955f: Add the database view's multi-key sort (`sort` block attr, the toolbar's sort control, the server-sorted reads over the bridge's `SortInput`) and the consumer-declarable system columns (the `Column.system` role `id` / `created` / `updated` over the row wire's instants: read-only, copyable, monospace id, localized instants, pinned last).
21
+ - 8b40d24: Replace the database filter's native selects with the package's popover pickers: the condition's field, the enum and row-link values (the cell editors' option and row lists, the display label on the trigger and the ref's id in the payload), and the boolean value — two options with no empty entry. The boolean column's catalog keeps the `is` / `is not` operators only, and its create spec sends the column non-nullable.
22
+
23
+ ### Patch Changes
24
+
25
+ - 844d473: Column patches carry the column's live revision as `ctx.expectedRevision`:
26
+ a concurrent writer's change rejects the stale patch with `conflict` and the
27
+ client re-reads the schema and retries once over the fresh revision. A stale
28
+ view (a column deleted outside the grid) heals on load: the first read's
29
+ `invalid_*` rejection stands a schema read, the filter / sort are normalized
30
+ over it, the read retries, and the block's attrs are repaired.
31
+ - ee977ec: Deleting a column prunes the block's view before the bridge call: the filter
32
+ conditions (and the groups left empty), the sort keys, the column-order /
33
+ hidden entries and the positional width leave the view in the same action (a
34
+ failed delete rolls the prune back), so the delete's refetch never sends the
35
+ deleted column. The rendered filter / sort also derive over the live schema.
36
+ - cd2d3f2: The page chunk size is the consumer's default: the grid no longer sends a
37
+ hardcoded `limit` on its reads — the query's optional `limit` stays absent
38
+ (the consumer's default page applies; the negotiated `maxPageSize` remains
39
+ its ceiling) and the client paginates to the tail over the opaque cursor.
40
+ - 16eb238: The grid's column widths are fixed: a column without a committed width
41
+ stands the 160 px default track (the content width is the tracks' sum — a
42
+ wider table scrolls horizontally, a narrower one never stretches), and the
43
+ trailing rail (the rows' menu / the add-column cell) stays pinned at the
44
+ scroller's right edge while the columns scroll under it.
45
+ - Updated dependencies [2bb955f]
46
+ - docblocks-core@0.12.0
47
+
48
+ ## 0.28.0
49
+
50
+ ### Minor Changes
51
+
52
+ - 4f81883: Add database range actions, localized filter operators, flicker-free filter refetches, and typed grid clipboard round-trips with paste-range highlighting.
53
+
3
54
  ## 0.27.0
4
55
 
5
56
  ### Minor Changes
package/README.md CHANGED
@@ -558,14 +558,35 @@ retries:
558
558
  limits) — the client negotiates it before any use; a version /
559
559
  baseline-capability mismatch stands the `protocol_mismatch`, not a
560
560
  silent downgrade
561
- - catalog: `listTables`, `createTable`, `renameTable`, `describeTable`
561
+ - catalog: `listTables`, `createTable`, `renameTable`, `describeTable`.
562
+ The table name is a display label, never the identity: the consumer
563
+ assigns the id and duplicate names are legal — the package derives
564
+ nothing from a name. A consumer may reject a name by its own policy
565
+ (a `validation` rejection with its own localized message; there is no
566
+ `name-taken` code in the closed vocabulary).
562
567
  - schema: `createColumn`, `updateColumn`, `renameColumn` (the `name` key
563
568
  of `updateColumn`), `deleteColumn`, `restoreDeletedColumn` (the
564
- soft-delete posture)
569
+ soft-delete posture). A column patch carries the column's revision as
570
+ `ctx.expectedRevision` (the CAS): a concurrent writer's change rejects
571
+ the stale patch with `conflict`, and the client re-reads the schema and
572
+ retries once over the fresh revision instead of silently overwriting
573
+ state it never saw. An enum column's create carries the initial options
574
+ (`enumOptions`): the consumer creates the hidden dictionary (and, where it
575
+ keeps one, the `many` junction) inside the one operation and returns the
576
+ ids in the created column's `reference` — `tableId` (the dictionary),
577
+ `displayColumnId` (the option label), `colorColumnId` (the chip's color),
578
+ `junctionTableId` (the link table). The client creates and names no
579
+ catalog structures; the options' edits write the returned dictionary's
580
+ rows through the ordinary batch ops. Deleting the column leaves the
581
+ consumer's dictionary standing (the catalog is the consumer's data — its
582
+ cleanup is the consumer's own operation).
565
583
  - reads: `snapshotTable` (the sole initial load: the schema + the first
566
584
  page from one read), `queryNextPage` (the opaque keyset cursor — the
567
585
  cursor is signed by the server), `resolveRowDisplay` (the row-link
568
- cells' join)
586
+ cells' join). The page chunk size is the consumer's: the client sends no
587
+ `limit` (the query's `limit` is optional — absent = the consumer's
588
+ default page; `limits.maxPageSize` stands its ceiling), and paginates to
589
+ the tail over the opaque cursor
569
590
  - writes: the atomic mixed `batchRows` (the ordered `ops[]` commit as one
570
591
  transaction — the insert / update / remove / move / append stand the
571
592
  op's kinds), `undeleteRows` (one atomic operation, independent of the
@@ -591,8 +612,8 @@ package root: `BridgeError` (the structured error type) with
591
612
  `toBridgeError` / `isBridgeError` / `isBridgeErrorCode`, `newMutationContext`
592
613
  (the client-issued `operationId` per op), `PROTOCOL_VERSION` /
593
614
  `BASELINE_CAPABILITIES` / `validateProtocolDescriptor` (the negotiation),
594
- `isDatabaseBridge`, and `useDatabaseTable(bridge, tableId, filter?)` — the
595
- grid controller for a consumer-owned grid over the bridge. The filter's
615
+ `isDatabaseBridge`, and `useDatabaseTable(bridge, tableId, filter?, sort?)` —
616
+ the grid controller for a consumer-owned grid over the bridge. The filter's
596
617
  utilities are exported as well: `emptyFilter`, `filterIsComplete`,
597
618
  `conditionMatches` (the filter's evaluation over a row), `parseCellValue` /
598
619
  `cellValueEqual` (the cell's typed comparison), and `columnAnnotation`
@@ -603,6 +624,16 @@ and reorders them by dragging their grips or pressing ArrowUp/ArrowDown on a
603
624
  focused grip. Header drag and the popover share one full column order, and
604
625
  visible column widths follow the moved column.
605
626
 
627
+ Column widths are fixed: a column without a committed width stands the
628
+ 160 px default track (never a share of the container), and the table's
629
+ content width is the sum of its tracks. A table wider than its container
630
+ scrolls horizontally (the header and the rows share the grid's tracks, so
631
+ they scroll together); a narrower table keeps its tracks and never stretches
632
+ to fill the container. Dragging a column's right edge commits the visible
633
+ widths as the block's `columnWidths` view attr (the standalone's view patch).
634
+ The trailing rail — the rows' menu and the header's add-column cell — stays
635
+ pinned at the scroller's right edge, with the columns scrolling under it.
636
+
606
637
  The header row's **height** is adjustable: dragging the lower edge of the
607
638
  header row (the full-width strip over its bottom border) sets the height of
608
639
  every header cell at once, with the live preview and one commit on the
@@ -643,10 +674,58 @@ grid also re-reads it after its own table mutations.
643
674
  The grid's **Filter** control edits a recursive and/or condition tree: one
644
675
  row per condition (the field / the operator / the value over the column's
645
676
  annotation, a single line), the nested groups over bordered cards, and the
646
- conditions and the groups bound by the group's left connector line. The
647
- logic's labels stand the UI's locale (en/ru), the active pill over the
648
- prominent `primary` fill. `Apply` commits the draft as
649
- the view's `filter` attr (the block's write stand); `Clear` resets it.
677
+ conditions and the groups bound by the group's left connector line. The field,
678
+ the operator, and the values are the package's popover pickers — the native
679
+ `select` stands nowhere in the filter. Enum and row-link values pick through
680
+ the cell editors' lists (the display label on the trigger, the option's id or
681
+ the row's id in the payload); a boolean value stands exactly two options and
682
+ no empty entry, because a boolean cell is never null (its catalog keeps the
683
+ `is` / `is not` operators only). Number and text values keep their inputs, and
684
+ date / datetime values their pickers. The logic's labels, the operator picker,
685
+ and the boolean options stand the UI's locale (en/ru), while the filter
686
+ payload keeps its English wire operators and the refs' raw ids. Every other
687
+ default column catalog offers the applicable emptiness checks. `Apply`
688
+ commits the draft as the view's `filter` attr (the block's write stand);
689
+ `Clear` resets it. A filter change keeps the current rows rendered until the
690
+ new snapshot arrives; loading and empty states remain limited to the initial
691
+ load and the arrived result.
692
+
693
+ Deleting a column drops it from the block's view before the bridge call: the
694
+ filter's conditions over it (and the nested groups left empty), the sort keys,
695
+ the `columnOrder` / `hiddenColumns` entries and the positional width all leave
696
+ the view in the same action (one doc write; a failed delete rolls the prune
697
+ back), so the delete's refetch — and every client over the doc sync — never
698
+ sends the deleted column to the consumer. The rendered filter / sort also
699
+ derive over the live schema, so a stale view's residue (a column deleted
700
+ outside the grid) is never displayed or sent.
701
+
702
+ A failed write keeps its surface: the bridge's typed rejection (the
703
+ consumer's localized `message`) stands an overlay note at the grid's
704
+ lower-left corner — the layout stays untouched, the reader closes it with
705
+ the × (no auto-hide), and the machine code stands the `data-code` hook. The
706
+ note shows the consumer's message verbatim; `useDatabaseTable` exposes the
707
+ same state as `error` / `errorCode` for a consumer-owned surface.
708
+
709
+ A stale view heals on load too: a column deleted outside the grid (the
710
+ consumer's own admin tools / another bridge client) leaves the block's
711
+ filter / sort over an unknown column — the first read rejects, the client
712
+ reads the schema, drops the columns the schema no longer has (the filter's
713
+ conditions and the groups left empty, the sort keys), retries the read, and
714
+ writes the normalized view back to the block (one repair write). The
715
+ filter / sort the user sees follow the live schema, so an invalid column is
716
+ never displayed nor sent.
717
+
718
+ The toolbar's **Sort** control edits an ordered list of sort keys: each key
719
+ stands a column picker, the ascending / descending toggle, and the remove.
720
+ The keys' order is the priority (the first key is the primary one), changed by
721
+ dragging a key's grip or pressing ArrowUp/ArrowDown on it. `Apply` commits the
722
+ draft as the view's `sort` attr (one block write, undoable) and re-reads the
723
+ table over the server's sort input (`{ fieldId, direction }[]` — the contract
724
+ query's `sort`); `Clear` resets the draft to the physical order. The control
725
+ is gated on the bridge's `serverSort` capability: a bridge without it renders
726
+ the control disabled, because a client-side sort over the loaded page would
727
+ misrepresent the table. The attribute is an ordered `{ columnId, direction }[]`
728
+ (`[]` = the physical order).
650
729
 
651
730
  When an inserted row does not match the active filter, the grid keeps it
652
731
  visible with an orange outline while its initial edit session has focus. The
@@ -655,6 +734,33 @@ unchanged. `useDatabaseTable` exposes this transient row as `pendingRow` and
655
734
  `dismissPendingRow(rowId?)` for consumer-owned grids implementing the same
656
735
  interaction.
657
736
 
737
+ **System columns.** A bridge column may declare a system role —
738
+ `system: "id" | "created" | "updated"` — and the grid renders it read-only.
739
+ The value is never a stored cell: the id column stands the row's `id`, the
740
+ created / updated columns stand the row wire's `createdAt` / `updatedAt`
741
+ instants (the ISO strings the consumer supplies; absent = the empty cell).
742
+ The cells stay selectable, copyable (the copy stands the display text, ready
743
+ for a spreadsheet) and sortable / filterable, but every write path skips
744
+ them: no edit session, no clear, no paste, no header rename / delete. The id
745
+ renders in the monospace font; the instants render over the UI locale and the
746
+ browser's time zone. The system columns stand pinned last in the display
747
+ order (whatever the stored `columnOrder`; the consumer's own columns always
748
+ precede them), cannot be dragged or arrow-moved, and stay hideable. The
749
+ reference in-memory bridge (`apps/playground/src/memory-bridge/`) implements
750
+ the contract: it stamps the row instants and rejects a write to a system
751
+ column's cell. The playground's localStorage reload keeps the column roles
752
+ and the saved row instants (its restore writes them back after the create
753
+ replay — the harness's own persistence stand, not a wire operation).
754
+
755
+ A multi-cell edit-mode selection opens a context menu over the right-clicked
756
+ cell: **Clear range** writes one batch, and **Delete rows** removes every
757
+ selected row in one batch. Each action has one grid-history undo step when the
758
+ bridge supports row restoration. Copy writes plain-text TSV plus the
759
+ `application/x-docblocks-database-grid` raw-value JSON flavor; paste uses the
760
+ raw values within the same table and resolves external enum labels and unique
761
+ row-link displays from TSV. The changed cells carry a distinct paste-range
762
+ frame until the next grid interaction.
763
+
658
764
  ### Standalone database table
659
765
 
660
766
  The database's UI stands outside any document as well — the