@ts-common/azure-js-dev-tools
Version:
Developer dependencies for TypeScript related projects
504 lines • 18.2 kB
TypeScript
import { BuilderActions, TextBuilder, TextElementBuilder } from "./textBuilder";
/**
* Create an html element string.
*/
export declare function html(htmlActions?: BuilderActions<HTMLBuilder>, textBuilder?: TextBuilder): string;
/**
* Create a body element string.
*/
export declare function body(bodyActions?: BuilderActions<BodyBuilder>, textBuilder?: TextBuilder): string;
/**
* Create a h element string.
*/
export declare function h(level: number, hActions?: BuilderActions<HBuilder>, textBuilder?: TextBuilder): string;
/**
* Create a h1 element string.
*/
export declare function h1(hActions?: BuilderActions<HBuilder>, textBuilder?: TextBuilder): string;
/**
* Create a h2 element string.
*/
export declare function h2(hActions?: BuilderActions<HBuilder>, textBuilder?: TextBuilder): string;
/**
* Create a h3 element string.
*/
export declare function h3(hActions?: BuilderActions<HBuilder>, textBuilder?: TextBuilder): string;
/**
* Create a h4 element string.
*/
export declare function h4(hActions?: BuilderActions<HBuilder>, textBuilder?: TextBuilder): string;
/**
* Create a h5 element string.
*/
export declare function h5(hActions?: BuilderActions<HBuilder>, textBuilder?: TextBuilder): string;
/**
* Create a h6 element string.
*/
export declare function h6(hActions?: BuilderActions<HBuilder>, textBuilder?: TextBuilder): string;
/**
* Create a table element string.
*/
export declare function table(tableActions?: BuilderActions<TableBuilder>, textBuilder?: TextBuilder): string;
/**
* Create a tr element string.
*/
export declare function tr(trActions?: BuilderActions<TRBuilder>, textBuilder?: TextBuilder): string;
/**
* Create a td element string.
*/
export declare function td(tdActions?: BuilderActions<TDBuilder>, textBuilder?: TextBuilder): string;
/**
* Create a a element string.
*/
export declare function a(aActions?: BuilderActions<ABuilder>, textBuilder?: TextBuilder): string;
/**
* Create a img element string.
*/
export declare function img(imgActions?: BuilderActions<ImgBuilder>, textBuilder?: TextBuilder): string;
/**
* Create a details element string.
*/
export declare function details(actions?: BuilderActions<DetailsBuilder>, textBuilder?: TextBuilder): string;
/**
* Create a summary element string.
*/
export declare function summary(actions?: BuilderActions<SummaryBuilder>, textBuilder?: TextBuilder): string;
/**
* Create a ul element string.
*/
export declare function ul(actions?: BuilderActions<ULBuilder>, textBuilder?: TextBuilder): string;
/**
* Create an li element string.
*/
export declare function li(actions?: BuilderActions<LIBuilder>, textBuilder?: TextBuilder): string;
/**
* Create an br element string.
*/
export declare function br(actions?: BuilderActions<BRBuilder>, textBuilder?: TextBuilder): string;
/**
* Create a blockquote element string.
*/
export declare function blockquote(actions?: BuilderActions<BlockQuoteBuilder>, textBuilder?: TextBuilder): string;
/**
* Create a b element string.
*/
export declare function b(actions?: BuilderActions<BBuilder>, textBuilder?: TextBuilder): string;
/**
* A class that can be used to create a generic HTML element.
*/
export declare class HTMLElementBuilder implements TextElementBuilder {
private readonly elementName;
protected readonly text: TextBuilder;
private hasContent;
/**
* Create a new HTMLBuilder.
*/
constructor(elementName: string, text?: TextBuilder);
/**
* Start the html element.
*/
start(): void;
/**
* Add the provided attribute to the html element.
* @param attributeName The name of the attribute.
* @param attributeValue The value of the attribute.
*/
attribute(attributeName: string, attributeValue: string | number): HTMLElementBuilder;
/**
* Add the provided content to this element. This will close the start tag of the element if it
* was open.
* @param actions The content to add to the element.
*/
content(actions: BuilderActions<HTMLElementBuilder>): HTMLElementBuilder;
/**
* Append newline characters to the content of this HTML element. This will close the start tag if
* it is still open.
*/
contentNewLine(count?: number): HTMLElementBuilder;
/**
* End the html element.
*/
end(): void;
/**
* Get the HTML text that this HTMLBuilder has been building.
*/
toString(): string;
}
/**
* A class that can be used to build an html element.
*/
export declare class HTMLBuilder extends HTMLElementBuilder {
constructor(text?: TextBuilder);
/**
* Populate this element using the provided action.
* @param htmlActions The actions that will populate this element.
*/
create(htmlActions?: BuilderActions<HTMLBuilder>): string;
/**
* Add a body element to this html element's content.
* @param bodyActions The action that will create the body element.
*/
body(bodyActions?: BuilderActions<BodyBuilder>): HTMLBuilder;
}
/**
* A class that can be used to build a body element.
*/
export declare class BodyBuilder extends HTMLElementBuilder {
constructor(text?: TextBuilder);
/**
* Populate this element using the provided action.
* @param bodyActions The actions that will populate this element.
*/
create(bodyActions?: BuilderActions<BodyBuilder>): string;
/**
* Create a bold element in this body element.
* @param bActions The actions that will populate this element.
*/
b(bActions?: BuilderActions<BBuilder>): BodyBuilder;
/**
* Create a header element in this body element.
* @param level The level of the header.
* @param hActions The actions to use to populate the header element.
*/
h(level: number, hActions?: BuilderActions<HBuilder>): BodyBuilder;
/**
* Create a h1 element in this body element.
* @param hActions The actions to use to populate the header element.
*/
h1(hActions?: BuilderActions<HBuilder>): BodyBuilder;
/**
* Create a h2 element in this body element.
* @param hActions The actions to use to populate the header element.
*/
h2(hActions?: BuilderActions<HBuilder>): BodyBuilder;
/**
* Create a h3 element in this body element.
* @param hActions The actions to use to populate the header element.
*/
h3(hActions?: BuilderActions<HBuilder>): BodyBuilder;
/**
* Create a h4 element in this body element.
* @param hActions The actions to use to populate the header element.
*/
h4(hActions?: BuilderActions<HBuilder>): BodyBuilder;
/**
* Create a h5 element in this body element.
* @param hActions The actions to use to populate the header element.
*/
h5(hActions?: BuilderActions<HBuilder>): BodyBuilder;
/**
* Create a h6 element in this body element.
* @param hActions The actions to use to populate the header element.
*/
h6(hActions?: BuilderActions<HBuilder>): BodyBuilder;
/**
* Add a table element to this body element's content.
* @param tableAction The action that will create the table element.
*/
table(tableActions?: BuilderActions<TableBuilder>): BodyBuilder;
/**
* Add a ul element to this body element's content.
* @param ulActions The actions that will create the ul element.
*/
ul(ulActions?: BuilderActions<ULBuilder>): BodyBuilder;
/**
* Add a details element to this body element's content.
* @param detailsActions The actions that will create the details element.
*/
details(detailsActions?: BuilderActions<DetailsBuilder>): BodyBuilder;
/**
* Add a br element to this body element's content.
* @param brActions The actions that will create the br element.
*/
br(brActions?: BuilderActions<BRBuilder>): BodyBuilder;
}
/**
* A class that can be used to build an h element.
*/
export declare class HBuilder extends HTMLElementBuilder {
constructor(level: number, text?: TextBuilder);
/**
* Populate this element using the provided action.
* @param hActions The actions that will populate this element.
*/
create(hActions?: BuilderActions<HBuilder>): string;
/**
* Add an a element to this h element's content.
* @param aAction The action that will create the tr element.
*/
a(aActions?: BuilderActions<ABuilder>): HBuilder;
}
/**
* A class that can be used to build a table element.
*/
export declare class TableBuilder extends HTMLElementBuilder {
constructor(text?: TextBuilder);
/**
* Populate this element using the provided action.
* @param tableActions The actions that will populate this element.
*/
create(tableActions?: BuilderActions<TableBuilder>): string;
/**
* Add a border attribute to this table element.
* @param value The value of the border attribute.
*/
border(value: number): TableBuilder;
/**
* Add a tr element to this table element's content.
* @param trAction The action that will create the tr element.
*/
tr(trActions?: BuilderActions<TRBuilder>): TableBuilder;
}
/**
* A class that can be used to build a tr element.
*/
export declare class TRBuilder extends HTMLElementBuilder {
constructor(text?: TextBuilder);
/**
* Populate this element using the provided action.
* @param trActions The actions that will populate this element.
*/
create(trActions?: BuilderActions<TRBuilder>): string;
/**
* Add a td element to this tr element's content.
* @param tdActions The action that will create the td element.
*/
td(tdActions?: BuilderActions<TDBuilder>): TRBuilder;
}
/**
* A class that can be used to build a td element.
*/
export declare class TDBuilder extends HTMLElementBuilder {
constructor(text?: TextBuilder);
/**
* Populate this element using the provided action.
* @param tdActions The actions that will populate this element.
*/
create(tdActions?: BuilderActions<TDBuilder>): string;
/**
* Add a colspan attribute to this td element.
* @param value The value of the colspan attribute.
*/
colspan(value: number): TDBuilder;
/**
* Add a rowspan attribute to this td element.
* @param value The value of the rowspan attribute.
*/
rowspan(value: string | number): TDBuilder;
/**
* Create an a element in this td element.
* @param aActions The actions to use to populate the a element.
*/
a(aActions?: BuilderActions<ABuilder>): TDBuilder;
/**
* Create a bold element in this td element.
* @param bActions The actions that will populate this element.
*/
b(bActions?: BuilderActions<BBuilder>): TDBuilder;
/**
* Create a header element in this td element.
* @param level The level of the header.
* @param hActions The actions to use to populate the header element.
*/
h(level: number, hActions?: BuilderActions<HBuilder>): TDBuilder;
/**
* Create a h1 element in this td element.
* @param hActions The actions to use to populate the header element.
*/
h1(hActions?: BuilderActions<HBuilder>): TDBuilder;
/**
* Create a h2 element in this td element.
* @param hActions The actions to use to populate the header element.
*/
h2(hActions?: BuilderActions<HBuilder>): TDBuilder;
/**
* Create a h3 element in this td element.
* @param hActions The actions to use to populate the header element.
*/
h3(hActions?: BuilderActions<HBuilder>): TDBuilder;
/**
* Create a h4 element in this td element.
* @param hActions The actions to use to populate the header element.
*/
h4(hActions?: BuilderActions<HBuilder>): TDBuilder;
/**
* Create a h5 element in this td element.
* @param hActions The actions to use to populate the header element.
*/
h5(hActions?: BuilderActions<HBuilder>): TDBuilder;
/**
* Create a h6 element in this td element.
* @param hActions The actions to use to populate the header element.
*/
h6(hActions?: BuilderActions<HBuilder>): TDBuilder;
/**
* Create a img element in this td element.
* @param imgActions The actions to use to populate the img element.
*/
img(imgActions?: BuilderActions<ImgBuilder>): TDBuilder;
}
/**
* A class that can be used to build an a element.
*/
export declare class ABuilder extends HTMLElementBuilder {
constructor(text?: TextBuilder);
/**
* Populate this element using the provided action.
* @param aActions The actions that will populate this element.
*/
create(aActions?: BuilderActions<ABuilder>): string;
/**
* Add an href attribute to this a element.
* @param hrefValue The value of the href attribute.
*/
href(hrefValue: string): ABuilder;
}
/**
* A class that can be used to build an img element.
*/
export declare class ImgBuilder extends HTMLElementBuilder {
constructor(text?: TextBuilder);
/**
* Populate this element using the provided action.
* @param imgActions The actions that will populate this element.
*/
create(imgActions?: BuilderActions<ImgBuilder>): string;
/**
* Add a src attribute to this img element.
* @param srcValue The value of the src attribute.
*/
src(srcValue: string): ImgBuilder;
/**
* Add an alt attribute to this img element.
* @param altValue The value of the alt attribute.
*/
alt(altValue: string): ImgBuilder;
/**
* Add an width attribute to this img element.
* @param widthValue The value of the width attribute.
*/
width(widthValue: number): ImgBuilder;
/**
* Add an height attribute to this img element.
* @param heightValue The value of the height attribute.
*/
height(heightValue: number): ImgBuilder;
}
/**
* A class that can be used to build a details element.
*/
export declare class DetailsBuilder extends HTMLElementBuilder {
constructor(text?: TextBuilder);
/**
* Populate this element using the provided action.
* @param actions The actions that will populate this element.
*/
create(actions?: BuilderActions<DetailsBuilder>): string;
/**
* Add a summary element to this details element.
* @param actions The actions used to populate the summary element.
*/
summary(actions: BuilderActions<SummaryBuilder>): DetailsBuilder;
/**
* Add a blockquote element to this details element.
* @param actions The actions used to populate the blockquote element.
*/
blockquote(actions: BuilderActions<BlockQuoteBuilder>): DetailsBuilder;
/**
* Add a ul element to this details element.
* @param actions The actions used to populate the ul element.
*/
ul(actions: BuilderActions<ULBuilder>): DetailsBuilder;
}
/**
* A class that can be used to build a summary element.
*/
export declare class SummaryBuilder extends HTMLElementBuilder {
constructor(text?: TextBuilder);
/**
* Populate this element using the provided action.
* @param actions The actions that will populate this element.
*/
create(actions?: BuilderActions<SummaryBuilder>): string;
}
/**
* A class that can be used to build a ul element.
*/
export declare class ULBuilder extends HTMLElementBuilder {
constructor(text?: TextBuilder);
/**
* Populate this element using the provided action.
* @param actions The actions that will populate this element.
*/
create(actions?: BuilderActions<ULBuilder>): string;
/**
* Add an li element to this ul element.
* @param actions The actions used to populate the li element.
*/
li(actions?: BuilderActions<LIBuilder>): ULBuilder;
}
/**
* A class that can be used to build a li element.
*/
export declare class LIBuilder extends HTMLElementBuilder {
constructor(text?: TextBuilder);
/**
* Populate this element using the provided action.
* @param actions The actions that will populate this element.
*/
create(actions?: BuilderActions<LIBuilder>): string;
/**
* Add a ul element to this li element's content.
* @param ulActions The actions that will create the ul element.
*/
ul(ulActions?: BuilderActions<ULBuilder>): LIBuilder;
/**
* Add a details element to this body element's content.
* @param detailsActions The actions that will create the details element.
*/
details(detailsActions?: BuilderActions<DetailsBuilder>): LIBuilder;
}
/**
* A class that can be used to build a br element.
*/
export declare class BRBuilder extends HTMLElementBuilder {
constructor(text?: TextBuilder);
/**
* Populate this element using the provided action.
* @param actions The actions that will populate this element.
*/
create(actions?: BuilderActions<BRBuilder>): string;
}
/**
* A class that can be used to build a blockquote element.
*/
export declare class BlockQuoteBuilder extends HTMLElementBuilder {
constructor(text?: TextBuilder);
/**
* Populate this element using the provided action.
* @param actions The actions that will populate this element.
*/
create(actions?: BuilderActions<BlockQuoteBuilder>): string;
/**
* Add a ul element to this blockquote element's content.
* @param ulActions The actions that will create the ul element.
*/
ul(ulActions?: BuilderActions<ULBuilder>): BlockQuoteBuilder;
/**
* Add a details element to this blockquote element's content.
* @param detailsActions The actions that will create the details element.
*/
details(detailsActions?: BuilderActions<DetailsBuilder>): BlockQuoteBuilder;
}
/**
* A class that can be used to build a b element.
*/
export declare class BBuilder extends HTMLElementBuilder {
constructor(text?: TextBuilder);
/**
* Populate this element using the provided action.
* @param actions The actions that will populate this element.
*/
create(actions?: BuilderActions<BBuilder>): string;
}
//# sourceMappingURL=htmlBuilder.d.ts.map