4 files
This commit is contained in:
1 parent
8b759845d6
commit
55dd6a3754
4 files changed
+181
-17
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import nodeResolve from "@rollup/plugin-node-resolve";
|
||||
import json from "@rollup/plugin-json";
|
||||
import typescript from "rollup-plugin-typescript2";
|
||||
import { terser } from "rollup-plugin-terser";
|
||||
import babel from "@rollup/plugin-babel";
|
||||
|
||||
const dev = process.env.ROLLUP_WATCH;
|
||||
|
||||
export default {
|
||||
input: "src/main.ts",
|
||||
output: {
|
||||
file: "state-switch.js",
|
||||
format: "es",
|
||||
},
|
||||
plugins: [
|
||||
nodeResolve(),
|
||||
json(),
|
||||
typescript(),
|
||||
babel({
|
||||
exclude: "node_modules/**",
|
||||
}),
|
||||
!dev && terser({ format: { comments: false } }),
|
||||
],
|
||||
};
|
||||
@@ -0,0 +1,139 @@
|
||||
function t(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r}const e=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),s=new Map;class o{constructor(t,e){if(this._$cssResult$=!0,e!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let t=s.get(this.cssText);return e&&void 0===t&&(s.set(this.cssText,t=new CSSStyleSheet),t.replaceSync(this.cssText)),t}toString(){return this.cssText}}const n=(t,...e)=>{const s=1===t.length?t[0]:e.reduce(((e,i,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1]),t[0]);return new o(s,i)},r=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new o("string"==typeof t?t:t+"",i))(e)})(t):t;var a;const l=window.trustedTypes,h=l?l.emptyScript:"",d=window.reactiveElementPolyfillSupport,c={toAttribute(t,e){switch(e){case Boolean:t=t?h:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},u=(t,e)=>e!==t&&(e==e||t==t),p={attribute:!0,type:String,converter:c,reflect:!1,hasChanged:u};class v extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var e;null!==(e=this.l)&&void 0!==e||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const s=this._$Eh(i,e);void 0!==s&&(this._$Eu.set(s,i),t.push(s))})),t}static createProperty(t,e=p){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,s=this.getPropertyDescriptor(t,i,e);void 0!==s&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const o=this[t];this[e]=s,this.requestUpdate(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||p}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(r(t))}else void 0!==t&&e.push(r(t));return e}static _$Eh(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}o(){var t;this._$Ep=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(t=this.constructor.l)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$Eg)&&void 0!==e?e:this._$Eg=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$Eg)||void 0===e||e.splice(this._$Eg.indexOf(t)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Et.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const i=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,i)=>{e?t.adoptedStyleSheets=i.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):i.forEach((e=>{const i=document.createElement("style"),s=window.litNonce;void 0!==s&&i.setAttribute("nonce",s),i.textContent=e.cssText,t.appendChild(i)}))})(i,this.constructor.elementStyles),i}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ES(t,e,i=p){var s,o;const n=this.constructor._$Eh(t,i);if(void 0!==n&&!0===i.rLine truncated
|
||||
<div
|
||||
id="root"
|
||||
class="${this._config.transition}"
|
||||
style="
|
||||
transition-duration: ${this._config.transition_time||500}ms;
|
||||
transition-delay: ${this._config.transition_time||500}ms;
|
||||
"
|
||||
>
|
||||
${Object.keys(this.cards).map((t=>M` <div>${this.cards[t]}</div> `))}
|
||||
</div>
|
||||
`}async getCardSize(){var t;let e=1;for(const i in this.cards)(null===(t=this.cards[i])||void 0===t?void 0:t.getCardSize)&&(e=Math.max(e,await this.cards[i].getCardSize()));return e}static get styles(){return n`
|
||||
:host {
|
||||
perspective: 1000px;
|
||||
}
|
||||
:host(.no-match) {
|
||||
display: none;
|
||||
}
|
||||
#root {
|
||||
margin: -4px;
|
||||
padding: 4px;
|
||||
display: grid;
|
||||
grid-template-rows: auto 0px;
|
||||
overflow: clip visible;
|
||||
}
|
||||
#root.transition {
|
||||
overflow: hidden;
|
||||
}
|
||||
#root * {
|
||||
grid-column: 1;
|
||||
grid-row: 2;
|
||||
overflow: hidden;
|
||||
min-width: 0;
|
||||
}
|
||||
#root *.visible,
|
||||
#root *.out {
|
||||
grid-row: 1;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
#root.slide-down *,
|
||||
#root.slide-up *,
|
||||
#root.slide-left *,
|
||||
#root.slide-right * {
|
||||
transition-property: transform;
|
||||
transition-timing-function: linear;
|
||||
transition-duration: inherit;
|
||||
transform: translate(0, -110%);
|
||||
}
|
||||
#root.slide-up * {
|
||||
transform: translate(0, 110%);
|
||||
}
|
||||
#root.slide-left * {
|
||||
transform: translate(110%, 0);
|
||||
}
|
||||
#root.slide-right * {
|
||||
transform: translate(-110%, 0);
|
||||
}
|
||||
#root.slide-down .visible,
|
||||
#root.slide-up .visible,
|
||||
#root.slide-left .visible,
|
||||
#root.slide-right .visible {
|
||||
transform: translate(0%);
|
||||
}
|
||||
#root.slide-down .out {
|
||||
transform: translate(0, 110%);
|
||||
}
|
||||
#root.slide-up .out {
|
||||
transform: translate(0, -110%);
|
||||
}
|
||||
#root.slide-left .out {
|
||||
transform: translate(-110%);
|
||||
}
|
||||
#root.slide-right .out {
|
||||
transform: translate(110%);
|
||||
}
|
||||
|
||||
#root.swap-down *,
|
||||
#root.swap-up *,
|
||||
#root.swap-left *,
|
||||
#root.swap-right * {
|
||||
transition-property: transform;
|
||||
transition-timing-function: linear;
|
||||
transition-duration: inherit;
|
||||
transform: translate(0, 110%);
|
||||
}
|
||||
#root.swap-up * {
|
||||
transform: translate(0, -110%);
|
||||
}
|
||||
#root.swap-left * {
|
||||
transform: translate(-110%, 0);
|
||||
}
|
||||
#root.swap-right * {
|
||||
transform: translate(110%, 0);
|
||||
}
|
||||
#root.swap-down .visible,
|
||||
#root.swap-up .visible,
|
||||
#root.swap-left .visible,
|
||||
#root.swap-right .visible {
|
||||
transition-delay: inherit;
|
||||
transform: translate(0%);
|
||||
}
|
||||
|
||||
#root.flip,
|
||||
#root.flip-x,
|
||||
#root.flip-y {
|
||||
position: relative;
|
||||
perspective: 1000px;
|
||||
}
|
||||
#root.flip *,
|
||||
#root.flip-x *,
|
||||
#root.flip-y * {
|
||||
transform: rotate3d(0, 1, 0, -180deg);
|
||||
transition-property: transform;
|
||||
transition-timing-function: linear;
|
||||
transition-duration: inherit;
|
||||
transform-style: preserve-3d;
|
||||
backface-visibility: hidden;
|
||||
z-index: 100;
|
||||
}
|
||||
#root.flip-y * {
|
||||
transform: rotate3d(1, 0, 0, -180deg);
|
||||
}
|
||||
#root.flip .visible,
|
||||
#root.flip-x .visible,
|
||||
#root.flip-y .visible {
|
||||
backface-visibility: hidden;
|
||||
transform: rotate3d(0, 0, 0, 0deg);
|
||||
}
|
||||
#root.flip .out,
|
||||
#root.flip-x .out,
|
||||
#root.flip-y .out {
|
||||
pointer-events: none;
|
||||
transform: rotate3d(0, 1, 0, 180deg);
|
||||
}
|
||||
#root.flip-y .out {
|
||||
transform: rotate3d(1, 0, 0, 180deg);
|
||||
}
|
||||
`}}t([tt()],ht.prototype,"_config",void 0),t([tt()],ht.prototype,"_hass",void 0),t([tt()],ht.prototype,"state",void 0),t([tt()],ht.prototype,"_tmpl",void 0),customElements.get("state-switch")||(customElements.define("state-switch",ht),console.info(`%cSTATE-SWITCH ${lt} IS INSTALLED`,"color: green; font-weight: bold",""));
|
||||
Reference in new issue
Block a user