import type { ElementBuilder } from "./element-builder.js"; import { Attributes, NODE, NodeTarget } from "./element-common.js"; import { applyElement } from "./jsx/common.js"; import { Content } from "./types.js"; /** * Utility for modifying an existing element or {@link ElementBuilder element builder} returned from a component. * * + Event listeners are additive. * + Unique styles, classes, attributes and properties are additive. * + **Styles, classes, attributes and properties that are already set by the component may cause conflicts.** * * @example * ```tsx * * * * ``` */ export function Override(props: { children: unknown } & Attributes): Content { const { children } = props as { children: NodeTarget | Element }; delete props.children; applyElement(NODE in children ? children[NODE] : children, props as Attributes); return children; }