js.foresight-devtools 1.4.0 → 2.0.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.
- package/LICENSE +21 -0
- package/README.md +9 -4
- package/dist/index.d.mts +627 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2197 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +64 -65
- package/dist/index.d.ts +0 -569
- package/dist/index.js +0 -2031
package/dist/index.js
DELETED
|
@@ -1,2031 +0,0 @@
|
|
|
1
|
-
var ze=Object.defineProperty;var He=Object.getOwnPropertyDescriptor;var n=(o,r,e,t)=>{for(var i=t>1?void 0:t?He(r,e):r,a=o.length-1,s;a>=0;a--)(s=o[a])&&(i=(t?s(r,e,i):s(i))||i);return t&&i&&ze(r,e,i),i};import{LitElement as zn,css as Hn,html as je}from"lit";import{customElement as Bn,state as Gn}from"lit/decorators.js";import{LitElement as yn,css as wn,html as xn}from"lit";import{customElement as kn,state as q}from"lit/decorators.js";import{classMap as re}from"lit/directives/class-map.js";import{ForesightManager as Fe}from"js.foresight";import{css as St,html as W,LitElement as Tt}from"lit";import{customElement as Dt,state as $}from"lit/decorators.js";import{map as Me}from"lit/directives/map.js";import{ForesightManager as I}from"js.foresight";import{html as c}from"lit";var le=c`
|
|
2
|
-
<svg
|
|
3
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
-
width="16"
|
|
5
|
-
height="16"
|
|
6
|
-
viewBox="0 0 24 24"
|
|
7
|
-
fill="none"
|
|
8
|
-
stroke="currentColor"
|
|
9
|
-
stroke-width="2"
|
|
10
|
-
stroke-linecap="round"
|
|
11
|
-
stroke-linejoin="round"
|
|
12
|
-
>
|
|
13
|
-
<rect x="2" y="2" width="20" height="15" rx="2" ry="2"></rect>
|
|
14
|
-
<line x1="2" y1="17" x2="22" y2="17"></line>
|
|
15
|
-
<line x1="7" y1="21" x2="17" y2="21"></line>
|
|
16
|
-
<line x1="12" y1="17" x2="12" y2="21"></line>
|
|
17
|
-
</svg>
|
|
18
|
-
`,ce=c`
|
|
19
|
-
<svg
|
|
20
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
21
|
-
width="16"
|
|
22
|
-
height="16"
|
|
23
|
-
viewBox="0 0 24 24"
|
|
24
|
-
fill="none"
|
|
25
|
-
stroke="currentColor"
|
|
26
|
-
stroke-width="2"
|
|
27
|
-
stroke-linecap="round"
|
|
28
|
-
stroke-linejoin="round"
|
|
29
|
-
>
|
|
30
|
-
<polyline points="4 17 10 11 4 5"></polyline>
|
|
31
|
-
<line x1="12" y1="19" x2="20" y2="19"></line>
|
|
32
|
-
</svg>
|
|
33
|
-
`,de=c`
|
|
34
|
-
<svg
|
|
35
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
36
|
-
width="16"
|
|
37
|
-
height="16"
|
|
38
|
-
viewBox="0 0 24 24"
|
|
39
|
-
fill="none"
|
|
40
|
-
stroke="currentColor"
|
|
41
|
-
stroke-width="2"
|
|
42
|
-
stroke-linecap="round"
|
|
43
|
-
stroke-linejoin="round"
|
|
44
|
-
>
|
|
45
|
-
<path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path>
|
|
46
|
-
<path d="M13.73 21a2 2 0 0 1-3.46 0"></path>
|
|
47
|
-
<line x1="1" y1="1" x2="23" y2="23"></line>
|
|
48
|
-
</svg>
|
|
49
|
-
`,pe=c`
|
|
50
|
-
<svg
|
|
51
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
52
|
-
width="16"
|
|
53
|
-
height="16"
|
|
54
|
-
viewBox="0 0 24 24"
|
|
55
|
-
fill="none"
|
|
56
|
-
stroke="currentColor"
|
|
57
|
-
stroke-width="2"
|
|
58
|
-
stroke-linecap="round"
|
|
59
|
-
stroke-linejoin="round"
|
|
60
|
-
>
|
|
61
|
-
<path d="M12 2v8" />
|
|
62
|
-
<path d="M12 10l-6 6" />
|
|
63
|
-
<path d="M12 10l6 6" />
|
|
64
|
-
<circle cx="6" cy="18" r="2" />
|
|
65
|
-
<circle cx="18" cy="18" r="2" />
|
|
66
|
-
</svg>
|
|
67
|
-
`,ge=c`
|
|
68
|
-
<svg
|
|
69
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
70
|
-
width="16"
|
|
71
|
-
height="16"
|
|
72
|
-
viewBox="0 0 24 24"
|
|
73
|
-
fill="none"
|
|
74
|
-
stroke="currentColor"
|
|
75
|
-
stroke-width="2"
|
|
76
|
-
stroke-linecap="round"
|
|
77
|
-
stroke-linejoin="round"
|
|
78
|
-
>
|
|
79
|
-
<path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" />
|
|
80
|
-
<circle cx="12" cy="12" r="3" />
|
|
81
|
-
</svg>
|
|
82
|
-
`,he=c`
|
|
83
|
-
<svg
|
|
84
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
85
|
-
width="16"
|
|
86
|
-
height="16"
|
|
87
|
-
viewBox="0 0 24 24"
|
|
88
|
-
fill="none"
|
|
89
|
-
stroke="currentColor"
|
|
90
|
-
stroke-width="2"
|
|
91
|
-
stroke-linecap="round"
|
|
92
|
-
stroke-linejoin="round"
|
|
93
|
-
>
|
|
94
|
-
<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" />
|
|
95
|
-
<polyline points="14 2 14 8 20 8" />
|
|
96
|
-
<line x1="16" y1="13" x2="8" y2="13" />
|
|
97
|
-
<line x1="16" y1="17" x2="8" y2="17" />
|
|
98
|
-
<line x1="10" y1="9" x2="8" y2="9" />
|
|
99
|
-
</svg>
|
|
100
|
-
`,me=c`
|
|
101
|
-
<svg
|
|
102
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
103
|
-
width="16"
|
|
104
|
-
height="16"
|
|
105
|
-
viewBox="0 0 24 24"
|
|
106
|
-
fill="none"
|
|
107
|
-
stroke="currentColor"
|
|
108
|
-
stroke-width="2"
|
|
109
|
-
stroke-linecap="round"
|
|
110
|
-
stroke-linejoin="round"
|
|
111
|
-
>
|
|
112
|
-
<path d="M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01" />
|
|
113
|
-
</svg>
|
|
114
|
-
`,u=c`
|
|
115
|
-
<svg
|
|
116
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
117
|
-
width="16"
|
|
118
|
-
height="16"
|
|
119
|
-
viewBox="0 0 24 24"
|
|
120
|
-
fill="none"
|
|
121
|
-
stroke="currentColor"
|
|
122
|
-
stroke-width="2"
|
|
123
|
-
stroke-linecap="round"
|
|
124
|
-
stroke-linejoin="round"
|
|
125
|
-
>
|
|
126
|
-
<polygon points="22,3 2,3 10,12.46 10,19 14,21 14,12.46" />
|
|
127
|
-
</svg>
|
|
128
|
-
`,ue=c`
|
|
129
|
-
<svg
|
|
130
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
131
|
-
width="16"
|
|
132
|
-
height="16"
|
|
133
|
-
viewBox="0 0 24 24"
|
|
134
|
-
fill="none"
|
|
135
|
-
stroke="currentColor"
|
|
136
|
-
stroke-width="2"
|
|
137
|
-
stroke-linecap="round"
|
|
138
|
-
stroke-linejoin="round"
|
|
139
|
-
>
|
|
140
|
-
<circle cx="12" cy="12" r="10" />
|
|
141
|
-
<line x1="4.93" y1="4.93" x2="19.07" y2="19.07" />
|
|
142
|
-
</svg>
|
|
143
|
-
`,be=c`
|
|
144
|
-
<svg
|
|
145
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
146
|
-
width="24"
|
|
147
|
-
height="24"
|
|
148
|
-
viewBox="0 0 24 24"
|
|
149
|
-
fill="none"
|
|
150
|
-
stroke="currentColor"
|
|
151
|
-
stroke-width="2"
|
|
152
|
-
stroke-linecap="round"
|
|
153
|
-
stroke-linejoin="round"
|
|
154
|
-
>
|
|
155
|
-
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
|
156
|
-
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
|
157
|
-
</svg>
|
|
158
|
-
`,ve=c`
|
|
159
|
-
<svg
|
|
160
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
161
|
-
width="24"
|
|
162
|
-
height="24"
|
|
163
|
-
viewBox="0 0 24 24"
|
|
164
|
-
fill="none"
|
|
165
|
-
stroke="currentColor"
|
|
166
|
-
stroke-width="2"
|
|
167
|
-
stroke-linecap="round"
|
|
168
|
-
stroke-linejoin="round"
|
|
169
|
-
>
|
|
170
|
-
<polyline points="20 6 9 17 4 12"></polyline>
|
|
171
|
-
</svg>
|
|
172
|
-
`,fe=c`
|
|
173
|
-
<svg
|
|
174
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
175
|
-
width="16"
|
|
176
|
-
height="16"
|
|
177
|
-
viewBox="0 0 24 24"
|
|
178
|
-
fill="none"
|
|
179
|
-
stroke="currentColor"
|
|
180
|
-
stroke-width="2"
|
|
181
|
-
stroke-linecap="round"
|
|
182
|
-
stroke-linejoin="round"
|
|
183
|
-
>
|
|
184
|
-
<path
|
|
185
|
-
d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"
|
|
186
|
-
></path>
|
|
187
|
-
<line x1="12" y1="9" x2="12" y2="13"></line>
|
|
188
|
-
<line x1="12" y1="17" x2="12.01" y2="17"></line>
|
|
189
|
-
</svg>
|
|
190
|
-
`,ye=c`
|
|
191
|
-
<svg
|
|
192
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
193
|
-
width="16"
|
|
194
|
-
height="16"
|
|
195
|
-
viewBox="0 0 24 24"
|
|
196
|
-
fill="none"
|
|
197
|
-
stroke="currentColor"
|
|
198
|
-
stroke-width="2"
|
|
199
|
-
stroke-linecap="round"
|
|
200
|
-
stroke-linejoin="round"
|
|
201
|
-
>
|
|
202
|
-
<circle cx="6" cy="12" r="3"></circle>
|
|
203
|
-
<circle cx="18" cy="12" r="3"></circle>
|
|
204
|
-
<path d="M9 12h6"></path>
|
|
205
|
-
<path d="M15 9l3 3-3 3"></path>
|
|
206
|
-
<circle cx="12" cy="6" r="2"></circle>
|
|
207
|
-
<circle cx="12" cy="18" r="2"></circle>
|
|
208
|
-
<path d="M10 8l2-2 2 2"></path>
|
|
209
|
-
<path d="M14 16l-2 2-2-2"></path>
|
|
210
|
-
</svg>
|
|
211
|
-
`,we=c`
|
|
212
|
-
<svg
|
|
213
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
214
|
-
width="12"
|
|
215
|
-
height="12"
|
|
216
|
-
viewBox="0 0 24 24"
|
|
217
|
-
fill="none"
|
|
218
|
-
stroke="currentColor"
|
|
219
|
-
stroke-width="2"
|
|
220
|
-
stroke-linecap="round"
|
|
221
|
-
stroke-linejoin="round"
|
|
222
|
-
>
|
|
223
|
-
<polyline points="3 6 5 6 21 6"></polyline>
|
|
224
|
-
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path>
|
|
225
|
-
<line x1="10" y1="11" x2="10" y2="17"></line>
|
|
226
|
-
<line x1="14" y1="11" x2="14" y2="17"></line>
|
|
227
|
-
</svg>
|
|
228
|
-
`,Yn=c`
|
|
229
|
-
<svg
|
|
230
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
231
|
-
width="16"
|
|
232
|
-
height="16"
|
|
233
|
-
viewBox="0 0 24 24"
|
|
234
|
-
fill="none"
|
|
235
|
-
stroke="currentColor"
|
|
236
|
-
stroke-width="2"
|
|
237
|
-
stroke-linecap="round"
|
|
238
|
-
stroke-linejoin="round"
|
|
239
|
-
>
|
|
240
|
-
<path d="M18 8a6 6 0 0 0-12 0c0 2 3 4 6 6 3-2 6-4 6-6z" />
|
|
241
|
-
<circle cx="12" cy="8" r="3" />
|
|
242
|
-
</svg>
|
|
243
|
-
`,Jn=c`
|
|
244
|
-
<svg
|
|
245
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
246
|
-
width="16"
|
|
247
|
-
height="16"
|
|
248
|
-
viewBox="0 0 24 24"
|
|
249
|
-
fill="none"
|
|
250
|
-
stroke="currentColor"
|
|
251
|
-
stroke-width="2"
|
|
252
|
-
stroke-linecap="round"
|
|
253
|
-
stroke-linejoin="round"
|
|
254
|
-
>
|
|
255
|
-
<rect x="2" y="3" width="20" height="14" rx="2" ry="2" />
|
|
256
|
-
<line x1="8" y1="21" x2="16" y2="21" />
|
|
257
|
-
<line x1="12" y1="17" x2="12" y2="21" />
|
|
258
|
-
<circle cx="12" cy="10" r="2" />
|
|
259
|
-
</svg>
|
|
260
|
-
`,Xn=c`
|
|
261
|
-
<svg
|
|
262
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
263
|
-
width="16"
|
|
264
|
-
height="16"
|
|
265
|
-
viewBox="0 0 24 24"
|
|
266
|
-
fill="none"
|
|
267
|
-
stroke="currentColor"
|
|
268
|
-
stroke-width="2"
|
|
269
|
-
stroke-linecap="round"
|
|
270
|
-
stroke-linejoin="round"
|
|
271
|
-
>
|
|
272
|
-
<circle cx="12" cy="12" r="10" />
|
|
273
|
-
<line x1="4.93" y1="4.93" x2="19.07" y2="19.07" />
|
|
274
|
-
</svg>
|
|
275
|
-
`;import{LitElement as Be,html as Ge,css as We}from"lit";import{customElement as Ke,property as qe}from"lit/decorators.js";var F=class extends Be{constructor(){super(...arguments);this.title=""}render(){return Ge`
|
|
276
|
-
<span class="chip" title="${this.title}">
|
|
277
|
-
<slot></slot>
|
|
278
|
-
</span>
|
|
279
|
-
`}};F.styles=[We`
|
|
280
|
-
:host {
|
|
281
|
-
display: inline-block;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
.chip {
|
|
285
|
-
display: inline-flex;
|
|
286
|
-
align-items: center;
|
|
287
|
-
padding: 3px 8px;
|
|
288
|
-
background-color: rgba(255, 255, 255, 0.05);
|
|
289
|
-
color: #e8e8e8;
|
|
290
|
-
font-size: 10px;
|
|
291
|
-
font-weight: 500;
|
|
292
|
-
white-space: nowrap;
|
|
293
|
-
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
294
|
-
font-family: "SF Mono", "Monaco", "Consolas", "Liberation Mono", "Courier New", monospace;
|
|
295
|
-
letter-spacing: 0.02em;
|
|
296
|
-
line-height: 1.2;
|
|
297
|
-
transition: all 0.2s ease;
|
|
298
|
-
}
|
|
299
|
-
`],n([qe({type:String})],F.prototype,"title",2),F=n([Ke("chip-element")],F);import{LitElement as Ye,html as ne,css as Je}from"lit";import{customElement as Xe,property as xe}from"lit/decorators.js";var _=class extends Ye{constructor(){super(...arguments);this.noContentMessage="No content available.";this.hasContent=!0}render(){return ne`
|
|
300
|
-
<div class="content-container">
|
|
301
|
-
${this.hasContent?ne`<slot></slot>`:ne`<div class="no-content-message">${this.noContentMessage}</div>`}
|
|
302
|
-
</div>
|
|
303
|
-
`}};_.styles=[Je`
|
|
304
|
-
:host {
|
|
305
|
-
overflow: hidden;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
.content-container::-webkit-scrollbar {
|
|
309
|
-
width: 8px;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
.content-container::-webkit-scrollbar-track {
|
|
313
|
-
background: rgba(30, 30, 30, 0.5);
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
.content-container::-webkit-scrollbar-thumb {
|
|
317
|
-
background-color: rgba(176, 196, 222, 0.5);
|
|
318
|
-
border: 2px solid rgba(0, 0, 0, 0.2);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
.content-container::-webkit-scrollbar-thumb:hover {
|
|
322
|
-
background-color: rgba(176, 196, 222, 0.7);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
.content-container {
|
|
326
|
-
scrollbar-gutter: stable;
|
|
327
|
-
height: 100%;
|
|
328
|
-
min-height: 150px;
|
|
329
|
-
overflow-y: auto;
|
|
330
|
-
scrollbar-width: thin;
|
|
331
|
-
scrollbar-color: rgba(176, 196, 222, 0.5) rgba(30, 30, 30, 0.5);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
.no-content-message {
|
|
335
|
-
display: flex;
|
|
336
|
-
justify-content: center;
|
|
337
|
-
align-items: center;
|
|
338
|
-
height: 100%;
|
|
339
|
-
color: #afafaf;
|
|
340
|
-
font-style: italic;
|
|
341
|
-
font-family: "Courier New", monospace;
|
|
342
|
-
}
|
|
343
|
-
`],n([xe({type:String,attribute:"no-content-message"})],_.prototype,"noContentMessage",2),n([xe({type:Boolean})],_.prototype,"hasContent",2),_=n([Xe("tab-content")],_);import{LitElement as Ze,html as Qe,css as et}from"lit";import{customElement as tt}from"lit/decorators.js";var B=class extends Ze{render(){return Qe`
|
|
344
|
-
<div class="tab-bar-elements">
|
|
345
|
-
<div class="tab-bar-info">
|
|
346
|
-
<div class="stats-chips">
|
|
347
|
-
<slot name="chips"></slot>
|
|
348
|
-
</div>
|
|
349
|
-
</div>
|
|
350
|
-
<div class="tab-bar-actions">
|
|
351
|
-
<slot name="actions"></slot>
|
|
352
|
-
</div>
|
|
353
|
-
</div>
|
|
354
|
-
`}};B.styles=[et`
|
|
355
|
-
:host {
|
|
356
|
-
}
|
|
357
|
-
.tab-bar-info {
|
|
358
|
-
display: flex;
|
|
359
|
-
gap: 12px;
|
|
360
|
-
align-items: center;
|
|
361
|
-
flex: 1;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
.stats-chips {
|
|
365
|
-
display: flex;
|
|
366
|
-
gap: 8px;
|
|
367
|
-
align-items: center;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
.chip {
|
|
371
|
-
font-size: 11px;
|
|
372
|
-
font-weight: 500;
|
|
373
|
-
padding: 4px 8px;
|
|
374
|
-
border: 1px solid #555;
|
|
375
|
-
white-space: nowrap;
|
|
376
|
-
letter-spacing: 0.3px;
|
|
377
|
-
background: rgba(40, 40, 40, 0.7);
|
|
378
|
-
color: #b0c4de;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
.tab-bar-actions {
|
|
382
|
-
display: flex;
|
|
383
|
-
gap: 6px;
|
|
384
|
-
align-items: center;
|
|
385
|
-
position: relative;
|
|
386
|
-
flex-direction: row;
|
|
387
|
-
}
|
|
388
|
-
.tab-bar-elements {
|
|
389
|
-
display: flex;
|
|
390
|
-
justify-content: space-between;
|
|
391
|
-
padding: 4px 0 4px 0;
|
|
392
|
-
border-bottom: 1px solid #444;
|
|
393
|
-
position: sticky;
|
|
394
|
-
top: 0;
|
|
395
|
-
z-index: 5;
|
|
396
|
-
min-height: 36px;
|
|
397
|
-
}
|
|
398
|
-
`],B=n([tt("tab-header")],B);import{html as rt}from"lit";import{customElement as st,property as Ce}from"lit/decorators.js";import{LitElement as nt,html as ke,css as it}from"lit";import{property as ot,state as at}from"lit/decorators.js";var p=class p extends nt{constructor(){super(...arguments);this.isDropdownOpen=!1;this.dropdownOptions=[];this._toggleDropdown=e=>{e.stopPropagation(),this.isDropdownOpen?this._closeDropdown():(p.currentlyOpen&&p.currentlyOpen!==this&&p.currentlyOpen._closeDropdown(),this.isDropdownOpen=!0,p.currentlyOpen=this,this._positionDropdown())};this._handleOutsideClick=e=>{this.isDropdownOpen&&(e.composedPath().includes(this)||this._closeDropdown())}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick),p.currentlyOpen===this&&(p.currentlyOpen=null)}_closeDropdown(){this.isDropdownOpen=!1,p.currentlyOpen===this&&(p.currentlyOpen=null)}_positionDropdown(){if(typeof window>"u")return;let e=this.shadowRoot?.querySelector(".trigger-button"),t=this.shadowRoot?.querySelector(".dropdown-menu");if(e&&t){let i=e.getBoundingClientRect(),a=t.offsetHeight||200,s=i.bottom+5,d=window.innerWidth-i.right;window.innerHeight-i.bottom<a&&i.top>a?t.style.top=`${i.top-a-5}px`:t.style.top=`${s}px`,t.style.right=`${d}px`}}render(){let e=`trigger-button ${this.isDropdownOpen?"active":""}`,t=`dropdown-menu ${this.isDropdownOpen?"active":""}`;return ke`
|
|
399
|
-
<div class="dropdown-container">
|
|
400
|
-
<button
|
|
401
|
-
class="${e}"
|
|
402
|
-
title="${this._getTriggerTitle()}"
|
|
403
|
-
@click="${this._toggleDropdown}"
|
|
404
|
-
aria-haspopup="true"
|
|
405
|
-
aria-expanded="${this.isDropdownOpen}"
|
|
406
|
-
aria-controls="dropdown-menu"
|
|
407
|
-
aria-label="${this._getTriggerLabel()}"
|
|
408
|
-
>
|
|
409
|
-
${this._getTriggerIcon()}
|
|
410
|
-
<svg
|
|
411
|
-
class="arrow-icon"
|
|
412
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
413
|
-
viewBox="0 0 24 24"
|
|
414
|
-
stroke="currentColor"
|
|
415
|
-
stroke-width="2"
|
|
416
|
-
stroke-linecap="round"
|
|
417
|
-
stroke-linejoin="round"
|
|
418
|
-
>
|
|
419
|
-
<polyline points="6 9 12 15 18 9"></polyline>
|
|
420
|
-
</svg>
|
|
421
|
-
</button>
|
|
422
|
-
|
|
423
|
-
<div class="${t}" id="dropdown-menu" role="menu">
|
|
424
|
-
${this.dropdownOptions.map(i=>ke`
|
|
425
|
-
<button
|
|
426
|
-
value="${i.value}"
|
|
427
|
-
title="${i.title}"
|
|
428
|
-
class="${this._isOptionSelected(i)?"active":""}"
|
|
429
|
-
@click="${()=>this._handleOptionClick(i)}"
|
|
430
|
-
role="menuitem"
|
|
431
|
-
>
|
|
432
|
-
${i.label}
|
|
433
|
-
</button>
|
|
434
|
-
`)}
|
|
435
|
-
</div>
|
|
436
|
-
</div>
|
|
437
|
-
`}};p.currentlyOpen=null,p.styles=[it`
|
|
438
|
-
:host {
|
|
439
|
-
display: inline-block;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
.dropdown-container {
|
|
443
|
-
position: relative;
|
|
444
|
-
display: inline-block;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
.trigger-button {
|
|
448
|
-
background: none;
|
|
449
|
-
border: none;
|
|
450
|
-
color: white;
|
|
451
|
-
cursor: pointer;
|
|
452
|
-
padding: 6px;
|
|
453
|
-
display: flex;
|
|
454
|
-
align-items: center;
|
|
455
|
-
justify-content: center;
|
|
456
|
-
gap: 4px;
|
|
457
|
-
transition: all 0.2s ease;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
.trigger-button svg {
|
|
461
|
-
width: 16px;
|
|
462
|
-
height: 16px;
|
|
463
|
-
stroke: white;
|
|
464
|
-
transition: stroke 0.2s;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
.trigger-button .arrow-icon {
|
|
468
|
-
width: 10px;
|
|
469
|
-
height: 10px;
|
|
470
|
-
stroke: white;
|
|
471
|
-
fill: none;
|
|
472
|
-
stroke-width: 2;
|
|
473
|
-
transition:
|
|
474
|
-
transform 0.2s ease,
|
|
475
|
-
stroke 0.2s;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
.trigger-button:hover {
|
|
479
|
-
background-color: rgba(176, 196, 222, 0.1);
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
.trigger-button:hover svg,
|
|
483
|
-
.trigger-button:hover .arrow-icon {
|
|
484
|
-
stroke: #b0c4de;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
.trigger-button.active {
|
|
488
|
-
background-color: rgba(176, 196, 222, 0.2);
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
.trigger-button.active svg {
|
|
492
|
-
stroke: #b0c4de;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
.trigger-button.active .arrow-icon {
|
|
496
|
-
transform: rotate(180deg);
|
|
497
|
-
stroke: #b0c4de;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
.dropdown-menu {
|
|
501
|
-
position: fixed;
|
|
502
|
-
z-index: 9999;
|
|
503
|
-
display: none;
|
|
504
|
-
flex-direction: column;
|
|
505
|
-
background-color: #3a3a3a;
|
|
506
|
-
border: 1px solid #555;
|
|
507
|
-
min-width: 200px;
|
|
508
|
-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
|
|
509
|
-
overflow: hidden;
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
.dropdown-menu.active {
|
|
513
|
-
display: flex;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
.dropdown-menu button {
|
|
517
|
-
background: none;
|
|
518
|
-
border: none;
|
|
519
|
-
color: #ccc;
|
|
520
|
-
font-size: 12px;
|
|
521
|
-
text-align: left;
|
|
522
|
-
padding: 8px 12px;
|
|
523
|
-
cursor: pointer;
|
|
524
|
-
transition: all 0.2s ease;
|
|
525
|
-
display: flex;
|
|
526
|
-
align-items: center;
|
|
527
|
-
position: relative;
|
|
528
|
-
width: 100%;
|
|
529
|
-
box-sizing: border-box;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
.dropdown-menu button:hover {
|
|
533
|
-
background-color: #555;
|
|
534
|
-
color: white;
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
.dropdown-menu button.active {
|
|
538
|
-
color: #b0c4de;
|
|
539
|
-
font-weight: bold;
|
|
540
|
-
background-color: rgba(176, 196, 222, 0.1);
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
.dropdown-menu button.active::after {
|
|
544
|
-
content: "✓";
|
|
545
|
-
position: absolute;
|
|
546
|
-
right: 8px;
|
|
547
|
-
top: 50%;
|
|
548
|
-
transform: translateY(-50%);
|
|
549
|
-
color: #b0c4de;
|
|
550
|
-
font-weight: bold;
|
|
551
|
-
}
|
|
552
|
-
`],n([at()],p.prototype,"isDropdownOpen",2),n([ot({type:Array})],p.prototype,"dropdownOptions",2);var L=p;var V=class extends L{constructor(){super(...arguments);this.selectedOptionValue=""}connectedCallback(){super.connectedCallback(),this.dropdownOptions.length>0&&!this.selectedOptionValue&&(this.selectedOptionValue=this.dropdownOptions[0].value)}willUpdate(e){e.has("dropdownOptions")&&this.dropdownOptions.length>0&&!this.selectedOptionValue&&(this.selectedOptionValue=this.dropdownOptions[0].value)}_handleOptionClick(e){e.value!==this.selectedOptionValue&&(this.selectedOptionValue=e.value,this.onSelectionChange?.(e.value)),this._closeDropdown()}_getTriggerIcon(){let e=this._getSelectedOption();return e?e.icon:rt``}_isOptionSelected(e){return e.value===this.selectedOptionValue}_getTriggerTitle(){let e=this._getSelectedOption();return e?e.title:"Change selection"}_getTriggerLabel(){let e=this._getSelectedOption();return e?`Current selection: ${e.label}`:"No selection"}_getSelectedOption(){return this.dropdownOptions.find(e=>e.value===this.selectedOptionValue)}};n([Ce({type:String})],V.prototype,"selectedOptionValue",2),n([Ce({type:Function})],V.prototype,"onSelectionChange",2),V=n([st("single-select-dropdown")],V);import{LitElement as wt,html as xt,css as kt}from"lit";import{customElement as Ct,property as X,state as Et}from"lit/decorators.js";import{LitElement as gt,html as Te,css as ht}from"lit";import{customElement as mt,property as G}from"lit/decorators.js";import{LitElement as lt,html as ct,css as dt}from"lit";import{customElement as pt,property as Ee,state as Se}from"lit/decorators.js";var x=class extends lt{constructor(){super(...arguments);this.title="Copy to clipboard";this.isCopied=!1;this.copyTimeout=null}async handleClick(e){if(!this.isCopied){if(this.onCopy)try{await this.onCopy(e)}catch(t){console.error("Error in onCopy function:",t)}this.isCopied=!0,this.copyTimeout&&clearTimeout(this.copyTimeout),this.copyTimeout=setTimeout(()=>{this.isCopied=!1,this.copyTimeout=null},2e3)}}disconnectedCallback(){super.disconnectedCallback(),this.copyTimeout&&(clearTimeout(this.copyTimeout),this.copyTimeout=null)}render(){return ct`
|
|
553
|
-
<button
|
|
554
|
-
class="copy-button ${this.isCopied?"copied":""}"
|
|
555
|
-
title="${this.title}"
|
|
556
|
-
@click=${this.handleClick}
|
|
557
|
-
>
|
|
558
|
-
${this.isCopied?ve:be}
|
|
559
|
-
</button>
|
|
560
|
-
`}};x.styles=dt`
|
|
561
|
-
.copy-button {
|
|
562
|
-
background: transparent;
|
|
563
|
-
border: 0px;
|
|
564
|
-
cursor: pointer;
|
|
565
|
-
padding: 6px;
|
|
566
|
-
display: flex;
|
|
567
|
-
align-items: center;
|
|
568
|
-
justify-content: center;
|
|
569
|
-
opacity: 0.6;
|
|
570
|
-
transition:
|
|
571
|
-
opacity 0.2s ease,
|
|
572
|
-
background-color 0.2s ease;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
:host([positioned]) .copy-button {
|
|
576
|
-
position: absolute;
|
|
577
|
-
top: 10px;
|
|
578
|
-
right: 1px;
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
.copy-button:hover {
|
|
582
|
-
background-color: rgba(176, 196, 222, 0.1);
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
.copy-button:hover svg {
|
|
586
|
-
stroke: #b0c4de;
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
.copy-button svg {
|
|
590
|
-
width: 14px;
|
|
591
|
-
height: 14px;
|
|
592
|
-
stroke: #ddd;
|
|
593
|
-
stroke-width: 2.5;
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
.copy-button.copied svg {
|
|
597
|
-
stroke: #4caf50;
|
|
598
|
-
}
|
|
599
|
-
`,n([Ee({type:String})],x.prototype,"title",2),n([Ee({type:Function})],x.prototype,"onCopy",2),n([Se()],x.prototype,"isCopied",2),n([Se()],x.prototype,"copyTimeout",2),x=n([pt("copy-icon")],x);var f=class extends gt{constructor(){super(...arguments);this.borderColor="#555";this.showCopyButton=!1;this.itemId="";this.isExpanded=!1}toggleExpand(){this.onToggle&&this.onToggle(this.itemId)}async handleCopy(e){e.stopPropagation();let t=this.shadowRoot?.querySelector('slot[name="details"]');if(t){let a=t.assignedNodes().map(s=>s.textContent).join("");try{await navigator.clipboard.writeText(a)}catch(s){console.error("Failed to copy text: ",s)}}}render(){return this.style.setProperty("--border-color",this.borderColor),Te`
|
|
600
|
-
<div class="item-entry ${this.isExpanded?"expanded":""}">
|
|
601
|
-
<div class="item-header ${this.isExpanded?"expanded":""}" @click="${this.toggleExpand}">
|
|
602
|
-
<div class="item-content">
|
|
603
|
-
<slot name="content"></slot>
|
|
604
|
-
</div>
|
|
605
|
-
<span class="item-toggle ${this.isExpanded?"expanded":""}">
|
|
606
|
-
<svg viewBox="0 0 24 24">
|
|
607
|
-
<polyline points="9,18 15,12 9,6"></polyline>
|
|
608
|
-
</svg>
|
|
609
|
-
</span>
|
|
610
|
-
</div>
|
|
611
|
-
${this.isExpanded?Te`
|
|
612
|
-
<div class="item-details">
|
|
613
|
-
<copy-icon
|
|
614
|
-
positioned
|
|
615
|
-
title="Copy Details"
|
|
616
|
-
.onCopy=${e=>this.handleCopy(e)}
|
|
617
|
-
></copy-icon>
|
|
618
|
-
<pre class="item-data">
|
|
619
|
-
<slot name="details"></slot>
|
|
620
|
-
</pre>
|
|
621
|
-
</div>
|
|
622
|
-
`:""}
|
|
623
|
-
</div>
|
|
624
|
-
`}};f.styles=[ht`
|
|
625
|
-
:host {
|
|
626
|
-
display: block;
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
.item-entry {
|
|
630
|
-
margin-bottom: 2px;
|
|
631
|
-
font-size: 11px;
|
|
632
|
-
line-height: 1.3;
|
|
633
|
-
overflow: hidden;
|
|
634
|
-
transition: all 0.2s ease;
|
|
635
|
-
border-left: 2px solid var(--border-color, #555);
|
|
636
|
-
padding-left: 6px;
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
.item-entry:hover:not(.expanded) {
|
|
640
|
-
background-color: rgba(255, 255, 255, 0.02);
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
.item-entry.expanded {
|
|
644
|
-
background-color: rgba(255, 255, 255, 0.03);
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
.item-header {
|
|
648
|
-
display: flex;
|
|
649
|
-
align-items: center;
|
|
650
|
-
padding: 3px 4px;
|
|
651
|
-
cursor: pointer;
|
|
652
|
-
transition: background-color 0.2s ease;
|
|
653
|
-
gap: 8px;
|
|
654
|
-
min-height: 20px;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
.item-header:hover:not(.expanded) {
|
|
658
|
-
background-color: rgba(255, 255, 255, 0.03);
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
.item-details {
|
|
662
|
-
position: relative;
|
|
663
|
-
border-top: 1px solid rgba(255, 255, 255, 0.1);
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
.item-toggle {
|
|
667
|
-
display: flex;
|
|
668
|
-
align-items: center;
|
|
669
|
-
justify-content: center;
|
|
670
|
-
width: 16px;
|
|
671
|
-
height: 16px;
|
|
672
|
-
|
|
673
|
-
user-select: none;
|
|
674
|
-
cursor: pointer;
|
|
675
|
-
transition: all 0.2s ease;
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
.item-toggle:hover {
|
|
679
|
-
background-color: rgba(255, 255, 255, 0.1);
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
.item-toggle svg {
|
|
683
|
-
width: 14px;
|
|
684
|
-
height: 14px;
|
|
685
|
-
fill: none;
|
|
686
|
-
stroke: #b0c4de;
|
|
687
|
-
stroke-width: 2;
|
|
688
|
-
stroke-linecap: round;
|
|
689
|
-
stroke-linejoin: round;
|
|
690
|
-
transition: all 0.2s ease;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
.item-toggle:hover svg {
|
|
694
|
-
stroke: #d4e4f4;
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
.item-toggle.expanded svg {
|
|
698
|
-
transform: rotate(90deg);
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
.item-content {
|
|
702
|
-
flex: 1;
|
|
703
|
-
display: flex;
|
|
704
|
-
align-items: center;
|
|
705
|
-
gap: 8px;
|
|
706
|
-
min-width: 0;
|
|
707
|
-
overflow: hidden;
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
.item-data {
|
|
711
|
-
color: #e0e0e0;
|
|
712
|
-
white-space: pre;
|
|
713
|
-
font-size: 11px;
|
|
714
|
-
margin: 0;
|
|
715
|
-
padding: 0;
|
|
716
|
-
font-family: "Courier New", monospace;
|
|
717
|
-
line-height: 1.3;
|
|
718
|
-
display: block;
|
|
719
|
-
overflow-x: auto;
|
|
720
|
-
}
|
|
721
|
-
`],n([G()],f.prototype,"borderColor",2),n([G()],f.prototype,"showCopyButton",2),n([G()],f.prototype,"itemId",2),n([G()],f.prototype,"isExpanded",2),n([G()],f.prototype,"onToggle",2),f=n([mt("expandable-item")],f);import{ForesightManager as ut}from"js.foresight";import{LitElement as bt,css as vt,html as J}from"lit";import{customElement as ft,property as yt,state as De}from"lit/decorators.js";var E=class extends bt{constructor(){super(...arguments);this.remainingTime=0;this.isCountdownActive=!1;this.intervalId=null;this.startTime=0;this.handleTimerClick=e=>{e.stopPropagation(),ut.instance.reactivate(this.elementData.element)}}connectedCallback(){super.connectedCallback(),this.checkAndStartCountdown()}disconnectedCallback(){super.disconnectedCallback(),this.clearCountdown()}willUpdate(e){super.willUpdate(e),e.has("elementData")&&this.checkAndStartCountdown()}checkAndStartCountdown(){let e=this.elementData?.callbackInfo;if(!e){this.clearCountdown();return}let t=e.lastCallbackCompletedAt||e.lastCallbackInvokedAt;!e.isCallbackActive&&t&&e.reactivateAfter>0?this.startCountdown():this.clearCountdown()}startCountdown(){this.clearCountdown();let e=this.elementData?.callbackInfo;if(!e)return;if(this.isCountdownActive=!0,e.reactivateAfter===1/0){this.remainingTime=1/0;return}let t=e.reactivateAfter,i=e.lastCallbackCompletedAt||e.lastCallbackInvokedAt;if(!i){this.clearCountdown();return}this.startTime=i;let a=()=>{let s=Date.now()-this.startTime,d=Math.max(0,t-s);this.remainingTime=d,this.requestUpdate(),(d<=0||this.elementData.callbackInfo.isCallbackActive)&&this.clearCountdown()};a(),this.remainingTime>0&&typeof window<"u"&&(this.intervalId=window.setInterval(a,100))}clearCountdown(){this.intervalId!==null&&(clearInterval(this.intervalId),this.intervalId=null),this.isCountdownActive=!1,this.remainingTime=0}formatTime(e){if(e===1/0)return"\u221E";let t=Math.ceil(e/1e3);if(t<60)return`${t}s`;let i=Math.floor(t/60),a=t%60;if(i<60)return a>0?`${i}m ${a}s`:`${i}m`;let s=Math.floor(i/60),d=i%60;return d>0?`${s}h ${d}m`:`${s}h`}render(){return this.isCountdownActive?this.remainingTime===1/0?J`
|
|
722
|
-
<button
|
|
723
|
-
class="reactivate-button"
|
|
724
|
-
@click="${this.handleTimerClick}"
|
|
725
|
-
title="Click to reactivate manually"
|
|
726
|
-
>
|
|
727
|
-
<span class="countdown-time infinity">∞</span>
|
|
728
|
-
</button>
|
|
729
|
-
`:this.remainingTime<=0?J``:J`
|
|
730
|
-
<button
|
|
731
|
-
class="reactivate-button"
|
|
732
|
-
@click="${this.handleTimerClick}"
|
|
733
|
-
title="Click to reactivate immediately"
|
|
734
|
-
>
|
|
735
|
-
<span class="countdown-time clickable">${this.formatTime(this.remainingTime)}</span>
|
|
736
|
-
</button>
|
|
737
|
-
`:J``}};E.styles=[vt`
|
|
738
|
-
:host {
|
|
739
|
-
display: inline-block;
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
.reactivate-button {
|
|
743
|
-
all: unset;
|
|
744
|
-
cursor: pointer;
|
|
745
|
-
padding: 2px 4px;
|
|
746
|
-
transition: background-color 0.2s ease;
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
.reactivate-button:hover {
|
|
750
|
-
background-color: rgba(255, 165, 0, 0.1);
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
.countdown-time {
|
|
754
|
-
color: #ffa726;
|
|
755
|
-
font-weight: 500;
|
|
756
|
-
font-size: 10px;
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
.countdown-time.infinity {
|
|
760
|
-
font-size: 12px;
|
|
761
|
-
font-weight: 600;
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
.countdown-time.clickable {
|
|
765
|
-
cursor: pointer;
|
|
766
|
-
}
|
|
767
|
-
`],n([yt({hasChanged:()=>!0})],E.prototype,"elementData",2),n([De()],E.prototype,"remainingTime",2),n([De()],E.prototype,"isCountdownActive",2),E=n([ft("reactivate-countdown")],E);import{ForesightManager as ie}from"js.foresight";var y=class extends wt{constructor(){super(...arguments);this.isActive=!1;this.isExpanded=!1;this.currentDeviceStrategy="mouse";this._abortController=null;this.handleUnregister=e=>{e.stopPropagation(),ie.instance.unregister(this.elementData.element,"devtools")}}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;this.currentDeviceStrategy=ie.instance.getManagerData.currentDeviceStrategy,ie.instance.addEventListener("deviceStrategyChanged",t=>{this.currentDeviceStrategy=t.newStrategy},{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this._abortController=null}getBorderColor(){return this.isActive?"#ffeb3b":this.elementData.callbackInfo.isCallbackActive?this.currentDeviceStrategy==="touch"?"#ba68c8":this.elementData.isIntersectingWithViewport?"#4caf50":"#666":"#999"}getStatusIndicatorClass(){return this.isActive?"prefetching":this.elementData.callbackInfo.isCallbackActive?this.currentDeviceStrategy==="touch"?"touch-device":this.elementData.isIntersectingWithViewport?"visible":"hidden":"inactive"}getStatusText(){if(this.isActive)return"callback active";if(!this.elementData.callbackInfo.isCallbackActive)return"callback inactive";let e=this.elementData.isIntersectingWithViewport?"in viewport":"not in viewport",t=this.currentDeviceStrategy==="touch"?" (touch device)":"";return e+t}formatElementDetails(){let e=this.elementData,t={status:this.getStatusText(),isIntersecting:e.isIntersectingWithViewport,registerCount:e.registerCount,hitSlop:{top:e.elementBounds.hitSlop.top,right:e.elementBounds.hitSlop.right,bottom:e.elementBounds.hitSlop.bottom,left:e.elementBounds.hitSlop.left},callbackInfo:e.callbackInfo,meta:this.elementData.meta};return JSON.stringify(t,null,2)}render(){let e=!this.elementData.isIntersectingWithViewport&&this.currentDeviceStrategy!=="touch";return xt`
|
|
768
|
-
<div class="element-wrapper ${e?"not-visible":""}">
|
|
769
|
-
<expandable-item
|
|
770
|
-
.borderColor=${this.getBorderColor()}
|
|
771
|
-
.showCopyButton=${!0}
|
|
772
|
-
.itemId=${this.elementData.id}
|
|
773
|
-
.isExpanded=${this.isExpanded}
|
|
774
|
-
.onToggle=${this.onToggle}
|
|
775
|
-
>
|
|
776
|
-
<div slot="content" class="element-content" title="Status: ${this.getStatusText()}">
|
|
777
|
-
<div class="status-indicator ${this.getStatusIndicatorClass()}"></div>
|
|
778
|
-
<span
|
|
779
|
-
class="element-name ${this.isActive?"callback-active":this.elementData.callbackInfo.isCallbackActive?"":"callback-inactive"}"
|
|
780
|
-
>
|
|
781
|
-
${this.elementData.name||"unnamed"}
|
|
782
|
-
</span>
|
|
783
|
-
<reactivate-countdown .elementData=${this.elementData}> </reactivate-countdown>
|
|
784
|
-
<button
|
|
785
|
-
class="unregister-button"
|
|
786
|
-
@click="${this.handleUnregister}"
|
|
787
|
-
title="Unregister element"
|
|
788
|
-
>
|
|
789
|
-
${we}
|
|
790
|
-
</button>
|
|
791
|
-
</div>
|
|
792
|
-
<div slot="details">${this.formatElementDetails()}</div>
|
|
793
|
-
</expandable-item>
|
|
794
|
-
</div>
|
|
795
|
-
`}};y.styles=[kt`
|
|
796
|
-
:host {
|
|
797
|
-
display: block;
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
.element-wrapper {
|
|
801
|
-
display: block;
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
.element-content {
|
|
805
|
-
display: flex;
|
|
806
|
-
align-items: center;
|
|
807
|
-
gap: 8px;
|
|
808
|
-
flex: 1;
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
.status-indicator {
|
|
812
|
-
margin-left: 2px;
|
|
813
|
-
width: 8px;
|
|
814
|
-
height: 8px;
|
|
815
|
-
flex-shrink: 0;
|
|
816
|
-
transition: all 0.3s ease;
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
.status-indicator.visible {
|
|
820
|
-
background-color: #4caf50;
|
|
821
|
-
box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
.status-indicator.hidden {
|
|
825
|
-
background-color: #666;
|
|
826
|
-
box-shadow: 0 0 0 2px rgba(102, 102, 102, 0.2);
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
.status-indicator.prefetching {
|
|
830
|
-
background-color: #ffeb3b;
|
|
831
|
-
box-shadow: 0 0 0 2px rgba(255, 235, 59, 0.4);
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
.status-indicator.inactive {
|
|
835
|
-
background-color: #999;
|
|
836
|
-
box-shadow: 0 0 0 2px rgba(153, 153, 153, 0.3);
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
.status-indicator.touch-device {
|
|
840
|
-
background-color: #ba68c8;
|
|
841
|
-
box-shadow: 0 0 0 2px rgba(186, 104, 200, 0.4);
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
.unregister-button {
|
|
845
|
-
all: unset;
|
|
846
|
-
display: flex;
|
|
847
|
-
align-items: center;
|
|
848
|
-
justify-content: center;
|
|
849
|
-
width: 14px;
|
|
850
|
-
height: 14px;
|
|
851
|
-
padding: 1px;
|
|
852
|
-
cursor: pointer;
|
|
853
|
-
color: #999;
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
.unregister-button:hover {
|
|
857
|
-
background-color: rgba(255, 107, 107, 0.1);
|
|
858
|
-
color: #ff6b6b;
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
.element-name {
|
|
862
|
-
flex-grow: 1;
|
|
863
|
-
white-space: nowrap;
|
|
864
|
-
overflow: hidden;
|
|
865
|
-
text-overflow: ellipsis;
|
|
866
|
-
font-size: 11px;
|
|
867
|
-
font-weight: 500;
|
|
868
|
-
color: #e8e8e8;
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
.element-name.callback-active {
|
|
872
|
-
color: #fff;
|
|
873
|
-
font-weight: 600;
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
.element-name.callback-inactive {
|
|
877
|
-
color: #999;
|
|
878
|
-
font-weight: 500;
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
.reactivate-countdown {
|
|
882
|
-
font-size: 14px;
|
|
883
|
-
color: #ffa726;
|
|
884
|
-
font-weight: 500;
|
|
885
|
-
min-width: 0;
|
|
886
|
-
white-space: nowrap;
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
.reactivate-countdown:empty {
|
|
890
|
-
display: none;
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
:host(.not-visible) {
|
|
894
|
-
opacity: 0.5;
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
.element-wrapper.not-visible {
|
|
898
|
-
opacity: 0.5;
|
|
899
|
-
}
|
|
900
|
-
`],n([X({hasChanged:()=>!0})],y.prototype,"elementData",2),n([X()],y.prototype,"isActive",2),n([X()],y.prototype,"isExpanded",2),n([X()],y.prototype,"onToggle",2),n([Et()],y.prototype,"currentDeviceStrategy",2),y=n([Ct("single-element")],y);var b=class extends Tt{constructor(){super();this.hitCount={mouse:{hover:0,trajectory:0},scroll:{down:0,left:0,right:0,up:0},tab:{forwards:0,reverse:0},touch:0,viewport:0,total:0};this.elementListItems=new Map;this.noContentMessage="No Elements Registered To The Foresight Manager";this.runningCallbacks=new Set;this.expandedElementIds=new Set;this._abortController=null;this._pendingElementUpdates=new Map;this._updateDebounceId=null;this._cachedActiveElements=[];this._cachedInactiveElements=[];this._elementsCacheDirty=!0;this.handleSortChange=e=>{this.sortOrder=e,this._elementsCacheDirty=!0};this.handleElementToggle=e=>{let t=new Set(this.expandedElementIds);t.has(e)?t.delete(e):t.add(e),this.expandedElementIds=t};this.sortByDocumentPosition=(e,t)=>{let i=e.element.compareDocumentPosition(t.element);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0};this.sortOrder=l.instance.devtoolsSettings.sortElementList,this.sortDropdown=[{value:"visibility",label:"Visibility",title:"Sort by Visibility",icon:ge},{value:"documentOrder",label:"Document Order",title:"Sort by Document Order",icon:he},{value:"insertionOrder",label:"Insertion Order",title:"Sort by Insertion Order",icon:me}]}_generateHitsChipTitle(e){let t=[];t.push(`Total Callback Hits: ${e.total}`),t.push("");let i=e.mouse.trajectory+e.mouse.hover,a=e.scroll.up+e.scroll.down+e.scroll.left+e.scroll.right,s=e.tab.forwards+e.tab.reverse;t.push("Desktop Strategy"),i>0?t.push(` Mouse (${i}): ${e.mouse.trajectory} trajectory, ${e.mouse.hover} hover`):t.push(" Mouse: No hits"),a>0?t.push(` Scroll (${a}): Up ${e.scroll.up}, Down ${e.scroll.down}, Left ${e.scroll.left}, Right ${e.scroll.right}`):t.push(" Scroll: No hits"),s>0?t.push(` Tab (${s}): ${e.tab.forwards} forward, ${e.tab.reverse} reverse`):t.push(" Tab: No hits"),t.push("");let d=e.touch+e.viewport;return t.push("Touch Strategy"),e.touch>0?t.push(` Touch Start: ${e.touch}`):t.push(" Touch Start: No hits"),e.viewport>0?t.push(` Viewport Enter: ${e.viewport}`):t.push(" Viewport Enter: No hits"),d===0&&i+a+s===0&&(t.push(""),t.push("Interact with registered elements to see callback statistics")),t.join(`
|
|
901
|
-
`)}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;this.updateElementListFromManager(),I.instance.addEventListener("elementRegistered",t=>{this.elementListItems.set(t.elementData.element,t.elementData),this._elementsCacheDirty=!0},{signal:e}),I.instance.addEventListener("elementDataUpdated",t=>{this.elementListItems.get(t.elementData.element)&&(this._pendingElementUpdates.set(t.elementData.element,t.elementData),this._scheduleDebouncedUpdate())},{signal:e}),I.instance.addEventListener("elementReactivated",t=>{this.elementListItems.get(t.elementData.element)&&(this.elementListItems.set(t.elementData.element,t.elementData),this._elementsCacheDirty=!0,this.requestUpdate())},{signal:e}),I.instance.addEventListener("elementUnregistered",t=>{this.elementListItems.delete(t.elementData.element),this.elementListItems.size||(this.noContentMessage="No Elements Registered To The Foresight Manager"),this.runningCallbacks.delete(t.elementData.element),this._elementsCacheDirty=!0,this.requestUpdate()},{signal:e}),I.instance.addEventListener("callbackInvoked",t=>{this.elementListItems.get(t.elementData.element)&&this.elementListItems.set(t.elementData.element,t.elementData),this.runningCallbacks.add(t.elementData.element),this._elementsCacheDirty=!0,this.requestUpdate()},{signal:e}),I.instance.addEventListener("callbackCompleted",t=>{this.elementListItems.get(t.elementData.element)&&this.elementListItems.set(t.elementData.element,t.elementData),this.handleCallbackCompleted(t.hitType),this.runningCallbacks.delete(t.elementData.element),this._elementsCacheDirty=!0,this.requestUpdate()},{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this._abortController=null,this._updateDebounceId!==null&&(clearTimeout(this._updateDebounceId),this._updateDebounceId=null),this._pendingElementUpdates.clear()}_scheduleDebouncedUpdate(){this._updateDebounceId===null&&(this._updateDebounceId=setTimeout(()=>{this._updateDebounceId=null,this._flushPendingUpdates()},16))}_flushPendingUpdates(){if(this._pendingElementUpdates.size!==0){for(let[e,t]of this._pendingElementUpdates)this.elementListItems.set(e,t);this._pendingElementUpdates.clear(),this._elementsCacheDirty=!0,this.requestUpdate()}}updateElementListFromManager(){this.elementListItems=new Map(I.instance.registeredElements),this._elementsCacheDirty=!0}handleCallbackCompleted(e){switch(e.kind){case"mouse":this.hitCount.mouse[e.subType]++;break;case"tab":this.hitCount.tab[e.subType]++;break;case"scroll":this.hitCount.scroll[e.subType]++;break;case"touch":this.hitCount.touch++;break;case"viewport":this.hitCount.viewport++;break;default:}this.hitCount.total++,this.requestUpdate()}getSortedElements(){let e=Array.from(this.elementListItems.values());switch(this.sortOrder){case"insertionOrder":return e;case"documentOrder":return e.sort(this.sortByDocumentPosition);case"visibility":return e.sort((t,i)=>t.isIntersectingWithViewport!==i.isIntersectingWithViewport?t.isIntersectingWithViewport?-1:1:this.sortByDocumentPosition(t,i));default:return this.sortOrder,e}}_recomputeElementsCache(){if(!this._elementsCacheDirty)return;let e=this.getSortedElements();this._cachedActiveElements=e.filter(t=>t.callbackInfo.isCallbackActive),this._cachedInactiveElements=e.filter(t=>!t.callbackInfo.isCallbackActive),this._elementsCacheDirty=!1}get activeElements(){return this._recomputeElementsCache(),this._cachedActiveElements}get inactiveElements(){return this._recomputeElementsCache(),this._cachedInactiveElements}render(){return W`
|
|
902
|
-
<tab-header>
|
|
903
|
-
<div slot="chips" class="chips-container">
|
|
904
|
-
<chip-element title="${this._generateHitsChipTitle(this.hitCount)}">
|
|
905
|
-
${this.hitCount.total} hits
|
|
906
|
-
</chip-element>
|
|
907
|
-
</div>
|
|
908
|
-
<div slot="actions">
|
|
909
|
-
<single-select-dropdown
|
|
910
|
-
.dropdownOptions="${this.sortDropdown}"
|
|
911
|
-
.selectedOptionValue="${this.sortOrder}"
|
|
912
|
-
.onSelectionChange="${this.handleSortChange}"
|
|
913
|
-
></single-select-dropdown>
|
|
914
|
-
</div>
|
|
915
|
-
</tab-header>
|
|
916
|
-
<tab-content
|
|
917
|
-
.noContentMessage=${this.noContentMessage}
|
|
918
|
-
.hasContent=${!!this.elementListItems.size}
|
|
919
|
-
>
|
|
920
|
-
${this.activeElements.length>0?W`
|
|
921
|
-
<div class="element-section">
|
|
922
|
-
<h3 class="section-header active">
|
|
923
|
-
Active Elements (${this.activeElements.length})
|
|
924
|
-
</h3>
|
|
925
|
-
${Me(this.activeElements,e=>W`
|
|
926
|
-
<single-element
|
|
927
|
-
.elementData=${e}
|
|
928
|
-
.isActive=${this.runningCallbacks.has(e.element)}
|
|
929
|
-
.isExpanded=${this.expandedElementIds.has(e.id)}
|
|
930
|
-
.onToggle=${this.handleElementToggle}
|
|
931
|
-
>
|
|
932
|
-
</single-element>
|
|
933
|
-
`)}
|
|
934
|
-
</div>
|
|
935
|
-
`:""}
|
|
936
|
-
${this.inactiveElements.length>0?W`
|
|
937
|
-
<div class="element-section">
|
|
938
|
-
<h3 class="section-header inactive">
|
|
939
|
-
Inactive Elements (${this.inactiveElements.length})
|
|
940
|
-
</h3>
|
|
941
|
-
${Me(this.inactiveElements,e=>W`
|
|
942
|
-
<single-element
|
|
943
|
-
.elementData=${e}
|
|
944
|
-
.isActive=${this.runningCallbacks.has(e.element)}
|
|
945
|
-
.isExpanded=${this.expandedElementIds.has(e.id)}
|
|
946
|
-
.onToggle=${this.handleElementToggle}
|
|
947
|
-
>
|
|
948
|
-
</single-element>
|
|
949
|
-
`)}
|
|
950
|
-
</div>
|
|
951
|
-
`:""}
|
|
952
|
-
</tab-content>
|
|
953
|
-
`}};b.styles=St`
|
|
954
|
-
:host {
|
|
955
|
-
display: flex;
|
|
956
|
-
flex-direction: column;
|
|
957
|
-
height: 100%;
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
.chips-container {
|
|
961
|
-
display: flex;
|
|
962
|
-
gap: 8px;
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
.element-section {
|
|
966
|
-
margin-bottom: 16px;
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
.element-section:last-child {
|
|
970
|
-
margin-bottom: 0;
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
.section-header {
|
|
974
|
-
margin: 4px 0 4px 0;
|
|
975
|
-
font-size: 12px;
|
|
976
|
-
font-weight: 600;
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
.section-header.active {
|
|
980
|
-
color: #e8e8e8;
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
.section-header.inactive {
|
|
984
|
-
color: #999;
|
|
985
|
-
}
|
|
986
|
-
`,n([$()],b.prototype,"hitCount",2),n([$()],b.prototype,"sortDropdown",2),n([$()],b.prototype,"sortOrder",2),n([$()],b.prototype,"elementListItems",2),n([$()],b.prototype,"noContentMessage",2),n([$()],b.prototype,"runningCallbacks",2),n([$()],b.prototype,"expandedElementIds",2),b=n([Dt("element-tab")],b);import{css as Mt,html as _e,LitElement as _t}from"lit";import{customElement as Lt,property as $t}from"lit/decorators.js";var A=class extends _t{constructor(){super(...arguments);this.activeTab="settings";this.tabs=["settings","elements","logs"]}_handleTabClick(e){this.dispatchEvent(new CustomEvent("tab-change",{detail:{tab:e},bubbles:!0,composed:!0}))}render(){return _e`
|
|
987
|
-
<div class="tab-selector-wrapper">
|
|
988
|
-
${this.tabs.map(e=>_e`
|
|
989
|
-
<button
|
|
990
|
-
class="tab-button ${this.activeTab===e?"active":""}"
|
|
991
|
-
@click="${()=>this._handleTabClick(e)}"
|
|
992
|
-
data-tab="${e}"
|
|
993
|
-
>
|
|
994
|
-
${e.charAt(0).toUpperCase()+e.slice(1)}
|
|
995
|
-
</button>
|
|
996
|
-
`)}
|
|
997
|
-
</div>
|
|
998
|
-
`}};A.styles=Mt`
|
|
999
|
-
.tab-selector-wrapper {
|
|
1000
|
-
border-bottom: 2px solid #444;
|
|
1001
|
-
margin-top: 12px;
|
|
1002
|
-
display: flex;
|
|
1003
|
-
justify-content: space-evenly;
|
|
1004
|
-
width: 100%;
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
.tab-button {
|
|
1008
|
-
background: none;
|
|
1009
|
-
border: none;
|
|
1010
|
-
color: #9e9e9e;
|
|
1011
|
-
flex: 1;
|
|
1012
|
-
padding: 8px;
|
|
1013
|
-
cursor: pointer;
|
|
1014
|
-
border-bottom: 2px solid transparent;
|
|
1015
|
-
transition: all 0.2s ease;
|
|
1016
|
-
font-size: 13px;
|
|
1017
|
-
font-weight: 500;
|
|
1018
|
-
text-align: center;
|
|
1019
|
-
}
|
|
1020
|
-
.tab-button:hover {
|
|
1021
|
-
color: #b0c4de;
|
|
1022
|
-
background-color: rgba(176, 196, 222, 0.1);
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
.tab-button.active {
|
|
1026
|
-
color: #b0c4de;
|
|
1027
|
-
border-bottom-color: #b0c4de;
|
|
1028
|
-
}
|
|
1029
|
-
`,n([$t({type:String})],A.prototype,"activeTab",2),A=n([Lt("tab-selector")],A);import{ForesightManager as K}from"js.foresight";import{LitElement as At,css as Rt,html as Z}from"lit";import{customElement as jt,property as zt,state as R}from"lit/decorators.js";import{map as Ht}from"lit/directives/map.js";function $e(o,r){let e={};o.eventListeners.forEach((i,a)=>{e[a]=i.length});let t=[];return o.registeredElements.forEach((i,a)=>{let{element:s,...d}=i;t.push({...d,elementInfo:`${a.id?`#${a.id}`:""}${a.className?`.${a.className.replace(/\s+/g,".")}`:""}`})}),{type:"managerDataPayload",warning:"this is a lot easier to view in the console",logId:r,globalCallbackHits:o.globalCallbackHits,localizedTimestamp:new Date().toLocaleTimeString(),eventListenerCount:e,managerSettings:o.globalSettings,registeredElements:t,loadedModules:o.loadedModules,summary:`${t.length} elements, ${Object.values(e).flat().length} listeners,
|
|
1030
|
-
${o.globalCallbackHits.total} hits`}}function Ie(o,r){try{switch(o.type){case"elementRegistered":return{type:"elementRegistered",name:o.elementData.name,id:o.elementData.element.id||"",callbackInfo:o.elementData.callbackInfo,hitslop:o.elementData.elementBounds.hitSlop,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),meta:o.elementData.meta,logId:r,summary:o.elementData.registerCount===1?o.elementData.name:`${o.elementData.name} - ${Le(o.elementData.registerCount)} time`};case"elementReactivated":return{type:"elementReactivated",name:o.elementData.name,id:o.elementData.element.id||"",callbackInfo:o.elementData.callbackInfo,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),meta:o.elementData.meta,logId:r,summary:o.elementData.registerCount===1?o.elementData.name:`${o.elementData.name} - ${Le(o.elementData.registerCount)} time`};case"elementUnregistered":return{type:"elementUnregistered",name:o.elementData.name,id:o.elementData.element.id||"",meta:o.elementData.meta,callbackInfo:o.elementData.callbackInfo,wasLastRegisteredElement:o.wasLastRegisteredElement,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),logId:r,summary:`${o.elementData.name} - ${o.unregisterReason}`};case"elementDataUpdated":return{type:"elementDataUpdated",name:o.elementData.name,updatedProps:o.updatedProps||[],callbackInfo:o.elementData.callbackInfo,isIntersecting:o.elementData.isIntersectingWithViewport,meta:o.elementData.meta,localizedTimestamp:new Date().toLocaleTimeString(),logId:r,summary:`${o.elementData.name} - ${o.updatedProps.toString()}`};case"callbackInvoked":return{type:"callbackInvoked",name:o.elementData.name,hitType:o.hitType,callbackInfo:o.elementData.callbackInfo,meta:o.elementData.meta,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),logId:r,summary:`${o.elementData.name} - ${o.hitType.kind}`};case"callbackCompleted":{let e=It(o.elementData.callbackInfo.lastCallbackRuntime||0);return{type:"callbackCompleted",name:o.elementData.name,hitType:o.hitType,callbackInfo:o.elementData.callbackInfo,meta:o.elementData.meta,wasLastActiveElement:o.wasLastActiveElement,elapsed:e,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),logId:r,status:o.elementData.callbackInfo.lastCallbackStatus,errorMessage:o.elementData.callbackInfo.lastCallbackErrorMessage,summary:`${o.elementData.name} - ${e}`}}case"mouseTrajectoryUpdate":return{type:"mouseTrajectoryUpdate",currentPoint:o.trajectoryPositions?.currentPoint,predictedPoint:o.trajectoryPositions?.predictedPoint,positionCount:o.trajectoryPositions?.positions?.length||0,mousePredictionEnabled:o.predictionEnabled,localizedTimestamp:new Date().toLocaleTimeString(),logId:r,summary:""};case"scrollTrajectoryUpdate":return{type:"scrollTrajectoryUpdate",currentPoint:o.currentPoint,predictedPoint:o.predictedPoint,scrollDirection:o.scrollDirection,localizedTimestamp:new Date().toLocaleTimeString(),logId:r,summary:o.scrollDirection};case"managerSettingsChanged":return{type:"managerSettingsChanged",globalSettings:o.managerData?.globalSettings||{},settingsChanged:o.updatedSettings,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),logId:r,summary:o.updatedSettings.map(e=>e.setting).join(", ")};case"deviceStrategyChanged":return{type:"deviceStrategyChanged",oldStrategy:o.oldStrategy,newStrategy:o.newStrategy,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),logId:r,summary:`${o.oldStrategy} \u2192 ${o.newStrategy}`};default:return{type:"serializationError",error:"Failed to serialize event data",errorMessage:JSON.stringify(o),localizedTimestamp:new Date().toLocaleTimeString(),logId:r,summary:""}}}catch(e){return{type:"serializationError",error:"Failed to serialize event data",localizedTimestamp:new Date().toLocaleTimeString(),errorMessage:e instanceof Error?e.message:String(e),logId:r,summary:""}}}function It(o){return`${(o/1e3).toFixed(4)} s`}function Le(o){let r=["th","st","nd","rd"],e=o%100;return o+(r[(e-20)%10]||r[e]||r[0])}import{html as Oe,css as Ot}from"lit";import{customElement as Pt,property as Pe}from"lit/decorators.js";var O=class extends L{constructor(){super(...arguments);this.selectedValues=[]}_handleOptionClick(e){let t=this.selectedValues.includes(e.value);t?this.selectedValues=this.selectedValues.filter(a=>a!==e.value):this.selectedValues=[...this.selectedValues,e.value];let i=!t;this.onSelectionChange?.(e.value,i)}_getTriggerIcon(){return u}_isOptionSelected(e){return this.selectedValues.includes(e.value)}_getTriggerTitle(){let e=this.selectedValues.length;return e===0?"No items selected":e===1?"1 item selected":`${e} items selected`}_getTriggerLabel(){return`Filter options: ${this.selectedValues.length} selected`}render(){let e=`trigger-button ${this.isDropdownOpen?"active":""}`,t=`dropdown-menu ${this.isDropdownOpen?"active":""}`;return Oe`
|
|
1031
|
-
<div class="dropdown-container">
|
|
1032
|
-
<button
|
|
1033
|
-
class="${e}"
|
|
1034
|
-
title="${this._getTriggerTitle()}"
|
|
1035
|
-
@click="${this._toggleDropdown}"
|
|
1036
|
-
aria-haspopup="true"
|
|
1037
|
-
aria-expanded="${this.isDropdownOpen}"
|
|
1038
|
-
aria-controls="dropdown-menu"
|
|
1039
|
-
aria-label="${this._getTriggerLabel()}"
|
|
1040
|
-
>
|
|
1041
|
-
${this._getTriggerIcon()}
|
|
1042
|
-
<span class="selected-count">${this.selectedValues.length}</span>
|
|
1043
|
-
<svg
|
|
1044
|
-
class="arrow-icon"
|
|
1045
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
1046
|
-
viewBox="0 0 24 24"
|
|
1047
|
-
stroke="currentColor"
|
|
1048
|
-
stroke-width="2"
|
|
1049
|
-
stroke-linecap="round"
|
|
1050
|
-
stroke-linejoin="round"
|
|
1051
|
-
>
|
|
1052
|
-
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1053
|
-
</svg>
|
|
1054
|
-
</button>
|
|
1055
|
-
|
|
1056
|
-
<div class="${t}" id="dropdown-menu" role="menu">
|
|
1057
|
-
${this.dropdownOptions.map(i=>Oe`
|
|
1058
|
-
<button
|
|
1059
|
-
value="${i.value}"
|
|
1060
|
-
title="${i.title}"
|
|
1061
|
-
class="${this._isOptionSelected(i)?"active":""}"
|
|
1062
|
-
@click="${()=>this._handleOptionClick(i)}"
|
|
1063
|
-
role="menuitem"
|
|
1064
|
-
>
|
|
1065
|
-
${i.label}
|
|
1066
|
-
</button>
|
|
1067
|
-
`)}
|
|
1068
|
-
</div>
|
|
1069
|
-
</div>
|
|
1070
|
-
`}};O.styles=[...L.styles,Ot`
|
|
1071
|
-
.dropdown-menu button.active::after {
|
|
1072
|
-
content: "✓";
|
|
1073
|
-
position: absolute;
|
|
1074
|
-
right: 8px;
|
|
1075
|
-
top: 50%;
|
|
1076
|
-
transform: translateY(-50%);
|
|
1077
|
-
color: #b0c4de;
|
|
1078
|
-
font-weight: bold;
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
.selected-count {
|
|
1082
|
-
font-size: 10px;
|
|
1083
|
-
color: #b0c4de;
|
|
1084
|
-
margin-left: 2px;
|
|
1085
|
-
}
|
|
1086
|
-
`],n([Pe({type:Array})],O.prototype,"selectedValues",2),n([Pe()],O.prototype,"onSelectionChange",2),O=n([Pt("multi-select-dropdown")],O);import{LitElement as Ut,html as Nt,css as Ft}from"lit";import{customElement as Vt,property as oe}from"lit/decorators.js";var S=class extends Ut{constructor(e){super();this.isExpanded=!1;this.log=e}updated(e){if(e.has("log")&&this.log){let t=this.log,i=t.type==="callbackCompleted"&&"status"in t&&t.status==="error",a=i?"#f44336":this.getLogTypeColor(t.type),s=i?"rgba(244, 67, 54, 0.1)":"transparent";this.style.setProperty("--log-color",a),this.style.setProperty("--log-background-color",s)}}serializeLogDataWithoutSummary(e){let{summary:t,...i}=e;return JSON.stringify(i,null,2)}getLogTypeColor(e){return{elementRegistered:"#2196f3",elementReactivated:"#ff9800",callbackInvoked:"#00bcd4",callbackCompleted:"#4caf50",elementDataUpdated:"#ffc107",elementUnregistered:"#ff9800",managerSettingsChanged:"#f44336",mouseTrajectoryUpdate:"#78909c",scrollTrajectoryUpdate:"#607d8b",deviceStrategyChanged:"#9c27b0"}[e]||"#555"}getEventDisplayName(e){return{elementRegistered:"Registered",elementReactivated:"Reactivated",elementUnregistered:"Unregistered",elementDataUpdated:"Data Updated",callbackInvoked:"Invoked",callbackCompleted:"Completed",mouseTrajectoryUpdate:"Mouse",scrollTrajectoryUpdate:"Scroll",managerSettingsChanged:"Settings",managerDataPayload:"ManagerData",deviceStrategyChanged:"Strategy"}[e]||e}truncateLogSummary(e,t=50){return e.length<=t?e:e.substring(0,t)+"..."}render(){let e=this.log,i=e.type==="callbackCompleted"&&"status"in e&&e.status==="error"?"#f44336":this.getLogTypeColor(e.type);return Nt`
|
|
1087
|
-
<expandable-item
|
|
1088
|
-
.borderColor=${i}
|
|
1089
|
-
.itemId=${e.logId}
|
|
1090
|
-
.isExpanded=${this.isExpanded}
|
|
1091
|
-
.onToggle=${this.onToggle}
|
|
1092
|
-
>
|
|
1093
|
-
<div slot="content">
|
|
1094
|
-
<div class="log-content">
|
|
1095
|
-
<span class="log-time">${e.localizedTimestamp}</span>
|
|
1096
|
-
<span class="log-type-badge">${this.getEventDisplayName(e.type)}</span>
|
|
1097
|
-
<span class="log-summary">${this.truncateLogSummary(e.summary)}</span>
|
|
1098
|
-
</div>
|
|
1099
|
-
</div>
|
|
1100
|
-
<div slot="details">${this.serializeLogDataWithoutSummary(e)}</div>
|
|
1101
|
-
</expandable-item>
|
|
1102
|
-
`}};S.styles=[Ft`
|
|
1103
|
-
:host {
|
|
1104
|
-
display: block;
|
|
1105
|
-
/*
|
|
1106
|
-
* The background color is now driven by a CSS variable.
|
|
1107
|
-
* This allows us to set it from TypeScript without touching the class.
|
|
1108
|
-
*/
|
|
1109
|
-
background-color: var(--log-background-color, transparent);
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
.log-time {
|
|
1113
|
-
color: #b8b8b8;
|
|
1114
|
-
font-weight: 500;
|
|
1115
|
-
font-size: 10px;
|
|
1116
|
-
font-family: "SF Mono", "Monaco", "Consolas", "Liberation Mono", "Courier New", monospace;
|
|
1117
|
-
min-width: 70px;
|
|
1118
|
-
max-width: 70px;
|
|
1119
|
-
text-align: left;
|
|
1120
|
-
letter-spacing: 0.02em;
|
|
1121
|
-
flex-shrink: 0;
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
.log-type-badge {
|
|
1125
|
-
display: inline-flex;
|
|
1126
|
-
align-items: center;
|
|
1127
|
-
font-size: 10px;
|
|
1128
|
-
font-weight: 600;
|
|
1129
|
-
text-transform: uppercase;
|
|
1130
|
-
letter-spacing: 0.02em;
|
|
1131
|
-
/* The color is driven by a CSS variable set in updated() */
|
|
1132
|
-
color: var(--log-color, #b0c4de);
|
|
1133
|
-
min-width: 90px;
|
|
1134
|
-
max-width: 90px;
|
|
1135
|
-
white-space: nowrap;
|
|
1136
|
-
text-align: left;
|
|
1137
|
-
margin-left: 10px;
|
|
1138
|
-
flex-shrink: 0;
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
.log-summary {
|
|
1142
|
-
flex: 1;
|
|
1143
|
-
color: #ccc;
|
|
1144
|
-
font-size: 11px;
|
|
1145
|
-
opacity: 0.9;
|
|
1146
|
-
white-space: nowrap;
|
|
1147
|
-
overflow: hidden;
|
|
1148
|
-
text-overflow: ellipsis;
|
|
1149
|
-
margin-left: 6px;
|
|
1150
|
-
font-weight: 400;
|
|
1151
|
-
min-width: 0;
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
.log-content {
|
|
1155
|
-
display: flex;
|
|
1156
|
-
align-items: center;
|
|
1157
|
-
width: 100%;
|
|
1158
|
-
min-width: 0;
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
/*
|
|
1162
|
-
* The :host(.error-status) selector is no longer needed,
|
|
1163
|
-
* as all styling is now handled by setting CSS variables below.
|
|
1164
|
-
* This makes the component's styling more self-contained.
|
|
1165
|
-
*/
|
|
1166
|
-
`],n([oe({attribute:!1})],S.prototype,"log",2),n([oe({type:Boolean})],S.prototype,"isExpanded",2),n([oe()],S.prototype,"onToggle",2),S=n([Vt("single-log")],S);var v=class extends At{constructor(){super();this.logs=[];this.expandedLogIds=new Set;this.MAX_LOGS=100;this.logIdCounter=0;this.noContentMessage="No logs available";this._abortController=null;this._eventListeners=new Map;this.handleLogLocationChange=e=>{this.logLocation=e};this.handleFilterChange=(e,t)=>{this.eventsEnabled={...this.eventsEnabled,[e]:t},t?this.addForesightEventListener(e):this.removeForesightEventListener(e)};this.handleLogToggle=e=>{let t=new Set(this.expandedLogIds);t.has(e)?t.delete(e):t.add(e),this.expandedLogIds=t};let{logging:{logLocation:e,...t}}=l.instance.devtoolsSettings;this.eventsEnabled=t,this.logLocation=e,this.logDropdown=[{value:"controlPanel",label:"Control Panel",title:"Log only to the control panel",icon:le},{value:"console",label:"Console",title:"Log only to the console",icon:ce},{value:"both",label:"Both",title:"Log to both the control panel and the console",icon:pe},{value:"none",label:"None",title:"Dont log anywhere",icon:de}],this.filterDropdown=[{value:"elementRegistered",label:"Element Registered",title:"Show element registration events",icon:u},{value:"elementUnregistered",label:"Element Unregistered",title:"Show element unregistration events",icon:u},{value:"elementReactivated",label:"Element Reactivated",title:"Show when element gets reactivated after stale time has passed",icon:u},{value:"callbackInvoked",label:"Callback Invoked",title:"Show callback invoked events",icon:u},{value:"callbackCompleted",label:"Callback Completed",title:"Show callback completed events",icon:u},{value:"mouseTrajectoryUpdate",label:"Mouse Trajectory Update",title:"Show mouse trajectory update events",icon:u},{value:"scrollTrajectoryUpdate",label:"Scroll Trajectory Update",title:"Show scroll trajectory update events",icon:u},{value:"managerSettingsChanged",label:"Manager Settings Changed",title:"Show manager settings change events",icon:u},{value:"deviceStrategyChanged",label:"Strategy Changed",title:"Show strategy change events",icon:u}]}getSelectedEventFilters(){return Object.entries(this.eventsEnabled).filter(([,e])=>e).map(([e])=>e)}shouldShowPerformanceWarning(){let e=this.logLocation==="console"||this.logLocation==="both",t=this.eventsEnabled.mouseTrajectoryUpdate||this.eventsEnabled.scrollTrajectoryUpdate||this.eventsEnabled.elementDataUpdated;return e&&t}getNoLogsMessage(){return Object.values(this.eventsEnabled).filter(Boolean).length===0?"Logging for all events is turned off":this.logLocation==="console"?"No logs to display. Logging location is set to console - check browser console for events.":this.logLocation==="none"?"No logs to display. Logging location is set to none":"Interact with Foresight to generate events."}clearLogs(){this.logs=[],this.expandedLogIds.clear(),this.noContentMessage="Logs cleared"}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController,this.setupDynamicEventListeners()}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this.removeAllEventListeners()}setupDynamicEventListeners(){Object.entries(this.eventsEnabled).forEach(([e,t])=>{t&&this.addForesightEventListener(e)})}addForesightEventListener(e){if(this._eventListeners.has(e))return;let t=i=>{this.handleEvent(e,i)};this._eventListeners.set(e,t),K.instance.addEventListener(e,t,{signal:this._abortController?.signal})}removeForesightEventListener(e){let t=this._eventListeners.get(e);t&&(K.instance.removeEventListener(e,t),this._eventListeners.delete(e))}removeAllEventListeners(){this._eventListeners.forEach((e,t)=>{K.instance.removeEventListener(t,e)}),this._eventListeners.clear()}getEventColor(e){return{elementRegistered:"#2196f3",elementReactivated:"#ff9800",callbackInvoked:"#00bcd4",callbackCompleted:"#4caf50",elementDataUpdated:"#ffc107",elementUnregistered:"#ff9800",managerSettingsChanged:"#f44336",mouseTrajectoryUpdate:"#78909c",scrollTrajectoryUpdate:"#607d8b",deviceStrategyChanged:"#9c27b0"}[e]||"#ffffff"}handleEvent(e,t){if(this.logLocation!=="none"){if(this.logLocation==="console"||this.logLocation==="both"){let i=this.getEventColor(e);console.log(`%c[ForesightJS] ${e}`,`color: ${i}; font-weight: bold;`,t)}(this.logLocation==="controlPanel"||this.logLocation==="both")&&this.addEventLog(t)}}addLog(e){this.logs.unshift(e),this.logs.length>this.MAX_LOGS&&this.logs.pop(),this.requestUpdate()}logManagerData(){this.logLocation!=="none"&&((this.logLocation==="console"||this.logLocation==="both")&&console.log(K.instance.getManagerData),(this.logLocation==="controlPanel"||this.logLocation==="both")&&this.addManagerLog())}addManagerLog(){let e=$e(K.instance.getManagerData,(++this.logIdCounter).toString());this.addLog(e)}addEventLog(e){let t=Ie(e,(++this.logIdCounter).toString());if(t.type==="serializationError"){console.error(t.error,t.errorMessage);return}this.addLog(t)}render(){return Z`
|
|
1167
|
-
<tab-header>
|
|
1168
|
-
<div slot="chips" class="chips-container">
|
|
1169
|
-
<chip-element title="Number of logged events (Max ${this.MAX_LOGS})">
|
|
1170
|
-
${this.logs.length} events
|
|
1171
|
-
</chip-element>
|
|
1172
|
-
</div>
|
|
1173
|
-
<div slot="actions">
|
|
1174
|
-
${this.shouldShowPerformanceWarning()?Z`
|
|
1175
|
-
<div
|
|
1176
|
-
class="warning-container"
|
|
1177
|
-
title="Console logging can be slow with frequent trajectory events.
|
|
1178
|
-
Consider using 'Control Panel' only for better performance."
|
|
1179
|
-
>
|
|
1180
|
-
${fe}
|
|
1181
|
-
</div>
|
|
1182
|
-
`:""}
|
|
1183
|
-
<single-select-dropdown
|
|
1184
|
-
.dropdownOptions="${this.logDropdown}"
|
|
1185
|
-
.selectedOptionValue="${this.logLocation}"
|
|
1186
|
-
.onSelectionChange="${this.handleLogLocationChange}"
|
|
1187
|
-
></single-select-dropdown>
|
|
1188
|
-
|
|
1189
|
-
<multi-select-dropdown
|
|
1190
|
-
.dropdownOptions="${this.filterDropdown}"
|
|
1191
|
-
.selectedValues="${this.getSelectedEventFilters()}"
|
|
1192
|
-
.onSelectionChange="${this.handleFilterChange}"
|
|
1193
|
-
></multi-select-dropdown>
|
|
1194
|
-
<button
|
|
1195
|
-
class="single-button"
|
|
1196
|
-
title="Log the state from the manager"
|
|
1197
|
-
@click="${this.logManagerData}"
|
|
1198
|
-
>
|
|
1199
|
-
${ye}
|
|
1200
|
-
</button>
|
|
1201
|
-
<button
|
|
1202
|
-
class="single-button"
|
|
1203
|
-
title="Clear all logs"
|
|
1204
|
-
?disabled="${this.logs.length===0}"
|
|
1205
|
-
@click="${this.clearLogs}"
|
|
1206
|
-
>
|
|
1207
|
-
${ue}
|
|
1208
|
-
</button>
|
|
1209
|
-
</div>
|
|
1210
|
-
</tab-header>
|
|
1211
|
-
<tab-content .noContentMessage=${this.noContentMessage} .hasContent=${!!this.logs.length}>
|
|
1212
|
-
${this.logs.length===0?Z`<div class="no-items">${this.getNoLogsMessage()}</div>`:Ht(this.logs,e=>Z`
|
|
1213
|
-
<single-log
|
|
1214
|
-
.log=${e}
|
|
1215
|
-
.isExpanded=${this.expandedLogIds.has(e.logId)}
|
|
1216
|
-
.onToggle=${this.handleLogToggle}
|
|
1217
|
-
></single-log>
|
|
1218
|
-
`)}
|
|
1219
|
-
</tab-content>
|
|
1220
|
-
`}};v.styles=[Rt`
|
|
1221
|
-
:host {
|
|
1222
|
-
display: flex;
|
|
1223
|
-
flex-direction: column;
|
|
1224
|
-
height: 100%;
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
.chips-container {
|
|
1228
|
-
display: flex;
|
|
1229
|
-
gap: 4px;
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
.single-button {
|
|
1233
|
-
background: none;
|
|
1234
|
-
border: none;
|
|
1235
|
-
color: white;
|
|
1236
|
-
cursor: pointer;
|
|
1237
|
-
padding: 6px;
|
|
1238
|
-
display: inline-flex;
|
|
1239
|
-
align-items: center;
|
|
1240
|
-
justify-content: center;
|
|
1241
|
-
transition: all 0.2s ease;
|
|
1242
|
-
vertical-align: top;
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1245
|
-
.single-button svg {
|
|
1246
|
-
width: 16px;
|
|
1247
|
-
height: 16px;
|
|
1248
|
-
stroke: white;
|
|
1249
|
-
transition: stroke 0.2s;
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
.single-button:hover {
|
|
1253
|
-
background-color: rgba(176, 196, 222, 0.1);
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
.single-button:hover svg {
|
|
1257
|
-
stroke: #b0c4de;
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
.single-button:disabled {
|
|
1261
|
-
opacity: 0.4;
|
|
1262
|
-
cursor: not-allowed;
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
.single-button:disabled:hover {
|
|
1266
|
-
background: none;
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
.single-button:disabled svg {
|
|
1270
|
-
stroke: #666;
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
.no-items {
|
|
1274
|
-
display: flex;
|
|
1275
|
-
align-items: center;
|
|
1276
|
-
justify-content: center;
|
|
1277
|
-
height: 200px;
|
|
1278
|
-
text-align: center;
|
|
1279
|
-
font-family: "Courier New", monospace;
|
|
1280
|
-
font-style: italic;
|
|
1281
|
-
padding: 20px;
|
|
1282
|
-
color: #999;
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
.warning-container {
|
|
1286
|
-
background: none;
|
|
1287
|
-
border: none;
|
|
1288
|
-
color: #ffc107;
|
|
1289
|
-
cursor: help;
|
|
1290
|
-
padding: 6px;
|
|
1291
|
-
display: inline-flex;
|
|
1292
|
-
align-items: center;
|
|
1293
|
-
justify-content: center;
|
|
1294
|
-
transition: all 0.2s ease;
|
|
1295
|
-
vertical-align: top;
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
.warning-container svg {
|
|
1299
|
-
width: 16px;
|
|
1300
|
-
height: 16px;
|
|
1301
|
-
stroke: #ffc107;
|
|
1302
|
-
fill: none;
|
|
1303
|
-
transition: stroke 0.2s;
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
.warning-container:hover {
|
|
1307
|
-
background-color: rgba(255, 193, 7, 0.1);
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
.warning-container:hover svg {
|
|
1311
|
-
stroke: #ffdc3e;
|
|
1312
|
-
}
|
|
1313
|
-
`],n([R()],v.prototype,"logDropdown",2),n([R()],v.prototype,"filterDropdown",2),n([R()],v.prototype,"logLocation",2),n([R()],v.prototype,"eventsEnabled",2),n([R()],v.prototype,"logs",2),n([R()],v.prototype,"expandedLogIds",2),n([zt()],v.prototype,"noContentMessage",2),v=n([jt("log-tab")],v);import{ForesightManager as ee}from"js.foresight";import{css as bn,html as h,LitElement as vn}from"lit";import{customElement as fn,state as T}from"lit/decorators.js";var ae="points";var Ue="tabs";import{LitElement as qt,html as Yt,css as Jt}from"lit";import{customElement as Xt,property as Q}from"lit/decorators.js";import{LitElement as Bt,html as Gt,css as Wt}from"lit";import{customElement as Kt,property as Ne}from"lit/decorators.js";var P=class extends Bt{constructor(){super(...arguments);this.header="";this.description=""}render(){return Gt`<div class="setting-item">
|
|
1314
|
-
<label>
|
|
1315
|
-
<span class="setting-header">${this.header}</span>
|
|
1316
|
-
<span class="setting-description"> ${this.description} </span>
|
|
1317
|
-
</label>
|
|
1318
|
-
<div class="setting-controls">
|
|
1319
|
-
<slot name="controls"></slot>
|
|
1320
|
-
</div>
|
|
1321
|
-
</div>`}};P.styles=[Wt`
|
|
1322
|
-
.setting-item {
|
|
1323
|
-
display: flex;
|
|
1324
|
-
align-items: center;
|
|
1325
|
-
gap: 12px;
|
|
1326
|
-
padding: 10px 0;
|
|
1327
|
-
border-bottom: 1px solid rgba(80, 80, 80, 0.2);
|
|
1328
|
-
}
|
|
1329
|
-
|
|
1330
|
-
.setting-item:last-child {
|
|
1331
|
-
border-bottom: none;
|
|
1332
|
-
}
|
|
1333
|
-
.setting-controls {
|
|
1334
|
-
display: flex;
|
|
1335
|
-
align-items: center;
|
|
1336
|
-
gap: 8px;
|
|
1337
|
-
flex-shrink: 0;
|
|
1338
|
-
}
|
|
1339
|
-
.setting-description {
|
|
1340
|
-
font-size: 11px;
|
|
1341
|
-
color: #9e9e9e;
|
|
1342
|
-
line-height: 1.3;
|
|
1343
|
-
font-weight: normal;
|
|
1344
|
-
}
|
|
1345
|
-
.setting-item label {
|
|
1346
|
-
flex: 1;
|
|
1347
|
-
display: flex;
|
|
1348
|
-
flex-direction: column;
|
|
1349
|
-
gap: 4px;
|
|
1350
|
-
font-weight: 500;
|
|
1351
|
-
color: #fff;
|
|
1352
|
-
font-size: 13px;
|
|
1353
|
-
min-width: 180px;
|
|
1354
|
-
}
|
|
1355
|
-
.setting-header {
|
|
1356
|
-
font-weight: 500;
|
|
1357
|
-
color: #fff;
|
|
1358
|
-
font-size: 13px;
|
|
1359
|
-
}
|
|
1360
|
-
`],n([Ne({type:String})],P.prototype,"header",2),n([Ne({type:String})],P.prototype,"description",2),P=n([Kt("setting-item")],P);import{ForesightManager as Zt}from"js.foresight";var k=class extends qt{constructor(){super(...arguments);this.isChecked=!1;this.header="";this.description="";this.setting="enableMousePrediction"}handleCheckboxChange(e){let t=e.target;if(t instanceof HTMLInputElement){let i=t.checked;this.setting==="showNameTags"?this.dispatchEvent(new CustomEvent("setting-changed",{detail:{setting:this.setting,value:i},bubbles:!0})):Zt.instance.alterGlobalSettings({[this.setting]:i})}}render(){return Yt`<setting-item header=${this.header} description=${this.description}>
|
|
1361
|
-
<input
|
|
1362
|
-
slot="controls"
|
|
1363
|
-
type="checkbox"
|
|
1364
|
-
.checked=${this.isChecked}
|
|
1365
|
-
@change=${this.handleCheckboxChange}
|
|
1366
|
-
/>
|
|
1367
|
-
</setting-item>`}};k.styles=[Jt`
|
|
1368
|
-
input[type="checkbox"] {
|
|
1369
|
-
appearance: none;
|
|
1370
|
-
-webkit-appearance: none;
|
|
1371
|
-
-moz-appearance: none;
|
|
1372
|
-
position: relative;
|
|
1373
|
-
width: 44px;
|
|
1374
|
-
height: 22px;
|
|
1375
|
-
background-color: #444;
|
|
1376
|
-
cursor: pointer;
|
|
1377
|
-
outline: none;
|
|
1378
|
-
transition: all 0.3s ease;
|
|
1379
|
-
vertical-align: middle;
|
|
1380
|
-
flex-shrink: 0;
|
|
1381
|
-
margin: 0;
|
|
1382
|
-
border: 2px solid #555;
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
input[type="checkbox"]::before {
|
|
1386
|
-
content: "";
|
|
1387
|
-
position: absolute;
|
|
1388
|
-
width: 16px;
|
|
1389
|
-
height: 16px;
|
|
1390
|
-
background-color: white;
|
|
1391
|
-
top: 1px;
|
|
1392
|
-
left: 1px;
|
|
1393
|
-
transition: all 0.3s ease;
|
|
1394
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
|
1395
|
-
}
|
|
1396
|
-
|
|
1397
|
-
input[type="checkbox"]:checked {
|
|
1398
|
-
background-color: #b0c4de;
|
|
1399
|
-
border-color: #b0c4de;
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1402
|
-
input[type="checkbox"]:checked::before {
|
|
1403
|
-
transform: translateX(22px);
|
|
1404
|
-
background-color: white;
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
|
-
input[type="checkbox"]:hover {
|
|
1408
|
-
box-shadow: 0 0 0 3px rgba(176, 196, 222, 0.1);
|
|
1409
|
-
}
|
|
1410
|
-
`],n([Q({type:Boolean})],k.prototype,"isChecked",2),n([Q({type:String})],k.prototype,"header",2),n([Q({type:String})],k.prototype,"description",2),n([Q({type:String})],k.prototype,"setting",2),k=n([Xt("setting-item-checkbox")],k);import{LitElement as Qt,html as en,css as tn}from"lit";import{customElement as nn,property as U,state as on}from"lit/decorators.js";import{ForesightManager as an}from"js.foresight";var g=class extends Qt{constructor(){super(...arguments);this.minValue=0;this.maxValue=100;this.currentValue=50;this.unit="px";this.header="";this.description="";this.setting="tabOffset";this.displayValue=50}handleRangeInput(e){let t=e.target;t instanceof HTMLInputElement&&(this.displayValue=parseInt(t.value,10))}handleRangeChange(e){let t=e.target;if(t instanceof HTMLInputElement){let i=parseInt(t.value,10);this.displayValue=i,an.instance.alterGlobalSettings({[this.setting]:i})}}willUpdate(e){super.willUpdate(e),e.has("currentValue")&&(this.displayValue=this.currentValue)}render(){return en`<setting-item header=${this.header} description=${this.description}>
|
|
1411
|
-
<div slot="controls" class="range-wrapper">
|
|
1412
|
-
<input
|
|
1413
|
-
slot="controls"
|
|
1414
|
-
type="range"
|
|
1415
|
-
min="${this.minValue}"
|
|
1416
|
-
max="${this.maxValue}"
|
|
1417
|
-
step="1"
|
|
1418
|
-
.value=${this.displayValue}
|
|
1419
|
-
@input=${this.handleRangeInput}
|
|
1420
|
-
@change=${this.handleRangeChange}
|
|
1421
|
-
/>
|
|
1422
|
-
<span class="setting-range-value">${this.displayValue} ${this.unit}</span>
|
|
1423
|
-
</div>
|
|
1424
|
-
</setting-item>`}};g.styles=[tn`
|
|
1425
|
-
.setting-range-value {
|
|
1426
|
-
font-size: 12px;
|
|
1427
|
-
color: #b0c4de;
|
|
1428
|
-
font-weight: 500;
|
|
1429
|
-
min-width: 45px;
|
|
1430
|
-
text-align: right;
|
|
1431
|
-
}
|
|
1432
|
-
|
|
1433
|
-
.range-wrapper {
|
|
1434
|
-
display: flex;
|
|
1435
|
-
align-items: center;
|
|
1436
|
-
gap: 8px;
|
|
1437
|
-
width: 100%;
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
input[type="range"] {
|
|
1441
|
-
margin: 0;
|
|
1442
|
-
cursor: pointer;
|
|
1443
|
-
-webkit-appearance: none;
|
|
1444
|
-
appearance: none;
|
|
1445
|
-
background: transparent;
|
|
1446
|
-
height: 22px;
|
|
1447
|
-
vertical-align: middle;
|
|
1448
|
-
width: 100px;
|
|
1449
|
-
}
|
|
1450
|
-
|
|
1451
|
-
input[type="range"]::-webkit-slider-runnable-track {
|
|
1452
|
-
height: 6px;
|
|
1453
|
-
background: #444;
|
|
1454
|
-
border: 1px solid #555;
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
input[type="range"]::-moz-range-track {
|
|
1458
|
-
height: 6px;
|
|
1459
|
-
background: #444;
|
|
1460
|
-
border: 1px solid #555;
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
|
-
input[type="range"]::-webkit-slider-thumb {
|
|
1464
|
-
-webkit-appearance: none;
|
|
1465
|
-
appearance: none;
|
|
1466
|
-
margin-top: -7px;
|
|
1467
|
-
background: #b0c4de;
|
|
1468
|
-
height: 20px;
|
|
1469
|
-
width: 20px;
|
|
1470
|
-
border: 2px solid #333;
|
|
1471
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
|
1472
|
-
transition: all 0.2s ease;
|
|
1473
|
-
}
|
|
1474
|
-
|
|
1475
|
-
input[type="range"]::-moz-range-thumb {
|
|
1476
|
-
background: #b0c4de;
|
|
1477
|
-
height: 20px;
|
|
1478
|
-
width: 20px;
|
|
1479
|
-
border: 2px solid #333;
|
|
1480
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
|
1481
|
-
transition: all 0.2s ease;
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1484
|
-
input[type="range"]:hover::-webkit-slider-thumb {
|
|
1485
|
-
transform: scale(1.1);
|
|
1486
|
-
box-shadow: 0 0 0 4px rgba(176, 196, 222, 0.2);
|
|
1487
|
-
}
|
|
1488
|
-
|
|
1489
|
-
input[type="range"]:hover::-moz-range-thumb {
|
|
1490
|
-
transform: scale(1.1);
|
|
1491
|
-
box-shadow: 0 0 0 4px rgba(176, 196, 222, 0.2);
|
|
1492
|
-
}
|
|
1493
|
-
`],n([U({type:Number})],g.prototype,"minValue",2),n([U({type:Number})],g.prototype,"maxValue",2),n([U({type:Number})],g.prototype,"currentValue",2),n([U({type:String})],g.prototype,"unit",2),n([U({type:String})],g.prototype,"header",2),n([U({type:String})],g.prototype,"description",2),n([U({type:String})],g.prototype,"setting",2),n([on()],g.prototype,"displayValue",2),g=n([nn("setting-item-range")],g);var m=class extends vn{constructor(){super();this.changedSettings=[];this.currentCorner="bottom-right";this.touchDeviceStrategyOptions=[{value:"onTouchStart",label:"On Touch Start",title:"Execute callbacks when user touches registered elements",icon:h`<span>Touch</span>`},{value:"viewport",label:"Viewport Entry",title:"Execute callbacks when registered elements enter the viewport",icon:h`<span>Viewport</span>`},{value:"none",label:"None",title:"Disable touch device prediction",icon:h`<span>None</span>`}];this.minimumConnectionTypeOptions=[{value:"slow-2g",label:"Slow 2G",title:"Slow 2G",icon:h`<span>Slow 2G</span>`},{value:"2g",label:"2G",title:"2G",icon:h`<span>2G</span>`},{value:"3g",label:"3G",title:"3G",icon:h`<span>3G</span>`},{value:"4g",label:"4G",title:"4G",icon:h`<span>4G</span>`}];this.cornerOptions=[{value:"top-left",label:"Top Left",title:"Position control panel in top-left corner",icon:h`<span>↖</span>`},{value:"top-right",label:"Top Right",title:"Position control panel in top-right corner",icon:h`<span>↗</span>`},{value:"bottom-left",label:"Bottom Left",title:"Position control panel in bottom-left corner",icon:h`<span>↙</span>`},{value:"bottom-right",label:"Bottom Right",title:"Position control panel in bottom-right corner",icon:h`<span>↘</span>`}];this._abortController=null;this._handleTouchDeviceStrategyChange=e=>{ee.instance.alterGlobalSettings({touchDeviceStrategy:e})};this._handleMinimumConnectionTypeChange=e=>{ee.instance.alterGlobalSettings({minimumConnectionType:e})};this._handleCornerChange=e=>{this.currentCorner=e,this.dispatchEvent(new CustomEvent("corner-change",{detail:{corner:e},bubbles:!0,composed:!0}))};let e=l.instance.devtoolsSettings,t=ee.instance.getManagerData.globalSettings;this.devtoolsSettings=Object.assign({},e),this.managerSettings=Object.assign({},t),this.currentCorner=this.getCurrentCorner(),this.initialSettings={devtools:Object.assign({},e),manager:Object.assign({},t)}}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;ee.instance.addEventListener("managerSettingsChanged",t=>{this.managerSettings=t.managerData.globalSettings,this._updateChangedSettings()},{signal:e}),this._updateChangedSettings()}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this._abortController=null}_updateChangedSettings(){let e=[];this._checkManagerSettingsChanges(e),this._checkDevtoolsSettingsChanges(e),this.changedSettings=e}_checkManagerSettingsChanges(e){let t=["enableMousePrediction","enableTabPrediction","enableScrollPrediction","trajectoryPredictionTime","positionHistorySize","tabOffset","scrollMargin","touchDeviceStrategy","minimumConnectionType"];for(let i of t){let a=this.initialSettings.manager[i],s=this.managerSettings[i];a!==s&&e.push({setting:i,oldValue:a,newValue:s})}}_checkDevtoolsSettingsChanges(e){let t=["showNameTags"];for(let i of t){let a=this.initialSettings.devtools[i],s=this.devtoolsSettings[i];a!==s&&e.push({setting:i,oldValue:a,newValue:s})}}_handleDevtoolsSettingChange(e){let{setting:t,value:i}=e.detail;t==="showNameTags"&&(this.devtoolsSettings={...this.devtoolsSettings,showNameTags:i},l.instance.alterDevtoolsSettings({showNameTags:i}),this._updateChangedSettings())}getCurrentCorner(){try{let e=localStorage.getItem("foresight-devtools-control-panel-corner");if(e&&["top-left","top-right","bottom-left","bottom-right"].includes(e))return e}catch(e){console.warn("ForesightDevtools: Failed to load corner from localStorage:",e)}return"bottom-right"}async handleCopySettings(){if(this.managerSettings)try{let e=this.generateSettingsCode(this.managerSettings);navigator.clipboard&&navigator.clipboard.writeText&&await navigator.clipboard.writeText(e)}catch(e){console.error("Failed to copy settings code:",e)}}generateSettingsCode(e){let t={enableMousePrediction:e.enableMousePrediction,enableTabPrediction:e.enableTabPrediction,enableScrollPrediction:e.enableScrollPrediction,positionHistorySize:e.positionHistorySize,trajectoryPredictionTime:e.trajectoryPredictionTime,tabOffset:e.tabOffset,scrollMargin:e.scrollMargin,touchDeviceStrategy:e.touchDeviceStrategy,minimumConnectionType:e.minimumConnectionType};return`ForesightManager.initialize(${JSON.stringify(t,null,2)})`}render(){if(!this.managerSettings||!this.devtoolsSettings)return h`<tab-content
|
|
1494
|
-
.noContentMessage=${"Loading settings..."}
|
|
1495
|
-
.hasContent=${!1}
|
|
1496
|
-
></tab-content>`;let e=this.managerSettings,t=this.changedSettings.length>0?`Settings that have been changed this session compared to your initialized settings.
|
|
1497
|
-
Click on the copy icon to easely copy the new setting into your project
|
|
1498
|
-
|
|
1499
|
-
`+this.changedSettings.map(i=>`${i.setting}: ${JSON.stringify(i.oldValue)} -> ${JSON.stringify(i.newValue)}`).join(`
|
|
1500
|
-
`):"No settings changed from initial values";return h`
|
|
1501
|
-
<tab-header>
|
|
1502
|
-
<div slot="chips" class="chips-container">
|
|
1503
|
-
<chip-element .title=${t}> ${this.changedSettings.length} changed </chip-element>
|
|
1504
|
-
</div>
|
|
1505
|
-
<div slot="actions">
|
|
1506
|
-
<copy-icon
|
|
1507
|
-
title="Copy current settings as code"
|
|
1508
|
-
.onCopy=${()=>this.handleCopySettings()}
|
|
1509
|
-
></copy-icon>
|
|
1510
|
-
</div>
|
|
1511
|
-
</tab-header>
|
|
1512
|
-
|
|
1513
|
-
<tab-content .hasContent=${!0}>
|
|
1514
|
-
<div class="settings-content">
|
|
1515
|
-
<div class="settings-section">
|
|
1516
|
-
<div class="settings-group">
|
|
1517
|
-
<h4>Mouse Prediction</h4>
|
|
1518
|
-
<setting-item-checkbox
|
|
1519
|
-
.isChecked=${e.enableMousePrediction}
|
|
1520
|
-
header="Enable Mouse Prediction"
|
|
1521
|
-
description="Execute callbacks when mouse is ${e.trajectoryPredictionTime}ms away from registered elements in mouse direction"
|
|
1522
|
-
setting="enableMousePrediction"
|
|
1523
|
-
></setting-item-checkbox>
|
|
1524
|
-
<setting-item-range
|
|
1525
|
-
.currentValue=${e.trajectoryPredictionTime}
|
|
1526
|
-
.maxValue=${200}
|
|
1527
|
-
.minValue=${10}
|
|
1528
|
-
.unit=${"ms"}
|
|
1529
|
-
header="Prediction Time"
|
|
1530
|
-
description="How far into the future to calculate mouse trajectory path"
|
|
1531
|
-
setting="trajectoryPredictionTime"
|
|
1532
|
-
></setting-item-range>
|
|
1533
|
-
<setting-item-range
|
|
1534
|
-
.currentValue=${e.positionHistorySize}
|
|
1535
|
-
.maxValue=${30}
|
|
1536
|
-
.minValue=${2}
|
|
1537
|
-
.unit=${ae}
|
|
1538
|
-
header="Position History Size"
|
|
1539
|
-
description="How far into the future, in ${ae}, to calculate mouse trajectory path"
|
|
1540
|
-
setting="positionHistorySize"
|
|
1541
|
-
>
|
|
1542
|
-
</setting-item-range>
|
|
1543
|
-
</div>
|
|
1544
|
-
<div class="settings-group">
|
|
1545
|
-
<h4>Keyboard Navigation</h4>
|
|
1546
|
-
<setting-item-checkbox
|
|
1547
|
-
.isChecked=${e.enableTabPrediction}
|
|
1548
|
-
header="Enable Tab Prediction"
|
|
1549
|
-
description="Execute callbacks when user ${e.tabOffset} tabbable elements away from registered elements in tab direction"
|
|
1550
|
-
setting="enableTabPrediction"
|
|
1551
|
-
>
|
|
1552
|
-
</setting-item-checkbox>
|
|
1553
|
-
<setting-item-range
|
|
1554
|
-
.currentValue=${e.tabOffset}
|
|
1555
|
-
.maxValue=${20}
|
|
1556
|
-
.minValue=${0}
|
|
1557
|
-
.unit=${Ue}
|
|
1558
|
-
header="Tab Offset"
|
|
1559
|
-
description="Number of tabbable elements to look ahead when predicting navigation"
|
|
1560
|
-
setting="tabOffset"
|
|
1561
|
-
>
|
|
1562
|
-
</setting-item-range>
|
|
1563
|
-
</div>
|
|
1564
|
-
|
|
1565
|
-
<div class="settings-group">
|
|
1566
|
-
<h4>Scroll Prediction</h4>
|
|
1567
|
-
<setting-item-checkbox
|
|
1568
|
-
.isChecked=${e.enableScrollPrediction}
|
|
1569
|
-
header="Enable Scroll Prediction"
|
|
1570
|
-
description="Execute callbacks when user is ${e.scrollMargin}px away from registered elements in scroll direction"
|
|
1571
|
-
setting="enableScrollPrediction"
|
|
1572
|
-
></setting-item-checkbox>
|
|
1573
|
-
<setting-item-range
|
|
1574
|
-
.currentValue=${e.scrollMargin}
|
|
1575
|
-
.maxValue=${300}
|
|
1576
|
-
.minValue=${30}
|
|
1577
|
-
.unit=${"px"}
|
|
1578
|
-
header="Scroll Margin"
|
|
1579
|
-
description="Pixel distance to check from mouse position in scroll direction"
|
|
1580
|
-
setting="scrollMargin"
|
|
1581
|
-
></setting-item-range>
|
|
1582
|
-
</div>
|
|
1583
|
-
|
|
1584
|
-
<div class="settings-group">
|
|
1585
|
-
<h4>Touch Device</h4>
|
|
1586
|
-
<setting-item
|
|
1587
|
-
header="Touch Device Strategy"
|
|
1588
|
-
description="How to handle prediction on touch devices"
|
|
1589
|
-
>
|
|
1590
|
-
<single-select-dropdown
|
|
1591
|
-
slot="controls"
|
|
1592
|
-
.dropdownOptions=${this.touchDeviceStrategyOptions}
|
|
1593
|
-
.selectedOptionValue=${e.touchDeviceStrategy}
|
|
1594
|
-
.onSelectionChange=${this._handleTouchDeviceStrategyChange}
|
|
1595
|
-
></single-select-dropdown>
|
|
1596
|
-
</setting-item>
|
|
1597
|
-
</div>
|
|
1598
|
-
|
|
1599
|
-
<div class="settings-group">
|
|
1600
|
-
<h4>Minimum Connection</h4>
|
|
1601
|
-
<setting-item
|
|
1602
|
-
header="Minimum Connection Type"
|
|
1603
|
-
description="Minimum connection speed required to register elements"
|
|
1604
|
-
>
|
|
1605
|
-
<single-select-dropdown
|
|
1606
|
-
slot="controls"
|
|
1607
|
-
.dropdownOptions=${this.minimumConnectionTypeOptions}
|
|
1608
|
-
.selectedOptionValue=${e.minimumConnectionType}
|
|
1609
|
-
.onSelectionChange=${this._handleMinimumConnectionTypeChange}
|
|
1610
|
-
></single-select-dropdown>
|
|
1611
|
-
</setting-item>
|
|
1612
|
-
</div>
|
|
1613
|
-
|
|
1614
|
-
<!-- Developer Tools Group -->
|
|
1615
|
-
<div class="settings-group">
|
|
1616
|
-
<h4>Developer Tools</h4>
|
|
1617
|
-
<setting-item-checkbox
|
|
1618
|
-
.isChecked=${this.devtoolsSettings.showNameTags}
|
|
1619
|
-
header="Show Name Tags"
|
|
1620
|
-
description="Display name tags over each registered element in the debugger"
|
|
1621
|
-
setting="showNameTags"
|
|
1622
|
-
@setting-changed=${this._handleDevtoolsSettingChange}
|
|
1623
|
-
></setting-item-checkbox>
|
|
1624
|
-
<setting-item
|
|
1625
|
-
header="Panel Position"
|
|
1626
|
-
description="Choose which corner to position the control panel"
|
|
1627
|
-
>
|
|
1628
|
-
<single-select-dropdown
|
|
1629
|
-
slot="controls"
|
|
1630
|
-
.dropdownOptions=${this.cornerOptions}
|
|
1631
|
-
.selectedOptionValue=${this.currentCorner}
|
|
1632
|
-
.onSelectionChange=${this._handleCornerChange}
|
|
1633
|
-
></single-select-dropdown>
|
|
1634
|
-
</setting-item>
|
|
1635
|
-
</div>
|
|
1636
|
-
</div>
|
|
1637
|
-
</div>
|
|
1638
|
-
</tab-content>
|
|
1639
|
-
`}};m.styles=bn`
|
|
1640
|
-
:host {
|
|
1641
|
-
display: flex;
|
|
1642
|
-
flex-direction: column;
|
|
1643
|
-
height: 100%;
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
.settings-content {
|
|
1647
|
-
display: block;
|
|
1648
|
-
}
|
|
1649
|
-
|
|
1650
|
-
.settings-section {
|
|
1651
|
-
display: flex;
|
|
1652
|
-
flex-direction: column;
|
|
1653
|
-
gap: 16px;
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1656
|
-
.settings-group {
|
|
1657
|
-
background: rgba(30, 30, 30, 0.6);
|
|
1658
|
-
padding: 16px;
|
|
1659
|
-
border: 1px solid rgba(176, 196, 222, 0.1);
|
|
1660
|
-
}
|
|
1661
|
-
|
|
1662
|
-
.settings-group h4 {
|
|
1663
|
-
margin: 0 0 12px 0;
|
|
1664
|
-
font-size: 14px;
|
|
1665
|
-
font-weight: 600;
|
|
1666
|
-
color: #b0c4de;
|
|
1667
|
-
border-bottom: 1px solid rgba(176, 196, 222, 0.2);
|
|
1668
|
-
padding-bottom: 8px;
|
|
1669
|
-
}
|
|
1670
|
-
`,n([T()],m.prototype,"managerSettings",2),n([T()],m.prototype,"initialSettings",2),n([T()],m.prototype,"devtoolsSettings",2),n([T()],m.prototype,"changedSettings",2),n([T()],m.prototype,"currentCorner",2),n([T()],m.prototype,"touchDeviceStrategyOptions",2),n([T()],m.prototype,"minimumConnectionTypeOptions",2),n([T()],m.prototype,"cornerOptions",2),m=n([fn("settings-tab")],m);var w=class extends yn{constructor(){super();this.isMinimized=l.instance.devtoolsSettings.isControlPanelDefaultMinimized;this.isTouchDevice=!1;this.isWarningDismissed=!1;this.corner="bottom-right";this.localStorageSelectedTabKey="foresight-devtools-control-panel-tab";this.localStorageCornerKey="foresight-devtools-control-panel-corner";this._abortController=null;this.activeTab=this.getStoredTab(),this.corner=this.getStoredCorner(),this.isTouchDevice=Fe.instance.getManagerData.currentDeviceStrategy==="touch"}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;Fe.instance.addEventListener("deviceStrategyChanged",t=>{this.isTouchDevice=t.newStrategy==="touch",t.newStrategy==="touch"&&(this.isWarningDismissed=!1)},{signal:e}),this.addEventListener("corner-change",(t=>{this.setCorner(t.detail.corner)}),{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this._abortController=null}getStoredTab(){try{return localStorage.getItem(this.localStorageSelectedTabKey)||"logs"}catch(e){return console.error(e),"logs"}}getStoredCorner(){try{let e=localStorage.getItem(this.localStorageCornerKey);if(e)return e}catch(e){console.error("ForesightDevtools: Failed to load corner from localStorage:",e)}return"bottom-right"}_handleTabChange(e){this.activeTab=e.detail.tab,this.setStoredTab(this.activeTab)}setStoredTab(e){try{localStorage.setItem(this.localStorageSelectedTabKey,e)}catch(t){console.warn("ForesightDevtools: Failed to save tab preference to localStorage:",t)}}setStoredCorner(e){try{localStorage.setItem(this.localStorageCornerKey,e)}catch(t){console.warn("ForesightDevtools: Failed to save corner to localStorage:",t)}}dismissWarning(){this.isWarningDismissed=!0}setCorner(e){this.corner=e,this.setStoredCorner(this.corner),this.requestUpdate()}handleMinimizeClick(e){e.stopPropagation(),this.isMinimized=!this.isMinimized}getMinimizeSymbol(){return this.isMinimized?"+":"\u2212"}render(){return xn`
|
|
1671
|
-
<div class="control-wrapper ${this.corner} ${this.isMinimized?"minimized":""}">
|
|
1672
|
-
<div class="title-wrapper">
|
|
1673
|
-
<button @click="${this.handleMinimizeClick}" class="minimize-button">
|
|
1674
|
-
${this.getMinimizeSymbol()}
|
|
1675
|
-
</button>
|
|
1676
|
-
<h1>Foresight DevTools</h1>
|
|
1677
|
-
<div></div>
|
|
1678
|
-
</div>
|
|
1679
|
-
|
|
1680
|
-
<div
|
|
1681
|
-
class="touch-device-warning ${this.isMinimized||!this.isTouchDevice||this.isWarningDismissed?"hidden":""}"
|
|
1682
|
-
>
|
|
1683
|
-
<div class="warning-content">
|
|
1684
|
-
<span class="warning-icon">⚠️</span>
|
|
1685
|
-
<span>Touch device mode: Overlays and visibility sorting not available</span>
|
|
1686
|
-
</div>
|
|
1687
|
-
<button @click="${this.dismissWarning}" class="dismiss-button" title="Dismiss warning">
|
|
1688
|
-
×
|
|
1689
|
-
</button>
|
|
1690
|
-
</div>
|
|
1691
|
-
|
|
1692
|
-
<div class="tab-container ${this.isMinimized?"hidden":""}">
|
|
1693
|
-
<tab-selector
|
|
1694
|
-
.activeTab="${this.activeTab}"
|
|
1695
|
-
@tab-change="${this._handleTabChange}"
|
|
1696
|
-
></tab-selector>
|
|
1697
|
-
|
|
1698
|
-
<div class="tab-content">
|
|
1699
|
-
<log-tab class=${re({active:this.activeTab==="logs"})}></log-tab>
|
|
1700
|
-
<element-tab class=${re({active:this.activeTab==="elements"})}></element-tab>
|
|
1701
|
-
<settings-tab
|
|
1702
|
-
class=${re({active:this.activeTab==="settings"})}
|
|
1703
|
-
></settings-tab>
|
|
1704
|
-
</div>
|
|
1705
|
-
</div>
|
|
1706
|
-
</div>
|
|
1707
|
-
`}};w.styles=wn`
|
|
1708
|
-
.control-wrapper {
|
|
1709
|
-
--panel-offset: 10px;
|
|
1710
|
-
padding: 12px;
|
|
1711
|
-
position: fixed;
|
|
1712
|
-
background-color: rgba(0, 0, 0, 0.9);
|
|
1713
|
-
color: white;
|
|
1714
|
-
font-family: Arial, sans-serif;
|
|
1715
|
-
font-size: 13px;
|
|
1716
|
-
z-index: 10001;
|
|
1717
|
-
pointer-events: auto;
|
|
1718
|
-
display: flex;
|
|
1719
|
-
flex-direction: column;
|
|
1720
|
-
width: 450px;
|
|
1721
|
-
height: 450px;
|
|
1722
|
-
transition:
|
|
1723
|
-
width 0.3s ease,
|
|
1724
|
-
height 0.3s ease;
|
|
1725
|
-
box-sizing: border-box;
|
|
1726
|
-
border-radius: 8px;
|
|
1727
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
|
1728
|
-
}
|
|
1729
|
-
|
|
1730
|
-
.control-wrapper.top-left {
|
|
1731
|
-
top: var(--panel-offset);
|
|
1732
|
-
left: var(--panel-offset);
|
|
1733
|
-
}
|
|
1734
|
-
.control-wrapper.top-right {
|
|
1735
|
-
top: var(--panel-offset);
|
|
1736
|
-
right: var(--panel-offset);
|
|
1737
|
-
}
|
|
1738
|
-
.control-wrapper.bottom-left {
|
|
1739
|
-
bottom: var(--panel-offset);
|
|
1740
|
-
left: var(--panel-offset);
|
|
1741
|
-
}
|
|
1742
|
-
.control-wrapper.bottom-right {
|
|
1743
|
-
bottom: var(--panel-offset);
|
|
1744
|
-
right: var(--panel-offset);
|
|
1745
|
-
}
|
|
1746
|
-
|
|
1747
|
-
.control-wrapper.minimized {
|
|
1748
|
-
width: 230px;
|
|
1749
|
-
height: 45px;
|
|
1750
|
-
}
|
|
1751
|
-
|
|
1752
|
-
.title-wrapper {
|
|
1753
|
-
display: flex;
|
|
1754
|
-
justify-content: space-between;
|
|
1755
|
-
align-items: center;
|
|
1756
|
-
padding: 0;
|
|
1757
|
-
flex-shrink: 0;
|
|
1758
|
-
}
|
|
1759
|
-
|
|
1760
|
-
.title-wrapper h1 {
|
|
1761
|
-
margin: 0;
|
|
1762
|
-
font-size: 15px;
|
|
1763
|
-
}
|
|
1764
|
-
|
|
1765
|
-
.minimize-button {
|
|
1766
|
-
background: none;
|
|
1767
|
-
border: none;
|
|
1768
|
-
color: white;
|
|
1769
|
-
font-size: 22px;
|
|
1770
|
-
cursor: pointer;
|
|
1771
|
-
line-height: 1;
|
|
1772
|
-
padding: 0;
|
|
1773
|
-
}
|
|
1774
|
-
|
|
1775
|
-
.tab-container {
|
|
1776
|
-
display: flex;
|
|
1777
|
-
flex-direction: column;
|
|
1778
|
-
flex: 1;
|
|
1779
|
-
overflow: hidden;
|
|
1780
|
-
}
|
|
1781
|
-
|
|
1782
|
-
.tab-container.hidden {
|
|
1783
|
-
display: none;
|
|
1784
|
-
}
|
|
1785
|
-
|
|
1786
|
-
.tab-content {
|
|
1787
|
-
flex: 1;
|
|
1788
|
-
position: relative;
|
|
1789
|
-
}
|
|
1790
|
-
|
|
1791
|
-
.tab-content > * {
|
|
1792
|
-
display: none;
|
|
1793
|
-
}
|
|
1794
|
-
|
|
1795
|
-
.tab-content > .active {
|
|
1796
|
-
display: flex;
|
|
1797
|
-
position: absolute;
|
|
1798
|
-
top: 0;
|
|
1799
|
-
left: 0;
|
|
1800
|
-
width: 100%;
|
|
1801
|
-
height: 100%;
|
|
1802
|
-
}
|
|
1803
|
-
|
|
1804
|
-
.touch-device-warning {
|
|
1805
|
-
background-color: rgba(255, 193, 7, 0.9);
|
|
1806
|
-
color: #000;
|
|
1807
|
-
padding: 8px 12px;
|
|
1808
|
-
margin: 8px 0;
|
|
1809
|
-
border-radius: 4px;
|
|
1810
|
-
font-size: 12px;
|
|
1811
|
-
font-weight: 500;
|
|
1812
|
-
display: flex;
|
|
1813
|
-
align-items: center;
|
|
1814
|
-
justify-content: space-between;
|
|
1815
|
-
gap: 8px;
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
|
-
.touch-device-warning.hidden {
|
|
1819
|
-
display: none;
|
|
1820
|
-
}
|
|
1821
|
-
|
|
1822
|
-
.warning-content {
|
|
1823
|
-
display: flex;
|
|
1824
|
-
align-items: center;
|
|
1825
|
-
gap: 8px;
|
|
1826
|
-
}
|
|
1827
|
-
|
|
1828
|
-
.warning-icon {
|
|
1829
|
-
font-weight: bold;
|
|
1830
|
-
font-size: 14px;
|
|
1831
|
-
}
|
|
1832
|
-
|
|
1833
|
-
.dismiss-button {
|
|
1834
|
-
background: none;
|
|
1835
|
-
border: none;
|
|
1836
|
-
color: #000;
|
|
1837
|
-
font-size: 16px;
|
|
1838
|
-
cursor: pointer;
|
|
1839
|
-
padding: 0;
|
|
1840
|
-
line-height: 1;
|
|
1841
|
-
font-weight: bold;
|
|
1842
|
-
}
|
|
1843
|
-
|
|
1844
|
-
.dismiss-button:hover {
|
|
1845
|
-
opacity: 0.7;
|
|
1846
|
-
}
|
|
1847
|
-
`,n([q()],w.prototype,"activeTab",2),n([q()],w.prototype,"isMinimized",2),n([q()],w.prototype,"isTouchDevice",2),n([q()],w.prototype,"isWarningDismissed",2),n([q()],w.prototype,"corner",2),w=n([kn("control-panel")],w);import{LitElement as Vn,css as An,html as Ae}from"lit";import{customElement as Rn,state as jn}from"lit/decorators.js";import{LitElement as Cn,html as En,css as Sn}from"lit";import{customElement as Tn,state as Ve,query as Dn}from"lit/decorators.js";import{ForesightManager as j}from"js.foresight";var D=class extends Cn{constructor(){super(...arguments);this.overlayMap=new Map;this.callbackAnimations=new Map;this._abortController=null}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;j.instance.addEventListener("elementRegistered",t=>{t.elementData.isIntersectingWithViewport&&this.createOrUpdateElementOverlay(t.elementData)},{signal:e}),j.instance.addEventListener("elementUnregistered",t=>{this.removeElementOverlay(t.elementData)},{signal:e}),j.instance.addEventListener("elementReactivated",t=>{t.elementData.isIntersectingWithViewport&&this.createOrUpdateElementOverlay(t.elementData)},{signal:e}),j.instance.addEventListener("elementDataUpdated",t=>{t.updatedProps.includes("bounds")&&t.elementData.callbackInfo.isCallbackActive&&this.createOrUpdateElementOverlay(t.elementData),t.updatedProps.includes("visibility")&&(t.elementData.isIntersectingWithViewport||this.removeElementOverlay(t.elementData))},{signal:e}),j.instance.addEventListener("callbackInvoked",t=>{this.highlightElementCallback(t.elementData,t.hitType)},{signal:e}),j.instance.addEventListener("callbackCompleted",t=>{this.unhighlightElementCallback(t.elementData),this.removeElementOverlay(t.elementData)},{signal:e}),document.addEventListener("showNameTagsChanged",t=>{let i=t;this.updateNameTagVisibility(i.detail.showNameTags)},{signal:e})}createElementOverlays(e){let t=document.createElement("div");t.className="expanded-overlay";let i=document.createElement("div");i.className="name-label",this.containerElement.appendChild(t),this.containerElement.appendChild(i);let a={expandedOverlay:t,nameLabel:i};return this.overlayMap.set(e.element,a),a}updateElementOverlays(e,t){let{expandedOverlay:i,nameLabel:a}=e,{expandedRect:s}=t.elementBounds,d=s.right-s.left,Y=s.bottom-s.top;i.style.width=`${d}px`,i.style.height=`${Y}px`,i.style.transform=`translate3d(${s.left}px, ${s.top}px, 0)`,l.instance.devtoolsSettings.showNameTags?(a.textContent=t.name,a.style.display="block",a.style.transform=`translate3d(${s.left}px, ${s.top-25}px, 0)`):a.style.display="none"}createOrUpdateElementOverlay(e){let t=this.overlayMap.get(e.element);t||(t=this.createElementOverlays(e)),this.updateElementOverlays(t,e)}removeElementOverlay(e){let t=this.overlayMap.get(e.element);t&&(t.expandedOverlay.remove(),t.nameLabel.remove(),this.overlayMap.delete(e.element)),this.clearCallbackAnimationTimeout(e.element)}clearCallbackAnimationTimeout(e){let t=this.callbackAnimations.get(e);t&&(clearTimeout(t.timeoutId),this.callbackAnimations.delete(e))}highlightElementCallback(e,t){let i=this.overlayMap.get(e.element);if(i)switch(this.clearCallbackAnimationTimeout(e.element),t.kind){case"mouse":i.expandedOverlay.classList.add("invoked-by-mouse");break;case"scroll":i.expandedOverlay.classList.add("invoked-by-scroll");break;case"tab":i.expandedOverlay.classList.add("invoked-by-tab");break;case"touch":break;case"viewport":break;default:}}unhighlightElementCallback(e){let t=this.overlayMap.get(e.element);if(!t)return;let i=setTimeout(()=>{t.expandedOverlay.classList.remove("callback-invoked"),this.callbackAnimations.delete(e.element)},400);this.callbackAnimations.set(e.element,{element:e.element,timeoutId:i})}updateNameTagVisibility(e){this.overlayMap.forEach(t=>{let i=t.nameLabel;e?i.style.display="block":i.style.display="none"})}disconnectedCallback(){super.disconnectedCallback(),this.callbackAnimations.forEach(e=>{clearTimeout(e.timeoutId)}),this.callbackAnimations.clear(),this.overlayMap.clear(),this._abortController?.abort(),this._abortController=null}render(){return En` <div id="overlays-container"></div> `}};D.styles=[Sn`
|
|
1848
|
-
:host {
|
|
1849
|
-
position: fixed;
|
|
1850
|
-
top: 0;
|
|
1851
|
-
left: 0;
|
|
1852
|
-
width: 100%;
|
|
1853
|
-
height: 100%;
|
|
1854
|
-
pointer-events: none;
|
|
1855
|
-
z-index: 9999;
|
|
1856
|
-
}
|
|
1857
|
-
|
|
1858
|
-
.expanded-overlay {
|
|
1859
|
-
position: absolute;
|
|
1860
|
-
will-change: transform, box-shadow;
|
|
1861
|
-
border: 1px dashed rgba(100, 116, 139, 0.4);
|
|
1862
|
-
background-color: rgba(100, 116, 139, 0.05);
|
|
1863
|
-
transition:
|
|
1864
|
-
border-color 0.2s ease,
|
|
1865
|
-
background-color 0.2s ease;
|
|
1866
|
-
}
|
|
1867
|
-
|
|
1868
|
-
.expanded-overlay.invoked-by-scroll {
|
|
1869
|
-
--glow-color-rgb: 234, 179, 8;
|
|
1870
|
-
border-color: #eab308;
|
|
1871
|
-
background-color: rgba(var(--glow-color-rgb), 0.1);
|
|
1872
|
-
animation: callback-glow 2s ease-in-out infinite;
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1875
|
-
.expanded-overlay.invoked-by-mouse {
|
|
1876
|
-
--glow-color-rgb: 59, 130, 246;
|
|
1877
|
-
border-color: #3b82f6;
|
|
1878
|
-
background-color: rgba(var(--glow-color-rgb), 0.1);
|
|
1879
|
-
animation: callback-glow 2s ease-in-out infinite;
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
|
-
.expanded-overlay.invoked-by-tab {
|
|
1883
|
-
--glow-color-rgb: 249, 115, 22;
|
|
1884
|
-
border-color: #f97316;
|
|
1885
|
-
background-color: rgba(var(--glow-color-rgb), 0.1);
|
|
1886
|
-
animation: callback-glow 2s ease-in-out infinite;
|
|
1887
|
-
}
|
|
1888
|
-
@keyframes callback-glow {
|
|
1889
|
-
0% {
|
|
1890
|
-
box-shadow: 0 0 5px 2px rgba(var(--glow-color-rgb), 0.3);
|
|
1891
|
-
}
|
|
1892
|
-
50% {
|
|
1893
|
-
box-shadow: 0 0 15px 4px rgba(var(--glow-color-rgb), 0.6);
|
|
1894
|
-
}
|
|
1895
|
-
100% {
|
|
1896
|
-
box-shadow: 0 0 5px 2px rgba(var(--glow-color-rgb), 0.3);
|
|
1897
|
-
}
|
|
1898
|
-
}
|
|
1899
|
-
|
|
1900
|
-
.name-label {
|
|
1901
|
-
position: absolute;
|
|
1902
|
-
top: 0;
|
|
1903
|
-
left: 0;
|
|
1904
|
-
will-change: transform;
|
|
1905
|
-
background-color: rgba(27, 31, 35, 0.85);
|
|
1906
|
-
backdrop-filter: blur(4px);
|
|
1907
|
-
color: white;
|
|
1908
|
-
padding: 4px 8px;
|
|
1909
|
-
font-size: 11px;
|
|
1910
|
-
font-family:
|
|
1911
|
-
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif,
|
|
1912
|
-
"Apple Color Emoji", "Segoe UI Emoji";
|
|
1913
|
-
z-index: 10001;
|
|
1914
|
-
white-space: nowrap;
|
|
1915
|
-
pointer-events: none;
|
|
1916
|
-
}
|
|
1917
|
-
`],n([Ve()],D.prototype,"overlayMap",2),n([Ve()],D.prototype,"callbackAnimations",2),n([Dn("#overlays-container")],D.prototype,"containerElement",2),D=n([Tn("element-overlays")],D);import{LitElement as Mn,html as _n,css as Ln}from"lit";import{customElement as $n,state as se}from"lit/decorators.js";import{styleMap as In}from"lit/directives/style-map.js";import{ForesightManager as z}from"js.foresight";var M=class extends Mn{constructor(){super(...arguments);this._abortController=new AbortController;this._mousePredictionIsEnabled=z.instance.getManagerData.globalSettings.enableMousePrediction;this._isVisible=!1;this._trajectoryStyles={};this.handleTrajectoryReset=e=>{("wasLastActiveElement"in e&&e.wasLastActiveElement||"wasLastRegisteredElement"in e&&e.wasLastRegisteredElement)&&(this._isVisible=!1,this._trajectoryStyles={transform:"translate3d(0px, 0px, 0) rotate(0deg)",width:"0px"})};this.handleSettingsChange=e=>{let t=e.managerData.globalSettings.enableMousePrediction;this._mousePredictionIsEnabled=t,t||(this._isVisible=!1),this.requestUpdate()};this.handleTrajectoryUpdate=e=>{if(!this._mousePredictionIsEnabled)return;this._isVisible=!0;let{currentPoint:t,predictedPoint:i}=e.trajectoryPositions,a=i.x-t.x,s=i.y-t.y,d=Math.sqrt(a*a+s*s),Y=Math.atan2(s,a)*57.29577951308232;this._trajectoryStyles={transform:`translate3d(${t.x}px, ${t.y}px, 0) rotate(${Y}deg)`,width:`${d}px`}}}connectedCallback(){super.connectedCallback();let{signal:e}=this._abortController;z.instance.addEventListener("callbackCompleted",this.handleTrajectoryReset,{signal:e}),z.instance.addEventListener("elementUnregistered",this.handleTrajectoryReset,{signal:e}),z.instance.addEventListener("mouseTrajectoryUpdate",this.handleTrajectoryUpdate,{signal:e}),z.instance.addEventListener("scrollTrajectoryUpdate",()=>{this._isVisible=!1},{signal:e}),z.instance.addEventListener("managerSettingsChanged",this.handleSettingsChange,{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController.abort()}render(){let e={display:this._isVisible?"block":"none",...this._trajectoryStyles};return _n` <div class="trajectory-line" style=${In(e)}></div> `}};M.styles=[Ln`
|
|
1918
|
-
:host {
|
|
1919
|
-
display: block;
|
|
1920
|
-
}
|
|
1921
|
-
|
|
1922
|
-
.trajectory-line {
|
|
1923
|
-
position: absolute;
|
|
1924
|
-
top: 0;
|
|
1925
|
-
left: 0;
|
|
1926
|
-
will-change: transform, width;
|
|
1927
|
-
transform-origin: left center;
|
|
1928
|
-
height: 4px;
|
|
1929
|
-
background: linear-gradient(90deg, #3b82f6, rgba(59, 130, 246, 0.4));
|
|
1930
|
-
z-index: 9999;
|
|
1931
|
-
border-radius: 2px;
|
|
1932
|
-
box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
|
|
1933
|
-
}
|
|
1934
|
-
|
|
1935
|
-
.trajectory-line::after {
|
|
1936
|
-
content: "";
|
|
1937
|
-
position: absolute;
|
|
1938
|
-
right: -6px;
|
|
1939
|
-
top: 50%;
|
|
1940
|
-
transform: translateY(-50%);
|
|
1941
|
-
width: 0;
|
|
1942
|
-
height: 0;
|
|
1943
|
-
border-left: 8px solid #3b82f6;
|
|
1944
|
-
border-top: 4px solid transparent;
|
|
1945
|
-
border-bottom: 4px solid transparent;
|
|
1946
|
-
filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.6));
|
|
1947
|
-
}
|
|
1948
|
-
`],n([se()],M.prototype,"_mousePredictionIsEnabled",2),n([se()],M.prototype,"_isVisible",2),n([se()],M.prototype,"_trajectoryStyles",2),M=n([$n("mouse-trajectory")],M);import{LitElement as On,html as Pn,css as Un}from"lit";import{customElement as Nn,state as te}from"lit/decorators.js";import{styleMap as Fn}from"lit/directives/style-map.js";import{ForesightManager as N}from"js.foresight";var C=class extends On{constructor(){super(...arguments);this._abortController=new AbortController;this._scrollPredictionIsEnabled=N.instance.getManagerData.globalSettings.enableScrollPrediction;this._scrollMargin=N.instance.getManagerData.globalSettings.scrollMargin;this._isVisible=!1;this._trajectoryStyles={};this._isUpdateScheduled=!1;this._latestScrollTrajectory=null;this.handleTrajectoryReset=e=>{("wasLastActiveElement"in e&&e.wasLastActiveElement||"wasLastRegisteredElement"in e&&e.wasLastRegisteredElement)&&(this._isVisible=!1,this._trajectoryStyles={transform:"translate(0px, 0px) rotate(0deg)"})};this.handleSettingsChange=e=>{let t=e.managerData.globalSettings.enableScrollPrediction;this._scrollPredictionIsEnabled=t,t||(this._isVisible=!1);let i=e.updatedSettings.find(a=>a.setting==="scrollMargin");i&&(this._scrollMargin=i.newValue)};this.handleScrollUpdate=e=>{this._scrollPredictionIsEnabled&&(this._isVisible=!0,this._latestScrollTrajectory={currentPoint:e.currentPoint,predictedPoint:e.predictedPoint},this._isUpdateScheduled||(this._isUpdateScheduled=!0,this.renderScrollTrajectory()))};this.renderScrollTrajectory=()=>{if(!this._latestScrollTrajectory){this._isUpdateScheduled=!1;return}let{currentPoint:e,predictedPoint:t}=this._latestScrollTrajectory,i=t.x-e.x,a=t.y-e.y,s=Math.atan2(a,i)*180/Math.PI;this._trajectoryStyles={transform:`translate(${e.x}px, ${e.y}px) rotate(${s}deg)`},this._isUpdateScheduled=!1,this.requestUpdate()}}connectedCallback(){super.connectedCallback();let{signal:e}=this._abortController;N.instance.addEventListener("scrollTrajectoryUpdate",this.handleScrollUpdate,{signal:e}),N.instance.addEventListener("mouseTrajectoryUpdate",()=>{this._isVisible=!1},{signal:e}),N.instance.addEventListener("callbackCompleted",this.handleTrajectoryReset,{signal:e}),N.instance.addEventListener("elementUnregistered",this.handleTrajectoryReset,{signal:e}),N.instance.addEventListener("managerSettingsChanged",this.handleSettingsChange,{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController.abort()}render(){let e={display:this._isVisible?"block":"none",width:`${this._scrollMargin}px`,...this._trajectoryStyles};return Pn` <div class="scroll-trajectory-line" style=${Fn(e)}></div> `}};C.styles=[Un`
|
|
1949
|
-
:host {
|
|
1950
|
-
display: block;
|
|
1951
|
-
}
|
|
1952
|
-
|
|
1953
|
-
.scroll-trajectory-line {
|
|
1954
|
-
position: absolute;
|
|
1955
|
-
top: 0;
|
|
1956
|
-
left: 0;
|
|
1957
|
-
will-change: transform, width;
|
|
1958
|
-
transform-origin: left center;
|
|
1959
|
-
height: 4px;
|
|
1960
|
-
background: repeating-linear-gradient(
|
|
1961
|
-
90deg,
|
|
1962
|
-
#eab308 0px,
|
|
1963
|
-
#eab308 8px,
|
|
1964
|
-
transparent 8px,
|
|
1965
|
-
transparent 16px
|
|
1966
|
-
);
|
|
1967
|
-
z-index: 9999;
|
|
1968
|
-
border-radius: 2px;
|
|
1969
|
-
animation: scroll-dash-flow 1.5s linear infinite;
|
|
1970
|
-
box-shadow: 0 0 12px rgba(234, 179, 8, 0.4);
|
|
1971
|
-
}
|
|
1972
|
-
|
|
1973
|
-
.scroll-trajectory-line::after {
|
|
1974
|
-
content: "";
|
|
1975
|
-
position: absolute;
|
|
1976
|
-
right: -6px;
|
|
1977
|
-
top: 50%;
|
|
1978
|
-
transform: translateY(-50%);
|
|
1979
|
-
width: 0;
|
|
1980
|
-
height: 0;
|
|
1981
|
-
border-left: 8px solid #eab308;
|
|
1982
|
-
border-top: 4px solid transparent;
|
|
1983
|
-
border-bottom: 4px solid transparent;
|
|
1984
|
-
filter: drop-shadow(0 0 6px rgba(234, 179, 8, 0.6));
|
|
1985
|
-
animation: scroll-arrow-pulse 1.5s ease-in-out infinite;
|
|
1986
|
-
}
|
|
1987
|
-
|
|
1988
|
-
@keyframes scroll-dash-flow {
|
|
1989
|
-
0% {
|
|
1990
|
-
background-position: 0px 0px;
|
|
1991
|
-
}
|
|
1992
|
-
100% {
|
|
1993
|
-
background-position: 16px 0px;
|
|
1994
|
-
}
|
|
1995
|
-
}
|
|
1996
|
-
|
|
1997
|
-
@keyframes scroll-arrow-pulse {
|
|
1998
|
-
0%,
|
|
1999
|
-
100% {
|
|
2000
|
-
transform: translateY(-50%) scale(1);
|
|
2001
|
-
filter: drop-shadow(0 0 6px rgba(234, 179, 8, 0.6));
|
|
2002
|
-
}
|
|
2003
|
-
50% {
|
|
2004
|
-
transform: translateY(-50%) scale(1.2);
|
|
2005
|
-
filter: drop-shadow(0 0 12px rgba(234, 179, 8, 0.8));
|
|
2006
|
-
}
|
|
2007
|
-
}
|
|
2008
|
-
`],n([te()],C.prototype,"_scrollPredictionIsEnabled",2),n([te()],C.prototype,"_scrollMargin",2),n([te()],C.prototype,"_isVisible",2),n([te()],C.prototype,"_trajectoryStyles",2),C=n([Nn("scroll-trajectory")],C);import{ForesightManager as Re}from"js.foresight";var H=class extends Vn{constructor(){super(...arguments);this._abortController=null;this._strategy=Re.instance.getManagerData.currentDeviceStrategy;this.handleDeviceStrategyChange=e=>this._strategy=e.newStrategy}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;Re.instance.addEventListener("deviceStrategyChanged",this.handleDeviceStrategyChange,{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort()}render(){return Ae`
|
|
2009
|
-
<div id="overlay-container">
|
|
2010
|
-
${this._strategy==="mouse"?Ae`
|
|
2011
|
-
<mouse-trajectory></mouse-trajectory>
|
|
2012
|
-
<scroll-trajectory></scroll-trajectory>
|
|
2013
|
-
<element-overlays></element-overlays>
|
|
2014
|
-
`:""}
|
|
2015
|
-
</div>
|
|
2016
|
-
`}};H.styles=[An`
|
|
2017
|
-
:host {
|
|
2018
|
-
display: block;
|
|
2019
|
-
}
|
|
2020
|
-
#overlay-container {
|
|
2021
|
-
position: fixed;
|
|
2022
|
-
top: 0;
|
|
2023
|
-
left: 0;
|
|
2024
|
-
pointer-events: none;
|
|
2025
|
-
z-index: 9999;
|
|
2026
|
-
}
|
|
2027
|
-
`],n([jn()],H.prototype,"_strategy",2),H=n([Rn("debug-overlay")],H);var l=class extends zn{constructor(){super();this.isInitialized=!1;this.devtoolsSettings={showDebugger:!0,isControlPanelDefaultMinimized:!1,showNameTags:!0,sortElementList:"visibility",logging:{logLocation:"controlPanel",callbackCompleted:!0,elementReactivated:!0,callbackInvoked:!0,elementDataUpdated:!1,elementRegistered:!1,elementUnregistered:!1,managerSettingsChanged:!0,mouseTrajectoryUpdate:!1,scrollTrajectoryUpdate:!1,deviceStrategyChanged:!0}}}static createAndAppendInstance(){typeof window>"u"||typeof document>"u"||(l._instance=document.createElement("foresight-devtools"),document.body.appendChild(l._instance))}static initialize(e){if(l._instance||l.createAndAppendInstance(),!l._instance)return l._instance;let t=l._instance;return t.isInitialized=!0,t.alterDevtoolsSettings(e),t}static get instance(){return l._instance?l._instance:l.initialize()}disconnectedCallback(){super.disconnectedCallback(),this.cleanup()}shouldUpdateSetting(e,t){return e!==void 0&&e!==t}updateLoggingSetting(e,t){this.shouldUpdateSetting(t,this.devtoolsSettings.logging[e])&&(this.devtoolsSettings.logging[e]=t)}alterDevtoolsSettings(e){e!==void 0&&(this.shouldUpdateSetting(e.showNameTags,this.devtoolsSettings.showNameTags)&&(this.devtoolsSettings.showNameTags=e.showNameTags,this.dispatchEvent(new CustomEvent("showNameTagsChanged",{detail:{showNameTags:e.showNameTags},bubbles:!0}))),this.shouldUpdateSetting(e.showDebugger,this.devtoolsSettings.showDebugger)&&(this.devtoolsSettings.showDebugger=e.showDebugger,this.requestUpdate()),this.shouldUpdateSetting(e.isControlPanelDefaultMinimized,this.devtoolsSettings.isControlPanelDefaultMinimized)&&(this.devtoolsSettings.isControlPanelDefaultMinimized=e.isControlPanelDefaultMinimized),this.shouldUpdateSetting(e.sortElementList,this.devtoolsSettings.sortElementList)&&(this.devtoolsSettings.sortElementList=e.sortElementList),e.logging&&(this.shouldUpdateSetting(e.logging.logLocation,this.devtoolsSettings.logging.logLocation)&&(this.devtoolsSettings.logging.logLocation=e.logging.logLocation),this.updateLoggingSetting("callbackCompleted",e.logging.callbackCompleted),this.updateLoggingSetting("callbackInvoked",e.logging.callbackInvoked),this.updateLoggingSetting("elementDataUpdated",e.logging.elementDataUpdated),this.updateLoggingSetting("elementRegistered",e.logging.elementRegistered),this.updateLoggingSetting("elementUnregistered",e.logging.elementUnregistered),this.updateLoggingSetting("managerSettingsChanged",e.logging.managerSettingsChanged),this.updateLoggingSetting("mouseTrajectoryUpdate",e.logging.mouseTrajectoryUpdate),this.updateLoggingSetting("scrollTrajectoryUpdate",e.logging.scrollTrajectoryUpdate),this.updateLoggingSetting("deviceStrategyChanged",e.logging.deviceStrategyChanged)))}cleanup(){this.requestUpdate()}render(){return!this.isInitialized||!this.devtoolsSettings.showDebugger?je``:je`<control-panel></control-panel> <debug-overlay></debug-overlay>`}};l.styles=[Hn`
|
|
2028
|
-
:host {
|
|
2029
|
-
display: block;
|
|
2030
|
-
}
|
|
2031
|
-
`],l._instance=null,n([Gn()],l.prototype,"isInitialized",2),l=n([Bn("foresight-devtools")],l);export{l as ForesightDevtools};
|