brainsatplay-components
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -1,5 +0,132 @@ | ||
export * from './general.types'; | ||
import * as streams from './streams'; | ||
import * as brand from './brand'; | ||
export * from './general'; | ||
export { streams, brand, }; | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).components={})}(this,(function(t){"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2019 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/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 r{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 o=(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 r(s,i)},n=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new r("string"==typeof t?t:t+"",i))(e)})(t):t | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/;var l;const a=window.trustedTypes,d=a?a.emptyScript:"",h=window.reactiveElementPolyfillSupport,c={toAttribute(t,e){switch(e){case Boolean:t=t?d: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 r=this[t];this[e]=s,this.requestUpdate(t,r,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(n(t))}else void 0!==t&&e.push(n(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,r;const o=this.constructor._$Eh(t,i);if(void 0!==o&&!0===i.reflect){const n=(null!==(r=null===(s=i.converter)||void 0===s?void 0:s.toAttribute)&&void 0!==r?r:c.toAttribute)(e,i.type);this._$Ei=t,null==n?this.removeAttribute(o):this.setAttribute(o,n),this._$Ei=null}}_$AK(t,e){var i,s,r;const o=this.constructor,n=o._$Eu.get(t);if(void 0!==n&&this._$Ei!==n){const t=o.getPropertyOptions(n),l=t.converter,a=null!==(r=null!==(s=null===(i=l)||void 0===i?void 0:i.fromAttribute)&&void 0!==s?s:"function"==typeof l?l:null)&&void 0!==r?r:c.fromAttribute;this._$Ei=n,this[n]=a(e,t.type),this._$Ei=null}}requestUpdate(t,e,i){let s=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||u)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$Ei!==t&&(void 0===this._$E_&&(this._$E_=new Map),this._$E_.set(t,i))):s=!1),!this.isUpdatePending&&s&&(this._$Ep=this._$EC())}async _$EC(){this.isUpdatePending=!0;try{await this._$Ep}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach(((t,e)=>this[e]=t)),this._$Et=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$Eg)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ep}shouldUpdate(t){return!0}update(t){void 0!==this._$E_&&(this._$E_.forEach(((t,e)=>this._$ES(e,this[e],t))),this._$E_=void 0),this._$EU()}updated(t){}firstUpdated(t){}} | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
var f;v.finalized=!0,v.elementProperties=new Map,v.elementStyles=[],v.shadowRootOptions={mode:"open"},null==h||h({ReactiveElement:v}),(null!==(l=globalThis.reactiveElementVersions)&&void 0!==l?l:globalThis.reactiveElementVersions=[]).push("1.2.1");const g=globalThis.trustedTypes,y=g?g.createPolicy("lit-html",{createHTML:t=>t}):void 0,m=`lit$${(Math.random()+"").slice(9)}$`,$="?"+m,b=`<${$}>`,_=document,x=(t="")=>_.createComment(t),A=t=>null===t||"object"!=typeof t&&"function"!=typeof t,w=Array.isArray,E=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,S=/-->/g,k=/>/g,C=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,U=/'/g,P=/"/g,O=/^(?:script|style|textarea)$/i,j=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),z=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),N=new WeakMap,H=_.createTreeWalker(_,129,null,!1),M=(t,e)=>{const i=t.length-1,s=[];let r,o=2===e?"<svg>":"",n=E;for(let e=0;e<i;e++){const i=t[e];let l,a,d=-1,h=0;for(;h<i.length&&(n.lastIndex=h,a=n.exec(i),null!==a);)h=n.lastIndex,n===E?"!--"===a[1]?n=S:void 0!==a[1]?n=k:void 0!==a[2]?(O.test(a[2])&&(r=RegExp("</"+a[2],"g")),n=C):void 0!==a[3]&&(n=C):n===C?">"===a[0]?(n=null!=r?r:E,d=-1):void 0===a[1]?d=-2:(d=n.lastIndex-a[2].length,l=a[1],n=void 0===a[3]?C:'"'===a[3]?P:U):n===P||n===U?n=C:n===S||n===k?n=E:(n=C,r=void 0);const c=n===C&&t[e+1].startsWith("/>")?" ":"";o+=n===E?i+b:d>=0?(s.push(l),i.slice(0,d)+"$lit$"+i.slice(d)+m+c):i+m+(-2===d?(s.push(void 0),e):c)}const l=o+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==y?y.createHTML(l):l,s]};class R{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let r=0,o=0;const n=t.length-1,l=this.parts,[a,d]=M(t,e);if(this.el=R.createElement(a,i),H.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=H.nextNode())&&l.length<n;){if(1===s.nodeType){if(s.hasAttributes()){const t=[];for(const e of s.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(m)){const i=d[o++];if(t.push(e),void 0!==i){const t=s.getAttribute(i.toLowerCase()+"$lit$").split(m),e=/([.?@])?(.*)/.exec(i);l.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?V:"?"===e[1]?G:"@"===e[1]?W:D})}else l.push({type:6,index:r})}for(const e of t)s.removeAttribute(e)}if(O.test(s.tagName)){const t=s.textContent.split(m),e=t.length-1;if(e>0){s.textContent=g?g.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],x()),H.nextNode(),l.push({type:2,index:++r});s.append(t[e],x())}}}else if(8===s.nodeType)if(s.data===$)l.push({type:2,index:r});else{let t=-1;for(;-1!==(t=s.data.indexOf(m,t+1));)l.push({type:7,index:r}),t+=m.length-1}r++}}static createElement(t,e){const i=_.createElement("template");return i.innerHTML=t,i}}function B(t,e,i=t,s){var r,o,n,l;if(e===z)return e;let a=void 0!==s?null===(r=i._$Cl)||void 0===r?void 0:r[s]:i._$Cu;const d=A(e)?void 0:e._$litDirective$;return(null==a?void 0:a.constructor)!==d&&(null===(o=null==a?void 0:a._$AO)||void 0===o||o.call(a,!1),void 0===d?a=void 0:(a=new d(t),a._$AT(t,i,s)),void 0!==s?(null!==(n=(l=i)._$Cl)&&void 0!==n?n:l._$Cl=[])[s]=a:i._$Cu=a),void 0!==a&&(e=B(t,a._$AS(t,e.values),a,s)),e}class L{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:i},parts:s}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:_).importNode(i,!0);H.currentNode=r;let o=H.nextNode(),n=0,l=0,a=s[0];for(;void 0!==a;){if(n===a.index){let e;2===a.type?e=new I(o,o.nextSibling,this,t):1===a.type?e=new a.ctor(o,a.name,a.strings,this,t):6===a.type&&(e=new J(o,this,t)),this.v.push(e),a=s[++l]}n!==(null==a?void 0:a.index)&&(o=H.nextNode(),n++)}return r}m(t){let e=0;for(const i of this.v)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class I{constructor(t,e,i,s){var r;this.type=2,this._$AH=T,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cg=null===(r=null==s?void 0:s.isConnected)||void 0===r||r}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=B(this,t,e),A(t)?t===T||null==t||""===t?(this._$AH!==T&&this._$AR(),this._$AH=T):t!==this._$AH&&t!==z&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.S(t):(t=>{var e;return w(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])})(t)?this.A(t):this.$(t)}M(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.M(t))}$(t){this._$AH!==T&&A(this._$AH)?this._$AA.nextSibling.data=t:this.S(_.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:s}=t,r="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=R.createElement(s.h,this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.m(i);else{const t=new L(r,this),e=t.p(this.options);t.m(i),this.S(e),this._$AH=t}}_$AC(t){let e=N.get(t.strings);return void 0===e&&N.set(t.strings,e=new R(t)),e}A(t){w(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const r of t)s===e.length?e.push(i=new I(this.M(x()),this.M(x()),this,this.options)):i=e[s],i._$AI(r),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cg=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class D{constructor(t,e,i,s,r){this.type=1,this._$AH=T,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=T}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const r=this.strings;let o=!1;if(void 0===r)t=B(this,t,e,0),o=!A(t)||t!==this._$AH&&t!==z,o&&(this._$AH=t);else{const s=t;let n,l;for(t=r[0],n=0;n<r.length-1;n++)l=B(this,s[i+n],e,n),l===z&&(l=this._$AH[n]),o||(o=!A(l)||l!==this._$AH[n]),l===T?t=T:t!==T&&(t+=(null!=l?l:"")+r[n+1]),this._$AH[n]=l}o&&!s&&this.k(t)}k(t){t===T?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class V extends D{constructor(){super(...arguments),this.type=3}k(t){this.element[this.name]=t===T?void 0:t}}const Z=g?g.emptyScript:"";class G extends D{constructor(){super(...arguments),this.type=4}k(t){t&&t!==T?this.element.setAttribute(this.name,Z):this.element.removeAttribute(this.name)}}class W extends D{constructor(t,e,i,s,r){super(t,e,i,s,r),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=B(this,t,e,0))&&void 0!==i?i:T)===z)return;const s=this._$AH,r=t===T&&s!==T||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==T&&(s===T||r);r&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class J{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){B(this,t)}}const q=window.litHtmlPolyfillSupport; | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
var F,K;null==q||q(R,I),(null!==(f=globalThis.litHtmlVersions)&&void 0!==f?f:globalThis.litHtmlVersions=[]).push("2.1.2");class Q extends v{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=((t,e,i)=>{var s,r;const o=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:e;let n=o._$litPart$;if(void 0===n){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;o._$litPart$=n=new I(e.insertBefore(x(),t),t,void 0,null!=i?i:{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return z}}Q.finalized=!0,Q._$litElement$=!0,null===(F=globalThis.litElementHydrateSupport)||void 0===F||F.call(globalThis,{LitElement:Q});const X=globalThis.litElementPolyfillSupport;null==X||X({LitElement:Q}),(null!==(K=globalThis.litElementVersions)&&void 0!==K?K:globalThis.litElementVersions=[]).push("3.1.2");class Y extends Q{constructor(t={}){var e,i,s;super(),this.volume=null!==(e=t.volume)&&void 0!==e?e:0,this.backgroundColor=null!==(i=t.backgroundColor)&&void 0!==i?i:"#69ce2b",this.count=null!==(s=t.count)&&void 0!==s?s:10}static get styles(){return o`#wrapper{width:100%}`}static get properties(){return{volume:{type:Number},count:{type:Number},backgroundColor:{type:String,reflect:!0}}}willUpdate(t){t.has("volume")&&(!this.volume||this.volume<0?this.volume=0:this.volume>1&&(this.volume=1))}render(){var t;const e=Math.round(this.count*(null!==(t=this.volume)&&void 0!==t?t:0));return j`<style>.target{width:calc(${100/this.count}% - 10px);height:10px;display:inline-block;margin:5px;background-color:#e6e7e8}.active{background-color:${this.backgroundColor}}</style><div id="wrapper">${Array.from({length:this.count},((t,i)=>j`<div class="${i<e?"target active":"target"}"></div>`))}</div>`}}customElements.define("brainsatplay-audio-volume",Y);var tt=Object.freeze({__proto__:null,Volume:Y});class et extends Q{constructor(t={}){super(),this.source=t.source,this.autoplay=t.autoplay,this.controls=t.controls}static get styles(){return o`video{width:100%}`}static get properties(){return{source:{converter:{toAttribute:t=>t,fromAttribute:t=>t}},autoplay:{type:Boolean},controls:{type:Boolean}}}willUpdate(t){}render(){let t=document.createElement("video");if("object"==typeof this.source)t.srcObject=this.source;else if(this.source){const e=document.createElement("source");e.src=this.source,t.insertAdjacentElement("beforeend",e)}return this.autoplay&&(t.autoplay=this.autoplay),this.controls&&(t.controls=this.controls),t}}customElements.define("brainsatplay-video-player",et);var it=Object.freeze({__proto__:null,Player:et});class st extends Q{constructor(t={}){var e,i,s;super(),this.volume=null!==(e=t.volume)&&void 0!==e?e:0,this.backgroundColor=null!==(i=t.backgroundColor)&&void 0!==i?i:"#69ce2b",this.count=null!==(s=t.count)&&void 0!==s?s:10}static get styles(){return o`#wrapper{width:100%}`}static get properties(){return{volume:{type:Number},count:{type:Number},backgroundColor:{type:String,reflect:!0}}}willUpdate(t){t.has("volume")&&(!this.volume||this.volume<0?this.volume=0:this.volume>1&&(this.volume=1))}render(){var t;const e=Math.round(this.count*(null!==(t=this.volume)&&void 0!==t?t:0));return j`<style>.target{width:calc(${100/this.count}% - 10px);height:10px;display:inline-block;margin:5px;background-color:#e6e7e8}.active{background-color:${this.backgroundColor}}</style><div id="wrapper">${Array.from({length:this.count},((t,i)=>j`<div class="${i<e?"target active":"target"}"></div>`))}</div>`}}customElements.define("brainsatplay-data-timeseries",st);var rt=Object.freeze({__proto__:null,TimeSeries:st}),ot=Object.freeze({__proto__:null,audio:tt,video:it,data:rt});class nt extends Q{constructor(t={}){var e,i;super(),this.verb=null!==(e=t.verb)&&void 0!==e?e:"contribute",this.color=null!==(i=t.color)&&void 0!==i?i:"blue"}static get styles(){return o`img{width:100%}`}static get properties(){return{verb:{type:String},color:{type:String,reflect:!0}}}willUpdate(t){}render(){return j`<a href="https://opencollective.com/brainsatplay/donate" target="_blank"><img src="https://opencollective.com/brainsatplay/${this.verb}/button@2x.png?color=${this.color}"></a>`}}customElements.define("brainsatplay-contribute",nt);var lt=Object.freeze({__proto__:null,Contribute:nt});class at extends Q{constructor(t={brand:{content:"My Brand"},primary:{menu:[],options:[]},secondary:[]}){var e,i,s,r;super(),this.getElement=t=>"button"===t.type?j`<a href="${t.link}" target="${t.external?"_blank":"_self"}"><button>${t.content}</button></a>`:j`<a href="${t.link}" target="${t.external?"_blank":"_self"}" class="decorate">${t.content}</a>`,this.primary=null!==(e=t.primary)&&void 0!==e?e:{menu:[],options:[]},this.secondary=null!==(i=t.secondary)&&void 0!==i?i:[],this.color=null!==(s=t.color)&&void 0!==s?s:"blue",this.brand=null!==(r=t.brand)&&void 0!==r?r:"My Brand"}static get styles(){return o`:host{font-family:sans-serif}header{width:100%;position:absolute;top:0;left:0}:host *{box-sizing:border-box}nav{color:#fff;width:100%;padding:0 25px;display:flex;align-items:center;background:#060606}#primary{position:sticky;top:0;left:0;height:70px;max-height:100px;justify-content:space-between;font-size:80%}#primary>div{height:100%;width:100%;display:flex;align-items:center;justify-content:space-between;flex-direction:row-reverse}#menu,#options{height:100%;display:flex;align-items:center;justify-content:center}#secondary{height:50px;justify-content:flex-end;border-bottom:1px solid #3d3d3d;font-size:75%}a{color:#fff;text-decoration:none}.brand{padding-right:15px}a:not(.brand){height:100%;display:flex;align-items:center;justify-content:center;text-align:center}.decorate{padding:10px 15px}#primary .decorate:hover{box-shadow:0 4px 0 #0fb3ff inset}#secondary .decorate:hover{box-shadow:0 3px 0 #c4c4c4 inset}button{border:1px solid #fff;color:#fff;border-radius:3px;background:0 0;padding:5px 10px;margin-left:10px;font-size:95%}nav button:last-child{margin-right:0}button:hover{outline:1.1px solid #fff;cursor:pointer}@media only screen and (max-width:800px){#primary #menu{display:none}}`}static get properties(){return{primary:{type:Object,reflect:!0},secondary:{type:Array,reflect:!0},brand:{type:Object},color:{type:String,reflect:!0}}}willUpdate(t){}render(){var t,e,i;return j`<header>${this.secondary.length>0?j`<nav id="secondary">${null===(t=this.secondary)||void 0===t?void 0:t.map((t=>this.getElement(t)))}</nav>`:""}<nav id="primary">${j`<a class="brand" target="${this.brand.external?"_blank":"_self"}" href="${this.brand.link}">${/(jpg|gif|png|JPG|GIF|PNG|JPEG|jpeg)$/.test(this.brand.content)?j`<img src="${this.brand.content}">`:j`<h1>${this.brand.content.toUpperCase()}</h1>`}</a>`}<div><div id="options">${null===(e=this.primary.options)||void 0===e?void 0:e.map((t=>this.getElement(t)))}</div><div id="menu">${null===(i=this.primary.menu)||void 0===i?void 0:i.map((t=>this.getElement(t)))}</div></div></nav></header>`}}customElements.define("brainsatplay-nav",at);class dt extends Q{constructor(t={}){var e,i,s,r;super(),this.progress=t.progress,this.color=t.color,this.background=null!==(e=t.background)&&void 0!==e?e:"#f3f3f3",this.type=null!==(i=t.type)&&void 0!==i?i:"default",this.showPercent=null===(s=t.showPercent)||void 0===s||s,this.text=t.text,this.textBackground=t.textBackground,this.textColor=t.textColor,this.size=null!==(r=t.size)&&void 0!==r?r:"13px",this.color||("default"===this.type?this.color="blue":this.color="#7aff80")}static get styles(){return o` | ||
:host { | ||
font-family: sans-serif; | ||
} | ||
#container { | ||
width: 100%; | ||
} | ||
#indicator { | ||
width: 100%; | ||
overflow: hidden; | ||
animate: 0.5s; | ||
opacity: 0.7; | ||
} | ||
#indicator > div { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
#linear-text { | ||
padding: 10px 15px; | ||
border-top-left-radius: 5px; | ||
border-top-right-radius: 5px; | ||
font-size: 75%; | ||
background: white; | ||
} | ||
.loader-container { | ||
width: 80px; | ||
height: 80px; | ||
position: relative; | ||
color: #5b5b5b; | ||
} | ||
.loader { | ||
width: 100%; | ||
height: 100%; | ||
border: 4px solid; | ||
background: white; | ||
border-right: none; | ||
border-top: none; | ||
border-left: none; | ||
z-index: 2000; | ||
background-color: transparent; | ||
border-radius: 100%; | ||
transform: rotateZ(0); | ||
} | ||
.loader-container > span{ | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
font-size: 80%; | ||
transform: translate(-50%, -50%); | ||
user-select: none; | ||
} | ||
.loader.active { | ||
opacity: 0.45; | ||
-webkit-animation: spin 2s linear infinite; | ||
animation: spin 2s linear infinite; | ||
} | ||
/* @-moz-keyframes spin { . . . } */ | ||
/* @-ms-keyframes spin { . . . } */ | ||
/* @-o-keyframes spin { . . . } */ | ||
@-webkit-keyframes spin { | ||
from { | ||
transform: rotateZ(0deg) scale(1); | ||
} | ||
50% { | ||
transform: rotateZ(540deg) scale(0.9); | ||
filter: brightness(50%); | ||
} | ||
to { | ||
transform: rotateZ(1080deg) scale(1); | ||
} | ||
} | ||
@keyframes spin { | ||
from { | ||
transform: rotateZ(0deg) scale(1); | ||
} | ||
50% { | ||
transform: rotateZ(540deg) scale(0.9); | ||
filter: brightness(50%); | ||
} | ||
to { | ||
transform: rotateZ(1080deg) scale(1); | ||
} | ||
} | ||
`}static get properties(){return{progress:{type:Number,reflect:!0},text:{type:String,reflect:!0},type:{type:String,reflect:!0},color:{type:String,reflect:!0},background:{type:String,reflect:!0},textBackground:{type:String,reflect:!0},textColor:{type:String,reflect:!0},size:{type:String,reflect:!0}}}willUpdate(t){}render(){var t;const e=null!==(t=this.progress)&&void 0!==t?t:0,i=null!=this.text?this.text:this.showPercent?`${(100*e).toFixed(1)}%`:"";return"linear"===this.type?j` | ||
${i?j`<div id="linear-text" style="background: ${this.textBackground}; color: ${this.textColor};">${i}</div>`:""} | ||
<div id="indicator" style="height:${this.size}; background:${this.background}; opacity:${1===e?1:""};"> | ||
<div style="width:${100*e}%; background: ${this.color}"></div> | ||
</div> | ||
`:j` | ||
<div class="loader-container" style="height:${this.size}; width:${this.size}; background: ${this.textBackground};"> | ||
${i?j`<span style="color: ${this.textColor};">${i}</span>`:""} | ||
<div class="loader active" style="border-color: ${this.color};"></div> | ||
</div> | ||
`}}customElements.define("brainsatplay-loader",dt);class ht extends Q{constructor(t={files:[]}){var e;super(),this.getElement=t=>"button"===t.type?j`<a class="file" onclick="${t.onclick}"><button>${t.name}</button></a>`:j`<a class="file" onclick="${t.onclick}">${t.name}</a>`,this.files=null!==(e=t.files)&&void 0!==e?e:[]}static get styles(){return o`:host{font-family:sans-serif}:host *{box-sizing:border-box}.container{background:#fff;border:1px solid gray}.header{padding:10px;border-bottom:1px solid gray}.files{width:100%;padding:10px}.file{width:100%;font-size:90%;padding:10px 15px;background:#dcdcdc}`}static get properties(){return{files:{type:Array,reflect:!0}}}willUpdate(t){}render(){var t;return j`<div class="container"><div class="header">Container</div><div class="files">${null===(t=this.files)||void 0===t?void 0:t.map((t=>this.getElement(t)))}</div></div>`}}customElements.define("brainsatplay-filesystem",ht);var ct=Object.freeze({__proto__:null,FileSystem:ht});class ut extends Q{constructor(t={target:{},header:"Object"}){var e,i,s;super(),this.history=[],this.getActions=(t,e)=>{let i;return"object"==typeof e[t]&&(i=j`<button @click="${()=>{this.history.push({parent:e,key:this.header}),this.target=e[t],this.header=t,this.mode=Array.isArray(e[t])?"plot":"view"}}">${Array.isArray(e[t])?j`Plot`:j`View`}</button>`),j`<div class="actions">${i}</div>`},this.getElement=(t,e)=>j`<div class="attribute separate"><div><span class="name">${t}</span><br><span class="value">${"object"==typeof e[t]?Object.keys(e[t]).length?e[t].constructor.name:j`Empty ${e[t].constructor.name}`:e[t]}</span></div>${this.getActions(t,e)}</div>`,this.target=null!==(e=t.target)&&void 0!==e?e:{},this.header=null!==(i=t.header)&&void 0!==i?i:"Object",this.mode=null!==(s=t.mode)&&void 0!==s?s:"view"}static get styles(){return o`:host{font-family:sans-serif}:host *{box-sizing:border-box}.main{background:#fff;border:1px solid gray}button{padding:10px;min-width:25px}.header{padding:20px;border-top-left-radius:10px;border-top-right-radius:10px;color:#fff;background:#000;font-size:80%}.header span{font-weight:800;font-size:120%}.container{background:#fff;border:1px solid gray;width:100%;padding:10px;display:flex;align-items:center;justify-content:center;flex-wrap:wrap}.separate{display:flex;align-items:center;justify-content:space-between}.attribute{width:100%;font-size:90%;padding:15px;background:#dcdcdc;flex-grow:1;margin:10px;border-radius:10px}.name{font-weight:800;padding-right:10px}.value{font-size:80%}`}static get properties(){return{target:{type:Object,reflect:!0},header:{type:String,reflect:!0},mode:{type:String,reflect:!0}}}willUpdate(t){t.has("target")}render(){var t,e;return j`<div><div class="header separate"><span>${this.header}</span> ${this.history.length>0?j`<button @click="${()=>{const t=this.history.pop();this.header=t.key,this.target=t.parent}}">Go Back</button>`:"No History"}</div><div class="container">${"view"===this.mode?null===(t=Object.keys(this.target))||void 0===t?void 0:t.map((t=>this.getElement(t,this.target))):null===(e=Object.keys(this.target))||void 0===e?void 0:e.map((t=>this.getElement(t,this.target)))}</div></div>`}}customElements.define("brainsatplay-object-editor",ut);var pt=Object.freeze({__proto__:null,ObjectEditor:ut});t.Loader=dt,t.Nav=at,t.brand=lt,t.editor=pt,t.files=ct,t.streams=ot,Object.defineProperty(t,"__esModule",{value:!0})})); |
{ | ||
"name": "brainsatplay-components", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"author": "Garrett Flynn <garrettmflynn@gmail.com>", | ||
"license": "AGPL-3.0-or-later", | ||
"main": "dist/index.js", | ||
"module": "dist/module.js", | ||
"browser": "dist/browser.js", | ||
"types": "dist/index.d.ts", | ||
"module": "dist/index.esm.js", | ||
"types": "dist/src/index.d.ts", | ||
"scripts": { | ||
@@ -11,0 +10,0 @@ "start": "concurrently \"yarn:storybook\" \"yarn:tailwind\" -k --kill-others-on-fail -p \"{name}|\" -n \"SB,TW\" -c \"magenta,cyan\"", |
export * from './Nav' | ||
export * from './Loader' |
@@ -5,6 +5,10 @@ export * from './general.types'; | ||
export * from './general'; | ||
import * as files from './files'; | ||
import * as editor from './editor'; | ||
export { | ||
files, | ||
streams, | ||
brand, | ||
editor | ||
} |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
5285286
88
125790
1