js.foresight-devtools 1.2.1 → 1.3.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -323,6 +323,11 @@ interface ManagerSettingsChangedPayload extends PayloadBase {
323
323
  globalSettings: ForesightManagerSettings;
324
324
  settingsChanged: UpdatedManagerSetting[];
325
325
  }
326
+ interface DeviceStrategyChangedPayload extends PayloadBase {
327
+ type: "deviceStrategyChanged";
328
+ oldStrategy: string;
329
+ newStrategy: string;
330
+ }
326
331
  interface SerializationErrorPayload extends PayloadBase {
327
332
  type: "serializationError";
328
333
  error: "Failed to serialize event data";
@@ -338,7 +343,7 @@ interface ManagerDataPayload extends PayloadBase {
338
343
  elementInfo: string;
339
344
  }>;
340
345
  }
341
- type SerializedEventData = ElementRegisteredPayload | ElementUnregisteredEvent | ElementReactivatedPayload | ElementDataUpdatedPayload | CallbackInvokedPayload | CallbackCompletedPayload | MouseTrajectoryUpdatePayload | ScrollTrajectoryUpdatePayload | ManagerSettingsChangedPayload | ManagerDataPayload | SerializationErrorPayload;
346
+ type SerializedEventData = ElementRegisteredPayload | ElementUnregisteredEvent | ElementReactivatedPayload | ElementDataUpdatedPayload | CallbackInvokedPayload | CallbackCompletedPayload | MouseTrajectoryUpdatePayload | ScrollTrajectoryUpdatePayload | ManagerSettingsChangedPayload | DeviceStrategyChangedPayload | ManagerDataPayload | SerializationErrorPayload;
342
347
 
343
348
  declare class SingleLog extends LitElement {
344
349
  static styles: lit.CSSResult[];
@@ -454,6 +459,7 @@ declare class SettingsTab extends LitElement {
454
459
  private initialSettings;
455
460
  private devtoolsSettings;
456
461
  private changedSettings;
462
+ private touchDeviceStrategyOptions;
457
463
  private _abortController;
458
464
  constructor();
459
465
  connectedCallback(): void;
@@ -462,6 +468,7 @@ declare class SettingsTab extends LitElement {
462
468
  private _checkManagerSettingsChanges;
463
469
  private _checkDevtoolsSettingsChanges;
464
470
  private _handleDevtoolsSettingChange;
471
+ private _handleTouchDeviceStrategyChange;
465
472
  private handleCopySettings;
466
473
  private generateSettingsCode;
467
474
  render(): lit.TemplateResult<1>;
@@ -498,6 +505,11 @@ declare global {
498
505
 
499
506
  declare class DebugOverlay extends LitElement {
500
507
  static styles: lit.CSSResult[];
508
+ private _abortController;
509
+ private _strategy;
510
+ connectedCallback(): void;
511
+ private handleDeviceStrategyChange;
512
+ disconnectedCallback(): void;
501
513
  render(): lit.TemplateResult<1>;
502
514
  }
503
515
  declare global {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e,t)=>{for(var i=t>1?void 0:t?ze(s,e):s,a=o.length-1,r;a>=0;a--)(r=o[a])&&(i=(t?r(s,e,i):r(i))||i);return t&&i&&je(s,e,i),i};import{LitElement as Vn,css as An,html as Ae}from"lit";import{customElement as jn,state as zn}from"lit/decorators.js";import{LitElement as un,css as bn,html as vn}from"lit";import{customElement as fn,state as Fe}from"lit/decorators.js";import{classMap as ne}from"lit/directives/class-map.js";import{css as Et,html as R,LitElement as Ct}from"lit";import{customElement as St,state as M}from"lit/decorators.js";import{map as Ce}from"lit/directives/map.js";import{ForesightManager as L}from"js.foresight";import{html as c}from"lit";var oe=c`
1
+ var Re=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&&Re(r,e,i),i};import{LitElement as jn,css as zn,html as ze}from"lit";import{customElement as Rn,state as Hn}from"lit/decorators.js";import{LitElement as vn,css as fn,html as yn}from"lit";import{customElement as wn,state as Ve}from"lit/decorators.js";import{classMap as oe}from"lit/directives/class-map.js";import{css as Ct,html as H,LitElement as Tt}from"lit";import{customElement as Dt,state as M}from"lit/decorators.js";import{map as Te}from"lit/directives/map.js";import{ForesightManager as L}from"js.foresight";import{html as c}from"lit";var re=c`
2
2
  <svg
3
3
  xmlns="http://www.w3.org/2000/svg"
4
4
  width="16"
@@ -15,7 +15,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
15
15
  <line x1="7" y1="21" x2="17" y2="21"></line>
16
16
  <line x1="12" y1="17" x2="12" y2="21"></line>
17
17
  </svg>
18
- `,ae=c`
18
+ `,se=c`
19
19
  <svg
20
20
  xmlns="http://www.w3.org/2000/svg"
21
21
  width="16"
@@ -30,7 +30,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
30
30
  <polyline points="4 17 10 11 4 5"></polyline>
31
31
  <line x1="12" y1="19" x2="20" y2="19"></line>
32
32
  </svg>
33
- `,se=c`
33
+ `,le=c`
34
34
  <svg
35
35
  xmlns="http://www.w3.org/2000/svg"
36
36
  width="16"
@@ -46,7 +46,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
46
46
  <path d="M13.73 21a2 2 0 0 1-3.46 0"></path>
47
47
  <line x1="1" y1="1" x2="23" y2="23"></line>
48
48
  </svg>
49
- `,re=c`
49
+ `,ce=c`
50
50
  <svg
51
51
  xmlns="http://www.w3.org/2000/svg"
52
52
  width="16"
@@ -64,7 +64,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
64
64
  <circle cx="6" cy="18" r="2" />
65
65
  <circle cx="18" cy="18" r="2" />
66
66
  </svg>
67
- `,le=c`
67
+ `,de=c`
68
68
  <svg
69
69
  xmlns="http://www.w3.org/2000/svg"
70
70
  width="16"
@@ -79,7 +79,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
79
79
  <path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" />
80
80
  <circle cx="12" cy="12" r="3" />
81
81
  </svg>
82
- `,ce=c`
82
+ `,ge=c`
83
83
  <svg
84
84
  xmlns="http://www.w3.org/2000/svg"
85
85
  width="16"
@@ -97,7 +97,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
97
97
  <line x1="16" y1="17" x2="8" y2="17" />
98
98
  <line x1="10" y1="9" x2="8" y2="9" />
99
99
  </svg>
100
- `,de=c`
100
+ `,pe=c`
101
101
  <svg
102
102
  xmlns="http://www.w3.org/2000/svg"
103
103
  width="16"
@@ -111,7 +111,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
111
111
  >
112
112
  <path d="M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01" />
113
113
  </svg>
114
- `,u=c`
114
+ `,h=c`
115
115
  <svg
116
116
  xmlns="http://www.w3.org/2000/svg"
117
117
  width="16"
@@ -125,7 +125,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
125
125
  >
126
126
  <polygon points="22,3 2,3 10,12.46 10,19 14,21 14,12.46" />
127
127
  </svg>
128
- `,pe=c`
128
+ `,he=c`
129
129
  <svg
130
130
  xmlns="http://www.w3.org/2000/svg"
131
131
  width="16"
@@ -140,7 +140,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
140
140
  <circle cx="12" cy="12" r="10" />
141
141
  <line x1="4.93" y1="4.93" x2="19.07" y2="19.07" />
142
142
  </svg>
143
- `,ge=c`
143
+ `,me=c`
144
144
  <svg
145
145
  xmlns="http://www.w3.org/2000/svg"
146
146
  width="24"
@@ -155,7 +155,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
155
155
  <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
156
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
157
  </svg>
158
- `,he=c`
158
+ `,ue=c`
159
159
  <svg
160
160
  xmlns="http://www.w3.org/2000/svg"
161
161
  width="24"
@@ -169,7 +169,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
169
169
  >
170
170
  <polyline points="20 6 9 17 4 12"></polyline>
171
171
  </svg>
172
- `,me=c`
172
+ `,be=c`
173
173
  <svg
174
174
  xmlns="http://www.w3.org/2000/svg"
175
175
  width="16"
@@ -187,7 +187,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
187
187
  <line x1="12" y1="9" x2="12" y2="13"></line>
188
188
  <line x1="12" y1="17" x2="12.01" y2="17"></line>
189
189
  </svg>
190
- `,ue=c`
190
+ `,ve=c`
191
191
  <svg
192
192
  xmlns="http://www.w3.org/2000/svg"
193
193
  width="16"
@@ -208,7 +208,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
208
208
  <path d="M10 8l2-2 2 2"></path>
209
209
  <path d="M14 16l-2 2-2-2"></path>
210
210
  </svg>
211
- `,be=c`
211
+ `,fe=c`
212
212
  <svg
213
213
  xmlns="http://www.w3.org/2000/svg"
214
214
  width="12"
@@ -225,11 +225,58 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
225
225
  <line x1="10" y1="11" x2="10" y2="17"></line>
226
226
  <line x1="14" y1="11" x2="14" y2="17"></line>
227
227
  </svg>
228
- `;import{LitElement as Re,html as He,css as Be}from"lit";import{customElement as Ge,property as Ke}from"lit/decorators.js";var P=class extends Re{constructor(){super(...arguments);this.title=""}render(){return He`
228
+ `,Kn=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
+ `,qn=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
+ `,Yn=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 P=class extends Be{constructor(){super(...arguments);this.title=""}render(){return Ge`
229
276
  <span class="chip" title="${this.title}">
230
277
  <slot></slot>
231
278
  </span>
232
- `}};P.styles=[Be`
279
+ `}};P.styles=[We`
233
280
  :host {
234
281
  display: inline-block;
235
282
  }
@@ -249,11 +296,11 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
249
296
  line-height: 1.2;
250
297
  transition: all 0.2s ease;
251
298
  }
252
- `],n([Ke({type:String})],P.prototype,"title",2),P=n([Ge("chip-element")],P);import{LitElement as We,html as Q,css as qe}from"lit";import{customElement as Ye,property as ve}from"lit/decorators.js";var T=class extends We{constructor(){super(...arguments);this.noContentMessage="No content available.";this.hasContent=!0}render(){return Q`
299
+ `],n([qe({type:String})],P.prototype,"title",2),P=n([Ke("chip-element")],P);import{LitElement as Ye,html as ee,css as Je}from"lit";import{customElement as Xe,property as ye}from"lit/decorators.js";var T=class extends Ye{constructor(){super(...arguments);this.noContentMessage="No content available.";this.hasContent=!0}render(){return ee`
253
300
  <div class="content-container">
254
- ${this.hasContent?Q`<slot></slot>`:Q`<div class="no-content-message">${this.noContentMessage}</div>`}
301
+ ${this.hasContent?ee`<slot></slot>`:ee`<div class="no-content-message">${this.noContentMessage}</div>`}
255
302
  </div>
256
- `}};T.styles=[qe`
303
+ `}};T.styles=[Je`
257
304
  :host {
258
305
  overflow: hidden;
259
306
  }
@@ -293,7 +340,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
293
340
  font-style: italic;
294
341
  font-family: "Courier New", monospace;
295
342
  }
296
- `],n([ve({type:String,attribute:"no-content-message"})],T.prototype,"noContentMessage",2),n([ve({type:Boolean})],T.prototype,"hasContent",2),T=n([Ye("tab-content")],T);import{LitElement as Je,html as Xe,css as Ze}from"lit";import{customElement as Qe}from"lit/decorators.js";var j=class extends Je{render(){return Xe`
343
+ `],n([ye({type:String,attribute:"no-content-message"})],T.prototype,"noContentMessage",2),n([ye({type:Boolean})],T.prototype,"hasContent",2),T=n([Xe("tab-content")],T);import{LitElement as Ze,html as Qe,css as et}from"lit";import{customElement as tt}from"lit/decorators.js";var z=class extends Ze{render(){return Qe`
297
344
  <div class="tab-bar-elements">
298
345
  <div class="tab-bar-info">
299
346
  <div class="stats-chips">
@@ -304,7 +351,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
304
351
  <slot name="actions"></slot>
305
352
  </div>
306
353
  </div>
307
- `}};j.styles=[Ze`
354
+ `}};z.styles=[et`
308
355
  :host {
309
356
  }
310
357
  .tab-bar-info {
@@ -348,7 +395,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
348
395
  z-index: 5;
349
396
  min-height: 36px;
350
397
  }
351
- `],j=n([Qe("tab-header")],j);import{html as ot}from"lit";import{customElement as at,property as ye}from"lit/decorators.js";import{LitElement as et,html as fe,css as tt}from"lit";import{property as nt,state as it}from"lit/decorators.js";var d=class d extends et{constructor(){super(...arguments);this.isDropdownOpen=!1;this.dropdownOptions=[];this._toggleDropdown=e=>{e.stopPropagation(),this.isDropdownOpen?this._closeDropdown():(d.currentlyOpen&&d.currentlyOpen!==this&&d.currentlyOpen._closeDropdown(),this.isDropdownOpen=!0,d.currentlyOpen=this,requestAnimationFrame(()=>{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),d.currentlyOpen===this&&(d.currentlyOpen=null)}_closeDropdown(){this.isDropdownOpen=!1,d.currentlyOpen===this&&(d.currentlyOpen=null)}_positionDropdown(){let e=this.shadowRoot?.querySelector(".trigger-button"),t=this.shadowRoot?.querySelector(".dropdown-menu");if(e&&t){let i=e.getBoundingClientRect(),a=t.offsetHeight||200,r=i.bottom+5,p=window.innerWidth-i.right;window.innerHeight-i.bottom<a&&i.top>a?t.style.top=`${i.top-a-5}px`:t.style.top=`${r}px`,t.style.right=`${p}px`}}render(){let e=`trigger-button ${this.isDropdownOpen?"active":""}`,t=`dropdown-menu ${this.isDropdownOpen?"active":""}`;return fe`
398
+ `],z=n([tt("tab-header")],z);import{html as rt}from"lit";import{customElement as st,property as xe}from"lit/decorators.js";import{LitElement as nt,html as we,css as it}from"lit";import{property as ot,state as at}from"lit/decorators.js";var g=class g extends nt{constructor(){super(...arguments);this.isDropdownOpen=!1;this.dropdownOptions=[];this._toggleDropdown=e=>{e.stopPropagation(),this.isDropdownOpen?this._closeDropdown():(g.currentlyOpen&&g.currentlyOpen!==this&&g.currentlyOpen._closeDropdown(),this.isDropdownOpen=!0,g.currentlyOpen=this,requestAnimationFrame(()=>{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),g.currentlyOpen===this&&(g.currentlyOpen=null)}_closeDropdown(){this.isDropdownOpen=!1,g.currentlyOpen===this&&(g.currentlyOpen=null)}_positionDropdown(){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 we`
352
399
  <div class="dropdown-container">
353
400
  <button
354
401
  class="${e}"
@@ -374,7 +421,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
374
421
  </button>
375
422
 
376
423
  <div class="${t}" id="dropdown-menu" role="menu">
377
- ${this.dropdownOptions.map(i=>fe`
424
+ ${this.dropdownOptions.map(i=>we`
378
425
  <button
379
426
  value="${i.value}"
380
427
  title="${i.title}"
@@ -387,7 +434,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
387
434
  `)}
388
435
  </div>
389
436
  </div>
390
- `}};d.currentlyOpen=null,d.styles=[tt`
437
+ `}};g.currentlyOpen=null,g.styles=[it`
391
438
  :host {
392
439
  display: inline-block;
393
440
  }
@@ -502,15 +549,15 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
502
549
  color: #b0c4de;
503
550
  font-weight: bold;
504
551
  }
505
- `],n([it()],d.prototype,"isDropdownOpen",2),n([nt({type:Array})],d.prototype,"dropdownOptions",2);var D=d;var U=class extends D{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:ot``}_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([ye({type:String})],U.prototype,"selectedOptionValue",2),n([ye({type:Function})],U.prototype,"onSelectionChange",2),U=n([at("single-select-dropdown")],U);import{LitElement as ft,html as yt,css as xt}from"lit";import{customElement as wt,property as q}from"lit/decorators.js";import{LitElement as dt,html as ke,css as pt}from"lit";import{customElement as gt,property as z}from"lit/decorators.js";import{LitElement as st,html as rt,css as lt}from"lit";import{customElement as ct,property as xe,state as we}from"lit/decorators.js";var v=class extends st{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 rt`
552
+ `],n([at()],g.prototype,"isDropdownOpen",2),n([ot({type:Array})],g.prototype,"dropdownOptions",2);var D=g;var U=class extends D{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([xe({type:String})],U.prototype,"selectedOptionValue",2),n([xe({type:Function})],U.prototype,"onSelectionChange",2),U=n([st("single-select-dropdown")],U);import{LitElement as wt,html as xt,css as kt}from"lit";import{customElement as Et,property as J}from"lit/decorators.js";import{LitElement as pt,html as Se,css as ht}from"lit";import{customElement as mt,property as R}from"lit/decorators.js";import{LitElement as lt,html as ct,css as dt}from"lit";import{customElement as gt,property as ke,state as Ee}from"lit/decorators.js";var f=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`
506
553
  <button
507
554
  class="copy-button ${this.isCopied?"copied":""}"
508
555
  title="${this.title}"
509
556
  @click=${this.handleClick}
510
557
  >
511
- ${this.isCopied?he:ge}
558
+ ${this.isCopied?ue:me}
512
559
  </button>
513
- `}};v.styles=lt`
560
+ `}};f.styles=dt`
514
561
  .copy-button {
515
562
  background: transparent;
516
563
  border: 0px;
@@ -549,7 +596,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
549
596
  .copy-button.copied svg {
550
597
  stroke: #4caf50;
551
598
  }
552
- `,n([xe({type:String})],v.prototype,"title",2),n([xe({type:Function})],v.prototype,"onCopy",2),n([we()],v.prototype,"isCopied",2),n([we()],v.prototype,"copyTimeout",2),v=n([ct("copy-icon")],v);var b=class extends dt{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(r=>r.textContent).join("");try{await navigator.clipboard.writeText(a)}catch(r){console.error("Failed to copy text: ",r)}}}render(){return this.style.setProperty("--border-color",this.borderColor),ke`
599
+ `,n([ke({type:String})],f.prototype,"title",2),n([ke({type:Function})],f.prototype,"onCopy",2),n([Ee()],f.prototype,"isCopied",2),n([Ee()],f.prototype,"copyTimeout",2),f=n([gt("copy-icon")],f);var b=class extends pt{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),Se`
553
600
  <div class="item-entry ${this.isExpanded?"expanded":""}">
554
601
  <div class="item-header ${this.isExpanded?"expanded":""}" @click="${this.toggleExpand}">
555
602
  <div class="item-content">
@@ -561,7 +608,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
561
608
  </svg>
562
609
  </span>
563
610
  </div>
564
- ${this.isExpanded?ke`
611
+ ${this.isExpanded?Se`
565
612
  <div class="item-details">
566
613
  <copy-icon
567
614
  positioned
@@ -574,7 +621,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
574
621
  </div>
575
622
  `:""}
576
623
  </div>
577
- `}};b.styles=[pt`
624
+ `}};b.styles=[ht`
578
625
  :host {
579
626
  display: block;
580
627
  }
@@ -671,7 +718,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
671
718
  display: block;
672
719
  overflow-x: auto;
673
720
  }
674
- `],n([z()],b.prototype,"borderColor",2),n([z()],b.prototype,"showCopyButton",2),n([z()],b.prototype,"itemId",2),n([z()],b.prototype,"isExpanded",2),n([z()],b.prototype,"onToggle",2),b=n([gt("expandable-item")],b);import{ForesightManager as ht}from"js.foresight";import{LitElement as mt,css as ut,html as W}from"lit";import{customElement as bt,property as vt,state as Ee}from"lit/decorators.js";var k=class extends mt{constructor(){super(...arguments);this.remainingTime=0;this.isCountdownActive=!1;this.intervalId=null;this.startTime=0;this.handleTimerClick=e=>{e.stopPropagation(),ht.instance.reactivate(this.elementData.element)}}connectedCallback(){super.connectedCallback(),this.checkAndStartCountdown()}disconnectedCallback(){super.disconnectedCallback(),this.clearCountdown()}updated(e){super.updated(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 r=Date.now()-this.startTime,p=Math.max(0,t-r);this.remainingTime=p,this.requestUpdate(),(p<=0||this.elementData.callbackInfo.isCallbackActive)&&this.clearCountdown()};a(),this.remainingTime>0&&(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 r=Math.floor(i/60),p=i%60;return p>0?`${r}h ${p}m`:`${r}h`}render(){return this.isCountdownActive?this.remainingTime===1/0?W`
721
+ `],n([R()],b.prototype,"borderColor",2),n([R()],b.prototype,"showCopyButton",2),n([R()],b.prototype,"itemId",2),n([R()],b.prototype,"isExpanded",2),n([R()],b.prototype,"onToggle",2),b=n([mt("expandable-item")],b);import{ForesightManager as ut}from"js.foresight";import{LitElement as bt,css as vt,html as Y}from"lit";import{customElement as ft,property as yt,state as Ce}from"lit/decorators.js";var k=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()}updated(e){super.updated(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&&(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?Y`
675
722
  <button
676
723
  class="reactivate-button"
677
724
  @click="${this.handleTimerClick}"
@@ -679,7 +726,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
679
726
  >
680
727
  <span class="countdown-time infinity">∞</span>
681
728
  </button>
682
- `:this.remainingTime<=0?W``:W`
729
+ `:this.remainingTime<=0?Y``:Y`
683
730
  <button
684
731
  class="reactivate-button"
685
732
  @click="${this.handleTimerClick}"
@@ -687,7 +734,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
687
734
  >
688
735
  <span class="countdown-time clickable">${this.formatTime(this.remainingTime)}</span>
689
736
  </button>
690
- `:W``}};k.styles=[ut`
737
+ `:Y``}};k.styles=[vt`
691
738
  :host {
692
739
  display: inline-block;
693
740
  }
@@ -717,7 +764,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
717
764
  .countdown-time.clickable {
718
765
  cursor: pointer;
719
766
  }
720
- `],n([vt({hasChanged:()=>!0})],k.prototype,"elementData",2),n([Ee()],k.prototype,"remainingTime",2),n([Ee()],k.prototype,"isCountdownActive",2),k=n([bt("reactivate-countdown")],k);import{ForesightManager as kt}from"js.foresight";var f=class extends ft{constructor(){super(...arguments);this.isActive=!1;this.isExpanded=!1;this.handleUnregister=e=>{e.stopPropagation(),kt.instance.unregister(this.elementData.element,"devtools")}}getBorderColor(){return this.isActive?"#ffeb3b":this.elementData.callbackInfo.isCallbackActive?this.elementData.isIntersectingWithViewport?"#4caf50":"#666":"#999"}getStatusIndicatorClass(){return this.isActive?"prefetching":this.elementData.callbackInfo.isCallbackActive?this.elementData.isIntersectingWithViewport?"visible":"hidden":"inactive"}getStatusText(){return this.isActive?"callback active":this.elementData.callbackInfo.isCallbackActive?this.elementData.isIntersectingWithViewport?"in viewport":"not in viewport":"callback inactive"}formatElementDetails(){let e=this.elementData,t={status:this.getStatusText(),tagName:e.element.tagName.toLowerCase(),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;return yt`
767
+ `],n([yt({hasChanged:()=>!0})],k.prototype,"elementData",2),n([Ce()],k.prototype,"remainingTime",2),n([Ce()],k.prototype,"isCountdownActive",2),k=n([ft("reactivate-countdown")],k);import{ForesightManager as St}from"js.foresight";var y=class extends wt{constructor(){super(...arguments);this.isActive=!1;this.isExpanded=!1;this.handleUnregister=e=>{e.stopPropagation(),St.instance.unregister(this.elementData.element,"devtools")}}getBorderColor(){return this.isActive?"#ffeb3b":this.elementData.callbackInfo.isCallbackActive?this.elementData.isIntersectingWithViewport?"#4caf50":"#666":"#999"}getStatusIndicatorClass(){return this.isActive?"prefetching":this.elementData.callbackInfo.isCallbackActive?this.elementData.isIntersectingWithViewport?"visible":"hidden":"inactive"}getStatusText(){return this.isActive?"callback active":this.elementData.callbackInfo.isCallbackActive?this.elementData.isIntersectingWithViewport?"in viewport":"not in viewport":"callback inactive"}formatElementDetails(){let e=this.elementData,t={status:this.getStatusText(),tagName:e.element.tagName.toLowerCase(),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;return xt`
721
768
  <div class="element-wrapper ${e?"not-visible":""}">
722
769
  <expandable-item
723
770
  .borderColor=${this.getBorderColor()}
@@ -739,13 +786,13 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
739
786
  @click="${this.handleUnregister}"
740
787
  title="Unregister element"
741
788
  >
742
- ${be}
789
+ ${fe}
743
790
  </button>
744
791
  </div>
745
792
  <div slot="details">${this.formatElementDetails()}</div>
746
793
  </expandable-item>
747
794
  </div>
748
- `}};f.styles=[xt`
795
+ `}};y.styles=[kt`
749
796
  :host {
750
797
  display: block;
751
798
  }
@@ -845,8 +892,8 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
845
892
  .element-wrapper.not-visible {
846
893
  opacity: 0.5;
847
894
  }
848
- `],n([q({hasChanged:()=>!0})],f.prototype,"elementData",2),n([q()],f.prototype,"isActive",2),n([q()],f.prototype,"isExpanded",2),n([q()],f.prototype,"onToggle",2),f=n([wt("single-element")],f);var h=class extends Ct{constructor(){super();this.hitCount={mouse:{hover:0,trajectory:0},scroll:{down:0,left:0,right:0,up:0},tab:{forwards:0,reverse: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.handleSortChange=e=>{this.sortOrder=e};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:le},{value:"documentOrder",label:"Document Order",title:"Sort by Document Order",icon:ce},{value:"insertionOrder",label:"Insertion Order",title:"Sort by Insertion Order",icon:de}]}_generateHitsChipTitle(e){let t=[];return t.push(`Total Hits: ${e.total}`),t.push(""),t.push(`Mouse: Trajectory: ${e.mouse.trajectory}, Hover: ${e.mouse.hover}`),t.push(`Scroll: Up: ${e.scroll.up}, Down: ${e.scroll.down}, Left: ${e.scroll.left}, Right: ${e.scroll.right}`),t.push(`Tab: Forwards: ${e.tab.forwards}, Reverse: ${e.tab.reverse}`),t.join(`
849
- `)}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;this.updateElementListFromManager(),L.instance.addEventListener("elementRegistered",t=>{this.elementListItems.set(t.elementData.element,t.elementData)},{signal:e}),L.instance.addEventListener("elementDataUpdated",t=>{this.elementListItems.get(t.elementData.element)&&(this.elementListItems.set(t.elementData.element,t.elementData),this.requestUpdate())},{signal:e}),L.instance.addEventListener("elementReactivated",t=>{this.elementListItems.get(t.elementData.element)&&(this.elementListItems.set(t.elementData.element,t.elementData),this.requestUpdate())},{signal:e}),L.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.requestUpdate()},{signal:e}),L.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.requestUpdate()},{signal:e}),L.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.requestUpdate()},{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this._abortController=null}updateElementListFromManager(){this.elementListItems=new Map(L.instance.registeredElements)}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;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}}getActiveElements(){return this.getSortedElements().filter(e=>e.callbackInfo.isCallbackActive)}getInactiveElements(){return this.getSortedElements().filter(e=>!e.callbackInfo.isCallbackActive)}render(){return R`
895
+ `],n([J({hasChanged:()=>!0})],y.prototype,"elementData",2),n([J()],y.prototype,"isActive",2),n([J()],y.prototype,"isExpanded",2),n([J()],y.prototype,"onToggle",2),y=n([Et("single-element")],y);var m=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.handleSortChange=e=>{this.sortOrder=e};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:de},{value:"documentOrder",label:"Document Order",title:"Sort by Document Order",icon:ge},{value:"insertionOrder",label:"Insertion Order",title:"Sort by Insertion Order",icon:pe}]}_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(`
896
+ `)}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;this.updateElementListFromManager(),L.instance.addEventListener("elementRegistered",t=>{this.elementListItems.set(t.elementData.element,t.elementData)},{signal:e}),L.instance.addEventListener("elementDataUpdated",t=>{this.elementListItems.get(t.elementData.element)&&(this.elementListItems.set(t.elementData.element,t.elementData),this.requestUpdate())},{signal:e}),L.instance.addEventListener("elementReactivated",t=>{this.elementListItems.get(t.elementData.element)&&(this.elementListItems.set(t.elementData.element,t.elementData),this.requestUpdate())},{signal:e}),L.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.requestUpdate()},{signal:e}),L.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.requestUpdate()},{signal:e}),L.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.requestUpdate()},{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this._abortController=null}updateElementListFromManager(){this.elementListItems=new Map(L.instance.registeredElements)}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}}getActiveElements(){return this.getSortedElements().filter(e=>e.callbackInfo.isCallbackActive)}getInactiveElements(){return this.getSortedElements().filter(e=>!e.callbackInfo.isCallbackActive)}render(){return H`
850
897
  <tab-header>
851
898
  <div slot="chips" class="chips-container">
852
899
  <chip-element title="${this._generateHitsChipTitle(this.hitCount)}">
@@ -865,12 +912,12 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
865
912
  .noContentMessage=${this.noContentMessage}
866
913
  .hasContent=${!!this.elementListItems.size}
867
914
  >
868
- ${this.getActiveElements().length>0?R`
915
+ ${this.getActiveElements().length>0?H`
869
916
  <div class="element-section">
870
917
  <h3 class="section-header active">
871
918
  Active Elements (${this.getActiveElements().length})
872
919
  </h3>
873
- ${Ce(this.getActiveElements(),e=>R`
920
+ ${Te(this.getActiveElements(),e=>H`
874
921
  <single-element
875
922
  .elementData=${e}
876
923
  .isActive=${this.runningCallbacks.has(e.element)}
@@ -881,12 +928,12 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
881
928
  `)}
882
929
  </div>
883
930
  `:""}
884
- ${this.getInactiveElements().length>0?R`
931
+ ${this.getInactiveElements().length>0?H`
885
932
  <div class="element-section">
886
933
  <h3 class="section-header inactive">
887
934
  Inactive Elements (${this.getInactiveElements().length})
888
935
  </h3>
889
- ${Ce(this.getInactiveElements(),e=>R`
936
+ ${Te(this.getInactiveElements(),e=>H`
890
937
  <single-element
891
938
  .elementData=${e}
892
939
  .isActive=${this.runningCallbacks.has(e.element)}
@@ -898,7 +945,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
898
945
  </div>
899
946
  `:""}
900
947
  </tab-content>
901
- `}};h.styles=Et`
948
+ `}};m.styles=Ct`
902
949
  :host {
903
950
  display: flex;
904
951
  flex-direction: column;
@@ -931,9 +978,9 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
931
978
  .section-header.inactive {
932
979
  color: #999;
933
980
  }
934
- `,n([M()],h.prototype,"hitCount",2),n([M()],h.prototype,"sortDropdown",2),n([M()],h.prototype,"sortOrder",2),n([M()],h.prototype,"elementListItems",2),n([M()],h.prototype,"noContentMessage",2),n([M()],h.prototype,"runningCallbacks",2),n([M()],h.prototype,"expandedElementIds",2),h=n([St("element-tab")],h);import{css as Tt,html as Se,LitElement as Dt}from"lit";import{customElement as Mt,property as Lt}from"lit/decorators.js";var N=class extends Dt{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 Se`
981
+ `,n([M()],m.prototype,"hitCount",2),n([M()],m.prototype,"sortDropdown",2),n([M()],m.prototype,"sortOrder",2),n([M()],m.prototype,"elementListItems",2),n([M()],m.prototype,"noContentMessage",2),n([M()],m.prototype,"runningCallbacks",2),n([M()],m.prototype,"expandedElementIds",2),m=n([Dt("element-tab")],m);import{css as Mt,html as De,LitElement as Lt}from"lit";import{customElement as $t,property as _t}from"lit/decorators.js";var N=class extends Lt{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 De`
935
982
  <div class="tab-selector-wrapper">
936
- ${this.tabs.map(e=>Se`
983
+ ${this.tabs.map(e=>De`
937
984
  <button
938
985
  class="tab-button ${this.activeTab===e?"active":""}"
939
986
  @click="${()=>this._handleTabClick(e)}"
@@ -943,7 +990,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
943
990
  </button>
944
991
  `)}
945
992
  </div>
946
- `}};N.styles=Tt`
993
+ `}};N.styles=Mt`
947
994
  .tab-selector-wrapper {
948
995
  border-bottom: 2px solid #444;
949
996
  margin-top: 12px;
@@ -974,8 +1021,8 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
974
1021
  color: #b0c4de;
975
1022
  border-bottom-color: #b0c4de;
976
1023
  }
977
- `,n([Lt({type:String})],N.prototype,"activeTab",2),N=n([Mt("tab-selector")],N);import{ForesightManager as H}from"js.foresight";import{LitElement as Ft,css as Vt,html as Y}from"lit";import{customElement as At,property as jt,state as F}from"lit/decorators.js";import{map as zt}from"lit/directives/map.js";function De(o,s){let e={};o.eventListeners.forEach((i,a)=>{e[a]=i.length});let t=[];return o.registeredElements.forEach((i,a)=>{let{element:r,...p}=i;t.push({...p,elementInfo:`${a.tagName.toLowerCase()}${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:s,globalCallbackHits:o.globalCallbackHits,localizedTimestamp:new Date().toLocaleTimeString(),eventListenerCount:e,managerSettings:o.globalSettings,registeredElements:t,summary:`${t.length} elements, ${Object.values(e).flat().length} listeners,
978
- ${o.globalCallbackHits.total} hits`}}function Me(o,s){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:s,summary:o.elementData.registerCount===1?o.elementData.name:`${o.elementData.name} - ${Te(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:s,summary:o.elementData.registerCount===1?o.elementData.name:`${o.elementData.name} - ${Te(o.elementData.registerCount)} time`};case"elementUnregistered":return{type:"elementUnregistered",localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),logId:s,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:s,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:s,summary:`${o.elementData.name} - ${o.hitType.kind}`};case"callbackCompleted":{let e=$t(o.elapsed);return{type:"callbackCompleted",name:o.elementData.name,hitType:o.hitType,callbackInfo:o.elementData.callbackInfo,meta:o.elementData.meta,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),logId:s,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:s,summary:""};case"scrollTrajectoryUpdate":return{type:"scrollTrajectoryUpdate",currentPoint:o.currentPoint,predictedPoint:o.predictedPoint,scrollDirection:o.scrollDirection,localizedTimestamp:new Date().toLocaleTimeString(),logId:s,summary:o.scrollDirection};case"managerSettingsChanged":return{type:"managerSettingsChanged",globalSettings:o.managerData?.globalSettings||{},settingsChanged:o.updatedSettings,localizedTimestamp:new Date(o.timestamp).toLocaleTimeString(),logId:s,summary:o.updatedSettings.map(e=>e.setting).join(", ")};default:return{type:"serializationError",error:"Failed to serialize event data",errorMessage:JSON.stringify(o),localizedTimestamp:new Date().toLocaleTimeString(),logId:s,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:s,summary:""}}}function $t(o){return`${(o/1e3).toFixed(4)} s`}function Te(o){let s=["th","st","nd","rd"],e=o%100;return o+(s[(e-20)%10]||s[e]||s[0])}import{html as Le,css as It}from"lit";import{customElement as _t,property as $e}from"lit/decorators.js";var $=class extends D{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 Le`
1024
+ `,n([_t({type:String})],N.prototype,"activeTab",2),N=n([$t("tab-selector")],N);import{ForesightManager as B}from"js.foresight";import{LitElement as Ft,css as jt,html as X}from"lit";import{customElement as zt,property as Rt,state as V}from"lit/decorators.js";import{map as Ht}from"lit/directives/map.js";function Le(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.tagName.toLowerCase()}${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,summary:`${t.length} elements, ${Object.values(e).flat().length} listeners,
1025
+ ${o.globalCallbackHits.total} hits`}}function $e(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} - ${Me(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} - ${Me(o.elementData.registerCount)} time`};case"elementUnregistered":return{type:"elementUnregistered",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.elapsed);return{type:"callbackCompleted",name:o.elementData.name,hitType:o.hitType,callbackInfo:o.elementData.callbackInfo,meta:o.elementData.meta,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 Me(o){let r=["th","st","nd","rd"],e=o%100;return o+(r[(e-20)%10]||r[e]||r[0])}import{html as _e,css as Ot}from"lit";import{customElement as Pt,property as Ie}from"lit/decorators.js";var $=class extends D{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 h}_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 _e`
979
1026
  <div class="dropdown-container">
980
1027
  <button
981
1028
  class="${e}"
@@ -1002,7 +1049,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
1002
1049
  </button>
1003
1050
 
1004
1051
  <div class="${t}" id="dropdown-menu" role="menu">
1005
- ${this.dropdownOptions.map(i=>Le`
1052
+ ${this.dropdownOptions.map(i=>_e`
1006
1053
  <button
1007
1054
  value="${i.value}"
1008
1055
  title="${i.title}"
@@ -1015,7 +1062,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
1015
1062
  `)}
1016
1063
  </div>
1017
1064
  </div>
1018
- `}};$.styles=[...D.styles,It`
1065
+ `}};$.styles=[...D.styles,Ot`
1019
1066
  .dropdown-menu button.active::after {
1020
1067
  content: "✓";
1021
1068
  position: absolute;
@@ -1031,7 +1078,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
1031
1078
  color: #b0c4de;
1032
1079
  margin-left: 2px;
1033
1080
  }
1034
- `],n([$e({type:Array})],$.prototype,"selectedValues",2),n([$e()],$.prototype,"onSelectionChange",2),$=n([_t("multi-select-dropdown")],$);import{LitElement as Ot,html as Pt,css as Ut}from"lit";import{customElement as Nt,property as ee}from"lit/decorators.js";var E=class extends Ot{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),r=i?"rgba(244, 67, 54, 0.1)":"transparent";this.style.setProperty("--log-color",a),this.style.setProperty("--log-background-color",r)}}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"}[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"}[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 Pt`
1081
+ `],n([Ie({type:Array})],$.prototype,"selectedValues",2),n([Ie()],$.prototype,"onSelectionChange",2),$=n([Pt("multi-select-dropdown")],$);import{LitElement as Ut,html as Nt,css as Vt}from"lit";import{customElement as At,property as te}from"lit/decorators.js";var E=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`
1035
1082
  <expandable-item
1036
1083
  .borderColor=${i}
1037
1084
  .itemId=${e.logId}
@@ -1047,7 +1094,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
1047
1094
  </div>
1048
1095
  <div slot="details">${this.serializeLogDataWithoutSummary(e)}</div>
1049
1096
  </expandable-item>
1050
- `}};E.styles=[Ut`
1097
+ `}};E.styles=[Vt`
1051
1098
  :host {
1052
1099
  display: block;
1053
1100
  /*
@@ -1111,7 +1158,7 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
1111
1158
  * as all styling is now handled by setting CSS variables below.
1112
1159
  * This makes the component's styling more self-contained.
1113
1160
  */
1114
- `],n([ee({attribute:!1})],E.prototype,"log",2),n([ee({type:Boolean})],E.prototype,"isExpanded",2),n([ee()],E.prototype,"onToggle",2),E=n([Nt("single-log")],E);var m=class extends Ft{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:oe},{value:"console",label:"Console",title:"Log only to the console",icon:ae},{value:"both",label:"Both",title:"Log to both the control panel and the console",icon:re},{value:"none",label:"None",title:"Dont log anywhere",icon:se}],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}]}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),H.instance.addEventListener(e,t,{signal:this._abortController?.signal})}removeForesightEventListener(e){let t=this._eventListeners.get(e);t&&(H.instance.removeEventListener(e,t),this._eventListeners.delete(e))}removeAllEventListeners(){this._eventListeners.forEach((e,t)=>{H.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"}[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(H.instance.getManagerData),(this.logLocation==="controlPanel"||this.logLocation==="both")&&this.addManagerLog())}addManagerLog(){let e=De(H.instance.getManagerData,(++this.logIdCounter).toString());this.addLog(e)}addEventLog(e){let t=Me(e,(++this.logIdCounter).toString());if(t.type==="serializationError"){console.error(t.error,t.errorMessage);return}this.addLog(t)}render(){return Y`
1161
+ `],n([te({attribute:!1})],E.prototype,"log",2),n([te({type:Boolean})],E.prototype,"isExpanded",2),n([te()],E.prototype,"onToggle",2),E=n([At("single-log")],E);var u=class extends Ft{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:re},{value:"console",label:"Console",title:"Log only to the console",icon:se},{value:"both",label:"Both",title:"Log to both the control panel and the console",icon:ce},{value:"none",label:"None",title:"Dont log anywhere",icon:le}],this.filterDropdown=[{value:"elementRegistered",label:"Element Registered",title:"Show element registration events",icon:h},{value:"elementUnregistered",label:"Element Unregistered",title:"Show element unregistration events",icon:h},{value:"elementReactivated",label:"Element Reactivated",title:"Show when element gets reactivated after stale time has passed",icon:h},{value:"callbackInvoked",label:"Callback Invoked",title:"Show callback invoked events",icon:h},{value:"callbackCompleted",label:"Callback Completed",title:"Show callback completed events",icon:h},{value:"mouseTrajectoryUpdate",label:"Mouse Trajectory Update",title:"Show mouse trajectory update events",icon:h},{value:"scrollTrajectoryUpdate",label:"Scroll Trajectory Update",title:"Show scroll trajectory update events",icon:h},{value:"managerSettingsChanged",label:"Manager Settings Changed",title:"Show manager settings change events",icon:h},{value:"deviceStrategyChanged",label:"Strategy Changed",title:"Show strategy change events",icon:h}]}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),B.instance.addEventListener(e,t,{signal:this._abortController?.signal})}removeForesightEventListener(e){let t=this._eventListeners.get(e);t&&(B.instance.removeEventListener(e,t),this._eventListeners.delete(e))}removeAllEventListeners(){this._eventListeners.forEach((e,t)=>{B.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(B.instance.getManagerData),(this.logLocation==="controlPanel"||this.logLocation==="both")&&this.addManagerLog())}addManagerLog(){let e=Le(B.instance.getManagerData,(++this.logIdCounter).toString());this.addLog(e)}addEventLog(e){let t=$e(e,(++this.logIdCounter).toString());if(t.type==="serializationError"){console.error(t.error,t.errorMessage);return}this.addLog(t)}render(){return X`
1115
1162
  <tab-header>
1116
1163
  <div slot="chips" class="chips-container">
1117
1164
  <chip-element title="Number of logged events (Max ${this.MAX_LOGS})">
@@ -1119,13 +1166,13 @@ var je=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var n=(o,s,e
1119
1166
  </chip-element>
1120
1167
  </div>
1121
1168
  <div slot="actions">
1122
- ${this.shouldShowPerformanceWarning()?Y`
1169
+ ${this.shouldShowPerformanceWarning()?X`
1123
1170
  <div
1124
1171
  class="warning-container"
1125
1172
  title="Console logging can be slow with frequent trajectory events.
1126
1173
  Consider using 'Control Panel' only for better performance."
1127
1174
  >
1128
- ${me}
1175
+ ${be}
1129
1176
  </div>
1130
1177
  `:""}
1131
1178
  <single-select-dropdown
@@ -1144,7 +1191,7 @@ Consider using 'Control Panel' only for better performance."
1144
1191
  title="Log the state from the manager"
1145
1192
  @click="${this.logManagerData}"
1146
1193
  >
1147
- ${ue}
1194
+ ${ve}
1148
1195
  </button>
1149
1196
  <button
1150
1197
  class="single-button"
@@ -1152,12 +1199,12 @@ Consider using 'Control Panel' only for better performance."
1152
1199
  ?disabled="${this.logs.length===0}"
1153
1200
  @click="${this.clearLogs}"
1154
1201
  >
1155
- ${pe}
1202
+ ${he}
1156
1203
  </button>
1157
1204
  </div>
1158
1205
  </tab-header>
1159
1206
  <tab-content .noContentMessage=${this.noContentMessage} .hasContent=${!!this.logs.length}>
1160
- ${this.logs.length===0?Y`<div class="no-items">${this.getNoLogsMessage()}</div>`:zt(this.logs,e=>Y`
1207
+ ${this.logs.length===0?X`<div class="no-items">${this.getNoLogsMessage()}</div>`:Ht(this.logs,e=>X`
1161
1208
  <single-log
1162
1209
  .log=${e}
1163
1210
  .isExpanded=${this.expandedLogIds.has(e.logId)}
@@ -1165,7 +1212,7 @@ Consider using 'Control Panel' only for better performance."
1165
1212
  ></single-log>
1166
1213
  `)}
1167
1214
  </tab-content>
1168
- `}};m.styles=[Vt`
1215
+ `}};u.styles=[jt`
1169
1216
  :host {
1170
1217
  display: flex;
1171
1218
  flex-direction: column;
@@ -1258,7 +1305,7 @@ Consider using 'Control Panel' only for better performance."
1258
1305
  .warning-container:hover svg {
1259
1306
  stroke: #ffdc3e;
1260
1307
  }
1261
- `],n([F()],m.prototype,"logDropdown",2),n([F()],m.prototype,"filterDropdown",2),n([F()],m.prototype,"logLocation",2),n([F()],m.prototype,"eventsEnabled",2),n([F()],m.prototype,"logs",2),n([F()],m.prototype,"expandedLogIds",2),n([jt()],m.prototype,"noContentMessage",2),m=n([At("log-tab")],m);import{ForesightManager as Ue}from"js.foresight";import{css as gn,html as Ne,LitElement as hn}from"lit";import{customElement as mn,state as X}from"lit/decorators.js";var te="points",Ie="px",_e="tabs",Oe="ms";import{LitElement as Kt,html as Wt,css as qt}from"lit";import{customElement as Yt,property as J}from"lit/decorators.js";import{LitElement as Rt,html as Ht,css as Bt}from"lit";import{customElement as Gt,property as Pe}from"lit/decorators.js";var I=class extends Rt{constructor(){super(...arguments);this.header="";this.description=""}render(){return Ht`<div class="setting-item">
1308
+ `],n([V()],u.prototype,"logDropdown",2),n([V()],u.prototype,"filterDropdown",2),n([V()],u.prototype,"logLocation",2),n([V()],u.prototype,"eventsEnabled",2),n([V()],u.prototype,"logs",2),n([V()],u.prototype,"expandedLogIds",2),n([Rt()],u.prototype,"noContentMessage",2),u=n([zt("log-tab")],u);import{ForesightManager as ie}from"js.foresight";import{css as mn,html as G,LitElement as un}from"lit";import{customElement as bn,state as W}from"lit/decorators.js";var ne="points",Oe="px",Pe="tabs",Ue="ms";import{LitElement as qt,html as Yt,css as Jt}from"lit";import{customElement as Xt,property as Z}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 _=class extends Bt{constructor(){super(...arguments);this.header="";this.description=""}render(){return Gt`<div class="setting-item">
1262
1309
  <label>
1263
1310
  <span class="setting-header">${this.header}</span>
1264
1311
  <span class="setting-description"> ${this.description} </span>
@@ -1266,7 +1313,7 @@ Consider using 'Control Panel' only for better performance."
1266
1313
  <div class="setting-controls">
1267
1314
  <slot name="controls"></slot>
1268
1315
  </div>
1269
- </div>`}};I.styles=[Bt`
1316
+ </div>`}};_.styles=[Wt`
1270
1317
  .setting-item {
1271
1318
  display: flex;
1272
1319
  align-items: center;
@@ -1306,14 +1353,14 @@ Consider using 'Control Panel' only for better performance."
1306
1353
  color: #fff;
1307
1354
  font-size: 13px;
1308
1355
  }
1309
- `],n([Pe({type:String})],I.prototype,"header",2),n([Pe({type:String})],I.prototype,"description",2),I=n([Gt("setting-item")],I);import{ForesightManager as Jt}from"js.foresight";var y=class extends Kt{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})):Jt.instance.alterGlobalSettings({[this.setting]:i})}}render(){return Wt`<setting-item header=${this.header} description=${this.description}>
1356
+ `],n([Ne({type:String})],_.prototype,"header",2),n([Ne({type:String})],_.prototype,"description",2),_=n([Kt("setting-item")],_);import{ForesightManager as Zt}from"js.foresight";var w=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}>
1310
1357
  <input
1311
1358
  slot="controls"
1312
1359
  type="checkbox"
1313
1360
  .checked=${this.isChecked}
1314
1361
  @change=${this.handleCheckboxChange}
1315
1362
  />
1316
- </setting-item>`}};y.styles=[qt`
1363
+ </setting-item>`}};w.styles=[Jt`
1317
1364
  input[type="checkbox"] {
1318
1365
  appearance: none;
1319
1366
  -webkit-appearance: none;
@@ -1356,7 +1403,7 @@ Consider using 'Control Panel' only for better performance."
1356
1403
  input[type="checkbox"]:hover {
1357
1404
  box-shadow: 0 0 0 3px rgba(176, 196, 222, 0.1);
1358
1405
  }
1359
- `],n([J({type:Boolean})],y.prototype,"isChecked",2),n([J({type:String})],y.prototype,"header",2),n([J({type:String})],y.prototype,"description",2),n([J({type:String})],y.prototype,"setting",2),y=n([Yt("setting-item-checkbox")],y);import{LitElement as Xt,html as Zt,css as Qt}from"lit";import{customElement as en,property as _,state as tn}from"lit/decorators.js";import{ForesightManager as nn}from"js.foresight";var g=class extends Xt{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,nn.instance.alterGlobalSettings({[this.setting]:i})}}willUpdate(e){super.willUpdate(e),e.has("currentValue")&&(this.displayValue=this.currentValue)}render(){return Zt`<setting-item header=${this.header} description=${this.description}>
1406
+ `],n([Z({type:Boolean})],w.prototype,"isChecked",2),n([Z({type:String})],w.prototype,"header",2),n([Z({type:String})],w.prototype,"description",2),n([Z({type:String})],w.prototype,"setting",2),w=n([Xt("setting-item-checkbox")],w);import{LitElement as Qt,html as en,css as tn}from"lit";import{customElement as nn,property as I,state as on}from"lit/decorators.js";import{ForesightManager as an}from"js.foresight";var p=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}>
1360
1407
  <div slot="controls" class="range-wrapper">
1361
1408
  <input
1362
1409
  slot="controls"
@@ -1370,7 +1417,7 @@ Consider using 'Control Panel' only for better performance."
1370
1417
  />
1371
1418
  <span class="setting-range-value">${this.displayValue} ${this.unit}</span>
1372
1419
  </div>
1373
- </setting-item>`}};g.styles=[Qt`
1420
+ </setting-item>`}};p.styles=[tn`
1374
1421
  .setting-range-value {
1375
1422
  font-size: 12px;
1376
1423
  color: #b0c4de;
@@ -1439,14 +1486,14 @@ Consider using 'Control Panel' only for better performance."
1439
1486
  transform: scale(1.1);
1440
1487
  box-shadow: 0 0 0 4px rgba(176, 196, 222, 0.2);
1441
1488
  }
1442
- `],n([_({type:Number})],g.prototype,"minValue",2),n([_({type:Number})],g.prototype,"maxValue",2),n([_({type:Number})],g.prototype,"currentValue",2),n([_({type:String})],g.prototype,"unit",2),n([_({type:String})],g.prototype,"header",2),n([_({type:String})],g.prototype,"description",2),n([_({type:String})],g.prototype,"setting",2),n([tn()],g.prototype,"displayValue",2),g=n([en("setting-item-range")],g);var x=class extends hn{constructor(){super();this.changedSettings=[];this._abortController=null;let e=l.instance.devtoolsSettings,t=Ue.instance.getManagerData.globalSettings;this.devtoolsSettings=Object.assign({},e),this.managerSettings=Object.assign({},t),this.initialSettings={devtools:Object.assign({},e),manager:Object.assign({},t)}}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;Ue.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"];for(let i of t){let a=this.initialSettings.manager[i],r=this.managerSettings[i];a!==r&&e.push({setting:i,oldValue:a,newValue:r})}}_checkDevtoolsSettingsChanges(e){let t=["showNameTags"];for(let i of t){let a=this.initialSettings.devtools[i],r=this.devtoolsSettings[i];a!==r&&e.push({setting:i,oldValue:a,newValue:r})}}_handleDevtoolsSettingChange(e){let{setting:t,value:i}=e.detail;t==="showNameTags"&&(this.devtoolsSettings={...this.devtoolsSettings,showNameTags:i},l.instance.alterDevtoolsSettings({showNameTags:i}),this._updateChangedSettings())}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};return`ForesightManager.initialize(${JSON.stringify(t,null,2)})`}render(){if(!this.managerSettings||!this.devtoolsSettings)return Ne`<tab-content
1489
+ `],n([I({type:Number})],p.prototype,"minValue",2),n([I({type:Number})],p.prototype,"maxValue",2),n([I({type:Number})],p.prototype,"currentValue",2),n([I({type:String})],p.prototype,"unit",2),n([I({type:String})],p.prototype,"header",2),n([I({type:String})],p.prototype,"description",2),n([I({type:String})],p.prototype,"setting",2),n([on()],p.prototype,"displayValue",2),p=n([nn("setting-item-range")],p);var v=class extends un{constructor(){super();this.changedSettings=[];this.touchDeviceStrategyOptions=[{value:"onTouchStart",label:"On Touch Start",title:"Execute callbacks when user touches registered elements",icon:G`<span>Touch</span>`},{value:"viewport",label:"Viewport Entry",title:"Execute callbacks when registered elements enter the viewport",icon:G`<span>Viewport</span>`},{value:"none",label:"None",title:"Disable touch device prediction",icon:G`<span>None</span>`}];this._abortController=null;this._handleTouchDeviceStrategyChange=e=>{ie.instance.alterGlobalSettings({touchDeviceStrategy:e})};let e=l.instance.devtoolsSettings,t=ie.instance.getManagerData.globalSettings;this.devtoolsSettings=Object.assign({},e),this.managerSettings=Object.assign({},t),this.initialSettings={devtools:Object.assign({},e),manager:Object.assign({},t)}}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;ie.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"];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())}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};return`ForesightManager.initialize(${JSON.stringify(t,null,2)})`}render(){if(!this.managerSettings||!this.devtoolsSettings)return G`<tab-content
1443
1490
  .noContentMessage=${"Loading settings..."}
1444
1491
  .hasContent=${!1}
1445
1492
  ></tab-content>`;let e=this.managerSettings,t=this.changedSettings.length>0?`Settings that have been changed this session compared to your initialized settings.
1446
1493
  Click on the copy icon to easely copy the new setting into your project
1447
1494
 
1448
1495
  `+this.changedSettings.map(i=>`${i.setting}: ${JSON.stringify(i.oldValue)} -> ${JSON.stringify(i.newValue)}`).join(`
1449
- `):"No settings changed from initial values";return Ne`
1496
+ `):"No settings changed from initial values";return G`
1450
1497
  <tab-header>
1451
1498
  <div slot="chips" class="chips-container">
1452
1499
  <chip-element .title=${t}> ${this.changedSettings.length} changed </chip-element>
@@ -1474,7 +1521,7 @@ Click on the copy icon to easely copy the new setting into your project
1474
1521
  .currentValue=${e.trajectoryPredictionTime}
1475
1522
  .maxValue=${200}
1476
1523
  .minValue=${10}
1477
- .unit=${Oe}
1524
+ .unit=${Ue}
1478
1525
  header="Prediction Time"
1479
1526
  description="How far into the future to calculate mouse trajectory path"
1480
1527
  setting="trajectoryPredictionTime"
@@ -1483,9 +1530,9 @@ Click on the copy icon to easely copy the new setting into your project
1483
1530
  .currentValue=${e.positionHistorySize}
1484
1531
  .maxValue=${30}
1485
1532
  .minValue=${2}
1486
- .unit=${te}
1533
+ .unit=${ne}
1487
1534
  header="Position History Size"
1488
- description="How far into the future, in ${te}, to calculate mouse trajectory path"
1535
+ description="How far into the future, in ${ne}, to calculate mouse trajectory path"
1489
1536
  setting="positionHistorySize"
1490
1537
  >
1491
1538
  </setting-item-range>
@@ -1503,7 +1550,7 @@ Click on the copy icon to easely copy the new setting into your project
1503
1550
  .currentValue=${e.tabOffset}
1504
1551
  .maxValue=${20}
1505
1552
  .minValue=${0}
1506
- .unit=${_e}
1553
+ .unit=${Pe}
1507
1554
  header="Tab Offset"
1508
1555
  description="Number of tabbable elements to look ahead when predicting navigation"
1509
1556
  setting="tabOffset"
@@ -1523,13 +1570,28 @@ Click on the copy icon to easely copy the new setting into your project
1523
1570
  .currentValue=${e.scrollMargin}
1524
1571
  .maxValue=${300}
1525
1572
  .minValue=${30}
1526
- .unit=${Ie}
1573
+ .unit=${Oe}
1527
1574
  header="Scroll Margin"
1528
1575
  description="Pixel distance to check from mouse position in scroll direction"
1529
1576
  setting="scrollMargin"
1530
1577
  ></setting-item-range>
1531
1578
  </div>
1532
1579
 
1580
+ <div class="settings-group">
1581
+ <h4>Touch Device</h4>
1582
+ <setting-item
1583
+ header="Touch Device Strategy"
1584
+ description="How to handle prediction on touch devices"
1585
+ >
1586
+ <single-select-dropdown
1587
+ slot="controls"
1588
+ .dropdownOptions=${this.touchDeviceStrategyOptions}
1589
+ .selectedOptionValue=${e.touchDeviceStrategy}
1590
+ .onSelectionChange=${this._handleTouchDeviceStrategyChange}
1591
+ ></single-select-dropdown>
1592
+ </setting-item>
1593
+ </div>
1594
+
1533
1595
  <!-- Developer Tools Group -->
1534
1596
  <div class="settings-group">
1535
1597
  <h4>Developer Tools</h4>
@@ -1544,7 +1606,7 @@ Click on the copy icon to easely copy the new setting into your project
1544
1606
  </div>
1545
1607
  </div>
1546
1608
  </tab-content>
1547
- `}};x.styles=gn`
1609
+ `}};v.styles=mn`
1548
1610
  :host {
1549
1611
  display: flex;
1550
1612
  flex-direction: column;
@@ -1575,7 +1637,7 @@ Click on the copy icon to easely copy the new setting into your project
1575
1637
  border-bottom: 1px solid rgba(176, 196, 222, 0.2);
1576
1638
  padding-bottom: 8px;
1577
1639
  }
1578
- `,n([X()],x.prototype,"managerSettings",2),n([X()],x.prototype,"initialSettings",2),n([X()],x.prototype,"devtoolsSettings",2),n([X()],x.prototype,"changedSettings",2),x=n([mn("settings-tab")],x);var O=class extends un{constructor(){super();this.isMinimized=l.instance.devtoolsSettings.isControlPanelDefaultMinimized;this.localStorageSelectedTabKey="foresight-devtools-control-panel-tab";this.activeTab=this.getStoredTab()}getStoredTab(){try{return localStorage.getItem(this.localStorageSelectedTabKey)||"logs"}catch(e){return console.error(e),"logs"}}_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)}}render(){return vn`
1640
+ `,n([W()],v.prototype,"managerSettings",2),n([W()],v.prototype,"initialSettings",2),n([W()],v.prototype,"devtoolsSettings",2),n([W()],v.prototype,"changedSettings",2),n([W()],v.prototype,"touchDeviceStrategyOptions",2),v=n([bn("settings-tab")],v);var O=class extends vn{constructor(){super();this.isMinimized=l.instance.devtoolsSettings.isControlPanelDefaultMinimized;this.localStorageSelectedTabKey="foresight-devtools-control-panel-tab";this.activeTab=this.getStoredTab()}getStoredTab(){try{return localStorage.getItem(this.localStorageSelectedTabKey)||"logs"}catch(e){return console.error(e),"logs"}}_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)}}render(){return yn`
1579
1641
  <div class="control-wrapper ${this.isMinimized?"minimized":""}">
1580
1642
  <div class="title-wrapper">
1581
1643
  <button @click="${()=>this.isMinimized=!this.isMinimized}" class="minimize-button">
@@ -1592,15 +1654,15 @@ Click on the copy icon to easely copy the new setting into your project
1592
1654
  ></tab-selector>
1593
1655
 
1594
1656
  <div class="tab-content">
1595
- <log-tab class=${ne({active:this.activeTab==="logs"})}></log-tab>
1596
- <element-tab class=${ne({active:this.activeTab==="elements"})}></element-tab>
1657
+ <log-tab class=${oe({active:this.activeTab==="logs"})}></log-tab>
1658
+ <element-tab class=${oe({active:this.activeTab==="elements"})}></element-tab>
1597
1659
  <settings-tab
1598
- class=${ne({active:this.activeTab==="settings"})}
1660
+ class=${oe({active:this.activeTab==="settings"})}
1599
1661
  ></settings-tab>
1600
1662
  </div>
1601
1663
  </div>
1602
1664
  </div>
1603
- `}};O.styles=bn`
1665
+ `}};O.styles=fn`
1604
1666
  .control-wrapper {
1605
1667
  padding: 12px;
1606
1668
  position: fixed;
@@ -1675,7 +1737,7 @@ Click on the copy icon to easely copy the new setting into your project
1675
1737
  width: 100%;
1676
1738
  height: 100%;
1677
1739
  }
1678
- `,n([Fe()],O.prototype,"activeTab",2),n([Fe()],O.prototype,"isMinimized",2),O=n([fn("control-panel")],O);import{LitElement as Pn,css as Un,html as Nn}from"lit";import{customElement as Fn}from"lit/decorators.js";import{LitElement as yn,html as xn,css as wn}from"lit";import{customElement as kn,state as Ve,query as En}from"lit/decorators.js";import{ForesightManager as V}from"js.foresight";var C=class extends yn{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;V.instance.addEventListener("elementRegistered",t=>{t.elementData.isIntersectingWithViewport&&this.createOrUpdateElementOverlay(t.elementData)},{signal:e}),V.instance.addEventListener("elementUnregistered",t=>{this.removeElementOverlay(t.elementData)},{signal:e}),V.instance.addEventListener("elementReactivated",t=>{t.elementData.isIntersectingWithViewport&&this.createOrUpdateElementOverlay(t.elementData)},{signal:e}),V.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}),V.instance.addEventListener("callbackInvoked",t=>{this.highlightElementCallback(t.elementData,t.hitType)},{signal:e}),V.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:r}=t.elementBounds,p=r.right-r.left,K=r.bottom-r.top;i.style.width=`${p}px`,i.style.height=`${K}px`,i.style.transform=`translate3d(${r.left}px, ${r.top}px, 0)`,l.instance.devtoolsSettings.showNameTags?(a.textContent=t.name,a.style.display="block",a.style.transform=`translate3d(${r.left}px, ${r.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;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 xn` <div id="overlays-container"></div> `}};C.styles=[wn`
1740
+ `,n([Ve()],O.prototype,"activeTab",2),n([Ve()],O.prototype,"isMinimized",2),O=n([wn("control-panel")],O);import{LitElement as Nn,css as Vn,html as Fe}from"lit";import{customElement as An,state as Fn}from"lit/decorators.js";import{LitElement as xn,html as kn,css as En}from"lit";import{customElement as Sn,state as Ae,query as Cn}from"lit/decorators.js";import{ForesightManager as A}from"js.foresight";var S=class extends xn{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;A.instance.addEventListener("elementRegistered",t=>{t.elementData.isIntersectingWithViewport&&this.createOrUpdateElementOverlay(t.elementData)},{signal:e}),A.instance.addEventListener("elementUnregistered",t=>{this.removeElementOverlay(t.elementData)},{signal:e}),A.instance.addEventListener("elementReactivated",t=>{t.elementData.isIntersectingWithViewport&&this.createOrUpdateElementOverlay(t.elementData)},{signal:e}),A.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}),A.instance.addEventListener("callbackInvoked",t=>{this.highlightElementCallback(t.elementData,t.hitType)},{signal:e}),A.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,q=s.bottom-s.top;i.style.width=`${d}px`,i.style.height=`${q}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 kn` <div id="overlays-container"></div> `}};S.styles=[En`
1679
1741
  :host {
1680
1742
  position: fixed;
1681
1743
  top: 0;
@@ -1742,7 +1804,7 @@ Click on the copy icon to easely copy the new setting into your project
1742
1804
  white-space: nowrap;
1743
1805
  pointer-events: none;
1744
1806
  }
1745
- `],n([Ve()],C.prototype,"overlayMap",2),n([Ve()],C.prototype,"callbackAnimations",2),n([En("#overlays-container")],C.prototype,"containerElement",2),C=n([kn("element-overlays")],C);import{LitElement as Cn,html as Sn,css as Tn}from"lit";import{customElement as Dn,state as ie}from"lit/decorators.js";import{styleMap as Mn}from"lit/directives/style-map.js";import{ForesightManager as B}from"js.foresight";var S=class extends Cn{constructor(){super(...arguments);this._abortController=new AbortController;this._mousePredictionIsEnabled=B.instance.getManagerData.globalSettings.enableMousePrediction;this._isVisible=!1;this._trajectoryStyles={};this.handleElementUnregistered=e=>{e.wasLastElement&&(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,r=i.y-t.y,p=Math.sqrt(a*a+r*r),K=Math.atan2(r,a)*57.29577951308232;this._trajectoryStyles={transform:`translate3d(${t.x}px, ${t.y}px, 0) rotate(${K}deg)`,width:`${p}px`}}}connectedCallback(){super.connectedCallback();let{signal:e}=this._abortController;B.instance.addEventListener("mouseTrajectoryUpdate",this.handleTrajectoryUpdate,{signal:e}),B.instance.addEventListener("elementUnregistered",this.handleElementUnregistered,{signal:e}),B.instance.addEventListener("scrollTrajectoryUpdate",()=>{this._isVisible=!1},{signal:e}),B.instance.addEventListener("managerSettingsChanged",this.handleSettingsChange,{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController.abort()}render(){let e={display:this._isVisible?"block":"none",...this._trajectoryStyles};return Sn` <div class="trajectory-line" style=${Mn(e)}></div> `}};S.styles=[Tn`
1807
+ `],n([Ae()],S.prototype,"overlayMap",2),n([Ae()],S.prototype,"callbackAnimations",2),n([Cn("#overlays-container")],S.prototype,"containerElement",2),S=n([Sn("element-overlays")],S);import{LitElement as Tn,html as Dn,css as Mn}from"lit";import{customElement as Ln,state as ae}from"lit/decorators.js";import{styleMap as $n}from"lit/directives/style-map.js";import{ForesightManager as K}from"js.foresight";var C=class extends Tn{constructor(){super(...arguments);this._abortController=new AbortController;this._mousePredictionIsEnabled=K.instance.getManagerData.globalSettings.enableMousePrediction;this._isVisible=!1;this._trajectoryStyles={};this.handleElementUnregistered=e=>{e.wasLastElement&&(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),q=Math.atan2(s,a)*57.29577951308232;this._trajectoryStyles={transform:`translate3d(${t.x}px, ${t.y}px, 0) rotate(${q}deg)`,width:`${d}px`}}}connectedCallback(){super.connectedCallback();let{signal:e}=this._abortController;K.instance.addEventListener("mouseTrajectoryUpdate",this.handleTrajectoryUpdate,{signal:e}),K.instance.addEventListener("elementUnregistered",this.handleElementUnregistered,{signal:e}),K.instance.addEventListener("scrollTrajectoryUpdate",()=>{this._isVisible=!1},{signal:e}),K.instance.addEventListener("managerSettingsChanged",this.handleSettingsChange,{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController.abort()}render(){let e={display:this._isVisible?"block":"none",...this._trajectoryStyles};return Dn` <div class="trajectory-line" style=${$n(e)}></div> `}};C.styles=[Mn`
1746
1808
  :host {
1747
1809
  display: block;
1748
1810
  }
@@ -1773,7 +1835,7 @@ Click on the copy icon to easely copy the new setting into your project
1773
1835
  border-bottom: 4px solid transparent;
1774
1836
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.6));
1775
1837
  }
1776
- `],n([ie()],S.prototype,"_mousePredictionIsEnabled",2),n([ie()],S.prototype,"_isVisible",2),n([ie()],S.prototype,"_trajectoryStyles",2),S=n([Dn("mouse-trajectory")],S);import{LitElement as Ln,html as $n,css as In}from"lit";import{customElement as _n,state as Z}from"lit/decorators.js";import{styleMap as On}from"lit/directives/style-map.js";import{ForesightManager as A}from"js.foresight";var w=class extends Ln{constructor(){super(...arguments);this._abortController=new AbortController;this._scrollPredictionIsEnabled=A.instance.getManagerData.globalSettings.enableScrollPrediction;this._scrollMargin=A.instance.getManagerData.globalSettings.scrollMargin;this._isVisible=!1;this._trajectoryStyles={};this._isUpdateScheduled=!1;this._latestScrollTrajectory=null;this.handleElementUnregistered=e=>{e.wasLastElement&&(this._isVisible=!1)};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,requestAnimationFrame(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,r=Math.atan2(a,i)*180/Math.PI;this._trajectoryStyles={transform:`translate(${e.x}px, ${e.y}px) rotate(${r}deg)`},this._isUpdateScheduled=!1,this.requestUpdate()}}connectedCallback(){super.connectedCallback();let{signal:e}=this._abortController;A.instance.addEventListener("scrollTrajectoryUpdate",this.handleScrollUpdate,{signal:e}),A.instance.addEventListener("mouseTrajectoryUpdate",()=>{this._isVisible=!1},{signal:e}),A.instance.addEventListener("elementUnregistered",this.handleElementUnregistered,{signal:e}),A.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 $n` <div class="scroll-trajectory-line" style=${On(e)}></div> `}};w.styles=[In`
1838
+ `],n([ae()],C.prototype,"_mousePredictionIsEnabled",2),n([ae()],C.prototype,"_isVisible",2),n([ae()],C.prototype,"_trajectoryStyles",2),C=n([Ln("mouse-trajectory")],C);import{LitElement as _n,html as In,css as On}from"lit";import{customElement as Pn,state as Q}from"lit/decorators.js";import{styleMap as Un}from"lit/directives/style-map.js";import{ForesightManager as F}from"js.foresight";var x=class extends _n{constructor(){super(...arguments);this._abortController=new AbortController;this._scrollPredictionIsEnabled=F.instance.getManagerData.globalSettings.enableScrollPrediction;this._scrollMargin=F.instance.getManagerData.globalSettings.scrollMargin;this._isVisible=!1;this._trajectoryStyles={};this._isUpdateScheduled=!1;this._latestScrollTrajectory=null;this.handleElementUnregistered=e=>{e.wasLastElement&&(this._isVisible=!1)};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,requestAnimationFrame(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;F.instance.addEventListener("scrollTrajectoryUpdate",this.handleScrollUpdate,{signal:e}),F.instance.addEventListener("mouseTrajectoryUpdate",()=>{this._isVisible=!1},{signal:e}),F.instance.addEventListener("elementUnregistered",this.handleElementUnregistered,{signal:e}),F.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 In` <div class="scroll-trajectory-line" style=${Un(e)}></div> `}};x.styles=[On`
1777
1839
  :host {
1778
1840
  display: block;
1779
1841
  }
@@ -1833,13 +1895,15 @@ Click on the copy icon to easely copy the new setting into your project
1833
1895
  filter: drop-shadow(0 0 12px rgba(234, 179, 8, 0.8));
1834
1896
  }
1835
1897
  }
1836
- `],n([Z()],w.prototype,"_scrollPredictionIsEnabled",2),n([Z()],w.prototype,"_scrollMargin",2),n([Z()],w.prototype,"_isVisible",2),n([Z()],w.prototype,"_trajectoryStyles",2),w=n([_n("scroll-trajectory")],w);var G=class extends Pn{render(){return Nn`
1898
+ `],n([Q()],x.prototype,"_scrollPredictionIsEnabled",2),n([Q()],x.prototype,"_scrollMargin",2),n([Q()],x.prototype,"_isVisible",2),n([Q()],x.prototype,"_trajectoryStyles",2),x=n([Pn("scroll-trajectory")],x);import{ForesightManager as je}from"js.foresight";var j=class extends Nn{constructor(){super(...arguments);this._abortController=null;this._strategy=je.instance.getManagerData.currentDeviceStrategy;this.handleDeviceStrategyChange=e=>this._strategy=e.newStrategy}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;je.instance.addEventListener("deviceStrategyChanged",this.handleDeviceStrategyChange,{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort()}render(){return Fe`
1837
1899
  <div id="overlay-container">
1838
- <mouse-trajectory></mouse-trajectory>
1839
- <scroll-trajectory></scroll-trajectory>
1840
- <element-overlays></element-overlays>
1900
+ ${this._strategy==="mouse"?Fe`
1901
+ <mouse-trajectory></mouse-trajectory>
1902
+ <scroll-trajectory></scroll-trajectory>
1903
+ <element-overlays></element-overlays>
1904
+ `:""}
1841
1905
  </div>
1842
- `}};G.styles=[Un`
1906
+ `}};j.styles=[Vn`
1843
1907
  :host {
1844
1908
  display: block;
1845
1909
  }
@@ -1850,8 +1914,8 @@ Click on the copy icon to easely copy the new setting into your project
1850
1914
  pointer-events: none;
1851
1915
  z-index: 9999;
1852
1916
  }
1853
- `],G=n([Fn("debug-overlay")],G);var l=class extends Vn{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}}}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)))}cleanup(){this.requestUpdate()}render(){return!this.isInitialized||!this.devtoolsSettings.showDebugger?Ae``:Ae`<control-panel></control-panel> <debug-overlay></debug-overlay>`}};l.styles=[An`
1917
+ `],n([Fn()],j.prototype,"_strategy",2),j=n([An("debug-overlay")],j);var l=class extends jn{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?ze``:ze`<control-panel></control-panel> <debug-overlay></debug-overlay>`}};l.styles=[zn`
1854
1918
  :host {
1855
1919
  display: block;
1856
1920
  }
1857
- `],l._instance=null,n([zn()],l.prototype,"isInitialized",2),l=n([jn("foresight-devtools")],l);export{l as ForesightDevtools};
1921
+ `],l._instance=null,n([Hn()],l.prototype,"isInitialized",2),l=n([Rn("foresight-devtools")],l);export{l as ForesightDevtools};
package/package.json CHANGED
@@ -1,62 +1,63 @@
1
- {
2
- "name": "js.foresight-devtools",
3
- "version": "1.2.1",
4
- "description": "Visual debugging tools for ForesightJS - mouse trajectory prediction and element interaction visualization",
5
- "type": "module",
6
- "main": "./dist/index.js",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./dist/index.d.ts",
12
- "default": "./dist/index.js"
13
- }
14
- },
15
- "homepage": "https://foresightjs.com/docs/getting_started/development_tools",
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/spaansba/ForesightJS/tree/main/packages/devpage"
19
- },
20
- "files": [
21
- "dist",
22
- "README.md",
23
- "LICENSE"
24
- ],
25
- "keywords": [
26
- "foresight",
27
- "debugger",
28
- "mouse-trajectory",
29
- "visualization",
30
- "debug-tools",
31
- "development",
32
- "foresightjs",
33
- "devtools"
34
- ],
35
- "author": "Bart Spaans",
36
- "license": "MIT",
37
- "peerDependencies": {
38
- "js.foresight": "^3.2.0"
39
- },
40
- "devDependencies": {
41
- "@types/node": "^22.15.30",
42
- "tslib": "^2.8.1",
43
- "tsup": "^8.5.0",
44
- "typescript": "^5.8.3",
45
- "vitest": "^3.2.4",
46
- "js.foresight": "3.2.1"
47
- },
48
- "dependencies": {
49
- "@thednp/position-observer": "^1.1.0",
50
- "lit": "^3.3.0"
51
- },
52
- "scripts": {
53
- "build": "tsup --sourcemap",
54
- "build:prod": "tsup",
55
- "dev": "tsup --watch",
56
- "test": "vitest",
57
- "test:watch": "vitest --watch",
58
- "test:run": "vitest run",
59
- "prettier": "prettier --write .",
60
- "lint": "eslint . --fix"
61
- }
62
- }
1
+ {
2
+ "name": "js.foresight-devtools",
3
+ "version": "1.3.0-beta.1",
4
+ "description": "Visual debugging tools for ForesightJS - mouse trajectory prediction and element interaction visualization",
5
+ "type": "module",
6
+ "scripts": {
7
+ "build": "tsup --sourcemap",
8
+ "build:prod": "tsup",
9
+ "dev": "tsup --watch",
10
+ "test": "vitest",
11
+ "test:watch": "vitest --watch",
12
+ "test:run": "vitest run",
13
+ "prettier": "prettier --write .",
14
+ "lint": "eslint . --fix",
15
+ "prepublishOnly": "pnpm lint && pnpm test:run && pnpm build:prod"
16
+ },
17
+ "main": "./dist/index.js",
18
+ "module": "./dist/index.js",
19
+ "types": "./dist/index.d.ts",
20
+ "exports": {
21
+ ".": {
22
+ "types": "./dist/index.d.ts",
23
+ "default": "./dist/index.js"
24
+ }
25
+ },
26
+ "homepage": "https://foresightjs.com/docs/getting_started/development_tools",
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/spaansba/ForesightJS/tree/main/packages/devpage"
30
+ },
31
+ "files": [
32
+ "dist",
33
+ "README.md",
34
+ "LICENSE"
35
+ ],
36
+ "keywords": [
37
+ "foresight",
38
+ "debugger",
39
+ "mouse-trajectory",
40
+ "visualization",
41
+ "debug-tools",
42
+ "development",
43
+ "foresightjs",
44
+ "devtools"
45
+ ],
46
+ "author": "Bart Spaans",
47
+ "license": "MIT",
48
+ "peerDependencies": {
49
+ "js.foresight": "^3.3.0-beta.1"
50
+ },
51
+ "devDependencies": {
52
+ "@types/node": "^22.15.30",
53
+ "js.foresight": "workspace:*",
54
+ "tslib": "^2.8.1",
55
+ "tsup": "^8.5.0",
56
+ "typescript": "^5.8.3",
57
+ "vitest": "^3.2.4"
58
+ },
59
+ "dependencies": {
60
+ "@thednp/position-observer": "^1.1.0",
61
+ "lit": "^3.3.0"
62
+ }
63
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Bart Spaans
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.