源码快照 @ 2026-09-02 (source-only, 剔除非源码素材)

This commit is contained in:
agent-radar
2026-09-02 01:05:41 +08:00
commit 04bac1f6e2
2200 changed files with 489415 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OpenWork UI Demo</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
+24
View File
@@ -0,0 +1,24 @@
{
"name": "@openwork/ui-demo",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite --host 0.0.0.0 --port 3333 --strictPort",
"build": "vite build",
"preview": "vite preview --host 0.0.0.0 --port 3333 --strictPort",
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
"@openwork/ui": "workspace:*",
"react": "catalog:",
"react-dom": "catalog:"
},
"devDependencies": {
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"@vitejs/plugin-react": "^5.0.4",
"typescript": "^5.9.3",
"vite": "^7.1.12"
}
}
+215
View File
@@ -0,0 +1,215 @@
import {
PaperGrainGradient,
PaperMeshGradient,
getSeededPaperGrainGradientConfig,
getSeededPaperMeshGradientConfig,
} from "@openwork/ui/react"
import { useMemo, useState } from "react"
const sampleIds = [
"om_01kmhbscaze02vp04ykqa4tcsb",
"om_01kmhbscazf4cjf1bssx6v9q9",
"ow_01kmj2wc68r1zk4n8v7j6v1n2k",
]
export function App() {
const [seed, setSeed] = useState(sampleIds[0])
const normalizedSeed = seed.trim() || sampleIds[0]
const parsedSeed = parseTypeId(normalizedSeed)
const meshConfig = useMemo(() => getSeededPaperMeshGradientConfig(normalizedSeed), [normalizedSeed])
const grainConfig = useMemo(() => getSeededPaperGrainGradientConfig(normalizedSeed), [normalizedSeed])
return (
<main className="app-shell">
<div className="ambient ambient-a" />
<div className="ambient ambient-b" />
<section className="hero-card panel">
<div className="hero-copy">
<span className="eyebrow">OpenWork UI demo</span>
<h1>Seeded Paper gradients on their own dev surface</h1>
<p>
Type a TypeID-like string, inspect the deterministic values derived from it, and preview
the gradients that `@openwork/ui/react` will render anywhere else in the repo.
</p>
</div>
<div className="rule-card">
<span className="eyebrow muted">Deterministic</span>
<strong>Same seed, same result.</strong>
<p>Useful for stable identity-driven art direction across apps.</p>
</div>
</section>
<section className="controls-grid">
<div className="panel input-panel">
<label className="eyebrow muted" htmlFor="seed-id">
Seed id
</label>
<input
id="seed-id"
className="seed-input"
type="text"
value={seed}
onChange={(event) => setSeed(event.target.value)}
spellCheck={false}
/>
<div className="sample-list">
{sampleIds.map((sampleId) => (
<button
key={sampleId}
type="button"
className={sampleId === normalizedSeed ? "sample-chip active" : "sample-chip"}
onClick={() => setSeed(sampleId)}
>
{sampleId}
</button>
))}
</div>
</div>
<div className="panel seed-meta-grid">
<SeedMeta label="prefix" value={parsedSeed.prefix ?? "-"} />
<SeedMeta label="suffix" value={parsedSeed.suffix ?? "-"} />
<SeedMeta label="suffix first 5" value={parsedSeed.suffixAnchor ?? "-"} />
<SeedMeta label="suffix tail" value={parsedSeed.suffixTail ?? "-"} />
</div>
</section>
<section className="preview-grid">
<GradientCard
title="Mesh gradient"
subtitle="Shared mesh defaults plus seeded color and motion variation"
colors={meshConfig.colors}
config={meshConfig}
surface={<PaperMeshGradient seed={normalizedSeed} className="gradient-fill" />}
/>
<GradientCard
title="Grain gradient"
subtitle="Shared grain defaults plus seeded background, shape, and values"
colors={[grainConfig.colorBack, ...grainConfig.colors]}
config={grainConfig}
surface={<PaperGrainGradient seed={normalizedSeed} className="gradient-fill" />}
/>
</section>
<section className="footer-grid">
<div className="panel">
<span className="eyebrow muted">Determinism check</span>
<div className="mini-grid">
<MiniPreview title="Mesh A">
<PaperMeshGradient seed={normalizedSeed} className="gradient-fill" />
</MiniPreview>
<MiniPreview title="Mesh B">
<PaperMeshGradient seed={normalizedSeed} className="gradient-fill" />
</MiniPreview>
</div>
<p className="support-copy">
These two cards use the same seed and should always match.
</p>
</div>
<div className="panel code-panel">
<span className="eyebrow muted">Import paths</span>
<div className="pill-stack">
<code className="import-pill">@openwork/ui/react</code>
</div>
<pre>{`import { PaperMeshGradient, PaperGrainGradient } from "@openwork/ui/react"
<PaperMeshGradient seed="${normalizedSeed}" />
<PaperGrainGradient seed="${normalizedSeed}" />`}</pre>
</div>
</section>
</main>
)
}
function GradientCard({
title,
subtitle,
colors,
config,
surface,
}: {
title: string
subtitle: string
colors: string[]
config: Record<string, unknown>
surface: React.ReactNode
}) {
return (
<article className="panel preview-card">
<div className="gradient-surface">
{surface}
<div className="surface-overlay" />
<div className="surface-copy">
<span className="eyebrow on-dark">@openwork/ui/react</span>
<h2>{title}</h2>
<p>{subtitle}</p>
</div>
</div>
<div className="details-stack">
<div>
<span className="eyebrow muted">Colors</span>
<div className="swatch-list">
{colors.map((color) => (
<div key={color} className="swatch-pill">
<span className="swatch-dot" style={{ backgroundColor: color }} />
<code>{color}</code>
</div>
))}
</div>
</div>
<div>
<span className="eyebrow muted">Calculated values</span>
<pre>{JSON.stringify(config, null, 2)}</pre>
</div>
</div>
</article>
)
}
function MiniPreview({ title, children }: { title: string; children: React.ReactNode }) {
return (
<div>
<span className="eyebrow muted">{title}</span>
<div className="mini-surface">{children}</div>
</div>
)
}
function SeedMeta({ label, value }: { label: string; value: string }) {
return (
<div className="seed-meta-card">
<span className="eyebrow muted">{label}</span>
<code>{value}</code>
</div>
)
}
function parseTypeId(value: string) {
const separatorIndex = value.indexOf("_")
if (separatorIndex === -1) {
return {
prefix: null,
suffix: value,
suffixAnchor: value.slice(0, 5) || null,
suffixTail: value.slice(5) || null,
}
}
const prefix = value.slice(0, separatorIndex) || null
const suffix = value.slice(separatorIndex + 1) || null
return {
prefix,
suffix,
suffixAnchor: suffix?.slice(0, 5) || null,
suffixTail: suffix?.slice(5) || null,
}
}
+10
View File
@@ -0,0 +1,10 @@
import React from "react"
import ReactDOM from "react-dom/client"
import { App } from "./app"
import "./styles.css"
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
+343
View File
@@ -0,0 +1,343 @@
:root {
color-scheme: light;
font-family: "IBM Plex Sans", "Inter", system-ui, sans-serif;
background:
radial-gradient(circle at top left, rgba(57, 181, 74, 0.16), transparent 28%),
radial-gradient(circle at top right, rgba(39, 98, 255, 0.14), transparent 30%),
linear-gradient(180deg, #f6f1e8 0%, #efe7d7 100%);
color: #1f2c2b;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
min-width: 320px;
}
button,
input,
textarea,
select {
font: inherit;
}
code,
pre,
.sample-chip,
.seed-input {
font-family: "IBM Plex Mono", "SFMono-Regular", ui-monospace, monospace;
}
.app-shell {
position: relative;
min-height: 100vh;
padding: 32px;
overflow: hidden;
}
.ambient {
position: fixed;
pointer-events: none;
border-radius: 999px;
filter: blur(70px);
opacity: 0.45;
}
.ambient-a {
top: -120px;
left: -80px;
width: 320px;
height: 320px;
background: rgba(76, 175, 80, 0.22);
}
.ambient-b {
right: -80px;
bottom: 80px;
width: 280px;
height: 280px;
background: rgba(59, 130, 246, 0.2);
}
.panel {
position: relative;
border: 1px solid rgba(24, 30, 28, 0.08);
background: rgba(255, 251, 245, 0.82);
backdrop-filter: blur(18px);
border-radius: 28px;
box-shadow: 0 24px 80px -48px rgba(29, 24, 17, 0.45);
}
.hero-card {
display: grid;
gap: 24px;
grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.8fr);
padding: 32px;
}
.hero-copy h1 {
margin: 10px 0 0;
font-size: clamp(2.4rem, 6vw, 4.5rem);
line-height: 0.92;
letter-spacing: -0.08em;
}
.hero-copy p,
.rule-card p,
.support-copy,
.surface-copy p {
margin: 0;
color: #516160;
line-height: 1.7;
}
.hero-copy p {
margin-top: 18px;
max-width: 62ch;
}
.rule-card {
align-self: end;
padding: 20px;
border-radius: 24px;
background: #16201f;
color: #f0f7f3;
}
.rule-card p {
margin-top: 8px;
color: rgba(240, 247, 243, 0.74);
}
.eyebrow {
display: inline-block;
font-size: 0.72rem;
font-weight: 700;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.muted {
color: #6d7a79;
}
.on-dark {
color: rgba(255, 255, 255, 0.68);
}
.controls-grid,
.footer-grid {
display: grid;
gap: 24px;
grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
margin-top: 24px;
}
.input-panel,
.seed-meta-grid,
.code-panel {
padding: 24px;
}
.seed-input {
width: 100%;
margin-top: 10px;
padding: 15px 16px;
border-radius: 20px;
border: 1px solid rgba(22, 32, 31, 0.12);
background: rgba(255, 255, 255, 0.92);
color: #182321;
font-size: 0.92rem;
outline: none;
transition: border-color 120ms ease, box-shadow 120ms ease;
}
.seed-input:focus {
border-color: #287d75;
box-shadow: 0 0 0 5px rgba(40, 125, 117, 0.12);
}
.sample-list {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-top: 16px;
}
.sample-chip {
border: 1px solid rgba(22, 32, 31, 0.1);
background: rgba(255, 255, 255, 0.75);
color: #425251;
border-radius: 999px;
padding: 9px 14px;
cursor: pointer;
}
.sample-chip.active {
background: #1f6978;
color: white;
border-color: #1f6978;
}
.seed-meta-grid {
display: grid;
gap: 12px;
grid-template-columns: repeat(2, minmax(0, 1fr));
background: #16201f;
}
.seed-meta-card {
padding: 18px;
border-radius: 20px;
border: 1px solid rgba(255, 255, 255, 0.08);
background: rgba(255, 255, 255, 0.04);
}
.seed-meta-card code {
display: block;
margin-top: 8px;
color: #f4fbf7;
word-break: break-all;
line-height: 1.6;
}
.preview-grid {
display: grid;
gap: 24px;
grid-template-columns: repeat(2, minmax(0, 1fr));
margin-top: 24px;
}
.preview-card {
overflow: hidden;
}
.gradient-surface {
position: relative;
min-height: 340px;
background: #101818;
}
.gradient-fill {
position: absolute;
inset: 0;
}
.surface-overlay {
position: absolute;
inset: 0;
background: linear-gradient(180deg, rgba(10, 18, 18, 0.08), rgba(10, 18, 18, 0.34));
}
.surface-copy {
position: absolute;
inset-inline: 0;
bottom: 0;
padding: 24px;
color: white;
}
.surface-copy h2 {
margin: 10px 0 0;
font-size: 2rem;
letter-spacing: -0.05em;
}
.surface-copy p {
margin-top: 10px;
color: rgba(255, 255, 255, 0.78);
}
.details-stack {
display: grid;
gap: 20px;
padding: 24px;
}
.swatch-list,
.pill-stack {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-top: 14px;
}
.swatch-pill,
.import-pill {
display: inline-flex;
align-items: center;
gap: 10px;
border-radius: 999px;
border: 1px solid rgba(22, 32, 31, 0.08);
background: rgba(248, 243, 235, 0.9);
padding: 10px 14px;
}
.swatch-dot {
width: 14px;
height: 14px;
border-radius: 999px;
border: 1px solid rgba(0, 0, 0, 0.12);
}
pre {
overflow-x: auto;
margin: 14px 0 0;
border-radius: 22px;
background: #16201f;
color: #dcebe4;
padding: 18px;
font-size: 0.8rem;
line-height: 1.7;
}
.mini-grid {
display: grid;
gap: 16px;
grid-template-columns: repeat(2, minmax(0, 1fr));
margin-top: 16px;
}
.mini-surface {
position: relative;
min-height: 180px;
margin-top: 8px;
overflow: hidden;
border-radius: 22px;
background: #111918;
}
.support-copy {
margin-top: 16px;
}
@media (max-width: 980px) {
.hero-card,
.controls-grid,
.preview-grid,
.footer-grid {
grid-template-columns: 1fr;
}
}
@media (max-width: 640px) {
.app-shell {
padding: 18px;
}
.hero-card,
.input-panel,
.seed-meta-grid,
.code-panel,
.details-stack {
padding: 18px;
}
.seed-meta-grid,
.mini-grid {
grid-template-columns: 1fr;
}
}
+17
View File
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "ES2022",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"jsx": "react-jsx",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"types": ["vite/client"]
},
"include": ["src", "vite.config.ts"]
}
+19
View File
@@ -0,0 +1,19 @@
import { defineConfig } from "vite"
import react from "@vitejs/plugin-react"
export default defineConfig({
plugins: [react()],
server: {
host: "0.0.0.0",
port: 3333,
strictPort: true,
},
preview: {
host: "0.0.0.0",
port: 3333,
strictPort: true,
},
build: {
target: "es2022",
},
})