rails-profiler 0.35.3 → 0.36.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -0
- data/app/assets/builds/profiler-toolbar.js +2 -2
- data/app/assets/builds/profiler.js +10 -10
- data/app/assets/javascript/profiler-ajax-interceptor.js +9 -0
- data/lib/profiler/middleware/toolbar_injector.rb +22 -2
- data/lib/profiler/version.rb +1 -1
- metadata +1 -1
|
@@ -33,6 +33,15 @@
|
|
|
33
33
|
return window.__PROFILER_PARENT_TOKEN__;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
// A Turbo Drive visit to a page the profiler left alone brings no inline script to set a new
|
|
37
|
+
// token, and the window keeps the one of the previous page: forget it, or every request of
|
|
38
|
+
// this page would be linked to a page the user has left.
|
|
39
|
+
document.addEventListener('turbo:load', function() {
|
|
40
|
+
if (!document.getElementById('profiler-toolbar')) {
|
|
41
|
+
delete window.__PROFILER_PARENT_TOKEN__;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
36
45
|
function isRequest(input) {
|
|
37
46
|
return typeof Request !== 'undefined' && input instanceof Request;
|
|
38
47
|
}
|
|
@@ -172,7 +172,7 @@ module Profiler
|
|
|
172
172
|
<style#{nonce_attr}>#{self.class.toolbar_styles}</style>
|
|
173
173
|
<div id="profiler-toolbar" class="profiler-root" data-token="#{ERB::Util.html_escape(@token)}"></div>
|
|
174
174
|
<button id="profiler-toolbar-toggle" class="profiler-root" title="Toggle profiler (Alt+P)"><span class="profiler-toggle-icon">▶</span></button>
|
|
175
|
-
<script#{nonce_attr}>(function(){
|
|
175
|
+
<script#{nonce_attr}>(function(){function g(k){try{return localStorage.getItem(k)}catch(e){return null}}var c=g('profiler-toolbar-collapsed')==='true',t=g('profiler-theme'),theme=t==='light'?'light':t==='dark'?'dark':(window.matchMedia('(prefers-color-scheme:light)').matches?'light':'dark'),el=document.getElementById('profiler-toolbar'),tog=document.getElementById('profiler-toolbar-toggle');if(c){el.style.cssText='animation:none!important;transform:translateX(calc(100% + 44px))';tog.dataset.collapsed='true';}el.setAttribute('data-theme',theme);tog.setAttribute('data-theme',theme);})();</script>
|
|
176
176
|
<script src="#{Profiler::Assets.url("profiler-toolbar.js")}" defer#{nonce_attr}></script>
|
|
177
177
|
HTML
|
|
178
178
|
end
|
|
@@ -336,6 +336,26 @@ module Profiler
|
|
|
336
336
|
}
|
|
337
337
|
#profiler-toolbar .profiler-toolbar-logo:hover { color: var(--pf-amber-h); }
|
|
338
338
|
|
|
339
|
+
/* Error state: the profile could not be loaded, or a component failed. */
|
|
340
|
+
#profiler-toolbar .profiler-toolbar-error {
|
|
341
|
+
display: inline-flex;
|
|
342
|
+
align-items: center;
|
|
343
|
+
gap: 10px;
|
|
344
|
+
padding: 0 13px;
|
|
345
|
+
}
|
|
346
|
+
#profiler-toolbar .profiler-toolbar-retry {
|
|
347
|
+
font-family: var(--pf-mono);
|
|
348
|
+
font-size: 11px;
|
|
349
|
+
color: var(--pf-amber);
|
|
350
|
+
background: transparent;
|
|
351
|
+
border: 1px solid var(--pf-border-s);
|
|
352
|
+
border-radius: 3px;
|
|
353
|
+
padding: 2px 8px;
|
|
354
|
+
cursor: pointer;
|
|
355
|
+
}
|
|
356
|
+
#profiler-toolbar .profiler-toolbar-retry:hover:not(:disabled) { color: var(--pf-amber-h); background: var(--pf-amber-bg); }
|
|
357
|
+
#profiler-toolbar .profiler-toolbar-retry:disabled { cursor: default; opacity: .6; }
|
|
358
|
+
|
|
339
359
|
/* ── Toggle button (fixed, always visible) ───────────────────────── */
|
|
340
360
|
#profiler-toolbar-toggle {
|
|
341
361
|
position: fixed;
|
|
@@ -359,7 +379,7 @@ module Profiler
|
|
|
359
379
|
animation: pfPop 380ms ease-out both;
|
|
360
380
|
transform: none;
|
|
361
381
|
}
|
|
362
|
-
.profiler-toggle-icon {
|
|
382
|
+
#profiler-toolbar-toggle .profiler-toggle-icon {
|
|
363
383
|
display: inline-block;
|
|
364
384
|
transition: transform 280ms cubic-bezier(.4,0,.2,1);
|
|
365
385
|
}
|
data/lib/profiler/version.rb
CHANGED