@sakura-ui/markdown 0.0.5-beta.4 → 0.0.5-beta.6

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 CHANGED
@@ -342,7 +342,7 @@ React keys must be passed directly to JSX without using spread:
342
342
  w-full
343
343
  overflow-x-auto
344
344
  whitespace-nowrap
345
- `,t),...r,children:n})},Fi=e=>e.type==="containerDirective"||e.type==="leafDirective"||e.type==="textDirective",Pi=e=>e.type==="containerDirective",Bl=e=>e.type==="leafDirective",WT=e=>e.type==="textDirective";function QT(){return e=>{Et(e,Fi,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,o=r.width,l=r.height,c=r.allow||"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",f=r.referrerpolicy||"strict-origin-when-cross-origin";n.hName="iframe",n.hProperties={title:a,src:"https://www.youtube-nocookie.com/embed/"+u,width:o,height:l,frameBorder:0,allow:c,referrerpolicy:f,allowFullScreen:!0,loading:"lazy"}}})}}const ti={}.hasOwnProperty;function Ml(e,t,n){const r=n&&JT(n);function u(i,a,...o){let l=-1,c;if(i==null){c={type:"root",children:[]};const f=a;o.unshift(f)}else if(c=wo(i,t),c.tagName=c.tagName.toLowerCase(),r&&ti.call(r,c.tagName)&&(c.tagName=r[c.tagName]),GT(a))o.unshift(a);else{let f;for(f in a)ti.call(a,f)&&XT(e,c.properties,f,a[f])}for(;++l<o.length;)ni(c.children,o[l]);return c.type==="element"&&c.tagName==="template"&&(c.content={type:"root",children:c.children},c.children=[]),c}return u}function GT(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 XT(e,t,n,r){const u=Er(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=cr(r):u.commaSeparated?a=Yr(r):u.commaOrSpaceSeparated?a=cr(Yr(r).join(" ")):a=Rs(u,u.property,r):Array.isArray(r)?a=r.concat():a=u.property==="style"?KT(r):String(r);if(Array.isArray(a)){const o=[];for(;++i<a.length;){const l=Rs(u,u.property,a[i]);o[i]=l}a=o}if(u.property==="className"&&Array.isArray(t.className)){const o=a;a=t.className.concat(o)}t[u.property]=a}}function ni(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;)ni(e,t[n]);else if(typeof t=="object"&&"type"in t)t.type==="root"?ni(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function Rs(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||Tn(n)===Tn(t)))return!0}return n}function KT(e){const t=[];let n;for(n in e)ti.call(e,n)&&t.push([n,e[n]].join(": "));return t.join("; ")}function JT(e){const t={};let n=-1;for(;++n<e.length;)t[e[n].toLowerCase()]=e[n];return t}const ZT=["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"],Gt=Ml(Pn,"div");Ml(Kt,"g",ZT);const e2=()=>e=>{Et(e,Fi,function(t){t.data=t.data??{};const n=Gt(t.name,t.attributes||{});t.data.hName=n.tagName,t.data.hProperties=n.properties})};function t2(){return e=>{Et(e,WT,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=Gt(r,t.attributes).properties})}}function n2(){return e=>{Et(e,Pi,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=Gt(u,t.attributes).properties})}}function r2(){return e=>{Et(e,Pi,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=Gt(n,t.attributes).properties,t.children.forEach(r=>{if(!Bl(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=Gt(u,r.attributes).properties})})}}function u2(){return e=>{Et(e,Fi,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=Gt(n,t.attributes).properties,t.children.forEach(r=>{if(r.type!=="containerDirective")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=Gt(u,r.attributes).properties})})}}function i2(){return e=>{Et(e,Pi,t=>{if(t.name!=="faq")return;t.data=t.data??{};const n="dl";t.data.hName=n,t.data.hProperties=Gt(n,t.attributes||{}).properties,t.children.forEach(r=>{if(!Bl(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=Gt(u,r.attributes||{}).properties})})}}const a2=()=>(e,t)=>{const n=[],r=new Rl;Et(e,"heading",i=>{const a={id:r.slug(or(i)),depth:i.depth,value:or(i)};n.push(a)}),console.log(n),t.data.fm||(t.data.fm={}),t.data.fm.headings=mc(n)},Hl=it.createContext({href:""}),s2=({href:e,className:t,children:n,...r})=>{const u=`
345
+ `,t),...r,children:n})},Fi=e=>e.type==="containerDirective"||e.type==="leafDirective"||e.type==="textDirective",Pi=e=>e.type==="containerDirective",Bl=e=>e.type==="leafDirective",WT=e=>e.type==="textDirective",QT=e=>e.type==="heading";function GT(){return e=>{Et(e,Fi,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,o=r.width,l=r.height,c=r.allow||"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",f=r.referrerpolicy||"strict-origin-when-cross-origin";n.hName="iframe",n.hProperties={title:a,src:"https://www.youtube-nocookie.com/embed/"+u,width:o,height:l,frameBorder:0,allow:c,referrerpolicy:f,allowFullScreen:!0,loading:"lazy"}}})}}const ti={}.hasOwnProperty;function Ml(e,t,n){const r=n&&ZT(n);function u(i,a,...o){let l=-1,c;if(i==null){c={type:"root",children:[]};const f=a;o.unshift(f)}else if(c=wo(i,t),c.tagName=c.tagName.toLowerCase(),r&&ti.call(r,c.tagName)&&(c.tagName=r[c.tagName]),XT(a))o.unshift(a);else{let f;for(f in a)ti.call(a,f)&&KT(e,c.properties,f,a[f])}for(;++l<o.length;)ni(c.children,o[l]);return c.type==="element"&&c.tagName==="template"&&(c.content={type:"root",children:c.children},c.children=[]),c}return u}function XT(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 KT(e,t,n,r){const u=Er(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=cr(r):u.commaSeparated?a=Yr(r):u.commaOrSpaceSeparated?a=cr(Yr(r).join(" ")):a=Rs(u,u.property,r):Array.isArray(r)?a=r.concat():a=u.property==="style"?JT(r):String(r);if(Array.isArray(a)){const o=[];for(;++i<a.length;){const l=Rs(u,u.property,a[i]);o[i]=l}a=o}if(u.property==="className"&&Array.isArray(t.className)){const o=a;a=t.className.concat(o)}t[u.property]=a}}function ni(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;)ni(e,t[n]);else if(typeof t=="object"&&"type"in t)t.type==="root"?ni(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function Rs(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||Tn(n)===Tn(t)))return!0}return n}function JT(e){const t=[];let n;for(n in e)ti.call(e,n)&&t.push([n,e[n]].join(": "));return t.join("; ")}function ZT(e){const t={};let n=-1;for(;++n<e.length;)t[e[n].toLowerCase()]=e[n];return t}const e2=["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"],Gt=Ml(Pn,"div");Ml(Kt,"g",e2);const t2=()=>e=>{Et(e,Fi,function(t){t.data=t.data??{};const n=Gt(t.name,t.attributes||{});t.data.hName=n.tagName,t.data.hProperties=n.properties})};function n2(){return e=>{Et(e,WT,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=Gt(r,t.attributes).properties})}}function r2(){return e=>{Et(e,Pi,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=Gt(u,t.attributes).properties})}}function u2(){return e=>{Et(e,Pi,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=Gt(n,t.attributes).properties,t.children.forEach(r=>{if(!Bl(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=Gt(u,r.attributes).properties})})}}function i2(){return e=>{Et(e,Fi,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=Gt(n,t.attributes).properties,t.children.forEach(r=>{if(r.type!=="containerDirective")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=Gt(u,r.attributes).properties})})}}function a2(){return e=>{Et(e,Pi,t=>{if(t.name!=="faq")return;t.data=t.data??{};const n="dl";t.data.hName=n,t.data.hProperties=Gt(n,t.attributes||{}).properties,t.children.forEach(r=>{if(!Bl(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=Gt(u,r.attributes||{}).properties})})}}const s2=()=>(console.log("@@@@@@1"),(e,t)=>{console.log("@@@@@@2");const n=[],r=new Rl;Et(e,QT,i=>{console.log("@@@@@@3");const a={id:r.slug(or(i)),depth:i.depth,value:or(i)};n.push(a)}),console.log(n),t.data.fm||(t.data.fm={}),t.data.fm.headings=mc(n)}),Hl=it.createContext({href:""}),o2=({href:e,className:t,children:n,...r})=>{const u=`
346
346
  grid
347
347
  grid-rows-subgrid
348
348
  outline-offset-4
@@ -354,11 +354,11 @@ React keys must be passed directly to JSX without using spread:
354
354
  `,i=`
355
355
  hover:text-sea-1000
356
356
  hover:border-sea-1000
357
- `,a=e==null?void 0:e.startsWith("https://");return xe.jsx(Hl.Provider,{value:{href:e},children:xe.jsx("a",{className:Qt(u),href:e,target:a?"_blank":"",children:xe.jsx(wl,{className:Qt(i,t),...r,children:n})})})},o2=({className:e,children:t})=>{const{href:n}=it.useContext(Hl),r=`
357
+ `,a=e==null?void 0:e.startsWith("https://");return xe.jsx(Hl.Provider,{value:{href:e},children:xe.jsx("a",{className:Qt(u),href:e,target:a?"_blank":"",children:xe.jsx(wl,{className:Qt(i,t),...r,children:n})})})},l2=({className:e,children:t})=>{const{href:n}=it.useContext(Hl),r=`
358
358
  flex
359
359
  justify-between
360
360
  items-center
361
- `,u=n.startsWith("https://");return xe.jsx(DT,{className:Qt(e,r),children:n===""?t:xe.jsxs(xe.Fragment,{children:[xe.jsxs("span",{children:[t,u?xe.jsx(Zu,{className:"text-base ml-1 font-light",icon:"open_in_new"}):""]}),u?"":xe.jsx(Zu,{className:"text-base-sm !font-medium",icon:"arrow_forward"})]})})},Ul=({items:e})=>xe.jsx(xe.Fragment,{children:e.map(t=>xe.jsxs("li",{children:[xe.jsx(Oi,{href:`#${t.id}`,children:t.value}),t.children?xe.jsx(ei,{children:xe.jsx(Ul,{items:t.children})}):null]},t.id))}),l2=e=>{const{className:t,children:n,...r}=e;return xe.jsx($T,{children:xe.jsx(HT,{className:Qt(t),...r,children:n})})},c2=e=>{const{children:t,href:n,...r}=e;return r["data-node"]==="link-button"?xe.jsx(Ri,{as:"a",variant:"secondary",href:n,children:t}):xe.jsx(Oi,{href:n,...r,children:t})},f2=e=>{const{children:t,className:n,...r}=e;if(r["data-node"]==="card"){if(r["data-behavior"]==="link"){const i=r["data-href"];return xe.jsx(s2,{href:i,className:Qt(n),children:t})}return xe.jsx(wl,{className:Qt(n),children:t})}return xe.jsx("article",{className:n,...r,children:t})},h2=e=>{const{children:t,...n}=e,r=n["data-node"];return r==="card-title"?xe.jsx(o2,{children:t}):r==="card-description"?xe.jsx(yT,{children:t}):r==="card-footer"?xe.jsx(xT,{children:t}):n["data-behavior"]==="list"?xe.jsx("ul",{children:it.Children.map(t,(u,i)=>xe.jsx("li",{className:"sm:grid sm:grid-rows-subgrid",children:u},i))}):xe.jsx("div",{...n,children:t})},d2=e=>{const{children:t,className:n,...r}=e;return r["data-node"]==="card-img"?xe.jsx(CT,{className:Qt("w-full aspect-[352/226]",n),...r}):r["data-node"]==="cell-img"?xe.jsx("img",{className:Qt("mb-4",n),...r}):xe.jsx("img",{className:n,...r})},p2=e=>{const{className:t,children:n,...r}=e,u=`
361
+ `,u=n.startsWith("https://");return xe.jsx(DT,{className:Qt(e,r),children:n===""?t:xe.jsxs(xe.Fragment,{children:[xe.jsxs("span",{children:[t,u?xe.jsx(Zu,{className:"text-base ml-1 font-light",icon:"open_in_new"}):""]}),u?"":xe.jsx(Zu,{className:"text-base-sm !font-medium",icon:"arrow_forward"})]})})},Ul=({items:e})=>xe.jsx(xe.Fragment,{children:e.map(t=>xe.jsxs("li",{children:[xe.jsx(Oi,{href:`#${t.id}`,children:t.value}),t.children?xe.jsx(ei,{children:xe.jsx(Ul,{items:t.children})}):null]},t.id))}),c2=e=>{const{className:t,children:n,...r}=e;return xe.jsx($T,{children:xe.jsx(HT,{className:Qt(t),...r,children:n})})},f2=e=>{const{children:t,href:n,...r}=e;return r["data-node"]==="link-button"?xe.jsx(Ri,{as:"a",variant:"secondary",href:n,children:t}):xe.jsx(Oi,{href:n,...r,children:t})},h2=e=>{const{children:t,className:n,...r}=e;if(r["data-node"]==="card"){if(r["data-behavior"]==="link"){const i=r["data-href"];return xe.jsx(o2,{href:i,className:Qt(n),children:t})}return xe.jsx(wl,{className:Qt(n),children:t})}return xe.jsx("article",{className:n,...r,children:t})},d2=e=>{const{children:t,...n}=e,r=n["data-node"];return r==="card-title"?xe.jsx(l2,{children:t}):r==="card-description"?xe.jsx(yT,{children:t}):r==="card-footer"?xe.jsx(xT,{children:t}):n["data-behavior"]==="list"?xe.jsx("ul",{children:it.Children.map(t,(u,i)=>xe.jsx("li",{className:"sm:grid sm:grid-rows-subgrid",children:u},i))}):xe.jsx("div",{...n,children:t})},p2=e=>{const{children:t,className:n,...r}=e;return r["data-node"]==="card-img"?xe.jsx(CT,{className:Qt("w-full aspect-[352/226]",n),...r}):r["data-node"]==="cell-img"?xe.jsx("img",{className:Qt("mb-4",n),...r}):xe.jsx("img",{className:n,...r})},m2=e=>{const{className:t,children:n,...r}=e,u=`
362
362
  my-8
363
363
  `;let i=`
364
364
  aspect-video
@@ -370,8 +370,8 @@ React keys must be passed directly to JSX without using spread:
370
370
  lg:aspect-auto
371
371
  lg:w-[${e.width}px]
372
372
  lg:h-[${e.height}px]
373
- `),xe.jsx("iframe",{className:Qt(u,i,t),...r,children:n})},m2=({children:e,showToc:t,tocTitle:n="目次"})=>{const[r,u]=it.useState([]),[i,a]=it.useState();it.useEffect(()=>{u(o(e)),a(c(e))},[e]);const o=d=>{const g=Aa().use(Pa).use(a2).parse(d);console.log(g);const m=g.children.filter(T=>T.depth<3);return console.log(m),m},l={...hc,components:{a:c2,article:f2,button:Ri,code:NT,dl:IT,dt:ST,dd:kT,h1:RT,h2:LT,h3:OT,h4:FT,h5:PT,h6:wT,iframe:p2,img:d2,ul:ei,ol:BT,pre:MT,table:l2,caption:UT,thead:jT,tbody:zT,th:YT,tr:qT,td:VT,div:h2}},c=d=>Aa().use(Pa).use(ep).use(Qp).use(Mm).use(e2).use(QT).use(t2).use(r2).use(u2).use(i2).use(n2).use(wm,{allowDangerousHtml:!0}).use(ug).use(mg,{target:"_blank"}).use(gg,{shift:0}).use(pT).use(sT,l).processSync(d).result;return xe.jsxs("div",{className:"py-8 flex flex-col gap-8",children:[t&&xe.jsxs("nav",{className:`
373
+ `),xe.jsx("iframe",{className:Qt(u,i,t),...r,children:n})},E2=({children:e,showToc:t,tocTitle:n="目次"})=>{const[r,u]=it.useState([]),[i,a]=it.useState();it.useEffect(()=>{u(o(e)),a(c(e))},[e]);const o=d=>{const g=Aa().use(Pa).use(s2).parse(d);console.log(g);const m=g.children.filter(T=>T.depth<3);return console.log(m),m},l={...hc,components:{a:f2,article:h2,button:Ri,code:NT,dl:IT,dt:ST,dd:kT,h1:RT,h2:LT,h3:OT,h4:FT,h5:PT,h6:wT,iframe:m2,img:p2,ul:ei,ol:BT,pre:MT,table:c2,caption:UT,thead:jT,tbody:zT,th:YT,tr:qT,td:VT,div:d2}},c=d=>Aa().use(Pa).use(ep).use(Qp).use(Mm).use(t2).use(GT).use(n2).use(u2).use(i2).use(a2).use(r2).use(wm,{allowDangerousHtml:!0}).use(ug).use(mg,{target:"_blank"}).use(gg,{shift:0}).use(pT).use(sT,l).processSync(d).result;return xe.jsxs("div",{className:"py-8 flex flex-col gap-8",children:[t&&xe.jsxs("nav",{className:`
374
374
  rounded-3xl
375
375
  p-10
376
376
  bg-wood-50
377
- `,children:[xe.jsx("h2",{className:"mb-4 font-bold text-h-xs-m sm:text-h-xs",children:n}),xe.jsx(ei,{children:xe.jsx(Ul,{items:r})})]}),i]})};exports.Markdown=m2;
377
+ `,children:[xe.jsx("h2",{className:"mb-4 font-bold text-h-xs-m sm:text-h-xs",children:n}),xe.jsx(ei,{children:xe.jsx(Ul,{items:r})})]}),i]})};exports.Markdown=E2;
package/dist/index.es.js CHANGED
@@ -19159,8 +19159,8 @@ const ei = (e) => {
19159
19159
  overflow-x-auto
19160
19160
  whitespace-nowrap
19161
19161
  `, t), ...r, children: n });
19162
- }, Fi = (e) => e.type === "containerDirective" || e.type === "leafDirective" || e.type === "textDirective", Pi = (e) => e.type === "containerDirective", Bl = (e) => e.type === "leafDirective", GT = (e) => e.type === "textDirective";
19163
- function XT() {
19162
+ }, Fi = (e) => e.type === "containerDirective" || e.type === "leafDirective" || e.type === "textDirective", Pi = (e) => e.type === "containerDirective", Bl = (e) => e.type === "leafDirective", GT = (e) => e.type === "textDirective", XT = (e) => e.type === "heading";
19163
+ function KT() {
19164
19164
  return (e) => {
19165
19165
  Et(e, Fi, function(t) {
19166
19166
  if (t.type === "containerDirective" || t.type === "leafDirective") {
@@ -19186,7 +19186,7 @@ function XT() {
19186
19186
  }
19187
19187
  const ti = {}.hasOwnProperty;
19188
19188
  function Ml(e, t, n) {
19189
- const r = n && e2(n);
19189
+ const r = n && t2(n);
19190
19190
  function u(i, a, ...o) {
19191
19191
  let l = -1, c;
19192
19192
  if (i == null) {
@@ -19196,12 +19196,12 @@ function Ml(e, t, n) {
19196
19196
  a
19197
19197
  );
19198
19198
  o.unshift(f);
19199
- } else if (c = wo(i, t), c.tagName = c.tagName.toLowerCase(), r && ti.call(r, c.tagName) && (c.tagName = r[c.tagName]), KT(a))
19199
+ } else if (c = wo(i, t), c.tagName = c.tagName.toLowerCase(), r && ti.call(r, c.tagName) && (c.tagName = r[c.tagName]), JT(a))
19200
19200
  o.unshift(a);
19201
19201
  else {
19202
19202
  let f;
19203
19203
  for (f in a)
19204
- ti.call(a, f) && JT(e, c.properties, f, a[f]);
19204
+ ti.call(a, f) && ZT(e, c.properties, f, a[f]);
19205
19205
  }
19206
19206
  for (; ++l < o.length; )
19207
19207
  ni(c.children, o[l]);
@@ -19209,7 +19209,7 @@ function Ml(e, t, n) {
19209
19209
  }
19210
19210
  return u;
19211
19211
  }
19212
- function KT(e) {
19212
+ function JT(e) {
19213
19213
  if (e === null || typeof e != "object" || Array.isArray(e))
19214
19214
  return !0;
19215
19215
  if (typeof e.type != "string")
@@ -19234,7 +19234,7 @@ function KT(e) {
19234
19234
  }
19235
19235
  return !!("children" in e && Array.isArray(e.children));
19236
19236
  }
19237
- function JT(e, t, n, r) {
19237
+ function ZT(e, t, n, r) {
19238
19238
  const u = Er(e, n);
19239
19239
  let i = -1, a;
19240
19240
  if (r != null) {
@@ -19243,7 +19243,7 @@ function JT(e, t, n, r) {
19243
19243
  return;
19244
19244
  a = r;
19245
19245
  } else
19246
- typeof r == "boolean" ? a = r : typeof r == "string" ? u.spaceSeparated ? a = cr(r) : u.commaSeparated ? a = Yr(r) : u.commaOrSpaceSeparated ? a = cr(Yr(r).join(" ")) : a = Rs(u, u.property, r) : Array.isArray(r) ? a = r.concat() : a = u.property === "style" ? ZT(r) : String(r);
19246
+ typeof r == "boolean" ? a = r : typeof r == "string" ? u.spaceSeparated ? a = cr(r) : u.commaSeparated ? a = Yr(r) : u.commaOrSpaceSeparated ? a = cr(Yr(r).join(" ")) : a = Rs(u, u.property, r) : Array.isArray(r) ? a = r.concat() : a = u.property === "style" ? e2(r) : String(r);
19247
19247
  if (Array.isArray(a)) {
19248
19248
  const o = [];
19249
19249
  for (; ++i < a.length; ) {
@@ -19287,21 +19287,21 @@ function Rs(e, t, n) {
19287
19287
  }
19288
19288
  return n;
19289
19289
  }
19290
- function ZT(e) {
19290
+ function e2(e) {
19291
19291
  const t = [];
19292
19292
  let n;
19293
19293
  for (n in e)
19294
19294
  ti.call(e, n) && t.push([n, e[n]].join(": "));
19295
19295
  return t.join("; ");
19296
19296
  }
19297
- function e2(e) {
19297
+ function t2(e) {
19298
19298
  const t = {};
19299
19299
  let n = -1;
19300
19300
  for (; ++n < e.length; )
19301
19301
  t[e[n].toLowerCase()] = e[n];
19302
19302
  return t;
19303
19303
  }
19304
- const t2 = [
19304
+ const n2 = [
19305
19305
  "altGlyph",
19306
19306
  "altGlyphDef",
19307
19307
  "altGlyphItem",
@@ -19342,15 +19342,15 @@ const t2 = [
19342
19342
  "textArea",
19343
19343
  "textPath"
19344
19344
  ], Gt = Ml(Pn, "div");
19345
- Ml(Kt, "g", t2);
19346
- const n2 = () => (e) => {
19345
+ Ml(Kt, "g", n2);
19346
+ const r2 = () => (e) => {
19347
19347
  Et(e, Fi, function(t) {
19348
19348
  t.data = t.data ?? {};
19349
19349
  const n = Gt(t.name, t.attributes || {});
19350
19350
  t.data.hName = n.tagName, t.data.hProperties = n.properties;
19351
19351
  });
19352
19352
  };
19353
- function r2() {
19353
+ function u2() {
19354
19354
  return (e) => {
19355
19355
  Et(e, GT, (t) => {
19356
19356
  if (t.name !== "link-button")
@@ -19360,7 +19360,7 @@ function r2() {
19360
19360
  });
19361
19361
  };
19362
19362
  }
19363
- function u2() {
19363
+ function i2() {
19364
19364
  return (e) => {
19365
19365
  Et(e, Pi, (t) => {
19366
19366
  if (!t.name.startsWith("grid-cols-"))
@@ -19386,7 +19386,7 @@ function u2() {
19386
19386
  });
19387
19387
  };
19388
19388
  }
19389
- function i2() {
19389
+ function a2() {
19390
19390
  return (e) => {
19391
19391
  Et(e, Pi, (t) => {
19392
19392
  if (t.name !== "cell")
@@ -19403,7 +19403,7 @@ function i2() {
19403
19403
  });
19404
19404
  };
19405
19405
  }
19406
- function a2() {
19406
+ function s2() {
19407
19407
  return (e) => {
19408
19408
  Et(e, Fi, (t) => {
19409
19409
  if (t.type !== "containerDirective" || t.name !== "card")
@@ -19420,7 +19420,7 @@ function a2() {
19420
19420
  });
19421
19421
  };
19422
19422
  }
19423
- function s2() {
19423
+ function o2() {
19424
19424
  return (e) => {
19425
19425
  Et(e, Pi, (t) => {
19426
19426
  if (t.name !== "faq")
@@ -19437,9 +19437,11 @@ function s2() {
19437
19437
  });
19438
19438
  };
19439
19439
  }
19440
- const o2 = () => (e, t) => {
19440
+ const l2 = () => (console.log("@@@@@@1"), (e, t) => {
19441
+ console.log("@@@@@@2");
19441
19442
  const n = [], r = new Rl();
19442
- Et(e, "heading", (i) => {
19443
+ Et(e, XT, (i) => {
19444
+ console.log("@@@@@@3");
19443
19445
  const a = {
19444
19446
  id: r.slug(or(i)),
19445
19447
  depth: i.depth,
@@ -19447,7 +19449,7 @@ const o2 = () => (e, t) => {
19447
19449
  };
19448
19450
  n.push(a);
19449
19451
  }), console.log(n), t.data.fm || (t.data.fm = {}), t.data.fm.headings = bc(n);
19450
- }, Hl = mt.createContext({ href: "" }), l2 = ({
19452
+ }), Hl = mt.createContext({ href: "" }), c2 = ({
19451
19453
  href: e,
19452
19454
  className: t,
19453
19455
  children: n,
@@ -19475,7 +19477,7 @@ const o2 = () => (e, t) => {
19475
19477
  children: /* @__PURE__ */ xe.jsx(wl, { className: Qt(i, t), ...r, children: n })
19476
19478
  }
19477
19479
  ) });
19478
- }, c2 = ({
19480
+ }, f2 = ({
19479
19481
  className: e,
19480
19482
  children: t
19481
19483
  }) => {
@@ -19494,26 +19496,26 @@ const o2 = () => (e, t) => {
19494
19496
  }, Ul = ({ items: e }) => /* @__PURE__ */ xe.jsx(xe.Fragment, { children: e.map((t) => /* @__PURE__ */ xe.jsxs("li", { children: [
19495
19497
  /* @__PURE__ */ xe.jsx(Oi, { href: `#${t.id}`, children: t.value }),
19496
19498
  t.children ? /* @__PURE__ */ xe.jsx(ei, { children: /* @__PURE__ */ xe.jsx(Ul, { items: t.children }) }) : null
19497
- ] }, t.id)) }), f2 = (e) => {
19499
+ ] }, t.id)) }), h2 = (e) => {
19498
19500
  const { className: t, children: n, ...r } = e;
19499
19501
  return /* @__PURE__ */ xe.jsx(QT, { children: /* @__PURE__ */ xe.jsx(jT, { className: Qt(t), ...r, children: n }) });
19500
- }, h2 = (e) => {
19502
+ }, d2 = (e) => {
19501
19503
  const { children: t, href: n, ...r } = e;
19502
19504
  return r["data-node"] === "link-button" ? /* @__PURE__ */ xe.jsx(Ri, { as: "a", variant: "secondary", href: n, children: t }) : /* @__PURE__ */ xe.jsx(Oi, { href: n, ...r, children: t });
19503
- }, d2 = (e) => {
19505
+ }, p2 = (e) => {
19504
19506
  const { children: t, className: n, ...r } = e;
19505
19507
  if (r["data-node"] === "card") {
19506
19508
  if (r["data-behavior"] === "link") {
19507
19509
  const i = r["data-href"];
19508
- return /* @__PURE__ */ xe.jsx(l2, { href: i, className: Qt(n), children: t });
19510
+ return /* @__PURE__ */ xe.jsx(c2, { href: i, className: Qt(n), children: t });
19509
19511
  }
19510
19512
  return /* @__PURE__ */ xe.jsx(wl, { className: Qt(n), children: t });
19511
19513
  }
19512
19514
  return /* @__PURE__ */ xe.jsx("article", { className: n, ...r, children: t });
19513
- }, p2 = (e) => {
19514
- const { children: t, ...n } = e, r = n["data-node"];
19515
- return r === "card-title" ? /* @__PURE__ */ xe.jsx(c2, { children: t }) : r === "card-description" ? /* @__PURE__ */ xe.jsx(NT, { children: t }) : r === "card-footer" ? /* @__PURE__ */ xe.jsx(IT, { children: t }) : n["data-behavior"] === "list" ? /* @__PURE__ */ xe.jsx("ul", { children: lc.map(t, (u, i) => /* @__PURE__ */ xe.jsx("li", { className: "sm:grid sm:grid-rows-subgrid", children: u }, i)) }) : /* @__PURE__ */ xe.jsx("div", { ...n, children: t });
19516
19515
  }, m2 = (e) => {
19516
+ const { children: t, ...n } = e, r = n["data-node"];
19517
+ return r === "card-title" ? /* @__PURE__ */ xe.jsx(f2, { children: t }) : r === "card-description" ? /* @__PURE__ */ xe.jsx(NT, { children: t }) : r === "card-footer" ? /* @__PURE__ */ xe.jsx(IT, { children: t }) : n["data-behavior"] === "list" ? /* @__PURE__ */ xe.jsx("ul", { children: lc.map(t, (u, i) => /* @__PURE__ */ xe.jsx("li", { className: "sm:grid sm:grid-rows-subgrid", children: u }, i)) }) : /* @__PURE__ */ xe.jsx("div", { ...n, children: t });
19518
+ }, E2 = (e) => {
19517
19519
  const { children: t, className: n, ...r } = e;
19518
19520
  return r["data-node"] === "card-img" ? /* @__PURE__ */ xe.jsx(
19519
19521
  yT,
@@ -19522,7 +19524,7 @@ const o2 = () => (e, t) => {
19522
19524
  ...r
19523
19525
  }
19524
19526
  ) : r["data-node"] === "cell-img" ? /* @__PURE__ */ xe.jsx("img", { className: Qt("mb-4", n), ...r }) : /* @__PURE__ */ xe.jsx("img", { className: n, ...r });
19525
- }, E2 = (e) => {
19527
+ }, b2 = (e) => {
19526
19528
  const { className: t, children: n, ...r } = e, u = `
19527
19529
  my-8
19528
19530
  `;
@@ -19538,13 +19540,13 @@ const o2 = () => (e, t) => {
19538
19540
  lg:w-[${e.width}px]
19539
19541
  lg:h-[${e.height}px]
19540
19542
  `), /* @__PURE__ */ xe.jsx("iframe", { className: Qt(u, i, t), ...r, children: n });
19541
- }, g2 = ({ children: e, showToc: t, tocTitle: n = "目次" }) => {
19543
+ }, T2 = ({ children: e, showToc: t, tocTitle: n = "目次" }) => {
19542
19544
  const [r, u] = mt.useState([]), [i, a] = mt.useState();
19543
19545
  mt.useEffect(() => {
19544
19546
  u(o(e)), a(c(e));
19545
19547
  }, [e]);
19546
19548
  const o = (d) => {
19547
- const g = Aa().use(Pa).use(o2).parse(d);
19549
+ const g = Aa().use(Pa).use(l2).parse(d);
19548
19550
  console.log(g);
19549
19551
  const m = g.children.filter(
19550
19552
  (T) => T.depth < 3
@@ -19553,8 +19555,8 @@ const o2 = () => (e, t) => {
19553
19555
  }, l = {
19554
19556
  ...pc,
19555
19557
  components: {
19556
- a: h2,
19557
- article: d2,
19558
+ a: d2,
19559
+ article: p2,
19558
19560
  button: Ri,
19559
19561
  code: ST,
19560
19562
  dl: kT,
@@ -19566,21 +19568,21 @@ const o2 = () => (e, t) => {
19566
19568
  h4: wT,
19567
19569
  h5: vT,
19568
19570
  h6: BT,
19569
- iframe: E2,
19570
- img: m2,
19571
+ iframe: b2,
19572
+ img: E2,
19571
19573
  ul: ei,
19572
19574
  ol: HT,
19573
19575
  pre: UT,
19574
- table: f2,
19576
+ table: h2,
19575
19577
  caption: zT,
19576
19578
  thead: YT,
19577
19579
  tbody: qT,
19578
19580
  th: VT,
19579
19581
  tr: $T,
19580
19582
  td: WT,
19581
- div: p2
19583
+ div: m2
19582
19584
  }
19583
- }, c = (d) => Aa().use(Pa).use(np).use(Xp).use(Um).use(n2).use(XT).use(r2).use(i2).use(a2).use(s2).use(u2).use(Bm, {
19585
+ }, c = (d) => Aa().use(Pa).use(np).use(Xp).use(Um).use(r2).use(KT).use(u2).use(a2).use(s2).use(o2).use(i2).use(Bm, {
19584
19586
  allowDangerousHtml: !0
19585
19587
  }).use(ag).use(bg, { target: "_blank" }).use(Ag, { shift: 0 }).use(ET).use(lT, l).processSync(d).result;
19586
19588
  return /* @__PURE__ */ xe.jsxs("div", { className: "py-8 flex flex-col gap-8", children: [
@@ -19596,5 +19598,5 @@ const o2 = () => (e, t) => {
19596
19598
  ] });
19597
19599
  };
19598
19600
  export {
19599
- g2 as Markdown
19601
+ T2 as Markdown
19600
19602
  };
@@ -1 +1 @@
1
- {"version":3,"file":"headings.d.ts","sourceRoot":"","sources":["../../../src/plugins/headings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,OAAO,CAAA;AAM1C,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,cAAc,eACX,IAAI,SAAS,GAAG,SAoB/B,CAAA"}
1
+ {"version":3,"file":"headings.d.ts","sourceRoot":"","sources":["../../../src/plugins/headings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,OAAO,CAAA;AAO1C,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,cAAc,eAEX,IAAI,SAAS,GAAG,SAsB/B,CAAA"}
@@ -1,7 +1,9 @@
1
1
  import type { Directives } from 'mdast-util-directive';
2
2
  import { Node } from 'unist';
3
+ import { Heading } from 'mdast';
3
4
  export declare const isDirective: (node: Node) => node is Directives;
4
5
  export declare const isContainerDirective: (node: Node) => node is Directives;
5
6
  export declare const isLeafDirective: (node: Node) => node is Directives;
6
7
  export declare const isTextDirective: (node: Node) => node is Directives;
8
+ export declare const isHeading: (node: Node) => node is Heading;
7
9
  //# sourceMappingURL=helper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../src/plugins/helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAE5B,eAAO,MAAM,WAAW,SAAU,IAAI,uBAMrC,CAAA;AAED,eAAO,MAAM,oBAAoB,SAAU,IAAI,uBAE9C,CAAA;AAED,eAAO,MAAM,eAAe,SAAU,IAAI,uBAEzC,CAAA;AAED,eAAO,MAAM,eAAe,SAAU,IAAI,uBAEzC,CAAA"}
1
+ {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../src/plugins/helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,eAAO,MAAM,WAAW,SAAU,IAAI,uBAMrC,CAAA;AAED,eAAO,MAAM,oBAAoB,SAAU,IAAI,uBAE9C,CAAA;AAED,eAAO,MAAM,eAAe,SAAU,IAAI,uBAEzC,CAAA;AAED,eAAO,MAAM,eAAe,SAAU,IAAI,uBAEzC,CAAA;AAED,eAAO,MAAM,SAAS,SAAU,IAAI,oBAEnC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sakura-ui/markdown",
3
- "version": "0.0.5-beta.4",
3
+ "version": "0.0.5-beta.6",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "glassonion1",