@kickd0wn/react-dev-companion 0.1.1 → 0.2.0
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/index.cjs +30 -2
- package/dist/index.js +740 -237
- package/dist/src/components/DevCompanion.d.ts +4 -1
- package/dist/src/components/NetworkTab.d.ts +7 -0
- package/dist/src/components/StorageTab.d.ts +1 -0
- package/dist/src/components/styles.d.ts +19 -0
- package/dist/src/core/fetchInterceptor.d.ts +5 -0
- package/dist/src/hooks/useKeyboardShortcut.d.ts +5 -0
- package/dist/src/types/storage.d.ts +10 -0
- package/dist/src/utils/storage.d.ts +5 -0
- package/package.json +6 -5
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react")):typeof define==`function`&&define.amd?define([`exports`,`react`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ReactDevCompanion={},e.React))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e};t=((e,t,i)=>(i=e==null?{}:n(o(e)),l(r(i,`default`,{value:e,enumerable:!0}),e)))(t,1);var u=e=>{let t=window.fetch;window.fetch=async(...n)=>{let
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react")):typeof define==`function`&&define.amd?define([`exports`,`react`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ReactDevCompanion={},e.React))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e};t=((e,t,i)=>(i=e==null?{}:n(o(e)),l(r(i,`default`,{value:e,enumerable:!0}),e)))(t,1);var u=!1,d={isOffline:!1,delayMs:0},f=e=>{if(u||typeof window>`u`)return;u=!0;let t=window.fetch;window.fetch=async(...n)=>{let r=performance.now(),i=Math.random().toString(36).substring(2,9),a=``,o=`GET`;if(typeof n[0]==`string`?a=n[0]:n[0]instanceof URL?a=n[0].toString():n[0]instanceof Request&&(a=n[0].url,o=n[0].method||`GET`),n[1]&&n[1].method&&(o=n[1].method.toUpperCase()),d.delayMs>0&&await new Promise(e=>setTimeout(e,d.delayMs)),d.isOffline){let t=performance.now();throw e({id:i,url:a,method:o,status:0,duration:Math.round(t-r),timestamp:new Date().toLocaleTimeString()}),TypeError(`Failed to fetch (Simulated Offline Mode)`)}try{let s=await t(...n),c=performance.now();return e({id:i,url:a,method:o,status:s.status,duration:Math.round(c-r),timestamp:new Date().toLocaleTimeString()}),s}catch(t){let n=performance.now();throw e({id:i,url:a,method:o,status:0,duration:Math.round(n-r),timestamp:new Date().toLocaleTimeString()}),t}}},p=()=>typeof document>`u`||!document.cookie?[]:document.cookie.split(`; `).map(e=>{let[t,...n]=e.split(`=`);return{key:t,value:decodeURIComponent(n.join(`=`))}}),m=(e,t,n=7)=>{if(typeof document>`u`)return;let r=new Date(Date.now()+n*864e5).toUTCString();document.cookie=`${encodeURIComponent(e)}=${encodeURIComponent(t)}; expires=${r}; path=/`},h=e=>{typeof document<`u`&&(document.cookie=`${encodeURIComponent(e)}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`)},g=e=>{let t={};e===`localStorage`?t={...localStorage}:e===`sessionStorage`?t={...sessionStorage}:e===`cookie`&&p().forEach(e=>{t[e.key]=e.value});let n={type:e,timestamp:new Date().toISOString(),data:t},r=new Blob([JSON.stringify(n,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`dev-companion-${e}-${Date.now()}.json`,a.click(),URL.revokeObjectURL(i)},_={bg:`#0f172a`,cardBg:`#1e293b`,hoverBg:`#334155`,border:`#334155`,borderSubtle:`#1e293b`,textPrimary:`#f8fafc`,textSecondary:`#94a3b8`,accent:`#0284c7`,accentHover:`#0369a1`,success:`#4ade80`,warning:`#facc15`,danger:`#f87171`,methodGet:`#38bdf8`,methodPost:`#4ade80`,methodPut:`#facc15`,methodDelete:`#f87171`},v=()=>{if(typeof document>`u`)return;let e=`dev-companion-custom-styles`;if(document.getElementById(e))return;let t=document.createElement(`style`);t.id=e,t.innerHTML=`
|
|
2
|
+
.dev-companion-scroll::-webkit-scrollbar {
|
|
3
|
+
width: 5px;
|
|
4
|
+
height: 5px;
|
|
5
|
+
}
|
|
6
|
+
.dev-companion-scroll::-webkit-scrollbar-track {
|
|
7
|
+
background: #0f172a;
|
|
8
|
+
}
|
|
9
|
+
.dev-companion-scroll::-webkit-scrollbar-thumb {
|
|
10
|
+
background: #334155;
|
|
11
|
+
border-radius: 4px;
|
|
12
|
+
}
|
|
13
|
+
.dev-companion-scroll::-webkit-scrollbar-thumb:hover {
|
|
14
|
+
background: #475569;
|
|
15
|
+
}
|
|
16
|
+
@keyframes devCompanionSlideUp {
|
|
17
|
+
from {
|
|
18
|
+
opacity: 0;
|
|
19
|
+
transform: translateY(8px) scale(0.98);
|
|
20
|
+
}
|
|
21
|
+
to {
|
|
22
|
+
opacity: 1;
|
|
23
|
+
transform: translateY(0) scale(1);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
.dev-companion-panel-animate {
|
|
27
|
+
animation: devCompanionSlideUp 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
|
|
28
|
+
}
|
|
29
|
+
`,document.head.appendChild(t)},y=c((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),b=c((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===k?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`;case O:return`ViewTransition`}if(typeof e==`object`)switch(typeof e.tag==`number`&&console.error(`Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.`),e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var n=e.render;return e=e.displayName,e||=(e=n.displayName||n.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case E:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===E)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=A.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(j.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){P||(P=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function l(){var e=t(this.type);return F[e]||(F[e]=!0,console.error(`Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.`)),e=this.props.ref,e===void 0?null:e}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,"ref",{enumerable:!1,value:null}):Object.defineProperty(e,"ref",{enumerable:!1,get:l}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0){if(o){if(M(p)){for(o=0;o<p.length;o++)f(p[o]);Object.freeze&&Object.freeze(p)}else console.error(`React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.`)}else f(p)}if(j.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,R[p+o]||(m=0<m.length?`{`+m.join(`: ..., `)+`: ...}`:`{}`,console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
30
|
let props = %s;
|
|
3
31
|
<%s {...props} />
|
|
4
32
|
React keys must be passed directly to JSX without using spread:
|
|
5
33
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,o,p,m,p),R[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require("react"),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.view_transition`),k=Symbol.for(`react.client.reference`),A=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=Object.prototype.hasOwnProperty,M=Array.isArray,N=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var P,F={},I=m.react_stack_bottom_frame.bind(m,o)(),L=N(i(o)),R={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>A.recentlyCreatedOwnerStacks++;if(r){var a=Error.stackTraceLimit;Error.stackTraceLimit=10;var o=Error(`react-stack-top-frame`);Error.stackTraceLimit=a}else o=I;return d(e,t,n,!1,o,r?N(i(e)):L)},e.jsxs=function(e,t,n){var r=1e4>A.recentlyCreatedOwnerStacks++;if(r){var a=Error.stackTraceLimit;Error.stackTraceLimit=10;var o=Error(`react-stack-top-frame`);Error.stackTraceLimit=a}else o=I;return d(e,t,n,!0,o,r?N(i(e)):L)}})()})),v=c(((e,t)=>{t.exports=process.env.NODE_ENV===`production`?g():_()}))(),y=()=>{let[e,n]=(0,t.useState)(`local`),[r,i]=(0,t.useState)([]),[a,o]=(0,t.useState)(``),[s,c]=(0,t.useState)(``),l=()=>{e===`local`?i(d()):e===`session`?i(f()):e===`cookie`&&i(p())};(0,t.useEffect)(()=>{l()},[e]);let u=t=>{m(t,e),l()};return(0,v.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`10px`},children:[(0,v.jsx)(`div`,{style:{display:`flex`,gap:`6px`,borderBottom:`1px solid #334155`,paddingBottom:`6px`},children:[`local`,`session`,`cookie`].map(t=>(0,v.jsx)(`button`,{onClick:()=>n(t),style:{background:e===t?`#3b82f6`:`#1e293b`,color:`#fff`,border:`none`,padding:`4px 8px`,borderRadius:`4px`,fontSize:`11px`,cursor:`pointer`},children:t.toUpperCase()},t))}),(0,v.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),a.trim()&&(h(a.trim(),s.trim(),e),o(``),c(``),l())},style:{display:`flex`,gap:`4px`},children:[(0,v.jsx)(`input`,{placeholder:`Key`,value:a,onChange:e=>o(e.target.value),style:{flex:1,padding:`4px`,fontSize:`11px`,background:`#1e293b`,color:`#fff`,border:`1px solid #334155`,borderRadius:`4px`}}),(0,v.jsx)(`input`,{placeholder:`Value`,value:s,onChange:e=>c(e.target.value),style:{flex:1,padding:`4px`,fontSize:`11px`,background:`#1e293b`,color:`#fff`,border:`1px solid #334155`,borderRadius:`4px`}}),(0,v.jsx)(`button`,{type:`submit`,style:{background:`#22c55e`,color:`#fff`,border:`none`,padding:`4px 8px`,borderRadius:`4px`,fontSize:`11px`,cursor:`pointer`},children:`Add`})]}),(0,v.jsx)(`div`,{style:{maxHeight:`180px`,overflowY:`auto`},children:r.length===0?(0,v.jsx)(`p`,{style:{color:`#94a3b8`,fontSize:`12px`},children:`No items found.`}):r.map(e=>(0,v.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`4px 0`,borderBottom:`1px solid #1e293b`,fontSize:`11px`},children:[(0,v.jsxs)(`div`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,maxWidth:`220px`},children:[(0,v.jsxs)(`strong`,{style:{color:`#38bdf8`},children:[e.key,`:`]}),` `,e.value]}),(0,v.jsx)(`button`,{onClick:()=>u(e.key),style:{background:`#ef4444`,color:`#fff`,border:`none`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`10px`,cursor:`pointer`},children:`Del`})]},e.key))})]})};e.DevCompanion=()=>{let[e,n]=(0,t.useState)(!1),[r,i]=(0,t.useState)(`network`),[a,o]=(0,t.useState)([]);return(0,t.useEffect)(()=>{u(e=>{o(t=>[e,...t])})},[]),(0,v.jsxs)(`div`,{style:{position:`fixed`,bottom:16,right:16,zIndex:99999,fontFamily:`sans-serif`},children:[(0,v.jsxs)(`button`,{onClick:()=>n(!e),style:{background:`#1e293b`,color:`#fff`,border:`none`,padding:`10px 14px`,borderRadius:`8px`,cursor:`pointer`,fontWeight:`bold`,boxShadow:`0 4px 12px rgba(0,0,0,0.15)`},children:[`Dev Companion (`,a.length,`)`]}),e&&(0,v.jsxs)(`div`,{style:{position:`absolute`,bottom:50,right:0,width:380,height:340,background:`#0f172a`,color:`#f8fafc`,borderRadius:`8px`,padding:`12px`,boxShadow:`0 8px 24px rgba(0,0,0,0.3)`,display:`flex`,flexDirection:`column`},children:[(0,v.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,borderBottom:`1px solid #334155`,paddingBottom:`8px`,marginBottom:`8px`},children:[(0,v.jsx)(`button`,{onClick:()=>i(`network`),style:{background:r===`network`?`#0284c7`:`#1e293b`,color:`#fff`,border:`none`,padding:`6px 12px`,borderRadius:`4px`,fontSize:`12px`,fontWeight:`bold`,cursor:`pointer`},children:`Network`}),(0,v.jsx)(`button`,{onClick:()=>i(`storage`),style:{background:r===`storage`?`#0284c7`:`#1e293b`,color:`#fff`,border:`none`,padding:`6px 12px`,borderRadius:`4px`,fontSize:`12px`,fontWeight:`bold`,cursor:`pointer`},children:`Storage`})]}),r===`network`?(0,v.jsx)(`div`,{style:{flex:1,overflowY:`auto`},children:a.length===0?(0,v.jsx)(`p`,{style:{color:`#94a3b8`,fontSize:`13px`},children:`No requests captured yet.`}):a.map(e=>(0,v.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,padding:`6px 0`,borderBottom:`1px solid #1e293b`,fontSize:`12px`},children:[(0,v.jsxs)(`span`,{style:{fontWeight:`bold`,color:e.method===`GET`?`#38bdf8`:`#4ade80`},children:[`[`,e.method,`]`]}),(0,v.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,maxWidth:`180px`},children:e.url}),(0,v.jsx)(`span`,{style:{color:e.status&&e.status>=400?`#f87171`:`#facc15`},children:e.status||`PENDING`})]},e.id))}):(0,v.jsx)(y,{})]})]})}});
|
|
34
|
+
<%s key={someKey} {...props} />`,o,p,m,p),R[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require("react"),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.view_transition`),k=Symbol.for(`react.client.reference`),A=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=Object.prototype.hasOwnProperty,M=Array.isArray,N=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var P,F={},I=m.react_stack_bottom_frame.bind(m,o)(),L=N(i(o)),R={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>A.recentlyCreatedOwnerStacks++;if(r){var a=Error.stackTraceLimit;Error.stackTraceLimit=10;var o=Error(`react-stack-top-frame`);Error.stackTraceLimit=a}else o=I;return d(e,t,n,!1,o,r?N(i(e)):L)},e.jsxs=function(e,t,n){var r=1e4>A.recentlyCreatedOwnerStacks++;if(r){var a=Error.stackTraceLimit;Error.stackTraceLimit=10;var o=Error(`react-stack-top-frame`);Error.stackTraceLimit=a}else o=I;return d(e,t,n,!0,o,r?N(i(e)):L)}})()})),x=c(((e,t)=>{t.exports=process.env.NODE_ENV===`production`?y():b()}))(),S=()=>{let[e,n]=(0,t.useState)(`localStorage`),[r,i]=(0,t.useState)([]),[a,o]=(0,t.useState)(null),[s,c]=(0,t.useState)(``);(0,t.useEffect)(()=>{v()},[]);let l=()=>{if(typeof window>`u`)return;let t=[];if(e===`localStorage`)for(let e=0;e<localStorage.length;e++){let n=localStorage.key(e);n&&t.push({key:n,value:localStorage.getItem(n)||``})}else if(e===`sessionStorage`)for(let e=0;e<sessionStorage.length;e++){let n=sessionStorage.key(e);n&&t.push({key:n,value:sessionStorage.getItem(n)||``})}else e===`cookie`&&t.push(...p());i(t)};(0,t.useEffect)(()=>{l()},[e]);let u=t=>{e===`localStorage`?localStorage.setItem(t,s):e===`sessionStorage`?sessionStorage.setItem(t,s):e===`cookie`&&m(t,s),o(null),l()},d=t=>{e===`localStorage`?localStorage.removeItem(t):e===`sessionStorage`?sessionStorage.removeItem(t):e===`cookie`&&h(t),l()};return(0,x.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`10px`,height:`100%`},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,x.jsx)(`div`,{style:{display:`flex`,gap:`4px`,background:_.cardBg,padding:`3px`,borderRadius:`6px`,border:`1px solid ${_.border}`},children:[`localStorage`,`sessionStorage`,`cookie`].map(t=>(0,x.jsx)(`button`,{onClick:()=>n(t),style:{padding:`4px 8px`,borderRadius:`4px`,border:`none`,background:e===t?_.accent:`transparent`,color:e===t?`#fff`:_.textSecondary,cursor:`pointer`,fontSize:`11px`,fontWeight:600,transition:`all 0.15s ease`},children:t===`localStorage`?`Local`:t===`sessionStorage`?`Session`:`Cookies`},t))}),(0,x.jsxs)(`div`,{style:{display:`flex`,gap:`6px`,alignItems:`center`},children:[(0,x.jsx)(`button`,{onClick:l,title:`Refresh storage data`,style:{padding:`5px 8px`,fontSize:`11px`,background:_.cardBg,color:_.accent,border:`1px solid ${_.border}`,borderRadius:`6px`,cursor:`pointer`,fontWeight:600},children:`↻ Refresh`}),(0,x.jsx)(`button`,{onClick:()=>g(e),style:{padding:`5px 9px`,fontSize:`11px`,background:_.cardBg,color:_.textPrimary,border:`1px solid ${_.border}`,borderRadius:`6px`,cursor:`pointer`,fontWeight:500},children:`Export`}),(0,x.jsxs)(`label`,{style:{padding:`5px 9px`,fontSize:`11px`,background:_.cardBg,color:_.textPrimary,border:`1px solid ${_.border}`,borderRadius:`6px`,cursor:`pointer`,fontWeight:500},children:[`Import`,(0,x.jsx)(`input`,{type:`file`,accept:`.json`,onChange:t=>{let n=t.target.files?.[0];if(!n)return;let r=new FileReader;r.onload=t=>{try{let n=JSON.parse(t.target?.result);n&&n.data&&(Object.entries(n.data).forEach(([t,n])=>{let r=typeof n==`string`?n:JSON.stringify(n);e===`localStorage`&&localStorage.setItem(t,r),e===`sessionStorage`&&sessionStorage.setItem(t,r),e===`cookie`&&m(t,r)}),l())}catch(e){console.error(`[DevCompanion] Failed to import JSON:`,e)}},r.readAsText(n)},style:{display:`none`}})]})]})]}),(0,x.jsx)(`div`,{className:`dev-companion-scroll`,style:{flex:1,overflowY:`auto`,background:_.cardBg,borderRadius:`6px`,border:`1px solid ${_.border}`},children:r.length===0?(0,x.jsxs)(`p`,{style:{color:_.textSecondary,fontSize:`12px`,textAlign:`center`,padding:`24px 0`},children:[`No items found in `,e,`.`]}):(0,x.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:`11px`,color:_.textPrimary},children:[(0,x.jsx)(`thead`,{children:(0,x.jsxs)(`tr`,{style:{borderBottom:`1px solid ${_.border}`,textAlign:`left`,background:_.bg,color:_.textSecondary},children:[(0,x.jsx)(`th`,{style:{padding:`8px`,width:`35%`},children:`Key`}),(0,x.jsx)(`th`,{style:{padding:`8px`},children:`Value`}),(0,x.jsx)(`th`,{style:{padding:`8px`,width:`80px`,textAlign:`right`},children:`Actions`})]})}),(0,x.jsx)(`tbody`,{children:r.map(e=>(0,x.jsxs)(`tr`,{style:{borderBottom:`1px solid ${_.borderSubtle}`},children:[(0,x.jsx)(`td`,{style:{padding:`8px`,fontWeight:600,color:_.methodGet,fontFamily:`monospace`,wordBreak:`break-all`},children:e.key}),(0,x.jsx)(`td`,{style:{padding:`8px`},children:a===e.key?(0,x.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),style:{width:`100%`,background:_.bg,color:_.textPrimary,border:`1px solid ${_.accent}`,borderRadius:`4px`,padding:`3px 6px`,fontSize:`11px`,outline:`none`}}):(0,x.jsx)(`span`,{style:{wordBreak:`break-all`,fontFamily:`monospace`,color:_.textSecondary},children:e.value})}),(0,x.jsxs)(`td`,{style:{padding:`8px`,textAlign:`right`},children:[a===e.key?(0,x.jsx)(`button`,{onClick:()=>u(e.key),style:{color:_.success,background:`none`,border:`none`,cursor:`pointer`,fontWeight:600,marginRight:`6px`},children:`Save`}):(0,x.jsx)(`button`,{onClick:()=>{o(e.key),c(e.value)},style:{color:_.warning,background:`none`,border:`none`,cursor:`pointer`,marginRight:`6px`},children:`Edit`}),(0,x.jsx)(`button`,{onClick:()=>d(e.key),style:{color:_.danger,background:`none`,border:`none`,cursor:`pointer`},children:`Del`})]})]},e.key))})]})})]})},C=({logs:e=[],onClear:n})=>{let[r,i]=(0,t.useState)(``),[a,o]=(0,t.useState)(`ALL`),[s,c]=(0,t.useState)(d.isOffline),[l,u]=(0,t.useState)(d.delayMs),[f,p]=(0,t.useState)(null);(0,t.useEffect)(()=>{v()},[]);let m=()=>{let e=!s;c(e),d.isOffline=e},h=e=>{u(e),d.delayMs=e},g=e.filter(e=>{if(!e||!e.url)return!1;let t=e.url.toLowerCase().includes((r||``).toLowerCase()),n=a===`ALL`||e.method===a;return t&&n}),y=e=>{let t=`curl -X ${e.method} "${e.url}"`;navigator.clipboard.writeText(t),p(e.id),setTimeout(()=>p(null),1500)},b=e=>{switch(e?.toUpperCase()){case`GET`:return _.methodGet;case`POST`:return _.methodPost;case`PUT`:return _.methodPut;case`DELETE`:return _.methodDelete;default:return _.textPrimary}};return(0,x.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`10px`,height:`100%`},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,background:_.cardBg,padding:`8px 10px`,borderRadius:`6px`,fontSize:`11px`,border:`1px solid ${_.borderSubtle}`,flexShrink:0},children:[(0,x.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`6px`,cursor:`pointer`,color:s?_.danger:_.textSecondary,fontWeight:500},children:[(0,x.jsx)(`input`,{type:`checkbox`,checked:s,onChange:m,style:{accentColor:_.danger}}),`Offline Mode`]}),(0,x.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,x.jsx)(`span`,{style:{color:_.textSecondary},children:`Delay:`}),(0,x.jsxs)(`select`,{value:l,onChange:e=>h(Number(e.target.value)),style:{background:_.bg,color:_.textPrimary,border:`1px solid ${_.border}`,borderRadius:`4px`,padding:`2px 6px`,fontSize:`11px`,outline:`none`,cursor:`pointer`},children:[(0,x.jsx)(`option`,{value:0,children:`None (0ms)`}),(0,x.jsx)(`option`,{value:500,children:`Fast 3G (500ms)`}),(0,x.jsx)(`option`,{value:2e3,children:`Slow 3G (2s)`})]})]})]}),(0,x.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,flexShrink:0,alignItems:`center`},children:[(0,x.jsx)(`input`,{type:`text`,placeholder:`Filter URL...`,value:r,onChange:e=>i(e.target.value),style:{flex:1,background:_.cardBg,color:_.textPrimary,border:`1px solid ${_.border}`,borderRadius:`6px`,padding:`6px 10px`,fontSize:`12px`,outline:`none`}}),(0,x.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value),style:{background:_.cardBg,color:_.textPrimary,border:`1px solid ${_.border}`,borderRadius:`6px`,padding:`6px 8px`,fontSize:`12px`,outline:`none`,cursor:`pointer`},children:[(0,x.jsx)(`option`,{value:`ALL`,children:`ALL`}),(0,x.jsx)(`option`,{value:`GET`,children:`GET`}),(0,x.jsx)(`option`,{value:`POST`,children:`POST`}),(0,x.jsx)(`option`,{value:`PUT`,children:`PUT`}),(0,x.jsx)(`option`,{value:`DELETE`,children:`DELETE`})]}),n&&(0,x.jsx)(`button`,{onClick:n,title:`Clear request history`,style:{padding:`6px 10px`,fontSize:`11px`,background:_.cardBg,color:_.textSecondary,border:`1px solid ${_.border}`,borderRadius:`6px`,cursor:`pointer`,fontWeight:600},children:`Clear`})]}),(0,x.jsx)(`div`,{className:`dev-companion-scroll`,style:{flex:1,overflowY:`auto`,display:`flex`,flexDirection:`column`,gap:`4px`,paddingRight:`2px`},children:g.length===0?(0,x.jsx)(`p`,{style:{color:_.textSecondary,fontSize:`12px`,textAlign:`center`,marginTop:`24px`},children:`No requests captured.`}):g.map(e=>{let t=!e.status||e.status>=400?_.danger:_.success;return(0,x.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`8px 10px`,background:_.cardBg,borderRadius:`6px`,border:`1px solid ${_.borderSubtle}`,fontSize:`12px`,flexShrink:0},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,overflow:`hidden`},children:[(0,x.jsx)(`span`,{style:{fontWeight:700,color:b(e.method),fontSize:`11px`,background:_.bg,padding:`2px 6px`,borderRadius:`4px`,border:`1px solid ${_.border}`,minWidth:`45px`,textAlign:`center`},children:e.method}),(0,x.jsx)(`span`,{title:e.url,style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,maxWidth:`170px`,color:_.textPrimary,fontFamily:`monospace`,fontSize:`11px`},children:e.url})]}),(0,x.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,flexShrink:0},children:[e.duration!==void 0&&(0,x.jsxs)(`span`,{style:{color:_.textSecondary,fontSize:`10px`,fontFamily:`monospace`},children:[e.duration,`ms`]}),(0,x.jsx)(`span`,{style:{color:t,fontWeight:700,fontSize:`11px`,background:`${t}15`,padding:`2px 6px`,borderRadius:`4px`},children:e.status||`ERR`}),(0,x.jsx)(`button`,{onClick:()=>y(e),title:`Copy cURL`,style:{background:f===e.id?_.success:_.hoverBg,color:f===e.id?`#000`:_.textPrimary,border:`none`,borderRadius:`4px`,padding:`3px 8px`,fontSize:`10px`,fontWeight:600,cursor:`pointer`,transition:`all 0.15s ease`},children:f===e.id?`Copied!`:`cURL`})]})]},e.id)})})]})},w=(e,n)=>{(0,t.useEffect)(()=>{let t=t=>{let r=!e.ctrlOrCmd||t.metaKey||t.ctrlKey,i=!e.shift||t.shiftKey,a=t.key.toLowerCase()===e.key.toLowerCase();r&&i&&a&&(t.preventDefault(),n())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,n])};e.DevCompanion=({position:e=`bottom-right`})=>{let[n,r]=(0,t.useState)(!1),[i,a]=(0,t.useState)(`network`),[o,s]=(0,t.useState)([]);(0,t.useEffect)(()=>{v()},[]),w({key:`d`,ctrlOrCmd:!0,shift:!0},()=>{r(e=>!e)}),(0,t.useEffect)(()=>{f(e=>{s(t=>[e,...t])})},[]);let c=(()=>{switch(e){case`bottom-left`:return{bottom:16,left:16};case`top-right`:return{top:16,right:16};case`top-left`:return{top:16,left:16};default:return{bottom:16,right:16}}})();return(0,x.jsxs)(`div`,{style:{position:`fixed`,...c,zIndex:99999,fontFamily:`system-ui, -apple-system, sans-serif`},children:[(0,x.jsxs)(`button`,{onClick:()=>r(!n),title:`Shortcut: Ctrl + Shift + D`,style:{background:_.bg,color:_.textPrimary,border:`1px solid ${_.border}`,padding:`8px 14px`,borderRadius:`20px`,cursor:`pointer`,fontWeight:600,fontSize:`12px`,display:`flex`,alignItems:`center`,gap:`8px`,boxShadow:`0 4px 20px rgba(0,0,0,0.35)`,transition:`transform 0.15s ease`},children:[(0,x.jsx)(`span`,{style:{color:_.accent},children:`⚡`}),` DevCompanion`,o.length>0&&(0,x.jsx)(`span`,{style:{background:_.accent,color:`#fff`,fontSize:`10px`,padding:`2px 6px`,borderRadius:`10px`,fontWeight:700},children:o.length})]}),n&&(0,x.jsxs)(`div`,{className:`dev-companion-panel-animate`,style:{position:`absolute`,...c.bottom===void 0?{top:50}:{bottom:50},...c.right===void 0?{left:0}:{right:0},width:440,height:400,background:_.bg,color:_.textPrimary,borderRadius:`10px`,padding:`12px`,border:`1px solid ${_.border}`,boxShadow:`0 12px 32px rgba(0,0,0,0.5)`,display:`flex`,flexDirection:`column`},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,borderBottom:`1px solid ${_.border}`,paddingBottom:`8px`,marginBottom:`10px`},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,gap:`6px`},children:[(0,x.jsx)(`button`,{onClick:()=>a(`network`),style:{background:i===`network`?_.accent:`transparent`,color:i===`network`?`#fff`:_.textSecondary,border:`none`,padding:`5px 12px`,borderRadius:`6px`,fontSize:`12px`,fontWeight:600,cursor:`pointer`,transition:`all 0.15s ease`},children:`Network`}),(0,x.jsx)(`button`,{onClick:()=>a(`storage`),style:{background:i===`storage`?_.accent:`transparent`,color:i===`storage`?`#fff`:_.textSecondary,border:`none`,padding:`5px 12px`,borderRadius:`6px`,fontSize:`12px`,fontWeight:600,cursor:`pointer`,transition:`all 0.15s ease`},children:`Storage`})]}),(0,x.jsx)(`span`,{style:{fontSize:`10px`,color:_.textSecondary,fontFamily:`monospace`},children:`Ctrl+Shift+D`})]}),(0,x.jsx)(`div`,{style:{flex:1,overflow:`hidden`},children:i===`network`?(0,x.jsx)(C,{logs:o,onClear:()=>s([])}):(0,x.jsx)(S,{})})]})]})}});
|
package/dist/index.js
CHANGED
|
@@ -3,56 +3,95 @@ import { useEffect as e, useState as t } from "react";
|
|
|
3
3
|
var n = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), r = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
4
4
|
if (typeof require < "u") return require.apply(this, arguments);
|
|
5
5
|
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
6
|
-
}), i =
|
|
6
|
+
}), i = !1, a = {
|
|
7
|
+
isOffline: !1,
|
|
8
|
+
delayMs: 0
|
|
9
|
+
}, o = (e) => {
|
|
10
|
+
if (i || typeof window > "u") return;
|
|
11
|
+
i = !0;
|
|
7
12
|
let t = window.fetch;
|
|
8
13
|
window.fetch = async (...n) => {
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
let r = performance.now(), i = Math.random().toString(36).substring(2, 9), o = "", s = "GET";
|
|
15
|
+
if (typeof n[0] == "string" ? o = n[0] : n[0] instanceof URL ? o = n[0].toString() : n[0] instanceof Request && (o = n[0].url, s = n[0].method || "GET"), n[1] && n[1].method && (s = n[1].method.toUpperCase()), a.delayMs > 0 && await new Promise((e) => setTimeout(e, a.delayMs)), a.isOffline) {
|
|
16
|
+
let t = performance.now();
|
|
17
|
+
throw e({
|
|
18
|
+
id: i,
|
|
19
|
+
url: o,
|
|
20
|
+
method: s,
|
|
21
|
+
status: 0,
|
|
22
|
+
duration: Math.round(t - r),
|
|
23
|
+
timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString()
|
|
24
|
+
}), TypeError("Failed to fetch (Simulated Offline Mode)");
|
|
25
|
+
}
|
|
15
26
|
try {
|
|
16
|
-
let
|
|
17
|
-
return
|
|
27
|
+
let a = await t(...n), c = performance.now();
|
|
28
|
+
return e({
|
|
29
|
+
id: i,
|
|
30
|
+
url: o,
|
|
31
|
+
method: s,
|
|
32
|
+
status: a.status,
|
|
33
|
+
duration: Math.round(c - r),
|
|
34
|
+
timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString()
|
|
35
|
+
}), a;
|
|
18
36
|
} catch (t) {
|
|
19
|
-
|
|
37
|
+
let n = performance.now();
|
|
38
|
+
throw e({
|
|
39
|
+
id: i,
|
|
40
|
+
url: o,
|
|
41
|
+
method: s,
|
|
42
|
+
status: 0,
|
|
43
|
+
duration: Math.round(n - r),
|
|
44
|
+
timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString()
|
|
45
|
+
}), t;
|
|
20
46
|
}
|
|
21
47
|
};
|
|
22
|
-
},
|
|
23
|
-
let e = [];
|
|
24
|
-
for (let t = 0; t < localStorage.length; t++) {
|
|
25
|
-
let n = localStorage.key(t);
|
|
26
|
-
n && e.push({
|
|
27
|
-
key: n,
|
|
28
|
-
value: localStorage.getItem(n) || "",
|
|
29
|
-
type: "local"
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
return e;
|
|
33
|
-
}, o = () => {
|
|
34
|
-
let e = [];
|
|
35
|
-
for (let t = 0; t < sessionStorage.length; t++) {
|
|
36
|
-
let n = sessionStorage.key(t);
|
|
37
|
-
n && e.push({
|
|
38
|
-
key: n,
|
|
39
|
-
value: sessionStorage.getItem(n) || "",
|
|
40
|
-
type: "session"
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
return e;
|
|
44
|
-
}, s = () => document.cookie ? document.cookie.split("; ").map((e) => {
|
|
48
|
+
}, s = () => typeof document > "u" || !document.cookie ? [] : document.cookie.split("; ").map((e) => {
|
|
45
49
|
let [t, ...n] = e.split("=");
|
|
46
50
|
return {
|
|
47
|
-
key: t
|
|
48
|
-
value: decodeURIComponent(n.join("="))
|
|
49
|
-
type: "cookie"
|
|
51
|
+
key: t,
|
|
52
|
+
value: decodeURIComponent(n.join("="))
|
|
50
53
|
};
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
},
|
|
54
|
+
}), c = (e, t, n = 7) => {
|
|
55
|
+
if (typeof document > "u") return;
|
|
56
|
+
let r = new Date(Date.now() + n * 864e5).toUTCString();
|
|
57
|
+
document.cookie = `${encodeURIComponent(e)}=${encodeURIComponent(t)}; expires=${r}; path=/`;
|
|
58
|
+
}, l = (e) => {
|
|
59
|
+
typeof document < "u" && (document.cookie = `${encodeURIComponent(e)}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`);
|
|
60
|
+
}, u = (e) => {
|
|
61
|
+
let t = {};
|
|
62
|
+
e === "localStorage" ? t = { ...localStorage } : e === "sessionStorage" ? t = { ...sessionStorage } : e === "cookie" && s().forEach((e) => {
|
|
63
|
+
t[e.key] = e.value;
|
|
64
|
+
});
|
|
65
|
+
let n = {
|
|
66
|
+
type: e,
|
|
67
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
68
|
+
data: t
|
|
69
|
+
}, r = new Blob([JSON.stringify(n, null, 2)], { type: "application/json" }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
70
|
+
a.href = i, a.download = `dev-companion-${e}-${Date.now()}.json`, a.click(), URL.revokeObjectURL(i);
|
|
71
|
+
}, d = {
|
|
72
|
+
bg: "#0f172a",
|
|
73
|
+
cardBg: "#1e293b",
|
|
74
|
+
hoverBg: "#334155",
|
|
75
|
+
border: "#334155",
|
|
76
|
+
borderSubtle: "#1e293b",
|
|
77
|
+
textPrimary: "#f8fafc",
|
|
78
|
+
textSecondary: "#94a3b8",
|
|
79
|
+
accent: "#0284c7",
|
|
80
|
+
accentHover: "#0369a1",
|
|
81
|
+
success: "#4ade80",
|
|
82
|
+
warning: "#facc15",
|
|
83
|
+
danger: "#f87171",
|
|
84
|
+
methodGet: "#38bdf8",
|
|
85
|
+
methodPost: "#4ade80",
|
|
86
|
+
methodPut: "#facc15",
|
|
87
|
+
methodDelete: "#f87171"
|
|
88
|
+
}, f = () => {
|
|
89
|
+
if (typeof document > "u") return;
|
|
90
|
+
let e = "dev-companion-custom-styles";
|
|
91
|
+
if (document.getElementById(e)) return;
|
|
92
|
+
let t = document.createElement("style");
|
|
93
|
+
t.id = e, t.innerHTML = "\n .dev-companion-scroll::-webkit-scrollbar {\n width: 5px;\n height: 5px;\n }\n .dev-companion-scroll::-webkit-scrollbar-track {\n background: #0f172a;\n }\n .dev-companion-scroll::-webkit-scrollbar-thumb {\n background: #334155;\n border-radius: 4px;\n }\n .dev-companion-scroll::-webkit-scrollbar-thumb:hover {\n background: #475569;\n }\n @keyframes devCompanionSlideUp {\n from {\n opacity: 0;\n transform: translateY(8px) scale(0.98);\n }\n to {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n }\n .dev-companion-panel-animate {\n animation: devCompanionSlideUp 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;\n }\n ", document.head.appendChild(t);
|
|
94
|
+
}, p = /* @__PURE__ */ n(((e) => {
|
|
56
95
|
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
57
96
|
function r(e, n, r) {
|
|
58
97
|
var i = null;
|
|
@@ -67,7 +106,7 @@ var n = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e
|
|
|
67
106
|
};
|
|
68
107
|
}
|
|
69
108
|
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
70
|
-
})),
|
|
109
|
+
})), m = /* @__PURE__ */ n(((e) => {
|
|
71
110
|
process.env.NODE_ENV !== "production" && (function() {
|
|
72
111
|
function t(e) {
|
|
73
112
|
if (e == null) return null;
|
|
@@ -241,283 +280,747 @@ var n = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e
|
|
|
241
280
|
return f(e, t, n, !0, o, r ? P(a(e)) : R);
|
|
242
281
|
};
|
|
243
282
|
})();
|
|
244
|
-
})),
|
|
245
|
-
t.exports = process.env.NODE_ENV === "production" ?
|
|
246
|
-
})))(),
|
|
247
|
-
let [n, r] = t("
|
|
248
|
-
|
|
283
|
+
})), h = (/* @__PURE__ */ n(((e, t) => {
|
|
284
|
+
t.exports = process.env.NODE_ENV === "production" ? p() : m();
|
|
285
|
+
})))(), g = () => {
|
|
286
|
+
let [n, r] = t("localStorage"), [i, a] = t([]), [o, p] = t(null), [m, g] = t("");
|
|
287
|
+
e(() => {
|
|
288
|
+
f();
|
|
289
|
+
}, []);
|
|
290
|
+
let _ = () => {
|
|
291
|
+
if (typeof window > "u") return;
|
|
292
|
+
let e = [];
|
|
293
|
+
if (n === "localStorage") for (let t = 0; t < localStorage.length; t++) {
|
|
294
|
+
let n = localStorage.key(t);
|
|
295
|
+
n && e.push({
|
|
296
|
+
key: n,
|
|
297
|
+
value: localStorage.getItem(n) || ""
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
else if (n === "sessionStorage") for (let t = 0; t < sessionStorage.length; t++) {
|
|
301
|
+
let n = sessionStorage.key(t);
|
|
302
|
+
n && e.push({
|
|
303
|
+
key: n,
|
|
304
|
+
value: sessionStorage.getItem(n) || ""
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
else n === "cookie" && e.push(...s());
|
|
308
|
+
a(e);
|
|
249
309
|
};
|
|
250
310
|
e(() => {
|
|
251
|
-
|
|
311
|
+
_();
|
|
252
312
|
}, [n]);
|
|
253
|
-
let
|
|
254
|
-
|
|
313
|
+
let v = (e) => {
|
|
314
|
+
n === "localStorage" ? localStorage.setItem(e, m) : n === "sessionStorage" ? sessionStorage.setItem(e, m) : n === "cookie" && c(e, m), p(null), _();
|
|
315
|
+
}, y = (e) => {
|
|
316
|
+
n === "localStorage" ? localStorage.removeItem(e) : n === "sessionStorage" ? sessionStorage.removeItem(e) : n === "cookie" && l(e), _();
|
|
255
317
|
};
|
|
256
|
-
return /* @__PURE__ */ (0,
|
|
318
|
+
return /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
257
319
|
style: {
|
|
258
320
|
display: "flex",
|
|
259
321
|
flexDirection: "column",
|
|
260
|
-
gap: "10px"
|
|
322
|
+
gap: "10px",
|
|
323
|
+
height: "100%"
|
|
261
324
|
},
|
|
262
|
-
children: [
|
|
263
|
-
|
|
325
|
+
children: [/* @__PURE__ */ (0, h.jsxs)("div", {
|
|
326
|
+
style: {
|
|
327
|
+
display: "flex",
|
|
328
|
+
justifyContent: "space-between",
|
|
329
|
+
alignItems: "center"
|
|
330
|
+
},
|
|
331
|
+
children: [/* @__PURE__ */ (0, h.jsx)("div", {
|
|
264
332
|
style: {
|
|
265
333
|
display: "flex",
|
|
266
|
-
gap: "
|
|
267
|
-
|
|
268
|
-
|
|
334
|
+
gap: "4px",
|
|
335
|
+
background: d.cardBg,
|
|
336
|
+
padding: "3px",
|
|
337
|
+
borderRadius: "6px",
|
|
338
|
+
border: `1px solid ${d.border}`
|
|
269
339
|
},
|
|
270
340
|
children: [
|
|
271
|
-
"
|
|
272
|
-
"
|
|
341
|
+
"localStorage",
|
|
342
|
+
"sessionStorage",
|
|
273
343
|
"cookie"
|
|
274
|
-
].map((e) => /* @__PURE__ */ (0,
|
|
344
|
+
].map((e) => /* @__PURE__ */ (0, h.jsx)("button", {
|
|
275
345
|
onClick: () => r(e),
|
|
276
346
|
style: {
|
|
277
|
-
background: n === e ? "#3b82f6" : "#1e293b",
|
|
278
|
-
color: "#fff",
|
|
279
|
-
border: "none",
|
|
280
347
|
padding: "4px 8px",
|
|
281
348
|
borderRadius: "4px",
|
|
349
|
+
border: "none",
|
|
350
|
+
background: n === e ? d.accent : "transparent",
|
|
351
|
+
color: n === e ? "#fff" : d.textSecondary,
|
|
352
|
+
cursor: "pointer",
|
|
282
353
|
fontSize: "11px",
|
|
283
|
-
|
|
354
|
+
fontWeight: 600,
|
|
355
|
+
transition: "all 0.15s ease"
|
|
284
356
|
},
|
|
285
|
-
children: e
|
|
357
|
+
children: e === "localStorage" ? "Local" : e === "sessionStorage" ? "Session" : "Cookies"
|
|
286
358
|
}, e))
|
|
287
|
-
}),
|
|
288
|
-
/* @__PURE__ */ (0, f.jsxs)("form", {
|
|
289
|
-
onSubmit: (e) => {
|
|
290
|
-
e.preventDefault(), d.trim() && (l(d.trim(), m.trim(), n), p(""), h(""), g());
|
|
291
|
-
},
|
|
359
|
+
}), /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
292
360
|
style: {
|
|
293
361
|
display: "flex",
|
|
294
|
-
gap: "
|
|
362
|
+
gap: "6px",
|
|
363
|
+
alignItems: "center"
|
|
295
364
|
},
|
|
296
365
|
children: [
|
|
297
|
-
/* @__PURE__ */ (0,
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
onChange: (e) => p(e.target.value),
|
|
366
|
+
/* @__PURE__ */ (0, h.jsx)("button", {
|
|
367
|
+
onClick: _,
|
|
368
|
+
title: "Refresh storage data",
|
|
301
369
|
style: {
|
|
302
|
-
|
|
303
|
-
padding: "4px",
|
|
370
|
+
padding: "5px 8px",
|
|
304
371
|
fontSize: "11px",
|
|
305
|
-
background:
|
|
306
|
-
color:
|
|
307
|
-
border:
|
|
308
|
-
borderRadius: "
|
|
309
|
-
|
|
372
|
+
background: d.cardBg,
|
|
373
|
+
color: d.accent,
|
|
374
|
+
border: `1px solid ${d.border}`,
|
|
375
|
+
borderRadius: "6px",
|
|
376
|
+
cursor: "pointer",
|
|
377
|
+
fontWeight: 600
|
|
378
|
+
},
|
|
379
|
+
children: "↻ Refresh"
|
|
310
380
|
}),
|
|
311
|
-
/* @__PURE__ */ (0,
|
|
312
|
-
|
|
313
|
-
value: m,
|
|
314
|
-
onChange: (e) => h(e.target.value),
|
|
381
|
+
/* @__PURE__ */ (0, h.jsx)("button", {
|
|
382
|
+
onClick: () => u(n),
|
|
315
383
|
style: {
|
|
316
|
-
|
|
317
|
-
padding: "4px",
|
|
384
|
+
padding: "5px 9px",
|
|
318
385
|
fontSize: "11px",
|
|
319
|
-
background:
|
|
320
|
-
color:
|
|
321
|
-
border:
|
|
322
|
-
borderRadius: "
|
|
323
|
-
|
|
386
|
+
background: d.cardBg,
|
|
387
|
+
color: d.textPrimary,
|
|
388
|
+
border: `1px solid ${d.border}`,
|
|
389
|
+
borderRadius: "6px",
|
|
390
|
+
cursor: "pointer",
|
|
391
|
+
fontWeight: 500
|
|
392
|
+
},
|
|
393
|
+
children: "Export"
|
|
324
394
|
}),
|
|
325
|
-
/* @__PURE__ */ (0,
|
|
326
|
-
type: "submit",
|
|
395
|
+
/* @__PURE__ */ (0, h.jsxs)("label", {
|
|
327
396
|
style: {
|
|
328
|
-
|
|
329
|
-
color: "#fff",
|
|
330
|
-
border: "none",
|
|
331
|
-
padding: "4px 8px",
|
|
332
|
-
borderRadius: "4px",
|
|
397
|
+
padding: "5px 9px",
|
|
333
398
|
fontSize: "11px",
|
|
334
|
-
|
|
399
|
+
background: d.cardBg,
|
|
400
|
+
color: d.textPrimary,
|
|
401
|
+
border: `1px solid ${d.border}`,
|
|
402
|
+
borderRadius: "6px",
|
|
403
|
+
cursor: "pointer",
|
|
404
|
+
fontWeight: 500
|
|
335
405
|
},
|
|
336
|
-
children: "
|
|
406
|
+
children: ["Import", /* @__PURE__ */ (0, h.jsx)("input", {
|
|
407
|
+
type: "file",
|
|
408
|
+
accept: ".json",
|
|
409
|
+
onChange: (e) => {
|
|
410
|
+
let t = e.target.files?.[0];
|
|
411
|
+
if (!t) return;
|
|
412
|
+
let r = new FileReader();
|
|
413
|
+
r.onload = (e) => {
|
|
414
|
+
try {
|
|
415
|
+
let t = JSON.parse(e.target?.result);
|
|
416
|
+
t && t.data && (Object.entries(t.data).forEach(([e, t]) => {
|
|
417
|
+
let r = typeof t == "string" ? t : JSON.stringify(t);
|
|
418
|
+
n === "localStorage" && localStorage.setItem(e, r), n === "sessionStorage" && sessionStorage.setItem(e, r), n === "cookie" && c(e, r);
|
|
419
|
+
}), _());
|
|
420
|
+
} catch (e) {
|
|
421
|
+
console.error("[DevCompanion] Failed to import JSON:", e);
|
|
422
|
+
}
|
|
423
|
+
}, r.readAsText(t);
|
|
424
|
+
},
|
|
425
|
+
style: { display: "none" }
|
|
426
|
+
})]
|
|
337
427
|
})
|
|
338
428
|
]
|
|
339
|
-
})
|
|
340
|
-
|
|
429
|
+
})]
|
|
430
|
+
}), /* @__PURE__ */ (0, h.jsx)("div", {
|
|
431
|
+
className: "dev-companion-scroll",
|
|
432
|
+
style: {
|
|
433
|
+
flex: 1,
|
|
434
|
+
overflowY: "auto",
|
|
435
|
+
background: d.cardBg,
|
|
436
|
+
borderRadius: "6px",
|
|
437
|
+
border: `1px solid ${d.border}`
|
|
438
|
+
},
|
|
439
|
+
children: i.length === 0 ? /* @__PURE__ */ (0, h.jsxs)("p", {
|
|
440
|
+
style: {
|
|
441
|
+
color: d.textSecondary,
|
|
442
|
+
fontSize: "12px",
|
|
443
|
+
textAlign: "center",
|
|
444
|
+
padding: "24px 0"
|
|
445
|
+
},
|
|
446
|
+
children: [
|
|
447
|
+
"No items found in ",
|
|
448
|
+
n,
|
|
449
|
+
"."
|
|
450
|
+
]
|
|
451
|
+
}) : /* @__PURE__ */ (0, h.jsxs)("table", {
|
|
452
|
+
style: {
|
|
453
|
+
width: "100%",
|
|
454
|
+
borderCollapse: "collapse",
|
|
455
|
+
fontSize: "11px",
|
|
456
|
+
color: d.textPrimary
|
|
457
|
+
},
|
|
458
|
+
children: [/* @__PURE__ */ (0, h.jsx)("thead", { children: /* @__PURE__ */ (0, h.jsxs)("tr", {
|
|
459
|
+
style: {
|
|
460
|
+
borderBottom: `1px solid ${d.border}`,
|
|
461
|
+
textAlign: "left",
|
|
462
|
+
background: d.bg,
|
|
463
|
+
color: d.textSecondary
|
|
464
|
+
},
|
|
465
|
+
children: [
|
|
466
|
+
/* @__PURE__ */ (0, h.jsx)("th", {
|
|
467
|
+
style: {
|
|
468
|
+
padding: "8px",
|
|
469
|
+
width: "35%"
|
|
470
|
+
},
|
|
471
|
+
children: "Key"
|
|
472
|
+
}),
|
|
473
|
+
/* @__PURE__ */ (0, h.jsx)("th", {
|
|
474
|
+
style: { padding: "8px" },
|
|
475
|
+
children: "Value"
|
|
476
|
+
}),
|
|
477
|
+
/* @__PURE__ */ (0, h.jsx)("th", {
|
|
478
|
+
style: {
|
|
479
|
+
padding: "8px",
|
|
480
|
+
width: "80px",
|
|
481
|
+
textAlign: "right"
|
|
482
|
+
},
|
|
483
|
+
children: "Actions"
|
|
484
|
+
})
|
|
485
|
+
]
|
|
486
|
+
}) }), /* @__PURE__ */ (0, h.jsx)("tbody", { children: i.map((e) => /* @__PURE__ */ (0, h.jsxs)("tr", {
|
|
487
|
+
style: { borderBottom: `1px solid ${d.borderSubtle}` },
|
|
488
|
+
children: [
|
|
489
|
+
/* @__PURE__ */ (0, h.jsx)("td", {
|
|
490
|
+
style: {
|
|
491
|
+
padding: "8px",
|
|
492
|
+
fontWeight: 600,
|
|
493
|
+
color: d.methodGet,
|
|
494
|
+
fontFamily: "monospace",
|
|
495
|
+
wordBreak: "break-all"
|
|
496
|
+
},
|
|
497
|
+
children: e.key
|
|
498
|
+
}),
|
|
499
|
+
/* @__PURE__ */ (0, h.jsx)("td", {
|
|
500
|
+
style: { padding: "8px" },
|
|
501
|
+
children: o === e.key ? /* @__PURE__ */ (0, h.jsx)("input", {
|
|
502
|
+
value: m,
|
|
503
|
+
onChange: (e) => g(e.target.value),
|
|
504
|
+
style: {
|
|
505
|
+
width: "100%",
|
|
506
|
+
background: d.bg,
|
|
507
|
+
color: d.textPrimary,
|
|
508
|
+
border: `1px solid ${d.accent}`,
|
|
509
|
+
borderRadius: "4px",
|
|
510
|
+
padding: "3px 6px",
|
|
511
|
+
fontSize: "11px",
|
|
512
|
+
outline: "none"
|
|
513
|
+
}
|
|
514
|
+
}) : /* @__PURE__ */ (0, h.jsx)("span", {
|
|
515
|
+
style: {
|
|
516
|
+
wordBreak: "break-all",
|
|
517
|
+
fontFamily: "monospace",
|
|
518
|
+
color: d.textSecondary
|
|
519
|
+
},
|
|
520
|
+
children: e.value
|
|
521
|
+
})
|
|
522
|
+
}),
|
|
523
|
+
/* @__PURE__ */ (0, h.jsxs)("td", {
|
|
524
|
+
style: {
|
|
525
|
+
padding: "8px",
|
|
526
|
+
textAlign: "right"
|
|
527
|
+
},
|
|
528
|
+
children: [o === e.key ? /* @__PURE__ */ (0, h.jsx)("button", {
|
|
529
|
+
onClick: () => v(e.key),
|
|
530
|
+
style: {
|
|
531
|
+
color: d.success,
|
|
532
|
+
background: "none",
|
|
533
|
+
border: "none",
|
|
534
|
+
cursor: "pointer",
|
|
535
|
+
fontWeight: 600,
|
|
536
|
+
marginRight: "6px"
|
|
537
|
+
},
|
|
538
|
+
children: "Save"
|
|
539
|
+
}) : /* @__PURE__ */ (0, h.jsx)("button", {
|
|
540
|
+
onClick: () => {
|
|
541
|
+
p(e.key), g(e.value);
|
|
542
|
+
},
|
|
543
|
+
style: {
|
|
544
|
+
color: d.warning,
|
|
545
|
+
background: "none",
|
|
546
|
+
border: "none",
|
|
547
|
+
cursor: "pointer",
|
|
548
|
+
marginRight: "6px"
|
|
549
|
+
},
|
|
550
|
+
children: "Edit"
|
|
551
|
+
}), /* @__PURE__ */ (0, h.jsx)("button", {
|
|
552
|
+
onClick: () => y(e.key),
|
|
553
|
+
style: {
|
|
554
|
+
color: d.danger,
|
|
555
|
+
background: "none",
|
|
556
|
+
border: "none",
|
|
557
|
+
cursor: "pointer"
|
|
558
|
+
},
|
|
559
|
+
children: "Del"
|
|
560
|
+
})]
|
|
561
|
+
})
|
|
562
|
+
]
|
|
563
|
+
}, e.key)) })]
|
|
564
|
+
})
|
|
565
|
+
})]
|
|
566
|
+
});
|
|
567
|
+
}, _ = ({ logs: n = [], onClear: r }) => {
|
|
568
|
+
let [i, o] = t(""), [s, c] = t("ALL"), [l, u] = t(a.isOffline), [p, m] = t(a.delayMs), [g, _] = t(null);
|
|
569
|
+
e(() => {
|
|
570
|
+
f();
|
|
571
|
+
}, []);
|
|
572
|
+
let v = () => {
|
|
573
|
+
let e = !l;
|
|
574
|
+
u(e), a.isOffline = e;
|
|
575
|
+
}, y = (e) => {
|
|
576
|
+
m(e), a.delayMs = e;
|
|
577
|
+
}, b = n.filter((e) => {
|
|
578
|
+
if (!e || !e.url) return !1;
|
|
579
|
+
let t = e.url.toLowerCase().includes((i || "").toLowerCase()), n = s === "ALL" || e.method === s;
|
|
580
|
+
return t && n;
|
|
581
|
+
}), x = (e) => {
|
|
582
|
+
let t = `curl -X ${e.method} "${e.url}"`;
|
|
583
|
+
navigator.clipboard.writeText(t), _(e.id), setTimeout(() => _(null), 1500);
|
|
584
|
+
}, S = (e) => {
|
|
585
|
+
switch (e?.toUpperCase()) {
|
|
586
|
+
case "GET": return d.methodGet;
|
|
587
|
+
case "POST": return d.methodPost;
|
|
588
|
+
case "PUT": return d.methodPut;
|
|
589
|
+
case "DELETE": return d.methodDelete;
|
|
590
|
+
default: return d.textPrimary;
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
return /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
594
|
+
style: {
|
|
595
|
+
display: "flex",
|
|
596
|
+
flexDirection: "column",
|
|
597
|
+
gap: "10px",
|
|
598
|
+
height: "100%"
|
|
599
|
+
},
|
|
600
|
+
children: [
|
|
601
|
+
/* @__PURE__ */ (0, h.jsxs)("div", {
|
|
341
602
|
style: {
|
|
342
|
-
|
|
343
|
-
|
|
603
|
+
display: "flex",
|
|
604
|
+
alignItems: "center",
|
|
605
|
+
justifyContent: "space-between",
|
|
606
|
+
background: d.cardBg,
|
|
607
|
+
padding: "8px 10px",
|
|
608
|
+
borderRadius: "6px",
|
|
609
|
+
fontSize: "11px",
|
|
610
|
+
border: `1px solid ${d.borderSubtle}`,
|
|
611
|
+
flexShrink: 0
|
|
344
612
|
},
|
|
345
|
-
children:
|
|
613
|
+
children: [/* @__PURE__ */ (0, h.jsxs)("label", {
|
|
346
614
|
style: {
|
|
347
|
-
|
|
348
|
-
|
|
615
|
+
display: "flex",
|
|
616
|
+
alignItems: "center",
|
|
617
|
+
gap: "6px",
|
|
618
|
+
cursor: "pointer",
|
|
619
|
+
color: l ? d.danger : d.textSecondary,
|
|
620
|
+
fontWeight: 500
|
|
349
621
|
},
|
|
350
|
-
children:
|
|
351
|
-
|
|
622
|
+
children: [/* @__PURE__ */ (0, h.jsx)("input", {
|
|
623
|
+
type: "checkbox",
|
|
624
|
+
checked: l,
|
|
625
|
+
onChange: v,
|
|
626
|
+
style: { accentColor: d.danger }
|
|
627
|
+
}), "Offline Mode"]
|
|
628
|
+
}), /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
352
629
|
style: {
|
|
353
630
|
display: "flex",
|
|
354
|
-
justifyContent: "space-between",
|
|
355
631
|
alignItems: "center",
|
|
356
|
-
|
|
357
|
-
borderBottom: "1px solid #1e293b",
|
|
358
|
-
fontSize: "11px"
|
|
632
|
+
gap: "6px"
|
|
359
633
|
},
|
|
360
|
-
children: [/* @__PURE__ */ (0,
|
|
634
|
+
children: [/* @__PURE__ */ (0, h.jsx)("span", {
|
|
635
|
+
style: { color: d.textSecondary },
|
|
636
|
+
children: "Delay:"
|
|
637
|
+
}), /* @__PURE__ */ (0, h.jsxs)("select", {
|
|
638
|
+
value: p,
|
|
639
|
+
onChange: (e) => y(Number(e.target.value)),
|
|
361
640
|
style: {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
641
|
+
background: d.bg,
|
|
642
|
+
color: d.textPrimary,
|
|
643
|
+
border: `1px solid ${d.border}`,
|
|
644
|
+
borderRadius: "4px",
|
|
645
|
+
padding: "2px 6px",
|
|
646
|
+
fontSize: "11px",
|
|
647
|
+
outline: "none",
|
|
648
|
+
cursor: "pointer"
|
|
366
649
|
},
|
|
367
650
|
children: [
|
|
368
|
-
/* @__PURE__ */ (0,
|
|
369
|
-
|
|
370
|
-
children:
|
|
651
|
+
/* @__PURE__ */ (0, h.jsx)("option", {
|
|
652
|
+
value: 0,
|
|
653
|
+
children: "None (0ms)"
|
|
654
|
+
}),
|
|
655
|
+
/* @__PURE__ */ (0, h.jsx)("option", {
|
|
656
|
+
value: 500,
|
|
657
|
+
children: "Fast 3G (500ms)"
|
|
371
658
|
}),
|
|
372
|
-
|
|
373
|
-
|
|
659
|
+
/* @__PURE__ */ (0, h.jsx)("option", {
|
|
660
|
+
value: 2e3,
|
|
661
|
+
children: "Slow 3G (2s)"
|
|
662
|
+
})
|
|
374
663
|
]
|
|
375
|
-
})
|
|
376
|
-
|
|
664
|
+
})]
|
|
665
|
+
})]
|
|
666
|
+
}),
|
|
667
|
+
/* @__PURE__ */ (0, h.jsxs)("div", {
|
|
668
|
+
style: {
|
|
669
|
+
display: "flex",
|
|
670
|
+
gap: "8px",
|
|
671
|
+
flexShrink: 0,
|
|
672
|
+
alignItems: "center"
|
|
673
|
+
},
|
|
674
|
+
children: [
|
|
675
|
+
/* @__PURE__ */ (0, h.jsx)("input", {
|
|
676
|
+
type: "text",
|
|
677
|
+
placeholder: "Filter URL...",
|
|
678
|
+
value: i,
|
|
679
|
+
onChange: (e) => o(e.target.value),
|
|
377
680
|
style: {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
borderRadius: "
|
|
383
|
-
|
|
681
|
+
flex: 1,
|
|
682
|
+
background: d.cardBg,
|
|
683
|
+
color: d.textPrimary,
|
|
684
|
+
border: `1px solid ${d.border}`,
|
|
685
|
+
borderRadius: "6px",
|
|
686
|
+
padding: "6px 10px",
|
|
687
|
+
fontSize: "12px",
|
|
688
|
+
outline: "none"
|
|
689
|
+
}
|
|
690
|
+
}),
|
|
691
|
+
/* @__PURE__ */ (0, h.jsxs)("select", {
|
|
692
|
+
value: s,
|
|
693
|
+
onChange: (e) => c(e.target.value),
|
|
694
|
+
style: {
|
|
695
|
+
background: d.cardBg,
|
|
696
|
+
color: d.textPrimary,
|
|
697
|
+
border: `1px solid ${d.border}`,
|
|
698
|
+
borderRadius: "6px",
|
|
699
|
+
padding: "6px 8px",
|
|
700
|
+
fontSize: "12px",
|
|
701
|
+
outline: "none",
|
|
384
702
|
cursor: "pointer"
|
|
385
703
|
},
|
|
386
|
-
children:
|
|
387
|
-
|
|
388
|
-
|
|
704
|
+
children: [
|
|
705
|
+
/* @__PURE__ */ (0, h.jsx)("option", {
|
|
706
|
+
value: "ALL",
|
|
707
|
+
children: "ALL"
|
|
708
|
+
}),
|
|
709
|
+
/* @__PURE__ */ (0, h.jsx)("option", {
|
|
710
|
+
value: "GET",
|
|
711
|
+
children: "GET"
|
|
712
|
+
}),
|
|
713
|
+
/* @__PURE__ */ (0, h.jsx)("option", {
|
|
714
|
+
value: "POST",
|
|
715
|
+
children: "POST"
|
|
716
|
+
}),
|
|
717
|
+
/* @__PURE__ */ (0, h.jsx)("option", {
|
|
718
|
+
value: "PUT",
|
|
719
|
+
children: "PUT"
|
|
720
|
+
}),
|
|
721
|
+
/* @__PURE__ */ (0, h.jsx)("option", {
|
|
722
|
+
value: "DELETE",
|
|
723
|
+
children: "DELETE"
|
|
724
|
+
})
|
|
725
|
+
]
|
|
726
|
+
}),
|
|
727
|
+
r && /* @__PURE__ */ (0, h.jsx)("button", {
|
|
728
|
+
onClick: r,
|
|
729
|
+
title: "Clear request history",
|
|
730
|
+
style: {
|
|
731
|
+
padding: "6px 10px",
|
|
732
|
+
fontSize: "11px",
|
|
733
|
+
background: d.cardBg,
|
|
734
|
+
color: d.textSecondary,
|
|
735
|
+
border: `1px solid ${d.border}`,
|
|
736
|
+
borderRadius: "6px",
|
|
737
|
+
cursor: "pointer",
|
|
738
|
+
fontWeight: 600
|
|
739
|
+
},
|
|
740
|
+
children: "Clear"
|
|
741
|
+
})
|
|
742
|
+
]
|
|
743
|
+
}),
|
|
744
|
+
/* @__PURE__ */ (0, h.jsx)("div", {
|
|
745
|
+
className: "dev-companion-scroll",
|
|
746
|
+
style: {
|
|
747
|
+
flex: 1,
|
|
748
|
+
overflowY: "auto",
|
|
749
|
+
display: "flex",
|
|
750
|
+
flexDirection: "column",
|
|
751
|
+
gap: "4px",
|
|
752
|
+
paddingRight: "2px"
|
|
753
|
+
},
|
|
754
|
+
children: b.length === 0 ? /* @__PURE__ */ (0, h.jsx)("p", {
|
|
755
|
+
style: {
|
|
756
|
+
color: d.textSecondary,
|
|
757
|
+
fontSize: "12px",
|
|
758
|
+
textAlign: "center",
|
|
759
|
+
marginTop: "24px"
|
|
760
|
+
},
|
|
761
|
+
children: "No requests captured."
|
|
762
|
+
}) : b.map((e) => {
|
|
763
|
+
let t = !e.status || e.status >= 400 ? d.danger : d.success;
|
|
764
|
+
return /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
765
|
+
style: {
|
|
766
|
+
display: "flex",
|
|
767
|
+
alignItems: "center",
|
|
768
|
+
justifyContent: "space-between",
|
|
769
|
+
padding: "8px 10px",
|
|
770
|
+
background: d.cardBg,
|
|
771
|
+
borderRadius: "6px",
|
|
772
|
+
border: `1px solid ${d.borderSubtle}`,
|
|
773
|
+
fontSize: "12px",
|
|
774
|
+
flexShrink: 0
|
|
775
|
+
},
|
|
776
|
+
children: [/* @__PURE__ */ (0, h.jsxs)("div", {
|
|
777
|
+
style: {
|
|
778
|
+
display: "flex",
|
|
779
|
+
alignItems: "center",
|
|
780
|
+
gap: "8px",
|
|
781
|
+
overflow: "hidden"
|
|
782
|
+
},
|
|
783
|
+
children: [/* @__PURE__ */ (0, h.jsx)("span", {
|
|
784
|
+
style: {
|
|
785
|
+
fontWeight: 700,
|
|
786
|
+
color: S(e.method),
|
|
787
|
+
fontSize: "11px",
|
|
788
|
+
background: d.bg,
|
|
789
|
+
padding: "2px 6px",
|
|
790
|
+
borderRadius: "4px",
|
|
791
|
+
border: `1px solid ${d.border}`,
|
|
792
|
+
minWidth: "45px",
|
|
793
|
+
textAlign: "center"
|
|
794
|
+
},
|
|
795
|
+
children: e.method
|
|
796
|
+
}), /* @__PURE__ */ (0, h.jsx)("span", {
|
|
797
|
+
title: e.url,
|
|
798
|
+
style: {
|
|
799
|
+
overflow: "hidden",
|
|
800
|
+
textOverflow: "ellipsis",
|
|
801
|
+
whiteSpace: "nowrap",
|
|
802
|
+
maxWidth: "170px",
|
|
803
|
+
color: d.textPrimary,
|
|
804
|
+
fontFamily: "monospace",
|
|
805
|
+
fontSize: "11px"
|
|
806
|
+
},
|
|
807
|
+
children: e.url
|
|
808
|
+
})]
|
|
809
|
+
}), /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
810
|
+
style: {
|
|
811
|
+
display: "flex",
|
|
812
|
+
alignItems: "center",
|
|
813
|
+
gap: "8px",
|
|
814
|
+
flexShrink: 0
|
|
815
|
+
},
|
|
816
|
+
children: [
|
|
817
|
+
e.duration !== void 0 && /* @__PURE__ */ (0, h.jsxs)("span", {
|
|
818
|
+
style: {
|
|
819
|
+
color: d.textSecondary,
|
|
820
|
+
fontSize: "10px",
|
|
821
|
+
fontFamily: "monospace"
|
|
822
|
+
},
|
|
823
|
+
children: [e.duration, "ms"]
|
|
824
|
+
}),
|
|
825
|
+
/* @__PURE__ */ (0, h.jsx)("span", {
|
|
826
|
+
style: {
|
|
827
|
+
color: t,
|
|
828
|
+
fontWeight: 700,
|
|
829
|
+
fontSize: "11px",
|
|
830
|
+
background: `${t}15`,
|
|
831
|
+
padding: "2px 6px",
|
|
832
|
+
borderRadius: "4px"
|
|
833
|
+
},
|
|
834
|
+
children: e.status || "ERR"
|
|
835
|
+
}),
|
|
836
|
+
/* @__PURE__ */ (0, h.jsx)("button", {
|
|
837
|
+
onClick: () => x(e),
|
|
838
|
+
title: "Copy cURL",
|
|
839
|
+
style: {
|
|
840
|
+
background: g === e.id ? d.success : d.hoverBg,
|
|
841
|
+
color: g === e.id ? "#000" : d.textPrimary,
|
|
842
|
+
border: "none",
|
|
843
|
+
borderRadius: "4px",
|
|
844
|
+
padding: "3px 8px",
|
|
845
|
+
fontSize: "10px",
|
|
846
|
+
fontWeight: 600,
|
|
847
|
+
cursor: "pointer",
|
|
848
|
+
transition: "all 0.15s ease"
|
|
849
|
+
},
|
|
850
|
+
children: g === e.id ? "Copied!" : "cURL"
|
|
851
|
+
})
|
|
852
|
+
]
|
|
853
|
+
})]
|
|
854
|
+
}, e.id);
|
|
855
|
+
})
|
|
389
856
|
})
|
|
390
857
|
]
|
|
391
858
|
});
|
|
392
|
-
},
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
859
|
+
}, v = (t, n) => {
|
|
860
|
+
e(() => {
|
|
861
|
+
let e = (e) => {
|
|
862
|
+
let r = !t.ctrlOrCmd || e.metaKey || e.ctrlKey, i = !t.shift || e.shiftKey, a = e.key.toLowerCase() === t.key.toLowerCase();
|
|
863
|
+
r && i && a && (e.preventDefault(), n());
|
|
864
|
+
};
|
|
865
|
+
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
866
|
+
}, [t, n]);
|
|
867
|
+
}, y = ({ position: n = "bottom-right" }) => {
|
|
868
|
+
let [r, i] = t(!1), [a, s] = t("network"), [c, l] = t([]);
|
|
869
|
+
e(() => {
|
|
870
|
+
f();
|
|
871
|
+
}, []), v({
|
|
872
|
+
key: "d",
|
|
873
|
+
ctrlOrCmd: !0,
|
|
874
|
+
shift: !0
|
|
875
|
+
}, () => {
|
|
876
|
+
i((e) => !e);
|
|
877
|
+
}), e(() => {
|
|
878
|
+
o((e) => {
|
|
879
|
+
l((t) => [e, ...t]);
|
|
397
880
|
});
|
|
398
|
-
}, [])
|
|
881
|
+
}, []);
|
|
882
|
+
let u = (() => {
|
|
883
|
+
switch (n) {
|
|
884
|
+
case "bottom-left": return {
|
|
885
|
+
bottom: 16,
|
|
886
|
+
left: 16
|
|
887
|
+
};
|
|
888
|
+
case "top-right": return {
|
|
889
|
+
top: 16,
|
|
890
|
+
right: 16
|
|
891
|
+
};
|
|
892
|
+
case "top-left": return {
|
|
893
|
+
top: 16,
|
|
894
|
+
left: 16
|
|
895
|
+
};
|
|
896
|
+
default: return {
|
|
897
|
+
bottom: 16,
|
|
898
|
+
right: 16
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
})();
|
|
902
|
+
return /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
399
903
|
style: {
|
|
400
904
|
position: "fixed",
|
|
401
|
-
|
|
402
|
-
right: 16,
|
|
905
|
+
...u,
|
|
403
906
|
zIndex: 99999,
|
|
404
|
-
fontFamily: "sans-serif"
|
|
907
|
+
fontFamily: "system-ui, -apple-system, sans-serif"
|
|
405
908
|
},
|
|
406
|
-
children: [/* @__PURE__ */ (0,
|
|
407
|
-
onClick: () =>
|
|
909
|
+
children: [/* @__PURE__ */ (0, h.jsxs)("button", {
|
|
910
|
+
onClick: () => i(!r),
|
|
911
|
+
title: "Shortcut: Ctrl + Shift + D",
|
|
408
912
|
style: {
|
|
409
|
-
background:
|
|
410
|
-
color:
|
|
411
|
-
border:
|
|
412
|
-
padding: "
|
|
413
|
-
borderRadius: "
|
|
913
|
+
background: d.bg,
|
|
914
|
+
color: d.textPrimary,
|
|
915
|
+
border: `1px solid ${d.border}`,
|
|
916
|
+
padding: "8px 14px",
|
|
917
|
+
borderRadius: "20px",
|
|
414
918
|
cursor: "pointer",
|
|
415
|
-
fontWeight:
|
|
416
|
-
|
|
919
|
+
fontWeight: 600,
|
|
920
|
+
fontSize: "12px",
|
|
921
|
+
display: "flex",
|
|
922
|
+
alignItems: "center",
|
|
923
|
+
gap: "8px",
|
|
924
|
+
boxShadow: "0 4px 20px rgba(0,0,0,0.35)",
|
|
925
|
+
transition: "transform 0.15s ease"
|
|
417
926
|
},
|
|
418
927
|
children: [
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
928
|
+
/* @__PURE__ */ (0, h.jsx)("span", {
|
|
929
|
+
style: { color: d.accent },
|
|
930
|
+
children: "⚡"
|
|
931
|
+
}),
|
|
932
|
+
" DevCompanion",
|
|
933
|
+
c.length > 0 && /* @__PURE__ */ (0, h.jsx)("span", {
|
|
934
|
+
style: {
|
|
935
|
+
background: d.accent,
|
|
936
|
+
color: "#fff",
|
|
937
|
+
fontSize: "10px",
|
|
938
|
+
padding: "2px 6px",
|
|
939
|
+
borderRadius: "10px",
|
|
940
|
+
fontWeight: 700
|
|
941
|
+
},
|
|
942
|
+
children: c.length
|
|
943
|
+
})
|
|
422
944
|
]
|
|
423
|
-
}),
|
|
945
|
+
}), r && /* @__PURE__ */ (0, h.jsxs)("div", {
|
|
946
|
+
className: "dev-companion-panel-animate",
|
|
424
947
|
style: {
|
|
425
948
|
position: "absolute",
|
|
426
|
-
bottom: 50,
|
|
427
|
-
right: 0,
|
|
428
|
-
width:
|
|
429
|
-
height:
|
|
430
|
-
background:
|
|
431
|
-
color:
|
|
432
|
-
borderRadius: "
|
|
949
|
+
...u.bottom === void 0 ? { top: 50 } : { bottom: 50 },
|
|
950
|
+
...u.right === void 0 ? { left: 0 } : { right: 0 },
|
|
951
|
+
width: 440,
|
|
952
|
+
height: 400,
|
|
953
|
+
background: d.bg,
|
|
954
|
+
color: d.textPrimary,
|
|
955
|
+
borderRadius: "10px",
|
|
433
956
|
padding: "12px",
|
|
434
|
-
|
|
957
|
+
border: `1px solid ${d.border}`,
|
|
958
|
+
boxShadow: "0 12px 32px rgba(0,0,0,0.5)",
|
|
435
959
|
display: "flex",
|
|
436
960
|
flexDirection: "column"
|
|
437
961
|
},
|
|
438
|
-
children: [/* @__PURE__ */ (0,
|
|
962
|
+
children: [/* @__PURE__ */ (0, h.jsxs)("div", {
|
|
439
963
|
style: {
|
|
440
964
|
display: "flex",
|
|
441
|
-
|
|
442
|
-
|
|
965
|
+
justifyContent: "space-between",
|
|
966
|
+
alignItems: "center",
|
|
967
|
+
borderBottom: `1px solid ${d.border}`,
|
|
443
968
|
paddingBottom: "8px",
|
|
444
|
-
marginBottom: "
|
|
969
|
+
marginBottom: "10px"
|
|
445
970
|
},
|
|
446
|
-
children: [/* @__PURE__ */ (0,
|
|
447
|
-
onClick: () => o("network"),
|
|
971
|
+
children: [/* @__PURE__ */ (0, h.jsxs)("div", {
|
|
448
972
|
style: {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
border: "none",
|
|
452
|
-
padding: "6px 12px",
|
|
453
|
-
borderRadius: "4px",
|
|
454
|
-
fontSize: "12px",
|
|
455
|
-
fontWeight: "bold",
|
|
456
|
-
cursor: "pointer"
|
|
973
|
+
display: "flex",
|
|
974
|
+
gap: "6px"
|
|
457
975
|
},
|
|
458
|
-
children: "
|
|
459
|
-
|
|
460
|
-
|
|
976
|
+
children: [/* @__PURE__ */ (0, h.jsx)("button", {
|
|
977
|
+
onClick: () => s("network"),
|
|
978
|
+
style: {
|
|
979
|
+
background: a === "network" ? d.accent : "transparent",
|
|
980
|
+
color: a === "network" ? "#fff" : d.textSecondary,
|
|
981
|
+
border: "none",
|
|
982
|
+
padding: "5px 12px",
|
|
983
|
+
borderRadius: "6px",
|
|
984
|
+
fontSize: "12px",
|
|
985
|
+
fontWeight: 600,
|
|
986
|
+
cursor: "pointer",
|
|
987
|
+
transition: "all 0.15s ease"
|
|
988
|
+
},
|
|
989
|
+
children: "Network"
|
|
990
|
+
}), /* @__PURE__ */ (0, h.jsx)("button", {
|
|
991
|
+
onClick: () => s("storage"),
|
|
992
|
+
style: {
|
|
993
|
+
background: a === "storage" ? d.accent : "transparent",
|
|
994
|
+
color: a === "storage" ? "#fff" : d.textSecondary,
|
|
995
|
+
border: "none",
|
|
996
|
+
padding: "5px 12px",
|
|
997
|
+
borderRadius: "6px",
|
|
998
|
+
fontSize: "12px",
|
|
999
|
+
fontWeight: 600,
|
|
1000
|
+
cursor: "pointer",
|
|
1001
|
+
transition: "all 0.15s ease"
|
|
1002
|
+
},
|
|
1003
|
+
children: "Storage"
|
|
1004
|
+
})]
|
|
1005
|
+
}), /* @__PURE__ */ (0, h.jsx)("span", {
|
|
461
1006
|
style: {
|
|
462
|
-
|
|
463
|
-
color:
|
|
464
|
-
|
|
465
|
-
padding: "6px 12px",
|
|
466
|
-
borderRadius: "4px",
|
|
467
|
-
fontSize: "12px",
|
|
468
|
-
fontWeight: "bold",
|
|
469
|
-
cursor: "pointer"
|
|
1007
|
+
fontSize: "10px",
|
|
1008
|
+
color: d.textSecondary,
|
|
1009
|
+
fontFamily: "monospace"
|
|
470
1010
|
},
|
|
471
|
-
children: "
|
|
1011
|
+
children: "Ctrl+Shift+D"
|
|
472
1012
|
})]
|
|
473
|
-
}),
|
|
1013
|
+
}), /* @__PURE__ */ (0, h.jsx)("div", {
|
|
474
1014
|
style: {
|
|
475
1015
|
flex: 1,
|
|
476
|
-
|
|
1016
|
+
overflow: "hidden"
|
|
477
1017
|
},
|
|
478
|
-
children:
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
children: "No requests captured yet."
|
|
484
|
-
}) : s.map((e) => /* @__PURE__ */ (0, f.jsxs)("div", {
|
|
485
|
-
style: {
|
|
486
|
-
display: "flex",
|
|
487
|
-
justifyContent: "space-between",
|
|
488
|
-
padding: "6px 0",
|
|
489
|
-
borderBottom: "1px solid #1e293b",
|
|
490
|
-
fontSize: "12px"
|
|
491
|
-
},
|
|
492
|
-
children: [
|
|
493
|
-
/* @__PURE__ */ (0, f.jsxs)("span", {
|
|
494
|
-
style: {
|
|
495
|
-
fontWeight: "bold",
|
|
496
|
-
color: e.method === "GET" ? "#38bdf8" : "#4ade80"
|
|
497
|
-
},
|
|
498
|
-
children: [
|
|
499
|
-
"[",
|
|
500
|
-
e.method,
|
|
501
|
-
"]"
|
|
502
|
-
]
|
|
503
|
-
}),
|
|
504
|
-
/* @__PURE__ */ (0, f.jsx)("span", {
|
|
505
|
-
style: {
|
|
506
|
-
overflow: "hidden",
|
|
507
|
-
textOverflow: "ellipsis",
|
|
508
|
-
whiteSpace: "nowrap",
|
|
509
|
-
maxWidth: "180px"
|
|
510
|
-
},
|
|
511
|
-
children: e.url
|
|
512
|
-
}),
|
|
513
|
-
/* @__PURE__ */ (0, f.jsx)("span", {
|
|
514
|
-
style: { color: e.status && e.status >= 400 ? "#f87171" : "#facc15" },
|
|
515
|
-
children: e.status || "PENDING"
|
|
516
|
-
})
|
|
517
|
-
]
|
|
518
|
-
}, e.id))
|
|
519
|
-
}) : /* @__PURE__ */ (0, f.jsx)(p, {})]
|
|
1018
|
+
children: a === "network" ? /* @__PURE__ */ (0, h.jsx)(_, {
|
|
1019
|
+
logs: c,
|
|
1020
|
+
onClear: () => l([])
|
|
1021
|
+
}) : /* @__PURE__ */ (0, h.jsx)(g, {})
|
|
1022
|
+
})]
|
|
520
1023
|
})]
|
|
521
1024
|
});
|
|
522
1025
|
};
|
|
523
|
-
export {
|
|
1026
|
+
export { y as DevCompanion };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const StorageTab: () => import('react').JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const theme: {
|
|
2
|
+
bg: string;
|
|
3
|
+
cardBg: string;
|
|
4
|
+
hoverBg: string;
|
|
5
|
+
border: string;
|
|
6
|
+
borderSubtle: string;
|
|
7
|
+
textPrimary: string;
|
|
8
|
+
textSecondary: string;
|
|
9
|
+
accent: string;
|
|
10
|
+
accentHover: string;
|
|
11
|
+
success: string;
|
|
12
|
+
warning: string;
|
|
13
|
+
danger: string;
|
|
14
|
+
methodGet: string;
|
|
15
|
+
methodPost: string;
|
|
16
|
+
methodPut: string;
|
|
17
|
+
methodDelete: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const injectDevCompanionStyles: () => void;
|
|
@@ -3,8 +3,13 @@ export interface NetworkLog {
|
|
|
3
3
|
url: string;
|
|
4
4
|
method: string;
|
|
5
5
|
status?: number;
|
|
6
|
+
duration?: number;
|
|
6
7
|
timestamp: string;
|
|
7
8
|
}
|
|
8
9
|
type LogCallback = (log: NetworkLog) => void;
|
|
10
|
+
export declare const networkConfig: {
|
|
11
|
+
isOffline: boolean;
|
|
12
|
+
delayMs: number;
|
|
13
|
+
};
|
|
9
14
|
export declare const initFetchInterceptor: (onLog: LogCallback) => void;
|
|
10
15
|
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { StorageItem, StorageType } from '../types/storage';
|
|
2
|
+
export declare const getCookies: () => StorageItem[];
|
|
3
|
+
export declare const setCookie: (key: string, value: string, days?: number) => void;
|
|
4
|
+
export declare const deleteCookie: (key: string) => void;
|
|
5
|
+
export declare const exportStorageJSON: (type: StorageType) => void;
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kickd0wn/react-dev-companion",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A zero-dependency DevTools overlay for React and Next.js applications.",
|
|
6
|
-
"main": "./dist/index.
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
11
12
|
"import": "./dist/index.js",
|
|
12
|
-
"require": "./dist/index.cjs"
|
|
13
|
-
"types": "./dist/index.d.ts"
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"dev": "vite",
|
|
21
21
|
"build": "tsc && vite build",
|
|
22
|
+
"playground": "npm --prefix playground run dev",
|
|
22
23
|
"prepublishOnly": "npm run build"
|
|
23
24
|
},
|
|
24
25
|
"keywords": [
|
|
@@ -50,4 +51,4 @@
|
|
|
50
51
|
"vite": "^8.3.6",
|
|
51
52
|
"vite-plugin-dts": "^5.1.2"
|
|
52
53
|
}
|
|
53
|
-
}
|
|
54
|
+
}
|