Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat(micrographics): add MicroGlyph, SchematicLabel, MicroLoader module
Adam Eivy4e9ce450f05f
diff --git a/client/src/components/micrographics/MicroGlyph.jsx b/client/src/components/micrographics/MicroGlyph.jsxnew file mode 100644index 0000000000..4082b3e50d--- /dev/null+++ b/client/src/components/micrographics/MicroGlyph.jsx@@ -0,0 +1,307 @@+import { useId } from 'react';+import './micrographics.css';++const polarDots = (count, radius) =>+ Array.from({ length: count }, (_, i) => {+ const angle = (Math.PI * 2 * i) / count - Math.PI / 2;+ return { x: 32 + Math.cos(angle) * radius, y: 32 + Math.sin(angle) * radius };+ });++const DOTS_8 = polarDots(8, 22);+const DOTS_12 = polarDots(12, 23);+const MATRIX_DOTS = Array.from({ length: 25 }, (_, i) => ({+ x: 16 + (i % 5) * 8,+ y: 16 + Math.floor(i / 5) * 8,+ index: i,+}));++function OrbitGlyph() {+ return (+ <>+ <circle className="port-microglyph__line port-microglyph__muted" cx="32" cy="32" r="24" />+ <circle className="port-microglyph__line port-microglyph__ghost" cx="32" cy="32" r="14" />+ <g className="port-microglyph__orbit">+ <path className="port-microglyph__line" d="M32 8a24 24 0 0 1 22 14" />+ <circle className="port-microglyph__fill" cx="53" cy="21" r="3" />+ </g>+ <g className="port-microglyph__counter-orbit">+ <path className="port-microglyph__line port-microglyph__muted" d="M12 45a24 24 0 0 1-3-17" />+ <circle className="port-microglyph__fill port-microglyph__dim" cx="10" cy="45" r="2" />+ </g>+ <circle className="port-microglyph__fill port-microglyph__core" cx="32" cy="32" r="3.5" />+ </>+ );+}++// `level` (0–1) drives bar heights when provided so the signal glyph can be+// data-bound (e.g. live audio level) instead of always animating.+function SignalGlyph({ level }) {+ const bars = [+ { x: 19, baseY: 25, baseH: 14, mod: 1 },+ { x: 26, baseY: 17, baseH: 30, mod: 2 },+ { x: 33, baseY: 11, baseH: 42, mod: 3 },+ { x: 40, baseY: 20, baseH: 24, mod: 4 },+ ];+ const driven = typeof level === 'number';+ return (+ <>+ <path className="port-microglyph__line port-microglyph__muted" d="M9 32h8m30 0h8" />+ <g>+ {bars.map((b, i) => {+ if (driven) {+ const k = Math.max(0, Math.min(1, level)) * (0.5 + (i % 3) * 0.25);+ const h = Math.max(4, b.baseH * (0.4 + k * 0.6));+ const y = 53 - h;+ return (+ <rect+ key={i}+ className="port-microglyph__fill"+ x={b.x}+ y={y}+ width="4"+ height={h}+ rx="2"+ style={{ transition: 'y 0.08s linear, height 0.08s linear' }}+ />+ );+ }+ return (+ <rect+ key={i}+ className={`port-microglyph__fill port-microglyph__bar port-microglyph__bar-${b.mod}`}+ x={b.x}+ y={b.baseY}+ width="4"+ height={b.baseH}+ rx="2"+ />+ );+ })}+ </g>+ <path className="port-microglyph__line port-microglyph__ghost" d="M17 49c10-7 20-7 30 0" />+ </>+ );+}++function NodeGlyph() {+ return (+ <>+ <g className="port-microglyph__nodes">+ {DOTS_8.map((dot, i) => (+ <line+ key={`l${i}`}+ className="port-microglyph__line port-microglyph__ghost"+ x1="32" y1="32" x2={dot.x} y2={dot.y}+ />+ ))}+ {DOTS_8.map((dot, i) => (+ <circle+ key={`d${i}`}+ className={i % 3 === 0 ? 'port-microglyph__fill' : 'port-microglyph__fill port-microglyph__dim'}+ cx={dot.x} cy={dot.y} r={i % 3 === 0 ? 2.5 : 1.8}+ />+ ))}+ </g>+ <circle className="port-microglyph__line" cx="32" cy="32" r="7" />+ <circle className="port-microglyph__fill port-microglyph__core" cx="32" cy="32" r="2.5" />+ </>+ );+}++// `intensity` is an array of per-cell opacities (0–1, length 25). Lets the+// caller bind dot brightness to per-service health values.+function MatrixGlyph({ intensity }) {+ return (+ <>+ <rect className="port-microglyph__line port-microglyph__muted" x="12" y="12" width="40" height="40" rx="4" />+ <g>+ {MATRIX_DOTS.map((dot) => {+ const driven = Array.isArray(intensity);+ const opacity = driven+ ? Math.max(0.15, Math.min(1, intensity[dot.index] ?? 0.2))+ : undefined;+ return (+ <circle+ key={`m${dot.index}`}+ className={+ driven+ ? 'port-microglyph__fill'+ : `port-microglyph__fill port-microglyph__matrix-dot port-microglyph__matrix-dot-${dot.index % 5}`+ }+ cx={dot.x}+ cy={dot.y}+ r={driven ? 1.6 : (dot.index % 2 === 0 ? 1.8 : 1.25)}+ style={driven ? { opacity } : undefined}+ />+ );+ })}+ </g>+ <path className="port-microglyph__line" d="M18 46h28" />+ </>+ );+}++function ScanGlyph() {+ return (+ <>+ <path className="port-microglyph__line port-microglyph__muted" d="M14 16h36M14 48h36M16 14v12M48 38v12" />+ <path className="port-microglyph__line" d="M20 34h24" />+ <path className="port-microglyph__line port-microglyph__scan-sweep" d="M16 24h32" />+ <circle className="port-microglyph__line port-microglyph__ghost" cx="32" cy="32" r="15" />+ <circle className="port-microglyph__fill port-microglyph__core" cx="32" cy="32" r="2.5" />+ </>+ );+}++function SparkGlyph() {+ return (+ <>+ <g className="port-microglyph__spark">+ <path className="port-microglyph__line" d="M32 8v48M8 32h48M15 15l34 34M49 15 15 49" />+ </g>+ <circle className="port-microglyph__line port-microglyph__ghost" cx="32" cy="32" r="16" />+ <circle className="port-microglyph__fill port-microglyph__core" cx="32" cy="32" r="4" />+ </>+ );+}++function ReticleGlyph() {+ return (+ <>+ <circle className="port-microglyph__line port-microglyph__muted" cx="32" cy="32" r="22" />+ <circle className="port-microglyph__line" cx="32" cy="32" r="10" />+ <path className="port-microglyph__line" d="M32 6v10M32 48v10M6 32h10M48 32h10" />+ <path className="port-microglyph__line port-microglyph__ghost" d="M24 24l16 16M40 24 24 40" />+ </>+ );+}++function ProgressGlyph({ progress = 0.66 }) {+ const normalized = Math.max(0, Math.min(1, progress));+ return (+ <>+ <circle className="port-microglyph__line port-microglyph__muted" cx="32" cy="32" r="24" />+ <circle+ className="port-microglyph__line port-microglyph__progress-ring"+ cx="32" cy="32" r="24"+ style={{ '--port-micro-progress': normalized }}+ />+ <g>+ {DOTS_12.map((dot, i) => (+ <circle+ key={`p${i}`}+ className={i / 12 <= normalized ? 'port-microglyph__fill' : 'port-microglyph__fill port-microglyph__dim'}+ cx={dot.x} cy={dot.y} r="1.5"+ />+ ))}+ </g>+ <path className="port-microglyph__line" d="M23 33l6 6 13-16" />+ </>+ );+}++function PulseDotGlyph() {+ return (+ <>+ <circle className="port-microglyph__line port-microglyph__muted" cx="32" cy="32" r="22" />+ <g className="port-microglyph__pulse">+ <circle className="port-microglyph__fill port-microglyph__core" cx="32" cy="32" r="6" />+ </g>+ </>+ );+}++function WarningTriGlyph() {+ return (+ <g className="port-microglyph__warn-blink">+ <path+ className="port-microglyph__line"+ d="M32 9 L57 51 L7 51 Z"+ strokeLinejoin="miter"+ />+ <path className="port-microglyph__line" d="M32 24v14" />+ <circle className="port-microglyph__fill" cx="32" cy="44" r="2" />+ </g>+ );+}++function CheckTickGlyph() {+ return (+ <>+ <circle className="port-microglyph__line port-microglyph__muted" cx="32" cy="32" r="24" />+ <path className="port-microglyph__line" d="M21 33l8 8 14-18" />+ </>+ );+}++function BracketPairGlyph() {+ return (+ <>+ <path className="port-microglyph__line" d="M14 14h-4v36h4" />+ <path className="port-microglyph__line" d="M50 14h4v36h-4" />+ <circle className="port-microglyph__fill port-microglyph__dim" cx="22" cy="32" r="1.6" />+ <circle className="port-microglyph__fill" cx="32" cy="32" r="2" />+ <circle className="port-microglyph__fill port-microglyph__dim" cx="42" cy="32" r="1.6" />+ </>+ );+}++const GLYPHS = {+ orbit: OrbitGlyph,+ signal: SignalGlyph,+ node: NodeGlyph,+ matrix: MatrixGlyph,+ scan: ScanGlyph,+ spark: SparkGlyph,+ reticle: ReticleGlyph,+ progress: ProgressGlyph,+ 'pulse-dot': PulseDotGlyph,+ 'warning-tri': WarningTriGlyph,+ 'check-tick': CheckTickGlyph,+ 'bracket-pair': BracketPairGlyph,+};++const VALID_STATES = new Set(['idle', 'active', 'success', 'warn', 'warning', 'error', 'accent']);++export default function MicroGlyph({+ variant = 'orbit',+ size = 16,+ animated = false,+ state,+ progress,+ level,+ intensity,+ className = '',+ title,+}) {+ const titleId = useId();+ const Glyph = GLYPHS[variant] ?? OrbitGlyph;+ const stateClass = VALID_STATES.has(state) ? `port-microglyph--${state}` : '';+ const accessibility = title+ ? { role: 'img', 'aria-labelledby': titleId }+ : { 'aria-hidden': 'true' };+ const classes = [+ 'port-microglyph',+ `port-microglyph--${variant}`,+ animated ? 'port-microglyph--animated' : '',+ stateClass,+ className,+ ].filter(Boolean).join(' ');++ return (+ <svg+ viewBox="0 0 64 64"+ width={size}+ height={size}+ className={classes}+ fill="none"+ focusable="false"+ {...accessibility}+ >+ {title && <title id={titleId}>{title}</title>}+ <Glyph progress={progress} level={level} intensity={intensity} />+ </svg>+ );+}++export const GLYPH_VARIANTS = Object.keys(GLYPHS);diff --git a/client/src/components/micrographics/MicroLoader.jsx b/client/src/components/micrographics/MicroLoader.jsxnew file mode 100644index 0000000000..f861a99033--- /dev/null+++ b/client/src/components/micrographics/MicroLoader.jsx@@ -0,0 +1,37 @@+import MicroGlyph from './MicroGlyph';+import './micrographics.css';++// Context-aware micrographic loader. Used in a small set of empty states+// (Dashboard / Apps grid / CoS empty list); BrailleSpinner remains the+// default loader everywhere else.+export default function MicroLoader({+ label,+ module = 'LOAD',+ status = 'WAITING',+ glyph = 'orbit',+ block = false,+ size = 18,+ className = '',+}) {+ const classes = [+ 'port-microloader',+ block ? 'port-microloader--block' : '',+ className,+ ].filter(Boolean).join(' ');++ return (+ <div className={classes} role="status" aria-live="polite">+ <MicroGlyph variant={glyph} size={size} animated state="accent" title={label || `${module} ${status}`} />+ <span className="port-microloader__label">+ <span style={{ opacity: 0.85 }}>{module}</span>+ <span style={{ opacity: 0.45, margin: '0 0.35em' }}>//</span>+ <span style={{ fontWeight: 600 }}>{status}</span>+ </span>+ {label && (+ <span className="port-microloader__label" style={{ opacity: 0.75, fontFamily: 'var(--port-font-mono)', textTransform: 'none', letterSpacing: 0 }}>+ {label}+ </span>+ )}+ </div>+ );+}diff --git a/client/src/components/micrographics/SchematicLabel.jsx b/client/src/components/micrographics/SchematicLabel.jsxnew file mode 100644index 0000000000..0f1179bc49--- /dev/null+++ b/client/src/components/micrographics/SchematicLabel.jsx@@ -0,0 +1,62 @@+import MicroGlyph from './MicroGlyph';++const STATE_TO_TONE = {+ active: 'accent',+ online: 'success',+ ok: 'success',+ success: 'success',+ warn: 'warn',+ warning: 'warn',+ error: 'error',+ idle: 'muted',+ offline: 'muted',+};++// Schematic HUD label — type-paired chrome lifted from the micro2 reference+// sticker sheet. Renders something like: "MODULE.04 // ACTIVE ●"+//+// Sits at the top edge of cards, above widget headers, on empty states.+// Reuses GeistPixelSquare (already loaded for CyberCity) so no font cost.+export default function SchematicLabel({+ module,+ prefix = 'MODULE',+ status,+ glyph,+ state = 'idle',+ variant = 'inline', // 'inline' | 'tab'+ animated,+ className = '',+}) {+ const tone = STATE_TO_TONE[state] || '';+ const toneClass = tone ? `port-schematic-label--${tone}` : '';+ const classes = [+ 'port-schematic-label',+ variant === 'tab' ? 'port-schematic-label--tab' : '',+ toneClass,+ className,+ ].filter(Boolean).join(' ');++ // Animation default: only spin/pulse when state is "active". Override+ // explicitly via the `animated` prop when needed.+ const shouldAnimate = animated ?? state === 'active';++ return (+ <span className={classes} aria-hidden="true">+ {module && (+ <span className="port-schematic-label__module">+ {prefix}.{module}+ </span>+ )}+ {module && status && <span className="port-schematic-label__divider">//</span>}+ {status && <span className="port-schematic-label__status">{status}</span>}+ {glyph && (+ <MicroGlyph+ variant={glyph}+ size={11}+ animated={shouldAnimate}+ state={tone === 'muted' ? undefined : tone}+ />+ )}+ </span>+ );+}diff --git a/client/src/components/micrographics/index.js b/client/src/components/micrographics/index.jsnew file mode 100644index 0000000000..e49797baee--- /dev/null+++ b/client/src/components/micrographics/index.js@@ -0,0 +1,3 @@+export { default as MicroGlyph, GLYPH_VARIANTS } from './MicroGlyph';+export { default as SchematicLabel } from './SchematicLabel';+export { default as MicroLoader } from './MicroLoader';diff --git a/client/src/components/micrographics/micrographics.css b/client/src/components/micrographics/micrographics.cssnew file mode 100644index 0000000000..879a7ce1e1--- /dev/null+++ b/client/src/components/micrographics/micrographics.css@@ -0,0 +1,213 @@+/* PortOS micrographics — small SVG glyphs + schematic HUD labels.+ All keyframes live inside the prefers-reduced-motion guard so users who+ request reduced motion get a fully static set of glyphs. */++.port-microglyph {+ display: inline-block;+ flex: none;+ overflow: visible;+ color: currentColor;+ vertical-align: -0.15em;+}++.port-microglyph--success { color: rgb(var(--port-success)); }+.port-microglyph--warn,+.port-microglyph--warning { color: rgb(var(--port-warning)); }+.port-microglyph--error { color: rgb(var(--port-error)); }+.port-microglyph--accent { color: rgb(var(--port-accent)); }++.port-microglyph__line {+ fill: none;+ stroke: currentColor;+ stroke-width: 2;+ stroke-linecap: round;+ stroke-linejoin: round;+ vector-effect: non-scaling-stroke;+}++.port-microglyph__muted { stroke: currentColor; opacity: 0.4; }+.port-microglyph__ghost { opacity: 0.42; }+.port-microglyph__fill { fill: currentColor; }+.port-microglyph__dim { opacity: 0.46; }+.port-microglyph__core { filter: drop-shadow(0 0 6px currentColor); }++.port-microglyph__progress-ring {+ stroke-dasharray: calc(var(--port-micro-progress, 0.66) * 151) 151;+ transform: rotate(-90deg);+ transform-origin: 32px 32px;+}++/* Schematic label — type-paired chrome, "MODULE.04 // ACTIVE ●". */+.port-schematic-label {+ display: inline-flex;+ align-items: center;+ gap: 0.45rem;+ font-family: 'GeistPixelSquare', 'Courier New', monospace;+ font-size: 0.68rem;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ color: rgb(var(--port-accent));+ line-height: 1;+ white-space: nowrap;+}++.port-schematic-label__bracket {+ opacity: 0.55;+ font-weight: normal;+}++.port-schematic-label__module {+ color: currentColor;+ opacity: 0.85;+}++.port-schematic-label__divider {+ color: currentColor;+ opacity: 0.45;+}++.port-schematic-label__status {+ color: currentColor;+ opacity: 0.95;+ font-weight: 600;+}++.port-schematic-label--success { color: rgb(var(--port-success)); }+.port-schematic-label--warn { color: rgb(var(--port-warning)); }+.port-schematic-label--error { color: rgb(var(--port-error)); }+.port-schematic-label--muted { color: rgb(var(--port-border)); opacity: 0.85; }++/* Card-tab variant: when a label sits on a card's top border like a+ blueprint tab. The host needs `position: relative`. */+.port-schematic-label--tab {+ position: absolute;+ top: -0.45rem;+ left: 0.9rem;+ z-index: 1;+ padding: 0 0.45rem;+ background: rgb(var(--port-bg));+ pointer-events: none;+}++/* Microloader — context-aware loading shell. */+.port-microloader {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ gap: 0.5rem;+ line-height: 1;+ white-space: nowrap;+ color: rgb(var(--port-accent));+}++.port-microloader__label {+ font-family: 'GeistPixelSquare', 'Courier New', monospace;+ font-size: 0.72rem;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ opacity: 0.85;+}++.port-microloader--block {+ flex-direction: column;+ gap: 0.55rem;+ padding: 1.1rem 1.4rem;+ border: 1px dashed rgb(var(--port-border));+ border-radius: 0.75rem;+ background: rgb(var(--port-card) / 0.5);+}++/* Animations — only run when motion is allowed. */+@media (prefers-reduced-motion: no-preference) {+ .port-microglyph--animated .port-microglyph__orbit {+ animation: port-micro-spin 4.8s linear infinite;+ transform-origin: 32px 32px;+ }++ .port-microglyph--animated .port-microglyph__counter-orbit {+ animation: port-micro-spin 7s linear infinite reverse;+ transform-origin: 32px 32px;+ }++ .port-microglyph--animated .port-microglyph__nodes {+ animation: port-micro-breathe 2.8s ease-in-out infinite;+ transform-origin: 32px 32px;+ }++ .port-microglyph--animated .port-microglyph__spark {+ animation: port-micro-spark 3.2s ease-in-out infinite;+ transform-origin: 32px 32px;+ }++ .port-microglyph--animated .port-microglyph__scan-sweep {+ animation: port-micro-scan 1.35s ease-in-out infinite;+ }++ .port-microglyph--animated .port-microglyph__matrix-dot {+ animation: port-micro-dot 1.35s ease-in-out infinite;+ }++ .port-microglyph--animated .port-microglyph__matrix-dot-1 { animation-delay: 90ms; }+ .port-microglyph--animated .port-microglyph__matrix-dot-2 { animation-delay: 180ms; }+ .port-microglyph--animated .port-microglyph__matrix-dot-3 { animation-delay: 270ms; }+ .port-microglyph--animated .port-microglyph__matrix-dot-4 { animation-delay: 360ms; }++ .port-microglyph--animated .port-microglyph__bar {+ animation: port-micro-bars 1.1s ease-in-out infinite;+ transform-origin: center;+ }++ .port-microglyph--animated .port-microglyph__bar-2 { animation-delay: 90ms; }+ .port-microglyph--animated .port-microglyph__bar-3 { animation-delay: 180ms; }+ .port-microglyph--animated .port-microglyph__bar-4 { animation-delay: 270ms; }++ .port-microglyph--animated .port-microglyph__pulse {+ animation: port-micro-pulse 2.2s ease-in-out infinite;+ transform-origin: 32px 32px;+ }++ .port-microglyph--animated .port-microglyph__warn-blink {+ animation: port-micro-warn 1.2s steps(2, end) infinite;+ transform-origin: 32px 32px;+ }+}++@keyframes port-micro-spin {+ to { transform: rotate(360deg); }+}++@keyframes port-micro-breathe {+ 0%, 100% { opacity: 0.72; transform: scale(0.96); }+ 50% { opacity: 1; transform: scale(1.04); }+}++@keyframes port-micro-spark {+ 0%, 100% { opacity: 0.64; transform: rotate(0deg) scale(0.94); }+ 50% { opacity: 1; transform: rotate(45deg) scale(1.04); }+}++@keyframes port-micro-scan {+ 0% { opacity: 0; transform: translateY(-13px); }+ 35%, 65% { opacity: 1; }+ 100% { opacity: 0; transform: translateY(13px); }+}++@keyframes port-micro-dot {+ 0%, 100% { opacity: 0.32; transform: scale(0.86); }+ 50% { opacity: 1; transform: scale(1.18); }+}++@keyframes port-micro-bars {+ 0%, 100% { opacity: 0.48; transform: scaleY(0.68); }+ 50% { opacity: 1; transform: scaleY(1); }+}++@keyframes port-micro-pulse {+ 0%, 100% { opacity: 0.55; transform: scale(0.85); }+ 50% { opacity: 1; transform: scale(1.08); }+}++@keyframes port-micro-warn {+ 0%, 100% { opacity: 0.4; }+ 50% { opacity: 1; }+}