@pencil-agent/nano-mem 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +258 -0
- package/README.md +146 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +90 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +46 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +48 -0
- package/dist/config.js.map +1 -0
- package/dist/consolidation.d.ts +13 -0
- package/dist/consolidation.d.ts.map +1 -0
- package/dist/consolidation.js +111 -0
- package/dist/consolidation.js.map +1 -0
- package/dist/engine.d.ts +67 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +492 -0
- package/dist/engine.js.map +1 -0
- package/dist/eviction.d.ts +16 -0
- package/dist/eviction.d.ts.map +1 -0
- package/dist/eviction.js +22 -0
- package/dist/eviction.js.map +1 -0
- package/dist/extension.d.ts +11 -0
- package/dist/extension.d.ts.map +1 -0
- package/dist/extension.js +264 -0
- package/dist/extension.js.map +1 -0
- package/dist/extraction.d.ts +10 -0
- package/dist/extraction.d.ts.map +1 -0
- package/dist/extraction.js +136 -0
- package/dist/extraction.js.map +1 -0
- package/dist/full-insights-html.d.ts +8 -0
- package/dist/full-insights-html.d.ts.map +1 -0
- package/dist/full-insights-html.js +311 -0
- package/dist/full-insights-html.js.map +1 -0
- package/dist/full-insights.d.ts +21 -0
- package/dist/full-insights.d.ts.map +1 -0
- package/dist/full-insights.js +327 -0
- package/dist/full-insights.js.map +1 -0
- package/dist/i18n.d.ts +50 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +169 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/insights-html.d.ts +8 -0
- package/dist/insights-html.d.ts.map +1 -0
- package/dist/insights-html.js +431 -0
- package/dist/insights-html.js.map +1 -0
- package/dist/linking.d.ts +11 -0
- package/dist/linking.d.ts.map +1 -0
- package/dist/linking.js +40 -0
- package/dist/linking.js.map +1 -0
- package/dist/privacy.d.ts +16 -0
- package/dist/privacy.d.ts.map +1 -0
- package/dist/privacy.js +52 -0
- package/dist/privacy.js.map +1 -0
- package/dist/scoring.d.ts +25 -0
- package/dist/scoring.d.ts.map +1 -0
- package/dist/scoring.js +63 -0
- package/dist/scoring.js.map +1 -0
- package/dist/store.d.ts +16 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +68 -0
- package/dist/store.js.map +1 -0
- package/dist/types.d.ts +191 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist/update.d.ts +14 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +126 -0
- package/dist/update.js.map +1 -0
- package/package.json +60 -0
- package/src/cli.ts +99 -0
- package/src/config.ts +72 -0
- package/src/consolidation.ts +127 -0
- package/src/engine.ts +699 -0
- package/src/eviction.ts +30 -0
- package/src/extension.ts +290 -0
- package/src/extraction.ts +152 -0
- package/src/full-insights-html.ts +342 -0
- package/src/full-insights.ts +396 -0
- package/src/i18n.ts +233 -0
- package/src/index.ts +50 -0
- package/src/insights-html.ts +476 -0
- package/src/linking.ts +43 -0
- package/src/privacy.ts +52 -0
- package/src/scoring.ts +94 -0
- package/src/store.ts +84 -0
- package/src/types.ts +209 -0
- package/src/update.ts +141 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [INPUT]: FullInsightsReport, locale
|
|
3
|
+
* [OUTPUT]: Standalone HTML report with Remix Icon and charts
|
|
4
|
+
* [POS]: Pure renderer for full insights report
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { PROMPTS } from "./i18n.js";
|
|
8
|
+
import type {
|
|
9
|
+
FullInsightsChart,
|
|
10
|
+
FullInsightsFriction,
|
|
11
|
+
FullInsightsReport,
|
|
12
|
+
FullInsightsFeatureToTry,
|
|
13
|
+
FullInsightsUsagePattern,
|
|
14
|
+
PatternInsight,
|
|
15
|
+
} from "./types.js";
|
|
16
|
+
|
|
17
|
+
function escapeHtml(str: string): string {
|
|
18
|
+
return str
|
|
19
|
+
.replace(/&/g, "&")
|
|
20
|
+
.replace(/</g, "<")
|
|
21
|
+
.replace(/>/g, ">")
|
|
22
|
+
.replace(/"/g, """)
|
|
23
|
+
.replace(/'/g, "'");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function formatDate(iso: string, locale: string): string {
|
|
27
|
+
const d = new Date(iso);
|
|
28
|
+
if (Number.isNaN(d.getTime())) return iso;
|
|
29
|
+
return d.toLocaleString(locale === "zh" ? "zh-CN" : "en-US");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const CHART_COLORS: Record<string, string> = {
|
|
33
|
+
tools: "#0891b2",
|
|
34
|
+
languages: "#10b981",
|
|
35
|
+
errors: "#dc2626",
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
function renderBarRows(chart: FullInsightsChart): string {
|
|
39
|
+
if (!chart.rows.length) return "";
|
|
40
|
+
const max = Math.max(...chart.rows.map((r) => r.value), 1);
|
|
41
|
+
const color = CHART_COLORS[chart.id] ?? "#2563eb";
|
|
42
|
+
return chart.rows
|
|
43
|
+
.map(
|
|
44
|
+
(row) =>
|
|
45
|
+
`<div class="bar-row">
|
|
46
|
+
<div class="bar-label" title="${escapeHtml(row.label)}">${escapeHtml(row.label)}</div>
|
|
47
|
+
<div class="bar-track"><div class="bar-fill" style="width:${Math.max(8, Math.round((row.value / max) * 100))}%;background:${color}"></div></div>
|
|
48
|
+
<div class="bar-value">${row.value}</div>
|
|
49
|
+
</div>`,
|
|
50
|
+
)
|
|
51
|
+
.join("");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function renderFullInsightsHtml(report: FullInsightsReport, locale: string): string {
|
|
55
|
+
const p = PROMPTS[locale] ?? PROMPTS.en;
|
|
56
|
+
const lang = locale === "zh" ? "zh-CN" : "en";
|
|
57
|
+
|
|
58
|
+
const sections: string[] = [];
|
|
59
|
+
|
|
60
|
+
// TOC links (only for sections we might render)
|
|
61
|
+
const tocLinks: string[] = [
|
|
62
|
+
'<a href="#section-glance"><i class="ri-dashboard-line"></i> ' + escapeHtml(p.fullInsightsAtAGlance) + "</a>",
|
|
63
|
+
'<a href="#section-work"><i class="ri-briefcase-4-line"></i> ' + escapeHtml(p.fullInsightsWorkOn) + "</a>",
|
|
64
|
+
];
|
|
65
|
+
if (report.charts.length) tocLinks.push('<a href="#section-charts"><i class="ri-bar-chart-box-line"></i> Charts</a>');
|
|
66
|
+
if (report.wins.length) tocLinks.push('<a href="#section-wins"><i class="ri-trophy-line"></i> ' + escapeHtml(p.fullInsightsWins) + "</a>");
|
|
67
|
+
if (report.frictions.length) tocLinks.push('<a href="#section-frictions"><i class="ri-error-warning-line"></i> ' + escapeHtml(p.fullInsightsFrictions) + "</a>");
|
|
68
|
+
if (report.recommendations.length) tocLinks.push('<a href="#section-recommendations"><i class="ri-checkbox-circle-line"></i> ' + escapeHtml(p.fullInsightsRecommendations) + "</a>");
|
|
69
|
+
if (report.featuresToTry.length) tocLinks.push('<a href="#section-features"><i class="ri-magic-line"></i> ' + escapeHtml(p.fullInsightsFeaturesToTry) + "</a>");
|
|
70
|
+
if (report.usagePatterns.length) tocLinks.push('<a href="#section-patterns"><i class="ri-flow-chart"></i> ' + escapeHtml(p.fullInsightsUsagePatterns) + "</a>");
|
|
71
|
+
|
|
72
|
+
// Stats row
|
|
73
|
+
const statItems = [
|
|
74
|
+
{ value: report.stats.totalSessions, label: "Sessions", icon: "ri-chat-3-line" },
|
|
75
|
+
{ value: report.stats.episodes, label: "Episodes", icon: "ri-folder-line" },
|
|
76
|
+
{ value: report.stats.knowledge, label: "Knowledge", icon: "ri-book-open-line" },
|
|
77
|
+
{ value: report.stats.lessons, label: "Lessons", icon: "ri-lightbulb-line" },
|
|
78
|
+
{ value: report.stats.work, label: "Work", icon: "ri-briefcase-line" },
|
|
79
|
+
{ value: report.stats.facets, label: "Patterns/Struggles", icon: "ri-pie-chart-line" },
|
|
80
|
+
];
|
|
81
|
+
const statsHtml = `<section class="stats-row">
|
|
82
|
+
${statItems.map((s) => `<div class="stat"><i class="${s.icon} stat-icon"></i><div class="stat-value">${s.value}</div><div class="stat-label">${escapeHtml(s.label)}</div></div>`).join("\n")}
|
|
83
|
+
</section>`;
|
|
84
|
+
|
|
85
|
+
// At a Glance
|
|
86
|
+
const glanceHtml = `<section id="section-glance" class="at-a-glance">
|
|
87
|
+
<h2 class="glance-title"><i class="ri-dashboard-line"></i> ${escapeHtml(p.fullInsightsAtAGlance)}</h2>
|
|
88
|
+
<div class="glance-grid">
|
|
89
|
+
<article class="glance-card"><h3><i class="ri-checkbox-circle-line"></i> What's working</h3><p>${escapeHtml(report.atAGlance.working)}</p></article>
|
|
90
|
+
<article class="glance-card warn"><h3><i class="ri-error-warning-line"></i> What's hindering</h3><p>${escapeHtml(report.atAGlance.hindering)}</p></article>
|
|
91
|
+
<article class="glance-card"><h3><i class="ri-lightbulb-line"></i> Quick wins</h3><p>${escapeHtml(report.atAGlance.quickWins)}</p></article>
|
|
92
|
+
<article class="glance-card"><h3><i class="ri-rocket-line"></i> Ambitious</h3><p>${escapeHtml(report.atAGlance.ambitious)}</p></article>
|
|
93
|
+
</div>
|
|
94
|
+
</section>`;
|
|
95
|
+
|
|
96
|
+
// What You Work On
|
|
97
|
+
let workHtml = "";
|
|
98
|
+
if (report.projectAreas.length) {
|
|
99
|
+
workHtml = `<section id="section-work" class="section">
|
|
100
|
+
<h2><i class="ri-briefcase-4-line"></i> ${escapeHtml(p.fullInsightsWorkOn)}</h2>
|
|
101
|
+
<div class="project-list">
|
|
102
|
+
${report.projectAreas
|
|
103
|
+
.map(
|
|
104
|
+
(a) => ` <article class="project-area">
|
|
105
|
+
<div class="area-header">
|
|
106
|
+
<span class="area-name">${escapeHtml(a.name)}</span>
|
|
107
|
+
<span class="area-count">~${a.sessionCount} ${escapeHtml(p.fullInsightsSubtitleSessions)}</span>
|
|
108
|
+
</div>
|
|
109
|
+
<p class="area-desc">${escapeHtml(a.description)}</p>
|
|
110
|
+
</article>`,
|
|
111
|
+
)
|
|
112
|
+
.join("\n")}
|
|
113
|
+
</div>
|
|
114
|
+
</section>`;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Charts
|
|
118
|
+
let chartsHtml = "";
|
|
119
|
+
if (report.charts.length) {
|
|
120
|
+
chartsHtml = `<section id="section-charts" class="section">
|
|
121
|
+
<h2><i class="ri-bar-chart-box-line"></i> ${locale === "zh" ? "分布" : "Distribution"}</h2>
|
|
122
|
+
<div class="charts-row">
|
|
123
|
+
${report.charts.map((chart) => ` <div class="chart-card">
|
|
124
|
+
<div class="chart-title">${escapeHtml(chart.title)}</div>
|
|
125
|
+
${renderBarRows(chart)}
|
|
126
|
+
</div>`).join("\n")}
|
|
127
|
+
</div>
|
|
128
|
+
</section>`;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Wins
|
|
132
|
+
let winsHtml = "";
|
|
133
|
+
if (report.wins.length) {
|
|
134
|
+
winsHtml = `<section id="section-wins" class="section">
|
|
135
|
+
<h2><i class="ri-trophy-line"></i> ${escapeHtml(p.fullInsightsWins)}</h2>
|
|
136
|
+
<div class="wins-list">
|
|
137
|
+
${report.wins.map((w) => ` <article class="big-win"><div class="big-win-title">${escapeHtml(w.title)}</div><div class="big-win-desc">${escapeHtml(w.description)}</div></article>`).join("\n")}
|
|
138
|
+
</div>
|
|
139
|
+
</section>`;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Frictions
|
|
143
|
+
let frictionsHtml = "";
|
|
144
|
+
if (report.frictions.length) {
|
|
145
|
+
frictionsHtml = `<section id="section-frictions" class="section">
|
|
146
|
+
<h2><i class="ri-error-warning-line"></i> ${escapeHtml(p.fullInsightsFrictions)}</h2>
|
|
147
|
+
<div class="friction-list">
|
|
148
|
+
${report.frictions
|
|
149
|
+
.map(
|
|
150
|
+
(f) => ` <article class="friction-category">
|
|
151
|
+
<div class="friction-title">${escapeHtml(f.title)}</div>
|
|
152
|
+
<div class="friction-desc">${escapeHtml(f.description)}</div>
|
|
153
|
+
${f.examples?.length ? `<ul class="friction-examples">${f.examples.map((e) => `<li>${escapeHtml(e)}</li>`).join("")}</ul>` : ""}
|
|
154
|
+
</article>`,
|
|
155
|
+
)
|
|
156
|
+
.join("\n")}
|
|
157
|
+
</div>
|
|
158
|
+
</section>`;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Recommendations
|
|
162
|
+
let recHtml = "";
|
|
163
|
+
if (report.recommendations.length) {
|
|
164
|
+
recHtml = `<section id="section-recommendations" class="section">
|
|
165
|
+
<h2><i class="ri-checkbox-circle-line"></i> ${escapeHtml(p.fullInsightsRecommendations)}</h2>
|
|
166
|
+
<ul class="recommend-list">
|
|
167
|
+
${report.recommendations.map((r) => ` <li>${escapeHtml(r)}</li>`).join("\n")}
|
|
168
|
+
</ul>
|
|
169
|
+
</section>`;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Features to Try
|
|
173
|
+
let featuresHtml = "";
|
|
174
|
+
if (report.featuresToTry.length) {
|
|
175
|
+
featuresHtml = `<section id="section-features" class="section">
|
|
176
|
+
<h2><i class="ri-magic-line"></i> ${escapeHtml(p.fullInsightsFeaturesToTry)}</h2>
|
|
177
|
+
<div class="features-section">
|
|
178
|
+
${report.featuresToTry
|
|
179
|
+
.map(
|
|
180
|
+
(f, i) => ` <article class="feature-card">
|
|
181
|
+
<div class="feature-title">${escapeHtml(f.title)}</div>
|
|
182
|
+
<div class="feature-oneliner">${escapeHtml(f.oneLiner)}</div>
|
|
183
|
+
<div class="feature-why">${escapeHtml(f.whyForYou)}</div>
|
|
184
|
+
${f.exampleCode ? `<div class="feature-code"><code data-copy="feature-code-${i}">${escapeHtml(f.exampleCode)}</code><button type="button" class="copy-btn" data-copy-target="feature-code-${i}">${escapeHtml(p.fullInsightsCopy)}</button></div>` : ""}
|
|
185
|
+
</article>`,
|
|
186
|
+
)
|
|
187
|
+
.join("\n")}
|
|
188
|
+
</div>
|
|
189
|
+
</section>`;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Usage Patterns
|
|
193
|
+
let patternsHtml = "";
|
|
194
|
+
if (report.usagePatterns.length) {
|
|
195
|
+
patternsHtml = `<section id="section-patterns" class="section">
|
|
196
|
+
<h2><i class="ri-flow-chart"></i> ${escapeHtml(p.fullInsightsUsagePatterns)}</h2>
|
|
197
|
+
<div class="patterns-section">
|
|
198
|
+
${report.usagePatterns
|
|
199
|
+
.map(
|
|
200
|
+
(u, i) => ` <article class="pattern-card">
|
|
201
|
+
<div class="pattern-title">${escapeHtml(u.title)}</div>
|
|
202
|
+
<div class="pattern-summary">${escapeHtml(u.summary)}</div>
|
|
203
|
+
<div class="pattern-detail">${escapeHtml(u.detail)}</div>
|
|
204
|
+
${u.pastePrompt ? `<div class="copyable-prompt-section"><div class="prompt-label">${escapeHtml(p.fullInsightsCopy)}</div><div class="copyable-prompt-row"><code class="copyable-prompt" data-copy="pattern-prompt-${i}">${escapeHtml(u.pastePrompt)}</code><button type="button" class="copy-btn" data-copy-target="pattern-prompt-${i}">${escapeHtml(p.fullInsightsCopy)}</button></div></div>` : ""}
|
|
205
|
+
</article>`,
|
|
206
|
+
)
|
|
207
|
+
.join("\n")}
|
|
208
|
+
</div>
|
|
209
|
+
</section>`;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Behavioral patterns (raw list if any)
|
|
213
|
+
let rawPatternsHtml = "";
|
|
214
|
+
if (report.patterns.length) {
|
|
215
|
+
rawPatternsHtml = `<section class="section">
|
|
216
|
+
<h2><i class="ri-pie-chart-line"></i> ${escapeHtml(p.insightsSectionPatterns)}</h2>
|
|
217
|
+
<ul class="pattern-list">
|
|
218
|
+
${report.patterns.slice(0, 8).map((pa) => ` <li><strong>${escapeHtml(pa.trigger)}</strong> → ${escapeHtml(pa.behavior)}</li>`).join("\n")}
|
|
219
|
+
</ul>
|
|
220
|
+
</section>`;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const css = `
|
|
224
|
+
*{box-sizing:border-box;margin:0;padding:0}
|
|
225
|
+
body{font-family:'Inter',-apple-system,BlinkMacSystemFont,sans-serif;background:#f8fafc;color:#334155;line-height:1.65;padding:48px 24px}
|
|
226
|
+
.container{max-width:800px;margin:0 auto}
|
|
227
|
+
h1{font-size:32px;font-weight:700;color:#0f172a;margin-bottom:8px}
|
|
228
|
+
h2{font-size:20px;font-weight:600;color:#0f172a;margin-top:32px;margin-bottom:16px}
|
|
229
|
+
h2.glance-title{font-size:16px;margin-top:0;color:#92400e}
|
|
230
|
+
h2 .ri{vertical-align:middle;margin-right:6px}
|
|
231
|
+
.subtitle{color:#64748b;font-size:15px;margin-bottom:24px}
|
|
232
|
+
.nav-toc{display:flex;flex-wrap:wrap;gap:8px;margin:24px 0 32px;padding:16px;background:#fff;border-radius:8px;border:1px solid #e2e8f0}
|
|
233
|
+
.nav-toc a{font-size:12px;color:#64748b;text-decoration:none;padding:6px 12px;border-radius:6px;background:#f1f5f9;transition:all .15s}
|
|
234
|
+
.nav-toc a:hover{background:#e2e8f0;color:#334155}
|
|
235
|
+
.nav-toc .ri{margin-right:4px;vertical-align:middle}
|
|
236
|
+
.stats-row{display:flex;gap:24px;margin-bottom:32px;padding:20px 0;border-top:1px solid #e2e8f0;border-bottom:1px solid #e2e8f0;flex-wrap:wrap}
|
|
237
|
+
.stat{text-align:center}
|
|
238
|
+
.stat-icon{font-size:20px;color:#64748b;display:block;margin-bottom:4px}
|
|
239
|
+
.stat-value{font-size:24px;font-weight:700;color:#0f172a}
|
|
240
|
+
.stat-label{font-size:11px;color:#64748b;text-transform:uppercase}
|
|
241
|
+
.at-a-glance{background:linear-gradient(135deg,#fef3c7 0%,#fde68a 100%);border:1px solid #f59e0b;border-radius:12px;padding:20px 24px;margin-bottom:32px}
|
|
242
|
+
.glance-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px}
|
|
243
|
+
.glance-card{background:rgba(255,255,255,.6);border:1px solid rgba(245,158,11,.3);border-radius:8px;padding:14px}
|
|
244
|
+
.glance-card.warn{background:rgba(254,226,226,.7);border-color:#fca5a5}
|
|
245
|
+
.glance-card h3{font-size:13px;font-weight:600;color:#92400e;margin-bottom:8px}
|
|
246
|
+
.glance-card p{font-size:13px;color:#78350f;line-height:1.5;margin:0}
|
|
247
|
+
.section{background:#fff;border:1px solid #e2e8f0;border-radius:8px;padding:20px;margin-bottom:24px}
|
|
248
|
+
.project-list,.wins-list,.friction-list{display:flex;flex-direction:column;gap:12px}
|
|
249
|
+
.project-area{background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;padding:16px}
|
|
250
|
+
.area-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
|
|
251
|
+
.area-name{font-weight:600;font-size:15px;color:#0f172a}
|
|
252
|
+
.area-count{font-size:12px;color:#64748b;background:#f1f5f9;padding:2px 8px;border-radius:4px}
|
|
253
|
+
.area-desc{font-size:14px;color:#475569;line-height:1.5}
|
|
254
|
+
.charts-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:24px}
|
|
255
|
+
.chart-card{background:#fff;border:1px solid #e2e8f0;border-radius:8px;padding:16px}
|
|
256
|
+
.chart-title{font-size:12px;font-weight:600;color:#64748b;text-transform:uppercase;margin-bottom:12px}
|
|
257
|
+
.bar-row{display:flex;align-items:center;margin-bottom:6px}
|
|
258
|
+
.bar-label{width:100px;font-size:11px;color:#475569;flex-shrink:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
259
|
+
.bar-track{flex:1;height:6px;background:#f1f5f9;border-radius:3px;margin:0 8px}
|
|
260
|
+
.bar-fill{height:100%;border-radius:3px}
|
|
261
|
+
.bar-value{width:28px;font-size:11px;font-weight:500;color:#64748b;text-align:right}
|
|
262
|
+
.big-win{background:#f0fdf4;border:1px solid #bbf7d0;border-radius:8px;padding:16px}
|
|
263
|
+
.big-win-title{font-weight:600;font-size:15px;color:#166534;margin-bottom:8px}
|
|
264
|
+
.big-win-desc{font-size:14px;color:#15803d;line-height:1.5}
|
|
265
|
+
.friction-category{background:#fef2f2;border:1px solid #fca5a5;border-radius:8px;padding:16px}
|
|
266
|
+
.friction-title{font-weight:600;font-size:15px;color:#991b1b;margin-bottom:6px}
|
|
267
|
+
.friction-desc{font-size:13px;color:#7f1d1d;margin-bottom:10px}
|
|
268
|
+
.friction-examples{margin:0 0 0 20px;font-size:13px;color:#334155}
|
|
269
|
+
.recommend-list{margin:0;padding-left:20px}
|
|
270
|
+
.recommend-list li{margin-bottom:8px;font-size:14px;color:#334155}
|
|
271
|
+
.features-section,.patterns-section{display:flex;flex-direction:column;gap:12px}
|
|
272
|
+
.feature-card{background:#f0fdf4;border:1px solid #86efac;border-radius:8px;padding:16px}
|
|
273
|
+
.pattern-card{background:#f0f9ff;border:1px solid #7dd3fc;border-radius:8px;padding:16px}
|
|
274
|
+
.feature-title,.pattern-title{font-weight:600;font-size:15px;color:#0f172a;margin-bottom:6px}
|
|
275
|
+
.feature-oneliner,.pattern-summary{font-size:14px;color:#475569;margin-bottom:8px}
|
|
276
|
+
.feature-why,.pattern-detail{font-size:13px;color:#334155;line-height:1.5}
|
|
277
|
+
.feature-code{background:#f8fafc;padding:12px;border-radius:6px;margin-top:12px;border:1px solid #e2e8f0;display:flex;align-items:flex-start;gap:8px}
|
|
278
|
+
.feature-code code{flex:1;font-family:monospace;font-size:12px;white-space:pre-wrap}
|
|
279
|
+
.copyable-prompt-section{margin-top:12px;padding-top:12px;border-top:1px solid #e2e8f0}
|
|
280
|
+
.copyable-prompt-row{display:flex;align-items:flex-start;gap:8px}
|
|
281
|
+
.copyable-prompt{flex:1;background:#f8fafc;padding:10px 12px;border-radius:4px;font-family:monospace;font-size:12px;color:#334155;border:1px solid #e2e8f0;white-space:pre-wrap;line-height:1.5}
|
|
282
|
+
.prompt-label{font-size:11px;font-weight:600;text-transform:uppercase;color:#64748b;margin-bottom:6px}
|
|
283
|
+
.copy-btn{background:#e2e8f0;border:none;border-radius:4px;padding:4px 8px;font-size:11px;cursor:pointer;color:#475569;flex-shrink:0}
|
|
284
|
+
.copy-btn:hover{background:#cbd5e1}
|
|
285
|
+
.pattern-list{margin:0;padding-left:20px}
|
|
286
|
+
.pattern-list li{margin-bottom:6px;font-size:14px;color:#334155}
|
|
287
|
+
footer{margin-top:32px;text-align:center;font-size:12px;color:#94a3b8}
|
|
288
|
+
@media (max-width:640px){.charts-row{grid-template-columns:1fr}.stats-row{justify-content:center}}
|
|
289
|
+
`;
|
|
290
|
+
|
|
291
|
+
const copyScript = `
|
|
292
|
+
document.querySelectorAll('.copy-btn').forEach(function(btn){
|
|
293
|
+
btn.addEventListener('click', function(){
|
|
294
|
+
var id = this.getAttribute('data-copy-target');
|
|
295
|
+
var el = id ? document.querySelector('[data-copy="' + id + '"]') : null;
|
|
296
|
+
if (el) {
|
|
297
|
+
navigator.clipboard.writeText(el.textContent).then(function(){
|
|
298
|
+
var t = btn.textContent;
|
|
299
|
+
btn.textContent = '${escapeHtml(p.fullInsightsCopied)}';
|
|
300
|
+
setTimeout(function(){ btn.textContent = t; }, 2000);
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
`;
|
|
306
|
+
|
|
307
|
+
return `<!DOCTYPE html>
|
|
308
|
+
<html lang="${lang}">
|
|
309
|
+
<head>
|
|
310
|
+
<meta charset="utf-8" />
|
|
311
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
312
|
+
<title>${escapeHtml(p.fullInsightsTitle)}</title>
|
|
313
|
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />
|
|
314
|
+
<link href="https://cdn.jsdelivr.net/npm/remixicon@4.9.0/fonts/remixicon.css" rel="stylesheet" />
|
|
315
|
+
<style>${css}</style>
|
|
316
|
+
</head>
|
|
317
|
+
<body>
|
|
318
|
+
<div class="container">
|
|
319
|
+
<h1><i class="ri-file-list-3-line"></i> ${escapeHtml(p.fullInsightsTitle)}</h1>
|
|
320
|
+
<p class="subtitle">${report.stats.totalSessions} ${escapeHtml(p.fullInsightsSubtitleSessions)} | ${escapeHtml(p.insightsGeneratedAt)}: ${escapeHtml(formatDate(report.generatedAt, locale))}</p>
|
|
321
|
+
|
|
322
|
+
<nav class="nav-toc">
|
|
323
|
+
${tocLinks.map((link) => " " + link).join("\n")}
|
|
324
|
+
</nav>
|
|
325
|
+
|
|
326
|
+
${statsHtml}
|
|
327
|
+
${glanceHtml}
|
|
328
|
+
${workHtml}
|
|
329
|
+
${chartsHtml}
|
|
330
|
+
${winsHtml}
|
|
331
|
+
${frictionsHtml}
|
|
332
|
+
${recHtml}
|
|
333
|
+
${featuresHtml}
|
|
334
|
+
${patternsHtml}
|
|
335
|
+
${rawPatternsHtml}
|
|
336
|
+
|
|
337
|
+
<footer>${escapeHtml(p.fullInsightsGeneratedBy)} · ${escapeHtml(formatDate(report.generatedAt, locale))}</footer>
|
|
338
|
+
</div>
|
|
339
|
+
<script>${copyScript}</script>
|
|
340
|
+
</body>
|
|
341
|
+
</html>`;
|
|
342
|
+
}
|