{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "components-shimmer",
  "type": "registry:component",
  "title": "Shimmer",
  "description": "A travelling highlight painted into text, or a surface band over children the runtime cannot recolour",
  "author": "sudo-kw <https://github.com/sudo-kw>",
  "dependencies": [
    "@gpuix/native@0.11.0",
    "@gpuix/react@0.11.0",
    "effect@4.1.2",
    "react@^19.2.4"
  ],
  "registryDependencies": [
    "https://gpuixui.sudokw.com/gpuix-motion.json",
    "https://gpuixui.sudokw.com/gpuix-tokens.json",
    "https://gpuixui.sudokw.com/gpuix-tw.json"
  ],
  "files": [
    {
      "path": "packages/components/src/gradient-text/logic.ts",
      "target": "@ui/gpuixui/components/gradient-text/logic.ts",
      "type": "registry:lib",
      "content": "import * as Arr from \"effect/Array\";\nimport * as Option from \"effect/Option\";\nimport * as Result from \"effect/Result\";\nimport * as Str from \"effect/String\";\n\nexport interface HexColor {\n  readonly red: number;\n  readonly green: number;\n  readonly blue: number;\n  readonly alpha: number;\n}\n\nconst HEX = /^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;\n\nconst byteAt = (digits: string, index: number, width: number): number => {\n  const start = index * width;\n  const part = Str.slice(start, start + width)(digits);\n  return Number.parseInt(width === 1 ? `${part}${part}` : part, 16);\n};\n\nexport const parseHexColor = (value: string): Option.Option<HexColor> =>\n  Option.flatMap(Option.fromNullishOr(HEX.exec(value)), (match) => {\n    const digits = Str.toLowerCase(match[1] ?? \"\");\n    const width = digits.length <= 4 ? 1 : 2;\n    return Option.some({\n      red: byteAt(digits, 0, width),\n      green: byteAt(digits, 1, width),\n      blue: byteAt(digits, 2, width),\n      alpha:\n        digits.length === 4 || digits.length === 8\n          ? byteAt(digits, 3, width)\n          : 255,\n    });\n  });\n\nconst hexByte = (value: number): string =>\n  Str.padStart(2, \"0\")(Math.round(value).toString(16));\n\nconst writeHex = (color: HexColor): string =>\n  `#${hexByte(color.red)}${hexByte(color.green)}${hexByte(color.blue)}${\n    color.alpha === 255 ? \"\" : hexByte(color.alpha)\n  }`;\n\nconst clamped = (t: number): number =>\n  Number.isFinite(t) ? Math.min(Math.max(t, 0), 1) : 0;\n\nexport const gradientColor = (start: string, end: string, t: number): string =>\n  Option.match(Option.all([parseHexColor(start), parseHexColor(end)]), {\n    onNone: () => start,\n    onSome: ([from, to]) => {\n      const at = clamped(t);\n      return writeHex({\n        red: from.red + (to.red - from.red) * at,\n        green: from.green + (to.green - from.green) * at,\n        blue: from.blue + (to.blue - from.blue) * at,\n        alpha: from.alpha + (to.alpha - from.alpha) * at,\n      });\n    },\n  });\n\nexport interface GradientGlyph {\n  readonly key: string;\n  readonly text: string;\n  readonly color: string;\n\n  readonly position: number;\n\n  readonly label: Option.Option<string>;\n}\n\nexport interface GradientWord {\n  readonly key: string;\n  readonly label: string;\n  readonly glyphs: ReadonlyArray<GradientGlyph>;\n}\n\nexport interface GradientLine {\n  readonly key: string;\n  readonly words: ReadonlyArray<GradientWord>;\n}\n\nconst wordGlyphs = (\n  word: string,\n  line: number,\n  start: number,\n  total: number,\n  colorAt: (position: number) => string,\n): ReadonlyArray<GradientGlyph> =>\n  Arr.map(Arr.fromIterable(word), (text, local) => {\n    const index = start + local;\n    const position = total <= 1 ? 0 : index / (total - 1);\n    return {\n      key: `${line}:${index}:${text}`,\n      text,\n      color: colorAt(position),\n      position,\n      label: local === 0 ? Option.some(word) : Option.none(),\n    };\n  });\n\nexport const glyphLines = (\n  text: string,\n  colorAt: (position: number) => string,\n): ReadonlyArray<GradientLine> =>\n  Arr.filterMap(\n    Arr.map(Str.split(text, \"\\n\"), (line, index) => ({\n      index,\n      words: Arr.filter(Str.split(line, /\\s+/), Str.isNonEmpty),\n    })),\n    ({ index, words }) =>\n      Arr.match(words, {\n        onEmpty: () => Result.failVoid,\n        onNonEmpty: (present) => {\n          const total = Arr.reduce(\n            present,\n            0,\n            (count, word) => count + Arr.length(Arr.fromIterable(word)),\n          );\n          const placed = Arr.mapAccum(present, 0, (start, word) => [\n            start + Arr.length(Arr.fromIterable(word)),\n            {\n              key: `${index}:${start}:${word}`,\n              label: word,\n              glyphs: wordGlyphs(word, index, start, total, colorAt),\n            },\n          ]);\n          return Result.succeed({ key: String(index), words: placed[1] });\n        },\n      }),\n  );\n\nexport const gradientLines = (\n  text: string,\n  from: string,\n  to: string,\n): ReadonlyArray<GradientLine> =>\n  glyphLines(text, (position) => gradientColor(from, to, position));\n\nexport const glyphCount = (lines: ReadonlyArray<GradientLine>): number =>\n  Arr.reduce(\n    lines,\n    0,\n    (count, line) =>\n      count +\n      Arr.reduce(line.words, 0, (inLine, word) => inLine + word.glyphs.length),\n  );\n"
    },
    {
      "path": "packages/components/src/gradient/logic.ts",
      "target": "@ui/gpuixui/components/gradient/logic.ts",
      "type": "registry:lib",
      "content": "import type { LinearGradientBackground } from \"@gpuix/react\";\nimport * as Option from \"effect/Option\";\nimport { durationOf, paintable } from \"../internal/scatter.js\";\n\nexport const gradientBaseAngle = 135;\n\nexport const gradientBaseShift = 90;\n\nexport const gradientLegMs = 6_000;\n\nexport const gradientLegFloor = 400;\n\nexport const gradientLegCap = 60_000;\n\nexport const oneTurn = (degrees: number): number =>\n  ((degrees % 360) + 360) % 360;\n\nexport const angleOf = (angle: Option.Option<number>): number =>\n  Option.getOrElse(\n    Option.map(\n      Option.filter(angle, (value) => Number.isFinite(value)),\n      oneTurn,\n    ),\n    () => gradientBaseAngle,\n  );\n\nexport const shiftOf = (shift: Option.Option<number>): number =>\n  Option.getOrElse(\n    Option.map(\n      Option.filter(shift, (value) => Number.isFinite(value)),\n      oneTurn,\n    ),\n    () => gradientBaseShift,\n  );\n\nexport const breathesAtAll = (shift: number): boolean =>\n  Number.isFinite(shift) && oneTurn(shift) !== 0;\n\nexport const legOf = (leg: Option.Option<number>): number =>\n  durationOf(leg, gradientLegMs, gradientLegFloor, gradientLegCap);\n\nexport const radiusOf = (radius: Option.Option<number>): number =>\n  Option.getOrElse(\n    Option.filter(radius, (value) => paintable(value) && value <= 10_000),\n    () => 0,\n  );\n\nexport const rampOf = (\n  from: string,\n  to: string,\n  angle: number,\n): LinearGradientBackground => ({\n  type: \"linear-gradient\",\n  angle: oneTurn(angle),\n  stops: [\n    { color: from, position: 0 },\n    { color: to, position: 1 },\n  ],\n});\n\nexport const shiftedRampOf = (\n  from: string,\n  to: string,\n  angle: number,\n  shift: number,\n): LinearGradientBackground => rampOf(from, to, angle + shift);\n"
    },
    {
      "path": "packages/components/src/internal/presence.tsx",
      "target": "@ui/gpuixui/components/internal/presence.tsx",
      "type": "registry:component",
      "content": "/** @jsxImportSource @gpuix/react */\nimport type { MotionProps } from \"@gpuix/react\";\nimport {\n  delayedTiming,\n  exitWindowMs,\n  fadeFrom,\n  fadeFromAnchor,\n  fadeFromSide,\n  fadeOnly,\n  presenceMotion as motionOfPresence,\n  presenceStyle,\n  transitionWindowMs,\n  type PresenceFrames,\n  type PresenceHitRule,\n  type PresenceSide,\n  type PresenceTiming,\n  type PresenceTransition,\n} from \"../../motion/presence.js\";\nimport {\n  MotionProvider,\n  useMotionPreference,\n  useSurfacePresence,\n  useSurfaceTiming,\n  type MotionProviderProps,\n  type SurfacePresence,\n} from \"../../motion/react/presence.js\";\nimport {\n  motionTiming,\n  type MotionLevel,\n  type MotionPreference,\n} from \"../../motion/timing.js\";\n\nexport { MotionProvider, useMotionPreference, type MotionProviderProps };\n\nexport type SurfaceFrames = PresenceFrames;\n\nexport type SurfaceTiming = PresenceTiming;\n\nexport type PanelSide = PresenceSide;\n\nexport {\n  delayedTiming,\n  exitWindowMs,\n  fadeFrom,\n  fadeFromAnchor,\n  fadeFromSide,\n  fadeOnly,\n  presenceStyle,\n  transitionWindowMs,\n};\nexport type { PresenceHitRule };\n\nexport { useSurfacePresence, useSurfaceTiming, type SurfacePresence };\n\nexport const moveTiming = (\n  level: MotionLevel,\n  preference: MotionPreference,\n): PresenceTransition => motionTiming(level, { phase: \"standard\", preference });\n\nexport const useMoveTiming = (level: MotionLevel): PresenceTransition =>\n  moveTiming(level, useMotionPreference());\n\nexport const presenceMotion = (\n  frames: SurfaceFrames,\n  presence: SurfacePresence,\n  timing: SurfaceTiming = presence.timing,\n): MotionProps => motionOfPresence(frames, presence.present, timing);\n\nexport const PresenceShield = ({ present }: { readonly present: boolean }) =>\n  present ? null : (\n    <div\n      testId=\"presence-shield\"\n      style={{ position: \"absolute\", top: 0, right: 0, bottom: 0, left: 0 }}\n    />\n  );\n\nexport const presenceTabStop = (\n  present: boolean,\n): { readonly tabIndex?: number } => (present ? {} : { tabIndex: -1 });\n"
    },
    {
      "path": "packages/components/src/internal/recipe.ts",
      "target": "@ui/gpuixui/components/internal/recipe.ts",
      "type": "registry:lib",
      "content": "import type { StyleDesc } from \"@gpuix/react\";\nimport { createRecipeCache } from \"../../tw/index.js\";\nimport type { Theme } from \"./theme.js\";\n\nexport const recipeStyle: (recipe: string, theme: Theme) => StyleDesc =\n  createRecipeCache(512);\n"
    },
    {
      "path": "packages/components/src/internal/scatter.ts",
      "target": "@ui/gpuixui/components/internal/scatter.ts",
      "type": "registry:lib",
      "content": "import * as Option from \"effect/Option\";\n\nexport const seededUnit = (\n  seed: number,\n  index: number,\n  slot: number,\n): number => {\n  let value =\n    Math.imul(seed ^ 0x9e3779b9, 0x85ebca6b) ^\n    Math.imul((index + 1) * 8 + slot, 0xc2b2ae35);\n  value ^= value >>> 15;\n  value = Math.imul(value, 0x2c1b3c6d);\n  value ^= value >>> 13;\n  return (value >>> 0) / 0x100000000;\n};\n\nexport const tenth = (value: number): number => Math.round(value * 10) / 10;\n\nexport const paintable = (value: number): boolean =>\n  Number.isFinite(value) && value > 0;\n\nexport const seedOf = (seed: Option.Option<number>): number =>\n  Option.getOrElse(\n    Option.filter(seed, (value) => Number.isFinite(value)),\n    () => 1,\n  );\n\nexport const countOf = (\n  count: Option.Option<number>,\n  fallback: number,\n  cap: number,\n): number =>\n  Option.getOrElse(\n    Option.map(\n      Option.filter(count, (value) => Number.isFinite(value) && value >= 0),\n      (value) => Math.min(Math.round(value), cap),\n    ),\n    () => fallback,\n  );\n\nexport const sizeRangeOf = (\n  min: Option.Option<number>,\n  max: Option.Option<number>,\n  fallbackMin: number,\n  fallbackMax: number,\n): { readonly min: number; readonly max: number } => {\n  const floor = sizeOf(min, fallbackMin);\n  const ceiling = sizeOf(max, fallbackMax);\n  return floor <= ceiling\n    ? { min: floor, max: ceiling }\n    : { min: ceiling, max: floor };\n};\n\nconst sizeOf = (size: Option.Option<number>, fallback: number): number =>\n  Option.getOrElse(\n    Option.map(\n      Option.filter(size, (value) => Number.isFinite(value) && value >= 1),\n      Math.round,\n    ),\n    () => fallback,\n  );\n\nexport const durationOf = (\n  duration: Option.Option<number>,\n  fallback: number,\n  floor: number,\n  cap: number,\n): number =>\n  Option.getOrElse(\n    Option.map(\n      Option.filter(\n        duration,\n        (value) => Number.isFinite(value) && value >= floor,\n      ),\n      (value) => Math.min(Math.round(value), cap),\n    ),\n    () => fallback,\n  );\n"
    },
    {
      "path": "packages/components/src/internal/text.ts",
      "target": "@ui/gpuixui/components/internal/text.ts",
      "type": "registry:lib",
      "content": "import { pipe } from \"effect\";\nimport * as Option from \"effect/Option\";\nimport * as Str from \"effect/String\";\n\nexport const textOf = (value: unknown): string =>\n  typeof value === \"string\" ? value : \"\";\n\nexport const nameOf = (value: unknown): string | undefined =>\n  pipe(\n    Option.some(textOf(value)),\n    Option.map(Str.trim),\n    Option.filter(Str.isNonEmpty),\n    Option.getOrUndefined,\n  );\n"
    },
    {
      "path": "packages/components/src/internal/theme.ts",
      "target": "@ui/gpuixui/components/internal/theme.ts",
      "type": "registry:lib",
      "content": "import type { StyleDesc } from \"@gpuix/react\";\nimport * as Schema from \"effect/Schema\";\nimport {\n  alpha,\n  avatarPixels,\n  avatarSize,\n  brandTextOn,\n  controlFocusRing,\n  controlHeight,\n  controlPaddingX,\n  currentPlatform,\n  darkTheme,\n  disabledAction,\n  disabledOpacity,\n  elevationShadow,\n  filledHover,\n  filledPressed,\n  findHighlight,\n  focusRing,\n  keyboardFocusRing,\n  lightTheme,\n  nativeTextTheme,\n  pointerWash,\n  selectionOn,\n  statusTone,\n  syntaxColors,\n  targetSize,\n  textStyle,\n  type BoxShadow,\n  type ElevationLevel,\n  type FindHighlightSource,\n  type NativeTextFill,\n  type PlatformName,\n  type PointerWashSurface,\n  type StatusTone,\n  type SyntaxColors,\n  type SyntaxRole,\n  type TextRole,\n  type Theme,\n  type ThemeColors,\n} from \"../../tokens/index.js\";\n\nexport {\n  alpha,\n  avatarPixels,\n  avatarSize,\n  controlFocusRing,\n  controlHeight,\n  controlPaddingX,\n  currentPlatform,\n  darkTheme,\n  disabledAction,\n  disabledOpacity,\n  elevationShadow,\n  filledHover,\n  filledPressed,\n  findHighlight,\n  focusRing,\n  keyboardFocusRing,\n  lightTheme,\n  nativeTextTheme,\n  statusTone,\n  syntaxColors,\n  targetSize,\n  textStyle,\n};\nexport type {\n  BoxShadow,\n  ElevationLevel,\n  FindHighlightSource,\n  NativeTextFill,\n  PlatformName,\n  StatusTone,\n  SyntaxColors,\n  SyntaxRole,\n  TextRole,\n  Theme,\n};\nexport { ThemeProvider, useTheme } from \"../../tokens/react.js\";\n\nexport const keyboardRing = (theme: Theme, invalid = false): StyleDesc =>\n  controlFocusRing(theme, { invalid }) ?? {};\n\nexport interface ControlRingState {\n  readonly disabled?: boolean;\n\n  readonly invalid?: boolean;\n}\n\nexport const controlRing = (\n  theme: Theme,\n  state: ControlRingState = {},\n): StyleDesc => controlFocusRing(theme, state) ?? {};\n\nexport const pressWash = (theme: Theme, replaced: PointerWashSurface): string =>\n  pointerWash(theme, \"active\", replaced) ?? theme.colors.active;\n\nexport const selectionWash = (theme: Theme): StyleDesc => ({\n  selectionColor: theme.colors.selection,\n});\n\nexport const keepContent: StyleDesc = { keyboardFocusDim: false };\n\nexport const disabledFade = (\n  disabled: boolean,\n): { readonly opacity: number } | undefined =>\n  disabled ? { opacity: disabledOpacity } : undefined;\n\nconst Tones = Schema.Literals([\"info\", \"success\", \"warning\", \"danger\"]);\n\nexport type Tone = typeof Tones.Type;\n\nexport const toneOf = (value: unknown): Tone =>\n  Schema.is(Tones)(value) ? value : \"info\";\n\nexport interface ToneStyle {\n  readonly fg: string;\n  readonly bg: string;\n  readonly border: string;\n}\n\nconst TOKEN_TONE: Readonly<Record<Tone, StatusTone>> = {\n  info: \"info\",\n  success: \"success\",\n  warning: \"warning\",\n  danger: \"destructive\",\n};\n\nexport const tone = (theme: Theme, value: Tone): ToneStyle => {\n  const { background, border, foreground } = statusTone(\n    theme,\n    TOKEN_TONE[value],\n  );\n  return { bg: background, border, fg: foreground };\n};\n\nconst softRoles: Readonly<Record<Tone, keyof ThemeColors>> = {\n  info: \"infoSoft\",\n  success: \"successSoft\",\n  warning: \"warningSoft\",\n  danger: \"destructiveSoft\",\n};\n\nexport const messageLink = (theme: Theme, value: Tone): string =>\n  brandTextOn(theme, softRoles[value]);\n\nexport const messageSelection = (theme: Theme, value: Tone): string =>\n  selectionOn(theme, softRoles[value]);\n\nexport const toneSurface = (theme: Theme, value: Tone): StyleDesc => {\n  const { bg, border, fg } = tone(theme, value);\n  return {\n    backgroundColor: bg,\n    color: fg,\n    borderWidth: theme.borderWidth.thin,\n    borderColor: border,\n  };\n};\n"
    },
    {
      "path": "packages/components/src/shimmer.tsx",
      "target": "@ui/gpuixui/components/shimmer.tsx",
      "type": "registry:component",
      "content": "/** @jsxImportSource @gpuix/react */\nimport type { Props } from \"@gpuix/react\";\nimport {\n  mergeStyles,\n  resolveStyle,\n  type StateStyle,\n} from \"@gpuix/react/floating\";\nimport { reducedMotionOf } from \"../motion/timing.js\";\nimport { cn } from \"../tw/index.js\";\nimport * as Arr from \"effect/Array\";\nimport * as Option from \"effect/Option\";\nimport type { ReactElement, ReactNode } from \"react\";\nimport { useEffect, useState } from \"react\";\nimport type { GradientLine } from \"./gradient-text/logic.js\";\nimport { rampOf } from \"./gradient/logic.js\";\nimport { useMotionPreference } from \"./internal/presence.js\";\nimport { recipeStyle } from \"./internal/recipe.js\";\nimport { nameOf, textOf } from \"./internal/text.js\";\nimport {\n  alpha,\n  textStyle,\n  useTheme,\n  type TextRole,\n  type Theme,\n} from \"./internal/theme.js\";\nimport {\n  SHIMMER_STEPS,\n  shimmerFrame,\n  shimmerInterval,\n  shimmerLines,\n} from \"./shimmer/logic.js\";\n\nexport type ShimmerAccent = \"foreground\" | \"primary\" | \"muted\";\n\nexport interface ShimmerState {\n  readonly peak: number;\n  readonly reducedMotion: boolean;\n  readonly active: boolean;\n}\n\nexport interface ShimmerProps extends Omit<Props, \"children\" | \"style\"> {\n  readonly children?: ReactNode;\n\n  readonly active?: boolean;\n\n  readonly durationMs?: number;\n\n  readonly accent?: ShimmerAccent;\n\n  readonly role?: TextRole;\n\n  readonly reducedMotion?: boolean;\n\n  readonly label?: string;\n\n  readonly className?: string;\n\n  readonly style?: StateStyle<ShimmerState>;\n}\n\nconst ACCENT_ROLE: Readonly<Record<ShimmerAccent, (theme: Theme) => string>> = {\n  foreground: (theme) => theme.colors.foreground,\n  primary: (theme) => theme.colors.primary,\n  muted: (theme) => theme.colors.mutedForeground,\n};\n\nconst GlyphLine = ({\n  line,\n  metrics,\n  gap,\n}: {\n  readonly line: GradientLine;\n  readonly metrics: ReturnType<typeof textStyle>;\n  readonly gap: number;\n}) => (\n  <div\n    style={{\n      display: \"flex\",\n      flexDirection: \"row\",\n      flexWrap: \"wrap\",\n      alignItems: \"baseline\",\n      columnGap: gap,\n    }}\n  >\n    {line.words.map((word) => (\n      <div\n        key={word.key}\n        style={{\n          display: \"flex\",\n          flexDirection: \"row\",\n          alignItems: \"baseline\",\n        }}\n      >\n        {word.glyphs.map((glyph) => (\n          <text\n            key={glyph.key}\n            {...Option.match(glyph.label, {\n              onNone: () => ({ role: \"presentation\" as const }),\n              onSome: (wordLabel) => ({ \"aria-label\": wordLabel }),\n            })}\n            style={{ ...metrics, color: glyph.color }}\n          >\n            {glyph.text}\n          </text>\n        ))}\n      </div>\n    ))}\n  </div>\n);\n\nexport const Shimmer = ({\n  children,\n  active = true,\n  durationMs = 2_000,\n  accent = \"foreground\",\n  role = \"body\",\n  reducedMotion,\n  label,\n  className,\n  style,\n  ...rest\n}: ShimmerProps): ReactElement => {\n  const theme = useTheme();\n  const reduced = reducedMotionOf(reducedMotion, useMotionPreference());\n  const [step, setStep] = useState(0);\n  const running = active && !reduced;\n\n  useEffect(() => {\n    if (!running) return undefined;\n    const id = setInterval(\n      () => setStep((current) => current + 1),\n      shimmerInterval(durationMs),\n    );\n    return () => clearInterval(id);\n  }, [running, durationMs]);\n\n  const frame = shimmerFrame(running ? step : 0);\n  const ink = ACCENT_ROLE[accent](theme);\n  const name = nameOf(label);\n  const text = typeof children === \"string\" ? textOf(children) : undefined;\n  const metrics = textStyle(theme, role);\n  const lines =\n    text === undefined\n      ? []\n      : shimmerLines(text, theme.colors.mutedForeground, ink, frame);\n\n  return (\n    <div\n      role={name === undefined ? undefined : \"status\"}\n      {...(name === undefined ? {} : { \"aria-label\": name })}\n      {...rest}\n      style={mergeStyles(\n        recipeStyle(cn(\"relative overflow-hidden\", className), theme),\n        resolveStyle(style, {\n          peak: frame.peak,\n          reducedMotion: reduced,\n          active,\n        }),\n      )}\n    >\n      {text === undefined ? (\n        children\n      ) : (\n        <div\n          testId={rest.testId === undefined ? undefined : `${rest.testId}-ink`}\n          style={{ display: \"flex\", flexDirection: \"column\" }}\n        >\n          {lines.map((line) => (\n            <GlyphLine\n              gap={Math.round(metrics.fontSize * 0.3)}\n              key={line.key}\n              line={line}\n              metrics={metrics}\n            />\n          ))}\n        </div>\n      )}\n      {text === undefined && running ? (\n        <div\n          testId={\n            rest.testId === undefined ? undefined : `${rest.testId}-overlay`\n          }\n          style={{\n            position: \"absolute\",\n            top: 0,\n            right: 0,\n            bottom: 0,\n            left: 0,\n            display: \"flex\",\n            flexDirection: \"row\",\n            pointerEvents: \"none\",\n          }}\n        >\n          {Arr.map(Arr.range(0, SHIMMER_STEPS - 1), (index) => (\n            <div\n              key={index}\n              style={{\n                flexGrow: 1,\n                flexBasis: 0,\n                height: \"100%\",\n\n                background: rampOf(\n                  alpha(ink, 0.3 * (frame.alphas[index] ?? 0)),\n                  alpha(ink, 0.3 * (frame.alphas[index + 1] ?? 0)),\n                  90,\n                ),\n              }}\n            />\n          ))}\n        </div>\n      ) : null}\n    </div>\n  );\n};\n\nexport const shimmerMeta = {\n  name: \"Shimmer\",\n  tier: 2,\n  status: \"done\",\n  gpuixSupport: \"partial\",\n  limitations: [\n    \"No mask or background-clip: a text run is inked one code point at a time\",\n    \"A glyph's ink is one colour, so the sheen is discrete at glyph resolution\",\n    \"Children that cannot be recoloured keep the surface band, a different drawing\",\n    \"Reduced motion rests the text and paints no band\",\n  ],\n  docs: \"docs/shimmer.mdx\",\n  example: \"examples/shimmer.example.tsx\",\n  testFile: \"src/behaviour/shimmer.test.tsx\",\n} as const;\n"
    },
    {
      "path": "packages/components/src/shimmer/logic.ts",
      "target": "@ui/gpuixui/components/shimmer/logic.ts",
      "type": "registry:lib",
      "content": "import {\n  glyphLines,\n  gradientColor,\n  type GradientLine,\n} from \"../gradient-text/logic.js\";\n\nexport const SHIMMER_STEPS = 16;\n\nexport const SHIMMER_SPREAD = 3;\n\nexport interface ShimmerFrame {\n  readonly alphas: ReadonlyArray<number>;\n\n  readonly peak: number;\n}\n\nconst positive = (value: number, fallback: number): number =>\n  Number.isFinite(value) && value > 0 ? value : fallback;\n\nexport const shimmerFrame = (\n  step: number,\n  steps = SHIMMER_STEPS,\n  spread = SHIMMER_SPREAD,\n): ShimmerFrame => {\n  const frames = Math.max(2, Math.trunc(positive(steps, SHIMMER_STEPS)));\n  const reach = Math.max(1, positive(spread, SHIMMER_SPREAD));\n  const phase = ((Math.trunc(step) % frames) + frames) % frames;\n  const progress = phase / (frames - 1);\n  const centre = -reach + progress * (frames + reach * 2);\n  const alphas = Array.from({ length: frames + 1 }, (_, index) =>\n    Math.max(0, Math.min(1, 1 - Math.abs(index - centre) / reach)),\n  );\n  return { alphas, peak: Math.max(...alphas) };\n};\n\nexport const SHIMMER_INK = 1;\n\nconst profileAt = (frame: ShimmerFrame, position: number): number => {\n  const last = frame.alphas.length - 1;\n  if (last <= 0) return 0;\n  const at = Math.min(1, Math.max(0, position)) * last;\n  const lower = Math.floor(at);\n  const from = frame.alphas[lower] ?? 0;\n  const to = frame.alphas[lower + 1] ?? from;\n  return from + (to - from) * (at - lower);\n};\n\nexport const shimmerInk = (\n  frame: ShimmerFrame,\n  position: number,\n  from: string,\n  to: string,\n): string => gradientColor(from, to, profileAt(frame, position) * SHIMMER_INK);\n\nexport const shimmerLines = (\n  text: string,\n  from: string,\n  to: string,\n  frame: ShimmerFrame,\n): ReadonlyArray<GradientLine> =>\n  glyphLines(text, (position) => shimmerInk(frame, position, from, to));\n\nexport const shimmerInterval = (\n  durationMs: number,\n  steps = SHIMMER_STEPS,\n): number =>\n  Math.max(\n    1,\n    Math.round(positive(durationMs, 2_000) / positive(steps, SHIMMER_STEPS)),\n  );\n"
    }
  ],
  "docs": "[Shimmer](https://gpuixui.sudokw.com/components/shimmer) — These are GPUix native components: the files render through GPUix's reconciler against `@gpuix/react`, not the DOM, and need the per-platform `@gpuix/native` binding. The CLI installs the `@gpuixui/*` runtime the components import as registry items, so the copied tree resolves on its own; wrap it in `ThemeProvider` before it renders.",
  "meta": {
    "url": "/components/shimmer",
    "kind": "component",
    "runtime": "gpuix",
    "registry": "gpuixui"
  }
}