diff --git a/src/Component.ts b/src/Component.ts index 01fffe9..18893a8 100644 --- a/src/Component.ts +++ b/src/Component.ts @@ -16,11 +16,11 @@ */ import {ElementComponent} from "./index.js"; -type ElementToTagName = { +export type ElementToTagName = { [K in keyof HTMLElementTagNameMap]: HTMLElementTagNameMap[K] extends T ? K : never }[keyof HTMLElementTagNameMap]; -type HtmlTagString = +export type HtmlTagString = `<${{ [K in keyof HTMLElementTagNameMap]: HTMLElementTagNameMap[K] extends T ? K : never }[keyof HTMLElementTagNameMap]}>${string}` | `<${{ [K in keyof HTMLElementTagNameMap]: HTMLElementTagNameMap[K] extends T ? K : never }[keyof HTMLElementTagNameMap]} ${string}`; diff --git a/src/DocumentComponent.ts b/src/DocumentComponent.ts index e7116eb..4d151a7 100644 --- a/src/DocumentComponent.ts +++ b/src/DocumentComponent.ts @@ -28,7 +28,7 @@ export class DocumentComponent extends NodeComponent { * Template literal tag function that accepts HTML code with components in a * string literal * - * @warning This method should only be used with trusted inputs + * @remarks This method should only be used with trusted inputs * to avoid XSS vulnerabilities. */ public static tag(strings: TemplateStringsArray, ...components: (any | NodeComponent)[]): DocumentComponent { diff --git a/src/ElementComponent.ts b/src/ElementComponent.ts index ca0bf74..cae2576 100644 --- a/src/ElementComponent.ts +++ b/src/ElementComponent.ts @@ -19,7 +19,7 @@ import {DocumentComponent, NodeComponent} from "./index.js"; /** * Non-readonly non-method keys */ -type WritableKeys = { +export type WritableKeys = { [Prop in keyof T]: ( (() => G extends Pick ? 1 : 2) extends ( () => G extends Record ? 1 : 2 @@ -32,7 +32,7 @@ type WritableKeys = { /** * Non-method keys */ -type ReadableKeys = { +export type ReadableKeys = { [Prop in keyof T]: T[Prop] extends Function | null | undefined ? never : Prop; }[keyof T]; @@ -106,7 +106,7 @@ export abstract class ElementComponent extends NodeComponent< * Replace classes * * @param oldClasses If all of these classes are present, they will be removed. - * @param newClasses The classes to add if all {@link oldClasses} are present + * @param newClasses The classes to add if all `oldClasses` are present */ public replaceClass(oldClasses: string | string[], newClasses: string | string[]) { const remove = (typeof oldClasses === "string" ? [oldClasses] : oldClasses).flatMap(c => c.split(" ")); diff --git a/src/index.ts b/src/index.ts index a3a0cfd..533c80a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,6 +17,6 @@ export {NodeComponent} from "./NodeComponent.js"; export {DocumentComponent} from "./DocumentComponent.js"; export {TextComponent} from "./TextComponent.js"; -export {ElementComponent} from "./ElementComponent.js"; -export {Component} from "./Component.js"; +export {ElementComponent, ReadableKeys, WritableKeys} from "./ElementComponent.js"; +export {Component, ElementToTagName, HtmlTagString} from "./Component.js"; export {SvgComponent} from "./SvgComponent.js";