refactor(ui-kit): 样式类改为按需具名导入,去掉命名空间全量导入
CI / check (pull_request) Successful in 3m19s

import * as styles from '@idealjs/stack-ui-kit/components' 会把出口里的全部
样式名拉进作用域;改为只导入文件里实际用到的名字,引用去掉 styles. 前缀。
mount.ts 对 themes 出口的命名空间导入同样处理。

31 个文件(tutorial 29 + site-ui-kit 2),逐文件核对用到的名字,无动态
访问、无同名冲突。
This commit is contained in:
arnold.cui-agent committed 2026-12-02 11:54:04 +08:00
1 parent 5a34a30e11
commit 6045c36e73
31 files changed
+557 -405

No files matched your search

+15 -6
View File
@@ -1,5 +1,14 @@
import { Dropdown } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import {
bgClash2a,
bgPaper,
bgPaperDeep,
borderInk,
hoverableShadow,
liftSm,
shadowInk,
textInk,
} from '@idealjs/stack-ui-kit/components'
import type { ReactNode } from 'react'
@@ -8,7 +17,7 @@ export function AgentDock({
panelId,
label,
meta,
accentClass = `${styles.bgClash2a}`,
accentClass = `${bgClash2a}`,
panelClassName = 'h-[min(540px,100dvh_-_120px)]',
open,
onOpenChange,
@@ -33,12 +42,12 @@ export function AgentDock({
onOpenChange={onOpenChange}
placement="top"
panelClassName="w-[min(420px,100vw_-_24px)]"
triggerClassName={`${styles.hoverableShadow} ${styles.liftSm} flex cursor-pointer items-center gap-2 rounded-t-lg border-2 ${styles.borderInk} py-2 pr-4 pl-3 text-[12.5px] font-extrabold ${styles.textInk} shadow-[3px_3px_0_var(--color-ink)] transition-[translate] duration-150 motion-reduce:transition-none ${accentClass}`}
triggerClassName={`${hoverableShadow} ${liftSm} flex cursor-pointer items-center gap-2 rounded-t-lg border-2 ${borderInk} py-2 pr-4 pl-3 text-[12.5px] font-extrabold ${textInk} shadow-[3px_3px_0_var(--color-ink)] transition-[translate] duration-150 motion-reduce:transition-none ${accentClass}`}
trigger={
<>
<span
aria-hidden
className={`size-3 shrink-0 rounded-full border-2 ${styles.borderInk} ${styles.bgPaper}`}
className={`size-3 shrink-0 rounded-full border-2 ${borderInk} ${bgPaper}`}
/>
<span>{label}</span>
{meta && (
@@ -51,11 +60,11 @@ export function AgentDock({
}
>
<div
className={`relative rounded-b-lg rounded-tl-lg border-2 ${styles.borderInk} p-2 ${styles.shadowInk} ${accentClass} ${panelClassName}`}
className={`relative rounded-b-lg rounded-tl-lg border-2 ${borderInk} p-2 ${shadowInk} ${accentClass} ${panelClassName}`}
>
<span
aria-hidden
className={`absolute right-0 bottom-0 size-4 border-t-2 border-l-2 ${styles.borderInk} ${styles.bgPaperDeep}`}
className={`absolute right-0 bottom-0 size-4 border-t-2 border-l-2 ${borderInk} ${bgPaperDeep}`}
/>
<div className="h-full min-h-0">{children}</div>
</div>
+46 -35
View File
@@ -1,5 +1,26 @@
import { BrickDot, Mark, Tri } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import {
bgClash3b15,
bgInk,
bgPaper,
bgPaperDeep,
borderInk,
borderInk40,
hoverHost,
hoverableShadow,
shadowInk,
tDisplay,
tSmallMute,
tSmallStrong,
textBody,
textContent,
textInk,
textPaper,
textSmall,
textT1,
textT2,
textT3,
} from '@idealjs/stack-ui-kit/components'
import type { ReactNode } from 'react'
import { MONTHS, monthOf, POSTS } from '../content/blogs'
@@ -19,7 +40,7 @@ function inline(text: string): ReactNode[] {
parts.push(
<code
key={i++}
className={`rounded ${styles.bgPaperDeep} px-1 py-0.5 font-mono text-[0.9em] ${styles.textInk}`}
className={`rounded ${bgPaperDeep} px-1 py-0.5 font-mono text-[0.9em] ${textInk}`}
>
{t.slice(1, -1)}
</code>,
@@ -49,7 +70,7 @@ function Markdown({ raw }: { raw: string }) {
out.push(
<pre
key={key++}
className={`overflow-x-auto rounded-xl border-2 ${styles.borderInk} ${styles.bgInk} p-4 font-mono ${styles.textSmall} leading-relaxed ${styles.textPaper} ${styles.shadowInk}`}
className={`overflow-x-auto rounded-xl border-2 ${borderInk} ${bgInk} p-4 font-mono ${textSmall} leading-relaxed ${textPaper} ${shadowInk}`}
>
{buf.join('\n')}
</pre>,
@@ -60,9 +81,9 @@ function Markdown({ raw }: { raw: string }) {
out.push(
<blockquote
key={key++}
className={`m-0 rounded-xl border-2 border-dashed ${styles.borderInk40} bg-paper-deep/60 p-4`}
className={`m-0 rounded-xl border-2 border-dashed ${borderInk40} bg-paper-deep/60 p-4`}
>
<p className={`m-0 ${styles.textContent} ${styles.textBody}`}>{inline(ln.slice(2))}</p>
<p className={`m-0 ${textContent} ${textBody}`}>{inline(ln.slice(2))}</p>
</blockquote>,
)
i++
@@ -70,7 +91,7 @@ function Markdown({ raw }: { raw: string }) {
}
if (ln.startsWith('# ')) {
out.push(
<h1 key={key++} className={`m-0 ${styles.textT1} font-extrabold ${styles.textInk}`}>
<h1 key={key++} className={`m-0 ${textT1} font-extrabold ${textInk}`}>
{inline(ln.slice(2))}
</h1>,
)
@@ -81,7 +102,7 @@ function Markdown({ raw }: { raw: string }) {
out.push(
<h2
key={key++}
className={`m-0 flex items-center gap-2 ${styles.textT2} font-extrabold ${styles.textInk}`}
className={`m-0 flex items-center gap-2 ${textT2} font-extrabold ${textInk}`}
>
<Tri size={13} />
{inline(ln.slice(3))}
@@ -92,7 +113,7 @@ function Markdown({ raw }: { raw: string }) {
}
if (ln.startsWith('### ')) {
out.push(
<h3 key={key++} className={`m-0 ${styles.textT3} font-bold ${styles.textInk}`}>
<h3 key={key++} className={`m-0 ${textT3} font-bold ${textInk}`}>
{inline(ln.slice(4))}
</h3>,
)
@@ -114,7 +135,7 @@ function Markdown({ raw }: { raw: string }) {
<span className="mt-[9px] flex shrink-0">
<BrickDot size={11} on={ordered} />
</span>
<span className={`${styles.textContent} ${styles.textBody}`}>{inline(it)}</span>
<span className={`${textContent} ${textBody}`}>{inline(it)}</span>
</li>
))}
</ul>,
@@ -133,7 +154,7 @@ function Markdown({ raw }: { raw: string }) {
i++
}
out.push(
<p key={key++} className={`m-0 ${styles.textContent} ${styles.textBody}`}>
<p key={key++} className={`m-0 ${textContent} ${textBody}`}>
{inline(buf.join(' '))}
</p>,
)
@@ -151,28 +172,22 @@ export function BlogCard({ post, from }: { post: (typeof POSTS)[number]; from: P
) ??
''
return (
<span className={`${styles.hoverHost} block w-fit`}>
<span className={`${hoverHost} block w-fit`}>
<a
href={relHref(from, `blog-${post.slug}`)}
className={`${styles.hoverableShadow} block w-[420px] rounded-2xl border-2 ${styles.borderInk} ${styles.bgPaper} p-5 no-underline ${styles.shadowInk} transition-[translate,box-shadow] duration-150`}
className={`${hoverableShadow} block w-[420px] rounded-2xl border-2 ${borderInk} ${bgPaper} p-5 no-underline ${shadowInk} transition-[translate,box-shadow] duration-150`}
>
<div className="flex items-center gap-2.5">
<span
className={`rounded-full ${styles.bgClash3b15} px-2.5 py-0.5 font-mono ${styles.tSmallStrong}`}
>
<span className={`rounded-full ${bgClash3b15} px-2.5 py-0.5 font-mono ${tSmallStrong}`}>
{post.date}
</span>
<span className={`${styles.tSmallMute}`}>{post.author}</span>
<span className={`${tSmallMute}`}>{post.author}</span>
</div>
<h2 className={`m-0 mt-3 ${styles.textT3} font-extrabold ${styles.textInk}`}>
{post.title}
</h2>
<p
className={`m-0 mt-2 line-clamp-2 ${styles.textSmall} leading-relaxed ${styles.textBody}`}
>
<h2 className={`m-0 mt-3 ${textT3} font-extrabold ${textInk}`}>{post.title}</h2>
<p className={`m-0 mt-2 line-clamp-2 ${textSmall} leading-relaxed ${textBody}`}>
{quote.replace(/^> /, '').slice(0, 90)}…
</p>
<p className={`m-0 mt-3 ${styles.tSmallStrong}`}>
<p className={`m-0 mt-3 ${tSmallStrong}`}>
阅读全文 <span aria-hidden>→</span>
</p>
</a>
@@ -206,25 +221,21 @@ export function BlogPostPage({ slug }: { slug: string }) {
return (
<Page active={`blog-${monthOf(slug)}`} chain={`blog-${slug}`}>
<div
className={`relative overflow-hidden rounded-2xl border-2 ${styles.borderInk} ${styles.bgPaper} p-5 ${styles.shadowInk}`}
className={`relative overflow-hidden rounded-2xl border-2 ${borderInk} ${bgPaper} p-5 ${shadowInk}`}
>
<span
className={`${styles.tDisplay} pointer-events-none absolute right-4 top-1/2 -translate-y-1/2 select-none`}
className={`${tDisplay} pointer-events-none absolute right-4 top-1/2 -translate-y-1/2 select-none`}
aria-hidden
>
{post.date.slice(2, 4)}
</span>
<h1 className={`m-0 max-w-[46ch] ${styles.textT1} font-extrabold ${styles.textInk}`}>
{post.title}
</h1>
<h1 className={`m-0 max-w-[46ch] ${textT1} font-extrabold ${textInk}`}>{post.title}</h1>
<p className="m-0 mt-3 flex flex-wrap items-center gap-3">
<span
className={`rounded-full ${styles.bgClash3b15} px-2.5 py-0.5 font-mono ${styles.tSmallStrong}`}
>
<span className={`rounded-full ${bgClash3b15} px-2.5 py-0.5 font-mono ${tSmallStrong}`}>
{post.date}
</span>
<span className={`${styles.tSmallMute}`}>{post.author}</span>
<Mark className={`${styles.tSmallStrong}`}>开发自述</Mark>
<span className={`${tSmallMute}`}>{post.author}</span>
<Mark className={`${tSmallStrong}`}>开发自述</Mark>
</p>
</div>
<article className="mt-8 max-w-[76ch]">
@@ -233,13 +244,13 @@ export function BlogPostPage({ slug }: { slug: string }) {
<div className="mt-10 flex items-center justify-between">
<a
href={relHref(`blog-${slug}`, `blog-${monthOf(slug)}`)}
className={`rounded-xl border-2 ${styles.borderInk} ${styles.bgPaper} px-4 py-2 ${styles.textSmall} font-bold ${styles.textInk} no-underline ${styles.shadowInk}`}
className={`rounded-xl border-2 ${borderInk} ${bgPaper} px-4 py-2 ${textSmall} font-bold ${textInk} no-underline ${shadowInk}`}
>
← 返回 {monthOf(slug)}
</a>
<a
href={relHref(`blog-${slug}`, 'index')}
className={`rounded-xl border-2 ${styles.borderInk} ${styles.bgInk} px-4 py-2 ${styles.textSmall} font-bold ${styles.textPaper} no-underline`}
className={`rounded-xl border-2 ${borderInk} ${bgInk} px-4 py-2 ${textSmall} font-bold ${textPaper} no-underline`}
>
返回首页
</a>
+34 -23
View File
@@ -1,6 +1,21 @@
import { BrickDots } from '@idealjs/stack-site-ui-kit/components/MemphisCard'
import { Mark, Ring, Tri, Wave } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import {
bgClash3b15,
bgPaper,
borderInk,
borderInk40,
shadowInk,
tDisplay,
tSmallStrong,
textBody,
textContent,
textInk,
textMute,
textSmall,
textT1,
textT3,
} from '@idealjs/stack-ui-kit/components'
import type { ChapterId } from '@idealjs/stack-site-ui-kit'
@@ -15,21 +30,21 @@ export function ChapterPage({ id, children }: { id: ChapterId; children?: ReactN
return (
<Page active={id}>
<div
className={`relative flex items-center gap-4 overflow-hidden rounded-2xl border-2 ${styles.borderInk} p-5 ${styles.shadowInk}`}
className={`relative flex items-center gap-4 overflow-hidden rounded-2xl border-2 ${borderInk} p-5 ${shadowInk}`}
style={{ background: ch.color } as CSSProperties}
>
<span
className={`${styles.tDisplay} pointer-events-none absolute right-4 top-1/2 -translate-y-1/2 select-none`}
className={`${tDisplay} pointer-events-none absolute right-4 top-1/2 -translate-y-1/2 select-none`}
aria-hidden
>
0{id}
</span>
<span className="text-[44px] leading-none">{ch.emoji}</span>
<div className="flex-1">
<h1 className={`m-0 ${styles.textT1} font-extrabold ${styles.textInk}`}>
<h1 className={`m-0 ${textT1} font-extrabold ${textInk}`}>
第 {id} 章 · {ch.title}
</h1>
<div className={`mt-2 flex flex-wrap gap-x-6 gap-y-1 ${styles.tSmallStrong}`}>
<div className={`mt-2 flex flex-wrap gap-x-6 gap-y-1 ${tSmallStrong}`}>
<span>▲ 目标:{ch.target.goal}</span>
<span>○ 预期:{ch.target.expectation}</span>
<span className="flex items-center gap-1.5">
@@ -46,34 +61,30 @@ export function ChapterPage({ id, children }: { id: ChapterId; children?: ReactN
{c.steps.map((s, i) => (
<li
key={s.title}
className={`rounded-xl border-2 ${styles.borderInk} ${styles.bgPaper} p-4 ${styles.shadowInk}`}
className={`rounded-xl border-2 ${borderInk} ${bgPaper} p-4 ${shadowInk}`}
>
<div className="flex flex-wrap items-center gap-2.5">
<span
className={`flex h-6 w-6 items-center justify-center rounded-full border-2 ${styles.borderInk} bg-white text-[12px] font-extrabold`}
className={`flex h-6 w-6 items-center justify-center rounded-full border-2 ${borderInk} bg-white text-[12px] font-extrabold`}
>
{i + 1}
</span>
{s.kind === 'value' ? (
<Mark className={`${styles.textT3}`}>{s.title}</Mark>
<Mark className={`${textT3}`}>{s.title}</Mark>
) : (
<span
className={`flex items-center gap-1.5 ${styles.textT3} font-bold ${styles.textInk}`}
>
<span className={`flex items-center gap-1.5 ${textT3} font-bold ${textInk}`}>
<Wave size={30} />
{s.title}
<span
className={`rounded-full ${styles.bgClash3b15} px-2 py-0.5 text-[10.5px]`}
>
<span className={`rounded-full ${bgClash3b15} px-2 py-0.5 text-[10.5px]`}>
代理区 · 交给 agent
</span>
</span>
)}
</div>
<p className={`m-0 mt-2.5 ${styles.textContent} ${styles.textBody}`}>{s.what}</p>
<p className={`m-0 mt-2 ${styles.textContent} ${styles.textBody}`}>
<b className={`${styles.tSmallStrong}`}>验收</b>
<span className={`mx-1.5 ${styles.textMute}`}>·</span>
<p className={`m-0 mt-2.5 ${textContent} ${textBody}`}>{s.what}</p>
<p className={`m-0 mt-2 ${textContent} ${textBody}`}>
<b className={`${tSmallStrong}`}>验收</b>
<span className={`mx-1.5 ${textMute}`}>·</span>
{s.accept}
</p>
</li>
@@ -86,13 +97,13 @@ export function ChapterPage({ id, children }: { id: ChapterId; children?: ReactN
{c.bricks.map((b) => (
<div
key={b.name}
className={`rounded-xl border-2 ${styles.borderInk} ${styles.bgPaper} p-3.5 ${styles.shadowInk}`}
className={`rounded-xl border-2 ${borderInk} ${bgPaper} p-3.5 ${shadowInk}`}
>
<div className="flex items-center gap-2">
<Tri size={13} />
<b className={`${styles.textT3}`}>{b.name}</b>
<b className={`${textT3}`}>{b.name}</b>
</div>
<p className={`m-0 mt-2 ${styles.textSmall} leading-relaxed ${styles.textBody}`}>
<p className={`m-0 mt-2 ${textSmall} leading-relaxed ${textBody}`}>
<b>是什么</b>:{b.what}
<br />
<b>为何在这</b>:{b.why}
@@ -107,10 +118,10 @@ export function ChapterPage({ id, children }: { id: ChapterId; children?: ReactN
{c.base && (
<Section label="认知基础" note="脚下的地(env/库/运行环境)——第一次用到就地露出">
<div
className={`flex items-start gap-3 rounded-xl border-2 border-dashed ${styles.borderInk40} ${styles.bgClash3b15} p-4`}
className={`flex items-start gap-3 rounded-xl border-2 border-dashed ${borderInk40} ${bgClash3b15} p-4`}
>
<Ring size={18} className="mt-0.5 shrink-0" />
<p className={`m-0 ${styles.textContent} ${styles.textBody}`}>{c.base}</p>
<p className={`m-0 ${textContent} ${textBody}`}>{c.base}</p>
</div>
</Section>
)}
+32 -23
View File
@@ -1,4 +1,21 @@
import * as styles from '@idealjs/stack-ui-kit/components'
import {
bgClash1a,
bgClash1b,
bgClash2a,
bgPaper,
bgPaperDeep,
borderInk,
borderInk20,
focusBgPaperDeep,
hoverBgClash1a80,
hoverBgClash1b80,
hoverBgPaperDeep,
shadowInk,
tSmallMute,
tSmallStrong,
textBody,
textInk,
} from '@idealjs/stack-ui-kit/components'
import type { KeyboardEvent } from 'react'
import { useEffect, useRef } from 'react'
export interface ChatItem {
@@ -57,20 +74,16 @@ export function ChatPanel({
return (
<div
className={`flex h-full min-h-0 flex-col rounded-xl border-2 ${styles.borderInk} ${styles.bgPaper} ${flat ? '' : `${styles.shadowInk}`}`}
className={`flex h-full min-h-0 flex-col rounded-xl border-2 ${borderInk} ${bgPaper} ${flat ? '' : `${shadowInk}`}`}
>
<div
className={`flex items-center gap-2 border-b border-dashed ${styles.borderInk20} px-3 py-2`}
>
<span className={`${styles.tSmallStrong}`}>陪练 agent</span>
<span className={`${styles.tSmallMute} min-w-0 flex-1 truncate font-mono`}>{model}</span>
<div className={`flex items-center gap-2 border-b border-dashed ${borderInk20} px-3 py-2`}>
<span className={`${tSmallStrong}`}>陪练 agent</span>
<span className={`${tSmallMute} min-w-0 flex-1 truncate font-mono`}>{model}</span>
<button
type="button"
onClick={onOpenKey}
className={`cursor-pointer rounded-lg border-2 ${styles.borderInk} px-2 py-0.5 text-[12px] font-bold transition-colors ${
hasKey
? `${styles.bgPaper} ${styles.textBody} ${styles.hoverBgPaperDeep}`
: `${styles.bgClash2a} ${styles.textInk}`
className={`cursor-pointer rounded-lg border-2 ${borderInk} px-2 py-0.5 text-[12px] font-bold transition-colors ${
hasKey ? `${bgPaper} ${textBody} ${hoverBgPaperDeep}` : `${bgClash2a} ${textInk}`
}`}
>
{hasKey ? '接入配置' : '填写 Key'}
@@ -80,7 +93,7 @@ export function ChatPanel({
<div className="flex min-h-0 flex-1 flex-col gap-2.5 overflow-auto p-3">
{items.map((item, i) =>
item.kind === 'tool' ? (
<p key={i} className={`${styles.tSmallMute} m-0 font-mono`}>
<p key={i} className={`${tSmallMute} m-0 font-mono`}>
{item.text}
</p>
) : (
@@ -89,10 +102,8 @@ export function ChatPanel({
className={`flex ${item.kind === 'user' ? 'justify-end' : 'justify-start'}`}
>
<div
className={`max-w-[92%] rounded-xl border-2 ${styles.borderInk} px-3 py-2 text-[13.5px] leading-6 whitespace-pre-wrap ${
item.kind === 'user'
? `${styles.bgPaperDeep} ${styles.textInk}`
: `${styles.bgPaper} ${styles.textBody}`
className={`max-w-[92%] rounded-xl border-2 ${borderInk} px-3 py-2 text-[13.5px] leading-6 whitespace-pre-wrap ${
item.kind === 'user' ? `${bgPaperDeep} ${textInk}` : `${bgPaper} ${textBody}`
}`}
>
{item.text}
@@ -100,12 +111,10 @@ export function ChatPanel({
</div>
),
)}
{busy && (
<p className={`${styles.tSmallMute} m-0 animate-pulse font-mono`}>agent 工作中…</p>
)}
{busy && <p className={`${tSmallMute} m-0 animate-pulse font-mono`}>agent 工作中…</p>}
</div>
<div className={`border-t border-dashed ${styles.borderInk20} p-2.5`}>
<div className={`border-t border-dashed ${borderInk20} p-2.5`}>
<textarea
ref={textareaRef}
value={draft}
@@ -119,14 +128,14 @@ export function ChatPanel({
? '告诉 agent 要做什么(Enter 发送,Shift+Enter 换行)'
: '先填写 API Key'
}
className={`w-full resize-none rounded-lg border-2 ${styles.borderInk} ${styles.bgPaper} px-2.5 py-1.5 text-[13.5px] leading-6 outline-none ${styles.focusBgPaperDeep}`}
className={`w-full resize-none rounded-lg border-2 ${borderInk} ${bgPaper} px-2.5 py-1.5 text-[13.5px] leading-6 outline-none ${focusBgPaperDeep}`}
/>
<div className="mt-1.5 flex justify-end gap-2">
{busy ? (
<button
type="button"
onClick={onStop}
className={`cursor-pointer rounded-lg border-2 ${styles.borderInk} ${styles.bgClash1a} px-3 py-1 text-[13px] font-bold ${styles.textInk} transition-colors ${styles.hoverBgClash1a80}`}
className={`cursor-pointer rounded-lg border-2 ${borderInk} ${bgClash1a} px-3 py-1 text-[13px] font-bold ${textInk} transition-colors ${hoverBgClash1a80}`}
>
停止
</button>
@@ -135,7 +144,7 @@ export function ChatPanel({
type="button"
onClick={submit}
disabled={!ready}
className={`cursor-pointer rounded-lg border-2 ${styles.borderInk} ${styles.bgClash1b} px-3 py-1 text-[13px] font-bold ${styles.textInk} transition-colors ${styles.hoverBgClash1b80} disabled:cursor-not-allowed disabled:opacity-50`}
className={`cursor-pointer rounded-lg border-2 ${borderInk} ${bgClash1b} px-3 py-1 text-[13px] font-bold ${textInk} transition-colors ${hoverBgClash1b80} disabled:cursor-not-allowed disabled:opacity-50`}
>
发送
</button>
+14 -10
View File
@@ -1,5 +1,13 @@
import { Dropdown } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import {
bgClash1b,
bgClash2a,
bgPaper,
bgPaperDeep,
borderInk,
tSmallStrong,
textInk,
} from '@idealjs/stack-ui-kit/components'
import type { ReactNode } from 'react'
@@ -22,11 +30,7 @@ export function ChecklistDock({
}) {
const all = total > 0 && done >= total
const progress = all ? 'all' : done > 0 ? 'partial' : 'none'
const stripClass = all
? `${styles.bgClash1b}`
: done > 0
? `${styles.bgClash2a}`
: `${styles.bgPaperDeep}`
const stripClass = all ? `${bgClash1b}` : done > 0 ? `${bgClash2a}` : `${bgPaperDeep}`
return (
<Dropdown
@@ -36,20 +40,20 @@ export function ChecklistDock({
open={open}
onOpenChange={onOpenChange}
data-progress={progress}
triggerClassName={`flex h-[34px] w-[116px] flex-col rounded-[7px_7px_4px_4px] border-2 ${styles.borderInk} ${styles.bgPaper} shadow-[3px_3px_0_var(--color-ink)]`}
triggerClassName={`flex h-[34px] w-[116px] flex-col rounded-[7px_7px_4px_4px] border-2 ${borderInk} ${bgPaper} shadow-[3px_3px_0_var(--color-ink)]`}
trigger={
<>
<span
aria-hidden
className={`absolute top-[-9px] left-1/2 block h-[13px] w-[24px] -translate-x-1/2 rounded-t-[6px] border-2 ${styles.borderInk} ${styles.bgPaper}`}
className={`absolute top-[-9px] left-1/2 block h-[13px] w-[24px] -translate-x-1/2 rounded-t-[6px] border-2 ${borderInk} ${bgPaper}`}
/>
<span
aria-hidden
className={`mx-1.5 mt-[5px] block h-[7px] rounded-[3px] transition-colors duration-200 motion-reduce:transition-none ${stripClass}`}
/>
<span className="flex flex-1 items-center justify-center gap-1 pb-[3px] leading-none">
<span className={`${styles.tSmallStrong}`}>验收</span>
<span className={`font-mono text-[12px] font-bold ${styles.textInk}`}>
<span className={`${tSmallStrong}`}>验收</span>
<span className={`font-mono text-[12px] font-bold ${textInk}`}>
{done}/{total}
</span>
</span>
+11 -4
View File
@@ -1,4 +1,11 @@
import * as styles from '@idealjs/stack-ui-kit/components'
import {
bgInk,
bgPaper,
borderInk,
shadowInk,
textInk,
textPaper,
} from '@idealjs/stack-ui-kit/components'
import { neighborsOf, type PageKey, relHref } from '../lib/pages'
export function PageTurnBar({ from }: { from: PageKey }) {
const neighbors = neighborsOf(from)
@@ -9,7 +16,7 @@ export function PageTurnBar({ from }: { from: PageKey }) {
<a
href={relHref(from, prev.key)}
data-dir="prev"
className={`max-w-[36ch] truncate rounded-xl border-2 ${styles.borderInk} ${styles.bgPaper} px-4 py-2 text-[12.5px] font-bold ${styles.textInk} no-underline ${styles.shadowInk}`}
className={`max-w-[36ch] truncate rounded-xl border-2 ${borderInk} ${bgPaper} px-4 py-2 text-[12.5px] font-bold ${textInk} no-underline ${shadowInk}`}
>
← {prev.title}
</a>
@@ -18,7 +25,7 @@ export function PageTurnBar({ from }: { from: PageKey }) {
) : (
<a
href={relHref(from, 'index')}
className={`flex-none rounded-xl border-2 ${styles.borderInk} ${styles.bgInk} px-4 py-2 text-[12.5px] font-bold ${styles.textPaper} no-underline`}
className={`flex-none rounded-xl border-2 ${borderInk} ${bgInk} px-4 py-2 text-[12.5px] font-bold ${textPaper} no-underline`}
>
返回首页
</a>
@@ -26,7 +33,7 @@ export function PageTurnBar({ from }: { from: PageKey }) {
<a
href={relHref(from, next.key)}
data-dir="next"
className={`max-w-[36ch] truncate rounded-xl border-2 ${styles.borderInk} ${styles.bgPaper} px-4 py-2 text-[12.5px] font-bold ${styles.textInk} no-underline ${styles.shadowInk}`}
className={`max-w-[36ch] truncate rounded-xl border-2 ${borderInk} ${bgPaper} px-4 py-2 text-[12.5px] font-bold ${textInk} no-underline ${shadowInk}`}
>
{next.title} →
</a>
@@ -1,5 +1,12 @@
import { DockSheet } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import {
bgClash1a,
bgClash2b,
borderInk,
hoverBgPaperDeep,
tSmallMute,
textInk,
} from '@idealjs/stack-ui-kit/components'
import type { ReactNode } from 'react'
import { useEffect, useState } from 'react'
@@ -11,9 +18,9 @@ const PANE_META: Record<DockPaneKind, string> = {
sandbox: '隔离 iframe,postMessage 单通道',
}
const PANE_TAB_BASE = `cursor-pointer rounded-md border-2 ${styles.borderInk} px-2.5 py-1 text-[12.5px] font-extrabold ${styles.textInk} transition-colors duration-150 motion-reduce:transition-none`
const PANE_TAB_BASE = `cursor-pointer rounded-md border-2 ${borderInk} px-2.5 py-1 text-[12.5px] font-extrabold ${textInk} transition-colors duration-150 motion-reduce:transition-none`
const PANE_TAB_IDLE = `bg-white ${styles.hoverBgPaperDeep}`
const PANE_TAB_IDLE = `bg-white ${hoverBgPaperDeep}`
export function PlaygroundDock({
panelId,
@@ -55,13 +62,13 @@ export function PlaygroundDock({
id: 'editor',
comp: 'editor-dock-tab',
label: 'playground · 编辑器',
accentClass: `${styles.bgClash1a}`,
accentClass: `${bgClash1a}`,
},
{
id: 'sandbox',
comp: 'sandbox-dock-tab',
label: 'web runner · 沙箱预览',
accentClass: `${styles.bgClash2b}`,
accentClass: `${bgClash2b}`,
},
]}
toolbar={
@@ -89,7 +96,7 @@ export function PlaygroundDock({
沙箱预览
</button>
</div>
<span className={`${styles.tSmallMute} hidden min-w-0 flex-1 truncate sm:block`}>
<span className={`${tSmallMute} hidden min-w-0 flex-1 truncate sm:block`}>
{PANE_META[pane]}
</span>
</>
+2 -2
View File
@@ -1,5 +1,5 @@
import { Dropdown } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import { bgPaper, borderInk, textInk } from '@idealjs/stack-ui-kit/components'
import type { ReactNode } from 'react'
@@ -23,7 +23,7 @@ export function TipsDock({
label={label}
open={open}
onOpenChange={onOpenChange}
triggerClassName={`flex items-center gap-1.5 rounded-full border-2 ${styles.borderInk} ${styles.bgPaper} px-3 py-1.5 text-[12.5px] font-extrabold ${styles.textInk} shadow-[3px_3px_0_var(--color-ink)] transition-[translate] duration-150 motion-reduce:transition-none hover:-translate-y-0.5`}
triggerClassName={`flex items-center gap-1.5 rounded-full border-2 ${borderInk} ${bgPaper} px-3 py-1.5 text-[12.5px] font-extrabold ${textInk} shadow-[3px_3px_0_var(--color-ink)] transition-[translate] duration-150 motion-reduce:transition-none hover:-translate-y-0.5`}
trigger={
<>
<span aria-hidden>💡</span>
+4 -4
View File
@@ -1,5 +1,5 @@
import * as styles from '@idealjs/stack-ui-kit/components'
import * as themes from '@idealjs/stack-ui-kit/themes'
import { pageBase } from '@idealjs/stack-ui-kit/components'
import { paletteClass, siteClass, themeClass } from '@idealjs/stack-ui-kit/themes'
import '@idealjs/stack-site-ui-kit/styles/index.css'
import '../styles/tailwind.css'
import type { ReactNode } from 'react'
@@ -7,8 +7,8 @@ import { createRoot, hydrateRoot } from 'react-dom/client'
export function mountPage(page: ReactNode) {
if (typeof document === 'undefined') return
document.documentElement.classList.add(themes.paletteClass, themes.themeClass, themes.siteClass)
document.body.classList.add(styles.pageBase)
document.documentElement.classList.add(paletteClass, themeClass, siteClass)
document.body.classList.add(pageBase)
const root = document.getElementById('root')
if (!root) throw new Error('mount target #root not found')
if (root.hasChildNodes()) hydrateRoot(root, page)
+3 -3
View File
@@ -1,6 +1,6 @@
import { PageFlipZone } from '@idealjs/stack-site-ui-kit/components/PageFlipZone'
import { SitePage } from '@idealjs/stack-site-ui-kit/components/SitePage'
import * as styles from '@idealjs/stack-ui-kit/components'
import { tSmallMute, tSmallStrong } from '@idealjs/stack-ui-kit/components'
import type {
ChapterId,
NavItemLink,
@@ -173,8 +173,8 @@ export function Section({
<section id={id} className={`mb-8 ${className}`}>
{(label || note) && (
<h2 className="mb-2.5 flex flex-wrap items-baseline gap-2">
{label && <span className={`${styles.tSmallStrong}`}>{label}</span>}
{note && <i className={`${styles.tSmallMute} not-italic`}>{note}</i>}
{label && <span className={`${tSmallStrong}`}>{label}</span>}
{note && <i className={`${tSmallMute} not-italic`}>{note}</i>}
</h2>
)}
{children}
+12 -7
View File
@@ -1,18 +1,23 @@
import * as styles from '@idealjs/stack-ui-kit/components'
import {
bgPaper,
borderInk,
shadowInk,
tSmallStrong,
textBody,
textContent,
} from '@idealjs/stack-ui-kit/components'
import { TEMPLATE_FILES } from '../../lib/templateFiles'
import { Section } from '../../lib/ui'
import { Playground } from '../../playground'
function CodeCard({ label, code }: { label: string; code: string }) {
return (
<div
className={`min-w-0 rounded-xl border-2 ${styles.borderInk} ${styles.bgPaper} p-3.5 ${styles.shadowInk}`}
>
<p className={`${styles.tSmallStrong} m-0 mb-2 font-mono`}>{label}</p>
<div className={`min-w-0 rounded-xl border-2 ${borderInk} ${bgPaper} p-3.5 ${shadowInk}`}>
<p className={`${tSmallStrong} m-0 mb-2 font-mono`}>{label}</p>
<pre
tabIndex={0}
aria-label={`${label} 源码`}
className={`m-0 overflow-x-auto font-mono text-[12.5px] leading-relaxed ${styles.textBody}`}
className={`m-0 overflow-x-auto font-mono text-[12.5px] leading-relaxed ${textBody}`}
>
<code>{code}</code>
</pre>
@@ -26,7 +31,7 @@ export function TemplateLab() {
label="实验室:template 进沙箱"
note="预置的就是 examples/template 的真实文件——MPA 入口在 playground 里跑起来"
>
<p className={`m-0 ${styles.textContent} ${styles.textBody}`}>
<p className={`m-0 ${textContent} ${textBody}`}>
template 包的全部就是下面三个文件:index.html 是入口文档(挂载点+一行 module
script),main.ts 是被引进来的 TS,stack.config.ts 用 inputs 向宿主声明构建输入 ——index.html
即入口(html 输入,引擎按 script src 把 main.ts 拉成闭包并重写引用 路径);旧 entry
+2 -2
View File
@@ -1,5 +1,5 @@
import { Button } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import { textBody } from '@idealjs/stack-ui-kit/components'
import { relHref } from '../../lib/pages'
import { Page, Section } from '../../lib/ui'
@@ -13,7 +13,7 @@ export function App() {
CSS 是描述页面外观的样式语言:选择器匹配元素,决定布局、颜色和字体。
在主线教程里,它排列待办条目、为已完成的任务划上删除线,并让页面适配不同屏幕。
</p>
<p className={`m-0 leading-[1.75] ${styles.textBody}`}>
<p className={`m-0 leading-[1.75] ${textBody}`}>
专项教程将在这里逐步补充。想先动手做出点什么,直接走主线:
</p>
</div>
+34 -31
View File
@@ -1,4 +1,17 @@
import * as styles from '@idealjs/stack-ui-kit/components'
import {
bgClash1a,
bgClash1b,
bgClash2a,
bgInk,
bgPaper,
borderInk,
shadowInk,
tSmallMute,
textBody,
textContent,
textPaper,
textSmall,
} from '@idealjs/stack-ui-kit/components'
import { Page, Section } from '../../lib/ui'
const PAIRS = [
@@ -30,12 +43,9 @@ const CHAPTERS6 = [
function Chip({ c, n, h }: { c: string; n: string; h: string }) {
return (
<div>
<div
className={`h-12 rounded-[10px] border-2 ${styles.borderInk}`}
style={{ background: c }}
/>
<div className={`mt-1 whitespace-nowrap ${styles.textSmall} font-bold`}>{n}</div>
<div className={`whitespace-nowrap font-mono ${styles.tSmallMute}`}>{h}</div>
<div className={`h-12 rounded-[10px] border-2 ${borderInk}`} style={{ background: c }} />
<div className={`mt-1 whitespace-nowrap ${textSmall} font-bold`}>{n}</div>
<div className={`whitespace-nowrap font-mono ${tSmallMute}`}>{h}</div>
</div>
)
}
@@ -50,15 +60,15 @@ const RULES = [
badCap: '同色相邻失去碰撞',
goodCap: '相邻必撞色(跨对取色)',
badDemo: (
<div className={`flex overflow-hidden rounded-lg border-2 ${styles.borderInk}`}>
<div className={`h-10 w-20 ${styles.bgClash1a}`} />
<div className={`h-10 w-20 ${styles.bgClash1a}`} />
<div className={`flex overflow-hidden rounded-lg border-2 ${borderInk}`}>
<div className={`h-10 w-20 ${bgClash1a}`} />
<div className={`h-10 w-20 ${bgClash1a}`} />
</div>
),
goodDemo: (
<div className={`flex overflow-hidden rounded-lg border-2 ${styles.borderInk}`}>
<div className={`h-10 w-20 ${styles.bgClash1a}`} />
<div className={`h-10 w-20 ${styles.bgClash1b}`} />
<div className={`flex overflow-hidden rounded-lg border-2 ${borderInk}`}>
<div className={`h-10 w-20 ${bgClash1a}`} />
<div className={`h-10 w-20 ${bgClash1b}`} />
</div>
),
},
@@ -70,11 +80,9 @@ const RULES = [
],
badCap: '无描边的鲜艳摊平刺眼',
goodCap: '一切鲜艳以 2px ink 描边为界',
badDemo: <div className={`h-10 w-40 rounded-lg ${styles.bgClash2a}`} />,
badDemo: <div className={`h-10 w-40 rounded-lg ${bgClash2a}`} />,
goodDemo: (
<div
className={`h-10 w-40 rounded-lg border-2 ${styles.borderInk} ${styles.bgClash2a} ${styles.shadowInk}`}
/>
<div className={`h-10 w-40 rounded-lg border-2 ${borderInk} ${bgClash2a} ${shadowInk}`} />
),
},
{
@@ -87,14 +95,14 @@ const RULES = [
goodCap: '大底纸色,鲜艳只进局部',
badDemo: (
<div
className={`flex h-10 w-40 items-center justify-center rounded-lg border-2 ${styles.borderInk} ${styles.bgClash1b} text-[11px] font-bold`}
className={`flex h-10 w-40 items-center justify-center rounded-lg border-2 ${borderInk} ${bgClash1b} text-[11px] font-bold`}
>
大底鲜艳
</div>
),
goodDemo: (
<div
className={`flex h-10 w-40 items-center justify-center rounded-lg border-2 ${styles.borderInk} ${styles.bgPaper} text-[11px] font-bold`}
className={`flex h-10 w-40 items-center justify-center rounded-lg border-2 ${borderInk} ${bgPaper} text-[11px] font-bold`}
>
纸底安放正文
</div>
@@ -114,14 +122,12 @@ function DoDont({
return (
<div className="flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1.5 max-md:pb-1 md:flex-nowrap md:py-4 md:pl-4 md:pr-5">
<span
className={`flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 ${styles.borderInk} text-[11px] font-extrabold ${bad ? 'bg-clash1a text-paper' : 'bg-clash1b'}`}
className={`flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 ${borderInk} text-[11px] font-extrabold ${bad ? 'bg-clash1a text-paper' : 'bg-clash1b'}`}
>
{bad ? '✗' : '✓'}
</span>
{children}
<p className={`m-0 flex-1 basis-[160px] ${styles.textSmall} leading-snug ${styles.textBody}`}>
{text}
</p>
<p className={`m-0 flex-1 basis-[160px] ${textSmall} leading-snug ${textBody}`}>{text}</p>
</div>
)
}
@@ -137,12 +143,12 @@ export function App() {
<div className="grid grid-cols-3 gap-4">
{PAIRS.map((p) => (
<div key={p.name}>
<div className={`flex overflow-hidden rounded-xl border-2 ${styles.borderInk}`}>
<div className={`flex overflow-hidden rounded-xl border-2 ${borderInk}`}>
<div className="h-11 w-[88px]" style={{ background: p.a }} />
<div className="h-11 w-[88px]" style={{ background: p.b }} />
</div>
<div className="mt-1.5 text-[11px] font-bold">{p.name}</div>
<div className={`${styles.textSmall} text-[#555]`}>{p.use}</div>
<div className={`${textSmall} text-[#555]`}>{p.use}</div>
</div>
))}
</div>
@@ -166,22 +172,19 @@ export function App() {
{RULES.map((r, i) => (
<div
key={r.name}
className={`grid gap-y-3 rounded-xl border-2 ${styles.borderInk} ${styles.bgPaper} p-4 md:grid-cols-[minmax(0,320px)_minmax(0,1fr)_minmax(0,1fr)] md:gap-y-0 md:divide-x-2 md:divide-ink/15 md:p-0`}
className={`grid gap-y-3 rounded-xl border-2 ${borderInk} ${bgPaper} p-4 md:grid-cols-[minmax(0,320px)_minmax(0,1fr)_minmax(0,1fr)] md:gap-y-0 md:divide-x-2 md:divide-ink/15 md:p-0`}
>
<div className="grid content-start gap-1.5 md:py-4 md:pr-4 md:pl-5">
<div className="flex items-center gap-2">
<span
className={`flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-full border-2 ${styles.borderInk} ${styles.bgInk} text-[10px] font-extrabold ${styles.textPaper}`}
className={`flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-full border-2 ${borderInk} ${bgInk} text-[10px] font-extrabold ${textPaper}`}
>
{i + 1}
</span>
<b className="text-[13px]">{r.name}</b>
</div>
{r.note.map((para) => (
<p
key={para}
className={`m-0 indent-[2em] ${styles.textContent} ${styles.textBody}`}
>
<p key={para} className={`m-0 indent-[2em] ${textContent} ${textBody}`}>
{para}
</p>
))}
@@ -5,7 +5,7 @@ import { RoutableCard, RoutableScene } from '@idealjs/stack-site-ui-kit/componen
import { RouteLine } from '@idealjs/stack-site-ui-kit/components/RouteLine'
import { LearningKitGallery } from '@idealjs/stack-site-ui-kit/examples/LearningKitGallery'
import { Button, ShadowButton, ShadowCard, Mark } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import { borderInk, textSmall } from '@idealjs/stack-ui-kit/components'
import { CHAPTERS, PROFILES } from '../../lib/chapters'
import { relHref } from '../../lib/pages'
@@ -93,7 +93,7 @@ export function App() {
>
<div className="grid grid-cols-2 gap-3 md:grid-cols-4">
{LINES.map((l) => (
<div key={l.n} className={`rounded-xl border-2 ${styles.borderInk} bg-white p-3`}>
<div key={l.n} className={`rounded-xl border-2 ${borderInk} bg-white p-3`}>
<svg
role="img"
aria-label={`线条标本 ${l.n}`}
@@ -130,10 +130,10 @@ export function App() {
)}
</svg>
<div className="mt-1 text-[13px] font-extrabold">{l.n}</div>
<div className={`${styles.textSmall} text-[#555]`}>{l.m}</div>
<div className={`${textSmall} text-[#555]`}>{l.m}</div>
</div>
))}
<div className={`rounded-xl border-2 ${styles.borderInk} bg-white p-3`}>
<div className={`rounded-xl border-2 ${borderInk} bg-white p-3`}>
<svg role="img" aria-label="手写标本线" className="h-auto w-full" viewBox="0 0 188 44">
<path
d="M12 22 q10 -22 20 0 t20 0 t20 0 t20 0 t20 0 t20 0 t20 0 t20 0 t20 0"
@@ -144,7 +144,7 @@ export function App() {
/>
</svg>
<div className="mt-1 text-[13px] font-extrabold">波浪带 = 代理交接</div>
<div className={`${styles.textSmall} text-[#555]`}>agent 边界 · 区域标记,不连线</div>
<div className={`${textSmall} text-[#555]`}>agent 边界 · 区域标记,不连线</div>
</div>
</div>
<div className="mt-5 overflow-x-auto">
@@ -188,26 +188,22 @@ export function App() {
<div>
<ShadowCard className="h-[80px]" />
<div className="mt-1 text-[13px] font-extrabold">1 · 基础 shadow-card</div>
<div className={`${styles.textSmall} text-[#555]`}>
border-ink+paper+shadow-ink,内容空
</div>
<div className={`${textSmall} text-[#555]`}>border-ink+paper+shadow-ink,内容空</div>
</div>
<div>
<ShadowCard hover className="h-[80px]" />
<div className="mt-1 text-[13px] font-extrabold">2 · hover 拿起</div>
<div className={`${styles.textSmall} text-[#555]`}>
浮 3px+阴影 5→8(同 Button 规格)
</div>
<div className={`${textSmall} text-[#555]`}>浮 3px+阴影 5→8(同 Button 规格)</div>
</div>
<div>
<ShadowCard ticket className="h-[80px]" />
<div className="mt-1 text-[13px] font-extrabold">3 · ticket 打孔</div>
<div className={`${styles.textSmall} text-[#555]`}>同一张卡+撕线+咬边孔</div>
<div className={`${textSmall} text-[#555]`}>同一张卡+撕线+咬边孔</div>
</div>
<div>
<ShadowCard ticket hover className="h-[80px]" />
<div className="mt-1 text-[13px] font-extrabold">4 · 打孔 hover 拿起</div>
<div className={`${styles.textSmall} text-[#555]`}>
<div className={`${textSmall} text-[#555]`}>
浮 3px+阴影 5→8 跟随打孔轮廓(虚线撕线不动)
</div>
</div>
@@ -258,7 +254,7 @@ export function App() {
<ShadowButton size="sm">紧凑 · sm</ShadowButton>
<ShadowButton disabled>占位 · 虚线</ShadowButton>
</div>
<div className={`mt-3 ${styles.textSmall} text-[#555]`}>
<div className={`mt-3 ${textSmall} text-[#555]`}>
试着按下:鼠标按住不松,按钮朝阴影方向压进、投影收到 1px。
</div>
</Section>
@@ -1,5 +1,14 @@
import { BrowserMockup, ShadowButton, Mark } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import {
bgClash1a,
bgClash1b,
bgClash2a,
bgPaperDeep,
borderInk10,
textSmall,
textT2,
textT3,
} from '@idealjs/stack-ui-kit/components'
export function BrowserMockupPreview() {
return (
@@ -7,14 +16,14 @@ export function BrowserMockupPreview() {
<div className="w-[min(380px,100%)]">
<BrowserMockup url="https://stack.dev/design/components">
<div className="flex h-56 flex-col items-center justify-center gap-2 px-6 text-center">
<div className={`${styles.textT3} font-extrabold`}>你好,取景框</div>
<p className={`m-0 ${styles.textSmall} text-[#555]`}>
<div className={`${textT3} font-extrabold`}>你好,取景框</div>
<p className={`m-0 ${textSmall} text-[#555]`}>
纸面拟物 chrome:三圆点、放大镜地址栏、白底视口,内容即插槽。
</p>
</div>
</BrowserMockup>
<div className="mt-1 text-[13px] font-extrabold">1 · 基础取景框 · 定宽</div>
<div className={`${styles.textSmall} text-[#555]`}>
<div className={`${textSmall} text-[#555]`}>
360px 定宽,视口高度由内容撑起,URL 超长省略号截断
</div>
</div>
@@ -22,18 +31,18 @@ export function BrowserMockupPreview() {
<BrowserMockup url="https://stack.dev/learn" className="w-full">
<div className="flex flex-col">
<div
className={`flex items-center justify-between border-b-2 ${styles.borderInk10} ${styles.bgPaperDeep} px-4 py-2.5`}
className={`flex items-center justify-between border-b-2 ${borderInk10} ${bgPaperDeep} px-4 py-2.5`}
>
<span className="text-[12px] font-extrabold">stack 迷你站</span>
<span aria-hidden className="flex gap-1.5">
<i className={`size-2 rounded-full ${styles.bgClash1a}`} />
<i className={`size-2 rounded-full ${styles.bgClash2a}`} />
<i className={`size-2 rounded-full ${styles.bgClash1b}`} />
<i className={`size-2 rounded-full ${bgClash1a}`} />
<i className={`size-2 rounded-full ${bgClash2a}`} />
<i className={`size-2 rounded-full ${bgClash1b}`} />
</span>
</div>
<div className="flex flex-col items-center gap-2 px-6 py-8 text-center">
<h4 className={`m-0 ${styles.textT2} font-extrabold`}>在取景框里排你的页面</h4>
<p className={`m-0 ${styles.textSmall} text-[#555]`}>
<h4 className={`m-0 ${textT2} font-extrabold`}>在取景框里排你的页面</h4>
<p className={`m-0 ${textSmall} text-[#555]`}>
设计系统组件可以直接放进视口,比如这句里的
<Mark>荧光标记</Mark>。
</p>
@@ -42,7 +51,7 @@ export function BrowserMockupPreview() {
</div>
</BrowserMockup>
<div className="mt-1 text-[13px] font-extrabold">2 · 宽幅 · w-full</div>
<div className={`${styles.textSmall} text-[#555]`}>
<div className={`${textSmall} text-[#555]`}>
外壳随容器铺满,视口内自由组合设计系统件(Mark、ShadowButton)
</div>
</div>
@@ -1,11 +1,24 @@
import { Dropdown } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import {
bgClash2a,
bgPaper,
bgPaperDeep,
borderInk,
borderInk25,
hoverBgPaperDeep,
shadowInk,
tSmallMute,
tSmallStrong,
textBody,
textInk,
textSmall,
} from '@idealjs/stack-ui-kit/components'
import { useState } from 'react'
const ZONE_BASE = `${styles.tSmallMute} rounded-xl border-2 border-dashed ${styles.borderInk25} px-2.5 pt-1.5`
const ZONE_BASE = `${tSmallMute} rounded-xl border-2 border-dashed ${borderInk25} px-2.5 pt-1.5`
const CARD_BASE = `w-fit rounded-xl border-2 ${styles.borderInk} bg-white p-3`
const CARD_BASE = `w-fit rounded-xl border-2 ${borderInk} bg-white p-3`
export function DropdownPreview() {
const [downOpen, setDownOpen] = useState(false)
@@ -15,7 +28,7 @@ export function DropdownPreview() {
<div data-testid="dropdown-preview" className="flex flex-wrap items-start gap-8">
<div className={`${CARD_BASE} flex flex-col items-end`}>
<div className="mb-2 self-start text-[13px] font-extrabold">placement · bottom</div>
<div className={`${styles.textSmall} mb-2 self-start text-[#555]`}>
<div className={`${textSmall} mb-2 self-start text-[#555]`}>
向下展开 · tips 贴签与验收夹的形态
</div>
<div className="relative w-fit">
@@ -25,7 +38,7 @@ export function DropdownPreview() {
label="向下 · tips 形"
open={downOpen}
onOpenChange={setDownOpen}
triggerClassName={`flex items-center gap-1.5 rounded-full border-2 ${styles.borderInk} ${styles.bgPaper} px-3 py-1.5 text-[12.5px] font-extrabold ${styles.textInk} transition-[background-color] duration-150 motion-reduce:transition-none ${styles.hoverBgPaperDeep}`}
triggerClassName={`flex items-center gap-1.5 rounded-full border-2 ${borderInk} ${bgPaper} px-3 py-1.5 text-[12.5px] font-extrabold ${textInk} transition-[background-color] duration-150 motion-reduce:transition-none ${hoverBgPaperDeep}`}
trigger={
<>
<span aria-hidden>💡</span>
@@ -36,16 +49,14 @@ export function DropdownPreview() {
</>
}
>
<div className={`rounded-xl border-2 ${styles.borderInk} ${styles.bgPaper} p-3`}>
<p className={`${styles.tSmallStrong} m-0`}>tips 贴签面板</p>
<ul
className={`mt-2 mb-0 list-none space-y-1.5 p-0 ${styles.textSmall} ${styles.textBody}`}
>
<div className={`rounded-xl border-2 ${borderInk} ${bgPaper} p-3`}>
<p className={`${tSmallStrong} m-0`}>tips 贴签面板</p>
<ul className={`mt-2 mb-0 list-none space-y-1.5 p-0 ${textSmall} ${textBody}`}>
<li>点入口开合,点面板外任意处收起</li>
<li>Esc 收起,面板内点击不收</li>
<li>展开 200ms、收起 100ms,收起利落</li>
</ul>
<p className={`${styles.tSmallMute} mb-0 mt-2`}>真件应用:练习场 tips 贴签、验收夹</p>
<p className={`${tSmallMute} mb-0 mt-2`}>真件应用:练习场 tips 贴签、验收夹</p>
</div>
</Dropdown>
</div>
@@ -54,7 +65,7 @@ export function DropdownPreview() {
<div className={`${CARD_BASE} flex flex-col items-end`}>
<div className="mb-2 self-start text-[13px] font-extrabold">placement · top</div>
<div className={`${styles.textSmall} mb-2 self-start text-[#555]`}>
<div className={`${textSmall} mb-2 self-start text-[#555]`}>
向上弹出 · 陪练 agent 底角弹层的形态
</div>
<div className={`${ZONE_BASE} mb-2 h-[248px] w-[min(360px,100vw_-_48px)]`}>面板展开区</div>
@@ -67,12 +78,12 @@ export function DropdownPreview() {
onOpenChange={setUpOpen}
placement="top"
panelClassName="w-[min(360px,100vw_-_24px)]"
triggerClassName={`flex cursor-pointer items-center gap-2 rounded-t-lg border-2 ${styles.borderInk} ${styles.bgClash2a} py-2 pr-4 pl-3 text-[12.5px] font-extrabold ${styles.textInk} transition-[filter] duration-150 motion-reduce:transition-none hover:brightness-95`}
triggerClassName={`flex cursor-pointer items-center gap-2 rounded-t-lg border-2 ${borderInk} ${bgClash2a} py-2 pr-4 pl-3 text-[12.5px] font-extrabold ${textInk} transition-[filter] duration-150 motion-reduce:transition-none hover:brightness-95`}
trigger={
<>
<span
aria-hidden
className={`size-3 shrink-0 rounded-full border-2 ${styles.borderInk} ${styles.bgPaper}`}
className={`size-3 shrink-0 rounded-full border-2 ${borderInk} ${bgPaper}`}
/>
<span>陪练 agent</span>
<span aria-hidden className="ml-0.5">
@@ -82,22 +93,20 @@ export function DropdownPreview() {
}
>
<div
className={`relative h-[220px] rounded-b-lg rounded-tl-lg border-2 ${styles.borderInk} ${styles.bgClash2a} p-2 ${styles.shadowInk}`}
className={`relative h-[220px] rounded-b-lg rounded-tl-lg border-2 ${borderInk} ${bgClash2a} p-2 ${shadowInk}`}
>
<span
aria-hidden
className={`absolute right-0 bottom-0 size-4 border-t-2 border-l-2 ${styles.borderInk} ${styles.bgPaperDeep}`}
className={`absolute right-0 bottom-0 size-4 border-t-2 border-l-2 ${borderInk} ${bgPaperDeep}`}
/>
<div
className={`flex h-full min-h-0 flex-col gap-2 rounded-xl border-2 ${styles.borderInk} ${styles.bgPaper} p-3`}
className={`flex h-full min-h-0 flex-col gap-2 rounded-xl border-2 ${borderInk} ${bgPaper} p-3`}
>
<p className={`${styles.tSmallStrong} m-0`}>陪练弹层面板</p>
<p className={`m-0 ${styles.textSmall} ${styles.textBody}`}>
<p className={`${tSmallStrong} m-0`}>陪练弹层面板</p>
<p className={`m-0 ${textSmall} ${textBody}`}>
底角弹层从贴签向上弹出,pop 缩放归位;Esc 与点外收起同 tips 形。
</p>
<p className={`${styles.tSmallMute} mb-0 mt-auto`}>
真件应用:练习场陪练 agent 贴签
</p>
<p className={`${tSmallMute} mb-0 mt-auto`}>真件应用:练习场陪练 agent 贴签</p>
</div>
</div>
</Dropdown>
@@ -1,5 +1,5 @@
import { Ticket } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import { borderInk, textSmall } from '@idealjs/stack-ui-kit/components'
import { useState } from 'react'
@@ -12,11 +12,11 @@ export function TicketPreview() {
return (
<div data-testid="ticket-preview">
<div className={`mb-3 flex flex-wrap items-center gap-3 ${styles.textSmall}`}>
<div className={`mb-3 flex flex-wrap items-center gap-3 ${textSmall}`}>
<label className="flex items-center gap-1">
孔位
<input
className={`w-40 rounded border ${styles.borderInk} bg-white px-2 py-1`}
className={`w-40 rounded border ${borderInk} bg-white px-2 py-1`}
value={position}
onChange={(e) => setPosition(e.target.value)}
/>
@@ -27,7 +27,7 @@ export function TicketPreview() {
type="number"
min="0"
step="2"
className={`w-16 rounded border ${styles.borderInk} bg-white px-2 py-1`}
className={`w-16 rounded border ${borderInk} bg-white px-2 py-1`}
value={size}
onChange={(e) => setSize(Number(e.target.value))}
/>
+65 -52
View File
@@ -1,6 +1,29 @@
import { ChapterTicket } from '@idealjs/stack-site-ui-kit/components/ChapterTicket'
import { ShadowButton } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import {
bgClash2a,
bgPaper,
bgPaperDeep,
borderInk,
borderInk25,
borderInk60,
dropShadowInk,
dropShadowInkLift,
hoverBgPaperDeep,
hoverHost,
hoverShadowInkLift,
hoverableShadow,
liftSm,
shadowInk,
shadowInkLift,
tSmallMute,
tSmallStrong,
textBody,
textContent,
textInk,
textSmall,
textT3,
} from '@idealjs/stack-ui-kit/components'
import type { ReactNode } from 'react'
import { CHAPTERS } from '../../lib/chapters'
@@ -13,12 +36,12 @@ function TornNote({ className = '' }: { className?: string }) {
return (
<div className={className}>
<div
className={`relative border-2 ${styles.borderInk} ${styles.bgClash2a} px-5 py-4 ${styles.textSmall} font-bold ${styles.textInk} ${CLIP_TAG}`}
className={`relative border-2 ${borderInk} ${bgClash2a} px-5 py-4 ${textSmall} font-bold ${textInk} ${CLIP_TAG}`}
>
撕角便签
<i
aria-hidden
className={`absolute right-0 bottom-0 h-[22px] w-[22px] border-t-2 border-l-2 ${styles.borderInk} ${styles.bgPaperDeep}`}
className={`absolute right-0 bottom-0 h-[22px] w-[22px] border-t-2 border-l-2 ${borderInk} ${bgPaperDeep}`}
/>
</div>
</div>
@@ -38,16 +61,16 @@ function DoDont({
<div className="flex flex-1 flex-col gap-2">
<div className="flex items-center gap-2">
<span
className={`flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 ${styles.borderInk} text-[11px] font-extrabold ${
className={`flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 ${borderInk} text-[11px] font-extrabold ${
bad ? 'bg-clash1a text-paper' : 'bg-clash1b'
}`}
>
{bad ? '✗' : '✓'}
</span>
<span className={`${styles.textSmall} font-bold ${styles.textInk}`}>{text}</span>
<span className={`${textSmall} font-bold ${textInk}`}>{text}</span>
</div>
<div
className={`flex min-h-[96px] items-center rounded-xl border-2 border-dashed ${styles.borderInk25} bg-white p-4`}
className={`flex min-h-[96px] items-center rounded-xl border-2 border-dashed ${borderInk25} bg-white p-4`}
>
{children}
</div>
@@ -68,10 +91,10 @@ function Particle({
}) {
return (
<div className="flex min-w-0 flex-col items-center gap-2">
<div className={`flex h-[110px] items-center justify-center ${host ? styles.hoverHost : ''}`}>
<div className={`flex h-[110px] items-center justify-center ${host ? hoverHost : ''}`}>
{children}
</div>
<div className={`${styles.textSmall} font-extrabold ${styles.textInk}`}>{title}</div>
<div className={`${textSmall} font-extrabold ${textInk}`}>{title}</div>
<pre className="learning-demo-code m-0 w-full overflow-x-auto px-2 py-1 text-[11px]">
{code}
</pre>
@@ -81,10 +104,10 @@ function Particle({
function ShapeGroup({ name, hint, children }: { name: string; hint: string; children: ReactNode }) {
return (
<div className={`border-t-2 ${styles.borderInk60} py-4`}>
<div className={`border-t-2 ${borderInk60} py-4`}>
<div className="flex flex-wrap items-baseline gap-x-3">
<b className={`${styles.textT3} font-extrabold ${styles.textInk}`}>{name}</b>
<span className={`${styles.tSmallMute} font-mono`}>{hint}</span>
<b className={`${textT3} font-extrabold ${textInk}`}>{name}</b>
<span className={`${tSmallMute} font-mono`}>{hint}</span>
</div>
<div className="mt-3 grid grid-cols-2 gap-x-6 gap-y-4">{children}</div>
</div>
@@ -92,9 +115,7 @@ function ShapeGroup({ name, hint, children }: { name: string; hint: string; chil
}
function H3({ children }: { children: ReactNode }) {
return (
<h3 className={`mt-9 mb-4 ${styles.textT3} font-extrabold ${styles.textInk}`}>{children}</h3>
)
return <h3 className={`mt-9 mb-4 ${textT3} font-extrabold ${textInk}`}>{children}</h3>
}
function Rule({ demo }: { demo: ReactNode }) {
@@ -104,19 +125,17 @@ function Rule({ demo }: { demo: ReactNode }) {
function PaperCard({ hover = false }: { hover?: boolean }) {
return (
<div
className={`w-[150px] rounded-xl border-2 ${styles.borderInk} ${styles.bgPaper} px-3.5 py-3 ${styles.shadowInk} ${hover ? `${styles.hoverableShadow} cursor-pointer` : ''}`}
className={`w-[150px] rounded-xl border-2 ${borderInk} ${bgPaper} px-3.5 py-3 ${shadowInk} ${hover ? `${hoverableShadow} cursor-pointer` : ''}`}
>
<b className={`${styles.textSmall}`}>纸卡</b>
<b className={`${textSmall}`}>纸卡</b>
</div>
)
}
function HostCard({ children }: { children: ReactNode }) {
return (
<div
className={`w-fit rounded-xl border-2 ${styles.borderInk} ${styles.bgPaper} p-4 ${styles.shadowInk}`}
>
<b className={`${styles.textSmall}`}>第一层纸卡</b>
<div className={`w-fit rounded-xl border-2 ${borderInk} ${bgPaper} p-4 ${shadowInk}`}>
<b className={`${textSmall}`}>第一层纸卡</b>
<div className="mt-3">{children}</div>
</div>
)
@@ -137,9 +156,9 @@ export function App() {
code='<div className="shadow-ink">纸卡</div>'
>
<div
className={`w-[132px] rounded-xl border-2 ${styles.borderInk} ${styles.bgPaper} px-3 py-2.5 text-center ${styles.shadowInk}`}
className={`w-[132px] rounded-xl border-2 ${borderInk} ${bgPaper} px-3 py-2.5 text-center ${shadowInk}`}
>
<b className={`${styles.textSmall}`}>纸卡</b>
<b className={`${textSmall}`}>纸卡</b>
</div>
</Particle>
<Particle
@@ -148,9 +167,9 @@ export function App() {
code='<div className="shadow-ink-lift">纸卡</div>'
>
<div
className={`w-[132px] rounded-xl border-2 ${styles.borderInk} ${styles.bgPaper} px-3 py-2.5 text-center ${styles.shadowInkLift}`}
className={`w-[132px] rounded-xl border-2 ${borderInk} ${bgPaper} px-3 py-2.5 text-center ${shadowInkLift}`}
>
<b className={`${styles.textSmall}`}>纸卡</b>
<b className={`${textSmall}`}>纸卡</b>
</div>
</Particle>
</ShapeGroup>
@@ -160,14 +179,14 @@ export function App() {
title="drop-shadow-ink · 静置"
code='<TornNote className="drop-shadow-ink" />'
>
<TornNote className={`${styles.dropShadowInk} w-fit`} />
<TornNote className={`${dropShadowInk} w-fit`} />
</Particle>
<Particle
host={false}
title="drop-shadow-ink-lift · 拿起"
code='<TornNote className="drop-shadow-ink-lift" />'
>
<TornNote className={`${styles.dropShadowInkLift} w-fit`} />
<TornNote className={`${dropShadowInkLift} w-fit`} />
</Particle>
</ShapeGroup>
</Section>
@@ -196,15 +215,13 @@ export function App() {
title="drop-shadow-ink · 静置参照"
code='<div className="drop-shadow-ink">\n <div className="[clip-path:…]">便签</div>\n</div>'
>
<TornNote className={`${styles.dropShadowInk} w-fit`} />
<TornNote className={`${dropShadowInk} w-fit`} />
</Particle>
<Particle
title="+ hoverable-shadow"
code='<div className="drop-shadow-ink hoverable-shadow">\n <div className="[clip-path:…]">便签</div>\n</div>'
>
<TornNote
className={`${styles.dropShadowInk} ${styles.hoverableShadow} w-fit cursor-pointer`}
/>
<TornNote className={`${dropShadowInk} ${hoverableShadow} w-fit cursor-pointer`} />
</Particle>
</div>
<H3>Ticket 拿起</H3>
@@ -225,12 +242,12 @@ export function App() {
<>
<DoDont bad text="模糊影子">
<div
className={`h-10 w-40 rounded-lg border-2 ${styles.borderInk} ${styles.bgClash2a} [box-shadow:10px_10px_18px_rgba(17,17,17,0.4)]`}
className={`h-10 w-40 rounded-lg border-2 ${borderInk} ${bgClash2a} [box-shadow:10px_10px_18px_rgba(17,17,17,0.4)]`}
/>
</DoDont>
<DoDont text="硬投影">
<div
className={`h-10 w-40 rounded-lg border-2 ${styles.borderInk} ${styles.bgClash2a} ${styles.shadowInk}`}
className={`h-10 w-40 rounded-lg border-2 ${borderInk} ${bgClash2a} ${shadowInk}`}
/>
</DoDont>
</>
@@ -240,12 +257,12 @@ export function App() {
demo={
<>
<DoDont bad text="两层影子">
<div className={`${styles.shadowInk} w-fit`}>
<TornNote className={`${styles.dropShadowInk}`} />
<div className={`${shadowInk} w-fit`}>
<TornNote className={`${dropShadowInk}`} />
</div>
</DoDont>
<DoDont text="单层影子">
<TornNote className={`${styles.dropShadowInk} w-fit`} />
<TornNote className={`${dropShadowInk} w-fit`} />
</DoDont>
</>
}
@@ -255,17 +272,17 @@ export function App() {
<>
<DoDont bad text="被裁掉的影子">
<div
className={`relative ${styles.dropShadowInk} border-2 ${styles.borderInk} ${styles.bgClash2a} px-5 py-4 ${styles.textSmall} font-bold ${styles.textInk} ${CLIP_TAG}`}
className={`relative ${dropShadowInk} border-2 ${borderInk} ${bgClash2a} px-5 py-4 ${textSmall} font-bold ${textInk} ${CLIP_TAG}`}
>
影去哪了
<i
aria-hidden
className={`absolute right-0 bottom-0 h-[22px] w-[22px] border-t-2 border-l-2 ${styles.borderInk} ${styles.bgPaperDeep}`}
className={`absolute right-0 bottom-0 h-[22px] w-[22px] border-t-2 border-l-2 ${borderInk} ${bgPaperDeep}`}
/>
</div>
</DoDont>
<DoDont text="影子在外层">
<TornNote className={`${styles.dropShadowInk} w-fit`} />
<TornNote className={`${dropShadowInk} w-fit`} />
</DoDont>
</>
}
@@ -284,7 +301,7 @@ export function App() {
<HostCard>
<button
type="button"
className={`cursor-pointer rounded-lg border-2 ${styles.borderInk} ${styles.bgPaper} px-3 py-1.5 ${styles.textSmall} font-bold ${styles.textInk} shadow-[3px_3px_0_var(--color-ink)]`}
className={`cursor-pointer rounded-lg border-2 ${borderInk} ${bgPaper} px-3 py-1.5 ${textSmall} font-bold ${textInk} shadow-[3px_3px_0_var(--color-ink)]`}
>
卡内按钮
</button>
@@ -294,7 +311,7 @@ export function App() {
<HostCard>
<button
type="button"
className={`cursor-pointer rounded-lg border-2 ${styles.borderInk} ${styles.bgPaper} px-3 py-1.5 ${styles.textSmall} font-bold ${styles.textInk} transition-[background-color] duration-150 ${styles.hoverBgPaperDeep} active:translate-y-[1px]`}
className={`cursor-pointer rounded-lg border-2 ${borderInk} ${bgPaper} px-3 py-1.5 ${textSmall} font-bold ${textInk} transition-[background-color] duration-150 ${hoverBgPaperDeep} active:translate-y-[1px]`}
>
卡内按钮
</button>
@@ -303,15 +320,13 @@ export function App() {
</>
}
/>
<p className={`mt-4 mb-0 ${styles.textContent} ${styles.textBody}`}>
<p className={`mt-4 mb-0 ${textContent} ${textBody}`}>
二层交互件的完整形态:
<b className={`${styles.tSmallStrong}`}>
<b className={`${tSmallStrong}`}>
描边(2px ink)+底色,hover 换底色或调亮度,按压位移 1px 不换影
</b>
。ShadowButton / Button 的
<code
className={`mx-1 rounded ${styles.bgPaperDeep} px-1.5 py-0.5 font-mono text-[12.5px]`}
>
<code className={`mx-1 rounded ${bgPaperDeep} px-1.5 py-0.5 font-mono text-[12.5px]`}>
nested
</code>
形态、learning 组件里的翻面钮、工位卡、印章都按此执行。
@@ -327,15 +342,15 @@ export function App() {
<>
<DoDont bad text="自 hover:命中区跟着位移,指针停底边就疯狂抖动">
<div
className={`w-fit cursor-pointer rounded-xl border-2 ${styles.borderInk} ${styles.bgPaper} px-3.5 py-3 ${styles.shadowInk} transition-[translate,box-shadow] duration-150 hover:-translate-y-[3px] ${styles.hoverShadowInkLift}`}
className={`w-fit cursor-pointer rounded-xl border-2 ${borderInk} ${bgPaper} px-3.5 py-3 ${shadowInk} transition-[translate,box-shadow] duration-150 hover:-translate-y-[3px] ${hoverShadowInkLift}`}
>
<b className={`${styles.textSmall}`}>纸卡</b>
<b className={`${textSmall}`}>纸卡</b>
</div>
</DoDont>
<DoDont text="hover-host:宿主承接 hover,子元素才位移">
<div className="hover-host w-fit">
<div className="hoverable-shadow shadow-ink w-fit cursor-pointer rounded-xl border-2 border-ink bg-paper px-3.5 py-3">
<b className={`${styles.textSmall}`}>纸卡</b>
<b className={`${textSmall}`}>纸卡</b>
</div>
</div>
</DoDont>
@@ -353,9 +368,7 @@ export function App() {
title="撕角档 · drop-shadow-ink"
code='<div className="hover-host">\n <TornNote className="drop-shadow-ink hoverable-shadow" />\n</div>'
>
<TornNote
className={`${styles.dropShadowInk} ${styles.hoverableShadow} w-fit cursor-pointer`}
/>
<TornNote className={`${dropShadowInk} ${hoverableShadow} w-fit cursor-pointer`} />
</Particle>
<Particle
title="便签档 · lift-sm"
@@ -363,7 +376,7 @@ export function App() {
>
<button
type="button"
className={`${styles.hoverableShadow} ${styles.liftSm} flex cursor-pointer items-center gap-2 rounded-t-lg border-2 ${styles.borderInk} ${styles.bgClash2a} px-3 py-1.5 text-[12.5px] font-extrabold ${styles.textInk} shadow-[3px_3px_0_var(--color-ink)] transition-[translate] duration-150`}
className={`${hoverableShadow} ${liftSm} flex cursor-pointer items-center gap-2 rounded-t-lg border-2 ${borderInk} ${bgClash2a} px-3 py-1.5 text-[12.5px] font-extrabold ${textInk} shadow-[3px_3px_0_var(--color-ink)] transition-[translate] duration-150`}
>
便签 Tab
</button>
+13 -9
View File
@@ -1,5 +1,11 @@
import { BrickDot, Mark, Ring, Tri, Wave } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import {
borderInk,
tSmallMute,
textBody,
textInk,
textSmall,
} from '@idealjs/stack-ui-kit/components'
import type { ReactNode } from 'react'
import { Page, Section } from '../../lib/ui'
@@ -76,23 +82,21 @@ export function App() {
{SHAPES.map((s) => (
<div key={s.n} className="text-center">
<div
className={`mx-auto flex h-[46px] w-[46px] items-center justify-center rounded-xl border-2 ${styles.borderInk} bg-white`}
className={`mx-auto flex h-[46px] w-[46px] items-center justify-center rounded-xl border-2 ${borderInk} bg-white`}
>
{s.el}
</div>
<div className="mt-1.5 text-[11px] font-bold">{s.n}</div>
<div className={`mt-0.5 ${styles.textSmall} leading-snug ${styles.textBody}`}>
{s.d}
</div>
<div className={`mt-0.5 ${styles.tSmallMute} leading-tight`}>场景 · {s.s}</div>
<div className={`mt-0.5 ${textSmall} leading-snug ${textBody}`}>{s.d}</div>
<div className={`mt-0.5 ${tSmallMute} leading-tight`}>场景 · {s.s}</div>
</div>
))}
</div>
</Section>
<Section label="词汇表 · 父子层级" note="与 ai-era-tutorial 词汇表对齐">
<table className={`w-full border-collapse ${styles.textSmall} ${styles.textBody}`}>
<table className={`w-full border-collapse ${textSmall} ${textBody}`}>
<thead>
<tr className={`border-b-2 border-[#d5d5d3] text-left ${styles.textInk}`}>
<tr className={`border-b-2 border-[#d5d5d3] text-left ${textInk}`}>
<th className="w-24 py-1 pr-2">父词</th>
<th className="w-44 py-1 pr-2">图形 · 子词</th>
<th className="py-1 pr-2">释义(skill 口径)</th>
@@ -105,7 +109,7 @@ export function App() {
{i === 0 && (
<td
rowSpan={g.rows.length}
className={`py-1 pr-2 align-top font-extrabold ${styles.textInk}`}
className={`py-1 pr-2 align-top font-extrabold ${textInk}`}
>
{g.p}
</td>
@@ -1,14 +1,30 @@
import * as styles from '@idealjs/stack-ui-kit/components'
import {
bgInk,
bgPaper,
borderInk,
shadowInk,
tDisplay,
tSmallMute,
tSmallStrong,
textBody,
textContent,
textInk,
textPaper,
textSmall,
textT1,
textT2,
textT3,
} from '@idealjs/stack-ui-kit/components'
import { Page, Section } from '../../lib/ui'
const SCALE = [
{
n: '正文 content',
token: `${styles.textContent}`,
token: `${textContent}`,
spec: '16px / 1.75(浏览器默认)',
use: '全站基准——步骤与认知基础正文',
sample: (
<span className={`${styles.textContent} ${styles.textBody}`}>
<span className={`${textContent} ${textBody}`}>
把 16px 当正文,浏览器默认字号即设计基准。
</span>
),
@@ -16,47 +32,35 @@ const SCALE = [
},
{
n: '三级标题 t3',
token: `${styles.textT3}`,
token: `${textT3}`,
spec: '18px / 1.5',
use: '步骤标题、积木名',
sample: (
<span className={`${styles.textT3} font-bold ${styles.textInk}`}>
组件是界面拼接的最小单位
</span>
),
sample: <span className={`${textT3} font-bold ${textInk}`}>组件是界面拼接的最小单位</span>,
cls: '',
},
{
n: '二级标题 t2',
token: `${styles.textT2}`,
token: `${textT2}`,
spec: '22px / 1.45',
use: '次级标题(区块级,预留)',
sample: (
<span className={`${styles.textT2} font-bold ${styles.textInk}`}>
用组件拼出可增删的 todo
</span>
),
sample: <span className={`${textT2} font-bold ${textInk}`}>用组件拼出可增删的 todo</span>,
cls: '',
},
{
n: '一级标题 t1',
token: `${styles.textT1}`,
token: `${textT1}`,
spec: '28px / 1.3',
use: '页面主标题、章头',
sample: (
<span className={`${styles.textT1} font-extrabold ${styles.textInk}`}>
第 1 章 · 快速开始
</span>
),
sample: <span className={`${textT1} font-extrabold ${textInk}`}>第 1 章 · 快速开始</span>,
cls: '',
},
{
n: '辅助 small',
token: `${styles.textSmall}`,
token: `${textSmall}`,
spec: '12px / 1.65',
use: '卡片内辅助正文(积木三句话)',
sample: (
<span className={`${styles.textSmall} ${styles.textBody}`}>
<span className={`${textSmall} ${textBody}`}>
静态文件服务:把目录里的文件原样返回的那层服务。
</span>
),
@@ -64,27 +68,27 @@ const SCALE = [
},
{
n: '小字 · 边缘可忽略',
token: `${styles.tSmallMute}`,
token: `${tSmallMute}`,
spec: '12px 灰',
use: '注记、页脚——看不清也无妨',
sample: <span className={`${styles.tSmallMute}`}>散落只在卡片附近空当,密度 ≤ 8/屏</span>,
cls: `${styles.tSmallMute}`,
sample: <span className={`${tSmallMute}`}>散落只在卡片附近空当,密度 ≤ 8/屏</span>,
cls: `${tSmallMute}`,
},
{
n: '小字 · 缩小但加强',
token: `${styles.tSmallStrong}`,
token: `${tSmallStrong}`,
spec: '12px 加粗 + 字距',
use: 'Section 标签、靶子三行、验收标签',
sample: <span className={`${styles.tSmallStrong}`}>▲ 目标:让第一个网页跑起来</span>,
cls: `${styles.tSmallStrong}`,
sample: <span className={`${tSmallStrong}`}>▲ 目标:让第一个网页跑起来</span>,
cls: `${tSmallStrong}`,
},
{
n: '大字 · 大而弱',
token: `${styles.tDisplay}`,
token: `${tDisplay}`,
spec: '64px @ ink 10%',
use: '章头幽灵章号——存在但不抢戏',
sample: <span className={`${styles.tDisplay}`}>05</span>,
cls: `${styles.tDisplay}`,
sample: <span className={`${tDisplay}`}>05</span>,
cls: `${tDisplay}`,
},
]
@@ -115,16 +119,16 @@ export function App() {
{SCALE.map((s) => (
<div
key={s.n}
className={`flex flex-wrap items-baseline gap-x-5 gap-y-2 rounded-xl border-2 ${styles.borderInk} ${styles.bgPaper} p-3.5 ${styles.shadowInk}`}
className={`flex flex-wrap items-baseline gap-x-5 gap-y-2 rounded-xl border-2 ${borderInk} ${bgPaper} p-3.5 ${shadowInk}`}
>
<div className="w-[150px] shrink-0">
<div className={`${styles.tSmallStrong}`}>{s.n}</div>
<div className={`${styles.tSmallMute} font-mono`}>{s.token}</div>
<div className={`${tSmallStrong}`}>{s.n}</div>
<div className={`${tSmallMute} font-mono`}>{s.token}</div>
</div>
<div className="flex min-w-[280px] flex-1 flex-wrap items-center gap-x-6">
{s.sample}
</div>
<div className={`${styles.tSmallMute} w-[220px] shrink-0`}>
<div className={`${tSmallMute} w-[220px] shrink-0`}>
{s.spec} · {s.use}
</div>
</div>
@@ -136,19 +140,17 @@ export function App() {
{RULES.map((r, i) => (
<div
key={r.n}
className={`rounded-xl border-2 ${styles.borderInk} ${styles.bgPaper} p-4 ${styles.shadowInk}`}
className={`rounded-xl border-2 ${borderInk} ${bgPaper} p-4 ${shadowInk}`}
>
<div className="flex items-baseline gap-2">
<span
className={`flex h-[18px] w-[18px] shrink-0 translate-y-[2px] items-center justify-center rounded-full border-2 ${styles.borderInk} ${styles.bgInk} text-[10px] font-extrabold ${styles.textPaper}`}
className={`flex h-[18px] w-[18px] shrink-0 translate-y-[2px] items-center justify-center rounded-full border-2 ${borderInk} ${bgInk} text-[10px] font-extrabold ${textPaper}`}
>
{i + 1}
</span>
<b className={`${styles.textT3}`}>{r.n}</b>
<b className={`${textT3}`}>{r.n}</b>
</div>
<p className={`m-0 mt-1.5 max-w-[760px] ${styles.textContent} ${styles.textBody}`}>
{r.why}
</p>
<p className={`m-0 mt-1.5 max-w-[760px] ${textContent} ${textBody}`}>{r.why}</p>
</div>
))}
</div>
+15 -9
View File
@@ -1,4 +1,14 @@
import * as styles from '@idealjs/stack-ui-kit/components'
import {
bgPaper,
borderInk,
hoverHost,
hoverableShadow,
shadowInk,
textBody,
textInk,
textSmall,
textT3,
} from '@idealjs/stack-ui-kit/components'
import { type PageKey, relHref } from '../../lib/pages'
import { Page, Section } from '../../lib/ui'
@@ -32,17 +42,13 @@ export function App() {
<Section label="五册" note="点卡片进入对应册">
<div className="flex flex-wrap gap-6">
{BOOKS.map((b) => (
<span key={b.key} className={`${styles.hoverHost} block w-fit`}>
<span key={b.key} className={`${hoverHost} block w-fit`}>
<a
href={relHref('design', b.key)}
className={`${styles.hoverableShadow} block w-[280px] rounded-2xl border-2 ${styles.borderInk} ${styles.bgPaper} p-5 no-underline ${styles.shadowInk} transition-[translate,box-shadow] duration-150`}
className={`${hoverableShadow} block w-[280px] rounded-2xl border-2 ${borderInk} ${bgPaper} p-5 no-underline ${shadowInk} transition-[translate,box-shadow] duration-150`}
>
<span className={`${styles.textT3} font-extrabold ${styles.textInk}`}>
{b.label}
</span>
<span
className={`mt-2 block ${styles.textSmall} leading-relaxed ${styles.textBody}`}
>
<span className={`${textT3} font-extrabold ${textInk}`}>{b.label}</span>
<span className={`mt-2 block ${textSmall} leading-relaxed ${textBody}`}>
{b.desc}
</span>
</a>
+2 -2
View File
@@ -1,5 +1,5 @@
import { Button } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import { textBody } from '@idealjs/stack-ui-kit/components'
import { relHref } from '../../lib/pages'
import { Page, Section } from '../../lib/ui'
@@ -13,7 +13,7 @@ export function App() {
HTML 是描述网页结构的标记语言:标签告诉浏览器哪些是标题、段落、表单和列表。
在主线教程里,它第一个出场,为待办应用搭出骨架,让每一项数据都有展示的位置。
</p>
<p className={`m-0 leading-[1.75] ${styles.textBody}`}>
<p className={`m-0 leading-[1.75] ${textBody}`}>
专项教程将在这里逐步补充。想先动手做出点什么,直接走主线:
</p>
</div>
+4 -6
View File
@@ -1,5 +1,5 @@
import { Button } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import { textContent } from '@idealjs/stack-ui-kit/components'
import { MONTHS } from '../../content/blogs'
import { relHref } from '../../lib/pages'
@@ -9,15 +9,13 @@ export function App() {
return (
<Page active="index" title="idealjs stack" subtitle="从第一个网页,到完整的应用。">
<div className="max-w-[72ch]">
<p className={`m-0 ${styles.textContent}`}>
通过全栈工程师教程,逐步学习前端、后端与工程实践;
</p>
<p className={`m-0 ${textContent}`}>通过全栈工程师教程,逐步学习前端、后端与工程实践;</p>
<div className="mt-2.5">
<Button tone="clash1a" href={relHref('index', 'learn')}>
开始学习 <span aria-hidden="true">→</span>
</Button>
</div>
<p className={`mb-0 mt-7 ${styles.textContent}`}>在博客中,分享开发过程中的经验与思考。</p>
<p className={`mb-0 mt-7 ${textContent}`}>在博客中,分享开发过程中的经验与思考。</p>
<div className="mt-2.5">
{MONTHS[0] && (
<Button tone="clash2a" href={relHref('index', `blog-${MONTHS[0].key}`)}>
@@ -25,7 +23,7 @@ export function App() {
</Button>
)}
</div>
<p className={`mb-0 mt-7 ${styles.textContent}`}>
<p className={`mb-0 mt-7 ${textContent}`}>
在线练习场正在以 ESM + MCP 的形式重建;在那之前,从教程开始、在本地环境跟练。
</p>
<div className="mt-2.5">
+2 -2
View File
@@ -1,5 +1,5 @@
import { Button } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import { textBody } from '@idealjs/stack-ui-kit/components'
import { relHref } from '../../lib/pages'
import { Page, Section } from '../../lib/ui'
@@ -13,7 +13,7 @@ export function App() {
JavaScript 是处理数据与交互的编程语言,DOM
是它读取和修改页面的接口。在主线教程里,它用数组存放待办,响应添加、删除和勾选,再把变化呈现在页面上。
</p>
<p className={`m-0 leading-[1.75] ${styles.textBody}`}>
<p className={`m-0 leading-[1.75] ${textBody}`}>
专项教程将在这里逐步补充。想先动手做出点什么,直接走主线:
</p>
</div>
+3 -3
View File
@@ -1,7 +1,7 @@
import { PageFlipZone } from '@idealjs/stack-site-ui-kit/components/PageFlipZone'
import { SitePage } from '@idealjs/stack-site-ui-kit/components/SitePage'
import { SiteSidebar } from '@idealjs/stack-site-ui-kit/components/SiteSidebar'
import * as styles from '@idealjs/stack-ui-kit/components'
import { textContent, textInk, textMute, textT1 } from '@idealjs/stack-ui-kit/components'
import { PageTurnBar } from '../../components/PageTurnBar'
import { flipTargetsOf } from '../../lib/pages'
@@ -17,8 +17,8 @@ export function App() {
footerGroups={FOOTER_GROUPS}
>
<div className="mb-4">
<h1 className={`m-0 ${styles.textT1} font-extrabold ${styles.textInk}`}>在线练习</h1>
<p className={`m-0 mt-1.5 ${styles.textContent} ${styles.textMute}`}>
<h1 className={`m-0 ${textT1} font-extrabold ${textInk}`}>在线练习</h1>
<p className={`m-0 mt-1.5 ${textContent} ${textMute}`}>
沙箱写真跑:web runner 沙箱预览与 playground
编辑器同住右缘侧栏——点紫色的「沙箱预览」签直接看沙箱,点「编辑器」签写码;点「运行
▶」构建产物送进隔离 iframe
@@ -1,10 +1,22 @@
import { DockModal } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import {
bgClash1b,
bgPaper,
borderInk,
focusBgPaperDeep,
hoverBgClash1b80,
hoverBgPaperDeep,
tSmallMute,
tSmallStrong,
textBody,
textInk,
textT3,
} from '@idealjs/stack-ui-kit/components'
import { useState } from 'react'
import type { LlmConfig } from '../lib/agent/llm'
const FIELD = `w-full rounded-lg border-2 ${styles.borderInk} ${styles.bgPaper} px-2.5 py-1.5 font-mono text-[13px] outline-none ${styles.focusBgPaperDeep}`
const FIELD = `w-full rounded-lg border-2 ${borderInk} ${bgPaper} px-2.5 py-1.5 font-mono text-[13px] outline-none ${focusBgPaperDeep}`
export function KeyModal({
config,
@@ -21,8 +33,8 @@ export function KeyModal({
return (
<DockModal label="模型接入" className="w-full max-w-md" onClose={onClose}>
<h2 className={`m-0 ${styles.textT3} font-extrabold ${styles.textInk}`}>模型接入</h2>
<p className={`${styles.tSmallMute} mt-1.5 mb-4`}>
<h2 className={`m-0 ${textT3} font-extrabold ${textInk}`}>模型接入</h2>
<p className={`${tSmallMute} mt-1.5 mb-4`}>
默认 DeepSeek;也可填任何 OpenAI 兼容端点。key 仅保存在浏览器 localStorage。
</p>
<form
@@ -31,7 +43,7 @@ export function KeyModal({
onSave({ baseURL: baseURL.trim(), apiKey: apiKey.trim(), model: model.trim() })
}}
>
<label htmlFor="km-base-url" className={`${styles.tSmallStrong} mb-1 block`}>
<label htmlFor="km-base-url" className={`${tSmallStrong} mb-1 block`}>
API 地址(baseURL)
</label>
<input
@@ -41,7 +53,7 @@ export function KeyModal({
onChange={(e) => setBaseURL(e.target.value)}
spellCheck={false}
/>
<label htmlFor="km-api-key" className={`${styles.tSmallStrong} mt-3 mb-1 block`}>
<label htmlFor="km-api-key" className={`${tSmallStrong} mt-3 mb-1 block`}>
API Key
</label>
<input
@@ -54,7 +66,7 @@ export function KeyModal({
autoComplete="off"
spellCheck={false}
/>
<label htmlFor="km-model" className={`${styles.tSmallStrong} mt-3 mb-1 block`}>
<label htmlFor="km-model" className={`${tSmallStrong} mt-3 mb-1 block`}>
模型
</label>
<input
@@ -68,13 +80,13 @@ export function KeyModal({
<button
type="button"
onClick={onClose}
className={`cursor-pointer rounded-lg border-2 ${styles.borderInk} ${styles.bgPaper} px-3 py-1.5 text-[13px] font-bold ${styles.textBody} transition-colors ${styles.hoverBgPaperDeep}`}
className={`cursor-pointer rounded-lg border-2 ${borderInk} ${bgPaper} px-3 py-1.5 text-[13px] font-bold ${textBody} transition-colors ${hoverBgPaperDeep}`}
>
取消
</button>
<button
type="submit"
className={`cursor-pointer rounded-lg border-2 ${styles.borderInk} ${styles.bgClash1b} px-3 py-1.5 text-[13px] font-bold ${styles.textInk} transition-colors ${styles.hoverBgClash1b80}`}
className={`cursor-pointer rounded-lg border-2 ${borderInk} ${bgClash1b} px-3 py-1.5 text-[13px] font-bold ${textInk} transition-colors ${hoverBgClash1b80}`}
>
保存
</button>
@@ -1,6 +1,6 @@
import { ClipboardChecklist } from '@idealjs/stack-site-ui-kit/components/learning/ClipboardChecklist'
import { DataFlowBoard } from '@idealjs/stack-site-ui-kit/components/learning/DataFlowBoard'
import * as styles from '@idealjs/stack-ui-kit/components'
import { borderInk, tSmallMute, tSmallStrong } from '@idealjs/stack-ui-kit/components'
import type { DataFlowStep } from '@idealjs/stack-site-ui-kit'
import { useMemo, useRef, useState } from 'react'
@@ -47,13 +47,13 @@ function SandboxPane() {
<section aria-label="web runner 沙箱预览" className="flex min-h-0 flex-1 flex-col gap-2.5">
<StatusLine />
<div
className={`relative h-[320px] shrink-0 overflow-hidden rounded-lg border-2 ${styles.borderInk} bg-white`}
className={`relative h-[320px] shrink-0 overflow-hidden rounded-lg border-2 ${borderInk} bg-white`}
>
<SandboxFrame fill />
{!preview && (
<div className="pointer-events-none absolute inset-0 grid place-content-center gap-1 p-4 text-center">
<p className={`${styles.tSmallStrong} m-0`}>沙箱预览</p>
<p className={`${styles.tSmallMute} m-0`}>
<p className={`${tSmallStrong} m-0`}>沙箱预览</p>
<p className={`${tSmallMute} m-0`}>
切到「编辑器」页签写代码,点「运行 ▶」回到这里,构建产物送进隔离 iframe 真跑。
</p>
</div>
+22 -16
View File
@@ -1,4 +1,15 @@
import * as styles from '@idealjs/stack-ui-kit/components'
import {
bgClash1a,
bgClash2a,
bgPaper,
bgPaperDeep,
borderInk,
tSmallMute,
tSmallStrong,
textBody,
textInk,
textMute,
} from '@idealjs/stack-ui-kit/components'
import type { ConsoleLevel } from './protocol'
export interface OutputLine {
level: ConsoleLevel | 'system'
@@ -7,22 +18,19 @@ export interface OutputLine {
}
const LEVEL_STYLE: Record<OutputLine['level'], string> = {
log: `${styles.bgPaperDeep} ${styles.textBody}`,
info: `${styles.bgPaperDeep} ${styles.textBody}`,
warn: `${styles.bgClash2a} ${styles.textInk}`,
error: `${styles.bgClash1a} ${styles.textInk}`,
system: `${styles.bgPaper} ${styles.textMute}`,
log: `${bgPaperDeep} ${textBody}`,
info: `${bgPaperDeep} ${textBody}`,
warn: `${bgClash2a} ${textInk}`,
error: `${bgClash1a} ${textInk}`,
system: `${bgPaper} ${textMute}`,
}
export function OutputPanel({ lines, done }: { lines: OutputLine[]; done: boolean }) {
return (
<section
aria-label="输出"
className={`mt-4 rounded-xl border-2 ${styles.borderInk} bg-white p-3`}
>
<h2 className={`${styles.tSmallStrong} m-0 mb-2`}>输出</h2>
<section aria-label="输出" className={`mt-4 rounded-xl border-2 ${borderInk} bg-white p-3`}>
<h2 className={`${tSmallStrong} m-0 mb-2`}>输出</h2>
{lines.length === 0 && !done && (
<p className={`${styles.tSmallMute} m-0`}>(还没有输出——点「运行」试试)</p>
<p className={`${tSmallMute} m-0`}>(还没有输出——点「运行」试试)</p>
)}
<ul className="m-0 mb-0 list-none p-0">
{lines.map((l, i) => (
@@ -35,13 +43,11 @@ export function OutputPanel({ lines, done }: { lines: OutputLine[]; done: boolea
>
{l.stage === 'build' ? '构建' : l.level}
</span>
<span className={`min-w-0 break-all whitespace-pre-wrap ${styles.textBody}`}>
{l.text}
</span>
<span className={`min-w-0 break-all whitespace-pre-wrap ${textBody}`}>{l.text}</span>
</li>
))}
</ul>
{done && <p className={`${styles.tSmallMute} m-0 mt-1`}>✓ 执行完毕</p>}
{done && <p className={`${tSmallMute} m-0 mt-1`}>✓ 执行完毕</p>}
</section>
)
}
+21 -13
View File
@@ -1,5 +1,13 @@
import { ShadowButton } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import {
borderInk,
hoverBgPaperDeep,
hoverTextClash1a,
tSmallMute,
textClash1a,
textInk,
textMute,
} from '@idealjs/stack-ui-kit/components'
import runtimeDoc from 'virtual:web-runner-doc'
import { RUNTIME_ORIGIN, usePlayground } from './context'
@@ -8,19 +16,19 @@ import { OutputPanel } from './OutputPanel'
export function StatusLine() {
const { status, sameOriginAlert } = usePlayground()
return (
<p className={`${styles.tSmallMute} m-0 mb-2.5`} data-testid="runtime-status">
<p className={`${tSmallMute} m-0 mb-2.5`} data-testid="runtime-status">
{status
? `运行时源:${RUNTIME_ORIGIN ? `${RUNTIME_ORIGIN}(独立源部署)` : 'null(opaque origin,srcdoc 退化)'} · 文档 origin:${status.origin}`
: '运行时启动中…'}
{status && ' · '}
{status &&
(status.parentBlocked ? (
<span className={`font-bold ${styles.textInk}`}>父窗口访问已阻断</span>
<span className={`font-bold ${textInk}`}>父窗口访问已阻断</span>
) : (
<span className={`font-bold ${styles.textClash1a}`}>父窗口访问未被阻断——隔离异常!</span>
<span className={`font-bold ${textClash1a}`}>父窗口访问未被阻断——隔离异常!</span>
))}
{sameOriginAlert && (
<span className={`font-bold ${styles.textClash1a}`}> · 运行时与宿主同源——隔离失效!</span>
<span className={`font-bold ${textClash1a}`}> · 运行时与宿主同源——隔离失效!</span>
)}
</p>
)
@@ -45,7 +53,7 @@ export function FileTabs() {
{files.map((f) => (
<span
key={f.name}
className={`inline-flex items-center overflow-hidden rounded-md border-2 ${styles.borderInk} bg-white`}
className={`inline-flex items-center overflow-hidden rounded-md border-2 ${borderInk} bg-white`}
>
<button
type="button"
@@ -63,7 +71,7 @@ export function FileTabs() {
onClick={() => removeFile(f.name)}
aria-label={`删除 ${f.name}`}
title={`删除 ${f.name}`}
className={`px-1.5 py-0.5 text-[12px] ${styles.textMute} ${styles.hoverTextClash1a}`}
className={`px-1.5 py-0.5 text-[12px] ${textMute} ${hoverTextClash1a}`}
>
×
</button>
@@ -86,12 +94,12 @@ export function FileTabs() {
setNameError(null)
}}
placeholder="新建文件…"
className={`w-28 rounded-md border-2 ${styles.borderInk} bg-white px-2 py-0.5 font-mono text-[12px] ${styles.textInk} outline-none focus:bg-white`}
className={`w-28 rounded-md border-2 ${borderInk} bg-white px-2 py-0.5 font-mono text-[12px] ${textInk} outline-none focus:bg-white`}
/>
<button
type="submit"
aria-label="新建文件"
className={`rounded-md border-2 ${styles.borderInk} bg-white px-2 py-0.5 text-[12px] ${styles.textInk} ${styles.hoverBgPaperDeep}`}
className={`rounded-md border-2 ${borderInk} bg-white px-2 py-0.5 text-[12px] ${textInk} ${hoverBgPaperDeep}`}
>
+
</button>
@@ -101,7 +109,7 @@ export function FileTabs() {
<p
role="alert"
data-testid="file-name-error"
className={`${styles.tSmallMute} m-0 mb-2 font-bold ${styles.textClash1a}`}
className={`${tSmallMute} m-0 mb-2 font-bold ${textClash1a}`}
>
{nameError}
</p>
@@ -119,7 +127,7 @@ export function CodeEditor({ className = '' }: { className?: string }) {
onChange={(e) => updateActiveCode(e.target.value)}
spellCheck={false}
rows={12}
className={`w-full resize-y rounded-xl border-2 ${styles.borderInk} bg-white p-3 font-mono text-[13px] leading-relaxed ${styles.textInk} outline-none selection:bg-white ${className}`}
className={`w-full resize-y rounded-xl border-2 ${borderInk} bg-white p-3 font-mono text-[13px] leading-relaxed ${textInk} outline-none selection:bg-white ${className}`}
/>
)
}
@@ -136,7 +144,7 @@ export function RunRow({ nested = false }: { nested?: boolean }) {
>
{engineReady ? '运行 ▶' : '引擎加载中…'}
</ShadowButton>
<span className={`${styles.tSmallMute}`}>
<span className={`${tSmallMute}`}>
{building
? 'stack 构建中(宿主)…'
: `「${active.name}」宿主 stack 构建(入口按 stack.config.ts 的 inputs,缺省由 index.html 的 script src 推导)→ 产物送沙箱执行`}
@@ -179,7 +187,7 @@ export function SandboxFrame({ fill = false }: { fill?: boolean }) {
ref={iframeRef}
onLoad={pingRuntime}
className={
preview ? `mt-4 block w-full rounded-xl border-2 ${styles.borderInk} bg-white` : 'border-0'
preview ? `mt-4 block w-full rounded-xl border-2 ${borderInk} bg-white` : 'border-0'
}
style={preview ? { height: 240 } : { width: 0, height: 0 }}
/>
@@ -1,5 +1,24 @@
import { ShadowButton, shadowButtonClasses } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import {
bgInk,
bgPaper,
bgPaperDeep,
borderInk,
borderInk20,
borderTransparent,
hoverBgPaperDeep,
hoverBorderInk,
lgBgPaper,
lgBorderInk,
lgShadowInkLift,
maxLgBorderInk,
shadowInk,
textBody,
textContent,
textInk,
textT2,
textT3,
} from '@idealjs/stack-ui-kit/components'
import type { CSSProperties, ReactNode } from 'react'
import { Fragment } from 'react'
@@ -28,8 +47,8 @@ export interface NavRowGroup {
items: NavItemLink[]
}
const SELECTED = `${styles.bgPaperDeep} ${styles.textInk}`
const IDLE = `${styles.textBody} ${styles.hoverBgPaperDeep}`
const SELECTED = `${bgPaperDeep} ${textInk}`
const IDLE = `${textBody} ${hoverBgPaperDeep}`
const LIGHT_PRESS =
'transition-[transform,background-color,border-color] duration-150 active:translate-y-[1px]'
@@ -47,10 +66,8 @@ function RowLabel({
className?: string
style?: CSSProperties
}) {
const cls = `w-full rounded-lg border-2 px-2 py-0.5 text-left ${styles.textT3} font-extrabold leading-tight ${LIGHT_PRESS} ${
on
? `${styles.borderInk}`
: `${styles.borderTransparent} ${styles.textInk} ${styles.hoverBorderInk}`
const cls = `w-full rounded-lg border-2 px-2 py-0.5 text-left ${textT3} font-extrabold leading-tight ${LIGHT_PRESS} ${
on ? `${borderInk}` : `${borderTransparent} ${textInk} ${hoverBorderInk}`
} ${className ?? ''}`
if (!href)
return (
@@ -96,7 +113,7 @@ export function SiteNavbar({
})
return (
<header
className={`relative max-lg:z-50 lg:z-30 mb-8 rounded-2xl border-2 ${styles.borderInk} ${styles.bgPaper} p-2.5 ${styles.shadowInk}`}
className={`relative max-lg:z-50 lg:z-30 mb-8 rounded-2xl border-2 ${borderInk} ${bgPaper} p-2.5 ${shadowInk}`}
>
<input
id="site-nav-expand"
@@ -118,14 +135,14 @@ export function SiteNavbar({
href={brand.href}
size="none"
nested
className={`px-2.5 py-0.5 font-mono ${styles.textT2} font-extrabold ${styles.hoverBgPaperDeep}`}
className={`px-2.5 py-0.5 font-mono ${textT2} font-extrabold ${hoverBgPaperDeep}`}
>
{brand.label}
</ShadowButton>
</span>
{activeLabel && (
<span
className={`hidden rounded-lg ${styles.bgPaperDeep} px-2.5 py-0.5 ${styles.textT3} font-extrabold ${styles.textInk} lg:inline-block`}
className={`hidden rounded-lg ${bgPaperDeep} px-2.5 py-0.5 ${textT3} font-extrabold ${textInk} lg:inline-block`}
>
{activeLabel}
</span>
@@ -137,7 +154,7 @@ export function SiteNavbar({
aria-label="展开导航网格"
aria-expanded="false"
aria-controls="site-nav-drawer"
className={`nav-expand-open hidden lg:col-start-1 lg:row-start-1 lg:grid lg:size-10 lg:place-items-center ${shadowButtonClasses({ size: 'none', nested: true, className: `${styles.hoverBgPaperDeep}` })}`}
className={`nav-expand-open hidden lg:col-start-1 lg:row-start-1 lg:grid lg:size-10 lg:place-items-center ${shadowButtonClasses({ size: 'none', nested: true, className: `${hoverBgPaperDeep}` })}`}
>
<span aria-hidden="true" className="text-lg font-extrabold leading-none">
▼
@@ -149,7 +166,7 @@ export function SiteNavbar({
aria-label="收起导航网格"
aria-expanded="true"
aria-controls="site-nav-drawer"
className={`nav-expand-close hidden lg:col-start-1 lg:row-start-1 lg:invisible lg:grid lg:size-10 lg:place-items-center ${shadowButtonClasses({ size: 'none', nested: true, className: `${styles.hoverBgPaperDeep}` })}`}
className={`nav-expand-close hidden lg:col-start-1 lg:row-start-1 lg:invisible lg:grid lg:size-10 lg:place-items-center ${shadowButtonClasses({ size: 'none', nested: true, className: `${hoverBgPaperDeep}` })}`}
>
<span aria-hidden="true" className="text-lg font-extrabold leading-none">
▲
@@ -163,12 +180,12 @@ export function SiteNavbar({
aria-label="打开导航菜单"
aria-expanded="false"
aria-controls="site-nav-drawer"
className={`nav-drawer-open hidden max-lg:col-start-1 max-lg:row-start-1 max-lg:grid max-lg:size-10 max-lg:place-items-center ${shadowButtonClasses({ size: 'none', nested: true, className: `${styles.hoverBgPaperDeep}` })}`}
className={`nav-drawer-open hidden max-lg:col-start-1 max-lg:row-start-1 max-lg:grid max-lg:size-10 max-lg:place-items-center ${shadowButtonClasses({ size: 'none', nested: true, className: `${hoverBgPaperDeep}` })}`}
>
<span aria-hidden="true" className="flex flex-col gap-[5px]">
<i className={`block h-[3px] w-5 rounded-sm ${styles.bgInk}`} />
<i className={`block h-[3px] w-5 rounded-sm ${styles.bgInk}`} />
<i className={`block h-[3px] w-5 rounded-sm ${styles.bgInk}`} />
<i className={`block h-[3px] w-5 rounded-sm ${bgInk}`} />
<i className={`block h-[3px] w-5 rounded-sm ${bgInk}`} />
<i className={`block h-[3px] w-5 rounded-sm ${bgInk}`} />
</span>
</label>
{/* biome-ignore lint/a11y/useAriaPropsSupportedByRole: 纯 CSS checkbox 开合的触发 label,aria 状态为增强语义保留 */}
@@ -177,7 +194,7 @@ export function SiteNavbar({
aria-label="收起导航菜单"
aria-expanded="true"
aria-controls="site-nav-drawer"
className={`nav-drawer-close hidden max-lg:col-start-1 max-lg:row-start-1 max-lg:invisible max-lg:grid max-lg:size-10 max-lg:place-items-center ${shadowButtonClasses({ size: 'none', nested: true, className: `${styles.hoverBgPaperDeep}` })}`}
className={`nav-drawer-close hidden max-lg:col-start-1 max-lg:row-start-1 max-lg:invisible max-lg:grid max-lg:size-10 max-lg:place-items-center ${shadowButtonClasses({ size: 'none', nested: true, className: `${hoverBgPaperDeep}` })}`}
>
<span aria-hidden="true" className="text-lg font-extrabold leading-none">
×
@@ -188,7 +205,7 @@ export function SiteNavbar({
<div
id="site-nav-drawer"
className={`max-lg:fixed max-lg:inset-y-0 max-lg:left-0 max-lg:z-50 max-lg:w-72 max-lg:overflow-y-auto max-lg:rounded-none max-lg:border-r-2 ${styles.maxLgBorderInk} max-lg:bg-paper max-lg:px-4 max-lg:py-5 max-lg:shadow-[8px_0_0_0_var(--color-ink)] max-lg:invisible max-lg:opacity-0 max-lg:-translate-x-full max-lg:transition-[transform,visibility,opacity] max-lg:duration-300 max-lg:ease-[cubic-bezier(0.32,0.72,0,1)] max-lg:motion-reduce:transition-none max-lg:peer-checked/nav-drawer:visible max-lg:peer-checked/nav-drawer:translate-x-0 max-lg:peer-checked/nav-drawer:opacity-100 lg:pointer-events-none lg:absolute lg:inset-x-0 lg:top-full lg:z-40 lg:mt-2 lg:rounded-2xl lg:border-2 ${styles.lgBorderInk} ${styles.lgBgPaper} lg:p-3 ${styles.lgShadowInkLift} lg:invisible lg:opacity-0 lg:-translate-y-1 lg:transition-[transform,visibility,opacity] lg:duration-300 lg:ease-[cubic-bezier(0.32,0.72,0,1)] lg:motion-reduce:transition-none lg:peer-checked/nav-expand:pointer-events-auto lg:peer-checked/nav-expand:visible lg:peer-checked/nav-expand:opacity-100 lg:peer-checked/nav-expand:translate-y-0`}
className={`max-lg:fixed max-lg:inset-y-0 max-lg:left-0 max-lg:z-50 max-lg:w-72 max-lg:overflow-y-auto max-lg:rounded-none max-lg:border-r-2 ${maxLgBorderInk} max-lg:bg-paper max-lg:px-4 max-lg:py-5 max-lg:shadow-[8px_0_0_0_var(--color-ink)] max-lg:invisible max-lg:opacity-0 max-lg:-translate-x-full max-lg:transition-[transform,visibility,opacity] max-lg:duration-300 max-lg:ease-[cubic-bezier(0.32,0.72,0,1)] max-lg:motion-reduce:transition-none max-lg:peer-checked/nav-drawer:visible max-lg:peer-checked/nav-drawer:translate-x-0 max-lg:peer-checked/nav-drawer:opacity-100 lg:pointer-events-none lg:absolute lg:inset-x-0 lg:top-full lg:z-40 lg:mt-2 lg:rounded-2xl lg:border-2 ${lgBorderInk} ${lgBgPaper} lg:p-3 ${lgShadowInkLift} lg:invisible lg:opacity-0 lg:-translate-y-1 lg:transition-[transform,visibility,opacity] lg:duration-300 lg:ease-[cubic-bezier(0.32,0.72,0,1)] lg:motion-reduce:transition-none lg:peer-checked/nav-expand:pointer-events-auto lg:peer-checked/nav-expand:visible lg:peer-checked/nav-expand:opacity-100 lg:peer-checked/nav-expand:translate-y-0`}
>
<div className="lg:hidden max-lg:mb-5">
<ShadowButton
@@ -196,7 +213,7 @@ export function SiteNavbar({
href={brand.href}
size="sm"
nested
className={`font-mono ${styles.hoverBgPaperDeep}`}
className={`font-mono ${hoverBgPaperDeep}`}
>
{brand.label}
</ShadowButton>
@@ -206,7 +223,7 @@ export function SiteNavbar({
<Fragment key={row.sectionKey}>
<div
aria-hidden="true"
className={`col-span-full border-t border-dashed ${styles.borderInk20} lg:[grid-column:1/-1] lg:[grid-row:var(--divider)]`}
className={`col-span-full border-t border-dashed ${borderInk20} lg:[grid-column:1/-1] lg:[grid-row:var(--divider)]`}
style={{ '--divider': divider } as CSSProperties}
/>
<RowLabel
@@ -227,8 +244,8 @@ export function SiteNavbar({
<a
key={item.key}
href={item.href}
className={`rounded-lg px-2.5 py-0.5 text-left ${styles.textContent} font-bold leading-snug no-underline ${LIGHT_PRESS} ${
on ? (item.color ? `${styles.textInk}` : SELECTED) : IDLE
className={`rounded-lg px-2.5 py-0.5 text-left ${textContent} font-bold leading-snug no-underline ${LIGHT_PRESS} ${
on ? (item.color ? `${textInk}` : SELECTED) : IDLE
} ${item.mono ? 'font-mono' : ''}`}
style={on && item.color ? { background: item.color } : undefined}
>
@@ -1,5 +1,11 @@
import { ShadowButton, shadowButtonClasses } from '@idealjs/stack-ui-kit/react'
import * as styles from '@idealjs/stack-ui-kit/components'
import {
bgPaperDeep,
hoverBgPaperDeep,
hoverHost,
textBody,
textInk,
} from '@idealjs/stack-ui-kit/components'
import type { NavRowGroup, NavSectionLink } from './SiteNavbar'
import {
brandRow,
@@ -21,8 +27,8 @@ import {
triggerWrap,
} from './siteSidebar.css'
const SELECTED = `${styles.bgPaperDeep} ${styles.textInk} ${rowSelectedInset}`
const IDLE = `${styles.textBody} ${styles.hoverBgPaperDeep}`
const SELECTED = `${bgPaperDeep} ${textInk} ${rowSelectedInset}`
const IDLE = `${textBody} ${hoverBgPaperDeep}`
export function SiteSidebar({
brand,
@@ -44,7 +50,7 @@ export function SiteSidebar({
className={toggleInput}
/>
<span className={`${styles.hoverHost} ${triggerWrap}`}>
<span className={`${hoverHost} ${triggerWrap}`}>
{/* biome-ignore lint/a11y/useAriaPropsSupportedByRole: 纯 CSS checkbox 开合的触发 label,aria 状态为增强语义保留 */}
<label
htmlFor="site-sidebar-toggle"
@@ -68,7 +74,7 @@ export function SiteSidebar({
href={brand.href}
size="sm"
nested
className={`${itemMono} ${styles.hoverBgPaperDeep}`}
className={`${itemMono} ${hoverBgPaperDeep}`}
>
{brand.label}
</ShadowButton>
@@ -79,7 +85,7 @@ export function SiteSidebar({
aria-label="收起侧栏导航"
aria-expanded="true"
aria-controls="site-sidebar-drawer"
className={`${closeButton} ${shadowButtonClasses({ size: 'none', nested: true, className: `${styles.hoverBgPaperDeep}` })}`}
className={`${closeButton} ${shadowButtonClasses({ size: 'none', nested: true, className: `${hoverBgPaperDeep}` })}`}
>
<span aria-hidden="true">×</span>
</label>
@@ -91,12 +97,12 @@ export function SiteSidebar({
{row.href ? (
<a
href={row.href}
className={`${rowLink} ${rowOn(row) ? SELECTED : `${styles.textInk} ${styles.hoverBgPaperDeep}`}`}
className={`${rowLink} ${rowOn(row) ? SELECTED : `${textInk} ${hoverBgPaperDeep}`}`}
>
{row.label}
</a>
) : (
<span className={`${rowLabel} ${rowOn(row) ? SELECTED : styles.textInk}`}>
<span className={`${rowLabel} ${rowOn(row) ? SELECTED : textInk}`}>
{row.label}
</span>
)}
@@ -108,7 +114,7 @@ export function SiteSidebar({
key={item.key}
href={item.href}
className={`${itemLink} ${
on ? (item.color ? styles.textInk : SELECTED) : IDLE
on ? (item.color ? textInk : SELECTED) : IDLE
} ${item.mono ? itemMono : ''}`}
style={on && item.color ? { background: item.color } : undefined}
>