@siteping/widget 0.9.14 → 0.9.15

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/README.md CHANGED
@@ -78,6 +78,7 @@ All configuration options for `initSiteping()`:
78
78
  | `debug` | `boolean` | `false` | Enable debug logging to console |
79
79
  | `identity` | `{ name: string; email: string }` | — | Pre-fill author identity from the host (SSO). When set, the widget skips the identity modal |
80
80
  | `deepLink` | `boolean \| { param?: string }` | `false` | On initial load, focus the annotation referenced by `?siteping=<id>` (or a custom query key). SPA navigations are ignored — use `focusFeedback()` for route-change focus |
81
+ | `watchNavigation` | `boolean` | `true` | Auto re-fetch feedbacks on client-side (SPA) navigation. The widget patches the History API + listens for `popstate`/`hashchange`, so the panel list and markers follow route changes even when the widget is mounted once in a persistent layout (e.g. Next.js App Router). Re-fetches data only — it never re-scrolls. Set `false` to opt out and drive updates via `refresh()` |
81
82
 
82
83
  > **Custom translations** — Use `registerLocale(code, translations)` to add your own locale at runtime.
83
84
 
@@ -1780,5 +1780,5 @@ function c(t){let s=document.createRange().createContextualFragment(t).firstElem
1780
1780
  transition-duration: 0.01ms !important;
1781
1781
  }
1782
1782
  }
1783
- `,_e='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',re=class{constructor(e,n,s){this.t=s;this.keyMap=new Map([["j",()=>n.onNavigate("down")],["k",()=>n.onNavigate("up")],["r",()=>n.onResolve()],["d",()=>n.onDelete()],["f",()=>n.onFocusSearch()],["/",()=>n.onFocusSearch()],["x",()=>n.onToggleSelect()],["?",()=>this.toggleHelp()]]),this.helpOverlay=this.buildOverlay(),this.hintButton=this.buildHintButton(),this.boundHandler=r=>this.handleKeydown(r);}t;helpOverlay;hintButton;keyMap;boundHandler;shadowRoot=null;enabled=false;helpVisible=false;destroyed=false;enable(e){if(this.destroyed||this.enabled)return;e&&(this.shadowRoot=e),(this.shadowRoot??document).addEventListener("keydown",this.boundHandler),this.enabled=true;}disable(){if(!this.enabled)return;(this.shadowRoot??document).removeEventListener("keydown",this.boundHandler),this.enabled=false,this.helpVisible&&this.hideHelp();}toggleHelp(){this.helpVisible?this.hideHelp():this.showHelp();}destroy(){this.destroyed||(this.disable(),this.helpOverlay.remove(),this.hintButton.remove(),this.destroyed=true);}handleKeydown(e){if(e.key==="Escape"){this.helpVisible&&(e.preventDefault(),e.stopPropagation(),this.hideHelp());return}if(this.helpVisible)return;let n=e.composedPath()[0];if(n){let r=n.tagName?.toLowerCase();if(r==="input"||r==="textarea"||r==="select"||n.isContentEditable)return}if(e.ctrlKey||e.altKey||e.metaKey)return;let s=this.keyMap.get(e.key);s&&(e.preventDefault(),e.stopPropagation(),s());}showHelp(){this.helpVisible=true,this.helpOverlay.classList.add("sp-shortcuts-overlay--visible"),this.helpOverlay.querySelector(".sp-shortcuts-close")?.focus();}hideHelp(){this.helpVisible=false,this.helpOverlay.classList.remove("sp-shortcuts-overlay--visible");}buildOverlay(){let e=o("div",{class:"sp-shortcuts-overlay"});e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true"),e.setAttribute("aria-label",this.t("shortcuts.title")),e.addEventListener("click",d=>{d.target===e&&this.hideHelp();});let n=o("div",{class:"sp-shortcuts-card"}),s=o("div",{class:"sp-shortcuts-title"});s.appendChild(c(Ie));let r=o("span");a(r,this.t("shortcuts.title")),s.appendChild(r),n.appendChild(s);let i=document.createElement("button");i.className="sp-shortcuts-close",i.setAttribute("aria-label",this.t("shortcuts.close")),i.appendChild(c(_e)),i.addEventListener("click",()=>this.hideHelp()),n.appendChild(i);let l=o("div",{class:"sp-shortcuts-grid"});for(let d of je){let p=o("div",{class:"sp-shortcuts-row"}),h=o("div",{class:"sp-shortcuts-keys"});d.keys.forEach((v,m)=>{if(m>0){let g=o("span",{class:"sp-shortcuts-separator"});a(g,"/"),h.appendChild(g);}let f=o("span",{class:"sp-kbd"});a(f,v),h.appendChild(f);});let u=o("span",{class:"sp-shortcuts-desc"});a(u,this.t(d.label)),p.appendChild(h),p.appendChild(u),l.appendChild(p);}return n.appendChild(l),e.appendChild(n),e}buildHintButton(){let e=document.createElement("button");return e.className="sp-shortcuts-hint",e.setAttribute("aria-label",this.t("shortcuts.hint")),a(e,"?"),e.addEventListener("click",n=>{n.stopPropagation(),this.toggleHelp();}),e}};export{S as A,F as B,P as C,O as D,ce as E,ue as F,At as G,Lt as H,Rt as I,Pt as J,G as K,Dt as L,W as M,_t as N,Z as O,Kt as P,Ut as Q,Vt as R,te as S,Yt as T,Wt as U,ne as V,Jt as W,Zt as X,es as Y,re as Z,c as a,o as b,a as c,R as d,$e as e,Ke as f,Ue as g,Ve as h,Ye as i,Ge as j,qe as k,We as l,Xe as m,Qe as n,Je as o,Ze as p,et as q,tt as r,st as s,nt as t,rt as u,ot as v,at as w,M as x,_ as y,lt as z};//# sourceMappingURL=chunk-W5TBUGIT.js.map
1784
- //# sourceMappingURL=chunk-W5TBUGIT.js.map
1783
+ `,_e='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',re=class{constructor(e,n,s){this.t=s;this.keyMap=new Map([["j",()=>n.onNavigate("down")],["k",()=>n.onNavigate("up")],["r",()=>n.onResolve()],["d",()=>n.onDelete()],["f",()=>n.onFocusSearch()],["/",()=>n.onFocusSearch()],["x",()=>n.onToggleSelect()],["?",()=>this.toggleHelp()]]),this.helpOverlay=this.buildOverlay(),this.hintButton=this.buildHintButton(),this.boundHandler=r=>this.handleKeydown(r);}t;helpOverlay;hintButton;keyMap;boundHandler;shadowRoot=null;enabled=false;helpVisible=false;destroyed=false;enable(e){if(this.destroyed||this.enabled)return;e&&(this.shadowRoot=e),(this.shadowRoot??document).addEventListener("keydown",this.boundHandler),this.enabled=true;}disable(){if(!this.enabled)return;(this.shadowRoot??document).removeEventListener("keydown",this.boundHandler),this.enabled=false,this.helpVisible&&this.hideHelp();}toggleHelp(){this.helpVisible?this.hideHelp():this.showHelp();}destroy(){this.destroyed||(this.disable(),this.helpOverlay.remove(),this.hintButton.remove(),this.destroyed=true);}handleKeydown(e){if(e.key==="Escape"){this.helpVisible&&(e.preventDefault(),e.stopPropagation(),this.hideHelp());return}if(this.helpVisible)return;let n=e.composedPath()[0];if(n){let r=n.tagName?.toLowerCase();if(r==="input"||r==="textarea"||r==="select"||n.isContentEditable)return}if(e.ctrlKey||e.altKey||e.metaKey)return;let s=this.keyMap.get(e.key);s&&(e.preventDefault(),e.stopPropagation(),s());}showHelp(){this.helpVisible=true,this.helpOverlay.classList.add("sp-shortcuts-overlay--visible"),this.helpOverlay.querySelector(".sp-shortcuts-close")?.focus();}hideHelp(){this.helpVisible=false,this.helpOverlay.classList.remove("sp-shortcuts-overlay--visible");}buildOverlay(){let e=o("div",{class:"sp-shortcuts-overlay"});e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true"),e.setAttribute("aria-label",this.t("shortcuts.title")),e.addEventListener("click",d=>{d.target===e&&this.hideHelp();});let n=o("div",{class:"sp-shortcuts-card"}),s=o("div",{class:"sp-shortcuts-title"});s.appendChild(c(Ie));let r=o("span");a(r,this.t("shortcuts.title")),s.appendChild(r),n.appendChild(s);let i=document.createElement("button");i.className="sp-shortcuts-close",i.setAttribute("aria-label",this.t("shortcuts.close")),i.appendChild(c(_e)),i.addEventListener("click",()=>this.hideHelp()),n.appendChild(i);let l=o("div",{class:"sp-shortcuts-grid"});for(let d of je){let p=o("div",{class:"sp-shortcuts-row"}),h=o("div",{class:"sp-shortcuts-keys"});d.keys.forEach((v,m)=>{if(m>0){let g=o("span",{class:"sp-shortcuts-separator"});a(g,"/"),h.appendChild(g);}let f=o("span",{class:"sp-kbd"});a(f,v),h.appendChild(f);});let u=o("span",{class:"sp-shortcuts-desc"});a(u,this.t(d.label)),p.appendChild(h),p.appendChild(u),l.appendChild(p);}return n.appendChild(l),e.appendChild(n),e}buildHintButton(){let e=document.createElement("button");return e.className="sp-shortcuts-hint",e.setAttribute("aria-label",this.t("shortcuts.hint")),a(e,"?"),e.addEventListener("click",n=>{n.stopPropagation(),this.toggleHelp();}),e}};export{S as A,F as B,P as C,O as D,ce as E,ue as F,At as G,Lt as H,Rt as I,Pt as J,G as K,Dt as L,W as M,_t as N,Z as O,Kt as P,Ut as Q,Vt as R,te as S,Yt as T,Wt as U,ne as V,Jt as W,Zt as X,es as Y,re as Z,c as a,o as b,a as c,R as d,$e as e,Ke as f,Ue as g,Ve as h,Ye as i,Ge as j,qe as k,We as l,Xe as m,Qe as n,Je as o,Ze as p,et as q,tt as r,st as s,nt as t,rt as u,ot as v,at as w,M as x,_ as y,lt as z};//# sourceMappingURL=chunk-NEX6ECQM.js.map
1784
+ //# sourceMappingURL=chunk-NEX6ECQM.js.map