@leftium/gg 0.0.29 → 0.0.30
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/eruda/plugin.js +94 -42
- package/package.json +1 -1
package/dist/eruda/plugin.js
CHANGED
|
@@ -95,6 +95,20 @@ export function createGgPlugin(options, gg) {
|
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
+
function soloNamespace(namespace) {
|
|
99
|
+
const ns = namespace.trim();
|
|
100
|
+
// Toggle: if already soloed on this namespace, restore all
|
|
101
|
+
if (filterPattern === ns) {
|
|
102
|
+
filterPattern = 'gg:*';
|
|
103
|
+
enabledNamespaces.clear();
|
|
104
|
+
getAllCapturedNamespaces().forEach((n) => enabledNamespaces.add(n));
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
// Solo: show only this namespace
|
|
108
|
+
filterPattern = ns;
|
|
109
|
+
enabledNamespaces.clear();
|
|
110
|
+
enabledNamespaces.add(ns);
|
|
111
|
+
}
|
|
98
112
|
function simplifyPattern(pattern) {
|
|
99
113
|
if (!pattern)
|
|
100
114
|
return '';
|
|
@@ -172,7 +186,11 @@ export function createGgPlugin(options, gg) {
|
|
|
172
186
|
}
|
|
173
187
|
function gridColumns() {
|
|
174
188
|
const ns = nsColWidth !== null ? `${nsColWidth}px` : 'auto';
|
|
175
|
-
// diff | ns | handle | content
|
|
189
|
+
// When filter expanded: icons | diff | ns | handle | content
|
|
190
|
+
// When collapsed: diff | ns | handle | content
|
|
191
|
+
if (filterExpanded) {
|
|
192
|
+
return `auto auto ${ns} 4px 1fr`;
|
|
193
|
+
}
|
|
176
194
|
return `auto ${ns} 4px 1fr`;
|
|
177
195
|
}
|
|
178
196
|
function buildHTML() {
|
|
@@ -191,6 +209,7 @@ export function createGgPlugin(options, gg) {
|
|
|
191
209
|
.gg-log-header {
|
|
192
210
|
display: contents;
|
|
193
211
|
}
|
|
212
|
+
.gg-log-icons,
|
|
194
213
|
.gg-log-diff,
|
|
195
214
|
.gg-log-ns,
|
|
196
215
|
.gg-log-handle,
|
|
@@ -199,6 +218,32 @@ export function createGgPlugin(options, gg) {
|
|
|
199
218
|
align-self: start !important;
|
|
200
219
|
border-top: 1px solid rgba(0,0,0,0.05);
|
|
201
220
|
}
|
|
221
|
+
.gg-log-icons {
|
|
222
|
+
display: flex;
|
|
223
|
+
gap: 2px;
|
|
224
|
+
padding: 0 4px 0 0;
|
|
225
|
+
white-space: nowrap;
|
|
226
|
+
align-self: stretch !important;
|
|
227
|
+
}
|
|
228
|
+
.gg-log-icons button {
|
|
229
|
+
all: unset;
|
|
230
|
+
cursor: pointer;
|
|
231
|
+
opacity: 0.35;
|
|
232
|
+
padding: 4px 10px;
|
|
233
|
+
line-height: 1;
|
|
234
|
+
display: flex;
|
|
235
|
+
align-items: center;
|
|
236
|
+
}
|
|
237
|
+
.gg-log-icons button:hover {
|
|
238
|
+
opacity: 1;
|
|
239
|
+
background: rgba(0,0,0,0.05);
|
|
240
|
+
}
|
|
241
|
+
.gg-solo-target {
|
|
242
|
+
cursor: pointer;
|
|
243
|
+
}
|
|
244
|
+
.gg-solo-target:hover {
|
|
245
|
+
background: rgba(0,0,0,0.05);
|
|
246
|
+
}
|
|
202
247
|
.gg-details {
|
|
203
248
|
grid-column: 1 / -1;
|
|
204
249
|
border-top: none;
|
|
@@ -242,15 +287,6 @@ export function createGgPlugin(options, gg) {
|
|
|
242
287
|
word-break: break-word;
|
|
243
288
|
padding: 4px 0;
|
|
244
289
|
}
|
|
245
|
-
/* Make header clickable for filtering when filters are expanded */
|
|
246
|
-
.gg-log-header.clickable {
|
|
247
|
-
cursor: pointer;
|
|
248
|
-
}
|
|
249
|
-
/* Desktop: highlight child elements since header has display: contents */
|
|
250
|
-
.gg-log-header.clickable:hover .gg-log-diff,
|
|
251
|
-
.gg-log-header.clickable:hover .gg-log-ns {
|
|
252
|
-
background: rgba(0,0,0,0.05);
|
|
253
|
-
}
|
|
254
290
|
.gg-filter-panel {
|
|
255
291
|
background: #f5f5f5;
|
|
256
292
|
padding: 10px;
|
|
@@ -333,6 +369,7 @@ export function createGgPlugin(options, gg) {
|
|
|
333
369
|
.gg-log-entry:not(:first-child) {
|
|
334
370
|
border-top: 1px solid rgba(0,0,0,0.05);
|
|
335
371
|
}
|
|
372
|
+
.gg-log-icons,
|
|
336
373
|
.gg-log-diff,
|
|
337
374
|
.gg-log-ns,
|
|
338
375
|
.gg-log-handle,
|
|
@@ -347,18 +384,6 @@ export function createGgPlugin(options, gg) {
|
|
|
347
384
|
margin-bottom: 4px;
|
|
348
385
|
min-width: 0;
|
|
349
386
|
}
|
|
350
|
-
/* Mobile: hover on container since it's not display: contents */
|
|
351
|
-
.gg-log-header.clickable {
|
|
352
|
-
padding: 2px 0;
|
|
353
|
-
}
|
|
354
|
-
.gg-log-header.clickable:hover {
|
|
355
|
-
background: rgba(0,0,0,0.05);
|
|
356
|
-
}
|
|
357
|
-
/* Override desktop child hover on mobile */
|
|
358
|
-
.gg-log-header.clickable:hover .gg-log-diff,
|
|
359
|
-
.gg-log-header.clickable:hover .gg-log-ns {
|
|
360
|
-
background: transparent;
|
|
361
|
-
}
|
|
362
387
|
.gg-log-diff {
|
|
363
388
|
padding: 0;
|
|
364
389
|
text-align: left;
|
|
@@ -612,17 +637,42 @@ export function createGgPlugin(options, gg) {
|
|
|
612
637
|
}
|
|
613
638
|
return;
|
|
614
639
|
}
|
|
615
|
-
// Handle
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
target
|
|
619
|
-
const
|
|
620
|
-
|
|
640
|
+
// Handle filter icon clicks (hide / solo)
|
|
641
|
+
if (target?.classList?.contains('gg-icon-hide') ||
|
|
642
|
+
target?.classList?.contains('gg-icon-solo')) {
|
|
643
|
+
const iconsDiv = target.closest('.gg-log-icons');
|
|
644
|
+
const namespace = iconsDiv?.getAttribute('data-namespace');
|
|
645
|
+
if (!namespace)
|
|
646
|
+
return;
|
|
647
|
+
if (target.classList.contains('gg-icon-hide')) {
|
|
648
|
+
toggleNamespace(namespace, false);
|
|
649
|
+
}
|
|
650
|
+
else {
|
|
651
|
+
soloNamespace(namespace);
|
|
652
|
+
}
|
|
653
|
+
localStorage.setItem('debug', filterPattern);
|
|
654
|
+
renderFilterUI();
|
|
655
|
+
renderLogs();
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
// Handle clicking diff/ns cells to solo (same as 🎯)
|
|
659
|
+
if (target?.classList?.contains('gg-solo-target')) {
|
|
660
|
+
const namespace = target.getAttribute('data-namespace');
|
|
621
661
|
if (!namespace)
|
|
622
662
|
return;
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
663
|
+
soloNamespace(namespace);
|
|
664
|
+
localStorage.setItem('debug', filterPattern);
|
|
665
|
+
renderFilterUI();
|
|
666
|
+
renderLogs();
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
// Clicking background (container or grid, not a log element) restores all
|
|
670
|
+
if (filterExpanded &&
|
|
671
|
+
filterPattern !== 'gg:*' &&
|
|
672
|
+
(target === containerEl || target?.classList?.contains('gg-log-grid'))) {
|
|
673
|
+
filterPattern = 'gg:*';
|
|
674
|
+
enabledNamespaces.clear();
|
|
675
|
+
getAllCapturedNamespaces().forEach((ns) => enabledNamespaces.add(ns));
|
|
626
676
|
localStorage.setItem('debug', filterPattern);
|
|
627
677
|
renderFilterUI();
|
|
628
678
|
renderLogs();
|
|
@@ -727,20 +777,22 @@ export function createGgPlugin(options, gg) {
|
|
|
727
777
|
})
|
|
728
778
|
.join(' ');
|
|
729
779
|
}
|
|
730
|
-
//
|
|
731
|
-
const
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
const filterIcon = filterExpanded
|
|
737
|
-
? '<span style="font-weight: bold; color: #000; opacity: 0.6;">× </span>'
|
|
780
|
+
// Filter icons column (only when expanded)
|
|
781
|
+
const iconsCol = filterExpanded
|
|
782
|
+
? `<div class="gg-log-icons" data-namespace="${ns}">` +
|
|
783
|
+
`<button class="gg-icon-hide" title="Hide this namespace">🗑</button>` +
|
|
784
|
+
`<button class="gg-icon-solo" title="Show only this namespace">🎯</button>` +
|
|
785
|
+
`</div>`
|
|
738
786
|
: '';
|
|
787
|
+
// When filter expanded, diff+ns are clickable (solo) with data-namespace
|
|
788
|
+
const soloAttr = filterExpanded ? ` data-namespace="${ns}"` : '';
|
|
789
|
+
const soloClass = filterExpanded ? ' gg-solo-target' : '';
|
|
739
790
|
// Desktop: grid layout, Mobile: stacked layout
|
|
740
791
|
return (`<div class="gg-log-entry">` +
|
|
741
|
-
`<div class="
|
|
742
|
-
|
|
743
|
-
`<div class="gg-log-
|
|
792
|
+
`<div class="gg-log-header">` +
|
|
793
|
+
iconsCol +
|
|
794
|
+
`<div class="gg-log-diff${soloClass}" style="color: ${color};"${soloAttr}>${diff}</div>` +
|
|
795
|
+
`<div class="gg-log-ns${soloClass}" style="color: ${color};"${soloAttr}>${ns}</div>` +
|
|
744
796
|
`<div class="gg-log-handle"></div>` +
|
|
745
797
|
`</div>` +
|
|
746
798
|
`<div class="gg-log-content">${argsHTML}</div>` +
|