@pickaxeproject/react 0.0.31 → 0.0.33

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/README.md CHANGED
@@ -11,3 +11,7 @@
11
11
  - push to main branch to generate a new PR
12
12
 
13
13
  - merge the PR
14
+
15
+ ## Notes
16
+
17
+ - must import `import "katex/dist/katex.min.css";`
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("./hooks/usePickaxeMarkdownContext.js"),i=require("../../../../common/lotties/loader-black.js"),r=require("../../../../common/lotties/loader-white.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=s(require("react-lottie"));exports.default=({node:s,href:n="",children:o})=>{const{theme:l,accentColor:c,linkPreviews:d,actions:u}=t.usePickaxeMarkdownContext(),m=(n||"").startsWith("www.")?`https://${n}`:n,p=m.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(p&&(null==p?void 0:p[1]))return e.jsx("div",Object.assign({style:{marginTop:"2.5rem",marginBottom:"2.5rem",display:"flex",width:"100%",justifyContent:"center"}},{children:e.jsx("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${p[1]}`,style:{width:"100%",maxWidth:"560px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));return m.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif)$/)?e.jsx("div",Object.assign({style:{marginTop:"2.5rem",marginBottom:"2.5rem",display:"flex",width:"100%",justifyContent:"center"}},{children:e.jsx("img",{src:m,alt:"string"==typeof o?o:"Markdown Image",style:{borderRadius:"8px",maxWidth:"680px"}})})):u&&m.includes("pickaxe")&&(m.includes("/api/fn/result")||m.includes("/api/function_call_results"))?e.jsx("div",Object.assign({className:"marked-link-function-calling-loader",style:{width:"100%",maxWidth:"150px",minHeight:"150px"}},{children:e.jsx(a.default,{style:{cursor:"default",pointerEvents:"none"},options:{autoplay:!0,loop:!0,animationData:"dark"===l?r.loaderWhite:i.loaderBlack},isClickToPauseDisabled:!0,width:150,height:150})})):e.jsx("a",Object.assign({href:m,target:"_blank",rel:"noopener noreferrer"},d&&{className:"marked-link-possible-preview-render"},{style:{color:c}},{children:o}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("./hooks/usePickaxeMarkdownContext.js"),r=require("../../../../common/lotties/loader-black.js"),i=require("../../../../common/lotties/loader-white.js"),s=require("react-lottie"),a=require("./Img.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=o(s);exports.default=({node:s,href:o="",children:l})=>{const{theme:c,accentColor:u,linkPreviews:d,actions:m}=t.usePickaxeMarkdownContext(),p=(o||"").startsWith("www.")?`https://${o}`:o,f=p.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(f&&(null==f?void 0:f[1]))return e.jsx("div",Object.assign({style:{marginTop:"2.5rem",marginBottom:"2.5rem",display:"flex",width:"100%",justifyContent:"center"}},{children:e.jsx("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${f[1]}`,style:{width:"100%",maxWidth:"560px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));return p.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif)$/)?e.jsx(a.default,{src:p,alt:"string"==typeof l?l:"Markdown Image"}):m&&p.includes("pickaxe")&&(p.includes("/api/fn/result")||p.includes("/api/function_call_results"))?e.jsx("div",Object.assign({className:"marked-link-function-calling-loader",style:{width:"100%",maxWidth:"150px",minHeight:"150px"}},{children:e.jsx(n.default,{style:{cursor:"default",pointerEvents:"none"},options:{autoplay:!0,loop:!0,animationData:"dark"===c?i.loaderWhite:r.loaderBlack},isClickToPauseDisabled:!0,width:150,height:150})})):e.jsx("a",Object.assign({href:p,target:"_blank",rel:"noopener noreferrer"},d&&{className:"marked-link-possible-preview-render"},{style:{color:u,fontWeight:600}},{children:l}))};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react");exports.default=({node:r,src:s,alt:i})=>{const[n,a]=t.useState(!1);return e.jsx("div",Object.assign({style:{marginTop:"2.5rem",marginBottom:"2.5rem",display:"flex",width:"100%",justifyContent:"center"}},{children:n?e.jsx("p",Object.assign({style:{userSelect:"none",opacity:.5,fontStyle:"italic"}},{children:"[Image link is broken]"})):e.jsx("img",{src:s,alt:i,style:{borderRadius:"8px",maxWidth:"680px"},onError:()=>a(!0)})}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),i=require("react"),r=require("./hooks/usePickaxeMarkdownContext.js"),s=require("react-syntax-highlighter"),n=require("react-syntax-highlighter/dist/cjs/styles/prism"),l=require("react-markdown"),a=require("remark-gfm"),d=require("remark-math"),c=require("rehype-katex"),o=require("./A.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("katex/dist/katex.min.css");var h=m(l),g=m(a),j=m(d),x=m(c);exports.PickaxeMarkdownRenderer=({className:l,value:a})=>{const{theme:d}=r.usePickaxeMarkdownContext(),c=i.useRef(null),m={h1:({node:e,children:i})=>t.jsx("h1",Object.assign({style:{fontSize:"2.25rem",lineHeight:"2.5rem",marginBottom:"1.5rem"}},{children:i})),h2:({node:e,children:i})=>t.jsx("h2",Object.assign({style:{fontSize:"1.875rem",lineHeight:"2.25rem",marginBottom:"1.25rem"}},{children:i})),h3:({node:e,children:i})=>t.jsx("h3",Object.assign({style:{fontSize:"1.5rem",lineHeight:"2rem",marginBottom:"1rem"}},{children:i})),h4:({node:e,children:i})=>t.jsx("h4",Object.assign({className:"mt-2 text-xl",style:{fontSize:"1.25rem",lineHeight:"1.75rem",marginBottom:"0.75rem"}},{children:i})),h5:({node:e,children:i})=>t.jsx("h5",Object.assign({style:{fontSize:"1.125rem",lineHeight:"1.75rem"}},{children:i})),p:({node:e,children:i})=>t.jsx("p",Object.assign({style:{marginBottom:"1.25rem",fontWeight:350}},{children:i})),a:o.default,ol:({node:e,children:i})=>t.jsx("ol",Object.assign({style:{listStyleType:"decimal",listStylePosition:"inside",paddingLeft:"1.5rem",marginBottom:"2rem"}},{children:i})),ul:({node:e,children:i})=>t.jsx("ul",Object.assign({style:{listStyleType:"disc",listStylePosition:"inside",paddingLeft:"1.5rem",marginBottom:"2rem"}},{children:i})),li:({node:e,children:i})=>t.jsx("li",Object.assign({style:{marginBottom:"0.5rem"}},{children:i})),table:({children:e})=>t.jsx("div",Object.assign({className:"overflow-auto"},{children:t.jsx("table",Object.assign({style:{tableLayout:"fixed",fontSize:"0.875rem",lineHeight:"1.24rem",marginBottom:"1.5rem"}},{children:e}))})),th:({node:e,children:i})=>t.jsx("th",Object.assign({style:{padding:"0.75em 1em",fontWeight:600,textAlign:"left"}},{children:i})),tr:({node:e,children:i})=>t.jsx("tr",Object.assign({style:{border:"dark"===d?"1px solid #30363D":"1px solid #D0D7DE"}},{children:i})),td:({node:e,children:i})=>t.jsx("td",Object.assign({style:{padding:"0.75em 1em"}},{children:i})),code:i=>{var{node:r,children:l,className:a}=i,d=e.__rest(i,["node","children","className"]);const c=/language-(\w+)/.exec(a||"");return c?t.jsx(s.Prism,Object.assign({},d,{PreTag:"div",language:c[1],style:n.atomDark,showLineNumbers:!0},{children:String(l).replace(/\n$/,"")})):t.jsx("code",Object.assign({},d,{className:a},{children:l}))},blockquote:({node:e,children:i})=>t.jsx("blockquote",Object.assign({style:{borderLeft:"dark"===d?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===d?"#8B8B8B":"#656D76",paddingLeft:"1rem"}},{children:i})),img:({node:e,src:i,alt:r})=>t.jsx("div",Object.assign({style:{marginTop:"2.5rem",marginBottom:"2.5rem",display:"flex",width:"100%",justifyContent:"center"}},{children:t.jsx("img",{src:i,alt:r,style:{borderRadius:"8px",maxWidth:"680px"}})}))};return t.jsx("div",Object.assign({className:"pxe-markdown relative",ref:c},{children:t.jsx(h.default,Object.assign({},l&&{className:l},{components:m,remarkPlugins:[g.default,j.default],rehypePlugins:[x.default]},{children:a}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),i=require("react"),t=require("./hooks/usePickaxeMarkdownContext.js"),n=require("react-syntax-highlighter"),s=require("react-markdown"),l=require("remark-gfm"),a=require("remark-math"),d=require("rehype-katex"),o=require("./A.js"),c=require("./Img.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=m(s),g=m(l),j=m(a),u=m(d);exports.PickaxeMarkdownRenderer=({className:s,value:l})=>{const{theme:a,syntaxTheme:d}=t.usePickaxeMarkdownContext(),m=i.useRef(null),x={h1:({node:e,children:i})=>r.jsx("h1",Object.assign({style:{fontSize:"2.25rem",lineHeight:"2.5rem",marginTop:"1rem",marginBottom:"1.5rem"}},{children:i})),h2:({node:e,children:i})=>r.jsx("h2",Object.assign({style:{fontSize:"1.875rem",lineHeight:"2.25rem",marginTop:"1.25rem",marginBottom:"1.25rem"}},{children:i})),h3:({node:e,children:i})=>r.jsx("h3",Object.assign({style:{fontSize:"1.5rem",lineHeight:"2rem",marginBottom:"1rem"}},{children:i})),h4:({node:e,children:i})=>r.jsx("h4",Object.assign({className:"mt-2 text-xl",style:{fontSize:"1.25rem",lineHeight:"1.75rem",marginBottom:"0.75rem"}},{children:i})),h5:({node:e,children:i})=>r.jsx("h5",Object.assign({style:{fontSize:"1.125rem",lineHeight:"1.75rem"}},{children:i})),p:({node:e,children:i})=>r.jsx("p",Object.assign({style:{fontWeight:350}},{children:i})),a:o.default,ol:({node:e,children:i})=>r.jsx("ol",Object.assign({style:{listStyleType:"decimal",listStylePosition:"inside",paddingLeft:"1.5rem",marginTop:"1rem",marginBottom:"2rem"}},{children:i})),ul:({node:e,children:i})=>r.jsx("ul",Object.assign({style:{listStyleType:"disc",listStylePosition:"inside",paddingLeft:"1.5rem",marginTop:"1rem",marginBottom:"2rem"}},{children:i})),li:({node:e,children:i})=>r.jsx("li",Object.assign({style:{marginBottom:"0.75rem"}},{children:i})),table:({children:e})=>r.jsx("div",Object.assign({className:"overflow-auto"},{children:r.jsx("table",Object.assign({style:{tableLayout:"fixed",fontSize:"0.875rem",lineHeight:"1.24rem",marginBottom:"1.5rem"}},{children:e}))})),th:({node:e,children:i})=>r.jsx("th",Object.assign({style:{padding:"0.75em 1em",fontWeight:600,textAlign:"left"}},{children:i})),tr:({node:e,children:i})=>r.jsx("tr",Object.assign({style:{border:"dark"===a?"1px solid #30363D":"1px solid #D0D7DE"}},{children:i})),td:({node:e,children:i})=>r.jsx("td",Object.assign({style:{padding:"0.75em 1em"}},{children:i})),code:i=>{var{node:t,children:s,className:l}=i,a=e.__rest(i,["node","children","className"]);const o=/language-(\w+)/.exec(l||"");return o?r.jsx(n.Prism,Object.assign({},a,{PreTag:"div",language:o[1],style:d,showLineNumbers:!0},{children:String(s).replace(/\n$/,"")})):r.jsx("code",Object.assign({},a,{className:l},{children:s}))},blockquote:({node:e,children:i})=>r.jsx("blockquote",Object.assign({style:{borderLeft:"dark"===a?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===a?"#8B8B8B":"#656D76",paddingLeft:"1rem",marginBottom:"1.5rem"}},{children:i})),img:c.default};return r.jsx("div",Object.assign({className:"pxe-markdown relative",ref:m},{children:r.jsx(h.default,Object.assign({},s&&{className:s},{components:x,remarkPlugins:[g.default,j.default],rehypePlugins:[u.default]},{children:l}))}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react");const r=t.createContext({}),s=({children:s,theme:o="light",accentColor:c="#228DD7",linkPreviews:i=!1,actions:n=!1})=>{const[a,u]=t.useState(o),[l,x]=t.useState(c),[d,k]=t.useState(i),[v,P]=t.useState(n);return e.jsx(r.Provider,Object.assign({value:{theme:a,accentColor:l,linkPreviews:d,actions:v,setTheme:u,setAccentColor:x,setLinkPreviews:k,setActions:P}},{children:s}))};exports.PickaxeMarkdown=s,exports.PickaxeMarkdownContext=r,exports.default=s;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("react/jsx-runtime"),e=require("react");const r=e.createContext({}),t=({children:t,theme:n="light",syntaxTheme:c,accentColor:a="#228DD7",linkPreviews:l=!1,actions:i=!1})=>{const[s,d]=e.useState(n),[p,u]=e.useState(a),[C,F]=e.useState(l),[g,m]=e.useState(i);return o.jsx(r.Provider,Object.assign({value:{theme:s,syntaxTheme:c||{'code[class*="language-"]':{color:"#c5c8c6",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:"Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace",direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{color:"#c5c8c6",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:"Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace",direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto",borderRadius:"0.3em",background:"#1d1f21"},':not(pre) > code[class*="language-"]':{background:"#1d1f21",padding:".1em",borderRadius:".3em"},comment:{color:"#7C7C7C"},prolog:{color:"#7C7C7C"},doctype:{color:"#7C7C7C"},cdata:{color:"#7C7C7C"},punctuation:{color:"#c5c8c6"},".namespace":{opacity:".7"},property:{color:"#96CBFE"},keyword:{color:"#96CBFE"},tag:{color:"#96CBFE"},"class-name":{color:"#FFFFB6",textDecoration:"underline"},boolean:{color:"#99CC99"},constant:{color:"#99CC99"},symbol:{color:"#f92672"},deleted:{color:"#f92672"},number:{color:"#FF73FD"},selector:{color:"#A8FF60"},"attr-name":{color:"#A8FF60"},string:{color:"#A8FF60"},char:{color:"#A8FF60"},builtin:{color:"#A8FF60"},inserted:{color:"#A8FF60"},variable:{color:"#C6C5FE"},operator:{color:"#EDEDED"},entity:{color:"#FFFFB6",cursor:"help"},url:{color:"#96CBFE"},".language-css .token.string":{color:"#87C38A"},".style .token.string":{color:"#87C38A"},atrule:{color:"#F9EE98"},"attr-value":{color:"#F9EE98"},function:{color:"#DAD085"},regex:{color:"#E9C062"},important:{color:"#fd971f",fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},accentColor:p,linkPreviews:C,actions:g,setTheme:d,setAccentColor:u,setLinkPreviews:F,setActions:m}},{children:t}))};exports.PickaxeMarkdown=t,exports.PickaxeMarkdownContext=r,exports.default=t;
@@ -0,0 +1,4 @@
1
+ import { type FC, type ComponentPropsWithoutRef } from "react";
2
+ import type { Node } from "./Renderer";
3
+ declare const Img: FC<ComponentPropsWithoutRef<"img"> & Node>;
4
+ export default Img;
@@ -1,4 +1,3 @@
1
- import "katex/dist/katex.min.css";
2
1
  interface PickaxeMarkdownRendererProps {
3
2
  className?: string;
4
3
  value?: string | null;
@@ -1,5 +1,7 @@
1
+ /// <reference types="react" />
1
2
  export declare const usePickaxeMarkdownContext: () => {
2
3
  theme?: ("light" | "dark") | undefined;
4
+ syntaxTheme?: Record<string, import("react").CSSProperties> | undefined;
3
5
  accentColor?: string | undefined;
4
6
  linkPreviews?: boolean | undefined;
5
7
  actions?: boolean | undefined;
@@ -1,8 +1,9 @@
1
1
  import type { SetState } from "../../../../types/common";
2
- import { type ReactNode } from "react";
2
+ import { type CSSProperties, type ReactNode } from "react";
3
3
  type PickaxeMarkdownTheme = "light" | "dark";
4
4
  type PickaxeMarkdownContextType = {
5
5
  theme?: PickaxeMarkdownTheme;
6
+ syntaxTheme?: Record<string, CSSProperties>;
6
7
  accentColor?: string;
7
8
  linkPreviews?: boolean;
8
9
  actions?: boolean;
@@ -14,10 +15,11 @@ type PickaxeMarkdownContextType = {
14
15
  interface PickaxeMarkdownProps {
15
16
  children: ReactNode;
16
17
  theme?: PickaxeMarkdownTheme;
18
+ syntaxTheme?: Record<string, CSSProperties>;
17
19
  accentColor?: string;
18
20
  linkPreviews?: boolean;
19
21
  actions?: boolean;
20
22
  }
21
23
  export declare const PickaxeMarkdownContext: import("react").Context<PickaxeMarkdownContextType>;
22
- export declare const PickaxeMarkdown: ({ children, theme: _theme, accentColor: _accentColor, linkPreviews: _linkPreviews, actions: _actions, }: PickaxeMarkdownProps) => import("react/jsx-runtime").JSX.Element;
24
+ export declare const PickaxeMarkdown: ({ children, theme: _theme, syntaxTheme, accentColor: _accentColor, linkPreviews: _linkPreviews, actions: _actions, }: PickaxeMarkdownProps) => import("react/jsx-runtime").JSX.Element;
23
25
  export default PickaxeMarkdown;
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{usePickaxeMarkdownContext as t}from"./hooks/usePickaxeMarkdownContext.js";import{loaderBlack as i}from"../../../../common/lotties/loader-black.js";import{loaderWhite as r}from"../../../../common/lotties/loader-white.js";import o from"react-lottie";const s=({node:s,href:n="",children:a})=>{const{theme:l,accentColor:m,linkPreviews:c,actions:d}=t(),p=(n||"").startsWith("www.")?`https://${n}`:n,u=p.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(u&&(null==u?void 0:u[1]))return e("div",Object.assign({style:{marginTop:"2.5rem",marginBottom:"2.5rem",display:"flex",width:"100%",justifyContent:"center"}},{children:e("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${u[1]}`,style:{width:"100%",maxWidth:"560px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));return p.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif)$/)?e("div",Object.assign({style:{marginTop:"2.5rem",marginBottom:"2.5rem",display:"flex",width:"100%",justifyContent:"center"}},{children:e("img",{src:p,alt:"string"==typeof a?a:"Markdown Image",style:{borderRadius:"8px",maxWidth:"680px"}})})):d&&p.includes("pickaxe")&&(p.includes("/api/fn/result")||p.includes("/api/function_call_results"))?e("div",Object.assign({className:"marked-link-function-calling-loader",style:{width:"100%",maxWidth:"150px",minHeight:"150px"}},{children:e(o,{style:{cursor:"default",pointerEvents:"none"},options:{autoplay:!0,loop:!0,animationData:"dark"===l?r:i},isClickToPauseDisabled:!0,width:150,height:150})})):e("a",Object.assign({href:p,target:"_blank",rel:"noopener noreferrer"},c&&{className:"marked-link-possible-preview-render"},{style:{color:m}},{children:a}))};export{s as default};
1
+ import{jsx as e}from"react/jsx-runtime";import{usePickaxeMarkdownContext as t}from"./hooks/usePickaxeMarkdownContext.js";import{loaderBlack as i}from"../../../../common/lotties/loader-black.js";import{loaderWhite as o}from"../../../../common/lotties/loader-white.js";import r from"react-lottie";import s from"./Img.js";const n=({node:n,href:a="",children:l})=>{const{theme:c,accentColor:m,linkPreviews:d,actions:p}=t(),u=(a||"").startsWith("www.")?`https://${a}`:a,f=u.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(f&&(null==f?void 0:f[1]))return e("div",Object.assign({style:{marginTop:"2.5rem",marginBottom:"2.5rem",display:"flex",width:"100%",justifyContent:"center"}},{children:e("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${f[1]}`,style:{width:"100%",maxWidth:"560px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));return u.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif)$/)?e(s,{src:u,alt:"string"==typeof l?l:"Markdown Image"}):p&&u.includes("pickaxe")&&(u.includes("/api/fn/result")||u.includes("/api/function_call_results"))?e("div",Object.assign({className:"marked-link-function-calling-loader",style:{width:"100%",maxWidth:"150px",minHeight:"150px"}},{children:e(r,{style:{cursor:"default",pointerEvents:"none"},options:{autoplay:!0,loop:!0,animationData:"dark"===c?o:i},isClickToPauseDisabled:!0,width:150,height:150})})):e("a",Object.assign({href:u,target:"_blank",rel:"noopener noreferrer"},d&&{className:"marked-link-possible-preview-render"},{style:{color:m,fontWeight:600}},{children:l}))};export{n as default};
@@ -0,0 +1 @@
1
+ import{jsx as t}from"react/jsx-runtime";import{useState as e}from"react";const r=({node:r,src:i,alt:n})=>{const[o,s]=e(!1);return t("div",Object.assign({style:{marginTop:"2.5rem",marginBottom:"2.5rem",display:"flex",width:"100%",justifyContent:"center"}},{children:o?t("p",Object.assign({style:{userSelect:"none",opacity:.5,fontStyle:"italic"}},{children:"[Image link is broken]"})):t("img",{src:i,alt:n,style:{borderRadius:"8px",maxWidth:"680px"},onError:()=>s(!0)})}))};export{r as default};
@@ -1 +1 @@
1
- import{__rest as e}from"../../../../_virtual/_tslib.js";import{jsx as t}from"react/jsx-runtime";import{useRef as i}from"react";import{usePickaxeMarkdownContext as r}from"./hooks/usePickaxeMarkdownContext.js";import{Prism as n}from"react-syntax-highlighter";import{atomDark as s}from"react-syntax-highlighter/dist/cjs/styles/prism";import l from"react-markdown";import o from"remark-gfm";import m from"remark-math";import a from"rehype-katex";import d from"./A.js";import"katex/dist/katex.min.css";const c=({className:c,value:h})=>{const{theme:g}=r(),p=i(null),y={h1:({node:e,children:i})=>t("h1",Object.assign({style:{fontSize:"2.25rem",lineHeight:"2.5rem",marginBottom:"1.5rem"}},{children:i})),h2:({node:e,children:i})=>t("h2",Object.assign({style:{fontSize:"1.875rem",lineHeight:"2.25rem",marginBottom:"1.25rem"}},{children:i})),h3:({node:e,children:i})=>t("h3",Object.assign({style:{fontSize:"1.5rem",lineHeight:"2rem",marginBottom:"1rem"}},{children:i})),h4:({node:e,children:i})=>t("h4",Object.assign({className:"mt-2 text-xl",style:{fontSize:"1.25rem",lineHeight:"1.75rem",marginBottom:"0.75rem"}},{children:i})),h5:({node:e,children:i})=>t("h5",Object.assign({style:{fontSize:"1.125rem",lineHeight:"1.75rem"}},{children:i})),p:({node:e,children:i})=>t("p",Object.assign({style:{marginBottom:"1.25rem",fontWeight:350}},{children:i})),a:d,ol:({node:e,children:i})=>t("ol",Object.assign({style:{listStyleType:"decimal",listStylePosition:"inside",paddingLeft:"1.5rem",marginBottom:"2rem"}},{children:i})),ul:({node:e,children:i})=>t("ul",Object.assign({style:{listStyleType:"disc",listStylePosition:"inside",paddingLeft:"1.5rem",marginBottom:"2rem"}},{children:i})),li:({node:e,children:i})=>t("li",Object.assign({style:{marginBottom:"0.5rem"}},{children:i})),table:({children:e})=>t("div",Object.assign({className:"overflow-auto"},{children:t("table",Object.assign({style:{tableLayout:"fixed",fontSize:"0.875rem",lineHeight:"1.24rem",marginBottom:"1.5rem"}},{children:e}))})),th:({node:e,children:i})=>t("th",Object.assign({style:{padding:"0.75em 1em",fontWeight:600,textAlign:"left"}},{children:i})),tr:({node:e,children:i})=>t("tr",Object.assign({style:{border:"dark"===g?"1px solid #30363D":"1px solid #D0D7DE"}},{children:i})),td:({node:e,children:i})=>t("td",Object.assign({style:{padding:"0.75em 1em"}},{children:i})),code:i=>{var{node:r,children:l,className:o}=i,m=e(i,["node","children","className"]);const a=/language-(\w+)/.exec(o||"");return a?t(n,Object.assign({},m,{PreTag:"div",language:a[1],style:s,showLineNumbers:!0},{children:String(l).replace(/\n$/,"")})):t("code",Object.assign({},m,{className:o},{children:l}))},blockquote:({node:e,children:i})=>t("blockquote",Object.assign({style:{borderLeft:"dark"===g?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===g?"#8B8B8B":"#656D76",paddingLeft:"1rem"}},{children:i})),img:({node:e,src:i,alt:r})=>t("div",Object.assign({style:{marginTop:"2.5rem",marginBottom:"2.5rem",display:"flex",width:"100%",justifyContent:"center"}},{children:t("img",{src:i,alt:r,style:{borderRadius:"8px",maxWidth:"680px"}})}))};return t("div",Object.assign({className:"pxe-markdown relative",ref:p},{children:t(l,Object.assign({},c&&{className:c},{components:y,remarkPlugins:[o,m],rehypePlugins:[a]},{children:h}))}))};export{c as PickaxeMarkdownRenderer};
1
+ import{__rest as e}from"../../../../_virtual/_tslib.js";import{jsx as i}from"react/jsx-runtime";import{useRef as r}from"react";import{usePickaxeMarkdownContext as t}from"./hooks/usePickaxeMarkdownContext.js";import{Prism as n}from"react-syntax-highlighter";import l from"react-markdown";import o from"remark-gfm";import m from"remark-math";import s from"rehype-katex";import a from"./A.js";import d from"./Img.js";const c=({className:c,value:h})=>{const{theme:g,syntaxTheme:p}=t(),b=r(null),f={h1:({node:e,children:r})=>i("h1",Object.assign({style:{fontSize:"2.25rem",lineHeight:"2.5rem",marginTop:"1rem",marginBottom:"1.5rem"}},{children:r})),h2:({node:e,children:r})=>i("h2",Object.assign({style:{fontSize:"1.875rem",lineHeight:"2.25rem",marginTop:"1.25rem",marginBottom:"1.25rem"}},{children:r})),h3:({node:e,children:r})=>i("h3",Object.assign({style:{fontSize:"1.5rem",lineHeight:"2rem",marginBottom:"1rem"}},{children:r})),h4:({node:e,children:r})=>i("h4",Object.assign({className:"mt-2 text-xl",style:{fontSize:"1.25rem",lineHeight:"1.75rem",marginBottom:"0.75rem"}},{children:r})),h5:({node:e,children:r})=>i("h5",Object.assign({style:{fontSize:"1.125rem",lineHeight:"1.75rem"}},{children:r})),p:({node:e,children:r})=>i("p",Object.assign({style:{fontWeight:350}},{children:r})),a:a,ol:({node:e,children:r})=>i("ol",Object.assign({style:{listStyleType:"decimal",listStylePosition:"inside",paddingLeft:"1.5rem",marginTop:"1rem",marginBottom:"2rem"}},{children:r})),ul:({node:e,children:r})=>i("ul",Object.assign({style:{listStyleType:"disc",listStylePosition:"inside",paddingLeft:"1.5rem",marginTop:"1rem",marginBottom:"2rem"}},{children:r})),li:({node:e,children:r})=>i("li",Object.assign({style:{marginBottom:"0.75rem"}},{children:r})),table:({children:e})=>i("div",Object.assign({className:"overflow-auto"},{children:i("table",Object.assign({style:{tableLayout:"fixed",fontSize:"0.875rem",lineHeight:"1.24rem",marginBottom:"1.5rem"}},{children:e}))})),th:({node:e,children:r})=>i("th",Object.assign({style:{padding:"0.75em 1em",fontWeight:600,textAlign:"left"}},{children:r})),tr:({node:e,children:r})=>i("tr",Object.assign({style:{border:"dark"===g?"1px solid #30363D":"1px solid #D0D7DE"}},{children:r})),td:({node:e,children:r})=>i("td",Object.assign({style:{padding:"0.75em 1em"}},{children:r})),code:r=>{var{node:t,children:l,className:o}=r,m=e(r,["node","children","className"]);const s=/language-(\w+)/.exec(o||"");return s?i(n,Object.assign({},m,{PreTag:"div",language:s[1],style:p,showLineNumbers:!0},{children:String(l).replace(/\n$/,"")})):i("code",Object.assign({},m,{className:o},{children:l}))},blockquote:({node:e,children:r})=>i("blockquote",Object.assign({style:{borderLeft:"dark"===g?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===g?"#8B8B8B":"#656D76",paddingLeft:"1rem",marginBottom:"1.5rem"}},{children:r})),img:d};return i("div",Object.assign({className:"pxe-markdown relative",ref:b},{children:i(l,Object.assign({},c&&{className:c},{components:f,remarkPlugins:[o,m],rehypePlugins:[s]},{children:h}))}))};export{c as PickaxeMarkdownRenderer};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{createContext as t,useState as r}from"react";const i=t({}),o=({children:t,theme:o="light",accentColor:c="#228DD7",linkPreviews:n=!1,actions:s=!1})=>{const[a,l]=r(o),[m,h]=r(c),[v,d]=r(n),[u,P]=r(s);return e(i.Provider,Object.assign({value:{theme:a,accentColor:m,linkPreviews:v,actions:u,setTheme:l,setAccentColor:h,setLinkPreviews:d,setActions:P}},{children:t}))};export{o as PickaxeMarkdown,i as PickaxeMarkdownContext,o as default};
1
+ import{jsx as o}from"react/jsx-runtime";import{createContext as e,useState as r}from"react";const n=e({}),t=({children:e,theme:t="light",syntaxTheme:c,accentColor:l="#228DD7",linkPreviews:a=!1,actions:i=!1})=>{const[s,d]=r(t),[p,m]=r(l),[C,F]=r(a),[g,h]=r(i);return o(n.Provider,Object.assign({value:{theme:s,syntaxTheme:c||{'code[class*="language-"]':{color:"#c5c8c6",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:"Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace",direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{color:"#c5c8c6",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:"Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace",direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto",borderRadius:"0.3em",background:"#1d1f21"},':not(pre) > code[class*="language-"]':{background:"#1d1f21",padding:".1em",borderRadius:".3em"},comment:{color:"#7C7C7C"},prolog:{color:"#7C7C7C"},doctype:{color:"#7C7C7C"},cdata:{color:"#7C7C7C"},punctuation:{color:"#c5c8c6"},".namespace":{opacity:".7"},property:{color:"#96CBFE"},keyword:{color:"#96CBFE"},tag:{color:"#96CBFE"},"class-name":{color:"#FFFFB6",textDecoration:"underline"},boolean:{color:"#99CC99"},constant:{color:"#99CC99"},symbol:{color:"#f92672"},deleted:{color:"#f92672"},number:{color:"#FF73FD"},selector:{color:"#A8FF60"},"attr-name":{color:"#A8FF60"},string:{color:"#A8FF60"},char:{color:"#A8FF60"},builtin:{color:"#A8FF60"},inserted:{color:"#A8FF60"},variable:{color:"#C6C5FE"},operator:{color:"#EDEDED"},entity:{color:"#FFFFB6",cursor:"help"},url:{color:"#96CBFE"},".language-css .token.string":{color:"#87C38A"},".style .token.string":{color:"#87C38A"},atrule:{color:"#F9EE98"},"attr-value":{color:"#F9EE98"},function:{color:"#DAD085"},regex:{color:"#E9C062"},important:{color:"#fd971f",fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},accentColor:p,linkPreviews:C,actions:g,setTheme:d,setAccentColor:m,setLinkPreviews:F,setActions:h}},{children:e}))};export{t as PickaxeMarkdown,n as PickaxeMarkdownContext,t as default};
@@ -0,0 +1,4 @@
1
+ import { type FC, type ComponentPropsWithoutRef } from "react";
2
+ import type { Node } from "./Renderer";
3
+ declare const Img: FC<ComponentPropsWithoutRef<"img"> & Node>;
4
+ export default Img;
@@ -1,4 +1,3 @@
1
- import "katex/dist/katex.min.css";
2
1
  interface PickaxeMarkdownRendererProps {
3
2
  className?: string;
4
3
  value?: string | null;
@@ -1,5 +1,7 @@
1
+ /// <reference types="react" />
1
2
  export declare const usePickaxeMarkdownContext: () => {
2
3
  theme?: ("light" | "dark") | undefined;
4
+ syntaxTheme?: Record<string, import("react").CSSProperties> | undefined;
3
5
  accentColor?: string | undefined;
4
6
  linkPreviews?: boolean | undefined;
5
7
  actions?: boolean | undefined;
@@ -1,8 +1,9 @@
1
1
  import type { SetState } from "../../../../types/common";
2
- import { type ReactNode } from "react";
2
+ import { type CSSProperties, type ReactNode } from "react";
3
3
  type PickaxeMarkdownTheme = "light" | "dark";
4
4
  type PickaxeMarkdownContextType = {
5
5
  theme?: PickaxeMarkdownTheme;
6
+ syntaxTheme?: Record<string, CSSProperties>;
6
7
  accentColor?: string;
7
8
  linkPreviews?: boolean;
8
9
  actions?: boolean;
@@ -14,10 +15,11 @@ type PickaxeMarkdownContextType = {
14
15
  interface PickaxeMarkdownProps {
15
16
  children: ReactNode;
16
17
  theme?: PickaxeMarkdownTheme;
18
+ syntaxTheme?: Record<string, CSSProperties>;
17
19
  accentColor?: string;
18
20
  linkPreviews?: boolean;
19
21
  actions?: boolean;
20
22
  }
21
23
  export declare const PickaxeMarkdownContext: import("react").Context<PickaxeMarkdownContextType>;
22
- export declare const PickaxeMarkdown: ({ children, theme: _theme, accentColor: _accentColor, linkPreviews: _linkPreviews, actions: _actions, }: PickaxeMarkdownProps) => import("react/jsx-runtime").JSX.Element;
24
+ export declare const PickaxeMarkdown: ({ children, theme: _theme, syntaxTheme, accentColor: _accentColor, linkPreviews: _linkPreviews, actions: _actions, }: PickaxeMarkdownProps) => import("react/jsx-runtime").JSX.Element;
23
25
  export default PickaxeMarkdown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pickaxeproject/react",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "description": "Client utility library for Pickaxe",
5
5
  "repository": {
6
6
  "type": "git",