import React from 'react'; import { type CSSObject } from 'restyle'; import { type RepositoryInput, type GetCommitUrlOptions, type GetReleaseTagUrlOptions, type Release, type ReleaseSpecifier } from '../../file-system/Repository.ts'; declare const VARIANT_METHODS: { readonly edit: "getEditUrl"; readonly history: "getHistoryUrl"; readonly raw: "getRawUrl"; readonly blame: "getBlameUrl"; readonly source: "getSourceUrl"; readonly editor: "getEditorUri"; readonly release: "getReleaseUrl"; }; type ConfigVariants = 'repository' | 'owner' | 'branch' | 'commit' | 'releaseTag' | 'issue'; export type LinkVariant = keyof typeof VARIANT_METHODS | ConfigVariants; type VariantMethodName = Variant extends keyof typeof VARIANT_METHODS ? (typeof VARIANT_METHODS)[Variant] : never; type VariantOptions = Variant extends keyof typeof VARIANT_METHODS ? Source extends { [MethodName in VariantMethodName]: (options?: infer Options) => any; } ? Options : never : { ref?: string; } | undefined; export interface LinkReleaseContext extends Release { /** Original tag name from the provider (e.g. GitHub `tag_name`). */ rawTagName?: string; /** Original release name/title from the provider. */ rawName?: string; /** Primary tag identifier, normalized from the underlying release. */ tag?: string; /** Package or display name, normalized from the underlying release. */ name?: string; /** Normalized label suitable for display. */ label: string; /** String representation when rendered in a string context. */ toString(): string; } export interface LinkReleaseRenderContext { /** The URL of the release. */ href: string; /** The tag of the release. */ tag?: string; /** The name of the release. */ name?: string; /** The tag and name of the release. */ label: `${string}@${string}`; /** ISO timestamp for when the release was published, if provided by the host. */ publishedAt?: string; /** Indicates whether the release is marked as a prerelease. */ isPrerelease: boolean; /** Indicates whether the release is marked as a draft. */ isDraft: boolean; } interface LinkBaseRenderContext { /** The URL of the link. */ href: string; } type LinkContextFor = Variant extends 'release' ? LinkReleaseRenderContext : LinkBaseRenderContext; type LinkChildren = React.ReactNode | ((context: LinkContextFor) => React.ReactNode); type AnchorBaseProps = Omit, 'href' | 'children'> & { css?: CSSObject; }; type ConfigVariantProps = Variant extends 'branch' ? { variant?: 'branch'; source?: never; options?: { ref?: string; }; } : Variant extends 'commit' ? { variant: 'commit'; source?: never; options: GetCommitUrlOptions; } : Variant extends 'releaseTag' ? { variant: 'releaseTag'; source?: never; options: GetReleaseTagUrlOptions; } : { variant: Exclude; source?: never; options?: never; }; export type LinkProps = Variant extends 'release' ? AnchorBaseProps & { /** Entry to derive the href from. */ source?: Source; /** Which getter to use for the href. */ variant?: Variant; /** Optional package name to filter releases in monorepos. */ packageName?: string; /** Which release to resolve. */ release?: ReleaseSpecifier; /** Force a refresh of the cached release metadata. */ refresh?: boolean; /** Select a downloadable asset by heuristic or matcher. */ asset?: true | string | RegExp; /** Link to the release source archive. */ archiveSource?: 'zip' | 'tar'; /** Link to a compare view from this ref to the resolved release. */ compare?: string; /** Override repository for computing release URL. */ repository?: RepositoryInput; /** The content of the link. */ children?: LinkChildren; } : Variant extends keyof typeof VARIANT_METHODS ? AnchorBaseProps & { /** Entry to derive the href from. */ source: Source; /** Which getter to use for the href. */ variant?: Variant; /** Options forwarded to the variant getter method. */ options?: VariantOptions; /** The content of the link. */ children?: LinkChildren; } : Variant extends ConfigVariants ? AnchorBaseProps & ConfigVariantProps> & { /** The content of the link. */ children?: LinkChildren; } : never; /** * An anchor element that derives its `href` from a directory, file, module export, * or from the `RootProvider` config. */ export declare function Link(props: LinkProps): Promise | React.JSX.Element | null | undefined>; export {};