UNPKG

@system76/pop-vue

Version:

Vue components designed to look like Pop!_OS

2 lines (1 loc) 10.3 kB
"use strict";function e(e,t,o,i,n,s,r,a,l,d){"boolean"!=typeof r&&(l=a,a=r,r=!1);const p="function"==typeof o?o.options:o;let c;if(e&&e.render&&(p.render=e.render,p.staticRenderFns=e.staticRenderFns,p._compiled=!0,n&&(p.functional=!0)),i&&(p._scopeId=i),s?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,l(e)),e&&e._registeredComponents&&e._registeredComponents.add(s)},p._ssrRegister=c):t&&(c=r?function(e){t.call(this,d(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,a(e))}),c)if(p.functional){const e=p.render;p.render=function(t,o){return c.call(o),e(t,o)}}else{const e=p.beforeCreate;p.beforeCreate=e?[].concat(e,c):[c]}return o}function t(e){return e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),e?("styles"in e||(e._styles=e._styles||{},Object.defineProperty(e,"styles",{enumerable:!0,get:()=>e._renderStyles(e._styles)}),e._renderStyles=e._renderStyles||o),(t,o)=>function(e,t,o){const i="production"===process.env.NODE_ENV?t.media||"default":e,n=o._styles[i]||(o._styles[i]={ids:[],css:""});if(!n.ids.includes(e)){n.media=t.media,n.ids.push(e);let o=t.source;"production"!==process.env.NODE_ENV&&t.map&&(o+="\n/*# sourceURL="+t.map.sources[0]+" */",o+="\n/*# sourceMappingURL=data:application/json;base64,"+Buffer.from(unescape(encodeURIComponent(JSON.stringify(t.map)))).toString("base64")+" */"),n.css+=o+"\n"}}(t,o,e)):()=>{}}function o(e){let t="";for(const o in e){const i=e[o];t+='<style data-vue-ssr-id="'+Array.from(i.ids).join(" ")+'"'+(i.media?' media="'+i.media+'"':"")+">"+i.css+"</style>"}return t}Object.defineProperty(exports,"__esModule",{value:!0});const i=e({},(function(e){e&&(e("data-v-014b0b0a_0",{source:".pop-directory-1T0e{color:#48b9c7;font-weight:600}.pop-host-2KDL{color:#73c48f;font-weight:600}.pop-cursor-1J_r{animation:pop-blink-1t0C linear 1.4s infinite;background-color:#fff;display:inline-block;height:1em;vertical-align:middle;width:1ch}.pop-line-3xP0{word-wrap:break-word}@keyframes pop-blink-1t0C{0%{opacity:0}49%{opacity:0}50%{opacity:1}100%{opacity:1}}",map:void 0,media:void 0}),Object.defineProperty(this,"$style",{value:{directory:"pop-directory-1T0e",host:"pop-host-2KDL",cursor:"pop-cursor-1J_r",blink:"pop-blink-1t0C",line:"pop-line-3xP0"}}))}),{name:"PopTerminalLine",props:{animate:{type:Boolean,default:!1},cursor:{type:Boolean,default:!1},directory:{type:String,default:"~"},hostname:{type:String,default:"pop-os"},prompt:{type:Boolean,default:!1},text:{type:String,default:""},speed:{type:Number,default:0},user:{type:String,default:"pop-os"}},data(){return{currentText:this.animate&&0!==this.speed?"":this.text,finished:0===this.speed,renderTimeout:null}},mounted(){this.animate&&0!==this.speed?this.draw():this.$emit("complete")},beforeDestroy(){clearTimeout(this.renderTimeout)},methods:{draw(){if(!this.finished){const e=this.text.charAt(this.currentText.length);""!==e?this.currentText+=e:this.finished=!0}this.finished?this.$emit("complete"):this.renderTimeout=setTimeout(this.draw.bind(this),this.timeoutDelay())},timeoutDelay(){return Math.round(Math.random()*this.speed/2)+this.speed}},render(e){const t=[this.currentText];return this.prompt&&(t.unshift("$ "),t.unshift(e("span",{class:this.$style.directory},`${this.directory}`)),t.unshift(":"),t.unshift(e("span",{class:this.$style.host},`${this.user}@${this.hostname}`))),this.cursor&&t.push(e("span",{class:this.$style.cursor},"")),e("div",{class:this.$style.line},t)}},void 0,void 0,"data-v-014b0b0a",!1,void 0,t,void 0);function n(e){const t=function(e){const t={first:"$",delay:"",speed:"",text:"",last:"$"};if("$"===e.trim())return t;{const o=e.match(/^((\$|#)(\d*)\|?(\d*)(\$|#)?)?(.*?)(\$?)$/);if(null!=o){const[,,e,i,n,,s,r]=o;return Object.assign({},t,{first:e,delay:i,speed:n,text:s,last:r})}return t}}(e),o="$"!==e&&"$"===t.first,i="$"===t.last,n=function(e,t,o){return e.substring(t&&" "===e.charAt(0)?1:0).slice(0,o?-1:e.length)}(t.text,t.first,t.last);return{prompt:o,cursor:i,text:n,delay:Number(t.delay||0),speed:"$"===t.first&&""!==n?Number(t.speed||60):0}}function s(e,t){return{animate:e.animate,cursor:t.cursor,directory:e.directory,hostname:e.hostname,prompt:t.prompt,text:t.text,speed:t.speed,user:e.user}}const r=e({},(function(e){e&&(e("data-v-2d1a30be_0",{source:".pop-container-3Cfz{max-height:calc(100% - .6em);overflow-y:auto;padding:.3em}",map:void 0,media:void 0}),Object.defineProperty(this,"$style",{value:{container:"pop-container-3Cfz"}}))}),{name:"PopTerminalContent",props:{animate:{type:Boolean,default:!1},directory:{type:String,default:"~"},hostname:{type:String,default:"pop-os"},loop:{type:Boolean,default:!1},user:{type:String,default:"pop-os"}},data(){return{currentLine:0,finished:!this.animate}},computed:{firstLineDelay(){return null!=this.lineObjects[0]?this.lineObjects[0].delay:0},nextLineDelay(){return null!=this.lineObjects[this.currentLine]?this.lineObjects[this.currentLine].delay:0},hasAnimatedLines(){return this.lineObjects.some(e=>0!==e.delay||0!==e.speed)},lineObjects(){return this.linesOfText.map(n)},linesOfText(){if(null!=this.$slots.default[0]){const e=this.$slots.default[0].text.split("\n").filter(e=>/\S/.test(e)),t=(e[0].match(/^\s*/)[0]||"").length;return e.map(e=>e.substring(t))}return 0}},mounted(){this.animate?this.reset():this.currentLine=this.linesOfText.length},updated(){this.$el.scroll({top:this.$el.scrollHeight,behavior:"instant"})},methods:{draw(){this.currentLine<this.linesOfText.length&&!this.finished?this.renderTimeout=setTimeout(()=>{this.currentLine+=1},this.nextLineDelay):this.loop?this.renderTimeout=setTimeout(()=>{this.reset()},this.firstLineDelay):this.$emit("complete")},reset(){this.currentLine=0,this.finished=!1,this.draw()}},render(e){const t=this.lineObjects.slice(0,this.currentLine).map(t=>e(i,{on:{complete:this.draw},props:s(this,t)}));return e("div",{class:this.$style.container},t)}},void 0,void 0,"data-v-2d1a30be",!1,void 0,t,void 0);const a=e({render:function(){var e=this.$createElement;return(this._self._c||e)("div",{class:[this.$style.root]},[this._t("default")],2)},staticRenderFns:[]},(function(e){e&&(e("data-v-35655f7b_0",{source:".pop-root-2t8X{align-content:stretch;align-items:stretch;box-shadow:var(--pop-shadow-window);display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:flex-start}",map:void 0,media:void 0}),Object.defineProperty(this,"$style",{value:{root:"pop-root-2t8X"}}))}),{name:"PopWindowContainer",inheritAttrs:!1},void 0,!1,"data-v-35655f7b",!1,void 0,t,void 0);const l=e({render:function(){var e=this,t=e.$createElement;return(e._self._c||t)("div",{class:[e.$style.header]},[e._ssrNode("<span>"+e._ssrEscape(e._s(e.title))+"</span>"+(e.closeButton?"<div"+e._ssrClass(null,[e.$style.close])+'><svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M5 4.003a1 1 0 0 0-1 1 1 1 0 0 0 .293.707l2.293 2.293-2.293 2.293a1 1 0 0 0-.293.707 1 1 0 0 0 1 1 1 1 0 0 0 .707-.293L8 9.417l2.283 2.283a1 1 0 0 0 .717.303 1 1 0 0 0 1-1 1 1 0 0 0-.293-.707L9.414 8.003l2.283-2.283A1 1 0 0 0 12 5.003a1 1 0 0 0-1-1 1 1 0 0 0-.707.293L8 6.589 5.717 4.306a1 1 0 0 0-.01-.01A1 1 0 0 0 5 4.003z"></path></svg></div>':"\x3c!----\x3e"))])},staticRenderFns:[]},(function(e){e&&(e("data-v-4013a4f5_0",{source:'.pop-header-10KQ{align-content:center;align-items:center;background-color:var(--pop-warm-grey-500);border-radius:var(--pop-corner-radius) var(--pop-corner-radius) 0 0;box-sizing:border-box;color:var(--pop-white);display:flex;font-family:"Fira Sans",system-ui,"-apple-system","Segoe UI",Roboto,Ubuntu,Cantarell,"Nato Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:.9rem;font-weight:700;height:22px;justify-content:space-between;min-height:2.4em;padding:.3em;text-align:center;user-select:none;width:100%}.pop-header-10KQ>span{flex:1 1 auto;grid-area:center;text-align:center}.pop-close-1_TK{align-content:center;align-items:center;border-radius:9999px;display:flex;height:1.5rem;justify-content:center;margin-right:.15ch;width:1.5rem}.pop-close-1_TK svg{fill:var(--pop-mid-grey)}.pop-close-1_TK:active,.pop-close-1_TK:hover{background-color:var(--pop-orange-700)}.pop-close-1_TK:active svg,.pop-close-1_TK:hover svg{fill:var(--pop-white)}',map:void 0,media:void 0}),Object.defineProperty(this,"$style",{value:{header:"pop-header-10KQ",close:"pop-close-1_TK"}}))}),{name:"PopWindowHeader",inheritAttrs:!1,props:{closeButton:{type:Boolean,default:!0},title:{type:String,default:""}}},void 0,!1,"data-v-4013a4f5",!1,void 0,t,void 0);const d=e({render:function(){var e=this.$createElement,t=this._self._c||e;return t("pop-window-container",this._b({},"pop-window-container",this.$attrs,!1),[t("pop-window-header",this._b({attrs:{title:this.title}},"pop-window-header",this.$attrs,!1)),t("div",{class:[this.$style.box]},[this._t("default")],2)],1)},staticRenderFns:[]},(function(e){e&&(e("data-v-07efa0f7_0",{source:'.pop-box-3rlW{background-color:#333;box-sizing:border-box;color:#f2f2f2;display:block;flex:0 1 auto;font-family:"Fira Mono","Ubuntu Mono","Ubuntu Monospace",Menlo,Consolas,"Roboto Mono","Noto Mono","Oxygen Mono","Liberation Mono",monospace;font-size:.9rem;height:100%;line-height:1.2;overflow:hidden;width:100%}',map:void 0,media:void 0}),Object.defineProperty(this,"$style",{value:{box:"pop-box-3rlW"}}))}),{name:"PopTerminal",components:{PopWindowContainer:a,PopWindowHeader:l},inheritAttrs:!1,props:{directory:{type:String,default:"~"},hostname:{type:String,default:"pop-os"},user:{type:String,default:"pop-os"}},computed:{title(){return`${this.user}@${this.hostname}: ${this.directory}`}}},void 0,!1,"data-v-07efa0f7",!1,void 0,t,void 0);var p=Object.freeze({__proto__:null,PopTerminalContent:r,PopTerminal:d,PopWindowContainer:a,PopWindowHeader:l});function c(e){Object.keys(p).forEach(t=>{e.component(t,p[t])})}var u=Object.freeze({__proto__:null,install:c,PopTerminalContent:r,PopTerminal:d,PopWindowContainer:a,PopWindowHeader:l});let h=null;"undefined"!=typeof window?h=window.Vue:"undefined"!=typeof global&&(h=global.Vue),h&&h.use(u),exports.PopTerminal=d,exports.PopTerminalContent=r,exports.PopWindowContainer=a,exports.PopWindowHeader=l,exports.install=c;//# sourceMappingURL=index.common.js.map