@seatlayer/js 0.103.0 → 0.104.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-WFAVFYCD.js → chunk-P7YM5BKA.js} +1 -1
- package/dist/index.cjs +42 -34
- package/dist/index.d.cts +27 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.js +41 -33
- package/dist/manager.cjs +1 -1
- package/dist/manager.js +1 -1
- package/package.json +2 -2
package/dist/manager.cjs
CHANGED
|
@@ -1426,7 +1426,7 @@
|
|
|
1426
1426
|
transition:none!important;
|
|
1427
1427
|
scroll-behavior:auto!important}
|
|
1428
1428
|
}
|
|
1429
|
-
`;function ft(){if(typeof document>"u"||document.getElementById(bt))return;let o=document.createElement("style");o.id=bt,o.textContent=Bs,document.head.appendChild(o)}function vt(o){if(typeof document>"u"||document.getElementById(gt))return;let e=document.createElement("style");e.id=gt,e.textContent=o,document.head.appendChild(e)}Ge();var Pt=require("@seatlayer/core"),X=require("@seatlayer/core/picker/minimapGeometry");var Ht=require("@seatlayer/core"),qs=require("@seatlayer/core/core/cdnAsset");var _s=require("@seatlayer/core/core/cdnAsset");function F(o,e){let t=(0,Ht.t)(o);return t===o?e:t}function Ns(o){let e={inactive:0,available:1,selected:2},t=new Map;for(let n of o){let i=t.get(n.id);(!i||e[n.state]>e[i])&&t.set(n.id,n.state)}let s={selected:0,available:0,inactive:0};for(let n of t.values())s[n]+=1;return s}function js(o,e){return o.x<=e.x&&o.y<=e.y&&o.x+o.width>=e.x+e.width&&o.y+o.height>=e.y+e.height}function Bt(o,e){let t=new Xe(o);return t.build(e),t}var Xe=class{constructor(e){this.host=e;this.miniCanvas=null;this.miniBase=null;this.miniWrap=null;this.miniToggle=null;this.miniLabel=null;this.miniTf=null;this.miniDrag=null;this.miniSuppressClick=!1;this.userClosed=!1}dispose(){this.miniToggle?.remove(),this.miniWrap?.remove(),this.miniToggle=null,this.miniWrap=null,this.miniCanvas=null,this.miniBase=null,this.miniLabel=null,this.miniTf=null,this.miniDrag=null,this.host.root()?.removeAttribute("data-minimap-open")}build(e){if(!this.host.controller.getViewport())return;let s=document.createElement("button");s.type="button",s.className="sl-minimap-toggle",s.setAttribute("aria-label",F("picker.openVenueMap","Open venue overview map")),s.setAttribute("aria-expanded","false"),s.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 6l5-2 8 3 5-2v13l-5 2-8-3-5 2zM8 4v13M16 7v13"/></svg>',e.appendChild(s),this.miniToggle=s;let n=document.createElement("div");n.className="sl-minimap",n.setAttribute("role","group");let i=document.createElement("div");i.className="sl-minimap-bar";let a=document.createElement("span");a.className="sl-minimap-label";let l=document.createElement("span");l.className="sl-minimap-key",l.setAttribute("aria-label",F("picker.minimapStateKey","Focused, selected, available, and inactive sections")),l.innerHTML='<i class="focused" title="Focused"></i><i class="selected" title="Selected"></i><i title="Available"></i><i class="inactive" title="Inactive"></i>';let r=document.createElement("button");r.type="button",r.className="sl-minimap-close",r.setAttribute("aria-label",F("picker.closeVenueMap","Close venue overview map")),r.textContent="\xD7",i.append(a,l,r);let c=document.createElement("canvas");c.tabIndex=0,c.setAttribute("role","application"),c.setAttribute("aria-label",F("picker.venueMapInstructions","Venue overview map. Drag the viewport, click a section, or use arrow keys to pan.")),n.append(i,c),e.appendChild(n),this.miniWrap=n,this.miniLabel=a,this.miniCanvas=c;let d=document.createElement("canvas");this.miniBase=d,s.addEventListener("click",()=>{let h=this.host.root()?.dataset.minimapOpen==="true";this.userClosed=h,this.setMinimapOpen(!h)}),r.addEventListener("click",()=>{this.userClosed=!0,this.setMinimapOpen(!1)}),c.addEventListener("click",h=>{if(this.miniSuppressClick){this.miniSuppressClick=!1;return}this.minimapJump(h)}),c.addEventListener("pointerdown",h=>this.minimapPointerDown(h)),c.addEventListener("pointermove",h=>this.minimapPointerMove(h)),c.addEventListener("pointerup",h=>this.minimapPointerUp(h)),c.addEventListener("pointercancel",h=>this.minimapPointerUp(h)),c.addEventListener("keydown",h=>this.minimapKeydown(h)),this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect()}setAutoOpen(e){if(this.miniWrap){if(!e){this.userClosed=!1,this.host.root()?.dataset.minimapOpen==="true"&&this.setMinimapOpen(!1,!1);return}this.userClosed||this.host.root()?.dataset.minimapOpen==="true"||this.setMinimapOpen(!0,!1)}}setMinimapOpen(e,t=!0){this.host.root()?.setAttribute("data-minimap-open",String(e)),this.miniToggle?.setAttribute("aria-expanded",String(e)),t&&(e?this.miniCanvas?.focus():this.miniToggle?.focus())}layoutMinimap(){let e=this.miniCanvas,t=this.miniBase,s=this.host.controller.getViewport()?.bounds;if(!e||!t||!s||!(s.width>0&&s.height>0))return;let n=196,i=146,a=6,l=s.width/Math.max(1,s.height),r=n,c=Math.round(n/l);c>i&&(c=i,r=Math.round(i*l)),r=Math.max(64,r),c=Math.max(48,c);let d=Math.min(2,window.devicePixelRatio||1);e.width=Math.round(r*d),e.height=Math.round(c*d),e.style.width=`${r}px`,e.style.height=`${c}px`,t.width=e.width,t.height=e.height,this.miniTf=(0,X.createMinimapTransform)(s,e.width,e.height,d,a)}syncMinimapLabel(){if(!this.miniLabel||!this.miniWrap)return;let e=this.host.controller.getFloors(),t=this.host.controller.isFloorOverview()?F("picker.allFloors","All floors"):e.find(d=>d.id===this.host.controller.getActiveFloorId())?.name??F("picker.venueOverview","Venue overview"),s=this.host.controller.getMinimapSnapshot().sections,i=s.find(d=>d.active)?.label??this.host.focusedSectionLabel(),a=i?`${t} \xB7 ${i}`:t;this.miniLabel.textContent=a;let{selected:l,available:r,inactive:c}=Ns(s);this.miniWrap.setAttribute("aria-label",s.length?`${a}. ${l} selected, ${r} available, ${c} inactive sections.`:a),this.miniCanvas?.setAttribute("aria-label",s.length?`${a}. ${l} selected, ${r} available, ${c} inactive sections. ${F("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click a section, or use arrow keys to pan.")}`:`${a}. ${F("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click elsewhere, or use arrow keys to pan.")}`)}refreshMinimap(){this.miniBase&&(this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect())}drawMinimapStatic(){let e=this.miniBase,t=this.miniTf;if(!e||!t)return;let s=e.getContext("2d");if(!s)return;s.clearRect(0,0,e.width,e.height);let n=h=>h*t.scale+t.offX,i=h=>h*t.scale+t.offY,a=this.host.cssVar("--sl-line")||"rgba(139,147,167,.5)",l=this.host.cssVar("--sl-muted")||"#8b93a7",r=this.host.cssVar("--sl-accent")||"#6e7bff",c=this.host.cssVar("--sl-success")||"#22a06b",d=this.host.controller.getMinimapSnapshot();for(let h of d.sections){if(h.outline.length<3)continue;s.beginPath(),h.outline.forEach((m,p)=>p===0?s.moveTo(n(m.x),i(m.y)):s.lineTo(n(m.x),i(m.y))),s.closePath();let b=h.paint;if(s.globalAlpha=h.state==="inactive"?.5:.92,b?s.fillStyle=b.fill:(s.globalAlpha=h.state==="inactive"?.18:h.state==="selected"?.72:.34,s.fillStyle=h.state==="inactive"?l:h.state==="selected"?r:c),s.fill(),s.globalAlpha=.82,s.lineWidth=Math.max(1,t.dpr),s.strokeStyle=b?.stroke||a,s.stroke(),h.owned){s.globalAlpha=1,s.lineWidth=Math.max(2,t.dpr*1.5),s.strokeStyle=r,s.stroke();let m=h.outline.reduce((p,v)=>({x:p.x+v.x,y:p.y+v.y}),{x:0,y:0});s.beginPath(),s.arc(n(m.x/h.outline.length),i(m.y/h.outline.length),Math.max(1.5,t.dpr*1.6),0,Math.PI*2),s.fillStyle=r,s.fill(),s.beginPath(),h.outline.forEach((p,v)=>v===0?s.moveTo(n(p.x),i(p.y)):s.lineTo(n(p.x),i(p.y))),s.closePath()}h.active&&(s.globalAlpha=1,s.lineJoin="round",s.lineWidth=Math.max(4,t.dpr*3.5),s.strokeStyle=this.host.cssVar("--sl-surface")||"#fff",s.stroke(),s.lineWidth=Math.max(2,t.dpr*1.75),s.strokeStyle=r,s.stroke())}if(s.globalAlpha=1,!d.sections.length){let h=Math.max(1,t.dpr),b=new Map,m=p=>{let v=b.get(p);if(v)return v;let y=this.host.tint?.(p)||c;return b.set(p,y),y};for(let p of d.seats)s.globalAlpha=p.state==="inactive"?.22:.78,s.fillStyle=p.state==="inactive"?l:p.state==="selected"?r:m(p.categoryKey),s.beginPath(),s.arc(n(p.x),i(p.y),h,0,Math.PI*2),s.fill();s.globalAlpha=1}}drawMinimapRect(){let e=this.miniCanvas,t=this.miniBase,s=this.miniTf;if(!e||!t||!s)return;let n=e.getContext("2d");if(!n)return;n.clearRect(0,0,e.width,e.height),n.drawImage(t,0,0);let i=this.host.controller.getViewport();if(!i||js(i.visible,i.bounds))return;let a=(0,X.minimapViewportPlan)(i.visible,s,e.width,e.height,Math.max(2,s.dpr*2)),l=this.host.cssVar("--sl-text")||"#12151c",r=this.host.cssVar("--sl-surface")||"#fff";n.save(),n.globalAlpha=.1,n.fillStyle=l,n.fillRect(a.raw.x,a.raw.y,a.raw.width,a.raw.height),n.globalAlpha=.9,n.lineJoin="round",n.lineWidth=Math.max(4,s.dpr*3.25),n.strokeStyle=r,n.strokeRect(a.raw.x,a.raw.y,a.raw.width,a.raw.height),n.globalAlpha=1,n.lineWidth=Math.max(2,s.dpr*1.75),n.strokeStyle=l,n.strokeRect(a.raw.x,a.raw.y,a.raw.width,a.raw.height),a.clipped&&Object.values(a.clippedEdges).some(Boolean)&&(n.setLineDash([Math.max(3,s.dpr*3),Math.max(2,s.dpr*2)]),n.strokeRect(a.clipped.x,a.clipped.y,a.clipped.width,a.clipped.height)),n.restore()}minimapWorldPoint(e){let t=this.miniCanvas,s=this.miniTf;if(!t||!s)return null;let n=t.getBoundingClientRect(),i=(e.clientX-n.left)*(t.width/Math.max(1,n.width)),a=(e.clientY-n.top)*(t.height/Math.max(1,n.height));return{...(0,X.minimapPointToWorld)({x:i,y:a},s),px:i,py:a}}minimapPointerDown(e){let t=this.minimapWorldPoint(e),s=this.host.controller.getViewport()?.visible;!t||!s||!(t.x>=s.x&&t.x<=s.x+s.width&&t.y>=s.y&&t.y<=s.y+s.height)||(this.miniDrag={pointerId:e.pointerId,offsetX:t.x-(s.x+s.width/2),offsetY:t.y-(s.y+s.height/2),startX:e.clientX,startY:e.clientY,moved:!1},this.miniCanvas?.setPointerCapture(e.pointerId),this.miniCanvas?.classList.add("sl-dragging"),e.preventDefault())}minimapPointerMove(e){let t=this.miniDrag;if(!t||t.pointerId!==e.pointerId)return;let s=this.minimapWorldPoint(e);s&&(!t.moved&&Math.hypot(e.clientX-t.startX,e.clientY-t.startY)>2&&(t.moved=!0,this.host.controller.clearSectionFocus()),this.host.controller.panToWorld({x:s.x-t.offsetX,y:s.y-t.offsetY}),e.preventDefault())}minimapPointerUp(e){let t=this.miniDrag;!t||t.pointerId!==e.pointerId||(this.miniSuppressClick=t.moved,this.miniDrag=null,this.miniCanvas?.classList.remove("sl-dragging"),this.miniCanvas?.hasPointerCapture(e.pointerId)&&this.miniCanvas.releasePointerCapture(e.pointerId))}minimapKeydown(e){let t=this.host.controller.getViewport()?.visible;if(!t)return;if(e.key==="Home"){this.host.controller.overview(),e.preventDefault();return}let s=e.key==="ArrowLeft"?-t.width*.2:e.key==="ArrowRight"?t.width*.2:0,n=e.key==="ArrowUp"?-t.height*.2:e.key==="ArrowDown"?t.height*.2:0;!s&&!n||(this.host.controller.clearSectionFocus(),this.host.controller.panToWorld({x:t.x+t.width/2+s,y:t.y+t.height/2+n}),e.preventDefault())}minimapJump(e){let t=this.minimapWorldPoint(e);if(t){for(let s of this.host.controller.getMinimapSnapshot().sections)if(!(s.state==="inactive"||s.outline.length<3)&&(0,Pt.pointInPolygon)(t,s.outline)){this.host.controller.focusSection(s.id);return}this.host.controller.clearSectionFocus(),this.host.controller.panToWorld(t)}}};function Dt(o){return o.focusedSection!==null?o.deeperThanSectionFrame===!1?"venue":"section":o.atVenueFit!==void 0?o.atVenueFit?"none":"venue":o.seatsRevealed?"venue":"none"}function Ot(o){return o.total==null||o.free==null?o.label:o.free<=0?`${o.label} \xB7 sold out`:`${o.label} \xB7 ${o.free.toLocaleString()} of ${o.total.toLocaleString()} free`}function zt(o){let t=Dt({focusedSection:o.focused?o.focused.label:null,seatsRevealed:o.seatsRevealed,atVenueFit:o.atVenueFit})==="none";return{crumb:o.focused?o.floor?`${o.floor} \xB7 ${Ot(o.focused)}`:Ot(o.focused):o.floor??"Venue",crumbShown:!!o.focused||!!o.floor,zoomInEnabled:!o.atCeiling,zoomOutEnabled:!t,venueEnabled:!t}}function Ft(o={}){return`
|
|
1429
|
+
`;function ft(){if(typeof document>"u"||document.getElementById(bt))return;let o=document.createElement("style");o.id=bt,o.textContent=Bs,document.head.appendChild(o)}function vt(o){if(typeof document>"u"||document.getElementById(gt))return;let e=document.createElement("style");e.id=gt,e.textContent=o,document.head.appendChild(e)}Ge();var Pt=require("@seatlayer/core"),X=require("@seatlayer/core/picker/minimapGeometry");var Ht=require("@seatlayer/core"),qs=require("@seatlayer/core/core/cdnAsset");var _s=require("@seatlayer/core/core/cdnAsset");function F(o,e){let t=(0,Ht.t)(o);return t===o?e:t}function Ns(o){let e={inactive:0,available:1,selected:2},t=new Map;for(let n of o){let i=t.get(n.id);(!i||e[n.state]>e[i])&&t.set(n.id,n.state)}let s={selected:0,available:0,inactive:0};for(let n of t.values())s[n]+=1;return s}function js(o,e){return o.x<=e.x&&o.y<=e.y&&o.x+o.width>=e.x+e.width&&o.y+o.height>=e.y+e.height}function Bt(o,e){let t=new Xe(o);return t.build(e),t}var Xe=class{constructor(e){this.host=e;this.miniCanvas=null;this.miniBase=null;this.miniWrap=null;this.miniToggle=null;this.miniLabel=null;this.miniTf=null;this.miniDrag=null;this.miniSuppressClick=!1;this.userClosed=!1}dispose(){this.miniToggle?.remove(),this.miniWrap?.remove(),this.miniToggle=null,this.miniWrap=null,this.miniCanvas=null,this.miniBase=null,this.miniLabel=null,this.miniTf=null,this.miniDrag=null,this.host.root()?.removeAttribute("data-minimap-open")}build(e){if(!this.host.controller.getViewport())return;let s=document.createElement("button");s.type="button",s.className="sl-minimap-toggle",s.setAttribute("aria-label",F("picker.openVenueMap","Open venue overview map")),s.setAttribute("aria-expanded","false"),s.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 6l5-2 8 3 5-2v13l-5 2-8-3-5 2zM8 4v13M16 7v13"/></svg>',e.appendChild(s),this.miniToggle=s;let n=document.createElement("div");n.className="sl-minimap",n.setAttribute("role","group");let i=document.createElement("div");i.className="sl-minimap-bar";let a=document.createElement("span");a.className="sl-minimap-label";let l=document.createElement("span");l.className="sl-minimap-key",l.setAttribute("aria-label",F("picker.minimapStateKey","Focused, selected, available, and inactive sections")),l.innerHTML='<i class="focused" title="Focused"></i><i class="selected" title="Selected"></i><i title="Available"></i><i class="inactive" title="Inactive"></i>';let r=document.createElement("button");r.type="button",r.className="sl-minimap-close",r.setAttribute("aria-label",F("picker.closeVenueMap","Close venue overview map")),r.textContent="\xD7",i.append(a,l,r);let c=document.createElement("canvas");c.tabIndex=0,c.setAttribute("role","application"),c.setAttribute("aria-label",F("picker.venueMapInstructions","Venue overview map. Drag the viewport, click a section, or use arrow keys to pan.")),n.append(i,c),e.appendChild(n),this.miniWrap=n,this.miniLabel=a,this.miniCanvas=c;let d=document.createElement("canvas");this.miniBase=d,s.addEventListener("click",()=>{let h=this.host.root()?.dataset.minimapOpen==="true";this.userClosed=h,this.setMinimapOpen(!h)}),r.addEventListener("click",()=>{this.userClosed=!0,this.setMinimapOpen(!1)}),c.addEventListener("click",h=>{if(this.miniSuppressClick){this.miniSuppressClick=!1;return}this.minimapJump(h)}),c.addEventListener("pointerdown",h=>this.minimapPointerDown(h)),c.addEventListener("pointermove",h=>this.minimapPointerMove(h)),c.addEventListener("pointerup",h=>this.minimapPointerUp(h)),c.addEventListener("pointercancel",h=>this.minimapPointerUp(h)),c.addEventListener("keydown",h=>this.minimapKeydown(h)),this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect()}setAutoOpen(e){if(this.miniWrap){if(!e){this.userClosed=!1,this.host.root()?.dataset.minimapOpen==="true"&&this.setMinimapOpen(!1,!1);return}this.userClosed||this.host.root()?.dataset.minimapOpen==="true"||this.setMinimapOpen(!0,!1)}}setMinimapOpen(e,t=!0){this.host.root()?.setAttribute("data-minimap-open",String(e)),this.miniToggle?.setAttribute("aria-expanded",String(e)),t&&(e?this.miniCanvas?.focus():this.miniToggle?.focus())}layoutMinimap(){let e=this.miniCanvas,t=this.miniBase,s=this.host.controller.getViewport()?.bounds;if(!e||!t||!s||!(s.width>0&&s.height>0))return;let n=196,i=146,a=6,l=s.width/Math.max(1,s.height),r=n,c=Math.round(n/l);c>i&&(c=i,r=Math.round(i*l)),r=Math.max(64,r),c=Math.max(48,c);let d=Math.min(2,window.devicePixelRatio||1);e.width=Math.round(r*d),e.height=Math.round(c*d),e.style.width=`${r}px`,e.style.height=`${c}px`,t.width=e.width,t.height=e.height,this.miniTf=(0,X.createMinimapTransform)(s,e.width,e.height,d,a)}syncMinimapLabel(){if(!this.miniLabel||!this.miniWrap)return;let e=this.host.controller.getFloors(),t=this.host.controller.isFloorOverview()?F("picker.allFloors","All floors"):e.find(d=>d.id===this.host.controller.getActiveFloorId())?.name??F("picker.venueOverview","Venue overview"),s=this.host.controller.getMinimapSnapshot().sections,i=s.find(d=>d.active)?.label??this.host.focusedSectionLabel(),a=i?`${t} \xB7 ${i}`:t;this.miniLabel.textContent=a;let{selected:l,available:r,inactive:c}=Ns(s);this.miniWrap.setAttribute("aria-label",s.length?`${a}. ${l} selected, ${r} available, ${c} inactive sections.`:a),this.miniCanvas?.setAttribute("aria-label",s.length?`${a}. ${l} selected, ${r} available, ${c} inactive sections. ${F("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click a section, or use arrow keys to pan.")}`:`${a}. ${F("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click elsewhere, or use arrow keys to pan.")}`)}refreshMinimap(){this.miniBase&&(this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect())}drawMinimapStatic(){let e=this.miniBase,t=this.miniTf;if(!e||!t)return;let s=e.getContext("2d");if(!s)return;s.clearRect(0,0,e.width,e.height);let n=h=>h*t.scale+t.offX,i=h=>h*t.scale+t.offY,a=this.host.cssVar("--sl-line")||"rgba(139,147,167,.5)",l=this.host.cssVar("--sl-muted")||"#8b93a7",r=this.host.cssVar("--sl-accent")||"#6e7bff",c=this.host.cssVar("--sl-success")||"#22a06b",d=this.host.controller.getMinimapSnapshot();for(let h of d.sections){if(h.outline.length<3)continue;s.beginPath(),h.outline.forEach((m,p)=>p===0?s.moveTo(n(m.x),i(m.y)):s.lineTo(n(m.x),i(m.y))),s.closePath();let b=h.paint;if(s.globalAlpha=h.state==="inactive"?.5:.92,b?s.fillStyle=b.fill:(s.globalAlpha=h.state==="inactive"?.18:h.state==="selected"?.72:.34,s.fillStyle=h.state==="inactive"?l:h.state==="selected"?r:c),s.fill(),s.globalAlpha=.82,s.lineWidth=Math.max(1,t.dpr),s.strokeStyle=b?.stroke||a,s.stroke(),h.owned){s.globalAlpha=1,s.lineWidth=Math.max(2,t.dpr*1.5),s.strokeStyle=r,s.stroke();let m=h.outline.reduce((p,v)=>({x:p.x+v.x,y:p.y+v.y}),{x:0,y:0});s.beginPath(),s.arc(n(m.x/h.outline.length),i(m.y/h.outline.length),Math.max(1.5,t.dpr*1.6),0,Math.PI*2),s.fillStyle=r,s.fill(),s.beginPath(),h.outline.forEach((p,v)=>v===0?s.moveTo(n(p.x),i(p.y)):s.lineTo(n(p.x),i(p.y))),s.closePath()}h.active&&(s.globalAlpha=1,s.lineJoin="round",s.lineWidth=Math.max(4,t.dpr*3.5),s.strokeStyle=this.host.cssVar("--sl-surface")||"#fff",s.stroke(),s.lineWidth=Math.max(2,t.dpr*1.75),s.strokeStyle=r,s.stroke())}if(s.globalAlpha=1,!d.sections.length){let h=Math.max(1,t.dpr),b=new Map,m=p=>{let v=b.get(p);if(v)return v;let y=this.host.tint?.(p)||c;return b.set(p,y),y};for(let p of d.seats)s.globalAlpha=p.state==="inactive"?.22:.78,s.fillStyle=p.state==="inactive"?l:p.state==="selected"?r:m(p.categoryKey),s.beginPath(),s.arc(n(p.x),i(p.y),h,0,Math.PI*2),s.fill();s.globalAlpha=1}}drawMinimapRect(){let e=this.miniCanvas,t=this.miniBase,s=this.miniTf;if(!e||!t||!s)return;let n=e.getContext("2d");if(!n)return;n.clearRect(0,0,e.width,e.height),n.drawImage(t,0,0);let i=this.host.controller.getViewport();if(!i)return;let a=js(i.visible,i.bounds);if(this.host.root()?.toggleAttribute("data-minimap-idle",a),a)return;let l=(0,X.minimapViewportPlan)(i.visible,s,e.width,e.height,Math.max(2,s.dpr*2)),r=this.host.cssVar("--sl-text")||"#12151c",c=this.host.cssVar("--sl-surface")||"#fff";n.save(),n.globalAlpha=.1,n.fillStyle=r,n.fillRect(l.raw.x,l.raw.y,l.raw.width,l.raw.height),n.globalAlpha=.9,n.lineJoin="round",n.lineWidth=Math.max(4,s.dpr*3.25),n.strokeStyle=c,n.strokeRect(l.raw.x,l.raw.y,l.raw.width,l.raw.height),n.globalAlpha=1,n.lineWidth=Math.max(2,s.dpr*1.75),n.strokeStyle=r,n.strokeRect(l.raw.x,l.raw.y,l.raw.width,l.raw.height),l.clipped&&Object.values(l.clippedEdges).some(Boolean)&&(n.setLineDash([Math.max(3,s.dpr*3),Math.max(2,s.dpr*2)]),n.strokeRect(l.clipped.x,l.clipped.y,l.clipped.width,l.clipped.height)),n.restore()}minimapWorldPoint(e){let t=this.miniCanvas,s=this.miniTf;if(!t||!s)return null;let n=t.getBoundingClientRect(),i=(e.clientX-n.left)*(t.width/Math.max(1,n.width)),a=(e.clientY-n.top)*(t.height/Math.max(1,n.height));return{...(0,X.minimapPointToWorld)({x:i,y:a},s),px:i,py:a}}minimapPointerDown(e){let t=this.minimapWorldPoint(e),s=this.host.controller.getViewport()?.visible;!t||!s||!(t.x>=s.x&&t.x<=s.x+s.width&&t.y>=s.y&&t.y<=s.y+s.height)||(this.miniDrag={pointerId:e.pointerId,offsetX:t.x-(s.x+s.width/2),offsetY:t.y-(s.y+s.height/2),startX:e.clientX,startY:e.clientY,moved:!1},this.miniCanvas?.setPointerCapture(e.pointerId),this.miniCanvas?.classList.add("sl-dragging"),e.preventDefault())}minimapPointerMove(e){let t=this.miniDrag;if(!t||t.pointerId!==e.pointerId)return;let s=this.minimapWorldPoint(e);s&&(!t.moved&&Math.hypot(e.clientX-t.startX,e.clientY-t.startY)>2&&(t.moved=!0,this.host.controller.clearSectionFocus()),this.host.controller.panToWorld({x:s.x-t.offsetX,y:s.y-t.offsetY}),e.preventDefault())}minimapPointerUp(e){let t=this.miniDrag;!t||t.pointerId!==e.pointerId||(this.miniSuppressClick=t.moved,this.miniDrag=null,this.miniCanvas?.classList.remove("sl-dragging"),this.miniCanvas?.hasPointerCapture(e.pointerId)&&this.miniCanvas.releasePointerCapture(e.pointerId))}minimapKeydown(e){let t=this.host.controller.getViewport()?.visible;if(!t)return;if(e.key==="Home"){this.host.controller.overview(),e.preventDefault();return}let s=e.key==="ArrowLeft"?-t.width*.2:e.key==="ArrowRight"?t.width*.2:0,n=e.key==="ArrowUp"?-t.height*.2:e.key==="ArrowDown"?t.height*.2:0;!s&&!n||(this.host.controller.clearSectionFocus(),this.host.controller.panToWorld({x:t.x+t.width/2+s,y:t.y+t.height/2+n}),e.preventDefault())}minimapJump(e){let t=this.minimapWorldPoint(e);if(t){for(let s of this.host.controller.getMinimapSnapshot().sections)if(!(s.state==="inactive"||s.outline.length<3)&&(0,Pt.pointInPolygon)(t,s.outline)){this.host.controller.focusSection(s.id);return}this.host.controller.clearSectionFocus(),this.host.controller.panToWorld(t)}}};function Dt(o){return o.focusedSection!==null?o.deeperThanSectionFrame===!1?"venue":"section":o.atVenueFit!==void 0?o.atVenueFit?"none":"venue":o.seatsRevealed?"venue":"none"}function Ot(o){return o.total==null||o.free==null?o.label:o.free<=0?`${o.label} \xB7 sold out`:`${o.label} \xB7 ${o.free.toLocaleString()} of ${o.total.toLocaleString()} free`}function zt(o){let t=Dt({focusedSection:o.focused?o.focused.label:null,seatsRevealed:o.seatsRevealed,atVenueFit:o.atVenueFit})==="none";return{crumb:o.focused?o.floor?`${o.floor} \xB7 ${Ot(o.focused)}`:Ot(o.focused):o.floor??"Venue",crumbShown:!!o.focused||!!o.floor,zoomInEnabled:!o.atCeiling,zoomOutEnabled:!t,venueEnabled:!t}}function Ft(o={}){return`
|
|
1430
1430
|
<div class="slm-mapchrome" data-ref="mapchrome">
|
|
1431
1431
|
${o.legend??""}
|
|
1432
1432
|
<div class="slm-crumb" data-ref="crumb" role="status" hidden></div>
|
package/dist/manager.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as _,t as K}from"./chunk-
|
|
1
|
+
import{s as _,t as K}from"./chunk-P7YM5BKA.js";import{A as De,B as Ve,C as je,D as qe,E as Ne,F as _e,G as Ke,H as Ue,I as We,J as Ge,K as Ze,L as Ye,M as Xe,N as Qe,O as Je,P as et,Q as tt,R as st,S as it,T as ot,V as at,a as L,b as U,c as k,d as O,e as W,f as G,g as Z,h as Y,i as F,j as M,k as x,l as X,m as Q,n as J,o as ee,p as te,q as T,r as m,s as P,t as se,u as D,v as ze,w as Ie,x as Oe,y as Fe,z as Pe}from"./chunk-LLK5GY5O.js";import{d as I,f as N}from"./chunk-UBFNMA7U.js";import"./chunk-OSZ7DOEH.js";var ie={hold:"Held",release:"Released",expire:"Expired",book:"Booked",unbook:"Cancelled",block:"Blocked",unblock:"Unblocked"},C=class{constructor(e,t){this.host=e;this.fetchPage=t;this.closed=!1;this.busy=!1;this.generation=0;this.entries=[];this.next=null;this.summary=document.createElement("div");this.list=document.createElement("div");this.message=document.createElement("div");this.older=document.createElement("button");this.latest=document.createElement("button");e.className="slm-seat-history",this.summary.className="slm-history-counts",this.list.className="slm-history-list",this.list.setAttribute("role","region"),this.list.setAttribute("aria-label","Seat history"),this.list.tabIndex=0,this.message.className="slm-note",this.message.setAttribute("role","status"),this.older.className=this.latest.className="slm-btn ghost",this.older.textContent="Load older",this.older.hidden=!0,this.latest.textContent="New activity \xB7 Show latest",this.latest.hidden=!0,this.older.onclick=()=>{this.load(!0)},this.latest.onclick=()=>{this.list.scrollTop=0,this.latest.hidden=!0,this.load()},e.append(this.summary,this.latest,this.list,this.message,this.older),this.load()}destroy(){this.closed=!0,this.generation++}refresh(){this.busy||this.load(!1,!0)}async load(e=!1,t=!1){if(this.closed||this.busy||e&&!this.next)return;this.busy=!0,this.older.disabled=!0;let s=this.generation;t||(this.message.textContent="Loading history\u2026");try{let i=await this.fetchPage(e?this.next:void 0,this.action);if(this.closed||s!==this.generation)return;if(this.paintCounts(i),t&&this.entries.length&&i.entries[0]?.id!==this.entries[0]?.id&&this.list.scrollTop>24){this.latest.hidden=!1;return}let o=!t||i.entries[0]?.id!==this.entries[0]?.id;e?(this.entries=[...this.entries,...i.entries.filter(a=>!this.entries.some(l=>l.id===a.id))],this.next=i.nextBefore):o&&(this.entries=i.entries,this.next=i.nextBefore),o&&this.paintRows(),this.older.hidden=this.next===null,this.message.textContent=this.entries.length?"":"No recorded activity for this seat."}catch{if(!this.closed){this.message.textContent="History could not be loaded. ";let i=document.createElement("button");i.className="slm-btn ghost",i.textContent="Retry",i.onclick=()=>{this.load(e)},this.message.append(i)}}finally{this.busy=!1,this.older.disabled=!1}}paintCounts(e){let t=[{action:"",count:e.total},...e.counts];this.summary.replaceChildren(...t.map(({action:s,count:i})=>{let o=document.createElement("button");return o.type="button",o.textContent=s?`${ie[s]??s} ${i}`:`${i} changes`,o.setAttribute("aria-pressed",String((this.action??"")===s)),o.onclick=()=>{this.busy||(this.action=s||void 0,this.entries=[],this.next=null,this.list.scrollTop=0,this.latest.hidden=!0,this.load())},o}))}paintRows(){let e=this.list.scrollTop;this.list.replaceChildren(...this.entries.map(t=>{let s=document.createElement("div");s.className="slm-history-row",s.dataset.action=t.action;let i=document.createElement("time");i.dateTime=new Date(t.at).toISOString(),i.textContent=new Date(t.at).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),i.title=new Date(t.at).toString();let o=document.createElement("strong");return o.textContent=ie[t.action]??t.action,s.append(i,o),s})),this.list.scrollTop=e}};var lt={held:"HOLD",booked:"BOOK",expired:"EXPIRE",released:"RELEASE",cancelled:"CANCEL",blocked:"BLOCK",unblocked:"ON SALE",available:"FREE"},oe={held:"Held",booked:"Booked",expired:"Hold expired",released:"Hold released",cancelled:"Booking cancelled",blocked:"Blocked",unblocked:"Back on sale",available:"Available again"},E=class{constructor(e,t,s){this.host=e;this.locate=s;this.items=[];this.shown=new Set;this.paused=!1;this.limit=100;this.signature="unrendered";this.abort=new AbortController;e.innerHTML='<button class="slm-new-activity" hidden></button><div class="slm-activity-list" role="region" aria-label="Recent activity" tabindex="0"></div><button class="slm-more-activity" hidden>Show more activity</button>',this.list=e.querySelector(".slm-activity-list"),this.newer=e.querySelector(".slm-new-activity"),this.more=e.querySelector(".slm-more-activity");let i={signal:this.abort.signal},o=()=>{this.paused=!1,this.signature="unrendered",this.list.scrollTop=0,this.render()};this.list.addEventListener("scroll",()=>{this.list.scrollTop>24&&(this.paused=!0)},i),this.list.addEventListener("focusin",()=>{this.paused=!0},i),this.list.addEventListener("toggle",a=>{a.target.open&&(this.paused=!0)},{...i,capture:!0}),this.newer.addEventListener("click",o,i),this.more.addEventListener("click",()=>{this.limit=200,this.signature="unrendered",this.render(!0)},i)}update(e){this.items=e,this.render()}render(e=!1){let t=this.items,s=t.filter(a=>!this.shown.has(a.id)).length;if(this.newer.hidden=!this.paused,this.newer.textContent=s?`${s} new activit${s===1?"y":"ies"} \xB7 Back to live`:"Reading earlier activity \xB7 Back to live",this.paused&&!e)return;let i=t.slice(0,this.limit),o=i.map(a=>`${a.id}:${a.verb}`).join("|");if(o!==this.signature){if(this.signature=o,this.shown=new Set(t.map(a=>a.id)),this.list.replaceChildren(),!i.length){let a=document.createElement("p");a.className="slm-activity-empty",a.textContent=this.items.length?"No activity matches these filters.":"Waiting for activity. Holds, bookings and releases will appear here.",this.list.append(a)}for(let a of i){let l=document.createElement("article");l.className="slm-activity-entry",l.dataset.status=a.status;let r=document.createElement("button");r.type="button",r.className="slm-activity-row";let c=`${oe[a.verb]??a.verb} \xB7 ${a.count} seat${a.count===1?"":"s"} \xB7 ${a.sectionLabels?.join(", ")||"Event inventory"} \xB7 ${a.labels.join(", ")} \xB7 ${new Date(a.at).toLocaleString()}`;r.title=`${c} \u2014 click to show seats on the map`,r.setAttribute("aria-label",`Show seats on map: ${c}`),r.addEventListener("click",()=>this.locate(a.id));let d=document.createElement("time");d.dateTime=new Date(a.at).toISOString(),d.textContent=new Date(a.at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});let h=document.createElement("strong");h.textContent=lt[a.verb]??a.verb,h.title=oe[a.verb]??a.verb;let p=document.createElement("span");if(p.className="slm-activity-seats",p.textContent=a.labels.join(", "),r.append(d,h,p),l.append(r),a.count>1){let u=document.createElement("details");u.className="slm-activity-details";let g=document.createElement("summary");g.textContent="\u22EF",g.setAttribute("aria-label",`Show all ${a.count} seats`);let f=document.createElement("p");f.textContent=c,u.append(g,f),l.append(u)}this.list.append(l)}this.more.hidden=t.length<=this.limit}}destroy(){this.abort.abort()}};var R=class{constructor(e){this.host=e;this.moving=!1;this.space=!1;this.monitor=!1;this.selected=0;this.abort=new AbortController;let t=document.createElement("div");t.className="slm-navigation";let s=b=>`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${b}</svg>`,i=s('<path d="M8 13V6a2 2 0 0 1 4 0v6-8a2 2 0 0 1 4 0v8-6a2 2 0 0 1 4 0v10c0 4-3 6-7 6-3 0-5-2-7-5l-3-4a2 2 0 0 1 3-2l2 2Z"/>'),o=s('<path d="m5 3 14 10-7 1-3 7-4-18Z"/>'),a=s('<circle cx="10.5" cy="10.5" r="6.5"/><path d="m16 16 5 5"/>'),l=s('<path d="M7 6h10M12 1v10M7 18h10"/>'),r=s('<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M15 4v16"/>');t.innerHTML=`<div class="slm-navigation-tools" role="group" aria-label="Map navigation">
|
|
2
2
|
<button type="button" data-nav="move" aria-label="Move" aria-pressed="false" title="Drag to move the map; hold Space temporarily">${i}</button>
|
|
3
3
|
<button type="button" data-nav="select" aria-label="Select" aria-pressed="true" title="Drag to select seats \xB7 drag empty floor to move">${o}</button>
|
|
4
4
|
<button type="button" data-nav="search" aria-label="Search" title="Search seats, rows or sections" aria-expanded="false">${a}</button>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seatlayer/js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.104.0",
|
|
4
4
|
"description": "SeatLayer's official JavaScript seating chart and seat map SDK — live availability, seat selection, temporary holds, and a typed API for any web ticketing app.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"typescript"
|
|
69
69
|
],
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@seatlayer/core": "0.
|
|
71
|
+
"@seatlayer/core": "0.104.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"tsup": "^8.5.1",
|