Skip to content

Commit 2a9e056

Browse files
committed
merge main into feat/modal-auto-width
2 parents 38f3cbb + 1e93e80 commit 2a9e056

45 files changed

Lines changed: 1656 additions & 99 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/guide/layout.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ ui.row({ gap: 1 }, [
167167

168168
Rezi clips rendering to each widget’s allocated rect. Overflow is handled per-widget:
169169

170-
- `ui.text` supports `textOverflow: "clip" | "ellipsis"` (and `maxWidth`)
170+
- `ui.text` supports `textOverflow: "clip" | "ellipsis" | "middle"` (and `maxWidth`)
171171
- Containers clip their children to the padded/bordered content area
172172

173173
Example: ellipsis truncation

docs/recipes/data-table.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ await app.start();
8989
## Explanation
9090

9191
- Filter state is kept in `state.filter` and applied before passing data to the table.
92-
- Sorting is handled by the table (it emits `onSort(column, direction)` and you store that in state).
92+
- Sorting is handled by the table (click a sortable header, or focus the header and press Enter; it emits `onSort(column, direction)` and you store that in state).
9393
- Selection is stored as row keys and updated via `onSelectionChange`.
9494

9595
## Related

docs/widgets/layer.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ ui.layer({
3434

3535
- Use [`Layers`](layers.md) to manage stacking order and modals.
3636
- `BackdropStyle` values: `"none"`, `"dim"`, `"opaque"`.
37+
- Backdrops are rendered behind the layer. `"dim"` uses a light shade pattern; `"opaque"` clears the area behind the layer to the theme background color.
3738

3839
## Related
3940

docs/widgets/layers.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ ui.layers([
1717
- Child order defines z-order: later children render on top.
1818
- Use [`Layer`](layer.md) for explicit z-index or custom backdrops.
1919
- Layers enable deterministic hit testing and focus management across overlaps.
20+
- Backdrops (from [`Modal`](modal.md) and [`Layer`](layer.md)) render behind the active overlay(s) and stack in draw order.
2021

2122
## Related
2223

docs/widgets/modal.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ ui.modal({
6868
- Modals are rendered by conditionally including them in the tree (there is no `open` prop).
6969
- Render modals inside `ui.layers(...)` so they stack above base content.
7070
- `width: "auto"` sizes to content/actions and is clamped by `maxWidth` and the viewport.
71+
- Backdrops are rendered behind the modal. `"dim"` uses a light shade pattern; `"opaque"` clears the area behind the modal to the theme background color.
7172

7273
## Related
7374

docs/widgets/panel-group.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ ui.panelGroup(
99
{
1010
id: "panel-group",
1111
direction: "horizontal",
12-
autoSaveId: "main-layout",
1312
},
1413
[
1514
ui.resizablePanel({ defaultSize: 25 }, [Sidebar()]),
@@ -24,12 +23,11 @@ ui.panelGroup(
2423
|------|------|---------|-------------|
2524
| `id` | `string` | **required** | Group identifier |
2625
| `direction` | `"horizontal" \| "vertical"` | **required** | Layout direction |
27-
| `autoSaveId` | `string` | - | App-level key for persisting layout (core does not persist) |
2826

2927
## Notes
3028

31-
- `PanelGroup` distributes space evenly when sizes are not provided.
32-
- `ResizablePanel` size hints are preserved but not applied by core layout.
29+
- `PanelGroup` distributes space based on `ResizablePanel` size hints (with equal distribution when unspecified).
30+
- `ResizablePanel` size hints are interpreted as percentages of the group's width/height (based on `direction`).
3331
- Use [`SplitPane`](split-pane.md) for draggable resizing.
3432

3533
## Related

docs/widgets/resizable-panel.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ ui.panelGroup(
1818

1919
| Prop | Type | Default | Description |
2020
|------|------|---------|-------------|
21-
| `defaultSize` | `number` | auto | Initial size (percent or cells, based on parent) |
22-
| `minSize` | `number` | - | Minimum size |
23-
| `maxSize` | `number` | - | Maximum size |
21+
| `defaultSize` | `number` | auto | Initial size (percentage of the parent axis) |
22+
| `minSize` | `number` | - | Minimum size (percentage) |
23+
| `maxSize` | `number` | - | Maximum size (percentage) |
2424
| `collapsible` | `boolean` | `false` | Allow collapsing the panel |
2525

2626
## Notes
2727

2828
- `ResizablePanel` should contain exactly one child widget.
29-
- `PanelGroup` distributes space evenly; size hints on `ResizablePanel` are preserved as metadata but not applied by core layout.
29+
- `PanelGroup` uses `defaultSize`/`minSize`/`maxSize` as sizing hints along its primary axis.
3030
- For draggable sizing, use [`SplitPane`](split-pane.md).

docs/widgets/table.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ ui.table({
3434
| `sortDirection` | `"asc" \| "desc"` | - | Current sort direction |
3535
| `onSort` | `(column: string, direction: "asc" \| "desc") => void` | - | Called when sort changes |
3636
| `onRowPress` | `(row: T, index: number) => void` | - | Row activation callback |
37+
| `onRowDoublePress` | `(row: T, index: number) => void` | - | Row double-activation callback (double-click) |
3738
| `virtualized` | `boolean` | `true` | Enable windowed rendering for large datasets |
3839
| `overscan` | `number` | `3` | Extra rows rendered outside viewport |
3940
| `showHeader` | `boolean` | `true` | Show/hide header row |
@@ -63,6 +64,9 @@ ui.table({
6364

6465
- **Arrow keys** navigate rows. **Enter** activates the selected row.
6566
- **Mouse click** on a row selects it and moves focus to the table.
67+
- **Mouse click** on a sortable header toggles sort and fires `onSort(column, direction)`.
68+
- When focused: **Up** from the first row focuses the header. **Left/Right** moves between columns. **Enter** toggles sort on the focused header.
69+
- **Double click** on a row fires `onRowDoublePress` (when provided).
6670
- **Mouse scroll wheel** scrolls rows when the table is virtualized.
6771

6872
## Notes

docs/widgets/text.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ui.text("Caption", { variant: "caption", textOverflow: "ellipsis" }); // pass Te
2222
| `key` | `string` | - | Reconciliation key for lists |
2323
| `style` | `TextStyle` | - | Style applied to this text |
2424
| `variant` | `"body" \| "heading" \| "caption" \| "code" \| "label"` | `"body"` | Predefined styling intent |
25-
| `textOverflow` | `"clip" \| "ellipsis"` | `"clip"` | How to handle overflow |
25+
| `textOverflow` | `"clip" \| "ellipsis" \| "middle"` | `"clip"` | How to handle overflow |
2626
| `maxWidth` | `number` | - | Maximum width (cells) for overflow handling |
2727

2828
## Examples
@@ -48,10 +48,22 @@ ui.box({ width: 20, border: "single", p: 1 }, [
4848
]);
4949
```
5050

51+
### 3) Middle truncation
52+
53+
```typescript
54+
import { ui } from "@rezi-ui/core";
55+
56+
ui.box({ width: 24, border: "single", p: 1 }, [
57+
ui.text("/home/user/documents/project/src/index.ts", { textOverflow: "middle" }),
58+
]);
59+
```
60+
5161
## Notes
5262

5363
- Text is not focusable and does not emit events.
5464
- Measurement and truncation are cell-based and deterministic.
65+
- `maxWidth` caps both measurement (layout) and truncation width.
66+
- `variant` applies a small default style (heading/label: bold, caption: dim, code: inverse) which can be overridden via `style`.
5567

5668
## Related
5769

packages/core/src/app/__tests__/helpers.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ type EncodedEvent =
3131
wheelX?: number;
3232
wheelY?: number;
3333
}>
34-
| Readonly<{ kind: "resize"; timeMs: number; cols: number; rows: number }>;
34+
| Readonly<{ kind: "resize"; timeMs: number; cols: number; rows: number }>
35+
| Readonly<{ kind: "tick"; timeMs: number; dtMs?: number }>;
3536

3637
export function encodeZrevBatchV1(
3738
opts: Readonly<{ flags?: number; events?: readonly EncodedEvent[] }>,
@@ -102,6 +103,19 @@ export function encodeZrevBatchV1(
102103
continue;
103104
}
104105

106+
if (ev.kind === "tick") {
107+
dv.setUint32(off + 0, 6, true);
108+
dv.setUint32(off + 4, 32, true);
109+
dv.setUint32(off + 8, ev.timeMs, true);
110+
dv.setUint32(off + 12, 0, true);
111+
dv.setUint32(off + 16, ev.dtMs ?? 0, true);
112+
dv.setUint32(off + 20, 0, true);
113+
dv.setUint32(off + 24, 0, true);
114+
dv.setUint32(off + 28, 0, true);
115+
off += 32;
116+
continue;
117+
}
118+
105119
dv.setUint32(off + 0, 5, true);
106120
dv.setUint32(off + 4, 32, true);
107121
dv.setUint32(off + 8, ev.timeMs, true);

0 commit comments

Comments
 (0)