chore: initial commit

This commit is contained in:
2026-07-30 17:59:42 +08:00
commit 155f06846d
62 changed files with 7852 additions and 0 deletions
+180
View File
@@ -0,0 +1,180 @@
:root { font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif; color: #172033; background: #f5f7f8; font-synthesis: none; --primary: #075e54; --primary-dark: #064b44; --navy: #17324d; --border: #e1e7ea; --muted: #687780; }
* { box-sizing: border-box; }
html, body, #app { min-width: 320px; min-height: 100%; margin: 0; }
body { min-height: 100vh; background: #f5f7f8; }
button, input { font: inherit; }
a { color: inherit; }
.client-shell { min-height: 100vh; overflow-x: hidden; }
.top-header { position: fixed; inset: 0 0 auto 0; z-index: 20; display: flex; width: 100%; max-width: 100vw; height: 68px; align-items: center; padding: 0 28px; border-bottom: 1px solid var(--border); background: #fff; }
.client-brand { display: flex; width: 232px; min-width: 0; align-items: center; gap: 11px; color: var(--navy); text-decoration: none; }
.client-brand-mark, .auth-brand span { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 8px; background: var(--primary); color: #fff; font-size: 13px; font-weight: 800; }
.client-brand > span:last-child { display: flex; flex-direction: column; }
.client-brand strong { font-size: 15px; }
.client-brand small { margin-top: 1px; color: var(--muted); font-size: 10px; }
.tenant-name { display: flex; flex: 1; align-items: center; gap: 8px; color: #475467; font-size: 13px; }
.client-user { display: flex; align-items: center; gap: 10px; }
.client-avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: #e7f3f1; color: var(--primary); font-weight: 750; }
.client-user-copy { display: flex; flex-direction: column; }
.client-user-copy strong { font-size: 12px; }
.client-user-copy small { color: var(--muted); font-size: 10px; }
.client-sidebar { position: fixed; inset: 68px auto 0 0; display: flex; width: 232px; flex-direction: column; overflow: hidden; padding: 20px 14px; border-right: 1px solid var(--border); background: #fff; }
.client-sidebar nav { display: flex; flex: 1; min-width: 0; min-height: 0; flex-direction: column; overflow-x: hidden; overflow-y: auto; }
.client-nav-menu,
.client-nav-submenu { min-width: 0; margin: 0; padding: 0; list-style: none; }
.client-nav-menu { flex: 1; background: transparent; }
.client-nav-submenu { padding-left: 37px; }
.client-nav-node { min-width: 0; }
.client-sidebar-group-trigger,
.client-sidebar-link { display: flex; width: 100%; height: 44px; min-width: 0; align-items: center; gap: 11px; margin: 2px 0; padding: 0 10px; border-radius: 8px; color: #52616b; }
.client-sidebar-group-trigger { border: 0; background: transparent; cursor: pointer; text-align: left; }
.client-sidebar-link { text-decoration: none; }
.client-sidebar-group-trigger:hover,
.client-sidebar-link:hover { background: #f2f7f6; color: var(--primary); }
.client-sidebar-link[aria-current="page"] { background: #e9f4f2; color: var(--primary); font-weight: 650; }
.client-nav-node.is-active-parent > .client-sidebar-group-trigger { background: #f2f7f6; color: var(--primary); font-weight: 600; }
.client-sidebar .client-sidebar-group-trigger svg,
.client-sidebar .client-sidebar-link svg { flex: 0 0 18px; }
.client-sidebar .client-sidebar-group-chevron { width: 16px; height: 16px; flex: 0 0 16px; margin-left: auto; transition: transform .2s ease; }
.client-sidebar-group-trigger[aria-expanded="true"] .client-sidebar-group-chevron { transform: rotate(180deg); }
.client-sidebar-group-trigger span,
.client-sidebar-link span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-sidebar-group-trigger:focus-visible,
.client-sidebar-link:focus-visible,
.client-page-heading > button:focus-visible,
.client-sidebar-header button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.client-sidebar-header,
.client-sidebar-scrim { display: none; }
.sidebar-help { display: flex; flex: 0 0 auto; flex-direction: column; gap: 4px; margin-top: 16px; padding: 14px; border-left: 3px solid var(--primary); background: #f2f7f6; }
.sidebar-help strong { font-size: 12px; }
.sidebar-help span { color: var(--muted); font-size: 11px; }
.client-main { width: calc(100% - 232px); max-width: 100%; min-height: 100vh; margin-left: 232px; padding: 92px 28px 40px; }
.client-page-heading { display: flex; min-width: 0; align-items: center; gap: 12px; margin-bottom: 22px; }
.client-page-heading > div { min-width: 0; }
.client-page-heading button { display: none; width: 44px; height: 44px; flex: 0 0 44px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--navy); }
.client-page-heading h1 { margin: 0; font-size: 22px; }
.client-page-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.auth-page { min-height: 100vh; background: #eef3f3; }
.auth-header { display: flex; height: 72px; align-items: center; justify-content: space-between; padding: 0 clamp(24px, 6vw, 90px); border-bottom: 1px solid var(--border); background: #fff; color: var(--muted); font-size: 13px; }
.auth-brand { display: flex; align-items: center; gap: 10px; color: var(--navy); text-decoration: none; }
.auth-header a { color: var(--primary); text-decoration: none; }
.auth-main { display: grid; min-height: calc(100vh - 72px); grid-template-columns: 1fr 440px; align-items: center; gap: clamp(60px, 10vw, 150px); width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 50px 0; }
.auth-kicker, .section-label { color: var(--primary); font-size: 11px; font-weight: 750; letter-spacing: .13em; }
.auth-copy h1 { margin: 15px 0 20px; color: var(--navy); font-size: clamp(38px, 4.5vw, 62px); line-height: 1.14; letter-spacing: -.04em; }
.auth-copy > p { max-width: 520px; color: var(--muted); font-size: 16px; line-height: 1.8; }
.auth-facts { display: flex; gap: 8px; margin-top: 32px; flex-wrap: wrap; }
.auth-facts span { padding: 8px 12px; border: 1px solid #cbdad7; background: rgba(255,255,255,.7); color: #40534f; font-size: 12px; }
.auth-card { padding: 38px; border: 1px solid var(--border); background: #fff; box-shadow: 0 14px 36px rgba(23,50,77,.08); }
.auth-card h2 { margin: 0 0 8px; font-size: 26px; }
.auth-card > p { margin: 0 0 28px; color: var(--muted); }
.auth-form-options { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: -2px 0 18px; }
.auth-form-options button { min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--primary); cursor: pointer; }
.auth-form-options button:hover { text-decoration: underline; }
.auth-form-options button:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.auth-submit { width: 100%; }
.auth-submit span { display: flex; align-items: center; gap: 7px; }
.demo-tip { display: flex; flex-direction: column; gap: 3px; margin-top: 18px; padding: 10px 12px; background: #f2f7f6; color: var(--muted); font-size: 12px; line-height: 1.55; }
.demo-tip strong { color: #40534f; }
.register-page { min-height: 100vh; background: #f5f7f8; }
.register-header { display: flex; height: 68px; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 5vw, 72px); border-bottom: 1px solid var(--border); background: #fff; }
.register-header > a { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; text-decoration: none; }
.register-main { width: min(920px, calc(100% - 32px)); margin: 36px auto; padding: 34px 38px; border: 1px solid var(--border); background: #fff; }
.register-title { display: flex; align-items: center; gap: 14px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.register-title > div { display: grid; width: 44px; height: 44px; place-items: center; background: #e7f3f1; color: var(--primary); }
.register-title h1 { margin: 0 0 5px; font-size: 23px; }
.register-title p { margin: 0; color: var(--muted); font-size: 12px; }
.register-form { margin-top: 28px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
.agreement-item { margin-bottom: 8px; }
.agreement-control { display: flex; min-height: 44px; align-items: center; gap: 4px; flex-wrap: wrap; color: var(--muted); }
.agreement-item .el-checkbox { min-height: 44px; white-space: normal; }
.agreement-item button { padding: 0; border: 0; background: transparent; color: var(--primary); cursor: pointer; }
.agreement-item button:hover { text-decoration: underline; }
.agreement-item button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.register-security-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.register-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.registration-result { display: flex; min-height: 470px; align-items: center; justify-content: center; flex-direction: column; color: var(--primary); text-align: center; }
.registration-result h1 { margin: 18px 0 8px; color: var(--navy); font-size: 26px; }
.registration-result > p { max-width: 600px; margin: 0; color: var(--muted); line-height: 1.7; overflow-wrap: anywhere; }
.registration-result > p strong { color: var(--navy); }
.registration-result dl { display: grid; width: min(620px, 100%); grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 28px 0 0; border: 1px solid var(--border); color: var(--navy); text-align: left; }
.registration-result dl div { min-width: 0; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.registration-result dl div:nth-child(odd) { border-right: 1px solid var(--border); }
.registration-result dt { color: var(--muted); font-size: 11px; }
.registration-result dd { margin: 5px 0 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 650; }
.registration-next-step { display: flex; width: min(620px, 100%); flex-direction: column; gap: 5px; margin-top: 18px; padding: 14px 16px; border: 1px solid #d9cfad; background: #fff9e9; color: var(--muted); font-size: 12px; line-height: 1.65; text-align: left; }
.registration-next-step strong { color: var(--navy); font-size: 13px; }
.registration-result-actions { display: flex; justify-content: center; gap: 10px; margin-top: 28px; }
.client-dashboard { display: flex; flex-direction: column; gap: 18px; }
.quick-order-band { display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 26px 28px; border-left: 4px solid var(--primary); background: var(--navy); color: #fff; }
.quick-order-band span { color: #84c3ba; font-size: 11px; font-weight: 700; }
.quick-order-band h2 { margin: 6px 0; font-size: 22px; }
.quick-order-band p { margin: 0; color: #c6d0db; font-size: 13px; }
.client-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.client-stats article { display: flex; align-items: center; gap: 14px; padding: 20px; border: 1px solid var(--border); background: #fff; color: var(--primary); }
.client-stats article div { display: flex; flex-direction: column; gap: 3px; }
.client-stats span { color: var(--muted); font-size: 12px; }
.client-stats strong { color: var(--navy); font-size: 24px; }
.client-content-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 18px; }
.client-card { padding: 22px; border: 1px solid var(--border); background: #fff; box-shadow: 0 3px 12px rgba(23,50,77,.035); }
.client-card header { display: flex; align-items: center; justify-content: space-between; }
.client-card h3 { margin: 5px 0 14px; font-size: 17px; }
.client-empty { display: grid; min-height: 190px; place-items: center; border-top: 1px solid var(--border); color: #98a2a9; font-size: 13px; text-align: center; }
.recent-orders { border-top: 1px solid var(--border); }
.recent-orders button { display: flex; width: 100%; min-height: 62px; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border: 0; border-bottom: 1px solid var(--border); background: transparent; cursor: pointer; text-align: left; }
.recent-orders button:hover { color: var(--primary); }
.recent-orders button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.recent-orders button > span { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.recent-orders strong { font-size: 13px; }
.recent-orders small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.profile-summary { margin: 0 0 20px; }
.profile-summary div { display: flex; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--border); font-size: 12px; }
.profile-summary dt { color: var(--muted); }
.profile-summary dd { margin: 0; font-weight: 600; }
.module-stack { display: flex; flex-direction: column; gap: 14px; }
.module-actions { display: flex; justify-content: flex-end; gap: 10px; }
.module-actions .el-input { width: 280px; }
.module-empty { display: flex; min-height: 430px; align-items: center; justify-content: center; flex-direction: column; text-align: center; }
.module-empty-icon { display: grid; width: 56px; height: 56px; place-items: center; margin-bottom: 17px; background: #eaf2f1; color: var(--primary); }
.module-empty h2 { margin: 0 0 7px; font-size: 20px; }
.module-empty p { max-width: 540px; margin: 0 0 18px; color: var(--muted); }
.el-button--primary { --el-button-bg-color: var(--primary); --el-button-border-color: var(--primary); --el-button-hover-bg-color: var(--primary-dark); --el-button-hover-border-color: var(--primary-dark); }
@media (max-width: 960px) {
.auth-main { grid-template-columns: 1fr; width: min(520px, calc(100% - 32px)); }
.auth-copy { display: none; }
.client-content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
.top-header { padding: 0 14px; }
.client-sidebar { display: flex; width: min(286px, 86vw); padding: 0 14px 18px; visibility: hidden; pointer-events: none; transform: translateX(-100%); transition: transform .2s ease, visibility 0s linear .2s; z-index: 19; }
.mobile-menu-open .client-sidebar { visibility: visible; pointer-events: auto; transform: translateX(0); transition-delay: 0s; }
.client-sidebar-scrim { position: fixed; inset: 68px 0 0; z-index: 18; display: block; padding: 0; border: 0; background: rgba(23, 50, 77, .48); }
.client-sidebar-header { display: flex; height: 52px; flex: 0 0 52px; align-items: center; justify-content: space-between; color: var(--navy); }
.client-sidebar-header strong { font-size: 13px; }
.client-sidebar-header button { display: grid; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--navy); place-items: center; }
.client-main { width: 100%; max-width: 100%; margin-left: 0; padding: 88px 14px 30px; }
.client-brand { width: auto; }
.tenant-name, .client-user-copy { display: none; }
.client-user { margin-left: auto; }
.client-page-heading > button { display: grid; width: 44px; height: 44px; place-items: center; }
.client-stats { grid-template-columns: 1fr; }
.quick-order-band { align-items: flex-start; flex-direction: column; }
.form-grid { grid-template-columns: 1fr; }
.auth-header { padding: 0 18px; }
.auth-header > div:last-child { display: none; }
.auth-card, .register-main { padding: 26px 20px; }
.registration-result dl { grid-template-columns: 1fr; }
.registration-result dl div:nth-child(odd) { border-right: 0; }
.registration-result-actions { width: 100%; }
.registration-result-actions .el-button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
.client-sidebar,
.client-sidebar-group-chevron { transition: none; }
}
+49
View File
@@ -0,0 +1,49 @@
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
const styles = readFileSync(new URL('./index.css', import.meta.url), 'utf8')
const compact = styles.replace(/\/\*[\s\S]*?\*\//g, '').replace(/\s+/g, ' ')
const mobileStyles = compact.slice(compact.indexOf('@media (max-width: 720px)'))
test('style source contract: constrains the desktop sidebar and gives the menu its own scroll region', () => {
assert.match(compact, /\.client-shell\s*\{[^}]*overflow-x:\s*hidden/)
assert.match(compact, /\.client-sidebar\s*\{[^}]*overflow:\s*hidden/)
assert.match(compact, /\.client-sidebar nav\s*\{[^}]*flex:\s*1[^}]*min-height:\s*0[^}]*overflow-y:\s*auto/)
assert.match(compact, /\.client-nav-menu,[^\{]*\.client-nav-submenu\s*\{[^}]*min-width:\s*0/)
assert.match(compact, /\.client-nav-menu\s*\{[^}]*flex:\s*1[^}]*background:\s*transparent/)
assert.match(compact, /\.client-sidebar-header,\s*\.client-sidebar-scrim\s*\{[^}]*display:\s*none/)
})
test('style source contract: presents native grouped rows with restrained active states and truncation', () => {
assert.doesNotMatch(compact, /\.client-sidebar \.el-menu|\.el-menu-item|\.el-sub-menu/)
assert.match(compact, /\.client-nav-menu,[^\{]*\.client-nav-submenu\s*\{[^}]*margin:\s*0[^}]*padding:\s*0[^}]*list-style:\s*none/)
assert.match(compact, /\.client-sidebar-group-trigger,[^\{]*\.client-sidebar-link\s*\{[^}]*height:\s*44px[^}]*border-radius:\s*8px/)
assert.match(compact, /\.client-sidebar-link\[aria-current="page"\]\s*\{[^}]*background:\s*#e9f4f2[^}]*color:\s*var\(--primary\)/)
assert.match(compact, /\.client-nav-node\.is-active-parent > \.client-sidebar-group-trigger\s*\{[^}]*background:\s*#f2f7f6[^}]*color:\s*var\(--primary\)/)
assert.match(compact, /\.client-nav-submenu\s*\{[^}]*padding-left:\s*3[6-8]px/)
assert.match(compact, /\.client-sidebar-group-trigger\s*\{[^}]*border:\s*0[^}]*background:\s*transparent/)
assert.match(compact, /\.client-sidebar-link\s*\{[^}]*text-decoration:\s*none/)
assert.match(compact, /\.client-sidebar (?:\.client-sidebar-group-trigger|\.client-sidebar-link) svg[^\{]*\{[^}]*flex:\s*0 0 18px/)
assert.match(compact, /\.client-sidebar-group-trigger span,[^\{]*\.client-sidebar-link span\s*\{[^}]*min-width:\s*0[^}]*overflow:\s*hidden[^}]*text-overflow:\s*ellipsis[^}]*white-space:\s*nowrap/)
})
test('style source contract: makes navigation and drawer controls touch sized with visible keyboard focus', () => {
assert.match(compact, /\.client-sidebar-group-trigger,[^\{]*\.client-sidebar-link\s*\{[^}]*height:\s*44px/)
assert.match(compact, /\.client-sidebar-group-trigger:focus-visible,[^\{]*\.client-sidebar-link:focus-visible,[^\{]*\.client-page-heading > button:focus-visible,[^\{]*\.client-sidebar-header button:focus-visible\s*\{[^}]*outline:\s*2px solid var\(--primary\)[^}]*outline-offset:\s*2px/)
})
test('style source contract: turns the sidebar into a layered drawer at 720px and below', () => {
assert.doesNotMatch(mobileStyles, /\.client-sidebar\s*\{[^}]*display:\s*none/)
assert.match(mobileStyles, /\.client-sidebar\s*\{[^}]*display:\s*flex[^}]*width:\s*min\(286px,\s*86vw\)[^}]*visibility:\s*hidden[^}]*pointer-events:\s*none[^}]*transform:\s*translateX\(-100%\)[^}]*transition:\s*transform \.2s ease, visibility 0s linear \.2s[^}]*z-index:\s*19/)
assert.match(mobileStyles, /\.mobile-menu-open \.client-sidebar\s*\{[^}]*visibility:\s*visible[^}]*pointer-events:\s*auto[^}]*transform:\s*translateX\(0\)[^}]*transition-delay:\s*0s/)
assert.match(mobileStyles, /\.client-sidebar-scrim\s*\{[^}]*position:\s*fixed[^}]*inset:\s*68px 0 0[^}]*z-index:\s*18[^}]*background:\s*rgba\(23,\s*50,\s*77,\s*\.48\)/)
assert.match(mobileStyles, /\.client-sidebar-header\s*\{[^}]*display:\s*flex[^}]*height:\s*52px/)
assert.match(mobileStyles, /\.client-main\s*\{[^}]*max-width:\s*100%[^}]*margin-left:\s*0/)
assert.match(mobileStyles, /\.client-page-heading > button\s*\{[^}]*display:\s*grid[^}]*width:\s*44px[^}]*height:\s*44px/)
assert.match(mobileStyles, /\.client-user\s*\{[^}]*margin-left:\s*auto/)
})
test('style source contract: removes drawer motion when reduced motion is preferred', () => {
assert.match(compact, /@media \(prefers-reduced-motion: reduce\)\s*\{\s*\.client-sidebar,[^\{]*\.client-sidebar-group-chevron\s*\{[^}]*transition:\s*none/)
})