import type { NodeHandler, State } from "comark";
import { start } from "./client.ts";
import { css } from "./styles.ts";
import { attr, inlineScript } from "../../../shared/html.ts";
export { default, describeTime, TIME_TAG } from "./index.ts";
export type {
DescribeTimeOptions,
TimeAttributes,
TimeDescription,
TimeMeta,
TimeOptions,
} from "./index.ts";
const inline = inlineScript(`(${start.toString()})("")`);
/**
* The inline scripts this renderer writes, each exactly as it goes in its ``;
};
const time: NodeHandler = ([, attrs], state) => {
const { id, datetime, mode, label, tip, locale, threshold } = attrs;
if (!datetime || !label) return "";
return (
`${timeRuntime(state)}`
);
};
/** The HTML renderer for `:time`. Pass it as `components`; it inlines the styles and the script once per document. */
export const components: Record<"relative-time", NodeHandler> = { "relative-time": time };