import { Attributes, ComponentChild, ComponentChildren, JSX, VNode, toChildArray, } from "preact"; import { render } from "preact-render-to-string"; import { writeText } from "copy-paste"; export function Main({ children, ...attributes }: { children?: ComponentChildren; attributes?: Attributes; }) { return (
{...toChildArray(children)}
); } export const HCenter = ({ children, ...attrs }: { children: ComponentChildren; attrs?: Attributes; }) => (
{...toChildArray(children)}
); export const eggbug_emotions = { smiling: ( eggbug, smiling ), } as const; export const EggbugImg = ({ type }: { type: keyof typeof eggbug_emotions }) => eggbug_emotions[type]; export const render_and_copy = (elem: VNode, pretty = false) => { const rendered = render(elem, null, { pretty }); writeText(rendered); console.log(rendered); }; export const mk_class_wrapper = (klass: string) => ({ children }: { children?: ComponentChildren }) =>
{...toChildArray(children)}
; export const slidify = ( Slide: (_: { slide: JSX.Element; next?: JSX.Element; n: number; max: number; }) => JSX.Element, slides: JSX.Element[], n = 1, max = slides.length ): JSX.Element => slides[0] ? ( ) : ( <> ); // https://cohost.org/lexyeevee/post/2107474-css-for-css-baby-3 (wayyy down at the bottom) export const DisappearOnClick = ({ children, className, }: { className?: string; children: ComponentChildren; }) => (
{children}
);