diff --git a/html/cohost-plus.tsx b/html/cohost-plus.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/html/eggbug-spamclick-battle.tsx b/html/eggbug-spamclick-battle.tsx index e69de29..287bcf0 100644 --- a/html/eggbug-spamclick-battle.tsx +++ b/html/eggbug-spamclick-battle.tsx @@ -0,0 +1,12 @@ +import { debug_render } from "./html.ts"; +import { Component } from "./jsx/jsx-runtime.ts"; + +const Eggbug: Component = () => ( + eggbug, smiling +); + +debug_render(); diff --git a/html/hot_people_who_eat_croissants_are_dangerous.tsx b/html/hot_people_who_eat_croissants_are_dangerous.tsx index 9f0cdbd..d603f75 100644 --- a/html/hot_people_who_eat_croissants_are_dangerous.tsx +++ b/html/hot_people_who_eat_croissants_are_dangerous.tsx @@ -8,12 +8,17 @@ const peopleify = (...people: string[]): string[] => const animation_length = (num_items: number): number => /*num_items / 5*/ 3; -const wheel_style = (num_items: number, width?: number, n?: number): string => +const wheel_style = ( + num_items: number, + width?: number, + shl?: number, + n?: number +): string => `transform: translateY(calc(2rem * -${num_items})); animation: ${animation_length( num_items )}s ease-in-out reverse none running spin; ${ width ? `width: ${width * 100}%;` : "" - } ${n ? `margin-left: calc(-${(width ?? 0) * 100}% * ${n})` : ""}`; + } ${shl && n ? `margin-left: -${shl * (n + 1)}px;` : ""}`; const get_delays = (...lengths: number[]): number[] => { let out = [0]; @@ -23,19 +28,24 @@ const get_delays = (...lengths: number[]): number[] => { return out; }; -const Wheel: Component = ({ items, width, n, classes }, _) => ( +const Wheel: Component = ({ items, width, calc_width, shl, n, classes }, _) => (
- {...items.map((i: string) =>
{i}
)} + {/* {...items.map((i: string) =>
{i}
)} */}
{/*
*/} {...items.map((item: string, i: number) => (
{item}
@@ -53,12 +63,14 @@ function weird_slices(arr: T[]): T[][] { return arr.map(item => [...arr.filter(t => t != item), item]); } -const MultiWheel: Component = ({ items, type }, _) => ( +const MultiWheel: Component = ({ items, calc_width, shl, type }, _) => ( - {...weird_slices(items).map((items, n) => ( + {...weird_slices(items).map((sliced_items, n) => ( @@ -72,11 +84,16 @@ const MultiWheel: Component = ({ items, type }, _) => ( // it would be possible to have it so the final text is actually properyly selectable maybe but eh const Take: Component = ({ subjects, objects, adjectives }, _) => (
- {" "} + {" "}
who eat
{" "} - {" "} + {" "}
are
{" "} - +
); diff --git a/html/html.ts b/html/html.ts index 533fc8b..de97f2c 100644 --- a/html/html.ts +++ b/html/html.ts @@ -85,7 +85,8 @@ function indent(str: string, amount = 4, char = " "): string { } // incomplete, obviously -const NON_SELF_CLOSING = ["div", "p", "a"]; +// i hate html +const NON_SELF_CLOSING = ["div", "p", "a", "summary"]; function render_elem( { tag, attributes, children }: NonText,