-
-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hiccup-html): add more elems (tables)
- Loading branch information
1 parent
af290ca
commit f0616e6
Showing
4 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { defElements, defElement } from "./def"; | ||
import { NumericAttrib, AttribVal, Attribs } from "./api"; | ||
|
||
export const [table, tbody, tfoot, thead, tr, caption] = defElements([ | ||
"table", | ||
"tbody", | ||
"tfoot", | ||
"thead", | ||
"tr", | ||
"caption", | ||
]); | ||
|
||
export interface TableCellAttribs extends Attribs { | ||
colspan: NumericAttrib; | ||
headers: AttribVal<string | string[]>; | ||
rowspan: NumericAttrib; | ||
} | ||
|
||
export const td = defElement<Partial<TableCellAttribs>>("td"); | ||
|
||
export interface TableCellHeaderAttribs extends TableCellAttribs { | ||
scope: AttribVal<"auto" | "col" | "colgroup" | "row" | "rowgroup">; | ||
} | ||
|
||
export const th = defElement<Partial<TableCellHeaderAttribs>>("th"); | ||
|
||
export interface ColAttribs extends Attribs { | ||
span: NumericAttrib; | ||
} | ||
|
||
export const [col, colgroup] = defElements<Partial<ColAttribs>>([ | ||
"col", | ||
"colgroup", | ||
]); |