js.foresight-devtools 1.0.2 → 1.0.3
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.mts +2 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.js +70 -65
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +75 -70
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Ue=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var i=(n,s,e,t)=>{for(var o=t>1?void 0:t?Pe(s,e):s,a=n.length-1,r;a>=0;a--)(r=n[a])&&(o=(t?r(s,e,o):r(o))||o);return t&&o&&Ue(s,e,o),o};import{LitElement as Ti,css as Mi,html as Ie}from"lit";import{customElement as Di,state as _i}from"lit/decorators.js";import{LitElement as ni,css as si,html as ai}from"lit";import{customElement as ri,state as q}from"lit/decorators.js";import{classMap as Q}from"lit/directives/class-map.js";import{css as pt,html as we,LitElement as gt}from"lit";import{customElement as ht,state as y}from"lit/decorators.js";import{map as mt}from"lit/directives/map.js";import{LitElement as Ne,html as je,css as Ve}from"lit";import{customElement as Fe}from"lit/decorators.js";var j=class extends Ne{render(){return je`
|
|
2
2
|
<div class="tab-bar-elements">
|
|
3
3
|
<div class="tab-bar-info">
|
|
4
4
|
<div class="stats-chips">
|
|
@@ -9,7 +9,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
9
9
|
<slot name="actions"></slot>
|
|
10
10
|
</div>
|
|
11
11
|
</div>
|
|
12
|
-
`}};j.styles=[
|
|
12
|
+
`}};j.styles=[Ve`
|
|
13
13
|
:host {
|
|
14
14
|
}
|
|
15
15
|
.tab-bar-info {
|
|
@@ -53,11 +53,11 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
53
53
|
z-index: 5;
|
|
54
54
|
min-height: 36px;
|
|
55
55
|
}
|
|
56
|
-
`],j=i([
|
|
56
|
+
`],j=i([Fe("tab-header")],j);import{LitElement as ze,html as K,css as Re}from"lit";import{customElement as Ae,property as ne}from"lit/decorators.js";var T=class extends ze{constructor(){super(...arguments);this.noContentMessage="No content available.";this.hasContent=!0}render(){return K`
|
|
57
57
|
<div class="content-container">
|
|
58
|
-
${this.hasContent?
|
|
58
|
+
${this.hasContent?K`<slot></slot>`:K`<div class="no-content-message">${this.noContentMessage}</div>`}
|
|
59
59
|
</div>
|
|
60
|
-
`}};T.styles=[
|
|
60
|
+
`}};T.styles=[Re`
|
|
61
61
|
:host {
|
|
62
62
|
overflow: hidden;
|
|
63
63
|
}
|
|
@@ -96,7 +96,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
96
96
|
font-style: italic;
|
|
97
97
|
font-family: "Courier New", monospace;
|
|
98
98
|
}
|
|
99
|
-
`],i([
|
|
99
|
+
`],i([ne({type:String,attribute:"no-content-message"})],T.prototype,"noContentMessage",2),i([ne({type:Boolean})],T.prototype,"hasContent",2),T=i([Ae("tab-content")],T);import{html as We}from"lit";import{customElement as Ye,property as ae}from"lit/decorators.js";import{LitElement as He,html as se,css as Be}from"lit";import{property as Ge,state as qe}from"lit/decorators.js";var d=class d extends He{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 o=e.getBoundingClientRect(),a=t.offsetHeight||200,r=o.bottom+5,N=window.innerWidth-o.right;window.innerHeight-o.bottom<a&&o.top>a?t.style.top=`${o.top-a-5}px`:t.style.top=`${r}px`,t.style.right=`${N}px`}}render(){let e=`trigger-button ${this.isDropdownOpen?"active":""}`,t=`dropdown-menu ${this.isDropdownOpen?"active":""}`;return se`
|
|
100
100
|
<div class="dropdown-container">
|
|
101
101
|
<button
|
|
102
102
|
class="${e}"
|
|
@@ -122,7 +122,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
122
122
|
</button>
|
|
123
123
|
|
|
124
124
|
<div class="${t}" id="dropdown-menu" role="menu">
|
|
125
|
-
${this.dropdownOptions.map(o=>
|
|
125
|
+
${this.dropdownOptions.map(o=>se`
|
|
126
126
|
<button
|
|
127
127
|
value="${o.value}"
|
|
128
128
|
title="${o.title}"
|
|
@@ -135,7 +135,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
135
135
|
`)}
|
|
136
136
|
</div>
|
|
137
137
|
</div>
|
|
138
|
-
`}};d.currentlyOpen=null,d.styles=[
|
|
138
|
+
`}};d.currentlyOpen=null,d.styles=[Be`
|
|
139
139
|
:host {
|
|
140
140
|
display: inline-block;
|
|
141
141
|
}
|
|
@@ -250,11 +250,11 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
250
250
|
color: #b0c4de;
|
|
251
251
|
font-weight: bold;
|
|
252
252
|
}
|
|
253
|
-
`],i([
|
|
253
|
+
`],i([qe()],d.prototype,"isDropdownOpen",2),i([Ge({type:Array})],d.prototype,"dropdownOptions",2);var M=d;var $=class extends M{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:We``}_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)}};i([ae({type:String})],$.prototype,"selectedOptionValue",2),i([ae({type:Function})],$.prototype,"onSelectionChange",2),$=i([Ye("single-select-dropdown")],$);import{LitElement as Ke,html as Je,css as Xe}from"lit";import{customElement as Ze,property as Qe}from"lit/decorators.js";var O=class extends Ke{constructor(){super(...arguments);this.title=""}render(){return Je`
|
|
254
254
|
<span class="chip" title="${this.title}">
|
|
255
255
|
<slot></slot>
|
|
256
256
|
</span>
|
|
257
|
-
`}}
|
|
257
|
+
`}};O.styles=[Xe`
|
|
258
258
|
:host {
|
|
259
259
|
display: inline-block;
|
|
260
260
|
}
|
|
@@ -274,7 +274,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
274
274
|
line-height: 1.2;
|
|
275
275
|
transition: all 0.2s ease;
|
|
276
276
|
}
|
|
277
|
-
`],i([
|
|
277
|
+
`],i([Qe({type:String})],O.prototype,"title",2),O=i([Ze("chip-element")],O);import{LitElement as rt,html as lt,css as dt}from"lit";import{customElement as ct,property as A}from"lit/decorators.js";import{LitElement as nt,html as xe,css as st}from"lit";import{customElement as at,property as V}from"lit/decorators.js";import{LitElement as et,html as tt,css as it}from"lit";import{customElement as ot,property as fe,state as ye}from"lit/decorators.js";import{html as g}from"lit";var re=g`
|
|
278
278
|
<svg
|
|
279
279
|
xmlns="http://www.w3.org/2000/svg"
|
|
280
280
|
width="16"
|
|
@@ -291,7 +291,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
291
291
|
<line x1="7" y1="21" x2="17" y2="21"></line>
|
|
292
292
|
<line x1="12" y1="17" x2="12" y2="21"></line>
|
|
293
293
|
</svg>
|
|
294
|
-
`,
|
|
294
|
+
`,le=g`
|
|
295
295
|
<svg
|
|
296
296
|
xmlns="http://www.w3.org/2000/svg"
|
|
297
297
|
width="16"
|
|
@@ -306,7 +306,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
306
306
|
<polyline points="4 17 10 11 4 5"></polyline>
|
|
307
307
|
<line x1="12" y1="19" x2="20" y2="19"></line>
|
|
308
308
|
</svg>
|
|
309
|
-
`,
|
|
309
|
+
`,de=g`
|
|
310
310
|
<svg
|
|
311
311
|
xmlns="http://www.w3.org/2000/svg"
|
|
312
312
|
width="16"
|
|
@@ -322,7 +322,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
322
322
|
<path d="M13.73 21a2 2 0 0 1-3.46 0"></path>
|
|
323
323
|
<line x1="1" y1="1" x2="23" y2="23"></line>
|
|
324
324
|
</svg>
|
|
325
|
-
`,
|
|
325
|
+
`,ce=g`
|
|
326
326
|
<svg
|
|
327
327
|
xmlns="http://www.w3.org/2000/svg"
|
|
328
328
|
width="16"
|
|
@@ -340,7 +340,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
340
340
|
<circle cx="6" cy="18" r="2" />
|
|
341
341
|
<circle cx="18" cy="18" r="2" />
|
|
342
342
|
</svg>
|
|
343
|
-
`,
|
|
343
|
+
`,pe=g`
|
|
344
344
|
<svg
|
|
345
345
|
xmlns="http://www.w3.org/2000/svg"
|
|
346
346
|
width="16"
|
|
@@ -355,7 +355,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
355
355
|
<path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" />
|
|
356
356
|
<circle cx="12" cy="12" r="3" />
|
|
357
357
|
</svg>
|
|
358
|
-
`,
|
|
358
|
+
`,ge=g`
|
|
359
359
|
<svg
|
|
360
360
|
xmlns="http://www.w3.org/2000/svg"
|
|
361
361
|
width="16"
|
|
@@ -373,7 +373,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
373
373
|
<line x1="16" y1="17" x2="8" y2="17" />
|
|
374
374
|
<line x1="10" y1="9" x2="8" y2="9" />
|
|
375
375
|
</svg>
|
|
376
|
-
`,
|
|
376
|
+
`,he=g`
|
|
377
377
|
<svg
|
|
378
378
|
xmlns="http://www.w3.org/2000/svg"
|
|
379
379
|
width="16"
|
|
@@ -401,7 +401,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
401
401
|
>
|
|
402
402
|
<polygon points="22,3 2,3 10,12.46 10,19 14,21 14,12.46" />
|
|
403
403
|
</svg>
|
|
404
|
-
`,
|
|
404
|
+
`,me=g`
|
|
405
405
|
<svg
|
|
406
406
|
xmlns="http://www.w3.org/2000/svg"
|
|
407
407
|
width="16"
|
|
@@ -416,7 +416,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
416
416
|
<circle cx="12" cy="12" r="10" />
|
|
417
417
|
<line x1="4.93" y1="4.93" x2="19.07" y2="19.07" />
|
|
418
418
|
</svg>
|
|
419
|
-
`,
|
|
419
|
+
`,ue=g`
|
|
420
420
|
<svg
|
|
421
421
|
xmlns="http://www.w3.org/2000/svg"
|
|
422
422
|
width="24"
|
|
@@ -431,7 +431,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
431
431
|
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
|
432
432
|
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
|
433
433
|
</svg>
|
|
434
|
-
`,
|
|
434
|
+
`,be=g`
|
|
435
435
|
<svg
|
|
436
436
|
xmlns="http://www.w3.org/2000/svg"
|
|
437
437
|
width="24"
|
|
@@ -445,7 +445,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
445
445
|
>
|
|
446
446
|
<polyline points="20 6 9 17 4 12"></polyline>
|
|
447
447
|
</svg>
|
|
448
|
-
`,
|
|
448
|
+
`,ve=g`
|
|
449
449
|
<svg
|
|
450
450
|
xmlns="http://www.w3.org/2000/svg"
|
|
451
451
|
width="16"
|
|
@@ -463,15 +463,15 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
463
463
|
<line x1="12" y1="9" x2="12" y2="13"></line>
|
|
464
464
|
<line x1="12" y1="17" x2="12.01" y2="17"></line>
|
|
465
465
|
</svg>
|
|
466
|
-
`;var v=class extends
|
|
466
|
+
`;var v=class extends et{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 tt`
|
|
467
467
|
<button
|
|
468
468
|
class="copy-button ${this.isCopied?"copied":""}"
|
|
469
469
|
title="${this.title}"
|
|
470
470
|
@click=${this.handleClick}
|
|
471
471
|
>
|
|
472
|
-
${this.isCopied?
|
|
472
|
+
${this.isCopied?be:ue}
|
|
473
473
|
</button>
|
|
474
|
-
`}};v.styles=
|
|
474
|
+
`}};v.styles=it`
|
|
475
475
|
.copy-button {
|
|
476
476
|
background: transparent;
|
|
477
477
|
border: 0px;
|
|
@@ -510,7 +510,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
510
510
|
.copy-button.copied svg {
|
|
511
511
|
stroke: #4caf50;
|
|
512
512
|
}
|
|
513
|
-
`,i([
|
|
513
|
+
`,i([fe({type:String})],v.prototype,"title",2),i([fe({type:Function})],v.prototype,"onCopy",2),i([ye()],v.prototype,"isCopied",2),i([ye()],v.prototype,"copyTimeout",2),v=i([ot("copy-icon")],v);var u=class extends nt{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),xe`
|
|
514
514
|
<div class="item-entry ${this.isExpanded?"expanded":""}">
|
|
515
515
|
<div class="item-header ${this.isExpanded?"expanded":""}" @click="${this.toggleExpand}">
|
|
516
516
|
<div class="item-content">
|
|
@@ -522,7 +522,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
522
522
|
</svg>
|
|
523
523
|
</span>
|
|
524
524
|
</div>
|
|
525
|
-
${this.isExpanded?
|
|
525
|
+
${this.isExpanded?xe`
|
|
526
526
|
<div class="item-details">
|
|
527
527
|
<copy-icon
|
|
528
528
|
positioned
|
|
@@ -535,7 +535,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
535
535
|
</div>
|
|
536
536
|
`:""}
|
|
537
537
|
</div>
|
|
538
|
-
`}};u.styles=[
|
|
538
|
+
`}};u.styles=[st`
|
|
539
539
|
:host {
|
|
540
540
|
display: block;
|
|
541
541
|
}
|
|
@@ -633,7 +633,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
633
633
|
display: block;
|
|
634
634
|
overflow-x: auto;
|
|
635
635
|
}
|
|
636
|
-
`],i([V()],u.prototype,"borderColor",2),i([V()],u.prototype,"showCopyButton",2),i([V()],u.prototype,"itemId",2),i([V()],u.prototype,"isExpanded",2),i([V()],u.prototype,"onToggle",2),u=i([
|
|
636
|
+
`],i([V()],u.prototype,"borderColor",2),i([V()],u.prototype,"showCopyButton",2),i([V()],u.prototype,"itemId",2),i([V()],u.prototype,"isExpanded",2),i([V()],u.prototype,"onToggle",2),u=i([at("expandable-item")],u);var f=class extends rt{constructor(){super(...arguments);this.isActive=!1;this.isExpanded=!1}getBorderColor(){return this.isActive?"#ffeb3b":this.elementData.isIntersectingWithViewport?"#4caf50":"#666"}getStatusIndicatorClass(){return this.isActive?"prefetching":this.elementData.isIntersectingWithViewport?"visible":"hidden"}formatElementDetails(){let e={tagName:this.elementData.element.tagName.toLowerCase(),isIntersecting:this.elementData.isIntersectingWithViewport,registerCount:this.elementData.registerCount,hitSlop:{top:this.elementData.elementBounds.hitSlop.top,right:this.elementData.elementBounds.hitSlop.right,bottom:this.elementData.elementBounds.hitSlop.bottom,left:this.elementData.elementBounds.hitSlop.left}};return JSON.stringify(e,null,2)}render(){return lt`
|
|
637
637
|
<expandable-item
|
|
638
638
|
.borderColor=${this.getBorderColor()}
|
|
639
639
|
.showCopyButton=${!0}
|
|
@@ -649,7 +649,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
649
649
|
</div>
|
|
650
650
|
<div slot="details">${this.formatElementDetails()}</div>
|
|
651
651
|
</expandable-item>
|
|
652
|
-
`}};
|
|
652
|
+
`}};f.styles=[dt`
|
|
653
653
|
:host {
|
|
654
654
|
display: block;
|
|
655
655
|
}
|
|
@@ -697,8 +697,8 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
697
697
|
color: #fff;
|
|
698
698
|
font-weight: 600;
|
|
699
699
|
}
|
|
700
|
-
`],i([A()],
|
|
701
|
-
`)}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;this.updateElementListFromManager(),this.updateVisibilityCounts(),I.instance.addEventListener("elementRegistered",t=>{let o={...t.elementData,elementId:this.generateElementId()};this.elementListItems.set(t.elementData.element,o),this.updateVisibilityCounts()},{signal:e}),I.instance.addEventListener("elementDataUpdated",t=>{let o=this.elementListItems.get(t.elementData.element);if(o){let a={...t.elementData,elementId:o.elementId};this.elementListItems.set(t.elementData.element,a),this.updateVisibilityCounts(),this.requestUpdate()}},{signal:e}),I.instance.addEventListener("elementUnregistered",t=>{this.elementListItems.delete(t.elementData.element),this.updateVisibilityCounts(),this.elementListItems.size||(this.noContentMessage="No Elements Registered To The Foresight Manager"),this.requestUpdate(),this.activeCallbacks.delete(t.elementData.element)},{signal:e}),I.instance.addEventListener("callbackInvoked",t=>{this.activeCallbacks.add(t.elementData.element),this.requestUpdate()},{signal:e}),I.instance.addEventListener("callbackCompleted",t=>{this.handleCallbackCompleted(t.hitType),this.activeCallbacks.delete(t.elementData.element)},{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this._abortController=null}updateElementListFromManager(){let e=new Map;I.instance.registeredElements.forEach((t,o)=>{e.set(o,{...t,elementId:this.generateElementId()})}),this.elementListItems=e}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,o)=>t.isIntersectingWithViewport!==o.isIntersectingWithViewport?t.isIntersectingWithViewport?-1:1:this.sortByDocumentPosition(t,o));default:return this.sortOrder,e}}render(){return
|
|
700
|
+
`],i([A()],f.prototype,"elementData",2),i([A()],f.prototype,"isActive",2),i([A()],f.prototype,"isExpanded",2),i([A()],f.prototype,"onToggle",2),f=i([ct("single-element")],f);import{ForesightManager as I}from"js.foresight";var c=class extends gt{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.visibleElementsCount=0;this.totalElementsCount=0;this.elementListItems=new Map;this.noContentMessage="No Elements Registered To The Foresight Manager";this.activeCallbacks=new Set;this.expandedElementIds=new Set;this.elementIdCounter=0;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 o=e.element.compareDocumentPosition(t.element);return o&Node.DOCUMENT_POSITION_FOLLOWING?-1:o&Node.DOCUMENT_POSITION_PRECEDING?1:0};this.sortOrder=l.instance.devtoolsSettings.sortElementList,this.sortDropdown=[{value:"visibility",label:"Visibility",title:"Sort by Visibility",icon:pe},{value:"documentOrder",label:"Document Order",title:"Sort by Document Order",icon:ge},{value:"insertionOrder",label:"Insertion Order",title:"Sort by Insertion Order",icon:he}]}generateElementId(){return(++this.elementIdCounter).toString()}updateVisibilityCounts(){let e=0,t=0;this.elementListItems.forEach(o=>{t++,o.isIntersectingWithViewport&&e++}),this.visibleElementsCount=e,this.totalElementsCount=t,this.dispatchEvent(new CustomEvent("visibility-count-updated",{detail:{visibleCount:e,totalCount:t},bubbles:!0,composed:!0}))}_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(`
|
|
701
|
+
`)}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;this.updateElementListFromManager(),this.updateVisibilityCounts(),I.instance.addEventListener("elementRegistered",t=>{let o={...t.elementData,elementId:this.generateElementId()};this.elementListItems.set(t.elementData.element,o),this.updateVisibilityCounts()},{signal:e}),I.instance.addEventListener("elementDataUpdated",t=>{let o=this.elementListItems.get(t.elementData.element);if(o){let a={...t.elementData,elementId:o.elementId};this.elementListItems.set(t.elementData.element,a),this.updateVisibilityCounts(),this.requestUpdate()}},{signal:e}),I.instance.addEventListener("elementUnregistered",t=>{this.elementListItems.delete(t.elementData.element),this.updateVisibilityCounts(),this.elementListItems.size||(this.noContentMessage="No Elements Registered To The Foresight Manager"),this.requestUpdate(),this.activeCallbacks.delete(t.elementData.element)},{signal:e}),I.instance.addEventListener("callbackInvoked",t=>{this.activeCallbacks.add(t.elementData.element),this.requestUpdate()},{signal:e}),I.instance.addEventListener("callbackCompleted",t=>{this.handleCallbackCompleted(t.hitType),this.activeCallbacks.delete(t.elementData.element)},{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this._abortController=null}updateElementListFromManager(){let e=new Map;I.instance.registeredElements.forEach((t,o)=>{e.set(o,{...t,elementId:this.generateElementId()})}),this.elementListItems=e}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,o)=>t.isIntersectingWithViewport!==o.isIntersectingWithViewport?t.isIntersectingWithViewport?-1:1:this.sortByDocumentPosition(t,o));default:return this.sortOrder,e}}render(){return we`
|
|
702
702
|
<tab-header>
|
|
703
703
|
<div slot="chips" class="chips-container">
|
|
704
704
|
<chip-element title="Number of visible registered elements / total registered elements">
|
|
@@ -720,7 +720,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
720
720
|
.noContentMessage=${this.noContentMessage}
|
|
721
721
|
.hasContent=${!!this.elementListItems.size}
|
|
722
722
|
>
|
|
723
|
-
${
|
|
723
|
+
${mt(this.getSortedElements(),e=>we`
|
|
724
724
|
<single-element
|
|
725
725
|
.elementData=${e}
|
|
726
726
|
.isActive=${this.activeCallbacks.has(e.element)}
|
|
@@ -729,7 +729,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
729
729
|
></single-element>
|
|
730
730
|
`)}
|
|
731
731
|
</tab-content>
|
|
732
|
-
`}};c.styles=
|
|
732
|
+
`}};c.styles=pt`
|
|
733
733
|
:host {
|
|
734
734
|
display: flex;
|
|
735
735
|
flex-direction: column;
|
|
@@ -784,9 +784,9 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
784
784
|
color: #fff;
|
|
785
785
|
font-weight: 600;
|
|
786
786
|
}
|
|
787
|
-
`,i([
|
|
787
|
+
`,i([y()],c.prototype,"hitCount",2),i([y()],c.prototype,"visibleElementsCount",2),i([y()],c.prototype,"totalElementsCount",2),i([y()],c.prototype,"sortDropdown",2),i([y()],c.prototype,"sortOrder",2),i([y()],c.prototype,"elementListItems",2),i([y()],c.prototype,"noContentMessage",2),i([y()],c.prototype,"activeCallbacks",2),i([y()],c.prototype,"expandedElementIds",2),c=i([ht("element-tab")],c);import{css as ut,html as ke,LitElement as bt}from"lit";import{customElement as vt,property as ft}from"lit/decorators.js";var U=class extends bt{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 ke`
|
|
788
788
|
<div class="tab-selector-wrapper">
|
|
789
|
-
${this.tabs.map(e=>
|
|
789
|
+
${this.tabs.map(e=>ke`
|
|
790
790
|
<button
|
|
791
791
|
class="tab-button ${this.activeTab===e?"active":""}"
|
|
792
792
|
@click="${()=>this._handleTabClick(e)}"
|
|
@@ -796,7 +796,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
796
796
|
</button>
|
|
797
797
|
`)}
|
|
798
798
|
</div>
|
|
799
|
-
`}};
|
|
799
|
+
`}};U.styles=ut`
|
|
800
800
|
.tab-selector-wrapper {
|
|
801
801
|
border-bottom: 2px solid #444;
|
|
802
802
|
margin-top: 12px;
|
|
@@ -827,7 +827,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
827
827
|
color: #b0c4de;
|
|
828
828
|
border-bottom-color: #b0c4de;
|
|
829
829
|
}
|
|
830
|
-
`,i([
|
|
830
|
+
`,i([ft({type:String})],U.prototype,"activeTab",2),U=i([vt("tab-selector")],U);import{ForesightManager as X}from"js.foresight";import{LitElement as Mt,css as Dt,html as H}from"lit";import{customElement as _t,property as Lt,state as P}from"lit/decorators.js";import{map as $t}from"lit/directives/map.js";function Ce(n,s){try{switch(n.type){case"elementRegistered":return{type:"elementRegistered",name:n.elementData.name,id:n.elementData.element.id||"",registerCount:n.elementData.registerCount,hitslop:n.elementData.elementBounds.hitSlop,localizedTimestamp:new Date(n.timestamp).toLocaleTimeString(),logId:s,summary:n.elementData.registerCount===1?n.elementData.name:`${n.elementData.name} - ${xt(n.elementData.registerCount)} time`};case"elementUnregistered":return{type:"elementUnregistered",name:n.elementData.name,id:n.elementData.element.id||"",registerCount:n.elementData.registerCount,unregisterReason:n.unregisterReason,localizedTimestamp:new Date(n.timestamp).toLocaleTimeString(),logId:s,summary:`${n.elementData.name} - ${n.unregisterReason}`};case"elementDataUpdated":return{type:"elementDataUpdated",name:n.elementData.name,updatedProps:n.updatedProps||[],isIntersecting:n.elementData.isIntersectingWithViewport,localizedTimestamp:new Date().toLocaleTimeString(),logId:s,summary:`${n.elementData.name} - ${n.updatedProps.toString()}`};case"callbackInvoked":return{type:"callbackInvoked",name:n.elementData.name,hitType:n.hitType,localizedTimestamp:new Date(n.timestamp).toLocaleTimeString(),logId:s,summary:`${n.elementData.name} - ${n.hitType.kind}`};case"callbackCompleted":{let e=yt(n.elapsed);return{type:"callbackCompleted",...n.status==="error"?{status:"error",errorMessage:n.errorMessage}:{status:"success"},name:n.elementData.name,hitType:n.hitType,callbackRunTimeFormatted:e,callbackRunTimeRaw:n.elapsed,localizedTimestamp:new Date(n.timestamp).toLocaleTimeString(),logId:s,summary:`${n.elementData.name} - ${e}`}}case"mouseTrajectoryUpdate":return{type:"mouseTrajectoryUpdate",currentPoint:n.trajectoryPositions?.currentPoint,predictedPoint:n.trajectoryPositions?.predictedPoint,positionCount:n.trajectoryPositions?.positions?.length||0,mousePredictionEnabled:n.predictionEnabled,localizedTimestamp:new Date().toLocaleTimeString(),logId:s,summary:""};case"scrollTrajectoryUpdate":return{type:"scrollTrajectoryUpdate",currentPoint:n.currentPoint,predictedPoint:n.predictedPoint,scrollDirection:n.scrollDirection,localizedTimestamp:new Date().toLocaleTimeString(),logId:s,summary:n.scrollDirection};case"managerSettingsChanged":return{type:"managerSettingsChanged",globalSettings:n.managerData?.globalSettings||{},settingsChanged:n.updatedSettings,localizedTimestamp:new Date(n.timestamp).toLocaleTimeString(),logId:s,summary:n.updatedSettings.map(e=>e.setting).join(", ")};default:return{type:"serializationError",error:"Failed to serialize event data",errorMessage:JSON.stringify(n),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 yt(n){return`${(n/1e3).toFixed(4)} s`}function xt(n){let s=["th","st","nd","rd"],e=n%100;return n+(s[(e-20)%10]||s[e]||s[0])}import{html as Ee,css as wt}from"lit";import{customElement as kt,property as Se}from"lit/decorators.js";var D=class extends M{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 o=!t;this.onSelectionChange?.(e.value,o)}_getTriggerIcon(){return m}_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 Ee`
|
|
831
831
|
<div class="dropdown-container">
|
|
832
832
|
<button
|
|
833
833
|
class="${e}"
|
|
@@ -854,7 +854,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
854
854
|
</button>
|
|
855
855
|
|
|
856
856
|
<div class="${t}" id="dropdown-menu" role="menu">
|
|
857
|
-
${this.dropdownOptions.map(o=>
|
|
857
|
+
${this.dropdownOptions.map(o=>Ee`
|
|
858
858
|
<button
|
|
859
859
|
value="${o.value}"
|
|
860
860
|
title="${o.title}"
|
|
@@ -867,7 +867,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
867
867
|
`)}
|
|
868
868
|
</div>
|
|
869
869
|
</div>
|
|
870
|
-
`}};
|
|
870
|
+
`}};D.styles=[...M.styles,wt`
|
|
871
871
|
.dropdown-menu button.active::after {
|
|
872
872
|
content: "✓";
|
|
873
873
|
position: absolute;
|
|
@@ -883,7 +883,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
883
883
|
color: #b0c4de;
|
|
884
884
|
margin-left: 2px;
|
|
885
885
|
}
|
|
886
|
-
`],i([
|
|
886
|
+
`],i([Se({type:Array})],D.prototype,"selectedValues",2),i([Se()],D.prototype,"onSelectionChange",2),D=i([kt("multi-select-dropdown")],D);import{LitElement as Ct,html as Et,css as St}from"lit";import{customElement as Tt,property as J}from"lit/decorators.js";var C=class extends Ct{constructor(e){super();this.isExpanded=!1;this.log=e}updated(e){if(e.has("log")&&this.log){let t=this.log,o=t.type==="callbackCompleted"&&"status"in t&&t.status==="error",a=o?"#f44336":this.getLogTypeColor(t.type),r=o?"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,...o}=e;return JSON.stringify(o,null,2)}getLogTypeColor(e){return{elementRegistered:"#2196f3",callbackInvoked:"#00bcd4",callbackCompleted:"#4caf50",elementDataUpdated:"#ffc107",elementUnregistered:"#ff9800",managerSettingsChanged:"#f44336",mouseTrajectoryUpdate:"#78909c",scrollTrajectoryUpdate:"#607d8b"}[e]||"#555"}getEventDisplayName(e){return{elementRegistered:"Registered",elementUnregistered:"Unregistered",elementDataUpdated:"Data Updated",callbackInvoked:"Invoked",callbackCompleted:"Completed",mouseTrajectoryUpdate:"Mouse",scrollTrajectoryUpdate:"Scroll",managerSettingsChanged:"Settings"}[e]||e}truncateLogSummary(e,t=50){return e.length<=t?e:e.substring(0,t)+"..."}render(){let e=this.log,o=e.type==="callbackCompleted"&&"status"in e&&e.status==="error"?"#f44336":this.getLogTypeColor(e.type);return Et`
|
|
887
887
|
<expandable-item
|
|
888
888
|
.borderColor=${o}
|
|
889
889
|
.itemId=${e.logId}
|
|
@@ -899,7 +899,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
899
899
|
</div>
|
|
900
900
|
<div slot="details">${this.serializeLogDataWithoutSummary(e)}</div>
|
|
901
901
|
</expandable-item>
|
|
902
|
-
`}};
|
|
902
|
+
`}};C.styles=[St`
|
|
903
903
|
:host {
|
|
904
904
|
display: block;
|
|
905
905
|
/*
|
|
@@ -963,7 +963,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
963
963
|
* as all styling is now handled by setting CSS variables below.
|
|
964
964
|
* This makes the component's styling more self-contained.
|
|
965
965
|
*/
|
|
966
|
-
`],i([J({attribute:!1})],
|
|
966
|
+
`],i([J({attribute:!1})],C.prototype,"log",2),i([J({type:Boolean})],C.prototype,"isExpanded",2),i([J()],C.prototype,"onToggle",2),C=i([Tt("single-log")],C);var h=class extends Mt{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:le},{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:de}],this.filterDropdown=[{value:"elementRegistered",label:"Element Registered",title:"Show element registration events",icon:m},{value:"elementUnregistered",label:"Element Unregistered",title:"Show element unregistration events",icon:m},{value:"elementDataUpdated",label:"Element Data Updated",title:"Show element data update events",icon:m},{value:"callbackInvoked",label:"Callback Invoked",title:"Show callback invoked events",icon:m},{value:"callbackCompleted",label:"Callback Completed",title:"Show callback completed events",icon:m},{value:"mouseTrajectoryUpdate",label:"Mouse Trajectory Update",title:"Show mouse trajectory update events",icon:m},{value:"scrollTrajectoryUpdate",label:"Scroll Trajectory Update",title:"Show scroll trajectory update events",icon:m},{value:"managerSettingsChanged",label:"Manager Settings Changed",title:"Show manager settings change events",icon:m}]}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=o=>{this.handleEvent(e,o)};this._eventListeners.set(e,t),X.instance.addEventListener(e,t,{signal:this._abortController?.signal})}removeForesightEventListener(e){let t=this._eventListeners.get(e);t&&(X.instance.removeEventListener(e,t),this._eventListeners.delete(e))}removeAllEventListeners(){this._eventListeners.forEach((e,t)=>{X.instance.removeEventListener(t,e)}),this._eventListeners.clear()}getEventColor(e){return{elementRegistered:"#2196f3",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 o=this.getEventColor(e);console.log(`%c[ForesightJS] ${e}`,`color: ${o}; font-weight: bold;`,t)}(this.logLocation==="controlPanel"||this.logLocation==="both")&&this.addEventLog(t)}}addEventLog(e){let t=Ce(e,(++this.logIdCounter).toString());if(t.type==="serializationError"){console.error(t.error,t.errorMessage);return}this.logs.unshift(t),this.logs.length>this.MAX_LOGS&&this.logs.pop(),this.requestUpdate()}render(){return H`
|
|
967
967
|
<tab-header>
|
|
968
968
|
<div slot="chips" class="chips-container">
|
|
969
969
|
<chip-element title="Number of logged events (Max ${this.MAX_LOGS})">
|
|
@@ -977,7 +977,7 @@ var $e=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var i=(n,s,e
|
|
|
977
977
|
title="Console logging can be slow with frequent trajectory events.
|
|
978
978
|
Consider using 'Control Panel' only for better performance."
|
|
979
979
|
>
|
|
980
|
-
${
|
|
980
|
+
${ve}
|
|
981
981
|
</div>
|
|
982
982
|
`:""}
|
|
983
983
|
<single-select-dropdown
|
|
@@ -997,12 +997,12 @@ Consider using 'Control Panel' only for better performance."
|
|
|
997
997
|
?disabled="${this.logs.length===0}"
|
|
998
998
|
@click="${this.clearLogs}"
|
|
999
999
|
>
|
|
1000
|
-
${
|
|
1000
|
+
${me}
|
|
1001
1001
|
</button>
|
|
1002
1002
|
</div>
|
|
1003
1003
|
</tab-header>
|
|
1004
1004
|
<tab-content .noContentMessage=${this.noContentMessage} .hasContent=${!!this.logs.length}>
|
|
1005
|
-
${this.logs.length===0?H`<div class="no-items">${this.getNoLogsMessage()}</div
|
|
1005
|
+
${this.logs.length===0?H`<div class="no-items">${this.getNoLogsMessage()}</div>`:$t(this.logs,e=>H`
|
|
1006
1006
|
<single-log
|
|
1007
1007
|
.log=${e}
|
|
1008
1008
|
.isExpanded=${this.expandedLogIds.has(e.logId)}
|
|
@@ -1010,7 +1010,7 @@ Consider using 'Control Panel' only for better performance."
|
|
|
1010
1010
|
></single-log>
|
|
1011
1011
|
`)}
|
|
1012
1012
|
</tab-content>
|
|
1013
|
-
`}};h.styles=[
|
|
1013
|
+
`}};h.styles=[Dt`
|
|
1014
1014
|
:host {
|
|
1015
1015
|
display: flex;
|
|
1016
1016
|
flex-direction: column;
|
|
@@ -1103,7 +1103,7 @@ Consider using 'Control Panel' only for better performance."
|
|
|
1103
1103
|
.warning-container:hover svg {
|
|
1104
1104
|
stroke: #ffdc3e;
|
|
1105
1105
|
}
|
|
1106
|
-
`],i([
|
|
1106
|
+
`],i([P()],h.prototype,"logDropdown",2),i([P()],h.prototype,"filterDropdown",2),i([P()],h.prototype,"logLocation",2),i([P()],h.prototype,"eventsEnabled",2),i([P()],h.prototype,"logs",2),i([P()],h.prototype,"expandedLogIds",2),i([Lt()],h.prototype,"noContentMessage",2),h=i([_t("log-tab")],h);import{ForesightManager as Le}from"js.foresight";import{css as ti,html as $e,LitElement as ii}from"lit";import{customElement as oi,state as G}from"lit/decorators.js";var Z="points",Te="px",Me="tabs",De="ms";import{LitElement as Nt,html as jt,css as Vt}from"lit";import{customElement as Ft,property as B}from"lit/decorators.js";import{LitElement as Ot,html as It,css as Ut}from"lit";import{customElement as Pt,property as _e}from"lit/decorators.js";var _=class extends Ot{constructor(){super(...arguments);this.header="";this.description=""}render(){return It`<div class="setting-item">
|
|
1107
1107
|
<label>
|
|
1108
1108
|
<span class="setting-header">${this.header}</span>
|
|
1109
1109
|
<span class="setting-description"> ${this.description} </span>
|
|
@@ -1111,7 +1111,7 @@ Consider using 'Control Panel' only for better performance."
|
|
|
1111
1111
|
<div class="setting-controls">
|
|
1112
1112
|
<slot name="controls"></slot>
|
|
1113
1113
|
</div>
|
|
1114
|
-
</div>`}};
|
|
1114
|
+
</div>`}};_.styles=[Ut`
|
|
1115
1115
|
.setting-item {
|
|
1116
1116
|
display: flex;
|
|
1117
1117
|
align-items: center;
|
|
@@ -1151,14 +1151,14 @@ Consider using 'Control Panel' only for better performance."
|
|
|
1151
1151
|
color: #fff;
|
|
1152
1152
|
font-size: 13px;
|
|
1153
1153
|
}
|
|
1154
|
-
`],i([
|
|
1154
|
+
`],i([_e({type:String})],_.prototype,"header",2),i([_e({type:String})],_.prototype,"description",2),_=i([Pt("setting-item")],_);import{ForesightManager as zt}from"js.foresight";var x=class extends Nt{constructor(){super(...arguments);this.isChecked=!1;this.header="";this.description="";this.setting="enableMousePrediction"}handleCheckboxChange(e){let t=e.target;if(t instanceof HTMLInputElement){let o=t.checked;this.setting==="showNameTags"?this.dispatchEvent(new CustomEvent("setting-changed",{detail:{setting:this.setting,value:o},bubbles:!0})):zt.instance.alterGlobalSettings({[this.setting]:o})}}render(){return jt`<setting-item header=${this.header} description=${this.description}>
|
|
1155
1155
|
<input
|
|
1156
1156
|
slot="controls"
|
|
1157
1157
|
type="checkbox"
|
|
1158
1158
|
.checked=${this.isChecked}
|
|
1159
1159
|
@change=${this.handleCheckboxChange}
|
|
1160
1160
|
/>
|
|
1161
|
-
</setting-item>`}};x.styles=[
|
|
1161
|
+
</setting-item>`}};x.styles=[Vt`
|
|
1162
1162
|
input[type="checkbox"] {
|
|
1163
1163
|
appearance: none;
|
|
1164
1164
|
-webkit-appearance: none;
|
|
@@ -1201,7 +1201,7 @@ Consider using 'Control Panel' only for better performance."
|
|
|
1201
1201
|
input[type="checkbox"]:hover {
|
|
1202
1202
|
box-shadow: 0 0 0 3px rgba(176, 196, 222, 0.1);
|
|
1203
1203
|
}
|
|
1204
|
-
`],i([B({type:Boolean})],x.prototype,"isChecked",2),i([B({type:String})],x.prototype,"header",2),i([B({type:String})],x.prototype,"description",2),i([B({type:String})],x.prototype,"setting",2),x=i([
|
|
1204
|
+
`],i([B({type:Boolean})],x.prototype,"isChecked",2),i([B({type:String})],x.prototype,"header",2),i([B({type:String})],x.prototype,"description",2),i([B({type:String})],x.prototype,"setting",2),x=i([Ft("setting-item-checkbox")],x);import{LitElement as Rt,html as At,css as Ht}from"lit";import{customElement as Bt,property as L,state as Gt}from"lit/decorators.js";import{ForesightManager as qt}from"js.foresight";var p=class extends Rt{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 o=parseInt(t.value,10);this.displayValue=o,qt.instance.alterGlobalSettings({[this.setting]:o})}}willUpdate(e){super.willUpdate(e),e.has("currentValue")&&(this.displayValue=this.currentValue)}render(){return At`<setting-item header=${this.header} description=${this.description}>
|
|
1205
1205
|
<div slot="controls" class="range-wrapper">
|
|
1206
1206
|
<input
|
|
1207
1207
|
slot="controls"
|
|
@@ -1215,7 +1215,7 @@ Consider using 'Control Panel' only for better performance."
|
|
|
1215
1215
|
/>
|
|
1216
1216
|
<span class="setting-range-value">${this.displayValue} ${this.unit}</span>
|
|
1217
1217
|
</div>
|
|
1218
|
-
</setting-item>`}};p.styles=[
|
|
1218
|
+
</setting-item>`}};p.styles=[Ht`
|
|
1219
1219
|
.setting-range-value {
|
|
1220
1220
|
font-size: 12px;
|
|
1221
1221
|
color: #b0c4de;
|
|
@@ -1284,14 +1284,14 @@ Consider using 'Control Panel' only for better performance."
|
|
|
1284
1284
|
transform: scale(1.1);
|
|
1285
1285
|
box-shadow: 0 0 0 4px rgba(176, 196, 222, 0.2);
|
|
1286
1286
|
}
|
|
1287
|
-
`],i([L({type:Number})],p.prototype,"minValue",2),i([L({type:Number})],p.prototype,"maxValue",2),i([L({type:Number})],p.prototype,"currentValue",2),i([L({type:String})],p.prototype,"unit",2),i([L({type:String})],p.prototype,"header",2),i([L({type:String})],p.prototype,"description",2),i([L({type:String})],p.prototype,"setting",2),i([
|
|
1287
|
+
`],i([L({type:Number})],p.prototype,"minValue",2),i([L({type:Number})],p.prototype,"maxValue",2),i([L({type:Number})],p.prototype,"currentValue",2),i([L({type:String})],p.prototype,"unit",2),i([L({type:String})],p.prototype,"header",2),i([L({type:String})],p.prototype,"description",2),i([L({type:String})],p.prototype,"setting",2),i([Gt()],p.prototype,"displayValue",2),p=i([Bt("setting-item-range")],p);var w=class extends ii{constructor(){super();this.changedSettings=[];this._abortController=null;let e=l.instance.devtoolsSettings,t=Le.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;Le.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 o of t){let a=this.initialSettings.manager[o],r=this.managerSettings[o];a!==r&&e.push({setting:o,oldValue:a,newValue:r})}}_checkDevtoolsSettingsChanges(e){let t=["showNameTags"];for(let o of t){let a=this.initialSettings.devtools[o],r=this.devtoolsSettings[o];a!==r&&e.push({setting:o,oldValue:a,newValue:r})}}_handleDevtoolsSettingChange(e){let{setting:t,value:o}=e.detail;t==="showNameTags"&&(this.devtoolsSettings={...this.devtoolsSettings,showNameTags:o},l.instance.alterDevtoolsSettings({showNameTags:o}),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 $e`<tab-content
|
|
1288
1288
|
.noContentMessage=${"Loading settings..."}
|
|
1289
1289
|
.hasContent=${!1}
|
|
1290
1290
|
></tab-content>`;let e=this.managerSettings,t=this.changedSettings.length>0?`Settings that have been changed this session compared to your initialized settings.
|
|
1291
1291
|
Click on the copy icon to easely copy the new setting into your project
|
|
1292
1292
|
|
|
1293
1293
|
`+this.changedSettings.map(o=>`${o.setting}: ${JSON.stringify(o.oldValue)} -> ${JSON.stringify(o.newValue)}`).join(`
|
|
1294
|
-
`):"No settings changed from initial values";return
|
|
1294
|
+
`):"No settings changed from initial values";return $e`
|
|
1295
1295
|
<tab-header>
|
|
1296
1296
|
<div slot="chips" class="chips-container">
|
|
1297
1297
|
<chip-element .title=${t}> ${this.changedSettings.length} changed </chip-element>
|
|
@@ -1319,7 +1319,7 @@ Click on the copy icon to easely copy the new setting into your project
|
|
|
1319
1319
|
.currentValue=${e.trajectoryPredictionTime}
|
|
1320
1320
|
.maxValue=${200}
|
|
1321
1321
|
.minValue=${10}
|
|
1322
|
-
.unit=${
|
|
1322
|
+
.unit=${De}
|
|
1323
1323
|
header="Prediction Time"
|
|
1324
1324
|
description="How far into the future to calculate mouse trajectory path"
|
|
1325
1325
|
setting="trajectoryPredictionTime"
|
|
@@ -1348,7 +1348,7 @@ Click on the copy icon to easely copy the new setting into your project
|
|
|
1348
1348
|
.currentValue=${e.tabOffset}
|
|
1349
1349
|
.maxValue=${20}
|
|
1350
1350
|
.minValue=${0}
|
|
1351
|
-
.unit=${
|
|
1351
|
+
.unit=${Me}
|
|
1352
1352
|
header="Tab Offset"
|
|
1353
1353
|
description="Number of tabbable elements to look ahead when predicting navigation"
|
|
1354
1354
|
setting="tabOffset"
|
|
@@ -1368,7 +1368,7 @@ Click on the copy icon to easely copy the new setting into your project
|
|
|
1368
1368
|
.currentValue=${e.scrollMargin}
|
|
1369
1369
|
.maxValue=${300}
|
|
1370
1370
|
.minValue=${30}
|
|
1371
|
-
.unit=${
|
|
1371
|
+
.unit=${Te}
|
|
1372
1372
|
header="Scroll Margin"
|
|
1373
1373
|
description="Pixel distance to check from mouse position in scroll direction"
|
|
1374
1374
|
setting="scrollMargin"
|
|
@@ -1389,7 +1389,7 @@ Click on the copy icon to easely copy the new setting into your project
|
|
|
1389
1389
|
</div>
|
|
1390
1390
|
</div>
|
|
1391
1391
|
</tab-content>
|
|
1392
|
-
`}};w.styles=
|
|
1392
|
+
`}};w.styles=ti`
|
|
1393
1393
|
:host {
|
|
1394
1394
|
display: flex;
|
|
1395
1395
|
flex-direction: column;
|
|
@@ -1420,7 +1420,7 @@ Click on the copy icon to easely copy the new setting into your project
|
|
|
1420
1420
|
border-bottom: 1px solid rgba(176, 196, 222, 0.2);
|
|
1421
1421
|
padding-bottom: 8px;
|
|
1422
1422
|
}
|
|
1423
|
-
`,i([G()],w.prototype,"managerSettings",2),i([G()],w.prototype,"initialSettings",2),i([G()],w.prototype,"devtoolsSettings",2),i([G()],w.prototype,"changedSettings",2),w=i([
|
|
1423
|
+
`,i([G()],w.prototype,"managerSettings",2),i([G()],w.prototype,"initialSettings",2),i([G()],w.prototype,"devtoolsSettings",2),i([G()],w.prototype,"changedSettings",2),w=i([oi("settings-tab")],w);var b=class extends ni{constructor(){super();this.isMinimized=!1;this.visibleCount=0;this.totalCount=0;this.localStorageSelectedTabKey="foresight-devtools-control-panel-tab";this._handleVisibilityCountChange=e=>{let t=e;this.visibleCount=t.detail.visibleCount,this.totalCount=t.detail.totalCount};let e=localStorage.getItem(this.localStorageSelectedTabKey);this.activeTab=e||"logs"}_handleTabChange(e){this.activeTab=e.detail.tab,localStorage.setItem(this.localStorageSelectedTabKey,this.activeTab)}connectedCallback(){super.connectedCallback(),this.addEventListener("visibility-count-updated",this._handleVisibilityCountChange)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("visibility-count-updated",this._handleVisibilityCountChange)}render(){return ai`
|
|
1424
1424
|
<div class="control-wrapper ${this.isMinimized?"minimized":""}">
|
|
1425
1425
|
<div class="title-wrapper">
|
|
1426
1426
|
<button @click="${()=>this.isMinimized=!this.isMinimized}" class="minimize-button">
|
|
@@ -1449,7 +1449,7 @@ Click on the copy icon to easely copy the new setting into your project
|
|
|
1449
1449
|
</div>
|
|
1450
1450
|
</div>
|
|
1451
1451
|
</div>
|
|
1452
|
-
`}};b.styles=
|
|
1452
|
+
`}};b.styles=si`
|
|
1453
1453
|
.control-wrapper {
|
|
1454
1454
|
padding: 12px;
|
|
1455
1455
|
position: fixed;
|
|
@@ -1531,7 +1531,14 @@ Click on the copy icon to easely copy the new setting into your project
|
|
|
1531
1531
|
width: 100%;
|
|
1532
1532
|
height: 100%;
|
|
1533
1533
|
}
|
|
1534
|
-
`,i([
|
|
1534
|
+
`,i([q()],b.prototype,"activeTab",2),i([q()],b.prototype,"isMinimized",2),i([q()],b.prototype,"visibleCount",2),i([q()],b.prototype,"totalCount",2),b=i([ri("control-panel")],b);customElements.get("control-panel")||customElements.define("control-panel",b);import{LitElement as ki,css as Ci,html as Ei}from"lit";import{customElement as Si}from"lit/decorators.js";import{LitElement as li,html as ee,css as di}from"lit";import{customElement as ci,state as te}from"lit/decorators.js";import{styleMap as Oe}from"lit/directives/style-map.js";import{map as pi}from"lit/directives/map.js";import{ForesightManager as F}from"js.foresight";var E=class extends li{constructor(){super(...arguments);this.overlayDataMap=new Map;this.callbackAnimations=new Map;this.showNameTags=!1;this._abortController=null}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let{signal:e}=this._abortController;F.instance.addEventListener("elementRegistered",t=>{t.elementData.isIntersectingWithViewport&&this.createOrUpdateElementOverlay(t.elementData)},{signal:e}),F.instance.addEventListener("elementUnregistered",t=>{this.removeElementOverlay(t.elementData)},{signal:e}),F.instance.addEventListener("elementDataUpdated",t=>{t.updatedProps.includes("bounds")&&this.createOrUpdateElementOverlay(t.elementData),t.updatedProps.includes("visibility")&&(t.elementData.isIntersectingWithViewport||this.removeElementOverlay(t.elementData))},{signal:e}),F.instance.addEventListener("callbackInvoked",t=>{this.highlightElementCallback(t.elementData,t.hitType)},{signal:e}),F.instance.addEventListener("callbackCompleted",t=>{this.unhighlightElementCallback(t.elementData)},{signal:e}),document.addEventListener("showNameTagsChanged",t=>{let o=t;this.updateNameTagVisibility(o.detail.showNameTags)},{signal:e})}createOrUpdateElementOverlay(e){let{expandedRect:t}=e.elementBounds,o=t.right-t.left,a=t.bottom-t.top,r={elementData:e,expandedStyles:{width:`${o}px`,height:`${a}px`,transform:`translate3d(${t.left}px, ${t.top}px, 0)`},nameLabelStyles:{transform:`translate3d(${t.left}px, ${t.top-25}px, 0)`,display:this.showNameTags?"block":"none"},callbackClasses:[],showNameTag:this.showNameTags};this.overlayDataMap.set(e.element,r),this.requestUpdate()}removeElementOverlay(e){this.overlayDataMap.delete(e.element),this.clearCallbackAnimationTimeout(e.element),this.requestUpdate()}clearCallbackAnimationTimeout(e){let t=this.callbackAnimations.get(e);t&&(clearTimeout(t.timeoutId),this.callbackAnimations.delete(e))}highlightElementCallback(e,t){let o=this.overlayDataMap.get(e.element);if(o){this.clearCallbackAnimationTimeout(e.element);let a=`invoked-by-${t.kind}`;o.callbackClasses.includes(a)||o.callbackClasses.push(a),this.requestUpdate()}}unhighlightElementCallback(e){let t=this.overlayDataMap.get(e.element);if(t){let o=setTimeout(()=>{t.callbackClasses=[],this.callbackAnimations.delete(e.element),this.requestUpdate()},400);this.callbackAnimations.set(e.element,{element:e.element,timeoutId:o})}}updateNameTagVisibility(e){this.showNameTags=e,this.overlayDataMap.forEach(t=>{t.showNameTag=e,t.nameLabelStyles.display=e?"block":"none"}),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this._abortController=null,this.overlayDataMap.clear(),this.callbackAnimations.forEach(e=>clearTimeout(e.timeoutId)),this.callbackAnimations.clear()}render(){return ee`
|
|
1535
|
+
${pi(this.overlayDataMap.values(),e=>{let{elementData:t,expandedStyles:o,nameLabelStyles:a,callbackClasses:r,showNameTag:N}=e,oe=["expanded-overlay",...r].join(" ");return ee`
|
|
1536
|
+
<div class="${oe}" style=${Oe(o)}></div>
|
|
1537
|
+
${N?ee`
|
|
1538
|
+
<div class="name-label" style=${Oe(a)}>${t.name}</div>
|
|
1539
|
+
`:""}
|
|
1540
|
+
`})}
|
|
1541
|
+
`}};E.styles=[di`
|
|
1535
1542
|
:host {
|
|
1536
1543
|
position: fixed;
|
|
1537
1544
|
top: 0;
|
|
@@ -1547,9 +1554,7 @@ Click on the copy icon to easely copy the new setting into your project
|
|
|
1547
1554
|
will-change: transform, box-shadow;
|
|
1548
1555
|
border: 1px dashed rgba(100, 116, 139, 0.4);
|
|
1549
1556
|
background-color: rgba(100, 116, 139, 0.05);
|
|
1550
|
-
transition:
|
|
1551
|
-
border-color 0.2s ease,
|
|
1552
|
-
background-color 0.2s ease;
|
|
1557
|
+
transition: border-color 0.2s ease, background-color 0.2s ease;
|
|
1553
1558
|
}
|
|
1554
1559
|
|
|
1555
1560
|
.expanded-overlay.invoked-by-scroll {
|
|
@@ -1600,7 +1605,7 @@ Click on the copy icon to easely copy the new setting into your project
|
|
|
1600
1605
|
white-space: nowrap;
|
|
1601
1606
|
pointer-events: none;
|
|
1602
1607
|
}
|
|
1603
|
-
`],i([
|
|
1608
|
+
`],i([te()],E.prototype,"overlayDataMap",2),i([te()],E.prototype,"callbackAnimations",2),i([te()],E.prototype,"showNameTags",2),E=i([ci("element-overlays")],E);import{LitElement as gi,html as hi,css as mi}from"lit";import{customElement as ui,state as ie}from"lit/decorators.js";import{styleMap as bi}from"lit/directives/style-map.js";import{ForesightManager as W}from"js.foresight";var S=class extends gi{constructor(){super(...arguments);this._abortController=new AbortController;this._mousePredictionIsEnabled=W.instance.getManagerData.globalSettings.enableMousePrediction;this._isVisible=!1;this._trajectoryStyles={};this._isUpdateScheduled=!1;this._latestTrajectory=null;this.handleSettingsChange=e=>{let t=e.managerData.globalSettings.enableMousePrediction;this._mousePredictionIsEnabled=t,t||(this._isVisible=!1)};this.handleTrajectoryUpdate=e=>{this._mousePredictionIsEnabled&&(this._isVisible=!0,this._latestTrajectory=e.trajectoryPositions,this._isUpdateScheduled||(this._isUpdateScheduled=!0,requestAnimationFrame(this.renderTrajectory)))};this.renderTrajectory=()=>{if(!this._latestTrajectory){this._isUpdateScheduled=!1;return}let{currentPoint:e,predictedPoint:t}=this._latestTrajectory,o=t.x-e.x,a=t.y-e.y,r=Math.sqrt(o*o+a*a);if(r===0)this._trajectoryStyles={display:"none"};else{let N=Math.atan2(a,o)*180/Math.PI;this._trajectoryStyles={transform:`translate(${e.x}px, ${e.y}px) rotate(${N}deg)`,width:`${r}px`}}this._isUpdateScheduled=!1,this.requestUpdate()}}connectedCallback(){super.connectedCallback();let{signal:e}=this._abortController;W.instance.addEventListener("mouseTrajectoryUpdate",this.handleTrajectoryUpdate,{signal:e}),W.instance.addEventListener("scrollTrajectoryUpdate",()=>{this._isVisible=!1},{signal:e}),W.instance.addEventListener("managerSettingsChanged",this.handleSettingsChange,{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController.abort()}render(){let e={display:this._isVisible?"block":"none",...this._trajectoryStyles};return hi` <div class="trajectory-line" style=${bi(e)}></div> `}};S.styles=[mi`
|
|
1604
1609
|
:host {
|
|
1605
1610
|
display: block;
|
|
1606
1611
|
}
|
|
@@ -1631,7 +1636,7 @@ Click on the copy icon to easely copy the new setting into your project
|
|
|
1631
1636
|
border-bottom: 4px solid transparent;
|
|
1632
1637
|
filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.6));
|
|
1633
1638
|
}
|
|
1634
|
-
`],i([
|
|
1639
|
+
`],i([ie()],S.prototype,"_mousePredictionIsEnabled",2),i([ie()],S.prototype,"_isVisible",2),i([ie()],S.prototype,"_trajectoryStyles",2),S=i([ui("mouse-trajectory")],S);import{LitElement as vi,html as fi,css as yi}from"lit";import{customElement as xi,state as Y}from"lit/decorators.js";import{styleMap as wi}from"lit/directives/style-map.js";import{ForesightManager as z}from"js.foresight";var k=class extends vi{constructor(){super(...arguments);this._abortController=new AbortController;this._scrollPredictionIsEnabled=z.instance.getManagerData.globalSettings.enableScrollPrediction;this._scrollMargin=z.instance.getManagerData.globalSettings.scrollMargin;this._isVisible=!1;this._trajectoryStyles={};this._isUpdateScheduled=!1;this._latestScrollTrajectory=null;this.handleSettingsChange=e=>{let t=e.managerData.globalSettings.enableScrollPrediction;this._scrollPredictionIsEnabled=t,t||(this._isVisible=!1);let o=e.updatedSettings.find(a=>a.setting==="scrollMargin");o&&(this._scrollMargin=o.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,o=t.x-e.x,a=t.y-e.y,r=Math.atan2(a,o)*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;z.instance.addEventListener("scrollTrajectoryUpdate",this.handleScrollUpdate,{signal:e}),z.instance.addEventListener("mouseTrajectoryUpdate",()=>{this._isVisible=!1},{signal:e}),z.instance.addEventListener("managerSettingsChanged",this.handleSettingsChange,{signal:e})}disconnectedCallback(){super.disconnectedCallback(),this._abortController.abort()}render(){let e={display:this._isVisible?"block":"none",width:`${this._scrollMargin}px`,...this._trajectoryStyles};return fi` <div class="scroll-trajectory-line" style=${wi(e)}></div> `}};k.styles=[yi`
|
|
1635
1640
|
:host {
|
|
1636
1641
|
display: block;
|
|
1637
1642
|
}
|
|
@@ -1691,13 +1696,13 @@ Click on the copy icon to easely copy the new setting into your project
|
|
|
1691
1696
|
filter: drop-shadow(0 0 12px rgba(234, 179, 8, 0.8));
|
|
1692
1697
|
}
|
|
1693
1698
|
}
|
|
1694
|
-
`],i([
|
|
1699
|
+
`],i([Y()],k.prototype,"_scrollPredictionIsEnabled",2),i([Y()],k.prototype,"_scrollMargin",2),i([Y()],k.prototype,"_isVisible",2),i([Y()],k.prototype,"_trajectoryStyles",2),k=i([xi("scroll-trajectory")],k);var R=class extends ki{render(){return Ei`
|
|
1695
1700
|
<div id="overlay-container">
|
|
1696
1701
|
<mouse-trajectory></mouse-trajectory>
|
|
1697
1702
|
<scroll-trajectory></scroll-trajectory>
|
|
1698
1703
|
<element-overlays></element-overlays>
|
|
1699
1704
|
</div>
|
|
1700
|
-
`}};R.styles=[
|
|
1705
|
+
`}};R.styles=[Ci`
|
|
1701
1706
|
:host {
|
|
1702
1707
|
display: block;
|
|
1703
1708
|
}
|
|
@@ -1708,9 +1713,9 @@ Click on the copy icon to easely copy the new setting into your project
|
|
|
1708
1713
|
pointer-events: none;
|
|
1709
1714
|
z-index: 9999;
|
|
1710
1715
|
}
|
|
1711
|
-
`],R=i([
|
|
1716
|
+
`],R=i([Si("debug-overlay")],R);var l=class extends Ti{constructor(){super();this.isInitialized=!1;this.devtoolsSettings={showDebugger:!0,isControlPanelDefaultMinimized:!1,showNameTags:!0,sortElementList:"visibility",logging:{logLocation:"controlPanel",callbackCompleted:!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,e!==void 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}alterDevtoolsSettings(e){e&&(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.shouldUpdateSetting(e.logging.callbackCompleted,this.devtoolsSettings.logging.callbackCompleted)&&(this.devtoolsSettings.logging.callbackCompleted=e.logging.callbackCompleted),this.shouldUpdateSetting(e.logging.callbackInvoked,this.devtoolsSettings.logging.callbackInvoked)&&(this.devtoolsSettings.logging.callbackInvoked=e.logging.callbackInvoked),this.shouldUpdateSetting(e.logging.elementDataUpdated,this.devtoolsSettings.logging.elementDataUpdated)&&(this.devtoolsSettings.logging.elementDataUpdated=e.logging.elementDataUpdated),this.shouldUpdateSetting(e.logging.elementRegistered,this.devtoolsSettings.logging.elementRegistered)&&(this.devtoolsSettings.logging.elementRegistered=e.logging.elementRegistered),this.shouldUpdateSetting(e.logging.elementUnregistered,this.devtoolsSettings.logging.elementUnregistered)&&(this.devtoolsSettings.logging.elementUnregistered=e.logging.elementUnregistered),this.shouldUpdateSetting(e.logging.managerSettingsChanged,this.devtoolsSettings.logging.managerSettingsChanged)&&(this.devtoolsSettings.logging.managerSettingsChanged=e.logging.managerSettingsChanged),this.shouldUpdateSetting(e.logging.mouseTrajectoryUpdate,this.devtoolsSettings.logging.mouseTrajectoryUpdate)&&(this.devtoolsSettings.logging.mouseTrajectoryUpdate=e.logging.mouseTrajectoryUpdate),this.shouldUpdateSetting(e.logging.scrollTrajectoryUpdate,this.devtoolsSettings.logging.scrollTrajectoryUpdate)&&(this.devtoolsSettings.logging.scrollTrajectoryUpdate=e.logging.scrollTrajectoryUpdate)))}cleanup(){this.requestUpdate()}render(){return!this.isInitialized||!this.devtoolsSettings.showDebugger?Ie``:Ie`<control-panel></control-panel> <debug-overlay></debug-overlay>`}};l.styles=[Mi`
|
|
1712
1717
|
:host {
|
|
1713
1718
|
display: block;
|
|
1714
1719
|
}
|
|
1715
|
-
`],l._instance=null,i([_i()],l.prototype,"isInitialized",2),l=i([
|
|
1720
|
+
`],l._instance=null,i([_i()],l.prototype,"isInitialized",2),l=i([Di("foresight-devtools")],l);export{l as ForesightDevtools};
|
|
1716
1721
|
//# sourceMappingURL=index.mjs.map
|