@humanwhocodes/crosspost
Version:
A utility to post across multiple social networks.
92 lines (91 loc) • 1.94 kB
TypeScript
/**
* Detects rich text facets in the given text.
* @param {string} text The text to search.
* @returns {Array<BlueSkyFacet>} An array of BlueSkyFacet objects.
*/
export function detectFacets(text: string): Array<BlueSkyFacet>;
export const BLUESKY_URL_FACET: "app.bsky.richtext.facet#link";
export const BLUESKY_TAG_FACET: "app.bsky.richtext.facet#tag";
export type ByteRange = {
/**
* The byte offset of the start of the range.
*/
byteStart: number;
/**
* The byte offset of the end of
*/
byteEnd: number;
};
export type URIDetails = {
/**
* The URI of the facet.
*/
uri: string;
/**
* The byte range of the facet in the text.
*/
byteRange: ByteRange;
};
export type TagDetails = {
/**
* The tag of the facet.
*/
tag: string;
/**
* The byte range of the facet in the text.
*/
byteRange: ByteRange;
};
export type BlueSkyFacet = {
/**
* The byte range of the facet in the text.
*/
index: ByteRange;
/**
* The features of the facet.
*/
features: Array<BlueSkyURIFacetFeature | BlueSkyTagFacetFeature>;
};
/**
* A Bluesky URI facet feature.
*/
declare class BlueSkyURIFacetFeature {
/**
* Creates a new instance.
* @param {string} uri The URI of the facet.
*/
constructor(uri: string);
/**
* The URI of the facet.
* @type {string}
*/
uri: string;
/**
* The type of facet.
* @type {string}
* @const
*/
$type: string;
}
/**
* A Bluesky tag facet feature.
*/
declare class BlueSkyTagFacetFeature {
/**
* Creates a new instance.
* @param {string} tag The tag of the facet.
*/
constructor(tag: string);
/**
* The tag of the facet.
* @type {string}
*/
tag: string;
/**
* The type of facet.
* @type {string}
* @const
*/
$type: string;
}
export {};