feat: 实现网页实时预览

This commit is contained in:
SkyJourney
2026-07-25 21:52:45 +08:00
parent 7224dfdf60
commit fa07472428
16 changed files with 2860 additions and 218 deletions
+254 -125
View File
@@ -1,8 +1,6 @@
:root {
color: #1d2522;
background:
radial-gradient(circle at 12% 10%, rgb(197 225 210 / 45%), transparent 30rem),
#f2f0e9;
color: #1e2925;
background: #e9ece8;
font-family:
Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
font-synthesis: none;
@@ -26,169 +24,300 @@ textarea {
font: inherit;
}
.shell {
width: min(1120px, calc(100% - 40px));
margin: 0 auto;
padding: 88px 0;
}
.intro {
max-width: 760px;
}
.eyebrow,
.panel-label {
margin: 0 0 14px;
color: #34705a;
font-size: 0.75rem;
button,
.file-button {
min-height: 40px;
padding: 0 16px;
border: 1px solid #b8c2bd;
border-radius: 9px;
background: #fff;
color: #263a32;
font-size: 0.86rem;
font-weight: 700;
cursor: pointer;
}
button:disabled {
border-color: #d5d9d7;
background: #dfe3e1;
color: #8a938f;
cursor: not-allowed;
}
.workspace {
display: flex;
flex-direction: column;
min-height: 100vh;
}
.topbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 28px;
min-height: 92px;
padding: 18px 28px;
border-bottom: 1px solid #cbd2ce;
background: rgb(247 248 246 / 92%);
}
.eyebrow {
margin: 0 0 4px;
color: #3b755d;
font-size: 0.66rem;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
h1,
h2,
p {
margin-top: 0;
}
h1 {
max-width: 700px;
margin-bottom: 22px;
margin: 0;
font-family: Georgia, "Songti SC", serif;
font-size: clamp(3rem, 8vw, 6.4rem);
font-size: clamp(1.45rem, 3vw, 2rem);
font-weight: 500;
letter-spacing: -0.055em;
line-height: 0.94;
letter-spacing: -0.025em;
}
.summary {
max-width: 610px;
margin-bottom: 28px;
color: #56615d;
font-size: 1.15rem;
line-height: 1.7;
.topbar-actions {
display: flex;
gap: 10px;
}
.status {
.file-button {
display: inline-flex;
align-items: center;
gap: 10px;
color: #315a4b;
}
.file-button input {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip: rect(0 0 0 0);
}
.editor-layout {
display: grid;
grid-template-columns: minmax(360px, 0.8fr) minmax(520px, 1.2fr);
flex: 1;
min-height: 0;
}
.editor-panel,
.preview-panel {
display: flex;
flex-direction: column;
min-width: 0;
min-height: calc(100vh - 92px);
}
.editor-panel {
border-right: 1px solid #cbd2ce;
background: #f6f7f5;
}
.panel-heading {
display: flex;
align-items: center;
justify-content: space-between;
gap: 18px;
min-height: 66px;
padding: 12px 20px;
border-bottom: 1px solid #d9dedb;
background: rgb(255 255 255 / 70%);
}
.panel-heading > div {
display: flex;
flex-direction: column;
min-width: 0;
}
.panel-heading strong {
overflow: hidden;
font-size: 0.9rem;
font-weight: 650;
text-overflow: ellipsis;
white-space: nowrap;
}
.status-dot {
width: 9px;
height: 9px;
border-radius: 50%;
background: #3da073;
box-shadow: 0 0 0 5px rgb(61 160 115 / 13%);
.panel-kicker {
margin-bottom: 3px;
color: #7a8580;
font-size: 0.65rem;
font-weight: 750;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.panel {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(420px, 1.25fr);
gap: 48px;
align-items: end;
margin-top: 80px;
padding: 34px;
border: 1px solid rgb(41 64 55 / 14%);
border-radius: 20px;
background: rgb(255 255 255 / 58%);
box-shadow: 0 24px 60px rgb(49 67 59 / 8%);
backdrop-filter: blur(18px);
.render-status {
flex: none;
max-width: 48%;
overflow: hidden;
color: #4f695e;
font-size: 0.72rem;
text-overflow: ellipsis;
white-space: nowrap;
}
.panel h2 {
margin-bottom: 0;
font-family: Georgia, "Songti SC", serif;
font-size: clamp(1.8rem, 4vw, 3rem);
font-weight: 500;
.render-status.is-error {
color: #a23d3d;
}
.facts {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 12px;
margin: 0;
.theme-control {
display: flex;
flex: none;
align-items: center;
gap: 6px;
max-width: 56%;
}
.facts div {
padding: 18px;
border-radius: 13px;
background: #e6ebe6;
}
.facts dt {
margin-bottom: 7px;
color: #6b756f;
font-size: 0.75rem;
}
.facts dd {
margin: 0;
.theme-control select {
min-width: 0;
max-width: 220px;
height: 34px;
padding: 0 28px 0 10px;
overflow: hidden;
border: 1px solid #c9d4ce;
border-radius: 8px;
outline: 0;
background: #f8fbf9;
color: #356c55;
font-size: 0.74rem;
font-weight: 700;
text-overflow: ellipsis;
}
.capabilities {
.theme-control select:focus {
border-color: #74a88f;
box-shadow: 0 0 0 3px rgb(116 168 143 / 16%);
}
.local-theme-mark {
padding: 4px 7px;
border-radius: 999px;
background: #e3eee8;
color: #356c55;
font-size: 0.65rem;
font-weight: 800;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
textarea {
flex: 1;
width: 100%;
min-height: 560px;
padding: 24px;
border: 0;
outline: 0;
resize: none;
background: #f6f7f5;
color: #26312d;
font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
font-size: 0.86rem;
line-height: 1.72;
tab-size: 2;
}
textarea:focus {
box-shadow: inset 3px 0 #74a88f;
}
.preview-panel {
background:
linear-gradient(90deg, rgb(37 52 45 / 4%) 1px, transparent 1px),
linear-gradient(rgb(37 52 45 / 4%) 1px, transparent 1px),
#e6e9e5;
background-size: 22px 22px;
}
.preview-scroll {
flex: 1;
overflow: auto;
padding: 34px;
}
.paper {
width: 210mm;
min-width: 210mm;
min-height: 297mm;
margin: 0 auto;
padding: 20mm 18mm;
background: #fff;
box-shadow: 0 18px 48px rgb(37 49 43 / 16%);
}
.paper.is-local-theme {
padding: 8mm;
}
.preview-frame {
display: block;
width: 100%;
min-height: 500px;
border: 0;
background: #fff;
}
.preview-loading {
display: grid;
grid-template-columns: repeat(5, 1fr);
margin-top: 20px;
border-top: 1px solid rgb(41 64 55 / 16%);
min-height: 500px;
place-items: center;
color: #7a8580;
font-size: 0.9rem;
}
.capabilities article {
min-height: 132px;
padding: 20px 16px;
border-right: 1px solid rgb(41 64 55 / 16%);
}
.capabilities article:last-child {
border-right: 0;
}
.capabilities span {
color: #7e8983;
font-family: Georgia, serif;
font-size: 0.75rem;
}
.capabilities p {
margin: 42px 0 0;
font-size: 0.92rem;
font-weight: 650;
line-height: 1.45;
}
@media (max-width: 760px) {
.shell {
width: min(100% - 28px, 1120px);
padding: 48px 0;
@media (max-width: 900px) {
.topbar {
align-items: flex-start;
padding: 16px;
}
.panel {
grid-template-columns: 1fr;
margin-top: 56px;
padding: 24px;
.topbar-actions {
flex-direction: column;
}
.facts {
.editor-layout {
grid-template-columns: 1fr;
}
.capabilities {
grid-template-columns: 1fr;
.editor-panel,
.preview-panel {
min-height: 650px;
}
.capabilities article {
min-height: auto;
.editor-panel {
border-right: 0;
border-bottom: 1px solid rgb(41 64 55 / 16%);
border-bottom: 1px solid #cbd2ce;
}
.capabilities p {
margin-top: 16px;
.preview-scroll {
padding: 18px 10px;
}
.paper {
min-height: auto;
padding: 14mm 10mm;
}
.paper.is-local-theme {
padding: 8mm;
}
.theme-control {
max-width: 62%;
}
.theme-control select {
max-width: 150px;
}
}