feat(ts): 实现 Polaris 可交互首页

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-02 23:53:28 +08:00
co-authored by Claude Opus 4.8
parent 7eaa9e6f80
commit 9754d61ffe
71 changed files with 15613 additions and 46 deletions
+635
View File
@@ -0,0 +1,635 @@
@import "tailwindcss";
@theme inline {
--color-background: var(--background);
--color-foreground: var(--text-primary);
--color-primary: var(--primary);
--color-primary-foreground: #ffffff;
--color-muted-foreground: var(--text-secondary);
--color-border: var(--border-subtle);
--radius-lg: var(--radius-card);
--radius-xl: var(--radius-panel);
}
:root {
color-scheme: light;
--background: #dcebf5;
--text-primary: #0f172a;
--text-secondary: #64748b;
--text-muted: #94a3b8;
--primary: #3b82f6;
--primary-hover: #2563eb;
--primary-soft: rgba(59, 130, 246, 0.1);
--surface-sidebar: rgba(255, 255, 255, 0.68);
--surface-search: rgba(255, 255, 255, 0.72);
--surface-card: rgba(255, 255, 255, 0.62);
--surface-card-hover: rgba(255, 255, 255, 0.78);
--border-glass: rgba(255, 255, 255, 0.58);
--border-subtle: rgba(15, 23, 42, 0.08);
--shadow-soft: 0 14px 40px rgba(15, 23, 42, 0.1);
--shadow-medium: 0 20px 60px rgba(15, 23, 42, 0.12);
--shadow-panel: 0 24px 80px rgba(15, 23, 42, 0.1);
--radius-card: 20px;
--radius-panel: 24px;
--sidebar-expanded: 240px;
--sidebar-collapsed: 72px;
--layout-gap: 20px;
}
* {
box-sizing: border-box;
}
html,
body {
min-height: 100%;
}
body {
isolation: isolate;
margin: 0;
overflow-x: hidden;
color: var(--text-primary);
background:
radial-gradient(
circle at 12% 15%,
rgba(255, 245, 239, 0.92) 0,
transparent 34%
),
radial-gradient(
circle at 82% 14%,
rgba(194, 222, 246, 0.92) 0,
transparent 38%
),
radial-gradient(
circle at 48% 82%,
rgba(226, 239, 247, 0.72) 0,
transparent 44%
),
linear-gradient(135deg, #eef5fa 0%, #dceaf4 48%, #cbdff0 100%);
font-family:
Inter,
"SF Pro Display",
"SF Pro Text",
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
"PingFang SC",
"Hiragino Sans GB",
"Microsoft YaHei",
sans-serif;
}
body::before {
position: fixed;
inset: 0;
z-index: -1;
content: "";
pointer-events: none;
background:
linear-gradient(
180deg,
rgba(255, 255, 255, 0.2),
rgba(255, 255, 255, 0.08)
),
repeating-linear-gradient(
165deg,
transparent 0 84px,
rgba(255, 255, 255, 0.08) 85px 86px
);
-webkit-backdrop-filter: blur(8px);
backdrop-filter: blur(8px);
}
button,
input,
a {
font: inherit;
}
button,
a {
-webkit-tap-highlight-color: transparent;
}
:focus-visible {
outline: 3px solid rgba(59, 130, 246, 0.34);
outline-offset: 3px;
}
.glass-panel {
border: 1px solid var(--border-glass);
border-radius: var(--radius-panel);
background: var(--surface-card);
box-shadow: var(--shadow-soft);
-webkit-backdrop-filter: blur(20px);
backdrop-filter: blur(20px);
}
.app-shell {
--sidebar-width: var(--sidebar-expanded);
min-height: 100svh;
}
.app-shell[data-sidebar-collapsed="true"] {
--sidebar-width: var(--sidebar-collapsed);
}
.app-shell:not([data-hydrated="true"]) *,
.app-shell:not([data-hydrated="true"]) *::before,
.app-shell:not([data-hydrated="true"]) *::after {
transition: none !important;
}
.sidebar {
position: fixed;
inset: 20px auto 20px 20px;
z-index: 20;
display: flex;
width: var(--sidebar-width);
overflow: visible;
flex-direction: column;
border: 1px solid var(--border-glass);
border-radius: var(--radius-panel);
background: var(--surface-sidebar);
box-shadow: var(--shadow-panel);
-webkit-backdrop-filter: blur(24px);
backdrop-filter: blur(24px);
transition: width 180ms ease;
}
.sidebar__header {
position: relative;
display: flex;
min-height: 72px;
align-items: center;
gap: 10px;
padding: 0 16px;
border-bottom: 1px solid rgba(255, 255, 255, 0.46);
}
.sidebar__brand {
display: flex;
min-width: 0;
flex: 1;
align-items: center;
gap: 12px;
color: var(--text-primary);
text-decoration: none;
}
.sidebar__brand img {
display: block;
flex: none;
}
.sidebar__site-name {
overflow: hidden;
font-size: 18px;
font-weight: 700;
letter-spacing: -0.025em;
text-overflow: ellipsis;
white-space: nowrap;
}
.sidebar__header > button {
flex: none;
color: var(--text-secondary);
border-radius: 12px;
transition:
color 180ms ease,
background 180ms ease;
}
.sidebar__header > button:hover {
color: var(--primary-hover);
background: var(--primary-soft);
}
.sidebar__nav {
display: flex;
min-height: 0;
flex: 1;
flex-direction: column;
gap: 8px;
overflow-y: auto;
padding: 12px 12px 16px;
}
.sidebar__categories {
display: flex;
flex-direction: column;
gap: 6px;
}
.sidebar__nav-item {
display: flex;
width: 100%;
height: 48px;
min-height: 48px;
align-items: center;
justify-content: flex-start;
gap: 12px;
padding: 0 14px;
color: #334155;
text-decoration: none;
border: 0;
border-radius: 16px;
background: transparent;
transition:
color 180ms ease,
background 180ms ease;
}
.sidebar__nav-item svg {
width: 20px;
height: 20px;
flex: none;
}
.sidebar__nav-item--active {
color: var(--primary-hover);
background: var(--primary-soft);
font-weight: 650;
}
.sidebar__nav-item[aria-disabled="true"] {
cursor: not-allowed;
opacity: 0.82;
}
.sidebar__nav-item[aria-disabled="true"]:hover {
color: #334155;
background: rgba(255, 255, 255, 0.28);
}
.sidebar__label {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.app-shell[data-sidebar-collapsed="true"] .sidebar__header {
justify-content: center;
padding-inline: 10px;
}
.app-shell[data-sidebar-collapsed="true"] .sidebar__brand {
justify-content: center;
}
.app-shell[data-sidebar-collapsed="true"] .sidebar__header > button {
position: absolute;
top: 22px;
right: -14px;
width: 28px;
height: 28px;
border: 1px solid var(--border-glass);
background: rgba(255, 255, 255, 0.9);
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
.app-shell[data-sidebar-collapsed="true"] .sidebar__nav {
padding-inline: 10px;
}
.app-shell[data-sidebar-collapsed="true"] .sidebar__nav-item {
justify-content: center;
padding-inline: 0;
}
.app-shell__content {
min-height: 100svh;
margin-left: calc(var(--sidebar-width) + 40px);
transition: margin-left 180ms ease;
}
.home-content {
display: grid;
min-height: 100svh;
place-items: start center;
padding: clamp(108px, 14vh, 156px) 40px 64px;
}
.home-content__inner {
width: min(100%, 880px);
}
.clock-greeting {
text-align: center;
}
.clock-greeting__time {
min-height: 1.2em;
margin: 0;
color: var(--text-primary);
font-size: clamp(44px, 4.2vw, 56px);
font-weight: 700;
line-height: 1.16;
letter-spacing: -0.035em;
text-wrap: balance;
}
.clock-greeting__date {
margin: 12px 0 0;
color: var(--text-secondary);
font-size: 16px;
line-height: 1.6;
}
.search-box {
position: relative;
z-index: 10;
width: min(100%, 760px);
margin: 40px auto 0;
}
.search-box__form {
display: flex;
height: 68px;
align-items: center;
border: 1px solid var(--border-glass);
border-radius: var(--radius-panel);
background: var(--surface-search);
box-shadow: var(--shadow-medium);
-webkit-backdrop-filter: blur(22px);
backdrop-filter: blur(22px);
transition:
border-color 180ms ease,
box-shadow 180ms ease,
background 180ms ease;
}
.search-box__form:focus-within {
border-color: rgba(59, 130, 246, 0.26);
background: rgba(255, 255, 255, 0.8);
box-shadow:
0 0 0 4px rgba(59, 130, 246, 0.09),
var(--shadow-medium);
}
.search-provider-menu__trigger {
min-width: 126px;
height: 48px;
justify-content: flex-start;
margin-left: 10px;
padding-inline: 14px;
color: #334155;
border-radius: 16px;
}
.search-provider-menu__trigger:hover,
.search-provider-menu__trigger[aria-expanded="true"] {
color: var(--primary-hover);
background: var(--primary-soft);
}
.search-box__icon {
width: 20px;
height: 20px;
flex: none;
margin-left: 10px;
color: var(--text-muted);
}
.search-box__input {
min-width: 0;
height: 100%;
flex: 1;
padding: 0 14px;
color: var(--text-primary);
font-size: 16px;
line-height: 1.5;
border: 0;
outline: 0;
background: transparent;
}
.search-box__input::placeholder {
color: var(--text-muted);
opacity: 1;
}
.search-box__shortcut {
display: inline-flex;
min-width: 50px;
height: 30px;
flex: none;
align-items: center;
justify-content: center;
margin-right: 16px;
padding-inline: 9px;
color: var(--text-muted);
font-family: inherit;
font-size: 12px;
line-height: 1;
border: 1px solid rgba(100, 116, 139, 0.2);
border-radius: 9px;
background: rgba(255, 255, 255, 0.42);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}
.local-search-results {
position: absolute;
top: calc(100% + 8px);
left: 0;
z-index: 30;
width: 100%;
max-height: min(520px, calc(100vh - 220px));
overflow-y: auto;
padding: 8px;
border: 1px solid var(--border-glass);
border-radius: 20px;
background: rgba(255, 255, 255, 0.9);
box-shadow: var(--shadow-medium);
-webkit-backdrop-filter: blur(24px);
backdrop-filter: blur(24px);
}
.local-search-results__option {
display: flex;
min-height: 58px;
align-items: center;
gap: 12px;
padding: 9px 12px;
color: var(--text-primary);
text-decoration: none;
border: 1px solid transparent;
border-radius: 14px;
transition:
color 180ms ease,
background 180ms ease,
border-color 180ms ease;
}
.local-search-results__option[aria-selected="true"] {
color: var(--primary-hover);
border-color: rgba(59, 130, 246, 0.08);
background: var(--primary-soft);
}
.local-search-results__copy {
display: flex;
min-width: 0;
flex: 1;
flex-direction: column;
gap: 3px;
}
.local-search-results__title,
.local-search-results__category {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.local-search-results__title {
font-size: 14px;
font-weight: 650;
}
.local-search-results__category {
color: var(--text-secondary);
font-size: 12px;
}
.local-search-results__empty {
display: grid;
min-height: 96px;
place-items: center;
margin: 0;
color: var(--text-secondary);
font-size: 14px;
}
.quick-links {
width: min(100%, 880px);
margin-top: 44px;
}
.quick-links__title {
margin: 0 0 18px;
color: var(--text-primary);
font-size: 16px;
font-weight: 650;
}
.quick-links__grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 16px 18px;
}
.quick-link-card {
display: flex;
min-width: 0;
height: 76px;
align-items: center;
gap: 14px;
padding: 0 20px;
color: var(--text-primary);
text-decoration: none;
border: 1px solid var(--border-glass);
border-radius: var(--radius-card);
background: var(--surface-card);
box-shadow: var(--shadow-soft);
-webkit-backdrop-filter: blur(20px);
backdrop-filter: blur(20px);
transition:
transform 180ms ease,
background 180ms ease,
border-color 180ms ease,
box-shadow 180ms ease;
}
.quick-link-card:hover {
transform: translateY(-2px);
border-color: rgba(255, 255, 255, 0.76);
background: var(--surface-card-hover);
box-shadow: 0 18px 50px rgba(15, 23, 42, 0.14);
}
.quick-link-card > span:last-child {
min-width: 0;
overflow: hidden;
font-size: 15px;
font-weight: 600;
text-overflow: ellipsis;
white-space: nowrap;
}
.site-icon {
position: relative;
display: inline-flex;
overflow: hidden;
flex: none;
align-items: center;
justify-content: center;
border-radius: 11px;
}
.site-icon svg,
.site-icon img {
display: block;
max-width: 100%;
max-height: 100%;
}
.site-icon img {
width: 100%;
height: 100%;
object-fit: contain;
border-radius: 10px;
}
.site-icon__image {
position: absolute;
inset: 0;
}
.site-icon__image--loading {
opacity: 0;
}
.site-icon--initial::before {
content: attr(data-initial);
}
.site-icon--initial {
color: var(--primary-hover);
font-size: 15px;
font-weight: 700;
background: rgba(219, 234, 254, 0.7);
box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.08);
}
.local-search-results,
.sidebar__nav {
scrollbar-color: rgba(100, 116, 139, 0.32) transparent;
scrollbar-width: thin;
}
@media (max-width: 1199px) {
:root {
--sidebar-expanded: 220px;
}
.home-content {
padding-inline: 28px;
}
.quick-links__grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
scroll-behavior: auto !important;
transition-duration: 0.01ms !important;
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
}
}