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