UNPKG

@copilotkit/a2ui-renderer

Version:

A2UI Renderer for CopilotKit - render A2UI surfaces in React applications

1 lines 1.91 kB
{"version":3,"file":"text.cjs","names":["createLitComponent","TextApi","getBaseLeafStyle"],"sources":["../../../../src/web-components/catalog/basic/text.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport { TextApi } from \"@a2ui/web_core/v0_9/basic_catalog\";\nimport { createLitComponent } from \"../../adapter\";\nimport { getBaseLeafStyle } from \"./utils\";\n\nexport const Text = createLitComponent(TextApi, ({ props }) => {\n const text = props.text ?? \"\";\n const style = { ...getBaseLeafStyle(), display: \"inline-block\" };\n\n switch (props.variant) {\n case \"h1\":\n return html`<h1 style=${styleMap(style)}>${text}</h1>`;\n case \"h2\":\n return html`<h2 style=${styleMap(style)}>${text}</h2>`;\n case \"h3\":\n return html`<h3 style=${styleMap(style)}>${text}</h3>`;\n case \"h4\":\n return html`<h4 style=${styleMap(style)}>${text}</h4>`;\n case \"h5\":\n return html`<h5 style=${styleMap(style)}>${text}</h5>`;\n case \"caption\":\n return html`\n <small\n style=${styleMap({ ...style, color: \"#666\", textAlign: \"left\" })}\n >${text}</small\n >\n `;\n case \"body\":\n default:\n return html`<span style=${styleMap(style)}>${text}</span>`;\n }\n});\n"],"mappings":";;;;;;;AAMA,MAAa,OAAOA,mCAAmBC,4CAAU,EAAE,YAAY;CAC7D,MAAM,OAAO,MAAM,QAAQ;CAC3B,MAAM,QAAQ;EAAE,GAAGC,gCAAkB;EAAE,SAAS;EAAgB;AAEhE,SAAQ,MAAM,SAAd;EACE,KAAK,KACH,QAAO,QAAI,uDAAsB,MAAM,CAAC,GAAG,KAAK;EAClD,KAAK,KACH,QAAO,QAAI,uDAAsB,MAAM,CAAC,GAAG,KAAK;EAClD,KAAK,KACH,QAAO,QAAI,uDAAsB,MAAM,CAAC,GAAG,KAAK;EAClD,KAAK,KACH,QAAO,QAAI,uDAAsB,MAAM,CAAC,GAAG,KAAK;EAClD,KAAK,KACH,QAAO,QAAI,uDAAsB,MAAM,CAAC,GAAG,KAAK;EAClD,KAAK,UACH,QAAO,QAAI;;4DAEU;GAAE,GAAG;GAAO,OAAO;GAAQ,WAAW;GAAQ,CAAC,CAAC;aAC9D,KAAK;;;EAId,QACE,QAAO,QAAI,yDAAwB,MAAM,CAAC,GAAG,KAAK;;EAEtD"}