mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-11-30 16:48:21 +01:00
556 lines
12 KiB
CSS
556 lines
12 KiB
CSS
/* LCUI Documentation Viewer - Global styles
|
|
*
|
|
* Hand-maintained. Loaded into the doc-viewer via `import "./global.css"`
|
|
* in app/layout.tsx; lcui-cli converts this file to app/global.css.h on
|
|
* each build and the runtime registers the rules via
|
|
* `ui_load_css_string`.
|
|
*
|
|
* Tailwind utilities are reused through @apply where possible so the
|
|
* spacing / typography scale stays consistent with any inline tailwind
|
|
* class an MDX-derived page widget might emit.
|
|
*/
|
|
|
|
@tailwind components;
|
|
@tailwind utilities;
|
|
|
|
/* Geist ships variable TTF files (wght 100-900), which FreeType can load
|
|
* directly. The lcui-cli asset loader copies each file into dist/assets and
|
|
* preloads it with pd_font_library_load_file() before the UI starts. */
|
|
@font-face {
|
|
font-family: "Geist";
|
|
src: url("../node_modules/geist/dist/fonts/geist-sans/Geist-Variable.ttf");
|
|
}
|
|
|
|
@font-face {
|
|
font-family: "Geist Mono";
|
|
src: url("../node_modules/geist/dist/fonts/geist-mono/GeistMono-Variable.ttf");
|
|
}
|
|
|
|
* {
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.typeset {
|
|
color: #000;
|
|
font-family: "Geist", "Noto Sans SC", sans-serif;
|
|
}
|
|
|
|
root {
|
|
min-width: 800px;
|
|
min-height: 480px;
|
|
|
|
@apply text-base;
|
|
}
|
|
|
|
textinput {
|
|
min-width: 20px;
|
|
}
|
|
|
|
/* -- Page -- */
|
|
|
|
.doc-page {
|
|
@apply px-4 py-8 max-w-3xl mx-auto;
|
|
}
|
|
.doc-page-desc {
|
|
@apply text-lg text-gray-600 mb-6 leading-relaxed;
|
|
}
|
|
.doc-section {
|
|
@apply mb-8;
|
|
}
|
|
|
|
/* -- Locale-controlled visibility --
|
|
*
|
|
* Any element that should only appear when a specific locale is active
|
|
* on ui_root() gets both `.lang` and the matching locale class.
|
|
* `.lang` hides by default; the override below shows it when the root
|
|
* locale matches. Components like sidebar and code-block-copy share
|
|
* this pattern. */
|
|
|
|
.lang {
|
|
display: none;
|
|
}
|
|
.en .lang.en,
|
|
.zh-CN .lang.zh-CN {
|
|
display: block;
|
|
}
|
|
|
|
/* -- Semantic typography (h1-h6, p) --
|
|
*
|
|
* These are registered as `text` widget aliases in app/main.c. Each
|
|
* tag maps to a tailwind size on the default type scale; p shares the
|
|
* h6 size and is distinguished only by weight. */
|
|
|
|
h1, h2, h3, h4, h5, h6 {
|
|
@apply font-bold text-gray-900 leading-normal;
|
|
}
|
|
h1 {
|
|
@apply text-4xl mb-4;
|
|
}
|
|
h2 {
|
|
@apply text-3xl mt-8 mb-3;
|
|
}
|
|
h3 {
|
|
@apply text-2xl mt-6 mb-2;
|
|
}
|
|
h4 {
|
|
@apply text-xl mt-6 mb-2;
|
|
}
|
|
h5 {
|
|
@apply text-lg mt-4 mb-2;
|
|
}
|
|
h6 {
|
|
@apply text-base mt-4 mb-2;
|
|
}
|
|
p {
|
|
@apply text-base text-gray-800 mb-3 leading-relaxed;
|
|
}
|
|
|
|
/* -- Code block card --
|
|
*
|
|
* Light-themed card: a 1px border with rounded corners, a gray header
|
|
* carrying the file name (or language) plus a clickable Copy button,
|
|
* and a white body with one <Text> per source line. Both the demo
|
|
* code blocks and MDX-derived fenced blocks share this structure
|
|
* (see scripts/compiler/page-generator.ts). */
|
|
|
|
.code-block {
|
|
@apply rounded border border-gray-200 my-4 bg-white;
|
|
}
|
|
.code-block-header {
|
|
@apply flex flex-row items-center pl-3 pr-1 py-1 bg-gray-50 border-b border-gray-200 min-h-[36px];
|
|
}
|
|
.code-block-title {
|
|
@apply flex-1 text-sm text-gray-700;
|
|
}
|
|
.code-block-copy {
|
|
position: absolute;
|
|
top: 8px;
|
|
right: 8px;
|
|
@apply flex gap-1 items-center px-2 py-1 text-sm text-gray-600 cursor-pointer rounded;
|
|
}
|
|
.code-block-copy text {
|
|
white-space: nowrap;
|
|
}
|
|
.code-block-copy .copy-icon,
|
|
.code-block-copy .check-icon {
|
|
position: relative;
|
|
top: 1px;
|
|
}
|
|
.code-block-copy .check-icon {
|
|
display: none;
|
|
}
|
|
.code-block-copy.copied .copy-icon {
|
|
display: none;
|
|
}
|
|
.code-block-copy.copied .check-icon {
|
|
display: inline-block;
|
|
}
|
|
.code-block-copy:hover {
|
|
@apply bg-gray-100 text-gray-900;
|
|
}
|
|
.code-block-body {
|
|
@apply text-sm text-gray-800 whitespace-pre;
|
|
position: relative;
|
|
font-family: "Geist Mono", monospace;
|
|
}
|
|
.code-block-scroll {
|
|
width: 100%;
|
|
}
|
|
.code-block-scroll-content {
|
|
box-sizing: border-box;
|
|
padding: 12px;
|
|
}
|
|
.code-line-row {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
}
|
|
.code-line-number {
|
|
@apply text-gray-400;
|
|
|
|
flex-shrink: 0;
|
|
width: 80px;
|
|
padding-right: 12px;
|
|
text-align: right;
|
|
line-height: 20px;
|
|
font-family: "Geist Mono", monospace;
|
|
}
|
|
.code-line {
|
|
@apply text-gray-800;
|
|
|
|
flex: 0 0 auto;
|
|
line-height: 20px;
|
|
white-space: nowrap;
|
|
font-family: "Geist Mono", monospace;
|
|
}
|
|
|
|
/* -- Demo widget (see app/components/demo-provider.tsx) -- */
|
|
|
|
.demo {
|
|
@apply mb-6;
|
|
}
|
|
.demo-preview {
|
|
@apply px-6 py-8 bg-white border rounded-tl-md rounded-tr-md border-gray-200 flex items-center justify-center min-h-[128px];
|
|
}
|
|
.demo .code-block {
|
|
@apply rounded-tr-none rounded-tl-none border-t-0 my-0;
|
|
}
|
|
|
|
/* -- Widget demos -- */
|
|
|
|
.badge-basic-demo,
|
|
.badge-variants-demo,
|
|
.badge-colors-demo {
|
|
@apply flex flex-wrap gap-2;
|
|
}
|
|
|
|
.alert-variants-demo,
|
|
.alert-basic-demo {
|
|
@apply block w-full max-w-md;
|
|
}
|
|
|
|
.alert-destructive-demo,
|
|
.alert-action-demo {
|
|
@apply w-full max-w-md;
|
|
}
|
|
|
|
.item-basic-demo,
|
|
.item-variants-demo,
|
|
.item-size-demo,
|
|
.item-icon-demo,
|
|
.item-image-demo {
|
|
@apply flex max-w-md flex-col gap-6;
|
|
}
|
|
|
|
.item-duration {
|
|
@apply text-xs text-muted-foreground;
|
|
}
|
|
|
|
.button-basic-demo,
|
|
.button-variants-demo,
|
|
.button-icon-demo,
|
|
.button-with-icon-demo,
|
|
.button-size-demo,
|
|
.button-disabled-demo {
|
|
@apply flex flex-wrap items-center gap-4;
|
|
}
|
|
|
|
.select-basic-demo,
|
|
.select-groups-demo,
|
|
.select-disabled-demo,
|
|
.select-align-item-demo {
|
|
@apply w-full max-w-48;
|
|
}
|
|
|
|
.select-scrollable-demo {
|
|
@apply w-full max-w-64;
|
|
}
|
|
|
|
.checkbox-basic-demo {
|
|
@apply max-w-sm;
|
|
}
|
|
|
|
.checkbox-description-demo {
|
|
@apply max-w-72;
|
|
}
|
|
|
|
.checkbox-group-demo {
|
|
@apply w-full max-w-sm;
|
|
}
|
|
|
|
.checkbox-group-demo field-group {
|
|
@apply gap-3;
|
|
}
|
|
|
|
.checkbox-indeterminate-demo {
|
|
@apply flex flex-col gap-2;
|
|
}
|
|
|
|
.checkbox-indeterminate-demo .checkbox-row {
|
|
@apply flex items-center gap-2;
|
|
}
|
|
|
|
.field-demo {
|
|
@apply flex flex-col gap-5 max-w-[400px];
|
|
padding: 4px;
|
|
margin: -4px;
|
|
}
|
|
|
|
/* FieldLabel follows shadcn's `cn-label` (text-sm font-medium); examples that
|
|
* use a checkbox/radio as the control opt back into normal weight, mirroring
|
|
* the `className="font-normal"` in shadcn's field examples. */
|
|
.field-label.font-normal {
|
|
font-weight: 400;
|
|
}
|
|
|
|
/* field-basic uses a 3-column card row, so give it a bit more room. */
|
|
.field-demo.field-basic-demo {
|
|
@apply max-w-[448px];
|
|
}
|
|
|
|
.radio-group-demo {
|
|
@apply flex w-full max-w-[400px] flex-col;
|
|
}
|
|
|
|
.progress-label-demo {
|
|
@apply w-full max-w-[400px];
|
|
}
|
|
|
|
.tooltip-sides-demo {
|
|
@apply flex flex-wrap gap-2;
|
|
}
|
|
|
|
.popover-align-demo {
|
|
@apply flex flex-wrap gap-2;
|
|
}
|
|
|
|
.toast-demo-row {
|
|
@apply flex flex-wrap gap-2;
|
|
}
|
|
|
|
.card-basic-demo,
|
|
.card-image-demo {
|
|
width: 384px;
|
|
}
|
|
|
|
.card-image-demo {
|
|
padding-top: 0;
|
|
}
|
|
|
|
.card-image-cover {
|
|
position: relative;
|
|
width: 100%;
|
|
height: 216px;
|
|
background-color: #94a3b8;
|
|
border-top-left-radius: 12px;
|
|
border-top-right-radius: 12px;
|
|
}
|
|
|
|
.card-image-overlay {
|
|
position: absolute;
|
|
left: 0;
|
|
top: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background-color: rgba(0, 0, 0, 0.35);
|
|
}
|
|
|
|
.card-small-demo {
|
|
width: 320px;
|
|
}
|
|
|
|
.card-small-list {
|
|
@apply flex flex-col gap-2 py-2;
|
|
}
|
|
|
|
.card-small-row {
|
|
@apply flex gap-2;
|
|
}
|
|
|
|
.card-small-row text {
|
|
flex: 1;
|
|
}
|
|
|
|
.card-small-chevron {
|
|
@apply text-muted-foreground;
|
|
margin-top: 2px;
|
|
}
|
|
|
|
.card-basic-demo .card-form {
|
|
@apply flex flex-col gap-6;
|
|
}
|
|
|
|
.card-basic-demo .card-field {
|
|
@apply flex flex-col gap-2;
|
|
}
|
|
|
|
.card-basic-demo .card-field textinput {
|
|
width: 100%;
|
|
}
|
|
|
|
.card-basic-demo .card-label-row {
|
|
@apply flex items-center;
|
|
}
|
|
|
|
.card-basic-demo .card-forgot {
|
|
@apply ml-auto text-sm;
|
|
color: inherit;
|
|
}
|
|
|
|
.card-footer-stack {
|
|
flex-direction: column;
|
|
gap: 8px;
|
|
}
|
|
|
|
.card-footer-stack button {
|
|
width: 100%;
|
|
}
|
|
|
|
.popover-form-grid {
|
|
@apply flex flex-col gap-2;
|
|
/* clip-safe supplies the 4px focus-ring gutter; keep the original visual
|
|
* 12px offset above the grid (8px margin + 4px padding). */
|
|
margin-top: 8px;
|
|
}
|
|
|
|
.popover-form-grid field {
|
|
gap: 16px;
|
|
}
|
|
|
|
.popover-form-grid field-label {
|
|
flex: 1;
|
|
min-width: 0;
|
|
}
|
|
|
|
.popover-form-input {
|
|
flex: 2;
|
|
min-width: 0;
|
|
}
|
|
|
|
.field-checkbox-demo-group {
|
|
@apply gap-3;
|
|
}
|
|
|
|
.field-basic-card-row {
|
|
@apply flex gap-4;
|
|
padding: 4px;
|
|
margin: -4px;
|
|
}
|
|
|
|
.field-basic-card-field {
|
|
@apply flex-1;
|
|
}
|
|
|
|
.anchor-basic-demo:hover {
|
|
@apply text-blue-600 underline underline-offset-2;
|
|
}
|
|
|
|
.button-size-group {
|
|
@apply flex items-center gap-2;
|
|
}
|
|
|
|
.empty-basic-demo {
|
|
@apply w-full max-w-[400px];
|
|
}
|
|
|
|
.empty-background-demo {
|
|
@apply h-full w-full bg-muted/30;
|
|
}
|
|
|
|
/* The code-block wrapper holds the shared card chrome. Inner code
|
|
* block bodies are siblings of the header and carry data attributes
|
|
* for language/file/source selection. */
|
|
|
|
/* The header uses flex so that the file tab group, the language tab
|
|
* group, and the copy button share a single row. The `.demo-files`
|
|
* and `.demo-languages` containers themselves are plain blocks; their
|
|
* `.demo-tab` children are laid out with `display: inline-block` (see
|
|
* "CSS `display` property" in .opencode/skills/lcui-cli/SKILL.md). */
|
|
|
|
.code-block-header .demo-files {
|
|
flex: 1;
|
|
}
|
|
.code-block-header .demo-languages,
|
|
.code-block-header .demo-files {
|
|
@apply px-1 py-1;
|
|
}
|
|
|
|
.demo .code-block-header {
|
|
@apply px-1;
|
|
}
|
|
|
|
.demo-tab {
|
|
display: inline-block;
|
|
@apply px-2 py-1 text-sm rounded-lg mr-1;
|
|
}
|
|
.demo-tab:hover {
|
|
@apply bg-gray-100;
|
|
}
|
|
.demo-tab.active {
|
|
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.2);
|
|
@apply text-gray-900 font-bold bg-white;
|
|
}
|
|
|
|
/* -- Lists (ol/ul/li) --
|
|
*
|
|
* ol/ul are registered as native widgets in app/components/list.c.
|
|
* Each li has an absolutely-positioned marker child created in C
|
|
* (class .list-marker). The container's padding-left is set per-li
|
|
* at runtime in px (LCUI does not currently support em on padding).
|
|
* The defaults below apply when no inline override is present. */
|
|
|
|
ol,
|
|
ul {
|
|
display: block;
|
|
@apply my-3;
|
|
}
|
|
li {
|
|
display: block;
|
|
position: relative;
|
|
padding-left: 20px;
|
|
@apply text-base text-gray-800 mb-1;
|
|
}
|
|
.list-marker {
|
|
position: absolute;
|
|
left: 0;
|
|
top: 0;
|
|
@apply text-gray-700;
|
|
}
|
|
|
|
/* -- Admonitions (:::note / :::info / :::tip / :::caution / :::warning)
|
|
*
|
|
* Docusaurus-style admonition containers rendered by
|
|
* page-generator.ts. Each admonition is a rounded container with a
|
|
* coloured left border and a bold title that takes its colour from
|
|
* the admonition type. The generator recurses into the body so
|
|
* admonitions can contain paragraphs, lists, fenced code blocks,
|
|
* and other admonitions. */
|
|
|
|
.admonition {
|
|
display: block;
|
|
@apply my-4 py-3 px-4 rounded border-l-4 bg-gray-50;
|
|
}
|
|
.admonition-note { border-left-color: #3b82f6; }
|
|
.admonition-info { border-left-color: #06b6d4; }
|
|
.admonition-tip { border-left-color: #10b981; }
|
|
.admonition-caution { border-left-color: #eab308; }
|
|
.admonition-warning { border-left-color: #ef4444; }
|
|
.admonition-title {
|
|
@apply font-bold mb-1;
|
|
}
|
|
.admonition-note .admonition-title { color: #1d4ed8; }
|
|
.admonition-info .admonition-title { color: #0891b2; }
|
|
.admonition-tip .admonition-title { color: #047857; }
|
|
.admonition-caution .admonition-title { color: #ca8a04; }
|
|
.admonition-warning .admonition-title { color: #b91c1c; }
|
|
.admonition-content p,
|
|
.admonition-content ul,
|
|
.admonition-content ol {
|
|
@apply my-1;
|
|
}
|
|
|
|
/* -- Markdown tables (-- generated by scripts/compiler/page-generator.ts)
|
|
*
|
|
* LCUI does not support display: table, so every markdown table is
|
|
* emitted as a vertical stack of horizontal flex rows. Each cell is
|
|
* a widget with either a fixed width (for short, label-style columns)
|
|
* or flex-grow (for the last "description" column). A minimum width
|
|
* is applied so empty cells do not collapse. */
|
|
|
|
.mdx-table {
|
|
display: block;
|
|
@apply my-4 rounded border border-gray-200 bg-white;
|
|
}
|
|
.mdx-table-row {
|
|
display: flex;
|
|
flex-direction: row;
|
|
}
|
|
.mdx-table-head {
|
|
@apply bg-gray-50 border-b border-gray-200;
|
|
}
|
|
.mdx-table-cell {
|
|
@apply px-3 py-2 text-sm text-gray-800;
|
|
}
|
|
.mdx-table-head-cell {
|
|
@apply font-bold text-gray-900;
|
|
}
|