@bereasoftware/nexa 1.3.0 → 1.4.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/README.en.md +14 -3
- package/README.md +14 -3
- package/dist/bereasoftware-nexa-1.4.1.tgz +0 -0
- package/dist/nexa.cjs.js +4 -5
- package/dist/nexa.cjs.js.map +1 -1
- package/dist/nexa.es.js +16 -10
- package/dist/nexa.es.js.map +1 -1
- package/dist/nexa.iife.js +4 -5
- package/dist/nexa.iife.js.map +1 -1
- package/dist/nexa.umd.js +4 -5
- package/dist/nexa.umd.js.map +1 -1
- package/dist/types/dev-overlay/overlay.d.ts +4 -0
- package/package.json +1 -1
- package/dist/bereasoftware-nexa-1.3.0.tgz +0 -0
package/dist/nexa.umd.js
CHANGED
|
@@ -334,7 +334,7 @@
|
|
|
334
334
|
align-items: center;
|
|
335
335
|
gap: 8px;
|
|
336
336
|
}
|
|
337
|
-
`,be=class{panel=null;tracker;visible=!1;selectedRequest=null;config;searchQuery=``;constructor(e){this.tracker=e,this.config=e.getConfig(),this.setupKeyboardShortcut(),this.createPanel()}show(){this.panel&&(this.panel.style.display=`flex`,this.panel.style.opacity=`0`,this.panel.style.transform=`scale(0.96) translateY(8px)`,requestAnimationFrame(()=>{this.panel.style.transition=`all 0.25s cubic-bezier(0.16, 1, 0.3, 1)`,this.panel.style.opacity=`1`,this.panel.style.transform=`scale(1) translateY(0)`}),this.visible=!0)}hide(){this.panel&&(this.panel.style.transition=`all 0.15s ease-out`,this.panel.style.opacity=`0`,this.panel.style.transform=`scale(0.96) translateY(8px)`,setTimeout(()=>{this.panel&&(this.panel.style.display=`none`)},150),this.visible=!1)}toggle(){this.visible?this.hide():this.show()}destroy(){this.panel?.remove(),this.panel=null}setupKeyboardShortcut(){let e=this.config.keyboardShortcut.split(`+`),t=new Set(e.map(e=>e.toLowerCase()));
|
|
337
|
+
`,be=class{panel=null;tracker;visible=!1;selectedRequest=null;config;searchQuery=``;removeTrackerListener=null;keyboardShortcutHandler=null;globalKeyboardHandler=null;constructor(e){this.tracker=e,this.config=e.getConfig(),this.canUseDOM()&&(this.setupKeyboardShortcut(),this.createPanel())}show(){this.panel&&(this.panel.style.display=`flex`,this.panel.style.opacity=`0`,this.panel.style.transform=`scale(0.96) translateY(8px)`,(typeof requestAnimationFrame==`function`?requestAnimationFrame:e=>setTimeout(e,0))(()=>{this.panel.style.transition=`all 0.25s cubic-bezier(0.16, 1, 0.3, 1)`,this.panel.style.opacity=`1`,this.panel.style.transform=`scale(1) translateY(0)`}),this.visible=!0)}hide(){this.panel&&(this.panel.style.transition=`all 0.15s ease-out`,this.panel.style.opacity=`0`,this.panel.style.transform=`scale(0.96) translateY(8px)`,setTimeout(()=>{this.panel&&(this.panel.style.display=`none`)},150),this.visible=!1)}toggle(){this.visible?this.hide():this.show()}destroy(){this.keyboardShortcutHandler&&=(document.removeEventListener(`keydown`,this.keyboardShortcutHandler),null),this.globalKeyboardHandler&&=(document.removeEventListener(`keydown`,this.globalKeyboardHandler),null),this.removeTrackerListener?.(),this.removeTrackerListener=null,this.panel?.remove(),this.panel=null,this.visible=!1,this.selectedRequest=null}setupKeyboardShortcut(){let e=this.config.keyboardShortcut.split(`+`),t=new Set(e.map(e=>e.toLowerCase()));this.keyboardShortcutHandler=e=>{let n=new Set;e.ctrlKey&&n.add(`ctrl`),e.metaKey&&(n.add(`meta`),n.add(`cmd`),n.add(`ctrl`)),e.shiftKey&&n.add(`shift`),e.altKey&&n.add(`alt`),(e.key&&e.key.length===1||e.key.length>1)&&n.add(e.key.toLowerCase());let r=!0;for(let e of t)if(!n.has(e)){r=!1;break}r&&n.size===t.size&&(e.preventDefault(),this.toggle())},document.addEventListener(`keydown`,this.keyboardShortcutHandler)}createPanel(){if(!this.canUseDOM())return;this.panel=document.createElement(`div`),this.panel.id=`nexa-dev-overlay`;let e=this.config.position,t=e.includes(`bottom`),n=e.includes(`right`);this.panel.style.cssText=`
|
|
338
338
|
position: fixed;
|
|
339
339
|
${t?`bottom: 24px;`:`top: 24px;`}
|
|
340
340
|
${n?`right: 24px;`:`left: 24px;`}
|
|
@@ -349,8 +349,7 @@
|
|
|
349
349
|
<div class="nexa-header">
|
|
350
350
|
<div class="nexa-header-left">
|
|
351
351
|
<div class="nexa-logo">
|
|
352
|
-
<
|
|
353
|
-
<span style="display:none;align-items:center;justify-content:center;font-size:14px;font-weight:700;color:#fff;background:linear-gradient(135deg,#3b82f6,#238636);width:18px;height:18px;border-radius:4px;">N</span>
|
|
352
|
+
<span style="display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:700;color:#fff;background:linear-gradient(135deg,#3b82f6,#238636);width:18px;height:18px;border-radius:4px;">N</span>
|
|
354
353
|
</div>
|
|
355
354
|
<span class="nexa-title">Nexa DevTools</span>
|
|
356
355
|
</div>
|
|
@@ -390,7 +389,7 @@
|
|
|
390
389
|
</div>
|
|
391
390
|
<div class="nexa-detail-body"></div>
|
|
392
391
|
</div>
|
|
393
|
-
`,document.body.appendChild(this.panel),this.bindEvents(),this.tracker.onChange(()=>this.render()),this.hide(),
|
|
392
|
+
`,document.body.appendChild(this.panel),this.bindEvents(),this.removeTrackerListener=this.tracker.onChange(()=>this.render()),this.hide(),this.globalKeyboardHandler=e=>{if(e.key===`Escape`&&this.visible){this.hide();return}if(this.visible&&(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`f`){e.preventDefault();let t=this.panel?.querySelector(`.nexa-search-input`);t?.focus(),t?.select()}},document.addEventListener(`keydown`,this.globalKeyboardHandler)}bindEvents(){this.panel&&(this.panel.querySelector(`.nexa-btn-close`)?.addEventListener(`click`,()=>this.hide()),this.panel.querySelector(`.nexa-btn-clear`)?.addEventListener(`click`,()=>{this.tracker.clear(),this.render()}),this.panel.querySelector(`.nexa-btn-back`)?.addEventListener(`click`,()=>this.showMainView()),this.panel.querySelector(`.nexa-btn-retry`)?.addEventListener(`click`,()=>this.retrySelected()),this.panel.querySelector(`.nexa-search-input`)?.addEventListener(`input`,e=>{this.searchQuery=e.target.value.toLowerCase(),this.renderRequestList()}),this.panel.querySelectorAll(`.nexa-tab`).forEach(e=>{e.addEventListener(`click`,()=>{this.panel.querySelectorAll(`.nexa-tab`).forEach(e=>e.classList.remove(`nexa-tab-active`)),this.panel.querySelectorAll(`.nexa-panel`).forEach(e=>e.classList.remove(`nexa-panel-active`)),e.classList.add(`nexa-tab-active`),this.panel.querySelector(`[data-panel="${e.dataset.tab}"]`)?.classList.add(`nexa-panel-active`),e.dataset.tab===`metrics`&&this.renderMetrics()})}))}render(){!this.panel||!this.visible||(this.renderMetricsBar(),this.renderRequestList())}renderMetricsBar(){let e=this.tracker.getMetrics(),t=this.panel;t&&(t.querySelector(`[data-metric="total"]`).textContent=String(e.totalRequests),t.querySelector(`[data-metric="avg"]`).textContent=`${e.avgDuration.toFixed(0)}ms`,t.querySelector(`[data-metric="rate"]`).textContent=`${e.requestsPerSecond.toFixed(1)}`,t.querySelector(`[data-metric="success"]`).textContent=String(e.successfulRequests),t.querySelector(`[data-metric="fail"]`).textContent=String(e.failedRequests),t.querySelector(`[data-count="requests"]`).textContent=String(e.totalRequests))}renderRequestList(){let e=this.panel?.querySelector(`.nexa-request-list`);if(!e)return;let t=this.tracker.getHistory();if(this.searchQuery&&(t=t.filter(e=>e.url.toLowerCase().includes(this.searchQuery)||e.method.toLowerCase().includes(this.searchQuery)||String(e.status).includes(this.searchQuery))),t.length===0){e.innerHTML=`
|
|
394
393
|
<div class="nexa-empty">
|
|
395
394
|
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
396
395
|
<circle cx="12" cy="12" r="10"/><path d="M8 12h8M12 8v8"/>
|
|
@@ -459,5 +458,5 @@
|
|
|
459
458
|
<h3>Headers</h3>
|
|
460
459
|
<pre class="nexa-code">${this.formatJson(e.headers)}</pre>
|
|
461
460
|
</div>
|
|
462
|
-
`:``}`)}showMainView(){let e=this.panel?.querySelector(`.nexa-body`),t=this.panel?.querySelector(`.nexa-detail`);e&&(e.style.display=`flex`),t&&(t.style.display=`none`),this.selectedRequest=null}retrySelected(){if(!this.selectedRequest)return;let{method:e,url:t,body:n,headers:r}=this.selectedRequest;fetch(t,{method:e,headers:r,body:n?JSON.stringify(n):void 0}).then(async e=>{this.selectedRequest&&(this.selectedRequest={...this.selectedRequest,status:e.status,ok:e.ok,duration:this.selectedRequest.duration,timestamp:Date.now()},this.showDetail(this.selectedRequest))}).catch(()=>{})}truncateUrl(e,t=35){try{let t=new URL(e);return t.pathname+(t.search||``)}catch{return e.length>t?e.slice(0,t)+`...`:e}}formatJson(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}},Q=null,$=null;function xe(e={}){return Q?{tracker:$,ui:Q}:($=new Y(e),Q=new be($),Q.show(),{tracker:$,ui:Q})}function Se(){return{tracker:$,ui:Q}}function Ce(){Q?.destroy(),Q=null,$=null}e.AggressiveRetry=f,e.CachePlugin=I,e.CacheStore=y,e.CircuitBreakerRetry=ee,e.ConservativeRetry=p,e.DedupePlugin=L,e.Defer=k,e.Err=n,e.HttpClient=U,e.HttpError=W,e.LoggerPlugin=P,e.MetricsPlugin=F,e.MiddlewarePipeline=ae,e.Ok=t,e.PluginManager=N,e.RequestDeduplicator=x,e.RequestTracker=Y,e.TypedObservable=se,e.cacheMiddleware=re,e.createApiUrl=O,e.createCacheMiddleware=b,e.createDedupeMiddleware=S,e.createDevOverlay=xe,e.createHttpClient=de,e.createPipeline=C,e.createProjectionTransformer=u,e.createRealtimePlugin=ve,e.createRequiredFieldsValidator=i,e.createSSEClient=ge,e.createSchemaValidator=r,e.createStreamingMiddleware=M,e.createTypeGuard=E,e.createTypedApiClient=oe,e.createTypedRequest=T,e.createTypedResponse=w,e.createUrl=D,e.createWebSocketClient=me,e.createWrapperTransformer=d,e.dedupeMiddleware=ie,e.destroyDevOverlay=Ce,e.getDevOverlay=Se,e.handleStream=A,e.isHttpError=ue,e.retry=v,e.streamToFile=ce,e.streamingMiddleware=le,e.transformCamelToSnake=c,e.transformFlatten=l,e.transformSnakeToCamel=s,e.validatorIsArray=a,e.validatorIsObject=o,e.withTimeout=ne});
|
|
461
|
+
`:``}`)}showMainView(){let e=this.panel?.querySelector(`.nexa-body`),t=this.panel?.querySelector(`.nexa-detail`);e&&(e.style.display=`flex`),t&&(t.style.display=`none`),this.selectedRequest=null}retrySelected(){if(!this.selectedRequest)return;let{method:e,url:t,body:n,headers:r}=this.selectedRequest;fetch(t,{method:e,headers:r,body:n?JSON.stringify(n):void 0}).then(async e=>{this.selectedRequest&&(this.selectedRequest={...this.selectedRequest,status:e.status,ok:e.ok,duration:this.selectedRequest.duration,timestamp:Date.now()},this.showDetail(this.selectedRequest))}).catch(()=>{})}truncateUrl(e,t=35){try{let t=new URL(e);return t.pathname+(t.search||``)}catch{return e.length>t?e.slice(0,t)+`...`:e}}formatJson(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}canUseDOM(){return typeof document<`u`&&typeof document.createElement==`function`&&!!document.body}},Q=null,$=null;function xe(e={}){return Q?{tracker:$,ui:Q}:($=new Y(e),Q=new be($),Q.show(),{tracker:$,ui:Q})}function Se(){return{tracker:$,ui:Q}}function Ce(){Q?.destroy(),Q=null,$=null}e.AggressiveRetry=f,e.CachePlugin=I,e.CacheStore=y,e.CircuitBreakerRetry=ee,e.ConservativeRetry=p,e.DedupePlugin=L,e.Defer=k,e.Err=n,e.HttpClient=U,e.HttpError=W,e.LoggerPlugin=P,e.MetricsPlugin=F,e.MiddlewarePipeline=ae,e.Ok=t,e.PluginManager=N,e.RequestDeduplicator=x,e.RequestTracker=Y,e.TypedObservable=se,e.cacheMiddleware=re,e.createApiUrl=O,e.createCacheMiddleware=b,e.createDedupeMiddleware=S,e.createDevOverlay=xe,e.createHttpClient=de,e.createPipeline=C,e.createProjectionTransformer=u,e.createRealtimePlugin=ve,e.createRequiredFieldsValidator=i,e.createSSEClient=ge,e.createSchemaValidator=r,e.createStreamingMiddleware=M,e.createTypeGuard=E,e.createTypedApiClient=oe,e.createTypedRequest=T,e.createTypedResponse=w,e.createUrl=D,e.createWebSocketClient=me,e.createWrapperTransformer=d,e.dedupeMiddleware=ie,e.destroyDevOverlay=Ce,e.getDevOverlay=Se,e.handleStream=A,e.isHttpError=ue,e.retry=v,e.streamToFile=ce,e.streamingMiddleware=le,e.transformCamelToSnake=c,e.transformFlatten=l,e.transformSnakeToCamel=s,e.validatorIsArray=a,e.validatorIsObject=o,e.withTimeout=ne});
|
|
463
462
|
//# sourceMappingURL=nexa.umd.js.map
|