@pickaxeproject/react 6.2.4 → 6.3.1
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/Core/StudioTip.js +1 -0
- package/dist/cjs/components/Icons/history.svg.js +1 -1
- package/dist/cjs/components/Pickaxe/Addons/Artifact/Renderer/SaveMenu.js +1 -1
- package/dist/cjs/components/Pickaxe/Addons/Artifact/Renderer/index.js +1 -1
- package/dist/cjs/components/Pickaxe/Chat/index.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/Artifact/index.js +1 -1
- package/dist/cjs/src/components/Core/StudioTip.d.ts +11 -0
- package/dist/cjs/src/types/artifact.d.ts +1 -1
- package/dist/esm/components/Core/StudioTip.js +1 -0
- package/dist/esm/components/Icons/history.svg.js +1 -1
- package/dist/esm/components/Pickaxe/Addons/Artifact/Renderer/SaveMenu.js +1 -1
- package/dist/esm/components/Pickaxe/Addons/Artifact/Renderer/index.js +1 -1
- package/dist/esm/components/Pickaxe/Chat/index.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/Artifact/index.js +1 -1
- package/dist/esm/src/components/Core/StudioTip.d.ts +11 -0
- package/dist/esm/src/types/artifact.d.ts +1 -1
- package/package.json +211 -213
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("../../hooks/pickaxe/usePickaxeContext.js"),s=require("../../common/cn.js");const a=({containerClassName:a,className:l,content:o,children:n,strategy:c="absolute",align:i="bottom"})=>{const{colors:u}=r.usePickaxeContext(),[f,x]=t.useState(!1),[d,p]=t.useState({top:0,left:0}),h=t.useRef(null);t.useEffect((()=>{if(f&&"fixed"===c&&h.current){const e=h.current.getBoundingClientRect();let t=0,r=0;switch(i){case"top":t=e.top-8,r=e.left+e.width/2;break;case"bottom":t=e.bottom+8,r=e.left+e.width/2;break;case"left":t=e.top+e.height/2,r=e.left-8;break;case"right":t=e.top+e.height/2,r=e.right+8}p({top:t,left:r})}}),[f,c,i]);return e.jsxs("div",Object.assign({ref:h,className:s.default("relative",a),onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1)},{children:[n,f&&e.jsx("div",Object.assign({className:s.default("fixed"===c?`fixed ${(()=>{switch(i){case"top":return"-translate-x-1/2 -translate-y-full";case"bottom":return"-translate-x-1/2";case"left":return"-translate-x-full -translate-y-1/2";case"right":return"-translate-y-1/2"}})()}`:`absolute ${(()=>{switch(i){case"top":return"left-1/2 bottom-full mb-2 -translate-x-1/2";case"bottom":return"left-1/2 top-full mt-2 -translate-x-1/2";case"left":return"right-full top-1/2 mr-2 -translate-y-1/2";case"right":return"left-full top-1/2 ml-2 -translate-y-1/2"}})()}`,"select-none z-[1337] whitespace-nowrap rounded-lg px-3 py-2 text-xs font-semibold shadow-lg",l),style:Object.assign({backgroundColor:u.secondary,color:u.secondaryText},"fixed"===c&&{top:`${d.top}px`,left:`${d.left}px`})},{children:o}))]}))};exports.StudioTip=a,exports.default=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}Object.defineProperty(exports,"__esModule",{value:!0});var t,r=e(require("react"));function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},n.apply(null,arguments)}var a=e=>r.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none"},e),t||(t=r.createElement("path",{fill:"
|
|
1
|
+
"use strict";function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}Object.defineProperty(exports,"__esModule",{value:!0});var t,r=e(require("react"));function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},n.apply(null,arguments)}var a=e=>r.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none"},e),t||(t=r.createElement("path",{fill:"currentColor",d:"M20 10c0-5.523-4.477-10-10-10a9.97 9.97 0 0 0-7 2.859V1.75a.75.75 0 0 0-1.5 0v3.5c0 .414.336.75.75.75h3.5a.75.75 0 0 0 0-1.5H3.519a8.5 8.5 0 1 1 2.348 12.93l-.27-.15-3.986 1.111 1.113-3.984-.151-.27A8.46 8.46 0 0 1 1.5 10c0-.675.079-1.332.227-1.962.08-.301.065-.888-.536-1.02-.613-.134-.87.355-.935.719h.001A10 10 0 0 0 0 10a9.96 9.96 0 0 0 1.115 4.592L.047 18.415a1.25 1.25 0 0 0 1.54 1.54l3.826-1.067A9.96 9.96 0 0 0 10 20c5.523 0 10-4.477 10-10M10 6.75a.75.75 0 0 0-1.5 0v4.5c0 .414.336.75.75.75h3a.75.75 0 0 0 0-1.5H10z"})));exports.default=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../../Icons/save.svg.js"),t=require("../../../../Core/Menu/index.js"),a=require("../../../../Core/Menu/Button.js"),l=require("../../../../Core/Menu/List.js");exports.default=({variant:n="default",className:i,children:c,data:r,colors:x,onDownload:o,onSaveAsPDF:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../../Icons/save.svg.js"),t=require("../../../../Core/Menu/index.js"),a=require("../../../../Core/Menu/Button.js"),l=require("../../../../Core/Menu/List.js");exports.default=({variant:n="default",className:i,children:c,data:r,colors:x,onDownload:o,onSaveAsPDF:p,onSaveAsDOCX:d})=>e.jsxs(t.default,Object.assign({id:`save-artifact-${r.id}-${r.version}`},{children:[e.jsx(a.default,Object.assign({variant:n,className:i,style:{color:x.text}},{children:c})),e.jsx(l.default,Object.assign({width:"auto",className:"font-semibold p-1 text-sm",style:{backgroundColor:x.primary,color:x.text},border:`1px solid ${x.primary}`},{children:"text/markdown"===r.type?e.jsxs(e.Fragment,{children:[e.jsxs("button",Object.assign({className:"px-2 py-1 text-left",onClick:()=>o("text/markdown")},{children:[e.jsx(s.default,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"Markdown"]})),e.jsxs("button",Object.assign({className:"px-2 py-1 text-left",onClick:p},{children:[e.jsx(s.default,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"PDF"]})),e.jsxs("button",Object.assign({className:"px-2 py-1 text-left",onClick:d},{children:[e.jsx(s.default,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"DOCX"]})),e.jsxs("button",Object.assign({className:"px-2 py-1 text-left",onClick:()=>o("text/plain")},{children:[e.jsx(s.default,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"TXT"]}))]}):"text/html"===r.type?e.jsxs(e.Fragment,{children:[e.jsxs("button",Object.assign({className:"px-2 py-1 text-left",onClick:()=>o("text/html")},{children:[e.jsx(s.default,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"HTML"]})),e.jsxs("button",Object.assign({className:"px-2 py-1 text-left",onClick:p},{children:[e.jsx(s.default,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"PDF"]}))]}):"text/csv"===r.type?e.jsxs("button",Object.assign({className:"px-2 py-1 text-left",onClick:()=>o("text/csv")},{children:[e.jsx(s.default,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"CSV"]})):"text/tab-separated-values"===r.type?e.jsxs("button",Object.assign({className:"px-2 py-1 text-left",onClick:()=>o("text/tab-separated-values")},{children:[e.jsx(s.default,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"TSV"]})):"image/svg+xml"===r.type?e.jsxs("button",Object.assign({className:"px-2 py-1 text-left",onClick:()=>o("image/svg+xml")},{children:[e.jsx(s.default,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"SVG"]})):"application/pdf"===r.type?e.jsxs("button",Object.assign({className:"px-2 py-1 text-left",onClick:p},{children:[e.jsx(s.default,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"PDF"]})):"application/vnd.pxe.code"===r.type?e.jsxs("button",Object.assign({className:"px-2 py-1 text-left",onClick:()=>o("application/vnd.pxe.code")},{children:[e.jsx(s.default,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),`${r.programmingLanguage||"Plain Text"}`]})):"application/vnd.pxe.mermaid"===r.type?e.jsxs("button",Object.assign({className:"px-2 py-1 text-left",onClick:()=>o("application/vnd.pxe.mermaid")},{children:[e.jsx(s.default,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"SVG"]})):"application/vnd.pxe.react"===r.type?e.jsxs("button",Object.assign({className:"px-2 py-1 text-left",onClick:()=>o("application/vnd.pxe.react")},{children:[e.jsx(s.default,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"TSX"]})):null}))]}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),o=require("react"),n=require("../hooks/useArtifactContext.js"),a=require("../../../../../hooks/pickaxe/usePickaxeContext.js"),i=require("../../Scroll/hooks/useScroll.js"),r=require("../hooks/useArtifact.js"),l=require("react-to-print"),s=require("../../../common/PickaxeMarkdown/index.js"),c=require("../../../common/PickaxeMarkdown/Renderer.js"),d=require("react-syntax-highlighter"),p=require("../../../../../common/docx/index.js"),u=require("file-saver"),x=require("../../Scroll/ScrollLockView.js"),m=require("../../../../Icons/expand.svg.js"),y=require("../../../../Icons/shrink.svg.js"),v=require("../../../../Icons/collapse-new.svg.js"),f=require("../../../../Icons/copy-new.svg.js"),g=require("../../../../Icons/download-new.svg.js"),b=require("../../../common/PickaxeCopyButton.js"),h=require("../../../../Core/ScrollArea.js"),j=require("../../../../Core/TipContainer.js"),w=require("../MermaidRenderer.js"),C=require("./SaveMenu.js"),k=require("./ViewOptions.js"),T=require("csv-to-markdown-table"),F=require("copy-to-clipboard"),O=require("../../../../../common/cn.js");function A(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var S=A(u),D=A(T),N=A(F);const q="development"===process.env.NODE_ENV?"http://localhost:3007":"https://user-content.pickaxe.co";exports.default=u=>{var T,F,A,E;const{artifacts:M,currentPopupType:_,currentArtifact:B,setCurrentArtifact:P}=n.useArtifactContext(),{onLoadArtifact:R}=r.useArtifact(),{styles:$,colors:z,translations:L}=a.usePickaxeContext(),[W,H]=o.useState("code"),[I,V]=o.useState(!1),X=o.useRef(),G=o.useRef(null),J=o.useRef(null),K=l.useReactToPrint({contentRef:X}),{scrollContainerRef:Q,scrollStartSession:U,scrollToBottom:Y,scrollEndSession:Z}=i.useScroll({auto:"code"===W}),ee=null!==(F=null===(T=u.styling)||void 0===T?void 0:T.styles)&&void 0!==F?F:$,te=null!==(E=null===(A=u.styling)||void 0===A?void 0:A.colors)&&void 0!==E?E:z,oe=o.useMemo((()=>{var e,t,o,n,a;if(!u.artifact&&!B)return null;const i=null!==(t=null===(e=u.artifact)||void 0===e?void 0:e.id)&&void 0!==t?t:null==B?void 0:B.id,r=null!==(n=null===(o=u.artifact)||void 0===o?void 0:o.version)&&void 0!==n?n:null==B?void 0:B.version;return null!==(a=M.find((e=>e.id===i&&e.version===r)))&&void 0!==a?a:null}),[B,M,u.artifact]),ne=o.useMemo((()=>oe?"text/csv"===oe.type?D.default(oe.content,",",!0):"text/tab-separated-values"===oe.type?D.default(oe.content,"\t",!0):null:null),[oe]),ae=o.useMemo((()=>(te.secondaryText||"").toLowerCase().startsWith("#ffffff")),[null==te?void 0:te.secondaryText]),ie=o.useMemo((()=>{const e=u.artifact&&(null==B?void 0:B.id)===u.artifact.id&&(null==B?void 0:B.version)===u.artifact.version;return"inline"===u.type&&("inline-form"===_?!!B:e)}),[B,_,u.type,u.artifact]);o.useEffect((()=>{e.__awaiter(void 0,void 0,void 0,(function*(){"inline"===u.type&&u.artifact&&(M.some((e=>u.artifact&&e.id===u.artifact.id&&e.version===u.artifact.version))||R({id:u.artifact.id,version:u.artifact.version}))}))}),[M,u.type,u.artifact]),o.useEffect((()=>{if("application/vnd.pxe.code"===(null==oe?void 0:oe.type)&&H("code"),"finished"!==(null==oe?void 0:oe.status))return H("code"),U(),void Y();Z(),"application/vnd.pxe.code"!==oe.type&&H("render")}),[null==oe?void 0:oe.status,null==oe?void 0:oe.type]),o.useEffect((()=>{var e;!J.current||"text/html"!==(null==oe?void 0:oe.type)&&"application/vnd.pxe.react"!==(null==oe?void 0:oe.type)||null===(e=J.current.contentWindow)||void 0===e||e.postMessage({type:"text/html"===oe.type?"HTML_CODE":"REACT_CODE",content:oe.content},q)}),[null==oe?void 0:oe.content,null==oe?void 0:oe.type]);const re=()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(!oe)return;if("text/html"===oe.type){const e=oe.content,t=window.open("","_blank");return void(t&&(t.document.open(),t.document.write(e),t.document.close(),t.focus(),t.print()))}const e=W;"code"===e&&(H("render"),yield new Promise((e=>setTimeout(e,50)))),K(),"code"===e&&H(e)})),le=()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(!oe)return;const e=yield p.convertMarkdownToDocx(oe.content);p.downloadDocx(e,`${oe.title}.docx`)})),se=t=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;if(!oe)return;let o={mimeType:"text/plain",extension:".txt"};switch(t){case"text/markdown":o={mimeType:"text/markdown",extension:".md"};break;case"text/html":o={mimeType:"text/html",extension:".html"};break;case"text/csv":o={mimeType:"text/csv",extension:".csv"};break;case"text/tab-separated-values":o={mimeType:"text/tab-separated-values",extension:".tsv"};break;case"image/svg+xml":case"application/vnd.pxe.mermaid":o={mimeType:"image/svg+xml",extension:".svg"};break;case"application/vnd.pxe.code":o={mimeType:`application/${oe.programmingLanguage||"text"};charset=utf-8`,extension:`.${oe.programmingLanguage||"txt"}`};break;case"application/vnd.pxe.react":o={mimeType:"text/typescript",extension:".tsx"};break;default:o={mimeType:"text/plain",extension:".txt"}}let n=null;if("application/vnd.pxe.mermaid"===oe.type){const t=W;"code"===t&&(H("render"),yield new Promise((e=>setTimeout(e,50))));const o=null===(e=G.current)||void 0===e?void 0:e.querySelector("svg");o&&(n=(new XMLSerializer).serializeToString(o)),"code"===t&&H(t)}const a=new Blob([null!=n?n:oe.content],{type:o.mimeType});S.default(a,`${oe.title}${o.extension}`)})),ce=()=>{"inline"!==u.type||!u.artifact||ie?P(null):P({id:u.artifact.id,version:u.artifact.version})},de=ie||!_.startsWith("inline");return oe?t.jsxs("div",Object.assign({className:O.default("pxe-artifact-renderer flex flex-col","inline"===u.type&&!ie&&"min-h-[320px] mb-6",u.className),style:Object.assign(Object.assign({backgroundColor:te.secondary,color:te.secondaryText},"auto"!==_&&{borderRadius:ee.cornerRadius}),u.style)},{children:[t.jsxs("div",Object.assign({className:"flex items-center gap-4 justify-between px-4 py-3 shadow-sm"},{children:[t.jsxs("div",Object.assign({className:"pxe-artifact-create-header flex min-w-0 items-center gap-4"},{children:[de&&t.jsx(k.default,{type:oe.type,view:W,colors:te,onChange:H}),t.jsx("p",Object.assign({className:"w-[220px] max-w-full truncate text-[18px] font-semilight leading-tight",title:oe.title},{children:oe.title}))]})),"inline"===u.type&&!de&&t.jsx("div",Object.assign({className:"shrink-0"},{children:t.jsx("button",Object.assign({type:"button",style:{color:te.secondaryText},onClick:ce,title:(null==L?void 0:L.expand)||"Expand","aria-label":(null==L?void 0:L.expand)||"Expand artifact"},{children:ie?t.jsx(y.default,{className:"w-6 h-6 shrink-0"}):t.jsx(m.default,{className:"w-6 h-6 shrink-0"})}))}))]})),de&&t.jsx("div",Object.assign({className:"flex items-center justify-between border-y px-4 py-2.5",style:{borderColor:te.primary}},{children:t.jsxs("div",Object.assign({className:"flex items-center gap-3"},{children:[t.jsx("button",Object.assign({type:"button",className:"opacity-70 transition-opacity duration-300 ease-in-out hover:opacity-100",style:{color:te.secondaryText},onClick:ce,title:"inline"===u.type?(null==L?void 0:L.collapse)||"Collapse":(null==L?void 0:L.close)||"Close","aria-label":"inline"===u.type?(null==L?void 0:L.collapse)||"Collapse artifact":(null==L?void 0:L.close)||"Close artifact"},{children:t.jsx(v.default,{className:"h-5 w-5 shrink-0"})})),t.jsx("button",Object.assign({type:"button",className:"opacity-70 transition-opacity duration-300 ease-in-out hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-50",style:{color:te.secondaryText},disabled:I,onClick:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(oe)try{N.default(oe.content),V(!0),yield new Promise((e=>setTimeout(e,1500)))}finally{V(!1)}})),title:(null==L?void 0:L.copy)||"Copy","aria-label":(null==L?void 0:L.copy)||"Copy artifact content"},{children:t.jsx(f.default,{className:"h-[18px] w-[18px] shrink-0"})})),t.jsx(C.default,Object.assign({data:oe,colors:te,onDownload:se,onSaveAsPDF:re,onSaveAsDOCX:le,className:"opacity-70 transition-opacity duration-300 ease-in-out hover:opacity-100"},{children:t.jsx("div",Object.assign({role:"button",className:"cursor-pointer",style:{color:te.secondaryText},title:(null==L?void 0:L.save)||"Download","aria-label":(null==L?void 0:L.save)||"Download artifact content"},{children:t.jsx(g.default,{className:"h-6 w-6 shrink-0"})}))}))]}))})),t.jsx("div",Object.assign({className:"flex flex-col flex-grow @container/pickaxe-artifact"},{children:t.jsxs(h.default,Object.assign({ref:Q,innerClassName:"flex-grow w-full"},{children:["render"===W&&"application/vnd.pxe.code"!==oe.type?t.jsx("div",Object.assign({ref:X,className:O.default("p-4 pb-6 flex-grow flex flex-col","application/vnd.pxe.react"===oe.type&&"p-0","text/html"===oe.type&&"p-0","text/csv"===oe.type&&"p-0")},{children:"text/markdown"===oe.type||"text/csv"===oe.type||"text/tab-separated-values"===oe.type||"image/svg+xml"===oe.type?t.jsx(s.PickaxeMarkdown,Object.assign({theme:ee.theme,colors:te},{children:t.jsx(c.PickaxeMarkdownRenderer,{value:null!=ne?ne:oe.content,className:O.default("px-6 @[767px]/pickaxe-artifact:px-11 mx-auto w-full",("text/csv"===oe.type||"text/tab-separated-values"===oe.type)&&"px-4 @[767px]/pickaxe-artifact:px-4 mx-0"),style:{flex:1}})})):"application/vnd.pxe.mermaid"===oe.type?t.jsx(w.default,{ref:G,id:`mermaid-${oe.id}-${oe.version}`,data:oe.content}):"text/html"===oe.type||"application/vnd.pxe.react"===oe.type?t.jsx("iframe",Object.assign({ref:J,title:oe.title,src:`${q}/${"text/html"===oe.type?"html":"react"}?theme=${ae?"dark":"light"}&bg=${te.secondary}&accent=${te.accent}`,style:{width:"100%",flex:1,border:"none",backgroundColor:null==te?void 0:te.secondary},loading:"lazy",allow:"fullscreen; camera; microphone; gyroscope; accelerometer; geolocation; clipboard-write; autoplay",sandbox:"allow-scripts allow-same-origin allow-forms allow-downloads allow-popups-to-escape-sandbox allow-pointer-lock allow-popups allow-modals allow-orientation-lock allow-presentation",onLoad:e=>{const t=e.target;setTimeout((()=>{var e;try{null===(e=t.contentWindow)||void 0===e||e.postMessage({type:"text/html"===oe.type?"HTML_CODE":"REACT_CODE",content:oe.content},q)}catch(e){console.error("Error sending message to iframe:",e)}}),100),Y()}},{children:"Iframe is not supported, please view this artifact in a browser that supports it."})):null})):t.jsx(d.Prism,Object.assign({PreTag:"div",language:"text/markdown"===oe.type?"markdown":"text/html"===oe.type||"image/svg+xml"===oe.type?"xml":"application/vnd.pxe.react"===oe.type?"typescript":oe.programmingLanguage,showLineNumbers:!0,customStyle:{margin:0,flex:1},style:Object.assign({'code[class*="language-"]':Object.assign(Object.assign({color:null==te?void 0:te.secondaryText},ae&&{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-"]':Object.assign(Object.assign({color:null==te?void 0:te.secondaryText},ae&&{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",borderRadius:"0.3em",minWidth:0,paddingLeft:"1em",paddingRight:"1em",paddingBottom:"2em",background:null==te?void 0:te.secondary}),':not(pre) > code[class*="language-"]':{background:null==te?void 0:te.secondary,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"},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:null==te?void 0:te.secondaryText,fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},!ae&&{comment:{color:"#7D8B99"},prolog:{color:"#7D8B99"},doctype:{color:"#7D8B99"},cdata:{color:"#7D8B99"},punctuation:{color:"#4D4D4C"},property:{color:"#4078F2"},keyword:{color:"#8959A8"},tag:{color:"#8959A8"},"class-name":{color:"#D75F00"},boolean:{color:"#0086B3"},constant:{color:"#0086B3"},symbol:{color:"#990055"},deleted:{color:"#990000"},number:{color:"#005CC5"},selector:{color:"#63A35C"},"attr-name":{color:"#63A35C"},string:{color:"#50A14F"},char:{color:"#50A14F"},builtin:{color:"#50A14F"},inserted:{color:"#50A14F"},variable:{color:"#A626A4"},operator:{color:"#4D4D4C"},entity:{color:"#E45649",cursor:"help"},url:{color:"#4078F2"},".language-css .token.string":{color:"#50A14F"},".style .token.string":{color:"#50A14F"},atrule:{color:"#C18401"},"attr-value":{color:"#986801"},function:{color:"#005CC5"},regex:{color:"#D16969"},important:{color:null==te?void 0:te.secondaryText,fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}})},{children:oe.content})),t.jsx(x.default,{})]}))})),"inline"===u.type&&!ie&&t.jsxs("div",Object.assign({className:"flex items-center gap-4 p-4 pt-6"},{children:[t.jsx(j.default,Object.assign({id:`artifact-copy-${oe.id}-${oe.version}`,tip:(null==L?void 0:L.copy)||"Copy",style:{padding:"0.25rem 0.5rem",backgroundColor:te.secondary,color:te.secondaryText,fontSize:"12px"},align:"bottom"},{children:t.jsx(b.default,{color:te.secondaryText,text:oe.content,className:"opacity-100",iconClassName:"w-5 h-5"})})),t.jsx(j.default,Object.assign({id:`artifact-save-${oe.id}-${oe.version}`,tip:(null==L?void 0:L.save)||"Save",style:{padding:"0.25rem 0.5rem",backgroundColor:te.secondary,color:te.secondaryText,fontSize:"12px"},align:"bottom"},{children:t.jsx(C.default,Object.assign({data:oe,colors:te,onDownload:se,onSaveAsPDF:re,onSaveAsDOCX:le},{children:t.jsx("button",Object.assign({style:{color:te.secondaryText}},{children:t.jsx(g.default,{className:"w-5 h-5 shrink-0"})}))}))}))]}))]})):null};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),o=require("react"),a=require("../hooks/useArtifactContext.js"),n=require("../../../../../hooks/pickaxe/usePickaxeContext.js"),i=require("../../Scroll/hooks/useScroll.js"),r=require("../hooks/useArtifact.js"),l=require("react-to-print"),s=require("../../../common/PickaxeMarkdown/index.js"),c=require("../../../common/PickaxeMarkdown/Renderer.js"),d=require("react-syntax-highlighter"),p=require("../../../../../common/docx/index.js"),u=require("file-saver"),x=require("../../Scroll/ScrollLockView.js"),m=require("../../../../Icons/expand.svg.js"),y=require("../../../../Icons/shrink.svg.js"),v=require("../../../../Icons/collapse-new.svg.js"),f=require("../../../../Icons/copy-new.svg.js"),g=require("../../../../Icons/download-new.svg.js"),b=require("../../../common/PickaxeCopyButton.js"),h=require("../../../../Core/ScrollArea.js"),j=require("../../../../Core/TipContainer.js"),w=require("../MermaidRenderer.js"),C=require("./SaveMenu.js"),k=require("./ViewOptions.js"),T=require("csv-to-markdown-table"),F=require("copy-to-clipboard"),O=require("../../../../../common/cn.js");function A(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var S=A(u),D=A(T),N=A(F);const q="development"===process.env.NODE_ENV?"http://localhost:3007":"https://user-content.pickaxe.co";exports.default=u=>{var T,F,A,E;const{artifacts:M,currentPopupType:_,currentArtifact:B,setCurrentArtifact:P}=a.useArtifactContext(),{onLoadArtifact:R}=r.useArtifact(),{styles:$,colors:z,translations:L}=n.usePickaxeContext(),[W,H]=o.useState("code"),[I,V]=o.useState(!1),X=o.useRef(),G=o.useRef(null),J=o.useRef(null),K=l.useReactToPrint({contentRef:X}),{scrollContainerRef:Q,scrollStartSession:U,scrollToBottom:Y,scrollEndSession:Z}=i.useScroll({auto:"code"===W}),ee=null!==(F=null===(T=u.styling)||void 0===T?void 0:T.styles)&&void 0!==F?F:$,te=null!==(E=null===(A=u.styling)||void 0===A?void 0:A.colors)&&void 0!==E?E:z,oe=o.useMemo((()=>{var e,t,o,a,n;if(!u.artifact&&!B)return null;const i=null!==(t=null===(e=u.artifact)||void 0===e?void 0:e.id)&&void 0!==t?t:null==B?void 0:B.id,r=null!==(a=null===(o=u.artifact)||void 0===o?void 0:o.version)&&void 0!==a?a:null==B?void 0:B.version;return null!==(n=M.find((e=>e.id===i&&e.version===r)))&&void 0!==n?n:null}),[B,M,u.artifact]),ae=o.useMemo((()=>oe?"text/csv"===oe.type?D.default(oe.content,",",!0):"text/tab-separated-values"===oe.type?D.default(oe.content,"\t",!0):null:null),[oe]),ne=o.useMemo((()=>(te.secondaryText||"").toLowerCase().startsWith("#ffffff")),[null==te?void 0:te.secondaryText]),ie=o.useMemo((()=>{const e=u.artifact&&(null==B?void 0:B.id)===u.artifact.id&&(null==B?void 0:B.version)===u.artifact.version;return"inline"===u.type&&("inline-form"===_?!!B:e)}),[B,_,u.type,u.artifact]);o.useEffect((()=>{e.__awaiter(void 0,void 0,void 0,(function*(){"inline"===u.type&&u.artifact&&(M.some((e=>u.artifact&&e.id===u.artifact.id&&e.version===u.artifact.version))||R({id:u.artifact.id,version:u.artifact.version}))}))}),[M,u.type,u.artifact]),o.useEffect((()=>{if("application/vnd.pxe.code"===(null==oe?void 0:oe.type)&&H("code"),"finished"!==(null==oe?void 0:oe.status))return H("code"),U(),void Y();Z(),"application/vnd.pxe.code"!==oe.type&&H("render")}),[null==oe?void 0:oe.status,null==oe?void 0:oe.type]),o.useEffect((()=>{var e;!J.current||"text/html"!==(null==oe?void 0:oe.type)&&"application/pdf"!==(null==oe?void 0:oe.type)&&"application/vnd.pxe.react"!==(null==oe?void 0:oe.type)||null===(e=J.current.contentWindow)||void 0===e||e.postMessage({type:"application/vnd.pxe.react"!==oe.type?"HTML_CODE":"REACT_CODE",content:oe.content},q)}),[null==oe?void 0:oe.content,null==oe?void 0:oe.type]);const re=()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(!oe)return;if("text/html"===oe.type||"application/pdf"===oe.type){const e=oe.content,t=window.open("","_blank");return void(t&&(t.document.open(),t.document.write(e),t.document.close(),t.focus(),t.print()))}const e=W;"code"===e&&(H("render"),yield new Promise((e=>setTimeout(e,50)))),K(),"code"===e&&H(e)})),le=()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(!oe)return;const e=yield p.convertMarkdownToDocx(oe.content);p.downloadDocx(e,`${oe.title}.docx`)})),se=t=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;if(!oe)return;let o={mimeType:"text/plain",extension:".txt"};switch(t){case"text/markdown":o={mimeType:"text/markdown",extension:".md"};break;case"text/html":o={mimeType:"text/html",extension:".html"};break;case"text/csv":o={mimeType:"text/csv",extension:".csv"};break;case"text/tab-separated-values":o={mimeType:"text/tab-separated-values",extension:".tsv"};break;case"image/svg+xml":case"application/vnd.pxe.mermaid":o={mimeType:"image/svg+xml",extension:".svg"};break;case"application/pdf":o={mimeType:"application/pdf",extension:".pdf"};break;case"application/vnd.pxe.code":o={mimeType:`application/${oe.programmingLanguage||"text"};charset=utf-8`,extension:`.${oe.programmingLanguage||"txt"}`};break;case"application/vnd.pxe.react":o={mimeType:"text/typescript",extension:".tsx"};break;default:o={mimeType:"text/plain",extension:".txt"}}let a=null;if("application/vnd.pxe.mermaid"===oe.type){const t=W;"code"===t&&(H("render"),yield new Promise((e=>setTimeout(e,50))));const o=null===(e=G.current)||void 0===e?void 0:e.querySelector("svg");o&&(a=(new XMLSerializer).serializeToString(o)),"code"===t&&H(t)}const n=new Blob([null!=a?a:oe.content],{type:o.mimeType});S.default(n,`${oe.title}${o.extension}`)})),ce=()=>{"inline"!==u.type||!u.artifact||ie?P(null):P({id:u.artifact.id,version:u.artifact.version})},de=ie||!_.startsWith("inline");return oe?t.jsxs("div",Object.assign({className:O.default("pxe-artifact-renderer flex flex-col","inline"===u.type&&!ie&&"min-h-[320px] mb-6",u.className),style:Object.assign(Object.assign({backgroundColor:te.secondary,color:te.secondaryText},"auto"!==_&&{borderRadius:ee.cornerRadius}),u.style)},{children:[t.jsxs("div",Object.assign({className:"flex items-center gap-4 justify-between px-4 py-3 shadow-sm"},{children:[t.jsxs("div",Object.assign({className:"pxe-artifact-create-header flex min-w-0 items-center gap-4"},{children:[de&&t.jsx(k.default,{type:oe.type,view:W,colors:te,onChange:H}),t.jsx("p",Object.assign({className:"w-[220px] max-w-full truncate text-[18px] font-semilight leading-tight",title:oe.title},{children:oe.title}))]})),"inline"===u.type&&!de&&t.jsx("div",Object.assign({className:"shrink-0"},{children:t.jsx("button",Object.assign({type:"button",style:{color:te.secondaryText},onClick:ce,title:(null==L?void 0:L.expand)||"Expand","aria-label":(null==L?void 0:L.expand)||"Expand artifact"},{children:ie?t.jsx(y.default,{className:"w-6 h-6 shrink-0"}):t.jsx(m.default,{className:"w-6 h-6 shrink-0"})}))}))]})),de&&t.jsx("div",Object.assign({className:"flex items-center justify-between border-y px-4 py-2.5",style:{borderColor:te.primary}},{children:t.jsxs("div",Object.assign({className:"flex items-center gap-3"},{children:[t.jsx("button",Object.assign({type:"button",className:"opacity-70 transition-opacity duration-300 ease-in-out hover:opacity-100",style:{color:te.secondaryText},onClick:ce,title:"inline"===u.type?(null==L?void 0:L.collapse)||"Collapse":(null==L?void 0:L.close)||"Close","aria-label":"inline"===u.type?(null==L?void 0:L.collapse)||"Collapse artifact":(null==L?void 0:L.close)||"Close artifact"},{children:t.jsx(v.default,{className:"h-5 w-5 shrink-0"})})),t.jsx("button",Object.assign({type:"button",className:"opacity-70 transition-opacity duration-300 ease-in-out hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-50",style:{color:te.secondaryText},disabled:I,onClick:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(oe)try{N.default(oe.content),V(!0),yield new Promise((e=>setTimeout(e,1500)))}finally{V(!1)}})),title:(null==L?void 0:L.copy)||"Copy","aria-label":(null==L?void 0:L.copy)||"Copy artifact content"},{children:t.jsx(f.default,{className:"h-[18px] w-[18px] shrink-0"})})),t.jsx(C.default,Object.assign({data:oe,colors:te,onDownload:se,onSaveAsPDF:re,onSaveAsDOCX:le,className:"opacity-70 transition-opacity duration-300 ease-in-out hover:opacity-100"},{children:t.jsx("div",Object.assign({role:"button",className:"cursor-pointer",style:{color:te.secondaryText},title:(null==L?void 0:L.save)||"Download","aria-label":(null==L?void 0:L.save)||"Download artifact content"},{children:t.jsx(g.default,{className:"h-6 w-6 shrink-0"})}))}))]}))})),t.jsx("div",Object.assign({className:"flex flex-col flex-grow @container/pickaxe-artifact"},{children:t.jsxs(h.default,Object.assign({ref:Q,innerClassName:"flex-grow w-full"},{children:["render"===W&&"application/vnd.pxe.code"!==oe.type?t.jsx("div",Object.assign({ref:X,className:O.default("p-4 pb-6 flex-grow flex flex-col","text/html"===oe.type&&"p-0","text/csv"===oe.type&&"p-0","application/pdf"===oe.type&&"p-0","application/vnd.pxe.react"===oe.type&&"p-0")},{children:"text/markdown"===oe.type||"text/csv"===oe.type||"text/tab-separated-values"===oe.type||"image/svg+xml"===oe.type?t.jsx(s.PickaxeMarkdown,Object.assign({theme:ee.theme,colors:te},{children:t.jsx(c.PickaxeMarkdownRenderer,{value:null!=ae?ae:oe.content,className:O.default("px-6 @[767px]/pickaxe-artifact:px-11 mx-auto w-full",("text/csv"===oe.type||"text/tab-separated-values"===oe.type)&&"px-4 @[767px]/pickaxe-artifact:px-4 mx-0"),style:{flex:1}})})):"application/vnd.pxe.mermaid"===oe.type?t.jsx(w.default,{ref:G,id:`mermaid-${oe.id}-${oe.version}`,data:oe.content}):"text/html"===oe.type||"application/pdf"===oe.type||"application/vnd.pxe.react"===oe.type?t.jsx("iframe",Object.assign({ref:J,title:oe.title,src:`${q}/${"application/vnd.pxe.react"!==oe.type?"html":"react"}?theme=${ne?"dark":"light"}&bg=${te.secondary}&accent=${te.accent}`,style:{width:"100%",flex:1,border:"none",backgroundColor:null==te?void 0:te.secondary},loading:"lazy",allow:"fullscreen; camera; microphone; gyroscope; accelerometer; geolocation; clipboard-write; autoplay",sandbox:"allow-scripts allow-same-origin allow-forms allow-downloads allow-popups-to-escape-sandbox allow-pointer-lock allow-popups allow-modals allow-orientation-lock allow-presentation",onLoad:e=>{const t=e.target;setTimeout((()=>{var e;try{null===(e=t.contentWindow)||void 0===e||e.postMessage({type:"application/vnd.pxe.react"!==oe.type?"HTML_CODE":"REACT_CODE",content:oe.content},q)}catch(e){console.error("Error sending message to iframe:",e)}}),100),Y()}},{children:"Iframe is not supported, please view this artifact in a browser that supports it."})):null})):t.jsx(d.Prism,Object.assign({PreTag:"div",language:"text/markdown"===oe.type?"markdown":"text/html"===oe.type||"image/svg+xml"===oe.type?"xml":"application/vnd.pxe.react"===oe.type?"typescript":oe.programmingLanguage,showLineNumbers:!0,customStyle:{margin:0,flex:1},style:Object.assign({'code[class*="language-"]':Object.assign(Object.assign({color:null==te?void 0:te.secondaryText},ne&&{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-"]':Object.assign(Object.assign({color:null==te?void 0:te.secondaryText},ne&&{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",borderRadius:"0.3em",minWidth:0,paddingLeft:"1em",paddingRight:"1em",paddingBottom:"2em",background:null==te?void 0:te.secondary}),':not(pre) > code[class*="language-"]':{background:null==te?void 0:te.secondary,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"},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:null==te?void 0:te.secondaryText,fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},!ne&&{comment:{color:"#7D8B99"},prolog:{color:"#7D8B99"},doctype:{color:"#7D8B99"},cdata:{color:"#7D8B99"},punctuation:{color:"#4D4D4C"},property:{color:"#4078F2"},keyword:{color:"#8959A8"},tag:{color:"#8959A8"},"class-name":{color:"#D75F00"},boolean:{color:"#0086B3"},constant:{color:"#0086B3"},symbol:{color:"#990055"},deleted:{color:"#990000"},number:{color:"#005CC5"},selector:{color:"#63A35C"},"attr-name":{color:"#63A35C"},string:{color:"#50A14F"},char:{color:"#50A14F"},builtin:{color:"#50A14F"},inserted:{color:"#50A14F"},variable:{color:"#A626A4"},operator:{color:"#4D4D4C"},entity:{color:"#E45649",cursor:"help"},url:{color:"#4078F2"},".language-css .token.string":{color:"#50A14F"},".style .token.string":{color:"#50A14F"},atrule:{color:"#C18401"},"attr-value":{color:"#986801"},function:{color:"#005CC5"},regex:{color:"#D16969"},important:{color:null==te?void 0:te.secondaryText,fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}})},{children:oe.content})),t.jsx(x.default,{})]}))})),"inline"===u.type&&!ie&&t.jsxs("div",Object.assign({className:"flex items-center gap-4 p-4 pt-6"},{children:[t.jsx(j.default,Object.assign({id:`artifact-copy-${oe.id}-${oe.version}`,tip:(null==L?void 0:L.copy)||"Copy",style:{padding:"0.25rem 0.5rem",backgroundColor:te.secondary,color:te.secondaryText,fontSize:"12px"},align:"bottom"},{children:t.jsx(b.default,{color:te.secondaryText,text:oe.content,className:"opacity-100",iconClassName:"w-5 h-5"})})),t.jsx(j.default,Object.assign({id:`artifact-save-${oe.id}-${oe.version}`,tip:(null==L?void 0:L.save)||"Save",style:{padding:"0.25rem 0.5rem",backgroundColor:te.secondary,color:te.secondaryText,fontSize:"12px"},align:"bottom"},{children:t.jsx(C.default,Object.assign({data:oe,colors:te,onDownload:se,onSaveAsPDF:re,onSaveAsDOCX:le},{children:t.jsx("button",Object.assign({style:{color:te.secondaryText}},{children:t.jsx(g.default,{className:"w-5 h-5 shrink-0"})}))}))}))]}))]})):null};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),s=require("react"),i=require("../../../hooks/pickaxe/usePickaxeContext.js"),o=require("../Addons/Auth/hooks/useAuthContext.js"),r=require("../../../hooks/pickaxe/useDimensionContext.js"),n=require("../Addons/Document/hooks/useDocument.js"),a=require("../../../hooks/studio/useStyleFontSize.js"),l=require("./History/index.js"),u=require("./Input.js"),c=require("../../Icons/attach-vertical.svg.js"),d=require("../../../common/cn.js"),f=require("../../../common/api/pickaxe.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),s=require("react"),i=require("../../../hooks/pickaxe/usePickaxeContext.js"),o=require("../Addons/Auth/hooks/useAuthContext.js"),r=require("../../../hooks/pickaxe/useDimensionContext.js"),n=require("../Addons/Document/hooks/useDocument.js"),a=require("../../../hooks/studio/useStyleFontSize.js"),l=require("./History/index.js"),u=require("./Input.js"),c=require("../../Icons/attach-vertical.svg.js"),d=require("../../../common/cn.js"),f=require("../../../common/api/pickaxe.js"),h=require("uuid"),m=require("../../Core/StudioTip.js"),p=require("../../../hooks/pickaxe/useResponseContext.js"),x=require("../Addons/Navbar/NavPill.js"),v=require("../../Icons/history.svg.js");exports.default=()=>{const{deploymentType:j,isNewChat:g,setIsNewChat:b,sessionId:k,setSessionId:y,setLastSessionId:w,pickaxeId:C,sender:D,pickaxe:I,styles:S,isEmbed:_,translations:q}=i.usePickaxeContext(),{isSent:N}=o.useAuthContext(),{width:P,height:F,setDimension:A}=r.useDimensionContext(),{setDocuments:T,onFileUpload:E}=n.useDocument(),{isGenerating:O,messages:R}=p.useResponseContext(),z=a.useStyleFontSize(),[H,G]=s.useState(0),[L,B]=s.useState(!1),[M,U]=s.useState(!1),J=s.useRef(null),K=s.useRef(null),Q=s.useRef(0),[V,W]=s.useState(null),[X,Y]=s.useState(!1),Z="chat-input"===j&&g&&!N;s.useEffect((()=>()=>{T([])}),[]);const $=s.useCallback((()=>{if(!C||!D)return;const t=(s=0)=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;try{const t=yield f.default.post("/get_pickaxe_conversation",{sessionId:k,userId:D});if(t.data&&t.data.success){const e=t.data.title;if(e&&"Conversation Title"!==e)return void te(e)}else console.error("Failed to load conversation:",null===(e=t.data)||void 0===e?void 0:e.error)}catch(e){console.error("Error fetching conversation:",e)}s<20&&setTimeout((()=>t(s+1)),3e3)}));t()}),[C,D,k]);s.useEffect((()=>{O||g||!k||$()}),[O,g,k,$]),s.useEffect((()=>{if(!J.current)return;const e=new ResizeObserver((e=>{for(const t of e){const{width:e,height:s}=t.contentRect;A(parseInt(e.toFixed(0)),parseInt(s.toFixed(0)))}}));return e.observe(J.current),()=>{e.disconnect()}}),[J.current]);const[ee,te]=s.useState("New Chat"),se=(null==I?void 0:I.formtitle)||"Pickaxe",ie=(null==I?void 0:I.coverphoto)||void 0,[oe,re]=s.useState(!1);s.useEffect((()=>{const e=!Z&&!_&&S.portalTheme&&(R.filter((e=>"user"===e.role)).length>0||L||!g);re(null!=e&&e)}),[R,L,g]);return t.jsxs("div",Object.assign({ref:J,className:"relative flex h-full w-full flex-col items-center overflow-hidden",onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),Q.current+=1,e.dataTransfer.items&&e.dataTransfer.items.length>0&&U(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),Q.current-=1,0===Q.current&&U(!1)},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDrop:t=>e.__awaiter(void 0,void 0,void 0,(function*(){t.preventDefault(),t.stopPropagation(),U(!1),Q.current=0;const e=Array.from(t.dataTransfer.files||[]);e.length>0&&(b(!1),yield E(e))}))},{children:[M&&t.jsxs("div",Object.assign({className:"absolute inset-0 z-50 flex flex-col items-center justify-center rounded-lg bg-white/80 backdrop-blur-sm transition-all duration-300"},{children:[t.jsx("div",Object.assign({className:"flex h-24 w-24 items-center justify-center rounded-full bg-white shadow-lg animate-bounce text-black"},{children:t.jsx(c.default,{className:"h-10 w-10"})})),t.jsx("h3",Object.assign({className:d.default(z.h3,"mt-6 font-semibold text-c-primary text-black")},{children:"Drop files to upload"})),t.jsx("p",Object.assign({className:d.default(z.b2,"mt-2 opacity-60 text-black")},{children:"Add anything to the conversation"}))]})),Z?t.jsx(u.default,{}):t.jsxs(t.Fragment,{children:[oe&&t.jsxs("div",Object.assign({className:d.default("direct-link"===j?"absolute top-4 left-4 md:top-6 md:left-6 z-40 flex items-center gap-2 animate-in fade-in slide-in-from-top-4 duration-500":"w-full max-w-3xl mt-6 px-4 md:px-0 flex justify-start z-30 mb-4 animate-in fade-in slide-in-from-top-4 duration-500 gap-2","dark"===S.portalTheme?"glass-dark ":"")},{children:[t.jsx(x.NavPill,{text:se,icon:ie}),g||"New Chat"===ee?t.jsx(x.NavPill,{text:ee}):t.jsx(x.EditableNavPill,{text:ee,sessionId:k,onRename:t=>e.__awaiter(void 0,void 0,void 0,(function*(){if(k)try{yield f.default.post("/edit_conversation_name",{sessionId:k,name:t,userId:D}),te(t)}catch(e){console.error("Error renaming chat:",e),alert("Failed to rename chat.")}})),onDelete:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(k&&window.confirm("Are you sure you want to delete this conversation?"))try{yield f.default.post("/delete_pickaxe_conversation",{sessionId:k,userId:D}),b(!0),y(h.v4()),te("New Chat")}catch(e){console.error("Error deleting chat:",e),alert("Failed to delete chat.")}})),isDarkGlass:"dark"===S.portalTheme}),t.jsx(m.StudioTip,Object.assign({content:q["chat-history"]||"Chat History",align:"bottom",containerClassName:"inline-flex shrink-0"},{children:t.jsx(x.HistoryPill,{icon:t.jsx(v.default,{}),onClick:()=>{y(""),w(k)}})}))]})),t.jsx(l.default,{additionalScrollHeight:H,isForceHideInfo:F<=545||P<=350||L,isInputFocused:L,onSubmit:t=>e.__awaiter(void 0,void 0,void 0,(function*(){K.current&&K.current.onSubmit(t)})),smitheryAuthData:V,resubmitPrompt:()=>{W(null),Y(!0)}}),t.jsx(u.default,{ref:K,onFocus:()=>B(!0),onBlur:()=>B(!1),onInputHeightChange:G,initSmitheryAuthData:e=>W(e),resubmitPrompt:X})]})]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("../../hooks/usePickaxeMarkdownContext.js"),i=require("../../../../Addons/Artifact/hooks/useArtifactContext.js"),a=require("framer-motion"),s=require("../../../../../Icons/spinner-lines.svg.js"),n=require("../../../../Addons/Artifact/Renderer/index.js");exports.Artifact=({node:o})=>{const{theme:c,colors:d,styles:l,onArtifactClick:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("../../hooks/usePickaxeMarkdownContext.js"),i=require("../../../../Addons/Artifact/hooks/useArtifactContext.js"),a=require("framer-motion"),s=require("../../../../../Icons/spinner-lines.svg.js"),n=require("../../../../Addons/Artifact/Renderer/index.js");exports.Artifact=({node:o})=>{const{theme:c,colors:d,styles:l,onArtifactClick:p}=r.usePickaxeMarkdownContext(),{artifacts:u,currentPopupType:x,currentArtifact:f}=i.useArtifactContext(),m=t.useMemo((()=>{const{dataId:e,dataCommand:t,dataTitle:r,dataType:i,dataVersion:a}=(null==o?void 0:o.properties)||{};return e?{id:e,command:t||"create",title:r||"Untitled Artifact",type:i||"text/markdown",version:a?parseInt(a,10):1}:null}),[]),v=t.useMemo((()=>{var e,t;if(!m)return null;const{command:r,type:i,version:a}=m;let s=`${null!==(e={create:"Created",update:"Updated",rewrite:"Rewrote"}[r])&&void 0!==e?e:"Created"} ${null!==(t={"text/markdown":"Markdown","text/html":"HTML","text/csv":"CSV","text/tab-separated-values":"TSV","image/svg+xml":"SVG","application/pdf":"PDF","application/vnd.pxe.code":"Code","application/vnd.pxe.mermaid":"Diagram","application/vnd.pxe.react":"React Component"}[i])&&void 0!==t?t:"Artifact"}`;return a>1&&(s+=` (v${a})`),s}),[m]),C=t.useMemo((()=>{if(!m)return"finished";const e=u.find((e=>e.id===m.id&&e.version===m.version));return e?e.status:"finished"}),[u,m]);return m?x.startsWith("inline")&&"finished"===C?f?null:e.jsx(n.default,{type:"inline",className:"pxe-artifact-inline",styling:{colors:d,styles:l},artifact:{id:m.id,version:m.version}}):e.jsxs(a.motion.div,Object.assign({className:"pxe-artifact-create-container p-4 flex items-center gap-8 flex-wrap justify-between mb-4 select-none",style:Object.assign({borderColor:"dark"===c?"#444444":"#CCCCCC",backgroundColor:d.secondary+"80",color:d.secondaryText,borderRadius:l.cornerRadius},!!p&&{cursor:"pointer"}),initial:{opacity:0,x:10,scale:.95},animate:{opacity:1,x:0,scale:1},transition:{duration:.5,ease:"easeOut",staggerChildren:.1},whileHover:{borderColor:"dark"===c?"#666666":"#AAAAAA",backgroundColor:d.secondary}},p&&{onClick:()=>p({id:m.id,version:m.version})},{children:[e.jsxs("div",Object.assign({className:"pxe-artifact-create-header flex flex-col gap-2 text-[10pt]"},{children:[e.jsx("p",Object.assign({className:"font-semibold"},{children:m.title})),e.jsx("p",Object.assign({className:"opacity-90"},{children:v}))]})),"finished"!==C&&e.jsx("div",{children:e.jsx(s.default,{className:"pxe-spin w-5 h-5 shrink-0"})})]})):null},exports.ArtifactError=({node:r,children:a})=>{const{setArtifacts:s}=i.useArtifactContext();return t.useEffect((()=>{if(!r||!r.properties)return;const e=r.properties.dataId;e&&s((t=>t.map((t=>t.id===e?Object.assign(Object.assign({},t),{status:"error"}):t))))}),[]),e.jsx("div",Object.assign({className:"pxe-red pxe-artifact-error"},{children:a}))};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
interface StudioTipProps {
|
|
3
|
+
containerClassName?: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
content: string;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
strategy?: "absolute" | "fixed";
|
|
8
|
+
align?: "top" | "bottom" | "left" | "right";
|
|
9
|
+
}
|
|
10
|
+
export declare const StudioTip: ({ containerClassName, className, content, children, strategy, align, }: StudioTipProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default StudioTip;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ArtifactType = "text/markdown" | "text/html" | "text/csv" | "text/tab-separated-values" | "image/svg+xml" | "application/vnd.pxe.code" | "application/vnd.pxe.mermaid" | "application/vnd.pxe.react";
|
|
1
|
+
export type ArtifactType = "text/markdown" | "text/html" | "text/csv" | "text/tab-separated-values" | "image/svg+xml" | "application/pdf" | "application/vnd.pxe.code" | "application/vnd.pxe.mermaid" | "application/vnd.pxe.react";
|
|
2
2
|
export type ArtifactCommand = "create" | "update" | "rewrite";
|
|
3
3
|
export type ArtifactStatus = "finished" | "streaming" | "updating" | "error";
|
|
4
4
|
export type ArtifactViewOption = "render" | "code";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{useState as r,useRef as o,useEffect as a}from"react";import{usePickaxeContext as s}from"../../hooks/pickaxe/usePickaxeContext.js";import l from"../../common/cn.js";const n=({containerClassName:n,className:c,content:i,children:f,strategy:u="absolute",align:m="bottom"})=>{const{colors:p}=s(),[d,h]=r(!1),[x,b]=r({top:0,left:0}),g=o(null);a((()=>{if(d&&"fixed"===u&&g.current){const t=g.current.getBoundingClientRect();let e=0,r=0;switch(m){case"top":e=t.top-8,r=t.left+t.width/2;break;case"bottom":e=t.bottom+8,r=t.left+t.width/2;break;case"left":e=t.top+t.height/2,r=t.left-8;break;case"right":e=t.top+t.height/2,r=t.right+8}b({top:e,left:r})}}),[d,u,m]);return t("div",Object.assign({ref:g,className:l("relative",n),onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1)},{children:[f,d&&e("div",Object.assign({className:l("fixed"===u?`fixed ${(()=>{switch(m){case"top":return"-translate-x-1/2 -translate-y-full";case"bottom":return"-translate-x-1/2";case"left":return"-translate-x-full -translate-y-1/2";case"right":return"-translate-y-1/2"}})()}`:`absolute ${(()=>{switch(m){case"top":return"left-1/2 bottom-full mb-2 -translate-x-1/2";case"bottom":return"left-1/2 top-full mt-2 -translate-x-1/2";case"left":return"right-full top-1/2 mr-2 -translate-y-1/2";case"right":return"left-full top-1/2 ml-2 -translate-y-1/2"}})()}`,"select-none z-[1337] whitespace-nowrap rounded-lg px-3 py-2 text-xs font-semibold shadow-lg",c),style:Object.assign({backgroundColor:p.secondary,color:p.secondaryText},"fixed"===u&&{top:`${x.top}px`,left:`${x.left}px`})},{children:i}))]}))};export{n as StudioTip,n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as a from"react";var
|
|
1
|
+
import*as a from"react";var r;function t(){return t=Object.assign?Object.assign.bind():function(a){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var e in t)({}).hasOwnProperty.call(t,e)&&(a[e]=t[e])}return a},t.apply(null,arguments)}var e=e=>a.createElement("svg",t({xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none"},e),r||(r=a.createElement("path",{fill:"currentColor",d:"M20 10c0-5.523-4.477-10-10-10a9.97 9.97 0 0 0-7 2.859V1.75a.75.75 0 0 0-1.5 0v3.5c0 .414.336.75.75.75h3.5a.75.75 0 0 0 0-1.5H3.519a8.5 8.5 0 1 1 2.348 12.93l-.27-.15-3.986 1.111 1.113-3.984-.151-.27A8.46 8.46 0 0 1 1.5 10c0-.675.079-1.332.227-1.962.08-.301.065-.888-.536-1.02-.613-.134-.87.355-.935.719h.001A10 10 0 0 0 0 10a9.96 9.96 0 0 0 1.115 4.592L.047 18.415a1.25 1.25 0 0 0 1.54 1.54l3.826-1.067A9.96 9.96 0 0 0 10 20c5.523 0 10-4.477 10-10M10 6.75a.75.75 0 0 0-1.5 0v4.5c0 .414.336.75.75.75h3a.75.75 0 0 0 0-1.5H10z"})));export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import s from"../../../../Icons/save.svg.js";import a from"../../../../Core/Menu/index.js";import l from"../../../../Core/Menu/Button.js";import i from"../../../../Core/Menu/List.js";const c=({variant:c="default",className:o,children:r,data:m,colors:p,onDownload:x,onSaveAsPDF:
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import s from"../../../../Icons/save.svg.js";import a from"../../../../Core/Menu/index.js";import l from"../../../../Core/Menu/Button.js";import i from"../../../../Core/Menu/List.js";const c=({variant:c="default",className:o,children:r,data:m,colors:p,onDownload:x,onSaveAsPDF:h,onSaveAsDOCX:b})=>e(a,Object.assign({id:`save-artifact-${m.id}-${m.version}`},{children:[t(l,Object.assign({variant:c,className:o,style:{color:p.text}},{children:r})),t(i,Object.assign({width:"auto",className:"font-semibold p-1 text-sm",style:{backgroundColor:p.primary,color:p.text},border:`1px solid ${p.primary}`},{children:"text/markdown"===m.type?e(n,{children:[e("button",Object.assign({className:"px-2 py-1 text-left",onClick:()=>x("text/markdown")},{children:[t(s,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"Markdown"]})),e("button",Object.assign({className:"px-2 py-1 text-left",onClick:h},{children:[t(s,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"PDF"]})),e("button",Object.assign({className:"px-2 py-1 text-left",onClick:b},{children:[t(s,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"DOCX"]})),e("button",Object.assign({className:"px-2 py-1 text-left",onClick:()=>x("text/plain")},{children:[t(s,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"TXT"]}))]}):"text/html"===m.type?e(n,{children:[e("button",Object.assign({className:"px-2 py-1 text-left",onClick:()=>x("text/html")},{children:[t(s,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"HTML"]})),e("button",Object.assign({className:"px-2 py-1 text-left",onClick:h},{children:[t(s,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"PDF"]}))]}):"text/csv"===m.type?e("button",Object.assign({className:"px-2 py-1 text-left",onClick:()=>x("text/csv")},{children:[t(s,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"CSV"]})):"text/tab-separated-values"===m.type?e("button",Object.assign({className:"px-2 py-1 text-left",onClick:()=>x("text/tab-separated-values")},{children:[t(s,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"TSV"]})):"image/svg+xml"===m.type?e("button",Object.assign({className:"px-2 py-1 text-left",onClick:()=>x("image/svg+xml")},{children:[t(s,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"SVG"]})):"application/pdf"===m.type?e("button",Object.assign({className:"px-2 py-1 text-left",onClick:h},{children:[t(s,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"PDF"]})):"application/vnd.pxe.code"===m.type?e("button",Object.assign({className:"px-2 py-1 text-left",onClick:()=>x("application/vnd.pxe.code")},{children:[t(s,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),`${m.programmingLanguage||"Plain Text"}`]})):"application/vnd.pxe.mermaid"===m.type?e("button",Object.assign({className:"px-2 py-1 text-left",onClick:()=>x("application/vnd.pxe.mermaid")},{children:[t(s,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"SVG"]})):"application/vnd.pxe.react"===m.type?e("button",Object.assign({className:"px-2 py-1 text-left",onClick:()=>x("application/vnd.pxe.react")},{children:[t(s,{className:"w-5 h-5 shrink-0 inline-block mr-2"}),"TSX"]})):null}))]}));export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e}from"../../../../../_virtual/_tslib.js";import{jsxs as o,jsx as t}from"react/jsx-runtime";import{useState as n,useRef as i,useMemo as r,useEffect as a}from"react";import{useArtifactContext as l}from"../hooks/useArtifactContext.js";import{usePickaxeContext as c}from"../../../../../hooks/pickaxe/usePickaxeContext.js";import{useScroll as s}from"../../Scroll/hooks/useScroll.js";import{useArtifact as d}from"../hooks/useArtifact.js";import{useReactToPrint as p}from"react-to-print";import{PickaxeMarkdown as m}from"../../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as u}from"../../../common/PickaxeMarkdown/Renderer.js";import{Prism as y}from"react-syntax-highlighter";import{convertMarkdownToDocx as v,downloadDocx as x}from"../../../../../common/docx/index.js";import f from"file-saver";import g from"../../Scroll/ScrollLockView.js";import b from"../../../../Icons/expand.svg.js";import h from"../../../../Icons/shrink.svg.js";import w from"../../../../Icons/collapse-new.svg.js";import C from"../../../../Icons/copy-new.svg.js";import k from"../../../../Icons/download-new.svg.js";import j from"../../../common/PickaxeCopyButton.js";import F from"../../../../Core/ScrollArea.js";import T from"../../../../Core/TipContainer.js";import O from"../MermaidRenderer.js";import A from"./SaveMenu.js";import S from"./ViewOptions.js";import D from"csv-to-markdown-table";import N from"copy-to-clipboard";import E from"../../../../../common/cn.js";const B="development"===process.env.NODE_ENV?"http://localhost:3007":"https://user-content.pickaxe.co",$=$=>{var z,M,L,P;const{artifacts:R,currentPopupType:W,currentArtifact:H,setCurrentArtifact:I}=l(),{onLoadArtifact:_}=d(),{styles:V,colors:X,translations:q}=c(),[G,J]=n("code"),[K,Q]=n(!1),U=i(),Y=i(null),Z=i(null),ee=p({contentRef:U}),{scrollContainerRef:oe,scrollStartSession:te,scrollToBottom:ne,scrollEndSession:ie}=s({auto:"code"===G}),re=null!==(M=null===(z=$.styling)||void 0===z?void 0:z.styles)&&void 0!==M?M:V,ae=null!==(P=null===(L=$.styling)||void 0===L?void 0:L.colors)&&void 0!==P?P:X,le=r((()=>{var e,o,t,n,i;if(!$.artifact&&!H)return null;const r=null!==(o=null===(e=$.artifact)||void 0===e?void 0:e.id)&&void 0!==o?o:null==H?void 0:H.id,a=null!==(n=null===(t=$.artifact)||void 0===t?void 0:t.version)&&void 0!==n?n:null==H?void 0:H.version;return null!==(i=R.find((e=>e.id===r&&e.version===a)))&&void 0!==i?i:null}),[H,R,$.artifact]),ce=r((()=>le?"text/csv"===le.type?D(le.content,",",!0):"text/tab-separated-values"===le.type?D(le.content,"\t",!0):null:null),[le]),se=r((()=>(ae.secondaryText||"").toLowerCase().startsWith("#ffffff")),[null==ae?void 0:ae.secondaryText]),de=r((()=>{const e=$.artifact&&(null==H?void 0:H.id)===$.artifact.id&&(null==H?void 0:H.version)===$.artifact.version;return"inline"===$.type&&("inline-form"===W?!!H:e)}),[H,W,$.type,$.artifact]);a((()=>{e(void 0,void 0,void 0,(function*(){"inline"===$.type&&$.artifact&&(R.some((e=>$.artifact&&e.id===$.artifact.id&&e.version===$.artifact.version))||_({id:$.artifact.id,version:$.artifact.version}))}))}),[R,$.type,$.artifact]),a((()=>{if("application/vnd.pxe.code"===(null==le?void 0:le.type)&&J("code"),"finished"!==(null==le?void 0:le.status))return J("code"),te(),void ne();ie(),"application/vnd.pxe.code"!==le.type&&J("render")}),[null==le?void 0:le.status,null==le?void 0:le.type]),a((()=>{var e;!Z.current||"text/html"!==(null==le?void 0:le.type)&&"application/vnd.pxe.react"!==(null==le?void 0:le.type)||null===(e=Z.current.contentWindow)||void 0===e||e.postMessage({type:"text/html"===le.type?"HTML_CODE":"REACT_CODE",content:le.content},B)}),[null==le?void 0:le.content,null==le?void 0:le.type]);const pe=()=>e(void 0,void 0,void 0,(function*(){if(!le)return;if("text/html"===le.type){const e=le.content,o=window.open("","_blank");return void(o&&(o.document.open(),o.document.write(e),o.document.close(),o.focus(),o.print()))}const e=G;"code"===e&&(J("render"),yield new Promise((e=>setTimeout(e,50)))),ee(),"code"===e&&J(e)})),me=()=>e(void 0,void 0,void 0,(function*(){if(!le)return;const e=yield v(le.content);x(e,`${le.title}.docx`)})),ue=o=>e(void 0,void 0,void 0,(function*(){var e;if(!le)return;let t={mimeType:"text/plain",extension:".txt"};switch(o){case"text/markdown":t={mimeType:"text/markdown",extension:".md"};break;case"text/html":t={mimeType:"text/html",extension:".html"};break;case"text/csv":t={mimeType:"text/csv",extension:".csv"};break;case"text/tab-separated-values":t={mimeType:"text/tab-separated-values",extension:".tsv"};break;case"image/svg+xml":case"application/vnd.pxe.mermaid":t={mimeType:"image/svg+xml",extension:".svg"};break;case"application/vnd.pxe.code":t={mimeType:`application/${le.programmingLanguage||"text"};charset=utf-8`,extension:`.${le.programmingLanguage||"txt"}`};break;case"application/vnd.pxe.react":t={mimeType:"text/typescript",extension:".tsx"};break;default:t={mimeType:"text/plain",extension:".txt"}}let n=null;if("application/vnd.pxe.mermaid"===le.type){const o=G;"code"===o&&(J("render"),yield new Promise((e=>setTimeout(e,50))));const t=null===(e=Y.current)||void 0===e?void 0:e.querySelector("svg");t&&(n=(new XMLSerializer).serializeToString(t)),"code"===o&&J(o)}const i=new Blob([null!=n?n:le.content],{type:t.mimeType});f(i,`${le.title}${t.extension}`)})),ye=()=>{"inline"!==$.type||!$.artifact||de?I(null):I({id:$.artifact.id,version:$.artifact.version})},ve=de||!W.startsWith("inline");return le?o("div",Object.assign({className:E("pxe-artifact-renderer flex flex-col","inline"===$.type&&!de&&"min-h-[320px] mb-6",$.className),style:Object.assign(Object.assign({backgroundColor:ae.secondary,color:ae.secondaryText},"auto"!==W&&{borderRadius:re.cornerRadius}),$.style)},{children:[o("div",Object.assign({className:"flex items-center gap-4 justify-between px-4 py-3 shadow-sm"},{children:[o("div",Object.assign({className:"pxe-artifact-create-header flex min-w-0 items-center gap-4"},{children:[ve&&t(S,{type:le.type,view:G,colors:ae,onChange:J}),t("p",Object.assign({className:"w-[220px] max-w-full truncate text-[18px] font-semilight leading-tight",title:le.title},{children:le.title}))]})),"inline"===$.type&&!ve&&t("div",Object.assign({className:"shrink-0"},{children:t("button",Object.assign({type:"button",style:{color:ae.secondaryText},onClick:ye,title:(null==q?void 0:q.expand)||"Expand","aria-label":(null==q?void 0:q.expand)||"Expand artifact"},{children:t(de?h:b,{className:"w-6 h-6 shrink-0"})}))}))]})),ve&&t("div",Object.assign({className:"flex items-center justify-between border-y px-4 py-2.5",style:{borderColor:ae.primary}},{children:o("div",Object.assign({className:"flex items-center gap-3"},{children:[t("button",Object.assign({type:"button",className:"opacity-70 transition-opacity duration-300 ease-in-out hover:opacity-100",style:{color:ae.secondaryText},onClick:ye,title:"inline"===$.type?(null==q?void 0:q.collapse)||"Collapse":(null==q?void 0:q.close)||"Close","aria-label":"inline"===$.type?(null==q?void 0:q.collapse)||"Collapse artifact":(null==q?void 0:q.close)||"Close artifact"},{children:t(w,{className:"h-5 w-5 shrink-0"})})),t("button",Object.assign({type:"button",className:"opacity-70 transition-opacity duration-300 ease-in-out hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-50",style:{color:ae.secondaryText},disabled:K,onClick:()=>e(void 0,void 0,void 0,(function*(){if(le)try{N(le.content),Q(!0),yield new Promise((e=>setTimeout(e,1500)))}finally{Q(!1)}})),title:(null==q?void 0:q.copy)||"Copy","aria-label":(null==q?void 0:q.copy)||"Copy artifact content"},{children:t(C,{className:"h-[18px] w-[18px] shrink-0"})})),t(A,Object.assign({data:le,colors:ae,onDownload:ue,onSaveAsPDF:pe,onSaveAsDOCX:me,className:"opacity-70 transition-opacity duration-300 ease-in-out hover:opacity-100"},{children:t("div",Object.assign({role:"button",className:"cursor-pointer",style:{color:ae.secondaryText},title:(null==q?void 0:q.save)||"Download","aria-label":(null==q?void 0:q.save)||"Download artifact content"},{children:t(k,{className:"h-6 w-6 shrink-0"})}))}))]}))})),t("div",Object.assign({className:"flex flex-col flex-grow @container/pickaxe-artifact"},{children:o(F,Object.assign({ref:oe,innerClassName:"flex-grow w-full"},{children:["render"===G&&"application/vnd.pxe.code"!==le.type?t("div",Object.assign({ref:U,className:E("p-4 pb-6 flex-grow flex flex-col","application/vnd.pxe.react"===le.type&&"p-0","text/html"===le.type&&"p-0","text/csv"===le.type&&"p-0")},{children:"text/markdown"===le.type||"text/csv"===le.type||"text/tab-separated-values"===le.type||"image/svg+xml"===le.type?t(m,Object.assign({theme:re.theme,colors:ae},{children:t(u,{value:null!=ce?ce:le.content,className:E("px-6 @[767px]/pickaxe-artifact:px-11 mx-auto w-full",("text/csv"===le.type||"text/tab-separated-values"===le.type)&&"px-4 @[767px]/pickaxe-artifact:px-4 mx-0"),style:{flex:1}})})):"application/vnd.pxe.mermaid"===le.type?t(O,{ref:Y,id:`mermaid-${le.id}-${le.version}`,data:le.content}):"text/html"===le.type||"application/vnd.pxe.react"===le.type?t("iframe",Object.assign({ref:Z,title:le.title,src:`${B}/${"text/html"===le.type?"html":"react"}?theme=${se?"dark":"light"}&bg=${ae.secondary}&accent=${ae.accent}`,style:{width:"100%",flex:1,border:"none",backgroundColor:null==ae?void 0:ae.secondary},loading:"lazy",allow:"fullscreen; camera; microphone; gyroscope; accelerometer; geolocation; clipboard-write; autoplay",sandbox:"allow-scripts allow-same-origin allow-forms allow-downloads allow-popups-to-escape-sandbox allow-pointer-lock allow-popups allow-modals allow-orientation-lock allow-presentation",onLoad:e=>{const o=e.target;setTimeout((()=>{var e;try{null===(e=o.contentWindow)||void 0===e||e.postMessage({type:"text/html"===le.type?"HTML_CODE":"REACT_CODE",content:le.content},B)}catch(e){console.error("Error sending message to iframe:",e)}}),100),ne()}},{children:"Iframe is not supported, please view this artifact in a browser that supports it."})):null})):t(y,Object.assign({PreTag:"div",language:"text/markdown"===le.type?"markdown":"text/html"===le.type||"image/svg+xml"===le.type?"xml":"application/vnd.pxe.react"===le.type?"typescript":le.programmingLanguage,showLineNumbers:!0,customStyle:{margin:0,flex:1},style:Object.assign({'code[class*="language-"]':Object.assign(Object.assign({color:null==ae?void 0:ae.secondaryText},se&&{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-"]':Object.assign(Object.assign({color:null==ae?void 0:ae.secondaryText},se&&{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",borderRadius:"0.3em",minWidth:0,paddingLeft:"1em",paddingRight:"1em",paddingBottom:"2em",background:null==ae?void 0:ae.secondary}),':not(pre) > code[class*="language-"]':{background:null==ae?void 0:ae.secondary,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"},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:null==ae?void 0:ae.secondaryText,fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},!se&&{comment:{color:"#7D8B99"},prolog:{color:"#7D8B99"},doctype:{color:"#7D8B99"},cdata:{color:"#7D8B99"},punctuation:{color:"#4D4D4C"},property:{color:"#4078F2"},keyword:{color:"#8959A8"},tag:{color:"#8959A8"},"class-name":{color:"#D75F00"},boolean:{color:"#0086B3"},constant:{color:"#0086B3"},symbol:{color:"#990055"},deleted:{color:"#990000"},number:{color:"#005CC5"},selector:{color:"#63A35C"},"attr-name":{color:"#63A35C"},string:{color:"#50A14F"},char:{color:"#50A14F"},builtin:{color:"#50A14F"},inserted:{color:"#50A14F"},variable:{color:"#A626A4"},operator:{color:"#4D4D4C"},entity:{color:"#E45649",cursor:"help"},url:{color:"#4078F2"},".language-css .token.string":{color:"#50A14F"},".style .token.string":{color:"#50A14F"},atrule:{color:"#C18401"},"attr-value":{color:"#986801"},function:{color:"#005CC5"},regex:{color:"#D16969"},important:{color:null==ae?void 0:ae.secondaryText,fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}})},{children:le.content})),t(g,{})]}))})),"inline"===$.type&&!de&&o("div",Object.assign({className:"flex items-center gap-4 p-4 pt-6"},{children:[t(T,Object.assign({id:`artifact-copy-${le.id}-${le.version}`,tip:(null==q?void 0:q.copy)||"Copy",style:{padding:"0.25rem 0.5rem",backgroundColor:ae.secondary,color:ae.secondaryText,fontSize:"12px"},align:"bottom"},{children:t(j,{color:ae.secondaryText,text:le.content,className:"opacity-100",iconClassName:"w-5 h-5"})})),t(T,Object.assign({id:`artifact-save-${le.id}-${le.version}`,tip:(null==q?void 0:q.save)||"Save",style:{padding:"0.25rem 0.5rem",backgroundColor:ae.secondary,color:ae.secondaryText,fontSize:"12px"},align:"bottom"},{children:t(A,Object.assign({data:le,colors:ae,onDownload:ue,onSaveAsPDF:pe,onSaveAsDOCX:me},{children:t("button",Object.assign({style:{color:ae.secondaryText}},{children:t(k,{className:"w-5 h-5 shrink-0"})}))}))}))]}))]})):null};export{$ as default};
|
|
1
|
+
import{__awaiter as e}from"../../../../../_virtual/_tslib.js";import{jsxs as o,jsx as t}from"react/jsx-runtime";import{useState as n,useRef as i,useMemo as a,useEffect as r}from"react";import{useArtifactContext as l}from"../hooks/useArtifactContext.js";import{usePickaxeContext as c}from"../../../../../hooks/pickaxe/usePickaxeContext.js";import{useScroll as s}from"../../Scroll/hooks/useScroll.js";import{useArtifact as p}from"../hooks/useArtifact.js";import{useReactToPrint as d}from"react-to-print";import{PickaxeMarkdown as m}from"../../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as u}from"../../../common/PickaxeMarkdown/Renderer.js";import{Prism as y}from"react-syntax-highlighter";import{convertMarkdownToDocx as v,downloadDocx as f}from"../../../../../common/docx/index.js";import x from"file-saver";import g from"../../Scroll/ScrollLockView.js";import b from"../../../../Icons/expand.svg.js";import h from"../../../../Icons/shrink.svg.js";import w from"../../../../Icons/collapse-new.svg.js";import C from"../../../../Icons/copy-new.svg.js";import k from"../../../../Icons/download-new.svg.js";import j from"../../../common/PickaxeCopyButton.js";import F from"../../../../Core/ScrollArea.js";import T from"../../../../Core/TipContainer.js";import O from"../MermaidRenderer.js";import A from"./SaveMenu.js";import S from"./ViewOptions.js";import D from"csv-to-markdown-table";import N from"copy-to-clipboard";import E from"../../../../../common/cn.js";const B="development"===process.env.NODE_ENV?"http://localhost:3007":"https://user-content.pickaxe.co",$=$=>{var z,M,L,P;const{artifacts:R,currentPopupType:W,currentArtifact:H,setCurrentArtifact:I}=l(),{onLoadArtifact:_}=p(),{styles:V,colors:X,translations:q}=c(),[G,J]=n("code"),[K,Q]=n(!1),U=i(),Y=i(null),Z=i(null),ee=d({contentRef:U}),{scrollContainerRef:oe,scrollStartSession:te,scrollToBottom:ne,scrollEndSession:ie}=s({auto:"code"===G}),ae=null!==(M=null===(z=$.styling)||void 0===z?void 0:z.styles)&&void 0!==M?M:V,re=null!==(P=null===(L=$.styling)||void 0===L?void 0:L.colors)&&void 0!==P?P:X,le=a((()=>{var e,o,t,n,i;if(!$.artifact&&!H)return null;const a=null!==(o=null===(e=$.artifact)||void 0===e?void 0:e.id)&&void 0!==o?o:null==H?void 0:H.id,r=null!==(n=null===(t=$.artifact)||void 0===t?void 0:t.version)&&void 0!==n?n:null==H?void 0:H.version;return null!==(i=R.find((e=>e.id===a&&e.version===r)))&&void 0!==i?i:null}),[H,R,$.artifact]),ce=a((()=>le?"text/csv"===le.type?D(le.content,",",!0):"text/tab-separated-values"===le.type?D(le.content,"\t",!0):null:null),[le]),se=a((()=>(re.secondaryText||"").toLowerCase().startsWith("#ffffff")),[null==re?void 0:re.secondaryText]),pe=a((()=>{const e=$.artifact&&(null==H?void 0:H.id)===$.artifact.id&&(null==H?void 0:H.version)===$.artifact.version;return"inline"===$.type&&("inline-form"===W?!!H:e)}),[H,W,$.type,$.artifact]);r((()=>{e(void 0,void 0,void 0,(function*(){"inline"===$.type&&$.artifact&&(R.some((e=>$.artifact&&e.id===$.artifact.id&&e.version===$.artifact.version))||_({id:$.artifact.id,version:$.artifact.version}))}))}),[R,$.type,$.artifact]),r((()=>{if("application/vnd.pxe.code"===(null==le?void 0:le.type)&&J("code"),"finished"!==(null==le?void 0:le.status))return J("code"),te(),void ne();ie(),"application/vnd.pxe.code"!==le.type&&J("render")}),[null==le?void 0:le.status,null==le?void 0:le.type]),r((()=>{var e;!Z.current||"text/html"!==(null==le?void 0:le.type)&&"application/pdf"!==(null==le?void 0:le.type)&&"application/vnd.pxe.react"!==(null==le?void 0:le.type)||null===(e=Z.current.contentWindow)||void 0===e||e.postMessage({type:"application/vnd.pxe.react"!==le.type?"HTML_CODE":"REACT_CODE",content:le.content},B)}),[null==le?void 0:le.content,null==le?void 0:le.type]);const de=()=>e(void 0,void 0,void 0,(function*(){if(!le)return;if("text/html"===le.type||"application/pdf"===le.type){const e=le.content,o=window.open("","_blank");return void(o&&(o.document.open(),o.document.write(e),o.document.close(),o.focus(),o.print()))}const e=G;"code"===e&&(J("render"),yield new Promise((e=>setTimeout(e,50)))),ee(),"code"===e&&J(e)})),me=()=>e(void 0,void 0,void 0,(function*(){if(!le)return;const e=yield v(le.content);f(e,`${le.title}.docx`)})),ue=o=>e(void 0,void 0,void 0,(function*(){var e;if(!le)return;let t={mimeType:"text/plain",extension:".txt"};switch(o){case"text/markdown":t={mimeType:"text/markdown",extension:".md"};break;case"text/html":t={mimeType:"text/html",extension:".html"};break;case"text/csv":t={mimeType:"text/csv",extension:".csv"};break;case"text/tab-separated-values":t={mimeType:"text/tab-separated-values",extension:".tsv"};break;case"image/svg+xml":case"application/vnd.pxe.mermaid":t={mimeType:"image/svg+xml",extension:".svg"};break;case"application/pdf":t={mimeType:"application/pdf",extension:".pdf"};break;case"application/vnd.pxe.code":t={mimeType:`application/${le.programmingLanguage||"text"};charset=utf-8`,extension:`.${le.programmingLanguage||"txt"}`};break;case"application/vnd.pxe.react":t={mimeType:"text/typescript",extension:".tsx"};break;default:t={mimeType:"text/plain",extension:".txt"}}let n=null;if("application/vnd.pxe.mermaid"===le.type){const o=G;"code"===o&&(J("render"),yield new Promise((e=>setTimeout(e,50))));const t=null===(e=Y.current)||void 0===e?void 0:e.querySelector("svg");t&&(n=(new XMLSerializer).serializeToString(t)),"code"===o&&J(o)}const i=new Blob([null!=n?n:le.content],{type:t.mimeType});x(i,`${le.title}${t.extension}`)})),ye=()=>{"inline"!==$.type||!$.artifact||pe?I(null):I({id:$.artifact.id,version:$.artifact.version})},ve=pe||!W.startsWith("inline");return le?o("div",Object.assign({className:E("pxe-artifact-renderer flex flex-col","inline"===$.type&&!pe&&"min-h-[320px] mb-6",$.className),style:Object.assign(Object.assign({backgroundColor:re.secondary,color:re.secondaryText},"auto"!==W&&{borderRadius:ae.cornerRadius}),$.style)},{children:[o("div",Object.assign({className:"flex items-center gap-4 justify-between px-4 py-3 shadow-sm"},{children:[o("div",Object.assign({className:"pxe-artifact-create-header flex min-w-0 items-center gap-4"},{children:[ve&&t(S,{type:le.type,view:G,colors:re,onChange:J}),t("p",Object.assign({className:"w-[220px] max-w-full truncate text-[18px] font-semilight leading-tight",title:le.title},{children:le.title}))]})),"inline"===$.type&&!ve&&t("div",Object.assign({className:"shrink-0"},{children:t("button",Object.assign({type:"button",style:{color:re.secondaryText},onClick:ye,title:(null==q?void 0:q.expand)||"Expand","aria-label":(null==q?void 0:q.expand)||"Expand artifact"},{children:t(pe?h:b,{className:"w-6 h-6 shrink-0"})}))}))]})),ve&&t("div",Object.assign({className:"flex items-center justify-between border-y px-4 py-2.5",style:{borderColor:re.primary}},{children:o("div",Object.assign({className:"flex items-center gap-3"},{children:[t("button",Object.assign({type:"button",className:"opacity-70 transition-opacity duration-300 ease-in-out hover:opacity-100",style:{color:re.secondaryText},onClick:ye,title:"inline"===$.type?(null==q?void 0:q.collapse)||"Collapse":(null==q?void 0:q.close)||"Close","aria-label":"inline"===$.type?(null==q?void 0:q.collapse)||"Collapse artifact":(null==q?void 0:q.close)||"Close artifact"},{children:t(w,{className:"h-5 w-5 shrink-0"})})),t("button",Object.assign({type:"button",className:"opacity-70 transition-opacity duration-300 ease-in-out hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-50",style:{color:re.secondaryText},disabled:K,onClick:()=>e(void 0,void 0,void 0,(function*(){if(le)try{N(le.content),Q(!0),yield new Promise((e=>setTimeout(e,1500)))}finally{Q(!1)}})),title:(null==q?void 0:q.copy)||"Copy","aria-label":(null==q?void 0:q.copy)||"Copy artifact content"},{children:t(C,{className:"h-[18px] w-[18px] shrink-0"})})),t(A,Object.assign({data:le,colors:re,onDownload:ue,onSaveAsPDF:de,onSaveAsDOCX:me,className:"opacity-70 transition-opacity duration-300 ease-in-out hover:opacity-100"},{children:t("div",Object.assign({role:"button",className:"cursor-pointer",style:{color:re.secondaryText},title:(null==q?void 0:q.save)||"Download","aria-label":(null==q?void 0:q.save)||"Download artifact content"},{children:t(k,{className:"h-6 w-6 shrink-0"})}))}))]}))})),t("div",Object.assign({className:"flex flex-col flex-grow @container/pickaxe-artifact"},{children:o(F,Object.assign({ref:oe,innerClassName:"flex-grow w-full"},{children:["render"===G&&"application/vnd.pxe.code"!==le.type?t("div",Object.assign({ref:U,className:E("p-4 pb-6 flex-grow flex flex-col","text/html"===le.type&&"p-0","text/csv"===le.type&&"p-0","application/pdf"===le.type&&"p-0","application/vnd.pxe.react"===le.type&&"p-0")},{children:"text/markdown"===le.type||"text/csv"===le.type||"text/tab-separated-values"===le.type||"image/svg+xml"===le.type?t(m,Object.assign({theme:ae.theme,colors:re},{children:t(u,{value:null!=ce?ce:le.content,className:E("px-6 @[767px]/pickaxe-artifact:px-11 mx-auto w-full",("text/csv"===le.type||"text/tab-separated-values"===le.type)&&"px-4 @[767px]/pickaxe-artifact:px-4 mx-0"),style:{flex:1}})})):"application/vnd.pxe.mermaid"===le.type?t(O,{ref:Y,id:`mermaid-${le.id}-${le.version}`,data:le.content}):"text/html"===le.type||"application/pdf"===le.type||"application/vnd.pxe.react"===le.type?t("iframe",Object.assign({ref:Z,title:le.title,src:`${B}/${"application/vnd.pxe.react"!==le.type?"html":"react"}?theme=${se?"dark":"light"}&bg=${re.secondary}&accent=${re.accent}`,style:{width:"100%",flex:1,border:"none",backgroundColor:null==re?void 0:re.secondary},loading:"lazy",allow:"fullscreen; camera; microphone; gyroscope; accelerometer; geolocation; clipboard-write; autoplay",sandbox:"allow-scripts allow-same-origin allow-forms allow-downloads allow-popups-to-escape-sandbox allow-pointer-lock allow-popups allow-modals allow-orientation-lock allow-presentation",onLoad:e=>{const o=e.target;setTimeout((()=>{var e;try{null===(e=o.contentWindow)||void 0===e||e.postMessage({type:"application/vnd.pxe.react"!==le.type?"HTML_CODE":"REACT_CODE",content:le.content},B)}catch(e){console.error("Error sending message to iframe:",e)}}),100),ne()}},{children:"Iframe is not supported, please view this artifact in a browser that supports it."})):null})):t(y,Object.assign({PreTag:"div",language:"text/markdown"===le.type?"markdown":"text/html"===le.type||"image/svg+xml"===le.type?"xml":"application/vnd.pxe.react"===le.type?"typescript":le.programmingLanguage,showLineNumbers:!0,customStyle:{margin:0,flex:1},style:Object.assign({'code[class*="language-"]':Object.assign(Object.assign({color:null==re?void 0:re.secondaryText},se&&{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-"]':Object.assign(Object.assign({color:null==re?void 0:re.secondaryText},se&&{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",borderRadius:"0.3em",minWidth:0,paddingLeft:"1em",paddingRight:"1em",paddingBottom:"2em",background:null==re?void 0:re.secondary}),':not(pre) > code[class*="language-"]':{background:null==re?void 0:re.secondary,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"},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:null==re?void 0:re.secondaryText,fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},!se&&{comment:{color:"#7D8B99"},prolog:{color:"#7D8B99"},doctype:{color:"#7D8B99"},cdata:{color:"#7D8B99"},punctuation:{color:"#4D4D4C"},property:{color:"#4078F2"},keyword:{color:"#8959A8"},tag:{color:"#8959A8"},"class-name":{color:"#D75F00"},boolean:{color:"#0086B3"},constant:{color:"#0086B3"},symbol:{color:"#990055"},deleted:{color:"#990000"},number:{color:"#005CC5"},selector:{color:"#63A35C"},"attr-name":{color:"#63A35C"},string:{color:"#50A14F"},char:{color:"#50A14F"},builtin:{color:"#50A14F"},inserted:{color:"#50A14F"},variable:{color:"#A626A4"},operator:{color:"#4D4D4C"},entity:{color:"#E45649",cursor:"help"},url:{color:"#4078F2"},".language-css .token.string":{color:"#50A14F"},".style .token.string":{color:"#50A14F"},atrule:{color:"#C18401"},"attr-value":{color:"#986801"},function:{color:"#005CC5"},regex:{color:"#D16969"},important:{color:null==re?void 0:re.secondaryText,fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}})},{children:le.content})),t(g,{})]}))})),"inline"===$.type&&!pe&&o("div",Object.assign({className:"flex items-center gap-4 p-4 pt-6"},{children:[t(T,Object.assign({id:`artifact-copy-${le.id}-${le.version}`,tip:(null==q?void 0:q.copy)||"Copy",style:{padding:"0.25rem 0.5rem",backgroundColor:re.secondary,color:re.secondaryText,fontSize:"12px"},align:"bottom"},{children:t(j,{color:re.secondaryText,text:le.content,className:"opacity-100",iconClassName:"w-5 h-5"})})),t(T,Object.assign({id:`artifact-save-${le.id}-${le.version}`,tip:(null==q?void 0:q.save)||"Save",style:{padding:"0.25rem 0.5rem",backgroundColor:re.secondary,color:re.secondaryText,fontSize:"12px"},align:"bottom"},{children:t(A,Object.assign({data:le,colors:re,onDownload:ue,onSaveAsPDF:de,onSaveAsDOCX:me},{children:t("button",Object.assign({style:{color:re.secondaryText}},{children:t(k,{className:"w-5 h-5 shrink-0"})}))}))}))]}))]})):null};export{$ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e}from"../../../_virtual/_tslib.js";import{jsxs as t,jsx as o,Fragment as i}from"react/jsx-runtime";import{useState as r,useRef as n,useEffect as s,useCallback as a}from"react";import{usePickaxeContext as
|
|
1
|
+
import{__awaiter as e}from"../../../_virtual/_tslib.js";import{jsxs as t,jsx as o,Fragment as i}from"react/jsx-runtime";import{useState as r,useRef as n,useEffect as s,useCallback as a}from"react";import{usePickaxeContext as l}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useAuthContext as c}from"../Addons/Auth/hooks/useAuthContext.js";import{useDimensionContext as d}from"../../../hooks/pickaxe/useDimensionContext.js";import{useDocument as m}from"../Addons/Document/hooks/useDocument.js";import{useStyleFontSize as u}from"../../../hooks/studio/useStyleFontSize.js";import p from"./History/index.js";import f from"./Input.js";import h from"../../Icons/attach-vertical.svg.js";import v from"../../../common/cn.js";import g from"../../../common/api/pickaxe.js";import{v4 as x}from"uuid";import{StudioTip as b}from"../../Core/StudioTip.js";import{useResponseContext as k}from"../../../hooks/pickaxe/useResponseContext.js";import{NavPill as j,EditableNavPill as y,HistoryPill as w}from"../Addons/Navbar/NavPill.js";import I from"../../Icons/history.svg.js";const D=()=>{const{deploymentType:D,isNewChat:C,setIsNewChat:N,sessionId:A,setSessionId:F,setLastSessionId:S,pickaxeId:T,sender:O,pickaxe:P,styles:_,isEmbed:z,translations:E}=l(),{isSent:H}=c(),{width:R,height:G,setDimension:L}=d(),{setDocuments:B,onFileUpload:U}=m(),{isGenerating:q,messages:J}=k(),K=u(),[M,Q]=r(0),[V,W]=r(!1),[X,Y]=r(!1),Z=n(null),$=n(null),ee=n(0),[te,oe]=r(null),[ie,re]=r(!1),ne="chat-input"===D&&C&&!H;s((()=>()=>{B([])}),[]);const se=a((()=>{if(!T||!O)return;const t=(o=0)=>e(void 0,void 0,void 0,(function*(){var e;try{const t=yield g.post("/get_pickaxe_conversation",{sessionId:A,userId:O});if(t.data&&t.data.success){const e=t.data.title;if(e&&"Conversation Title"!==e)return void le(e)}else console.error("Failed to load conversation:",null===(e=t.data)||void 0===e?void 0:e.error)}catch(e){console.error("Error fetching conversation:",e)}o<20&&setTimeout((()=>t(o+1)),3e3)}));t()}),[T,O,A]);s((()=>{q||C||!A||se()}),[q,C,A,se]),s((()=>{if(!Z.current)return;const e=new ResizeObserver((e=>{for(const t of e){const{width:e,height:o}=t.contentRect;L(parseInt(e.toFixed(0)),parseInt(o.toFixed(0)))}}));return e.observe(Z.current),()=>{e.disconnect()}}),[Z.current]);const[ae,le]=r("New Chat"),ce=(null==P?void 0:P.formtitle)||"Pickaxe",de=(null==P?void 0:P.coverphoto)||void 0,[me,ue]=r(!1);s((()=>{const e=!ne&&!z&&_.portalTheme&&(J.filter((e=>"user"===e.role)).length>0||V||!C);ue(null!=e&&e)}),[J,V,C]);return t("div",Object.assign({ref:Z,className:"relative flex h-full w-full flex-col items-center overflow-hidden",onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),ee.current+=1,e.dataTransfer.items&&e.dataTransfer.items.length>0&&Y(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),ee.current-=1,0===ee.current&&Y(!1)},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDrop:t=>e(void 0,void 0,void 0,(function*(){t.preventDefault(),t.stopPropagation(),Y(!1),ee.current=0;const e=Array.from(t.dataTransfer.files||[]);e.length>0&&(N(!1),yield U(e))}))},{children:[X&&t("div",Object.assign({className:"absolute inset-0 z-50 flex flex-col items-center justify-center rounded-lg bg-white/80 backdrop-blur-sm transition-all duration-300"},{children:[o("div",Object.assign({className:"flex h-24 w-24 items-center justify-center rounded-full bg-white shadow-lg animate-bounce text-black"},{children:o(h,{className:"h-10 w-10"})})),o("h3",Object.assign({className:v(K.h3,"mt-6 font-semibold text-c-primary text-black")},{children:"Drop files to upload"})),o("p",Object.assign({className:v(K.b2,"mt-2 opacity-60 text-black")},{children:"Add anything to the conversation"}))]})),ne?o(f,{}):t(i,{children:[me&&t("div",Object.assign({className:v("direct-link"===D?"absolute top-4 left-4 md:top-6 md:left-6 z-40 flex items-center gap-2 animate-in fade-in slide-in-from-top-4 duration-500":"w-full max-w-3xl mt-6 px-4 md:px-0 flex justify-start z-30 mb-4 animate-in fade-in slide-in-from-top-4 duration-500 gap-2","dark"===_.portalTheme?"glass-dark ":"")},{children:[o(j,{text:ce,icon:de}),C||"New Chat"===ae?o(j,{text:ae}):o(y,{text:ae,sessionId:A,onRename:t=>e(void 0,void 0,void 0,(function*(){if(A)try{yield g.post("/edit_conversation_name",{sessionId:A,name:t,userId:O}),le(t)}catch(e){console.error("Error renaming chat:",e),alert("Failed to rename chat.")}})),onDelete:()=>e(void 0,void 0,void 0,(function*(){if(A&&window.confirm("Are you sure you want to delete this conversation?"))try{yield g.post("/delete_pickaxe_conversation",{sessionId:A,userId:O}),N(!0),F(x()),le("New Chat")}catch(e){console.error("Error deleting chat:",e),alert("Failed to delete chat.")}})),isDarkGlass:"dark"===_.portalTheme}),o(b,Object.assign({content:E["chat-history"]||"Chat History",align:"bottom",containerClassName:"inline-flex shrink-0"},{children:o(w,{icon:o(I,{}),onClick:()=>{F(""),S(A)}})}))]})),o(p,{additionalScrollHeight:M,isForceHideInfo:G<=545||R<=350||V,isInputFocused:V,onSubmit:t=>e(void 0,void 0,void 0,(function*(){$.current&&$.current.onSubmit(t)})),smitheryAuthData:te,resubmitPrompt:()=>{oe(null),re(!0)}}),o(f,{ref:$,onFocus:()=>W(!0),onBlur:()=>W(!1),onInputHeightChange:Q,initSmitheryAuthData:e=>oe(e),resubmitPrompt:ie})]})]}))};export{D as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useMemo as r,useEffect as i}from"react";import{usePickaxeMarkdownContext as a}from"../../hooks/usePickaxeMarkdownContext.js";import{useArtifactContext as n}from"../../../../Addons/Artifact/hooks/useArtifactContext.js";import{motion as s}from"framer-motion";import o from"../../../../../Icons/spinner-lines.svg.js";import c from"../../../../Addons/Artifact/Renderer/index.js";const d=({node:i})=>{const{theme:d,colors:l,styles:p,onArtifactClick:m}=a(),{artifacts:f,currentPopupType:u,currentArtifact:x}=n(),v=r((()=>{const{dataId:e,dataCommand:t,dataTitle:r,dataType:a,dataVersion:n}=(null==i?void 0:i.properties)||{};return e?{id:e,command:t||"create",title:r||"Untitled Artifact",type:a||"text/markdown",version:n?parseInt(n,10):1}:null}),[]),h=r((()=>{var e,t;if(!v)return null;const{command:r,type:i,version:a}=v;let n=`${null!==(e={create:"Created",update:"Updated",rewrite:"Rewrote"}[r])&&void 0!==e?e:"Created"} ${null!==(t={"text/markdown":"Markdown","text/html":"HTML","text/csv":"CSV","text/tab-separated-values":"TSV","image/svg+xml":"SVG","application/vnd.pxe.code":"Code","application/vnd.pxe.mermaid":"Diagram","application/vnd.pxe.react":"React Component"}[i])&&void 0!==t?t:"Artifact"}`;return a>1&&(n+=` (v${a})`),n}),[v]),C=r((()=>{if(!v)return"finished";const e=f.find((e=>e.id===v.id&&e.version===v.version));return e?e.status:"finished"}),[f,v]);return v?u.startsWith("inline")&&"finished"===C?x?null:e(c,{type:"inline",className:"pxe-artifact-inline",styling:{colors:l,styles:p},artifact:{id:v.id,version:v.version}}):t(s.div,Object.assign({className:"pxe-artifact-create-container p-4 flex items-center gap-8 flex-wrap justify-between mb-4 select-none",style:Object.assign({borderColor:"dark"===d?"#444444":"#CCCCCC",backgroundColor:l.secondary+"80",color:l.secondaryText,borderRadius:p.cornerRadius},!!m&&{cursor:"pointer"}),initial:{opacity:0,x:10,scale:.95},animate:{opacity:1,x:0,scale:1},transition:{duration:.5,ease:"easeOut",staggerChildren:.1},whileHover:{borderColor:"dark"===d?"#666666":"#AAAAAA",backgroundColor:l.secondary}},m&&{onClick:()=>m({id:v.id,version:v.version})},{children:[t("div",Object.assign({className:"pxe-artifact-create-header flex flex-col gap-2 text-[10pt]"},{children:[e("p",Object.assign({className:"font-semibold"},{children:v.title})),e("p",Object.assign({className:"opacity-90"},{children:h}))]})),"finished"!==C&&e("div",{children:e(o,{className:"pxe-spin w-5 h-5 shrink-0"})})]})):null},l=({node:t,children:r})=>{const{setArtifacts:a}=n();return i((()=>{if(!t||!t.properties)return;const e=t.properties.dataId;e&&a((t=>t.map((t=>t.id===e?Object.assign(Object.assign({},t),{status:"error"}):t))))}),[]),e("div",Object.assign({className:"pxe-red pxe-artifact-error"},{children:r}))};export{d as Artifact,l as ArtifactError};
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useMemo as r,useEffect as i}from"react";import{usePickaxeMarkdownContext as a}from"../../hooks/usePickaxeMarkdownContext.js";import{useArtifactContext as n}from"../../../../Addons/Artifact/hooks/useArtifactContext.js";import{motion as s}from"framer-motion";import o from"../../../../../Icons/spinner-lines.svg.js";import c from"../../../../Addons/Artifact/Renderer/index.js";const d=({node:i})=>{const{theme:d,colors:l,styles:p,onArtifactClick:m}=a(),{artifacts:f,currentPopupType:u,currentArtifact:x}=n(),v=r((()=>{const{dataId:e,dataCommand:t,dataTitle:r,dataType:a,dataVersion:n}=(null==i?void 0:i.properties)||{};return e?{id:e,command:t||"create",title:r||"Untitled Artifact",type:a||"text/markdown",version:n?parseInt(n,10):1}:null}),[]),h=r((()=>{var e,t;if(!v)return null;const{command:r,type:i,version:a}=v;let n=`${null!==(e={create:"Created",update:"Updated",rewrite:"Rewrote"}[r])&&void 0!==e?e:"Created"} ${null!==(t={"text/markdown":"Markdown","text/html":"HTML","text/csv":"CSV","text/tab-separated-values":"TSV","image/svg+xml":"SVG","application/pdf":"PDF","application/vnd.pxe.code":"Code","application/vnd.pxe.mermaid":"Diagram","application/vnd.pxe.react":"React Component"}[i])&&void 0!==t?t:"Artifact"}`;return a>1&&(n+=` (v${a})`),n}),[v]),C=r((()=>{if(!v)return"finished";const e=f.find((e=>e.id===v.id&&e.version===v.version));return e?e.status:"finished"}),[f,v]);return v?u.startsWith("inline")&&"finished"===C?x?null:e(c,{type:"inline",className:"pxe-artifact-inline",styling:{colors:l,styles:p},artifact:{id:v.id,version:v.version}}):t(s.div,Object.assign({className:"pxe-artifact-create-container p-4 flex items-center gap-8 flex-wrap justify-between mb-4 select-none",style:Object.assign({borderColor:"dark"===d?"#444444":"#CCCCCC",backgroundColor:l.secondary+"80",color:l.secondaryText,borderRadius:p.cornerRadius},!!m&&{cursor:"pointer"}),initial:{opacity:0,x:10,scale:.95},animate:{opacity:1,x:0,scale:1},transition:{duration:.5,ease:"easeOut",staggerChildren:.1},whileHover:{borderColor:"dark"===d?"#666666":"#AAAAAA",backgroundColor:l.secondary}},m&&{onClick:()=>m({id:v.id,version:v.version})},{children:[t("div",Object.assign({className:"pxe-artifact-create-header flex flex-col gap-2 text-[10pt]"},{children:[e("p",Object.assign({className:"font-semibold"},{children:v.title})),e("p",Object.assign({className:"opacity-90"},{children:h}))]})),"finished"!==C&&e("div",{children:e(o,{className:"pxe-spin w-5 h-5 shrink-0"})})]})):null},l=({node:t,children:r})=>{const{setArtifacts:a}=n();return i((()=>{if(!t||!t.properties)return;const e=t.properties.dataId;e&&a((t=>t.map((t=>t.id===e?Object.assign(Object.assign({},t),{status:"error"}):t))))}),[]),e("div",Object.assign({className:"pxe-red pxe-artifact-error"},{children:r}))};export{d as Artifact,l as ArtifactError};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
interface StudioTipProps {
|
|
3
|
+
containerClassName?: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
content: string;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
strategy?: "absolute" | "fixed";
|
|
8
|
+
align?: "top" | "bottom" | "left" | "right";
|
|
9
|
+
}
|
|
10
|
+
export declare const StudioTip: ({ containerClassName, className, content, children, strategy, align, }: StudioTipProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default StudioTip;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ArtifactType = "text/markdown" | "text/html" | "text/csv" | "text/tab-separated-values" | "image/svg+xml" | "application/vnd.pxe.code" | "application/vnd.pxe.mermaid" | "application/vnd.pxe.react";
|
|
1
|
+
export type ArtifactType = "text/markdown" | "text/html" | "text/csv" | "text/tab-separated-values" | "image/svg+xml" | "application/pdf" | "application/vnd.pxe.code" | "application/vnd.pxe.mermaid" | "application/vnd.pxe.react";
|
|
2
2
|
export type ArtifactCommand = "create" | "update" | "rewrite";
|
|
3
3
|
export type ArtifactStatus = "finished" | "streaming" | "updating" | "error";
|
|
4
4
|
export type ArtifactViewOption = "render" | "code";
|
package/package.json
CHANGED
|
@@ -1,214 +1,212 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
}
|
|
2
|
+
"name": "@pickaxeproject/react",
|
|
3
|
+
"version": "6.3.1",
|
|
4
|
+
"description": "Client utility library for Pickaxe",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/pickaxeproject/v2-pickaxe-react.git"
|
|
8
|
+
},
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/esm/index.js",
|
|
13
|
+
"require": "./dist/cjs/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./embed": {
|
|
16
|
+
"import": "./dist/esm/embed/index.js",
|
|
17
|
+
"require": "./dist/cjs/embed/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./prose.css": "./dist/esm/prose.css"
|
|
20
|
+
},
|
|
21
|
+
"main": "dist/cjs/index.js",
|
|
22
|
+
"module": "dist/esm/index.js",
|
|
23
|
+
"types": "dist/esm/src/index.d.ts",
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"browserslist": [
|
|
28
|
+
"> 1%",
|
|
29
|
+
"not dead",
|
|
30
|
+
"not edge <= 18",
|
|
31
|
+
"not ie 11",
|
|
32
|
+
"not op_mini all"
|
|
33
|
+
],
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@babel/runtime": "^7.20.7",
|
|
36
|
+
"@modelcontextprotocol/sdk": "1.20.2",
|
|
37
|
+
"@radix-ui/react-avatar": "^1.1.11",
|
|
38
|
+
"franc-min": "^6.2.0",
|
|
39
|
+
"jose": "^6.1.3",
|
|
40
|
+
"lucide-react": "^0.563.0",
|
|
41
|
+
"pkce-challenge": "3.0.0",
|
|
42
|
+
"react-speech-recognition": "^4.0.1",
|
|
43
|
+
"regenerator-runtime": "^0.14.1",
|
|
44
|
+
"remove-markdown": "^0.6.3",
|
|
45
|
+
"tldts": "^7.0.23"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@babel/core": "^7.20.12",
|
|
49
|
+
"@babel/plugin-transform-runtime": "^7.19.6",
|
|
50
|
+
"@babel/preset-env": "^7.20.2",
|
|
51
|
+
"@babel/preset-react": "^7.18.6",
|
|
52
|
+
"@babel/preset-typescript": "^7.26.0",
|
|
53
|
+
"@changesets/cli": "^2.26.0",
|
|
54
|
+
"@chromatic-com/storybook": "3.2.3",
|
|
55
|
+
"@mdx-js/react": "^3.1.0",
|
|
56
|
+
"@nem035/gpt-3-encoder": "^1.1.7",
|
|
57
|
+
"@prettier/plugin-xml": "^3.4.1",
|
|
58
|
+
"@rollup/plugin-alias": "^5.1.1",
|
|
59
|
+
"@rollup/plugin-babel": "^6.0.3",
|
|
60
|
+
"@rollup/plugin-commonjs": "^24.0.0",
|
|
61
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
62
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
63
|
+
"@rollup/plugin-replace": "^6.0.2",
|
|
64
|
+
"@rollup/plugin-terser": "^0.3.0",
|
|
65
|
+
"@storybook/addon-a11y": "^8.5.3",
|
|
66
|
+
"@storybook/addon-docs": "^8.5.3",
|
|
67
|
+
"@storybook/addon-essentials": "^8.5.3",
|
|
68
|
+
"@storybook/addon-interactions": "^8.5.3",
|
|
69
|
+
"@storybook/addon-links": "^8.5.3",
|
|
70
|
+
"@storybook/addon-themes": "^8.5.3",
|
|
71
|
+
"@storybook/blocks": "^8.5.3",
|
|
72
|
+
"@storybook/react": "^8.5.3",
|
|
73
|
+
"@storybook/react-vite": "^8.5.3",
|
|
74
|
+
"@storybook/test": "^8.5.3",
|
|
75
|
+
"@stripe/react-stripe-js": "^4.0.2",
|
|
76
|
+
"@stripe/stripe-js": "^7.9.0",
|
|
77
|
+
"@svgr/rollup": "^8.1.0",
|
|
78
|
+
"@tailwindcss/container-queries": "^0.1.1",
|
|
79
|
+
"@tanstack/react-query": "^4.36.1",
|
|
80
|
+
"@types/hast": "^3.0.4",
|
|
81
|
+
"@types/katex": "^0.16.7",
|
|
82
|
+
"@types/node": "^18.11.18",
|
|
83
|
+
"@types/react": "^18.0.26",
|
|
84
|
+
"@types/react-dom": "^18.0.10",
|
|
85
|
+
"@types/react-speech-recognition": "^3.9.6",
|
|
86
|
+
"@types/react-syntax-highlighter": "^15.5.13",
|
|
87
|
+
"@types/uuid": "^10.0.0",
|
|
88
|
+
"@types/webfontloader": "^1.6.38",
|
|
89
|
+
"@typescript-eslint/eslint-plugin": "^5.48.1",
|
|
90
|
+
"@typescript-eslint/parser": "^5.48.1",
|
|
91
|
+
"@zerollup/ts-transform-paths": "^1.7.18",
|
|
92
|
+
"autoprefixer": "^10.4.20",
|
|
93
|
+
"axios": "^1.7.9",
|
|
94
|
+
"babel-loader": "^9.1.2",
|
|
95
|
+
"clsx": "^2.1.1",
|
|
96
|
+
"copy-to-clipboard": "^3.3.3",
|
|
97
|
+
"cross-env": "^7.0.3",
|
|
98
|
+
"csv-to-markdown-table": "^1.5.0",
|
|
99
|
+
"date-fns": "^3.6.0",
|
|
100
|
+
"docx": "^9.5.1",
|
|
101
|
+
"eslint": "8.31.0",
|
|
102
|
+
"eslint-config-prettier": "^8.6.0",
|
|
103
|
+
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
104
|
+
"eslint-plugin-prettier": "^5.4.0",
|
|
105
|
+
"eslint-plugin-react": "^7.32.0",
|
|
106
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
107
|
+
"eslint-plugin-storybook": "^0.11.2",
|
|
108
|
+
"eventsource-parser": "^3.0.2",
|
|
109
|
+
"file-saver": "^2.0.5",
|
|
110
|
+
"framer-motion": "^11.17.0",
|
|
111
|
+
"husky": "^8.0.3",
|
|
112
|
+
"isomorphic-dompurify": "^2.20.0",
|
|
113
|
+
"katex": "^0.16.19",
|
|
114
|
+
"lottie-react": "^2.4.0",
|
|
115
|
+
"mermaid": "^11.7.0",
|
|
116
|
+
"microsoft-cognitiveservices-speech-sdk": "^1.48.0",
|
|
117
|
+
"postcss": "^8.4.49",
|
|
118
|
+
"prettier": "^3.5.3",
|
|
119
|
+
"prismjs": "^1.29.0",
|
|
120
|
+
"react": "^18.2.0",
|
|
121
|
+
"react-dom": "^18.2.0",
|
|
122
|
+
"react-intersection-observer": "^9.14.1",
|
|
123
|
+
"react-markdown": "^9.0.3",
|
|
124
|
+
"react-resizable-panels": "^3.0.3",
|
|
125
|
+
"react-syntax-highlighter": "^15.6.1",
|
|
126
|
+
"react-textarea-autosize": "^8.5.9",
|
|
127
|
+
"react-to-print": "^3.1.1",
|
|
128
|
+
"react-tooltip": "^5.28.0",
|
|
129
|
+
"react-virtualized-auto-sizer": "^1.0.25",
|
|
130
|
+
"rehype-katex": "^7.0.1",
|
|
131
|
+
"rehype-raw": "^7.0.0",
|
|
132
|
+
"remark-gfm": "^4.0.0",
|
|
133
|
+
"remark-math": "^6.0.0",
|
|
134
|
+
"rollup": "^2.79.1",
|
|
135
|
+
"rollup-plugin-delete": "^2.0.0",
|
|
136
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
137
|
+
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
138
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
139
|
+
"rollup-plugin-typescript2": "^0.34.1",
|
|
140
|
+
"storybook": "^8.5.3",
|
|
141
|
+
"tailwind-merge": "^2.6.0",
|
|
142
|
+
"tailwind-scrollbar": "^3.1.0",
|
|
143
|
+
"tailwindcss": "^3.4.17",
|
|
144
|
+
"tslib": "^2.4.1",
|
|
145
|
+
"ttypescript": "^1.5.15",
|
|
146
|
+
"typescript": "^4.9.4",
|
|
147
|
+
"typescript-transform-paths": "^3.4.6",
|
|
148
|
+
"unist-util-visit": "^5.0.0",
|
|
149
|
+
"uuid": "^11.1.0",
|
|
150
|
+
"vite": "^6.0.7",
|
|
151
|
+
"vite-plugin-node-polyfills": "^0.24.0",
|
|
152
|
+
"vite-plugin-svgr": "^4.3.0",
|
|
153
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
154
|
+
"web-speech-cognitive-services": "^8.1.4",
|
|
155
|
+
"webfontloader": "^1.6.28",
|
|
156
|
+
"webpack": "^5.75.0",
|
|
157
|
+
"webpack-cli": "^5.0.1"
|
|
158
|
+
},
|
|
159
|
+
"peerDependencies": {
|
|
160
|
+
"@nem035/gpt-3-encoder": "^1.1.7",
|
|
161
|
+
"@tailwindcss/container-queries": "^0.1.1",
|
|
162
|
+
"@tanstack/react-query": "^4.36.1",
|
|
163
|
+
"axios": "^1.7.9",
|
|
164
|
+
"clsx": "^2.1.1",
|
|
165
|
+
"copy-to-clipboard": "^3.3.3",
|
|
166
|
+
"csv-to-markdown-table": "^1.5.0",
|
|
167
|
+
"date-fns": "^3.6.0",
|
|
168
|
+
"docx": "^9.5.1",
|
|
169
|
+
"eventsource-parser": "^3.0.2",
|
|
170
|
+
"file-saver": "^2.0.5",
|
|
171
|
+
"framer-motion": "^11.17.0",
|
|
172
|
+
"isomorphic-dompurify": "^2.20.0",
|
|
173
|
+
"katex": "^0.16.19",
|
|
174
|
+
"lottie-react": "^2.4.0",
|
|
175
|
+
"microsoft-cognitiveservices-speech-sdk": "^1.48.0",
|
|
176
|
+
"prismjs": "^1.29.0",
|
|
177
|
+
"react": "^16.8.0 || ^17 || ^18",
|
|
178
|
+
"react-dom": "^16.8.0 || ^17 || ^18",
|
|
179
|
+
"react-intersection-observer": "^9.14.1",
|
|
180
|
+
"react-markdown": "^9.0.3",
|
|
181
|
+
"react-syntax-highlighter": "^15.6.1",
|
|
182
|
+
"react-textarea-autosize": "^8.5.9",
|
|
183
|
+
"react-to-print": "^3.1.1",
|
|
184
|
+
"react-tooltip": "^5.28.0",
|
|
185
|
+
"react-virtualized-auto-sizer": "^1.0.25",
|
|
186
|
+
"rehype-katex": "^7.0.1",
|
|
187
|
+
"rehype-raw": "^7.0.0",
|
|
188
|
+
"remark-gfm": "^4.0.0",
|
|
189
|
+
"remark-math": "^6.0.0",
|
|
190
|
+
"tailwind-merge": "^2.6.0",
|
|
191
|
+
"tailwind-scrollbar": "^3.1.0",
|
|
192
|
+
"unist-util-visit": "^5.0.0",
|
|
193
|
+
"uuid": "^11.1.0",
|
|
194
|
+
"web-speech-cognitive-services": "^8.1.4",
|
|
195
|
+
"webfontloader": "^1.6.28"
|
|
196
|
+
},
|
|
197
|
+
"engines": {
|
|
198
|
+
"node": ">=18"
|
|
199
|
+
},
|
|
200
|
+
"scripts": {
|
|
201
|
+
"build": "cross-env NODE_ENV=production rollup -c",
|
|
202
|
+
"lint": "eslint . --ext .ts,.tsx,.js,.jsx",
|
|
203
|
+
"lint:format": "prettier --check src/**/*",
|
|
204
|
+
"lint:staged": "pnpm run lint && pnpm run lint:format",
|
|
205
|
+
"format": "prettier --write .",
|
|
206
|
+
"changeset": "changeset",
|
|
207
|
+
"release": "changeset publish",
|
|
208
|
+
"dev": "storybook dev -p 6006",
|
|
209
|
+
"storybook": "storybook dev -p 6006",
|
|
210
|
+
"build-storybook": "storybook build"
|
|
211
|
+
}
|
|
212
|
+
}
|