media-chrome
Advanced tools
Comparing version 0.5.2 to 0.5.3
@@ -1,1 +0,2 @@ | ||
export const MediaUIEvents={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_CAPTIONS_REQUEST:"mediashowcaptionsrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_CAPTIONS_REQUEST:"mediadisablecaptionsrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},MediaUIAttributes={MEDIA_AIRPLAY_UNAVAILABLE:"media-airplay-unavailable",MEDIA_PIP_UNAVAILABLE:"media-pip-unavailable",MEDIA_PAUSED:"media-paused",MEDIA_HAS_PLAYED:"media-has-played",MEDIA_MUTED:"media-muted",MEDIA_VOLUME_LEVEL:"media-volume-level",MEDIA_VOLUME:"media-volume",MEDIA_VOLUME_UNAVAILABLE:"media-volume-unavailable",MEDIA_IS_PIP:"media-is-pip",MEDIA_CAPTIONS_LIST:"media-captions-list",MEDIA_SUBTITLES_LIST:"media-subtitles-list",MEDIA_CAPTIONS_SHOWING:"media-captions-showing",MEDIA_SUBTITLES_SHOWING:"media-subtitles-showing",MEDIA_IS_FULLSCREEN:"media-is-fullscreen",MEDIA_PLAYBACK_RATE:"media-playback-rate",MEDIA_CURRENT_TIME:"media-current-time",MEDIA_DURATION:"media-duration",MEDIA_PREVIEW_IMAGE:"media-preview-image",MEDIA_PREVIEW_COORDS:"media-preview-coords",MEDIA_CHROME_ATTRIBUTES:"media-chrome-attributes",MEDIA_CONTROLLER:"media-controller",MEDIA_LOADING:"media-loading"},TextTrackKinds={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},TextTrackModes={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"},ReadyStates={HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4},AvailabilityStates={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"}; | ||
const e={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_CAPTIONS_REQUEST:"mediashowcaptionsrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_CAPTIONS_REQUEST:"mediadisablecaptionsrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},E={MEDIA_AIRPLAY_UNAVAILABLE:"media-airplay-unavailable",MEDIA_PIP_UNAVAILABLE:"media-pip-unavailable",MEDIA_PAUSED:"media-paused",MEDIA_HAS_PLAYED:"media-has-played",MEDIA_MUTED:"media-muted",MEDIA_VOLUME_LEVEL:"media-volume-level",MEDIA_VOLUME:"media-volume",MEDIA_VOLUME_UNAVAILABLE:"media-volume-unavailable",MEDIA_IS_PIP:"media-is-pip",MEDIA_CAPTIONS_LIST:"media-captions-list",MEDIA_SUBTITLES_LIST:"media-subtitles-list",MEDIA_CAPTIONS_SHOWING:"media-captions-showing",MEDIA_SUBTITLES_SHOWING:"media-subtitles-showing",MEDIA_IS_FULLSCREEN:"media-is-fullscreen",MEDIA_PLAYBACK_RATE:"media-playback-rate",MEDIA_CURRENT_TIME:"media-current-time",MEDIA_DURATION:"media-duration",MEDIA_PREVIEW_IMAGE:"media-preview-image",MEDIA_PREVIEW_COORDS:"media-preview-coords",MEDIA_CHROME_ATTRIBUTES:"media-chrome-attributes",MEDIA_CONTROLLER:"media-controller",MEDIA_LOADING:"media-loading"},A={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},_={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"},a={HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4},i={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"};export{i as AvailabilityStates,E as MediaUIAttributes,e as MediaUIEvents,a as ReadyStates,A as TextTrackKinds,_ as TextTrackModes}; | ||
//# sourceMappingURL=constants.js.map |
@@ -1,1 +0,2 @@ | ||
import*as E from"./constants.js";export{E as constants};export{default as labels}from"./labels/labels.js";import*as P from"./utils/time.js";export{P as timeUtils};import r from"./media-airplay-button.js";import m from"./media-chrome-button.js";import i from"./media-controller.js";import s from"./media-chrome-range.js";import n from"./media-control-bar.js";import d from"./media-current-time-display.js";import l from"./media-duration-display.js";import p from"./media-time-display.js";import u from"./media-captions-button.js";import f from"./media-seek-forward-button.js";import c from"./media-fullscreen-button.js";import M from"./media-mute-button.js";import j from"./media-pip-button.js";import b from"./media-play-button.js";import g from"./media-playback-rate-button.js";import y from"./media-progress-range.js";import B from"./media-seek-backward-button.js";import t from"./media-thumbnail-preview.js";import h from"./media-time-range.js";import w from"./media-loading-indicator.js";import C from"./media-title-element.js";import k from"./media-volume-range.js";import{Window as e}from"./utils/server-safe-globals.js";class x extends i{}e.customElements.get("media-chrome")||e.customElements.define("media-chrome",x);class o extends i{constructor(){super();console.warn("MediaChrome: <media-container> is deprecated. Use <media-controller>.")}}e.customElements.get("media-container")||e.customElements.define("media-container",o);export{r as MediaAirplayButton,m as MediaChromeButton,o as MediaContainer,i as MediaController,s as MediaChromeRange,n as MediaControlBar,d as MediaCurrentTimeDisplay,l as MediaDurationDisplay,p as MediaTimeDisplay,u as MediaCaptionsButton,f as MediaSeekForwardButton,c as MediaFullscreenButton,M as MediaMuteButton,j as MediaPipButton,b as MediaPlayButton,g as MediaPlaybackRateButton,y as MediaProgressRange,B as MediaSeekBackwardButton,t as MediaThumbnailPreview,t as MediaThumbnailPreviewElement,h as MediaTimeRange,C as MediaTitleElement,w as MediaLoadingIndicator,k as MediaVolumeRange}; | ||
import*as b from"./constants.js";import{default as oe}from"./labels/labels.js";import*as k from"./utils/time.js";import m from"./media-airplay-button.js";import a from"./media-chrome-button.js";import o from"./media-controller.js";import n from"./media-chrome-range.js";import d from"./media-control-bar.js";import p from"./media-current-time-display.js";import s from"./media-duration-display.js";import f from"./media-time-display.js";import l from"./media-captions-button.js";import M from"./media-seek-forward-button.js";import u from"./media-fullscreen-button.js";import c from"./media-mute-button.js";import B from"./media-pip-button.js";import g from"./media-play-button.js";import C from"./media-playback-rate-button.js";import h from"./media-poster-image.js";import w from"./media-progress-range.js";import P from"./media-seek-backward-button.js";import r from"./media-thumbnail-preview.js";import x from"./media-time-range.js";import y from"./media-loading-indicator.js";import E from"./media-title-element.js";import T from"./media-volume-range.js";import{Window as e}from"./utils/server-safe-globals.js";class R extends o{}e.customElements.get("media-chrome")||e.customElements.define("media-chrome",R);class i extends o{constructor(){super();console.warn("MediaChrome: <media-container> is deprecated. Use <media-controller>.")}}e.customElements.get("media-container")||e.customElements.define("media-container",i);export{m as MediaAirplayButton,l as MediaCaptionsButton,a as MediaChromeButton,n as MediaChromeRange,i as MediaContainer,d as MediaControlBar,o as MediaController,p as MediaCurrentTimeDisplay,s as MediaDurationDisplay,u as MediaFullscreenButton,y as MediaLoadingIndicator,c as MediaMuteButton,B as MediaPipButton,g as MediaPlayButton,C as MediaPlaybackRateButton,h as MediaPosterImage,w as MediaProgressRange,P as MediaSeekBackwardButton,M as MediaSeekForwardButton,r as MediaThumbnailPreview,r as MediaThumbnailPreviewElement,f as MediaTimeDisplay,x as MediaTimeRange,E as MediaTitleElement,T as MediaVolumeRange,b as constants,oe as labels,k as timeUtils}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,1 +0,2 @@ | ||
export const nouns={AUDIO_PLAYER:()=>"audio player",VIDEO_PLAYER:()=>"video player",VOLUME:()=>"volume",SEEK:()=>"seek",CLOSED_CAPTIONS:()=>"closed captions",PLAYBACK_RATE:({playbackRate:e=1}={})=>`current playback rate ${e}`,PLAYBACK_TIME:()=>"playback time",MEDIA_LOADING:()=>"media loading"},verbs={PLAY:()=>"play",PAUSE:()=>"pause",MUTE:()=>"mute",UNMUTE:()=>"unmute",AIRPLAY:()=>"air play",ENTER_FULLSCREEN:()=>"enter fullscreen mode",EXIT_FULLSCREEN:()=>"exit fullscreen mode",ENTER_PIP:()=>"enter picture in picture mode",EXIT_PIP:()=>"exit picture in picture mode",SEEK_FORWARD_N_SECS:({seekOffset:e=30}={})=>`seek forward ${e} seconds`,SEEK_BACK_N_SECS:({seekOffset:e=30}={})=>`seek back ${e} seconds`};export default{...nouns,...verbs}; | ||
const E={AUDIO_PLAYER:()=>"audio player",VIDEO_PLAYER:()=>"video player",VOLUME:()=>"volume",SEEK:()=>"seek",CLOSED_CAPTIONS:()=>"closed captions",PLAYBACK_RATE:({playbackRate:e=1}={})=>`current playback rate ${e}`,PLAYBACK_TIME:()=>"playback time",MEDIA_LOADING:()=>"media loading"},r={PLAY:()=>"play",PAUSE:()=>"pause",MUTE:()=>"mute",UNMUTE:()=>"unmute",AIRPLAY:()=>"air play",ENTER_FULLSCREEN:()=>"enter fullscreen mode",EXIT_FULLSCREEN:()=>"exit fullscreen mode",ENTER_PIP:()=>"enter picture in picture mode",EXIT_PIP:()=>"exit picture in picture mode",SEEK_FORWARD_N_SECS:({seekOffset:e=30}={})=>`seek forward ${e} seconds`,SEEK_BACK_N_SECS:({seekOffset:e=30}={})=>`seek back ${e} seconds`};var t={...E,...r};export{t as default,E as nouns,r as verbs}; | ||
//# sourceMappingURL=labels.js.map |
@@ -1,6 +0,7 @@ | ||
import l from"./media-chrome-button.js";import{defineCustomElement as o}from"./utils/defineCustomElement.js";import{Window as r,Document as i}from"./utils/server-safe-globals.js";import{MediaUIEvents as n,MediaUIAttributes as c}from"./constants.js";import{verbs as m}from"./labels/labels.js";const d='<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 18"><defs><style>.cls-1{fill:var(--media-icon-color, #eee);}</style></defs><title>Mux Player SVG Icons_v2</title><path class="cls-1" d="M10.19,11.22a.25.25,0,0,0-.38,0L4.35,17.59a.25.25,0,0,0,.19.41H15.46a.25.25,0,0,0,.19-.41Z"/><path class="cls-1" d="M19,0H1A1,1,0,0,0,0,1V14a1,1,0,0,0,1,1H3.94L5,13.75H1.25V1.25h17.5v12.5H15L16.06,15H19a1,1,0,0,0,1-1V1A1,1,0,0,0,19,0Z"/></svg>',t=i.createElement("template");t.innerHTML=` | ||
import o from"./media-chrome-button.js";import{defineCustomElement as r}from"./utils/defineCustomElement.js";import{Window as l,Document as i}from"./utils/server-safe-globals.js";import{MediaUIEvents as n,MediaUIAttributes as c}from"./constants.js";import{verbs as d}from"./labels/labels.js";const m='<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 18"><defs><style>.cls-1{fill:var(--media-icon-color, #eee);}</style></defs><title>Mux Player SVG Icons_v2</title><path class="cls-1" d="M10.19,11.22a.25.25,0,0,0-.38,0L4.35,17.59a.25.25,0,0,0,.19.41H15.46a.25.25,0,0,0,.19-.41Z"/><path class="cls-1" d="M19,0H1A1,1,0,0,0,0,1V14a1,1,0,0,0,1,1H3.94L5,13.75H1.25V1.25h17.5v12.5H15L16.06,15H19a1,1,0,0,0,1-1V1A1,1,0,0,0,19,0Z"/></svg>',t=i.createElement("template");t.innerHTML=` | ||
<style> | ||
</style> | ||
<slot name="airplay">${d}</slot> | ||
`;class s extends l{static get observedAttributes(){return[...super.observedAttributes,c.MEDIA_AIRPLAY_UNAVAILABLE]}constructor(e={}){super({slotTemplate:t,...e})}connectedCallback(){this.setAttribute("aria-label",m.AIRPLAY()),super.connectedCallback()}handleClick(e){const a=new r.CustomEvent(n.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(a)}}o("media-airplay-button",s);export default s; | ||
<slot name="airplay">${m}</slot> | ||
`;class s extends o{static get observedAttributes(){return[...super.observedAttributes,c.MEDIA_AIRPLAY_UNAVAILABLE]}constructor(e={}){super({slotTemplate:t,...e})}connectedCallback(){this.setAttribute("aria-label",d.AIRPLAY()),super.connectedCallback()}handleClick(e){const a=new l.CustomEvent(n.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(a)}}r("media-airplay-button",s);var L=s;export{L as default}; | ||
//# sourceMappingURL=media-airplay-button.js.map |
@@ -1,2 +0,2 @@ | ||
import p from"./media-chrome-button.js";import{defineCustomElement as E}from"./utils/defineCustomElement.js";import{Window as d,Document as f}from"./utils/server-safe-globals.js";import{MediaUIEvents as u,MediaUIAttributes as t}from"./constants.js";import{nouns as _}from"./labels/labels.js";import{splitTextTracksStr as h}from"./utils/captions.js";const T=` | ||
import p from"./media-chrome-button.js";import{defineCustomElement as E}from"./utils/defineCustomElement.js";import{Window as d,Document as _}from"./utils/server-safe-globals.js";import{MediaUIEvents as u,MediaUIAttributes as t}from"./constants.js";import{nouns as f}from"./labels/labels.js";import{splitTextTracksStr as h}from"./utils/captions.js";const T=` | ||
<svg | ||
@@ -31,3 +31,3 @@ aria-hidden="true" | ||
</svg> | ||
`,m=` | ||
`,g=` | ||
<svg | ||
@@ -61,3 +61,3 @@ aria-hidden="true" | ||
</svg> | ||
`,b=f.createElement("template");b.innerHTML=` | ||
`,I=_.createElement("template");I.innerHTML=` | ||
<style> | ||
@@ -77,3 +77,4 @@ :host([aria-checked="true"]) slot:not([name=on]) > *, | ||
<slot name="on">${T}</slot> | ||
<slot name="off">${m}</slot> | ||
`;const I=s=>{s.setAttribute("aria-checked",S(s))},S=s=>{const e=!!s.getAttribute(t.MEDIA_CAPTIONS_SHOWING),r=!s.hasAttribute("no-subtitles-fallback")&&!!s.getAttribute(t.MEDIA_SUBTITLES_SHOWING);return e||r};class A extends p{static get observedAttributes(){return[...super.observedAttributes,"no-subtitles-fallback","default-showing",t.MEDIA_CAPTIONS_LIST,t.MEDIA_CAPTIONS_SHOWING,t.MEDIA_SUBTITLES_LIST,t.MEDIA_SUBTITLES_SHOWING]}constructor(e={}){super({slotTemplate:b,...e});this._captionsReady=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",_.CLOSED_CAPTIONS()),I(this)}attributeChangedCallback(e,r,c){if([t.MEDIA_CAPTIONS_SHOWING,t.MEDIA_SUBTITLES_SHOWING].includes(e)&&I(this),this.hasAttribute("default-showing")&&this.getAttribute("aria-checked")!=="true"){const o=!this.hasAttribute("no-subtitles-fallback");if((o?[t.MEDIA_CAPTIONS_LIST,t.MEDIA_SUBTITLES_LIST]:[t.MEDIA_CAPTIONS_LIST]).includes(e)){const n=!!this.getAttribute(t.MEDIA_CAPTIONS_LIST)||!!(o&&this.getAttribute(t.MEDIA_SUBTITLES_LIST));this._captionsReady!==n&&(this._captionsReady=n,this._captionsReady&&this.handleClick())}}super.attributeChangedCallback(e,r,c)}handleClick(e){var c,o,C,n;if(S(this)){const a=this.getAttribute(t.MEDIA_CAPTIONS_SHOWING);if(a){const l=new d.CustomEvent(u.MEDIA_DISABLE_CAPTIONS_REQUEST,{composed:!0,bubbles:!0,detail:a});this.dispatchEvent(l)}const i=this.getAttribute(t.MEDIA_SUBTITLES_SHOWING);if(i&&!this.hasAttribute("no-subtitles-fallback")){const l=new d.CustomEvent(u.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:i});this.dispatchEvent(l)}}else{const[a]=(o=h((c=this.getAttribute(t.MEDIA_CAPTIONS_LIST))!=null?c:""))!=null?o:[];if(a){const i=new d.CustomEvent(u.MEDIA_SHOW_CAPTIONS_REQUEST,{composed:!0,bubbles:!0,detail:a});this.dispatchEvent(i)}else if(this.hasAttribute("no-subtitles-fallback"))console.error("Attempting to enable closed captions but none are available! Please verify your media content if this is unexpected.");else{const[i]=(n=h((C=this.getAttribute(t.MEDIA_SUBTITLES_LIST))!=null?C:""))!=null?n:[];if(i){const l=new d.CustomEvent(u.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:i});this.dispatchEvent(l)}}}}}E("media-captions-button",A);export default A; | ||
<slot name="off">${g}</slot> | ||
`;const b=s=>{s.setAttribute("aria-checked",S(s))},S=s=>{const e=!!s.getAttribute(t.MEDIA_CAPTIONS_SHOWING),r=!s.hasAttribute("no-subtitles-fallback")&&!!s.getAttribute(t.MEDIA_SUBTITLES_SHOWING);return e||r};class A extends p{static get observedAttributes(){return[...super.observedAttributes,"no-subtitles-fallback","default-showing",t.MEDIA_CAPTIONS_LIST,t.MEDIA_CAPTIONS_SHOWING,t.MEDIA_SUBTITLES_LIST,t.MEDIA_SUBTITLES_SHOWING]}constructor(e={}){super({slotTemplate:I,...e});this._captionsReady=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",f.CLOSED_CAPTIONS()),b(this)}attributeChangedCallback(e,r,c){if([t.MEDIA_CAPTIONS_SHOWING,t.MEDIA_SUBTITLES_SHOWING].includes(e)&&b(this),this.hasAttribute("default-showing")&&this.getAttribute("aria-checked")!=="true"){const o=!this.hasAttribute("no-subtitles-fallback");if((o?[t.MEDIA_CAPTIONS_LIST,t.MEDIA_SUBTITLES_LIST]:[t.MEDIA_CAPTIONS_LIST]).includes(e)){const n=!!this.getAttribute(t.MEDIA_CAPTIONS_LIST)||!!(o&&this.getAttribute(t.MEDIA_SUBTITLES_LIST));this._captionsReady!==n&&(this._captionsReady=n,this._captionsReady&&this.handleClick())}}super.attributeChangedCallback(e,r,c)}handleClick(e){var c,o,C,n;if(S(this)){const a=this.getAttribute(t.MEDIA_CAPTIONS_SHOWING);if(a){const l=new d.CustomEvent(u.MEDIA_DISABLE_CAPTIONS_REQUEST,{composed:!0,bubbles:!0,detail:a});this.dispatchEvent(l)}const i=this.getAttribute(t.MEDIA_SUBTITLES_SHOWING);if(i&&!this.hasAttribute("no-subtitles-fallback")){const l=new d.CustomEvent(u.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:i});this.dispatchEvent(l)}}else{const[a]=(o=h((c=this.getAttribute(t.MEDIA_CAPTIONS_LIST))!=null?c:""))!=null?o:[];if(a){const i=new d.CustomEvent(u.MEDIA_SHOW_CAPTIONS_REQUEST,{composed:!0,bubbles:!0,detail:a});this.dispatchEvent(i)}else if(this.hasAttribute("no-subtitles-fallback"))console.error("Attempting to enable closed captions but none are available! Please verify your media content if this is unexpected.");else{const[i]=(n=h((C=this.getAttribute(t.MEDIA_SUBTITLES_LIST))!=null?C:""))!=null?n:[];if(i){const l=new d.CustomEvent(u.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:i});this.dispatchEvent(l)}}}}}E("media-captions-button",A);var O=A;export{O as default}; | ||
//# sourceMappingURL=media-captions-button.js.map |
@@ -57,2 +57,3 @@ import{MediaUIAttributes as r}from"./constants.js";import{defineCustomElement as b}from"./utils/defineCustomElement.js";import{Window as g,Document as a}from"./utils/server-safe-globals.js";const d=a.createElement("template");d.innerHTML=` | ||
</style> | ||
`;const l=["Enter"," "];class h extends g.HTMLElement{static get observedAttributes(){return[r.MEDIA_CONTROLLER]}constructor(i={}){super();const n=this.attachShadow({mode:"open"}),e=d.content.cloneNode(!0);this.nativeEl=e;let s=i.slotTemplate;s||(s=a.createElement("template"),s.innerHTML=`<slot>${i.defaultContent||""}</slot>`),this.nativeEl.appendChild(s.content.cloneNode(!0)),n.appendChild(e),this.addEventListener("click",t=>{this.handleClick(t)});const o=t=>{const{key:c}=t;if(!l.includes(c)){this.removeEventListener("keyup",o);return}this.handleClick(t)};this.addEventListener("keydown",t=>{const{metaKey:c,altKey:u,key:m}=t;if(c||u||!l.includes(m)){this.removeEventListener("keyup",o);return}this.addEventListener("keyup",o)})}attributeChangedCallback(i,n,e){var s,o;if(i===r.MEDIA_CONTROLLER){if(n){const t=a.getElementById(n);(s=t==null?void 0:t.unassociateElement)==null||s.call(t,this)}if(e){const t=a.getElementById(e);(o=t==null?void 0:t.associateElement)==null||o.call(t,this)}}}connectedCallback(){var n;this.setAttribute("role","button"),this.setAttribute("tabindex",0);const i=this.getAttribute(r.MEDIA_CONTROLLER);if(i){const e=a.getElementById(i);(n=e==null?void 0:e.associateElement)==null||n.call(e,this)}}disconnectedCallback(){var n;if(this.getAttribute(r.MEDIA_CONTROLLER)){const e=a.getElementById(mediaControllerId);(n=e==null?void 0:e.unassociateElement)==null||n.call(e,this)}}handleClick(){}}b("media-chrome-button",h);export default h; | ||
`;const h=["Enter"," "];class l extends g.HTMLElement{static get observedAttributes(){return[r.MEDIA_CONTROLLER]}constructor(i={}){super();const n=this.attachShadow({mode:"open"}),e=d.content.cloneNode(!0);this.nativeEl=e;let o=i.slotTemplate;o||(o=a.createElement("template"),o.innerHTML=`<slot>${i.defaultContent||""}</slot>`),this.nativeEl.appendChild(o.content.cloneNode(!0)),n.appendChild(e),this.addEventListener("click",t=>{this.handleClick(t)});const s=t=>{const{key:c}=t;if(!h.includes(c)){this.removeEventListener("keyup",s);return}this.handleClick(t)};this.addEventListener("keydown",t=>{const{metaKey:c,altKey:u,key:m}=t;if(c||u||!h.includes(m)){this.removeEventListener("keyup",s);return}this.addEventListener("keyup",s)})}attributeChangedCallback(i,n,e){var o,s;if(i===r.MEDIA_CONTROLLER){if(n){const t=a.getElementById(n);(o=t==null?void 0:t.unassociateElement)==null||o.call(t,this)}if(e){const t=a.getElementById(e);(s=t==null?void 0:t.associateElement)==null||s.call(t,this)}}}connectedCallback(){var n;this.setAttribute("role","button"),this.setAttribute("tabindex",0);const i=this.getAttribute(r.MEDIA_CONTROLLER);if(i){const e=a.getElementById(i);(n=e==null?void 0:e.associateElement)==null||n.call(e,this)}}disconnectedCallback(){var n;if(this.getAttribute(r.MEDIA_CONTROLLER)){const e=a.getElementById(mediaControllerId);(n=e==null?void 0:e.unassociateElement)==null||n.call(e,this)}}handleClick(){}}b("media-chrome-button",l);var k=l;export{k as default}; | ||
//# sourceMappingURL=media-chrome-button.js.map |
@@ -1,2 +0,2 @@ | ||
import{MediaUIAttributes as o}from"./constants.js";import{defineCustomElement as g}from"./utils/defineCustomElement.js";import{Window as b,Document as i}from"./utils/server-safe-globals.js";const c=i.createElement("template"),h=` | ||
import{MediaUIAttributes as o}from"./constants.js";import{defineCustomElement as u}from"./utils/defineCustomElement.js";import{Window as b,Document as i}from"./utils/server-safe-globals.js";const c=i.createElement("template"),h=` | ||
height: var(--thumb-height); | ||
@@ -112,2 +112,3 @@ width: var(--media-range-thumb-width, 10px); | ||
<input id="range" type="range" min="0" max="1000" step="1" value="0"> | ||
`;class u extends b.HTMLElement{static get observedAttributes(){return[o.MEDIA_CONTROLLER]}constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(c.content.cloneNode(!0)),this.range=this.shadowRoot.querySelector("#range"),this.range.addEventListener("input",this.updateBar.bind(this))}attributeChangedCallback(a,t,e){var n,d;if(a===o.MEDIA_CONTROLLER){if(t){const r=i.getElementById(t);(n=r==null?void 0:r.unassociateElement)==null||n.call(r,this)}if(e){const r=i.getElementById(e);(d=r==null?void 0:r.associateElement)==null||d.call(r,this)}}}connectedCallback(){var t;const a=this.getAttribute(o.MEDIA_CONTROLLER);if(a){const e=i.getElementById(a);(t=e==null?void 0:e.associateElement)==null||t.call(e,this)}this.updateBar()}disconnectedCallback(){var t;if(this.getAttribute(o.MEDIA_CONTROLLER)){const e=i.getElementById(mediaControllerId);(t=e==null?void 0:e.unassociateElement)==null||t.call(e,this)}}updateBar(){const a=this.getBarColors();let t="linear-gradient(to right, ",e=0;a.forEach(n=>{n[1]<e||(t=t+`${n[0]} ${e}%, ${n[0]} ${n[1]}%,`,e=n[1])}),t=t.slice(0,t.length-1)+")",this.style.setProperty("--media-range-track-background-internal",t)}getBarColors(){const a=this.range,t=a.value/a.max*100;return[["var(--media-range-bar-color, #fff)",t],["var(--media-range-track-background-color, #333)",100]]}}g("media-chrome-range",u);export default u; | ||
`;class g extends b.HTMLElement{static get observedAttributes(){return[o.MEDIA_CONTROLLER]}constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(c.content.cloneNode(!0)),this.range=this.shadowRoot.querySelector("#range"),this.range.addEventListener("input",this.updateBar.bind(this))}attributeChangedCallback(a,t,e){var n,d;if(a===o.MEDIA_CONTROLLER){if(t){const r=i.getElementById(t);(n=r==null?void 0:r.unassociateElement)==null||n.call(r,this)}if(e){const r=i.getElementById(e);(d=r==null?void 0:r.associateElement)==null||d.call(r,this)}}}connectedCallback(){var t;const a=this.getAttribute(o.MEDIA_CONTROLLER);if(a){const e=i.getElementById(a);(t=e==null?void 0:e.associateElement)==null||t.call(e,this)}this.updateBar()}disconnectedCallback(){var t;if(this.getAttribute(o.MEDIA_CONTROLLER)){const e=i.getElementById(mediaControllerId);(t=e==null?void 0:e.unassociateElement)==null||t.call(e,this)}}updateBar(){const a=this.getBarColors();let t="linear-gradient(to right, ",e=0;a.forEach(n=>{n[1]<e||(t=t+`${n[0]} ${e}%, ${n[0]} ${n[1]}%,`,e=n[1])}),t=t.slice(0,t.length-1)+")",this.style.setProperty("--media-range-track-background-internal",t)}getBarColors(){const a=this.range,t=a.value/a.max*100;return[["var(--media-range-bar-color, #fff)",t],["var(--media-range-track-background-color, #333)",100]]}}u("media-chrome-range",g);var v=g;export{v as default}; | ||
//# sourceMappingURL=media-chrome-range.js.map |
@@ -23,6 +23,11 @@ import{defineCustomElement as v}from"./utils/defineCustomElement.js";import{Window as n,Document as f}from"./utils/server-safe-globals.js";import{MediaUIEvents as h,MediaUIAttributes as c}from"./constants.js";import{nouns as m}from"./labels/labels.js";const p=f.createElement("template");p.innerHTML=` | ||
:host(:not([audio])) :is([part~=gestures-layer],[part~=media-layer]) { | ||
:host(:not([audio])) :is([part~=gestures-layer],[part~=media-layer]) { | ||
pointer-events: auto; | ||
} | ||
::slotted([slot=poster]) { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
:host(:not([audio])) *[part~=layer][part~=centered-layer] { | ||
@@ -38,4 +43,5 @@ align-items: center; | ||
/* Position the media element to fill the container */ | ||
::slotted([slot=media]) { | ||
/* Position the media and poster elements to fill the container */ | ||
::slotted([slot=media]), | ||
::slotted([slot=poster]) { | ||
width: 100%; | ||
@@ -92,2 +98,5 @@ height: 100%; | ||
</span> | ||
<span part="layer poster-layer"> | ||
<slot name="poster"></slot> | ||
</span> | ||
<span part="layer gesture-layer"> | ||
@@ -105,2 +114,3 @@ <slot name="gestures-chrome"></slot> | ||
</span> | ||
`;const y=Object.values(c);class b extends n.HTMLElement{constructor(){super();const e=this.attachShadow({mode:"open"});this.shadowRoot.appendChild(p.content.cloneNode(!0));const o=(t,r)=>{const d=this.media;for(let s of t)s.type==="childList"&&(s.removedNodes.forEach(l=>{if(l.slot=="media"&&s.target==this){let a=s.previousSibling&&s.previousSibling.previousElementSibling;if(!a||!d)this.mediaUnsetCallback(l);else{let u=a.slot!=="media";for(;(a=a.previousSibling)!==null;)a.slot=="media"&&(u=!1);u&&this.mediaUnsetCallback(l)}}}),d&&s.addedNodes.forEach(l=>{l==d&&this.handleMediaUpdated(d).then(a=>this.mediaSetCallback(a))}))};new MutationObserver(o).observe(this,{childList:!0,subtree:!0})}static get observedAttributes(){return["autohide"].concat(y)}attributeChangedCallback(e,o,i){e.toLowerCase()=="autohide"&&(this.autohide=i)}get media(){let e=this.querySelector(":scope > [slot=media]");return(e==null?void 0:e.nodeName)=="SLOT"&&(e=e.assignedElements({flatten:!0})[0]),e}mediaSetCallback(e){this._mediaClickPlayToggle=o=>{const i=e.paused?h.MEDIA_PLAY_REQUEST:h.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new n.CustomEvent(i,{composed:!0,bubbles:!0}))}}handleMediaUpdated(e){const o=r=>Promise.resolve(r),i=r=>(console.error('<media-chrome>: Media element set with slot="media" does not appear to be compatible.',r),Promise.reject(r));if(!e)return i(e);const t=e.nodeName.toLowerCase();return t.includes("-")?n.customElements.whenDefined(t).then(()=>o(e)):o(e)}mediaUnsetCallback(e){}connectedCallback(){const o=this.getAttribute("audio")!=null?m.AUDIO_PLAYER():m.VIDEO_PLAYER();this.setAttribute("role","region"),this.setAttribute("aria-label",o),this.media&&this.handleMediaUpdated(this.media).then(t=>this.mediaSetCallback(t));const i=()=>{this.removeAttribute("user-inactive"),n.clearTimeout(this.inactiveTimeout),!(this.autohide<0)&&(this.inactiveTimeout=n.setTimeout(()=>{this.setAttribute("user-inactive","user-inactive")},this.autohide*1e3))};this.addEventListener("keyup",t=>{i()}),this.addEventListener("keyup",t=>{this.setAttribute("media-keyboard-control","media-keyboard-control")}),this.addEventListener("mouseup",t=>{this.removeAttribute("media-keyboard-control")}),this.addEventListener("mousemove",t=>{t.target!==this&&(this.removeAttribute("user-inactive"),n.clearTimeout(this.inactiveTimeout),t.target===this.media&&i())}),this.addEventListener("mouseout",t=>{this.autohide>-1&&this.setAttribute("user-inactive","user-inactive")})}set autohide(e){e=Number(e),this._autohide=isNaN(e)?0:e}get autohide(){return this._autohide===void 0?2:this._autohide}}v("media-container-temp",b);export default b; | ||
`;const y=Object.values(c);class b extends n.HTMLElement{constructor(){super();const e=this.attachShadow({mode:"open"});this.shadowRoot.appendChild(p.content.cloneNode(!0));const o=(t,r)=>{const d=this.media;for(let s of t)s.type==="childList"&&(s.removedNodes.forEach(l=>{if(l.slot=="media"&&s.target==this){let a=s.previousSibling&&s.previousSibling.previousElementSibling;if(!a||!d)this.mediaUnsetCallback(l);else{let u=a.slot!=="media";for(;(a=a.previousSibling)!==null;)a.slot=="media"&&(u=!1);u&&this.mediaUnsetCallback(l)}}}),d&&s.addedNodes.forEach(l=>{l==d&&this.handleMediaUpdated(d).then(a=>this.mediaSetCallback(a))}))};new MutationObserver(o).observe(this,{childList:!0,subtree:!0})}static get observedAttributes(){return["autohide"].concat(y)}attributeChangedCallback(e,o,i){e.toLowerCase()=="autohide"&&(this.autohide=i)}get media(){let e=this.querySelector(":scope > [slot=media]");return(e==null?void 0:e.nodeName)=="SLOT"&&(e=e.assignedElements({flatten:!0})[0]),e}mediaSetCallback(e){this._mediaClickPlayToggle=o=>{const i=e.paused?h.MEDIA_PLAY_REQUEST:h.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new n.CustomEvent(i,{composed:!0,bubbles:!0}))}}handleMediaUpdated(e){const o=r=>Promise.resolve(r),i=r=>(console.error('<media-chrome>: Media element set with slot="media" does not appear to be compatible.',r),Promise.reject(r));if(!e)return i(e);const t=e.nodeName.toLowerCase();return t.includes("-")?n.customElements.whenDefined(t).then(()=>o(e)):o(e)}mediaUnsetCallback(e){}connectedCallback(){const o=this.getAttribute("audio")!=null?m.AUDIO_PLAYER():m.VIDEO_PLAYER();this.setAttribute("role","region"),this.setAttribute("aria-label",o),this.media&&this.handleMediaUpdated(this.media).then(t=>this.mediaSetCallback(t));const i=()=>{this.removeAttribute("user-inactive"),n.clearTimeout(this.inactiveTimeout),!(this.autohide<0)&&(this.inactiveTimeout=n.setTimeout(()=>{this.setAttribute("user-inactive","user-inactive")},this.autohide*1e3))};this.addEventListener("keyup",t=>{i()}),this.addEventListener("keyup",t=>{this.setAttribute("media-keyboard-control","media-keyboard-control")}),this.addEventListener("mouseup",t=>{this.removeAttribute("media-keyboard-control")}),this.addEventListener("mousemove",t=>{t.target!==this&&(this.removeAttribute("user-inactive"),n.clearTimeout(this.inactiveTimeout),t.target===this.media&&i())}),this.addEventListener("mouseout",t=>{this.autohide>-1&&this.setAttribute("user-inactive","user-inactive")})}set autohide(e){e=Number(e),this._autohide=isNaN(e)?0:e}get autohide(){return this._autohide===void 0?2:this._autohide}}v("media-container-temp",b);var C=b;export{C as default}; | ||
//# sourceMappingURL=media-container.js.map |
@@ -1,2 +0,2 @@ | ||
import{MediaUIAttributes as n}from"./constants.js";import{defineCustomElement as m}from"./utils/defineCustomElement.js";import{Window as l,Document as i}from"./utils/server-safe-globals.js";const d=i.createElement("template");d.innerHTML=` | ||
import{MediaUIAttributes as n}from"./constants.js";import{defineCustomElement as m}from"./utils/defineCustomElement.js";import{Window as p,Document as i}from"./utils/server-safe-globals.js";const d=i.createElement("template");d.innerHTML=` | ||
<style> | ||
@@ -20,2 +20,3 @@ :host { | ||
<slot></slot> | ||
`;class r extends l.HTMLElement{static get observedAttributes(){return[n.MEDIA_CONTROLLER]}constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(d.content.cloneNode(!0))}attributeChangedCallback(o,s,t){var a,c;if(o===n.MEDIA_CONTROLLER){if(s){const e=i.getElementById(s);(a=e==null?void 0:e.unassociateElement)==null||a.call(e,this)}if(t){const e=i.getElementById(t);(c=e==null?void 0:e.associateElement)==null||c.call(e,this)}}}connectedCallback(){var s;const o=this.getAttribute(n.MEDIA_CONTROLLER);if(o){const t=i.getElementById(o);(s=t==null?void 0:t.associateElement)==null||s.call(t,this)}}disconnectedCallback(){var s;if(this.getAttribute(n.MEDIA_CONTROLLER)){const t=i.getElementById(mediaControllerId);(s=t==null?void 0:t.unassociateElement)==null||s.call(t,this)}}}m("media-control-bar",r);export default r; | ||
`;class r extends p.HTMLElement{static get observedAttributes(){return[n.MEDIA_CONTROLLER]}constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(d.content.cloneNode(!0))}attributeChangedCallback(o,s,t){var a,c;if(o===n.MEDIA_CONTROLLER){if(s){const e=i.getElementById(s);(a=e==null?void 0:e.unassociateElement)==null||a.call(e,this)}if(t){const e=i.getElementById(t);(c=e==null?void 0:e.associateElement)==null||c.call(e,this)}}}connectedCallback(){var s;const o=this.getAttribute(n.MEDIA_CONTROLLER);if(o){const t=i.getElementById(o);(s=t==null?void 0:t.associateElement)==null||s.call(t,this)}}disconnectedCallback(){var s;if(this.getAttribute(n.MEDIA_CONTROLLER)){const t=i.getElementById(mediaControllerId);(s=t==null?void 0:t.unassociateElement)==null||s.call(t,this)}}}m("media-control-bar",r);var u=r;export{u as default}; | ||
//# sourceMappingURL=media-control-bar.js.map |
@@ -1,1 +0,2 @@ | ||
import N from"./media-container.js";import{defineCustomElement as x}from"./utils/defineCustomElement.js";import{Window as E,Document as l}from"./utils/server-safe-globals.js";import{fullscreenApi as m}from"./utils/fullscreenApi.js";import{constToCamel as P}from"./utils/stringUtils.js";import{containsWithShadow as Q}from"./utils/element-utils.js";import{MediaUIEvents as h,MediaUIAttributes as r,TextTrackKinds as T,TextTrackModes as _,AvailabilityStates as A}from"./constants.js";import{stringifyTextTrackList as p,getTextTracksList as M,updateTracksModeTo as f}from"./utils/captions.js";const{MEDIA_PLAY_REQUEST:B,MEDIA_PAUSE_REQUEST:V,MEDIA_MUTE_REQUEST:W,MEDIA_UNMUTE_REQUEST:H,MEDIA_VOLUME_REQUEST:j,MEDIA_ENTER_FULLSCREEN_REQUEST:F,MEDIA_EXIT_FULLSCREEN_REQUEST:G,MEDIA_SEEK_REQUEST:Y,MEDIA_PREVIEW_REQUEST:K,MEDIA_ENTER_PIP_REQUEST:q,MEDIA_EXIT_PIP_REQUEST:X,MEDIA_PLAYBACK_RATE_REQUEST:$}=h;class C extends N{constructor(){super();at||(this._airplayUnavailable=A.UNSUPPORTED),et||(this._pipUnavailable=A.UNSUPPORTED),U!==void 0?U||(this._volumeUnavailable=A.UNSUPPORTED):it.then(()=>{U||(this._volumeUnavailable=A.UNSUPPORTED,this.propagateMediaState(r.MEDIA_VOLUME_UNAVAILABLE,this.volumeUnavailable))}),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,this.associatedElements=[],this.associateElement(this);const t={MEDIA_PLAY_REQUEST:()=>this.media.play(),MEDIA_PAUSE_REQUEST:()=>this.media.pause(),MEDIA_MUTE_REQUEST:()=>this.media.muted=!0,MEDIA_UNMUTE_REQUEST:()=>{const e=this.media;e.muted=!1,e.volume===0&&(e.volume=.25)},MEDIA_VOLUME_REQUEST:e=>{const i=this.media,s=e.detail;i.volume=s,s>0&&i.muted&&(i.muted=!1);try{E.localStorage.setItem("media-chrome-pref-volume",s.toString())}catch(n){}},MEDIA_ENTER_FULLSCREEN_REQUEST:()=>{const e=this.media;l.pictureInPictureElement&&l.exitPictureInPicture(),super[m.enter]?super[m.enter]():e.webkitEnterFullscreen?e.webkitEnterFullscreen():e.requestFullscreen?e.requestFullscreen():console.warn("MediaChrome: Fullscreen not supported")},MEDIA_EXIT_FULLSCREEN_REQUEST:()=>{l[m.exit]()},MEDIA_ENTER_PIP_REQUEST:()=>{const e=this.media;!l.pictureInPictureEnabled||(l[m.element]&&l[m.exit](),e.requestPictureInPicture())},MEDIA_EXIT_PIP_REQUEST:()=>{l.pictureInPictureElement&&l.exitPictureInPicture()},MEDIA_SEEK_REQUEST:e=>{const i=this.media,s=e.detail;(i.readyState>0||i.readyState===void 0)&&(i.currentTime=s)},MEDIA_PLAYBACK_RATE_REQUEST:e=>{this.media.playbackRate=e.detail},MEDIA_PREVIEW_REQUEST:e=>{const i=this.media;if(!i)return;const[s]=M(i,{kind:T.METADATA,label:"thumbnails"});if(!(s&&s.cues))return;const n=e.detail,c=Array.prototype.find.call(s.cues,S=>S.startTime>=n);if(!c)return;const I=new URL(c.text),u=new URLSearchParams(I.hash).get("#xywh");this.propagateMediaState(r.MEDIA_PREVIEW_IMAGE,I.href),this.propagateMediaState(r.MEDIA_PREVIEW_COORDS,u.split(",").join(" "))},MEDIA_SHOW_CAPTIONS_REQUEST:e=>{const i=this.captionTracks,{detail:s=[]}=e;f(_.SHOWING,i,s)},MEDIA_DISABLE_CAPTIONS_REQUEST:e=>{const i=this.captionTracks,{detail:s=[]}=e;f(_.DISABLED,i,s)},MEDIA_SHOW_SUBTITLES_REQUEST:e=>{const i=this.subtitleTracks,{detail:s=[]}=e;f(_.SHOWING,i,s)},MEDIA_DISABLE_SUBTITLES_REQUEST:e=>{const i=this.subtitleTracks,{detail:s=[]}=e;f(_.DISABLED,i,s)},MEDIA_AIRPLAY_REQUEST:e=>{const{media:i}=this;if(!!i){if(!(i.webkitShowPlaybackTargetPicker&&E.WebKitPlaybackTargetAvailabilityEvent)){console.warn("received a request to select AirPlay but AirPlay is not supported in this environment");return}i.webkitShowPlaybackTargetPicker()}}};if(Object.keys(t).forEach(e=>{const i=`_handle${P(e,!0)}`;this[i]=s=>{if(s.stopPropagation(),!this.media){console.warn("MediaController: No media available.");return}t[e](s,this.media)},this.addEventListener(h[e],this[i])}),this._mediaStatePropagators={"play,pause":()=>{this.propagateMediaState(r.MEDIA_PAUSED,this.paused)},playing:()=>{var e;this.propagateMediaState(r.MEDIA_HAS_PLAYED,!((e=this.media)==null?void 0:e.paused))},volumechange:()=>{this.propagateMediaState(r.MEDIA_MUTED,this.muted),this.propagateMediaState(r.MEDIA_VOLUME,this.volume),this.propagateMediaState(r.MEDIA_VOLUME_LEVEL,this.volumeLevel)},[m.event]:()=>{var i;let e=l[m.element];this.propagateMediaState(r.MEDIA_IS_FULLSCREEN,e===((i=this.getRootNode().host)!=null?i:this))},"enterpictureinpicture,leavepictureinpicture":e=>{let i;e?i=e.type=="enterpictureinpicture":i=this.isPip,this.propagateMediaState(r.MEDIA_IS_PIP,i)},"timeupdate,loadedmetadata":()=>{this.propagateMediaState(r.MEDIA_CURRENT_TIME,this.currentTime)},"durationchange,loadedmetadata":()=>{this.propagateMediaState(r.MEDIA_DURATION,this.duration)},ratechange:()=>{this.propagateMediaState(r.MEDIA_PLAYBACK_RATE,this.playbackRate)},"waiting,playing":()=>{var i;const e=((i=this.media)==null?void 0:i.readyState)<3;this.propagateMediaState(r.MEDIA_LOADING,e)}},this.airplayUnavailable!==A.UNSUPPORTED){const e=i=>{(i==null?void 0:i.availability)==="available"?this._airplayUnavailable=void 0:(i==null?void 0:i.availability)==="not-available"&&(this._airplayUnavailable=A.UNAVAILABLE),this.propagateMediaState(r.MEDIA_AIRPLAY_UNAVAILABLE,this.airplayUnavailable)};this._mediaStatePropagators.webkitplaybacktargetavailabilitychanged=e}this._textTrackMediaStatePropagators={"addtrack,removetrack":()=>{this.propagateMediaState(r.MEDIA_CAPTIONS_LIST,p(this.captionTracks)||void 0),this.propagateMediaState(r.MEDIA_SUBTITLES_LIST,p(this.subtitleTracks)||void 0),this.propagateMediaState(r.MEDIA_CAPTIONS_SHOWING,p(this.showingCaptionTracks)||void 0),this.propagateMediaState(r.MEDIA_SUBTITLES_SHOWING,p(this.showingSubtitleTracks)||void 0)},change:()=>{this.propagateMediaState(r.MEDIA_CAPTIONS_SHOWING,p(this.showingCaptionTracks)||void 0),this.propagateMediaState(r.MEDIA_SUBTITLES_SHOWING,p(this.showingSubtitleTracks)||void 0)}}}mediaSetCallback(t){super.mediaSetCallback(t),Object.keys(this._mediaStatePropagators).forEach(e=>{const i=e.split(","),s=this._mediaStatePropagators[e];i.forEach(n=>{(n==m.event?this.getRootNode():t).addEventListener(n,s)}),s()}),Object.entries(this._textTrackMediaStatePropagators).forEach(([e,i])=>{e.split(",").forEach(n=>{t.textTracks&&t.textTracks.addEventListener(n,i)}),i()});try{const e=E.localStorage.getItem("media-chrome-pref-volume");e!==null&&(t.volume=e)}catch(e){console.debug("Error getting volume pref",e)}}mediaUnsetCallback(t){super.mediaUnsetCallback(t),Object.keys(this._mediaStatePropagators).forEach(e=>{const i=e.split(","),s=this._mediaStatePropagators[e];i.forEach(n=>{(n==m.event?this.getRootNode():t).removeEventListener(n,s)})}),Object.entries(this._textTrackMediaStatePropagators).forEach(([e,i])=>{e.split(",").forEach(n=>{t.textTracks&&t.textTracks.removeEventListener(n,i)}),i()}),this.propagateMediaState(r.MEDIA_PAUSED,!0)}propagateMediaState(t,e){o(this.mediaStateReceivers,t,e)}associateElement(t){if(!t)return;const{associatedElementSubscriptions:e}=this;if(e.has(t))return;const i=this.registerMediaStateReceiver.bind(this),s=this.unregisterMediaStateReceiver.bind(this),n=tt(t,i,s);Object.keys(h).forEach(c=>{t.addEventListener(h[c],this[`_handle${P(c,!0)}`])}),e.set(t,n)}unassociateElement(t){if(!t)return;const{associatedElementSubscriptions:e}=this;if(!e.has(t))return;e.get(t)(),e.delete(t),Object.keys(h).forEach(s=>{t.removeEventListener(h[s],this[`_handle${P(s,!0)}`])})}registerMediaStateReceiver(t){if(!t)return;const e=this.mediaStateReceivers;e.indexOf(t)>-1||(e.push(t),o([t],r.MEDIA_VOLUME_UNAVAILABLE,this.volumeUnavailable),o([t],r.MEDIA_AIRPLAY_UNAVAILABLE,this.airplayUnavailable),o([t],r.MEDIA_PIP_UNAVAILABLE,this.pipUnavailable),this.media&&(o([t],r.MEDIA_CAPTIONS_LIST,p(this.captionTracks)||void 0),o([t],r.MEDIA_SUBTITLES_LIST,p(this.subtitleTracks)||void 0),o([t],r.MEDIA_CAPTIONS_SHOWING,p(this.showingCaptionTracks)||void 0),o([t],r.MEDIA_SUBTITLES_SHOWING,p(this.showingSubtitleTracks)||void 0),o([t],r.MEDIA_PAUSED,this.paused),o([t],r.MEDIA_MUTED,this.muted),o([t],r.MEDIA_VOLUME,this.volume),o([t],r.MEDIA_VOLUME_LEVEL,this.volumeLevel),o([t],r.MEDIA_CURRENT_TIME,this.currentTime),o([t],r.MEDIA_DURATION,this.duration),o([t],r.MEDIA_PLAYBACK_RATE,this.playbackRate)))}unregisterMediaStateReceiver(t){const e=this.mediaStateReceivers,i=e.indexOf(t);i<0||e.splice(i,1)}play(){this.dispatchEvent(new E.CustomEvent(B))}pause(){this.dispatchEvent(new E.CustomEvent(V))}get airplayUnavailable(){return this._airplayUnavailable}get paused(){return this.media?this.media.paused:!0}get muted(){return!!(this.media&&this.media.muted)}set muted(t){const e=t?W:H;this.dispatchEvent(new E.CustomEvent(e))}get volume(){const t=this.media;return t?t.volume:1}set volume(t){this.dispatchEvent(new E.CustomEvent(j,{detail:t}))}get volumeLevel(){let t="high";if(!this.media)return t;const{muted:e,volume:i}=this.media;return i===0||e?t="off":i<.5?t="low":i<.75&&(t="medium"),t}get volumeUnavailable(){return this._volumeUnavailable}requestFullscreen(){this.dispatchEvent(new E.CustomEvent(F))}exitFullscreen(){this.dispatchEvent(new E.CustomEvent(G))}get currentTime(){const t=this.media;return t?t.currentTime:0}set currentTime(t){this.dispatchEvent(new E.CustomEvent(Y,{detail:t}))}get duration(){const t=this.media;return t?t.duration:NaN}get playbackRate(){const t=this.media;return t?t.playbackRate:1}set playbackRate(t){this.dispatchEvent(new E.CustomEvent($,{detail:t}))}get subtitleTracks(){return M(this.media,{kind:T.SUBTITLES})}get captionTracks(){return M(this.media,{kind:T.CAPTIONS})}get showingSubtitleTracks(){return M(this.media,{kind:T.SUBTITLES,mode:_.SHOWING})}get showingCaptionTracks(){return M(this.media,{kind:T.CAPTIONS,mode:_.SHOWING})}get isPip(){var e;const t=(e=this.getRootNode().pictureInPictureElement)!=null?e:l.pictureInPictureElement;return this.media&&Q(this.media,t)}requestPictureInPicture(){this.dispatchEvent(new E.CustomEvent(q))}exitPictureInPicture(){this.dispatchEvent(new E.CustomEvent(X))}requestPreview(t){this.dispatchEvent(new E.CustomEvent(K,{detail:t}))}get pipUnavailable(){return this._pipUnavailable}}const z=Object.values(r),y=a=>{var i,s,n;const{constructor:{observedAttributes:t}}=a,e=(n=(s=(i=a==null?void 0:a.getAttribute)==null?void 0:i.call(a,r.MEDIA_CHROME_ATTRIBUTES))==null?void 0:s.split)==null?void 0:n.call(s,/\s+/);return Array.isArray(t||e)?(t||e).filter(c=>z.includes(c)):[]},L=a=>!!y(a).length,J=(a,t,e)=>e==null?a.removeAttribute(t):typeof e=="boolean"?e?a.setAttribute(t,""):a.removeAttribute(t):Number.isNaN(e)?a.removeAttribute(t):a.setAttribute(t,e),Z=a=>{var t;return!!((t=a.closest)==null?void 0:t.call(a,'*[slot="media"]'))},v=(a,t)=>{if(Z(a))return;const e=(s,n)=>{var S,d;L(s)&&n(s);const{children:c=[]}=s!=null?s:{},I=(d=(S=s==null?void 0:s.shadowRoot)==null?void 0:S.children)!=null?d:[];[...c,...I].forEach(R=>v(R,n))},i=a==null?void 0:a.nodeName.toLowerCase();if(i.includes("-")&&!L(a)){E.customElements.whenDefined(i).then(()=>{e(a,t)});return}e(a,t)},o=(a,t,e)=>{a.forEach(i=>{!y(i).includes(t)||J(i,t,e)})},tt=(a,t,e)=>{v(a,t);const i=u=>{var d;const S=(d=u==null?void 0:u.composedPath()[0])!=null?d:u.target;t(S)},s=u=>{var d;const S=(d=u==null?void 0:u.composedPath()[0])!=null?d:u.target;e(S)};a.addEventListener(h.REGISTER_MEDIA_STATE_RECEIVER,i),a.addEventListener(h.UNREGISTER_MEDIA_STATE_RECEIVER,s);const n=(u,S)=>{u.forEach(d=>{const{addedNodes:R=[],removedNodes:O=[],type:k,target:g,attributeName:w}=d;k==="childList"?(Array.prototype.forEach.call(R,D=>v(D,t)),Array.prototype.forEach.call(O,D=>v(D,e))):k==="attributes"&&w===r.MEDIA_CHROME_ATTRIBUTES&&(L(g)?t(g):e(g))})},c=new MutationObserver(n);return c.observe(a,{childList:!0,attributes:!0,subtree:!0}),()=>{v(a,e),c.disconnect(),a.removeEventListener(h.REGISTER_MEDIA_STATE_RECEIVER,i),a.removeEventListener(h.UNREGISTER_MEDIA_STATE_RECEIVER,s)}};let b;export const getTestMediaEl=()=>{var a,t;return b||(b=(t=(a=l)==null?void 0:a.createElement)==null?void 0:t.call(a,"video"),b)},hasVolumeSupportAsync=async(a=getTestMediaEl())=>{if(!a)return!1;const t=a.volume;return a.volume=t/2+.1,new Promise((e,i)=>{setTimeout(()=>{e(a.volume!==t)},0)})},hasPipSupport=(a=getTestMediaEl())=>typeof(a==null?void 0:a.requestPictureInPicture)=="function";const et=hasPipSupport();let U;const it=hasVolumeSupportAsync().then(a=>(U=a,U)),at=!!E.WebKitPlaybackTargetAvailabilityEvent;x("media-controller",C);export default C; | ||
import x from"./media-container.js";import{defineCustomElement as Q}from"./utils/defineCustomElement.js";import{Window as E,Document as l}from"./utils/server-safe-globals.js";import{fullscreenApi as m}from"./utils/fullscreenApi.js";import{constToCamel as P}from"./utils/stringUtils.js";import{containsWithShadow as B}from"./utils/element-utils.js";import{MediaUIEvents as h,MediaUIAttributes as r,TextTrackKinds as T,TextTrackModes as _,AvailabilityStates as A}from"./constants.js";import{stringifyTextTrackList as p,getTextTracksList as M,updateTracksModeTo as b}from"./utils/captions.js";const{MEDIA_PLAY_REQUEST:V,MEDIA_PAUSE_REQUEST:W,MEDIA_MUTE_REQUEST:H,MEDIA_UNMUTE_REQUEST:F,MEDIA_VOLUME_REQUEST:G,MEDIA_ENTER_FULLSCREEN_REQUEST:j,MEDIA_EXIT_FULLSCREEN_REQUEST:Y,MEDIA_SEEK_REQUEST:q,MEDIA_PREVIEW_REQUEST:K,MEDIA_ENTER_PIP_REQUEST:X,MEDIA_EXIT_PIP_REQUEST:$,MEDIA_PLAYBACK_RATE_REQUEST:z}=h;class C extends x{constructor(){super();nt||(this._airplayUnavailable=A.UNSUPPORTED),st||(this._pipUnavailable=A.UNSUPPORTED),U!==void 0?U||(this._volumeUnavailable=A.UNSUPPORTED):rt.then(()=>{U||(this._volumeUnavailable=A.UNSUPPORTED,this.propagateMediaState(r.MEDIA_VOLUME_UNAVAILABLE,this.volumeUnavailable))}),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,this.associatedElements=[],this.associateElement(this);const t={MEDIA_PLAY_REQUEST:()=>this.media.play(),MEDIA_PAUSE_REQUEST:()=>this.media.pause(),MEDIA_MUTE_REQUEST:()=>this.media.muted=!0,MEDIA_UNMUTE_REQUEST:()=>{const e=this.media;e.muted=!1,e.volume===0&&(e.volume=.25)},MEDIA_VOLUME_REQUEST:e=>{const i=this.media,s=e.detail;i.volume=s,s>0&&i.muted&&(i.muted=!1);try{E.localStorage.setItem("media-chrome-pref-volume",s.toString())}catch{}},MEDIA_ENTER_FULLSCREEN_REQUEST:()=>{const e=this.media;l.pictureInPictureElement&&l.exitPictureInPicture(),super[m.enter]?super[m.enter]():e.webkitEnterFullscreen?e.webkitEnterFullscreen():e.requestFullscreen?e.requestFullscreen():console.warn("MediaChrome: Fullscreen not supported")},MEDIA_EXIT_FULLSCREEN_REQUEST:()=>{l[m.exit]()},MEDIA_ENTER_PIP_REQUEST:()=>{const e=this.media;!l.pictureInPictureEnabled||(l[m.element]&&l[m.exit](),e.requestPictureInPicture())},MEDIA_EXIT_PIP_REQUEST:()=>{l.pictureInPictureElement&&l.exitPictureInPicture()},MEDIA_SEEK_REQUEST:e=>{const i=this.media,s=e.detail;(i.readyState>0||i.readyState===void 0)&&(i.currentTime=s)},MEDIA_PLAYBACK_RATE_REQUEST:e=>{this.media.playbackRate=e.detail},MEDIA_PREVIEW_REQUEST:e=>{var d;const i=this.media;if(!i)return;const[s]=M(i,{kind:T.METADATA,label:"thumbnails"});if(!(s&&s.cues))return;const n=e.detail,o=Array.prototype.find.call(s.cues,I=>I.startTime>=n);if(!o)return;const f=/'^(?:[a-z]+:)?\/\//i.test(o.text)||(d=i.querySelector('track[label="thumbnails"]'))==null?void 0:d.src,c=new URL(o.text,f),S=new URLSearchParams(c.hash).get("#xywh");this.propagateMediaState(r.MEDIA_PREVIEW_IMAGE,c.href),this.propagateMediaState(r.MEDIA_PREVIEW_COORDS,S.split(",").join(" "))},MEDIA_SHOW_CAPTIONS_REQUEST:e=>{const i=this.captionTracks,{detail:s=[]}=e;b(_.SHOWING,i,s)},MEDIA_DISABLE_CAPTIONS_REQUEST:e=>{const i=this.captionTracks,{detail:s=[]}=e;b(_.DISABLED,i,s)},MEDIA_SHOW_SUBTITLES_REQUEST:e=>{const i=this.subtitleTracks,{detail:s=[]}=e;b(_.SHOWING,i,s)},MEDIA_DISABLE_SUBTITLES_REQUEST:e=>{const i=this.subtitleTracks,{detail:s=[]}=e;b(_.DISABLED,i,s)},MEDIA_AIRPLAY_REQUEST:e=>{const{media:i}=this;if(!!i){if(!(i.webkitShowPlaybackTargetPicker&&E.WebKitPlaybackTargetAvailabilityEvent)){console.warn("received a request to select AirPlay but AirPlay is not supported in this environment");return}i.webkitShowPlaybackTargetPicker()}}};if(Object.keys(t).forEach(e=>{const i=`_handle${P(e,!0)}`;this[i]=s=>{if(s.stopPropagation(),!this.media){console.warn("MediaController: No media available.");return}t[e](s,this.media)},this.addEventListener(h[e],this[i])}),this._mediaStatePropagators={"play,pause,emptied":()=>{this.propagateMediaState(r.MEDIA_PAUSED,this.paused)},"playing,emptied":()=>{var e;this.propagateMediaState(r.MEDIA_HAS_PLAYED,!((e=this.media)==null?void 0:e.paused))},volumechange:()=>{this.propagateMediaState(r.MEDIA_MUTED,this.muted),this.propagateMediaState(r.MEDIA_VOLUME,this.volume),this.propagateMediaState(r.MEDIA_VOLUME_LEVEL,this.volumeLevel)},[m.event]:()=>{var i;let e=l[m.element];this.propagateMediaState(r.MEDIA_IS_FULLSCREEN,e===((i=this.getRootNode().host)!=null?i:this))},"enterpictureinpicture,leavepictureinpicture":e=>{let i;e?i=e.type=="enterpictureinpicture":i=this.isPip,this.propagateMediaState(r.MEDIA_IS_PIP,i)},"timeupdate,loadedmetadata":()=>{this.propagateMediaState(r.MEDIA_CURRENT_TIME,this.currentTime)},"durationchange,loadedmetadata,emptied":()=>{this.propagateMediaState(r.MEDIA_DURATION,this.duration)},ratechange:()=>{this.propagateMediaState(r.MEDIA_PLAYBACK_RATE,this.playbackRate)},"waiting,playing,emptied":()=>{var i;const e=((i=this.media)==null?void 0:i.readyState)<3;this.propagateMediaState(r.MEDIA_LOADING,e)}},this.airplayUnavailable!==A.UNSUPPORTED){const e=i=>{(i==null?void 0:i.availability)==="available"?this._airplayUnavailable=void 0:(i==null?void 0:i.availability)==="not-available"&&(this._airplayUnavailable=A.UNAVAILABLE),this.propagateMediaState(r.MEDIA_AIRPLAY_UNAVAILABLE,this.airplayUnavailable)};this._mediaStatePropagators.webkitplaybacktargetavailabilitychanged=e}this._textTrackMediaStatePropagators={"addtrack,removetrack":()=>{this.propagateMediaState(r.MEDIA_CAPTIONS_LIST,p(this.captionTracks)||void 0),this.propagateMediaState(r.MEDIA_SUBTITLES_LIST,p(this.subtitleTracks)||void 0),this.propagateMediaState(r.MEDIA_CAPTIONS_SHOWING,p(this.showingCaptionTracks)||void 0),this.propagateMediaState(r.MEDIA_SUBTITLES_SHOWING,p(this.showingSubtitleTracks)||void 0)},change:()=>{this.propagateMediaState(r.MEDIA_CAPTIONS_SHOWING,p(this.showingCaptionTracks)||void 0),this.propagateMediaState(r.MEDIA_SUBTITLES_SHOWING,p(this.showingSubtitleTracks)||void 0)}}}mediaSetCallback(t){super.mediaSetCallback(t),Object.keys(this._mediaStatePropagators).forEach(e=>{const i=e.split(","),s=this._mediaStatePropagators[e];i.forEach(n=>{(n==m.event?this.getRootNode():t).addEventListener(n,s)}),s()}),Object.entries(this._textTrackMediaStatePropagators).forEach(([e,i])=>{e.split(",").forEach(n=>{t.textTracks&&t.textTracks.addEventListener(n,i)}),i()});try{const e=E.localStorage.getItem("media-chrome-pref-volume");e!==null&&(t.volume=e)}catch(e){console.debug("Error getting volume pref",e)}}mediaUnsetCallback(t){super.mediaUnsetCallback(t),Object.keys(this._mediaStatePropagators).forEach(e=>{const i=e.split(","),s=this._mediaStatePropagators[e];i.forEach(n=>{(n==m.event?this.getRootNode():t).removeEventListener(n,s)})}),Object.entries(this._textTrackMediaStatePropagators).forEach(([e,i])=>{e.split(",").forEach(n=>{t.textTracks&&t.textTracks.removeEventListener(n,i)}),i()}),this.propagateMediaState(r.MEDIA_PAUSED,!0)}propagateMediaState(t,e){u(this.mediaStateReceivers,t,e)}associateElement(t){if(!t)return;const{associatedElementSubscriptions:e}=this;if(e.has(t))return;const i=this.registerMediaStateReceiver.bind(this),s=this.unregisterMediaStateReceiver.bind(this),n=et(t,i,s);Object.keys(h).forEach(o=>{t.addEventListener(h[o],this[`_handle${P(o,!0)}`])}),e.set(t,n)}unassociateElement(t){if(!t)return;const{associatedElementSubscriptions:e}=this;if(!e.has(t))return;e.get(t)(),e.delete(t),Object.keys(h).forEach(s=>{t.removeEventListener(h[s],this[`_handle${P(s,!0)}`])})}registerMediaStateReceiver(t){if(!t)return;const e=this.mediaStateReceivers;e.indexOf(t)>-1||(e.push(t),u([t],r.MEDIA_VOLUME_UNAVAILABLE,this.volumeUnavailable),u([t],r.MEDIA_AIRPLAY_UNAVAILABLE,this.airplayUnavailable),u([t],r.MEDIA_PIP_UNAVAILABLE,this.pipUnavailable),this.media&&(u([t],r.MEDIA_CAPTIONS_LIST,p(this.captionTracks)||void 0),u([t],r.MEDIA_SUBTITLES_LIST,p(this.subtitleTracks)||void 0),u([t],r.MEDIA_CAPTIONS_SHOWING,p(this.showingCaptionTracks)||void 0),u([t],r.MEDIA_SUBTITLES_SHOWING,p(this.showingSubtitleTracks)||void 0),u([t],r.MEDIA_PAUSED,this.paused),u([t],r.MEDIA_MUTED,this.muted),u([t],r.MEDIA_VOLUME,this.volume),u([t],r.MEDIA_VOLUME_LEVEL,this.volumeLevel),u([t],r.MEDIA_CURRENT_TIME,this.currentTime),u([t],r.MEDIA_DURATION,this.duration),u([t],r.MEDIA_PLAYBACK_RATE,this.playbackRate)))}unregisterMediaStateReceiver(t){const e=this.mediaStateReceivers,i=e.indexOf(t);i<0||e.splice(i,1)}play(){this.dispatchEvent(new E.CustomEvent(V))}pause(){this.dispatchEvent(new E.CustomEvent(W))}get airplayUnavailable(){return this._airplayUnavailable}get paused(){return this.media?this.media.paused:!0}get muted(){return!!(this.media&&this.media.muted)}set muted(t){const e=t?H:F;this.dispatchEvent(new E.CustomEvent(e))}get volume(){const t=this.media;return t?t.volume:1}set volume(t){this.dispatchEvent(new E.CustomEvent(G,{detail:t}))}get volumeLevel(){let t="high";if(!this.media)return t;const{muted:e,volume:i}=this.media;return i===0||e?t="off":i<.5?t="low":i<.75&&(t="medium"),t}get volumeUnavailable(){return this._volumeUnavailable}requestFullscreen(){this.dispatchEvent(new E.CustomEvent(j))}exitFullscreen(){this.dispatchEvent(new E.CustomEvent(Y))}get currentTime(){const t=this.media;return t?t.currentTime:0}set currentTime(t){this.dispatchEvent(new E.CustomEvent(q,{detail:t}))}get duration(){const t=this.media;return t?t.duration:NaN}get playbackRate(){const t=this.media;return t?t.playbackRate:1}set playbackRate(t){this.dispatchEvent(new E.CustomEvent(z,{detail:t}))}get subtitleTracks(){return M(this.media,{kind:T.SUBTITLES})}get captionTracks(){return M(this.media,{kind:T.CAPTIONS})}get showingSubtitleTracks(){return M(this.media,{kind:T.SUBTITLES,mode:_.SHOWING})}get showingCaptionTracks(){return M(this.media,{kind:T.CAPTIONS,mode:_.SHOWING})}get isPip(){var e;const t=(e=this.getRootNode().pictureInPictureElement)!=null?e:l.pictureInPictureElement;return this.media&&B(this.media,t)}requestPictureInPicture(){this.dispatchEvent(new E.CustomEvent(X))}exitPictureInPicture(){this.dispatchEvent(new E.CustomEvent($))}requestPreview(t){this.dispatchEvent(new E.CustomEvent(K,{detail:t}))}get pipUnavailable(){return this._pipUnavailable}}const J=Object.values(r),y=a=>{var i,s,n;const{constructor:{observedAttributes:t}}=a,e=(n=(s=(i=a==null?void 0:a.getAttribute)==null?void 0:i.call(a,r.MEDIA_CHROME_ATTRIBUTES))==null?void 0:s.split)==null?void 0:n.call(s,/\s+/);return Array.isArray(t||e)?(t||e).filter(o=>J.includes(o)):[]},L=a=>!!y(a).length,Z=(a,t,e)=>e==null?a.removeAttribute(t):typeof e=="boolean"?e?a.setAttribute(t,""):a.removeAttribute(t):Number.isNaN(e)?a.removeAttribute(t):a.setAttribute(t,e),tt=a=>{var t;return!!((t=a.closest)==null?void 0:t.call(a,'*[slot="media"]'))},v=(a,t)=>{if(tt(a))return;const e=(s,n)=>{var S,d;L(s)&&n(s);const{children:o=[]}=s!=null?s:{},f=(d=(S=s==null?void 0:s.shadowRoot)==null?void 0:S.children)!=null?d:[];[...o,...f].forEach(I=>v(I,n))},i=a==null?void 0:a.nodeName.toLowerCase();if(i.includes("-")&&!L(a)){E.customElements.whenDefined(i).then(()=>{e(a,t)});return}e(a,t)},u=(a,t,e)=>{a.forEach(i=>{!y(i).includes(t)||Z(i,t,e)})},et=(a,t,e)=>{v(a,t);const i=c=>{var d;const S=(d=c==null?void 0:c.composedPath()[0])!=null?d:c.target;t(S)},s=c=>{var d;const S=(d=c==null?void 0:c.composedPath()[0])!=null?d:c.target;e(S)};a.addEventListener(h.REGISTER_MEDIA_STATE_RECEIVER,i),a.addEventListener(h.UNREGISTER_MEDIA_STATE_RECEIVER,s);const n=(c,S)=>{c.forEach(d=>{const{addedNodes:I=[],removedNodes:w=[],type:k,target:g,attributeName:N}=d;k==="childList"?(Array.prototype.forEach.call(I,D=>v(D,t)),Array.prototype.forEach.call(w,D=>v(D,e))):k==="attributes"&&N===r.MEDIA_CHROME_ATTRIBUTES&&(L(g)?t(g):e(g))})},o=new MutationObserver(n);return o.observe(a,{childList:!0,attributes:!0,subtree:!0}),()=>{v(a,e),o.disconnect(),a.removeEventListener(h.REGISTER_MEDIA_STATE_RECEIVER,i),a.removeEventListener(h.UNREGISTER_MEDIA_STATE_RECEIVER,s)}};let R;const O=()=>{var a,t;return R||(R=(t=(a=l)==null?void 0:a.createElement)==null?void 0:t.call(a,"video"),R)},it=async(a=O())=>{if(!a)return!1;const t=a.volume;return a.volume=t/2+.1,new Promise((e,i)=>{setTimeout(()=>{e(a.volume!==t)},0)})},at=(a=O())=>typeof(a==null?void 0:a.requestPictureInPicture)=="function",st=at();let U;const rt=it().then(a=>(U=a,U)),nt=!!E.WebKitPlaybackTargetAvailabilityEvent;Q("media-controller",C);var St=C;export{St as default,O as getTestMediaEl,at as hasPipSupport,it as hasVolumeSupportAsync}; | ||
//# sourceMappingURL=media-controller.js.map |
@@ -1,1 +0,2 @@ | ||
import a from"./media-text-display.js";import{defineCustomElement as m}from"./utils/defineCustomElement.js";import{formatTime as o}from"./utils/time.js";import{MediaUIAttributes as i}from"./constants.js";class r extends a{static get observedAttributes(){return[...super.observedAttributes,i.MEDIA_CURRENT_TIME]}attributeChangedCallback(t,s,e){t===i.MEDIA_CURRENT_TIME&&(this.container.innerHTML=o(e)),super.attributeChangedCallback(t,s,e)}}m("media-current-time-display",r);export default r; | ||
import s from"./media-text-display.js";import{defineCustomElement as m}from"./utils/defineCustomElement.js";import{formatTime as o}from"./utils/time.js";import{MediaUIAttributes as r}from"./constants.js";class i extends s{static get observedAttributes(){return[...super.observedAttributes,r.MEDIA_CURRENT_TIME]}attributeChangedCallback(t,a,e){t===r.MEDIA_CURRENT_TIME&&(this.container.innerHTML=o(e)),super.attributeChangedCallback(t,a,e)}}m("media-current-time-display",i);var l=i;export{l as default}; | ||
//# sourceMappingURL=media-current-time-display.js.map |
@@ -1,1 +0,2 @@ | ||
import a from"./media-text-display.js";import{defineCustomElement as o}from"./utils/defineCustomElement.js";import{formatTime as d}from"./utils/time.js";import{MediaUIAttributes as i}from"./constants.js";class s extends a{static get observedAttributes(){return[...super.observedAttributes,i.MEDIA_DURATION]}attributeChangedCallback(t,r,e){t===i.MEDIA_DURATION&&(this.container.innerHTML=d(e)),super.attributeChangedCallback(t,r,e)}}o("media-duration-display",s);export default s; | ||
import o from"./media-text-display.js";import{defineCustomElement as s}from"./utils/defineCustomElement.js";import{formatTime as d}from"./utils/time.js";import{MediaUIAttributes as i}from"./constants.js";class r extends o{static get observedAttributes(){return[...super.observedAttributes,i.MEDIA_DURATION]}attributeChangedCallback(t,a,e){t===i.MEDIA_DURATION&&(this.container.innerHTML=d(e)),super.attributeChangedCallback(t,a,e)}}s("media-duration-display",r);var l=r;export{l as default}; | ||
//# sourceMappingURL=media-duration-display.js.map |
@@ -1,2 +0,2 @@ | ||
import u from"./media-chrome-button.js";import{defineCustomElement as h}from"./utils/defineCustomElement.js";import{Window as c,Document as d}from"./utils/server-safe-globals.js";import{MediaUIEvents as o,MediaUIAttributes as t}from"./constants.js";import{verbs as l}from"./labels/labels.js";const v=`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> | ||
import h from"./media-chrome-button.js";import{defineCustomElement as u}from"./utils/defineCustomElement.js";import{Window as c,Document as v}from"./utils/server-safe-globals.js";import{MediaUIEvents as o,MediaUIAttributes as t}from"./constants.js";import{verbs as l}from"./labels/labels.js";const d=`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> | ||
<path d="M0 0h24v24H0z" fill="none"/> | ||
@@ -7,3 +7,3 @@ <path class="icon" d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/> | ||
<path class="icon" d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"/> | ||
</svg>`,a=d.createElement("template");a.innerHTML=` | ||
</svg>`,a=v.createElement("template");a.innerHTML=` | ||
<style> | ||
@@ -22,4 +22,5 @@ :host([${t.MEDIA_IS_FULLSCREEN}]) slot:not([name=exit]) > *, | ||
<slot name="enter">${v}</slot> | ||
<slot name="enter">${d}</slot> | ||
<slot name="exit">${m}</slot> | ||
`;const i=n=>{const s=n.getAttribute(t.MEDIA_IS_FULLSCREEN)!=null?l.EXIT_FULLSCREEN():l.ENTER_FULLSCREEN();n.setAttribute("aria-label",s)};class r extends u{static get observedAttributes(){return[...super.observedAttributes,t.MEDIA_IS_FULLSCREEN]}constructor(e={}){super({slotTemplate:a,...e})}connectedCallback(){i(this),super.connectedCallback()}attributeChangedCallback(e,s,E){e===t.MEDIA_IS_FULLSCREEN&&i(this),super.attributeChangedCallback(e,s,E)}handleClick(e){const s=this.getAttribute(t.MEDIA_IS_FULLSCREEN)!=null?o.MEDIA_EXIT_FULLSCREEN_REQUEST:o.MEDIA_ENTER_FULLSCREEN_REQUEST;this.dispatchEvent(new c.CustomEvent(s,{composed:!0,bubbles:!0}))}}h("media-fullscreen-button",r);export default r; | ||
`;const i=n=>{const s=n.getAttribute(t.MEDIA_IS_FULLSCREEN)!=null?l.EXIT_FULLSCREEN():l.ENTER_FULLSCREEN();n.setAttribute("aria-label",s)};class r extends h{static get observedAttributes(){return[...super.observedAttributes,t.MEDIA_IS_FULLSCREEN]}constructor(e={}){super({slotTemplate:a,...e})}connectedCallback(){i(this),super.connectedCallback()}attributeChangedCallback(e,s,E){e===t.MEDIA_IS_FULLSCREEN&&i(this),super.attributeChangedCallback(e,s,E)}handleClick(e){const s=this.getAttribute(t.MEDIA_IS_FULLSCREEN)!=null?o.MEDIA_EXIT_FULLSCREEN_REQUEST:o.MEDIA_ENTER_FULLSCREEN_REQUEST;this.dispatchEvent(new c.CustomEvent(s,{composed:!0,bubbles:!0}))}}u("media-fullscreen-button",r);var S=r;export{S as default}; | ||
//# sourceMappingURL=media-fullscreen-button.js.map |
@@ -1,2 +0,2 @@ | ||
import{MediaUIAttributes as s}from"./constants.js";import{nouns as m}from"./labels/labels.js";import{defineCustomElement as D}from"./utils/defineCustomElement.js";import{Window as f,Document as a}from"./utils/server-safe-globals.js";const g=a.createElement("template"),A=` | ||
import{MediaUIAttributes as n}from"./constants.js";import{nouns as m}from"./labels/labels.js";import{defineCustomElement as D}from"./utils/defineCustomElement.js";import{Window as A,Document as o}from"./utils/server-safe-globals.js";const g=o.createElement("template"),f=` | ||
<svg aria-hidden="true" viewBox="0 0 100 100"> | ||
@@ -51,4 +51,5 @@ <path d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"> | ||
<slot name="loading">${A}</slot> | ||
<slot name="loading">${f}</slot> | ||
<div id="status" role="status" aria-live="polite">${m.MEDIA_LOADING()}</div> | ||
`;const I=500;class r extends f.HTMLElement{static get observedAttributes(){return[s.MEDIA_CONTROLLER,s.MEDIA_PAUSED,s.MEDIA_LOADING,"loading-delay"]}constructor(){super();const n=this.attachShadow({mode:"open"}),i=g.content.cloneNode(!0);n.appendChild(i)}attributeChangedCallback(n,i,t){var o,d,l;if(n===s.MEDIA_LOADING||n===s.MEDIA_PAUSED){const e=this.getAttribute(s.MEDIA_PAUSED)!=null,h=this.getAttribute(s.MEDIA_LOADING)!=null,c=!e&&h;if(!c)this.loadingDelayHandle&&(clearTimeout(this.loadingDelayHandle),this.loadingDelayHandle=void 0),this.removeAttribute("is-loading");else if(!this.loadingDelayHandle&&c){const u=+((o=this.getAttribute("loading-delay"))!=null?o:I);this.loadingDelayHandle=setTimeout(()=>{this.setAttribute("is-loading",""),this.loadingDelayHandle=void 0},u)}}else if(n===s.MEDIA_CONTROLLER){if(i){const e=a.getElementById(i);(d=e==null?void 0:e.unassociateElement)==null||d.call(e,this)}if(t){const e=a.getElementById(t);(l=e==null?void 0:e.associateElement)==null||l.call(e,this)}}}connectedCallback(){var i;const n=this.getAttribute(s.MEDIA_CONTROLLER);if(n){const t=a.getElementById(n);(i=t==null?void 0:t.associateElement)==null||i.call(t,this)}}disconnectedCallback(){var i;if(this.loadingDelayHandle&&(clearTimeout(this.loadingDelayHandle),this.loadingDelayHandle=void 0),this.getAttribute(s.MEDIA_CONTROLLER)){const t=a.getElementById(mediaControllerId);(i=t==null?void 0:t.unassociateElement)==null||i.call(t,this)}}}D("media-loading-indicator",r);export default r; | ||
`;const I=500;class h extends A.HTMLElement{static get observedAttributes(){return[n.MEDIA_CONTROLLER,n.MEDIA_PAUSED,n.MEDIA_LOADING,"loading-delay"]}constructor(){super();const a=this.attachShadow({mode:"open"}),e=g.content.cloneNode(!0);a.appendChild(e)}attributeChangedCallback(a,e,t){var s,d,l;if(a===n.MEDIA_LOADING||a===n.MEDIA_PAUSED){const i=this.getAttribute(n.MEDIA_PAUSED)!=null,r=this.getAttribute(n.MEDIA_LOADING)!=null,c=!i&&r;if(!c)this.loadingDelayHandle&&(clearTimeout(this.loadingDelayHandle),this.loadingDelayHandle=void 0),this.removeAttribute("is-loading");else if(!this.loadingDelayHandle&&c){const u=+((s=this.getAttribute("loading-delay"))!=null?s:I);this.loadingDelayHandle=setTimeout(()=>{this.setAttribute("is-loading",""),this.loadingDelayHandle=void 0},u)}}else if(a===n.MEDIA_CONTROLLER){if(e){const i=o.getElementById(e);(d=i==null?void 0:i.unassociateElement)==null||d.call(i,this)}if(t){const i=o.getElementById(t);(l=i==null?void 0:i.associateElement)==null||l.call(i,this)}}}connectedCallback(){var e;const a=this.getAttribute(n.MEDIA_CONTROLLER);if(a){const t=o.getElementById(a);(e=t==null?void 0:t.associateElement)==null||e.call(t,this)}}disconnectedCallback(){var e;if(this.loadingDelayHandle&&(clearTimeout(this.loadingDelayHandle),this.loadingDelayHandle=void 0),this.getAttribute(n.MEDIA_CONTROLLER)){const t=o.getElementById(mediaControllerId);(e=t==null?void 0:t.unassociateElement)==null||e.call(t,this)}}}D("media-loading-indicator",h);var E=h;export{E as default}; | ||
//# sourceMappingURL=media-loading-indicator.js.map |
@@ -1,2 +0,2 @@ | ||
import c from"./media-chrome-button.js";import{defineCustomElement as d}from"./utils/defineCustomElement.js";import{Window as L,Document as M}from"./utils/server-safe-globals.js";import{MediaUIEvents as n,MediaUIAttributes as t}from"./constants.js";import{verbs as l}from"./labels/labels.js";const r='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path class="icon" d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',E='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path class="icon" d="M18.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM5 9v6h4l5 5V4L9 9H5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',u='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path class="icon" d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',i=M.createElement("template");i.innerHTML=` | ||
import M from"./media-chrome-button.js";import{defineCustomElement as c}from"./utils/defineCustomElement.js";import{Window as d,Document as m}from"./utils/server-safe-globals.js";import{MediaUIEvents as n,MediaUIAttributes as t}from"./constants.js";import{verbs as l}from"./labels/labels.js";const r='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path class="icon" d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',E='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path class="icon" d="M18.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM5 9v6h4l5 5V4L9 9H5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',u='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path class="icon" d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',i=m.createElement("template");i.innerHTML=` | ||
<style> | ||
@@ -31,2 +31,3 @@ /* Default to High slot/icon. */ | ||
<slot name="high">${u}</slot> | ||
`;const a=s=>{const e=s.getAttribute(t.MEDIA_VOLUME_LEVEL)==="off"?l.UNMUTE():l.MUTE();s.setAttribute("aria-label",e)};class h extends c{static get observedAttributes(){return[...super.observedAttributes,t.MEDIA_VOLUME_LEVEL]}constructor(o={}){super({slotTemplate:i,...o})}connectedCallback(){a(this),super.connectedCallback()}attributeChangedCallback(o,e,m){o===t.MEDIA_VOLUME_LEVEL&&a(this),super.attributeChangedCallback(o,e,m)}handleClick(o){const e=this.getAttribute(t.MEDIA_VOLUME_LEVEL)==="off"?n.MEDIA_UNMUTE_REQUEST:n.MEDIA_MUTE_REQUEST;this.dispatchEvent(new L.CustomEvent(e,{composed:!0,bubbles:!0}))}}d("media-mute-button",h);export default h; | ||
`;const a=s=>{const e=s.getAttribute(t.MEDIA_VOLUME_LEVEL)==="off"?l.UNMUTE():l.MUTE();s.setAttribute("aria-label",e)};class h extends M{static get observedAttributes(){return[...super.observedAttributes,t.MEDIA_VOLUME_LEVEL]}constructor(o={}){super({slotTemplate:i,...o})}connectedCallback(){a(this),super.connectedCallback()}attributeChangedCallback(o,e,L){o===t.MEDIA_VOLUME_LEVEL&&a(this),super.attributeChangedCallback(o,e,L)}handleClick(o){const e=this.getAttribute(t.MEDIA_VOLUME_LEVEL)==="off"?n.MEDIA_UNMUTE_REQUEST:n.MEDIA_MUTE_REQUEST;this.dispatchEvent(new d.CustomEvent(e,{composed:!0,bubbles:!0}))}}c("media-mute-button",h);var g=h;export{g as default}; | ||
//# sourceMappingURL=media-mute-button.js.map |
@@ -1,2 +0,2 @@ | ||
import c from"./media-chrome-button.js";import{defineCustomElement as d}from"./utils/defineCustomElement.js";import{Window as m,Document as b}from"./utils/server-safe-globals.js";import{MediaUIEvents as n,MediaUIAttributes as t}from"./constants.js";import{verbs as l}from"./labels/labels.js";const i='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path class="icon" d="M19 7h-8v6h8V7zm2-4H3c-1.1 0-2 .9-2 2v14c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98V5c0-1.1-.9-2-2-2zm0 16.01H3V4.98h18v14.03z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',a=b.createElement("template");a.innerHTML=` | ||
import u from"./media-chrome-button.js";import{defineCustomElement as d}from"./utils/defineCustomElement.js";import{Window as P,Document as m}from"./utils/server-safe-globals.js";import{MediaUIEvents as n,MediaUIAttributes as t}from"./constants.js";import{verbs as i}from"./labels/labels.js";const a='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path class="icon" d="M19 7h-8v6h8V7zm2-4H3c-1.1 0-2 .9-2 2v14c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98V5c0-1.1-.9-2-2-2zm0 16.01H3V4.98h18v14.03z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',l=m.createElement("template");l.innerHTML=` | ||
<style> | ||
@@ -15,4 +15,5 @@ :host([${t.MEDIA_IS_PIP}]) slot:not([name=exit]) > *, | ||
<slot name="enter">${i}</slot> | ||
<slot name="exit">${i}</slot> | ||
`;const r=o=>{const s=o.getAttribute(t.MEDIA_IS_PIP)!=null?l.EXIT_PIP():l.ENTER_PIP();o.setAttribute("aria-label",s)};class I extends c{static get observedAttributes(){return[...super.observedAttributes,t.MEDIA_IS_PIP,t.MEDIA_PIP_UNAVAILABLE]}constructor(e={}){super({slotTemplate:a,...e})}connectedCallback(){r(this),super.connectedCallback()}attributeChangedCallback(e,s,u){e===t.MEDIA_IS_PIP&&r(this),super.attributeChangedCallback(e,s,u)}handleClick(e){const s=this.getAttribute(t.MEDIA_IS_PIP)!=null?n.MEDIA_EXIT_PIP_REQUEST:n.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new m.CustomEvent(s,{composed:!0,bubbles:!0}))}}d("media-pip-button",I);export default I; | ||
<slot name="enter">${a}</slot> | ||
<slot name="exit">${a}</slot> | ||
`;const r=s=>{const o=s.getAttribute(t.MEDIA_IS_PIP)!=null?i.EXIT_PIP():i.ENTER_PIP();s.setAttribute("aria-label",o)};class I extends u{static get observedAttributes(){return[...super.observedAttributes,t.MEDIA_IS_PIP,t.MEDIA_PIP_UNAVAILABLE]}constructor(e={}){super({slotTemplate:l,...e})}connectedCallback(){r(this),super.connectedCallback()}attributeChangedCallback(e,o,c){e===t.MEDIA_IS_PIP&&r(this),super.attributeChangedCallback(e,o,c)}handleClick(e){const o=this.getAttribute(t.MEDIA_IS_PIP)!=null?n.MEDIA_EXIT_PIP_REQUEST:n.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new P.CustomEvent(o,{composed:!0,bubbles:!0}))}}d("media-pip-button",I);var A=I;export{A as default}; | ||
//# sourceMappingURL=media-pip-button.js.map |
@@ -1,2 +0,2 @@ | ||
import d from"./media-chrome-button.js";import{Window as p,Document as c}from"./utils/server-safe-globals.js";import{defineCustomElement as m}from"./utils/defineCustomElement.js";import{MediaUIEvents as a,MediaUIAttributes as t}from"./constants.js";import{verbs as l}from"./labels/labels.js";const E='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path class="icon" d="M8 5v14l11-7z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',A='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path class="icon" d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',n=c.createElement("template");n.innerHTML=` | ||
import d from"./media-chrome-button.js";import{Window as p,Document as c}from"./utils/server-safe-globals.js";import{defineCustomElement as A}from"./utils/defineCustomElement.js";import{MediaUIEvents as a,MediaUIAttributes as t}from"./constants.js";import{verbs as n}from"./labels/labels.js";const E='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path class="icon" d="M8 5v14l11-7z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',m='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path class="icon" d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',l=c.createElement("template");l.innerHTML=` | ||
<style> | ||
@@ -15,3 +15,4 @@ :host([${t.MEDIA_PAUSED}]) slot[name=pause] > *, | ||
<slot name="play">${E}</slot> | ||
<slot name="pause">${A}</slot> | ||
`;const i=o=>{const s=o.getAttribute(t.MEDIA_PAUSED)!=null?l.PLAY():l.PAUSE();o.setAttribute("aria-label",s)};class r extends d{static get observedAttributes(){return[...super.observedAttributes,t.MEDIA_PAUSED]}constructor(e={}){super({slotTemplate:n,...e})}connectedCallback(){i(this),super.connectedCallback()}attributeChangedCallback(e,s,u){e===t.MEDIA_PAUSED&&i(this),super.attributeChangedCallback(e,s,u)}handleClick(e){const s=this.getAttribute(t.MEDIA_PAUSED)!=null?a.MEDIA_PLAY_REQUEST:a.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new p.CustomEvent(s,{composed:!0,bubbles:!0}))}}m("media-play-button",r);export default r; | ||
<slot name="pause">${m}</slot> | ||
`;const i=o=>{const s=o.getAttribute(t.MEDIA_PAUSED)!=null?n.PLAY():n.PAUSE();o.setAttribute("aria-label",s)};class r extends d{static get observedAttributes(){return[...super.observedAttributes,t.MEDIA_PAUSED]}constructor(e={}){super({slotTemplate:l,...e})}connectedCallback(){i(this),super.connectedCallback()}attributeChangedCallback(e,s,u){e===t.MEDIA_PAUSED&&i(this),super.attributeChangedCallback(e,s,u)}handleClick(e){const s=this.getAttribute(t.MEDIA_PAUSED)!=null?a.MEDIA_PLAY_REQUEST:a.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new p.CustomEvent(s,{composed:!0,bubbles:!0}))}}A("media-play-button",r);var w=r;export{w as default}; | ||
//# sourceMappingURL=media-play-button.js.map |
@@ -1,2 +0,2 @@ | ||
import u from"./media-chrome-button.js";import{defineCustomElement as A}from"./utils/defineCustomElement.js";import{Window as h,Document as d}from"./utils/server-safe-globals.js";import{MediaUIEvents as p,MediaUIAttributes as a}from"./constants.js";import{nouns as E}from"./labels/labels.js";const c=[1,1.25,1.5,1.75,2],n=1,l=d.createElement("template");l.innerHTML=` | ||
import b from"./media-chrome-button.js";import{defineCustomElement as u}from"./utils/defineCustomElement.js";import{Window as d,Document as l}from"./utils/server-safe-globals.js";import{MediaUIEvents as p,MediaUIAttributes as a}from"./constants.js";import{nouns as E}from"./labels/labels.js";const c=[1,1.25,1.5,1.75,2],n=1,A=l.createElement("template");A.innerHTML=` | ||
<style> | ||
@@ -15,2 +15,3 @@ :host { | ||
<span id="container"></span> | ||
`;class m extends u{static get observedAttributes(){return[...super.observedAttributes,a.MEDIA_PLAYBACK_RATE,"rates"]}constructor(i={}){super({slotTemplate:l,...i});this._rates=c,this.container=this.shadowRoot.querySelector("#container"),this.container.innerHTML=`${n}x`}attributeChangedCallback(i,o,e){if(i==="rates"){const s=(e!=null?e:"").trim().split(/\s*,?\s+/).map(t=>Number(t)).filter(t=>!Number.isNaN(t)).sort((t,r)=>t-r);this._rates=s.length?s:c;return}if(i===a.MEDIA_PLAYBACK_RATE){const s=e?+e:Number.NaN,t=Number.isNaN(s)?n:s;this.container.innerHTML=`${t}x`,this.setAttribute("aria-label",E.PLAYBACK_RATE({playbackRate:t}));return}super.attributeChangedCallback(i,o,e)}handleClick(i){var t,r;const o=+this.getAttribute(a.MEDIA_PLAYBACK_RATE)||n,e=(r=(t=this._rates.find(b=>b>o))!=null?t:this._rates[0])!=null?r:n,s=new h.CustomEvent(p.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(s)}}A("media-playback-rate-button",m);export default m; | ||
`;class h extends b{static get observedAttributes(){return[...super.observedAttributes,a.MEDIA_PLAYBACK_RATE,"rates"]}constructor(r={}){super({slotTemplate:A,...r});this._rates=c,this.container=this.shadowRoot.querySelector("#container"),this.container.innerHTML=`${n}x`}attributeChangedCallback(r,o,e){if(r==="rates"){const s=(e!=null?e:"").trim().split(/\s*,?\s+/).map(t=>Number(t)).filter(t=>!Number.isNaN(t)).sort((t,i)=>t-i);this._rates=s.length?s:c;return}if(r===a.MEDIA_PLAYBACK_RATE){const s=e?+e:Number.NaN,t=Number.isNaN(s)?n:s;this.container.innerHTML=`${t}x`,this.setAttribute("aria-label",E.PLAYBACK_RATE({playbackRate:t}));return}super.attributeChangedCallback(r,o,e)}handleClick(r){var t,i;const o=+this.getAttribute(a.MEDIA_PLAYBACK_RATE)||n,e=(i=(t=this._rates.find(m=>m>o))!=null?t:this._rates[0])!=null?i:n,s=new d.CustomEvent(p.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(s)}}u("media-playback-rate-button",h);var L=h;export{L as default}; | ||
//# sourceMappingURL=media-playback-rate-button.js.map |
@@ -1,1 +0,2 @@ | ||
import r from"./media-time-range.js";import{defineCustomElement as s}from"./utils/defineCustomElement.js";class e extends r{constructor(){super();console.warn("MediaChrome: <media-progress-range> is deprecated. Use <media-time-range> instead.")}}s("media-progress-range",e);export default e; | ||
import r from"./media-time-range.js";import{defineCustomElement as a}from"./utils/defineCustomElement.js";class e extends r{constructor(){super();console.warn("MediaChrome: <media-progress-range> is deprecated. Use <media-time-range> instead.")}}a("media-progress-range",e);var d=e;export{d as default}; | ||
//# sourceMappingURL=media-progress-range.js.map |
@@ -1,3 +0,4 @@ | ||
import f from"./media-chrome-button.js";import{defineCustomElement as m}from"./utils/defineCustomElement.js";import{Window as b,Document as E}from"./utils/server-safe-globals.js";import{MediaUIEvents as h,MediaUIAttributes as i}from"./constants.js";import{verbs as k}from"./labels/labels.js";import{getSlotted as A,updateIconText as p}from"./utils/element-utils.js";const a=30,v=`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="-3 -3 24 24"><defs><style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style></defs><text class="text value" transform="translate(1.68 17.6)">${a}</text><path d="M9.48,3V0L3.87,4l5.61,4V5a5.54,5.54,0,0,1,1.92,10.5V17.6A7.5,7.5,0,0,0,9.48,3Z"/></svg>`,r=E.createElement("template");r.innerHTML=` | ||
<slot name="backward">${v}</slot> | ||
`;const w=0,n=e=>{const t=Math.abs(+e.getAttribute("seek-offset")),s=k.SEEK_BACK_N_SECS({seekOffset:t});e.setAttribute("aria-label",s)},l=e=>{const t=A(e,"backward"),s=e.getAttribute("seek-offset");p(t,s)};class u extends f{static get observedAttributes(){return[...super.observedAttributes,i.MEDIA_CURRENT_TIME]}constructor(t={}){super({slotTemplate:r,...t})}connectedCallback(){this.hasAttribute("seek-offset")||this.setAttribute("seek-offset",a),n(this),l(this),super.connectedCallback()}attributeChangedCallback(t,s,o){t==="seek-offset"&&(o==null&&this.setAttribute("seek-offset",a),l(this),n(this))}handleClick(){const t=this.getAttribute(i.MEDIA_CURRENT_TIME),s=+this.getAttribute("seek-offset"),o=t&&!Number.isNaN(+t)?+t:w,c=Math.max(o-s,0),d=new b.CustomEvent(h.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:c});this.dispatchEvent(d)}}m("media-seek-backward-button",u);export default u; | ||
import f from"./media-chrome-button.js";import{defineCustomElement as b}from"./utils/defineCustomElement.js";import{Window as m,Document as E}from"./utils/server-safe-globals.js";import{MediaUIEvents as h,MediaUIAttributes as r}from"./constants.js";import{verbs as k}from"./labels/labels.js";import{getSlotted as A,updateIconText as p}from"./utils/element-utils.js";const a=30,w=`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="-3 -3 24 24"><defs><style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style></defs><text class="text value" transform="translate(1.68 17.6)">${a}</text><path d="M9.48,3V0L3.87,4l5.61,4V5a5.54,5.54,0,0,1,1.92,10.5V17.6A7.5,7.5,0,0,0,9.48,3Z"/></svg>`,i=E.createElement("template");i.innerHTML=` | ||
<slot name="backward">${w}</slot> | ||
`;const M=0,n=e=>{const t=Math.abs(+e.getAttribute("seek-offset")),s=k.SEEK_BACK_N_SECS({seekOffset:t});e.setAttribute("aria-label",s)},c=e=>{const t=A(e,"backward"),s=e.getAttribute("seek-offset");p(t,s)};class u extends f{static get observedAttributes(){return[...super.observedAttributes,r.MEDIA_CURRENT_TIME]}constructor(t={}){super({slotTemplate:i,...t})}connectedCallback(){this.hasAttribute("seek-offset")||this.setAttribute("seek-offset",a),n(this),c(this),super.connectedCallback()}attributeChangedCallback(t,s,o){t==="seek-offset"&&(o==null&&this.setAttribute("seek-offset",a),c(this),n(this))}handleClick(){const t=this.getAttribute(r.MEDIA_CURRENT_TIME),s=+this.getAttribute("seek-offset"),o=t&&!Number.isNaN(+t)?+t:M,d=Math.max(o-s,0),l=new m.CustomEvent(h.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:d});this.dispatchEvent(l)}}b("media-seek-backward-button",u);var I=u;export{I as default}; | ||
//# sourceMappingURL=media-seek-backward-button.js.map |
@@ -1,3 +0,4 @@ | ||
import d from"./media-chrome-button.js";import{defineCustomElement as m}from"./utils/defineCustomElement.js";import{Window as b,Document as E}from"./utils/server-safe-globals.js";import{MediaUIEvents as A,MediaUIAttributes as i}from"./constants.js";import{verbs as h}from"./labels/labels.js";import{getSlotted as p,updateIconText as k}from"./utils/element-utils.js";const o=30,T=`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="-3 -3 24 24"><defs><style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style></defs><text class="text value" transform="translate(7.4 17.6)">${o}</text><path d="M8.52,3V0l5.61,4-5.61,4V5A5.54,5.54,0,0,0,6.6,15.48V17.6A7.5,7.5,0,0,1,8.52,3Z"/></svg>`,a=E.createElement("template");a.innerHTML=` | ||
import l from"./media-chrome-button.js";import{defineCustomElement as m}from"./utils/defineCustomElement.js";import{Window as b,Document as E}from"./utils/server-safe-globals.js";import{MediaUIEvents as A,MediaUIAttributes as i}from"./constants.js";import{verbs as h}from"./labels/labels.js";import{getSlotted as p,updateIconText as k}from"./utils/element-utils.js";const o=30,T=`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="-3 -3 24 24"><defs><style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style></defs><text class="text value" transform="translate(7.4 17.6)">${o}</text><path d="M8.52,3V0l5.61,4-5.61,4V5A5.54,5.54,0,0,0,6.6,15.48V17.6A7.5,7.5,0,0,1,8.52,3Z"/></svg>`,a=E.createElement("template");a.innerHTML=` | ||
<slot name="forward">${T}</slot> | ||
`;const v=0,n=e=>{const t=Math.abs(+e.getAttribute("seek-offset")),s=h.SEEK_FORWARD_N_SECS({seekOffset:t});e.setAttribute("aria-label",s)},l=e=>{const t=p(e,"forward"),s=e.getAttribute("seek-offset");k(t,s)};class u extends d{static get observedAttributes(){return[...super.observedAttributes,i.MEDIA_CURRENT_TIME,"seek-offset"]}constructor(t={}){super({slotTemplate:a,...t})}connectedCallback(){this.hasAttribute("seek-offset")||this.setAttribute("seek-offset",o),n(this),l(this),super.connectedCallback()}attributeChangedCallback(t,s,r){t==="seek-offset"&&(r==null&&this.setAttribute("seek-offset",o),l(this),n(this))}handleClick(){const t=this.getAttribute(i.MEDIA_CURRENT_TIME),s=+this.getAttribute("seek-offset"),f=(t&&!Number.isNaN(+t)?+t:v)+s,c=new b.CustomEvent(A.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:f});this.dispatchEvent(c)}}m("media-seek-forward-button",u);export default u; | ||
`;const w=0,n=e=>{const t=Math.abs(+e.getAttribute("seek-offset")),s=h.SEEK_FORWARD_N_SECS({seekOffset:t});e.setAttribute("aria-label",s)},f=e=>{const t=p(e,"forward"),s=e.getAttribute("seek-offset");k(t,s)};class u extends l{static get observedAttributes(){return[...super.observedAttributes,i.MEDIA_CURRENT_TIME,"seek-offset"]}constructor(t={}){super({slotTemplate:a,...t})}connectedCallback(){this.hasAttribute("seek-offset")||this.setAttribute("seek-offset",o),n(this),f(this),super.connectedCallback()}attributeChangedCallback(t,s,r){t==="seek-offset"&&(r==null&&this.setAttribute("seek-offset",o),f(this),n(this))}handleClick(){const t=this.getAttribute(i.MEDIA_CURRENT_TIME),s=+this.getAttribute("seek-offset"),c=(t&&!Number.isNaN(+t)?+t:w)+s,d=new b.CustomEvent(A.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:c});this.dispatchEvent(d)}}m("media-seek-forward-button",u);var S=u;export{S as default}; | ||
//# sourceMappingURL=media-seek-forward-button.js.map |
@@ -33,2 +33,3 @@ import{defineCustomElement as o}from"./utils/defineCustomElement.js";import{Document as t,Window as i}from"./utils/server-safe-globals.js";const e=t.createElement("template");e.innerHTML=` | ||
</media-chrome-menu> | ||
`;class m extends i.HTMLElement{constructor(){super();const a=this.attachShadow({mode:"open"});this.shadowRoot.appendChild(e.content.cloneNode(!0))}}o("media-settings-popup",m);export default m; | ||
`;class m extends i.HTMLElement{constructor(){super();const a=this.attachShadow({mode:"open"});this.shadowRoot.appendChild(e.content.cloneNode(!0))}}o("media-settings-popup",m);var r=m;export{r as default}; | ||
//# sourceMappingURL=media-settings-popup.js.map |
@@ -1,2 +0,2 @@ | ||
import{MediaUIAttributes as o}from"./constants.js";import{defineCustomElement as f}from"./utils/defineCustomElement.js";import{Window as h,Document as i}from"./utils/server-safe-globals.js";const r=i.createElement("template");r.innerHTML=` | ||
import{MediaUIAttributes as o}from"./constants.js";import{defineCustomElement as h}from"./utils/defineCustomElement.js";import{Window as f,Document as s}from"./utils/server-safe-globals.js";const r=s.createElement("template");r.innerHTML=` | ||
<style> | ||
@@ -28,2 +28,3 @@ :host { | ||
</span> | ||
`;class d extends h.HTMLElement{static get observedAttributes(){return[o.MEDIA_CONTROLLER]}constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(r.content.cloneNode(!0)),this.container=this.shadowRoot.querySelector("#container")}attributeChangedCallback(s,n,t){var a,c;if(s===o.MEDIA_CONTROLLER){if(n){const e=i.getElementById(n);(a=e==null?void 0:e.unassociateElement)==null||a.call(e,this)}if(t){const e=i.getElementById(t);(c=e==null?void 0:e.associateElement)==null||c.call(e,this)}}}connectedCallback(){var n;const s=this.getAttribute(o.MEDIA_CONTROLLER);if(s){const t=i.getElementById(s);(n=t==null?void 0:t.associateElement)==null||n.call(t,this)}}disconnectedCallback(){var n;if(this.getAttribute(o.MEDIA_CONTROLLER)){const t=i.getElementById(mediaControllerId);(n=t==null?void 0:t.unassociateElement)==null||n.call(t,this)}}}f("media-text-display",d);export default d; | ||
`;class d extends f.HTMLElement{static get observedAttributes(){return[o.MEDIA_CONTROLLER]}constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(r.content.cloneNode(!0)),this.container=this.shadowRoot.querySelector("#container")}attributeChangedCallback(i,n,t){var a,c;if(i===o.MEDIA_CONTROLLER){if(n){const e=s.getElementById(n);(a=e==null?void 0:e.unassociateElement)==null||a.call(e,this)}if(t){const e=s.getElementById(t);(c=e==null?void 0:e.associateElement)==null||c.call(e,this)}}}connectedCallback(){var n;const i=this.getAttribute(o.MEDIA_CONTROLLER);if(i){const t=s.getElementById(i);(n=t==null?void 0:t.associateElement)==null||n.call(t,this)}}disconnectedCallback(){var n;if(this.getAttribute(o.MEDIA_CONTROLLER)){const t=s.getElementById(mediaControllerId);(n=t==null?void 0:t.unassociateElement)==null||n.call(t,this)}}}h("media-text-display",d);var b=d;export{b as default}; | ||
//# sourceMappingURL=media-text-display.js.map |
@@ -1,2 +0,2 @@ | ||
import{Window as I,Document as o}from"./utils/server-safe-globals.js";import{defineCustomElement as g}from"./utils/defineCustomElement.js";import{MediaUIAttributes as i}from"./constants.js";const E=o.createElement("template");E.innerHTML=` | ||
import{Window as u,Document as n}from"./utils/server-safe-globals.js";import{defineCustomElement as g}from"./utils/defineCustomElement.js";import{MediaUIAttributes as i}from"./constants.js";const r=n.createElement("template");r.innerHTML=` | ||
<style> | ||
@@ -14,2 +14,3 @@ :host { | ||
<img crossorigin loading="eager" decoding="async" /> | ||
`;class u extends I.HTMLElement{static get observedAttributes(){return[i.MEDIA_CONTROLLER,"time",i.MEDIA_PREVIEW_IMAGE,i.MEDIA_PREVIEW_COORDS]}constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(E.content.cloneNode(!0))}connectedCallback(){var s;const n=this.getAttribute(i.MEDIA_CONTROLLER);if(n){const t=o.getElementById(n);(s=t==null?void 0:t.associateElement)==null||s.call(t,this)}}disconnectedCallback(){var s;if(this.getAttribute(i.MEDIA_CONTROLLER)){const t=o.getElementById(mediaControllerId);(s=t==null?void 0:t.unassociateElement)==null||s.call(t,this)}}attributeChangedCallback(n,s,t){var c,a;if(["time",i.MEDIA_PREVIEW_IMAGE,i.MEDIA_PREVIEW_COORDS].includes(n)&&this.update(),n===i.MEDIA_CONTROLLER){if(s){const e=o.getElementById(s);(c=e==null?void 0:e.unassociateElement)==null||c.call(e,this)}if(t){const e=o.getElementById(t);(a=e==null?void 0:e.associateElement)==null||a.call(e,this)}}}update(){const n=this.getAttribute(i.MEDIA_PREVIEW_COORDS),s=this.getAttribute(i.MEDIA_PREVIEW_IMAGE);if(!(n&&s))return;const t=this.shadowRoot.querySelector("img"),[c,a,e,m]=n.split(/\s+/).map(h=>+h),r=s,d=()=>{t.style.height=`${m}px`,t.style["aspect-ratio"]=`${e} / ${m}`};t.src!==r&&(t.onload=d,t.src=r,d()),d(),t.style["object-position"]=`-${c}px -${a}px`}}g("media-thumbnail-preview",u);export default u; | ||
`;class h extends u.HTMLElement{static get observedAttributes(){return[i.MEDIA_CONTROLLER,"time",i.MEDIA_PREVIEW_IMAGE,i.MEDIA_PREVIEW_COORDS]}constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(r.content.cloneNode(!0))}connectedCallback(){var s;const o=this.getAttribute(i.MEDIA_CONTROLLER);if(o){const t=n.getElementById(o);(s=t==null?void 0:t.associateElement)==null||s.call(t,this)}}disconnectedCallback(){var s;if(this.getAttribute(i.MEDIA_CONTROLLER)){const t=n.getElementById(mediaControllerId);(s=t==null?void 0:t.unassociateElement)==null||s.call(t,this)}}attributeChangedCallback(o,s,t){var c,a;if(["time",i.MEDIA_PREVIEW_IMAGE,i.MEDIA_PREVIEW_COORDS].includes(o)&&this.update(),o===i.MEDIA_CONTROLLER){if(s){const e=n.getElementById(s);(c=e==null?void 0:e.unassociateElement)==null||c.call(e,this)}if(t){const e=n.getElementById(t);(a=e==null?void 0:e.associateElement)==null||a.call(e,this)}}}update(){const o=this.getAttribute(i.MEDIA_PREVIEW_COORDS),s=this.getAttribute(i.MEDIA_PREVIEW_IMAGE);if(!(o&&s))return;const t=this.shadowRoot.querySelector("img"),[c,a,e,E]=o.split(/\s+/).map(I=>+I),m=s,d=()=>{t.style.height=`${E}px`,t.style["aspect-ratio"]=`${e} / ${E}`};t.src!==m&&(t.onload=d,t.src=m,d()),d(),t.style["object-position"]=`-${c}px -${a}px`}}g("media-thumbnail-preview",h);var b=h;export{b as default}; | ||
//# sourceMappingURL=media-thumbnail-preview.js.map |
@@ -1,1 +0,2 @@ | ||
import l from"./media-text-display.js";import{defineCustomElement as c}from"./utils/defineCustomElement.js";import{formatAsTimePhrase as u,formatTime as A}from"./utils/time.js";import{MediaUIAttributes as e}from"./constants.js";import{nouns as T}from"./labels/labels.js";const d=" / ",E=(t,{timesSep:r=d}={})=>{const n=t.getAttribute("remaining")!=null,s=t.getAttribute("show-duration")!=null,i=+t.getAttribute(e.MEDIA_CURRENT_TIME),a=+t.getAttribute(e.MEDIA_DURATION),o=n?A(0-(a-i)):A(i);return s?`${o}${r}${A(a)}`:o},I="video not loaded, unknown time.",M=t=>{if(!(t.hasAttribute(e.MEDIA_CURRENT_TIME)&&t.hasAttribute(e.MEDIA_DURATION))){t.setAttribute("aria-valuetext",I);return}const r=t.getAttribute("remaining")!=null,n=t.getAttribute("show-duration")!=null,s=+t.getAttribute(e.MEDIA_CURRENT_TIME),i=+t.getAttribute(e.MEDIA_DURATION),a=r?u(0-(i-s)):u(s);if(!n){t.setAttribute("aria-valuetext",a);return}const o=u(i),b=`${a} of ${o}`;t.setAttribute("aria-valuetext",b)};class m extends l{static get observedAttributes(){return[...super.observedAttributes,e.MEDIA_CURRENT_TIME,e.MEDIA_DURATION,"remaining","show-duration"]}connectedCallback(){this.setAttribute("role","progressbar"),this.setAttribute("aria-label",T.PLAYBACK_TIME()),this.setAttribute("tabindex",0),super.connectedCallback()}attributeChangedCallback(r,n,s){if([e.MEDIA_CURRENT_TIME,e.MEDIA_DURATION,"remaining","show-duration"].includes(r)){const i=E(this);M(this),this.container.innerHTML=i}super.attributeChangedCallback(r,n,s)}}c("media-time-display",m);export default m; | ||
import c from"./media-text-display.js";import{defineCustomElement as T}from"./utils/defineCustomElement.js";import{formatAsTimePhrase as u,formatTime as A}from"./utils/time.js";import{MediaUIAttributes as e}from"./constants.js";import{nouns as E}from"./labels/labels.js";const d=" / ",l=(t,{timesSep:r=d}={})=>{const a=t.getAttribute("remaining")!=null,n=t.getAttribute("show-duration")!=null,i=+t.getAttribute(e.MEDIA_CURRENT_TIME),s=+t.getAttribute(e.MEDIA_DURATION),o=a?A(0-(s-i)):A(i);return n?`${o}${r}${A(s)}`:o},I="video not loaded, unknown time.",M=t=>{if(!(t.hasAttribute(e.MEDIA_CURRENT_TIME)&&t.hasAttribute(e.MEDIA_DURATION))){t.setAttribute("aria-valuetext",I);return}const r=t.getAttribute("remaining")!=null,a=t.getAttribute("show-duration")!=null,n=+t.getAttribute(e.MEDIA_CURRENT_TIME),i=+t.getAttribute(e.MEDIA_DURATION),s=r?u(0-(i-n)):u(n);if(!a){t.setAttribute("aria-valuetext",s);return}const o=u(i),m=`${s} of ${o}`;t.setAttribute("aria-valuetext",m)};class b extends c{static get observedAttributes(){return[...super.observedAttributes,e.MEDIA_CURRENT_TIME,e.MEDIA_DURATION,"remaining","show-duration"]}connectedCallback(){this.setAttribute("role","progressbar"),this.setAttribute("aria-label",E.PLAYBACK_TIME()),this.setAttribute("tabindex",0),super.connectedCallback()}attributeChangedCallback(r,a,n){if([e.MEDIA_CURRENT_TIME,e.MEDIA_DURATION,"remaining","show-duration"].includes(r)){const i=l(this);M(this),this.container.innerHTML=i}super.attributeChangedCallback(r,a,n)}}T("media-time-display",b);var f=b;export{f as default}; | ||
//# sourceMappingURL=media-time-display.js.map |
@@ -1,2 +0,2 @@ | ||
import A from"./media-chrome-range.js";import{defineCustomElement as I}from"./utils/defineCustomElement.js";import{Window as o,Document as C}from"./utils/server-safe-globals.js";import{MediaUIEvents as c,MediaUIAttributes as i}from"./constants.js";import{nouns as w}from"./labels/labels.js";import{formatAsTimePhrase as h}from"./utils/time.js";const T="video not loaded, unknown time.",f=d=>{const e=d.range,t=h(+e.value),a=h(+e.max),l=t&&a?`${t} of ${a}`:T;e.setAttribute("aria-valuetext",l)},b=C.createElement("template");b.innerHTML=` | ||
import A from"./media-chrome-range.js";import{defineCustomElement as I}from"./utils/defineCustomElement.js";import{Window as o,Document as w}from"./utils/server-safe-globals.js";import{MediaUIEvents as c,MediaUIAttributes as n}from"./constants.js";import{nouns as C}from"./labels/labels.js";import{formatAsTimePhrase as h}from"./utils/time.js";const T="video not loaded, unknown time.",f=d=>{const e=d.range,t=h(+e.value),a=h(+e.max),l=t&&a?`${t} of ${a}`:T;e.setAttribute("aria-valuetext",l)},b=w.createElement("template");b.innerHTML=` | ||
<style> | ||
@@ -27,3 +27,3 @@ #thumbnailContainer { | ||
:host([${i.MEDIA_PREVIEW_IMAGE}]:hover) #thumbnailContainer { | ||
:host([${n.MEDIA_PREVIEW_IMAGE}]:hover) #thumbnailContainer { | ||
display: block; | ||
@@ -51,2 +51,3 @@ animation: fadeIn ease 0.5s; | ||
</div> | ||
`;class p extends A{static get observedAttributes(){return[...super.observedAttributes,"thumbnails",i.MEDIA_DURATION,i.MEDIA_CURRENT_TIME,i.MEDIA_PREVIEW_IMAGE]}constructor(){super();this.shadowRoot.appendChild(b.content.cloneNode(!0)),this.range.addEventListener("input",()=>{const t=this.range.value,a=new o.CustomEvent(c.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:t});this.dispatchEvent(a)}),this.enableThumbnails()}connectedCallback(){this.range.setAttribute("aria-label",w.SEEK()),super.connectedCallback()}attributeChangedCallback(e,t,a){e===i.MEDIA_CURRENT_TIME&&(this.range.value=+a,f(this),this.updateBar()),e===i.MEDIA_DURATION&&(this.range.max=Math.floor(+a),f(this),this.updateBar()),super.attributeChangedCallback(e,t,a)}getBarColors(){let e=super.getBarColors();if(!this.mediaBuffered||!this.mediaBuffered.length||this.mediaDuration<=0)return e;const t=this.mediaBuffered,a=t[t.length-1][1]/this.mediaDuration*100;return e.splice(1,0,["var(--media-time-buffered-color, #777)",a]),e}enableThumbnails(){this.thumbnailPreview=this.shadowRoot.querySelector("media-thumbnail-preview"),this.shadowRoot.querySelector("#thumbnailContainer").classList.add("enabled");let t;const a=()=>{t=u=>{const s=+this.getAttribute(i.MEDIA_DURATION);if(!s)return;const n=this.range.getBoundingClientRect();let r=(u.clientX-n.left)/n.width;r=Math.max(0,Math.min(1,r));const g=n.left-this.getBoundingClientRect().left+r*n.width;this.thumbnailPreview.style.left=`${g}px`;const v=r*s,M=new o.CustomEvent(c.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(M)},o.addEventListener("mousemove",t,!1)},l=()=>{o.removeEventListener("mousemove",t)};let m=!1,E=u=>{const s=this.getAttribute(i.MEDIA_DURATION);if(!m&&s){m=!0,a();let n=r=>{r.target!=this&&!this.contains(r.target)&&(o.removeEventListener("mousemove",n),m=!1,l())};o.addEventListener("mousemove",n,!1)}};this.addEventListener("mousemove",E,!1)}}I("media-time-range",p);export default p; | ||
`;class p extends A{static get observedAttributes(){return[...super.observedAttributes,"thumbnails",n.MEDIA_DURATION,n.MEDIA_CURRENT_TIME,n.MEDIA_PREVIEW_IMAGE]}constructor(){super();this.shadowRoot.appendChild(b.content.cloneNode(!0)),this.range.addEventListener("input",()=>{const t=this.range.value,a=new o.CustomEvent(c.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:t});this.dispatchEvent(a)}),this.enableThumbnails()}connectedCallback(){this.range.setAttribute("aria-label",C.SEEK()),super.connectedCallback()}attributeChangedCallback(e,t,a){e===n.MEDIA_CURRENT_TIME&&(this.range.value=+a,f(this),this.updateBar()),e===n.MEDIA_DURATION&&(this.range.max=Math.floor(+a),f(this),this.updateBar()),super.attributeChangedCallback(e,t,a)}getBarColors(){let e=super.getBarColors();if(!this.mediaBuffered||!this.mediaBuffered.length||this.mediaDuration<=0)return e;const t=this.mediaBuffered,a=t[t.length-1][1]/this.mediaDuration*100;return e.splice(1,0,["var(--media-time-buffered-color, #777)",a]),e}enableThumbnails(){this.thumbnailPreview=this.shadowRoot.querySelector("media-thumbnail-preview"),this.shadowRoot.querySelector("#thumbnailContainer").classList.add("enabled");let t;const a=()=>{t=u=>{const s=+this.getAttribute(n.MEDIA_DURATION);if(!s)return;const i=this.range.getBoundingClientRect();let r=(u.clientX-i.left)/i.width;r=Math.max(0,Math.min(1,r));const g=i.left-this.getBoundingClientRect().left+r*i.width;this.thumbnailPreview.style.left=`${g}px`;const v=r*s,M=new o.CustomEvent(c.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(M)},o.addEventListener("mousemove",t,!1)},l=()=>{o.removeEventListener("mousemove",t)};let m=!1,E=u=>{const s=this.getAttribute(n.MEDIA_DURATION);if(!m&&s){m=!0,a();let i=r=>{r.target!=this&&!this.contains(r.target)&&(o.removeEventListener("mousemove",i),m=!1,l())};o.addEventListener("mousemove",i,!1)}};this.addEventListener("mousemove",E,!1)}}I("media-time-range",p);var S=p;export{S as default}; | ||
//# sourceMappingURL=media-time-range.js.map |
@@ -1,2 +0,2 @@ | ||
import{defineCustomElement as o}from"./utils/defineCustomElement.js";import{Window as s,Document as l}from"./utils/server-safe-globals.js";const e=l.createElement("template");e.innerHTML=` | ||
import{defineCustomElement as o}from"./utils/defineCustomElement.js";import{Window as n,Document as s}from"./utils/server-safe-globals.js";const e=s.createElement("template");e.innerHTML=` | ||
<style> | ||
@@ -9,2 +9,3 @@ :host { | ||
<slot></slot> | ||
`;class t extends s.HTMLElement{constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(e.content.cloneNode(!0))}}o("media-title-bar",t);export default t; | ||
`;class t extends n.HTMLElement{constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(e.content.cloneNode(!0))}}o("media-title-bar",t);var m=t;export{m as default}; | ||
//# sourceMappingURL=media-title-element.js.map |
@@ -1,1 +0,2 @@ | ||
import{Window as i}from"./utils/server-safe-globals.js";import u from"./media-chrome-range.js";import{defineCustomElement as l}from"./utils/defineCustomElement.js";import{MediaUIAttributes as t,MediaUIEvents as m}from"./constants.js";import{nouns as d}from"./labels/labels.js";const E=100,c=s=>{var n;if(s.getAttribute(t.MEDIA_MUTED)!=null)return 0;const r=+((n=s.getAttribute(t.MEDIA_VOLUME))!=null?n:1);return Math.round(r*s.range.max)},M=({value:s,max:e})=>`${Math.round(s/e*100)}%`;class a extends u{static get observedAttributes(){return[...super.observedAttributes,t.MEDIA_VOLUME,t.MEDIA_MUTED,t.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super();this.range.max=E,this.range.addEventListener("input",()=>{const r=this.range.value/this.range.max,n=new i.CustomEvent(m.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:r});this.dispatchEvent(n)})}connectedCallback(){this.range.setAttribute("aria-label",d.VOLUME()),super.connectedCallback()}attributeChangedCallback(e,r,n){if(e===t.MEDIA_VOLUME||e===t.MEDIA_MUTED){const o=c(this);this.range.value=o,this.range.setAttribute("aria-valuetext",M(this.range)),this.updateBar()}super.attributeChangedCallback(e,r,n)}}l("media-volume-range",a);export default a; | ||
import{Window as i}from"./utils/server-safe-globals.js";import u from"./media-chrome-range.js";import{defineCustomElement as m}from"./utils/defineCustomElement.js";import{MediaUIAttributes as e,MediaUIEvents as E}from"./constants.js";import{nouns as d}from"./labels/labels.js";const l=100,M=r=>{var n;if(r.getAttribute(e.MEDIA_MUTED)!=null)return 0;const a=+((n=r.getAttribute(e.MEDIA_VOLUME))!=null?n:1);return Math.round(a*r.range.max)},c=({value:r,max:t})=>`${Math.round(r/t*100)}%`;class s extends u{static get observedAttributes(){return[...super.observedAttributes,e.MEDIA_VOLUME,e.MEDIA_MUTED,e.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super();this.range.max=l,this.range.addEventListener("input",()=>{const a=this.range.value/this.range.max,n=new i.CustomEvent(E.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:a});this.dispatchEvent(n)})}connectedCallback(){this.range.setAttribute("aria-label",d.VOLUME()),super.connectedCallback()}attributeChangedCallback(t,a,n){if(t===e.MEDIA_VOLUME||t===e.MEDIA_MUTED){const o=M(this);this.range.value=o,this.range.setAttribute("aria-valuetext",c(this.range)),this.updateBar()}super.attributeChangedCallback(t,a,n)}}m("media-volume-range",s);var p=s;export{p as default}; | ||
//# sourceMappingURL=media-volume-range.js.map |
@@ -75,2 +75,5 @@ import type React from 'react'; | ||
declare const MediaPosterImage: GenericForwardRef; | ||
export { MediaPosterImage }; | ||
declare const MediaTimeRange: GenericForwardRef; | ||
@@ -77,0 +80,0 @@ export { MediaTimeRange }; |
@@ -125,2 +125,9 @@ import React from "react"; | ||
/** @type { import("react").HTMLElement } */ | ||
const MediaPosterImage = React.forwardRef(({ children, ...props }, ref) => { | ||
return React.createElement('media-poster-image', toNativeProps({ ...props, ref }), children); | ||
}); | ||
export { MediaPosterImage }; | ||
/** @type { import("react").HTMLElement } */ | ||
const MediaTimeRange = React.forwardRef(({ children, ...props }, ref) => { | ||
@@ -127,0 +134,0 @@ return React.createElement('media-time-range', toNativeProps({ ...props, ref }), children); |
@@ -146,2 +146,3 @@ import a from"./media-theme.js";const o=` | ||
</media-controller> | ||
`;class e extends a{constructor(t={}){super(o,{...t})}}customElements.get("media-theme-netflix")||customElements.define("media-theme-netflix",e);export default e; | ||
`;class e extends a{constructor(t={}){super(o,{...t})}}customElements.get("media-theme-netflix")||customElements.define("media-theme-netflix",e);var r=e;export{r as default}; | ||
//# sourceMappingURL=media-theme-netflix.js.map |
@@ -1,1 +0,2 @@ | ||
class m extends HTMLElement{constructor(e="",t={}){super();t=Object.assign({},t),this.template=e;const n=document.createElement("template");n.innerHTML=e;const o=this.attachShadow({mode:"open"});o.appendChild(n.content.cloneNode(!0)),this.mediaController=o.querySelector("media-controller")}}customElements.get("media-theme")||customElements.define("media-theme",m);export default m; | ||
class m extends HTMLElement{constructor(e="",t={}){super();t=Object.assign({},t),this.template=e;const n=document.createElement("template");n.innerHTML=e;const o=this.attachShadow({mode:"open"});o.appendChild(n.content.cloneNode(!0)),this.mediaController=o.querySelector("media-controller")}}customElements.get("media-theme")||customElements.define("media-theme",m);var l=m;export{l as default}; | ||
//# sourceMappingURL=media-theme.js.map |
@@ -1,1 +0,2 @@ | ||
export const splitTextTracksStr=(t="")=>t.split(/\s+/),parseTextTrackStr=(t="")=>{const[r,e]=t.split(":"),o=e?decodeURIComponent(e):void 0;return{language:r,label:o}},parseTextTracksStr=(t="",r={})=>splitTextTracksStr(t).map(e=>{const o=parseTextTrackStr(e);return{...r,...o}}),parseTracks=t=>Array.isArray(t)?t.map(r=>typeof r=="string"?parseTextTrackStr(r):r):typeof t=="string"?parseTextTracksStr(t):[t],formatTextTrackObj=({label:t,language:r}={})=>t?`${r}:${encodeURIComponent(t)}`:r,stringifyTextTrackList=(t=[])=>Array.prototype.map.call(t,formatTextTrackObj).join(" "),isMatchingPropOf=(t,r)=>e=>e[t]===r,textTrackObjAsPred=t=>{const r=Object.entries(t).map(([e,o])=>isMatchingPropOf(e,o));return e=>r.every(o=>o(e))},updateTracksModeTo=(t,r=[],e=[])=>{const o=parseTracks(e).map(textTrackObjAsPred),s=n=>o.some(p=>p(n));Array.from(r).filter(s).forEach(n=>{n.mode=t})},getTextTracksList=(t,r=()=>!0)=>{if(!(t==null?void 0:t.textTracks))return[];const e=typeof r=="function"?r:textTrackObjAsPred(r);return Array.from(t.textTracks).filter(e)}; | ||
const x=(t="")=>t.split(/\s+/),s=(t="")=>{const[r,e]=t.split(":"),o=e?decodeURIComponent(e):void 0;return{language:r,label:o}},a=(t="",r={})=>x(t).map(e=>{const o=s(e);return{...r,...o}}),i=t=>Array.isArray(t)?t.map(r=>typeof r=="string"?s(r):r):typeof t=="string"?a(t):[t],f=({label:t,language:r}={})=>t?`${r}:${encodeURIComponent(t)}`:r,y=(t=[])=>Array.prototype.map.call(t,f).join(" "),T=(t,r)=>e=>e[t]===r,p=t=>{const r=Object.entries(t).map(([e,o])=>T(e,o));return e=>r.every(o=>o(e))},d=(t,r=[],e=[])=>{const o=i(e).map(p),c=n=>o.some(u=>u(n));Array.from(r).filter(c).forEach(n=>{n.mode=t})},l=(t,r=()=>!0)=>{if(!(t==null?void 0:t.textTracks))return[];const e=typeof r=="function"?r:p(r);return Array.from(t.textTracks).filter(e)};export{f as formatTextTrackObj,l as getTextTracksList,T as isMatchingPropOf,s as parseTextTrackStr,a as parseTextTracksStr,i as parseTracks,x as splitTextTracksStr,y as stringifyTextTrackList,p as textTrackObjAsPred,d as updateTracksModeTo}; | ||
//# sourceMappingURL=captions.js.map |
@@ -1,1 +0,2 @@ | ||
import{Window as s}from"./server-safe-globals.js";export function defineCustomElement(e,o){s.customElements.get(e)||(s.customElements.define(e,o),s[o.name]=o)} | ||
import{Window as t}from"./server-safe-globals.js";function e(i,o){t.customElements.get(i)||(t.customElements.define(i,o),t[o.name]=o)}export{e as defineCustomElement}; | ||
//# sourceMappingURL=defineCustomElement.js.map |
@@ -1,1 +0,2 @@ | ||
export const updateIconText=(t,e,o=".value")=>{const n=t.querySelector(o);!n||(n.textContent=e)},getAllSlotted=(t,e)=>{const o=`slot[name="${e}"]`,n=t.shadowRoot.querySelector(o);return n?n.children:[]},getSlotted=(t,e)=>getAllSlotted(t,e)[0],containsWithShadow=(t,e)=>!t||!e?!1:t.contains(e)?!0:[t,...t.querySelectorAll("*")].some(o=>containsWithShadow(o.shadowRoot,e)); | ||
const s=(t,e,o=".value")=>{const n=t.querySelector(o);!n||(n.textContent=e)},r=(t,e)=>{const o=`slot[name="${e}"]`,n=t.shadowRoot.querySelector(o);return n?n.children:[]},c=(t,e)=>r(t,e)[0],l=(t,e)=>!t||!e?!1:t.contains(e)?!0:[t,...t.querySelectorAll("*")].some(o=>l(o.shadowRoot,e));export{l as containsWithShadow,r as getAllSlotted,c as getSlotted,s as updateIconText}; | ||
//# sourceMappingURL=element-utils.js.map |
@@ -1,1 +0,2 @@ | ||
import{Document as e}from"./server-safe-globals.js";export const fullscreenApi={enter:"requestFullscreen",exit:"exitFullscreen",event:"fullscreenchange",element:"fullscreenElement",error:"fullscreenerror"};e.fullscreenElement===void 0&&(fullscreenApi.enter="webkitRequestFullScreen",fullscreenApi.exit=e.webkitExitFullscreen!=null?"webkitExitFullscreen":"webkitCancelFullScreen",fullscreenApi.event="webkitfullscreenchange",fullscreenApi.element="webkitFullscreenElement",fullscreenApi.error="webkitfullscreenerror"); | ||
import{Document as l}from"./server-safe-globals.js";const e={enter:"requestFullscreen",exit:"exitFullscreen",event:"fullscreenchange",element:"fullscreenElement",error:"fullscreenerror"};l.fullscreenElement===void 0&&(e.enter="webkitRequestFullScreen",e.exit=l.webkitExitFullscreen!=null?"webkitExitFullscreen":"webkitCancelFullScreen",e.event="webkitfullscreenchange",e.element="webkitFullscreenElement",e.error="webkitfullscreenerror");export{e as fullscreenApi}; | ||
//# sourceMappingURL=fullscreenApi.js.map |
@@ -1,1 +0,2 @@ | ||
const n={HTMLElement:function(){this.addEventListener=()=>{},this.removeEventListener=()=>{},this.dispatchEvent=()=>{}},customElements:{get:function(){},define:function(){},whenDefined:function(){}},CustomEvent:function(){}},t={createElement:function(){return new n.HTMLElement}};export const isServer=typeof window=="undefined"||typeof window.customElements=="undefined",Window=isServer?n:window,Document=isServer?t:window.document; | ||
const n={HTMLElement:function(){this.addEventListener=()=>{},this.removeEventListener=()=>{},this.dispatchEvent=()=>{}},customElements:{get:function(){},define:function(){},whenDefined:function(){}},CustomEvent:function(){}},o={createElement:function(){return new n.HTMLElement}},e=typeof window=="undefined"||typeof window.customElements=="undefined",i=e?n:window,c=e?o:window.document;export{c as Document,i as Window,e as isServer}; | ||
//# sourceMappingURL=server-safe-globals.js.map |
@@ -1,1 +0,2 @@ | ||
export function dashedToCamel(t){return t.split("-").map(function(e,o){return(o?e[0].toUpperCase():e[0].toLowerCase())+e.slice(1).toLowerCase()}).join("")}export function constToCamel(t,e=!1){return t.split("_").map(function(o,r){return(r||e?o[0].toUpperCase():o[0].toLowerCase())+o.slice(1).toLowerCase()}).join("")} | ||
function n(t){return t.split("-").map(function(e,o){return(o?e[0].toUpperCase():e[0].toLowerCase())+e.slice(1).toLowerCase()}).join("")}function s(t,e=!1){return t.split("_").map(function(o,r){return(r||e?o[0].toUpperCase():o[0].toLowerCase())+o.slice(1).toLowerCase()}).join("")}export{s as constToCamel,n as dashedToCamel}; | ||
//# sourceMappingURL=stringUtils.js.map |
@@ -1,1 +0,2 @@ | ||
const m=t=>typeof t=="number"&&!Number.isNaN(t)&&Number.isFinite(t),u=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],s=(t,i)=>{const n=t===1?u[i].singular:u[i].plural;return`${t} ${n}`};export const formatAsTimePhrase=t=>{if(!m(t))return"";const i=Math.abs(t),n=i!==t,r=new Date(0,0,0,0,0,i,0);return`${[r.getHours(),r.getMinutes(),r.getSeconds()].map((o,f)=>o&&s(o,f)).filter(o=>o).join(", ")}${n?" remaining":""}`};export function formatTime(t,i){let n=!1;t<0&&(n=!0,t=0-t),t=t<0?0:t;let r=Math.floor(t%60),e=Math.floor(t/60%60),a=Math.floor(t/3600);const l=Math.floor(i/60%60),o=Math.floor(i/3600);return(isNaN(t)||t===Infinity)&&(a=e=r="-"),a=a>0||o>0?a+":":"",e=((a||l>=10)&&e<10?"0"+e:e)+":",r=r<10?"0"+r:r,(n?"-":"")+a+e+r} | ||
const m=t=>typeof t=="number"&&!Number.isNaN(t)&&Number.isFinite(t),u=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],s=(t,i)=>{const n=t===1?u[i].singular:u[i].plural;return`${t} ${n}`},g=t=>{if(!m(t))return"";const i=Math.abs(t),n=i!==t,r=new Date(0,0,0,0,0,i,0);return`${[r.getHours(),r.getMinutes(),r.getSeconds()].map((o,f)=>o&&s(o,f)).filter(o=>o).join(", ")}${n?" remaining":""}`};function h(t,i){let n=!1;t<0&&(n=!0,t=0-t),t=t<0?0:t;let r=Math.floor(t%60),e=Math.floor(t/60%60),a=Math.floor(t/3600);const l=Math.floor(i/60%60),o=Math.floor(i/3600);return(isNaN(t)||t===1/0)&&(a=e=r="-"),a=a>0||o>0?a+":":"",e=((a||l>=10)&&e<10?"0"+e:e)+":",r=r<10?"0"+r:r,(n?"-":"")+a+e+r}export{g as formatAsTimePhrase,h as formatTime}; | ||
//# sourceMappingURL=time.js.map |
{ | ||
"name": "media-chrome", | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"description": "Custom elements (web components) for making audio and video player controls that look great in your website or app.", | ||
@@ -15,6 +15,6 @@ "main": "dist/index.js", | ||
"clean": "rimraf dist", | ||
"build:esm": "snowpack build --config snowpack.prod.config.cjs", | ||
"build:react": "node ./tools/react/build.js", | ||
"build:esm": "esbuild src/js/*.js src/js/*/*.js --target=es2019 --format=esm --outdir=dist --minify --sourcemap", | ||
"build:react": "node ./scripts/react/build.js", | ||
"build": "yarn build:esm && yarn build:react", | ||
"dev": "snowpack dev --config snowpack.dev.config.cjs", | ||
"dev": "node ./scripts/esbuild.js", | ||
"start": "yarn dev", | ||
@@ -46,2 +46,3 @@ "test": "web-test-runner --coverage --config test/web-test-runner.config.js", | ||
"@web/test-runner": "^0.13.20", | ||
"esbuild": "^0.14.23", | ||
"np": "^7.6.0", | ||
@@ -51,6 +52,5 @@ "prettier": "^2.5.1", | ||
"rimraf": "^3.0.2", | ||
"sinon": "^11.1.2", | ||
"snowpack": "^3.8.3" | ||
"sinon": "^11.1.2" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -180,2 +180,3 @@ # [`<media-chrome>`](https://media-chrome.org) | ||
| `<media-captions-button>` | Show/disable captions (if no captions are available, will fallback to subtitles by default unless `no-subtitles-fallback` attribute is set). ([docs](./docs/media-captions-button.md)) | | ||
| `<media-poster-image>` | Show a poster image that's displayed until media begins playing for the first time. Optionally also accepts a `placeholder-src` attribute that can be used for content that immediately loads, such as an inlined, low-resolution image. ([docs](./docs/media-poster-image.md) | | ||
| `<media-airplay-button>` | Bring up the AirPlay menu to select/deselect AirPlay playback (Safari only). ([docs](./docs/media-airplay-button.md)) | | ||
@@ -256,3 +257,3 @@ | `<media-loading-indicator>` | Show when your media content is loading/buffering. ([docs](./docs/media-loading-indicator.md)) | | ||
![media clip selector example](./screenshots/media-clip-selector.gif?raw=true) | ||
![media clip selector example](./docs/assets/media-clip-selector.gif?raw=true) | ||
@@ -259,0 +260,0 @@ ## Architecture |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
623246
122
1378
262