@sakura-ui/markdown 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +2 -2
- package/dist/index.es.js +20470 -13345
- package/dist/types/components/Markdown.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -414,7 +414,7 @@ Check the top-level render call using <`+_+">.")}return h}function Cr(s,h){if(!(
|
|
|
414
414
|
w-full
|
|
415
415
|
overflow-x-auto
|
|
416
416
|
whitespace-nowrap
|
|
417
|
-
`,t),...r,children:n})},rr=e=>e.type==="containerDirective"||e.type==="leafDirective"||e.type==="textDirective",La=e=>e.type==="containerDirective",R_=e=>e.type==="textDirective",O_=e=>e.type==="heading";function L_(){return e=>{Nt(e,rr,function(t){if(t.type==="containerDirective"||t.type==="leafDirective"){if(t.name!=="youtube")return;const n=t.data||(t.data={}),r=t.attributes||{},u=r.id;u||console.error("Unexpected missing `id` on `youtube` directive");const a=t.children[0].value,l=r.width,c=r.height,f=r.allow||"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",d=r.referrerpolicy||"strict-origin-when-cross-origin";n.hName="iframe",n.hProperties={title:a,src:"https://www.youtube-nocookie.com/embed/"+u,width:l,height:c,frameBorder:0,allow:f,referrerpolicy:d,allowFullScreen:!0,loading:"lazy"}}})}}const Ji={}.hasOwnProperty;function bc(e,t,n){const r=n&&P_(n);function u(i,a,...l){let c=-1,f;if(i==null){f={type:"root",children:[]};const d=a;l.unshift(d)}else if(f=ml(i,t),f.tagName=f.tagName.toLowerCase(),r&&Ji.call(r,f.tagName)&&(f.tagName=r[f.tagName]),F_(a))l.unshift(a);else{let d;for(d in a)Ji.call(a,d)&&v_(e,f.properties,d,a[d])}for(;++c<l.length;)Zi(f.children,l[c]);return f.type==="element"&&f.tagName==="template"&&(f.content={type:"root",children:f.children},f.children=[]),f}return u}function F_(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const r of n){const u=t[r];if(u&&typeof u=="object"){if(!Array.isArray(u))return!0;const i=u;for(const a of i)if(typeof a!="number"&&typeof a!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function v_(e,t,n,r){const u=uu(e,n);let i=-1,a;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;a=r}else typeof r=="boolean"?a=r:typeof r=="string"?u.spaceSeparated?a=Jr(r):u.commaSeparated?a=xu(r):u.commaOrSpaceSeparated?a=Jr(xu(r).join(" ")):a=ao(u,u.property,r):Array.isArray(r)?a=r.concat():a=u.property==="style"?w_(r):String(r);if(Array.isArray(a)){const l=[];for(;++i<a.length;){const c=ao(u,u.property,a[i]);l[i]=c}a=l}if(u.property==="className"&&Array.isArray(t.className)){const l=a;a=t.className.concat(l)}t[u.property]=a}}function Zi(e,t){let n=-1;if(t!=null)if(typeof t=="string"||typeof t=="number")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(;++n<t.length;)Zi(e,t[n]);else if(typeof t=="object"&&"type"in t)t.type==="root"?Zi(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function ao(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||qn(n)===qn(t)))return!0}return n}function w_(e){const t=[];let n;for(n in e)Ji.call(e,n)&&t.push([n,e[n]].join(": "));return t.join("; ")}function P_(e){const t={};let n=-1;for(;++n<e.length;)t[e[n].toLowerCase()]=e[n];return t}const B_=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],gn=bc(ar,"div");bc(Tn,"g",B_);const M_=()=>e=>{Nt(e,rr,function(t){t.data=t.data??{};const n=gn(t.name,t.attributes||{});t.data.hName=n.tagName,t.data.hProperties=n.properties})};function H_(){return e=>{Nt(e,R_,t=>{if(t.name!=="link-button")return;const n=t.data||(t.data={}),r="a";n.hName=r,t.attributes=t.attributes??{},t.attributes["data-node"]=t.name,n.hProperties=gn(r,t.attributes).properties})}}function U_(){return e=>{Nt(e,La,t=>{if(!t.name.startsWith("grid-cols-"))return;t.attributes=t.attributes??{},t.attributes.as==="list"&&(t.attributes.as=void 0,t.attributes["data-behavior"]="list");const n=parseInt(t.name.split("-").pop()||"1"),r={1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-6",8:"md:grid-cols-6",9:"md:grid-cols-6",10:"md:grid-cols-6",11:"md:grid-cols-6",12:"md:grid-cols-12"};t.data=t.data??{};const u="div";t.data.hName=u,t.attributes.class=`flex flex-col md:grid ${r[n]} gap-8`,t.data.hProperties=gn(u,t.attributes).properties})}}function j_(){return e=>{Nt(e,La,t=>{if(t.name!=="cell")return;t.data=t.data??{};const n="div";t.data.hName=n,t.attributes=t.attributes??{},t.attributes["data-node"]=t.name,t.data.hProperties=gn(n,t.attributes).properties,t.children.forEach(r=>{if(!rr(r)||r.name!=="cell-img")return;r.data=r.data??{};const u="img";r.data.hName=u,r.attributes=r.attributes??{},r.attributes["data-node"]=r.name,r.data.hProperties=gn(u,r.attributes).properties})})}}function z_(){return e=>{Nt(e,rr,t=>{if(t.type!=="containerDirective"||t.name!=="card")return;t.data=t.data??{};const n="article";t.data.hName=n,t.attributes=t.attributes??{},t.attributes["data-node"]=t.name,t.attributes.as==="link"&&(t.attributes.as=void 0,t.attributes["data-behavior"]="link",t.attributes["data-href"]=t.attributes.href||""),t.data.hProperties=gn(n,t.attributes).properties,t.children.forEach(r=>{if(!rr(r))return;r.data=r.data??{};let u="div";r.name==="card-img"&&(u="img"),r.data.hName=u,r.attributes=r.attributes??{},r.attributes["data-node"]=r.name,r.data.hProperties=gn(u,r.attributes).properties})})}}function Y_(){return e=>{Nt(e,La,t=>{if(t.name!=="faq")return;t.data=t.data??{};const n="dl";t.data.hName=n,t.data.hProperties=gn(n,t.attributes||{}).properties,t.children.forEach(r=>{if(!rr(r)||r.name!=="faq-q"&&r.name!=="faq-a")return;r.data=r.data??{};const u=r.name==="faq-q"?"dt":"dd";r.data.hName=u,r.data.hProperties=gn(u,r.attributes||{}).properties})})}}const $_=()=>(e,t)=>{const n=[],r=new cc;Nt(e,O_,i=>{const a={id:r.slug(Xr(i)),depth:i.depth,value:Xr(i)};n.push(a)}),t.data.fm||(t.data.fm={}),t.data.fm.headings=qT(n)},Tc=({items:e})=>Ye.jsx(Ye.Fragment,{children:e.map(t=>Ye.jsxs("li",{children:[Ye.jsx(Oa,{href:`#${t.id}`,children:t.value}),t.children?Ye.jsx(Ki,{children:Ye.jsx(Tc,{items:t.children})}):null]},t.id))}),V_=e=>{const{className:t,children:n,...r}=e;return Ye.jsx(I_,{children:Ye.jsx(y_,{className:nr(t),...r,children:n})})},q_=e=>{const{children:t,href:n,...r}=e;return r["data-node"]==="link-button"?Ye.jsx(Ia,{as:"a",variant:"secondary",href:n,children:t}):Ye.jsx(Oa,{href:n,...r,children:t})},W_=e=>{const{children:t,className:n,...r}=e;if(r["data-node"]==="card"){if(r["data-behavior"]==="link"){const i=r["data-href"];return Ye.jsx(s_,{href:i,className:nr(n),children:t})}return Ye.jsx(mc,{className:nr(n),children:t})}return Ye.jsx("article",{className:n,...r,children:t})},G_=e=>{const{children:t,...n}=e,r=n["data-node"];return r==="card-title"?Ye.jsx(o_,{children:t}):r==="card-description"?Ye.jsx(i_,{children:t}):r==="card-footer"?Ye.jsx(a_,{children:t}):n["data-behavior"]==="list"?Ye.jsx("ul",{children:Dt.Children.map(t,(u,i)=>Ye.jsx("li",{className:"sm:grid",children:u},i))}):Ye.jsx("div",{...n,children:t})},Q_=e=>{const{children:t,className:n,...r}=e;return r["data-node"]==="card-img"?Ye.jsx(r_,{className:nr("w-full aspect-[352/226]",n),...r}):r["data-node"]==="cell-img"?Ye.jsx("img",{className:nr("mb-4",n),...r}):Ye.jsx("img",{className:n,...r})},X_=e=>{const{className:t,children:n,...r}=e,u=`
|
|
417
|
+
`,t),...r,children:n})},rr=e=>e.type==="containerDirective"||e.type==="leafDirective"||e.type==="textDirective",La=e=>e.type==="containerDirective",R_=e=>e.type==="textDirective",O_=e=>e.type==="heading";function L_(){return e=>{Nt(e,rr,function(t){if(t.type==="containerDirective"||t.type==="leafDirective"){if(t.name!=="youtube")return;const n=t.data||(t.data={}),r=t.attributes||{},u=r.id;u||console.error("Unexpected missing `id` on `youtube` directive");const a=t.children[0].value,l=r.width,c=r.height,f=r.allow||"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",d=r.referrerpolicy||"strict-origin-when-cross-origin";n.hName="iframe",n.hProperties={title:a,src:"https://www.youtube-nocookie.com/embed/"+u,width:l,height:c,frameBorder:0,allow:f,referrerpolicy:d,allowFullScreen:!0,loading:"lazy"}}})}}const Ji={}.hasOwnProperty;function bc(e,t,n){const r=n&&P_(n);function u(i,a,...l){let c=-1,f;if(i==null){f={type:"root",children:[]};const d=a;l.unshift(d)}else if(f=ml(i,t),f.tagName=f.tagName.toLowerCase(),r&&Ji.call(r,f.tagName)&&(f.tagName=r[f.tagName]),F_(a))l.unshift(a);else{let d;for(d in a)Ji.call(a,d)&&v_(e,f.properties,d,a[d])}for(;++c<l.length;)Zi(f.children,l[c]);return f.type==="element"&&f.tagName==="template"&&(f.content={type:"root",children:f.children},f.children=[]),f}return u}function F_(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const r of n){const u=t[r];if(u&&typeof u=="object"){if(!Array.isArray(u))return!0;const i=u;for(const a of i)if(typeof a!="number"&&typeof a!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function v_(e,t,n,r){const u=uu(e,n);let i=-1,a;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;a=r}else typeof r=="boolean"?a=r:typeof r=="string"?u.spaceSeparated?a=Jr(r):u.commaSeparated?a=xu(r):u.commaOrSpaceSeparated?a=Jr(xu(r).join(" ")):a=ao(u,u.property,r):Array.isArray(r)?a=r.concat():a=u.property==="style"?w_(r):String(r);if(Array.isArray(a)){const l=[];for(;++i<a.length;){const c=ao(u,u.property,a[i]);l[i]=c}a=l}if(u.property==="className"&&Array.isArray(t.className)){const l=a;a=t.className.concat(l)}t[u.property]=a}}function Zi(e,t){let n=-1;if(t!=null)if(typeof t=="string"||typeof t=="number")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(;++n<t.length;)Zi(e,t[n]);else if(typeof t=="object"&&"type"in t)t.type==="root"?Zi(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function ao(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||qn(n)===qn(t)))return!0}return n}function w_(e){const t=[];let n;for(n in e)Ji.call(e,n)&&t.push([n,e[n]].join(": "));return t.join("; ")}function P_(e){const t={};let n=-1;for(;++n<e.length;)t[e[n].toLowerCase()]=e[n];return t}const B_=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],gn=bc(ar,"div");bc(Tn,"g",B_);const M_=()=>e=>{Nt(e,rr,function(t){t.data=t.data??{};const n=gn(t.name,t.attributes||{});t.data.hName=n.tagName,t.data.hProperties=n.properties})};function H_(){return e=>{Nt(e,R_,t=>{if(t.name!=="link-button")return;const n=t.data||(t.data={}),r="a";n.hName=r,t.attributes=t.attributes??{},t.attributes["data-node"]=t.name,n.hProperties=gn(r,t.attributes).properties})}}function U_(){return e=>{Nt(e,La,t=>{if(!t.name.startsWith("grid-cols-"))return;t.attributes=t.attributes??{},t.attributes.as==="list"&&(t.attributes.as=void 0,t.attributes["data-behavior"]="list");const n=parseInt(t.name.split("-").pop()||"1"),r={1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-6",8:"md:grid-cols-6",9:"md:grid-cols-6",10:"md:grid-cols-6",11:"md:grid-cols-6",12:"md:grid-cols-12"};t.data=t.data??{};const u="div";t.data.hName=u,t.attributes.class=`flex flex-col md:grid ${r[n]} gap-8`,t.data.hProperties=gn(u,t.attributes).properties})}}function j_(){return e=>{Nt(e,La,t=>{if(t.name!=="cell")return;t.data=t.data??{};const n="div";t.data.hName=n,t.attributes=t.attributes??{},t.attributes["data-node"]=t.name,t.data.hProperties=gn(n,t.attributes).properties,t.children.forEach(r=>{if(!rr(r)||r.name!=="cell-img")return;r.data=r.data??{};const u="img";r.data.hName=u,r.attributes=r.attributes??{},r.attributes["data-node"]=r.name,r.data.hProperties=gn(u,r.attributes).properties})})}}function z_(){return e=>{Nt(e,rr,t=>{if(t.type!=="containerDirective"||t.name!=="card")return;t.data=t.data??{};const n="article";t.data.hName=n,t.attributes=t.attributes??{},t.attributes["data-node"]=t.name,t.attributes.as==="link"&&(t.attributes.as=void 0,t.attributes["data-behavior"]="link",t.attributes["data-href"]=t.attributes.href||""),t.data.hProperties=gn(n,t.attributes).properties,t.children.forEach(r=>{if(!rr(r))return;r.data=r.data??{};let u="div";r.name==="card-img"&&(u="img"),r.data.hName=u,r.attributes=r.attributes??{},r.attributes["data-node"]=r.name,r.data.hProperties=gn(u,r.attributes).properties})})}}function Y_(){return e=>{Nt(e,La,t=>{if(t.name!=="faq")return;t.data=t.data??{};const n="dl";t.data.hName=n,t.data.hProperties=gn(n,t.attributes||{}).properties,t.children.forEach(r=>{if(!rr(r)||r.name!=="faq-q"&&r.name!=="faq-a")return;r.data=r.data??{};const u=r.name==="faq-q"?"dt":"dd";r.data.hName=u,r.data.hProperties=gn(u,r.attributes||{}).properties})})}}const $_=()=>(e,t)=>{const n=[],r=new cc;Nt(e,O_,i=>{const a={id:r.slug(Xr(i)),depth:i.depth,value:Xr(i)};n.push(a)}),t.data.fm||(t.data.fm={}),t.data.fm.headings=qT(n)},Tc=({items:e})=>Ye.jsx(Ye.Fragment,{children:e.map(t=>Ye.jsxs("li",{children:[Ye.jsx(Oa,{href:`#${t.id}`,children:t.value}),t.children?Ye.jsx(Ki,{children:Ye.jsx(Tc,{items:t.children})}):null]},t.id))}),V_=e=>{const{className:t,children:n,...r}=e;return Ye.jsx(I_,{children:Ye.jsx(y_,{className:nr(t),...r,children:n})})},q_=e=>{const{children:t,href:n,...r}=e;return r["data-node"]==="link-button"?Ye.jsx(Ia,{as:"a",variant:"secondary",href:n,children:t}):Ye.jsx(Oa,{href:n,...r,children:t})},W_=e=>{const{children:t,className:n,...r}=e;if(r["data-node"]==="card"){if(r["data-behavior"]==="link"){const i=r["data-href"];return Ye.jsx(s_,{href:i,className:nr(n),children:t})}return Ye.jsx(mc,{className:nr(n),children:t})}return Ye.jsx("article",{className:n,...r,children:t})},G_=e=>{const{children:t,...n}=e,r=n["data-node"];return r==="card-title"?Ye.jsx(o_,{children:t}):r==="card-description"?Ye.jsx(i_,{children:t}):r==="card-footer"?Ye.jsx(a_,{children:t}):n["data-behavior"]==="list"?Ye.jsx("ul",{className:n.className,children:Dt.Children.map(t,(u,i)=>Ye.jsx("li",{className:"sm:grid",children:u},i))}):Ye.jsx("div",{...n,children:t})},Q_=e=>{const{children:t,className:n,...r}=e;return r["data-node"]==="card-img"?Ye.jsx(r_,{className:nr("w-full aspect-[352/226]",n),...r}):r["data-node"]==="cell-img"?Ye.jsx("img",{className:nr("mb-4",n),...r}):Ye.jsx("img",{className:n,...r})},X_=e=>{const{className:t,children:n,...r}=e,u=`
|
|
418
418
|
my-8
|
|
419
419
|
`;let i=`
|
|
420
420
|
aspect-video
|
|
@@ -426,7 +426,7 @@ Check the top-level render call using <`+_+">.")}return h}function Cr(s,h){if(!(
|
|
|
426
426
|
lg:aspect-auto
|
|
427
427
|
lg:w-[${e.width}px]
|
|
428
428
|
lg:h-[${e.height}px]
|
|
429
|
-
`),Ye.jsx("iframe",{className:nr(u,i,t),...r,children:n})},K_=({children:e,showToc:t,tocTitle:n="目次"})=>{const[r,u]=Dt.useState([]),[i,a]=Dt.useState();Dt.useEffect(()=>{u(l(e)),a(f(e))},[e]);const l=p=>Jd().use($_).processSync(p).data.fm.headings.filter(D=>D.depth<3),c={...Dc,components:{a:q_,article:W_,button:Ia,code:l_,dl:c_,dt:f_,dd:d_,h1:h_,h2:p_,h3:m_,h4:E_,h5:g_,h6:b_,iframe:X_,img:Q_,ul:Ki,ol:__,pre:A_,table:V_,caption:C_,thead:D_,tbody:x_,th:S_,tr:k_,td:N_,div:G_}},f=p=>Uo().use(Do).use(Ip).use(Cm).use(h1).use(M_).use(L_).use(H_).use(j_).use(z_).use(Y_).use(U_).use(c1,{allowDangerousHtml:!0}).use(Fb).use($b,{target:"_blank"}).use(Wb,{shift:0}).use(YT).use(PT,c).processSync(p).result;return Ye.jsxs("div",{className:"py-8 flex flex-col gap-8",children:[t&&Ye.jsxs("nav",{className:`
|
|
429
|
+
`),Ye.jsx("iframe",{className:nr(u,i,t),...r,children:n})},K_=({children:e,showToc:t,tocTitle:n="目次"})=>{const[r,u]=Dt.useState([]),[i,a]=Dt.useState(Ye.jsx(Ye.Fragment,{}));Dt.useEffect(()=>{u(l(e)),a(f(e))},[e]);const l=p=>Jd().use($_).processSync(p).data.fm.headings.filter(D=>D.depth<3),c={...Dc,components:{a:q_,article:W_,button:Ia,code:l_,dl:c_,dt:f_,dd:d_,h1:h_,h2:p_,h3:m_,h4:E_,h5:g_,h6:b_,iframe:X_,img:Q_,ul:Ki,ol:__,pre:A_,table:V_,caption:C_,thead:D_,tbody:x_,th:S_,tr:k_,td:N_,div:G_}},f=p=>Uo().use(Do).use(Ip).use(Cm).use(h1).use(M_).use(L_).use(H_).use(j_).use(z_).use(Y_).use(U_).use(c1,{allowDangerousHtml:!0}).use(Fb).use($b,{target:"_blank"}).use(Wb,{shift:0}).use(YT).use(PT,c).processSync(p).result;return Ye.jsxs("div",{className:"py-8 flex flex-col gap-8",children:[t&&Ye.jsxs("nav",{className:`
|
|
430
430
|
rounded-3xl
|
|
431
431
|
p-10
|
|
432
432
|
bg-wood-50
|