@kickd0wn/react-dev-companion 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +137 -3
- package/dist/index.cjs +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +523 -0
- package/dist/src/components/DevCompanion.d.ts +2 -0
- package/dist/src/components/StorageInspector.d.ts +2 -0
- package/dist/src/core/fetchInterceptor.d.ts +10 -0
- package/dist/src/core/storageManager.d.ts +10 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/vite.config.d.ts +2 -0
- package/package.json +53 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 KickDown
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,137 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# React Dev Companion
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
React Dev Companion is an embeddable, zero-dependency developer tools panel for React and Next.js applications. It intercepts outgoing network requests in real-time, inspects runtime environments, and provides client-side visibility during development without relying on browser extensions.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- **Real-Time API Interception:** Monitors outgoing `window.fetch` calls and logs HTTP methods, request status, and target URLs.
|
|
15
|
+
- **Storage Inspector:** View, inject, and delete keys across `localStorage`, `sessionStorage`, and `cookies` in real time.
|
|
16
|
+
- **Framework Agnostic Support:** Compatible with React SPA setups (Vite, CRA) and SSR frameworks (Next.js client components).
|
|
17
|
+
- **Non-Intrusive Overlay:** Floating UI widget designed to stay out of the way of primary application elements.
|
|
18
|
+
- **Zero Heavy Dependencies:** Lightweight footprint focused on developer experience and minimal bundle impact.
|
|
19
|
+
- **TypeScript Native:** Fully typed with built-in `.d.ts` declarations.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
Install the package via `npm`, `yarn`, or `pnpm`:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @kickd0wn/react-dev-companion
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Or using yarn:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
yarn add @kickd0wn/react-dev-companion
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Or using pnpm:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pnpm add @kickd0wn/react-dev-companion
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
Import and render the component within your application tree. It is recommended to load the component conditionally in development environments.
|
|
48
|
+
|
|
49
|
+
### Next.js (App Router / Client Component)
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
'use client';
|
|
53
|
+
|
|
54
|
+
import { DevCompanion } from '@kickd0wn/react-dev-companion';
|
|
55
|
+
|
|
56
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
57
|
+
return (
|
|
58
|
+
<html lang="en">
|
|
59
|
+
<body>
|
|
60
|
+
{children}
|
|
61
|
+
{process.env.NODE_ENV === 'development' && <DevCompanion />}
|
|
62
|
+
</body>
|
|
63
|
+
</html>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Vite / Standard React SPA
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
import React from 'react';
|
|
72
|
+
import { DevCompanion } from '@kickd0wn/react-dev-companion';
|
|
73
|
+
|
|
74
|
+
export function App() {
|
|
75
|
+
return (
|
|
76
|
+
<div>
|
|
77
|
+
<MainContent />
|
|
78
|
+
{import.meta.env.DEV && <DevCompanion />}
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## API Reference
|
|
87
|
+
|
|
88
|
+
### `<DevCompanion />`
|
|
89
|
+
|
|
90
|
+
| Prop | Type | Default | Description |
|
|
91
|
+
| :--- | :--- | :--- | :--- |
|
|
92
|
+
| `position` | `'bottom-right' \| 'bottom-left'` | `'bottom-right'` | Position of the floating overlay trigger. |
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Architecture Overview
|
|
97
|
+
|
|
98
|
+
React DevCompanion hooks into the global `window.fetch` object upon mounting, wrapping original request handlers with event emitters. Captured metrics are streamed directly into an isolated local state container to ensure application state remains completely decoupled from devtools inspection logic.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Contributing
|
|
103
|
+
|
|
104
|
+
Contributions are welcome. Please read our guidelines below before submitting a Pull Request.
|
|
105
|
+
|
|
106
|
+
### Development Workflow
|
|
107
|
+
|
|
108
|
+
1. Fork and clone the repository:
|
|
109
|
+
```bash
|
|
110
|
+
git clone https://github.com/Kickz1nn/react-dev-companion.git
|
|
111
|
+
cd react-dev-companion
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
2. Install dependencies:
|
|
115
|
+
```bash
|
|
116
|
+
npm install
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
3. Run local build checks:
|
|
120
|
+
```bash
|
|
121
|
+
npm run build
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Commit Guidelines
|
|
125
|
+
|
|
126
|
+
This project enforces [Conventional Commits](https://www.conventionalcommits.org/). Commits are verified locally using Husky and Commitlint prior to stage completion.
|
|
127
|
+
|
|
128
|
+
Example commit formats:
|
|
129
|
+
- `feat: add localStorage inspection tab`
|
|
130
|
+
- `fix: handle fetch network failure edge case`
|
|
131
|
+
- `docs: update setup guide in README`
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## License
|
|
136
|
+
|
|
137
|
+
Distributed under the MIT License. See `LICENSE` for more information.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
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[r,i]=n,a=typeof r==`string`?r:r instanceof Request?r.url:String(r),o=i?.method||`GET`,s={id:Math.random().toString(36).substring(2,9),url:a,method:o.toUpperCase(),timestamp:new Date().toLocaleTimeString()};try{let r=await t(...n);return s.status=r.status,e(s),r}catch(t){throw s.status=0,e(s),t}}},d=()=>{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n&&e.push({key:n,value:localStorage.getItem(n)||``,type:`local`})}return e},f=()=>{let e=[];for(let t=0;t<sessionStorage.length;t++){let n=sessionStorage.key(t);n&&e.push({key:n,value:sessionStorage.getItem(n)||``,type:`session`})}return e},p=()=>document.cookie?document.cookie.split(`; `).map(e=>{let[t,...n]=e.split(`=`);return{key:t.trim(),value:decodeURIComponent(n.join(`=`)),type:`cookie`}}):[],m=(e,t)=>{t===`local`?localStorage.removeItem(e):t===`session`?sessionStorage.removeItem(e):t===`cookie`&&(document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`)},h=(e,t,n)=>{n===`local`?localStorage.setItem(e,t):n===`session`?sessionStorage.setItem(e,t):n===`cookie`&&(document.cookie=`${e}=${encodeURIComponent(t)}; path=/;`)},g=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})),_=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
|
+
let props = %s;
|
|
3
|
+
<%s {...props} />
|
|
4
|
+
React keys must be passed directly to JSX without using spread:
|
|
5
|
+
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,{})]})]})}});
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
import { useEffect as e, useState as t } from "react";
|
|
2
|
+
// \0rolldown/runtime.js
|
|
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
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
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 = (e) => {
|
|
7
|
+
let t = window.fetch;
|
|
8
|
+
window.fetch = async (...n) => {
|
|
9
|
+
let [r, i] = n, a = typeof r == "string" ? r : r instanceof Request ? r.url : String(r), o = i?.method || "GET", s = {
|
|
10
|
+
id: Math.random().toString(36).substring(2, 9),
|
|
11
|
+
url: a,
|
|
12
|
+
method: o.toUpperCase(),
|
|
13
|
+
timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString()
|
|
14
|
+
};
|
|
15
|
+
try {
|
|
16
|
+
let r = await t(...n);
|
|
17
|
+
return s.status = r.status, e(s), r;
|
|
18
|
+
} catch (t) {
|
|
19
|
+
throw s.status = 0, e(s), t;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}, a = () => {
|
|
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) => {
|
|
45
|
+
let [t, ...n] = e.split("=");
|
|
46
|
+
return {
|
|
47
|
+
key: t.trim(),
|
|
48
|
+
value: decodeURIComponent(n.join("=")),
|
|
49
|
+
type: "cookie"
|
|
50
|
+
};
|
|
51
|
+
}) : [], c = (e, t) => {
|
|
52
|
+
t === "local" ? localStorage.removeItem(e) : t === "session" ? sessionStorage.removeItem(e) : t === "cookie" && (document.cookie = `${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`);
|
|
53
|
+
}, l = (e, t, n) => {
|
|
54
|
+
n === "local" ? localStorage.setItem(e, t) : n === "session" ? sessionStorage.setItem(e, t) : n === "cookie" && (document.cookie = `${e}=${encodeURIComponent(t)}; path=/;`);
|
|
55
|
+
}, u = /* @__PURE__ */ n(((e) => {
|
|
56
|
+
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
57
|
+
function r(e, n, r) {
|
|
58
|
+
var i = null;
|
|
59
|
+
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]);
|
|
60
|
+
else r = n;
|
|
61
|
+
return n = r.ref, {
|
|
62
|
+
$$typeof: t,
|
|
63
|
+
type: e,
|
|
64
|
+
key: i,
|
|
65
|
+
ref: n === void 0 ? null : n,
|
|
66
|
+
props: r
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
70
|
+
})), d = /* @__PURE__ */ n(((e) => {
|
|
71
|
+
process.env.NODE_ENV !== "production" && (function() {
|
|
72
|
+
function t(e) {
|
|
73
|
+
if (e == null) return null;
|
|
74
|
+
if (typeof e == "function") return e.$$typeof === A ? null : e.displayName || e.name || null;
|
|
75
|
+
if (typeof e == "string") return e;
|
|
76
|
+
switch (e) {
|
|
77
|
+
case v: return "Fragment";
|
|
78
|
+
case b: return "Profiler";
|
|
79
|
+
case y: return "StrictMode";
|
|
80
|
+
case w: return "Suspense";
|
|
81
|
+
case T: return "SuspenseList";
|
|
82
|
+
case O: return "Activity";
|
|
83
|
+
case k: return "ViewTransition";
|
|
84
|
+
}
|
|
85
|
+
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) {
|
|
86
|
+
case _: return "Portal";
|
|
87
|
+
case S: return e.displayName || "Context";
|
|
88
|
+
case x: return (e._context.displayName || "Context") + ".Consumer";
|
|
89
|
+
case C:
|
|
90
|
+
var n = e.render;
|
|
91
|
+
return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
|
|
92
|
+
case E: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
|
|
93
|
+
case D:
|
|
94
|
+
n = e._payload, e = e._init;
|
|
95
|
+
try {
|
|
96
|
+
return t(e(n));
|
|
97
|
+
} catch {}
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
function n(e) {
|
|
102
|
+
return "" + e;
|
|
103
|
+
}
|
|
104
|
+
function i(e) {
|
|
105
|
+
try {
|
|
106
|
+
n(e);
|
|
107
|
+
var t = !1;
|
|
108
|
+
} catch {
|
|
109
|
+
t = !0;
|
|
110
|
+
}
|
|
111
|
+
if (t) {
|
|
112
|
+
t = console;
|
|
113
|
+
var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
114
|
+
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);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function a(e) {
|
|
118
|
+
if (e === v) return "<>";
|
|
119
|
+
if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
|
|
120
|
+
try {
|
|
121
|
+
var n = t(e);
|
|
122
|
+
return n ? "<" + n + ">" : "<...>";
|
|
123
|
+
} catch {
|
|
124
|
+
return "<...>";
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function o() {
|
|
128
|
+
var e = j.A;
|
|
129
|
+
return e === null ? null : e.getOwner();
|
|
130
|
+
}
|
|
131
|
+
function s() {
|
|
132
|
+
return Error("react-stack-top-frame");
|
|
133
|
+
}
|
|
134
|
+
function c(e) {
|
|
135
|
+
if (M.call(e, "key")) {
|
|
136
|
+
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
137
|
+
if (t && t.isReactWarning) return !1;
|
|
138
|
+
}
|
|
139
|
+
return e.key !== void 0;
|
|
140
|
+
}
|
|
141
|
+
function l(e, t) {
|
|
142
|
+
function n() {
|
|
143
|
+
F || (F = !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));
|
|
144
|
+
}
|
|
145
|
+
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
146
|
+
get: n,
|
|
147
|
+
configurable: !0
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
function u() {
|
|
151
|
+
var e = t(this.type);
|
|
152
|
+
return I[e] || (I[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;
|
|
153
|
+
}
|
|
154
|
+
function d(e, t, n, r, i, a) {
|
|
155
|
+
var o = n.ref;
|
|
156
|
+
return e = {
|
|
157
|
+
$$typeof: g,
|
|
158
|
+
type: e,
|
|
159
|
+
key: t,
|
|
160
|
+
props: n,
|
|
161
|
+
_owner: r
|
|
162
|
+
}, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
|
|
163
|
+
enumerable: !1,
|
|
164
|
+
value: null
|
|
165
|
+
}) : Object.defineProperty(e, "ref", {
|
|
166
|
+
enumerable: !1,
|
|
167
|
+
get: u
|
|
168
|
+
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
169
|
+
configurable: !1,
|
|
170
|
+
enumerable: !1,
|
|
171
|
+
writable: !0,
|
|
172
|
+
value: 0
|
|
173
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
174
|
+
configurable: !1,
|
|
175
|
+
enumerable: !1,
|
|
176
|
+
writable: !0,
|
|
177
|
+
value: null
|
|
178
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
179
|
+
configurable: !1,
|
|
180
|
+
enumerable: !1,
|
|
181
|
+
writable: !0,
|
|
182
|
+
value: i
|
|
183
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
184
|
+
configurable: !1,
|
|
185
|
+
enumerable: !1,
|
|
186
|
+
writable: !0,
|
|
187
|
+
value: a
|
|
188
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
189
|
+
}
|
|
190
|
+
function f(e, n, r, a, s, u) {
|
|
191
|
+
var f = n.children;
|
|
192
|
+
if (f !== void 0) {
|
|
193
|
+
if (a) {
|
|
194
|
+
if (N(f)) {
|
|
195
|
+
for (a = 0; a < f.length; a++) p(f[a]);
|
|
196
|
+
Object.freeze && Object.freeze(f);
|
|
197
|
+
} 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.");
|
|
198
|
+
} else p(f);
|
|
199
|
+
}
|
|
200
|
+
if (M.call(n, "key")) {
|
|
201
|
+
f = t(e);
|
|
202
|
+
var m = Object.keys(n).filter(function(e) {
|
|
203
|
+
return e !== "key";
|
|
204
|
+
});
|
|
205
|
+
a = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", z[f + a] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", a, f, m, f), z[f + a] = !0);
|
|
206
|
+
}
|
|
207
|
+
if (f = null, r !== void 0 && (i(r), f = "" + r), c(n) && (i(n.key), f = "" + n.key), "key" in n) for (var h in r = {}, n) h !== "key" && (r[h] = n[h]);
|
|
208
|
+
else r = n;
|
|
209
|
+
return f && l(r, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), d(e, f, r, o(), s, u);
|
|
210
|
+
}
|
|
211
|
+
function p(e) {
|
|
212
|
+
m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
213
|
+
}
|
|
214
|
+
function m(e) {
|
|
215
|
+
return typeof e == "object" && !!e && e.$$typeof === g;
|
|
216
|
+
}
|
|
217
|
+
var h = r("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.view_transition"), A = Symbol.for("react.client.reference"), j = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, N = Array.isArray, P = console.createTask ? console.createTask : function() {
|
|
218
|
+
return null;
|
|
219
|
+
};
|
|
220
|
+
h = { react_stack_bottom_frame: function(e) {
|
|
221
|
+
return e();
|
|
222
|
+
} };
|
|
223
|
+
var F, I = {}, L = h.react_stack_bottom_frame.bind(h, s)(), R = P(a(s)), z = {};
|
|
224
|
+
e.Fragment = v, e.jsx = function(e, t, n) {
|
|
225
|
+
var r = 1e4 > j.recentlyCreatedOwnerStacks++;
|
|
226
|
+
if (r) {
|
|
227
|
+
var i = Error.stackTraceLimit;
|
|
228
|
+
Error.stackTraceLimit = 10;
|
|
229
|
+
var o = Error("react-stack-top-frame");
|
|
230
|
+
Error.stackTraceLimit = i;
|
|
231
|
+
} else o = L;
|
|
232
|
+
return f(e, t, n, !1, o, r ? P(a(e)) : R);
|
|
233
|
+
}, e.jsxs = function(e, t, n) {
|
|
234
|
+
var r = 1e4 > j.recentlyCreatedOwnerStacks++;
|
|
235
|
+
if (r) {
|
|
236
|
+
var i = Error.stackTraceLimit;
|
|
237
|
+
Error.stackTraceLimit = 10;
|
|
238
|
+
var o = Error("react-stack-top-frame");
|
|
239
|
+
Error.stackTraceLimit = i;
|
|
240
|
+
} else o = L;
|
|
241
|
+
return f(e, t, n, !0, o, r ? P(a(e)) : R);
|
|
242
|
+
};
|
|
243
|
+
})();
|
|
244
|
+
})), f = (/* @__PURE__ */ n(((e, t) => {
|
|
245
|
+
t.exports = process.env.NODE_ENV === "production" ? u() : d();
|
|
246
|
+
})))(), p = () => {
|
|
247
|
+
let [n, r] = t("local"), [i, u] = t([]), [d, p] = t(""), [m, h] = t(""), g = () => {
|
|
248
|
+
n === "local" ? u(a()) : n === "session" ? u(o()) : n === "cookie" && u(s());
|
|
249
|
+
};
|
|
250
|
+
e(() => {
|
|
251
|
+
g();
|
|
252
|
+
}, [n]);
|
|
253
|
+
let _ = (e) => {
|
|
254
|
+
c(e, n), g();
|
|
255
|
+
};
|
|
256
|
+
return /* @__PURE__ */ (0, f.jsxs)("div", {
|
|
257
|
+
style: {
|
|
258
|
+
display: "flex",
|
|
259
|
+
flexDirection: "column",
|
|
260
|
+
gap: "10px"
|
|
261
|
+
},
|
|
262
|
+
children: [
|
|
263
|
+
/* @__PURE__ */ (0, f.jsx)("div", {
|
|
264
|
+
style: {
|
|
265
|
+
display: "flex",
|
|
266
|
+
gap: "6px",
|
|
267
|
+
borderBottom: "1px solid #334155",
|
|
268
|
+
paddingBottom: "6px"
|
|
269
|
+
},
|
|
270
|
+
children: [
|
|
271
|
+
"local",
|
|
272
|
+
"session",
|
|
273
|
+
"cookie"
|
|
274
|
+
].map((e) => /* @__PURE__ */ (0, f.jsx)("button", {
|
|
275
|
+
onClick: () => r(e),
|
|
276
|
+
style: {
|
|
277
|
+
background: n === e ? "#3b82f6" : "#1e293b",
|
|
278
|
+
color: "#fff",
|
|
279
|
+
border: "none",
|
|
280
|
+
padding: "4px 8px",
|
|
281
|
+
borderRadius: "4px",
|
|
282
|
+
fontSize: "11px",
|
|
283
|
+
cursor: "pointer"
|
|
284
|
+
},
|
|
285
|
+
children: e.toUpperCase()
|
|
286
|
+
}, 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
|
+
},
|
|
292
|
+
style: {
|
|
293
|
+
display: "flex",
|
|
294
|
+
gap: "4px"
|
|
295
|
+
},
|
|
296
|
+
children: [
|
|
297
|
+
/* @__PURE__ */ (0, f.jsx)("input", {
|
|
298
|
+
placeholder: "Key",
|
|
299
|
+
value: d,
|
|
300
|
+
onChange: (e) => p(e.target.value),
|
|
301
|
+
style: {
|
|
302
|
+
flex: 1,
|
|
303
|
+
padding: "4px",
|
|
304
|
+
fontSize: "11px",
|
|
305
|
+
background: "#1e293b",
|
|
306
|
+
color: "#fff",
|
|
307
|
+
border: "1px solid #334155",
|
|
308
|
+
borderRadius: "4px"
|
|
309
|
+
}
|
|
310
|
+
}),
|
|
311
|
+
/* @__PURE__ */ (0, f.jsx)("input", {
|
|
312
|
+
placeholder: "Value",
|
|
313
|
+
value: m,
|
|
314
|
+
onChange: (e) => h(e.target.value),
|
|
315
|
+
style: {
|
|
316
|
+
flex: 1,
|
|
317
|
+
padding: "4px",
|
|
318
|
+
fontSize: "11px",
|
|
319
|
+
background: "#1e293b",
|
|
320
|
+
color: "#fff",
|
|
321
|
+
border: "1px solid #334155",
|
|
322
|
+
borderRadius: "4px"
|
|
323
|
+
}
|
|
324
|
+
}),
|
|
325
|
+
/* @__PURE__ */ (0, f.jsx)("button", {
|
|
326
|
+
type: "submit",
|
|
327
|
+
style: {
|
|
328
|
+
background: "#22c55e",
|
|
329
|
+
color: "#fff",
|
|
330
|
+
border: "none",
|
|
331
|
+
padding: "4px 8px",
|
|
332
|
+
borderRadius: "4px",
|
|
333
|
+
fontSize: "11px",
|
|
334
|
+
cursor: "pointer"
|
|
335
|
+
},
|
|
336
|
+
children: "Add"
|
|
337
|
+
})
|
|
338
|
+
]
|
|
339
|
+
}),
|
|
340
|
+
/* @__PURE__ */ (0, f.jsx)("div", {
|
|
341
|
+
style: {
|
|
342
|
+
maxHeight: "180px",
|
|
343
|
+
overflowY: "auto"
|
|
344
|
+
},
|
|
345
|
+
children: i.length === 0 ? /* @__PURE__ */ (0, f.jsx)("p", {
|
|
346
|
+
style: {
|
|
347
|
+
color: "#94a3b8",
|
|
348
|
+
fontSize: "12px"
|
|
349
|
+
},
|
|
350
|
+
children: "No items found."
|
|
351
|
+
}) : i.map((e) => /* @__PURE__ */ (0, f.jsxs)("div", {
|
|
352
|
+
style: {
|
|
353
|
+
display: "flex",
|
|
354
|
+
justifyContent: "space-between",
|
|
355
|
+
alignItems: "center",
|
|
356
|
+
padding: "4px 0",
|
|
357
|
+
borderBottom: "1px solid #1e293b",
|
|
358
|
+
fontSize: "11px"
|
|
359
|
+
},
|
|
360
|
+
children: [/* @__PURE__ */ (0, f.jsxs)("div", {
|
|
361
|
+
style: {
|
|
362
|
+
overflow: "hidden",
|
|
363
|
+
textOverflow: "ellipsis",
|
|
364
|
+
whiteSpace: "nowrap",
|
|
365
|
+
maxWidth: "220px"
|
|
366
|
+
},
|
|
367
|
+
children: [
|
|
368
|
+
/* @__PURE__ */ (0, f.jsxs)("strong", {
|
|
369
|
+
style: { color: "#38bdf8" },
|
|
370
|
+
children: [e.key, ":"]
|
|
371
|
+
}),
|
|
372
|
+
" ",
|
|
373
|
+
e.value
|
|
374
|
+
]
|
|
375
|
+
}), /* @__PURE__ */ (0, f.jsx)("button", {
|
|
376
|
+
onClick: () => _(e.key),
|
|
377
|
+
style: {
|
|
378
|
+
background: "#ef4444",
|
|
379
|
+
color: "#fff",
|
|
380
|
+
border: "none",
|
|
381
|
+
padding: "2px 6px",
|
|
382
|
+
borderRadius: "4px",
|
|
383
|
+
fontSize: "10px",
|
|
384
|
+
cursor: "pointer"
|
|
385
|
+
},
|
|
386
|
+
children: "Del"
|
|
387
|
+
})]
|
|
388
|
+
}, e.key))
|
|
389
|
+
})
|
|
390
|
+
]
|
|
391
|
+
});
|
|
392
|
+
}, m = () => {
|
|
393
|
+
let [n, r] = t(!1), [a, o] = t("network"), [s, c] = t([]);
|
|
394
|
+
return e(() => {
|
|
395
|
+
i((e) => {
|
|
396
|
+
c((t) => [e, ...t]);
|
|
397
|
+
});
|
|
398
|
+
}, []), /* @__PURE__ */ (0, f.jsxs)("div", {
|
|
399
|
+
style: {
|
|
400
|
+
position: "fixed",
|
|
401
|
+
bottom: 16,
|
|
402
|
+
right: 16,
|
|
403
|
+
zIndex: 99999,
|
|
404
|
+
fontFamily: "sans-serif"
|
|
405
|
+
},
|
|
406
|
+
children: [/* @__PURE__ */ (0, f.jsxs)("button", {
|
|
407
|
+
onClick: () => r(!n),
|
|
408
|
+
style: {
|
|
409
|
+
background: "#1e293b",
|
|
410
|
+
color: "#fff",
|
|
411
|
+
border: "none",
|
|
412
|
+
padding: "10px 14px",
|
|
413
|
+
borderRadius: "8px",
|
|
414
|
+
cursor: "pointer",
|
|
415
|
+
fontWeight: "bold",
|
|
416
|
+
boxShadow: "0 4px 12px rgba(0,0,0,0.15)"
|
|
417
|
+
},
|
|
418
|
+
children: [
|
|
419
|
+
"Dev Companion (",
|
|
420
|
+
s.length,
|
|
421
|
+
")"
|
|
422
|
+
]
|
|
423
|
+
}), n && /* @__PURE__ */ (0, f.jsxs)("div", {
|
|
424
|
+
style: {
|
|
425
|
+
position: "absolute",
|
|
426
|
+
bottom: 50,
|
|
427
|
+
right: 0,
|
|
428
|
+
width: 380,
|
|
429
|
+
height: 340,
|
|
430
|
+
background: "#0f172a",
|
|
431
|
+
color: "#f8fafc",
|
|
432
|
+
borderRadius: "8px",
|
|
433
|
+
padding: "12px",
|
|
434
|
+
boxShadow: "0 8px 24px rgba(0,0,0,0.3)",
|
|
435
|
+
display: "flex",
|
|
436
|
+
flexDirection: "column"
|
|
437
|
+
},
|
|
438
|
+
children: [/* @__PURE__ */ (0, f.jsxs)("div", {
|
|
439
|
+
style: {
|
|
440
|
+
display: "flex",
|
|
441
|
+
gap: "8px",
|
|
442
|
+
borderBottom: "1px solid #334155",
|
|
443
|
+
paddingBottom: "8px",
|
|
444
|
+
marginBottom: "8px"
|
|
445
|
+
},
|
|
446
|
+
children: [/* @__PURE__ */ (0, f.jsx)("button", {
|
|
447
|
+
onClick: () => o("network"),
|
|
448
|
+
style: {
|
|
449
|
+
background: a === "network" ? "#0284c7" : "#1e293b",
|
|
450
|
+
color: "#fff",
|
|
451
|
+
border: "none",
|
|
452
|
+
padding: "6px 12px",
|
|
453
|
+
borderRadius: "4px",
|
|
454
|
+
fontSize: "12px",
|
|
455
|
+
fontWeight: "bold",
|
|
456
|
+
cursor: "pointer"
|
|
457
|
+
},
|
|
458
|
+
children: "Network"
|
|
459
|
+
}), /* @__PURE__ */ (0, f.jsx)("button", {
|
|
460
|
+
onClick: () => o("storage"),
|
|
461
|
+
style: {
|
|
462
|
+
background: a === "storage" ? "#0284c7" : "#1e293b",
|
|
463
|
+
color: "#fff",
|
|
464
|
+
border: "none",
|
|
465
|
+
padding: "6px 12px",
|
|
466
|
+
borderRadius: "4px",
|
|
467
|
+
fontSize: "12px",
|
|
468
|
+
fontWeight: "bold",
|
|
469
|
+
cursor: "pointer"
|
|
470
|
+
},
|
|
471
|
+
children: "Storage"
|
|
472
|
+
})]
|
|
473
|
+
}), a === "network" ? /* @__PURE__ */ (0, f.jsx)("div", {
|
|
474
|
+
style: {
|
|
475
|
+
flex: 1,
|
|
476
|
+
overflowY: "auto"
|
|
477
|
+
},
|
|
478
|
+
children: s.length === 0 ? /* @__PURE__ */ (0, f.jsx)("p", {
|
|
479
|
+
style: {
|
|
480
|
+
color: "#94a3b8",
|
|
481
|
+
fontSize: "13px"
|
|
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, {})]
|
|
520
|
+
})]
|
|
521
|
+
});
|
|
522
|
+
};
|
|
523
|
+
export { m as DevCompanion };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface StorageItem {
|
|
2
|
+
key: string;
|
|
3
|
+
value: string;
|
|
4
|
+
type: 'local' | 'session' | 'cookie';
|
|
5
|
+
}
|
|
6
|
+
export declare const getLocalStorageItems: () => StorageItem[];
|
|
7
|
+
export declare const getSessionStorageItems: () => StorageItem[];
|
|
8
|
+
export declare const getCookieItems: () => StorageItem[];
|
|
9
|
+
export declare const deleteStorageItem: (key: string, type: "local" | "session" | "cookie") => void;
|
|
10
|
+
export declare const setStorageItem: (key: string, value: string, type: "local" | "session" | "cookie") => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,53 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@kickd0wn/react-dev-companion",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@kickd0wn/react-dev-companion",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "A zero-dependency DevTools overlay for React and Next.js applications.",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.cjs",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"dev": "vite",
|
|
21
|
+
"build": "tsc && vite build",
|
|
22
|
+
"prepublishOnly": "npm run build"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"react",
|
|
26
|
+
"nextjs",
|
|
27
|
+
"devtools",
|
|
28
|
+
"storage",
|
|
29
|
+
"network-interceptor",
|
|
30
|
+
"typescript"
|
|
31
|
+
],
|
|
32
|
+
"author": "Kickz1nn <https://github.com/Kickz1nn>",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/Kickz1nn/react-dev-companion.git"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"react": ">=17.0.0",
|
|
40
|
+
"react-dom": ">=17.0.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@commitlint/cli": "^21.2.4",
|
|
44
|
+
"@commitlint/config-conventional": "^21.2.4",
|
|
45
|
+
"@types/node": "^26.6.6",
|
|
46
|
+
"@types/react": "^19.3.0",
|
|
47
|
+
"@types/react-dom": "^19.3.0",
|
|
48
|
+
"@vitejs/plugin-react": "^6.2.1",
|
|
49
|
+
"typescript": "^6.0.3",
|
|
50
|
+
"vite": "^8.3.6",
|
|
51
|
+
"vite-plugin-dts": "^5.1.2"
|
|
52
|
+
}
|
|
53
|
+
}
|