Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(theme): sweep skeleton shine at an even pace
Josh Corbett63a6ce38e0c6
diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/Skeleton.browser.test.tsx b/invokeai/frontend/webv2/src/platform/ui/theme/Skeleton.browser.test.tsxnew file mode 100644index 0000000000..8a8b7979bc--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/ui/theme/Skeleton.browser.test.tsx@@ -0,0 +1,35 @@+import { ChakraProvider, Skeleton } from '@chakra-ui/react';+import { system } from '@theme/system';+import { act } from 'react';+import { createRoot, type Root } from 'react-dom/client';+import { afterEach, expect, it } from 'vitest';++(globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;++let host: HTMLDivElement | null = null;+let root: Root | null = null;++afterEach(async () => {+ await act(() => root?.unmount());+ host?.remove();+ host = null;+ root = null;+});++it('sweeps its highlight at an even pace', async () => {+ host = document.createElement('div');+ document.body.append(host);+ root = createRoot(host);+ await act(() =>+ root!.render(+ <ChakraProvider value={system}>+ <Skeleton data-testid="skeleton" h="4" w="20" />+ </ChakraProvider>+ )+ );++ const style = getComputedStyle(host.querySelector('[data-testid="skeleton"]')!);+ expect(style.animationName).toBe('bg-position');+ expect(style.animationTimingFunction).toBe('linear');+ expect(style.animationIterationCount).toBe('infinite');+});diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts b/invokeai/frontend/webv2/src/platform/ui/theme/recipes.tsindex 233675c8e1..0a07861162 100644--- a/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts+++ b/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts@@ -852,8 +852,10 @@ export const colorPickerSlotRecipe = defineSlotRecipe({/*** Skeletons sweep a subtle highlight instead of pulsing. The gradient rests on* the same `bg.emphasized` surface the stock pulse used; the band is a small- * fg lift so it stays quiet on every theme. Reduce-motion is handled by the- * global `.chakra-skeleton` animation kill in `system.ts`.+ * fg lift so it stays quiet on every theme. The sweep runs linear: the stock+ * ease-in-out lingers at each end and rushes the middle, which reads as a+ * stutter. Reduce-motion is handled by the global `.chakra-skeleton`+ * animation kill in `system.ts`.*/export const skeletonRecipe = defineRecipe({...chakraRecipes.skeleton,@@ -864,6 +866,7 @@ export const skeletonRecipe = defineRecipe({shine: {...chakraRecipes.skeleton.variants?.variant?.shine,'--duration': '2s',+ animation: 'bg-position var(--duration) linear infinite','--end-color': 'colors.bg.emphasized','--start-color': 'color-mix(in oklab, {colors.fg} 8%, {colors.bg.emphasized})',},