Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

18.2 KB
Raw Blame
/* Native dialogs eKlyp/Q0wFN/DZesH/JEkvL and their Light variants.

   The dialog is a fixed frame, not a box that fits its content. A centred modal
   with content height moves its own top edge by half of every content change,
   so switching Subscription/API Key — or a provider list growing by one row —
   used to slide the heading and the tabs out from under the pointer. Five rows
   own the layout instead: heading, description, the method row, the only part
   allowed to scroll, and the action footer. Four of them are a fixed height, so
   the frame's height is decided by the assistant alone and every anchor inside
   it holds still while the middle changes.

   The height per assistant is the tallest state each one can reach, so its own
   middle never scrolls without cause: Codex 580, Claude 620, OpenCode 640 (it
   also has to hold a provider list). Everything else follows from the rows —
   50 + 40 + 40 + 56 of fixed rows, 4 × 20 gaps and 2 × 24 padding leave the
   middle exactly H − 314. */
.connection-dialog {
  --connection-overlay-shadow: #00000088;
  --connection-selected-border: #5bffa059;
  --connection-logo-well: #ffffff04;
  --connection-h: 620px;
  --connection-pad: 24px;
  --connection-gap: 20px;
  --connection-head: 50px;
  --connection-desc: 40px;
  --connection-controls: 40px;
  --connection-footer: 56px;
  /* The room: the one rectangle this frame is allowed to live in. It is stated
     once, as four edges, because every term below is a different reading of the
     same thing and correcting one axis without the other is what keeps going
     wrong.

     `100dvh` / `100vw` are the LAYOUT viewport: on iOS it does not shrink when
     the soft keyboard opens, so a frame sized to it would put its own footer
     under the keyboard. `--app-vv*` are the VISUAL viewport, mirrored by
     `useViewportHeightVar` — `w`/`h` for how much of the window a person can
     see and `l`/`t` for where that band starts, since iOS also pans it over the
     layout viewport while `position: fixed` stays measured against the layout
     one. Each falls back to its layout-viewport equivalent, so this reads the
     usable rectangle on a phone and the window everywhere else.

     The insets are the notch and the home indicator, named rather than inlined
     so the whole rectangle is one vocabulary — and so a test can drive an
     asymmetric safe area, which `env()` alone gives no way to do. 32px is the
     design's margin, which the frame owes on every side it can be pushed
     against; the room is what exists, `fit` is what the frame may occupy. */
  --connection-margin: 32px;
  --connection-inset-t: env(safe-area-inset-top, 0px);
  --connection-inset-r: env(safe-area-inset-right, 0px);
  --connection-inset-b: env(safe-area-inset-bottom, 0px);
  --connection-inset-l: env(safe-area-inset-left, 0px);
  --connection-room-w: calc(var(--app-vvw, 100vw) - var(--connection-inset-l) - var(--connection-inset-r));
  --connection-room-h: calc(var(--app-vvh, 100dvh) - var(--connection-inset-t) - var(--connection-inset-b));
  --connection-fit-w: calc(var(--connection-room-w) - var(--connection-margin));
  --connection-fit-h: calc(var(--connection-room-h) - var(--connection-margin));
  /* The middle of that room, which is not the middle of the window. A soft
     keyboard takes the bottom of the screen without moving the layout viewport,
     so a frame centred on the window keeps its lower half under the keyboard
     even after it has shrunk enough to fit above it. A notch does the same
     sideways: a room narrowed from one edge has its middle nearer the other.
     Off a phone every measured term is its default and both of these are
     exactly 50% again — the room is the whole window. */
  --connection-centre-x: calc(var(--app-vvl, 0px) + var(--connection-inset-l) + var(--connection-room-w) / 2);
  --connection-centre-y: calc(var(--app-vvt, 0px) + var(--connection-inset-t) + var(--connection-room-h) / 2);
  width: min(568px, var(--connection-fit-w)); max-width: 568px;
  height: min(var(--connection-h), var(--connection-fit-h));
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--connection-head) var(--connection-desc) var(--connection-controls) minmax(0, 1fr) var(--connection-footer);
  /* The frame does not scroll; its middle does. Every band below sizes the rows
     down as the room shrinks, and at each one the middle still absorbs what is
     left — so in every room the design describes, this axis has nothing to do
     and stays here only as the last resort for the rooms it does not. */
  overflow-x: hidden; overflow-y: auto;
  padding: var(--connection-pad); gap: var(--connection-gap); border-radius: 16px;
  border-color: var(--border-strong); background: var(--surface-2);
  box-shadow: 0 18px 48px var(--desktop-overlay-shadow, var(--connection-overlay-shadow));
}
/* The shared dialog primitive caps every dialog it owns at `100dvh - 2rem`, and
   below its `md` edge at `90dvh` — its own defaults for dialogs that size to
   their content, and both of them layout-viewport units that a soft keyboard
   never moves. It also centres on the window for the same reason. This frame
   has its own bound and its own centre, so it states both here rather than
   inheriting them: the doubled class only exists to outweigh a utility class,
   because the primitive's file belongs to another surface. The primitive's own
   `-translate-x-1/2 -translate-y-1/2` still does the centring on both axes; only
   the point it is centred on changes. */
.connection-dialog.connection-dialog {
  max-height: var(--connection-fit-h); top: var(--connection-centre-y); bottom: auto;
  /* Stated here rather than beside the width because the phone band below also
     re-centres the frame, and a single class there would outrank a single class
     here on exactly the screens this room is measured for. */
  left: var(--connection-centre-x); right: auto;
}
.connection-dialog[data-backend='codex'] { --connection-h: 580px; }
.connection-dialog[data-backend='opencode'] { --connection-h: 640px; }
/* Below the floor — the room cannot hold the five rows and one whole control
   between them. There the middle is at or near nothing, and a scroll container
   with no height scrolls nothing, so the fields inside it are not merely small
   but impossible to reach. A phone held sideways is 390 tall before a keyboard
   takes any of it, so this is a room a person really does land in.
   `useRoomFloor` measures it and writes the answer here.

   The dialog then hands the scroll over instead of splitting it. Exactly one
   thing changes: the middle stops being clamped to what is left and stops being
   a scroll container, so it takes the height its content needs and the frame —
   the one box that was always allowed to scroll — becomes the single scroll
   owner. Every field, the provider choice, the instructions, Close and the
   footer action are then reachable in one column.

   The other four rows keep their heights, and the frame keeps the height and
   the centre the room gives it — deliberately not `auto`. A box that sizes to
   its content moves its own top edge by half of every content change, which is
   the defect the fixed frame exists to prevent; the fallback changes who
   scrolls, not whether the frame holds still. So the heading, the description
   and the method row do not move at all, and only the footer travels with the
   content it follows. With the mode decided by the room alone, switching method
   or raising an error can move neither the mode nor the frame — and while the
   middle still fits, this row behaves exactly as `1fr` did. */
.connection-dialog[data-room='tight'] {
  grid-template-rows: var(--connection-head) var(--connection-desc) var(--connection-controls) auto var(--connection-footer);
}
/* The floor and the scrolling are one decision: `min-height: 0` is what lets the
   middle shrink below its content, and it is also what holds the `auto` row at
   the leftover space — a grid item whose minimum is zero contributes nothing for
   the row to be sized from. Handing the scroll over means restoring the real
   minimum, so the row is sized by the content rather than by what was left. */
.connection-dialog[data-room='tight'] .connection-body {
  min-height: auto;
  overflow-y: visible;
}
/* `display: contents` keeps the form one component while its three regions sit
   in the dialog's own rows. Settings renders the same form as an ordinary
   column, so both rules stay scoped to the dialog. */
.connection-dialog .backend-connection-form,
.connection-dialog .backend-connection-form > .connection-radio { display: contents; }
.connection-dialog .connection-heading { grid-row: 1; }
.connection-dialog .connection-description { grid-row: 2; }
.connection-dialog .connection-controls,
.connection-dialog .backend-connection-form > .connection-radio > [role='radiogroup'] { grid-row: 3; }
.connection-dialog .connection-body { grid-row: 4; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: var(--connection-gap); min-width: 0; }
.connection-dialog .connection-body.connection-pick { gap: 12px; }
.connection-dialog .connection-actions { grid-row: 5; margin: 0; }
.connection-description { line-height: 20px; overflow: hidden; }
.connection-search { position: relative; display: flex; align-items: center; }
.connection-search > svg { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.connection-search input { height: 40px; padding-left: 34px; border-radius: 9px; }
.connection-chosen { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px 0 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.connection-chosen .connection-provider-text { flex: 1; min-width: 0; }
.connection-provider-mark { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 7px; background: var(--logo-well-background, var(--connection-logo-well)); border: 1px solid var(--border); }
.connection-provider-mark svg { height: 15px; width: auto; }
.connection-chosen .connection-provider-mark { width: 24px; height: 24px; border-radius: 6px; }
.connection-chosen .connection-provider-mark svg { height: 13px; }
.connection-provider-text { min-width: 0; }
.connection-provider-text strong { display: block; font-size: 13px; font-weight: 600; }
.connection-provider-text small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connection-provider-configured { flex: none; font-size: 11px; font-weight: 600; color: var(--mint-ink); }
.connection-dialog .connection-more { width: 100%; justify-content: flex-start; gap: 8px; height: 38px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
[data-theme='light'] .connection-dialog { --connection-overlay-shadow: #0a0a1424; --connection-selected-border: #10b98160; --connection-logo-well: #eef1f780; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) .connection-dialog { --connection-overlay-shadow: #0a0a1424; --connection-selected-border: #10b98160; --connection-logo-well: #eef1f780; }
}
.connection-heading { display: flex; gap: 12px; align-items: center; padding-right: 20px; }
.connection-logo { width: 40px; height: 40px; flex: none; border: 1px solid var(--border); border-radius: 10px; display: grid; place-items: center; background: var(--logo-well-background, var(--connection-logo-well)); }
.connection-heading h2 { font-size: 20px; line-height: 24px; font-weight: 600; }
.connection-heading p { line-height: 15px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.connection-intro { font-size: 13px; line-height: 1.55; color: var(--muted); }
.backend-connection-form { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.connection-dialog [role='radiogroup'] { height: 40px; padding: 3px; gap: 4px; border-radius: 9px; background: var(--background); border: 1px solid var(--border); }
.connection-dialog [role='radio'] { min-width: 0; border-radius: 6px; font-size: 12px; line-height: 1.2; font-weight: 500; white-space: normal; flex: 1; }
.connection-dialog [role='radio'][aria-checked='true'] { background: var(--mint-soft); color: var(--mint); border: 1px solid var(--nav-selected-border, var(--connection-selected-border)); font-weight: 600; }
.connection-dialog button:disabled:not([role='radio']) { opacity: .4; }
.backend-connection-form [role='radio']:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.connection-dialog [role='radiogroup']:has(button:disabled) { opacity: .6; }
.connection-account { display: flex; flex-direction: column; gap: 12px; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.connection-account h3 { line-height: 17px; font-size: 14px; font-weight: 600; }
.connection-account p { font-size: 13px; line-height: 1.6; color: var(--muted); }
.connection-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.connection-field label, .connection-auth-steps label { font-size: 12px; font-weight: 500; }
.connection-field p { font-size: 12px; line-height: 1.55; color: var(--muted); }
.connection-field input { height: 42px; border-radius: 8px; background: var(--background); border-color: var(--border-strong); font-family: var(--font-mono); font-size: 12px; }
.connection-secret { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--background); color: var(--muted); }
.connection-secret input { border: none; background: transparent; padding: 0; box-shadow: none; min-width: 0; }
.connection-secret code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 12px; }
.connection-secret > svg { flex: none; }
.connection-secret > button { flex: none; }
.connection-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 18px; border-top: 1px solid var(--border); }
.connection-dialog .connection-actions button, .connection-dialog .connection-account button { height: 38px; border-radius: 8px; padding: 0 14px; font-size: 13px; font-weight: 600; }
.connection-auth-steps { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.connection-auth-steps > div:has(> a + button) { border-radius: 8px; background: var(--cyan-soft); padding: 0 12px; min-height: 40px; gap: 8px; flex-wrap: nowrap; }
.connection-auth-steps > div:has(> a + button) a { background: transparent; padding: 0; min-width: 0; flex: 1; }
.connection-auth-steps > div:has(> a + button) a span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.connection-auth-steps > div:has(> code) { min-height: 54px; background: var(--background); border: 1px solid var(--border); padding: 8px 12px; border-radius: 8px; justify-content: space-between; }
.connection-auth-steps code { background: transparent; font-size: 19px; letter-spacing: 2px; padding: 0; }
.connection-waiting, .connection-loading, .connection-confirmed { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.connection-waiting svg, .connection-confirmed { color: var(--mint-ink); }
.connection-error, .connection-field .connection-error { color: var(--destructive-ink); font-size: 12px; overflow-wrap: anywhere; }
.connection-notice { font-size: 12px; color: var(--gold-ink); }
/* The list does not scroll on its own: the dialog's middle already does, and a
   scroller inside a scroller gives the same content two ways to move. */
.connection-provider-list { display: flex; flex-direction: column; gap: 10px; }
.connection-provider { width: 100%; min-height: 56px; border-radius: 10px; padding: 10px 14px; gap: 12px; border: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; text-align: left; }
.connection-provider .connection-provider-text { flex: 1; }
.connection-provider > svg { flex: none; color: var(--muted); }
/* No narrow native frames exist: preserve a centered, scrollable dialog, type,
   focus and reachable actions rather than inheriting the management sheet.
   The band is the primitive's own `md` edge, so the sheet shape and the phone
   metrics change on the same pixel instead of leaving a few widths half-way
   between the two. The description gets a third line here because the same
   sentence wraps further at phone width. */
@media (max-width: 767px) {
  /* Neither edge of the centre is restored here: the frame is centred on its
     room above, on both axes, because that and its size answer the same
     question. Only the transform the phone layout drops is put back. */
  .connection-dialog {
    transform: translate(-50%, -50%);
    border-radius: 16px;
    --connection-pad: 20px; --connection-gap: 16px; --connection-desc: 60px;
  }
  .connection-dialog > div[aria-hidden='true']:first-child { display: none; }
  .connection-heading h2 { font-size: 19px; }
}
/* A short window keeps every anchor the contract names — tabs, close, footer —
   and pays for them out of the parts that are only breathing room. The middle
   is `minmax(0, 1fr)`, so it is what gives way, down to nothing, before the
   frame is ever asked to exceed the viewport. */
@media (max-height: 640px) {
  .connection-dialog { --connection-pad: 16px; --connection-gap: 12px; --connection-head: 44px; --connection-desc: 40px; }
  .connection-heading h2 { font-size: 18px; line-height: 22px; }
}
/* Shorter than a landscape phone — a soft keyboard on a small screen reaches
   here too. There is no longer room for both breathing space and the anchors,
   so the breathing space goes: tighter padding, tighter gaps, a smaller mark
   and heading. The method row and the footer keep their full height, because
   they are what has to stay usable, and the middle still gives way first. */
@media (max-height: 480px) {
  .connection-dialog { --connection-pad: 12px; --connection-gap: 8px; --connection-head: 40px; }
  .connection-heading h2 { font-size: 17px; line-height: 20px; }
  .connection-logo { width: 34px; height: 34px; border-radius: 9px; }
}

.connection-auth-steps > div > a[data-slot="button"] { height: 38px; border-radius: 8px; padding: 0 14px; font-size: 13px; font-weight: 600; }
.connection-dialog .connection-auth-steps > div > a:not(:has(+ button)) { height: 38px; border-radius: 8px; padding: 0 14px; font-size: 13px; font-weight: 600; }