@tacktext/widget 0.1.7 → 0.1.8

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.js CHANGED
@@ -1103,6 +1103,8 @@
1103
1103
 
1104
1104
  .tack-comment-row-resolve.resolved {
1105
1105
  color: #10B981;
1106
+ opacity: 1;
1107
+ pointer-events: auto;
1106
1108
  }
1107
1109
 
1108
1110
  .tack-comment-row-resolve.resolved:hover {
@@ -2272,7 +2274,7 @@
2272
2274
  cursor: ${o.cursor};
2273
2275
  background: transparent;
2274
2276
  touch-action: none;
2275
- `,document.body.appendChild(e),e}function g(o){o&&o.parentNode&&o.parentNode.removeChild(o)}function P(o,e){let i=window.innerHeight-e-20;return Math.max(20,Math.min(o,i))}function R(o,e,t,i,n=5){let a=t-o,r=i-e;return Math.sqrt(a*a+r*r)>n}var fe="tack-panel-side-";function G(){return`${fe}${location.origin}`}function Z(){try{let o=localStorage.getItem(G());if(o==="left"||o==="right")return o}catch{}return"right"}function ee(o){try{localStorage.setItem(G(),o)}catch{}}var ie="tack_panel_filters";function ve(){try{let o=localStorage.getItem(ie);if(o){let e=JSON.parse(o);return{sort:e.sort||"date",showResolved:e.showResolved??!1,onlyYourThreads:e.onlyYourThreads??!1,onlyCurrentPage:e.onlyCurrentPage??!1}}}catch{}return{sort:"date",showResolved:!1,onlyYourThreads:!1,onlyCurrentPage:!1}}function te(o){try{localStorage.setItem(ie,JSON.stringify(o))}catch{}}var H=class{constructor(e,t){this.comments=[];this.searchQuery="";this.searchTimer=null;this.highlightedId=null;this.filterDropdownOpen=!1;this.currentUser=null;this.projectId="";this.dragState="idle";this.dragStartPointer={x:0,y:0};this.dragStartRect=null;this.dragOverlay=null;this.snapHint=null;this.container=e,this.callbacks=t,this.filters=ve(),this.readCommentIds=this.loadReadIds(),this.side=Z(),this.strip=this.createPanelStrip(),this.panel=this.strip.querySelector(".tack-panel"),this.applySide(),this.setupHeaderDrag(),this.container.appendChild(this.strip)}getSide(){return this.side}setUser(e){this.currentUser=e}setProjectId(e){this.projectId=e,this.readCommentIds=this.loadReadIds()}loadReadIds(){try{let e=`tack_read_${this.projectId}`,t=localStorage.getItem(e);if(t)return new Set(JSON.parse(t))}catch{}return new Set}saveReadIds(){try{let e=`tack_read_${this.projectId}`;localStorage.setItem(e,JSON.stringify([...this.readCommentIds]))}catch{}}markAsRead(e){this.readCommentIds.has(e)||(this.readCommentIds.add(e),this.saveReadIds())}markVisibleAsRead(){if(!this.isOpen())return;let e=this.getFilteredComments(),t=!1;for(let i of e)this.readCommentIds.has(i.id)||(this.readCommentIds.add(i.id),t=!0);t&&this.saveReadIds()}isRead(e){return this.readCommentIds.has(e)}createPanelStrip(){let e=document.createElement("div");e.className="tack-panel-strip",e.innerHTML=`
2277
+ `,document.body.appendChild(e),e}function g(o){o&&o.parentNode&&o.parentNode.removeChild(o)}function P(o,e){let i=window.innerHeight-e-20;return Math.max(20,Math.min(o,i))}function R(o,e,t,i,n=5){let a=t-o,r=i-e;return Math.sqrt(a*a+r*r)>n}var fe="tack-panel-side-";function G(){return`${fe}${location.origin}`}function Z(){try{let o=localStorage.getItem(G());if(o==="left"||o==="right")return o}catch{}return"right"}function ee(o){try{localStorage.setItem(G(),o)}catch{}}var ie="tack_panel_filters";function ve(){try{let o=localStorage.getItem(ie);if(o){let e=JSON.parse(o);return{sort:e.sort||"date",showResolved:e.showResolved??!1,onlyYourThreads:e.onlyYourThreads??!1,onlyCurrentPage:e.onlyCurrentPage??!1}}}catch{}return{sort:"date",showResolved:!0,onlyYourThreads:!1,onlyCurrentPage:!1}}function te(o){try{localStorage.setItem(ie,JSON.stringify(o))}catch{}}var H=class{constructor(e,t){this.comments=[];this.searchQuery="";this.searchTimer=null;this.highlightedId=null;this.filterDropdownOpen=!1;this.currentUser=null;this.projectId="";this.dragState="idle";this.dragStartPointer={x:0,y:0};this.dragStartRect=null;this.dragOverlay=null;this.snapHint=null;this.container=e,this.callbacks=t,this.filters=ve(),this.readCommentIds=this.loadReadIds(),this.side=Z(),this.strip=this.createPanelStrip(),this.panel=this.strip.querySelector(".tack-panel"),this.applySide(),this.setupHeaderDrag(),this.container.appendChild(this.strip)}getSide(){return this.side}setUser(e){this.currentUser=e}setProjectId(e){this.projectId=e,this.readCommentIds=this.loadReadIds()}loadReadIds(){try{let e=`tack_read_${this.projectId}`,t=localStorage.getItem(e);if(t)return new Set(JSON.parse(t))}catch{}return new Set}saveReadIds(){try{let e=`tack_read_${this.projectId}`;localStorage.setItem(e,JSON.stringify([...this.readCommentIds]))}catch{}}markAsRead(e){this.readCommentIds.has(e)||(this.readCommentIds.add(e),this.saveReadIds())}markVisibleAsRead(){if(!this.isOpen())return;let e=this.getFilteredComments(),t=!1;for(let i of e)this.readCommentIds.has(i.id)||(this.readCommentIds.add(i.id),t=!0);t&&this.saveReadIds()}isRead(e){return this.readCommentIds.has(e)}createPanelStrip(){let e=document.createElement("div");e.className="tack-panel-strip",e.innerHTML=`
2276
2278
  <div class="tack-panel" role="complementary" aria-label="Comments panel">
2277
2279
  <div class="tack-panel-header">
2278
2280
  <span class="tack-panel-title">Comments</span>