jsx-slack
Version:
Build JSON object for Slack Block Kit surfaces from JSX
2 lines (1 loc) • 901 B
JavaScript
import{isValidElementInternal as s,createElementInternal as d,FragmentInternal as p,isValidElementFromComponent as m}from"./jsx-internals.mjs";function a(r){return r}(r=>{r.isValidElement=s,r.createElement=d,r.h=d,r.Fragment=p;const c=e=>e.reduce((n,l)=>(Array.isArray(l)&&!m(l)?n.push(...c(l)):l==null||l===!0||l===!1?n.push(null):n.push(l),n),[]),t=e=>c([e]);r.Children=Object.freeze({count:e=>e==null?0:t(e).length,forEach:(e,n)=>{r.Children.map(e,n)},map:(e,n)=>e==null?e:t(e).reduce((l,o,h)=>{const u=n.call(o,o,h);return u!=null&&l.push(u),l},[]),only:e=>{if((0,r.isValidElement)(e))return e;throw new Error("JSXSlack.Children.only expected to receive a single JSXSlack element child.")},toArray:e=>t(e).reduce((n,l)=>l==null?n:m(l,r.Fragment)?n.concat(r.Children.toArray([...l])):[...n,l],[])});let i=!1;r.exactMode=e=>(e!==void 0&&(i=e),i)})(a||(a={})),Object.freeze(a);export{a as JSXSlack};