Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions packages/extension-usage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"typings": "lib/index.d.ts",
"files": [
"lib",
"dist"
"dist",
"resources"
],
"exports": {
".": {
Expand Down Expand Up @@ -54,12 +55,19 @@
"devDependencies": {
"@koishijs/client": "^5.30.11",
"atsc": "^2.1.0",
"koishi": "^4.18.9"
"koishi": "^4.18.9",
"koishi-plugin-puppeteer": "^3.9.0"
},
"peerDependencies": {
"@koishijs/plugin-console": "^5.30.11",
"koishi": "^4.18.9",
"koishi-plugin-chatluna": "^1.4.0-alpha.20"
"koishi-plugin-chatluna": "^1.4.0-alpha.20",
"koishi-plugin-puppeteer": "^3.9.0"
},
"peerDependenciesMeta": {
"koishi-plugin-puppeteer": {
"optional": true
}
},
"koishi": {
"description": {
Expand All @@ -72,7 +80,8 @@
"database"
],
"optional": [
"console"
"console",
"puppeteer"
]
}
}
Expand Down
114 changes: 114 additions & 0 deletions packages/extension-usage/resources/token-trend/template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>${title}</title>
<style>
:root {
color-scheme: light;
--card: #ffffff;
--text: #0f172a;
--muted: #64748b;
--faint: #94a3b8;
--brand: #6366f1;
--brand-2: #8b5cf6;
--border: #eef0f6;
}
* { box-sizing: border-box; }
body { margin: 0; }
.stage {
display: inline-flex;
flex-direction: column;
gap: 24px;
padding: 56px;
background:
radial-gradient(1100px 560px at 10% -10%, #e7e9ff 0%, transparent 55%),
radial-gradient(900px 480px at 110% 0%, #f5e9ff 0%, transparent 50%),
linear-gradient(180deg, #eef1ff, #f7f8fc);
font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
-webkit-font-smoothing: antialiased;
}
.stage.theme-dark {
color-scheme: dark;
--card: #111827;
--text: #e5e7eb;
--muted: #94a3b8;
--faint: #64748b;
--border: #253044;
background:
radial-gradient(1100px 560px at 10% -10%, rgba(79, 70, 229, 0.28) 0%, transparent 55%),
radial-gradient(900px 480px at 110% 0%, rgba(14, 165, 233, 0.18) 0%, transparent 50%),
linear-gradient(180deg, #0b1020, #111827);
}
.token-trend-card {
position: relative;
width: 1040px;
padding: 38px 40px 28px;
background: var(--card);
border: 1px solid var(--border);
border-radius: 24px;
box-shadow:
0 24px 60px -20px rgba(49, 46, 129, 0.30),
0 8px 24px -12px rgba(15, 23, 42, 0.12);
overflow: hidden;
color: var(--text);
}
.token-trend-card::before {
content: "";
position: absolute;
inset: 0 0 auto;
height: 5px;
background: linear-gradient(90deg, var(--brand), var(--brand-2));
}
.stage.theme-dark .token-trend-card { box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.65), 0 8px 24px -12px rgba(0, 0, 0, 0.55); }
.head { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: linear-gradient(140deg, var(--brand), var(--brand-2)); box-shadow: 0 10px 22px -8px rgba(99, 102, 241, 0.65); }
h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
.range { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.chart-wrap { padding: 18px 16px 12px; border: 1px solid var(--border); border-radius: 18px; background: radial-gradient(620px 220px at 82% -10%, rgba(139, 92, 246, 0.07), transparent 60%), linear-gradient(180deg, #ffffff, #fbfcff); }
.stage.theme-dark .chart-wrap { background: radial-gradient(620px 220px at 82% -10%, rgba(14, 165, 233, 0.10), transparent 60%), linear-gradient(180deg, #111827, #0f172a); }
.trend-chart { display: block; width: 100%; height: auto; }
.grid line { stroke: #eef1f6; stroke-width: 1; }
.stage.theme-dark .grid line { stroke: #253044; }
.grid text { fill: var(--faint); font-size: 12px; text-anchor: end; font-variant-numeric: tabular-nums; }
.axis-x { fill: var(--faint); font-size: 12px; text-anchor: middle; }
.line { fill: none; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.line-total { stroke: url(#totalGrad); }
.line-input { stroke: #0ea5e9; }
.line-output { stroke: #f59e0b; }
.dot-total, .dot-input, .dot-output { fill: var(--card); stroke-width: 3; }
.dot-total { stroke: #6366f1; }
.dot-input { stroke: #0ea5e9; }
.dot-output { stroke: #f59e0b; }
.dot-last.dot-total { fill: #6366f1; stroke: #fff; }
.dot-last.dot-input { fill: #0ea5e9; stroke: #fff; }
.dot-last.dot-output { fill: #f59e0b; stroke: #fff; }
.chart-legend { display: flex; justify-content: center; gap: 22px; margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; font-variant-numeric: tabular-nums; }
.legend-item i { width: 26px; height: 3px; border-radius: 999px; background: var(--legend-color); box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.03); }
.empty-chart { display: grid; height: 360px; place-items: center; color: var(--faint); font-size: 16px; }
.plugin-list { display: flex; flex-direction: column; gap: 18px; }
.plugin-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: baseline; }
.plugin-name { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 600; color: var(--text); }
.plugin-name i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.plugin-meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.plugin-meta b { color: var(--text); font-weight: 700; font-size: 15px; }
.plugin-track { grid-column: 1 / -1; height: 10px; border-radius: 6px; background: #f1f3f9; overflow: hidden; }
.stage.theme-dark .plugin-track { background: #1f2937; }
.plugin-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
</style>
</head>
<body>
<div class="stage ${themeClass}">
<main class="token-trend-card">
<header class="head">
<div class="mark"><svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M4 16l4.5-5 3.5 3.5L20 7" stroke="white" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/><path d="M4 20h15" stroke="white" stroke-width="2.2" stroke-linecap="round" opacity="0.55"/></svg></div>
<div><h1>${title}</h1><p class="range">${range}</p></div>
</header>
<section class="chart-wrap">${chart}</section>
</main>
${pluginCard}
</div>
</body>
</html>
Loading
Loading