{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "media-crop-area",
  "type": "registry:component",
  "title": "CropArea",
  "description": "A picture with a controlled crop hole and drag handles",
  "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-tokens.json",
    "https://gpuixui.sudokw.com/gpuix-tw.json"
  ],
  "files": [
    {
      "path": "packages/media/src/crop-area.tsx",
      "target": "@ui/gpuixui/media/crop-area.tsx",
      "type": "registry:component",
      "content": "/** @jsxImportSource @gpuix/react */\nimport type { Props, StyleDesc } from \"@gpuix/react\";\nimport { mergeStyles } from \"@gpuix/react/floating\";\nimport { keyboardFocusRing } from \"../tokens/index.js\";\nimport { cn } from \"../tw/index.js\";\nimport * as Option from \"effect/Option\";\nimport { useEffect, useRef, type ReactElement } from \"react\";\nimport {\n  clampCrop,\n  cornerCursor,\n  cornerLabel,\n  cropBars,\n  cropGuides,\n  cropLabel,\n  CROP_HANDLE_SIZE,\n  CROP_MIN_SIZE,\n  CropCorner,\n  CropRect,\n  cropKey,\n  gestureCrop,\n  handleBox,\n  isPrimaryPress,\n  sameCrop,\n  type CropBounds,\n  type CropGesture,\n  type CropModifiers,\n} from \"./crop/logic.js\";\nimport { recipeStyle, useTheme, type Theme } from \"./internal.js\";\nimport { accessibleName, PICTURE_NAME } from \"./name.js\";\n\nexport interface CropAreaSurface {\n  readonly onFrameDown: (event: CropPointer) => void;\n  readonly onFrameMove: (event: CropPointer) => void;\n  readonly onRelease: () => void;\n  readonly onHandleDown: (corner: CropCorner, event: CropPointer) => void;\n  readonly onHandleKey: (corner: CropCorner, event: CropKey) => void;\n}\n\nexport interface CropPointer {\n  readonly x?: number | null;\n  readonly y?: number | null;\n\n  readonly button?: number | null;\n  readonly stopPropagation?: () => void;\n}\n\nexport interface CropKey {\n  readonly key?: string | null;\n  readonly modifiers?: CropModifiers | null;\n  readonly preventDefault?: () => void;\n}\n\nexport interface CropAreaProps extends Omit<Props, \"children\" | \"onChange\"> {\n  readonly src: string;\n\n  readonly alt: string;\n\n  readonly width: number;\n\n  readonly height: number;\n\n  readonly value: CropRect;\n\n  readonly onChange: (crop: CropRect) => void;\n\n  readonly minSize?: number;\n\n  readonly handleSize?: number;\n\n  readonly aspectRatio?: number;\n\n  readonly guides?: boolean;\n\n  readonly label?: string;\n\n  readonly disabled?: boolean;\n  readonly className?: string;\n}\n\nconst CORNERS: ReadonlyArray<CropCorner> = [\"nw\", \"ne\", \"sw\", \"se\"];\n\nconst DEFAULT_LABEL = \"Crop area\";\n\nexport const cropBounds = (width: number, height: number): CropBounds => ({\n  width: Number.isFinite(width) && width > 0 ? width : 0,\n  height: Number.isFinite(height) && height > 0 ? height : 0,\n});\n\nconst absolute = (box: CropRect): StyleDesc => ({\n  position: \"absolute\",\n  left: box.x,\n  top: box.y,\n  width: box.width,\n  height: box.height,\n});\n\nconst guideStyle = (theme: Theme, box: CropRect): StyleDesc => ({\n  ...absolute(box),\n  backgroundColor: theme.colors.background,\n  boxShadow: {\n    offsetX: 0,\n    offsetY: 0,\n    blurRadius: 0,\n    spreadRadius: 1,\n    color: theme.colors.foreground,\n  },\n  pointerEvents: \"none\",\n});\n\nconst handleStyle = (\n  theme: Theme,\n  box: CropRect,\n  corner: CropCorner,\n  disabled: boolean,\n): StyleDesc => ({\n  ...absolute(box),\n  backgroundColor: disabled ? theme.colors.muted : theme.colors.primary,\n  borderWidth: theme.borderWidth.thin,\n  borderStyle: \"solid\",\n  borderColor: theme.colors.background,\n  borderRadius: theme.radius.sm,\n  cursor: disabled ? \"default\" : cornerCursor(corner),\n  ...(disabled ? {} : keyboardFocusRing(theme)),\n});\n\nexport const renderCropArea = (\n  props: CropAreaProps,\n  theme: Theme,\n  surface: CropAreaSurface,\n): ReactElement => {\n  const {\n    src,\n    alt,\n    width,\n    height,\n    value,\n    onChange: _onChange,\n    minSize = CROP_MIN_SIZE,\n    handleSize = CROP_HANDLE_SIZE,\n    aspectRatio,\n    guides = false,\n    label = DEFAULT_LABEL,\n    disabled = false,\n    className,\n    style,\n    ...rest\n  } = props;\n  const name = accessibleName(label, DEFAULT_LABEL);\n\n  const pictureName = accessibleName(alt, PICTURE_NAME);\n\n  const picture = typeof src === \"string\" ? src.trim() : \"\";\n  const bounds = cropBounds(width, height);\n  const crop = clampCrop(value, bounds, minSize, aspectRatio);\n  const bars = cropBars(crop, bounds);\n\n  return (\n    <div\n      {...rest}\n      role=\"group\"\n      aria-label={name}\n      onMouseDown={(event) => {\n        if (!disabled) surface.onFrameDown(event);\n      }}\n      onMouseMove={(event) => {\n        if (!disabled) surface.onFrameMove(event);\n      }}\n      onMouseUp={() => surface.onRelease()}\n      onMouseLeave={() => surface.onRelease()}\n      style={mergeStyles(\n        mergeStyles(recipeStyle(cn(\"rounded-sm\", className), theme), {\n          position: \"relative\",\n          width: bounds.width,\n          height: bounds.height,\n          backgroundColor: theme.colors.card,\n          overflow: \"hidden\",\n          cursor: disabled ? \"default\" : \"move\",\n        }),\n        style,\n      )}\n    >\n      {picture.length === 0 ? null : (\n        <img\n          src={picture}\n          alt={pictureName}\n          objectFit=\"fill\"\n          style={{ width: bounds.width, height: bounds.height }}\n        />\n      )}\n      <>\n        {bars.map((bar) => (\n          <div\n            key={bar.side}\n            testId={`crop-bar-${bar.side}` satisfies string}\n            style={{\n              ...absolute(bar.box),\n              backgroundColor: theme.colors.overlay,\n              pointerEvents: \"none\",\n            }}\n          />\n        ))}\n      </>\n      <>\n        {guides\n          ? cropGuides(crop).map((guide) => (\n              <div\n                key={guide.name}\n                testId={`crop-guide-${guide.name}`}\n                style={guideStyle(theme, guide.box)}\n              />\n            ))\n          : null}\n      </>\n      <>\n        {CORNERS.map((corner) => (\n          <div\n            key={corner}\n            testId={`crop-handle-${corner}`}\n            role=\"slider\"\n            aria-label={`${name} ${cornerLabel(corner)} handle`}\n            aria-valuetext={cropLabel(crop)}\n            tabIndex={disabled ? -1 : 0}\n            onMouseDown={(event) => {\n              if (disabled) return;\n              surface.onHandleDown(corner, event);\n            }}\n            onMouseMove={(event) => {\n              if (!disabled) surface.onFrameMove(event);\n            }}\n            onMouseUp={() => surface.onRelease()}\n            onKeyDown={(event) => {\n              if (!disabled) surface.onHandleKey(corner, event);\n            }}\n            style={handleStyle(\n              theme,\n              handleBox(crop, corner, handleSize, bounds),\n              corner,\n              disabled,\n            )}\n          />\n        ))}\n      </>\n    </div>\n  );\n};\n\nexport const CropArea = (props: CropAreaProps): ReactElement => {\n  const theme = useTheme();\n  const gesture = useRef<Option.Option<CropGesture>>(Option.none());\n\n  useEffect(() => {\n    if (props.disabled === true) gesture.current = Option.none();\n  }, [props.disabled]);\n\n  const bounds = cropBounds(props.width, props.height);\n  const crop = clampCrop(props.value, bounds, props.minSize, props.aspectRatio);\n  const min = props.minSize ?? CROP_MIN_SIZE;\n  const point = (event: CropPointer): { x: number; y: number } => ({\n    x: event.x ?? 0,\n    y: event.y ?? 0,\n  });\n\n  const report = (next: CropRect): void => {\n    if (!sameCrop(next, crop)) props.onChange(next);\n  };\n\n  const surface: CropAreaSurface = {\n    onFrameDown: (event) => {\n      if (!isPrimaryPress(event.button)) return;\n      if (Option.isSome(gesture.current)) return;\n      gesture.current = Option.some({\n        kind: \"move\",\n        start: crop,\n        ...point(event),\n      });\n    },\n    onFrameMove: (event) => {\n      Option.match(gesture.current, {\n        onNone: () => undefined,\n        onSome: (held) => {\n          report(\n            gestureCrop(held, point(event), bounds, min, props.aspectRatio),\n          );\n        },\n      });\n    },\n    onRelease: () => {\n      gesture.current = Option.none();\n    },\n    onHandleDown: (corner, event) => {\n      if (!isPrimaryPress(event.button)) return;\n      event.stopPropagation?.();\n      gesture.current = Option.some({\n        kind: \"corner\",\n        corner,\n        start: crop,\n        ...point(event),\n      });\n    },\n    onHandleKey: (corner, event) => {\n      Option.match(\n        cropKey(\n          crop,\n          corner,\n          event.key ?? \"\",\n          event.modifiers,\n          bounds,\n          min,\n          props.aspectRatio,\n        ),\n        {\n          onNone: () => undefined,\n          onSome: (next) => {\n            event.preventDefault?.();\n            report(next);\n          },\n        },\n      );\n    },\n  };\n\n  return renderCropArea(props, theme, surface);\n};\n"
    },
    {
      "path": "packages/media/src/crop/logic.ts",
      "target": "@ui/gpuixui/media/crop/logic.ts",
      "type": "registry:lib",
      "content": "import { Match } from \"effect\";\nimport * as Option from \"effect/Option\";\nimport * as Schema from \"effect/Schema\";\n\nexport const CropCorner = Schema.Literals([\"nw\", \"ne\", \"sw\", \"se\"]);\n\nexport type CropCorner = typeof CropCorner.Type;\n\nexport const CROP_MIN_SIZE = 24;\n\nexport const CROP_HANDLE_SIZE = 10;\n\nexport class CropRect extends Schema.Class<CropRect>(\"CropRect\")({\n  x: Schema.Number,\n  y: Schema.Number,\n  width: Schema.Number,\n  height: Schema.Number,\n}) {\n  get right(): number {\n    return this.x + this.width;\n  }\n\n  get bottom(): number {\n    return this.y + this.height;\n  }\n}\n\nexport interface CropBounds {\n  readonly width: number;\n  readonly height: number;\n}\n\nexport const sameCrop = Schema.toEquivalence(CropRect);\n\nexport const isPrimaryPress = (button: number | null | undefined): boolean =>\n  button === undefined || button === null || button === 0;\n\nexport const CROP_BAR_SIDES = [\"top\", \"right\", \"bottom\", \"left\"] as const;\n\nexport type CropBarSide = (typeof CROP_BAR_SIDES)[number];\n\nexport interface CropBar {\n  readonly side: CropBarSide;\n  readonly box: CropRect;\n}\n\nconst clamp = (value: number, low: number, high: number): number =>\n  Math.min(Math.max(value, low), high);\n\nconst delta = (value: number): number => (Number.isFinite(value) ? value : 0);\n\nconst floorOf = (bounds: CropBounds, min: number): number =>\n  Math.max(\n    0,\n    Math.min(\n      Number.isFinite(min) && min > 0 ? min : CROP_MIN_SIZE,\n      Math.max(0, bounds.width),\n      Math.max(0, bounds.height),\n    ),\n  );\n\nconst ratioOf = (ratio: number | undefined): Option.Option<number> =>\n  typeof ratio === \"number\" && Number.isFinite(ratio) && ratio > 0\n    ? Option.some(ratio)\n    : Option.none();\n\nconst fitRatio = (\n  rect: CropRect,\n  start: CropRect,\n  corner: CropCorner,\n  bounds: CropBounds,\n  min: number,\n  ratio: number,\n): CropRect => {\n  const maxW = Math.max(0, bounds.width);\n  const maxH = Math.max(0, bounds.height);\n  const floor = floorOf(bounds, min);\n  const minWidth = Math.max(floor, floor * ratio);\n  const minHeight = minWidth / ratio;\n  if (minWidth > maxW || minHeight > maxH) {\n    return rect;\n  }\n  const across = rect.width - start.width;\n  const down = (rect.height - start.height) * ratio;\n  const wanted =\n    start.width + (Math.abs(across) >= Math.abs(down) ? across : down);\n  const anchor = Match.value(corner).pipe(\n    Match.when(\"se\", () => ({ x: rect.x, y: rect.y })),\n    Match.when(\"nw\", () => ({ x: rect.right, y: rect.bottom })),\n    Match.when(\"ne\", () => ({ x: rect.x, y: rect.bottom })),\n    Match.when(\"sw\", () => ({ x: rect.right, y: rect.y })),\n    Match.exhaustive,\n  );\n  const movesLeft = corner === \"nw\" || corner === \"sw\";\n  const movesTop = corner === \"nw\" || corner === \"ne\";\n\n  const roomW = movesLeft ? anchor.x : maxW - anchor.x;\n  const roomH = movesTop ? anchor.y : maxH - anchor.y;\n  const cap = Math.min(roomW, roomH * ratio);\n  const width = Math.max(minWidth, Math.min(wanted, cap));\n  const height = width / ratio;\n  return new CropRect({\n    x: clamp(movesLeft ? anchor.x - width : anchor.x, 0, maxW - width),\n    y: clamp(movesTop ? anchor.y - height : anchor.y, 0, maxH - height),\n    width,\n    height,\n  });\n};\n\nexport const clampCrop = (\n  crop: CropRect | null | undefined,\n  bounds: CropBounds,\n  min: number = CROP_MIN_SIZE,\n  aspectRatio?: number,\n): CropRect => {\n  const floor = floorOf(bounds, min);\n  const held = Option.getOrElse(\n    Option.fromNullishOr(crop),\n    () => new CropRect({ x: 0, y: 0, width: 0, height: 0 }),\n  );\n\n  const side = (value: number): number =>\n    Number.isFinite(value) ? value : floor;\n  const point = (value: number): number => (Number.isFinite(value) ? value : 0);\n  const width = clamp(side(held.width), floor, Math.max(0, bounds.width));\n  const height = clamp(side(held.height), floor, Math.max(0, bounds.height));\n  const free = new CropRect({\n    x: clamp(point(held.x), 0, Math.max(0, bounds.width - width)),\n    y: clamp(point(held.y), 0, Math.max(0, bounds.height - height)),\n    width,\n    height,\n  });\n  return Option.match(ratioOf(aspectRatio), {\n    onNone: () => free,\n    onSome: (ratio) => fitRatio(free, free, \"se\", bounds, min, ratio),\n  });\n};\n\nexport const cropBars = (\n  crop: CropRect,\n  bounds: CropBounds,\n): ReadonlyArray<CropBar> => {\n  const boxOf = (side: CropBarSide): CropRect =>\n    Match.value(side).pipe(\n      Match.when(\n        \"top\",\n        () => new CropRect({ x: 0, y: 0, width: bounds.width, height: crop.y }),\n      ),\n      Match.when(\n        \"bottom\",\n        () =>\n          new CropRect({\n            x: 0,\n            y: crop.bottom,\n            width: bounds.width,\n            height: Math.max(0, bounds.height - crop.bottom),\n          }),\n      ),\n      Match.when(\n        \"left\",\n        () =>\n          new CropRect({ x: 0, y: crop.y, width: crop.x, height: crop.height }),\n      ),\n      Match.when(\n        \"right\",\n        () =>\n          new CropRect({\n            x: crop.right,\n            y: crop.y,\n            width: Math.max(0, bounds.width - crop.right),\n            height: crop.height,\n          }),\n      ),\n      Match.exhaustive,\n    );\n  const bars = CROP_BAR_SIDES.map((side) => ({ side, box: boxOf(side) }));\n  return bars.filter(({ box }) => box.width > 0 && box.height > 0);\n};\n\nexport interface CropGuide {\n  readonly name: \"v1\" | \"v2\" | \"h1\" | \"h2\";\n  readonly box: CropRect;\n}\n\nexport const cropGuides = (crop: CropRect): ReadonlyArray<CropGuide> => {\n  const thirdW = crop.width / 3;\n  const thirdH = crop.height / 3;\n  const lineW = Math.min(1, Math.max(0, crop.width));\n  const lineH = Math.min(1, Math.max(0, crop.height));\n  const vertical = (x: number): CropRect =>\n    new CropRect({\n      x: Math.min(crop.x + x, crop.right - lineW),\n      y: crop.y,\n      width: lineW,\n      height: crop.height,\n    });\n  const horizontal = (y: number): CropRect =>\n    new CropRect({\n      x: crop.x,\n      y: Math.min(crop.y + y, crop.bottom - lineH),\n      width: crop.width,\n      height: lineH,\n    });\n  return [\n    { name: \"v1\", box: vertical(thirdW) },\n    { name: \"v2\", box: vertical(thirdW * 2) },\n    { name: \"h1\", box: horizontal(thirdH) },\n    { name: \"h2\", box: horizontal(thirdH * 2) },\n  ];\n};\n\nexport const handleBox = (\n  crop: CropRect,\n  corner: CropCorner,\n  size: number,\n  bounds?: CropBounds,\n): CropRect => {\n  const side = Number.isFinite(size) && size > 0 ? size : CROP_HANDLE_SIZE;\n  const point = Match.value(corner).pipe(\n    Match.when(\"nw\", () => ({ x: crop.x, y: crop.y })),\n    Match.when(\"ne\", () => ({ x: crop.right, y: crop.y })),\n    Match.when(\"sw\", () => ({ x: crop.x, y: crop.bottom })),\n    Match.when(\"se\", () => ({ x: crop.right, y: crop.bottom })),\n    Match.exhaustive,\n  );\n  const inside = (value: number, extent: number): number =>\n    clamp(value, 0, Math.max(0, extent - side));\n  return new CropRect({\n    x:\n      bounds === undefined\n        ? point.x - side / 2\n        : inside(point.x - side / 2, bounds.width),\n    y:\n      bounds === undefined\n        ? point.y - side / 2\n        : inside(point.y - side / 2, bounds.height),\n    width: side,\n    height: side,\n  });\n};\n\nexport const resizeCrop = (\n  crop: CropRect,\n  corner: CropCorner,\n  dx: number,\n  dy: number,\n  bounds: CropBounds,\n  min: number = CROP_MIN_SIZE,\n  aspectRatio?: number,\n): CropRect => {\n  const held = clampCrop(crop, bounds, min, aspectRatio);\n  const floor = floorOf(bounds, min);\n  const movesLeft = corner === \"nw\" || corner === \"sw\";\n  const movesTop = corner === \"nw\" || corner === \"ne\";\n  const left = movesLeft\n    ? clamp(held.x + delta(dx), 0, Math.max(0, held.right - floor))\n    : held.x;\n  const right = movesLeft\n    ? held.right\n    : clamp(held.right + delta(dx), held.x + floor, Math.max(0, bounds.width));\n  const top = movesTop\n    ? clamp(held.y + delta(dy), 0, Math.max(0, held.bottom - floor))\n    : held.y;\n  const bottom = movesTop\n    ? held.bottom\n    : clamp(\n        held.bottom + delta(dy),\n        held.y + floor,\n        Math.max(0, bounds.height),\n      );\n  const free = new CropRect({\n    x: left,\n    y: top,\n    width: Math.max(floor, right - left),\n    height: Math.max(floor, bottom - top),\n  });\n  return Option.match(ratioOf(aspectRatio), {\n    onNone: () => free,\n    onSome: (ratio) => fitRatio(free, held, corner, bounds, min, ratio),\n  });\n};\n\nexport const moveCrop = (\n  crop: CropRect,\n  dx: number,\n  dy: number,\n  bounds: CropBounds,\n  min: number = CROP_MIN_SIZE,\n): CropRect => {\n  const held = clampCrop(crop, bounds, min);\n  return new CropRect({\n    x: clamp(held.x + delta(dx), 0, Math.max(0, bounds.width - held.width)),\n    y: clamp(held.y + delta(dy), 0, Math.max(0, bounds.height - held.height)),\n    width: held.width,\n    height: held.height,\n  });\n};\n\nconst keyDelta = (\n  key: string,\n  step: number,\n): Option.Option<{ readonly dx: number; readonly dy: number }> =>\n  Match.value(key).pipe(\n    Match.when(\"left\", () => Option.some({ dx: -step, dy: 0 })),\n    Match.when(\"right\", () => Option.some({ dx: step, dy: 0 })),\n    Match.when(\"up\", () => Option.some({ dx: 0, dy: -step })),\n    Match.when(\"down\", () => Option.some({ dx: 0, dy: step })),\n    Match.orElse(() => Option.none()),\n  );\n\nexport const keyboardCrop = (\n  crop: CropRect,\n  corner: CropCorner,\n  key: string,\n  step: number,\n  bounds: CropBounds,\n  min: number = CROP_MIN_SIZE,\n  aspectRatio?: number,\n): Option.Option<CropRect> => {\n  const move = keyDelta(key, Math.abs(step));\n  return Option.map(move, (delta) =>\n    resizeCrop(crop, corner, delta.dx, delta.dy, bounds, min, aspectRatio),\n  );\n};\n\nexport const keyboardMove = (\n  crop: CropRect,\n  key: string,\n  step: number,\n  bounds: CropBounds,\n  min: number = CROP_MIN_SIZE,\n): Option.Option<CropRect> =>\n  Option.map(keyDelta(key, Math.abs(step)), (delta) =>\n    moveCrop(crop, delta.dx, delta.dy, bounds, min),\n  );\n\nexport interface CropModifiers {\n  readonly shift?: boolean;\n  readonly alt?: boolean;\n}\n\nexport const cropKeyStep = (\n  modifiers: CropModifiers | null | undefined,\n): number => (modifiers?.shift === true ? 8 : 1);\n\nexport const cropKey = (\n  crop: CropRect,\n  corner: CropCorner,\n  key: string,\n  modifiers: CropModifiers | null | undefined,\n  bounds: CropBounds,\n  min: number = CROP_MIN_SIZE,\n  aspectRatio?: number,\n): Option.Option<CropRect> =>\n  modifiers?.alt === true\n    ? keyboardMove(crop, key, cropKeyStep(modifiers), bounds, min)\n    : keyboardCrop(\n        crop,\n        corner,\n        key,\n        cropKeyStep(modifiers),\n        bounds,\n        min,\n        aspectRatio,\n      );\n\nexport type CropGesture =\n  | {\n      readonly kind: \"move\";\n      readonly start: CropRect;\n      readonly x: number;\n      readonly y: number;\n    }\n  | {\n      readonly kind: \"corner\";\n      readonly corner: CropCorner;\n      readonly start: CropRect;\n      readonly x: number;\n      readonly y: number;\n    };\n\nexport const gestureCrop = (\n  gesture: CropGesture,\n  at: { readonly x: number; readonly y: number },\n  bounds: CropBounds,\n  min: number = CROP_MIN_SIZE,\n  aspectRatio?: number,\n): CropRect =>\n  gesture.kind === \"move\"\n    ? moveCrop(gesture.start, at.x - gesture.x, at.y - gesture.y, bounds, min)\n    : resizeCrop(\n        gesture.start,\n        gesture.corner,\n        at.x - gesture.x,\n        at.y - gesture.y,\n        bounds,\n        min,\n        aspectRatio,\n      );\n\nexport const cropLabel = (crop: CropRect): string =>\n  `${Math.round(crop.x)}, ${Math.round(crop.y)}, ${Math.round(crop.width)} × ${Math.round(crop.height)}`;\n\nexport const cornerLabel = (corner: CropCorner): string =>\n  Match.value(corner).pipe(\n    Match.when(\"nw\", () => \"top left\"),\n    Match.when(\"ne\", () => \"top right\"),\n    Match.when(\"sw\", () => \"bottom left\"),\n    Match.when(\"se\", () => \"bottom right\"),\n    Match.exhaustive,\n  );\n\nexport const cornerCursor = (\n  corner: CropCorner,\n): \"nwse-resize\" | \"nesw-resize\" =>\n  Match.value(corner).pipe(\n    Match.when(\"nw\", () => \"nwse-resize\" as const),\n    Match.when(\"se\", () => \"nwse-resize\" as const),\n    Match.when(\"ne\", () => \"nesw-resize\" as const),\n    Match.when(\"sw\", () => \"nesw-resize\" as const),\n    Match.exhaustive,\n  );\n"
    },
    {
      "path": "packages/media/src/internal.ts",
      "target": "@ui/gpuixui/media/internal.ts",
      "type": "registry:lib",
      "content": "import type { StyleDesc } from \"@gpuix/react\";\nimport { classesToStyle } from \"../tw/index.js\";\nimport type { Theme } from \"../tokens/index.js\";\n\nexport { ThemeProvider, useTheme } from \"../tokens/react.js\";\nexport type { Theme } from \"../tokens/index.js\";\n\nexport const recipeStyle = (recipe: string, theme: Theme): StyleDesc =>\n  classesToStyle(recipe, theme).style;\n"
    },
    {
      "path": "packages/media/src/name.ts",
      "target": "@ui/gpuixui/media/name.ts",
      "type": "registry:lib",
      "content": "import * as Str from \"effect/String\";\n\nexport const accessibleName = (label: unknown, fallback: string): string => {\n  const text = typeof label === \"string\" ? Str.trim(label) : \"\";\n  return Str.isEmpty(text) ? fallback : text;\n};\n\nexport const PICTURE_NAME = \"Picture\";\n"
    }
  ],
  "docs": "[CropArea](https://gpuixui.sudokw.com/media/crop-area) — 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": "/media/crop-area",
    "kind": "component",
    "runtime": "gpuix",
    "registry": "gpuixui"
  }
}