Skip to content

Self-improving AI Employees for everyone

5.3 KB
Raw Blame
/* ============================================================================
 * OpenCompany — animation system (light, dark, atomic)
 *
 * Source: client/src/themes/base.css + each theme file's Motion block and
 * decorative keyframes. This file declares:
 *   1. Per-theme motion scopes — dur/ease/motion-style by [data-theme].
 *   2. The signature keyframes every theme draws from.
 *   3. Reusable helper classes (pulse, blink).
 *
 * Motion personality lives in the EASING FUNCTION, not just duration:
 *   smooth (light/dark) · bouncy 1.6 overshoot (atomic).
 *
 * The executing-node pulse uses --node-pulse-color (a theme-chosen high
 * contrast accent), NEVER the node's own role color, so the glow stays
 * visible on any canvas.
 * ========================================================================== */

/* ---- Base defaults (light / dark inherit these) ----
 * Durations + eases are declared in tokens/motion.css; here we add only the
 * motion-style label and the executing-pulse selectors. */
:root {
  --motion-style: smooth; /* @kind other */
  --pulse-keyframe: node-pulse; /* @kind other */
  --pulse-duration: 1.4s; /* @kind other */
  --pulse-timing: ease-in-out; /* @kind other */
}

/* ---- Per-theme motion contracts ---- */
[data-theme="atomic"] {
  --dur-fast: 100ms; /* @kind other */ --dur-default: 200ms; /* @kind other */ --dur-slow: 380ms; /* @kind other */
  --ease-default: cubic-bezier(0.34, 1.6, 0.5, 1); /* @kind other */
  --ease-emphasis: cubic-bezier(0.34, 1.6, 0.5, 1); /* @kind other */
  --motion-style: bouncy; /* @kind other */
}

/* ============================================================================
 * Signature keyframes
 * ========================================================================== */

/* Default 3-layer executing pulse (light, dark and atomic). Glow scales
 * out and back. */
@keyframes node-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 0 color-mix(in srgb, var(--node-pulse-color, var(--info)) 80%, transparent),
      0 0 14px 2px color-mix(in srgb, var(--node-pulse-color, var(--info)) 50%, transparent),
      0 0 28px 4px color-mix(in srgb, var(--node-pulse-color, var(--info)) 25%, transparent);
  }
  50% {
    box-shadow:
      0 0 0 12px color-mix(in srgb, var(--node-pulse-color, var(--info)) 45%, transparent),
      0 0 32px 8px color-mix(in srgb, var(--node-pulse-color, var(--info)) 65%, transparent),
      0 0 56px 16px color-mix(in srgb, var(--node-pulse-color, var(--info)) 30%, transparent);
  }
}

/* ---- Trigger nodes: "listening / armed" state ----
 * Triggers (whatsappReceive, cronScheduler, webhookTrigger, start) glow
 * CONTINUOUSLY while waiting for events — distinct from the one-shot
 * execution pulse. The breathing is gentler and slower (an idle-but-armed
 * heartbeat) and uses --node-pulse-color (theme-contrast), so it reads on
 * any background. Pair with the lightning badge. */
@keyframes trigger-listening {
  0%, 100% {
    box-shadow:
      0 0 0 0 color-mix(in srgb, var(--node-pulse-color, #ff79c6) 0%, transparent),
      0 0 9px 1px color-mix(in srgb, var(--node-pulse-color, #ff79c6) 38%, transparent);
  }
  50% {
    box-shadow:
      0 0 0 6px color-mix(in srgb, var(--node-pulse-color, #ff79c6) 20%, transparent),
      0 0 20px 4px color-mix(in srgb, var(--node-pulse-color, #ff79c6) 55%, transparent);
  }
}
/* When a trigger fires — a single bright flash before handing off. */
@keyframes trigger-fire {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--node-pulse-color, #ff79c6) 90%, transparent), 0 0 28px 8px color-mix(in srgb, var(--node-pulse-color, #ff79c6) 70%, transparent); }
  100% { box-shadow: 0 0 0 14px color-mix(in srgb, var(--node-pulse-color, #ff79c6) 0%, transparent), 0 0 28px 8px color-mix(in srgb, var(--node-pulse-color, #ff79c6) 0%, transparent); }
}
/* Lightning badge soft flash while armed. */
@keyframes trigger-bolt { 0%, 100% { opacity: 0.6; transform: scale(0.94); } 50% { opacity: 1; transform: scale(1.06); } }

/* Status pip blink (generic, smooth). */
@keyframes opencompany-pip-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* Spinner. */
@keyframes opencompany-spin { to { transform: rotate(360deg); } }

/* ============================================================================
 * Helper classes
 * ========================================================================== */

/* Apply to an executing node; reads the theme's chosen keyframe + timing. */
.opencompany-pulse {
  animation: var(--pulse-keyframe, node-pulse) var(--pulse-duration, 1.4s) var(--pulse-timing, ease-in-out) infinite;
}

/* Trigger node waiting for events — continuous armed heartbeat. Slower than
 * the execution pulse so the two read as distinct states. */
.opencompany-trigger-armed {
  animation: trigger-listening 2.4s ease-in-out infinite;
}
/* One-shot flash the moment a trigger fires (add, then remove on animationend). */
.opencompany-trigger-fire {
  animation: trigger-fire 0.6s var(--ease-default, ease-out) 1;
}
/* Lightning badge + listening pip pulses. */
.opencompany-bolt { animation: trigger-bolt 1.8s ease-in-out infinite; }
.opencompany-pip-pulse { animation: opencompany-pip-blink 1.4s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .opencompany-pulse,
  .opencompany-trigger-armed, .opencompany-trigger-fire, .opencompany-bolt, .opencompany-pip-pulse { animation: none !important; }
}