Commit 71b8532
authored
* [Feature] Remove Popper.js — port hover_card & context_menu to Floating UI (#158)
tippy.js (which bundles @popperjs/core) was the last dependency pulling
Popper into RubyUI and breaking importmap installs. The other nine
components already use @floating-ui/dom; this ports the final two.
Gem:
- Rewrite hover_card & context_menu Stimulus controllers on @floating-ui/dom
(computePosition + autoUpdate, flip/shift/offset), dropping tippy.
- Content components now render a real hidden, absolutely-positioned div
instead of a cloned <template> (Floating UI positions a live element).
- dependencies.yml: hover_card/context_menu -> @floating-ui/dom.
- javascript_utils.rb: drop pin_tippy_js (tippy + @popperjs/core CDN pins).
- package.json: drop tippy.js.
Docs:
- Sync both controllers, drop tippy.js from package.json + lockfile,
remove the tippy/popper importmap install snippet.
Tests:
- Assert content renders a hidden positioned div, not a <template>.
* [Bug Fix] Address review: hover_card/context_menu interaction fixes
Fixes from PR review (cubic):
- hover_card: Escape now closes the card. Was gated behind an early
return for the no-menu-items case, making it unreachable for the
common hover-card usage.
- hover_card: add focusin/focusout listeners to the content element so
moving keyboard focus into the card no longer auto-closes it.
- context_menu: dismiss on outside right-click (contextmenu), not just
left-click, so the native menu can take over instead of leaving a
stale menu open.
- both: controllers now toggle data-state open/closed in sync with the
hidden class, keeping semantic state and state-based animation classes
accurate instead of permanently "open".
* [Bug Fix] Rebuild MCP registry.json for Floating UI migration
CI 'MCP registry up to date' check rebuilds registry.json from ../gem and
fails on diff. Regenerated so hover_card/context_menu reflect
@floating-ui/dom (not tippy.js) and the updated component sources.
* [Bug Fix] Content initial data-state closed (sync with hidden)
cubic flagged HoverCardContent rendering data-state=open while hidden,
which left the enter animation classes active before first show and made
semantic state inconsistent. Initial state is now 'closed' (matches the
hidden class); the controllers flip it to 'open' on show, so the
data-[state=open] enter animation actually plays on reveal. Applied to
both hover_card and context_menu content; registry.json regenerated.
1 parent fe69c94 commit 71b8532
15 files changed
Lines changed: 448 additions & 360 deletions
File tree
- docs
- app
- components/component_setup
- javascript/controllers/ruby_ui
- gem
- lib
- generators/ruby_ui
- ruby_ui
- hover_card
- test/ruby_ui
- mcp/data
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
| 177 | + | |
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | 185 | | |
192 | 186 | | |
193 | 187 | | |
| |||
Lines changed: 87 additions & 75 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
3 | 9 | | |
4 | 10 | | |
5 | 11 | | |
6 | 12 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
55 | 32 | | |
56 | 33 | | |
57 | | - | |
58 | | - | |
59 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
60 | 40 | | |
| 41 | + | |
| 42 | + | |
61 | 43 | | |
62 | 44 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
68 | 59 | | |
69 | 60 | | |
70 | 61 | | |
71 | | - | |
72 | | - | |
73 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
74 | 77 | | |
75 | 78 | | |
76 | | - | |
77 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
78 | 85 | | |
79 | 86 | | |
80 | | - | |
81 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
82 | 91 | | |
83 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
84 | 99 | | |
85 | | - | |
86 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
87 | 105 | | |
88 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
89 | 109 | | |
90 | 110 | | |
91 | | - | |
| 111 | + | |
92 | 112 | | |
93 | 113 | | |
94 | | - | |
| 114 | + | |
95 | 115 | | |
96 | 116 | | |
97 | 117 | | |
98 | 118 | | |
99 | 119 | | |
100 | 120 | | |
101 | | - | |
102 | 121 | | |
103 | | - | |
| 122 | + | |
104 | 123 | | |
105 | 124 | | |
106 | 125 | | |
| |||
121 | 140 | | |
122 | 141 | | |
123 | 142 | | |
124 | | - | |
125 | 143 | | |
126 | | - | |
| 144 | + | |
127 | 145 | | |
128 | | - | |
| 146 | + | |
129 | 147 | | |
130 | 148 | | |
131 | 149 | | |
132 | 150 | | |
133 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
134 | 154 | | |
135 | 155 | | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | 156 | | |
0 commit comments