lyco
Version:
Lit-based pure layout rendering function library , including Row/Column/Flex/Grid and other commonly used rendering functions .
2 lines • 7.91 kB
JavaScript
import{createEventBinder as e,renderFnOrArray as t,renderFnOrArrayOrCurry as n}from"./core-bQvrG1od.mjs";import{html as r,render as i}from"lit";import{styleMap as a}from"lit/directives/style-map.js";function o(e){return{let(t){return t(e),e}}}const s=o;function c(e){return typeof e==`string`?e:a(e).toString()}function l(t,n){return(a,o)=>{let l=a??{},u=e(l?.on??{}),d=a?.injectFields??(e=>{}),f=n??new Set,p=s(document.createElement(t)).let(e=>{l.className&&(e.className=l.className),l.id&&(e.id=l.id),l.style&&(e.style.cssText=c(l.style)),l.title&&(e.title=l.title),l.lang&&(e.lang=l.lang),l.dir&&(e.dir=l.dir),l.role&&(e.role=l.role),l.ariaLabel&&(e.ariaLabel=l.ariaLabel),l.ariaHidden&&(e.ariaHidden=l.ariaHidden),l.key&&e.setAttribute(`data-key`,l.key.toString())});f.forEach(e=>{l[e]&&(p[e]=l[e])}),l.hidden!==void 0&&(p.hidden=l.hidden),l.draggable!==void 0&&(p.draggable=l.draggable),l.contentEditable!==void 0&&(p.contentEditable=l.contentEditable.toString()),l.spellcheck!==void 0&&(p.spellcheck=l.spellcheck),l.tabIndex!==void 0&&(p.tabIndex=l.tabIndex),l.dataset&&Object.entries(l.dataset).forEach(([e,t])=>{p.dataset[e]=t}),u.bind(p),d(p),i(o,p);let m=document.createElement(`div`);return m.remove=()=>{m.remove(),u.unbindAll()},m.appendChild(p),r`${m.firstElementChild}`}}function u(t,n){return(a,o)=>{let l=a??{},u=e(l.on??{}),d=l?.injectFields??(e=>{}),f=n??new Set,p=s(document.createElementNS(`http://www.w3.org/1998/Math/MathML`,t)).let(e=>{l.className&&(e.className=l.className),l.id&&(e.id=l.id),l.style&&(e.style.cssText=c(l.style)),l.display&&e.setAttribute(`display`,l.display),l.key&&e.setAttribute(`data-key`,l.key.toString()),l.mathbackground&&e.setAttribute(`mathbackground`,l.mathbackground),l.mathcolor&&e.setAttribute(`mathcolor`,l.mathcolor)});f.forEach(e=>{l[e]&&(p[e]=l[e])}),u.bind(p),d(p),typeof o==`object`&&o&&`_$litType$`in o?i(o,p):p.textContent=`${o??``}`;let m=document.createElement(`div`);return m.remove=()=>{m.remove(),u.unbindAll()},m.appendChild(p),r`${m.firstElementChild}`}}function d(t,n){return(a,o)=>{let l=a??{},u=e(l.on??{}),d=l?.injectFields??(e=>{}),f=n??new Set,p=s(document.createElementNS(`http://www.w3.org/2000/svg`,t)).let(e=>{l.className&&e.setAttribute(`class`,l.className),l.id&&(e.id=l.id),l.style&&(e.style.cssText=c(l.style)),l.fill&&e.setAttribute(`fill`,l.fill),l.stroke&&e.setAttribute(`stroke`,l.stroke),l.key&&e.setAttribute(`data-key`,l.key.toString()),l.strokeWidth&&e.setAttribute(`stroke-width`,l.strokeWidth.toString()),l.viewBox&&e.setAttribute(`viewBox`,l.viewBox),l.transform&&e.setAttribute(`transform`,l.transform),l.opacity!==void 0&&e.setAttribute(`opacity`,l.opacity.toString())});f.forEach(e=>{if(l[e]){let t=l[e];if(typeof t==`function`)p[e]=t;else{let n=e.toString().replace(/([A-Z])/g,`-$1`).toLowerCase();p.setAttribute(n,t.toString())}}}),u.bind(p),d(p),typeof o==`object`&&o&&`_$litType$`in o||Array.isArray(o)&&o.length>0&&typeof o[0]==`object`&&`_$litType$`in o[0]?i(o,p):(console.log(`content`,o),p.textContent=`${o??``}`);let m=document.createElement(`div`);return m.remove=()=>{m.remove(),u.unbindAll()},m.appendChild(p),r`${m.firstElementChild}`}}function f(e,r){let i=l(e,r);return(e,r)=>{let a=n=>i(e,t(n));return n(r,a)}}function p(e,r){let i=u(e,r);return(e,r)=>{let a=n=>i(e,t(n));return n(r,a)}}function m(e,r){let i=d(e,r);return(e,r)=>{let a=n=>i(e,t(n));return n(r,a)}}const h={div:f(`div`),p:f(`p`),span:f(`span`),h1:f(`h1`),h2:f(`h2`),h3:f(`h3`),h4:f(`h4`),h5:f(`h5`),h6:f(`h6`),article:f(`article`),section:f(`section`),nav:f(`nav`),aside:f(`aside`),header:f(`header`),footer:f(`footer`),main:f(`main`),ul:f(`ul`),ol:f(`ol`),li:f(`li`),dl:f(`dl`),dt:f(`dt`),dd:f(`dd`),form:f(`form`,new Set([`method`,`action`,`enctype`,`target`,`novalidate`])),label:f(`label`),input:f(`input`),textarea:f(`textarea`,new Set([`cols`,`rows`,`wrap`,`maxLength`,`minLength`,`required`,`disabled`,`readonly`,`name`])),button:f(`button`),select:f(`select`,new Set([`multiple`,`required`,`disabled`,`name`,`size`])),option:f(`option`),table:f(`table`),thead:f(`thead`),tbody:f(`tbody`),tfoot:f(`tfoot`),tr:f(`tr`),th:f(`th`),td:f(`td`),a:f(`a`,new Set([`href`,`target`,`rel`,`download`,`type`])),img:f(`img`,new Set([`src`,`alt`,`width`,`height`,`loading`,`decoding`])),iframe:f(`iframe`),embed:f(`embed`),object:f(`object`),video:f(`video`),audio:f(`audio`),source:f(`source`),track:f(`track`),canvas:f(`canvas`),map:f(`map`),area:f(`area`),summary:f(`summary`),details:f(`details`),slot:f(`slot`),template:f(`template`),style:f(`style`),script:f(`script`),link:f(`link`),meta:f(`meta`),title:f(`title`),base:f(`base`),head:f(`head`),body:f(`body`),html:f(`html`),abbr:f(`abbr`),b:f(`b`),bdi:f(`bdi`),bdo:f(`bdo`),blockquote:f(`blockquote`),br:f(`br`),caption:f(`caption`),cite:f(`cite`),code:f(`code`),col:f(`col`),colgroup:f(`colgroup`),data:f(`data`),del:f(`del`),dfn:f(`dfn`),em:f(`em`),i:f(`i`),kbd:f(`kbd`),mark:f(`mark`),q:f(`q`),rp:f(`rp`),rt:f(`rt`),ruby:f(`ruby`),s:f(`s`),samp:f(`samp`),small:f(`small`),strong:f(`strong`),sub:f(`sub`),sup:f(`sup`),time:f(`time`),u:f(`u`),var:f(`var`),address:f(`address`),progress:f(`progress`),meter:f(`meter`),output:f(`output`),datalist:f(`datalist`),dialog:f(`dialog`),menu:f(`menu`),fieldset:f(`fieldset`),legend:f(`legend`),figcaption:f(`figcaption`),figure:f(`figure`),hgroup:f(`hgroup`),hr:f(`hr`),ins:f(`ins`),noscript:f(`noscript`),optgroup:f(`optgroup`),picture:f(`picture`),pre:f(`pre`),search:f(`search`),wbr:f(`wbr`)},g={math:p(`math`),mstyle:p(`mstyle`),merror:p(`merror`),mtext:p(`mtext`),mspace:p(`mspace`),msqrt:p(`msqrt`),mroot:p(`mroot`),mrow:p(`mrow`),mfrac:p(`mfrac`),msup:p(`msup`),msub:p(`msub`),msubsup:p(`msubsup`),munder:p(`munder`),mover:p(`mover`),munderover:p(`munderover`),mmultiscripts:p(`mmultiscripts`),mtable:p(`mtable`),mtr:p(`mtr`),mtd:p(`mtd`),ms:p(`ms`),mphantom:p(`mphantom`),annotation:p(`annotation`),"annotation-xml":p(`annotation-xml`),mprescripts:p(`mprescripts`),maction:p(`maction`),mi:p(`mi`),mn:p(`mn`),mo:p(`mo`),mpadded:p(`mpadded`),semantics:p(`semantics`)},_={svg:m(`svg`,new Set([`width`,`height`,`xmlns`,`version`])),defs:m(`defs`),desc:m(`desc`),title:m(`title`),metadata:m(`metadata`),g:m(`g`),a:m(`a`),circle:m(`circle`,new Set([`cx`,`cy`,`r`])),ellipse:m(`ellipse`),line:m(`line`),path:m(`path`,new Set([`d`,`pathLength`])),polygon:m(`polygon`),polyline:m(`polyline`),rect:m(`rect`,new Set([`x`,`y`,`width`,`height`,`rx`,`ry`])),use:m(`use`),stop:m(`stop`),tspan:m(`tspan`),text:m(`text`,new Set([`x`,`y`,`fontSize`,`textAnchor`,`fontWeight`])),image:m(`image`),clipPath:m(`clipPath`),linearGradient:m(`linearGradient`),radialGradient:m(`radialGradient`),mask:m(`mask`),pattern:m(`pattern`),marker:m(`marker`),symbol:m(`symbol`),view:m(`view`),animateMotion:m(`animateMotion`),animateTransform:m(`animateTransform`),filter:m(`filter`),style:m(`style`),script:m(`script`),animate:m(`animate`),set:m(`set`),mpath:m(`mpath`),foreignObject:m(`foreignObject`),textPath:m(`textPath`),feBlend:m(`feBlend`),feColorMatrix:m(`feColorMatrix`),feComponentTransfer:m(`feComponentTransfer`),feComposite:m(`feComposite`),feConvolveMatrix:m(`feConvolveMatrix`),feDiffuseLighting:m(`feDiffuseLighting`),feDisplacementMap:m(`feDisplacementMap`),feFlood:m(`feFlood`),feGaussianBlur:m(`feGaussianBlur`),feImage:m(`feImage`),feMerge:m(`feMerge`),feMorphology:m(`feMorphology`),feOffset:m(`feOffset`),feSpecularLighting:m(`feSpecularLighting`),feTile:m(`feTile`),feTurbulence:m(`feTurbulence`),feDistantLight:m(`feDistantLight`),fePointLight:m(`fePointLight`),feSpotLight:m(`feSpotLight`),feFuncR:m(`feFuncR`),feFuncG:m(`feFuncG`),feFuncB:m(`feFuncB`),feFuncA:m(`feFuncA`),feDropShadow:m(`feDropShadow`),feMergeNode:m(`feMergeNode`),switch:m(`switch`)},v=h,y=g,b=_,x={...h,...g,..._};export{x as $AllEl,v as $El,y as $MathEl,b as $SvgEl,h as htmlElements,g as mathmlElements,_ as svgElements};
//# sourceMappingURL=basic.es.js.map