Skip to content

Self-improving AI Employees for everyone

9.8 KB
Raw Blame
/* ============================================================================
 * themes/animations.css — theme-scoped executing-pulse selection, trigger
 * "armed/listening" motion, and reusable animation helper classes.
 *
 * Source contract: docs-internal/design-system/tokens/animations.css.
 *
 * The executing-pulse KEYFRAME is chosen per theme via `--pulse-keyframe`
 * (+ `--pulse-duration` / `--pulse-timing`); base.css's executing rules read
 * those tokens, so a theme switches its pulse by overriding one variable
 * instead of a high-specificity `.react-flow__node.executing` rule.
 *
 * Per-theme `--dur-*` / `--ease-*` / `--motion-style` already live in
 * base.css + each theme file; this file only adds the pulse-keyframe tokens
 * and the keyframes/helpers.
 *
 * Glow colour is `--node-pulse-color` (a theme-chosen high-contrast accent,
 * inherited from the active `:root[data-theme]` scope), NEVER the node's own
 * `--node-color` fill, so the glow stays visible on any canvas.
 * ========================================================================== */

:root {
  --pulse-keyframe: node-pulse;
  --pulse-duration: 1.4s;
  --pulse-timing: ease-in-out;
}

/* ============================================================================
 * Executing-pulse keyframes (relocated here as the single source of truth).
 * node-pulse references the shared --tint-pulse-* scale (base.css).
 * ========================================================================== */

/* Default 3-layer glow — light, dark and atomic all draw from this. */
@keyframes node-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 0 color-mix(in srgb, var(--node-pulse-color) var(--tint-pulse-ring), transparent),
      0 0 14px 2px color-mix(in srgb, var(--node-pulse-color) var(--tint-pulse-halo), transparent),
      0 0 28px 4px color-mix(in srgb, var(--node-pulse-color) var(--tint-pulse-atmos), transparent);
  }
  50% {
    box-shadow:
      0 0 0 12px color-mix(in srgb, var(--node-pulse-color) var(--tint-pulse-ring-peak), transparent),
      0 0 32px 8px color-mix(in srgb, var(--node-pulse-color) var(--tint-pulse-halo-peak), transparent),
      0 0 56px 16px color-mix(in srgb, var(--node-pulse-color) var(--tint-pulse-atmos-peak), transparent);
  }
}

/* ============================================================================
 * Trigger nodes — "armed / listening" state.
 * Triggers (whatsappReceive, telegramReceive, cronScheduler, webhookTrigger,
 * emailReceive, …) glow CONTINUOUSLY while deployed and waiting for events —
 * a gentle, slower heartbeat distinct from the one-shot execution pulse. Uses
 * --node-pulse-color so it reads on any theme background.
 * ========================================================================== */
/* One-shot success confirmation for canvas nodes (base.css `.completed`
   rule). Holds the success ring briefly, then fades to nothing — terminal
   statuses persist in the store, so without the fade every completed
   agent/tool node kept its green ring until the next run. */
@keyframes node-completed-fade {
  0%, 45% {
    box-shadow:
      0 0 0 1px var(--success),
      0 0 14px color-mix(in srgb, var(--success) var(--tint-glow), transparent);
  }
  100% {
    box-shadow:
      0 0 0 1px transparent,
      0 0 14px transparent;
  }
}

@keyframes trigger-listening {
  0%, 100% {
    box-shadow:
      0 0 0 0 color-mix(in srgb, var(--node-pulse-color, var(--info)) 0%, transparent),
      0 0 9px 1px color-mix(in srgb, var(--node-pulse-color, var(--info)) 38%, transparent);
  }
  50% {
    box-shadow:
      0 0 0 6px color-mix(in srgb, var(--node-pulse-color, var(--info)) 20%, transparent),
      0 0 20px 4px color-mix(in srgb, var(--node-pulse-color, var(--info)) 55%, transparent);
  }
}
/* One-shot bright flash the moment a trigger fires (add, remove on animationend). */
@keyframes trigger-fire {
  0% {
    box-shadow:
      0 0 0 0 color-mix(in srgb, var(--node-pulse-color, var(--info)) 90%, transparent),
      0 0 28px 8px color-mix(in srgb, var(--node-pulse-color, var(--info)) 70%, transparent);
  }
  100% {
    box-shadow:
      0 0 0 14px color-mix(in srgb, var(--node-pulse-color, var(--info)) 0%, transparent),
      0 0 28px 8px color-mix(in srgb, var(--node-pulse-color, var(--info)) 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; } }

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

/* Executing node — reads the active 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 waiting for events — continuous armed heartbeat (slower than the
 * execution pulse so the two states read as distinct). */
.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; }

/* ============================================================================
 * Chat (design handoff chat/, 2026-10-03). Durations are --dur-* tokens in
 * base.css. Spinners and the live ring reuse the global `spin` keyframes;
 * blinking pips reuse opencompany-pip-blink above.
 * ========================================================================== */

/* A gradient sweeping across: skeleton lines, slots and the "Working…" label. */
@keyframes opencompany-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
/* The dot that follows text while a reply streams. */
@keyframes opencompany-caret-pulse { 0%, 100% { transform: scale(0.7); opacity: 0.55; } 50% { transform: scale(1); opacity: 1; } }
/* The three dots of the status line. */
@keyframes opencompany-dots { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
/* BarChart bars growing from their start. */
@keyframes opencompany-grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
/* A stroke drawing itself (paths with stroke-dasharray 24). */
@keyframes opencompany-draw { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }

.opencompany-spinner { animation: spin var(--dur-spinner, 800ms) linear infinite; }
/* A 2px ring around a working employee's avatar; place it at inset -3px. */
.opencompany-live-ring {
  background: conic-gradient(from 0deg, var(--action-tools-ink), transparent 35%, var(--action-save-ink) 65%, var(--action-tools-ink));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), black calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), black calc(100% - 2px));
  animation: spin var(--dur-live-ring, 1200ms) linear infinite;
}
.opencompany-shimmer {
  background: linear-gradient(90deg, var(--bg-active) 0%, var(--bg-hover) 40%, var(--action-tools-soft) 50%, var(--bg-hover) 60%, var(--bg-active) 100%);
  background-size: 200% 100%;
  animation: opencompany-shimmer var(--dur-shimmer, 1600ms) linear infinite;
}
/* The dashed placeholder where the next generated-UI element will land. */
.opencompany-shimmer-slot {
  background: linear-gradient(90deg, transparent 0%, var(--bg-hover) 45%, var(--node-agent-soft) 50%, var(--bg-hover) 55%, transparent 100%);
  background-size: 200% 100%;
  animation: opencompany-shimmer var(--dur-shimmer, 1600ms) linear infinite;
}
.opencompany-shimmer-text {
  background: linear-gradient(90deg, var(--fg-faint) 0%, var(--fg-default) 50%, var(--fg-faint) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: opencompany-shimmer var(--dur-shimmer-text, 1800ms) linear infinite;
}
.opencompany-caret { animation: opencompany-caret-pulse var(--dur-caret, 1000ms) ease-in-out infinite; }
.opencompany-dots > * { animation: opencompany-dots var(--dur-dots, 1200ms) ease infinite; }
.opencompany-dots > :nth-child(2) { animation-delay: 150ms; }
.opencompany-dots > :nth-child(3) { animation-delay: 300ms; }
.opencompany-grow {
  transform-origin: left center;
  animation: opencompany-grow-x var(--dur-bar-grow, 900ms) var(--ease-spring) both;
}
.opencompany-draw {
  stroke-dasharray: 24;
  animation: opencompany-draw var(--dur-check-draw, 420ms) var(--ease-spring) both;
}

/* ============================================================================
 * Onboarding (design handoff onboarding, 2026-10-08).
 * ========================================================================== */

/* A hard on/off blink: the typing caret in the Welcome guide's demo. */
@keyframes opencompany-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.opencompany-caret-blink { animation: opencompany-blink var(--dur-caret, 1000ms) steps(1) infinite; }
/* The slower ring spinner: a new employee starting up. */
.opencompany-spinner-slow { animation: spin var(--dur-live-ring, 1200ms) linear infinite; }

@media (prefers-reduced-motion: reduce) {
  .opencompany-pulse,
  .opencompany-trigger-armed, .opencompany-trigger-fire, .opencompany-bolt, .opencompany-pip-pulse,
  .opencompany-spinner, .opencompany-live-ring, .opencompany-shimmer, .opencompany-shimmer-slot,
  .opencompany-shimmer-text, .opencompany-caret, .opencompany-dots > *, .opencompany-grow,
  .opencompany-draw, .opencompany-caret-blink, .opencompany-spinner-slow { animation: none !important; }
}