@hyperframes/player 0.8.142 → 0.8.144
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-VMPAV2RQ.js +2 -0
- package/dist/{chunk-QJ3QTT32.js.map → chunk-VMPAV2RQ.js.map} +1 -1
- package/dist/hyperframes-player.cjs +3 -3
- package/dist/hyperframes-player.cjs.map +1 -1
- package/dist/hyperframes-player.global.js +3 -3
- package/dist/hyperframes-player.global.js.map +1 -1
- package/dist/hyperframes-player.js +3 -3
- package/dist/hyperframes-player.js.map +1 -1
- package/dist/slideshow/hyperframes-slideshow.cjs +23 -23
- package/dist/slideshow/hyperframes-slideshow.cjs.map +1 -1
- package/dist/slideshow/hyperframes-slideshow.global.js +23 -23
- package/dist/slideshow/hyperframes-slideshow.global.js.map +1 -1
- package/dist/slideshow/hyperframes-slideshow.js +1 -1
- package/package.json +3 -2
- package/dist/chunk-QJ3QTT32.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as E,b as I}from"../chunk-
|
|
1
|
+
import{a as E,b as I}from"../chunk-VMPAV2RQ.js";var f="main",y=class{constructor(e,t){this.player=e;this.show=t;this.enterSlide(0)}player;show;stack=[{sequenceId:f,slideIndex:0,fragmentIndex:-1}];changeCbs=new Set;dispose(){}slidesOf(e){return e===f?this.show.slides:this.show.sequences[e]?.slides??[]}get frame(){return this.stack[this.stack.length-1]}get currentSlide(){return this.slidesOf(this.frame.sequenceId)[this.frame.slideIndex]}get nextSlide(){return this.slidesOf(this.frame.sequenceId)[this.frame.slideIndex+1]??null}get position(){return{...this.frame}}get counter(){return{index:this.frame.slideIndex+1,total:this.slidesOf(this.frame.sequenceId).length}}get canPrev(){return this.frame.slideIndex>0||this.stack.length>1}get canNext(){let e=this.slidesOf(this.frame.sequenceId);return this.frame.slideIndex+1<e.length||this.stack.length>1}get breadcrumb(){return this.stack.map(e=>e.sequenceId===f?{id:f,label:"Main deck"}:{id:e.sequenceId,label:this.show.sequences[e.sequenceId]?.label??e.sequenceId})}onChange(e){return this.changeCbs.add(e),()=>this.changeCbs.delete(e)}emitChange(){for(let e of this.changeCbs)e()}stopSlideMedia(){this.player.stopMedia?.()}enterSlide(e){e!==this.frame.slideIndex&&this.stopSlideMedia(),this.frame.slideIndex=e;let t=this.currentSlide;if(!t){this.frame.fragmentIndex=-1;return}t.fragments.length>0?(this.frame.fragmentIndex=0,this.playTo(t.fragments[0]??t.end)):(this.frame.fragmentIndex=-1,this.playTo(this.restFrame(t))),t.autoplay&&this.player.playSceneMedia?.(t.sceneId),this.emitChange()}restFrame(e){return e.start+(e.end-e.start)*.5}resumeSlide(e,t){this.frame.slideIndex=e,this.frame.fragmentIndex=t;let n=this.currentSlide;if(!n)return;let r=t>=0&&t<n.fragments.length?n.fragments[t]??n.start:n.fragments.length>0?n.start:this.restFrame(n);this.playTo(r),this.emitChange()}playTo(e){this.player.seek(e)}next(){let e=this.currentSlide;if(!e)return;if(this.frame.fragmentIndex+1<e.fragments.length){this.frame.fragmentIndex+=1;let r=e.fragments[this.frame.fragmentIndex]??e.end;this.playTo(r),this.emitChange();return}let n=this.slidesOf(this.frame.sequenceId);this.frame.slideIndex+1<n.length?this.enterSlide(this.frame.slideIndex+1):this.stack.length>1&&this.back()}prev(){if(this.frame.slideIndex>0){this.enterSlide(this.frame.slideIndex-1);return}this.stack.length>1&&this.back()}goToSlide(e){let t=this.slidesOf(this.frame.sequenceId);e>=0&&e<t.length&&this.enterSlide(e)}enterBranch(e){let t=this.show.sequences[e];!t||t.slides.length===0||(this.stopSlideMedia(),this.stack.push({sequenceId:e,slideIndex:0,fragmentIndex:-1}),this.enterSlide(0))}back(){this.stack.length<=1||(this.stopSlideMedia(),this.stack.pop(),this.resumeSlide(this.frame.slideIndex,this.frame.fragmentIndex))}backToMain(){this.stack.length<=1||(this.stopSlideMedia(),this.stack=[this.stack[0]],this.resumeSlide(this.frame.slideIndex,this.frame.fragmentIndex))}syncTo(e,t,n){this.isValidSyncTarget(e,t)&&(this.isCrossSlide(e,t)&&this.stopSlideMedia(),this.rerootStackTo(e)&&this.resumeSlide(t,n))}isValidSyncTarget(e,t){if(!this.stack[0])return!1;let n=e===f?this.show.slides:this.show.sequences[e]?.slides??null;return n?t>=0&&t<n.length:!1}isCrossSlide(e,t){return this.frame.sequenceId!==e||this.frame.slideIndex!==t}rerootStackTo(e){if(this.frame.sequenceId===e)return!0;let t=this.stack[0];if(!t)return!1;if(this.stack=[t],e===f)return!0;let n=this.show.sequences[e];return!n||n.slides.length===0?!1:(this.stack.push({sequenceId:e,slideIndex:0,fragmentIndex:-1}),!0)}};var P="Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",O=new Set(["play","pause","seeking","seeked","ratechange","volumechange","ended","timeupdate"]),U=["currentTime","volume","playbackRate"],D=["paused","ended","muted"];function A(i){return!(typeof i!="object"||i===null)}function G(i){if(!A(i))return!1;let e=i;return e.type==="goto"&&typeof e.sequenceId=="string"&&typeof e.slideIndex=="number"&&typeof e.fragmentIndex=="number"}function z(i){return O.has(i)}function W(i){return i==="presenter"||i==="audience"}function V(i){return U.every(e=>typeof i[e]=="number")}function X(i){return D.every(e=>typeof i[e]=="boolean")}function Y(i){if(!A(i))return!1;let e=i;return e.type==="media"&&W(e.sender)&&typeof e.key=="string"&&z(e.action)&&V(e)&&X(e)}function j(){return`hf-slideshow:${typeof location<"u"?location.pathname:""}`}var m=class{constructor(e,t,n=()=>{}){this.mode=e;this.onGoto=t;this.onMedia=n;try{this.channel=new BroadcastChannel(j())}catch{return}this.channel.onmessage=r=>{if(G(r.data)){e==="audience"&&this.onGoto(r.data);return}Y(r.data)&&r.data.sender!==e&&this.onMedia(r.data)}}mode;onGoto;onMedia;channel=null;postPosition(e){if(this.mode!=="presenter"||!this.channel)return;let t={type:"goto",...e};this.channel.postMessage(t)}postMedia(e){this.channel&&this.channel.postMessage({type:"media",sender:this.mode,...e})}destroy(){this.channel&&(this.channel.onmessage=null,this.channel.close(),this.channel=null)}};function C(i){let e=s=>s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),t=s=>e(s).replace(/"/g,"""),n=e(i.notes),r=i.hotspots.length?`<div style="display:flex;flex-direction:column;gap:6px;">
|
|
2
2
|
<div style="font-size:12px;text-transform:uppercase;letter-spacing:.12em;opacity:.55;">Branches</div>
|
|
3
3
|
${i.hotspots.map(s=>`<button data-hotspot-id="${t(s.id)}" data-hotspot-target="${t(s.target)}" type="button" title="${t(s.label)}" style="text-align:left;background:rgba(244,183,64,0.14);color:#f4b740;border:1px solid rgba(244,183,64,0.4);border-radius:8px;padding:8px 12px;font-size:15px;cursor:pointer;pointer-events:auto;font-family:inherit;">↳ ${e(s.label)}</button>`).join("")}
|
|
4
4
|
</div>`:"";return`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/player",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.144",
|
|
4
4
|
"description": "Embeddable web component for HyperFrames compositions",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@hyperframes/core": "0.8.
|
|
31
|
+
"@hyperframes/core": "0.8.144"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/bun": "^1.1.0",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"typecheck": "tsc --noEmit && tsc --noEmit -p tests/perf/tsconfig.json",
|
|
44
44
|
"test": "vitest run",
|
|
45
45
|
"test:browser-security": "bun run tests/browser/sandbox-origin.ts",
|
|
46
|
+
"test:browser-raster": "bun run tests/browser/preview-raster-size.ts",
|
|
46
47
|
"perf": "bun run tests/perf/index.ts"
|
|
47
48
|
}
|
|
48
49
|
}
|
package/dist/chunk-QJ3QTT32.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var p="application/hyperframes-slideshow+json";function m(e="i"){let t=p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`<script[^>]*type=["']${t}["'][^>]*>([\\s\\S]*?)<\\/script>`,e)}function w(e){let n=m("i").exec(e);if(!n||n[1]===void 0)return null;let i=n[1].trim();if(i.length===0)return null;let r=JSON.parse(i);if(!g(r))throw new Error("slideshow island is not a valid SlideshowManifest");return r}function y(e){return e===void 0||Array.isArray(e)&&e.every(t=>typeof t=="number")}function h(e){return e===void 0||typeof e=="boolean"}function f(e){if(typeof e!="object"||e===null)return!1;let t=e;return!(typeof t.sceneId!="string"||!y(t.fragments)||t.hotspots!==void 0&&!Array.isArray(t.hotspots)||!h(t.autoplay))}function S(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.id=="string"&&typeof t.label=="string"&&Array.isArray(t.slides)&&t.slides.every(f)}function g(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e;return!(!Array.isArray(t.slides)||!t.slides.every(f)||t.slideSequences!==void 0&&(!Array.isArray(t.slideSequences)||!t.slideSequences.every(S)))}function $(e,t){return`slide "${e}" sets ${t==="startTime"?"endTime":"startTime"} but ${t} cannot be resolved (no scene "${e}")`}function v(e,t,n){let{startTime:i,endTime:r,sceneId:o}=e;if(i!==void 0&&r!==void 0)return{start:i,end:r};if(i===void 0&&r===void 0)return t?{start:t.start,end:t.start+t.duration}:(n.push(`slide references unresolved sceneId "${o}"`),{start:0,end:0});if(!t){let l=i===void 0?"startTime":"endTime";n.push($(o,l));let d=i??r??0;return{start:d,end:d}}return{start:i??t.start,end:r??t.start+t.duration}}function b(e,t,n,i,r){for(let o of t)(o<n||o>i)&&r.push(`slide "${e}" fragment ${o} is outside range [${n}, ${i}]`)}function c(e,t,n){let i=t.get(e.sceneId),{start:r,end:o}=v(e,i,n);e.startTime!==void 0&&e.endTime!==void 0&&o<=r&&n.push(`slide "${e.sceneId}" has endTime (${o}) <= startTime (${r})`);let l=[...new Set(e.fragments??[])].sort((d,s)=>d-s);return b(e.sceneId,l,r,o,n),{...e,start:r,end:o,fragments:l,hotspots:e.hotspots??[]}}function A(e,t){let n=[],i=new Map(t.map(s=>[s.id,s])),r={};for(let s of e.slideSequences??[])Object.prototype.hasOwnProperty.call(r,s.id)&&n.push(`duplicate slideSequence id "${s.id}" \u2014 only the last definition is kept`),r[s.id]={id:s.id,label:s.label,slides:s.slides.map(a=>c(a,i,n))};let o=e.slides.map(s=>c(s,i,n)),l=[...o,...Object.values(r).flatMap(s=>s.slides)];for(let s of l)for(let a of s.hotspots){let u=r[a.target];u?u.slides.length===0&&n.push(`hotspot "${a.id}" targets empty sequence "${a.target}"`):n.push(`hotspot "${a.id}" targets unknown sequence "${a.target}"`)}let d=[...o].sort((s,a)=>s.start-a.start);for(let s=1;s<d.length;s++){let a=d[s-1],u=d[s];a!==void 0&&u!==void 0&&u.start<a.end&&n.push(`main-line slides "${a.sceneId}" and "${u.sceneId}" overlap`)}return{resolved:{slides:o,sequences:r},errors:n}}export{w as a,A as b};
|
|
2
|
-
//# sourceMappingURL=chunk-QJ3QTT32.js.map
|