Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

fix(taste): 雷达半径改用平方根刻度,热力图两张卡按内容高度排

longmeidao027fc23e5cca
diff --git a/frontend/src/react/charts/chart-tip.tsx b/frontend/src/react/charts/chart-tip.tsx
index 8ebe8e16c..5970f962e 100644
--- a/frontend/src/react/charts/chart-tip.tsx
+++ b/frontend/src/react/charts/chart-tip.tsx
@@ -31,10 +31,10 @@ export function TipRow({ swatch, name, value }: { swatch: ReactNode; name: React
export const TIP_SWATCH = 'size-2.5 shrink-0 rounded-xs';
type TipProps = Partial<Pick<TooltipContentProps<number, string>, 'active' | 'payload' | 'label'>> & {
- nameKey?: string; hideLabel?: boolean;
+ nameKey?: string; valueKey?: string; hideLabel?: boolean;
};
-function TipContent({ active, payload, label, nameKey, hideLabel }: TipProps) {
+function TipContent({ active, payload, label, nameKey, valueKey, hideLabel }: TipProps) {
const { config } = useChart();
const items = (payload ?? []).filter((item) => item.type !== 'none');
/* 上游同款:没有内容时留一块空的占位,浮层下一次出现才不会从图的左上角滑过来。 */
@@ -44,11 +44,13 @@ function TipContent({ active, payload, label, nameKey, hideLabel }: TipProps) {
<div className={TIP_SURFACE}>
{title ? <div className="font-medium text-foreground">{title}</div> : null}
{items.map((item, index) => {
- const named = nameKey && item.payload ? (item.payload as Record<string, unknown>)[nameKey] : undefined;
+ const row = (item.payload ?? {}) as Record<string, unknown>;
+ const named = nameKey ? row[nameKey] : undefined;
const key = `${named ?? item.name ?? item.dataKey ?? 'value'}`;
const entry = getPayloadConfigFromPayload(config, item, key);
+ const value = valueKey ? row[valueKey] : item.value;
return (
- <TipRow key={key + index} name={entry?.label ?? item.name} value={Number(item.value ?? 0)}
+ <TipRow key={key + index} name={entry?.label ?? item.name} value={Number(value ?? 0)}
swatch={(
// oxlint-disable-next-line shadcn/no-inline-styles -- 色点取 ChartStyle 按系列键生成的 CSS 变量,变量名随键变
<i className={TIP_SWATCH} style={{ background: `var(--color-${key}-0)` }} />
@@ -59,7 +61,13 @@ function TipContent({ active, payload, label, nameKey, hideLabel }: TipProps) {
);
}
-/** 接进 EvilCharts 图里的浮层。`nameKey` 是径向图那种一段一个名字的数据列。 */
-export function ChartTip({ nameKey, hideLabel }: { nameKey?: string; hideLabel?: boolean }) {
- return <ChartTooltip cursor={false} content={<TipContent nameKey={nameKey} hideLabel={hideLabel} />} />;
+/** 接进 EvilCharts 图里的浮层。`nameKey` 是径向图那种一段一个名字的数据列;`valueKey` 是
+ * 画图的列经过刻度换算时,浮层该读的原始数那一列(雷达图)。 */
+export function ChartTip(
+ { nameKey, valueKey, hideLabel }: { nameKey?: string; valueKey?: string; hideLabel?: boolean },
+) {
+ return (
+ <ChartTooltip cursor={false}
+ content={<TipContent nameKey={nameKey} valueKey={valueKey} hideLabel={hideLabel} />} />
+ );
}
diff --git a/frontend/src/react/charts/heat-card.tsx b/frontend/src/react/charts/heat-card.tsx
index 0f90ccdd3..a73c4f98e 100644
--- a/frontend/src/react/charts/heat-card.tsx
+++ b/frontend/src/react/charts/heat-card.tsx
@@ -137,8 +137,10 @@ export function ActivityHeat(
</section>
) : null;
}
+ /* 两张卡按各自内容的高度排:星期 × 小时有 24 列,格子比每日那张小一半,同行拉成等高
+ 会在它下面空出半张卡。 */
return (
- <div className="inline-grid w-full gap-5 lg:grid-cols-2">
+ <div className="inline-grid w-full items-start gap-5 lg:grid-cols-2">
<HeatCard title={title} words={words} tone={tone}
cells={hours.cells} total={hours.total} columns={24} rows={7} axis={HOUR_AXIS}
footer={<><span>星期 × 小时</span><span>{activity?.timezone || 'UTC+08:00'}</span></>} />
diff --git a/frontend/src/react/evilcharts/ORIGIN.md b/frontend/src/react/evilcharts/ORIGIN.md
index fa6fe186c..05516a188 100644
--- a/frontend/src/react/evilcharts/ORIGIN.md
+++ b/frontend/src/react/evilcharts/ORIGIN.md
@@ -45,6 +45,6 @@
| --- | --- | --- |
| `../charts/bar-card.tsx` 的 `BarCard` | `EvilBarChart` | 单系列,`ChartConfig` 只有 `value` 一个键;数值轴隐藏、留两成余量,数经 `barProps.label` 标在柱端;容器加 `flex-none`,否则在卡片的 flex 列里被压成 0 高。统计页的时长、画质、文件类型与播放次数 |
| `../stats/radial-card.tsx` 的 `RadialCard` | `EvilRadialChart` | 键写成 `s0`…`sN`,名字放进 `label`:键会进 CSS 变量名与渐变 id,来源名、库名不能直接当键。圈的形状与点击走 `radialBarProps`,按 React 状态淡化其余段、点下钉住;图例格子由 Peach 自己画 |
-| `../taste/charts.tsx` 的 `TasteRadar` | `EvilRadarChart` | 取分数最高的三到六个口味维度,单系列 `value`;少于三个画不成面,整块不出现。`chartProps.outerRadius` 压到 58%,顶点外侧的维度名在窄栏里放得下 |
+| `../taste/charts.tsx` 的 `TasteRadar` | `EvilRadarChart` | 取分数最高的三到六个口味维度,少于三个画不成面,整块不出现。画的是 `radius = √(次数 / 最大次数)` 一列,半径轴定死 `[0, 1]`,最大的维度落在外圈;浮层经 `ChartTip` 的 `valueKey` 读原始次数。`chartProps.outerRadius` 压到 58%,顶点外侧的维度名在窄栏里放得下 |
| `../taste/charts.tsx` 的 `RankedBars` | `EvilBarChart`(`layout="horizontal"`) | 前八个口味维度,柱端标数的写法同 `BarCard`;高度按条数取档 |
-| `../charts/chart-tip.tsx` 的 `ChartTip` | `ChartTooltip`、`useChart`、`getPayloadConfigFromPayload` | 见上表「浮层内容」 |
+| `../charts/chart-tip.tsx` 的 `ChartTip` | `ChartTooltip`、`useChart`、`getPayloadConfigFromPayload` | 见上表「浮层内容」;画图的列经过刻度换算时,`valueKey` 指定浮层读原始数的那一列 |
diff --git a/frontend/src/react/taste/charts.tsx b/frontend/src/react/taste/charts.tsx
index 3ca0c5e2f..2c3cc9f44 100644
--- a/frontend/src/react/taste/charts.tsx
+++ b/frontend/src/react/taste/charts.tsx
@@ -2,7 +2,7 @@
* 统计页共用 `../charts/heat-card.tsx`。
*
* 雷达与排行条由 EvilCharts 画,悬停浮层是 `../charts/chart-tip.tsx`,差异登记在
- * `../evilcharts/ORIGIN.md`。流向图保留 `d3-sankey` 自绘(ADR-0076):几何全写成属性,流的粗细
+ * `../evilcharts/ORIGIN.md`。雷达的半径是平方根刻度,浮层仍读原始次数。流向图保留 `d3-sankey` 自绘(ADR-0076):几何全写成属性,流的粗细
* 是 `stroke-width`,颜色只取 BoardUI 的 `chart-*` 档;指向一条流或一个节点时读数换成它的,
* 换的是 React 状态,指针离开或焦点移走就回到总数。差异登记在 `../boardui/ORIGIN.md`。 */
import { useState } from 'react';
@@ -34,19 +34,32 @@ const DIMENSION_CONFIG = { value: { label: '标签命中', colors: tone(CHART_CO
/** 排行条的高度按条数给:条数少时不把每一条撑得很粗。类名写成整串,Tailwind 扫得到。 */
const RANK_HEIGHT = ['h-24', 'h-24', 'h-24', 'h-32', 'h-40', 'h-48', 'h-52', 'h-60', 'h-64'];
+/** 雷达图画的是 `radius` 列,名字与颜色跟口味维度的另外两张图一致。 */
+const RADAR_CONFIG = { radius: DIMENSION_CONFIG.value };
+
+/** 雷达图的半径刻度,也是这张图唯一一处换算:`√(次数 / 最大次数)`,最大的维度落在外圈(1)。
+ * 头一个维度常是其余的十倍以上,线性半径会把面压成一根尖刺,读不出次要维度的形状;开方后
+ * 它们才撑得开。原始次数留在 `value` 列,浮层读它,数值本身由旁边的排行条给。 */
+const radarRadius = (value: number, top: number) => Math.sqrt(value / top);
+
/** 主要口味维度的雷达图,画的是 EvilCharts 的 `EvilRadarChart`。三个维度以下画不成面,那时整块不出现。 */
export function TasteRadar({ rows, label }: { rows: RankRow[]; label: string }) {
- const data = radarRows(rows);
- if (!data.length) return null;
+ const points = radarRows(rows);
+ if (!points.length) return null;
+ const top = points[0]!.value;
+ const data = points.map((row) => ({ ...row, radius: radarRadius(row.value, top) }));
return (
<div role="img" aria-label={`${label}:${data.map((row) => row.name).join(',')}`}>
{/* 半径压到六成:维度名排在顶点外侧,七八个字的名字在窄栏里要放得下,不被图框切掉。 */}
- <EvilRadarChart data={data} config={DIMENSION_CONFIG} chartProps={{ outerRadius: '58%' }}
+ <EvilRadarChart data={data} config={RADAR_CONFIG} chartProps={{ outerRadius: '58%' }}
className="aspect-auto h-70 text-text-secondary">
<EvilRadarChart.PolarGrid />
<EvilRadarChart.PolarAngleAxis dataKey="name" />
- <EvilRadarChart.Radar dataKey="value" />
- <ChartTip />
+ {/* 半径轴定死在 0 到 1:外圈就是最大的维度,不让 Recharts 往上取整留出空圈。网格圈跟着
+ 这根轴的刻度走,Recharts 默认只取整数刻度,要放开小数才有四等分的圈。 */}
+ <EvilRadarChart.PolarRadiusAxis domain={[0, 1]} allowDecimals tick={false} />
+ <EvilRadarChart.Radar dataKey="radius" />
+ <ChartTip valueKey="value" />
</EvilRadarChart>
</div>
);
diff --git a/frontend/test/react/taste.test.tsx b/frontend/test/react/taste.test.tsx
index b6e264964..6ea8aa934 100644
--- a/frontend/test/react/taste.test.tsx
+++ b/frontend/test/react/taste.test.tsx
@@ -3,7 +3,8 @@
*
* 外观(雷达图的网格、热力格的浓度档)是设计决定,由 `frontend/e2e/design.test.ts` 读
* `getComputedStyle` 断言;这里只看结构、文字与请求。Recharts 在这里量不到容器尺寸,
- * 雷达与排行条的图形画不出来,从外层的名字与纯函数上验。 */
+ * 整页挂上去时雷达与排行条的图形画不出来,从外层的名字与纯函数上验;雷达的刻度用例单挂
+ * 这张图,拿掉 `ResizeObserver` 让它按初始尺寸画。 */
import { act } from 'react';
import { notifyManager, QueryClientProvider } from '@tanstack/react-query';
import { afterEach, expect, it, vi } from 'vitest';
@@ -16,9 +17,10 @@ import {
DEFAULT_WINDOW, prefetchTaste, radarRows, RANK_MAX, TASTE_IMPORT_URL, TASTE_REFRESH_URL,
TASTE_SOURCE_URL, TASTE_URL, topScores, type TasteData, type TasteJob,
} from '../../src/react/taste/taste';
+import { TasteRadar } from '../../src/react/taste/charts';
import { TastePage } from '../../src/react/taste/taste-page';
-import { buttonNamed, choose, click, mountRoot, settle } from './render';
+import { buttonNamed, choose, click, mount, mountRoot, settle } from './render';
// 客户端是模块级的单例(所有 React 根共用一个),用例之间不清就互相喂数据。
afterEach(() => queryClient.clear());
@@ -164,6 +166,40 @@ it('口味维度取分数最高的几个:雷达三到六个,排行条最多
expect(radarRows([{ name: '甲', score: 3 }, { name: '乙', score: 1 }, { name: '丙' }])).toEqual([]);
});
+it('雷达半径按平方根刻度:最大的维度落在外圈,浮层读的仍是原始次数', async () => {
+ // Recharts 靠 ResizeObserver 量容器,拿掉它就按 EvilCharts 给的初始尺寸 320 × 200 画;
+ // 声明减少动态效果,Recharts 不播生长动画,多边形直接是终态。
+ vi.stubGlobal('ResizeObserver', undefined);
+ vi.stubGlobal('matchMedia', (query: string) => ({
+ matches: query.includes('reduce'), media: query, addEventListener() {}, removeEventListener() {},
+ }));
+ const counts = [657, 68, 56, 4, 1];
+ const host = await mount(
+ <TasteRadar rows={counts.map((score, index) => ({ name: `维度${index}`, score }))} label="主要口味维度" />);
+ const points = (path: Element | null | undefined) =>
+ [...(path?.getAttribute('d') ?? '').matchAll(/(-?[\d.]+),\s*(-?[\d.]+)/g)]
+ .map(([, x, y]) => ({ x: Number(x), y: Number(y) }));
+ const rings = [...host.querySelectorAll('.recharts-polar-grid-concentric-polygon')].map(points);
+ // 半径 0 那一圈退化成圆心;网格四等分,最外一圈就是半径轴的 1。
+ expect(rings).toHaveLength(5);
+ const center = rings[0]![0]!;
+ const reach = (point: { x: number; y: number }) => Math.hypot(point.x - center.x, point.y - center.y);
+ const outer = reach(rings.at(-1)![0]!);
+ const radar = points(host.querySelector('.recharts-radar-polygon path')).slice(0, counts.length);
+ expect(radar.map((point) => reach(point) / outer))
+ .toEqual(counts.map((count) => expect.closeTo(Math.sqrt(count / 657), 3)));
+
+ // 指到正上方那个顶点(最大的维度),浮层给的是 657 次,不是画图用的半径 1。
+ await act(async () => {
+ host.querySelector('.recharts-wrapper')!.dispatchEvent(new MouseEvent('mousemove',
+ { bubbles: true, clientX: center.x, clientY: center.y - outer / 2 }));
+ await new Promise((resolve) => setTimeout(resolve, 50));
+ });
+ const tip = host.querySelector('.recharts-tooltip-wrapper')!;
+ expect(tip.textContent).toContain('维度0');
+ expect([...tip.querySelectorAll('span')].map((span) => span.textContent)).toEqual(['标签命中', '657']);
+});
+
it('浏览器画像的雷达、排行与浏览活跃热力图都按这一份数画', async () => {
const { host } = await open();
const portrait = host.querySelector('section[aria-label="浏览器画像"]')!;
diff --git a/web/dist/peach-react.js b/web/dist/peach-react.js
index c695b442f..6fe82d08d 100644
--- a/web/dist/peach-react.js
+++ b/web/dist/peach-react.js
@@ -59613,34 +59613,35 @@ function R7({ swatch: e, name: t, value: n }) {
});
}
var z7 = "size-2.5 shrink-0 rounded-xs";
-function Cbe({ active: e, payload: t, label: n, nameKey: r, hideLabel: i }) {
- let { config: a } = p7(), o = (t ?? []).filter((e) => e.type !== "none");
- if (!e || !o.length) return /* @__PURE__ */ (0, D.jsx)("span", { className: "p-4" });
- let s = i || typeof n != "string" ? null : a[n]?.label ?? n;
+function Cbe({ active: e, payload: t, label: n, nameKey: r, valueKey: i, hideLabel: a }) {
+ let { config: o } = p7(), s = (t ?? []).filter((e) => e.type !== "none");
+ if (!e || !s.length) return /* @__PURE__ */ (0, D.jsx)("span", { className: "p-4" });
+ let c = a || typeof n != "string" ? null : o[n]?.label ?? n;
return /* @__PURE__ */ (0, D.jsxs)("div", {
className: L7,
- children: [s ? /* @__PURE__ */ (0, D.jsx)("div", {
+ children: [c ? /* @__PURE__ */ (0, D.jsx)("div", {
className: "font-medium text-foreground",
- children: s
- }) : null, o.map((e, t) => {
- let n = `${(r && e.payload ? e.payload[r] : void 0) ?? e.name ?? e.dataKey ?? "value"}`, i = _7(a, e, n);
+ children: c
+ }) : null, s.map((e, t) => {
+ let n = e.payload ?? {}, a = `${(r ? n[r] : void 0) ?? e.name ?? e.dataKey ?? "value"}`, s = _7(o, e, a), c = i ? n[i] : e.value;
return /* @__PURE__ */ (0, D.jsx)(R7, {
- name: i?.label ?? e.name,
- value: Number(e.value ?? 0),
+ name: s?.label ?? e.name,
+ value: Number(c ?? 0),
swatch: /* @__PURE__ */ (0, D.jsx)("i", {
className: z7,
- style: { background: `var(--color-${n}-0)` }
+ style: { background: `var(--color-${a}-0)` }
})
- }, n + t);
+ }, a + t);
})]
});
}
-function B7({ nameKey: e, hideLabel: t }) {
+function B7({ nameKey: e, valueKey: t, hideLabel: n }) {
return /* @__PURE__ */ (0, D.jsx)(b7, {
cursor: !1,
content: /* @__PURE__ */ (0, D.jsx)(Cbe, {
nameKey: e,
- hideLabel: t
+ valueKey: t,
+ hideLabel: n
})
});
}
@@ -59872,7 +59873,7 @@ var Obe = /* @__PURE__ */ (0, D.jsxs)(D.Fragment, { children: [W7.map((e, t) =>
function X7({ activity: e, title: t, dailyTitle: n, words: r, tone: i, empty: a }) {
let o = wbe(e), s = Tbe(e);
return s.cells.length ? /* @__PURE__ */ (0, D.jsxs)("div", {
- className: "inline-grid w-full gap-5 lg:grid-cols-2",
+ className: "inline-grid w-full items-start gap-5 lg:grid-cols-2",
children: [/* @__PURE__ */ (0, D.jsx)(Y7, {
title: t,
words: r,
@@ -61698,27 +61699,37 @@ var rSe = [
"h-52",
"h-60",
"h-64"
-];
-function oSe({ rows: e, label: t }) {
+], oSe = { radius: U9.value }, sSe = (e, t) => Math.sqrt(e / t);
+function cSe({ rows: e, label: t }) {
let n = Lxe(e);
- return n.length ? /* @__PURE__ */ (0, D.jsx)("div", {
+ if (!n.length) return null;
+ let r = n[0].value, i = n.map((e) => ({
+ ...e,
+ radius: sSe(e.value, r)
+ }));
+ return /* @__PURE__ */ (0, D.jsx)("div", {
role: "img",
- "aria-label": `${t}:${n.map((e) => e.name).join(",")}`,
+ "aria-label": `${t}:${i.map((e) => e.name).join(",")}`,
children: /* @__PURE__ */ (0, D.jsxs)(z9, {
- data: n,
- config: U9,
+ data: i,
+ config: oSe,
chartProps: { outerRadius: "58%" },
className: "aspect-auto h-70 text-text-secondary",
children: [
/* @__PURE__ */ (0, D.jsx)(z9.PolarGrid, {}),
/* @__PURE__ */ (0, D.jsx)(z9.PolarAngleAxis, { dataKey: "name" }),
- /* @__PURE__ */ (0, D.jsx)(z9.Radar, { dataKey: "value" }),
- /* @__PURE__ */ (0, D.jsx)(B7, {})
+ /* @__PURE__ */ (0, D.jsx)(z9.PolarRadiusAxis, {
+ domain: [0, 1],
+ allowDecimals: !0,
+ tick: !1
+ }),
+ /* @__PURE__ */ (0, D.jsx)(z9.Radar, { dataKey: "radius" }),
+ /* @__PURE__ */ (0, D.jsx)(B7, { valueKey: "value" })
]
})
- }) : null;
+ });
}
-function sSe({ rows: e, label: t }) {
+function lSe({ rows: e, label: t }) {
let n = O9(e, 8);
return n.length ? /* @__PURE__ */ (0, D.jsx)("section", {
"aria-label": t,
@@ -61750,7 +61761,7 @@ function sSe({ rows: e, label: t }) {
})
}) : null;
}
-function cSe({ flows: e }) {
+function uSe({ flows: e }) {
let [t, n] = (0, E.useState)(null), r = Rxe(e);
if (!r) return null;
let i = t?.node ?? null, a = (e, n) => t ? i === null ? t.label === n : e.source === i || e.target === i : !0;
@@ -61838,7 +61849,7 @@ function cSe({ flows: e }) {
}
//#endregion
//#region src/react/taste/taste-page.tsx
-var lSe = 10, W9 = cw(Zk, Qk, "text-body-2-medium"), G9 = `${_w()} flex flex-col gap-4`, K9 = "rounded-xl bg-background-primary-default p-3", uSe = "读取运行 Peach 的这台电脑上的浏览记录", dSe = "导入或读取浏览记录后,这里会列出已采集设备。", fSe = "馆藏里暂时没有对得上浏览信号的标签。", pSe = "采集浏览记录后,这里会显示聚合后的口味证据。", mSe = "这些词在浏览记录中出现,但 Peach 观看记录还没有对应证据", hSe = "在运行 Peach 的电脑上使用浏览器:点上面的「读取浏览器历史」。", gSe = "记录在其他设备上:导出文件后,点上面的「导入历史文件」。多台设备的文件分别导入。", _Se = "需要刷新时再次读取或导入;数据源可在页面底部移除。", vSe = "这个数据源将不再用于口味分析。原始导出文件保留。", q9 = "peach-taste-guide-dismissed";
+var dSe = 10, W9 = cw(Zk, Qk, "text-body-2-medium"), G9 = `${_w()} flex flex-col gap-4`, K9 = "rounded-xl bg-background-primary-default p-3", fSe = "读取运行 Peach 的这台电脑上的浏览记录", pSe = "导入或读取浏览记录后,这里会列出已采集设备。", mSe = "馆藏里暂时没有对得上浏览信号的标签。", hSe = "采集浏览记录后,这里会显示聚合后的口味证据。", gSe = "这些词在浏览记录中出现,但 Peach 观看记录还没有对应证据", _Se = "在运行 Peach 的电脑上使用浏览器:点上面的「读取浏览器历史」。", vSe = "记录在其他设备上:导出文件后,点上面的「导入历史文件」。多台设备的文件分别导入。", ySe = "需要刷新时再次读取或导入;数据源可在页面底部移除。", bSe = "这个数据源将不再用于口味分析。原始导出文件保留。", q9 = "peach-taste-guide-dismissed";
function J9({ icon: e, term: t, figure: n, detail: r, accent: i }) {
return /* @__PURE__ */ (0, D.jsx)("div", {
className: Wk(),
@@ -61865,13 +61876,13 @@ function Y9({ name: e, domain: t }) {
})]
});
}
-function ySe({ html: e }) {
+function xSe({ html: e }) {
return /* @__PURE__ */ (0, D.jsx)("span", {
className: "relative inline-grid size-8 shrink-0 place-items-center overflow-hidden rounded-full bg-background-tertiary-default text-caption-1-medium text-text-secondary [&_img]:absolute [&_img]:inset-0 [&_img]:size-full [&_img]:object-cover",
dangerouslySetInnerHTML: { __html: e }
});
}
-function bSe({ rows: e, kind: t, visual: n, empty: r, onSignal: i, avatarInner: a }) {
+function SSe({ rows: e, kind: t, visual: n, empty: r, onSignal: i, avatarInner: a }) {
if (!e.length) return /* @__PURE__ */ (0, D.jsx)(vw, {
shell: "plain",
icon: AS,
@@ -61880,7 +61891,7 @@ function bSe({ rows: e, kind: t, visual: n, empty: r, onSignal: i, avatarInner:
});
let o = Ixe(e);
return /* @__PURE__ */ (0, D.jsx)(Z7, {
- previewCount: lSe,
+ previewCount: dSe,
className: "inline-grid w-full gap-x-7 gap-y-2 sm:grid-cols-2",
children: e.map((e, r) => {
let s = !!t && !!e.peach_items, c = String(e.source_domain || ""), l = /* @__PURE__ */ (0, D.jsxs)(D.Fragment, { children: [
@@ -61907,7 +61918,7 @@ function bSe({ rows: e, kind: t, visual: n, empty: r, onSignal: i, avatarInner:
name: e.name,
domain: c
}) : null,
- n !== "none" && n !== "domain" && (e.entity_id || e.has_avatar || !c) ? /* @__PURE__ */ (0, D.jsx)(ySe, { html: a(e.name, e.entity_id ? {
+ n !== "none" && n !== "domain" && (e.entity_id || e.has_avatar || !c) ? /* @__PURE__ */ (0, D.jsx)(xSe, { html: a(e.name, e.entity_id ? {
id: e.entity_id,
has_image: !!e.has_image,
avatar_focus: e.avatar_focus
@@ -61959,7 +61970,7 @@ function X9({ label: e, panels: t, onSignal: n, avatarInner: r }) {
}), t.map((e) => /* @__PURE__ */ (0, D.jsx)(CO, {
id: e.id,
className: "px-4 pt-3.5 pb-4",
- children: /* @__PURE__ */ (0, D.jsx)(bSe, {
+ children: /* @__PURE__ */ (0, D.jsx)(SSe, {
...e.props,
onSignal: n,
avatarInner: r
@@ -61967,7 +61978,7 @@ function X9({ label: e, panels: t, onSignal: n, avatarInner: r }) {
}, e.id))]
});
}
-function xSe({ data: e, onSignal: t, navigate: n }) {
+function CSe({ data: e, onSignal: t, navigate: n }) {
let r = e.analysis;
if (!r?.headline) return null;
let i = r.confidence || {}, a = [...(r.explore || []).map((e) => ({
@@ -62042,12 +62053,12 @@ function xSe({ data: e, onSignal: t, navigate: n }) {
shell: "plain",
icon: AS,
title: "还没有可探索的入口",
- children: fSe
+ children: mSe
})
]
});
}
-function SSe({ onboarding: e, done: t }) {
+function wSe({ onboarding: e, done: t }) {
let [n, r] = (0, E.useState)(() => {
try {
return localStorage.getItem(q9) === "1";
@@ -62066,11 +62077,11 @@ function SSe({ onboarding: e, done: t }) {
children: [
/* @__PURE__ */ (0, D.jsx)("p", {
className: "text-body-2-regular text-text-secondary",
- children: hSe
+ children: _Se
}),
/* @__PURE__ */ (0, D.jsx)("p", {
className: "text-body-2-regular text-text-secondary",
- children: gSe
+ children: vSe
}),
/* @__PURE__ */ (0, D.jsxs)("ul", {
className: "flex list-disc flex-col gap-1 pl-5 text-body-2-regular text-text-secondary",
@@ -62100,7 +62111,7 @@ function SSe({ onboarding: e, done: t }) {
}),
/* @__PURE__ */ (0, D.jsx)("p", {
className: "text-body-2-regular text-text-secondary",
- children: _Se
+ children: ySe
}),
/* @__PURE__ */ (0, D.jsx)("span", {
className: "self-start",
@@ -62120,7 +62131,7 @@ function SSe({ onboarding: e, done: t }) {
})
});
}
-function CSe({ busy: e, onRefresh: t, onImport: n }) {
+function TSe({ busy: e, onRefresh: t, onImport: n }) {
let r = (0, E.useRef)(null), [i, a] = (0, E.useState)(!1), o = (e) => {
a(!1), e();
};
@@ -62130,7 +62141,7 @@ function CSe({ busy: e, onRefresh: t, onImport: n }) {
"data-variant": "primary",
children: [/* @__PURE__ */ (0, D.jsx)(G, {
leadingIcon: bS,
- title: uSe,
+ title: fSe,
onClick: t,
...J(e),
children: "读取浏览器历史"
@@ -62173,7 +62184,7 @@ function CSe({ busy: e, onRefresh: t, onImport: n }) {
})
})] });
}
-function wSe({ sources: e, window: t, toast: n }) {
+function ESe({ sources: e, window: t, toast: n }) {
let r = pt({
mutationFn: (e) => Axe(e, t),
onSuccess: (e) => {
@@ -62227,7 +62238,7 @@ function wSe({ sources: e, window: t, toast: n }) {
onClick: () => {
r.isPending || c({
title: "移除口味数据源",
- body: vSe,
+ body: bSe,
confirmLabel: "移除口味数据源",
onConfirm: () => r.mutateAsync(e.source_key)
});
@@ -62239,12 +62250,12 @@ function wSe({ sources: e, window: t, toast: n }) {
shell: "plain",
icon: xS,
title: "还没有数据源",
- children: dSe
+ children: pSe
})
]
});
}
-function TSe(e) {
+function DSe(e) {
let { onSignal: t, navigate: r, toast: i, avatarInner: a, onboarding: o } = e, [s, c] = (0, E.useState)("all"), [l, u] = (0, E.useState)("browser"), d = (0, E.useRef)(null), f = ft({
queryKey: T9(s),
queryFn: ({ signal: e }) => E9(s, e),
@@ -62308,7 +62319,7 @@ function TSe(e) {
children: t
}, e))
}),
- /* @__PURE__ */ (0, D.jsx)(CSe, {
+ /* @__PURE__ */ (0, D.jsx)(TSe, {
busy: m || g.isPending || _.isPending,
onRefresh: y,
onImport: () => d.current?.click()
@@ -62324,7 +62335,7 @@ function TSe(e) {
]
})]
}),
- /* @__PURE__ */ (0, D.jsx)(SSe, {
+ /* @__PURE__ */ (0, D.jsx)(wSe, {
onboarding: o,
done: !!(x.history_sources || b.updated_at)
}),
@@ -62396,7 +62407,7 @@ function TSe(e) {
className: "text-caption-1-regular text-text-secondary",
children: "浏览器画像"
}),
- /* @__PURE__ */ (0, D.jsx)(oSe, {
+ /* @__PURE__ */ (0, D.jsx)(cSe, {
rows: T,
label: "主要口味维度"
}),
@@ -62407,14 +62418,14 @@ function TSe(e) {
]
}), /* @__PURE__ */ (0, D.jsx)("div", {
className: "min-w-0 grow",
- children: T.length ? /* @__PURE__ */ (0, D.jsx)(sSe, {
+ children: T.length ? /* @__PURE__ */ (0, D.jsx)(lSe, {
rows: T,
label: "口味维度排名"
}) : /* @__PURE__ */ (0, D.jsx)(vw, {
shell: "plain",
icon: AS,
title: "暂无口味维度",
- children: pSe
+ children: hSe
})
})]
}),
@@ -62430,7 +62441,7 @@ function TSe(e) {
tone: 4,
empty: "还没有可用于分析的口味网站访问记录。"
}),
- /* @__PURE__ */ (0, D.jsx)(cSe, { flows: b.creator_flows }),
+ /* @__PURE__ */ (0, D.jsx)(uSe, { flows: b.creator_flows }),
/* @__PURE__ */ (0, D.jsx)(X9, {
label: "浏览器口味维度",
onSignal: t,
@@ -62473,7 +62484,7 @@ function TSe(e) {
rows: O,
kind: "",
visual: "none",
- empty: mSe
+ empty: gSe
}
}
]
@@ -62587,12 +62598,12 @@ function TSe(e) {
})
]
}),
- /* @__PURE__ */ (0, D.jsx)(xSe, {
+ /* @__PURE__ */ (0, D.jsx)(CSe, {
data: b,
onSignal: t,
navigate: r
}),
- /* @__PURE__ */ (0, D.jsx)(wSe, {
+ /* @__PURE__ */ (0, D.jsx)(ESe, {
sources: b.sources || [],
window: s,
toast: i
@@ -62622,7 +62633,7 @@ function Z9({ term: e, value: t, rest: n }) {
//#endregion
//#region src/react/entry.tsx
var Q9 = null;
-function ESe() {
+function OSe() {
return Q9?.isConnected || (Q9 = document.createElement("div"), Q9.className = "peach-react", Q9.dataset.reactOverlays = "", document.body.append(Q9)), Q9;
}
function $9(e) {
@@ -62632,7 +62643,7 @@ function $9(e) {
children: /* @__PURE__ */ (0, D.jsx)(gu, {
reducedMotion: "user",
children: /* @__PURE__ */ (0, D.jsx)(Xv, {
- getContainer: ESe,
+ getContainer: OSe,
children: /* @__PURE__ */ (0, D.jsx)(e, { ...t })
})
})
@@ -62643,7 +62654,7 @@ function $9(e) {
};
};
}
-var DSe = {
+var kSe = {
activity: {
prefetch: (e, t) => Xte(t),
mount: $9(cne)
@@ -62694,8 +62705,8 @@ var DSe = {
},
taste: {
prefetch: (e, t) => Oxe("all", t),
- mount: $9(TSe)
+ mount: $9(DSe)
}
};
//#endregion
-export { DSe as pages };
+export { kSe as pages };