A world-class math input for the web
1import { createCaretVDOMComponent, h, t } from "@caret-js/core";
2import { subSupTokenType } from "../tokens/subsup";
3
4export const SubSupTokenComponent = createCaretVDOMComponent<
5 typeof subSupTokenType
6>(({ token, children }) => {
7 return h(
8 "span",
9 { class: "subsup" },
10 h(
11 "span",
12 { class: "superscript" },
13 children.get("superscript") ?? t("\u200b"),
14 ),
15 h("span", { class: "subscript" }, children.get("subscript") ?? t("\u200b")),
16 );
17});