@pickaxeproject/react 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),r=require("react"),s=require("copy-to-clipboard"),o=require("../../Icons/copied-new.svg.js"),a=require("../../Icons/copy-new.svg.js"),i=require("./PickaxeSimpleButton.js"),c=require("../../../common/cn.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=l(s);exports.default=({color:s,text:l="",className:u,iconClassName:f})=>{const[d,m]=r.useState(l),[p,h]=r.useState(!1),[j,y]=r.useState(!1);r.useEffect((()=>{m(l)}),[l]);return t.jsx(i.default,Object.assign({color:s},u&&{className:u},{isForceColor:j,onClick:()=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;try{if(p)return;h(!0);const t=null!==(e=[...Array.from(l.matchAll(/https:\/\/streaming\.pickaxeproject\.com\/api\/function_call_results\?.*?&name=[^&]+/g)),...Array.from(l.matchAll(/https:\/\/utils\.pickaxe\.co\/api\/fn\/result\?.*?&name=[^&]+/g))].map((e=>e[0])))&&void 0!==e?e:[],r=[];if(t.length){for(const e of t)try{const t=yield fetch(e),s=yield t.json(),o=s.text||s.url||"";r.push(o)}catch(e){console.error(e)}r.length&&m(r.join("\n"))}n.default(r.length>0?r.join("\n"):d),h(!1),y(!0),yield new Promise((e=>setTimeout(e,1500)))}catch(e){console.error(e)}finally{h(!1),y(!1)}}))},{children:p||j?t.jsx(o.default,{className:c.default("w-4 h-4 shrink-0",f)}):t.jsx(a.default,{className:c.default("w-4 h-4 shrink-0",f)})}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),i=require("react"),r=require("copy-to-clipboard"),a=require("../../Icons/copied-new.svg.js"),o=require("../../Icons/copy-new.svg.js"),n=require("./PickaxeSimpleButton.js"),c=require("../../../common/cn.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=s(r);exports.default=({color:r,text:s="",className:u,iconClassName:d})=>{const[f,p]=i.useState(s),[m,h]=i.useState(!1),[j,x]=i.useState(!1);i.useEffect((()=>{p(s)}),[s]);return t.jsx(n.default,Object.assign({color:r},u&&{className:u},{isForceColor:j,onClick:()=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;try{if(m)return;h(!0);const t=null!==(e=[...Array.from(s.matchAll(/https:\/\/streaming\.pickaxeproject\.com\/api\/function_call_results\?.*?&name=[^&]+/g)),...Array.from(s.matchAll(/https:\/\/utils\.pickaxe\.co\/api\/fn\/result\?.*?&name=[^&]+/g))].map((e=>e[0])))&&void 0!==e?e:[],i=[];if(t.length){for(const e of t)try{const t=yield fetch(e),r=yield t.json(),a=r.text||r.url||"";i.push(a)}catch(e){console.error(e)}i.length&&p(i.join("\n"))}let r=i.length>0?i.join("\n"):f;(r.includes("<action-caption")||r.includes("<action-finished"))&&(r=r.replace(/<action-caption data-index="[^"]">(.*?)<\/action-caption>/g,"$1"),r=r.replace(/<action-finished data-index="[^"]">.*?<\/action-finished>/g,"")),l.default(r),h(!1),x(!0),yield new Promise((e=>setTimeout(e,1500)))}catch(e){console.error(e)}finally{h(!1),x(!1)}}))},{children:m||j?t.jsx(a.default,{className:c.default("w-4 h-4 shrink-0",d)}):t.jsx(o.default,{className:c.default("w-4 h-4 shrink-0",d)})}))};
@@ -1 +1 @@
1
- import{__awaiter as o}from"../../../_virtual/_tslib.js";import{jsx as r}from"react/jsx-runtime";import{useState as t,useEffect as e}from"react";import c from"copy-to-clipboard";import i from"../../Icons/copied-new.svg.js";import s from"../../Icons/copy-new.svg.js";import n from"./PickaxeSimpleButton.js";import l from"../../../common/cn.js";const m=({color:m,text:a="",className:p,iconClassName:f})=>{const[u,h]=t(a),[d,j]=t(!1),[y,g]=t(!1);e((()=>{h(a)}),[a]);return r(n,Object.assign({color:m},p&&{className:p},{isForceColor:y,onClick:()=>o(void 0,void 0,void 0,(function*(){var o;try{if(d)return;j(!0);const r=null!==(o=[...Array.from(a.matchAll(/https:\/\/streaming\.pickaxeproject\.com\/api\/function_call_results\?.*?&name=[^&]+/g)),...Array.from(a.matchAll(/https:\/\/utils\.pickaxe\.co\/api\/fn\/result\?.*?&name=[^&]+/g))].map((o=>o[0])))&&void 0!==o?o:[],t=[];if(r.length){for(const o of r)try{const r=yield fetch(o),e=yield r.json(),c=e.text||e.url||"";t.push(c)}catch(o){console.error(o)}t.length&&h(t.join("\n"))}c(t.length>0?t.join("\n"):u),j(!1),g(!0),yield new Promise((o=>setTimeout(o,1500)))}catch(o){console.error(o)}finally{j(!1),g(!1)}}))},{children:r(d||y?i:s,{className:l("w-4 h-4 shrink-0",f)})}))};export{m as default};
1
+ import{__awaiter as o}from"../../../_virtual/_tslib.js";import{jsx as t}from"react/jsx-runtime";import{useState as i,useEffect as n}from"react";import c from"copy-to-clipboard";import e from"../../Icons/copied-new.svg.js";import r from"../../Icons/copy-new.svg.js";import a from"./PickaxeSimpleButton.js";import s from"../../../common/cn.js";const l=({color:l,text:m="",className:p,iconClassName:f})=>{const[d,h]=i(m),[u,g]=i(!1),[j,y]=i(!1);n((()=>{h(m)}),[m]);return t(a,Object.assign({color:l},p&&{className:p},{isForceColor:j,onClick:()=>o(void 0,void 0,void 0,(function*(){var o;try{if(u)return;g(!0);const t=null!==(o=[...Array.from(m.matchAll(/https:\/\/streaming\.pickaxeproject\.com\/api\/function_call_results\?.*?&name=[^&]+/g)),...Array.from(m.matchAll(/https:\/\/utils\.pickaxe\.co\/api\/fn\/result\?.*?&name=[^&]+/g))].map((o=>o[0])))&&void 0!==o?o:[],i=[];if(t.length){for(const o of t)try{const t=yield fetch(o),n=yield t.json(),c=n.text||n.url||"";i.push(c)}catch(o){console.error(o)}i.length&&h(i.join("\n"))}let n=i.length>0?i.join("\n"):d;(n.includes("<action-caption")||n.includes("<action-finished"))&&(n=n.replace(/<action-caption data-index="[^"]">(.*?)<\/action-caption>/g,"$1"),n=n.replace(/<action-finished data-index="[^"]">.*?<\/action-finished>/g,"")),c(n),g(!1),y(!0),yield new Promise((o=>setTimeout(o,1500)))}catch(o){console.error(o)}finally{g(!1),y(!1)}}))},{children:t(u||j?e:r,{className:s("w-4 h-4 shrink-0",f)})}))};export{l as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pickaxeproject/react",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "Client utility library for Pickaxe",
5
5
  "repository": {
6
6
  "type": "git",