Final tweaks for 2.0 release

This commit is contained in:
thomas committed 2022-09-03 10:36:14 +00:00
1 parent 1a3a7b2e95
commit 6f2c139b89
7 files changed
+244 -235

No files matched your search

+135 -130
View File
@@ -1,14 +1,14 @@
function e(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(n<3?o(r):n>3?o(t,i,r):o(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r}const t=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),s=new WeakMap;class o{constructor(e,t,s){if(this._$cssResult$=!0,s!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const i=this.t;if(t&&void 0===e){const t=void 0!==i&&1===i.length;t&&(e=s.get(i)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&s.set(i,e))}return e}toString(){return this.cssText}}const n=(e,...t)=>{const s=1===e.length?e[0]:t.reduce(((t,i,s)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[s+1]),e[0]);return new o(s,e,i)},r=t?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new o("string"==typeof e?e:e+"",void 0,i))(t)})(e):e;var a;const l=window.trustedTypes,d=l?l.emptyScript:"",h=window.reactiveElementPolyfillSupport,c={toAttribute(e,t){switch(t){case Boolean:e=e?d:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},u=(e,t)=>t!==e&&(t==t||e==e),p={attribute:!0,type:String,converter:c,reflect:!1,hasChanged:u};class w extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(e){var t;null!==(t=this.h)&&void 0!==t||(this.h=[]),this.h.push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,i)=>{const s=this._$Ep(i,t);void 0!==s&&(this._$Ev.set(s,i),e.push(s))})),e}static createProperty(e,t=p){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const i="symbol"==typeof e?Symbol():"__"+e,s=this.getPropertyDescriptor(e,i,t);void 0!==s&&Object.defineProperty(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(s){const o=this[e];this[t]=s,this.requestUpdate(e,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||p}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const i of t)this.createProperty(i,e[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(r(e))}else void 0!==e&&t.push(r(e));return t}static _$Ep(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}u(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,i;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(i=e.hostConnected)||void 0===i||i.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const i=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,i)=>{t?e.adoptedStyleSheets=i.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):i.forEach((t=>{const i=document.createElement("style"),s=window.litNonce;void 0!==s&&i.setAttribute("nonce",s),i.textContent=t.cssText,e.appendChild(i)}))})(i,this.constructor.elementStyles),i}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,i){thisLine truncated function e(e,t,i,o){var s,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(r=(n<3?s(r):n>3?s(t,i,r):s(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r}const t=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),o=new WeakMap;class s{constructor(e,t,o){if(this._$cssResult$=!0,o!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const i=this.t;if(t&&void 0===e){const t=void 0!==i&&1===i.length;t&&(e=o.get(i)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&o.set(i,e))}return e}toString(){return this.cssText}}const n=(e,...t)=>{const o=1===e.length?e[0]:t.reduce(((t,i,o)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[o+1]),e[0]);return new s(o,e,i)},r=t?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new s("string"==typeof e?e:e+"",void 0,i))(t)})(e):e;var a;const l=window.trustedTypes,d=l?l.emptyScript:"",h=window.reactiveElementPolyfillSupport,c={toAttribute(e,t){switch(t){case Boolean:e=e?d:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},u=(e,t)=>t!==e&&(t==t||e==e),p={attribute:!0,type:String,converter:c,reflect:!1,hasChanged:u};class w extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(e){var t;null!==(t=this.h)&&void 0!==t||(this.h=[]),this.h.push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,i)=>{const o=this._$Ep(i,t);void 0!==o&&(this._$Ev.set(o,i),e.push(o))})),e}static createProperty(e,t=p){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const i="symbol"==typeof e?Symbol():"__"+e,o=this.getPropertyDescriptor(e,i,t);void 0!==o&&Object.defineProperty(this.prototype,e,o)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(o){const s=this[e];this[t]=o,this.requestUpdate(e,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||p}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const i of t)this.createProperty(i,e[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(r(e))}else void 0!==e&&t.push(r(e));return t}static _$Ep(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}u(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,i;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(i=e.hostConnected)||void 0===i||i.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const i=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,i)=>{t?e.adoptedStyleSheets=i.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):i.forEach((t=>{const i=document.createElement("style"),o=window.litNonce;void 0!==o&&i.setAttribute("nonce",o),i.textContent=t.cssText,e.appendChild(i)}))})(i,this.constructor.elementStyles),i}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,i){thisLine truncated
<ha-card outlined> <ha-card outlined>
<h1 class="card-header"> <h1 class="card-header">
<div class="name">This Browser</div> <div class="name">This Browser</div>
${(null===(e=window.browser_mod)||void 0===e?void 0:e.connected)?k` ${(null===(e=window.browser_mod)||void 0===e?void 0:e.connected)?U`
<ha-icon <ha-icon
class="icon" class="icon"
.icon=${"mdi:check-circle-outline"} .icon=${"mdi:check-circle-outline"}
style="color: var(--success-color, green);" style="color: var(--success-color, green);"
></ha-icon> ></ha-icon>
`:k` `:U`
<ha-icon <ha-icon
class="icon" class="icon"
.icon=${"mdi:circle-outline"} .icon=${"mdi:circle-outline"}
@@ -17,7 +17,7 @@ function e(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPro
`} `}
</h1> </h1>
<div class="card-content"> <div class="card-content">
${this.dirty?k` ${this.dirty?U`
<ha-alert alert-type="warning"> <ha-alert alert-type="warning">
It is strongly recommended to refresh your browser window It is strongly recommended to refresh your browser window
after changing any of the settings in this box. after changing any of the settings in this box.
@@ -47,7 +47,7 @@ function e(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPro
></ha-textfield> ></ha-textfield>
</ha-settings-row> </ha-settings-row>
${(null===(s=window.browser_mod)||void 0===s?void 0:s.registered)?k` ${(null===(o=window.browser_mod)||void 0===o?void 0:o.registered)?U`
${this._renderSuspensionAlert()} ${this._renderSuspensionAlert()}
<ha-settings-row> <ha-settings-row>
<span slot="heading">Enable camera</span> <span slot="heading">Enable camera</span>
@@ -56,11 +56,11 @@ function e(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPro
dependent)</span dependent)</span
> >
<ha-switch <ha-switch
.checked=${null===(o=window.browser_mod)||void 0===o?void 0:o.cameraEnabled} .checked=${null===(s=window.browser_mod)||void 0===s?void 0:s.cameraEnabled}
@change=${this.toggleCameraEnabled} @change=${this.toggleCameraEnabled}
></ha-switch> ></ha-switch>
</ha-settings-row> </ha-settings-row>
${(null===(n=window.browser_mod)||void 0===n?void 0:n.cameraError)?k` ${(null===(n=window.browser_mod)||void 0===n?void 0:n.cameraError)?U`
<ha-alert alert-type="error"> <ha-alert alert-type="error">
Setting up the device camera failed. Make sure you have Setting up the device camera failed. Make sure you have
allowed use of the camera in your browser. allowed use of the camera in your browser.
@@ -71,7 +71,7 @@ function e(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPro
`:""} `:""}
</div> </div>
</ha-card> </ha-card>
`}_renderSuspensionAlert(){return this.hass.suspendWhenHidden?k` `}_renderSuspensionAlert(){return this.hass.suspendWhenHidden?U`
<ha-alert alert-type="warning" title="Auto closing connection"> <ha-alert alert-type="warning" title="Auto closing connection">
Home Assistant will close the websocket connection to the server Home Assistant will close the websocket connection to the server
automatically after 5 minutes of inactivity.<br /><br /> automatically after 5 minutes of inactivity.<br /><br />
@@ -88,7 +88,7 @@ function e(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPro
and disabling the option and disabling the option
"${this.hass.localize("ui.panel.profile.suspend.header")||"Automatically close connection"}". "${this.hass.localize("ui.panel.profile.suspend.header")||"Automatically close connection"}".
</ha-alert> </ha-alert>
`:k``}_renderInteractionAlert(){return k` `:U``}_renderInteractionAlert(){return U`
<ha-alert title="Interaction requirement"> <ha-alert title="Interaction requirement">
For privacy reasons many browsers require the user to interact with a For privacy reasons many browsers require the user to interact with a
webpage before allowing audio playback or video capture. This may affect webpage before allowing audio playback or video capture. This may affect
@@ -97,34 +97,37 @@ function e(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPro
Mod. <br /><br /> Mod. <br /><br />
If you ever see a If you ever see a
<ha-icon icon="mdi:gesture-tap"></ha-icon> symbol at the bottom right <ha-icon
corner of the screen, please tap or click anywhere on the page. This icon="mdi:gesture-tap"
should allow Browser Mod to work again. style="color: var(--warning-color);"
></ha-icon>
symbol at the bottom right corner of the screen, please tap or click
anywhere on the page. This should allow Browser Mod to work again.
</ha-alert> </ha-alert>
`}_renderFKBSettingsInfo(){var e,t;return(null===(e=window.browser_mod)||void 0===e?void 0:e.fully)&&this.getFullySettings()?k` `}_renderFKBSettingsInfo(){var e,t;return(null===(e=window.browser_mod)||void 0===e?void 0:e.fully)&&this.getFullySettings()?U`
${(null===(t=window.browser_mod)||void 0===t?void 0:t.fully)&&this.getFullySettings()?k` <ha-alert title="FullyKiosk Browser"> ${(null===(t=window.browser_mod)||void 0===t?void 0:t.fully)&&this.getFullySettings()?U` <ha-alert title="FullyKiosk Browser">
You are using FullyKiosk Browser. It is recommended to enable the You are using FullyKiosk Browser. It is recommended to enable the
following settings: following settings:
<ul> <ul>
${this.getFullySettings()} ${this.getFullySettings()}
</ul> </ul>
</ha-alert>`:""} </ha-alert>`:""}
`:k``}getFullySettings(){if(!window.browser_mod.fully)return null;const e=[],t=[];"true"!==window.fully.getBooleanSetting("autoplayVideos")&&t.push(k`<li>Autoplay Videos</li>`),"true"!==window.fully.getBooleanSetting("autoplayAudio")&&t.push(k`<li>Autoplay Audio</li>`),"true"!==window.fully.getBooleanSetting("webcamAccess")&&t.push(k`<li>Enable Webcam Access (PLUS)</li>`),0!==t.length&&e.push(k`<li>Web Content Settings</li> `:U``}getFullySettings(){if(!window.browser_mod.fully)return null;const e=[],t=[];"true"!==window.fully.getBooleanSetting("autoplayVideos")&&t.push(U`<li>Autoplay Videos</li>`),"true"!==window.fully.getBooleanSetting("autoplayAudio")&&t.push(U`<li>Autoplay Audio</li>`),"true"!==window.fully.getBooleanSetting("webcamAccess")&&t.push(U`<li>Enable Webcam Access (PLUS)</li>`),0!==t.length&&e.push(U`<li>Web Content Settings</li>
<ul> <ul>
${t} ${t}
</ul>`),"true"!==window.fully.getBooleanSetting("websiteIntegration")&&e.push(k`<li>Advanced Web Settings</li> </ul>`),"true"!==window.fully.getBooleanSetting("websiteIntegration")&&e.push(U`<li>Advanced Web Settings</li>
<ul> <ul>
<li>Enable JavaScript Interface (PLUS)</li> <li>Enable JavaScript Interface (PLUS)</li>
</ul>`),"true"!==window.fully.getBooleanSetting("keepScreenOn")&&e.push(k`<li>Device Management</li> </ul>`),"true"!==window.fully.getBooleanSetting("keepScreenOn")&&e.push(U`<li>Device Management</li>
<ul> <ul>
<li>Keep Screen On</li> <li>Keep Screen On</li>
</ul>`),"true"!==window.fully.getBooleanSetting("preventSleepWhileScreenOff")&&e.push(k`<li>Power Settings</li> </ul>`),"true"!==window.fully.getBooleanSetting("preventSleepWhileScreenOff")&&e.push(U`<li>Power Settings</li>
<ul> <ul>
<li>Prevent from Sleep while Screen Off</li> <li>Prevent from Sleep while Screen Off</li>
</ul>`);const i=[];return"true"!==window.fully.getBooleanSetting("motionDetection")&&i.push(k`<li>Enable Visual Motion Detection</li>`),"true"!==window.fully.getBooleanSetting("screenOnOnMotion")&&i.push(k`<li>Turn Screen On on Motion</li>`),"true"!==window.fully.getBooleanSetting("stopScreensaverOnMotion")&&i.push(k`<li>Exit Screensaver on Motion</li>`),0!==i.length&&e.push(k`<li>Motion Detection (PLUS)</li> </ul>`);const i=[];return"true"!==window.fully.getBooleanSetting("motionDetection")&&i.push(U`<li>Enable Visual Motion Detection</li>`),"true"!==window.fully.getBooleanSetting("screenOnOnMotion")&&i.push(U`<li>Turn Screen On on Motion</li>`),"true"!==window.fully.getBooleanSetting("stopScreensaverOnMotion")&&i.push(U`<li>Exit Screensaver on Motion</li>`),0!==i.length&&e.push(U`<li>Motion Detection (PLUS)</li>
<ul> <ul>
${i} ${i}
</ul>`),"true"!==window.fully.getBooleanSetting("remoteAdmin")&&e.push(k`<li>Remote Administration (PLUS)</li> </ul>`),"true"!==window.fully.getBooleanSetting("remoteAdmin")&&e.push(U`<li>Remote Administration (PLUS)</li>
<ul> <ul>
<li>Enable Remote Administration</li> <li>Enable Remote Administration</li>
</ul>`),e.length?e:null}static get styles(){return n` </ul>`),e.length?e:null}static get styles(){return n`
@@ -137,10 +140,10 @@ function e(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPro
display: block; display: block;
margin-top: 8px; margin-top: 8px;
} }
`}}e([ee()],re.prototype,"hass",void 0),e([ee()],re.prototype,"dirty",void 0),customElements.define("browser-mod-browser-settings-card",re);class ae extends Z{firstUpdated(){window.browser_mod.addEventListener("browser-mod-config-update",(()=>this.requestUpdate()))}unregister_browser(e){const t=e.currentTarget.browserID;window.browser_mod.showPopup("Unregister browser",`Are you sure you want to unregister Browser ${t}?`,{right_button:"Yes",right_button_action:()=>{t===window.browser_mod.browserID?window.browser_mod.registered=!1:window.browser_mod.connection.sendMessage({type:"browser_mod/unregister",browserID:t})},left_button:"No"})}register_cast(){window.browser_mod.connection.sendMessage({type:"browser_mod/register",browserID:"CAST"})}render(){return k` `}}e([ee()],re.prototype,"hass",void 0),e([ee()],re.prototype,"dirty",void 0),customElements.define("browser-mod-browser-settings-card",re);class ae extends Z{firstUpdated(){window.browser_mod.addEventListener("browser-mod-config-update",(()=>this.requestUpdate()))}unregister_browser(e){const t=e.currentTarget.browserID;window.browser_mod.showPopup("Unregister browser",`Are you sure you want to unregister Browser ${t}?`,{right_button:"Yes",right_button_action:()=>{t===window.browser_mod.browserID?window.browser_mod.registered=!1:window.browser_mod.connection.sendMessage({type:"browser_mod/unregister",browserID:t})},left_button:"No"})}register_cast(){window.browser_mod.connection.sendMessage({type:"browser_mod/register",browserID:"CAST"})}render(){return U`
<ha-card header="Registered Browsers" outlined> <ha-card header="Registered Browsers" outlined>
<div class="card-content"> <div class="card-content">
${Object.keys(window.browser_mod.browsers).map((e=>{const t=window.browser_mod.browsers[e];return k` <ha-settings-row> ${Object.keys(window.browser_mod.browsers).map((e=>{const t=window.browser_mod.browsers[e];return U` <ha-settings-row>
<span slot="heading"> ${e} </span> <span slot="heading"> ${e} </span>
<span slot="description"> <span slot="description">
Last connected: Last connected:
@@ -149,7 +152,7 @@ function e(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPro
.datetime=${t.last_seen} .datetime=${t.last_seen}
></ha-relative-time> ></ha-relative-time>
</span> </span>
${t.meta&&"default"!==t.meta?k` ${t.meta&&"default"!==t.meta?U`
<a href="config/devices/device/${t.meta}"> <a href="config/devices/device/${t.meta}">
<ha-icon-button> <ha-icon-button>
<ha-icon .icon=${"mdi:devices"}></ha-icon> <ha-icon .icon=${"mdi:devices"}></ha-icon>
@@ -161,7 +164,7 @@ function e(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPro
</ha-icon-button> </ha-icon-button>
</ha-settings-row>`}))} </ha-settings-row>`}))}
</div> </div>
${void 0===window.browser_mod.browsers.CAST?k` ${void 0===window.browser_mod.browsers.CAST?U`
<div class="card-actions"> <div class="card-actions">
<mwc-button @click=${this.register_cast}> <mwc-button @click=${this.register_cast}>
Register CAST Browser Register CAST Browser
@@ -174,45 +177,45 @@ function e(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPro
display: flex; display: flex;
color: var(--primary-text-color); color: var(--primary-text-color);
} }
`}}e([ee()],ae.prototype,"hass",void 0),customElements.define("browser-mod-registered-browsers-card",ae);class le extends Z{constructor(){super(...arguments),this.settingSelector={template:{}},this.tableData=[],this._users=void 0}firstUpdated(){window.browser_mod.addEventListener("browser-mod-config-update",(()=>this.updateTable()))}updated(e){e.has("settingKey")&&this.updateTable(),e.has("hass")&&void 0===e.get("hass")&&this.updateTable()}async fetchUsers(){return void 0===this._users&&(this._users=await this.hass.callWS({type:"config/auth/list"})),this._users}clearSetting(e,t){var i;null===(i=window.browser_mod)||void 0===i||i.showPopup("Are you sure","Do you wish to clear this setting?",{right_button:"Yes",right_button_action:async()=>{if("sidebarPanelOrder"===this.settingKey)return await ne(document,"home-assistant $ home-assistant-main $ app-drawer-layout app-drawer ha-sidebar"),window.browser_mod.setSetting(e,t,{sidebarHiddenPanels:"[]",sidebarPanelOrder:"[]"}),void window.browser_mod.setSetting(e,t,{sidebarHiddenPanels:void 0,sidebarPanelOrder:void 0});this.default&&window.browser_mod.setSetting(e,t,{[this.settingKey]:this.default}),window.browser_mod.setSetting(e,t,{[this.settingKey]:void 0})},left_button:"No"})}changeSetting(e,t){var i,s,o,n,r,a;const l=null===(s=null===(i=window.browser_mod)||void 0===i?void 0:i.getSetting)||void 0===s?void 0:s.call(i,this.settingKey),d=null!==(o="global"===e?l.global:l[e][t])&&void 0!==o?o:this.default;null===(n=window.browser_mod)||void 0===n||n.showPopup("Change value",null!==(r=this.settingSelector.plaintext)&&void 0!==r?r:[{name:"value",label:null!==(a=this.settingSelector.label)&&void 0!==a?a:"",default:d,selector:this.settingSelector}],{right_button:"OK",right_button_action:async i=>{if("sidebarPanelOrder"===this.settingKey){const i=await ne(document,"home-assistant $ home-assistant-main $ app-drawer-layout app-drawer ha-sidebar");return window.browser_mod.setSetting(e,t,{sidebarHiddenPanels:JSON.stringify(i._hiddenPanels),sidebarPanelOrder:JSON.stringify(i._panelOrder)}),void console.log(i._hiddenPanels,i._panelOrder)}let s=i.value;window.browser_mod.setSetting(e,t,{[this.settingKey]:s})},left_button:"Cancel"})}addBrowserSetting(){var e,t;const i=null===(t=null===(e=window.browser_mod)||void 0===e?void 0:e.getSetting)||void 0===t?void 0:t.call(e,this.settingKey),s=window.browser_mod._data.browsers,o=[];for(const e of Object.keys(s))null==i.browser[e]&&o.push(e);0!==o.length?window.browser_mod.showPopup("Select browser to configure",[{name:"browser",label:"",selector:{select:{options:o}}}],{right_button:"Next",right_button_action:e=>this.changeSetting("browser",e.browser),left_button:"Cancel"}):window.browser_mod.showPopup("No browsers to configure","All registered browsers have already been configured.",{right_button:"OK"})}async addUserSetting(){var e,t;const i=null===(t=null===(e=window.browser_mod)||void 0===e?void 0:e.getSetting)||void 0===t?void 0:t.call(e,this.settingKey),s=await this.fetchUsers(),o=[];for(const e of s)e.username&&null==i.user[e.id]&&o.push({label:e.name,value:e.id});0!==o.length?window.browser_mod.showPopup("Select user to configure",[{name:"user",label:"",selector:{select:{options:o}}}],{right_button:"Next",right_button_action:e=>this.changeSetting("user",e.user),left_button:"Cancel"}):window.browser_mod.showPopup("No users to configure","All users have already been configured.",{right_button:"OK"})}async updateTable(){var e,t;if(void 0===this.hass)return;const i=await this.fetchUsers(),s=null===(t=null===(e=window.browser_mod)||void 0===e?void 0:e.getSetting)||void 0===t?void 0:t.call(e,this.settingKey),o=[];for(const[e,t]of Object.entries(s.user)){const s=i.find((t=>t.id===e));o.push({name:`User: ${s.name}`,value:String(t),controls:k` `}}e([ee()],ae.prototype,"hass",void 0),customElements.define("browser-mod-registered-browsers-card",ae);class le extends Z{constructor(){super(...arguments),this.settingSelector={template:{}},this.tableData=[],this._users=void 0}firstUpdated(){window.browser_mod.addEventListener("browser-mod-config-update",(()=>this.updateTable()))}updated(e){e.has("settingKey")&&this.updateTable(),e.has("hass")&&void 0===e.get("hass")&&this.updateTable()}async fetchUsers(){return void 0===this._users&&(this._users=await this.hass.callWS({type:"config/auth/list"})),this._users}clearSetting(e,t){var i;null===(i=window.browser_mod)||void 0===i||i.showPopup("Are you sure","Do you wish to clear this setting?",{right_button:"Yes",right_button_action:async()=>{if("sidebarPanelOrder"===this.settingKey)return await ne(document,"home-assistant $ home-assistant-main $ app-drawer-layout app-drawer ha-sidebar"),window.browser_mod.setSetting(e,t,{sidebarHiddenPanels:"[]",sidebarPanelOrder:"[]"}),void window.browser_mod.setSetting(e,t,{sidebarHiddenPanels:void 0,sidebarPanelOrder:void 0});this.default&&window.browser_mod.setSetting(e,t,{[this.settingKey]:this.default}),window.browser_mod.setSetting(e,t,{[this.settingKey]:void 0})},left_button:"No"})}changeSetting(e,t){var i,o,s,n,r,a;const l=null===(o=null===(i=window.browser_mod)||void 0===i?void 0:i.getSetting)||void 0===o?void 0:o.call(i,this.settingKey),d=null!==(s="global"===e?l.global:l[e][t])&&void 0!==s?s:this.default;null===(n=window.browser_mod)||void 0===n||n.showPopup("Change value",null!==(r=this.settingSelector.plaintext)&&void 0!==r?r:[{name:"value",label:null!==(a=this.settingSelector.label)&&void 0!==a?a:"",default:d,selector:this.settingSelector}],{right_button:"OK",right_button_action:async i=>{if("sidebarPanelOrder"===this.settingKey){const i=await ne(document,"home-assistant $ home-assistant-main $ app-drawer-layout app-drawer ha-sidebar");return window.browser_mod.setSetting(e,t,{sidebarHiddenPanels:JSON.stringify(i._hiddenPanels),sidebarPanelOrder:JSON.stringify(i._panelOrder)}),void console.log(i._hiddenPanels,i._panelOrder)}let o=i.value;window.browser_mod.setSetting(e,t,{[this.settingKey]:o})},left_button:"Cancel"})}addBrowserSetting(){var e,t;const i=null===(t=null===(e=window.browser_mod)||void 0===e?void 0:e.getSetting)||void 0===t?void 0:t.call(e,this.settingKey),o=window.browser_mod._data.browsers,s=[];for(const e of Object.keys(o))null==i.browser[e]&&s.push(e);0!==s.length?window.browser_mod.showPopup("Select browser to configure",[{name:"browser",label:"",selector:{select:{options:s}}}],{right_button:"Next",right_button_action:e=>this.changeSetting("browser",e.browser),left_button:"Cancel"}):window.browser_mod.showPopup("No browsers to configure","All registered browsers have already been configured.",{right_button:"OK"})}async addUserSetting(){var e,t;const i=null===(t=null===(e=window.browser_mod)||void 0===e?void 0:e.getSetting)||void 0===t?void 0:t.call(e,this.settingKey),o=await this.fetchUsers(),s=[];for(const e of o)e.username&&null==i.user[e.id]&&s.push({label:e.name,value:e.id});0!==s.length?window.browser_mod.showPopup("Select user to configure",[{name:"user",label:"",selector:{select:{options:s}}}],{right_button:"Next",right_button_action:e=>this.changeSetting("user",e.user),left_button:"Cancel"}):window.browser_mod.showPopup("No users to configure","All users have already been configured.",{right_button:"OK"})}async updateTable(){var e,t;if(void 0===this.hass)return;const i=await this.fetchUsers(),o=null===(t=null===(e=window.browser_mod)||void 0===e?void 0:e.getSetting)||void 0===t?void 0:t.call(e,this.settingKey),s=[];for(const[e,t]of Object.entries(o.user)){const o=i.find((t=>t.id===e));s.push({name:`User: ${o.name}`,value:String(t),controls:U`
<ha-icon-button @click=${()=>this.changeSetting("user",e)}> <ha-icon-button @click=${()=>this.changeSetting("user",e)}>
<ha-icon .icon=${"mdi:pencil"} style="display:flex;"></ha-icon> <ha-icon .icon=${"mdi:pencil"} style="display:flex;"></ha-icon>
</ha-icon-button> </ha-icon-button>
<ha-icon-button @click=${()=>this.clearSetting("user",e)}> <ha-icon-button @click=${()=>this.clearSetting("user",e)}>
<ha-icon .icon=${"mdi:delete"} style="display:flex;"></ha-icon> <ha-icon .icon=${"mdi:delete"} style="display:flex;"></ha-icon>
</ha-icon-button> </ha-icon-button>
`})}o.push({name:"",value:k` `})}s.push({name:"",value:U`
<mwc-button @click=${()=>this.addUserSetting()}> <mwc-button @click=${()=>this.addUserSetting()}>
<ha-icon .icon=${"mdi:plus"}></ha-icon> <ha-icon .icon=${"mdi:plus"}></ha-icon>
Add user setting Add user setting
</mwc-button> </mwc-button>
`});for(const[e,t]of Object.entries(s.browser))o.push({name:`Browser: ${e}`,value:String(t),controls:k` `});for(const[e,t]of Object.entries(o.browser))s.push({name:`Browser: ${e}`,value:String(t),controls:U`
<ha-icon-button @click=${()=>this.changeSetting("browser",e)}> <ha-icon-button @click=${()=>this.changeSetting("browser",e)}>
<ha-icon .icon=${"mdi:pencil"} style="display:flex;"></ha-icon> <ha-icon .icon=${"mdi:pencil"} style="display:flex;"></ha-icon>
</ha-icon-button> </ha-icon-button>
<ha-icon-button @click=${()=>this.clearSetting("browser",e)}> <ha-icon-button @click=${()=>this.clearSetting("browser",e)}>
<ha-icon .icon=${"mdi:delete"} style="display:flex;"></ha-icon> <ha-icon .icon=${"mdi:delete"} style="display:flex;"></ha-icon>
</ha-icon-button> </ha-icon-button>
`});o.push({name:"",value:k` `});s.push({name:"",value:U`
<mwc-button @click=${()=>this.addBrowserSetting()}> <mwc-button @click=${()=>this.addBrowserSetting()}>
<ha-icon .icon=${"mdi:plus"}></ha-icon> <ha-icon .icon=${"mdi:plus"}></ha-icon>
Add browser setting Add browser setting
</mwc-button> </mwc-button>
`}),o.push({name:"GLOBAL",value:null!=s.global?String(s.global):k`<span style="color: var(--warning-color);">DEFAULT</span>`,controls:k` `}),s.push({name:"GLOBAL",value:null!=o.global?String(o.global):U`<span style="color: var(--warning-color);">DEFAULT</span>`,controls:U`
<ha-icon-button @click=${()=>this.changeSetting("global",null)}> <ha-icon-button @click=${()=>this.changeSetting("global",null)}>
<ha-icon .icon=${"mdi:pencil"} style="display:flex;"></ha-icon> <ha-icon .icon=${"mdi:pencil"} style="display:flex;"></ha-icon>
</ha-icon-button> </ha-icon-button>
<ha-icon-button @click=${()=>this.clearSetting("global",null)}> <ha-icon-button @click=${()=>this.clearSetting("global",null)}>
<ha-icon .icon=${"mdi:delete"} style="display:flex;"></ha-icon> <ha-icon .icon=${"mdi:delete"} style="display:flex;"></ha-icon>
</ha-icon-button> </ha-icon-button>
`}),this.tableData=o}render(){var e,t;null===(t=null===(e=window.browser_mod)||void 0===e?void 0:e.global_settings)||void 0===t||t[this.settingKey];return k` `}),this.tableData=s}render(){var e,t;null===(t=null===(e=window.browser_mod)||void 0===e?void 0:e.global_settings)||void 0===t||t[this.settingKey];return U`
<ha-data-table .columns=${{name:{title:"Name",grows:!0},value:{title:"Value",grows:!0},controls:{}}} .data=${this.tableData} auto-height> <ha-data-table .columns=${{name:{title:"Name",grows:!0},value:{title:"Value",grows:!0},controls:{}}} .data=${this.tableData} auto-height>
</ha-data-table> </ha-data-table>
`}static get styles(){return n` `}static get styles(){return n`
:host { :host {
display: block; display: block;
} }
`}}e([ee()],le.prototype,"settingKey",void 0),e([ee()],le.prototype,"settingSelector",void 0),e([ee()],le.prototype,"hass",void 0),e([ee()],le.prototype,"default",void 0),e([ee()],le.prototype,"tableData",void 0),customElements.define("browser-mod-settings-table",le),(async()=>{var e,t,i,s,o,n,r;await customElements.whenDefined("partial-panel-resolver"),await customElements.whenDefined("partial-panel-resolver");const a=document.createElement("partial-panel-resolver").getRoutes([{component_name:"developer-tools",url_path:"a"}]);await(null===(i=null===(t=null===(e=null==a?void 0:a.routes)||void 0===e?void 0:e.a)||void 0===t?void 0:t.load)||void 0===i?void 0:i.call(t));const l=document.createElement("developer-tools-router");await(null===(r=null===(n=null===(o=null===(s=null==l?void 0:l.routerOptions)||void 0===s?void 0:s.routes)||void 0===o?void 0:o.template)||void 0===n?void 0:n.load)||void 0===r?void 0:r.call(n)),await customElements.whenDefined("developer-tools-template")})();class de extends Z{constructor(){super(...arguments),this._dashboards=[],this._editSidebar=!1,this._savedSidebar={panelOrder:[],hiddenPanels:[]}}firstUpdated(){window.browser_mod.addEventListener("browser-mod-config-update",(()=>this.requestUpdate()))}updated(e){e.has("hass")&&void 0===e.get("hass")&&(async()=>{this._dashboards=await this.hass.callWS({type:"lovelace/dashboards/list"})})()}async toggleEditSidebar(){var e,t;const i=await ne(document,"home-assistant $ home-assistant-main $ app-drawer-layout app-drawer ha-sidebar");i.editMode=!i.editMode,this._editSidebar=i.editMode,this._editSidebar?this._savedSidebar={panelOrder:i._panelOrder,hiddenPanels:i._hiddenPanels}:(i._panelOrder=null!==(e=this._savedSidebar.panelOrder)&&void 0!==e?e:[],i._hiddenPanels=null!==(t=this._savedSidebar.hiddenPanels)&&void 0!==t?t:[],this._savedSidebar={panelOrder:[],hiddenPanels:[]})}render(){const e=this._dashboards.map((e=>({value:e.url_path,label:e.title}))),t={select:{options:[{value:"lovelace",label:"lovelace (default)"},...e],custom_value:!0}};return k` `}}e([ee()],le.prototype,"settingKey",void 0),e([ee()],le.prototype,"settingSelector",void 0),e([ee()],le.prototype,"hass",void 0),e([ee()],le.prototype,"default",void 0),e([ee()],le.prototype,"tableData",void 0),customElements.define("browser-mod-settings-table",le),(async()=>{var e,t,i,o,s,n,r;await customElements.whenDefined("partial-panel-resolver"),await customElements.whenDefined("partial-panel-resolver");const a=document.createElement("partial-panel-resolver").getRoutes([{component_name:"developer-tools",url_path:"a"}]);await(null===(i=null===(t=null===(e=null==a?void 0:a.routes)||void 0===e?void 0:e.a)||void 0===t?void 0:t.load)||void 0===i?void 0:i.call(t));const l=document.createElement("developer-tools-router");await(null===(r=null===(n=null===(s=null===(o=null==l?void 0:l.routerOptions)||void 0===o?void 0:o.routes)||void 0===s?void 0:s.template)||void 0===n?void 0:n.load)||void 0===r?void 0:r.call(n)),await customElements.whenDefined("developer-tools-template")})();class de extends Z{constructor(){super(...arguments),this._dashboards=[],this._editSidebar=!1,this._savedSidebar={panelOrder:[],hiddenPanels:[]}}firstUpdated(){window.browser_mod.addEventListener("browser-mod-config-update",(()=>this.requestUpdate()))}updated(e){e.has("hass")&&void 0===e.get("hass")&&(async()=>{this._dashboards=await this.hass.callWS({type:"lovelace/dashboards/list"})})()}async toggleEditSidebar(){var e,t;const i=await ne(document,"home-assistant $ home-assistant-main $ app-drawer-layout app-drawer ha-sidebar");i.editMode=!i.editMode,this._editSidebar=i.editMode,this._editSidebar?this._savedSidebar={panelOrder:i._panelOrder,hiddenPanels:i._hiddenPanels}:(i._panelOrder=null!==(e=this._savedSidebar.panelOrder)&&void 0!==e?e:[],i._hiddenPanels=null!==(t=this._savedSidebar.hiddenPanels)&&void 0!==t?t:[],this._savedSidebar={panelOrder:[],hiddenPanels:[]})}render(){const e=this._dashboards.map((e=>({value:e.url_path,label:e.title}))),t={select:{options:[{value:"lovelace",label:"lovelace (default)"},...e],custom_value:!0}};return U`
<ha-card header="Frontend Settings" outlined> <ha-card header="Frontend Settings" outlined>
<div class="card-content"> <div class="card-content">
<ha-alert alert-type="warning" title="Please note:"> <ha-alert alert-type="warning" title="Please note:">
@@ -233,109 +236,101 @@ function e(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPro
DEFAULT. DEFAULT.
</p> </p>
<div class="separator"></div> <ha-expansion-panel
.header=${"Title template"}
.secondary=${"Jinja template for the browser window/tab title"}
leftChevron
>
<browser-mod-settings-table
.hass=${this.hass}
.settingKey=${"titleTemplate"}
></browser-mod-settings-table>
</ha-expansion-panel>
<ha-settings-row> <ha-expansion-panel
<span slot="heading">Title template</span> .header=${"Favicon template"}
<span slot="description"> .secondary=${"Jinja template for the browser favicon"}
Jinja template for the browser window/tab title leftChevron
</span> >
</ha-settings-row> <browser-mod-settings-table
<browser-mod-settings-table .hass=${this.hass}
.hass=${this.hass} .settingKey=${"faviconTemplate"}
.settingKey=${"titleTemplate"} ></browser-mod-settings-table>
></browser-mod-settings-table> </ha-expansion-panel>
<div class="separator"></div> <ha-expansion-panel
.header=${"Hide sidebar"}
.secondary=${"Completely remove the sidebar from all panels"}
leftChevron
>
<browser-mod-settings-table
.hass=${this.hass}
.settingKey=${"hideSidebar"}
.settingSelector=${{boolean:{},label:"Hide sidebar"}}
></browser-mod-settings-table>
</ha-expansion-panel>
<ha-settings-row> <ha-expansion-panel
<span slot="heading">Favicon template</span> .header=${"Hide header"}
<span slot="description"> .secondary=${"Completely remove the header from all panels"}
Jinja template for the browser favicon leftChevron
</span> >
</ha-settings-row> <browser-mod-settings-table
<browser-mod-settings-table .hass=${this.hass}
.hass=${this.hass} .settingKey=${"hideHeader"}
.settingKey=${"faviconTemplate"} .settingSelector=${{boolean:{},label:"Hide header"}}
></browser-mod-settings-table> ></browser-mod-settings-table>
</ha-expansion-panel>
<div class="separator"></div> <ha-expansion-panel
.header=${"Default dashboard"}
.secondary=${`The dashboard that is showed when navigating to ${location.origin}`}
leftChevron
>
<browser-mod-settings-table
.hass=${this.hass}
.settingKey=${"defaultPanel"}
.settingSelector=${t}
.default=${"lovelace"}
></browser-mod-settings-table>
</ha-expansion-panel>
<ha-settings-row> <ha-expansion-panel
<span slot="heading">Hide sidebar</span> .header=${"Sidebar order"}
<span slot="description"> .secondary=${"Order and visibility of sidebar items."}
Completely remove the sidebar from all panels leftChevron
</span> >
</ha-settings-row> <ha-settings-row>
<browser-mod-settings-table <ol slot="heading">
.hass=${this.hass} <li>Click EDIT</li>
.settingKey=${"hideSidebar"} <li>Set up the sidebar as you want it</li>
.settingSelector=${{boolean:{},label:"Hide sidebar"}} <li>Do NOT click DONE</li>
></browser-mod-settings-table> <li>Add a new setting or edit an old one</li>
<li>Click RESTORE</li>
</ol>
<mwc-button @click=${()=>this.toggleEditSidebar()}>
${this._editSidebar?"Restore":"Edit"}
</mwc-button>
</ha-settings-row>
<browser-mod-settings-table
.hass=${this.hass}
.settingKey=${"sidebarPanelOrder"}
.settingSelector=${{plaintext:"Press OK to store the current sidebar order"}}
.default=${"lovelace"}
></browser-mod-settings-table>
</ha-expansion-panel>
<div class="separator"></div> <ha-expansion-panel
.header=${"Sidebar title"}
<ha-settings-row> .secondary=${"The title at the top of the sidebar"}
<span slot="heading">Hide header</span> leftChevron
<span slot="description"> >
Completely remove the header from all panels <browser-mod-settings-table
</span> .hass=${this.hass}
</ha-settings-row> .settingKey=${"sidebarTitle"}
<browser-mod-settings-table .settingSelector=${{text:{}}}
.hass=${this.hass} ></browser-mod-settings-table>
.settingKey=${"hideHeader"} </ha-expansion-panel>
.settingSelector=${{boolean:{},label:"Hide header"}}
></browser-mod-settings-table>
<div class="separator"></div>
<ha-settings-row>
<span slot="heading">Default dashboard</span>
<span slot="description">
The dashboard that is showed when navigating to
${location.origin}/
</span>
</ha-settings-row>
<browser-mod-settings-table
.hass=${this.hass}
.settingKey=${"defaultPanel"}
.settingSelector=${t}
.default=${"lovelace"}
></browser-mod-settings-table>
<div class="separator"></div>
<ha-settings-row>
<span slot="heading">Sidebar order</span>
<span slot="description">
Order and visibility of sidebar items. <br />Click EDIT and set
the sidebar up as you want. Then save the settings and finally
click RESTORE.
</span>
<mwc-button @click=${()=>this.toggleEditSidebar()}>
${this._editSidebar?"Restore":"Edit"}
</mwc-button>
</ha-settings-row>
<browser-mod-settings-table
.hass=${this.hass}
.settingKey=${"sidebarPanelOrder"}
.settingSelector=${{plaintext:"Press OK to store the current sidebar order"}}
.default=${"lovelace"}
></browser-mod-settings-table>
<div class="separator"></div>
<ha-settings-row>
<span slot="heading">Sidebar title</span>
<span slot="description">
The title at the top of the sidebar
</span>
</ha-settings-row>
<browser-mod-settings-table
.hass=${this.hass}
.settingKey=${"sidebarTitle"}
.settingSelector=${{text:{}}}
></browser-mod-settings-table>
</div> </div>
</ha-card> </ha-card>
`}static get styles(){return n` `}static get styles(){return n`
@@ -356,7 +351,7 @@ function e(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPro
display: flex; display: flex;
align-items: center; align-items: center;
} }
`}}e([ee()],de.prototype,"hass",void 0),e([te()],de.prototype,"_dashboards",void 0),e([te()],de.prototype,"_editSidebar",void 0),customElements.define("browser-mod-frontend-settings-card",de),(async()=>{var e,t,i,s,o,n,r,a,l,d,h,c,u,p,w;await customElements.whenDefined("partial-panel-resolver");const g=document.createElement("partial-panel-resolver").getRoutes([{component_name:"config",url_path:"a"}]);await(null===(i=null===(t=null===(e=null==g?void 0:g.routes)||void 0===e?void 0:e.a)||void 0===t?void 0:t.load)||void 0===i?void 0:i.call(t)),await customElements.whenDefined("ha-panel-config");const v=document.createElement("ha-panel-config");await(null===(r=null===(n=null===(o=null===(s=null==v?void 0:v.routerOptions)||void 0===s?void 0:s.routes)||void 0===o?void 0:o.dashboard)||void 0===n?void 0:n.load)||void 0===r?void 0:r.call(n)),await(null===(h=null===(d=null===(l=null===(a=null==v?void 0:v.routerOptions)||void 0===a?void 0:a.routes)||void 0===l?void 0:l.cloud)||void 0===d?void 0:d.load)||void 0===h?void 0:h.call(d)),await(null===(w=null===(p=null===(u=null===(c=null==v?void 0:v.routerOptions)||void 0===c?void 0:c.routes)||void 0===u?void 0:u.entities)||void 0===p?void 0:p.load)||void 0===w?void 0:w.call(p)),await customElements.whenDefined("ha-config-dashboard")})().then((()=>{class t extends Z{firstUpdated(){window.addEventListener("browser-mod-config-update",(()=>this.requestUpdate()))}render(){return window.browser_mod?k` `}}e([ee()],de.prototype,"hass",void 0),e([te()],de.prototype,"_dashboards",void 0),e([te()],de.prototype,"_editSidebar",void 0),customElements.define("browser-mod-frontend-settings-card",de),(async()=>{var e,t,i,o,s,n,r,a,l,d,h,c,u,p,w;await customElements.whenDefined("partial-panel-resolver");const v=document.createElement("partial-panel-resolver").getRoutes([{component_name:"config",url_path:"a"}]);await(null===(i=null===(t=null===(e=null==v?void 0:v.routes)||void 0===e?void 0:e.a)||void 0===t?void 0:t.load)||void 0===i?void 0:i.call(t)),await customElements.whenDefined("ha-panel-config");const g=document.createElement("ha-panel-config");await(null===(r=null===(n=null===(s=null===(o=null==g?void 0:g.routerOptions)||void 0===o?void 0:o.routes)||void 0===s?void 0:s.dashboard)||void 0===n?void 0:n.load)||void 0===r?void 0:r.call(n)),await(null===(h=null===(d=null===(l=null===(a=null==g?void 0:g.routerOptions)||void 0===a?void 0:a.routes)||void 0===l?void 0:l.cloud)||void 0===d?void 0:d.load)||void 0===h?void 0:h.call(d)),await(null===(w=null===(p=null===(u=null===(c=null==g?void 0:g.routerOptions)||void 0===c?void 0:c.routes)||void 0===u?void 0:u.entities)||void 0===p?void 0:p.load)||void 0===w?void 0:w.call(p)),await customElements.whenDefined("ha-config-dashboard")})().then((()=>{class t extends Z{firstUpdated(){window.addEventListener("browser-mod-config-update",(()=>this.requestUpdate()))}render(){return window.browser_mod?U`
<ha-app-layout> <ha-app-layout>
<app-header slot="header" fixed> <app-header slot="header" fixed>
<app-toolbar> <app-toolbar>
@@ -365,6 +360,12 @@ function e(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPro
.narrow=${this.narrow} .narrow=${this.narrow}
></ha-menu-button> ></ha-menu-button>
<div main-title>Browser Mod Settings</div> <div main-title>Browser Mod Settings</div>
<a
href="https://github.com/thomasloven/hass-browser_mod/blob/master/README.md"
target="_blank"
>
<ha-icon class="icon" .icon=${"mdi:help"}></ha-icon>
</a>
</app-toolbar> </app-toolbar>
</app-header> </app-header>
@@ -382,7 +383,7 @@ function e(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPro
></browser-mod-frontend-settings-card> ></browser-mod-frontend-settings-card>
</ha-config-section> </ha-config-section>
</ha-app-layout> </ha-app-layout>
`:k``}static get styles(){var e,t;return[...null!==(t=null===(e=customElements.get("ha-config-dashboard"))||void 0===e?void 0:e.styles)&&void 0!==t?t:[],n` `:U``}static get styles(){var e,t;return[...null!==(t=null===(e=customElements.get("ha-config-dashboard"))||void 0===e?void 0:e.styles)&&void 0!==t?t:[],n`
:host { :host {
--app-header-background-color: var(--sidebar-background-color); --app-header-background-color: var(--sidebar-background-color);
--app-header-text-color: var(--sidebar-text-color); --app-header-text-color: var(--sidebar-text-color);
@@ -392,4 +393,8 @@ function e(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPro
ha-config-section { ha-config-section {
padding: 16px 0; padding: 16px 0;
} }
a {
color: var(--primary-text-color);
text-decoration: none;
}
`]}}e([ee()],t.prototype,"hass",void 0),e([ee()],t.prototype,"narrow",void 0),e([ee()],t.prototype,"connection",void 0),customElements.define("browser-mod-panel",t)})); `]}}e([ee()],t.prototype,"hass",void 0),e([ee()],t.prototype,"narrow",void 0),e([ee()],t.prototype,"connection",void 0),customElements.define("browser-mod-panel",t)}));
@@ -14,5 +14,4 @@ class BrowserModConfigFlow(config_entries.ConfigFlow):
async def async_step_user(self, user_input=None): async def async_step_user(self, user_input=None):
if self._async_current_entries(): if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed") return self.async_abort(reason="single_instance_allowed")
_LOGGER.error("Running async_create_entry")
return self.async_create_entry(title="Browser Mod", data={}) return self.async_create_entry(title="Browser Mod", data={})
+1 -1
View File
@@ -1,4 +1,4 @@
{ {
"name": "browser_mod", "name": "browser_mod",
"homeassistant": "2022.3.0" "homeassistant": "2022.8.0"
} }
+6 -3
View File
@@ -143,9 +143,12 @@ class BrowserModRegisteredBrowsersCard extends LitElement {
Mod. <br /><br /> Mod. <br /><br />
If you ever see a If you ever see a
<ha-icon icon="mdi:gesture-tap"></ha-icon> symbol at the bottom right <ha-icon
corner of the screen, please tap or click anywhere on the page. This icon="mdi:gesture-tap"
should allow Browser Mod to work again. style="color: var(--warning-color);"
></ha-icon>
symbol at the bottom right corner of the screen, please tap or click
anywhere on the page. This should allow Browser Mod to work again.
</ha-alert> </ha-alert>
`; `;
} }
+91 -99
View File
@@ -82,111 +82,103 @@ class BrowserModFrontendSettingsCard extends LitElement {
DEFAULT. DEFAULT.
</p> </p>
<div class="separator"></div> <ha-expansion-panel
.header=${"Title template"}
.secondary=${"Jinja template for the browser window/tab title"}
leftChevron
>
<browser-mod-settings-table
.hass=${this.hass}
.settingKey=${"titleTemplate"}
></browser-mod-settings-table>
</ha-expansion-panel>
<ha-settings-row> <ha-expansion-panel
<span slot="heading">Title template</span> .header=${"Favicon template"}
<span slot="description"> .secondary=${"Jinja template for the browser favicon"}
Jinja template for the browser window/tab title leftChevron
</span> >
</ha-settings-row> <browser-mod-settings-table
<browser-mod-settings-table .hass=${this.hass}
.hass=${this.hass} .settingKey=${"faviconTemplate"}
.settingKey=${"titleTemplate"} ></browser-mod-settings-table>
></browser-mod-settings-table> </ha-expansion-panel>
<div class="separator"></div> <ha-expansion-panel
.header=${"Hide sidebar"}
.secondary=${"Completely remove the sidebar from all panels"}
leftChevron
>
<browser-mod-settings-table
.hass=${this.hass}
.settingKey=${"hideSidebar"}
.settingSelector=${{ boolean: {}, label: "Hide sidebar" }}
></browser-mod-settings-table>
</ha-expansion-panel>
<ha-settings-row> <ha-expansion-panel
<span slot="heading">Favicon template</span> .header=${"Hide header"}
<span slot="description"> .secondary=${"Completely remove the header from all panels"}
Jinja template for the browser favicon leftChevron
</span> >
</ha-settings-row> <browser-mod-settings-table
<browser-mod-settings-table .hass=${this.hass}
.hass=${this.hass} .settingKey=${"hideHeader"}
.settingKey=${"faviconTemplate"} .settingSelector=${{ boolean: {}, label: "Hide header" }}
></browser-mod-settings-table> ></browser-mod-settings-table>
</ha-expansion-panel>
<div class="separator"></div> <ha-expansion-panel
.header=${"Default dashboard"}
.secondary=${`The dashboard that is showed when navigating to ${location.origin}`}
leftChevron
>
<browser-mod-settings-table
.hass=${this.hass}
.settingKey=${"defaultPanel"}
.settingSelector=${dashboardSelector}
.default=${"lovelace"}
></browser-mod-settings-table>
</ha-expansion-panel>
<ha-settings-row> <ha-expansion-panel
<span slot="heading">Hide sidebar</span> .header=${"Sidebar order"}
<span slot="description"> .secondary=${"Order and visibility of sidebar items."}
Completely remove the sidebar from all panels leftChevron
</span> >
</ha-settings-row> <ha-settings-row>
<browser-mod-settings-table <ol slot="heading">
.hass=${this.hass} <li>Click EDIT</li>
.settingKey=${"hideSidebar"} <li>Set up the sidebar as you want it</li>
.settingSelector=${{ boolean: {}, label: "Hide sidebar" }} <li>Do NOT click DONE</li>
></browser-mod-settings-table> <li>Add a new setting or edit an old one</li>
<li>Click RESTORE</li>
</ol>
<mwc-button @click=${() => this.toggleEditSidebar()}>
${this._editSidebar ? "Restore" : "Edit"}
</mwc-button>
</ha-settings-row>
<browser-mod-settings-table
.hass=${this.hass}
.settingKey=${"sidebarPanelOrder"}
.settingSelector=${{
plaintext: "Press OK to store the current sidebar order",
}}
.default=${"lovelace"}
></browser-mod-settings-table>
</ha-expansion-panel>
<div class="separator"></div> <ha-expansion-panel
.header=${"Sidebar title"}
<ha-settings-row> .secondary=${"The title at the top of the sidebar"}
<span slot="heading">Hide header</span> leftChevron
<span slot="description"> >
Completely remove the header from all panels <browser-mod-settings-table
</span> .hass=${this.hass}
</ha-settings-row> .settingKey=${"sidebarTitle"}
<browser-mod-settings-table .settingSelector=${{ text: {} }}
.hass=${this.hass} ></browser-mod-settings-table>
.settingKey=${"hideHeader"} </ha-expansion-panel>
.settingSelector=${{ boolean: {}, label: "Hide header" }}
></browser-mod-settings-table>
<div class="separator"></div>
<ha-settings-row>
<span slot="heading">Default dashboard</span>
<span slot="description">
The dashboard that is showed when navigating to
${location.origin}/
</span>
</ha-settings-row>
<browser-mod-settings-table
.hass=${this.hass}
.settingKey=${"defaultPanel"}
.settingSelector=${dashboardSelector}
.default=${"lovelace"}
></browser-mod-settings-table>
<div class="separator"></div>
<ha-settings-row>
<span slot="heading">Sidebar order</span>
<span slot="description">
Order and visibility of sidebar items. <br />Click EDIT and set
the sidebar up as you want. Then save the settings and finally
click RESTORE.
</span>
<mwc-button @click=${() => this.toggleEditSidebar()}>
${this._editSidebar ? "Restore" : "Edit"}
</mwc-button>
</ha-settings-row>
<browser-mod-settings-table
.hass=${this.hass}
.settingKey=${"sidebarPanelOrder"}
.settingSelector=${{
plaintext: "Press OK to store the current sidebar order",
}}
.default=${"lovelace"}
></browser-mod-settings-table>
<div class="separator"></div>
<ha-settings-row>
<span slot="heading">Sidebar title</span>
<span slot="description">
The title at the top of the sidebar
</span>
</ha-settings-row>
<browser-mod-settings-table
.hass=${this.hass}
.settingKey=${"sidebarTitle"}
.settingSelector=${{ text: {} }}
></browser-mod-settings-table>
</div> </div>
</ha-card> </ha-card>
`; `;
+10
View File
@@ -31,6 +31,12 @@ loadConfigDashboard().then(() => {
.narrow=${this.narrow} .narrow=${this.narrow}
></ha-menu-button> ></ha-menu-button>
<div main-title>Browser Mod Settings</div> <div main-title>Browser Mod Settings</div>
<a
href="https://github.com/thomasloven/hass-browser_mod/blob/master/README.md"
target="_blank"
>
<ha-icon class="icon" .icon=${"mdi:help"}></ha-icon>
</a>
</app-toolbar> </app-toolbar>
</app-header> </app-header>
@@ -64,6 +70,10 @@ loadConfigDashboard().then(() => {
ha-config-section { ha-config-section {
padding: 16px 0; padding: 16px 0;
} }
a {
color: var(--primary-text-color);
text-decoration: none;
}
`, `,
]; ];
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "browser_mod", "name": "browser_mod",
"version": "2.0.0b4", "version": "2.0.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {