{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "components-timeline",
  "type": "registry:component",
  "title": "Timeline",
  "description": "A read-only rail of events the app marks",
  "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/components/src/internal/parts.ts",
      "target": "@ui/gpuixui/components/internal/parts.ts",
      "type": "registry:lib",
      "content": "import * as Arr from \"effect/Array\";\nimport * as P from \"effect/Predicate\";\nimport {\n  Children,\n  Fragment,\n  isValidElement,\n  type ReactElement,\n  type ReactNode,\n} from \"react\";\n\nexport type PartComponent = (props: never) => ReactNode;\n\nexport type PartChildren =\n  | ReactElement<unknown>\n  | boolean\n  | null\n  | undefined\n  | ReadonlyArray<PartChildren>;\n\nexport interface PartsContract {\n  readonly parent: string;\n\n  readonly family: ReadonlyArray<PartComponent>;\n\n  readonly accepts: ReadonlyArray<PartComponent>;\n\n  readonly hint?: string;\n}\n\nconst componentName = (type: unknown): string =>\n  P.isString(type)\n    ? type\n    : P.isFunction(type)\n      ? type.name || \"anonymous\"\n      : \"element\";\n\nconst fragmentChildren = (element: ReactElement<unknown>): ReactNode =>\n  hasChildren(element.props) ? element.props.children : undefined;\n\nconst hasChildren = (\n  value: unknown,\n): value is { readonly children?: ReactNode } =>\n  P.isObject(value) && \"children\" in value;\n\nconst leaves = (children: ReactNode): ReadonlyArray<unknown> =>\n  Arr.flatMap(Children.toArray(children), (child) =>\n    isValidElement<unknown>(child) && child.type === Fragment\n      ? leaves(fragmentChildren(child))\n      : [child],\n  );\n\nexport const assertParts = (\n  contract: PartsContract,\n  children: ReactNode,\n): void => {\n  Arr.forEach(leaves(children), (leaf) => {\n    if (!isValidElement(leaf)) return;\n    if (Arr.some(contract.accepts, (part) => part === leaf.type)) return;\n    if (!Arr.some(contract.family, (part) => part === leaf.type)) return;\n\n    throw new Error(\n      `${componentName(leaf.type)} cannot be used inside ${contract.parent}.` +\n        (contract.hint === undefined ? \"\" : ` ${contract.hint}`),\n    );\n  });\n};\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/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/timeline.tsx",
      "target": "@ui/gpuixui/components/timeline.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 {\n  cn,\n  TIMELINE_CONNECTOR,\n  TIMELINE_CONTENT,\n  TIMELINE_DESCRIPTION,\n  TIMELINE_DOT,\n  TIMELINE_ITEM,\n  TIMELINE_RAIL,\n  TIMELINE_ROOT,\n  TIMELINE_TIMESTAMP,\n  TIMELINE_TITLE,\n} from \"../tw/index.js\";\nimport { Children, createContext, isValidElement, useContext } from \"react\";\nimport {\n  assertParts,\n  type PartChildren,\n  type PartComponent,\n  type PartsContract,\n} from \"./internal/parts.js\";\nimport { recipeStyle } from \"./internal/recipe.js\";\nimport { useTheme, type Theme } from \"./internal/theme.js\";\n\nexport type TimelineStatus = \"complete\" | \"current\" | \"upcoming\";\n\ninterface TimelineContextValue {\n  readonly last: boolean;\n}\n\nconst TimelineContext = createContext<TimelineContextValue>({ last: false });\n\nconst dotFill = (theme: Theme, status: TimelineStatus): string =>\n  status === \"current\"\n    ? theme.colors.primary\n    : status === \"complete\"\n      ? theme.colors.foreground\n      : theme.colors.mutedForeground;\n\nexport interface TimelineProps extends Omit<Props, \"children\"> {\n  readonly label?: string;\n\n  readonly className?: string;\n  readonly children?: PartChildren;\n}\n\nexport const Timeline = ({\n  label,\n  className,\n  children,\n  style,\n  ...rest\n}: TimelineProps) => {\n  const theme = useTheme();\n  assertParts(timelineRoot, children);\n\n  const items = Children.toArray(children);\n  const lastItem = items.reduce(\n    (last, child, index) =>\n      isValidElement(child) && child.type === TimelineItem ? index : last,\n    -1,\n  );\n\n  return (\n    <div\n      role=\"list\"\n      {...(label === undefined ? {} : { \"aria-label\": label })}\n      {...rest}\n      style={mergeStyles(\n        recipeStyle(cn(TIMELINE_ROOT, className), theme),\n        style,\n      )}\n    >\n      {items.map((item, index) => (\n        <TimelineContext.Provider\n          key={index}\n          value={{ last: index === lastItem }}\n        >\n          {item}\n        </TimelineContext.Provider>\n      ))}\n    </div>\n  );\n};\n\nexport interface TimelineItemProps extends Omit<Props, \"children\" | \"style\"> {\n  readonly title: string;\n\n  readonly description?: string;\n\n  readonly timestamp?: string;\n\n  readonly status?: TimelineStatus;\n\n  readonly className?: string;\n\n  readonly style?: StateStyle<TimelineItemState>;\n}\n\nexport interface TimelineItemState {\n  readonly status: TimelineStatus;\n  readonly last: boolean;\n}\n\nexport const TimelineItem = ({\n  title,\n  description,\n  timestamp,\n  status = \"complete\",\n  className,\n  style,\n  ...rest\n}: TimelineItemProps) => {\n  const theme = useTheme();\n  const { last } = useContext(TimelineContext);\n\n  return (\n    <div\n      role=\"listitem\"\n      aria-label={title}\n      aria-selected={status === \"current\"}\n      {...rest}\n      style={mergeStyles(\n        recipeStyle(cn(TIMELINE_ITEM, className), theme),\n        resolveStyle(style, { status, last }),\n      )}\n    >\n      <div style={recipeStyle(TIMELINE_RAIL, theme)}>\n        <div\n          style={mergeStyles(recipeStyle(TIMELINE_DOT, theme), {\n            backgroundColor: dotFill(theme, status),\n          })}\n        />\n        {last ? null : <div style={recipeStyle(TIMELINE_CONNECTOR, theme)} />}\n      </div>\n      <div\n        style={mergeStyles(recipeStyle(TIMELINE_CONTENT, theme), {\n          paddingBottom: last ? 0 : theme.spacing.lg,\n        })}\n      >\n        {timestamp === undefined ? null : (\n          <text style={recipeStyle(TIMELINE_TIMESTAMP, theme)}>\n            {timestamp}\n          </text>\n        )}\n        <text\n          style={mergeStyles(recipeStyle(TIMELINE_TITLE, theme), {\n            color:\n              status === \"upcoming\"\n                ? theme.colors.mutedForeground\n                : theme.colors.foreground,\n          })}\n        >\n          {title}\n        </text>\n        {description === undefined ? null : (\n          <text style={recipeStyle(TIMELINE_DESCRIPTION, theme)}>\n            {description}\n          </text>\n        )}\n      </div>\n    </div>\n  );\n};\n\nconst timelineParts: ReadonlyArray<PartComponent> = [Timeline, TimelineItem];\n\nconst timelineRoot: PartsContract = {\n  parent: \"Timeline\",\n  family: timelineParts,\n  accepts: [TimelineItem],\n  hint: \"Put TimelineItem directly inside Timeline.\",\n};\n\nexport const timelineMeta = {\n  name: \"Timeline\",\n  tier: 2,\n  gpuixSupport: \"partial\",\n  status: \"done\",\n  limitations: [\n    \"display-only: no click, selection or aria-current\",\n    \"the last item is computed from direct children; a fragment of items shares one flag\",\n    \"the connector is a 1px element because 0.11.0 has no pseudo-elements\",\n  ],\n  docs: \"docs/timeline.mdx\",\n  example: \"examples/timeline.example.tsx\",\n  testFile: \"src/behaviour/timeline.test.tsx\",\n} as const;\n"
    }
  ],
  "docs": "[Timeline](https://gpuixui.sudokw.com/components/timeline) — 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/timeline",
    "kind": "component",
    "runtime": "gpuix",
    "registry": "gpuixui"
  }
}