import { CSSObject, css } from "@emotion/css"; import { Children, ClickMessageData, Element, childrenElementList, childrenElementListTag, childrenText, childrenTextTag, } from "./view"; import { mapMapValue } from "./util"; /** * ```html *
* ``` */ export const div = ( option: { id?: string; click?: { stopPropagation: boolean; message: Message }; style?: CSSObject; }, children: ReadonlyMap> | string ): Element => ({ tag: "div", id: idOrUndefined(option.id), class: css(option.style), click: option.click === undefined ? null : { stopPropagation: option.click.stopPropagation, message: option.click.message, ignoreNewTab: false, }, children: childrenFromStringOrElementMap(children), }); /** * ```html * * ``` */ export const externalLink = ( option: { id?: string; url: URL; style?: CSSObject; }, children: ReadonlyMap> | string ): Element => ({ tag: "externalLink", id: idOrUndefined(option.id), class: css(option.style), url: option.url.toString(), children: childrenFromStringOrElementMap(children), }); /** * ```html * * ``` * `externalLink` とは違い, jumpMessage の発火を優先し, 新しいタブを開くような動作をしたら 通常の `` と同じ動きをする */ export const localLink = ( option: { id?: string; url: URL; style?: CSSObject; jumpMessage: Message; }, children: ReadonlyMap> | string ): Element => ({ tag: "localLink", id: idOrUndefined(option.id), class: css(option.style), url: option.url.toString(), jumpMessage: option.jumpMessage, children: childrenFromStringOrElementMap(children), }); /** * ```html *