{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "skeleton",
  "title": "Skeleton",
  "description": "Placeholder lines and blocks for content that's loading.",
  "registryDependencies": [
    "https://www.cyberspec.dev/r/cyber.json"
  ],
  "files": [
    {
      "path": "registry/cyber/ui/skeleton.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport \"@/registry/cyber/ui/cyber/skeleton.css\"\n\ntype Shape = \"line\" | \"block\" | \"tile\"\n\n// A length for a CSS variable: a bare number is pixels.\nconst length = (value: number | string | undefined) => (typeof value === \"number\" ? `${value}px` : value)\n\n// A placeholder for content that hasn't arrived: a line of text drawn as\n// redacted words, a block for a picture, or a tile for a portrait or an\n// icon, with a highlight sweeping across each. It's decoration, so every\n// piece is hidden from assistive technology; put the pieces in a\n// SkeletonGroup, which says what is loading.\n//\n// - `shape`: \"line\" (text), \"block\" (a picture or a panel) or \"tile\" (a\n//   square).\n// - `width` and `height`: a number of pixels or any CSS length. A line is as\n//   wide as its container unless told otherwise; a tile takes `width` for\n//   both sides.\n// - `lines`: for a line, how many to stack. The last one stops short, like\n//   the end of a paragraph.\nfunction Skeleton({\n  shape = \"line\",\n  width,\n  height,\n  lines = 1,\n  style,\n  ...props\n}: Omit<React.ComponentProps<\"span\">, \"children\"> & {\n  shape?: Shape\n  width?: number | string\n  height?: number | string\n  lines?: number\n}) {\n  const size = { \"--skeleton-w\": length(width), \"--skeleton-h\": length(height), ...style } as React.CSSProperties\n\n  if (shape === \"line\" && lines > 1) {\n    return (\n      <span data-kit=\"skeleton-lines\" aria-hidden style={size} {...props}>\n        {Array.from({ length: lines }, (_, index) => (\n          // Each line starts further into the word pattern, so no two lines\n          // of a paragraph break in the same places.\n          <span key={index} data-kit=\"skeleton\" data-shape=\"line\" style={{ \"--i\": index } as React.CSSProperties} />\n        ))}\n      </span>\n    )\n  }\n\n  return (\n    <span\n      data-kit=\"skeleton\"\n      data-shape={shape}\n      data-frame={shape === \"block\" ? \"br\" : shape === \"tile\" ? \"tl br\" : undefined}\n      aria-hidden\n      style={size}\n      {...props}\n    />\n  )\n}\n\n// A row inside a group: a tile beside a column of lines, the way a list row\n// or a card's heading is laid out.\nfunction SkeletonRow(props: React.ComponentProps<\"span\">) {\n  return <span data-kit=\"skeleton-row\" {...props} />\n}\n\n// The container for a skeleton. It carries `aria-busy` while `busy`, and\n// prints what's loading as a caption with a caret, so the placeholder says\n// what it is to a screen reader, and to anyone with the effects off.\n//\n// - `label`: what is loading, \"Loading\" by default.\n// - `framed` draws it as a card.\n// - `busy`: set it false once the content is in, if the group stays mounted.\nfunction SkeletonGroup({\n  label = \"Loading\",\n  framed,\n  busy = true,\n  children,\n  ...props\n}: React.ComponentProps<\"div\"> & { label?: string; framed?: boolean; busy?: boolean }) {\n  return (\n    <div data-kit=\"skeleton-group\" data-frame={framed ? \"br\" : undefined} aria-busy={busy} {...props}>\n      {children}\n      <span data-kit=\"skeleton-caption\">{label}</span>\n    </div>\n  )\n}\n\nexport { Skeleton, SkeletonGroup, SkeletonRow }\nexport type { Shape as SkeletonShape }\n",
      "type": "registry:ui",
      "target": "@ui/skeleton.tsx"
    },
    {
      "path": "registry/cyber/ui/cyber/skeleton.css",
      "content": "@layer ui-sdk, cyber.tokens, cyber.base, cyber.ui, cyber.blocks, cyber.fx, cyber.a11y;\n\n@layer cyber.ui {\n  /* Every piece is a dim shape with a highlight crossing it. The highlight\n     is a pseudo-element with a background three times the piece's width,\n     which the sweep slides across; at FX \"calm\" and \"off\" it stays parked\n     out of view and the piece is simply a still shape. */\n  [data-skin=\"cyber\"] [data-kit=\"skeleton\"] {\n    --dim: var(--cy-line-deco);\n    --sweep: color-mix(in srgb, var(--cy-ink) 80%, transparent);\n\n    position: relative;\n    display: block;\n    flex: none;\n    overflow: hidden;\n    pointer-events: none;\n    user-select: none;\n\n    &::after {\n      content: \"\";\n      position: absolute;\n      inset: 0;\n      background: linear-gradient(100deg, transparent 38%, var(--sweep) 50%, transparent 62%) 150% 0 / 300% 100% no-repeat;\n      animation: var(--cy-fx-sweep) 1.8s linear infinite;\n    }\n  }\n\n  /* A line of text, as redacted words: one strip, cut by a mask into blocks\n     of uneven length. Only the mask's alpha counts, so its \"color\" is any\n     opaque token. --i moves the pattern along for each line of a stack. */\n  [data-skin=\"cyber\"] [data-kit=\"skeleton\"][data-shape=\"line\"] {\n    --on: var(--cy-void);\n\n    width: var(--skeleton-w, 100%);\n    max-width: 100%;\n    height: var(--skeleton-h, 10px);\n    background: var(--dim);\n    mask-image: linear-gradient(\n      to right,\n      var(--on) 0 30px,\n      transparent 30px 35px,\n      var(--on) 35px 53px,\n      transparent 53px 58px,\n      var(--on) 58px 102px,\n      transparent 102px 107px,\n      var(--on) 107px 119px,\n      transparent 119px 124px,\n      var(--on) 124px 148px,\n      transparent 148px 153px\n    );\n    mask-size: 153px 100%;\n    mask-position: calc(var(--i, 0) * -41px) 0;\n    mask-repeat: repeat-x;\n  }\n\n  /* A paragraph. The last line stops short. */\n  [data-skin=\"cyber\"] [data-kit=\"skeleton-lines\"] {\n    display: grid;\n    gap: 8px;\n    width: var(--skeleton-w, 100%);\n    min-width: 0;\n\n    /* The stack's own width isn't each line's. */\n    & > * {\n      --skeleton-w: 100%;\n    }\n    & > :last-child {\n      --skeleton-w: 62%;\n    }\n  }\n\n  /* A block and a tile are frames: a faint tint, a cut corner, and a\n     registration cross where a picture's center would be. */\n  [data-skin=\"cyber\"] [data-kit=\"skeleton\"]:is([data-shape=\"block\"], [data-shape=\"tile\"]) {\n    --frame-cut: var(--cy-cut);\n    --frame-line: var(--cy-line-deco);\n    --frame-fill: color-mix(in srgb, var(--cy-accent) 9%, var(--cy-panel));\n    --frame-image: none;\n    --sweep: color-mix(in srgb, var(--cy-ink) 26%, transparent);\n\n    width: var(--skeleton-w, 100%);\n    max-width: 100%;\n    height: var(--skeleton-h, 72px);\n\n    &::before {\n      content: \"\";\n      position: absolute;\n      inset: 0;\n      margin: auto;\n      width: 9px;\n      height: 9px;\n      background:\n        linear-gradient(var(--cy-line-ctl), var(--cy-line-ctl)) center / 100% 1px no-repeat,\n        linear-gradient(var(--cy-line-ctl), var(--cy-line-ctl)) center / 1px 100% no-repeat;\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"skeleton\"][data-shape=\"tile\"] {\n    --frame-cut: var(--cy-cut-sm);\n\n    width: var(--skeleton-w, 40px);\n    height: var(--skeleton-h, var(--skeleton-w, 40px));\n  }\n\n  /* A tile beside a column of lines. */\n  [data-skin=\"cyber\"] [data-kit=\"skeleton-row\"] {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    min-width: 0;\n\n    & > :not([data-shape=\"tile\"]) {\n      flex: 1;\n      min-width: 0;\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"skeleton-group\"] {\n    display: grid;\n    gap: 12px;\n    width: 100%;\n    min-width: 0;\n    text-align: start;\n\n    &[data-frame] {\n      --frame-cut: var(--cy-cut);\n      --frame-line: var(--cy-line-deco);\n      --frame-fill: var(--cy-panel);\n      --frame-image: none;\n\n      padding: 12px 12px 10px;\n    }\n  }\n\n  /* What's loading, in words, with a caret waiting after it. */\n  [data-skin=\"cyber\"] [data-kit=\"skeleton-caption\"] {\n    font-family: var(--cy-mono);\n    font-size: var(--cy-text-xs);\n    line-height: 1.3;\n    letter-spacing: 0.08em;\n    text-transform: uppercase;\n    color: var(--cy-ink-mute);\n\n    &::after {\n      content: \"_\";\n      color: var(--cy-signal);\n      animation: var(--cy-fx-blink) 1s step-end infinite;\n    }\n  }\n\n  /* Forced colors drop backgrounds, which is all a line is. */\n  @media (forced-colors: active) {\n    [data-skin=\"cyber\"] [data-kit=\"skeleton\"][data-shape=\"line\"] {\n      mask-image: none;\n      border: 1px solid GrayText;\n    }\n    [data-skin=\"cyber\"] [data-kit=\"skeleton\"]::after {\n      content: none;\n    }\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/cyber/skeleton.css"
    }
  ],
  "type": "registry:ui"
}
