|
32 | 32 | background: transparent; |
33 | 33 | user-select: none; |
34 | 34 |
|
35 | | - &__dock { |
| 35 | + /* Holds the dock anchored bottom-right, above the click-away backdrop. */ |
| 36 | + &__stack { |
36 | 37 | position: absolute; |
37 | 38 | right: 0; |
38 | 39 | bottom: 0; |
| 40 | + z-index: 2; |
| 41 | + display: flex; |
| 42 | + flex-direction: column; |
| 43 | + align-items: flex-end; |
| 44 | + justify-content: flex-end; |
| 45 | + max-width: 100vw; |
| 46 | + max-height: 100vh; |
| 47 | + min-height: 0; |
| 48 | + pointer-events: none; |
| 49 | + } |
| 50 | + |
| 51 | + &__backdrop { |
| 52 | + position: absolute; |
| 53 | + inset: 0; |
| 54 | + z-index: 1; |
| 55 | + background: transparent; |
| 56 | + } |
| 57 | + |
| 58 | + &__dock { |
| 59 | + position: relative; |
| 60 | + flex: 0 1 auto; |
| 61 | + min-height: 0; |
39 | 62 | display: flex; |
40 | 63 | flex-direction: row; |
41 | 64 | align-items: center; |
|
46 | 69 | pointer-events: none; |
47 | 70 | } |
48 | 71 |
|
| 72 | + /* While a menu is open every click outside it must reach the backdrop. The |
| 73 | + bubble composer is excluded: it lives inside a bubble and stays usable. */ |
| 74 | + &--menu-open &__pet-hitbox, |
| 75 | + &--menu-open &__bubbles { |
| 76 | + pointer-events: none; |
| 77 | + } |
| 78 | + |
| 79 | + &--menu-open &__bubble-compose { |
| 80 | + pointer-events: none; |
| 81 | + } |
| 82 | + |
| 83 | + &__overlay { |
| 84 | + box-sizing: border-box; |
| 85 | + width: max-content; |
| 86 | + max-width: min(240px, 100vw); |
| 87 | + padding: 5px; |
| 88 | + display: flex; |
| 89 | + flex-direction: column; |
| 90 | + gap: 3px; |
| 91 | + border: 1px solid var(--color-overlay-slate-12); |
| 92 | + border-radius: 10px; |
| 93 | + /* Intentionally no backdrop-filter: adding a blurred layer on right-click |
| 94 | + re-composites the other blurred surfaces and flashes the whole window. */ |
| 95 | + background: var(--color-overlay-white-95); |
| 96 | + color: var(--bitfun-agent-companion-bubble-fg); |
| 97 | + box-shadow: 0 6px 18px rgba(var(--color-overlay-slate-rgb), 0.18); |
| 98 | + pointer-events: auto; |
| 99 | + |
| 100 | + /* Context menus are placed at the cursor. */ |
| 101 | + &--anchored { |
| 102 | + position: absolute; |
| 103 | + z-index: 3; |
| 104 | + } |
| 105 | + } |
| 106 | + |
| 107 | + &__menu { |
| 108 | + display: flex; |
| 109 | + flex-direction: column; |
| 110 | + gap: 2px; |
| 111 | + } |
| 112 | + |
| 113 | + &__menu-item { |
| 114 | + appearance: none; |
| 115 | + width: 100%; |
| 116 | + box-sizing: border-box; |
| 117 | + padding: 5px 8px; |
| 118 | + border: 0; |
| 119 | + border-radius: 6px; |
| 120 | + background: transparent; |
| 121 | + color: inherit; |
| 122 | + font: inherit; |
| 123 | + font-size: 11px; |
| 124 | + line-height: 1.3; |
| 125 | + text-align: left; |
| 126 | + /* Wrap rather than spill: the window can be as narrow as the pet sprite. */ |
| 127 | + white-space: normal; |
| 128 | + overflow-wrap: anywhere; |
| 129 | + cursor: pointer; |
| 130 | + |
| 131 | + &:hover { |
| 132 | + background: var(--color-overlay-slate-08); |
| 133 | + } |
| 134 | + |
| 135 | + &:focus-visible { |
| 136 | + outline: 2px solid color-mix(in srgb, var(--color-accent-600) 70%, transparent); |
| 137 | + outline-offset: -2px; |
| 138 | + } |
| 139 | + } |
| 140 | + |
| 141 | + /* Input bar shown inside the bubble the user replied from. */ |
| 142 | + &__bubble-composer { |
| 143 | + flex: 0 0 auto; |
| 144 | + align-self: stretch; |
| 145 | + width: 100%; |
| 146 | + margin-top: 5px; |
| 147 | + display: flex; |
| 148 | + flex-direction: row; |
| 149 | + align-items: center; |
| 150 | + gap: 4px; |
| 151 | + } |
| 152 | + |
| 153 | + &__bubble-composer-input { |
| 154 | + appearance: none; |
| 155 | + -webkit-appearance: none; |
| 156 | + flex: 1 1 auto; |
| 157 | + min-width: 0; |
| 158 | + height: 21px; |
| 159 | + box-sizing: border-box; |
| 160 | + padding: 2px 5px; |
| 161 | + border: 1px solid var(--color-overlay-slate-12); |
| 162 | + border-radius: 5px; |
| 163 | + background: var(--color-overlay-white-95); |
| 164 | + color: inherit; |
| 165 | + font: inherit; |
| 166 | + font-size: 10px; |
| 167 | + line-height: 1.3; |
| 168 | + user-select: text; |
| 169 | + -webkit-user-select: text; |
| 170 | + |
| 171 | + &:focus, |
| 172 | + &:focus-visible { |
| 173 | + outline: none; |
| 174 | + outline-offset: 0; |
| 175 | + box-shadow: none; |
| 176 | + } |
| 177 | + } |
| 178 | + |
| 179 | + &__bubble-composer-send, |
| 180 | + &__bubble-composer-cancel { |
| 181 | + appearance: none; |
| 182 | + flex-shrink: 0; |
| 183 | + width: 21px; |
| 184 | + height: 21px; |
| 185 | + padding: 0; |
| 186 | + display: grid; |
| 187 | + place-items: center; |
| 188 | + border: 1px solid var(--color-overlay-slate-12); |
| 189 | + border-radius: 5px; |
| 190 | + background: var(--color-overlay-slate-04); |
| 191 | + color: inherit; |
| 192 | + cursor: pointer; |
| 193 | + |
| 194 | + &:hover:not(:disabled) { |
| 195 | + background: var(--color-overlay-slate-08); |
| 196 | + } |
| 197 | + |
| 198 | + &:disabled { |
| 199 | + opacity: 0.45; |
| 200 | + cursor: default; |
| 201 | + } |
| 202 | + |
| 203 | + &:focus-visible { |
| 204 | + outline: 2px solid color-mix(in srgb, var(--color-accent-600) 70%, transparent); |
| 205 | + outline-offset: 1px; |
| 206 | + } |
| 207 | + } |
| 208 | + |
49 | 209 | &__pet { |
50 | 210 | width: min(var(--bitfun-agent-companion-pet-width), 100vw); |
51 | 211 | height: min(var(--bitfun-agent-companion-pet-height), 100vh); |
|
93 | 253 | &__bubbles { |
94 | 254 | position: relative; |
95 | 255 | flex-shrink: 0; |
96 | | - width: 146px; |
97 | | - max-width: 146px; |
| 256 | + width: 180px; |
| 257 | + max-width: 180px; |
| 258 | + min-height: 0; |
98 | 259 | max-height: 100vh; |
99 | 260 | display: flex; |
100 | 261 | flex-direction: column; |
|
121 | 282 | } |
122 | 283 | } |
123 | 284 |
|
| 285 | + /* Wraps one bubble so the hover compose button can sit on top of it without |
| 286 | + nesting a button inside the bubble button. */ |
| 287 | + &__bubble-shell { |
| 288 | + position: relative; |
| 289 | + isolation: isolate; |
| 290 | + flex-shrink: 0; |
| 291 | + width: 180px; |
| 292 | + max-width: 100%; |
| 293 | + |
| 294 | + &--single { |
| 295 | + height: min(var(--bitfun-agent-companion-pet-height), 100vh); |
| 296 | + } |
| 297 | + } |
| 298 | + |
| 299 | + &__bubble-compose { |
| 300 | + appearance: none; |
| 301 | + position: absolute; |
| 302 | + z-index: 2; |
| 303 | + right: 5px; |
| 304 | + bottom: 5px; |
| 305 | + width: 18px; |
| 306 | + height: 18px; |
| 307 | + padding: 0; |
| 308 | + display: grid; |
| 309 | + place-items: center; |
| 310 | + border: 1px solid var(--color-overlay-slate-12); |
| 311 | + border-radius: 50%; |
| 312 | + background: var(--color-overlay-white-95); |
| 313 | + color: var(--bitfun-agent-companion-bubble-fg); |
| 314 | + opacity: 0; |
| 315 | + visibility: hidden; |
| 316 | + pointer-events: none; |
| 317 | + transition: |
| 318 | + opacity 120ms ease, |
| 319 | + visibility 0s linear 120ms; |
| 320 | + cursor: pointer; |
| 321 | + |
| 322 | + &:hover { |
| 323 | + background: var(--color-overlay-slate-08); |
| 324 | + } |
| 325 | + |
| 326 | + &:focus-visible { |
| 327 | + outline: 2px solid color-mix(in srgb, var(--color-accent-600) 70%, transparent); |
| 328 | + outline-offset: 1px; |
| 329 | + } |
| 330 | + } |
| 331 | + |
| 332 | + &--native-hover &__bubble-shell:hover &__bubble-compose, |
| 333 | + &__bubble-shell--hovered &__bubble-compose { |
| 334 | + opacity: 1; |
| 335 | + visibility: visible; |
| 336 | + pointer-events: auto; |
| 337 | + transition-delay: 0s; |
| 338 | + } |
| 339 | + |
124 | 340 | &__bubble { |
125 | 341 | appearance: none; |
126 | 342 | text-align: left; |
127 | 343 | font: inherit; |
128 | | - width: 146px; |
| 344 | + width: 180px; |
129 | 345 | max-width: 100%; |
130 | 346 | box-sizing: border-box; |
131 | 347 | padding: 7px 10px; |
|
136 | 352 | backdrop-filter: blur(10px); |
137 | 353 | cursor: pointer; |
138 | 354 | position: relative; |
| 355 | + z-index: 0; |
139 | 356 |
|
140 | 357 | &:hover { |
141 | 358 | transform: translateY(-1px); |
|
152 | 369 | flex-direction: column; |
153 | 370 | overflow: hidden; |
154 | 371 | } |
| 372 | + |
| 373 | + /* Replying turns the bubble into its own composer, so it must not react to |
| 374 | + hover like a clickable bubble any more. */ |
| 375 | + &--composing { |
| 376 | + display: flex; |
| 377 | + flex-direction: column; |
| 378 | + overflow: hidden; |
| 379 | + cursor: default; |
| 380 | + |
| 381 | + &:hover { |
| 382 | + transform: none; |
| 383 | + } |
| 384 | + |
| 385 | + /* Only the output yields space to the input row; letting the title and |
| 386 | + status shrink too would clip their glyphs. */ |
| 387 | + .bitfun-agent-companion-window__bubble-title, |
| 388 | + .bitfun-agent-companion-window__bubble-status { |
| 389 | + flex: 0 0 auto; |
| 390 | + } |
| 391 | + |
| 392 | + /* Two whole lines: a flexible height would leave a half-clipped line |
| 393 | + under the input row. */ |
| 394 | + .bitfun-agent-companion-window__bubble-output { |
| 395 | + flex: 0 0 calc(12px * 2); |
| 396 | + height: calc(12px * 2); |
| 397 | + } |
| 398 | + } |
155 | 399 | } |
156 | 400 |
|
157 | 401 | &__bubble-title, |
|
0 commit comments