@shopify/cli-kit
Version:
A set of utilities, interfaces, and models that are common across all the platform features
49 lines (48 loc) • 1.19 kB
TypeScript
import { FunctionComponent } from 'react';
export interface LinkToken {
link: {
label?: string;
url: string;
};
}
export interface UserInputToken {
userInput: string;
}
export interface ListToken {
list: {
title?: TokenItem<InlineToken>;
items: TokenItem<InlineToken>[];
ordered?: boolean;
};
}
export interface BoldToken {
bold: string;
}
export type Token = string | {
command: string;
} | LinkToken | {
char: string;
} | UserInputToken | {
subdued: string;
} | {
filePath: string;
} | ListToken | BoldToken | {
info: string;
} | {
warn: string;
} | {
error: string;
};
export type InlineToken = Exclude<Token, ListToken>;
export type TokenItem<T extends Token = Token> = T | T[];
export declare function tokenItemToString(token: TokenItem): string;
export declare function appendToTokenItem(token: TokenItem, suffix: string): TokenItem;
interface TokenizedTextProps {
item: TokenItem;
}
/**
* `TokenizedText` renders a text string with tokens that can be either strings,
* links, and commands.
*/
declare const TokenizedText: FunctionComponent<TokenizedTextProps>;
export { TokenizedText };