Spaces:
Sleeping
Sleeping
File size: 18,569 Bytes
18115ce | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | /* The whole interface: sidebar | stage (toolbar, page pane | text pane). Gradio scopes this file to
the component by wrapping it in "#<component id> { ... }", so every rule is nested, and @keyframes
live in app.py's global CSS together with the colour tokens (--lo-*), which switch with the theme.
Evaluated as a JS template string too: no backticks and no dollar-brace placeholders in here. */
--c: #9ca3af;
display: block;
height: 100dvh;
min-height: 560px;
container-type: inline-size;
color: var(--lo-ink);
font: 13.5px/1.5 var(--lo-font);
-webkit-font-smoothing: antialiased;
* { box-sizing: border-box }
[hidden] { display: none !important }
button { font: inherit; color: inherit; cursor: pointer }
button:disabled { cursor: default }
input, output { font: inherit }
a { color: inherit }
svg { flex: none }
.app { display: grid; grid-template-columns: 304px minmax(0, 1fr); height: 100%; background: var(--lo-bg) }
/* ---- Sidebar ------------------------------------------------------------------------------ */
.side { display: flex; flex-direction: column; gap: 18px; min-height: 0; overflow: auto; padding: 18px 16px 20px; background: var(--lo-surface); border-right: 1px solid var(--lo-line); scrollbar-width: thin }
.brand { display: flex; align-items: center; gap: 8px; padding: 0 2px }
.logo svg { display: block; height: 22px; width: auto }
.logo-dark { display: none }
.brand-sub { padding-top: 1px; color: var(--lo-muted); font-size: 12.5px; font-weight: 600; letter-spacing: .04em; white-space: nowrap }
.theme { margin-left: auto }
.theme .moon { display: none }
.about { margin: -8px 2px 0; color: var(--lo-muted); font-size: 12.5px; line-height: 1.5 }
.about code { padding: 1px 5px; border-radius: 5px; background: var(--lo-surface-2); border: 1px solid var(--lo-line); font: 11.5px var(--lo-mono) }
.icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--lo-muted); font-size: 16px; line-height: 1 }
.icon-btn:hover { background: var(--lo-surface-2); color: var(--lo-ink); border-color: var(--lo-line) }
.block { display: flex; flex-direction: column; gap: 8px }
.block-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 2px }
.label { color: var(--lo-muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase }
.hint { color: var(--lo-muted); font-size: 11.5px }
.help { margin: 2px 2px 0; color: var(--lo-muted); font-size: 11.5px; line-height: 1.45 }
/* Document: a drop target, then the file card and the page pager */
.drop { display: flex; flex-direction: column; gap: 8px }
.drop-empty { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1.5px dashed var(--lo-line-strong); border-radius: 12px; color: var(--lo-muted); cursor: pointer; transition: border-color .15s, background .15s }
.drop-empty:hover, .drop-empty.over { border-color: var(--lo-accent); background: var(--lo-accent-soft); color: var(--lo-ink) }
.drop-empty b { display: block; color: var(--lo-ink); font-weight: 600 }
.drop-empty span { display: block; font-size: 12px }
.drop-empty u { text-decoration: underline; text-underline-offset: 2px }
.doc-card { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 12px; border: 1px solid var(--lo-line); border-radius: 12px; background: var(--lo-surface-2) }
.doc-icon { color: var(--lo-accent) }
.doc-meta { flex: 1; min-width: 0 }
.doc-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.doc-sub { color: var(--lo-muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.pager { display: flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid var(--lo-line); border-radius: 10px; background: var(--lo-surface-2) }
.pager button { width: 30px; height: 28px; border: 0; border-radius: 7px; background: transparent; font-size: 18px; line-height: 1; color: var(--lo-muted) }
.pager button:hover:not(:disabled) { background: var(--lo-surface); color: var(--lo-ink) }
.pager button:disabled { opacity: .35 }
.pager-mid { flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px; color: var(--lo-muted); font-size: 12.5px; font-variant-numeric: tabular-nums }
.pager input { width: 44px; height: 26px; padding: 0 4px; border: 1px solid var(--lo-line); border-radius: 6px; background: var(--lo-surface); color: var(--lo-ink); text-align: center; -moz-appearance: textfield }
.pager input::-webkit-outer-spin-button, .pager input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0 }
.pager input:focus { outline: 2px solid var(--lo-accent); outline-offset: -1px }
/* Model: one card per variant */
.models { display: flex; flex-direction: column; gap: 6px }
.model { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 10px; padding: 9px 12px 10px; border: 1px solid var(--lo-line); border-radius: 11px; background: var(--lo-surface); text-align: left; transition: border-color .15s, background .15s }
.model:hover { border-color: var(--lo-line-strong); background: var(--lo-surface-2) }
.model[aria-checked=true] { border-color: var(--lo-accent); background: var(--lo-accent-soft); box-shadow: inset 0 0 0 1px var(--lo-accent) }
.model-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.model-size { align-self: start; padding: 1px 7px; border-radius: 99px; background: var(--lo-surface-2); border: 1px solid var(--lo-line); color: var(--lo-muted); font: 600 10.5px/16px var(--lo-mono) }
.model[aria-checked=true] .model-size { background: var(--lo-accent); border-color: var(--lo-accent); color: #fff }
.model-desc { grid-column: 1 / -1; color: var(--lo-muted); font-size: 11.5px; line-height: 1.4 }
/* Segmented controls */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; border: 1px solid var(--lo-line); border-radius: 10px; background: var(--lo-surface-2) }
.seg button { height: 30px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--lo-muted); font-weight: 500; white-space: nowrap; transition: background .12s, color .12s }
.seg button:hover:not(:disabled) { color: var(--lo-ink) }
.seg button[aria-pressed=true], .seg button[aria-pressed=true]:hover { background: var(--lo-surface); color: var(--lo-ink); box-shadow: 0 1px 2px rgba(15, 23, 42, .12), 0 0 0 1px var(--lo-line) }
.seg button:disabled { opacity: .4 }
.seg.small { grid-auto-columns: auto; padding: 2px; border-radius: 9px }
.seg.small button { height: 26px; min-width: 28px; padding: 0 9px; font-size: 12.5px }
/* Settings */
.settings { gap: 0 }
.settings summary { display: flex; align-items: center; gap: 8px; padding: 2px; list-style: none; cursor: pointer; user-select: none }
.settings summary::-webkit-details-marker { display: none }
.summary-value { flex: 1; color: var(--lo-muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right }
.chev { color: var(--lo-muted); transition: transform .15s }
.settings[open] .chev { transform: rotate(180deg) }
.setting { display: flex; flex-direction: column; gap: 6px; padding: 12px 2px 2px }
.setting-head { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 500 }
.setting-head output { color: var(--lo-muted); font-variant-numeric: tabular-nums }
.setting input[type=range] { width: 100%; margin: 2px 0; accent-color: var(--lo-accent) }
/* Run / stop */
.actions { display: flex; flex-direction: column; gap: 6px }
.run { display: flex; align-items: center; justify-content: space-between; height: 42px; padding: 0 12px 0 16px; border: 0; border-radius: 11px; background: var(--lo-accent); color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 1px 2px rgba(15, 23, 42, .12), inset 0 1px 0 rgba(255, 255, 255, .15); transition: filter .12s, transform .06s }
.run:hover:not(:disabled) { filter: brightness(1.07) }
.run:active:not(:disabled) { transform: translateY(1px) }
.run:disabled { opacity: .55 }
.run kbd { padding: 1px 6px; border-radius: 5px; background: rgba(255, 255, 255, .18); font: 11px var(--lo-mono) }
.stop { height: 36px; border: 1px solid var(--lo-line); border-radius: 10px; background: var(--lo-surface); color: var(--lo-danger); font-weight: 600 }
.stop:hover { border-color: var(--lo-danger) }
/* Examples */
.examples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px }
.ex { position: relative; aspect-ratio: 1; padding: 0; border: 1px solid var(--lo-line); border-radius: 10px; overflow: hidden; background: var(--lo-surface-2); transition: border-color .15s, transform .12s }
.ex img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top }
.ex span { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 6px 5px; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); color: #fff; font-size: 10.5px; line-height: 1.2; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.ex:hover { border-color: var(--lo-accent); transform: translateY(-1px) }
.ex.active { outline: 2px solid var(--lo-accent); outline-offset: 1px }
.links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding: 4px 2px 0 }
.links a { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border: 1px solid var(--lo-line); border-radius: 8px; color: var(--lo-ink); font-size: 12px; font-weight: 600; text-decoration: none }
.links a:hover { border-color: var(--lo-accent); color: var(--lo-accent) }
.links a.site { border-color: transparent; background: var(--lo-accent-soft); color: var(--lo-accent) }
/* ---- Stage -------------------------------------------------------------------------------- */
.stage { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0 }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-height: 52px; padding: 10px 18px; background: var(--lo-surface); border-bottom: 1px solid var(--lo-line) }
.status { display: flex; align-items: center; gap: 8px; flex: 1 1 220px; min-width: 140px; overflow: hidden }
.badge { padding: 3px 8px; border-radius: 99px; background: var(--lo-accent-soft); color: var(--lo-accent); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap }
.badge:empty { display: none }
.msg { color: var(--lo-muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.msg.error { color: var(--lo-danger); white-space: normal }
.spin { width: 12px; height: 12px; border: 2px solid var(--lo-accent-soft); border-top-color: var(--lo-accent); border-radius: 50%; animation: lo-spin .8s linear infinite }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 18px; background: var(--lo-surface); border-bottom: 1px solid var(--lo-line) }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px 0 8px; border: 1px solid var(--lo-line); border-radius: 99px; background: var(--lo-surface-2); font-size: 12px; cursor: pointer; user-select: none; white-space: nowrap }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c) }
.chip b { font-weight: 500; color: var(--lo-muted); font-variant-numeric: tabular-nums }
.chip[aria-pressed=false] { opacity: .45; text-decoration: line-through }
.tools { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto }
.tool { height: 30px; padding: 0 11px; border: 1px solid var(--lo-line); border-radius: 9px; background: var(--lo-surface); font-size: 12.5px; font-weight: 500; white-space: nowrap }
.tool:hover:not(:disabled) { border-color: var(--lo-accent); color: var(--lo-accent) }
.tool:disabled { opacity: .4 }
.tool.done { border-color: var(--lo-ok); color: var(--lo-ok) }
.bar-links { display: flex; align-items: center; gap: 6px; flex: none; margin-left: auto }
.bar-links a { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 1px solid transparent; border-radius: 9px; background: var(--lo-accent-soft); color: var(--lo-accent); font-size: 12.5px; font-weight: 600; text-decoration: none; white-space: nowrap; transition: border-color .15s }
.bar-links a:hover { border-color: var(--lo-accent) }
.progress { height: 2px; margin-top: -1px; background: var(--lo-line); overflow: hidden }
.progress i { display: block; width: 30%; height: 100%; border-radius: 2px; background: var(--lo-accent); animation: lo-slide 1.3s ease-in-out infinite }
/* Panes, with a draggable gutter. --left is set by the gutter drag. */
.panes { --left: 50%; flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(260px, var(--left)) 6px minmax(260px, 1fr) }
/* position: relative matters: KaTeX puts an absolutely positioned (hidden) MathML copy in each
formula; without a positioned ancestor the pane cannot clip it. */
.pane { position: relative; overflow: auto; min-height: 0; scrollbar-gutter: stable; scrollbar-width: thin }
.left { padding: 22px }
.right { border-left: 1px solid var(--lo-line); background: var(--lo-bg) }
.gutter { position: relative; z-index: 3; margin: 0 -3px; cursor: col-resize }
.gutter:hover, .gutter.active { background: var(--lo-accent-soft) }
.empty { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 4px; padding: 24px; text-align: center; color: var(--lo-muted) }
.empty-art { margin-bottom: 10px; filter: drop-shadow(0 8px 20px rgba(15, 23, 42, .12)) }
.art-page { fill: var(--lo-surface); stroke: var(--lo-line) }
.art-title { fill: #d97706; opacity: .75 }
.art-text { fill: #2563eb; opacity: .35 }
.art-image { fill: #7c3aed; opacity: .3 }
.empty-title { color: var(--lo-ink); font-size: 15px; font-weight: 600 }
.empty-text { font-size: 12.5px }
/* The page, scaled to fit its pane (fitPage in app.js), and one .box per block. --c is the label colour. */
.page { position: relative; margin: 0 auto; background: #fff; border-radius: 4px; box-shadow: 0 1px 2px rgba(15, 23, 42, .1), 0 14px 36px rgba(15, 23, 42, .16) }
.page img { display: block; width: 100%; height: auto; border-radius: 4px }
.boxes { position: absolute; inset: 0 }
.box { position: absolute; border: 1px solid var(--c); border-radius: 2px; background: color-mix(in srgb, var(--c) 7%, transparent); cursor: pointer; transition: background .12s }
.box.inview { border-width: 1.5px; background: color-mix(in srgb, var(--c) 15%, transparent) }
.box.on { background: color-mix(in srgb, var(--c) 26%, transparent); box-shadow: 0 0 0 2px var(--c); z-index: 2 }
.box.cont { border-style: dashed }
.box.live { animation: lo-live 1s ease-in-out infinite }
.box::before { content: attr(data-label); position: absolute; left: -1px; bottom: 100%; padding: 0 5px; border-radius: 3px 3px 0 0; background: var(--c); color: #fff; font: 600 10px/15px var(--lo-mono); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s }
.box.on::before { opacity: 1 }
/* Text pane: one card per block, one document, or the raw output */
.panel { max-width: 860px; margin: 0 auto; padding: 18px 22px 64px; display: flex; flex-direction: column; gap: 8px }
.blk { min-width: 0; padding: 10px 14px 11px 16px; border-left: 3px solid var(--c); border-radius: 10px; background: var(--lo-surface); box-shadow: 0 1px 2px rgba(15, 23, 42, .06); cursor: pointer; transition: box-shadow .12s }
.blk.on { box-shadow: 0 0 0 2px var(--c) }
.blk .meta { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 3px; font-size: 11px }
.blk .lab { color: var(--c); font-weight: 700; letter-spacing: .06em; text-transform: uppercase }
.blk .bbox { color: var(--lo-muted); font: 11px/1.6 var(--lo-mono) }
.doc { padding: 30px 34px; border-radius: 12px; background: var(--lo-surface); box-shadow: 0 1px 2px rgba(15, 23, 42, .06); font-size: 15px; line-height: 1.65 }
pre.raw { margin: 0; padding: 14px 16px; border-radius: 12px; background: var(--lo-surface); box-shadow: 0 1px 2px rgba(15, 23, 42, .06); font: 12.5px/1.55 var(--lo-mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--lo-ink) }
.note { padding: 40px 0; color: var(--lo-muted); text-align: center }
.cursor { display: inline-block; width: 7px; height: 14px; margin-left: 2px; vertical-align: -2px; background: var(--lo-accent); animation: lo-blink 1s steps(2) infinite }
/* Rendered markdown */
.md { overflow-wrap: anywhere }
.md > :first-child { margin-top: 0 }
.md > :last-child { margin-bottom: 0 }
.md h1 { font-size: 1.5em } .md h2 { font-size: 1.3em } .md h3, .md h4 { font-size: 1.1em }
.md h1, .md h2, .md h3, .md h4 { margin: .6em 0 .4em; line-height: 1.25; font-weight: 700 }
.md p, .md ul, .md ol { margin: .5em 0 }
.md img { max-width: 100% }
.md .scroll { margin: 8px 0; max-width: 100%; overflow-x: auto }
.md table { margin: 0; border-collapse: collapse; font-size: 13px; width: max-content; max-width: none }
.md th, .md td { padding: 4px 9px; border: 1px solid var(--lo-line); text-align: left; vertical-align: top }
.md th { background: var(--lo-surface-2); font-weight: 600 }
.md pre { padding: 10px 12px; border-radius: 8px; background: var(--lo-surface-2); white-space: pre-wrap; overflow-wrap: anywhere }
.md code { font: 12.5px var(--lo-mono) }
.md a { color: var(--lo-accent) }
.md blockquote { margin: .5em 0; padding-left: 12px; border-left: 3px solid var(--lo-line); color: var(--lo-muted) }
.md .katex-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0 }
/* Drop anywhere */
.veil { position: absolute; inset: 10px; z-index: 20; display: grid; place-items: center; border: 2px dashed var(--lo-accent); border-radius: 16px; background: color-mix(in srgb, var(--lo-accent) 10%, var(--lo-bg)); color: var(--lo-accent); font-size: 18px; font-weight: 600; pointer-events: none }
/* ---- Narrow containers: the sidebar goes on top, the panes stack --------------------------- */
@container (max-width: 920px) {
height: auto;
.app { grid-template-columns: 1fr; height: auto }
.side { max-height: none; border-right: 0; border-bottom: 1px solid var(--lo-line) }
.stage { height: 92dvh }
.panes { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) 0 minmax(0, 1fr) }
.gutter { display: none }
.right { border-left: 0; border-top: 1px solid var(--lo-line) }
.tools { flex: 1 1 100%; margin-left: 0 }
}
|