Commit d50182b
authored
Add page-level key binding system (capture phase) (#105)
* Add page-level key binding system (capture phase) (#104)
Implement capture-phase input handling where pages intercept keys before
focused components, enabling reliable navigation key handling (Escape, Tab).
- Add PageKeyBindings class for registering page-level key handlers
- Add HandlePageInput method to IBindablePage interface
- Modify TerminaApplication.ProcessEvent() to call page handler first
- Update ReactivePage to expose KeyBindings property
- Update all gallery demo pages to use new KeyBindings pattern
- Add comprehensive tests for page-level input handling
Closes #104
* Add navigation capabilities to ReactivePage
Give Pages direct access to Navigate(), NavigateWithParams(), and Shutdown()
methods instead of requiring wrapper methods on ViewModels.
Framework changes:
- Add WireUpNavigation() to IBindablePage interface
- Add protected Navigate/NavigateWithParams/Shutdown methods to ReactivePage
- Update TerminaApplication to wire up navigation to pages
This is a cleaner framework design where:
- Pages use Navigate() for input-driven navigation (Escape key, etc.)
- ViewModels use Navigate() for business-logic-driven navigation
Documentation updates:
- Update input-handling.md with correct Page.Navigate() usage
- Update architecture.md with two-phase input routing model
- Update concepts index with new data flow diagram
* Fix ReactiveLayoutNode child invalidation propagation
ReactiveLayoutNode now properly subscribes to its child's Invalidated
observable and propagates those events upward. This fixes the issue where
animated nodes (like SpinnerNode) nested inside reactive layouts would
not trigger redraws because their invalidation events were lost at the
ReactiveLayoutNode boundary.
Changes:
- Added _childInvalidationSubscription field to track child subscriptions
- Added SubscribeToChildInvalidation helper method
- Subscribe to child invalidation when new child is set from observable
- Re-subscribe on OnActivate to handle reactivation after navigation
- Properly dispose child invalidation subscription in Dispose
- Applied same fix to both ReactiveLayoutNode and ReactiveLayoutNode<T>
* Add Spacebar handling to AnimationsGalleryPage
Register a page-level key binding for Spacebar that updates the spinner
preview based on the currently highlighted item. This provides the same
behavior as Enter for this single-select use case, making the UX more
intuitive.
* Rename third column to 'Scrolling List' in SelectionListGalleryPage
Highlight the scrollbar feature by renaming the column header and
updating the description to show visible rows configuration.1 parent 81b988b commit d50182b
File tree
20 files changed
+944
-150
lines changed- demos/Termina.Demo.Gallery/Pages
- docs/concepts
- src/Termina
- Input
- Layout
- Pages
- Reactive
- tests/Termina.Tests/Input
20 files changed
+944
-150
lines changedLines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
27 | 40 | | |
28 | 41 | | |
29 | 42 | | |
| |||
Lines changed: 0 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
| |||
25 | 23 | | |
26 | 24 | | |
27 | 25 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | 26 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
| |||
20 | 18 | | |
21 | 19 | | |
22 | 20 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | 21 | | |
32 | 22 | | |
33 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
19 | 27 | | |
20 | 28 | | |
21 | 29 | | |
| |||
Lines changed: 0 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
| |||
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | 13 | | |
Lines changed: 9 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
32 | 37 | | |
33 | 38 | | |
34 | 39 | | |
| |||
46 | 51 | | |
47 | 52 | | |
48 | 53 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | 54 | | |
68 | 55 | | |
69 | 56 | | |
| |||
111 | 98 | | |
112 | 99 | | |
113 | 100 | | |
114 | | - | |
| 101 | + | |
115 | 102 | | |
116 | 103 | | |
117 | 104 | | |
| |||
176 | 163 | | |
177 | 164 | | |
178 | 165 | | |
179 | | - | |
| 166 | + | |
180 | 167 | | |
181 | 168 | | |
182 | 169 | | |
183 | | - | |
| 170 | + | |
184 | 171 | | |
185 | 172 | | |
186 | 173 | | |
187 | 174 | | |
188 | | - | |
| 175 | + | |
189 | 176 | | |
190 | 177 | | |
191 | 178 | | |
| |||
Lines changed: 0 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | 4 | | |
10 | 5 | | |
11 | 6 | | |
| |||
15 | 10 | | |
16 | 11 | | |
17 | 12 | | |
18 | | - | |
19 | | - | |
20 | 13 | | |
21 | 14 | | |
22 | | - | |
23 | | - | |
24 | 15 | | |
25 | 16 | | |
26 | 17 | | |
| |||
33 | 24 | | |
34 | 25 | | |
35 | 26 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | 27 | | |
51 | 28 | | |
52 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
25 | 31 | | |
26 | 32 | | |
27 | 33 | | |
| |||
30 | 36 | | |
31 | 37 | | |
32 | 38 | | |
| 39 | + | |
33 | 40 | | |
34 | 41 | | |
35 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
36 | 50 | | |
37 | 51 | | |
38 | 52 | | |
| |||
Lines changed: 0 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
| |||
14 | 12 | | |
15 | 13 | | |
16 | 14 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | 15 | | |
26 | 16 | | |
27 | 17 | | |
| |||
0 commit comments