add graph and card fonts test updates
This commit is contained in:
@ -2,14 +2,12 @@
|
||||
import { slide } from 'svelte/transition';
|
||||
// open — bindable: родитель может раскрыть пункт программно (например, тизером)
|
||||
let { label, icon = undefined, hint = undefined, open = $bindable(false), children } = $props();
|
||||
// есть вложенный контент → пункт раскрывающийся, нет → обычная строка
|
||||
const expandable = $derived(children !== undefined);
|
||||
</script>
|
||||
{#if expandable}
|
||||
<div class="node" class:open>
|
||||
<div class="row">
|
||||
<button type="button" class="head" aria-expanded={open} onclick={() => (open = !open)}>
|
||||
<!-- маркер раскрытия: «›» в неоновом стиле ромбика, стоит слева -->
|
||||
<svg class="mark" viewBox="0 0 12 12" aria-hidden="true">
|
||||
<path
|
||||
d="M4 2.5 L8 6 L4 9.5"
|
||||
@ -48,43 +46,42 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
column-gap: 10px;
|
||||
column-gap: 12px;
|
||||
row-gap: 4px;
|
||||
}
|
||||
.head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 9px;
|
||||
gap: 10px;
|
||||
flex: 0 1 auto;
|
||||
min-width: 0;
|
||||
padding: 5px 4px;
|
||||
padding: 6px 4px;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
background: none;
|
||||
color: var(--hi);
|
||||
font: inherit;
|
||||
font-size: 14.5px;
|
||||
/* ключевые строки списков — крупнее */
|
||||
font-size: 16.5px;
|
||||
font-weight: 600;
|
||||
text-align: left;
|
||||
}
|
||||
button.head { cursor: pointer; transition: background 0.18s ease; }
|
||||
button.head:hover { background: rgba(79, 240, 183, 0.06); }
|
||||
.static .head { font-weight: 500; color: var(--text); }
|
||||
/* ромбик остаётся только у статичных строк */
|
||||
.bullet {
|
||||
flex-shrink: 0;
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
margin: 0 3px;
|
||||
background: var(--acc);
|
||||
opacity: 0.6;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
/* маркер раскрытия: то же неоновое семейство, что и ромб */
|
||||
.mark {
|
||||
flex-shrink: 0;
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
margin: 0 1px;
|
||||
color: var(--acc);
|
||||
opacity: 0.65;
|
||||
@ -102,10 +99,11 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
padding: 2px 0 10px 26px;
|
||||
padding: 2px 0 10px 28px;
|
||||
font-size: 14px;
|
||||
}
|
||||
@media (max-width: 480px) {
|
||||
.head { font-size: 15.5px; }
|
||||
.body { padding-left: 16px; }
|
||||
}
|
||||
</style>
|
||||
|
||||
202
src/lib/common/ui/SubjectGraph.svelte
Normal file
202
src/lib/common/ui/SubjectGraph.svelte
Normal file
@ -0,0 +1,202 @@
|
||||
<script>
|
||||
import { onMount, onDestroy } from 'svelte';
|
||||
// Граф субъектов в духе Obsidian Graph: репульсия, пружины-связи,
|
||||
// лёгкое плавание и перетаскивание узлов pointer'ом.
|
||||
const W = 520;
|
||||
const H = 330;
|
||||
const PAD = 26;
|
||||
const C = { human: '#3ee0ff', prog: '#e05cff', com: '#ffc65c' };
|
||||
const defs = [
|
||||
{ id: 'hub', label: 'СУБЪЕКТ', kind: 'hub' },
|
||||
{ id: 'human', label: 'Человек', kind: 'type', color: C.human },
|
||||
{ id: 'group', label: 'Группа людей', kind: 'type', color: C.human },
|
||||
{ id: 'prog', label: 'Программа', kind: 'type', color: C.prog },
|
||||
{ id: 'ai', label: 'ИИ', kind: 'type', color: C.prog },
|
||||
{ id: 'agent', label: 'Агент', kind: 'type', color: C.prog },
|
||||
{ id: 'sym', label: 'Symbolic AI', kind: 'type', color: C.prog },
|
||||
{ id: 'com', label: 'Сообщество / Aura ID', kind: 'type', color: C.com },
|
||||
{ id: 'c0', label: 'Внутренние данные', kind: 'child', color: C.com, parent: 'com' },
|
||||
{ id: 'c1', label: 'Хендлеры / службы', kind: 'child', color: C.com, parent: 'com' },
|
||||
{ id: 'c2', label: 'События', kind: 'child', color: C.com, parent: 'com' },
|
||||
{ id: 'c3', label: 'Сигналы', kind: 'child', color: C.com, parent: 'com' },
|
||||
{ id: 'c4', label: 'Вызовы', kind: 'child', color: C.com, parent: 'com' },
|
||||
{ id: 'c5', label: 'Интерфейсы', kind: 'child', color: C.com, parent: 'com' },
|
||||
{ id: 'c6', label: 'Графы контекста', kind: 'child', color: C.com, parent: 'com' },
|
||||
];
|
||||
const links = defs
|
||||
.filter((d) => d.kind === 'type')
|
||||
.map((d) => ({ a: 'hub', b: d.id, rest: 92 }))
|
||||
.concat(defs.filter((d) => d.kind === 'child').map((d) => ({ a: d.parent, b: d.id, rest: 56 })));
|
||||
// стартовая «розетка», чтобы симуляция входила мягко
|
||||
let nodes = $state(
|
||||
defs.map((d, i) => {
|
||||
const angle = (i / defs.length) * Math.PI * 2;
|
||||
const radius = d.kind === 'hub' ? 0 : d.kind === 'child' ? 150 : 100;
|
||||
return {
|
||||
...d,
|
||||
r: d.kind === 'hub' ? 7 : d.kind === 'type' ? 5 : 3.4,
|
||||
x: W / 2 + Math.cos(angle) * radius + (Math.random() * 14 - 7),
|
||||
y: H / 2 + Math.sin(angle) * radius * 0.72 + (Math.random() * 14 - 7),
|
||||
vx: 0,
|
||||
vy: 0,
|
||||
phase: Math.random() * Math.PI * 2,
|
||||
};
|
||||
})
|
||||
);
|
||||
const byId = new Map(nodes.map((n) => [n.id, n]));
|
||||
let dragging = $state(/** @type {string | null} */ (null));
|
||||
let svgEl = $state(/** @type {SVGSVGElement | null} */ (null));
|
||||
const reduced = () =>
|
||||
typeof matchMedia !== 'undefined' && matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
// ── физика ──
|
||||
const REPEL = 2400;
|
||||
const SPRING = 0.014;
|
||||
const CENTER = 0.00024;
|
||||
const DAMP = 0.86;
|
||||
let raf = 0;
|
||||
let t0 = 0;
|
||||
function tick(now) {
|
||||
const t = now - t0;
|
||||
const quiet = reduced();
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
const a = nodes[i];
|
||||
for (let j = i + 1; j < nodes.length; j++) {
|
||||
const b = nodes[j];
|
||||
let dx = a.x - b.x;
|
||||
let dy = a.y - b.y;
|
||||
const d2 = dx * dx + dy * dy + 60;
|
||||
const d = Math.sqrt(d2);
|
||||
const f = (REPEL / d2) * 0.016;
|
||||
dx /= d;
|
||||
dy /= d;
|
||||
a.vx += dx * f;
|
||||
a.vy += dy * f;
|
||||
b.vx -= dx * f;
|
||||
b.vy -= dy * f;
|
||||
}
|
||||
}
|
||||
for (const l of links) {
|
||||
const a = byId.get(l.a);
|
||||
const b = byId.get(l.b);
|
||||
let dx = b.x - a.x;
|
||||
let dy = b.y - a.y;
|
||||
const d = Math.sqrt(dx * dx + dy * dy) || 1;
|
||||
const f = (d - l.rest) * SPRING;
|
||||
dx /= d;
|
||||
dy /= d;
|
||||
a.vx += dx * f;
|
||||
a.vy += dy * f;
|
||||
b.vx -= dx * f;
|
||||
b.vy -= dy * f;
|
||||
}
|
||||
for (const n of nodes) {
|
||||
if (n.id === dragging) {
|
||||
n.vx = 0;
|
||||
n.vy = 0;
|
||||
continue;
|
||||
}
|
||||
n.vx += (W / 2 - n.x) * CENTER;
|
||||
n.vy += (H / 2 - n.y) * CENTER;
|
||||
if (!quiet) {
|
||||
n.vx += Math.sin(t * 0.0009 + n.phase) * 0.012;
|
||||
n.vy += Math.cos(t * 0.0007 + n.phase * 1.3) * 0.012;
|
||||
}
|
||||
n.vx *= DAMP;
|
||||
n.vy *= DAMP;
|
||||
n.x += n.vx;
|
||||
n.y += n.vy;
|
||||
if (n.x < PAD) n.vx += (PAD - n.x) * 0.02;
|
||||
if (n.x > W - PAD) n.vx -= (n.x - (W - PAD)) * 0.02;
|
||||
if (n.y < PAD) n.vy += (PAD - n.y) * 0.02;
|
||||
if (n.y > H - PAD) n.vy -= (n.y - (H - PAD)) * 0.02;
|
||||
}
|
||||
raf = requestAnimationFrame(tick);
|
||||
}
|
||||
onMount(() => {
|
||||
t0 = performance.now();
|
||||
raf = requestAnimationFrame(tick);
|
||||
});
|
||||
onDestroy(() => cancelAnimationFrame(raf));
|
||||
// ── перетаскивание ──
|
||||
function toLocal(e) {
|
||||
const rect = svgEl.getBoundingClientRect();
|
||||
const s = rect.width / W;
|
||||
return { x: (e.clientX - rect.left) / s, y: (e.clientY - rect.top) / s };
|
||||
}
|
||||
function down(e, id) {
|
||||
dragging = id;
|
||||
e.target.setPointerCapture?.(e.pointerId);
|
||||
move(e);
|
||||
}
|
||||
function move(e) {
|
||||
if (!dragging) return;
|
||||
const p = toLocal(e);
|
||||
const n = byId.get(dragging);
|
||||
n.x = Math.min(W - PAD, Math.max(PAD, p.x));
|
||||
n.y = Math.min(H - PAD, Math.max(PAD, p.y));
|
||||
}
|
||||
function up() {
|
||||
dragging = null;
|
||||
}
|
||||
</script>
|
||||
<svg
|
||||
class="graph"
|
||||
viewBox="0 0 {W} {H}"
|
||||
bind:this={svgEl}
|
||||
onpointermove={move}
|
||||
onpointerup={up}
|
||||
onpointercancel={up}
|
||||
role="img"
|
||||
aria-label="Граф субъектов экосистемы"
|
||||
>
|
||||
{#each links as l}
|
||||
{@const a = byId.get(l.a)}
|
||||
{@const b = byId.get(l.b)}
|
||||
<line class="link" class:hub={l.a === 'hub'} x1={a.x} y1={a.y} x2={b.x} y2={b.y} />
|
||||
{/each}
|
||||
{#each nodes as n}
|
||||
<g
|
||||
class="node"
|
||||
class:hub={n.kind === 'hub'}
|
||||
class:child={n.kind === 'child'}
|
||||
class:drag={dragging === n.id}
|
||||
style:color={n.color ?? 'var(--acc)'}
|
||||
onpointerdown={(e) => down(e, n.id)}
|
||||
>
|
||||
<!-- невидимая зона захвата побольше -->
|
||||
<circle cx={n.x} cy={n.y} r={n.r + 9} fill="transparent" />
|
||||
<circle cx={n.x} cy={n.y} r={n.r} fill={n.color ?? 'var(--acc)'} />
|
||||
<text x={n.x} y={n.y + n.r + 13} text-anchor="middle">{n.label}</text>
|
||||
</g>
|
||||
{/each}
|
||||
</svg>
|
||||
<style>
|
||||
.graph {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
touch-action: none;
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
.link { stroke: rgba(150, 255, 220, 0.16); stroke-width: 1; }
|
||||
.link.hub { stroke: rgba(150, 255, 220, 0.28); }
|
||||
.node { cursor: grab; }
|
||||
.node.drag { cursor: grabbing; }
|
||||
.node circle { transition: filter 0.18s ease; }
|
||||
.node:hover circle,
|
||||
.node.drag circle { filter: drop-shadow(0 0 6px currentColor); }
|
||||
.node text {
|
||||
font-family: var(--mono);
|
||||
font-size: 10.5px;
|
||||
fill: var(--text);
|
||||
pointer-events: none;
|
||||
}
|
||||
.node.child text { font-size: 9.5px; fill: var(--dim); }
|
||||
.node.hub text {
|
||||
font-size: 11.5px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.12em;
|
||||
fill: var(--hi);
|
||||
}
|
||||
</style>
|
||||
@ -1,49 +1,46 @@
|
||||
<script>
|
||||
import Card from '$lib/common/ui/Card.svelte';
|
||||
import Node from '$lib/common/ui/Node.svelte';
|
||||
import SubjectGraph from '$lib/common/ui/SubjectGraph.svelte';
|
||||
import RankRadar from '$lib/pages/bionyx/RankRadar.svelte';
|
||||
</script>
|
||||
<Card title="BIONYX COMMUNITY" subtitle="Полная интеграция с экосистемой Bionyx">
|
||||
<p class="bx-p">
|
||||
Сообщество Bionyx — нейроинтегрированное и имеет расширенную модель взаимодействия
|
||||
<span class="mono">субъект ↔ субъект</span>.
|
||||
</p>
|
||||
<div class="model-head">
|
||||
<h3 class="model-title">Новая модель</h3>
|
||||
<p class="model-sub">субъект ↔ субъект</p>
|
||||
</div>
|
||||
<div class="block">
|
||||
<p class="bx-label">Субъектом может быть</p>
|
||||
<div class="nodes">
|
||||
<Node label="Человек / Группа людей" />
|
||||
<Node label="Программа / ИИ / Агент / Symbolic AI" />
|
||||
<Node label="Сообщество / Репозиторий Aura ID">
|
||||
<ul class="bx-list">
|
||||
<li>Внутренние данные</li>
|
||||
<li>Хендлеры / службы</li>
|
||||
<li>События</li>
|
||||
<li>Сигналы</li>
|
||||
<li>Вызовы</li>
|
||||
<li>Интерфейсы</li>
|
||||
<li>Графы контекста</li>
|
||||
</ul>
|
||||
</Node>
|
||||
<SubjectGraph />
|
||||
</div>
|
||||
</div>
|
||||
<!-- блок рангов живёт прямо в карточке, без отдельного фрейма -->
|
||||
<RankRadar />
|
||||
<p class="bx-note">Открыто для любых направлений.</p>
|
||||
</Card>
|
||||
<style>
|
||||
.block {
|
||||
.model-head {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
.nodes {
|
||||
.model-title {
|
||||
margin: 0;
|
||||
font-size: clamp(22px, 3vw, 30px);
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
color: var(--dim);
|
||||
}
|
||||
.model-sub {
|
||||
margin: 0;
|
||||
font-family: var(--mono);
|
||||
font-size: clamp(14px, 2vw, 18px);
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.06em;
|
||||
color: var(--acc);
|
||||
text-shadow: 0 0 12px rgba(79, 240, 183, 0.35);
|
||||
}
|
||||
.block {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
.mono {
|
||||
font-family: var(--mono);
|
||||
font-size: 0.92em;
|
||||
color: var(--acc);
|
||||
gap: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -120,22 +120,23 @@
|
||||
<style>
|
||||
.block { display: flex; flex-direction: column; gap: 10px; }
|
||||
.nodes { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
||||
/* ключевая цифра — чисто текст, без рамки и подложки */
|
||||
/* ключевая цифра — крупнее и жирнее, чисто текст */
|
||||
.hint-num {
|
||||
font-family: var(--mono);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: var(--acc);
|
||||
text-shadow: 0 0 10px rgba(79, 240, 183, 0.45);
|
||||
white-space: nowrap;
|
||||
opacity: 0.95;
|
||||
}
|
||||
/* символы-иконки — крупнее */
|
||||
.nix-icon {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
stroke: var(--acc);
|
||||
fill: none;
|
||||
stroke-width: 1.3;
|
||||
stroke-width: 1.2;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
filter: drop-shadow(0 0 6px rgba(79, 240, 183, 0.55));
|
||||
|
||||
@ -250,13 +250,16 @@
|
||||
|
||||
<div class="rank">
|
||||
<div class="rank-head">
|
||||
<div class="rank-intro">
|
||||
<h3 class="rank-title">Ранг система</h3>
|
||||
<!-- компактно: ранг не «на глаз», а из данных -->
|
||||
<p class="rank-sub">по измеримым метрикам</p>
|
||||
</div>
|
||||
<div class="rank-side">
|
||||
<span class="rank-kicker">Ранг</span>
|
||||
<span class="rank-kicker">текущий ранг</span>
|
||||
{#key rank}
|
||||
<span class="rank-grade" style:color={rankColor}>{rank}</span>
|
||||
{/key}
|
||||
<!-- полоса прокачки: деления E → S+, текущее светится -->
|
||||
<div class="rank-track" aria-hidden="true">
|
||||
{#each GRADE_ORDER as g}
|
||||
<span class="tick" class:on={g === rank}></span>
|
||||
@ -429,15 +432,38 @@
|
||||
align-items: center;
|
||||
gap: 18px;
|
||||
}
|
||||
.rank-title {
|
||||
.rank-intro {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
.rank-title {
|
||||
margin: 0;
|
||||
font-size: clamp(20px, 2.6vw, 26px);
|
||||
font-size: clamp(24px, 3.4vw, 32px);
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
color: var(--dim); /* сероватый, как просил */
|
||||
color: var(--dim);
|
||||
}
|
||||
.rank-sub {
|
||||
margin: 0;
|
||||
font-family: var(--mono);
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.14em;
|
||||
text-transform: uppercase;
|
||||
color: var(--dim);
|
||||
opacity: 0.85;
|
||||
}
|
||||
.rank-grade {
|
||||
font-family: var(--mono);
|
||||
font-size: 46px;
|
||||
font-weight: 800;
|
||||
line-height: 1.05;
|
||||
letter-spacing: 0.02em;
|
||||
filter: drop-shadow(0 0 12px);
|
||||
animation: grade-in 0.45s ease;
|
||||
}
|
||||
.rank-side {
|
||||
flex-shrink: 0;
|
||||
|
||||
Reference in New Issue
Block a user