UNPKG

jsx-slack

Version:

Build JSON object for Slack Block Kit surfaces from JSX

2 lines (1 loc) 1 kB
const{defineProperty:a,create:s,keys:d,freeze:m}=Object,r="$$jsxslack",i=`${r}Component`,h=(e,t=null,...o)=>{let n=s(null);if(typeof e=="function"){let l={...t||{}},{length:c}=o;c===1?[l.children]=o:c>1&&(l.children=o),n=e(l)}if(n&&typeof n=="object"){for(let l of d(n))n[l]===void 0&&delete n[l];if(!n[r]){let l=o;if(!o.length){let{children:c}=t||{};c!==void 0&&(l=[].concat(c))}a(n,r,{value:{type:e,props:t,children:l}})}}return n},p=(e,t,o={})=>a(t,i,{value:m(a({...o},"name",{value:e,enumerable:!0}))}),u=p("Fragment",({children:e})=>[].concat(e)),y=e=>typeof e=="function"&&!!Object.prototype.hasOwnProperty.call(e,i),f=e=>typeof e=="object"&&!!e&&!!Object.prototype.hasOwnProperty.call(e,r),b=(e,t)=>f(e)&&y(e[r].type)?typeof t=="string"?e[r].type[i].name===t:t?e[r].type===t:!0:!1,j=e=>Array.isArray(e)?[...e]:{...e};export{u as FragmentInternal,j as cleanMeta,p as createComponent,h as createElementInternal,y as isValidComponent,b as isValidElementFromComponent,f as isValidElementInternal};