Skip to content

World's first open-source enterprise world model.

A square sits a touch inside the circle, and the shape picker stands as tall as the colour well (#445)

WaylandYang54ad9def0812
diff --git a/web/src/pages/EntityHistory.tsx b/web/src/pages/EntityHistory.tsx
index a5f4595c..cf8dde04 100644
--- a/web/src/pages/EntityHistory.tsx
+++ b/web/src/pages/EntityHistory.tsx
@@ -89,7 +89,7 @@ function EventRow({ e }: { e: EntityHistoryEvent }) {
<Icon size={13} className={`mt-1 shrink-0 ${KIND_TONE[e.kind] ?? ""}`} />
<div className="min-w-0 flex-1">
<div className="flex items-baseline gap-2 flex-wrap">
- <span className="text-fine font-medium text-ink-2">
+ <span className="text-small font-medium text-ink-2">
{S.graph.historyKind[e.kind] ?? e.kind}
</span>
{note && <span className="u-num text-fine text-ink-3">{note}</span>}
@@ -97,15 +97,15 @@ function EventRow({ e }: { e: EntityHistoryEvent }) {
{/* 改类事件没有谓词也没有宾语,正文换成类的两端。
起点为空 = 从「未分类」改过来,0009 之后最常见的一种 */}
{e.kind === "retyped" || e.kind === "retype_reverted" ? (
- <div className="mt-1 text-small text-ink-2 truncate">
- <span className="text-ink-3">
+ <div className="mt-1 text-body text-ink-2 truncate">
+ <span className="text-small text-ink-3">
{e.from_type_label ?? S.graph.untyped} →{" "}
</span>
<span className="text-ink">{e.to_type_label}</span>
</div>
) : (
- <div className="mt-1 text-small text-ink-2 truncate">
- <span className="text-ink-3">
+ <div className="mt-1 text-body text-ink-2 truncate">
+ <span className="text-small text-ink-3">
{e.direction === "in" ? "← " : ""}
<span className={e.predicate_label === null ? "italic text-ink-3" : undefined}>
{e.predicate_label ?? S.graph.unknownPredicate}
diff --git a/web/src/pages/Graph.tsx b/web/src/pages/Graph.tsx
index ad0761f7..73d93f6f 100644
--- a/web/src/pages/Graph.tsx
+++ b/web/src/pages/Graph.tsx
@@ -1343,7 +1343,7 @@ export function Graph() {
}
>
<span
- className={`h-2 w-2 ${t.shape === "square" ? "" : "rounded-full"}`}
+ className={`h-2 w-2 ${t.shape === "square" ? "scale-90" : "rounded-full"}`}
style={{ background: t.color }}
/>
<span>{t.label}</span>
@@ -1429,7 +1429,7 @@ export function Graph() {
}
>
<span
- className={`h-2 w-2 shrink-0 ${t.shape === "square" ? "" : "rounded-full"}`}
+ className={`h-2 w-2 shrink-0 ${t.shape === "square" ? "scale-90" : "rounded-full"}`}
style={{
background: t.color,
opacity: hiddenTypes.has(key) ? 0.35 : 1,
@@ -3370,7 +3370,7 @@ function TimeEditor({
onClick={(ev) => ev.stopPropagation()}
>
<div className="flex items-center gap-2">
- <label className="w-11 shrink-0 text-fine text-ink-3">
+ <label className="w-11 shrink-0 text-small font-medium text-ink-2">
{S.graph.timeStart}
</label>
<Input
@@ -3382,7 +3382,7 @@ function TimeEditor({
/>
</div>
<div className="mt-2 flex items-start gap-2">
- <label className="w-11 shrink-0 pt-1 text-fine text-ink-3">
+ <label className="w-11 shrink-0 pt-1 text-small font-medium text-ink-2">
{S.graph.timeEnd}
</label>
<div className="flex-1 space-y-1">
@@ -3414,7 +3414,7 @@ function TimeEditor({
</div>
</div>
<div className="mt-2 flex items-center gap-2">
- <label className="w-11 shrink-0 text-fine text-ink-3">
+ <label className="w-11 shrink-0 text-small font-medium text-ink-2">
{S.graph.timeNote}
</label>
<Input
diff --git a/web/src/pages/Ontology.tsx b/web/src/pages/Ontology.tsx
index 5f164550..2effc303 100644
--- a/web/src/pages/Ontology.tsx
+++ b/web/src/pages/Ontology.tsx
@@ -695,7 +695,7 @@ function PanelHeader({
<div className="flex items-center gap-2">
{color && (
<span
- className={`h-2.5 w-2.5 shrink-0 ${square ? "" : "rounded-full"}`}
+ className={`h-2.5 w-2.5 shrink-0 ${square ? "scale-90" : "rounded-full"}`}
style={{ background: color, boxShadow: `0 0 8px ${color}55` }}
/>
)}
@@ -729,7 +729,7 @@ function InstancesCard({ kbId, type }: { kbId: string; type: EntityTypeView }) {
return (
// 平铺在面板里:面板已经是一块面,里面不再套卡片。标题与行同一个 px-2
<div>
- <GroupLabel className="mb-1 px-2" count={total}>
+ <GroupLabel className="mb-1" count={total}>
{S.ontology.instances}
</GroupLabel>
<div>
@@ -739,10 +739,10 @@ function InstancesCard({ kbId, type }: { kbId: string; type: EntityTypeView }) {
to="/kb/$kbId/graph"
params={{ kbId }}
search={{ entity: e.id }}
- className={rowClass()}
+ className={cn(rowClass(), "-mx-2")}
>
<span
- className={`h-2 w-2 shrink-0 ${type.shape === "square" ? "" : "rounded-full"}`}
+ className={`h-2 w-2 shrink-0 ${type.shape === "square" ? "scale-90" : "rounded-full"}`}
style={{ background: type.color }}
/>
<span className="truncate">{e.name}</span>
@@ -845,6 +845,7 @@ function RelationshipsCard({
// 悬停要有底色:这一行整条可点,只把文字提亮半级在深底上几乎看不出来。
// 底色用左栏那一档(white/[0.05]),右端的类型小字跟着一起提亮
<Row
+ className="-mx-2"
icon={
dir === "out" ? (
<ArrowRight size={12} className="text-violet" />
@@ -868,13 +869,13 @@ function RelationshipsCard({
// 平铺在面板里,与图谱面板的关系分组同一个骨架:带方向箭头的小标题 + 行
<div>
<GroupLabel
- className="mb-1 px-2"
+ className="mb-1"
count={outgoing.length + incoming.length || undefined}
>
{S.ontology.schemaRelationships}
</GroupLabel>
{outgoing.length === 0 && incoming.length === 0 ? (
- <p className="mb-2 px-2 text-small text-ink-3">
+ <p className="mb-2 text-small text-ink-3">
{S.ontology.schemaNoRelationships}
</p>
) : (
@@ -882,7 +883,7 @@ function RelationshipsCard({
{outgoing.length > 0 && (
<>
<GroupLabel
- className="px-2 pb-1 pt-2"
+ className="pb-1 pt-2"
icon={<ArrowRight size={10} />}
count={outgoing.length > 1 ? outgoing.length : undefined}
>
@@ -898,7 +899,7 @@ function RelationshipsCard({
{incoming.length > 0 && (
<>
<GroupLabel
- className="px-2 pb-1 pt-2"
+ className="pb-1 pt-2"
icon={<ArrowLeft size={10} />}
count={incoming.length > 1 ? incoming.length : undefined}
>
@@ -913,7 +914,7 @@ function RelationshipsCard({
)}
</div>
)}
- <div className="border-t border-line px-2 pt-3">
+ <div className="border-t border-line pt-3">
<p className="text-fine text-ink-3 mb-2">
{S.ontology.schemaConnectHint}
</p>
@@ -932,7 +933,7 @@ function RelationshipsCard({
/>
</div>
<div className="flex items-center gap-2 mb-2">
- <span className="text-fine text-ink-3">
+ <span className="text-small font-medium text-ink-2">
{S.ontology.schemaConnectAs}
</span>
<Segmented
@@ -992,10 +993,10 @@ export function AttributesCard({
return (
<div className="border-t border-line pt-3">
- <GroupLabel className="mb-1 px-2" count={attributes.length || undefined}>
+ <GroupLabel className="mb-1" count={attributes.length || undefined}>
{S.ontology.attributes}
</GroupLabel>
- <p className="mb-2 px-2 text-small text-ink-3">
+ <p className="mb-2 text-fine text-ink-3">
{S.ontology.attributesHint}
</p>
<div className="divide-y divide-line">
@@ -1125,7 +1126,7 @@ function AttributeForm({
onError,
});
- const lbl = "block text-small font-medium text-ink-3 mb-1";
+ const lbl = "block text-small font-medium text-ink-2 mb-1";
return (
<div className="py-3 space-y-3">
{!existing && (
@@ -1317,7 +1318,7 @@ function ClassTree({
<span className="flex items-center gap-2">
{/* 方形是直角:与圆形拉开区分度(图谱节点同理) */}
<span
- className={`h-2.5 w-2.5 shrink-0 ${t.shape === "square" ? "" : "rounded-full"}`}
+ className={`h-2.5 w-2.5 shrink-0 ${t.shape === "square" ? "scale-90" : "rounded-full"}`}
style={{ background: t.color }}
/>
{/* 不在列表里放逐项用量读数:数量级上来后统计和渲染都是负担,用量看表单 */}
@@ -1507,13 +1508,13 @@ export function ClassForm({
onError,
});
- const lbl = "block text-small font-medium text-ink-3 mb-1";
+ const lbl = "block text-small font-medium text-ink-2 mb-1";
return (
<div className="space-y-3">
{!headless && (
<div className="flex items-center gap-2">
<span
- className={`h-3 w-3 ${shape === "square" ? "" : "rounded-full"}`}
+ className={`h-3 w-3 ${shape === "square" ? "scale-90" : "rounded-full"}`}
style={{ background: color }}
/>
<span className="font-semibold text-ink">
@@ -1566,12 +1567,16 @@ export function ClassForm({
options={(["circle", "square"] as const).map((sh) => ({
value: sh,
title: sh,
+ // 图标占一行正文的高(h-4 = text-fine 的行高):Segmented 的高度由内容撑,
+ // 光秃秃的 12px 图标会让它比旁边 32 高的色井矮一截
label: (
- <span
- className={`h-3 w-3 border-[1.5px] border-current ${
- sh === "circle" ? "rounded-full" : ""
- }`}
- />
+ <span className="flex h-4 items-center">
+ <span
+ className={`h-3 w-3 border-[1.5px] border-current ${
+ sh === "circle" ? "rounded-full" : "scale-90"
+ }`}
+ />
+ </span>
),
}))}
/>
@@ -1805,7 +1810,7 @@ export function PropertyForm({
onError,
});
- const lbl = "block text-small font-medium text-ink-3 mb-1";
+ const lbl = "block text-small font-medium text-ink-2 mb-1";
return (
<div className="space-y-3">
{!headless && (
@@ -1852,7 +1857,7 @@ export function PropertyForm({
</p>
<div className="grid gap-2 sm:grid-cols-2">
<div className="min-w-0">
- <div className="mb-1 text-fine font-medium text-ink-3">
+ <div className="mb-1 text-small font-medium text-ink-2">
{S.ontology.domainLabel}
</div>
<MultiSearchSelect
@@ -1864,7 +1869,7 @@ export function PropertyForm({
/>
</div>
<div className="min-w-0">
- <div className="mb-1 text-fine font-medium text-ink-3">
+ <div className="mb-1 text-small font-medium text-ink-2">
{S.ontology.rangeLabel}
</div>
<MultiSearchSelect
diff --git a/web/src/pages/squareShellProgram.ts b/web/src/pages/squareShellProgram.ts
index 5b9cb8bb..218edd2f 100644
--- a/web/src/pages/squareShellProgram.ts
+++ b/web/src/pages/squareShellProgram.ts
@@ -2,7 +2,7 @@
// 状态环(0.1) → 钢灰描边(0.07) → 深色壳(0.3) → 微彩核心(fill)。
// 圆形用欧氏距离 length(),方形改用切比雪夫距离 max(|x|,|y|),
// 几何沿用 @sigma/node-square:6 顶点四边形、角点 ±45°/±135°、sqrt8 缩放
-//(等效半边长与圆形半径一致,hover/selected 状态环两种形状表现对齐)。
+//(半边长取圆形半径的 0.9:边长等于直径时方块看着比圆大;状态环随之等比缩)。
import { NodeProgram } from "sigma/rendering";
import type { ProgramInfo } from "sigma/rendering";
@@ -44,7 +44,9 @@ const float sqrt_8 = sqrt(8.0);
const float sqrt_2 = sqrt(2.0);
void main() {
- float size = a_size * u_correctionRatio / u_sizeRatio * sqrt_8;
+ // 方块比圆小一丁点:边长 = 直径时方块看着比圆大(面积 4r² 对 πr²)。取 0.9,
+ // 接近等面积的 0.886,四层环随之一起缩,hover/选中态两种形状仍对齐
+ float size = a_size * u_correctionRatio / u_sizeRatio * sqrt_8 * 0.9;
// 屏幕上保持轴对齐(跟随相机旋转),切比雪夫度量用未旋转的本地坐标
float angle = a_angle + u_cameraAngle;
vec2 diffVector = size * vec2(cos(angle), sin(angle));
@@ -52,7 +54,7 @@ void main() {
gl_Position = vec4((u_matrix * vec3(position, 1)).xy, 0, 1);
v_diffVector = size * vec2(cos(a_angle), sin(a_angle));
- v_radius = size / sqrt_2; // 半边长,与圆形程序的半径等值
+ v_radius = size / sqrt_2; // 半边长 = 0.9 × 圆形程序的半径
#ifdef PICKING_MODE
v_color = a_id;
diff --git a/web/src/ui/field.tsx b/web/src/ui/field.tsx
index a2555e8a..1fac766b 100644
--- a/web/src/ui/field.tsx
+++ b/web/src/ui/field.tsx
@@ -22,7 +22,7 @@ export function Field({
}) {
return (
<div className={cn("mb-4", className)}>
- <label htmlFor={htmlFor} className="mb-1 block text-small text-ink-2">
+ <label htmlFor={htmlFor} className="mb-1 block text-small font-medium text-ink-2">
{label}
</label>
{children}
diff --git a/web/src/ui/index.tsx b/web/src/ui/index.tsx
index 0e19bc8e..a2223b89 100644
--- a/web/src/ui/index.tsx
+++ b/web/src/ui/index.tsx
@@ -737,10 +737,10 @@ export function ColorPicker({
type="button"
title={value}
onClick={() => setOpen(!open)}
- className="h-8 w-14 rounded-lg border border-line-strong hover:border-line-strong transition-colors bg-surface grid place-items-center"
+ className="h-8 w-10 rounded-lg border border-line-strong hover:border-line-strong transition-colors bg-surface grid place-items-center"
>
<span
- className={cn("h-3.5 w-3.5", shape === "circle" && "rounded-full")}
+ className={cn("h-3.5 w-3.5", shape === "circle" ? "rounded-full" : "scale-90")}
style={{ background: valid ? value : ENTITY_PALETTE[0] }}
/>
</button>
@@ -754,7 +754,7 @@ export function ColorPicker({
/>
)}
{open && (
- // 显式宽度:绝对定位的收缩宽度会被 inline-block 触发器的 56px 容器块钳死
+ // 显式宽度:绝对定位的收缩宽度会被 inline-block 触发器的容器块钳死
<div className="u-menu-glass u-pop-in u-pop-in-tl absolute z-50 left-0 top-full mt-2 w-56 rounded-xl p-3 shadow-2xl">
<div className="grid grid-cols-8 gap-1.5 mb-2.5">
{ENTITY_PALETTE.map((c) => (
@@ -1212,12 +1212,12 @@ export function Segmented<T extends string>({
fill && "flex-1",
active
? "bg-surface-3 text-ink"
- : "text-ink-3 hover:bg-surface-2 hover:text-ink-2",
+ : "text-ink-2 hover:bg-surface-2 hover:text-ink",
)}
>
{o.label}
{o.count !== undefined && o.count > 0 && (
- <span className="u-num text-ink-3">{o.count}</span>
+ <span className="u-num">{o.count}</span>
)}
</button>
);
@@ -1347,7 +1347,7 @@ export function GroupLabel({
>
{icon}
<span className="min-w-0 truncate">{children}</span>
- {count !== undefined && <span className="u-num text-ink-3">{count}</span>}
+ {count !== undefined && <span className="u-num">{count}</span>}
</div>
);
}