Loading...
- `}_computeBarStyle(t,e){const i=Math.floor(e/2),s=t<=i?.1+t/i*.6:.5-(t-i)/(e-i-1)*.4;return`${`animation-delay: ${(.2*Math.abs(t-i)).toFixed(2)}s;`} ${`background: rgba(var(--rgb-primary-color), ${s.toFixed(2)});`}`}};Lt.styles=a`
+ `}_computeBarStyle(t,e){const i=Math.floor(e/2),s=t<=i?.1+t/i*.6:.5-(t-i)/(e-i-1)*.4;return`${`animation-delay: ${(.2*Math.abs(t-i)).toFixed(2)}s;`} ${`background: rgba(var(--rgb-primary-color), ${s.toFixed(2)});`}`}};Dt.styles=a`
.loader {
- height: 100%;
width: 100%;
+ max-width: var(--ytube-card-width, 500px);
+ height: var(--ytube-card-height, 500px);
display: flex;
justify-content: center;
align-items: center;
+ position: relative;
/* aspect-ratio: 1; */
}
.music {
@@ -238,15 +377,7 @@ ha-card [loading] {
opacity: 1;
}
}
- `,t([mt({type:Number})],Lt.prototype,"cardWidth",void 0),Lt=t([pt("ytube-playlist-loader")],Lt);let zt=class extends ct{constructor(){super(...arguments),this._cardWidth=0}static async getConfigElement(){return await Promise.resolve().then((function(){return Ft})),document.createElement("ytube-playlist-editor")}async setConfig(t){if(!t.entity||"media_player"!==t.entity.split(".")[0])throw new Error("Specify an entity from within the media_player domain");this._config=t}connectedCallback(){super.connectedCallback(),window.YtubeCard=this,this.updateComplete.then((()=>this._attachObserver()))}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver&&this._resizeObserver.disconnect()}async _attachObserver(){this._resizeObserver||(this._resizeObserver=new ResizeObserver(At((()=>this._measureCard()),250,!1)));const t=this.shadowRoot.querySelector("ha-card");t&&this._resizeObserver.observe(t)}_measureCard(){const t=this.shadowRoot.querySelector("ha-card");t&&(this._cardWidth=t.clientWidth)}async firstUpdated(t){super.firstUpdated(t),this._attachObserver(),this._measureCard(),await this._loadContent()}updated(t){super.updated(t),t.has("_dialogOpen")&&(this._attachEventListeners(),this.updateBodyScroll())}async _loadContent(){if(!this.hass||!this._config)return;this._browseState=1;const t=this._config.default_page;let e={media_content_type:"",media_content_id:""};e="custom"===t.type&&void 0!==t.media_content_type&&void 0!==t.media_content_id?{media_content_type:t.media_content_type,media_content_id:t.media_content_id}:{media_content_type:t.type,media_content_id:""};const i=await this.store.haService.browseMedia(e.media_content_type,e.media_content_id);i?i.children&&0!==i.children.length?(this._initialItems=i,this._browseState=0):this._browseState=3:this._browseState=2}_attachEventListeners(){var t;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("ytube-dialog");if(!e)return;const i=e.querySelector(".dialog-content");i&&(i.classList.toggle("slide-in"),e.addEventListener("click",(t=>{t.target===e&&(this._dialogOpen=!1)})))}updateBodyScroll(){const t=document.querySelector("body");this._dialogOpen?t.style.overflow="hidden":t.style.overflow="",this.requestUpdate()}_createStore(){this.hass&&this._config&&(this.store=new wt(this.hass,this._config))}render(){return this.hass&&this._config?(this._createStore(),Y`Loading...
`;const e=[{label:"Custom",value:"custom"},...this._pageTypes],i={label:"Default Page",configType:"default_page",configValue:null===(t=this._config.default_page)||void 0===t?void 0:t.type,selector:{select:{options:e}},required:!0},s=this._HaSelector(i);return Y`${s} ${this._renderCustomPageForm()} ${this._renderCustomPageTitle()}`}_renderCustomPageTitle(){var t,e;return"custom"===(null===(t=this._config.default_page)||void 0===t?void 0:t.type)&&(null===(e=this._config.default_page)||void 0===e?void 0:e.title)?Y`
+}`;let Qt=class extends ct{constructor(){super(...arguments),this._activeTabIndex=0,this._pageTypes=[],this._newCardType=new Map,this._usingCustomPage=!1}connectedCallback(){super.connectedCallback(),window.YtubeEditor=this}disconnectedCallback(){super.disconnectedCallback()}static get styles(){return[Xt]}async setConfig(t){this._config=structuredClone(t)}async firstUpdated(t){super.firstUpdated(t),await new Promise((t=>setTimeout(t,0))),this._pageTypes=await Jt(this.hass,this._config.entity),this._service=new Ct(this.hass,this._config.entity)}render(){if(!this.hass||!this._config)return Y``;const t=[{key:"general",label:"General",content:this._renderGeneralTab()},{key:"layout",label:"Appearance",content:Y`
Appearance
`}],e=Zt({activeTabIndex:this._activeTabIndex||0,onTabChange:t=>this._activeTabIndex=t,tabs:t});return Y`
${e}
`}_renderGeneralTab(){const t=[{label:"Entity",configType:"entity",configValue:this._config.entity,selector:{entity:{filter:{integration:"ytube_music_player",domain:"media_player"}}},required:!0},{label:"Extra",configType:"extra",configValue:this._config.extra,selector:{entity:{filter:{integration:"ytube_music_player"}}}}],e=this._renderPageTypeSelector();return Y` ${t.map((t=>this._HaSelector(t)))} ${e}`}_renderPageTypeSelector(){var t;if(!this._pageTypes)return Y`
Loading...
`;const e=[{label:"Custom",value:"custom"},...this._pageTypes],i={label:"Default Page",configType:"default_page",configValue:null===(t=this._config.default_page)||void 0===t?void 0:t.type,selector:{select:{options:e}},required:!0},s=this._HaSelector(i);return Y`${s} ${this._renderCustomPageForm()} ${this._renderCustomPageTitle()}`}_renderCustomPageTitle(){var t,e;return"custom"===(null===(t=this._config.default_page)||void 0===t?void 0:t.type)&&(null===(e=this._config.default_page)||void 0===e?void 0:e.title)?Y`
`:G}_renderCustomPageForm(){var t;if(!this._usingCustomPage)return Y``;const e=!(null===(t=this._newCardType.get("media_content_type"))||void 0===t?void 0:t.length),i=Y`
@@ -365,7 +586,7 @@ ha-card [loading] {
`,s=Y`
this._usingCustomPage=!1}>Cancel
Save
- `;return Y`
${i} ${s}
`}_handleCustomPageTypeChange(t){t.stopPropagation();const e=t.target,i=e.configValue,s=e.value,r=new Map(this._newCardType);r.set(i,s.trim()),this._newCardType=r,this.requestUpdate()}async _handleCustomPageTypeSave(){var t;const e=this._newCardType.get("media_content_type"),i=this._newCardType.get("media_content_id");if(!e&&!i)return;const s=await(null===(t=this._service)||void 0===t?void 0:t.browseMedia(e,i).then((t=>null==t?void 0:t.title)))||"";this._config=Object.assign(Object.assign({},this._config),{default_page:{type:"custom",media_content_type:null!=e?e:"",media_content_id:null!=i?i:"",title:s}}),this._usingCustomPage=!1,this._newCardType=new Map,Dt(this,"config-changed",{config:this._config})}_HaSelector({label:t,configType:e,configValue:i,selector:s,required:r}){return Y`
+ `;return Y`
${i} ${s}
`}_handleCustomPageTypeChange(t){t.stopPropagation();const e=t.target,i=e.configValue,s=e.value,r=new Map(this._newCardType);r.set(i,s.trim()),this._newCardType=r,this.requestUpdate()}async _handleCustomPageTypeSave(){var t;const e=this._newCardType.get("media_content_type"),i=this._newCardType.get("media_content_id");if(!e&&!i)return;const s=await(null===(t=this._service)||void 0===t?void 0:t.browseMedia(e,i).then((t=>null==t?void 0:t.title)))||"";this._config=Object.assign(Object.assign({},this._config),{default_page:{type:"custom",media_content_type:null!=e?e:"",media_content_id:null!=i?i:"",title:s}}),this._usingCustomPage=!1,this._newCardType=new Map,Kt(this,"config-changed",{config:this._config})}_HaSelector({label:t,configType:e,configValue:i,selector:s,required:r}){return Y`
- `}_valueChanged(t){var e;if(t.stopPropagation(),!this._config||!this.hass)return;const i=t.target,s=i.configType,r=void 0!==i.checked?i.checked:(null===(e=t.detail)||void 0===e?void 0:e.value)||i.value,n={};if("default_page"===s){if("custom"===r)return void(this._usingCustomPage=!0);n[s]={type:r},this._usingCustomPage=!1}else n[s]=r;Object.keys(n).length>0&&(this._config=Object.assign(Object.assign({},this._config),n),Dt(this,"config-changed",{config:this._config}))}};t([mt({attribute:!1})],Yt.prototype,"hass",void 0),t([yt()],Yt.prototype,"_config",void 0),t([yt()],Yt.prototype,"_activeTabIndex",void 0),t([yt()],Yt.prototype,"_pageTypes",void 0),t([yt()],Yt.prototype,"_newCardType",void 0),t([yt()],Yt.prototype,"_usingCustomPage",void 0),t([yt()],Yt.prototype,"_service",void 0),Yt=t([pt("ytube-playlist-editor")],Yt);var Ft=Object.freeze({__proto__:null,get YtubePlaylistEditor(){return Yt}});export{zt as YtubePlaylistCard};
+ `}_valueChanged(t){var e;if(t.stopPropagation(),!this._config||!this.hass)return;const i=t.target,s=i.configType,r=void 0!==i.checked?i.checked:(null===(e=t.detail)||void 0===e?void 0:e.value)||i.value,o={};if("default_page"===s){if("custom"===r)return void(this._usingCustomPage=!0);o[s]={type:r},this._usingCustomPage=!1}else o[s]=r;Object.keys(o).length>0&&(this._config=Object.assign(Object.assign({},this._config),o),Kt(this,"config-changed",{config:this._config}))}};t([mt({attribute:!1})],Qt.prototype,"hass",void 0),t([gt()],Qt.prototype,"_config",void 0),t([gt()],Qt.prototype,"_activeTabIndex",void 0),t([gt()],Qt.prototype,"_pageTypes",void 0),t([gt()],Qt.prototype,"_newCardType",void 0),t([gt()],Qt.prototype,"_usingCustomPage",void 0),t([gt()],Qt.prototype,"_service",void 0),Qt=t([ut("ytube-playlist-editor")],Qt);var te=Object.freeze({__proto__:null,get YtubePlaylistEditor(){return Qt}});export{Yt as YtubePlaylistCard};
diff --git a/docs/README.md b/docs/README.md
index cf77091..d83d00f 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -10,7 +10,7 @@ Hey there! Welcome to my little corner of the tech world! 👨💻
This is where I store all the cool configurations for my Home Assistant system. Well, it's a mix of awesome codes and setups I discovered from the Home Assistant community. Seriously, those folks are wizards! 🧙♂️ As a bit of an internet newbie turned tech enthusiast, I stumbled upon the magic of IT, and this repository is my way of sharing the joy and knowledge I've gained along the way. Dive in, explore, and let the tech magic begin! ✨
-I frequently refresh my configuration files. My current Home Assistant version is
2024.12.4 . If you find something you like, don't forget to give my repository a ⭐️!
+I frequently refresh my configuration files. My current Home Assistant version is
2024.12.5 . If you find something you like, don't forget to give my repository a ⭐️!
@@ -37,7 +37,7 @@ https://github.com/ngocjohn/hass-config/assets/96962827/acc1a4db-b92e-4ab1-ac9d-
- 36,198
+ 36,280
34
178
63
@@ -102,10 +102,8 @@ https://github.com/ngocjohn/hass-config/assets/96962827/acc1a4db-b92e-4ab1-ac9d-
- [Node Red Companion](https://github.com/zachowj/hass-node-red)
- [Nuki Lock](https://github.com/kvj/hass_nuki_ng)
- [Portainer](https://github.com/tomaae/homeassistant-portainer)
-- [Remote Home Assistant](https://github.com/custom-components/remote_homeassistant)
- [Simpleicons](https://github.com/vigonotion/hass-simpleicons)
- [Spook 👻 Your Homie](https://github.com/frenck/spook)
-- [Spotcast](https://github.com/fondberg/spotcast)
- [Spotifyplus](https://github.com/thlucas1/homeassistantcomponent_spotifyplus)
- [Webrtc Camera](https://github.com/AlexxIT/WebRTC)
- [Xiaomi Cloud Map Extractor](https://github.com/PiotrMachowski/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor)
@@ -143,11 +141,9 @@ https://github.com/ngocjohn/hass-config/assets/96962827/acc1a4db-b92e-4ab1-ac9d-
- [Mini Media Player](https://github.com/kalkih/mini-media-player)
- [Multiple Entity Row](https://github.com/benct/lovelace-multiple-entity-row)
- [Mushroom](https://github.com/piitaya/lovelace-mushroom)
-- [Paper Buttons Row](https://github.com/jcwillox/lovelace-paper-buttons-row)
- [Polr Ytube Media Card](https://github.com/pathofleastresistor/polr-ytube-media-card)
- [Purifier Card](https://github.com/denysdovhan/purifier-card)
- [Restriction Card](https://github.com/iantrich/restriction-card)
-- [Roku Card](https://github.com/iantrich/roku-card)
- [Rpi Monitor Card](https://github.com/ironsheep/lovelace-rpi-monitor-card)
- [Simple Thermostat](https://github.com/nervetattoo/simple-thermostat)
- [Slider Button Card](https://github.com/custom-cards/slider-button-card)
@@ -160,10 +156,8 @@ https://github.com/ngocjohn/hass-config/assets/96962827/acc1a4db-b92e-4ab1-ac9d-
- [Timer Bar Card](https://github.com/rianadon/timer-bar-card)
- [Tv Remote Card (With Touchpad And Haptic Feedback)](https://github.com/usernein/tv-card)
- [Upcoming Media Card](https://github.com/xZetsubou/upcoming-media-card)
-- [Uptime Card](https://github.com/dylandoamaral/uptime-card)
- [Vehicle Info Card](https://github.com/ngocjohn/vehicle-info-card)
- [Vehicle Status Card](https://github.com/ngocjohn/vehicle-status-card)
-- [Vertical Stack In Card](https://github.com/ofekashery/vertical-stack-in-card)
- [Weather Card](https://github.com/bramkragten/weather-card)
- [Weather Chart Card](https://github.com/mlamberts78/weather-chart-card)
- [Weather Radar Card](https://github.com/Makin-Things/weather-radar-card)