Files
tauri.studio/docs/js/83b1e7f2.946267a6.js
2020-01-01 09:30:43 -03:00

1 line
18 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["83b1e7f2"],{2514:function(e,t,n){"use strict";var s=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"full-width q-pa-md"},[n("q-page-sticky",{directives:[{name:"scroll",rawName:"v-scroll",value:e.scrolled,expression:"scrolled"}],staticClass:"page-header fixed-top shadow-8 scroll-determined",staticStyle:{position:"fixed!important"},attrs:{expand:""}},[n("q-chip",{staticClass:"claim text-weight-light text-black bg-cyan-1 shadow-8",staticStyle:{top:"84%"},attrs:{outline:"",dense:"",square:"",icon:"star","icon-right":"star"}},[e._v("Build more secure native apps with fast, tiny binaries.")]),n("div",{staticClass:"bg-container scroll-determined q-pa-md q-ml-lg"}),n("div",[n("router-link",{attrs:{to:"/"}},[n("img",{staticClass:"tauri-name scroll-determined",staticStyle:{cursor:"pointer"},attrs:{src:"statics/tauri-wordmark.png"}})]),e.buttons?n("div",{staticClass:"row",staticStyle:{"margin-top":"90px"}},[n("q-btn",{staticClass:"btn",attrs:{dense:"",size:"small",to:"/docs/quickstart",label:"Quick Start","no-caps":"",color:"yellow-2","text-color":"black"}}),n("q-btn",{staticClass:"btn",attrs:{dense:"",size:"small",to:"/docs/patterns",label:"Patterns","no-caps":"",color:"yellow-2","text-color":"black"}}),e.showDocs?n("q-btn",{staticClass:"btn",attrs:{dense:"",size:"small",to:"/docs",label:"Docs","no-caps":"",color:"yellow-2","text-color":"black"}}):e._e()],1):n("div",{staticClass:"absolute-right",staticStyle:{margin:"18px 35px 0 0"}},[n("q-btn-dropdown",{staticClass:"q-mr-lg",attrs:{dense:"",color:"yellow-2",label:e.current,"no-caps":"","text-color":"black"}},[n("q-list",{attrs:{color:"yellow-2"}},[e.showDocs?n("q-item",{directives:[{name:"close-popup",rawName:"v-close-popup"}],attrs:{clickable:"",to:"/docs"},on:{click:function(t){e.current="Docs"}}},[n("q-item-section",[n("q-item-label",[e._v("Docs")])],1)],1):e._e(),n("q-item",{directives:[{name:"close-popup",rawName:"v-close-popup"}],attrs:{clickable:"",to:"/docs/quickstart"}},[n("q-item-section",[n("q-item-label",[e._v("Quick Start")])],1)],1),n("q-item",{directives:[{name:"close-popup",rawName:"v-close-popup"}],attrs:{clickable:"",to:"/docs/patterns"}},[n("q-item-section",[n("q-item-label",[e._v("Patterns")])],1)],1),n("q-item",{directives:[{name:"close-popup",rawName:"v-close-popup"}],attrs:{clickable:"",to:"/docs/environment"}},[n("q-item-section",[n("q-item-label",[e._v("Environment")])],1)],1)],1)],1)],1)],1)],1),n("main",{staticClass:"flex flex-start justify-center"},[n("div",{staticClass:"q-pa-sm col-12-sm col-10-md col-8-lg",staticStyle:{"max-width":"1024px",width:"100%"}},[e._t("default")],2)])],1)},a=[],i={name:"Hero",data:function(){return{buttons:!0,current:"Menu",height:270,heightName:140,heightPic:250,heightClaim:100,rightDrawerOpen:this.$q.platform.is.desktop}},mounted:function(){},computed:{showDocs:function(){var e=this.$route.meta.showDocslink;return"undefined"===typeof e||e}},methods:{scrolled:function(e){var t=e/4;this.height=270-t,this.heightName=140-t,this.heightPic=250-t,this.heightClaim=220-t,t>=50&&!1!==this.buttons?(this.buttons=!1,document.getElementsByClassName("scroll-determined")[0].setAttribute("style","height: 70px"),document.getElementsByClassName("scroll-determined")[1].setAttribute("style","height: 55px;width: 55px;transform: rotate(".concat(e,"deg)")),document.getElementsByClassName("tauri-name")[0].setAttribute("style","\n height: 35px;\n "),document.getElementsByClassName("q-drawer__content")[0].setAttribute("style","background-color: #FDFADE;margin-top: 60px;padding-top:20px"),document.getElementById("scrollHolder").setAttribute("style","height: calc(100% - 132px)"),document.getElementById("padding").setAttribute("style","height: 40px")):!1===this.buttons?document.getElementsByClassName("scroll-determined")[1].setAttribute("style","height: 55px;width: 55px;transform: rotate(".concat(e,"deg)")):document.getElementsByClassName("scroll-determined")[1].setAttribute("style","transform: rotate(".concat(e,"deg)"))}}},o=i,r=(n("42ef"),n("2877")),l=Object(r["a"])(o,s,a,!1,null,null,null);t["a"]=l.exports},"42ef":function(e,t,n){"use strict";var s=n("efb7"),a=n.n(s);a.a},"6d85":function(e,t,n){},8452:function(e,t,n){"use strict";n.r(t);var s=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("hero",[n("div",{staticStyle:{"padding-top":"260px"},attrs:{id:"padding"}}),n("p",{staticClass:"q-mt-xl"},[e._v("Tauri patterns are descriptions of use-cases that are entirely configurable within the Tauri configuration file. These are not the limits of what Tauri can do, and there are probably more out there. If you discover one, why not get in touch and help us update this collection!\n ")]),n("q-card",{staticClass:"q-mt-xl"},[n("q-card-section",{staticClass:"text-center",staticStyle:{"padding-bottom":"-20px"}},e._l(e.patterns,(function(t){return n("q-btn",{key:t.id,staticClass:"q-mx-xs",class:{"bg-cyan-2 text-black":e.pattern===t.name},attrs:{outline:"",flat:"",dense:"","no-caps":"",disabled:e.pattern===t.name},on:{click:function(n){e.pattern=t.name}}},[e._v(e._s(t.name))])})),1),n("q-separator"),n("q-card-section",{staticClass:"bg-cyan-1"},[n("q-ribbon",{staticStyle:{margin:"-16px"},attrs:{"leaf-color":e.yellow.dark,"background-color":e.yellow.light,color:"black",type:"corner",position:"top-right"}},[n("small",{staticClass:"q-pa-md text-weight-bold"},[e._v(e._s(e.active.most))])]),n("div",{staticClass:"fit row inline wrap justify-center",staticStyle:{"margin-top":"26px"},attrs:{id:"tryout"}},[n("img",{staticClass:"col-1 q-mt-lg q-mr-md",staticStyle:{height:"50px",width:"auto"},attrs:{src:"statics/patterns/"+e.pattern+".png"}}),n("h4",{staticClass:"col-grow text-weight-light text-cyan-10",staticStyle:{margin:"-30px 0"}},[e._v(e._s(e.pattern))]),n("span",{staticClass:"col-12 q-pa-sm text-weight-bold text-black",staticStyle:{margin:"-25px 0 0 110px"}},[e._v(e._s(e.active.bestWhen))]),n("div",{staticClass:"col-grow"}),n("div",{staticClass:"col-12 alight-right justify-end q-ma-sm"},[n("div",{staticClass:"row"},[n("span",{staticClass:"col-6 text-right q-pr-sm",staticStyle:{"white-space":"nowrap"}},[e._v("Ease of Use: ")]),n("q-rating",{staticClass:"col-6 inline-block",attrs:{color:"cyan-10",readonly:""},model:{value:e.active.ratings.easeOfUse,callback:function(t){e.$set(e.active.ratings,"easeOfUse",t)},expression:"active.ratings.easeOfUse"}})],1),n("div",{staticClass:"row"},[n("span",{staticClass:"col-6 text-right q-pr-sm"},[e._v("Extensibility: ")]),n("q-rating",{staticClass:"col-6 inline-block",attrs:{color:"cyan-10",readonly:""},model:{value:e.active.ratings.extensibility,callback:function(t){e.$set(e.active.ratings,"extensibility",t)},expression:"active.ratings.extensibility"}})],1),n("div",{staticClass:"row"},[n("span",{staticClass:"col-6 text-right q-pr-sm"},[e._v("Security: ")]),n("q-rating",{staticClass:"col-6 inline-block",attrs:{color:"cyan-10",readonly:""},model:{value:e.active.ratings.security,callback:function(t){e.$set(e.active.ratings,"security",t)},expression:"active.ratings.security"}})],1)])])],1),n("q-separator"),n("q-card-section",[n("p",{staticClass:"row"},[e._v(e._s(e.active.intro))]),n("div",{staticClass:"text-center",attrs:{id:"temp"},domProps:{innerHTML:e._s(e.graph)}})]),n("q-separator"),n("q-card-section",[n("ul",{staticClass:"text-weight-bold"},[e._v(" Features:\n "),e._l(e.active.features,(function(t){return n("li",{key:t.id,staticClass:"text-weight-regular row-12"},[e._v(e._s(t))])}))],2),n("ul",{staticClass:"text-weight-bold"},[e._v(" Pros:\n "),e._l(e.active.pros,(function(t){return n("li",{key:t.id,staticClass:"text-weight-regular row-12"},[e._v(e._s(t))])}))],2),n("ul",{staticClass:"text-weight-bold"},[e._v(" Cons:\n "),e._l(e.active.cons,(function(t){return n("li",{key:t.id,staticClass:"text-weight-regular row-12"},[e._v(e._s(t))])}))],2)]),n("q-separator"),n("q-card-section",[n("h6",[e._v("Configuration")]),n("span",[e._v("src-tauri/tauri.conf.json")]),n("q-markdown",{attrs:{src:e.active.configMD,toc:"","no-line-numbers":""},on:{data:e.onToc}})],1)],1),n("q-page-scroller",{attrs:{position:"bottom-right","scroll-offset":150,offset:[18,18]}},[n("q-btn",{attrs:{fab:"",icon:"keyboard_arrow_up",color:"primary"}})],1)],1)},a=[],i=(n("7f7f"),n("7514"),n("2514")),o={blue:{light:"#BAE5F2",dark:"#77CFE4"},yellow:{light:"#EFD3AF",dark:"#D08050"}},r={name:"Patterns",components:{Hero:i["a"]},data:function(){return{mermaidHTML:"",blue:o.blue,yellow:o.yellow,graph:"",clearfix:" ",pattern:"Cloudish",patterns:[{name:"Hermit",most:"MOST SECURE",intro:"The Hermit recipe is a pattern for ultimate application isolation where all logic is self-contained in the Window and the binary exists merely to bootstrap the Window. There is no communication back to Rust from the Window, there is no localhost server, and the Window has no access to any remote resources.",ratings:{easeOfUse:5,security:5,extensibility:0},bestWhen:"Best when you want to lock down your app from all external influences.",configMD:"\n```\ntauri: {\n embeddedServer: {\n active: false // do not use a localhost server\n },\n whitelist: {\n all: false, // disable and tree-shake all api functions\n },\n security: {\n csp: 'default-src data: \\'unsafe-eval\\' \\'unsafe-inline\\''\n fASLR: 'aot' // bootstrap with dynamic AOT of interface at every launch\n }\n}\n```\n ",graph:"graph LR\n A==>H\n H==>F\n subgraph WEBVIEW\n F\n end\n\n subgraph RUST\n A\n end\n A[fa:fa-cog Binary ]\n F[fa:fa-window-maximize Window]\n H{Bootstrap}\n style RUST fill:".concat(o.yellow.light,",stroke:").concat(o.yellow.dark,",stroke-width:4px\n style WEBVIEW fill:").concat(o.blue.light,",stroke:").concat(o.blue.dark,",stroke-width:4px")},{name:"Bridge",most:"MOST POPULAR",intro:"The Bridge recipe is a secure pattern where messages are passed between brokers via an implicit bridge using the API.",bestWhen:"Best when you want two-way communication between Rust and WebView.",ratings:{easeOfUse:4,security:4,extensibility:5},features:["render UI securely at bootstrap","promise based message passing","RW access to filesystem","STDOUT access to other binaries","extensible with Rust functions","whitelist for functional codegen","runtime message salting","fASLR & AoT Compiling"],pros:["highly configurable","infinitely extensible"],cons:["rust skills virtually required"],configMD:"\n```\ntauri: {\n embeddedServer: {\n active: false // do not use a localhost server\n },\n whitelist: { // all whitelist values are default:false\n all: true, // use this flag to enable all API features\n answer: false, // enable rust to direct the UI\n bridge: false, // enable Quasar Bridge\n event: false, // enable binding to message\n execute: false, // enable application execution\n listFiles: false, // list files in a directory\n open: false, // open link in a browser\n readBinaryFile: false, // read binary file from local filesystem\n readTextFile: false, // read text file from local filesystem\n setTitle: false, // set the window title\n writeFile: false // write file to local filesystem\n },\n security: {\n csp: 'default-src data: \\'unsafe-eval\\' \\'unsafe-inline\\'',\n messageSalt: 'none', // one of: ['none'|'aot'|'otp']\n fASLR: 'none' // one of: ['none'|'aot'|'otp']\n }\n}\n```\n ",graph:'graph LR\n H==>F\n\n subgraph WEBVIEW\n F-.-E\n end\n\n D--\x3eE\n E--\x3eD\n B--\x3eD\n D--\x3eB\n\n subgraph RUST\n A==>H\n A--\x3eB\n B-.-C\n B-.-G\n end\n\n A[Binary]\n B{Rust Broker}\n C[Subprocess 2]\n G[Subprocess 1]\n D(( API BRIDGE ))\n E{JS Broker}\n F[Window]\n H{Bootstrap}\n click D "/docs/api" "Visit the API page"\n style D fill:#ccc,stroke:#333,stroke-width:4px,color:white\n style RUST fill:'.concat(o.yellow.light,",stroke:").concat(o.yellow.dark,",stroke-width:4px\n style WEBVIEW fill:").concat(o.blue.light,",stroke:").concat(o.blue.dark,",stroke-width:4px")},{name:"Cloudish",most:"MOST EASY",intro:"The Cloudish recipe is a pattern for maximum flexibility and app performance. It uses a localhost server, which means that your app will technically be available to other processes, like browsers and potentially other devices on the network. All of your assets are baked into the binary, but served as if they were distinct files.",ratings:{easeOfUse:4,security:2,extensibility:3},bestWhen:"Best when you have never used Rust before.",configMD:"\n```\ntauri: {\n embeddedServer: {\n active: true // ship with a localhost server\n },\n whitelist: {\n all: false // disable entire API\n },\n security: {\n csp: 'default-src data: http: https: \\'unsafe-eval\\' \\'unsafe-inline\\''\n }\n}\n```\n ",graph:"graph LR\n H==>F\n H==>D\n D--\x3eF\n F--\x3eD\n\n subgraph RUST\n A==>H\n end\n\n subgraph WEBVIEW\n F\n end\n\n subgraph SERVER\n D\n E--\x3eD\n end\n\n A[Binary]\n D(( localhost ))\n E[bundled resources]\n F[Window]\n H{Bootstrap}\n style RUST fill:".concat(o.yellow.light,",stroke:").concat(o.yellow.dark,",stroke-width:4px\n style WEBVIEW fill:").concat(o.blue.light,",stroke:").concat(o.blue.dark,",stroke-width:4px\n style SERVER fill:#49A24A,stroke:#2B6063,stroke-width:4px")},{name:"Cloudbridge",most:"MOST COMPLEX",intro:"The Cloudbridge recipe combines the flexibility of a localhost and the security of the bridge. With so many features, it can be easy to get lost.",ratings:{easeOfUse:2,security:2,extensibility:5},bestWhen:"Best when your project is complex and you need all available options.",configMD:"\n```\ntauri: {\n embeddedServer: {\n active: true // ship with a localhost server\n },\n whitelist: {\n all: true // enable entire API\n },\n security: {\n csp: 'default-src data: http: https: \\'unsafe-eval\\' \\'unsafe-inline\\''\n }\n}\n```\n ",graph:"graph LR\n A== Bootstrap ==>F\n A[Rust Binary]\n F[WebView Window]\n "},{name:"Kamikaze",most:"MOST AWESOME",intro:"The Kamikaze recipe is a minimal usage of the Bridge pattern, which only allows interaction between Rust and the Window via expiring JS Promise Closures that are injected into the Window by Rust and nulled as part of the callback.",ratings:{easeOfUse:2,security:5,extensibility:4},bestWhen:"Best when you want Rust to drive the Webview.",configMD:"\n```\ntauri: {\n embeddedServer: {\n active: false // do not use a localhost server\n },\n whitelist: { // all API endpoints are default true\n event: true, // Use the EVENT API for injections\n },\n security: {\n csp: 'default-src data: \\'unsafe-eval\\' \\'unsafe-inline\\'',\n fASLR: 'aot' // bootstrap with dynamic AOT of interface on launch\n messageSalt: 'otp', // use One-Time-Pads for injected function handles\n eventRecycle: 0 // never use an event twice\n }\n}\n```\n ",graph:"graph LR\n H==>F\n G-.->B\n B--\x3eG\n subgraph WEBVIEW\n G--\x3eF\n end\n\n subgraph RUST\n A--\x3eB\n A==>H\n end\n\n A[Binary]\n B[API:Event]\n F[Window]\n G((Promise Closure))\n H{Bootstrap}\n style RUST fill:".concat(o.yellow.light,",stroke:").concat(o.yellow.dark,",stroke-width:4px\n style WEBVIEW fill:").concat(o.blue.light,",stroke:").concat(o.blue.dark,",stroke-width:4px")},{name:"Multiwin",most:"MOSTLY VAPOR",intro:"The Multiwin recipe will allow you to have multiple windows, some of which may be GL based. It is not yet available, but is in the research phase.",ratings:{easeOfUse:1,security:5,extensibility:4},bestWhen:"Best when you need more than one window.",configMD:"\n```\ntauri: {\n embeddedServer: {\n active: false // do not use a localhost server\n },\n whitelist: { // all API endpoints are default true\n event: true, // Use the EVENT API for injections\n },\n security: {\n csp: 'default-src data: \\'unsafe-eval\\' \\'unsafe-inline\\'',\n fASLR: 'aot' // bootstrap with dynamic AOT of interface on launch\n messageSalt: 'otp', // use One-Time-Pads for injected function handles\n eventRecycle: 0 // never use an event twice\n }\n}\n```\n ",graph:"graph LR\n A==>H\n H==>F\n H==>G\n subgraph WEBVIEW\n F\n end\n subgraph GLUTIN\n G\n end\n subgraph RUST\n A\n end\n\n A[Binary]\n F[Window]\n G[GL Window]\n H{Bootstrap}\n style GLUTIN stroke:".concat(o.blue.dark,",stroke-width:4px\n style RUST fill:").concat(o.yellow.light,",stroke:").concat(o.yellow.dark,",stroke-width:4px\n style WEBVIEW fill:").concat(o.blue.light,",stroke:").concat(o.blue.dark,",stroke-width:4px")}]}},watch:{pattern:{handler:function(e,t){t=t||"none",e=e||"none";var n=this.patterns.find((function(t){return t.name===e}));"undefined"!==typeof n&&this.goMermaid(n.graph)},immediate:!0}},computed:{toc:{get:function(){return this.$store.state.common.toc},set:function(e){this.$store.commit("common/toc",e)}},active:{get:function(){var e=this;return this.patterns.find((function(t){return t.name===e.pattern}))}}},mounted:function(){},methods:{onToc:function(e){this.toc=e},goMermaid:function(e){var t=this;this.graph=null,this.$nextTick((function(){t.graph=t.$mermaid.render("mermaid",e)}))}}},l=r,c=(n("d867"),n("2877")),d=Object(c["a"])(l,s,a,!1,null,null,null);t["default"]=d.exports},d867:function(e,t,n){"use strict";var s=n("6d85"),a=n.n(s);a.a},efb7:function(e,t,n){}}]);