Skip to content

Commit

Permalink
Update element props interface names (#5)
Browse files Browse the repository at this point in the history
* use consistent prop names across all elements

* replace type aliases with interfaces
  • Loading branch information
EthanThatOneKid authored Apr 6, 2024
1 parent 71ccc40 commit 15474fc
Show file tree
Hide file tree
Showing 133 changed files with 1,752 additions and 460 deletions.
44 changes: 35 additions & 9 deletions a.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,62 @@ import type { AnyProps, GlobalAttributes } from "./lib/mod.ts";
import { renderElement } from "./lib/mod.ts";

/**
* AProps are the props for the [`a`](https://developer.mozilla.org/docs/Web/HTML/Element/a) element.
* AElementProps are the props for the [`a`](https://developer.mozilla.org/docs/Web/HTML/Element/a) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/a>
*/
export interface AProps extends GlobalAttributes {
/** @experimental */
export interface AElementProps extends GlobalAttributes {
/**
* `attributionsrc` is an attribute of the [`a`](https://developer.mozilla.org/docs/Web/HTML/Element/a) element.
* @experimental
*/
attributionsrc?: string | undefined;
/** @deprecated */
/**
* `charset` is an attribute of the [`a`](https://developer.mozilla.org/docs/Web/HTML/Element/a) element.
* @deprecated
*/
charset?: string | undefined;
/** @deprecated */
/**
* `coords` is an attribute of the [`a`](https://developer.mozilla.org/docs/Web/HTML/Element/a) element.
* @deprecated
*/
coords?: string | undefined;
/** `download` is an attribute of the [`a`](https://developer.mozilla.org/docs/Web/HTML/Element/a) element. */
download?: string | undefined;
/** `href` is an attribute of the [`a`](https://developer.mozilla.org/docs/Web/HTML/Element/a) element. */
href?: string | undefined;
/** `hreflang` is an attribute of the [`a`](https://developer.mozilla.org/docs/Web/HTML/Element/a) element. */
hreflang?: string | undefined;
/** @deprecated */
/**
* `name` is an attribute of the [`a`](https://developer.mozilla.org/docs/Web/HTML/Element/a) element.
* @deprecated
*/
name?: string | undefined;
/** `ping` is an attribute of the [`a`](https://developer.mozilla.org/docs/Web/HTML/Element/a) element. */
ping?: string | undefined;
/** `referrerpolicy` is an attribute of the [`a`](https://developer.mozilla.org/docs/Web/HTML/Element/a) element. */
referrerpolicy?: string | undefined;
/** `rel` is an attribute of the [`a`](https://developer.mozilla.org/docs/Web/HTML/Element/a) element. */
rel?: string | undefined;
/** @deprecated */
/**
* `rev` is an attribute of the [`a`](https://developer.mozilla.org/docs/Web/HTML/Element/a) element.
* @deprecated
*/
rev?: string | undefined;
/** @deprecated */
/**
* `shape` is an attribute of the [`a`](https://developer.mozilla.org/docs/Web/HTML/Element/a) element.
* @deprecated
*/
shape?: string | undefined;
/** `target` is an attribute of the [`a`](https://developer.mozilla.org/docs/Web/HTML/Element/a) element. */
target?: string | undefined;
/** `type` is an attribute of the [`a`](https://developer.mozilla.org/docs/Web/HTML/Element/a) element. */
type?: string | undefined;
}

/**
* a renders the [`a`](https://developer.mozilla.org/docs/Web/HTML/Element/a) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/a>
*/
export function a(props?: AProps, ...children: string[]): string {
export function a(props?: AElementProps, ...children: string[]): string {
return renderElement("a", props as AnyProps, false, children);
}
9 changes: 8 additions & 1 deletion abbr.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import type { AnyProps, GlobalAttributes } from "./lib/mod.ts";
import { renderElement } from "./lib/mod.ts";

/**
* AbbrElementProps are the props for the [`abbr`](https://developer.mozilla.org/docs/Web/HTML/Element/abbr) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/abbr>
*/
export interface AbbrElementProps extends GlobalAttributes {
}

/**
* abbr renders the [`abbr`](https://developer.mozilla.org/docs/Web/HTML/Element/abbr) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/abbr>
*/
export function abbr(props?: GlobalAttributes, ...children: string[]): string {
export function abbr(props?: AbbrElementProps, ...children: string[]): string {
return renderElement("abbr", props as AnyProps, false, children);
}
10 changes: 9 additions & 1 deletion acronym.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import type { AnyProps, GlobalAttributes } from "./lib/mod.ts";
import { renderElement } from "./lib/mod.ts";

/**
* AcronymElementProps are the props for the [`acronym`](https://developer.mozilla.org/docs/Web/HTML/Element/acronym) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/acronym>
* @deprecated
*/
export interface AcronymElementProps extends GlobalAttributes {
}

/**
* acronym renders the [`acronym`](https://developer.mozilla.org/docs/Web/HTML/Element/acronym) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/acronym>
* @deprecated
*/
export function acronym(
props?: GlobalAttributes,
props?: AcronymElementProps,
...children: string[]
): string {
return renderElement("acronym", props as AnyProps, false, children);
Expand Down
9 changes: 8 additions & 1 deletion address.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import type { AnyProps, GlobalAttributes } from "./lib/mod.ts";
import { renderElement } from "./lib/mod.ts";

/**
* AddressElementProps are the props for the [`address`](https://developer.mozilla.org/docs/Web/HTML/Element/address) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/address>
*/
export interface AddressElementProps extends GlobalAttributes {
}

/**
* address renders the [`address`](https://developer.mozilla.org/docs/Web/HTML/Element/address) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/address>
*/
export function address(
props?: GlobalAttributes,
props?: AddressElementProps,
...children: string[]
): string {
return renderElement("address", props as AnyProps, false, children);
Expand Down
25 changes: 20 additions & 5 deletions area.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,44 @@ import type { AnyProps, GlobalAttributes } from "./lib/mod.ts";
import { renderElement } from "./lib/mod.ts";

/**
* AreaProps are the props for the [`area`](https://developer.mozilla.org/docs/Web/HTML/Element/area) element.
* AreaElementProps are the props for the [`area`](https://developer.mozilla.org/docs/Web/HTML/Element/area) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/area>
*/
export interface AreaProps extends GlobalAttributes {
export interface AreaElementProps extends GlobalAttributes {
/** `alt` is an attribute of the [`area`](https://developer.mozilla.org/docs/Web/HTML/Element/area) element. */
alt?: string | undefined;
/** `coords` is an attribute of the [`area`](https://developer.mozilla.org/docs/Web/HTML/Element/area) element. */
coords?: string | undefined;
/** `download` is an attribute of the [`area`](https://developer.mozilla.org/docs/Web/HTML/Element/area) element. */
download?: string | undefined;
/** `href` is an attribute of the [`area`](https://developer.mozilla.org/docs/Web/HTML/Element/area) element. */
href?: string | undefined;
/** @deprecated */
/**
* `nohref` is an attribute of the [`area`](https://developer.mozilla.org/docs/Web/HTML/Element/area) element.
* @deprecated
*/
nohref?: string | undefined;
/** `ping` is an attribute of the [`area`](https://developer.mozilla.org/docs/Web/HTML/Element/area) element. */
ping?: string | undefined;
/** `referrerpolicy` is an attribute of the [`area`](https://developer.mozilla.org/docs/Web/HTML/Element/area) element. */
referrerpolicy?: string | undefined;
/** `rel` is an attribute of the [`area`](https://developer.mozilla.org/docs/Web/HTML/Element/area) element. */
rel?: string | undefined;
/** `shape` is an attribute of the [`area`](https://developer.mozilla.org/docs/Web/HTML/Element/area) element. */
shape?: string | undefined;
/** @deprecated */
/**
* `tabindex` is an attribute of the [`area`](https://developer.mozilla.org/docs/Web/HTML/Element/area) element.
* @deprecated
*/
tabindex?: string | undefined;
/** `target` is an attribute of the [`area`](https://developer.mozilla.org/docs/Web/HTML/Element/area) element. */
target?: string | undefined;
}

/**
* area renders the [`area`](https://developer.mozilla.org/docs/Web/HTML/Element/area) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/area>
*/
export function area(props?: AreaProps): string {
export function area(props?: AreaElementProps): string {
return renderElement("area", props as AnyProps, true);
}
9 changes: 8 additions & 1 deletion article.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import type { AnyProps, GlobalAttributes } from "./lib/mod.ts";
import { renderElement } from "./lib/mod.ts";

/**
* ArticleElementProps are the props for the [`article`](https://developer.mozilla.org/docs/Web/HTML/Element/article) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/article>
*/
export interface ArticleElementProps extends GlobalAttributes {
}

/**
* article renders the [`article`](https://developer.mozilla.org/docs/Web/HTML/Element/article) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/article>
*/
export function article(
props?: GlobalAttributes,
props?: ArticleElementProps,
...children: string[]
): string {
return renderElement("article", props as AnyProps, false, children);
Expand Down
12 changes: 11 additions & 1 deletion aside.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
import type { AnyProps, GlobalAttributes } from "./lib/mod.ts";
import { renderElement } from "./lib/mod.ts";

/**
* AsideElementProps are the props for the [`aside`](https://developer.mozilla.org/docs/Web/HTML/Element/aside) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/aside>
*/
export interface AsideElementProps extends GlobalAttributes {
}

/**
* aside renders the [`aside`](https://developer.mozilla.org/docs/Web/HTML/Element/aside) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/aside>
*/
export function aside(props?: GlobalAttributes, ...children: string[]): string {
export function aside(
props?: AsideElementProps,
...children: string[]
): string {
return renderElement("aside", props as AnyProps, false, children);
}
18 changes: 15 additions & 3 deletions audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,37 @@ import type { AnyProps, GlobalAttributes } from "./lib/mod.ts";
import { renderElement } from "./lib/mod.ts";

/**
* AudioProps are the props for the [`audio`](https://developer.mozilla.org/docs/Web/HTML/Element/audio) element.
* AudioElementProps are the props for the [`audio`](https://developer.mozilla.org/docs/Web/HTML/Element/audio) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/audio>
*/
export interface AudioProps extends GlobalAttributes {
export interface AudioElementProps extends GlobalAttributes {
/** `autoplay` is an attribute of the [`audio`](https://developer.mozilla.org/docs/Web/HTML/Element/audio) element. */
autoplay?: string | undefined;
/** `controls` is an attribute of the [`audio`](https://developer.mozilla.org/docs/Web/HTML/Element/audio) element. */
controls?: string | undefined;
/** `controlslist` is an attribute of the [`audio`](https://developer.mozilla.org/docs/Web/HTML/Element/audio) element. */
controlslist?: string | undefined;
/** `crossorigin` is an attribute of the [`audio`](https://developer.mozilla.org/docs/Web/HTML/Element/audio) element. */
crossorigin?: string | undefined;
/** `disableremoteplayback` is an attribute of the [`audio`](https://developer.mozilla.org/docs/Web/HTML/Element/audio) element. */
disableremoteplayback?: string | undefined;
/** `loop` is an attribute of the [`audio`](https://developer.mozilla.org/docs/Web/HTML/Element/audio) element. */
loop?: string | undefined;
/** `muted` is an attribute of the [`audio`](https://developer.mozilla.org/docs/Web/HTML/Element/audio) element. */
muted?: string | undefined;
/** `preload` is an attribute of the [`audio`](https://developer.mozilla.org/docs/Web/HTML/Element/audio) element. */
preload?: string | undefined;
/** `src` is an attribute of the [`audio`](https://developer.mozilla.org/docs/Web/HTML/Element/audio) element. */
src?: string | undefined;
}

/**
* audio renders the [`audio`](https://developer.mozilla.org/docs/Web/HTML/Element/audio) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/audio>
*/
export function audio(props?: AudioProps, ...children: string[]): string {
export function audio(
props?: AudioElementProps,
...children: string[]
): string {
return renderElement("audio", props as AnyProps, false, children);
}
9 changes: 8 additions & 1 deletion b.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import type { AnyProps, GlobalAttributes } from "./lib/mod.ts";
import { renderElement } from "./lib/mod.ts";

/**
* BElementProps are the props for the [`b`](https://developer.mozilla.org/docs/Web/HTML/Element/b) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/b>
*/
export interface BElementProps extends GlobalAttributes {
}

/**
* b renders the [`b`](https://developer.mozilla.org/docs/Web/HTML/Element/b) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/b>
*/
export function b(props?: GlobalAttributes, ...children: string[]): string {
export function b(props?: BElementProps, ...children: string[]): string {
return renderElement("b", props as AnyProps, false, children);
}
8 changes: 5 additions & 3 deletions base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ import type { AnyProps, GlobalAttributes } from "./lib/mod.ts";
import { renderElement } from "./lib/mod.ts";

/**
* BaseProps are the props for the [`base`](https://developer.mozilla.org/docs/Web/HTML/Element/base) element.
* BaseElementProps are the props for the [`base`](https://developer.mozilla.org/docs/Web/HTML/Element/base) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/base>
*/
export interface BaseProps extends GlobalAttributes {
export interface BaseElementProps extends GlobalAttributes {
/** `href` is an attribute of the [`base`](https://developer.mozilla.org/docs/Web/HTML/Element/base) element. */
href?: string | undefined;
/** `target` is an attribute of the [`base`](https://developer.mozilla.org/docs/Web/HTML/Element/base) element. */
target?: string | undefined;
}

/**
* base renders the [`base`](https://developer.mozilla.org/docs/Web/HTML/Element/base) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/base>
*/
export function base(props?: BaseProps): string {
export function base(props?: BaseElementProps): string {
return renderElement("base", props as AnyProps, true);
}
9 changes: 8 additions & 1 deletion bdi.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import type { AnyProps, GlobalAttributes } from "./lib/mod.ts";
import { renderElement } from "./lib/mod.ts";

/**
* BdiElementProps are the props for the [`bdi`](https://developer.mozilla.org/docs/Web/HTML/Element/bdi) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/bdi>
*/
export interface BdiElementProps extends GlobalAttributes {
}

/**
* bdi renders the [`bdi`](https://developer.mozilla.org/docs/Web/HTML/Element/bdi) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/bdi>
*/
export function bdi(props?: GlobalAttributes, ...children: string[]): string {
export function bdi(props?: BdiElementProps, ...children: string[]): string {
return renderElement("bdi", props as AnyProps, false, children);
}
9 changes: 8 additions & 1 deletion bdo.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import type { AnyProps, GlobalAttributes } from "./lib/mod.ts";
import { renderElement } from "./lib/mod.ts";

/**
* BdoElementProps are the props for the [`bdo`](https://developer.mozilla.org/docs/Web/HTML/Element/bdo) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/bdo>
*/
export interface BdoElementProps extends GlobalAttributes {
}

/**
* bdo renders the [`bdo`](https://developer.mozilla.org/docs/Web/HTML/Element/bdo) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/bdo>
*/
export function bdo(props?: GlobalAttributes, ...children: string[]): string {
export function bdo(props?: BdoElementProps, ...children: string[]): string {
return renderElement("bdo", props as AnyProps, false, children);
}
10 changes: 9 additions & 1 deletion big.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import type { AnyProps, GlobalAttributes } from "./lib/mod.ts";
import { renderElement } from "./lib/mod.ts";

/**
* BigElementProps are the props for the [`big`](https://developer.mozilla.org/docs/Web/HTML/Element/big) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/big>
* @deprecated
*/
export interface BigElementProps extends GlobalAttributes {
}

/**
* big renders the [`big`](https://developer.mozilla.org/docs/Web/HTML/Element/big) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/big>
* @deprecated
*/
export function big(props?: GlobalAttributes, ...children: string[]): string {
export function big(props?: BigElementProps, ...children: string[]): string {
return renderElement("big", props as AnyProps, false, children);
}
7 changes: 4 additions & 3 deletions blockquote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import type { AnyProps, GlobalAttributes } from "./lib/mod.ts";
import { renderElement } from "./lib/mod.ts";

/**
* BlockquoteProps are the props for the [`blockquote`](https://developer.mozilla.org/docs/Web/HTML/Element/blockquote) element.
* BlockquoteElementProps are the props for the [`blockquote`](https://developer.mozilla.org/docs/Web/HTML/Element/blockquote) element.
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/blockquote>
*/
export interface BlockquoteProps extends GlobalAttributes {
export interface BlockquoteElementProps extends GlobalAttributes {
/** `cite` is an attribute of the [`blockquote`](https://developer.mozilla.org/docs/Web/HTML/Element/blockquote) element. */
cite?: string | undefined;
}

Expand All @@ -14,7 +15,7 @@ export interface BlockquoteProps extends GlobalAttributes {
* @see <https://developer.mozilla.org/docs/Web/HTML/Element/blockquote>
*/
export function blockquote(
props?: BlockquoteProps,
props?: BlockquoteElementProps,
...children: string[]
): string {
return renderElement("blockquote", props as AnyProps, false, children);
Expand Down
Loading

0 comments on commit 15474fc

Please sign in to comment.