hyperframes 0.8.33 → 0.8.35

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.
@@ -1,4 +1,4 @@
1
- "use strict";var HyperframesPlayer=(()=>{var ee=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var it=Object.prototype.hasOwnProperty;var rt=(r,e)=>{for(var t in e)ee(r,t,{get:e[t],enumerable:!0})},nt=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of tt(e))!it.call(r,n)&&n!==t&&ee(r,n,{get:()=>e[n],enumerable:!(i=et(e,n))||i.enumerable});return r};var ot=r=>nt(ee({},"__esModule",{value:!0}),r);var Ht={};rt(Ht,{HyperframesPlayer:()=>K,SPEED_PRESETS:()=>re,formatSpeed:()=>O,formatTime:()=>q});function we(r){return r.hasRuntime||r.runtimeInjected?!1:!!(r.hasNestedCompositions||r.hasTimelines&&r.attempts>=5)}function P(r){return typeof r=="object"&&r!==null}function Ae(r){return P(r)&&typeof r.getDuration=="function"}function Ce(r){return P(r)&&typeof r.duration=="function"&&typeof r.time=="function"&&typeof r.seek=="function"&&typeof r.play=="function"&&typeof r.pause=="function"}var k="https://cdn.jsdelivr.net/npm/@hyperframes/core@0.8.33/dist/hyperframe.runtime.iife.js";function N(r){if(r===null)return null;let e=Number.parseInt(r,10);return Number.isFinite(e)&&e>0?e:null}function at(r){let e=r?.querySelector("[data-composition-id][data-width][data-height]")??r?.querySelector("[data-width][data-height]");if(!e)return null;let t=N(e.getAttribute("data-width")),i=N(e.getAttribute("data-height"));return t!==null&&i!==null?{width:t,height:i}:null}var W=class{constructor(e,t){this._iframe=e;this._callbacks=t}_iframe;_callbacks;_interval=null;_runtimeInjected=!1;get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let e=0;this._interval=setInterval(()=>{e++;try{let t=this._iframe.contentWindow;if(!t)return;let i=!!(t.__hf||t.__player),n=!!(t.__timelines&&Object.keys(t.__timelines).length>0),o=!!this._iframe.contentDocument?.querySelector("[data-composition-src]");if(we({hasRuntime:i,hasTimelines:n,hasNestedCompositions:o,runtimeInjected:this._runtimeInjected,attempts:e})){this._injectRuntime();return}if(this._runtimeInjected&&!i)return;let d=this._resolvePlaybackDurationAdapter(t);if(d&&d.getDuration()>0){this.stop();let s=at(this._iframe.contentDocument);this._callbacks.onReady({duration:d.getDuration(),adapter:d,compositionSize:s});return}}catch{}e>=40&&(this.stop(),this._callbacks.onError("Composition timeline not found after 8s"))},200)}stop(){this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{let e=this._iframe.contentWindow;return e?this._resolveDirectTimelineAdapterFromWindow(e):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(e){return this._resolveDirectTimelineAdapterFromWindow(e)}hasRuntimeBridge(e){return Reflect.get(e,"__hf")!==void 0||P(Reflect.get(e,"__player"))}_injectRuntime(){this._runtimeInjected=!0;try{let e=this._iframe.contentDocument;if(!e)return;let t=e.createElement("script");t.src=k,(e.head||e.documentElement).appendChild(t),this._callbacks.onRuntimeInjected?.()}catch{}}_resolveDirectTimelineAdapterFromWindow(e){if(this.hasRuntimeBridge(e))return null;let t=Reflect.get(e,"__timelines");if(!P(t))return null;let i=Object.keys(t);if(i.length===0)return null;let n=this._iframe.contentDocument?.querySelector("[data-composition-id]")?.getAttribute("data-composition-id"),o=n&&n in t?n:i[i.length-1],d=t[o];return Ce(d)?d:null}_resolvePlaybackDurationAdapter(e){let t=Reflect.get(e,"__player");if(Ae(t))return{kind:"runtime",getDuration:()=>t.getDuration()};let i=this._resolveDirectTimelineAdapterFromWindow(e);return i?{kind:"direct-timeline",timeline:i,getDuration:()=>i.duration()}:null}};var Re=`
1
+ "use strict";var HyperframesPlayer=(()=>{var ee=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var it=Object.prototype.hasOwnProperty;var rt=(r,e)=>{for(var t in e)ee(r,t,{get:e[t],enumerable:!0})},nt=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of tt(e))!it.call(r,n)&&n!==t&&ee(r,n,{get:()=>e[n],enumerable:!(i=et(e,n))||i.enumerable});return r};var ot=r=>nt(ee({},"__esModule",{value:!0}),r);var Ht={};rt(Ht,{HyperframesPlayer:()=>K,SPEED_PRESETS:()=>re,formatSpeed:()=>O,formatTime:()=>q});function we(r){return r.hasRuntime||r.runtimeInjected?!1:!!(r.hasNestedCompositions||r.hasTimelines&&r.attempts>=5)}function P(r){return typeof r=="object"&&r!==null}function Ae(r){return P(r)&&typeof r.getDuration=="function"}function Ce(r){return P(r)&&typeof r.duration=="function"&&typeof r.time=="function"&&typeof r.seek=="function"&&typeof r.play=="function"&&typeof r.pause=="function"}var k="https://cdn.jsdelivr.net/npm/@hyperframes/core@0.8.35/dist/hyperframe.runtime.iife.js";function N(r){if(r===null)return null;let e=Number.parseInt(r,10);return Number.isFinite(e)&&e>0?e:null}function at(r){let e=r?.querySelector("[data-composition-id][data-width][data-height]")??r?.querySelector("[data-width][data-height]");if(!e)return null;let t=N(e.getAttribute("data-width")),i=N(e.getAttribute("data-height"));return t!==null&&i!==null?{width:t,height:i}:null}var W=class{constructor(e,t){this._iframe=e;this._callbacks=t}_iframe;_callbacks;_interval=null;_runtimeInjected=!1;get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let e=0;this._interval=setInterval(()=>{e++;try{let t=this._iframe.contentWindow;if(!t)return;let i=!!(t.__hf||t.__player),n=!!(t.__timelines&&Object.keys(t.__timelines).length>0),o=!!this._iframe.contentDocument?.querySelector("[data-composition-src]");if(we({hasRuntime:i,hasTimelines:n,hasNestedCompositions:o,runtimeInjected:this._runtimeInjected,attempts:e})){this._injectRuntime();return}if(this._runtimeInjected&&!i)return;let d=this._resolvePlaybackDurationAdapter(t);if(d&&d.getDuration()>0){this.stop();let s=at(this._iframe.contentDocument);this._callbacks.onReady({duration:d.getDuration(),adapter:d,compositionSize:s});return}}catch{}e>=40&&(this.stop(),this._callbacks.onError("Composition timeline not found after 8s"))},200)}stop(){this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{let e=this._iframe.contentWindow;return e?this._resolveDirectTimelineAdapterFromWindow(e):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(e){return this._resolveDirectTimelineAdapterFromWindow(e)}hasRuntimeBridge(e){return Reflect.get(e,"__hf")!==void 0||P(Reflect.get(e,"__player"))}_injectRuntime(){this._runtimeInjected=!0;try{let e=this._iframe.contentDocument;if(!e)return;let t=e.createElement("script");t.src=k,(e.head||e.documentElement).appendChild(t),this._callbacks.onRuntimeInjected?.()}catch{}}_resolveDirectTimelineAdapterFromWindow(e){if(this.hasRuntimeBridge(e))return null;let t=Reflect.get(e,"__timelines");if(!P(t))return null;let i=Object.keys(t);if(i.length===0)return null;let n=this._iframe.contentDocument?.querySelector("[data-composition-id]")?.getAttribute("data-composition-id"),o=n&&n in t?n:i[i.length-1],d=t[o];return Ce(d)?d:null}_resolvePlaybackDurationAdapter(e){let t=Reflect.get(e,"__player");if(Ae(t))return{kind:"runtime",getDuration:()=>t.getDuration()};let i=this._resolveDirectTimelineAdapterFromWindow(e);return i?{kind:"direct-timeline",timeline:i,getDuration:()=>i.duration()}:null}};var Re=`
2
2
  :host {
3
3
  display: block;
4
4
  position: relative;
@@ -77,7 +77,7 @@
77
77
  [data-hf-muted] [data-hf-mute]:hover {
78
78
  color: rgba(255,255,255,0.6) !important;
79
79
  }
80
- `,document.head.appendChild(i)}var H='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3H5a2 2 0 0 0-2 2v3M21 8V5a2 2 0 0 0-2-2h-3M3 16v3a2 2 0 0 0 2 2h3M16 21h3a2 2 0 0 0 2-2v-3"/></svg>',q='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3v3a2 2 0 0 1-2 2H3M21 8h-3a2 2 0 0 1-2-2V3M3 16h3a2 2 0 0 1 2 2v3M16 21v-3a2 2 0 0 1 2-2h3"/></svg>',Se='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="13" rx="2"/><path d="M8 21h8"/><path d="M12 17v4"/><path d="M10 8.5v4l4-2-4-2z"/></svg>',Te="Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",b=class extends HTMLElement{controller=null;offChange=null;chrome=null;touchStartX=0;touchStartY=0;channel=null;presenterStartMs=null;presenterInterval=null;presenterPositionTimers=[];disconnected=!1;initTimer=null;initRetry=null;initInFlight=!1;initGeneration=0;keyForwardFrame=null;detachIframeKeys=null;warnedIframeKeyForwardingUnavailable=!1;_muted=!1;mediaWireInterval=null;playerObserver=null;applyingRemoteMedia=!1;lastMediaTimeBroadcastMs=0;audienceMutedPlaybackKeys=new Set;blockedAudienceMedia=new Map;audienceMediaUnlockButton=null;autoplayToken=0;ownedMedia=new g(be,(e,t,n)=>this.publishMediaState(e,t,n));get muted(){return this._muted}resolveMode(){let e=this.getAttribute("mode");if(e)return e;try{return new URLSearchParams(location.search).get("mode")}catch{return null}}static get observedAttributes(){return["sound","mode"]}attributeChangedCallback(){this.controller&&this.render()}connectedCallback(){this.disconnected=!1,this.initInFlight=!1,this.initGeneration+=1,this.tabIndex=0,window.addEventListener("keydown",this.onKey),this.addEventListener("touchstart",this.onTouchStart,{passive:!0}),this.addEventListener("touchend",this.onTouchEnd),window.addEventListener("message",this.onMessage),document.addEventListener("fullscreenchange",this.onFsChange),this.initChannel(),this.observeInteractivePlayers(),this.initTimer=setTimeout(()=>{this.initTimer=null,this.isConnected&&!this.disconnected&&(this.ensureInteractivePlayers(),this.init())},0)}disconnectedCallback(){this.disconnected=!0,this.initGeneration+=1,this.autoplayToken++,this.initTimer!==null&&(clearTimeout(this.initTimer),this.initTimer=null),this.initRetry!==null&&(document.removeEventListener("DOMContentLoaded",this.initRetry),this.initRetry=null),window.removeEventListener("keydown",this.onKey),this.detachIframeKeys?.(),this.removeEventListener("touchstart",this.onTouchStart),this.removeEventListener("touchend",this.onTouchEnd),window.removeEventListener("message",this.onMessage),document.removeEventListener("fullscreenchange",this.onFsChange),this.offChange?.(),this.offChange=null,this.controller?.dispose?.(),this.controller=null,this.chrome=null,this.channel?.destroy(),this.channel=null,this.mediaWireInterval!==null&&(clearInterval(this.mediaWireInterval),this.mediaWireInterval=null),this.playerObserver!==null&&(this.playerObserver.disconnect(),this.playerObserver=null),this.ownedMedia.clear(),this.audienceMediaUnlockButton?.remove(),this.audienceMediaUnlockButton=null,this.audienceMutedPlaybackKeys.clear(),this.blockedAudienceMedia.clear(),this.presenterInterval!==null&&(clearInterval(this.presenterInterval),this.presenterInterval=null),this.clearPresenterPositionTimers()}__setControllerForTest(e){this.bindController(e)}present(){if(this.resolveMode()==="audience"||this.getAttribute("data-hf-presenting")==="true")return;let e=new URL(location.href);if(e.searchParams.set("mode","audience"),!this.openAudienceTab(e.href)){console.warn("[hyperframes-slideshow] present(): browser blocked the audience tab");return}this.setAttribute("data-hf-presenting","true"),this.postCurrentPresenterPositionBurst(),this.presenterStartMs=Date.now(),this.presenterInterval===null&&(this.presenterInterval=setInterval(()=>this.updateElapsed(),1e3)),this.render()}openAudienceTab(e){let t=navigator.userActivation;if(t&&t.isActive===!1)return!1;let n=document.createElement("a");return n.href=e,n.target="_blank",n.rel="noopener noreferrer",n.style.display="none",(document.body??document.documentElement).appendChild(n),n.click(),n.remove(),!0}updateElapsed(){if(this.presenterStartMs===null)return;let e=this.chrome?.querySelector("[data-hf-presenter-elapsed]");e&&(e.textContent=S(Math.floor((Date.now()-this.presenterStartMs)/1e3)))}initChannel(){this.resolveMode()==="audience"?this.channel=new m("audience",t=>{this.controller&&this.controller.syncTo?.(t.sequenceId,t.slideIndex,t.fragmentIndex)},this.onRemoteMedia):this.channel=new m("presenter",()=>{},this.onRemoteMedia)}async init(){if(this.initInFlight)return;this.initInFlight=!0;let e=this.initGeneration;try{let t=O(this);if(t.kind==="incomplete"){this.retryInitWhenParsed(e);return}let{player:n,manifest:r}=t;if(this.renderInitialChrome(r),!xe(n)||(await Ae(n),e!==this.initGeneration))return;this.attachIframeKeyForwarding(n);let s=await Ce(n,2500,()=>e!==this.initGeneration);if(e!==this.initGeneration)return;let{resolved:a,errors:d}=C(r,s);d.length>0&&console.warn("[hyperframes-slideshow] manifest errors:",d);let o=B(a);o.slides.length===0&&r.slides.length>0&&console.error("[hyperframes-slideshow] no main-line slides resolved \u2014 the scene timeline may not have loaded in time, or sceneIds/timing are invalid:",d);let l={seek:u=>n.seek(u),play:()=>n.play(),pause:()=>n.pause(),stopMedia:()=>{n.stopMedia?.(),this.stopDocumentMedia()},playSceneMedia:u=>this.playSceneDocumentMedia(u),get currentTime(){return n.currentTime},onTimeUpdate:u=>{let p=c=>{let M=c.detail;u(M.currentTime)};return n.addEventListener("timeupdate",p),()=>n.removeEventListener("timeupdate",p)}};this.bindController(new y(l,o)),s.length===0&&r.slides.length>0&&n.addEventListener("scenes",()=>{e===this.initGeneration&&this.init()},{once:!0})}finally{this.initInFlight=!1}}retryInitWhenParsed(e){if(this.initRetry!==null||!_(document.readyState))return;let t=()=>{this.initRetry=null,e===this.initGeneration&&this.isConnected&&!this.disconnected&&this.init()};this.initRetry=t,document.addEventListener("DOMContentLoaded",t,{once:!0})}renderInitialChrome(e){if(this.controller||e.slides.length===0)return;let t={index:1,total:e.slides.length};if(this.resolveMode()==="audience"){this.paintChrome(this.buildNavCluster(t,"28px","fs-only"));return}this.paintChrome(this.buildNavCluster(t,"28px","full",{canPrev:!1,canNext:e.slides.length>1,loading:e.slides.length>1}))}bindController(e){this.offChange?.(),this.controller?.dispose?.(),this.controller=e,this.startMediaSync(),this.offChange=e.onChange(()=>{this.resolveMode()!=="audience"&&this.channel&&this.channel.postPosition(e.position),this.render()}),this.resolveMode()!=="audience"&&this.channel&&this.channel.postPosition(e.position),this.render()}postCurrentPresenterPosition(){this.resolveMode()==="audience"||!this.channel||!this.controller||this.channel.postPosition(this.controller.position)}postCurrentPresenterPositionBurst(){this.clearPresenterPositionTimers(),this.postCurrentPresenterPosition();for(let e of[250,750,1500,3e3,5e3]){let t=setTimeout(()=>{this.presenterPositionTimers=this.presenterPositionTimers.filter(n=>n!==t),this.postCurrentPresenterPosition()},e);this.presenterPositionTimers.push(t)}}clearPresenterPositionTimers(){for(let e of this.presenterPositionTimers)clearTimeout(e);this.presenterPositionTimers=[]}startMediaSync(){this.wireSlideshowMedia(),this.mediaWireInterval===null&&(this.mediaWireInterval=setInterval(()=>this.wireSlideshowMedia(),1e3))}mediaPlayerElements(){return Array.from(this.querySelectorAll("hyperframes-player")).filter(e=>e instanceof HTMLElement)}ensureInteractivePlayers(){for(let e of this.querySelectorAll("hyperframes-player"))e.hasAttribute("interactive")||e.setAttribute("interactive","")}observeInteractivePlayers(){typeof MutationObserver>"u"||this.playerObserver===null&&(this.playerObserver=new MutationObserver(()=>this.ensureInteractivePlayers()),this.playerObserver.observe(this,{childList:!0,subtree:!0}))}attachIframeKeyForwarding(e){let t=e.iframeElement;if(!(t instanceof HTMLIFrameElement)||t===this.keyForwardFrame)return;this.detachIframeKeys?.();let n=()=>{try{t.contentWindow?.addEventListener("keydown",this.onKey)}catch{this.warnIframeKeyForwardingUnavailable()}};n(),t.addEventListener("load",n),this.keyForwardFrame=t,this.detachIframeKeys=()=>{t.removeEventListener("load",n);try{t.contentWindow?.removeEventListener("keydown",this.onKey)}catch{this.warnIframeKeyForwardingUnavailable()}this.keyForwardFrame=null,this.detachIframeKeys=null}}warnIframeKeyForwardingUnavailable(){this.warnedIframeKeyForwardingUnavailable||(this.warnedIframeKeyForwardingUnavailable=!0,console.warn("[hyperframes-slideshow] iframe keyboard forwarding is unavailable for this composition, likely because the player iframe is cross-origin. Arrow shortcuts work when focus is outside the iframe."))}playerFrameDocument(e){let t=e.iframeElement;if(!(t instanceof HTMLIFrameElement))return null;try{return t.contentDocument}catch{return null}}mediaKey(e,t,n,r){let s=e.id?`player-id:${e.id}`:`player:${t}`,a=n.id?`id:${n.id}`:`${n.tagName.toLowerCase()}:${r}`;return`${s}|${a}`}mediaEntries(){let e=[];return this.mediaPlayerElements().forEach((t,n)=>{let r=this.playerFrameDocument(t);r&&Array.from(r.querySelectorAll("video,audio")).filter(Ie).forEach((s,a)=>{e.push({key:this.mediaKey(t,n,s,a),el:s})})}),e}wireSlideshowMedia(){let e=this.ownedMedia.sync(this.mediaEntries());for(let t of e)t.muted=this._muted||t.defaultMuted}publishMediaState(e,t,n){if(!(this.applyingRemoteMedia||this.resolveMode()==="audience"||!this.channel)){if(n==="timeupdate"){let r=performance.now();if(r-this.lastMediaTimeBroadcastMs<450&&!e.paused)return;this.lastMediaTimeBroadcastMs=r}this.channel.postMedia({key:t,action:n,currentTime:v(e.currentTime,0),paused:e.paused,ended:e.ended,muted:e.muted,volume:v(e.volume,1),playbackRate:v(e.playbackRate,1)})}}onRemoteMedia=e=>{if(this.resolveMode()!=="audience")return;if(this.blockedAudienceMedia.has(e.key)&&e.action==="timeupdate"){this.blockedAudienceMedia.set(e.key,e),this.showAudienceMediaUnlock();return}this.wireSlideshowMedia();let t=this.mediaEntries().find(n=>n.key===e.key);if(t){this.applyingRemoteMedia=!0;try{this.applyRemoteMedia(t.el,e)}finally{setTimeout(()=>{this.applyingRemoteMedia=!1},300)}}};applyRemoteMedia(e,t){if(t.action==="pause"||t.action==="ended"){this.audienceMutedPlaybackKeys.delete(t.key),this.blockedAudienceMedia.delete(t.key),this.syncRemoteMediaState(e,t,!0),e.pause(),this.hideAudienceMediaUnlockIfClear();return}if(t.action==="play"||t.action==="timeupdate"&&t.paused===!1&&e.paused){this.playAudienceMediaMuted(e,t);return}this.syncRemoteMediaState(e,t,!0)}syncRemoteMediaState(e,t,n){e.playbackRate=v(t.playbackRate,1),e.volume=Math.max(0,Math.min(1,v(t.volume,1))),e.muted=this.audienceMutedPlaybackKeys.has(t.key)?!0:t.muted,n&&Number.isFinite(t.currentTime)&&Math.abs((e.currentTime||0)-t.currentTime)>.35&&(e.currentTime=Math.max(0,t.currentTime))}playAudienceMediaMuted(e,t){this.audienceMutedPlaybackKeys.add(t.key),this.syncRemoteMediaState(e,t,!0),e.muted=!0;try{e.play().then(()=>{this.blockedAudienceMedia.delete(t.key),this.hideAudienceMediaUnlockIfClear()}).catch(()=>{this.blockedAudienceMedia.set(t.key,t),this.showAudienceMediaUnlock()})}catch{this.blockedAudienceMedia.set(t.key,t),this.showAudienceMediaUnlock()}}retryBlockedAudienceMedia=()=>{this.wireSlideshowMedia();let e=new Map(this.mediaEntries().map(t=>[t.key,t.el]));for(let[t,n]of this.blockedAudienceMedia){let r=e.get(t);r&&this.playAudienceMediaMuted(r,n)}};showAudienceMediaUnlock(){if(this.resolveMode()!=="audience"||this.audienceMediaUnlockButton)return;let e=document.createElement("button");e.type="button",e.textContent="Play audience media muted",e.style.cssText="position:fixed;left:50%;bottom:96px;transform:translateX(-50%);z-index:100000;border:0;border-radius:999px;padding:12px 18px;background:#fff;color:#111827;box-shadow:0 10px 32px rgba(0,0,0,.28);font:700 14px/1 system-ui,sans-serif;cursor:pointer;pointer-events:auto;",e.addEventListener("click",this.retryBlockedAudienceMedia),this.appendChild(e),this.audienceMediaUnlockButton=e}hideAudienceMediaUnlockIfClear(){this.blockedAudienceMedia.size>0||!this.audienceMediaUnlockButton||(this.audienceMediaUnlockButton.remove(),this.audienceMediaUnlockButton=null)}onKey=e=>{if(Me(e.target))return;let t=document.activeElement,n=t===this||this.contains(t),r=document.querySelectorAll("hyperframes-slideshow").length>1,s=n||!r&&(t===document.body||t===null);if((e.key==="p"||e.key==="P")&&!e.metaKey&&!e.ctrlKey&&!e.altKey){if(!s||!this.shouldShowPresentControl())return;this.present(),e.preventDefault();return}if(this.controller){if(e.key==="ArrowRight"){if(!s)return;this.controller.next(),e.preventDefault()}else if(e.key==="ArrowLeft"){if(!s)return;this.controller.prev(),e.preventDefault()}else if(e.key===" "){if(!n)return;this.controller.next(),e.preventDefault()}else if(e.key==="Backspace"){if(!n)return;this.controller.prev(),e.preventDefault()}else if((e.key==="f"||e.key==="F")&&!e.metaKey&&!e.ctrlKey&&!e.altKey){if(!n)return;this.toggleFullscreen(),e.preventDefault()}}};onMessage=e=>{if(this.resolveMode()==="audience")return;let t=e.data;!t||!this.controller||(t.type==="next"?this.controller.next():t.type==="prev"?this.controller.prev():t.type==="goto"&&typeof t.slideIndex=="number"?this.controller.goToSlide?.(t.slideIndex):t.type==="back"&&this.controller.back?.())};onTouchStart=e=>{let t=e.touches[0];t&&(this.touchStartX=t.clientX,this.touchStartY=t.clientY)};onTouchEnd=e=>{if(!this.controller)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-this.touchStartX,r=t.clientY-this.touchStartY;Math.abs(n)<=40||Math.abs(n)<=Math.abs(r)||(n<0?this.controller.next():this.controller.prev())};render(){if(!this.controller)return;if(this.resolveMode()==="audience"){let{counter:r}=this.controller;this.paintChrome(this.buildNavCluster(r,"28px","fs-only"));return}if(this.getAttribute("data-hf-presenting")==="true"){this.renderPresenter();return}let{counter:e,currentSlide:t}=this.controller;if(!t)return;let n=t.hotspots.map(r=>{let s=r.region?`left:${r.region.x}%;top:${r.region.y}%;`:"right:5%;bottom:18%;";return`<button
80
+ `,document.head.appendChild(i)}var H='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3H5a2 2 0 0 0-2 2v3M21 8V5a2 2 0 0 0-2-2h-3M3 16v3a2 2 0 0 0 2 2h3M16 21h3a2 2 0 0 0 2-2v-3"/></svg>',q='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3v3a2 2 0 0 1-2 2H3M21 8h-3a2 2 0 0 1-2-2V3M3 16h3a2 2 0 0 1 2 2v3M16 21v-3a2 2 0 0 1 2-2h3"/></svg>',Se='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="13" rx="2"/><path d="M8 21h8"/><path d="M12 17v4"/><path d="M10 8.5v4l4-2-4-2z"/></svg>',Te="Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",b=class extends HTMLElement{controller=null;offChange=null;chrome=null;touchStartX=0;touchStartY=0;channel=null;presenterStartMs=null;presenterInterval=null;presenterPositionTimers=[];disconnected=!1;initTimer=null;initRetry=null;initInFlight=!1;initGeneration=0;keyForwardFrame=null;detachIframeKeys=null;warnedIframeKeyForwardingUnavailable=!1;_muted=!1;mediaWireInterval=null;playerObserver=null;applyingRemoteMedia=!1;lastMediaTimeBroadcastMs=0;audienceMutedPlaybackKeys=new Set;blockedAudienceMedia=new Map;audienceMediaUnlockButton=null;autoplayToken=0;ownedMedia=new g(be,(e,t,n)=>this.publishMediaState(e,t,n));get muted(){return this._muted}resolveMode(){let e=this.getAttribute("mode");if(e)return e;try{return new URLSearchParams(location.search).get("mode")}catch{return null}}static get observedAttributes(){return["sound","mode"]}attributeChangedCallback(){this.controller&&this.render()}connectedCallback(){this.disconnected=!1,this.initInFlight=!1,this.initGeneration+=1,this.tabIndex=0,window.addEventListener("keydown",this.onKey),this.addEventListener("touchstart",this.onTouchStart,{passive:!0}),this.addEventListener("touchend",this.onTouchEnd),window.addEventListener("message",this.onMessage),document.addEventListener("fullscreenchange",this.onFsChange),this.initChannel(),this.observeInteractivePlayers(),this.initTimer=setTimeout(()=>{this.initTimer=null,this.isConnected&&!this.disconnected&&(this.ensureInteractivePlayers(),this.init())},0)}disconnectedCallback(){this.disconnected=!0,this.initGeneration+=1,this.autoplayToken++,this.initTimer!==null&&(clearTimeout(this.initTimer),this.initTimer=null),this.initRetry!==null&&(document.removeEventListener("DOMContentLoaded",this.initRetry),this.initRetry=null),window.removeEventListener("keydown",this.onKey),this.detachIframeKeys?.(),this.removeEventListener("touchstart",this.onTouchStart),this.removeEventListener("touchend",this.onTouchEnd),window.removeEventListener("message",this.onMessage),document.removeEventListener("fullscreenchange",this.onFsChange),this.offChange?.(),this.offChange=null,this.controller?.dispose?.(),this.controller=null,this.chrome=null,this.channel?.destroy(),this.channel=null,this.mediaWireInterval!==null&&(clearInterval(this.mediaWireInterval),this.mediaWireInterval=null),this.playerObserver!==null&&(this.playerObserver.disconnect(),this.playerObserver=null),this.ownedMedia.clear(),this.audienceMediaUnlockButton?.remove(),this.audienceMediaUnlockButton=null,this.audienceMutedPlaybackKeys.clear(),this.blockedAudienceMedia.clear(),this.presenterInterval!==null&&(clearInterval(this.presenterInterval),this.presenterInterval=null),this.clearPresenterPositionTimers()}__setControllerForTest(e){this.bindController(e)}present(){if(this.resolveMode()==="audience"||this.getAttribute("data-hf-presenting")==="true")return;let e=new URL(location.href);if(e.searchParams.set("mode","audience"),!this.openAudienceTab(e.href)){console.warn("[hyperframes-slideshow] present(): browser blocked the audience tab");return}this.setAttribute("data-hf-presenting","true"),this.postCurrentPresenterPositionBurst(),this.presenterStartMs=Date.now(),this.presenterInterval===null&&(this.presenterInterval=setInterval(()=>this.updateElapsed(),1e3)),this.render()}openAudienceTab(e){let t=navigator.userActivation;if(t&&t.isActive===!1)return!1;let n=document.createElement("a");return n.href=e,n.target="_blank",n.rel="noopener noreferrer",n.style.display="none",(document.body??document.documentElement).appendChild(n),n.click(),n.remove(),!0}updateElapsed(){if(this.presenterStartMs===null)return;let e=this.chrome?.querySelector("[data-hf-presenter-elapsed]");e&&(e.textContent=S(Math.floor((Date.now()-this.presenterStartMs)/1e3)))}initChannel(){this.resolveMode()==="audience"?this.channel=new m("audience",t=>{this.controller&&this.controller.syncTo?.(t.sequenceId,t.slideIndex,t.fragmentIndex)},this.onRemoteMedia):this.channel=new m("presenter",()=>{},this.onRemoteMedia)}async init(){if(this.initInFlight)return;this.initInFlight=!0;let e=this.initGeneration;try{let t=O(this);if(t.kind==="incomplete"){this.retryInitWhenParsed(e);return}let{player:n,manifest:r}=t;if(this.renderInitialChrome(r),!xe(n)||(await Ae(n),e!==this.initGeneration))return;this.attachIframeKeyForwarding(n);let s=await Ce(n,2500,()=>e!==this.initGeneration);if(e!==this.initGeneration)return;let{resolved:a,errors:d}=C(r,s);d.length>0&&console.warn("[hyperframes-slideshow] manifest errors:",d);let o=B(a);o.slides.length===0&&r.slides.length>0&&console.error("[hyperframes-slideshow] no main-line slides resolved \u2014 the scene timeline may not have loaded in time, or sceneIds/timing are invalid:",d);let l={seek:u=>n.seek(u),play:()=>n.play(),pause:()=>n.pause(),stopMedia:()=>{n.stopMedia?.(),this.stopDocumentMedia()},playSceneMedia:u=>this.playSceneDocumentMedia(u),get currentTime(){return n.currentTime},onTimeUpdate:u=>{let p=c=>{let M=c.detail;u(M.currentTime)};return n.addEventListener("timeupdate",p),()=>n.removeEventListener("timeupdate",p)}};this.bindController(new y(l,o)),s.length===0&&r.slides.length>0&&n.addEventListener("scenes",()=>{e===this.initGeneration&&this.init()},{once:!0})}finally{this.initInFlight=!1}}retryInitWhenParsed(e){if(this.initRetry!==null||!_(document.readyState))return;let t=()=>{this.initRetry=null,e===this.initGeneration&&this.isConnected&&!this.disconnected&&this.init()};this.initRetry=t,document.addEventListener("DOMContentLoaded",t,{once:!0})}renderInitialChrome(e){if(this.controller||e.slides.length===0)return;let t={index:1,total:e.slides.length};if(this.resolveMode()==="audience"){this.paintChrome(this.buildNavCluster(t,"28px","fs-only"));return}this.paintChrome(this.buildNavCluster(t,"28px","full",{canPrev:!1,canNext:e.slides.length>1,loading:e.slides.length>1}))}bindController(e){this.offChange?.(),this.controller?.dispose?.(),this.controller=e,this.startMediaSync(),this.offChange=e.onChange(()=>{this.resolveMode()!=="audience"&&this.channel&&this.channel.postPosition(e.position),this.render()}),this.resolveMode()!=="audience"&&this.channel&&this.channel.postPosition(e.position),this.render()}postCurrentPresenterPosition(){this.resolveMode()==="audience"||!this.channel||!this.controller||this.channel.postPosition(this.controller.position)}postCurrentPresenterPositionBurst(){this.clearPresenterPositionTimers(),this.postCurrentPresenterPosition();for(let e of[250,750,1500,3e3,5e3]){let t=setTimeout(()=>{this.presenterPositionTimers=this.presenterPositionTimers.filter(n=>n!==t),this.postCurrentPresenterPosition()},e);this.presenterPositionTimers.push(t)}}clearPresenterPositionTimers(){for(let e of this.presenterPositionTimers)clearTimeout(e);this.presenterPositionTimers=[]}startMediaSync(){this.wireSlideshowMedia(),this.mediaWireInterval===null&&(this.mediaWireInterval=setInterval(()=>this.wireSlideshowMedia(),1e3))}mediaPlayerElements(){return Array.from(this.querySelectorAll("hyperframes-player")).filter(e=>e instanceof HTMLElement)}ensureInteractivePlayers(){for(let e of this.querySelectorAll("hyperframes-player"))e.hasAttribute("interactive")||e.setAttribute("interactive","")}observeInteractivePlayers(){typeof MutationObserver>"u"||this.playerObserver===null&&(this.playerObserver=new MutationObserver(()=>this.ensureInteractivePlayers()),this.playerObserver.observe(this,{childList:!0,subtree:!0}))}attachIframeKeyForwarding(e){let t=e.iframeElement;if(!(t instanceof HTMLIFrameElement)||t===this.keyForwardFrame)return;this.detachIframeKeys?.();let n=()=>{try{t.contentWindow?.addEventListener("keydown",this.onKey)}catch{this.warnIframeKeyForwardingUnavailable()}};n(),t.addEventListener("load",n),this.keyForwardFrame=t,this.detachIframeKeys=()=>{t.removeEventListener("load",n);try{t.contentWindow?.removeEventListener("keydown",this.onKey)}catch{this.warnIframeKeyForwardingUnavailable()}this.keyForwardFrame=null,this.detachIframeKeys=null}}warnIframeKeyForwardingUnavailable(){this.warnedIframeKeyForwardingUnavailable||(this.warnedIframeKeyForwardingUnavailable=!0,console.warn("[hyperframes-slideshow] iframe keyboard forwarding is unavailable for this composition, likely because the player iframe is cross-origin. Arrow shortcuts work when focus is outside the iframe."))}playerFrameDocument(e){let t=e.iframeElement;if(!(t instanceof HTMLIFrameElement))return null;try{return t.contentDocument}catch{return null}}mediaKey(e,t,n,r){let s=e.id?`player-id:${e.id}`:`player:${t}`,a=n.id?`id:${n.id}`:`${n.tagName.toLowerCase()}:${r}`;return`${s}|${a}`}mediaEntries(){let e=[];return this.mediaPlayerElements().forEach((t,n)=>{let r=this.playerFrameDocument(t);r&&Array.from(r.querySelectorAll("video,audio")).filter(Ie).forEach((s,a)=>{e.push({key:this.mediaKey(t,n,s,a),el:s})})}),e}wireSlideshowMedia(){let e=this.ownedMedia.sync(this.mediaEntries());for(let t of e)t.muted=this._muted||t.defaultMuted}publishMediaState(e,t,n){if(!(this.applyingRemoteMedia||this.resolveMode()==="audience"||!this.channel)){if(n==="timeupdate"){let r=performance.now();if(r-this.lastMediaTimeBroadcastMs<450&&!e.paused)return;this.lastMediaTimeBroadcastMs=r}this.channel.postMedia({key:t,action:n,currentTime:v(e.currentTime,0),paused:e.paused,ended:e.ended,muted:e.muted,volume:v(e.volume,1),playbackRate:v(e.playbackRate,1)})}}onRemoteMedia=e=>{if(this.resolveMode()!=="audience")return;if(this.blockedAudienceMedia.has(e.key)&&e.action==="timeupdate"){this.blockedAudienceMedia.set(e.key,e),this.showAudienceMediaUnlock();return}this.wireSlideshowMedia();let t=this.mediaEntries().find(n=>n.key===e.key);if(t){this.applyingRemoteMedia=!0;try{this.applyRemoteMedia(t.el,e)}finally{setTimeout(()=>{this.applyingRemoteMedia=!1},300)}}};applyRemoteMedia(e,t){if(t.action==="pause"||t.action==="ended"){this.audienceMutedPlaybackKeys.delete(t.key),this.blockedAudienceMedia.delete(t.key),this.syncRemoteMediaState(e,t,!0),e.pause(),this.hideAudienceMediaUnlockIfClear();return}if(t.action==="play"||t.action==="timeupdate"&&t.paused===!1&&e.paused){this.playAudienceMediaMuted(e,t);return}this.syncRemoteMediaState(e,t,!0)}syncRemoteMediaState(e,t,n){e.playbackRate=v(t.playbackRate,1),e.volume=Math.max(0,Math.min(1,v(t.volume,1))),e.muted=this.audienceMutedPlaybackKeys.has(t.key)?!0:t.muted,n&&Number.isFinite(t.currentTime)&&Math.abs((e.currentTime||0)-t.currentTime)>.35&&(e.currentTime=Math.max(0,t.currentTime))}playAudienceMediaMuted(e,t){this.audienceMutedPlaybackKeys.add(t.key),this.syncRemoteMediaState(e,t,!0),e.muted=!0;try{e.play().then(()=>{this.blockedAudienceMedia.delete(t.key),this.hideAudienceMediaUnlockIfClear()}).catch(()=>{this.blockedAudienceMedia.set(t.key,t),this.showAudienceMediaUnlock()})}catch{this.blockedAudienceMedia.set(t.key,t),this.showAudienceMediaUnlock()}}retryBlockedAudienceMedia=()=>{this.wireSlideshowMedia();let e=new Map(this.mediaEntries().map(t=>[t.key,t.el]));for(let[t,n]of this.blockedAudienceMedia){let r=e.get(t);r&&this.playAudienceMediaMuted(r,n)}};showAudienceMediaUnlock(){if(this.resolveMode()!=="audience"||this.audienceMediaUnlockButton)return;let e=document.createElement("button");e.type="button",e.textContent="Play audience media muted",e.style.cssText="position:fixed;left:50%;bottom:96px;transform:translateX(-50%);z-index:100000;border:0;border-radius:999px;padding:12px 18px;background:#fff;color:#111827;box-shadow:0 10px 32px rgba(0,0,0,.28);font:700 14px/1 system-ui,sans-serif;cursor:pointer;pointer-events:auto;",e.addEventListener("click",this.retryBlockedAudienceMedia),this.appendChild(e),this.audienceMediaUnlockButton=e}hideAudienceMediaUnlockIfClear(){this.blockedAudienceMedia.size>0||!this.audienceMediaUnlockButton||(this.audienceMediaUnlockButton.remove(),this.audienceMediaUnlockButton=null)}onKey=e=>{if(Me(e.target))return;let t=document.activeElement,n=t===this||this.contains(t),r=document.querySelectorAll("hyperframes-slideshow").length>1,s=n||!r&&(t===document.body||t===null);if((e.key==="p"||e.key==="P")&&!e.metaKey&&!e.ctrlKey&&!e.altKey){if(!s||!this.shouldShowPresentControl())return;this.present(),e.preventDefault();return}if(this.controller){if(e.key==="ArrowRight"){if(!s)return;this.controller.next(),e.preventDefault()}else if(e.key==="ArrowLeft"){if(!s)return;this.controller.prev(),e.preventDefault()}else if(e.key===" "){if(!n)return;this.controller.next(),e.preventDefault()}else if(e.key==="Backspace"){if(!n)return;this.controller.prev(),e.preventDefault()}else if((e.key==="f"||e.key==="F")&&!e.metaKey&&!e.ctrlKey&&!e.altKey){if(!n)return;this.toggleFullscreen(),e.preventDefault()}}};onMessage=e=>{if(e.source!==window.parent&&e.source!==window||this.resolveMode()==="audience")return;let t=e.data;!t||!this.controller||(t.type==="next"?this.controller.next():t.type==="prev"?this.controller.prev():t.type==="goto"&&typeof t.slideIndex=="number"?this.controller.goToSlide?.(t.slideIndex):t.type==="back"&&this.controller.back?.())};onTouchStart=e=>{let t=e.touches[0];t&&(this.touchStartX=t.clientX,this.touchStartY=t.clientY)};onTouchEnd=e=>{if(!this.controller)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-this.touchStartX,r=t.clientY-this.touchStartY;Math.abs(n)<=40||Math.abs(n)<=Math.abs(r)||(n<0?this.controller.next():this.controller.prev())};render(){if(!this.controller)return;if(this.resolveMode()==="audience"){let{counter:r}=this.controller;this.paintChrome(this.buildNavCluster(r,"28px","fs-only"));return}if(this.getAttribute("data-hf-presenting")==="true"){this.renderPresenter();return}let{counter:e,currentSlide:t}=this.controller;if(!t)return;let n=t.hotspots.map(r=>{let s=r.region?`left:${r.region.x}%;top:${r.region.y}%;`:"right:5%;bottom:18%;";return`<button
81
81
  class="hf-hotspot-pill"
82
82
  data-hotspot-id="${h(r.id)}"
83
83
  data-hotspot-target="${h(r.target)}"
@@ -85,17 +85,18 @@ Use the bare name without `/`. If the command fails, surface the error; do not r
85
85
 
86
86
  ## 5. Load domain skills on demand
87
87
 
88
- | Need | Skill |
89
- | ------------------------------------------------------------------------------------------------------------------- | ------------------------ |
90
- | Composition structure, timing attributes, tracks, variables, determinism | `/hyperframes-core` |
91
- | Motion rules, scene blueprints, transitions, runtime adapters | `/hyperframes-animation` |
92
- | Seek-safe GSAP, CSS, Anime.js, WAAPI, FLIP, paths, masks, SVG, 3D keyframes, or `hyperframes keyframes` diagnostics | `/hyperframes-keyframes` |
93
- | Design specs, concept, palette, typography, narration, beat planning | `/hyperframes-creative` |
94
- | Images, icons, logos, audio, captions, grades, LUTs, reusable media | `/media-use` |
95
- | Voiceover carve, audio effect chains, automation envelopes, or one chain/fader across several tracks (submix bus) | `/hyperframes-audio` |
96
- | Init, lint, check, snapshots, compare, batch render, Studio, render, publish, or diagnostics | `/hyperframes-cli` |
97
- | Registry blocks and components | `/hyperframes-registry` |
98
- | Figma assets, tokens, components, or storyboard frames as reconstructed motion | `/figma` |
88
+ | Need | Skill |
89
+ | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ |
90
+ | Composition structure, timing attributes, tracks, variables, determinism | `/hyperframes-core` |
91
+ | Motion rules, scene blueprints, transitions, runtime adapters | `/hyperframes-animation` |
92
+ | Seek-safe GSAP, CSS, Anime.js, WAAPI, FLIP, paths, masks, SVG, 3D keyframes, or `hyperframes keyframes` diagnostics | `/hyperframes-keyframes` |
93
+ | Design specs, concept, palette, typography, narration, beat planning | `/hyperframes-creative` |
94
+ | Images, icons, logos, audio, captions, grades, LUTs, reusable media | `/media-use` |
95
+ | Voiceover carve, audio effect chains, automation envelopes, or one chain/fader across several tracks (submix bus) | `/hyperframes-audio` |
96
+ | Init, lint, check, snapshots, compare, batch render, Studio, render, publish, or diagnostics | `/hyperframes-cli` |
97
+ | Registry blocks and components | `/hyperframes-registry` |
98
+ | A named look, effect, treatment, or transition CRT scanlines, glitch, film grain, shimmer sweep, confetti burst — BEFORE hand-building it | `/hyperframes-registry` |
99
+ | Figma assets, tokens, components, or storyboard frames as reconstructed motion | `/figma` |
99
100
 
100
101
  Creator edit phrases are cross-domain requests. Load every skill named in the matching row:
101
102
 
@@ -78,10 +78,10 @@ Treat tiny unstyled content, canvas-sized icons, missing hero elements, or timel
78
78
 
79
79
  - **Search the catalog before writing motion by hand.** `npx hyperframes catalog --query "<the beat, in plain English>"`. Search is entirely local: there is no hosted tier, no account, and the query text is never sent anywhere. By default it ranks on vocabulary shared with the item's name, title and description, which misses any phrasing that does not reuse the catalog's own wording. Add `--on-device` to rank by meaning instead (see the offline tier below).
80
80
  - **Query in English even when the video is not.** Both tiers index an English catalog, so a query in another script produces no searchable terms and returns nothing. Describe the move in English; the on-screen copy stays in whatever language the video needs. `No searchable words in query` means exactly this and is not a missing component, so do not report it as a catalog gap.
81
- - **Read which tier answered; never infer it from results appearing.** With `--json` the envelope carries `query`, `tier` (`on-device` or `words`), `tier_detail`, `dropped`, `unindexed`, `shown`, `total` and `results`, plus `top_score` when the answering tier produces one and `warnings` when a tier was asked for and could not run. A weak result on `words` is expected; the same result on `on-device` is a bug. `top_score` is on-device only and has no threshold behind it: the ranker returns the whole catalog in some order for every query, so read it as evidence rather than as a pass or fail.
81
+ - **Read which tier answered; never infer it from results appearing.** With `--json` the envelope carries `query`, `tier` (`on-device` or `words`), `tier_detail`, `dropped`, `unindexed`, `shown`, `total` and `results`, plus `top_score` when the answering tier produces one and `warnings` when a tier was asked for and could not run, or when a search returned nothing and a better tier is still waiting on someone's consent. A weak result on `words` is expected; the same result on `on-device` is a bug. `top_score` is on-device only and has no threshold behind it: the ranker returns the whole catalog in some order for every query, so read it as evidence rather than as a pass or fail.
82
82
  - **`dropped` and `unindexed` are opposite skews between the registry and the on-device index, and rewording the query fixes neither.** `dropped` counts ranked names this registry cannot install, so the strongest matches are the ones being lost. `unindexed` counts registry moves the index cannot see at all, which no query can ever return. Refreshing the registry is not the answer to either: its manifest carries a 24h TTL and heals itself, while the vectors are a separately published artifact fetched into `~/.hyperframes/catalog/`. Re-running with `--on-device` refetches that index when `unindexed` is above zero, so that is the remedy to hand the user. A pure over-coverage skew (`dropped` above zero while `unindexed` is zero) does not trigger the refetch; clearing `~/.hyperframes/catalog/` is the only way out of that one. Both counts are of names rather than of results, so either can exceed `total`.
83
83
  - **When a search comes back with nothing worth installing, say so.** `npx hyperframes feedback --search-miss "<the query you ran>" --wanted "<the move you needed>" --tier <the tier that answered>`. You do not have to assemble that line: `catalog --query` prints it pre-filled, and every `--json` search envelope carries it as `report_gap` with the query and tier already correct — fill in `--wanted` and send. This is the only path that sends a query anywhere, and it is a separate deliberate command precisely so plain `catalog --query` keeps its promise of sending nothing. **Report on either tier**, whenever the results do not do the thing; do not hold out for the on-device tier, which needs a consented 33 MB download and is therefore off in most agent runs — waiting for it means never reporting at all. The tier rides along in the report, so a vocabulary miss stays distinguishable from a meaning miss without you having to judge which one you hit. What comes back is a list of moves the catalog does not have yet, read directly rather than guessed from install counts, so the phrasing that matters is the effect you wanted, not the item name you imagined. It carries no rating and never lands in the rating metric.
84
- - **Offer the offline tier; never enable it silently.** A one-time ~33 MB download (a quantized ONNX build of `bge-small-en-v1.5` plus its tokenizer, pinned to a fixed revision) and the catalog vectors from the registry, both cached under `~/.hyperframes/`, neither added to the project or any package. Once cached it ranks by meaning with nothing sent. Say the size out loud and let the person decide, then pass `--on-device` (with `-y` to skip the prompt) once they agree. The interactive offer only fires on a TTY, and under `--json` nothing about it is printed at all, so in an agent run you have to raise it with the user yourself.
84
+ - **Offer the offline tier; never enable it silently.** A one-time ~33 MB download (a quantized ONNX build of `bge-small-en-v1.5` plus its tokenizer, pinned to a fixed revision) and the catalog vectors from the registry, both cached under `~/.hyperframes/`, neither added to the project or any package. Once cached it ranks by meaning with nothing sent. Say the size out loud and let the person decide, then pass `--on-device` (with `-y` to skip the prompt) once they agree. The interactive offer only fires on a TTY. Under `--json` there is no prompt, but a search that found nothing puts the same ask in `warnings`, so read that array and put the decision to the user yourself.
85
85
 
86
86
  - Prefer `--json` for agent and CI calls. Server-mode `render`, `preview`, and `play` do not provide ordinary JSON output; `preview --selection --json` and `preview --context --json` are query-mode exceptions.
87
87
  - `doctor --json` always exits zero. Gate on its payload:
@@ -1,5 +1,7 @@
1
1
  # init, capture, skills
2
2
 
3
+ <!-- registry-items: allow=blank,landscape-4k,portrait-4k,square-4k,product-launch-video,hyperframes-core,media-use -->
4
+
3
5
  Scaffolding commands. Use these instead of creating files by hand — they set up the right file structure, copy media, run transcription, and install AI coding skills.
4
6
 
5
7
  ## init
@@ -16,7 +18,7 @@ npx hyperframes init my-video --non-interactive --example blank # CI/agents —
16
18
 
17
19
  **Default depends on TTY**: in a terminal, the CLI prompts for example/options. Outside a TTY (CI, agents, piped output) it auto-switches to non-interactive and **requires `--example`** (the CLI errors with a usage example if missing). Pass `--non-interactive` to force flag-only mode even on a TTY.
18
20
 
19
- Templates: `blank`, `warm-grain`, `play-mode`, `swiss-grid`, `vignelli`, `decision-tree`, `kinetic-type`, `product-promo`, `nyt-graph`.
21
+ Templates: `blank`, `warm-grain`, `play-mode`, `swiss-grid`, `vignelli`, `decision-tree`, `kinetic-type`, `product-promo`, `nyt-graph`, `vscode-theme-visualizer`. (The closed set of `hyperframes:example` items in `registry/registry.json`. `hyperframes catalog` does not list examples — its `--type` takes only `block` or `component` — so this list has no live equivalent and is checked by `bun run lint:skills`.)
20
22
 
21
23
  Other useful flags:
22
24
 
@@ -1,4 +1,4 @@
1
- var ve=Object.defineProperty;var be=(n,i,e)=>i in n?ve(n,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[i]=e;var u=(n,i,e)=>be(n,typeof i!="symbol"?i+"":i,e);import{r as le,i as we,a as Ae}from"./index-DOoo96Tb.js";function Ee(n){return n.hasRuntime||n.runtimeInjected?!1:!!(n.hasNestedCompositions||n.hasTimelines&&n.attempts>=5)}function V(n){return typeof n=="object"&&n!==null}function Ce(n){return V(n)&&typeof n.getDuration=="function"}function Te(n){return V(n)&&typeof n.duration=="function"&&typeof n.time=="function"&&typeof n.seek=="function"&&typeof n.play=="function"&&typeof n.pause=="function"}function Se(n){if(!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(n))throw new Error(`Invalid HyperFrames runtime version: ${n}`);return`https://cdn.jsdelivr.net/npm/@hyperframes/core@${n}/dist/hyperframe.runtime.iife.js`}const H=typeof __HYPERFRAMES_RUNTIME_CDN_URL__=="string"?__HYPERFRAMES_RUNTIME_CDN_URL__:Se("0.0.0-dev");function $(n){if(n===null)return null;const i=Number.parseInt(n,10);return Number.isFinite(i)&&i>0?i:null}function Re(n){const i=(n==null?void 0:n.querySelector("[data-composition-id][data-width][data-height]"))??(n==null?void 0:n.querySelector("[data-width][data-height]"));if(!i)return null;const e=$(i.getAttribute("data-width")),t=$(i.getAttribute("data-height"));return e!==null&&t!==null?{width:e,height:t}:null}class xe{constructor(i,e){u(this,"_interval",null);u(this,"_runtimeInjected",!1);this._iframe=i,this._callbacks=e}get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let i=0;this._interval=setInterval(()=>{var e;i++;try{const t=this._iframe.contentWindow;if(!t)return;const r=!!(t.__hf||t.__player),s=!!(t.__timelines&&Object.keys(t.__timelines).length>0),o=!!((e=this._iframe.contentDocument)!=null&&e.querySelector("[data-composition-src]"));if(Ee({hasRuntime:r,hasTimelines:s,hasNestedCompositions:o,runtimeInjected:this._runtimeInjected,attempts:i})){this._injectRuntime();return}if(this._runtimeInjected&&!r)return;const d=this._resolvePlaybackDurationAdapter(t);if(d&&d.getDuration()>0){this.stop();const p=Re(this._iframe.contentDocument);this._callbacks.onReady({duration:d.getDuration(),adapter:d,compositionSize:p});return}}catch{}i>=40&&(this.stop(),this._callbacks.onError("Composition timeline not found after 8s"))},200)}stop(){this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{const i=this._iframe.contentWindow;return i?this._resolveDirectTimelineAdapterFromWindow(i):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(i){return this._resolveDirectTimelineAdapterFromWindow(i)}hasRuntimeBridge(i){return Reflect.get(i,"__hf")!==void 0||V(Reflect.get(i,"__player"))}_injectRuntime(){var i,e;this._runtimeInjected=!0;try{const t=this._iframe.contentDocument;if(!t)return;const r=t.createElement("script");r.src=H,(t.head||t.documentElement).appendChild(r),(e=(i=this._callbacks).onRuntimeInjected)==null||e.call(i)}catch{}}_resolveDirectTimelineAdapterFromWindow(i){var d,p;if(this.hasRuntimeBridge(i))return null;const e=Reflect.get(i,"__timelines");if(!V(e))return null;const t=Object.keys(e);if(t.length===0)return null;const r=(p=(d=this._iframe.contentDocument)==null?void 0:d.querySelector("[data-composition-id]"))==null?void 0:p.getAttribute("data-composition-id"),s=r&&r in e?r:t[t.length-1],o=e[s];return Te(o)?o:null}_resolvePlaybackDurationAdapter(i){const e=Reflect.get(i,"__player");if(Ce(e))return{kind:"runtime",getDuration:()=>e.getDuration()};const t=this._resolveDirectTimelineAdapterFromWindow(i);return t?{kind:"direct-timeline",timeline:t,getDuration:()=>t.duration()}:null}}const Me=`
1
+ var ve=Object.defineProperty;var be=(n,i,e)=>i in n?ve(n,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[i]=e;var u=(n,i,e)=>be(n,typeof i!="symbol"?i+"":i,e);import{r as le,i as we,a as Ae}from"./index-BRr1JoHX.js";function Ee(n){return n.hasRuntime||n.runtimeInjected?!1:!!(n.hasNestedCompositions||n.hasTimelines&&n.attempts>=5)}function V(n){return typeof n=="object"&&n!==null}function Ce(n){return V(n)&&typeof n.getDuration=="function"}function Te(n){return V(n)&&typeof n.duration=="function"&&typeof n.time=="function"&&typeof n.seek=="function"&&typeof n.play=="function"&&typeof n.pause=="function"}function Se(n){if(!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(n))throw new Error(`Invalid HyperFrames runtime version: ${n}`);return`https://cdn.jsdelivr.net/npm/@hyperframes/core@${n}/dist/hyperframe.runtime.iife.js`}const H=typeof __HYPERFRAMES_RUNTIME_CDN_URL__=="string"?__HYPERFRAMES_RUNTIME_CDN_URL__:Se("0.0.0-dev");function $(n){if(n===null)return null;const i=Number.parseInt(n,10);return Number.isFinite(i)&&i>0?i:null}function Re(n){const i=(n==null?void 0:n.querySelector("[data-composition-id][data-width][data-height]"))??(n==null?void 0:n.querySelector("[data-width][data-height]"));if(!i)return null;const e=$(i.getAttribute("data-width")),t=$(i.getAttribute("data-height"));return e!==null&&t!==null?{width:e,height:t}:null}class xe{constructor(i,e){u(this,"_interval",null);u(this,"_runtimeInjected",!1);this._iframe=i,this._callbacks=e}get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let i=0;this._interval=setInterval(()=>{var e;i++;try{const t=this._iframe.contentWindow;if(!t)return;const r=!!(t.__hf||t.__player),s=!!(t.__timelines&&Object.keys(t.__timelines).length>0),o=!!((e=this._iframe.contentDocument)!=null&&e.querySelector("[data-composition-src]"));if(Ee({hasRuntime:r,hasTimelines:s,hasNestedCompositions:o,runtimeInjected:this._runtimeInjected,attempts:i})){this._injectRuntime();return}if(this._runtimeInjected&&!r)return;const d=this._resolvePlaybackDurationAdapter(t);if(d&&d.getDuration()>0){this.stop();const p=Re(this._iframe.contentDocument);this._callbacks.onReady({duration:d.getDuration(),adapter:d,compositionSize:p});return}}catch{}i>=40&&(this.stop(),this._callbacks.onError("Composition timeline not found after 8s"))},200)}stop(){this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{const i=this._iframe.contentWindow;return i?this._resolveDirectTimelineAdapterFromWindow(i):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(i){return this._resolveDirectTimelineAdapterFromWindow(i)}hasRuntimeBridge(i){return Reflect.get(i,"__hf")!==void 0||V(Reflect.get(i,"__player"))}_injectRuntime(){var i,e;this._runtimeInjected=!0;try{const t=this._iframe.contentDocument;if(!t)return;const r=t.createElement("script");r.src=H,(t.head||t.documentElement).appendChild(r),(e=(i=this._callbacks).onRuntimeInjected)==null||e.call(i)}catch{}}_resolveDirectTimelineAdapterFromWindow(i){var d,p;if(this.hasRuntimeBridge(i))return null;const e=Reflect.get(i,"__timelines");if(!V(e))return null;const t=Object.keys(e);if(t.length===0)return null;const r=(p=(d=this._iframe.contentDocument)==null?void 0:d.querySelector("[data-composition-id]"))==null?void 0:p.getAttribute("data-composition-id"),s=r&&r in e?r:t[t.length-1],o=e[s];return Te(o)?o:null}_resolvePlaybackDurationAdapter(i){const e=Reflect.get(i,"__player");if(Ce(e))return{kind:"runtime",getDuration:()=>e.getDuration()};const t=this._resolveDirectTimelineAdapterFromWindow(i);return t?{kind:"direct-timeline",timeline:t,getDuration:()=>t.duration()}:null}}const Me=`
2
2
  :host {
3
3
  display: block;
4
4
  position: relative;