@pickaxeproject/react 0.0.57 → 0.0.58

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),r=require("react"),s=require("@tanstack/react-query"),i=require("../../hooks/usePickaxeMarkdownContext.js"),n=require("../common/Action.js"),o=require("../Img/index.js"),a=require("../../../../../../common/api/utils.js"),u=require("../../../../../../common/error.js");exports.default=({node:l,href:c="",children:d})=>{const{accentColor:f,websiteMetadatas:p,linkPreviews:m,actions:h,setWebsiteMetadatas:w}=i.usePickaxeMarkdownContext(),b=c.startsWith("http://")?`https://${c.slice(7)}`:c.startsWith("www.")?`https://${c}`:c;s.useQuery({queryKey:[b],queryFn:()=>(t=>e.__awaiter(void 0,void 0,void 0,(function*(){try{if("development"===process.env.NODE_ENV&&console.log("[getWebsiteMetadata]",t),!t)return null;if(!t.startsWith("https"))return null;if(!t.includes("."))return null;if(["/api/fn/result","/api/function_call_results","https://prod-pickaxe-assets.s3.amazonaws.com"].some((e=>t.includes(e))))return null;const e=(yield a.default.get(`/metadata?url=${encodeURIComponent(t)}`)).data;if(e.error)throw new Error(e.error||"Failed to fetch metadata");return e}catch(e){const t=u.default(e);return"development"===process.env.NODE_ENV&&console.error("[getJobResult]",t),null}})))(b),enabled:"undefined"!=typeof window&&m&&!!b&&!p.some((e=>e.href===b))&&b.includes(".")&&!b.includes("https://prod-pickaxe-assets.s3.amazonaws.com")&&!b.includes("https://pickaxeproject--v2"),retry:2,onSuccess:t=>e.__awaiter(void 0,void 0,void 0,(function*(){t&&(p.some((e=>e.href===t.href))||w((e=>[...e,t])))}))}),r.useEffect((()=>{m&&b&&p.some((e=>e.href===b))}),[m,b,p]);const j=b.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(j&&(null==j?void 0:j[1]))return t.jsx("div",Object.assign({style:{marginTop:"2rem",marginBottom:"2rem",display:"flex",width:"100%",justifyContent:"center"}},{children:t.jsx("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${j[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));return b.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif)$/)?t.jsx(o.default,{src:b,alt:"string"==typeof d?d:"Markdown Image"}):h&&b.includes("pickaxe")&&(b.includes("/api/fn/result")||b.includes("/api/function_call_results"))?t.jsx(n.default,{jobUrl:b}):t.jsx("a",Object.assign({href:b,target:"_blank",rel:"noopener noreferrer",style:{color:f,fontWeight:600}},{children:d}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),r=require("react"),s=require("@tanstack/react-query"),i=require("../../hooks/usePickaxeMarkdownContext.js"),o=require("../common/Action.js"),n=require("../Img/index.js"),a=require("../../../../../../common/api/utils.js"),u=require("../../../../../../common/error.js");exports.default=({node:c,href:l="",children:d})=>{const{accentColor:p,websiteMetadatas:f,linkPreviews:m,actions:h,setWebsiteMetadatas:w}=i.usePickaxeMarkdownContext(),[b,j]=r.useState("");r.useEffect((()=>{if(!l)return;const e=l.startsWith("http://")?`https://${l.slice(7)}`:l.startsWith("www.")?`https://${l}`:l;e!==b&&j(e)}),[l,b]),s.useQuery({queryKey:["website-metadata",b],queryFn:()=>{return t=b,e.__awaiter(void 0,void 0,void 0,(function*(){try{if("development"===process.env.NODE_ENV&&console.log("[getWebsiteMetadata]",t),!t||!t.startsWith("https")||!t.includes("."))return null;if(["/api/fn/result","/api/function_call_results","https://prod-pickaxe-assets.s3.amazonaws.com"].some((e=>t.includes(e))))return null;const e=(yield a.default.get(`/metadata?url=${encodeURIComponent(t)}`)).data;if(e.error)throw new Error(e.error||"Failed to fetch metadata");return e}catch(e){if("development"===process.env.NODE_ENV){const t=u.default(e);console.error("[getJobResult]",t)}return null}}));var t},enabled:"undefined"!=typeof window&&m&&Boolean(b)&&!f.some((e=>e.href===b))&&b.includes(".")&&!b.includes("https://prod-pickaxe-assets")&&!b.includes("https://pickaxeproject--v2"),retry:2,onSuccess:t=>e.__awaiter(void 0,void 0,void 0,(function*(){t&&(f.some((e=>e.href===t.href))||w((e=>[...e,t])))}))});const v=b.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(v&&(null==v?void 0:v[1]))return t.jsx("div",Object.assign({style:{marginTop:"2rem",marginBottom:"2rem",display:"flex",width:"100%",justifyContent:"center"}},{children:t.jsx("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${v[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));return b.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif)$/)?t.jsx(n.default,{src:b,alt:"string"==typeof d?d:"Markdown Image"}):h&&b.includes("pickaxe")&&(b.includes("/api/fn/result")||b.includes("/api/function_call_results"))?t.jsx(o.default,{jobUrl:b}):t.jsx("a",Object.assign({href:b,target:"_blank",rel:"noopener noreferrer",style:{color:p,fontWeight:600}},{children:d}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),t=require("./hooks/usePickaxeMarkdownContext.js"),r=require("react-markdown"),s=require("remark-gfm"),n=require("remark-math"),l=require("rehype-katex"),d=require("./Custom/A/index.js"),a=require("./Custom/P/index.js"),c=require("./Custom/Img/index.js"),o=require("./Custom/Iframe/index.js"),h=require("./Custom/Code/index.js"),m=require("./Custom/common/LinkPreview.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var j=u(r),x=u(s),g=u(n),f=u(l);exports.PickaxeMarkdownRenderer=({className:r,style:s,value:n,recursion:l=!1})=>{const{theme:u,websiteMetadatas:p}=t.usePickaxeMarkdownContext(),b=i.useRef(null),y=i.useMemo((()=>{if(!n)return"";let e=n;return e=n.replace(/<!--[\s\S]*?-->/g,""),e=n.replace(/\u200B/g,""),e}),[n]),k={h1:({node:i,children:t})=>e.jsx("h1",Object.assign({style:{fontSize:"2.25rem",lineHeight:"2.5rem"}},{children:t})),h2:({node:i,children:t})=>e.jsx("h2",Object.assign({style:{fontSize:"1.875rem",lineHeight:"2.25rem"}},{children:t})),h3:({node:i,children:t})=>e.jsx("h3",Object.assign({style:{fontSize:"1.5rem",lineHeight:"2rem"}},{children:t})),h4:({node:i,children:t})=>e.jsx("h4",Object.assign({className:"mt-2 text-xl",style:{fontSize:"1.25rem",lineHeight:"1.75rem"}},{children:t})),h5:({node:i,children:t})=>e.jsx("h5",Object.assign({style:{fontSize:"1.125rem",lineHeight:"1.75rem"}},{children:t})),p:a.default,a:d.default,ol:({node:i,children:t})=>e.jsx("ol",Object.assign({style:{listStyleType:"decimal",listStylePosition:"inside",paddingLeft:"1.5rem",whiteSpace:"normal"}},{children:t})),ul:({node:i,children:t})=>e.jsx("ul",Object.assign({style:{listStyleType:"disc",listStylePosition:"inside",paddingLeft:"1.5rem",whiteSpace:"normal"}},{children:t})),li:({node:i,children:t})=>e.jsx("li",Object.assign({style:{whiteSpace:"normal"}},{children:t})),table:({children:i})=>e.jsx("div",Object.assign({className:"overflow-auto"},{children:e.jsx("table",Object.assign({style:{tableLayout:"fixed",fontSize:"0.875rem",lineHeight:"1.24rem"}},{children:i}))})),th:({node:i,children:t})=>e.jsx("th",Object.assign({style:{padding:"0.75em 1em",fontWeight:600,textAlign:"left"}},{children:t})),tr:({node:i,children:t})=>e.jsx("tr",Object.assign({style:{border:"dark"===u?"1px solid #30363D":"1px solid #D0D7DE"}},{children:t})),td:({node:i,children:t})=>e.jsx("td",Object.assign({style:{padding:"0.75em 1em"}},{children:t})),code:h.default,blockquote:({node:i,children:t})=>e.jsx("blockquote",Object.assign({style:{lineHeight:"15px",borderLeft:"dark"===u?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===u?"#8B8B8B":"#656D76",paddingLeft:"1rem",marginBottom:"1rem"}},{children:t})),img:c.default,iframe:o.default};return e.jsxs("div",Object.assign({className:"pxe-markdown",ref:b,style:Object.assign({position:"relative",whiteSpace:"pre-wrap"},s)},{children:[e.jsx(j.default,Object.assign({},r&&{className:r},{components:k,remarkPlugins:[x.default,g.default],rehypePlugins:[f.default]},{children:y})),!l&&p.length>0&&e.jsx("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"2rem"}},{children:p.map(((i,t)=>e.jsx(m.default,{data:i},t)))}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),r=require("./hooks/usePickaxeMarkdownContext.js"),t=require("react-markdown"),s=require("remark-gfm"),n=require("remark-math"),l=require("rehype-katex"),d=require("./Custom/A/index.js"),a=require("./Custom/P/index.js"),o=require("./Custom/Img/index.js"),c=require("./Custom/Iframe/index.js"),h=require("./Custom/Code/index.js"),m=require("./Custom/common/LinkPreview.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var j=u(t),x=u(s),g=u(n),f=u(l);exports.PickaxeMarkdownRenderer=({className:t,style:s,value:n,recursion:l=!1})=>{const{theme:u,websiteMetadatas:p}=r.usePickaxeMarkdownContext(),b=i.useRef(null),y=i.useMemo((()=>{if(!n)return"";let e=n;return e=n.replace(/<!--[\s\S]*?-->/g,""),e=n.replace(/\u200B/g,""),e}),[n]),k={h1:({node:i,children:r})=>e.jsx("h1",Object.assign({style:{fontSize:"2.25rem",lineHeight:"2.5rem"}},{children:r})),h2:({node:i,children:r})=>e.jsx("h2",Object.assign({style:{fontSize:"1.875rem",lineHeight:"2.25rem"}},{children:r})),h3:({node:i,children:r})=>e.jsx("h3",Object.assign({style:{fontSize:"1.5rem",lineHeight:"2rem"}},{children:r})),h4:({node:i,children:r})=>e.jsx("h4",Object.assign({className:"mt-2 text-xl",style:{fontSize:"1.25rem",lineHeight:"1.75rem"}},{children:r})),h5:({node:i,children:r})=>e.jsx("h5",Object.assign({style:{fontSize:"1.125rem",lineHeight:"1.75rem"}},{children:r})),p:a.default,a:d.default,ol:({node:i,children:r})=>e.jsx("ol",Object.assign({style:{listStyleType:"decimal",listStylePosition:"inside",paddingLeft:"1.5rem",whiteSpace:"normal"}},{children:r})),ul:({node:i,children:r})=>e.jsx("ul",Object.assign({style:{listStyleType:"disc",listStylePosition:"inside",paddingLeft:"1.5rem",whiteSpace:"normal"}},{children:r})),li:({node:i,children:r})=>e.jsx("li",Object.assign({style:{whiteSpace:"normal"}},{children:r})),table:({children:i})=>e.jsx("div",Object.assign({className:"overflow-auto"},{children:e.jsx("table",Object.assign({style:{tableLayout:"fixed",fontSize:"0.875rem",lineHeight:"1.24rem"}},{children:i}))})),th:({node:i,children:r})=>e.jsx("th",Object.assign({style:{padding:"0.75em 1em",fontWeight:600,textAlign:"left"}},{children:r})),tr:({node:i,children:r})=>e.jsx("tr",Object.assign({style:{border:"dark"===u?"1px solid #30363D":"1px solid #D0D7DE"}},{children:r})),td:({node:i,children:r})=>e.jsx("td",Object.assign({style:{padding:"0.75em 1em"}},{children:r})),code:h.default,blockquote:({node:i,children:r})=>e.jsx("blockquote",Object.assign({style:{lineHeight:"15px",borderLeft:"dark"===u?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===u?"#8B8B8B":"#656D76",paddingLeft:"1rem",marginBottom:"1rem"}},{children:r})),img:o.default,iframe:c.default,hr:()=>e.jsx("hr",{style:{border:0,borderTop:"dark"===u?"1px solid #30363D":"1px solid #D0D7DE"}})};return e.jsxs("div",Object.assign({className:"pxe-markdown",ref:b,style:Object.assign({position:"relative",whiteSpace:"pre-wrap"},s)},{children:[e.jsx(j.default,Object.assign({},t&&{className:t},{components:k,remarkPlugins:[x.default,g.default],rehypePlugins:[f.default]},{children:`${y}${!l&&p.length>0?"\n\n---":""}`})),!l&&p.length>0&&e.jsx("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"2rem",marginTop:"2rem"}},{children:p.map(((i,r)=>e.jsx(m.default,{data:i},r)))}))]}))};
@@ -1,4 +1,4 @@
1
1
  import type { Node } from "../../Renderer";
2
- import { FC, ComponentPropsWithoutRef } from "react";
2
+ import { type FC, ComponentPropsWithoutRef } from "react";
3
3
  declare const A: FC<ComponentPropsWithoutRef<"a"> & Node>;
4
4
  export default A;
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../../../../../_virtual/_tslib.js";import{jsx as t}from"react/jsx-runtime";import{useEffect as r}from"react";import{useQuery as o}from"@tanstack/react-query";import{usePickaxeMarkdownContext as s}from"../../hooks/usePickaxeMarkdownContext.js";import n from"../common/Action.js";import i from"../Img/index.js";import a from"../../../../../../common/api/utils.js";import c from"../../../../../../common/error.js";const l=({node:l,href:m="",children:u})=>{const{accentColor:d,websiteMetadatas:p,linkPreviews:f,actions:h,setWebsiteMetadatas:w}=s(),b=m.startsWith("http://")?`https://${m.slice(7)}`:m.startsWith("www.")?`https://${m}`:m;o({queryKey:[b],queryFn:()=>(t=>e(void 0,void 0,void 0,(function*(){try{if("development"===process.env.NODE_ENV&&console.log("[getWebsiteMetadata]",t),!t)return null;if(!t.startsWith("https"))return null;if(!t.includes("."))return null;if(["/api/fn/result","/api/function_call_results","https://prod-pickaxe-assets.s3.amazonaws.com"].some((e=>t.includes(e))))return null;const e=(yield a.get(`/metadata?url=${encodeURIComponent(t)}`)).data;if(e.error)throw new Error(e.error||"Failed to fetch metadata");return e}catch(e){const t=c(e);return"development"===process.env.NODE_ENV&&console.error("[getJobResult]",t),null}})))(b),enabled:"undefined"!=typeof window&&f&&!!b&&!p.some((e=>e.href===b))&&b.includes(".")&&!b.includes("https://prod-pickaxe-assets.s3.amazonaws.com")&&!b.includes("https://pickaxeproject--v2"),retry:2,onSuccess:t=>e(void 0,void 0,void 0,(function*(){t&&(p.some((e=>e.href===t.href))||w((e=>[...e,t])))}))}),r((()=>{f&&b&&p.some((e=>e.href===b))}),[f,b,p]);const g=b.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(g&&(null==g?void 0:g[1]))return t("div",Object.assign({style:{marginTop:"2rem",marginBottom:"2rem",display:"flex",width:"100%",justifyContent:"center"}},{children:t("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${g[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));return b.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif)$/)?t(i,{src:b,alt:"string"==typeof u?u:"Markdown Image"}):h&&b.includes("pickaxe")&&(b.includes("/api/fn/result")||b.includes("/api/function_call_results"))?t(n,{jobUrl:b}):t("a",Object.assign({href:b,target:"_blank",rel:"noopener noreferrer",style:{color:d,fontWeight:600}},{children:u}))};export{l as default};
1
+ import{__awaiter as e}from"../../../../../../_virtual/_tslib.js";import{jsx as t}from"react/jsx-runtime";import{useState as r,useEffect as o}from"react";import{useQuery as s}from"@tanstack/react-query";import{usePickaxeMarkdownContext as i}from"../../hooks/usePickaxeMarkdownContext.js";import n from"../common/Action.js";import a from"../Img/index.js";import c from"../../../../../../common/api/utils.js";import l from"../../../../../../common/error.js";const m=({node:m,href:u="",children:d})=>{const{accentColor:p,websiteMetadatas:f,linkPreviews:h,actions:w,setWebsiteMetadatas:b}=i(),[g,v]=r("");o((()=>{if(!u)return;const e=u.startsWith("http://")?`https://${u.slice(7)}`:u.startsWith("www.")?`https://${u}`:u;e!==g&&v(e)}),[u,g]),s({queryKey:["website-metadata",g],queryFn:()=>{return t=g,e(void 0,void 0,void 0,(function*(){try{if("development"===process.env.NODE_ENV&&console.log("[getWebsiteMetadata]",t),!t||!t.startsWith("https")||!t.includes("."))return null;if(["/api/fn/result","/api/function_call_results","https://prod-pickaxe-assets.s3.amazonaws.com"].some((e=>t.includes(e))))return null;const e=(yield c.get(`/metadata?url=${encodeURIComponent(t)}`)).data;if(e.error)throw new Error(e.error||"Failed to fetch metadata");return e}catch(e){if("development"===process.env.NODE_ENV){const t=l(e);console.error("[getJobResult]",t)}return null}}));var t},enabled:"undefined"!=typeof window&&h&&Boolean(g)&&!f.some((e=>e.href===g))&&g.includes(".")&&!g.includes("https://prod-pickaxe-assets")&&!g.includes("https://pickaxeproject--v2"),retry:2,onSuccess:t=>e(void 0,void 0,void 0,(function*(){t&&(f.some((e=>e.href===t.href))||b((e=>[...e,t])))}))});const y=g.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(y&&(null==y?void 0:y[1]))return t("div",Object.assign({style:{marginTop:"2rem",marginBottom:"2rem",display:"flex",width:"100%",justifyContent:"center"}},{children:t("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${y[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));return g.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif)$/)?t(a,{src:g,alt:"string"==typeof d?d:"Markdown Image"}):w&&g.includes("pickaxe")&&(g.includes("/api/fn/result")||g.includes("/api/function_call_results"))?t(n,{jobUrl:g}):t("a",Object.assign({href:g,target:"_blank",rel:"noopener noreferrer",style:{color:p,fontWeight:600}},{children:d}))};export{m as default};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as i}from"react/jsx-runtime";import{useRef as t,useMemo as r}from"react";import{usePickaxeMarkdownContext as n}from"./hooks/usePickaxeMarkdownContext.js";import l from"react-markdown";import s from"remark-gfm";import o from"remark-math";import d from"rehype-katex";import m from"./Custom/A/index.js";import a from"./Custom/P/index.js";import c from"./Custom/Img/index.js";import h from"./Custom/Iframe/index.js";import p from"./Custom/Code/index.js";import g from"./Custom/common/LinkPreview.js";const f=({className:f,style:b,value:j,recursion:y=!1})=>{const{theme:u,websiteMetadatas:x}=n(),O=t(null),k=r((()=>{if(!j)return"";let e=j;return e=j.replace(/<!--[\s\S]*?-->/g,""),e=j.replace(/\u200B/g,""),e}),[j]),S={h1:({node:e,children:t})=>i("h1",Object.assign({style:{fontSize:"2.25rem",lineHeight:"2.5rem"}},{children:t})),h2:({node:e,children:t})=>i("h2",Object.assign({style:{fontSize:"1.875rem",lineHeight:"2.25rem"}},{children:t})),h3:({node:e,children:t})=>i("h3",Object.assign({style:{fontSize:"1.5rem",lineHeight:"2rem"}},{children:t})),h4:({node:e,children:t})=>i("h4",Object.assign({className:"mt-2 text-xl",style:{fontSize:"1.25rem",lineHeight:"1.75rem"}},{children:t})),h5:({node:e,children:t})=>i("h5",Object.assign({style:{fontSize:"1.125rem",lineHeight:"1.75rem"}},{children:t})),p:a,a:m,ol:({node:e,children:t})=>i("ol",Object.assign({style:{listStyleType:"decimal",listStylePosition:"inside",paddingLeft:"1.5rem",whiteSpace:"normal"}},{children:t})),ul:({node:e,children:t})=>i("ul",Object.assign({style:{listStyleType:"disc",listStylePosition:"inside",paddingLeft:"1.5rem",whiteSpace:"normal"}},{children:t})),li:({node:e,children:t})=>i("li",Object.assign({style:{whiteSpace:"normal"}},{children:t})),table:({children:e})=>i("div",Object.assign({className:"overflow-auto"},{children:i("table",Object.assign({style:{tableLayout:"fixed",fontSize:"0.875rem",lineHeight:"1.24rem"}},{children:e}))})),th:({node:e,children:t})=>i("th",Object.assign({style:{padding:"0.75em 1em",fontWeight:600,textAlign:"left"}},{children:t})),tr:({node:e,children:t})=>i("tr",Object.assign({style:{border:"dark"===u?"1px solid #30363D":"1px solid #D0D7DE"}},{children:t})),td:({node:e,children:t})=>i("td",Object.assign({style:{padding:"0.75em 1em"}},{children:t})),code:p,blockquote:({node:e,children:t})=>i("blockquote",Object.assign({style:{lineHeight:"15px",borderLeft:"dark"===u?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===u?"#8B8B8B":"#656D76",paddingLeft:"1rem",marginBottom:"1rem"}},{children:t})),img:c,iframe:h};return e("div",Object.assign({className:"pxe-markdown",ref:O,style:Object.assign({position:"relative",whiteSpace:"pre-wrap"},b)},{children:[i(l,Object.assign({},f&&{className:f},{components:S,remarkPlugins:[s,o],rehypePlugins:[d]},{children:k})),!y&&x.length>0&&i("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"2rem"}},{children:x.map(((e,t)=>i(g,{data:e},t)))}))]}))};export{f as PickaxeMarkdownRenderer};
1
+ import{jsxs as e,jsx as i}from"react/jsx-runtime";import{useRef as t,useMemo as r}from"react";import{usePickaxeMarkdownContext as n}from"./hooks/usePickaxeMarkdownContext.js";import l from"react-markdown";import s from"remark-gfm";import o from"remark-math";import d from"rehype-katex";import m from"./Custom/A/index.js";import a from"./Custom/P/index.js";import c from"./Custom/Img/index.js";import h from"./Custom/Iframe/index.js";import p from"./Custom/Code/index.js";import g from"./Custom/common/LinkPreview.js";const f=({className:f,style:b,value:y,recursion:j=!1})=>{const{theme:u,websiteMetadatas:x}=n(),O=t(null),k=r((()=>{if(!y)return"";let e=y;return e=y.replace(/<!--[\s\S]*?-->/g,""),e=y.replace(/\u200B/g,""),e}),[y]),S={h1:({node:e,children:t})=>i("h1",Object.assign({style:{fontSize:"2.25rem",lineHeight:"2.5rem"}},{children:t})),h2:({node:e,children:t})=>i("h2",Object.assign({style:{fontSize:"1.875rem",lineHeight:"2.25rem"}},{children:t})),h3:({node:e,children:t})=>i("h3",Object.assign({style:{fontSize:"1.5rem",lineHeight:"2rem"}},{children:t})),h4:({node:e,children:t})=>i("h4",Object.assign({className:"mt-2 text-xl",style:{fontSize:"1.25rem",lineHeight:"1.75rem"}},{children:t})),h5:({node:e,children:t})=>i("h5",Object.assign({style:{fontSize:"1.125rem",lineHeight:"1.75rem"}},{children:t})),p:a,a:m,ol:({node:e,children:t})=>i("ol",Object.assign({style:{listStyleType:"decimal",listStylePosition:"inside",paddingLeft:"1.5rem",whiteSpace:"normal"}},{children:t})),ul:({node:e,children:t})=>i("ul",Object.assign({style:{listStyleType:"disc",listStylePosition:"inside",paddingLeft:"1.5rem",whiteSpace:"normal"}},{children:t})),li:({node:e,children:t})=>i("li",Object.assign({style:{whiteSpace:"normal"}},{children:t})),table:({children:e})=>i("div",Object.assign({className:"overflow-auto"},{children:i("table",Object.assign({style:{tableLayout:"fixed",fontSize:"0.875rem",lineHeight:"1.24rem"}},{children:e}))})),th:({node:e,children:t})=>i("th",Object.assign({style:{padding:"0.75em 1em",fontWeight:600,textAlign:"left"}},{children:t})),tr:({node:e,children:t})=>i("tr",Object.assign({style:{border:"dark"===u?"1px solid #30363D":"1px solid #D0D7DE"}},{children:t})),td:({node:e,children:t})=>i("td",Object.assign({style:{padding:"0.75em 1em"}},{children:t})),code:p,blockquote:({node:e,children:t})=>i("blockquote",Object.assign({style:{lineHeight:"15px",borderLeft:"dark"===u?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===u?"#8B8B8B":"#656D76",paddingLeft:"1rem",marginBottom:"1rem"}},{children:t})),img:c,iframe:h,hr:()=>i("hr",{style:{border:0,borderTop:"dark"===u?"1px solid #30363D":"1px solid #D0D7DE"}})};return e("div",Object.assign({className:"pxe-markdown",ref:O,style:Object.assign({position:"relative",whiteSpace:"pre-wrap"},b)},{children:[i(l,Object.assign({},f&&{className:f},{components:S,remarkPlugins:[s,o],rehypePlugins:[d]},{children:`${k}${!j&&x.length>0?"\n\n---":""}`})),!j&&x.length>0&&i("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"2rem",marginTop:"2rem"}},{children:x.map(((e,t)=>i(g,{data:e},t)))}))]}))};export{f as PickaxeMarkdownRenderer};
@@ -1,4 +1,4 @@
1
1
  import type { Node } from "../../Renderer";
2
- import { FC, ComponentPropsWithoutRef } from "react";
2
+ import { type FC, ComponentPropsWithoutRef } from "react";
3
3
  declare const A: FC<ComponentPropsWithoutRef<"a"> & Node>;
4
4
  export default A;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pickaxeproject/react",
3
- "version": "0.0.57",
3
+ "version": "0.0.58",
4
4
  "description": "Client utility library for Pickaxe",
5
5
  "repository": {
6
6
  "type": "git",