lyco
Version:
Lit-based pure layout rendering function library , including Row/Column/Flex/Grid and other commonly used rendering functions .
5 lines • 2.79 kB
JavaScript
import{html as e}from"lit";const t=Symbol(`___LYCO_NULL___`);function n(t){return t?typeof t==`function`?t():t:e``}function r(t,r){let i=r??(e=>e);if(t===void 0)return e``;if(Array.isArray(t))return t.map((e,t)=>i(n(e),t,!0,!1));if(typeof t!=`function`)return i(n(t),void 0,!1,!1);let a=t();return Array.isArray(a)?a.map((e,t)=>i(n(e),t,!0,!1)):i(n(a),void 0,!1,!0)}function i(e){let t=Math.random().toString(36).substring(2,15);return e?`lyco-${e}-${t}`:`lyco-${t}`}function a(e,t){let r=t??(e=>e),i=e=>r(n(e));return e?i(e):i}function o(t,n,i){let a={string:t=>e` ${t} `,number:t=>e` ${t} `},o=typeof t in a?a[typeof t]:t,s=n??(e=>e),c=e=>s(r(e,i));return o?c(o):c}const s=e=>({init:!1,prefix:e,className:t}),c={"GridBreakpoint::grid-breakpoint":s(`grid-breakpoint`),"Hidden::hidden-container":s(`hidden-container`),"ListGroup::list-group":s(`list-group`),"ScrollBar::scrollbar-container":s(`scrollbar-container`),"SkeletonLoader::skeleton":s(`skeleton`),"Swiper::swiper":s(`swiper`),"Table::table":s(`table`),"WaterFlow::waterflow":s(`waterflow`),"AutoFitGrid::auto-fit-grid":s(`auto-fit-grid`),"GridCol::grid-col":s(`grid-col`),"GridRow::grid-row":s(`grid-row`),"List::list":s(`list`),"Dialog::dialog":s(`dialog`),"SwitchInput::switch":s(`switch`),"Combobox::combobox":s(`combobox`)};function l(e){let n=c[e];return n.init||(c[e].init=!0,c[e].className=i(n.prefix)),c[e].className===t?i(n.prefix):c[e].className}const u={all:{value:0}};function d(e){var t;return(t=u[e])?.value||(u[e]={value:0}),u[e].value}function f(t,n){return u.all={value:u.all.value+1},u[t]===void 0?u[t]={value:0}:u[t].value=u[t].value+1,e`
<!-- ${t} - ${u[t].value} -->
${n}
`}var p=class{static applyAnimation(e,t){t.animationClass&&(e.classList.add(t.animationClass),t.duration&&(e.style.animationDuration=`${t.duration}s`),t.delay&&(e.style.animationDelay=`${t.delay}s`)),t.animation&&t.animation(e),t.cssProperties&&Object.keys(t.cssProperties).length>0&&(Object.keys(t.cssProperties).forEach(n=>{e.style[n]=t.cssProperties[n]}),t.duration&&(e.style.transitionDuration=`${t.duration}s`))}};function m(e,t,n){t.forEach(([t,r])=>{if(!r)return;n.has(t)&&e.removeEventListener(t,n.get(t));let i,a;if(typeof r==`function`?(i=r,a=void 0):(i=r.handler,a=r.options),!i)return;let o=e=>i(e);e.addEventListener(t,o,a),n.set(t,o)})}function h(e){let t=new Map,n=Object.entries(e),r={value:null},i={bind(e){m(e,n,t),r.value=e},unbindAll(){t.forEach((e,t)=>{var n;(n=r.value)?.removeEventListener(t,e)}),t.clear(),r.value=null},auto:e=>{e?i.bind(e):i.unbindAll()}};return i}export{p as AnimationAPI,f as LycoComponent,h as createEventBinder,d as getComponentCount,l as getRandomClassName,n as renderFn,r as renderFnOrArray,o as renderFnOrArrayOrCurry,a as renderFnOrCurry};
//# sourceMappingURL=core-bQvrG1od.mjs.map