{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "components-image-zoom",
  "type": "registry:component",
  "title": "Image zoom",
  "description": "A frame whose picture magnifies under the pointer",
  "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/image-zoom.tsx",
      "target": "@ui/gpuixui/components/image-zoom.tsx",
      "type": "registry:component",
      "content": "/** @jsxImportSource @gpuix/react */\nimport type { EventPayload, Props } from \"@gpuix/react\";\nimport {\n  mergeStyles,\n  resolveStyle,\n  type StateStyle,\n} from \"@gpuix/react/floating\";\nimport type { MotionLevel } from \"../motion/timing.js\";\nimport { cn } from \"../tw/index.js\";\nimport * as Option from \"effect/Option\";\nimport {\n  zoomFollow,\n  zoomFrames,\n  zoomGeometry,\n  zoomRest,\n} from \"./image-zoom/logic.js\";\nimport { makeZoomStore } from \"./image-zoom/store.js\";\nimport { send, useLocalState, useLocalStore } from \"./internal/local-state.js\";\nimport { measuredPoint } from \"./internal/measure.js\";\nimport { nameOf } from \"./internal/text.js\";\nimport { useMotionPreference, useSurfaceTiming } from \"./internal/presence.js\";\nimport { recipeStyle } from \"./internal/recipe.js\";\nimport { surfaceOriginStyle, useSurfaceBox } from \"./internal/surface-box.js\";\nimport { useTheme, type Theme } from \"./internal/theme.js\";\n\nconst PICTURE_NAME = \"Picture\";\n\nconst cornerOf = (radius: Option.Option<number>, theme: Theme): number =>\n  Option.match(radius, {\n    onNone: () => theme.radius.md,\n    onSome: (value) =>\n      Number.isFinite(value) && value >= 0 ? value : theme.radius.md,\n  });\n\nexport interface ImageZoomState {\n  readonly zoomed: boolean;\n  readonly reducedMotion: boolean;\n}\n\nexport interface ImageZoomProps extends Omit<Props, \"children\" | \"style\"> {\n  readonly src: string;\n\n  readonly alt: string;\n\n  readonly width?: number;\n\n  readonly height?: number;\n\n  readonly scale?: number;\n\n  readonly radius?: number;\n\n  readonly level?: MotionLevel;\n\n  readonly className?: string;\n\n  readonly style?: StateStyle<ImageZoomState>;\n}\n\nexport const ImageZoom = ({\n  src,\n  alt,\n  width,\n  height,\n  scale,\n  radius,\n  level = \"normal\",\n  className,\n  style,\n  onMouseMove,\n  onMouseLeave,\n  onLayout,\n  ...rest\n}: ImageZoomProps) => {\n  const theme = useTheme();\n  const preference = useMotionPreference();\n  const timing = useSurfaceTiming(level).enter;\n  const geometry = zoomGeometry({\n    width: Option.fromNullishOr(width),\n    height: Option.fromNullishOr(height),\n    scale: Option.fromNullishOr(scale),\n  });\n  const store = useLocalStore(makeZoomStore);\n  const pointer = useLocalState(store.local);\n  const surface = useSurfaceBox();\n\n  const box = Option.match(Option.all({ pointer, surface: surface.box }), {\n    onNone: () => zoomRest(geometry),\n    onSome: ({ pointer, surface }) => zoomFollow(geometry, surface, pointer),\n  });\n\n  const measure = (event: EventPayload) => {\n    surface.measure(event);\n    onLayout?.(event);\n  };\n\n  const follow = (event: EventPayload) => {\n    onMouseMove?.(event);\n    surface.read();\n    Option.match(measuredPoint(event), {\n      onNone: () => undefined,\n      onSome: (point) => send(store.follow(point)),\n    });\n  };\n\n  const leave = (event: EventPayload) => {\n    onMouseLeave?.(event);\n    send(store.leave);\n  };\n\n  const corner = cornerOf(Option.fromNullishOr(radius), theme);\n  const pictureName = nameOf(alt) ?? PICTURE_NAME;\n  const state: ImageZoomState = {\n    zoomed: Option.isSome(pointer) && geometry.scale > 1,\n    reducedMotion: preference === \"reduced\",\n  };\n\n  return (\n    <div\n      {...rest}\n      onMouseMove={follow}\n      onMouseLeave={leave}\n      onLayout={measure}\n      style={mergeStyles(\n        mergeStyles(\n          {\n            position: \"relative\",\n            overflow: \"hidden\",\n            width: geometry.frameWidth,\n            height: geometry.frameHeight,\n            borderRadius: corner,\n          },\n          recipeStyle(cn(className), theme),\n        ),\n        resolveStyle(style, state),\n      )}\n    >\n      <div\n        style={surfaceOriginStyle(surface.nudge)}\n        onLayout={surface.noteOrigin}\n      />\n      <img\n        testId=\"image-zoom-image\"\n        src={src}\n        alt={pictureName}\n        objectFit=\"cover\"\n        motion={{\n          initial: false,\n          animate: zoomFrames(box),\n          transition: timing,\n        }}\n        style={{\n          position: \"absolute\",\n          borderRadius: corner,\n          pointerEvents: \"none\",\n        }}\n      />\n    </div>\n  );\n};\n\nexport const imageZoomMeta = {\n  name: \"Image zoom\",\n  tier: 5,\n  status: \"done\",\n  gpuixSupport: \"partial\",\n  limitations: [\n    \"the magnification is a box the picture scales itself into plus a left/top pan, not a transform: the runtime has no transform (upstream issue #102)\",\n    \"the pointer drives it; there is no wheel, pinch or drag-to-pan gesture, and the image publishes one image node with no tab stop\",\n    \"the frame is fixed: a responsive gallery passes a measured width and height rather than a percentage\",\n    \"the pan follows the box the frame reported; a 1px probe at its origin re-reports it on every pointer read, because onLayout reports a size change and not a move\",\n    \"a magnified picture shows the buffer the host decoded, so a very large factor is soft where the source is small\",\n  ],\n  docs: \"docs/image-zoom.mdx\",\n  example: \"examples/image-zoom.example.tsx\",\n  testFile: \"src/behaviour/image-zoom.test.tsx\",\n} as const;\n"
    },
    {
      "path": "packages/components/src/image-zoom/logic.ts",
      "target": "@ui/gpuixui/components/image-zoom/logic.ts",
      "type": "registry:lib",
      "content": "import type { MotionStyle } from \"@gpuix/react\";\nimport * as Option from \"effect/Option\";\n\nexport interface ZoomSize {\n  readonly width: number;\n  readonly height: number;\n}\n\nexport interface ZoomSurface {\n  readonly x: number;\n  readonly y: number;\n  readonly width: number;\n  readonly height: number;\n}\n\nexport interface ZoomPointer {\n  readonly x: number;\n  readonly y: number;\n}\n\nexport interface ZoomBox {\n  readonly left: number;\n  readonly top: number;\n  readonly width: number;\n  readonly height: number;\n}\n\nexport interface ZoomGeometry {\n  readonly frameWidth: number;\n  readonly frameHeight: number;\n  readonly scale: number;\n}\n\nexport const imageZoomFrame: ZoomSize = { width: 240, height: 160 };\n\nexport const imageZoomScale = 1.6;\n\nexport const imageZoomMaxScale = 4;\n\nexport const zoomRest = (geometry: ZoomGeometry): ZoomBox => ({\n  left: 0,\n  top: 0,\n  width: geometry.frameWidth,\n  height: geometry.frameHeight,\n});\n\nconst usable = (\n  value: Option.Option<number>,\n  low: number,\n  fallback: number,\n): number =>\n  Option.match(value, {\n    onNone: () => fallback,\n    onSome: (number) =>\n      Number.isFinite(number) && number >= low ? number : fallback,\n  });\n\nconst finite = (value: Option.Option<number>, fallback: number): number =>\n  Option.match(value, {\n    onNone: () => fallback,\n    onSome: (number) => (Number.isFinite(number) ? number : fallback),\n  });\n\nconst between = (value: number, low: number, high: number): number =>\n  Math.min(high, Math.max(low, value));\n\nconst tenth = (value: number): number => {\n  const rounded = Math.round(value * 10) / 10;\n  return rounded === 0 ? 0 : rounded;\n};\n\nexport const zoomGeometry = (input: {\n  readonly width: Option.Option<number>;\n  readonly height: Option.Option<number>;\n  readonly scale: Option.Option<number>;\n}): ZoomGeometry => ({\n  frameWidth: usable(input.width, 1, imageZoomFrame.width),\n  frameHeight: usable(input.height, 1, imageZoomFrame.height),\n  scale: between(finite(input.scale, imageZoomScale), 1, imageZoomMaxScale),\n});\n\nconst fraction = (offset: number, size: number): number =>\n  size > 0 ? between(offset / size, 0, 1) : 0.5;\n\nexport const zoomFollow = (\n  geometry: ZoomGeometry,\n  frame: ZoomSurface,\n  pointer: ZoomPointer,\n): ZoomBox => {\n  const across = fraction(pointer.x - frame.x, frame.width);\n  const down = fraction(pointer.y - frame.y, frame.height);\n  const width = tenth(geometry.frameWidth * geometry.scale);\n  const height = tenth(geometry.frameHeight * geometry.scale);\n\n  return {\n    left: tenth(-across * (width - geometry.frameWidth)),\n    top: tenth(-down * (height - geometry.frameHeight)),\n    width,\n    height,\n  };\n};\n\nexport const zoomFrames = (box: ZoomBox): MotionStyle => ({\n  left: box.left,\n  top: box.top,\n  width: box.width,\n  height: box.height,\n});\n\nexport const sameZoom = (a: ZoomBox, b: ZoomBox): boolean =>\n  a.left === b.left &&\n  a.top === b.top &&\n  a.width === b.width &&\n  a.height === b.height;\n\nexport const samePointer = (a: ZoomPointer, b: ZoomPointer): boolean =>\n  a.x === b.x && a.y === b.y;\n"
    },
    {
      "path": "packages/components/src/image-zoom/store.ts",
      "target": "@ui/gpuixui/components/image-zoom/store.ts",
      "type": "registry:lib",
      "content": "import { Effect } from \"effect\";\nimport * as Option from \"effect/Option\";\nimport * as SubscriptionRef from \"effect/SubscriptionRef\";\nimport { makeLocalState, type LocalState } from \"../internal/local-state.js\";\nimport { samePointer, type ZoomPointer } from \"./logic.js\";\n\nexport interface ZoomStore {\n  readonly local: LocalState<Option.Option<ZoomPointer>>;\n\n  readonly follow: (point: ZoomPointer) => Effect.Effect<void>;\n\n  readonly leave: Effect.Effect<void>;\n}\n\nexport const makeZoomStore: Effect.Effect<ZoomStore> = Effect.gen(function* () {\n  const local = yield* makeLocalState<Option.Option<ZoomPointer>>(\n    Option.none(),\n  );\n\n  const follow = Effect.fnUntraced(function* (point: ZoomPointer) {\n    const held = yield* SubscriptionRef.get(local.state);\n    if (Option.exists(held, (previous) => samePointer(previous, point))) return;\n    yield* local.write(Option.some(point));\n  });\n\n  const leave = Effect.gen(function* () {\n    const held = yield* SubscriptionRef.get(local.state);\n    if (Option.isNone(held)) return;\n    yield* local.write(Option.none());\n  });\n\n  return { local, follow, leave };\n});\n"
    },
    {
      "path": "packages/components/src/internal/local-state.ts",
      "target": "@ui/gpuixui/components/internal/local-state.ts",
      "type": "registry:lib",
      "content": "import { Effect } from \"effect\";\nimport * as Arr from \"effect/Array\";\nimport * as Duration from \"effect/Duration\";\nimport * as Fiber from \"effect/Fiber\";\nimport * as Option from \"effect/Option\";\nimport * as Ref from \"effect/Ref\";\nimport * as SubscriptionRef from \"effect/SubscriptionRef\";\nimport { useEffect, useState, useSyncExternalStore } from \"react\";\n\nexport interface LocalState<A> {\n  readonly state: SubscriptionRef.SubscriptionRef<A>;\n\n  readonly read: () => A;\n\n  readonly subscribe: (listener: () => void) => () => void;\n\n  readonly write: (next: A) => Effect.Effect<void>;\n\n  readonly after: (\n    millis: number,\n    effect: Effect.Effect<void>,\n  ) => Effect.Effect<void>;\n\n  readonly cancel: Effect.Effect<void>;\n\n  readonly running: () => boolean;\n}\n\nexport const makeLocalState = <A>(initial: A): Effect.Effect<LocalState<A>> =>\n  Effect.gen(function* () {\n    const state = yield* SubscriptionRef.make(initial);\n    const timer = yield* Ref.make(Option.none<Fiber.Fiber<void>>());\n    const listeners = yield* Ref.make<ReadonlyArray<() => void>>(Arr.empty());\n\n    const write = Effect.fnUntraced(function* (next: A) {\n      yield* SubscriptionRef.set(state, next);\n      const subscribers = yield* Ref.get(listeners);\n      yield* Effect.sync(() => {\n        Arr.forEach(subscribers, (listener) => listener());\n      });\n    });\n\n    const cancel = Effect.gen(function* () {\n      const held = yield* Ref.getAndSet(timer, Option.none());\n      yield* Option.match(held, {\n        onNone: () => Effect.void,\n        onSome: Fiber.interrupt,\n      });\n    });\n\n    const after = Effect.fnUntraced(function* (\n      millis: number,\n      effect: Effect.Effect<void>,\n    ) {\n      yield* cancel;\n      const fiber = yield* Effect.forkDetach(\n        Effect.sleep(Duration.millis(millis)).pipe(Effect.andThen(effect)),\n      );\n      yield* Ref.set(timer, Option.some(fiber));\n    });\n\n    const running = (): boolean =>\n      Option.exists(\n        Ref.getUnsafe(timer),\n        (fiber) => fiber.pollUnsafe() === undefined,\n      );\n\n    const subscribe = (listener: () => void): (() => void) => {\n      Effect.runSync(\n        Ref.update(listeners, (current) => Arr.append(current, listener)),\n      );\n      return () => {\n        Effect.runSync(\n          Ref.update(listeners, (current) =>\n            Arr.filter(current, (held) => held !== listener),\n          ),\n        );\n      };\n    };\n\n    return {\n      state,\n\n      read: () => SubscriptionRef.getUnsafe(state),\n      subscribe,\n      write,\n      after,\n      cancel,\n      running,\n    };\n  });\n\ninterface Teardown {\n  readonly local: { readonly cancel: Effect.Effect<void> };\n}\n\nexport const useLocalStore = <Store extends Teardown>(\n  make: Effect.Effect<Store>,\n): Store => {\n  const [store] = useState(() => Effect.runSync(make));\n  useEffect(() => () => send(store.local.cancel), [store]);\n  return store;\n};\n\nexport const send = (command: Effect.Effect<void>): void => {\n  Effect.runFork(command);\n};\n\nexport const useLocalState = <A>(local: LocalState<A>): A =>\n  useSyncExternalStore(local.subscribe, local.read, local.read);\n\nexport const useLocalSlice = <A, B>(\n  local: LocalState<A>,\n  select: (state: A) => B,\n): B =>\n  useSyncExternalStore(\n    local.subscribe,\n    () => select(local.read()),\n    () => select(local.read()),\n  );\n"
    },
    {
      "path": "packages/components/src/internal/measure.ts",
      "target": "@ui/gpuixui/components/internal/measure.ts",
      "type": "registry:lib",
      "content": "import type { EventPayload } from \"@gpuix/react\";\nimport * as Option from \"effect/Option\";\n\nexport interface MeasuredBox {\n  readonly x: number;\n  readonly y: number;\n  readonly width: number;\n  readonly height: number;\n}\n\nconst measurable = (value: number | undefined): Option.Option<number> =>\n  Option.filter(Option.fromNullishOr(value), Number.isFinite);\n\nexport const measuredBox = (event: EventPayload): Option.Option<MeasuredBox> =>\n  Option.all({\n    x: measurable(event.x),\n    y: measurable(event.y),\n    width: measurable(event.width),\n    height: measurable(event.height),\n  });\n\nexport const measuredHeight = (event: EventPayload): Option.Option<number> =>\n  measurable(event.height);\n\nexport interface MeasuredPoint {\n  readonly x: number;\n  readonly y: number;\n}\n\nexport const measuredPoint = (\n  event: EventPayload,\n): Option.Option<MeasuredPoint> =>\n  Option.all({\n    x: measurable(event.x),\n    y: measurable(event.y),\n  });\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/surface-box.tsx",
      "target": "@ui/gpuixui/components/internal/surface-box.tsx",
      "type": "registry:component",
      "content": "/** @jsxImportSource @gpuix/react */\nimport type { EventPayload, StyleDesc } from \"@gpuix/react\";\nimport * as Option from \"effect/Option\";\nimport { useRef, useState } from \"react\";\nimport { measuredBox, type MeasuredBox } from \"./measure.js\";\n\nexport interface SurfaceBox {\n  readonly box: Option.Option<MeasuredBox>;\n\n  readonly measure: (event: EventPayload) => void;\n\n  readonly read: () => void;\n\n  readonly nudge: number;\n\n  readonly noteOrigin: (event: EventPayload) => void;\n}\n\nexport const surfaceOriginStyle = (nudge: number): StyleDesc => ({\n  position: \"absolute\",\n  left: 0,\n  top: 0,\n  width: 1 + nudge,\n  height: 1,\n  pointerEvents: \"none\",\n});\n\nexport const useSurfaceBox = (): SurfaceBox => {\n  const size = useRef<Option.Option<MeasuredBox>>(Option.none());\n  const origin = useRef<Option.Option<MeasuredBox>>(Option.none());\n  const [box, setBox] = useState<Option.Option<MeasuredBox>>(Option.none());\n  const [nudge, setNudge] = useState(0);\n\n  const publish = () => {\n    setBox(\n      Option.map(\n        Option.all({ origin: origin.current, size: size.current }),\n        ({ origin, size }) => ({\n          x: origin.x,\n          y: origin.y,\n          width: size.width,\n          height: size.height,\n        }),\n      ),\n    );\n  };\n\n  const measure = (event: EventPayload) => {\n    Option.match(measuredBox(event), {\n      onNone: () => undefined,\n      onSome: (next) => {\n        size.current = Option.some(next);\n        publish();\n      },\n    });\n  };\n\n  const noteOrigin = (event: EventPayload) => {\n    Option.match(measuredBox(event), {\n      onNone: () => undefined,\n      onSome: (next) => {\n        origin.current = Option.some(next);\n        publish();\n      },\n    });\n  };\n\n  const read = () => setNudge((value) => (value === 0 ? 1 : 0));\n\n  return { box, measure, read, nudge, noteOrigin };\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"
    }
  ],
  "docs": "[Image zoom](https://gpuixui.sudokw.com/components/image-zoom) — 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/image-zoom",
    "kind": "component",
    "runtime": "gpuix",
    "registry": "gpuixui"
  }
}