ac448739efc1

fix button clicks (on:click for shadow DOM) and align visual style with PasskeyApprovalView

time
2026-05-13 15:33 UTC · 5 months ago
machine
koh2
parent
fb8a429cf180
2 files src/content/passkey-toast/PasskeyToast.tsx+38 −37src/content/passkey-toast/passkey-toast.css+82 −80
src/content/passkey-toast/PasskeyToast.tsx+38 −37
@@ -43,6 +43,8 @@4343     setTimeout(callback, 220);4444   }4545 46+  // on:click bypasses Solid's document-level event delegation, which breaks47+  // inside shadow DOM because event.target is retargeted to the shadow host.4648   return (4749     <div4850       class={[@@ -51,46 +53,46 @@5153         exiting() ? 'is-exiting' : '',5254       ].join(' ')}5355     >54-      <div class="peach-passkey-toast-site">56+      <div class="peach-passkey-toast-body">5557         <div class="peach-passkey-toast-icon">5658           <KeyIcon />5759         </div>58-        <span class="peach-passkey-toast-domain">{props.site}</span>59-      </div>6060 61-      <p class="peach-passkey-toast-headline">62-        sign in with passkey?63-      </p>61+        <div class="peach-passkey-toast-domain">{props.site}</div>6462 65-      <div class="peach-passkey-toast-account">66-        <span class="peach-passkey-toast-display-name">67-          {props.displayName}68-        </span>69-        <span class="peach-passkey-toast-username">70-          {props.username}71-        </span>72-      </div>63+        <h2 class="peach-passkey-toast-headline">64+          sign in with passkey?65+        </h2>7366 74-      <div class="peach-passkey-toast-countdown">75-        <div76-          class="peach-passkey-toast-countdown-bar"77-          style={{ 'animation-duration': `${TIMEOUT_MS}ms` }}78-        />79-      </div>67+        <div class="peach-passkey-toast-user">68+          {props.displayName} · {props.username}69+        </div>8070 81-      <div class="peach-passkey-toast-actions">82-        <button83-          class="peach-passkey-toast-btn peach-passkey-toast-btn--deny"84-          onClick={handleDeny}85-        >86-          deny87-        </button>88-        <button89-          class="peach-passkey-toast-btn peach-passkey-toast-btn--signin"90-          onClick={handleSignIn}91-        >92-          sign in →93-        </button>71+        <p class="peach-passkey-toast-notice">72+          Peach will authenticate you with your stored passkey for {props.site}.73+        </p>74+75+        <div class="peach-passkey-toast-countdown">76+          <div77+            class="peach-passkey-toast-countdown-bar"78+            style={{ 'animation-duration': `${TIMEOUT_MS}ms` }}79+          />80+        </div>81+82+        <div class="peach-passkey-toast-actions">83+          <button84+            class="peach-passkey-toast-btn peach-passkey-toast-btn--deny"85+            on:click={handleDeny}86+          >87+            deny88+          </button>89+          <button90+            class="peach-passkey-toast-btn peach-passkey-toast-btn--signin"91+            on:click={handleSignIn}92+          >93+            sign in94+          </button>95+        </div>9496       </div>9597     </div>9698   );@@ -98,10 +100,9 @@98100 99101 function KeyIcon() {100102   return (101-    <svg width="16" height="16" viewBox="0 0 16 16" fill="none">102-      <circle cx="5.5" cy="7.5" r="3" stroke="currentColor" stroke-width="1.5"/>103-      <path d="M8 7.5h5.5M11 7.5v2" stroke="currentColor"104-        stroke-width="1.5" stroke-linecap="round"/>103+    <svg width="22" height="22" viewBox="0 0 22 22" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round">104+      <circle cx="7" cy="11" r="3.5" />105+      <path d="M10.5 11h9M16.5 11v3M19.5 11v2" />105106     </svg>106107   );107108 }

view file

src/content/passkey-toast/passkey-toast.css+82 −80
@@ -1,26 +1,22 @@1+/* Palette — hardcoded equivalents of the popup's CSS vars (shadow DOM cannot2+   inherit :root variables from the host page). */3+14 .peach-passkey-toast {2-  /* Position */35   position: fixed;46   top: 16px;57   right: 16px;68   z-index: 2147483647;79 8-  /* Size */910   width: 320px;1011 11-  /* Appearance */12-  background: #141210;13-  border: 0.5px solid rgba(255, 255, 255, 0.1);12+  background: #0C0A06;13+  border: 0.5px solid rgba(240, 232, 216, 0.07);1414   border-radius: 14px;1515   box-shadow:16-    0 4px 6px rgba(0, 0, 0, 0.3),17-    0 12px 32px rgba(0, 0, 0, 0.4),18-    0 0 0 0.5px rgba(0, 0, 0, 0.5);16+    0 4px 6px rgba(0, 0, 0, 0.4),17+    0 12px 32px rgba(0, 0, 0, 0.55),18+    0 0 0 0.5px rgba(0, 0, 0, 0.6);1919 20-  /* Layout */21-  display: flex;22-  flex-direction: column;23-  gap: 0;2420   overflow: hidden;2521 2622   /* Initial state — hidden before animation */@@ -53,101 +49,94 @@5349 }5450 5551 @keyframes peach-passkey-in {56-  from {57-    opacity: 0;58-    transform: translateY(-12px) scale(0.96);59-  }60-  to {61-    opacity: 1;62-    transform: translateY(0) scale(1);63-  }52+  from { opacity: 0; transform: translateY(-12px) scale(0.96); }53+  to   { opacity: 1; transform: translateY(0) scale(1); }6454 }6555 6656 @keyframes peach-passkey-out {67-  from {68-    opacity: 1;69-    transform: translateY(0) scale(1);70-  }71-  to {72-    opacity: 0;73-    transform: translateY(-12px) scale(0.96);74-  }57+  from { opacity: 1; transform: translateY(0) scale(1); }58+  to   { opacity: 0; transform: translateY(-12px) scale(0.96); }7559 }7660 77-/* Site row */78-.peach-passkey-toast-site {61+/* Body — centered column, matching PasskeyApprovalView layout */62+.peach-passkey-toast-body {7963   display: flex;64+  flex-direction: column;8065   align-items: center;81-  gap: 8px;82-  padding: 16px 16px 12px;66+  padding: 22px 20px 18px;67+  gap: 10px;68+  text-align: center;8369 }8470 71+/* Key icon */8572 .peach-passkey-toast-icon {86-  width: 28px;87-  height: 28px;88-  background: rgba(201, 137, 58, 0.15);89-  border-radius: 7px;73+  width: 46px;74+  height: 46px;75+  border-radius: 12px;76+  background: #1A1710;77+  border: 1px solid rgba(240, 232, 216, 0.07);9078   display: flex;9179   align-items: center;9280   justify-content: center;93-  color: #C9893A;9481   flex-shrink: 0;82+  color: #E8956D;9583 }9684 85+/* Domain */9786 .peach-passkey-toast-domain {98-  font-size: 13px;99-  color: rgba(255, 255, 255, 0.5);100-  font-family: 'IBM Plex Mono', 'Fira Code', 'Courier New', monospace;101-  letter-spacing: -0.01em;87+  font-size: 0.75rem;88+  color: rgba(240, 232, 216, 0.20);89+  letter-spacing: 0.03em;90+  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;10291 }10392 10493 /* Headline */10594 .peach-passkey-toast-headline {10695   font-family: 'Cormorant Garamond', 'Georgia', 'Times New Roman', serif;10796   font-style: italic;108-  font-size: 20px;109-  font-weight: 600;110-  color: rgba(255, 255, 255, 0.92);111-  padding: 0 16px 10px;112-  line-height: 1.2;97+  font-size: 22px;98+  font-weight: 300;99+  color: #F0E8D8;100+  line-height: 1.1;101+  margin: 2px 0;113102 }114103 115-/* Account */116-.peach-passkey-toast-account {117-  display: flex;118-  flex-direction: column;119-  gap: 1px;120-  padding: 0 16px 16px;104+/* User pill */105+.peach-passkey-toast-user {106+  font-family: 'IBM Plex Mono', 'SFMono-Regular', Menlo, monospace;107+  font-size: 0.6875rem;108+  color: rgba(240, 232, 216, 0.50);109+  background: #1A1710;110+  border: 1px solid rgba(240, 232, 216, 0.07);111+  border-radius: 4px;112+  padding: 3px 8px;121113 }122114 123-.peach-passkey-toast-display-name {124-  font-size: 13px;125-  font-weight: 500;126-  color: rgba(255, 255, 255, 0.85);115+/* Notice */116+.peach-passkey-toast-notice {117+  font-size: 0.625rem;118+  color: rgba(240, 232, 216, 0.20);119+  line-height: 1.5;120+  max-width: 220px;127121 }128122 129-.peach-passkey-toast-username {130-  font-family: 'IBM Plex Mono', 'Fira Code', 'Courier New', monospace;131-  font-size: 12px;132-  color: rgba(255, 255, 255, 0.4);133-}134-135123 /* Countdown bar */136124 .peach-passkey-toast-countdown {125+  width: 100%;137126   height: 2px;138-  background: rgba(255, 255, 255, 0.06);139-  margin: 0 16px 14px;127+  background: rgba(240, 232, 216, 0.06);140128   border-radius: 1px;141129   overflow: hidden;130+  margin-top: 2px;142131 }143132 144133 .peach-passkey-toast-countdown-bar {145134   height: 100%;146-  background: #C9893A;135+  background: #E8956D;147136   border-radius: 1px;148137   transform-origin: left;149138   animation: peach-passkey-countdown linear forwards;150-  /* animation-duration set inline to TIMEOUT_MS */139+  /* animation-duration set inline */151140 }152141 153142 @keyframes peach-passkey-countdown {@@ -159,44 +148,57 @@159148 .peach-passkey-toast-actions {160149   display: flex;161150   gap: 8px;162-  padding: 0 16px 16px;151+  width: 100%;163152 }164153 165154 .peach-passkey-toast-btn {166155   flex: 1;167-  height: 36px;156+  min-height: 32px;157+  padding: 6px 9px;168158   border-radius: 8px;169159   border: none;170-  font-size: 13px;160+  font-size: 0.6875rem;171161   font-weight: 500;172162   cursor: pointer;173-  transition: opacity 120ms ease, transform 120ms ease;174-  font-family: inherit;163+  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;175164   letter-spacing: -0.01em;165+  transition: filter 120ms ease, opacity 120ms ease, transform 120ms ease;176166 }177167 168+.peach-passkey-toast-btn:focus {169+  outline: none;170+}171+172+.peach-passkey-toast-btn:focus-visible {173+  outline: none;174+  box-shadow: 0 0 0 2px #0C0A06, 0 0 0 4px rgba(232, 149, 109, 0.5);175+}176+178177 .peach-passkey-toast-btn:active {179178   opacity: 0.75;180179   transform: scale(0.97);181180 }182181 183182 .peach-passkey-toast-btn--deny {184-  background: rgba(255, 255, 255, 0.07);185-  color: rgba(255, 255, 255, 0.6);186-  border: 0.5px solid rgba(255, 255, 255, 0.1);183+  background: transparent;184+  color: rgba(240, 232, 216, 0.50);185+  border: 1px solid rgba(240, 232, 216, 0.07);187186 }188187 189188 .peach-passkey-toast-btn--deny:hover {190-  background: rgba(255, 255, 255, 0.1);191-  color: rgba(255, 255, 255, 0.8);189+  color: rgba(240, 232, 216, 0.80);190+  border-color: rgba(240, 232, 216, 0.12);192191 }193192 194193 .peach-passkey-toast-btn--signin {195-  background: #C9893A;196-  color: #0C0A06;197-  font-weight: 600;194+  background: #E8956D;195+  color: rgba(0, 0, 0, 0.92);196+  font-weight: 500;197+  box-shadow:198+    0 1px 0 rgba(255, 255, 255, 0.08) inset,199+    0 3px 16px rgba(232, 149, 109, 0.16);198200 }199201 200202 .peach-passkey-toast-btn--signin:hover {201-  background: #D99A4A;203+  filter: brightness(1.10) saturate(1.05);202204 }

view file