Open source CapCut alternative.
TypeScript
fix(site): skeletons shimmer over any surface
David Lea487af708b17
diff --git a/site/src/app/globals.css b/site/src/app/globals.cssindex b476885e..e5d72105 100644--- a/site/src/app/globals.css+++ b/site/src/app/globals.css@@ -73,6 +73,11 @@--muted-foreground: oklch(0.556 0 0);--accent: oklch(0.97 0 0);--accent-foreground: oklch(0.205 0 0);+ /* Skeleton slab, the tone it breathes to, and the highlight that sweeps+ across it. */+ --skeleton: #eaeaec;+ --skeleton-pulse: #dcdce1;+ --skeleton-highlight: #f5f5f6;--destructive: oklch(0.577 0.245 27.325);--border: oklch(0.922 0 0);--input: oklch(0.922 0 0);@@ -115,6 +120,9 @@--muted-foreground: oklch(0.708 0 0);--accent: oklch(0.269 0 0);--accent-foreground: oklch(0.985 0 0);+ --skeleton: oklch(0.3 0 0);+ --skeleton-pulse: oklch(0.26 0 0);+ --skeleton-highlight: oklch(0.38 0 0);--destructive: oklch(0.704 0.191 22.216);--border: oklch(1 0 0 / 10%);--input: oklch(1 0 0 / 15%);@@ -207,3 +215,54 @@ html.app-surface {opacity: 0;}}++/* Every skeleton in the app: an opaque slab breathing between two neutrals+ with a highlight sweeping across it. The slab animates background-color+ rather than opacity, so a skeleton laid over a dark surface stays a+ skeleton instead of blending into what is underneath. */+@layer base {+ [data-slot="skeleton"] {+ position: relative;+ overflow: hidden;+ animation: cut-skeleton-pulse 1.6s ease-in-out infinite;+ }+}++[data-slot="skeleton"]::after {+ content: "";+ position: absolute;+ inset: 0;+ background: linear-gradient(+ 90deg,+ color-mix(in srgb, var(--skeleton-highlight), transparent 100%) 0%,+ var(--skeleton-highlight) 50%,+ color-mix(in srgb, var(--skeleton-highlight), transparent 100%) 100%+ );+ animation: cut-skeleton-shimmer 1.6s ease-in-out infinite;+}++@keyframes cut-skeleton-shimmer {+ 0% {+ transform: translateX(-100%);+ }+ 100% {+ transform: translateX(100%);+ }+}++@keyframes cut-skeleton-pulse {+ 0%,+ 100% {+ background-color: var(--skeleton);+ }+ 50% {+ background-color: var(--skeleton-pulse);+ }+}++@media (prefers-reduced-motion: reduce) {+ [data-slot="skeleton"],+ [data-slot="skeleton"]::after {+ animation: none;+ }+}diff --git a/site/src/components/ui/skeleton.tsx b/site/src/components/ui/skeleton.tsxindex 3ec6be77..c3806290 100644--- a/site/src/components/ui/skeleton.tsx+++ b/site/src/components/ui/skeleton.tsx@@ -1,10 +1,12 @@import { cn } from "@/lib/utils"+// The slab, its breathing, and the highlight sweeping across it live in+// globals.css keyed on data-slot, so every skeleton in the app shimmers.function Skeleton({ className, ...props }: React.ComponentProps<"div">) {return (<divdata-slot="skeleton"- className={cn("animate-pulse rounded-md bg-accent", className)}+ className={cn("rounded-md bg-[var(--skeleton)]", className)}{...props}/>)diff --git a/site/src/cut/components/Timeline.tsx b/site/src/cut/components/Timeline.tsxindex b048a378..ab995b60 100644--- a/site/src/cut/components/Timeline.tsx+++ b/site/src/cut/components/Timeline.tsx@@ -4111,21 +4111,18 @@ function Filmstrip({// curves/wheels/hue bands show in the preview and exports).const { filter, tint } = gradeCssApprox(grade);// No thumbs yet — the media is still streaming into the browser store. A- // pulsing skeleton fills the box until the strip can draw real frames.+ // placeholder slab fills the box until the strip can draw real frames.if (!frames.length) {if (failed) {return (- <div className="tl-filmstrip-failed pointer-events-none absolute inset-0 bg-white/10" />+ <div className="tl-filmstrip-failed pointer-events-none absolute inset-0 bg-[var(--skeleton)]" />);}- // Both states paint straight onto the clip box's black, in white alphas- // that read the same in either theme. The page-colored tones the stock- // skeleton uses are near-white in the light theme, which covered the box- // in a flat white slab and left the pulse invisible.+ // Both states cover the clip box's black with an opaque neutral slab, so a+ // clip waiting on thumbnails reads as a placeholder against the timeline's+ // chrome.return (- <div className="tl-filmstrip-skeleton pointer-events-none absolute inset-0">- <Skeleton className="size-full rounded-none bg-white/20" />- </div>+ <Skeleton className="tl-filmstrip-skeleton pointer-events-none absolute inset-0 rounded-none" />);}return (