@hyperpuncher/pi-ui 0.38.2 → 0.39.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.
@@ -1,1021 +0,0 @@
1
- // Datastar Inspector v1.1.4 licensed to GitHub user @hyperpuncher
2
- var k=`<style>
3
- :host {
4
- --inspector-bg: #ebede9;
5
- --inspector-bg-light: #c7cfcc;
6
- --inspector-bg-hover: #d9dedc;
7
- --inspector-bg-dark: #a8b5b2;
8
- --inspector-color: #090a14;
9
- --inspector-color-blur: #819796;
10
- --inspector-color-filtered: #d73a49;
11
- --inspector-color-matched: #28a745;
12
- --color-purple: #A599FF;
13
- --color-gold: #FFA116;
14
- --color-html5: #E34C26;
15
- --color-html5-dark: #F06529;
16
- --color-dark-text: #0A0A0A;
17
- --color-white: #FFFFFF;
18
- background-color: var(--inspector-bg);
19
- border: 1px solid var(--inspector-bg-light);
20
- border-bottom: 0;
21
- border-radius: 7px 7px 0 0;
22
- color: var(--inspector-color);
23
- position: fixed;
24
- bottom: 0;
25
- right: 24px;
26
- max-width: 640px;
27
- margin: 0 5%;
28
- font-family: monospace;
29
- z-index: 9999;
30
-
31
- header, #collapsed {
32
- display: flex;
33
- justify-content: space-between;
34
- align-items: center;
35
- gap: 20px;
36
- padding: 8px 10px;
37
- font-size: 13px;
38
- font-weight: bold;
39
- user-select: none;
40
- cursor: pointer;
41
- box-sizing: border-box;
42
- height: 40px;
43
-
44
- button {
45
- padding: 2px 4px;
46
- }
47
-
48
- h1 {
49
- display: flex;
50
- align-items: center;
51
- gap: 8px;
52
- font-size: inherit;
53
- margin: 0;
54
- margin-left: -3px;
55
-
56
- button {
57
- font-size: 17px;
58
- padding: 0px 4px;
59
- }
60
- }
61
- }
62
-
63
- header {
64
- width: 640px;
65
-
66
- nav {
67
- display: flex;
68
- gap: 4px;
69
-
70
- button {
71
- display: flex;
72
- align-items: center;
73
- justify-content: center;
74
- gap: 4px;
75
-
76
- span {
77
- font-weight: bold;
78
- }
79
-
80
- svg {
81
- color: inherit;
82
- }
83
-
84
- &[data-type="currentSignals"][aria-selected="true"] {
85
- background-color: var(--color-purple);
86
- color: var(--color-dark-text);
87
- border-color: var(--color-purple);
88
- }
89
-
90
- &[data-type="signalPatchEvent"][aria-selected="true"] {
91
- background-color: var(--color-gold);
92
- color: var(--color-dark-text);
93
- border-color: var(--color-gold);
94
- }
95
-
96
- &[data-type="sseEvent"][aria-selected="true"] {
97
- background-color: var(--color-html5);
98
- color: var(--color-white);
99
- border-color: var(--color-html5);
100
- }
101
-
102
- &[data-type="persistedData"][aria-selected="true"] {
103
- background-color: var(--inspector-color-matched);
104
- color: var(--color-white);
105
- border-color: var(--inspector-color-matched);
106
- }
107
- }
108
- }
109
- }
110
-
111
- #collapsed {
112
- padding: 8px 12px 8px 15px;
113
- }
114
-
115
- button {
116
- background-color: var(--inspector-bg);
117
- border: 1px solid var(--inspector-bg-dark);
118
- border-radius: 4px;
119
- color: var(--inspector-color);
120
- font-family: inherit;
121
- font-size: 11px;
122
- flex-shrink: 0;
123
- cursor: pointer;
124
-
125
- &:hover {
126
- background-color: var(--inspector-bg-hover);
127
- }
128
- }
129
-
130
- pre {
131
- margin: 0;
132
- }
133
-
134
- main {
135
- max-height: 40vh;
136
- font-size: 12px;
137
- border-top: 1px solid var(--inspector-bg-dark);
138
- display: flex;
139
- flex-direction: column;
140
-
141
- .filters input[type="text"] {
142
- background-color: var(--inspector-bg);
143
- border: 1px solid var(--inspector-bg-dark);
144
- border-radius: 4px;
145
- color: var(--inspector-color);
146
- font-family: inherit;
147
- font-size: 11px;
148
- padding: 4px 6px;
149
- flex: 1;
150
- min-width: 0;
151
- }
152
-
153
- .input-with-icon {
154
- position: relative;
155
- display: flex;
156
- flex: 1;
157
- min-width: 0;
158
-
159
- input {
160
- padding-left: 32px;
161
- width: 100%;
162
- }
163
-
164
- .input-icon {
165
- position: absolute;
166
- left: 8px;
167
- top: 50%;
168
- transform: translateY(-50%);
169
- width: 16px;
170
- height: 16px;
171
- pointer-events: none;
172
- opacity: 0.6;
173
- color: var(--inspector-color);
174
- }
175
- }
176
-
177
- .filters label {
178
- display: flex;
179
- align-items: center;
180
- gap: 4px;
181
- font-size: 11px;
182
- user-select: none;
183
- cursor: pointer;
184
- white-space: nowrap;
185
- margin: 0 4px;
186
-
187
- span {
188
- font-weight: bold;
189
- font-family: monospace;
190
- }
191
- }
192
-
193
- .filters input[type="checkbox"] {
194
- cursor: pointer;
195
- margin: 0;
196
- flex-shrink: 0;
197
- }
198
-
199
- #resetFilters, #resetPersistedDataFilters, #refreshPersistedData {
200
- padding-bottom: 0;
201
- }
202
-
203
- #copyFilterObject, #copyPersistedDataFilterObject {
204
- display: flex;
205
- align-items: center;
206
- justify-content: center;
207
- padding: 4px;
208
- flex-shrink: 0;
209
- gap: 4px;
210
-
211
- svg {
212
- width: 14px;
213
- height: 14px;
214
- }
215
- }
216
-
217
- #clearPersistedData {
218
- display: flex;
219
- align-items: center;
220
- gap: 2px;
221
- }
222
-
223
- .regex-display {
224
- display: flex;
225
- align-items: center;
226
- gap: 8px;
227
- width: 100%;
228
- font-size: 11px;
229
- font-family: monospace;
230
-
231
- .regex-content {
232
- display: flex;
233
- gap: 4px;
234
- flex: 1;
235
-
236
- &::before {
237
- content: "{";
238
- color: var(--inspector-color);
239
- }
240
-
241
- &::after {
242
- content: "}";
243
- color: var(--inspector-color);
244
- }
245
- }
246
-
247
- .regex-include {
248
- color: var(--inspector-color-matched);
249
- }
250
-
251
- .regex-exclude {
252
- color: var(--inspector-color-filtered);
253
- }
254
-
255
- .regex-include:empty,
256
- .regex-exclude:empty {
257
- display: none;
258
- }
259
-
260
- .regex-include:not(:empty)::before {
261
- content: "include: ";
262
- color: var(--inspector-color);
263
- font-weight: normal;
264
- }
265
-
266
- .regex-exclude:not(:empty)::before {
267
- content: ", exclude: ";
268
- color: var(--inspector-color);
269
- font-weight: normal;
270
- }
271
- }
272
-
273
- p {
274
- margin: 8px 0;
275
- padding: 4px 10px;
276
- }
277
-
278
- footer {
279
- display: flex;
280
- align-items: center;
281
- gap: 8px;
282
- padding: 8px 10px;
283
- border-top: 1px solid var(--inspector-bg-dark);
284
- background-color: var(--inspector-bg-hover);
285
- font-size: 11px;
286
-
287
- &.filters {
288
- flex-wrap: wrap;
289
- row-gap: 12px;
290
- column-gap: 8px;
291
- }
292
-
293
- label {
294
- font-weight: normal;
295
- }
296
- }
297
-
298
- ul {
299
- margin: 8px 0;
300
- padding: 0;
301
- list-style: none;
302
-
303
- li {
304
- display: flex;
305
- align-items: flex-start;
306
- gap: 4px;
307
- padding: 4px 10px;
308
-
309
- &:hover {
310
- background-color: var(--inspector-bg-hover);
311
- }
312
-
313
- span {
314
- flex-shrink: 0;
315
- margin-right: 4px;
316
- }
317
-
318
- div {
319
- display: flex;
320
- flex: 1;
321
- overflow-x: auto;
322
- }
323
-
324
- summary {
325
- list-style: none;
326
- position: relative;
327
- padding-right: 1.2em;
328
- cursor: pointer;
329
- width: fit-content;
330
-
331
- &::after {
332
- content: '\u25B8';
333
- position: absolute;
334
- top: 0;
335
- right: 0;
336
- font-size: 16px;
337
- line-height: 16px;
338
- transition: transform 0.2s;
339
- }
340
- }
341
-
342
- details[open] {
343
- summary.blurrable {
344
- color: var(--inspector-color-blur);
345
- }
346
-
347
- summary::after {
348
- transform: rotate(90deg);
349
- }
350
- }
351
- }
352
- }
353
-
354
- .currentSignals ul li {
355
- border-left: 3px solid var(--color-purple);
356
-
357
- &:hover {
358
- background-color: initial;
359
- }
360
- }
361
-
362
- .signalPatchEvents ul li {
363
- border-left: 3px solid var(--color-gold);
364
- }
365
-
366
- .sseEvents ul li {
367
- border-left: 3px solid var(--color-html5-dark);
368
- }
369
-
370
- .persistedData ul li {
371
- border-left: 3px solid var(--inspector-color-matched);
372
- }
373
-
374
- button {
375
- padding: 2px 4px;
376
- flex-shrink: 0;
377
-
378
- &.copy-btn, &.log-btn, &.clear-btn {
379
- display: flex;
380
- align-items: center;
381
- justify-content: center;
382
- gap: 4px;
383
- position: sticky;
384
- top: calc(1em + 1px);
385
-
386
- svg {
387
- width: 16px;
388
- height: 16px;
389
- }
390
- }
391
- }
392
-
393
- input[type="number"] {
394
- background-color: var(--inspector-bg);
395
- border: 1px solid var(--inspector-bg-dark);
396
- border-radius: 4px;
397
- color: var(--inspector-color);
398
- font-family: inherit;
399
- font-size: 11px;
400
- padding: 4px 6px;
401
- flex-shrink: 0;
402
- }
403
-
404
- pre {
405
- .filtered {
406
- color: var(--inspector-color-filtered);
407
- }
408
- .matched {
409
- color: var(--inspector-color-matched);
410
- }
411
- }
412
-
413
- .signals-table {
414
- width: 100%;
415
- border-collapse: collapse;
416
- font-family: monospace;
417
-
418
- th {
419
- background-color: var(--inspector-bg-dark);
420
- padding: 6px 10px;
421
- text-align: left;
422
- border: 1px solid var(--inspector-bg-light);
423
- font-weight: bold;
424
- }
425
-
426
- td {
427
- padding: 4px 10px;
428
- border: 1px solid var(--inspector-bg-light);
429
- }
430
-
431
- tr:nth-child(even) {
432
- background-color: var(--inspector-bg-hover);
433
- }
434
-
435
- tr.matched td {
436
- color: var(--inspector-color-matched);
437
- }
438
-
439
- tr.filtered td {
440
- color: var(--inspector-color-filtered);
441
- }
442
- }
443
-
444
- /* Datastar signal highlighting styles */
445
- .datastar-signal-highlight {
446
- outline: 3px solid var(--color-purple) !important;
447
- outline-offset: 3px !important;
448
- background-color: rgba(165, 153, 255, 0.3) !important;
449
- box-shadow: 0 0 10px rgba(165, 153, 255, 0.5) !important;
450
- border: 2px solid var(--color-purple) !important;
451
- position: relative !important;
452
- z-index: 9998 !important;
453
- }
454
-
455
- .signal-path-hoverable {
456
- cursor: pointer;
457
- transition: background-color 0.2s;
458
- }
459
-
460
- .signal-path-hoverable:hover {
461
- background-color: var(--inspector-bg-hover);
462
- }
463
-
464
- .toggle-switch {
465
- position: relative;
466
- display: inline-block;
467
- width: 40px;
468
- height: 20px;
469
-
470
- input {
471
- opacity: 0;
472
- width: 0;
473
- height: 0;
474
-
475
- &:checked + .toggle-slider {
476
- background-color: var(--inspector-color);
477
- }
478
-
479
- &:checked + .toggle-slider:before {
480
- transform: translateX(18px);
481
- }
482
- }
483
-
484
- .toggle-slider {
485
- position: absolute;
486
- cursor: pointer;
487
- top: 0;
488
- left: 0;
489
- right: 0;
490
- bottom: 0;
491
- background-color: var(--inspector-bg-dark);
492
- transition: .2s;
493
- border-radius: 20px;
494
-
495
- &:before {
496
- position: absolute;
497
- content: "";
498
- height: 16px;
499
- width: 16px;
500
- left: 2px;
501
- bottom: 2px;
502
- background-color: var(--inspector-bg);
503
- transition: .2s;
504
- border-radius: 50%;
505
- }
506
- }
507
- }
508
-
509
-
510
- .filter-row {
511
- display: flex;
512
- align-items: center;
513
- gap: 8px;
514
- width: 100%;
515
- }
516
-
517
- section {
518
- display: flex;
519
- flex-direction: column;
520
- flex: 1;
521
- min-height: 0;
522
- }
523
-
524
- .scroll-content {
525
- overflow-y: auto;
526
- flex: 1;
527
- min-height: 0;
528
- }
529
-
530
- section#persistedDataContent {
531
- h3 {
532
- display: flex;
533
- align-items: center;
534
- justify-content: center;
535
- gap: 8px;
536
- margin: 8px 10px;
537
- font-size: 12px;
538
- font-weight: bold;
539
- color: var(--inspector-color);
540
-
541
- }
542
-
543
- #persistedDataStorageTitle {
544
- display: flex;
545
- align-items: center;
546
- justify-content: center;
547
- }
548
-
549
- .persisted-key-section {
550
- width: 100%;
551
- display: flex;
552
- flex-direction: column;
553
- border: 1px solid var(--inspector-bg-dark);
554
- border-radius: 4px;
555
- }
556
-
557
- .persisted-key-caption {
558
- font-weight: bold;
559
- padding: 4px 8px;
560
- background-color: var(--inspector-bg-hover);
561
- border-radius: 4px 4px 0 0;
562
- border-bottom: 1px solid var(--inspector-bg-dark);
563
- display: flex;
564
- align-items: center;
565
- justify-content: end;
566
- width: 100%;
567
- box-sizing: border-box;
568
- }
569
-
570
- .caption-text {
571
- font-size: 12px;
572
- color: var(--inspector-color);
573
- }
574
-
575
- .caption-buttons {
576
- display: flex;
577
- align-items: center;
578
- justify-content: end;
579
- gap: 4px;
580
- flex-shrink: 0;
581
- }
582
-
583
- pre {
584
- padding: 8px;
585
- margin: 0;
586
- }
587
-
588
- table {
589
- width: 100%;
590
- border-collapse: collapse;
591
- font-family: monospace;
592
- }
593
-
594
- table th {
595
- background-color: var(--inspector-bg-dark);
596
- padding: 6px 10px;
597
- text-align: left;
598
- font-weight: bold;
599
- }
600
-
601
- table td {
602
- padding: 4px 10px;
603
- }
604
-
605
- table tr:nth-child(even) {
606
- background-color: var(--inspector-bg-hover);
607
- }
608
-
609
- table tr.matched td {
610
- color: var(--inspector-color-matched);
611
- }
612
-
613
- table tr.filtered td {
614
- color: var(--inspector-color-filtered);
615
- }
616
- }
617
-
618
- .filter-row-secondary {
619
- display: flex;
620
- align-items: center;
621
- justify-content: space-between;
622
- gap: 8px;
623
- width: 100%;
624
- }
625
- }
626
- }
627
-
628
-
629
- @media (prefers-color-scheme: dark) {
630
- :host {
631
- --inspector-bg: #202e37;
632
- --inspector-bg-light: #394a50;
633
- --inspector-bg-hover: #1a262e;
634
- --inspector-bg-dark: #577277;
635
- --inspector-color: #ebede9;
636
- --inspector-color-blur: #819796;
637
- --inspector-color-filtered: #f97583;
638
- --inspector-color-matched: #34d058;
639
- }
640
-
641
- header nav button {
642
- &[data-type="currentSignals"][aria-selected="true"] {
643
- background-color: var(--color-purple);
644
- color: var(--color-dark-text);
645
- border-color: var(--color-purple);
646
- }
647
-
648
- &[data-type="signalPatchEvent"][aria-selected="true"] {
649
- background-color: var(--color-gold);
650
- color: var(--color-dark-text);
651
- border-color: var(--color-gold);
652
- }
653
-
654
- &[data-type="sseEvent"][aria-selected="true"] {
655
- background-color: var(--color-html5);
656
- color: var(--color-white);
657
- border-color: var(--color-html5);
658
- }
659
-
660
- &[data-type="persistedData"][aria-selected="true"] {
661
- background-color: var(--inspector-color-matched);
662
- color: var(--color-white);
663
- border-color: var(--inspector-color-matched);
664
- }
665
- }
666
- }
667
- </style>
668
-
669
- <template id="copy-button-template">
670
- <button class="copy-btn" title="Copy to clipboard">
671
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
672
- <use href="#copy-icon"/>
673
- </svg>
674
- <span style="display: none"></span>
675
- </button>
676
- </template>
677
-
678
- <template id="log-button-template">
679
- <button class="log-btn" title="Log to the console">
680
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
681
- <path fill="currentColor" fill-rule="evenodd" d="M9.586 11L7.05 8.464L8.464 7.05l4.95 4.95l-4.95 4.95l-1.414-1.414L9.586 13H3v-2zM11 3h8c1.1 0 2 .9 2 2v14c0 1.1-.9 2-2 2h-8v-2h8V5h-8z"/>
682
- </svg>
683
- <span style="display: none"></span>
684
- </button>
685
- </template>
686
-
687
- <template id="clear-button-template">
688
- <button class="clear-btn" title="Clear persisted data">
689
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
690
- <use href="#clear-icon"/>
691
- </svg>
692
- <span>Clear</span>
693
- </button>
694
- </template>
695
-
696
- <svg style="display: none">
697
- <defs>
698
- <g id="datastar-logo">
699
- <g fill="#752438"><path d="m20 5h1v2h-1z"/><path d="m19 6h1v2h-1z"/><path d="m21 3h1v2h-1z"/><path d="m5 13h1v1h-1z"/><path d="m10 19h1v1h-1z"/><path d="m14 15h1v1h-1z"/><path d="m13 16h1v1h-1z"/><path d="m12 17h1v1h-1z"/><path d="m4 14h1v1h-1z"/><path d="m17 6h1v1h-1z"/></g>
700
- <g fill="#73bed3"><path d="m11 7h1v1h-1z"/><path d="m12 6h1v1h-1z"/><path d="m13 5h1v1h-1z"/><path d="m9 9h1v1h-1z"/><path d="m10 8h1v1h-1z"/></g>
701
- <g fill="#172038"><path d="m9 12h1v1h-1z"/><path d="m16 12h1v1h-1z"/><path d="m12 15h1v2h-1z"/><path d="m15 13h1v1h-1z"/><path d="m13 15h1v1h-1z"/><path d="m8 11h1v1h-1z"/><path d="m17 11h1v1h-1z"/><path d="m10 17h2v1h-2z"/><path d="m6 14h1v1h-1z"/><path d="m11 14h1v1h-1z"/><path d="m14 14h1v1h-1z"/><path d="m18 10h1v1h-1z"/></g>
702
- <g fill="#be772b"><path d="m8 19h1v2h-1z"/><path d="m5 20h2v1h-2z"/><path d="m9 18h1v1h-1z"/><path d="m5 16h1v1h-1z"/></g>
703
- <g fill="#da863e"><path d="m17 2h3v1h-3z"/><path d="m15 4h1v1h-1z"/><path d="m16 3h1v1h-1z"/></g>
704
- <g fill="#cf573c"><path d="m6 10h1v1h-1z"/><path d="m4 12h1v1h-1z"/><path d="m10 20h1v1h-1z"/><path d="m3 13h1v1h-1z"/><path d="m9 13h1v1h-1z"/><path d="m20 2h2v1h-2z"/><path d="m11 19h1v1h-1z"/><path d="m6 16h1v1h-1z"/><path d="m14 16h1v1h-1z"/><path d="m7 15h1v1h-1z"/><path d="m13 17h1v1h-1z"/><path d="m18 3h1v1h-1z"/><path d="m5 11h1v1h-1z"/><path d="m2 14h1v1h-1z"/><path d="m8 14h1v1h-1z"/><path d="m17 3h1v2h-1z"/><path d="m12 18h1v1h-1z"/></g>
705
- <g fill="#3c5e8b"><path d="m11 9h1v3h-1z"/><path d="m7 14h1v1h-1z"/><path d="m15 11h1v1h-1z"/><path d="m11 15h1v1h-1z"/><path d="m14 10h1v3h-1z"/><path d="m12 8h1v5h-1z"/><path d="m8 12h1v2h-1z"/><path d="m13 7h1v1h-1z"/><path d="m16 7h1v4h-1z"/><path d="m6 13h1v1h-1z"/><path d="m15 6h1v2h-1z"/><path d="m13 11h1v3h-1z"/><path d="m14 6h1v3h-1z"/><path d="m13 9h1v1h-1z"/><path d="m15 9h1v1h-1z"/><path d="m17 8h1v2h-1z"/><path d="m10 15h1v2h-1z"/><path d="m8 10h1v1h-1z"/><path d="m10 10h1v1h-1z"/></g>
706
- <g fill="#253a5e"><path d="m17 10h1v1h-1z"/><path d="m11 13h1v1h-1z"/><path d="m14 13h1v1h-1z"/><path d="m18 9h1v1h-1z"/><path d="m9 16h1v1h-1z"/><path d="m11 16h1v1h-1z"/><path d="m7 12h1v2h-1z"/><path d="m12 14h1v1h-1z"/><path d="m9 11h1v1h-1z"/><path d="m16 11h1v1h-1z"/><path d="m10 12h1v1h-1z"/><path d="m15 12h1v1h-1z"/></g>
707
- <g fill="#e8c170"><path d="m8 17h1v1h-1z"/><path d="m6 15h1v1h-1z"/><path d="m4 19h1v2h-1z"/><path d="m5 18h1v2h-1z"/><path d="m3 20h1v2h-1z"/><path d="m7 18h1v1h-1z"/></g>
708
- <g fill="#241527"><path d="m20 7h1v1h-1z"/><path d="m18 8h1v1h-1z"/><path d="m19 8h1v2h-1z"/><path d="m21 5h1v2h-1z"/></g>
709
- <g fill="#602c2c"><path d="m9 17h1v1h-1z"/><path d="m6 18h1v1h-1z"/></g>
710
- <g fill="#4f8fba"><path d="m11 8h1v1h-1z"/><path d="m7 11h1v1h-1z"/><path d="m10 11h1v1h-1z"/><path d="m13 6h1v1h-1z"/><path d="m13 14h1v1h-1z"/><path d="m9 10h1v1h-1z"/><path d="m6 12h1v1h-1z"/><path d="m11 12h1v1h-1z"/><path d="m14 5h1v1h-1z"/><path d="m10 9h1v1h-1z"/><path d="m12 13h1v1h-1z"/><path d="m12 7h1v1h-1z"/></g>
711
- <g fill="#a53030"><path d="m19 3h1v3h-1z"/><path d="m6 11h1v1h-1z"/><path d="m6 17h1v1h-1z"/><path d="m14 17h1v1h-1z"/><path d="m13 18h1v1h-1z"/><path d="m20 3h1v2h-1z"/><path d="m3 14h1v1h-1z"/><path d="m9 14h1v1h-1z"/><path d="m12 19h1v1h-1z"/><path d="m8 15h1v1h-1z"/><path d="m7 16h1v1h-1z"/><path d="m4 13h1v1h-1z"/><path d="m10 13h1v1h-1z"/><path d="m18 4h1v3h-1z"/><path d="m7 10h1v1h-1z"/><path d="m16 4h1v2h-1z"/><path d="m11 20h1v1h-1z"/><path d="m17 5h1v1h-1z"/><path d="m5 12h1v1h-1z"/><path d="m10 21h1v1h-1z"/><path d="m14 4h1v1h-1z"/></g>
712
- <g fill="#411d31"><path d="m15 5h1v1h-1z"/><path d="m8 16h1v1h-1z"/><path d="m9 15h1v1h-1z"/><path d="m17 7h2v1h-2z"/><path d="m16 6h1v1h-1z"/><path d="m5 14h1v1h-1z"/><path d="m10 14h1v1h-1z"/><path d="m10 18h2v1h-2z"/><path d="m7 17h1v1h-1z"/></g>
713
- <g fill="#a4dddb"><path d="m13 10h1v1h-1z"/><path d="m15 10h1v1h-1z"/><path d="m13 8h1v1h-1z"/><path d="m15 8h1v1h-1z"/><path d="m14 9h1v1h-1z"/></g>
714
- <g fill="#de9e41"><path d="m4 18h1v1h-1z"/><path d="m8 18h1v1h-1z"/><path d="m5 17h1v1h-1z"/><path d="m3 19h1v1h-1z"/><path d="m6 19h2v1h-2z"/></g>
715
- </g>
716
-
717
- <!-- Common icons -->
718
- <g id="copy-icon">
719
- <path fill="currentColor" d="M4 2h11v2H6v13H4zm4 4h12v16H8zm2 2v12h8V8z"/>
720
- </g>
721
-
722
- <g id="reset-icon">
723
- <path fill="currentColor" d="M11.77 3c-2.65.07-5 1.28-6.6 3.16L3.85 4.85a.5.5 0 0 0-.85.36V9.5c0 .28.22.5.5.5h4.29c.45 0 .67-.54.35-.85L6.59 7.59C7.88 6.02 9.82 5 12 5c4.32 0 7.74 3.94 6.86 8.41c-.54 2.77-2.81 4.98-5.58 5.47c-3.8.68-7.18-1.74-8.05-5.16c-.12-.42-.52-.72-.96-.72c-.65 0-1.14.61-.98 1.23C4.28 18.12 7.8 21 12 21c5.06 0 9.14-4.17 9-9.26c-.14-4.88-4.35-8.86-9.23-8.74M14 12c0-1.1-.9-2-2-2s-2 .9-2 2s.9 2 2 2s2-.9 2-2" />
724
- </g>
725
-
726
- <g id="refresh-icon">
727
- <path fill="currentColor" d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"/>
728
- </g>
729
-
730
- <g id="clear-icon">
731
- <path fill="currentColor" d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"/>
732
- </g>
733
-
734
- <g id="tree-icon">
735
- <path fill="currentColor" d="M240 128c-64 0 0 88-64 88H80c-64 0 0-88-64-88c64 0 0-88 64-88h96c64 0 0 88 64 88" opacity=".2"/>
736
- <path fill="currentColor" d="M43.18 128a29.8 29.8 0 0 1 8 10.26c4.8 9.9 4.8 22 4.8 33.74c0 24.31 1 36 24 36a8 8 0 0 1 0 16c-17.48 0-29.32-6.14-35.2-18.26c-4.8-9.9-4.8-22-4.8-33.74c0-24.31-1-36-24-36a8 8 0 0 1 0-16c23 0 24-11.69 24-36c0-11.72 0-23.84 4.8-33.74C50.68 38.14 62.52 32 80 32a8 8 0 0 1 0 16c-23 0-24 11.69-24 36c0 11.72 0 23.84-4.8 33.74A29.8 29.8 0 0 1 43.18 128M240 120c-23 0-24-11.69-24-36c0-11.72 0-23.84-4.8-33.74C205.32 38.14 193.48 32 176 32a8 8 0 0 0 0 16c23 0 24 11.69 24 36c0 11.72 0 23.84 4.8 33.74a29.8 29.8 0 0 0 8 10.26a29.8 29.8 0 0 0-8 10.26c-4.8 9.9-4.8 22-4.8 33.74c0 24.31-1 36-24 36a8 8 0 0 0 0 16c17.48 0 29.32-6.14 35.2-18.26c4.8-9.9 4.8-22 4.8-33.74c0-24.31 1-36 24-36a8 8 0 0 0 0-16"/>
737
- </g>
738
-
739
- <g id="table-icon">
740
- <path fill="currentColor" d="M5 21q-.825 0-1.412-.587T3 19V5q0-.825.588-1.412T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.587 1.413T19 21zm6-6H5v4h6zm2 0v4h6v-4zm-2-2V9H5v4zm2 0h6V9h-6zM5 7h14V5H5z"/>
741
- </g>
742
-
743
- <g id="local-storage-icon">
744
- <path fill="currentColor" d="M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V9A2,2 0 0,0 5,11V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V5C19,3.89 18.1,3 17,3Z"/>
745
- </g>
746
-
747
- <g id="session-storage-icon">
748
- <path fill="currentColor" d="M6 2v6h.01L6 8.01L10 12l-4 4-.01.01V22h12v-5.99l-.01-.01L14 12l4-3.99V8h-.01L18 2H6zm2 2h8v2.5L12 10 8 6.5V4zm8 16v-2.5L12 14l-4 3.5V20h8z"/>
749
- </g>
750
- </defs>
751
- </svg>
752
-
753
- <div id="collapsed">
754
- <h1>
755
- <svg viewBox="0 0 24 24" width="24" height="24" xmlns="http://www.w3.org/2000/svg">
756
- <use href="#datastar-logo"/>
757
- </svg>
758
- </h1>
759
- </div>
760
- <header style="display: none">
761
- <h1>
762
- <button aria-label="Collapse">\xBB</button>
763
- Datastar Inspector
764
- <svg viewBox="0 0 24 24" width="20" height="20" xmlns="http://www.w3.org/2000/svg">
765
- <use href="#datastar-logo"/>
766
- </svg>
767
- </h1>
768
- <nav>
769
- <button data-type="currentSignals" aria-selected="true" aria-label="Switch to current signals tab" title="Current signals with the ability to filter">
770
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M12.442 13.033c-.278.307-.319.777-.05 1.092c.27.314.747.353 1.033.053a7.5 7.5 0 1 0-10.85 0c.286.3.763.261 1.032-.053c.27-.315.23-.785-.05-1.092a6 6 0 1 1 8.884 0m-.987-1.15c-.265.318-.745.279-1.015-.036c-.27-.314-.223-.784.015-1.123a3 3 0 1 0-4.91 0c.238.339.284.809.015 1.123c-.27.315-.75.354-1.015.036a4.5 4.5 0 1 1 6.91 0M8 10.5a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3" clip-rule="evenodd"/></svg>
771
- <span id="currentSignalsCount">0</span>
772
- </button>
773
- <button data-type="signalPatchEvent" aria-selected="false" aria-label="Switch to signal patch events tab" title="Signal patch events">
774
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M5 3h2v2H5v5a2 2 0 0 1-2 2a2 2 0 0 1 2 2v5h2v2H5c-1.07-.27-2-.9-2-2v-4a2 2 0 0 0-2-2H0v-2h1a2 2 0 0 0 2-2V5a2 2 0 0 1 2-2m14 0a2 2 0 0 1 2 2v4a2 2 0 0 0 2 2h1v2h-1a2 2 0 0 0-2 2v4a2 2 0 0 1-2 2h-2v-2h2v-5a2 2 0 0 1 2-2a2 2 0 0 1-2-2V5h-2V3zm-7 12a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1m-4 0a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1m8 0a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1"/></svg>
775
- <span id="signalPatchEventCount">0</span>
776
- </button>
777
- <button data-type="sseEvent" aria-selected="false" aria-label="Switch to SSE tab" title="SSE events">
778
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="m12 17.56l4.07-1.13l.55-6.1H9.38L9.2 8.3h7.6l.2-1.99H7l.56 6.01h6.89l-.23 2.58l-2.22.6l-2.22-.6l-.14-1.66h-2l.29 3.19zM4.07 3h15.86L18.5 19.2L12 21l-6.5-1.8z"/></svg>
779
- <span id="sseEventCount">0</span>
780
- </button>
781
- <button data-type="persistedData" aria-selected="false" aria-label="Switch to persisted data tab" title="Persisted data from localStorage and sessionStorage">
782
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M4 2h14v2H4v16h2v-6h12v6h2V6h2v16H2V2zm4 18h8v-4H8zM20 6h-2V4h2zM6 6h9v4H6z"/></svg>
783
- <span id="persistedDataCount">0</span>
784
- </button>
785
- </nav>
786
- </header>
787
- <main style="display: none">
788
- <section id="currentSignalsContent" class="currentSignals">
789
- <div class="scroll-content">
790
- <ul>
791
- <li>
792
- <pre></pre>
793
- </li>
794
- </ul>
795
- </div>
796
- <footer class="filters">
797
- <div class="filter-row">
798
- <div class="input-with-icon">
799
- <input type="text" id="currentSignalsIncludeFilter" placeholder="Include filter (default: .*)" title="Only show signals matching this pattern. Use regex or exact match (with wildcard support). Default '.*' matches all signals." />
800
- </div>
801
- <div class="input-with-icon">
802
- <input type="text" id="currentSignalsExcludeFilter" placeholder="Exclude filter (default: (^|\\.)_)" title="Hide signals matching this pattern. Use regex or exact match (with wildcard support). Default '(^|\\.)_' hides signals starting with underscore or containing '._'." />
803
- </div>
804
- <button id="resetFilters" title="Reset filters">
805
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24">
806
- <use href="#reset-icon"/>
807
- </svg>
808
- </button>
809
- <label title="Enable wildcard matching (\`*\` matches any character)">
810
- <input type="checkbox" id="currentSignalsExactMatchCheckbox" />
811
- <span>Wildcard</span>
812
- </label>
813
- </div>
814
- <div class="filter-row-secondary">
815
- <div class="regex-display" id="currentSignalsRegexDisplay" style="display: none">
816
- <button id="copyFilterObject" title="Copy filter as regex object">
817
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24">
818
- <use href="#copy-icon"/>
819
- </svg>
820
- <span style="display: none"></span>
821
- </button>
822
- <span class="regex-content">
823
- <span class="regex-include"></span>
824
- <span class="regex-exclude"></span>
825
- </span>
826
- </div>
827
- <label title="Toggle between object and path view">
828
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 256 256">
829
- <use href="#tree-icon"/>
830
- </svg>
831
- <div class="toggle-switch">
832
- <input type="checkbox" id="currentSignalsTableViewCheckbox" />
833
- <span class="toggle-slider"></span>
834
- </div>
835
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
836
- <use href="#table-icon"/>
837
- </svg>
838
- </label>
839
- </div>
840
- </footer>
841
- </section>
842
- <section id="signalPatchEventContent" class="signalPatchEvents" style="display: none">
843
- <div class="scroll-content">
844
- <p>No events yet.</p>
845
- <ul></ul>
846
- </div>
847
- <footer>
848
- <label for="signalPatchMaxEvents">Max events:</label>
849
- <input type="number" id="signalPatchMaxEvents" placeholder="Max events" min="1" style="width: 80px;" />
850
- <button data-type="signalPatchEvent" style="display: none">Clear</button>
851
- </footer>
852
- </section>
853
- <section id="sseEventContent" class="sseEvents" style="display: none">
854
- <div class="scroll-content">
855
- <p>No events yet.</p>
856
- <ul></ul>
857
- </div>
858
- <footer>
859
- <label for="sseMaxEvents">Max events:</label>
860
- <input type="number" id="sseMaxEvents" placeholder="Max events" min="1" style="width: 80px;" />
861
- <button data-type="sseEvent" style="display: none">Clear</button>
862
- </footer>
863
- </section>
864
- <section id="persistedDataContent" class="persistedData" style="display: none">
865
- <div class="scroll-content">
866
- <h3>
867
- <span id="persistedDataStorageTitle">
868
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" style="vertical-align: middle;"><use href="#local-storage-icon"/></svg>
869
- Local Storage
870
- </span>
871
- <button id="refreshPersistedData" title="Refresh persisted data">
872
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24">
873
- <use href="#refresh-icon"/>
874
- </svg>
875
- <span style="display: none"></span>
876
- </button>
877
- </h3>
878
- <p>No persisted data found.</p>
879
- <ul>
880
- <li>
881
- <pre></pre>
882
- </li>
883
- </ul>
884
- </div>
885
- <footer class="filters">
886
- <div class="filter-row">
887
- <div class="input-with-icon">
888
- <input type="text" id="persistedDataIncludeFilter" placeholder="Include filter (default: .*)" title="Only show persisted data matching this pattern. Use regex or exact match (with wildcard support). Default '.*' matches all data." />
889
- </div>
890
- <div class="input-with-icon">
891
- <input type="text" id="persistedDataExcludeFilter" placeholder="Exclude filter (default: (^|\\.)_)" title="Hide persisted data matching this pattern. Use regex or exact match (with wildcard support). Default '(^|\\.)_' hides keys starting with underscore or containing '._'." />
892
- </div>
893
- <button id="resetPersistedDataFilters" title="Reset filters">
894
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24">
895
- <use href="#reset-icon"/>
896
- </svg>
897
- </button>
898
- <label title="Enable wildcard matching (\`*\` matches any character)">
899
- <input type="checkbox" id="persistedDataExactMatchCheckbox" />
900
- <span>Wildcard</span>
901
- </label>
902
- </div>
903
- <div class="filter-row-secondary">
904
- <div class="regex-display" id="persistedDataRegexDisplay">
905
- <button id="copyPersistedDataFilterObject" title="Copy filter as regex object">
906
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24">
907
- <use href="#copy-icon"/>
908
- </svg>
909
- <span style="display: none"></span>
910
- </button>
911
- <span class="regex-content">
912
- <span class="regex-include"></span>
913
- <span class="regex-exclude"></span>
914
- </span>
915
- </div>
916
- <label title="Toggle between localStorage and sessionStorage">
917
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
918
- <use href="#local-storage-icon"/>
919
- </svg>
920
- <div class="toggle-switch">
921
- <input type="checkbox" id="persistedDataStorageToggle" />
922
- <span class="toggle-slider"></span>
923
- </div>
924
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
925
- <use href="#session-storage-icon"/>
926
- </svg>
927
- </label>
928
- <label title="Toggle between object and path view">
929
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 256 256">
930
- <use href="#tree-icon"/>
931
- </svg>
932
- <div class="toggle-switch">
933
- <input type="checkbox" id="persistedDataTableViewCheckbox" />
934
- <span class="toggle-slider"></span>
935
- </div>
936
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
937
- <use href="#table-icon"/>
938
- </svg>
939
- </label>
940
- </div>
941
- </footer>
942
- </section>
943
- </main>`;var z=class extends HTMLElement{constructor(){super();this.expanded=!1;this.open=!1;this.tab="currentSignals";this.maxEventsVisible=20;this.signalPatchEventCount=0;this.sseEventCount=0;this.signalPatchEvents=void 0;this.sseEvents=void 0;this.currentSignalsIncludeFilter="";this.currentSignalsExcludeFilter="";this.currentSignalsUseExactMatch=!1;this.currentSignalsTableView=!1;this.currentSignals={};this.persistedDataIncludeFilter="";this.persistedDataExcludeFilter="";this.persistedDataUseExactMatch=!1;this.persistedDataTableView=!1;this.persistedDataUseSessionStorage=!1;this.persistedData={};this.persistedDataCount=0;this.highlightedElements=[];this.highlightStyleElement=null;this.attachShadow({mode:"open"});let t=sessionStorage.getItem("datastar-inspector-state");if(t){let s=JSON.parse(t);this.expanded=s.expanded??this.expanded,this.open=s.open??this.open,this.tab=s.tab??this.tab,this.currentSignalsIncludeFilter=s.currentSignalsIncludeFilter??this.currentSignalsIncludeFilter,this.currentSignalsExcludeFilter=s.currentSignalsExcludeFilter??this.currentSignalsExcludeFilter,this.currentSignalsUseExactMatch=s.currentSignalsUseExactMatch??this.currentSignalsUseExactMatch,this.currentSignalsTableView=s.currentSignalsTableView??this.currentSignalsTableView,this.persistedDataIncludeFilter=s.persistedDataIncludeFilter??this.persistedDataIncludeFilter,this.persistedDataExcludeFilter=s.persistedDataExcludeFilter??this.persistedDataExcludeFilter,this.persistedDataUseExactMatch=s.persistedDataUseExactMatch??this.persistedDataUseExactMatch,this.persistedDataTableView=s.persistedDataTableView??this.persistedDataTableView,this.persistedDataUseSessionStorage=s.persistedDataUseSessionStorage??this.persistedDataUseSessionStorage}}static get observedAttributes(){return["max-events-visible"]}connectedCallback(){this.render(),this.injectHighlightStyles(),document.addEventListener("datastar-fetch",this.handleSseEvent.bind(this)),document.addEventListener("datastar-signal-patch",this.handleSignalPatchEvent.bind(this)),window.addEventListener("storage",this.handleStorageChange.bind(this));let t=this.getAttribute("max-events-visible");if(t){let s=Number.parseInt(t,10);!Number.isNaN(s)&&s>0&&(this.maxEventsVisible=s)}this.updatePersistedDataCount()}disconnectedCallback(){this.removeEventListener("datastar-fetch",this.handleSseEvent),this.removeEventListener("datastar-signal-patch",this.handleSignalPatchEvent),window.removeEventListener("storage",this.handleStorageChange),this.removeHighlightStyles()}applyTheme(){let t=window.matchMedia("(prefers-color-scheme: dark)").matches;this.shadowRoot&&(this.shadowRoot.host.classList.toggle("dark-theme",t),this.shadowRoot.host.setAttribute("data-theme",t?"dark":"light")),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",s=>{this.shadowRoot&&(this.shadowRoot.host.classList.toggle("dark-theme",s.matches),this.shadowRoot.host.setAttribute("data-theme",s.matches?"dark":"light"))})}attributeChangedCallback(t,s,e){t==="max-events-visible"&&s!==e&&e!==null&&(this.maxEventsVisible=Number.parseInt(e,10),this.garbageCollectEvents(this.shadowRoot?.querySelector("#sseEventContent ul")),this.garbageCollectEvents(this.shadowRoot?.querySelector("#signalPatchEventContent ul")))}render(){if(!this.shadowRoot)return;this.shadowRoot.innerHTML=k,this.applyTheme(),this.renderExpand(),this.renderOpen(),this.renderTab();for(let e of this.shadowRoot.querySelectorAll("#collapsed, h1 button"))e.addEventListener("click",()=>this.toggleExpand());for(let e of this.shadowRoot.querySelectorAll("#collapsed, header"))e.addEventListener("click",()=>this.toggleOpen());for(let e of this.shadowRoot.querySelectorAll("header h1 button, header nav"))e.addEventListener("click",a=>a.stopPropagation());for(let e of this.shadowRoot.querySelectorAll("header nav button"))e.addEventListener("click",()=>this.selectTab(e.dataset.type||""));for(let e of this.shadowRoot.querySelectorAll("footer button[data-type]"))e.addEventListener("click",()=>this.clearEvents(e.dataset.type||""));let t=this.shadowRoot.querySelector("#signalPatchMaxEvents"),s=this.shadowRoot.querySelector("#sseMaxEvents");t&&(t.value=this.maxEventsVisible.toString(),t.addEventListener("input",()=>{let e=Number.parseInt(t.value,10);!Number.isNaN(e)&&e>0&&(this.maxEventsVisible=e,s&&(s.value=e.toString()),this.garbageCollectEvents(this.shadowRoot?.querySelector("#signalPatchEventContent ul")),this.garbageCollectEvents(this.shadowRoot?.querySelector("#sseEventContent ul")))})),s&&(s.value=this.maxEventsVisible.toString(),s.addEventListener("input",()=>{let e=Number.parseInt(s.value,10);!Number.isNaN(e)&&e>0&&(this.maxEventsVisible=e,t&&(t.value=e.toString()),this.garbageCollectEvents(this.shadowRoot?.querySelector("#signalPatchEventContent ul")),this.garbageCollectEvents(this.shadowRoot?.querySelector("#sseEventContent ul")))})),this.setupFilterHandlers(),this.setupPersistedDataHandlers(),this.tab==="persistedData"&&this.updatePersistedDataDisplay()}setupFilterHandlers(){if(!this.shadowRoot)return;let t=this.shadowRoot.querySelector("#currentSignalsIncludeFilter"),s=this.shadowRoot.querySelector("#currentSignalsExcludeFilter"),e=this.shadowRoot.querySelector("#currentSignalsExactMatchCheckbox"),a=this.shadowRoot.querySelector("#resetFilters"),i=this.shadowRoot.querySelector("#copyFilterObject"),n=this.shadowRoot.querySelector("#currentSignalsTableViewCheckbox");t&&(t.value=this.currentSignalsIncludeFilter||(this.currentSignalsUseExactMatch?"":".*"),t.addEventListener("input",()=>{this.currentSignalsIncludeFilter=t.value,this.saveState(),this.updateCurrentSignalsDisplay(),this.updateRegexDisplay()})),s&&(s.value=this.currentSignalsExcludeFilter||(this.currentSignalsUseExactMatch?"":"(^|\\.)_"),s.addEventListener("input",()=>{this.currentSignalsExcludeFilter=s.value,this.saveState(),this.updateCurrentSignalsDisplay(),this.updateRegexDisplay()})),e&&(e.checked=this.currentSignalsUseExactMatch,e.addEventListener("change",()=>{this.currentSignalsUseExactMatch=e.checked,this.saveState(),this.updateCurrentSignalsDisplay(),this.updateRegexDisplay()})),a&&a.addEventListener("click",()=>{this.currentSignalsIncludeFilter=".*",this.currentSignalsExcludeFilter="(^|\\.)_",this.currentSignalsUseExactMatch=!1,t.value=this.currentSignalsIncludeFilter,s.value=this.currentSignalsExcludeFilter,e.checked=this.currentSignalsUseExactMatch,this.saveState(),this.updateCurrentSignalsDisplay(),this.updateRegexDisplay()}),i&&i.addEventListener("click",()=>{this.copyFilterObject(i)}),n&&(n.checked=this.currentSignalsTableView,n.addEventListener("change",()=>{this.currentSignalsTableView=n.checked,this.saveState(),this.updateCurrentSignalsDisplay()})),this.updateRegexDisplay()}exactMatchAsRegex(t){return RegExp(`^${t.replace(/\./g,"\\.").replace(/\*/g,".*")}$`)}flattenObject(t,s="",e=0){let i=[];for(let[n,r]of Object.entries(t)){let o=s?`${s}.${n}`:n;if(!(/^_rocket\.[^.]+\.id\d+$/.test(o)&&r==="")){if((n==="computed"||o.endsWith(".computed"))&&r&&typeof r=="object"){let l=Object.entries(r);if(l.length>0)for(let[c,u]of l){let h=`${o}.${c}`,d=u;if(typeof u=="function")try{d=u()}catch{d="__error__"}d!==null&&typeof d=="object"?(i.push([h,"__object__"]),e<6?i.push(...this.flattenObject(d,h,e+1)):i.push([`${h}.__truncated__`,!0])):i.push([h,d])}continue}r!==null&&typeof r=="object"?(i.push([o,"__object__"]),e<6?Array.isArray(r)?r.forEach((l,c)=>{l!==null&&typeof l=="object"?i.push(...this.flattenObject(l,`${o}.${c}`,e+1)):i.push([`${o}.${c}`,l])}):i.push(...this.flattenObject(r,o,e+1)):i.push([`${o}.__truncated__`,!0])):i.push([o,r])}}return i}updateRegexDisplay(){if(!this.shadowRoot)return;let t=this.shadowRoot.querySelector("#currentSignalsRegexDisplay"),s=t?.querySelector(".regex-include"),e=t?.querySelector(".regex-exclude");if(!t||!s||!e)return;t.style.display="";let a=this.currentSignalsIncludeFilter||".*",i=this.currentSignalsExcludeFilter||"(^|\\.)_";s.textContent=this.currentSignalsUseExactMatch&&this.currentSignalsIncludeFilter?this.exactMatchAsRegex(a).toString():`/${a}/`,e.textContent=this.currentSignalsUseExactMatch&&this.currentSignalsExcludeFilter?this.exactMatchAsRegex(i).toString():`/${i}/`}copyFilterObject(t){let s=this.currentSignalsIncludeFilter||".*",e=this.currentSignalsExcludeFilter||"(^|\\.)_",a={include:this.currentSignalsUseExactMatch?this.exactMatchAsRegex(s).toString():`/${s}/`,exclude:this.currentSignalsUseExactMatch?this.exactMatchAsRegex(e).toString():`/${e}/`},i=`{ include: ${a.include}, exclude: ${a.exclude} }`,n=t.querySelector("span");navigator.clipboard.writeText(i).then(()=>{n.textContent="Copied",n.style.display=""}).catch(()=>{n.textContent="Copy failed",n.style.display=""}).finally(()=>{setTimeout(()=>{n.style.display="none"},2e3)})}updateCurrentSignalsDisplay(){this.currentSignalsTableView?this.updateCurrentSignalsTableDisplay():this.updateCurrentSignalsTreeDisplay()}updateCurrentSignalsTableDisplay(){let t=this.currentSignalsIncludeFilter||this.currentSignalsExcludeFilter,s=this.flattenObject(this.currentSignals),e=0,n=`
944
- <table class="signals-table">
945
- <thead>
946
- <tr>
947
- <th>Path</th>
948
- <th>Value</th>
949
- </tr>
950
- </thead>
951
- <tbody>
952
- ${s.map(([o,l])=>{let c=this.matchesFilter(o,this.currentSignalsIncludeFilter,this.currentSignalsExcludeFilter,this.currentSignalsUseExactMatch);return c&&e++,{path:o,value:l,matches:c}}).map(({path:o,value:l,matches:c})=>{let u=JSON.stringify(l),h=t?c?"matched":"filtered":"";return`<tr${h?` class="${h}"`:""}><td>${this.escapeHtml(o)}</td><td>${this.escapeHtml(u)}</td></tr>`}).join(`
953
- `)}
954
- </tbody>
955
- </table>
956
- `;this.setTextContent("#currentSignalsCount",t?`${e}/${s.length}`:s.length);let r=this.shadowRoot?.querySelector("#currentSignalsContent ul li");r&&(r.innerHTML=`<div style="flex: 1; overflow-x: auto;">${n}</div>`,this.addCurrentSignalsButtons(r),this.addHoverHandlersToSignalPaths(r))}escapeHtml(t){let s=document.createElement("div");return s.textContent=t,s.innerHTML}updateCurrentSignalsTreeDisplay(){let t=this.currentSignalsIncludeFilter||this.currentSignalsExcludeFilter,s=new Set,e=0;if(t){let c=this.flattenObject(this.currentSignals);for(let[u]of c)if(this.matchesFilter(u,this.currentSignalsIncludeFilter,this.currentSignalsExcludeFilter,this.currentSignalsUseExactMatch)){e++;let h=u.split(".");for(let d=1;d<=h.length;d++)s.add(h.slice(0,d).join("."))}}let a=c=>{let u={};if(c&&typeof c=="object")for(let[h,d]of Object.entries(c))if(typeof d=="function")try{u[h]=d()}catch{u[h]="__error__"}else u[h]=d;return u},i=(c,u="",h=" ")=>{let d=[],x=Object.entries(c);return x.forEach(([m,g],v)=>{if((m==="computed"||u&&`${u}.${m}`.endsWith(".computed"))&&g&&typeof g=="object"){let S=a(g);if(Object.keys(S).length===0)return;g=S}let p=u?`${u}.${m}`:m,f=v===x.length-1,b=s.has(p),y;if(t?y=b?'class="matched"':'class="filtered"':y=`data-path="${p}"`,g!==null&&typeof g=="object"&&!Array.isArray(g)){d.push(`${h}<span ${y}>"${m}": {`);let S=i(g,p,`${h} `);d.push(...S),d.push(`${h}}${f?"</span>":",</span>"}`)}else{let C=JSON.stringify(g,null,2).split(`
957
- `);d.push(`${h}<span ${y}>"${m}": ${this.escapeHtml(C[0])}`);for(let w=1;w<C.length;w++)d.push(`${h}${this.escapeHtml(C[w])}`);d[d.length-1]+=f?"</span>":",</span>"}}),d},n=[],r=t&&e>0;n.push(r?'<span class="matched">{</span>':"{"),n.push(...i(this.currentSignals)),n.push(r?'<span class="matched">}</span>':"}");let o=this.flattenObject(this.currentSignals).length;this.setTextContent("#currentSignalsCount",t?`${e}/${o}`:o);let l=this.shadowRoot?.querySelector("#currentSignalsContent ul li");l&&(l.innerHTML=`<div style="flex: 1; overflow-x: auto;"><pre>${n.join(`
958
- `)}</pre></div>`,this.addCurrentSignalsButtons(l),this.addHoverHandlersToSignalPaths(l))}handleSignalPatchEvent(t){let s=t.detail,e=s;try{e=JSON.parse(JSON.stringify(s))}catch{}let a=this.safeSerialize(s);this.applyPatch(e),this.signalPatchEventCount++,this.setTextContent("#signalPatchEventCount",this.signalPatchEventCount),this.appendEvent(this.signalPatchEventCount,"#signalPatchEventContent",a,this.safeSerialize(s,!0),s,!0)}safeSerialize(t,s=!1){let e=new WeakSet,a=4,i=200,n=(r,o)=>{if(r===null||typeof r!="object")return r;if(typeof r=="function")return"__fn__";if(typeof Element<"u"&&r instanceof Element)return"__element__";if(e.has(r))return"__cycle__";if(o>=a)return"__truncated__";if(e.add(r),Array.isArray(r))return r.slice(0,i).map(u=>n(u,o+1));let l={},c=0;for(let[u,h]of Object.entries(r))if(l[u]=n(h,o+1),c+=1,c>=i){l.__truncated__=!0;break}return l};try{return JSON.stringify(n(t,0),null,s?2:void 0)}catch{return"{}"}}applyPatch(t){let s=(a,i="",n=[])=>{for(let[r,o]of Object.entries(a)){let l=i?`${i}.${r}`:r;o&&typeof o=="object"&&!Array.isArray(o)&&Object.keys(o).length>0?s(o,l,n):n.push([l,o])}return n},e=(a,i)=>{let n=a.split("."),r=this.currentSignals;for(let l=0;l<n.length-1;l+=1){let c=n[l];(r[c]===void 0||r[c]===null||typeof r[c]!="object")&&(r[c]={}),r=r[c]}let o=n[n.length-1];i===null?delete r[o]:r[o]=i};for(let[a,i]of s(t)){if(i===""&&/^_rocket\.[^.]+\.id\d+$/.test(a)){e(a,null);continue}e(a,i)}this.updateCurrentSignalsDisplay()}handleSseEvent(t){let s=t.detail;if(!s.type.startsWith("datastar-"))return;this.sseEventCount++,this.setTextContent("#sseEventCount",this.sseEventCount);let e="",a=s.argsRaw;for(let[i,n]of Object.entries(a))e+=`data: ${i} ${n}
959
- `;e=e.trimEnd(),this.appendEvent(this.sseEventCount,"#sseEventContent",`event: ${s.type}`,e,s,!1)}toggleExpand(){this.expanded=!this.expanded,this.renderExpand(),this.saveState()}renderExpand(){this.setVisibility("#collapsed",!this.expanded),this.setVisibility("header",this.expanded),this.expanded||(this.open=!0,this.toggleOpen())}toggleOpen(){this.open=!this.open,this.renderOpen(),this.saveState()}renderOpen(){this.setVisibility("main",this.open)}selectTab(t){this.open=!0,this.tab=t,this.renderTab(),this.saveState(),t==="persistedData"&&this.updatePersistedDataDisplay()}renderTab(){this.setAttributeValue("header button","aria-selected","false"),this.setAttributeValue(`header button[data-type=${this.tab}]`,"aria-selected","true"),this.setVisibility("main",this.open),this.setVisibility("main section",!1),this.setVisibility(`#${this.tab}Content`,!0),this.saveState()}saveState(){let t={expanded:this.expanded,open:this.open,tab:this.tab,currentSignalsIncludeFilter:this.currentSignalsIncludeFilter,currentSignalsExcludeFilter:this.currentSignalsExcludeFilter,currentSignalsUseExactMatch:this.currentSignalsUseExactMatch,currentSignalsTableView:this.currentSignalsTableView,persistedDataIncludeFilter:this.persistedDataIncludeFilter,persistedDataExcludeFilter:this.persistedDataExcludeFilter,persistedDataUseExactMatch:this.persistedDataUseExactMatch,persistedDataTableView:this.persistedDataTableView,persistedDataUseSessionStorage:this.persistedDataUseSessionStorage};sessionStorage.setItem("datastar-inspector-state",JSON.stringify(t))}clearEvents(t){t==="sse"?this.sseEventCount=0:this.signalPatchEventCount=0,this.setTextContent(`#${t}Count`,0),this.setInnerHtml(`#${t}Content ul`,""),this.setVisibility(`#${t}Content footer button[data-type]`,!1),this.setVisibility(`#${t}Content p`,!0)}setTextContent(t,s){let e=this.shadowRoot?.querySelector(t);e&&(e.textContent=`${s}`)}setInnerHtml(t,s){let e=this.shadowRoot?.querySelector(t);e&&(e.innerHTML=s)}setAttributeValue(t,s,e){for(let a of this.shadowRoot?.querySelectorAll(t)||[])a.setAttribute(s,e)}setVisibility(t,s){this.setAttributeValue(t,"style",s?"":"display: none;")}appendEvent(t,s,e,a,i,n){let r=this.shadowRoot?.querySelector(`${s} ul`);if(!r)return;let o=document.createElement("div"),l=document.createElement("span");l.textContent=`${t}.`;let c=document.createElement("details"),u=document.createElement("summary");n&&(u.className="blurrable"),u.textContent=e;let h=document.createElement("pre");h.textContent=a,c.appendChild(u),c.appendChild(h),o.appendChild(l),o.appendChild(c);let m=(this.shadowRoot?.querySelector("#copy-button-template")).content.cloneNode(!0).querySelector("button"),g=m.querySelector("span");m.onclick=()=>{let S=e.startsWith("event:")?`${e}
960
- ${a}`:a;navigator.clipboard.writeText(S).then(()=>{g.textContent="Copied",g.style.display=""}).catch(()=>{g.textContent="Copy Failed",g.style.display=""}).finally(()=>{setTimeout(()=>{g.style.display="none"},2e3)})};let f=(this.shadowRoot?.querySelector("#log-button-template")).content.cloneNode(!0).querySelector("button"),b=f.querySelector("span");f.onclick=()=>{console.log(i),b.textContent="Logged",b.style.display="",setTimeout(()=>{b.style.display="none"},2e3)};let y=document.createElement("li");y.appendChild(o),y.appendChild(m),y.appendChild(f),r.prepend(y),this.garbageCollectEvents(r),this.setVisibility(`${s} footer button[data-type]`,!0),this.setVisibility(`${s} p`,!1)}createButton(t,s){let e=document.createElement("button");return e.textContent=t,e.onclick=s,e}garbageCollectEvents(t){if(t)for(;t.children.length>this.maxEventsVisible;)t.removeChild(t.lastChild)}addCurrentSignalsButtons(t){let a=(this.shadowRoot?.querySelector("#copy-button-template")).content.cloneNode(!0).querySelector("button"),i=a.querySelector("span");a.onclick=()=>{let c=JSON.stringify(this.currentSignals,null,2);navigator.clipboard.writeText(c).then(()=>{i.textContent="Copied",i.style.display=""}).catch(()=>{i.textContent="Copy Failed",i.style.display=""}).finally(()=>{setTimeout(()=>{i.style.display="none"},2e3)})};let o=(this.shadowRoot?.querySelector("#log-button-template")).content.cloneNode(!0).querySelector("button"),l=o.querySelector("span");o.onclick=()=>{console.log(this.currentSignals),l.textContent="Logged",l.style.display="",setTimeout(()=>{l.style.display="none"},2e3)},t.appendChild(a),t.appendChild(o),this.addHoverHandlersToSignalPaths(t)}matchesFilter(t,s,e,a){let i=s||".*",n=e||"(^|\\.)_";if(a){let r=this.exactMatchAsRegex(i),o=this.exactMatchAsRegex(n);return r.test(t)&&!o.test(t)}try{let r=new RegExp(i),o=new RegExp(n);return r.test(t)&&!o.test(t)}catch{return t.includes(i)&&!t.includes(n)}}injectHighlightStyles(){this.highlightStyleElement||(this.highlightStyleElement=document.createElement("style"),this.highlightStyleElement.textContent=`
961
- @keyframes datastar-highlight-pulse {
962
- 0% {
963
- box-shadow:
964
- 0 0 0 2px rgba(165, 153, 255, 0.8),
965
- 0 0 0 6px rgba(165, 153, 255, 0.4),
966
- 0 0 16px 4px rgba(165, 153, 255, 0.6);
967
- background-color: rgba(165, 153, 255, 0.2);
968
- }
969
- 50% {
970
- box-shadow:
971
- 0 0 0 4px rgba(165, 153, 255, 1),
972
- 0 0 0 12px rgba(165, 153, 255, 0.6),
973
- 0 0 32px 8px rgba(165, 153, 255, 0.8);
974
- background-color: rgba(165, 153, 255, 0.4);
975
- }
976
- 100% {
977
- box-shadow:
978
- 0 0 0 2px rgba(165, 153, 255, 0.8),
979
- 0 0 0 6px rgba(165, 153, 255, 0.4),
980
- 0 0 16px 4px rgba(165, 153, 255, 0.6);
981
- background-color: rgba(165, 153, 255, 0.2);
982
- }
983
- }
984
-
985
- .datastar-signal-highlight {
986
- animation: datastar-highlight-pulse 0.8s ease-in-out infinite !important;
987
- position: relative !important;
988
- z-index: 9998 !important;
989
- }
990
- `,document.head.appendChild(this.highlightStyleElement))}removeHighlightStyles(){this.highlightStyleElement&&(document.head.removeChild(this.highlightStyleElement),this.highlightStyleElement=null)}findElementsUsingSignal(t){let s=[],e=this.generateSignalPatterns(t),a=document.querySelectorAll("*");for(let i of a){let n=i.attributes;for(let r of n)if(r.name.startsWith("data-")&&this.attributeUsesSignal(r.value,e)){s.push(i);break}}return s}generateSignalPatterns(t){let s=[],e=t.split(".");for(let a=e.length;a>0;a--){let i=e.slice(0,a).join(".");s.push(`$${i}`)}return s}attributeUsesSignal(t,s){for(let e of s)if(new RegExp(`\\${e.replace(".","\\.")}(?![a-zA-Z0-9_])`,"g").test(t))return!0;return!1}highlightElements(t){this.clearHighlights();for(let s of t)s.classList.add("datastar-signal-highlight"),this.highlightedElements.push(s)}clearHighlights(){for(let t of this.highlightedElements)t.classList.remove("datastar-signal-highlight");this.highlightedElements=[]}addHoverHandlersToSignalPaths(t,s="current"){let e=this.extractSignalPaths(t,s);for(let a of e)a.element.classList.add("signal-path-hoverable"),a.element.addEventListener("mouseenter",()=>{let i=this.findElementsUsingSignal(a.path);this.highlightElements(i)}),a.element.addEventListener("mouseleave",()=>{this.clearHighlights()})}extractSignalPaths(t,s){let e=[],a=s==="current"?this.currentSignalsTableView:this.persistedDataTableView,i=s==="current"?this.currentSignals:this.persistedData;if(a){let n=t.querySelectorAll("td:first-child");for(let r of n){let o=r.textContent?.trim();o&&e.push({element:r,path:o})}}else{let n=s==="persisted"?Array.from(t.querySelectorAll("pre")):[t.querySelector("pre")].filter(r=>r!==null);for(let r of n){let o=r.querySelectorAll("span"),l=new Set;for(let h of o){let d=h.getAttribute("data-path");if(d&&!l.has(d)){l.add(d),e.push({element:h,path:d});continue}let m=(h.textContent||"").match(/"([^"]+)":\s*/);if(m){let g=m[1];if(s==="current"){let v=this.flattenObject(i);for(let[p]of v)if(p.endsWith(g)||p===g){l.has(p)||(l.add(p),e.push({element:h,path:p}));break}}else for(let[,v]of Object.entries(i)){let p=this.flattenObject(v);for(let[f]of p)if(f.endsWith(g)||f===g){l.has(f)||(l.add(f),e.push({element:h,path:f}));break}}}}let c=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,{acceptNode:h=>h.parentElement?.tagName==="SPAN"?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}),u;for(;u=c.nextNode();){let d=(u.textContent||"").match(/"([^"]+)":\s*/);if(d){let x=d[1],m=u.parentElement;if(m){let g=new Set;if(s==="current"){let v=this.flattenObject(i);for(let[p]of v)if(p.endsWith(x)||p===x){g.has(p)||(g.add(p),e.push({element:m,path:p}));break}}else for(let[,v]of Object.entries(i)){let p=this.flattenObject(v);for(let[f]of p)if(f.endsWith(x)||f===x){g.has(f)||(g.add(f),e.push({element:m,path:f}));break}}}}}}}return e}handleStorageChange(){this.updatePersistedDataCount(),this.tab==="persistedData"&&this.updatePersistedDataDisplay()}updatePersistedDataCount(){let t=this.persistedDataUseSessionStorage?sessionStorage:localStorage,e=this.getDatastarPersistKeys().filter(a=>t.getItem(a)!==null).length;this.setTextContent("#persistedDataCount",e)}getDatastarPersistKeys(){let t=new Set,s=document.querySelectorAll("*");for(let e of s)for(let a of e.attributes)if(a.name.startsWith("data-persist")){let i=a.name;if(i==="data-persist")t.add("datastar");else if(i.startsWith("data-persist-")){let n=i.substring(13),[r]=n.split("__");r&&t.add(r)}}return Array.from(t)}updatePersistedDataDisplay(){let t=this.persistedDataUseSessionStorage?sessionStorage:localStorage,s=this.getDatastarPersistKeys(),e={},a=[];for(let n of s){let r=t.getItem(n);if(r!==null){a.push(n);try{e[n]=JSON.parse(r)}catch{e[n]=r}}}this.persistedData=e,this.persistedDataCount=a.length,this.setTextContent("#persistedDataCount",this.persistedDataCount);let i=this.shadowRoot?.querySelector("#persistedDataContent p");if(i&&(i.style.display=a.length===0?"":"none"),a.length===0){let n=this.shadowRoot?.querySelector("#persistedDataContent ul");n&&(n.innerHTML="");return}this.persistedDataTableView?this.updatePersistedDataTableDisplay():this.updatePersistedDataTreeDisplay()}updatePersistedDataTableDisplay(){let t=this.persistedDataUseSessionStorage?sessionStorage:localStorage,s=this.getDatastarPersistKeys(),e={};for(let l of s){let c=t.getItem(l);if(c!==null)try{e[l]=JSON.parse(c)}catch{e[l]=c}}let a=this.persistedDataIncludeFilter||this.persistedDataExcludeFilter,i=0,n=0,r=Object.entries(e).map(([l,c])=>{let u=this.flattenObject(c);n+=u.length;let d=u.map(([x,m])=>{let g=this.matchesFilter(x,this.persistedDataIncludeFilter,this.persistedDataExcludeFilter,this.persistedDataUseExactMatch);return g&&i++,{path:x,value:m,matches:g}}).map(({path:x,value:m,matches:g})=>{let v=JSON.stringify(m),p=a?g?"matched":"filtered":"";return`<tr${p?` class="${p}"`:""}><td>${this.escapeHtml(x)}</td><td>${this.escapeHtml(v)}</td></tr>`}).join(`
991
- `);return`
992
- <div class="persisted-key-section">
993
- <div class="persisted-key-caption">
994
- <div class="caption-text">${this.escapeHtml(l)}</div>
995
- <div class="caption-buttons" data-key="${this.escapeHtml(l)}"></div>
996
- </div>
997
- <table>
998
- <thead>
999
- <tr>
1000
- <th class="thin">Path</th>
1001
- <th>Value</th>
1002
- </tr>
1003
- </thead>
1004
- <tbody>
1005
- ${d}
1006
- </tbody>
1007
- </table>
1008
- </div>
1009
- `}).join(`
1010
- `);this.setTextContent("#persistedDataCount",a?`${i}/${n}`:n);let o=this.shadowRoot?.querySelector("#persistedDataContent ul");if(o){o.innerHTML=`<li><div style="flex: 1; overflow-x: auto;">${r}</div></li>`;let l=o.querySelector("li");l&&this.addPersistedDataButtons(l)}}updatePersistedDataTreeDisplay(){let t=this.persistedDataUseSessionStorage?sessionStorage:localStorage,s=this.getDatastarPersistKeys(),e={};for(let l of s){let c=t.getItem(l);if(c!==null)try{e[l]=JSON.parse(c)}catch{e[l]=c}}let a=this.persistedDataIncludeFilter||this.persistedDataExcludeFilter,i=0,n=0,r=Object.entries(e).map(([l,c])=>{let u=this.flattenObject(c);n+=u.length;let h=new Set;if(a){for(let[m]of u)if(this.matchesFilter(m,this.persistedDataIncludeFilter,this.persistedDataExcludeFilter,this.persistedDataUseExactMatch)){i++;let g=m.split(".");for(let v=1;v<=g.length;v++)h.add(g.slice(0,v).join("."))}}let d=(m,g="",v=" ")=>{let p=[],f=Object.entries(m);return f.forEach(([b,y],S)=>{let C=g?`${g}.${b}`:b,w=S===f.length-1,T=h.has(C);if(y!==null&&typeof y=="object"&&!Array.isArray(y)){a?T?p.push(`${v}<span class="matched">"${b}": {`):p.push(`${v}<span class="filtered">"${b}": {`):p.push(`${v}"${b}": {`);let M=d(y,C,`${v} `);p.push(...M),a?p.push(`${v}}${w?"</span>":",</span>"}`):p.push(`${v}}${w?"":","}`)}else{let E=JSON.stringify(y,null,2).split(`
1011
- `);if(a){T?p.push(`${v}<span class="matched">"${b}": ${this.escapeHtml(E[0])}`):p.push(`${v}<span class="filtered">"${b}": ${this.escapeHtml(E[0])}`);for(let D=1;D<E.length;D++)p.push(`${v}${E[D]}`);p[p.length-1]+=w?"</span>":",</span>"}else{p.push(`${v}"${b}": ${this.escapeHtml(E[0])}`);for(let D=1;D<E.length;D++)p.push(`${v}${this.escapeHtml(E[D])}`);w||(p[p.length-1]+=",")}}}),p},x=[];return x.push("{"),x.push(...d(c)),x.push("}"),`
1012
- <div class="persisted-key-section">
1013
- <div class="persisted-key-caption">
1014
- <div class="caption-text">${this.escapeHtml(l)}</div>
1015
- <div class="caption-buttons" data-key="${this.escapeHtml(l)}"></div>
1016
- </div>
1017
- <pre>${x.join(`
1018
- `)}</pre>
1019
- </div>
1020
- `}).join(`
1021
- `);this.setTextContent("#persistedDataCount",a?`${i}/${n}`:n);let o=this.shadowRoot?.querySelector("#persistedDataContent ul");if(o){o.innerHTML=`<li><div style="flex: 1; overflow-x: auto;">${r}</div></li>`;let l=o.querySelector("li");l&&this.addPersistedDataButtons(l)}}setupPersistedDataHandlers(){if(!this.shadowRoot)return;let t=this.shadowRoot.querySelector("#persistedDataIncludeFilter");t&&(this.persistedDataIncludeFilter||(this.persistedDataIncludeFilter=".*"),t.value=this.persistedDataIncludeFilter,t.addEventListener("input",()=>{this.persistedDataIncludeFilter=t.value,this.saveState(),this.updatePersistedDataDisplay(),this.updatePersistedDataRegexDisplay()}));let s=this.shadowRoot.querySelector("#persistedDataExcludeFilter");s&&(this.persistedDataExcludeFilter||(this.persistedDataExcludeFilter="(^|\\.)_"),s.value=this.persistedDataExcludeFilter,s.addEventListener("input",()=>{this.persistedDataExcludeFilter=s.value,this.saveState(),this.updatePersistedDataDisplay(),this.updatePersistedDataRegexDisplay()}));let e=this.shadowRoot.querySelector("#persistedDataExactMatchCheckbox");e&&(e.checked=this.persistedDataUseExactMatch,e.addEventListener("change",()=>{this.persistedDataUseExactMatch=e.checked,this.saveState(),this.updatePersistedDataDisplay(),this.updatePersistedDataRegexDisplay()}));let a=this.shadowRoot.querySelector("#persistedDataTableViewCheckbox");a&&(a.checked=this.persistedDataTableView,a.addEventListener("change",()=>{this.persistedDataTableView=a.checked,this.saveState(),this.updatePersistedDataDisplay()}));let i=this.shadowRoot.querySelector("#persistedDataStorageToggle");i&&(i.checked=this.persistedDataUseSessionStorage,i.addEventListener("change",()=>{this.persistedDataUseSessionStorage=i.checked,this.updateStorageTitle(),this.saveState(),this.updatePersistedDataCount(),this.updatePersistedDataDisplay()}));let n=this.shadowRoot.querySelector("#refreshPersistedData");n&&n.addEventListener("click",()=>{this.updatePersistedDataCount(),this.updatePersistedDataDisplay()});let r=this.shadowRoot.querySelector("#resetPersistedDataFilters");r&&r.addEventListener("click",()=>{this.persistedDataIncludeFilter=".*",this.persistedDataExcludeFilter="(^|\\.)_",this.persistedDataUseExactMatch=!1,t.value=this.persistedDataIncludeFilter,s.value=this.persistedDataExcludeFilter,e.checked=this.persistedDataUseExactMatch,this.saveState(),this.updatePersistedDataDisplay(),this.updatePersistedDataRegexDisplay()});let o=this.shadowRoot.querySelector("#copyPersistedDataFilterObject");o&&o.addEventListener("click",()=>{this.copyPersistedDataFilterObject(o)}),this.updatePersistedDataRegexDisplay(),this.updateStorageTitle()}updateStorageTitle(){if(!this.shadowRoot)return;let t=this.shadowRoot.querySelector("#persistedDataStorageTitle");t&&(this.persistedDataUseSessionStorage?t.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" style="vertical-align: middle; margin-right: 4px;"><use href="#session-storage-icon"/></svg>Session Storage':t.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" style="vertical-align: middle; margin-right: 4px;"><use href="#local-storage-icon"/></svg>Local Storage')}updatePersistedDataRegexDisplay(){if(!this.shadowRoot)return;let t=this.shadowRoot.querySelector("#persistedDataRegexDisplay"),s=t?.querySelector(".regex-include"),e=t?.querySelector(".regex-exclude");if(!t||!s||!e)return;let a=this.persistedDataIncludeFilter||".*",i=this.persistedDataExcludeFilter||"(^|\\.)_";s.textContent=this.persistedDataUseExactMatch&&this.persistedDataIncludeFilter?this.exactMatchAsRegex(a).toString():`/${a}/`,e.textContent=this.persistedDataUseExactMatch&&this.persistedDataExcludeFilter?this.exactMatchAsRegex(i).toString():`/${i}/`}copyPersistedDataFilterObject(t){let s=this.persistedDataIncludeFilter||".*",e=this.persistedDataExcludeFilter||"(^|\\.)_",a={include:this.persistedDataUseExactMatch?this.exactMatchAsRegex(s).toString():`/${s}/`,exclude:this.persistedDataUseExactMatch?this.exactMatchAsRegex(e).toString():`/${e}/`},i=`{ include: ${a.include}, exclude: ${a.exclude} }`,n=t.querySelector("span");navigator.clipboard.writeText(i).then(()=>{n.textContent="Copied",n.style.display=""}).catch(()=>{n.textContent="Copy failed",n.style.display=""}).finally(()=>{setTimeout(()=>{n.style.display="none"},2e3)})}addPersistedDataButtons(t){t.querySelectorAll(".caption-buttons").forEach(e=>{let a=e.getAttribute("data-key");if(!a||!this.persistedData[a])return;let i=this.persistedData[a],o=(this.shadowRoot?.querySelector("#copy-button-template")).content.cloneNode(!0).querySelector("button"),l=o.querySelector("span");o.onclick=()=>{let v=JSON.stringify(i,null,2);navigator.clipboard.writeText(v).then(()=>{l.textContent="Copied",l.style.display=""}).catch(()=>{l.textContent="Copy Failed",l.style.display=""}).finally(()=>{setTimeout(()=>{l.style.display="none"},2e3)})};let u=(this.shadowRoot?.querySelector("#log-button-template")).content.cloneNode(!0),h=u.querySelector("button"),d=h.querySelector("span");h.onclick=()=>{console.log(i),d.textContent="Logged",d.style.display="",setTimeout(()=>{d.style.display="none"},2e3)};let g=(this.shadowRoot?.querySelector("#clear-button-template")).content.cloneNode(!0).querySelector("button");g.onclick=()=>{confirm("Clear persisted data? This cannot be undone.")&&((this.persistedDataUseSessionStorage?sessionStorage:localStorage).removeItem(a),this.updatePersistedDataCount(),this.updatePersistedDataDisplay())},e.appendChild(o),e.appendChild(u),e.appendChild(g)}),this.addHoverHandlersToSignalPaths(t,"persisted")}};customElements.define("datastar-inspector",z);