@bangerpage/core 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ The runtime for [Banger](https://github.com/bangerpage/banger): presentations wr
|
|
|
5
5
|
Load it from a CDN with the exact version, then write the deck with `bang-*` elements:
|
|
6
6
|
|
|
7
7
|
```html
|
|
8
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@bangerpage/core@0.1.
|
|
8
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@bangerpage/core@0.1.1/dist/index.js"></script>
|
|
9
9
|
<bang-root theme="light">
|
|
10
10
|
<bang-frame id="intro" at="0,0"><bang-title>Hello</bang-title></bang-frame>
|
|
11
11
|
<bang-path>
|
package/dist/index.js
CHANGED
|
@@ -328,7 +328,7 @@ ${Object.keys(D.light).map(t=>` --bang-color-${t}: var(--bang-frame-${e}-${t});
|
|
|
328
328
|
:host {
|
|
329
329
|
display: none;
|
|
330
330
|
}
|
|
331
|
-
`}render(){return null}};g("bang-theme",ne);var de="0.1.
|
|
331
|
+
`}render(){return null}};g("bang-theme",ne);var de="0.1.1";var ue=r=>r.id?`frame "${r.id}"`:R(r);function Ze(r){let o=new Map;for(let e of r.querySelectorAll("*")){let t=e.localName;if(!t.startsWith("bang-")||customElements.get(t))continue;let n=o.get(t);n?n.count+=1:o.set(t,{selector:R(e),count:1})}return[...o].map(([e,{selector:t,count:n}])=>`${t}: <${e}> is not a Banger element${n>1?` (${n} times)`:""}; check the tag name`)}function Je(r){let o=[];for(let e=0;e<r.length;e++)for(let t=e+1;t<r.length;t++){let n=r[e].rect,s=r[t].rect;n.x<s.x+s.w&&s.x<n.x+n.w&&n.y<s.y+s.h&&s.y<n.y+n.h&&o.push(`${ue(r[e].el)} and ${ue(r[t].el)} overlap on the canvas; give them different at values`)}return o}function qe(r,o,e){let t={x:0,y:0,worst:null},n=0;for(let s of r.querySelectorAll("*")){if(s.localName==="script"||s.localName==="style"||s.closest("bang-free")||getComputedStyle(s).display==="inline")continue;let i=s.getBoundingClientRect();if(i.width===0&&i.height===0)continue;let a=Math.max(0,(o.left-i.left)/e,(i.right-o.right)/e),l=Math.max(0,(o.top-i.top)/e,(i.bottom-o.bottom)/e);t.x=Math.max(t.x,a),t.y=Math.max(t.y,l),Math.max(a,l)>n&&(n=Math.max(a,l),t.worst=s)}return t}var Ge=r=>r.worst?` (furthest: ${R(r.worst)})`:"",Xe=(r,o)=>[r>ae?`${Math.round(r)}px horizontally`:"",o>ae?`${Math.round(o)}px vertically`:""].filter(Boolean);function Qe(r){let o=[];for(let{el:e}of r){let t=e.shadowRoot?.querySelector(".frame");if(!t||e.offsetWidth===0)continue;let n=e.getBoundingClientRect(),s=n.width/e.offsetWidth,i=getComputedStyle(t),a={left:n.left+parseFloat(i.paddingLeft)*s,top:n.top+parseFloat(i.paddingTop)*s,right:n.right-parseFloat(i.paddingRight)*s,bottom:n.bottom-parseFloat(i.paddingBottom)*s},l=qe(e,a,s),x=Xe(Math.max(l.x,t.scrollWidth-t.clientWidth),Math.max(l.y,t.scrollHeight-t.clientHeight));x.length>0&&o.push(`${ue(e)}: the content does not fit inside the frame margins by ${x.join(", ")}${Ge(l)}; what passes the frame edge is cut off, so shorten it or use smaller sizes`);for(let h of e.querySelectorAll("bang-card")){let v=qe(h,h.getBoundingClientRect(),s),u=Xe(v.x,v.y);u.length>0&&o.push(`${R(h)}: the content sticks out of the card by ${u.join(", ")}${Ge(v)}; shorten it or use smaller sizes`)}}return o}var re=class{constructor(){this.id=Math.random().toString(36).slice(2);this.channel=new BroadcastChannel(`bang:${location.origin}${location.pathname}`)}send(o){let e={type:"state",stop:o.stop,step:o.step,sender:this.id};this.channel.postMessage(e)}onRemote(o){this.channel.addEventListener("message",e=>{let t=e.data;t?.type==="state"&&t.sender!==this.id&&o({stop:t.stop,step:t.step})})}close(){this.channel.close()}},Ye=r=>String(r).padStart(2,"0");function ft(r){let o=Math.floor(r/1e3);return`${Ye(Math.floor(o/60))}:${Ye(o%60)}`}function et(r){return d`<div class="presenter">
|
|
332
332
|
<div class="presenter-head">
|
|
333
333
|
<span class="presenter-stop">Stop ${r.stop+1} / ${r.stopCount}</span>
|
|
334
334
|
<span class="presenter-step">Step ${r.step+1} / ${r.steps+1}</span>
|
package/package.json
CHANGED