@pickaxeproject/react 0.0.50 → 0.0.52
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/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/A/index.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/Iframe/index.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/P/index.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Renderer.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/A/index.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/Iframe/index.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/P/index.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Renderer.js +1 -1
- package/package.json +1 -1
|
@@ -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"),o=require("../../hooks/usePickaxeMarkdownContext.js"),i=require("../common/Action.js"),n=require("../Img/index.js"),a=require("../../../../../../common/api/utils.js"),u=require("../../../../../../common/error.js");exports.default=({node:
|
|
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"),o=require("../../hooks/usePickaxeMarkdownContext.js"),i=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:f,websiteMetadatas:p,linkPreviews:m,actions:h,setWebsiteMetadatas:w}=o.usePickaxeMarkdownContext(),b=l.startsWith("http://")?`https://${l.slice(7)}`:l.startsWith("www.")?`https://${l}`:l;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;const e=["/api/function_call_results","/api/fn/result","https://prod-pickaxe-assets.s3.amazonaws.com"];if(t.includes("pickaxe")&&e.some((e=>t.includes(e))))return null;const r=(yield a.default.get(`/metadata?url=${encodeURIComponent(t)}`)).data;if(r.error)throw new Error(r.error||"Failed to fetch metadata");return r}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("https://prod-pickaxe-assets.s3.amazonaws.com"),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 x=b.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(x&&(null==x?void 0:x[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/${x[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(i.default,{jobUrl:b}):t.jsx("a",Object.assign({href:b,target:"_blank",rel:"noopener noreferrer",style:{color:f,fontWeight:600}},{children:d}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime");exports.default=t=>{var{node:i,title:l="Random Iframe",children:s}=t,a=e.__rest(t,["node","title","children"]);return r.jsx("iframe",Object.assign({title:l,style:{borderRadius:"8px"},allowFullScreen:!0},a,{children:s}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime");exports.default=t=>{var{node:i,title:l="Random Iframe",children:s}=t,a=e.__rest(t,["node","title","children"]);return r.jsx("iframe",Object.assign({title:l,style:{borderRadius:"8px",width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},a,{children:s}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../hooks/usePickaxeMarkdownContext.js"),s=require("../common/Action.js");exports.default=({node:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../hooks/usePickaxeMarkdownContext.js"),s=require("../common/Action.js"),i=require("../Img/index.js");exports.default=({node:r,children:n})=>{const{actions:l}=t.usePickaxeMarkdownContext(),a="string"==typeof n&&n.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(a&&(null==a?void 0:a[1]))return e.jsx("div",Object.assign({style:{marginTop:"2rem",marginBottom:"2rem",display:"flex",width:"100%",justifyContent:"center"}},{children:e.jsx("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${a[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));if("string"==typeof n&&n.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif)$/))return e.jsx(i.default,{src:n,alt:"string"==typeof n?n:"Markdown Image"});if(l&&"string"==typeof n&&n.includes("pickaxe")&&(n.includes("/api/fn/result")||n.includes("/api/function_call_results"))){const t=n.replace(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g,""),i=n.match(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g);return e.jsxs("div",Object.assign({className:"flex flex-col"},{children:[e.jsx("p",Object.assign({style:{fontWeight:350}},{children:t})),e.jsx(s.default,{jobUrl:(null==i?void 0:i[0])||""})]}))}return e.jsx("p",Object.assign({style:{fontWeight:350}},{children:n}))};
|
|
@@ -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"),o=require("./Custom/Img/index.js"),c=require("./Custom/Iframe/index.js"),h=require("./Custom/Code/index.js"),
|
|
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"),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(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",{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:o.default,iframe:c.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 +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:
|
|
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;const e=["/api/function_call_results","/api/fn/result","https://prod-pickaxe-assets.s3.amazonaws.com"];if(t.includes("pickaxe")&&e.some((e=>t.includes(e))))return null;const r=(yield a.get(`/metadata?url=${encodeURIComponent(t)}`)).data;if(r.error)throw new Error(r.error||"Failed to fetch metadata");return r}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("https://prod-pickaxe-assets.s3.amazonaws.com"),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 +1 @@
|
|
|
1
|
-
import{__rest as e}from"../../../../../../_virtual/_tslib.js";import{jsx as
|
|
1
|
+
import{__rest as e}from"../../../../../../_virtual/_tslib.js";import{jsx as t}from"react/jsx-runtime";const r=r=>{var{node:i,title:l="Random Iframe",children:a}=r,n=e(r,["node","title","children"]);return t("iframe",Object.assign({title:l,style:{borderRadius:"8px",width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},n,{children:a}))};export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{usePickaxeMarkdownContext as i}from"../../hooks/usePickaxeMarkdownContext.js";import n from"../common/Action.js";import s from"../Img/index.js";const r=({node:r,children:o})=>{const{actions:l}=i(),c="string"==typeof o&&o.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(c&&(null==c?void 0:c[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/${c[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));if("string"==typeof o&&o.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif)$/))return t(s,{src:o,alt:"string"==typeof o?o:"Markdown Image"});if(l&&"string"==typeof o&&o.includes("pickaxe")&&(o.includes("/api/fn/result")||o.includes("/api/function_call_results"))){const i=o.replace(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g,""),s=o.match(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g);return e("div",Object.assign({className:"flex flex-col"},{children:[t("p",Object.assign({style:{fontWeight:350}},{children:i})),t(n,{jobUrl:(null==s?void 0:s[0])||""})]}))}return t("p",Object.assign({style:{fontWeight:350}},{children:o}))};export{r 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
|
|
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",{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};
|