(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([["8083"],{6706:function(e,t,r){"use strict";r.r(t),r.d(t,{default:()=>u,frontMatter:()=>a,metadata:()=>o,assets:()=>c,toc:()=>d,contentTitle:()=>l});var o=JSON.parse('{"id":"features/deploy","title":"Deploy","description":"The result page (of any number of projects) can be deployed and hosted at GitHub Pages (a free service from GitHub for hosting static websites). This requires login with a GitHub account.","source":"@site/docs/features/deploy.mdx","sourceDirName":"features","slug":"/features/deploy","permalink":"/docs/features/deploy","draft":false,"unlisted":false,"editUrl":"https://github.com/live-codes/livecodes/tree/develop/docs/docs/features/deploy.mdx","tags":[],"version":"current","frontMatter":{},"sidebar":"docsSidebar","previous":{"title":"Data URLs","permalink":"/docs/features/data-urls"},"next":{"title":"Sync","permalink":"/docs/features/sync"}}'),n=r("5893"),s=r("65"),i=r("8500");let a={},l="Deploy",c={},d=[{value:"Related",id:"related",level:2}];function h(e){let t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",img:"img",li:"li",p:"p",strong:"strong",ul:"ul",...(0,s.a)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(t.header,{children:(0,n.jsx)(t.h1,{id:"deploy",children:"Deploy"})}),"\n",(0,n.jsxs)(t.p,{children:["The result page (of any number of projects) can be deployed and hosted at ",(0,n.jsx)(t.a,{href:"https://pages.github.com/",children:"GitHub Pages"})," (a free service from GitHub for hosting static websites). This requires login with a ",(0,n.jsx)(t.a,{href:"/docs/features/github-integration",children:"GitHub account"}),"."]}),"\n",(0,n.jsxs)(t.p,{children:["The ",(0,n.jsx)(t.code,{children:"Deploy"})," screen can be accessed from the Project menu \u2192 Deploy."]}),"\n","\n",(0,n.jsx)(i.Z,{params:{screen:"deploy"},linkText:"direct link"}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.img,{alt:"LiveCodes Deploy",src:r(1022).Z+"",width:"2240",height:"1400"})}),"\n",(0,n.jsxs)(t.p,{children:["The result page (and optionally the source code) is pushed to ",(0,n.jsx)(t.code,{children:"gh-pages"})," branch of a ",(0,n.jsx)(t.strong,{children:"public"})," GitHub repo (new or existing). The page, shortly, becomes available on ",(0,n.jsx)(t.code,{children:"https://{user}.github.io/{repo}/"}),"."]}),"\n",(0,n.jsxs)(t.p,{children:["If an existing repo is selected, the content of the ",(0,n.jsx)(t.code,{children:"gh-pages"})," branch (if existing) is replaced by the deployed content."]}),"\n",(0,n.jsxs)(t.p,{children:["If the option ",(0,n.jsx)(t.code,{children:"Commit source code"})," is enabled, the source code will be deployed to the directory ",(0,n.jsx)(t.code,{children:"/src"}),"."]}),"\n",(0,n.jsxs)(t.p,{children:["The code for the result page (and source code) is deployed as separate files for markup (",(0,n.jsx)(t.code,{children:"/index.html"}),"), styles (",(0,n.jsx)(t.code,{children:"style.css"}),") and script (",(0,n.jsx)(t.code,{children:"script.js"}),"). This allows re-use of these resources in other projects. Of course, multiple projects can be deloyed and linked to each other to act like a multi-page website."]}),"\n",(0,n.jsx)(t.p,{children:"The LiveCodes app will remember the repo used to deploy each project, so that later updates to the project can be deployed to the same repo."}),"\n",(0,n.jsx)(t.h2,{id:"related",children:"Related"}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsx)(t.li,{children:(0,n.jsx)(t.a,{href:"/docs/features/export",children:"Export"})}),"\n",(0,n.jsx)(t.li,{children:(0,n.jsx)(t.a,{href:"/docs/features/share",children:"Share"})}),"\n",(0,n.jsx)(t.li,{children:(0,n.jsx)(t.a,{href:"/docs/features/broadcast",children:"Broadcast"})}),"\n",(0,n.jsx)(t.li,{children:(0,n.jsx)(t.a,{href:"/docs/features/github-integration",children:"GitHub integration"})}),"\n"]})]})}function u(e={}){let{wrapper:t}={...(0,s.a)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(h,{...e})}):h(e)}},1022:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});let o=r.p+"assets/images/deploy-1-cfc621da21b4b525ba8776492d128e08.jpg"},7728:function(e,t,r){e=r.nmd(e);var o=function(){var e=String.fromCharCode,t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",o={};function n(e,t){if(!o[e]){o[e]={};for(var r=0;r>>8,r[2*o+1]=i%256}return r},decompressFromUint8Array:function(t){if(null==t)return s.decompress(t);for(var r=Array(t.length/2),o=0,n=r.length;od.charCodeAt(0)){for(o=0;o>=1}else{for(o=0,n=1;o>=1}0==--h&&(h=Math.pow(2,p),p++),delete a[d]}else for(o=0,n=i[d];o>=1;0==--h&&(h=Math.pow(2,p),p++),i[c]=u++,d=String(l)}if(""!==d){if(Object.prototype.hasOwnProperty.call(a,d)){if(256>d.charCodeAt(0)){for(o=0;o>=1}else{for(o=0,n=1;o>=1}0==--h&&(h=Math.pow(2,p),p++),delete a[d]}else for(o=0,n=i[d];o>=1;0==--h&&(h=Math.pow(2,p),p++)}for(o=0,n=2;o>=1;for(;;){if(m<<=1,g==t-1){f.push(r(m));break}g++}return f.join("")},decompress:function(e){return null==e?"":""==e?null:s._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(t,r,o){var n,s,i,a,l,c,d,h=[],u=4,p=4,f=3,m="",g=[],y={val:o(0),position:r,index:1};for(n=0;n<3;n+=1)h[n]=n;for(i=0,l=4,c=1;c!=l;)a=y.val&y.position,y.position>>=1,0==y.position&&(y.position=r,y.val=o(y.index++)),i|=(a>0?1:0)*c,c<<=1;switch(i){case 0:for(i=0,l=256,c=1;c!=l;)a=y.val&y.position,y.position>>=1,0==y.position&&(y.position=r,y.val=o(y.index++)),i|=(a>0?1:0)*c,c<<=1;d=e(i);break;case 1:for(i=0,l=65536,c=1;c!=l;)a=y.val&y.position,y.position>>=1,0==y.position&&(y.position=r,y.val=o(y.index++)),i|=(a>0?1:0)*c,c<<=1;d=e(i);break;case 2:return""}for(h[3]=d,s=d,g.push(d);;){if(y.index>t)return"";for(i=0,l=Math.pow(2,f),c=1;c!=l;)a=y.val&y.position,y.position>>=1,0==y.position&&(y.position=r,y.val=o(y.index++)),i|=(a>0?1:0)*c,c<<=1;switch(d=i){case 0:for(i=0,l=256,c=1;c!=l;)a=y.val&y.position,y.position>>=1,0==y.position&&(y.position=r,y.val=o(y.index++)),i|=(a>0?1:0)*c,c<<=1;h[p++]=e(i),d=p-1,u--;break;case 1:for(i=0,l=65536,c=1;c!=l;)a=y.val&y.position,y.position>>=1,0==y.position&&(y.position=r,y.val=o(y.index++)),i|=(a>0?1:0)*c,c<<=1;h[p++]=e(i),d=p-1,u--;break;case 2:return g.join("")}if(0==u&&(u=Math.pow(2,f),f++),h[d])m=h[d];else{if(d!==p)return null;m=s+s.charAt(0)}g.push(m),h[p++]=s+m.charAt(0),u--,s=m,0==u&&(u=Math.pow(2,f),f++)}}};return s}();"function"==typeof define&&define.amd?define(function(){return o}):null!=e&&(e.exports=o)},8500:function(e,t,r){"use strict";r.d(t,{Z:()=>c});var o=r("5893");r("7294");var n=r("6735");function s(e){let{children:t,fallback:r}=e;return(0,n.Z)()?(0,o.jsx)(o.Fragment,{children:t?.()}):r??null}var i=r("1705"),a=r("8294"),l=r("1858");function c(e){let{params:t,config:r,code:n,language:c="js",codeTitle:d="",showLineNumbers:h=!1,formatCode:u=!0,linkText:p="Run in LiveCodes",style:f={},className:m=""}=e,g=(0,a.r)({appUrl:l.G,params:t,config:r});return(0,o.jsxs)("div",{style:{marginBottom:"30px",...f},className:m,children:[n&&(0,o.jsx)(s,{children:()=>(0,o.jsx)(i.Z,{language:c,title:d,showLineNumbers:h,children:u?function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"js";return window.prettier?.format(e,{parser:"html"===t?"html":"babel",plugins:window.prettierPlugins})}(n,c):n})}),(0,o.jsxs)("a",{href:g,target:"_blank",rel:"noreferrer",children:[p,(0,o.jsx)("svg",{width:"12",height:"12","aria-hidden":"true",viewBox:"0 0 24 24",className:"iconExternalLink_node_modules-@docusaurus-theme-classic-lib-theme-Icon-ExternalLink-styles-module",style:{marginLeft:"4px"},children:(0,o.jsx)("path",{fill:"currentColor",d:"M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"})})]})]})}},8294:function(e,t,r){"use strict";r.d(t,{T:function(){return n},r:function(){return s}});var o=r(7728);async function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"object"!=typeof e||e instanceof HTMLElement||!e.headless&&"headless"!==e.view||(t=e,e=null);let{config:r={},headless:o,loading:n="lazy",view:i}=t,a=o||"headless"===i,l=null,c=null;if("string"==typeof e)l=document.querySelector(e);else if(e instanceof HTMLElement)l=e;else if(!(a&&"object"==typeof e))throw Error("A valid container element is required.");if(!l){if(a)P(l=document.createElement("div")),document.body.appendChild(l);else throw Error(`Cannot find element: "${e}"`)}let d=new URL(s(t)),h=d.origin;d.searchParams.set("embed","true"),d.searchParams.set("loading",a?"eager":n);let u=globalThis.process;d.searchParams.set("sdkVersion",u?.env?.SDK_VERSION||"latest"),"object"==typeof r&&Object.keys(r).length>0&&d.searchParams.set("config","sdk");let p=t.params;"object"==typeof p&&Object.keys(p).length>0&&JSON.stringify(p).length<1800&&Object.keys(p).forEach(e=>{d.searchParams.set(e,encodeURIComponent(String(p[e])))});let f=!1,m="Cannot call API methods after calling `destroy()`.",g=await new Promise(e=>{if(!l)return;let t=l.dataset.height||l.style.height;if(t&&!a){let e=isNaN(Number(t))?t:t+"px";l.style.height=e}"false"===l.dataset.defaultStyles||a||(l.style.backgroundColor||="#fff",l.style.border||="1px solid black",l.style.borderRadius||="8px",l.style.boxSizing||="border-box",l.style.padding||="0",l.style.width||="100%",l.style.height||=l.style.height||"300px",l.style.minHeight="200px",l.style.flexGrow="1",l.style.overflow||="hidden",l.style.resize||="vertical");let o="livecodes",s=l.querySelector(`iframe.${o}`),i=s||document.createElement("iframe");i.classList.add(o),i.setAttribute("allow","accelerometer; camera; encrypted-media; display-capture; geolocation; gyroscope; microphone; midi; clipboard-read; clipboard-write; web-share"),i.setAttribute("allowtransparency","true"),i.setAttribute("allowpaymentrequest","true"),i.setAttribute("allowfullscreen","true"),i.setAttribute("sandbox","allow-same-origin allow-downloads allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-presentation allow-scripts"),i.setAttribute("loading","eager"===n?"eager":"lazy"),a?P(i):(i.style.height="100%",i.style.minHeight="200px",i.style.width="100%",i.style.margin="0",i.style.border="0",i.style.borderRadius=l.style.borderRadius),addEventListener("message",function e(t){t.source===i.contentWindow&&t.origin===h&&t.data?.type==="livecodes-init"&&(removeEventListener("message",e),c=Number(t.data.payload.appVersion.replace(/^v/,"")))}),(!c||c<46)&&addEventListener("message",function e(t){t.source===i.contentWindow&&t.origin===h&&t.data?.type==="livecodes-get-config"&&(removeEventListener("message",e),i.contentWindow?.postMessage({type:"livecodes-config",payload:r},h))}),i.onload=()=>{e(i)},i.src=d.href,s||l.appendChild(i)}),y=new Promise(e=>{addEventListener("message",function t(r){r.source===g.contentWindow&&r.origin===h&&r.data?.type==="livecodes-ready"&&(removeEventListener("message",t),e(),y.settled=!0)})}),v=()=>f?Promise.reject(m):new Promise(async e=>{y.settled&&e(),g.contentWindow?.postMessage({type:"livecodes-load"},h),await y,e()}),b=(e,t)=>new Promise(async(r,o)=>{if(f)return o(m);await v();let n=k();addEventListener("message",function t(s){if(s.source===g.contentWindow&&s.origin===h&&s.data?.type==="livecodes-api-response"&&s.data?.id===n&&s.data.method===e){removeEventListener("message",t);let e=s.data.payload;e?.error?o(e.error):r(e)}}),g.contentWindow?.postMessage({method:e,id:n,args:t},h)}),w={},x=["load","ready","code","console","tests","destroy"],j=(e,t)=>{if(f)throw Error(m);return x.includes(e)?(b("watch",[e]),w[e]||(w[e]=[]),w[e]?.push(t),{remove:()=>{w[e]=w[e]?.filter(e=>e!==t),w[e]?.length===0&&b("watch",[e,"unsubscribe"])}}):{remove:()=>void 0}},C=e=>({"livecodes-app-loaded":"load","livecodes-ready":"ready","livecodes-change":"code","livecodes-console":"console","livecodes-test-results":"tests","livecodes-destroy":"destroy"})[e];addEventListener("message",async e=>{let t=C(e.data?.type??"");if(e.source!==g.contentWindow||e.origin!==h||!t||!w[t])return;let r=e.data?.payload;w[t]?.forEach(e=>{e(r)})});let E=()=>{Object.values(w).forEach(e=>{e.length=0}),g?.remove?.(),f=!0};function P(e){e.style.position="absolute",e.style.top="0",e.style.visibility="hidden",e.style.opacity="0"}"lazy"===n&&"IntersectionObserver"in window&&new IntersectionObserver((e,t)=>{e.forEach(async e=>{e.isIntersecting&&(await v(),t.unobserve(l))})},{rootMargin:"150px"}).observe(l);let k=()=>(String(Math.random())+Date.now().toFixed()).replace("0.","");return{load:()=>v(),run:()=>b("run"),format:e=>b("format",[e]),getShareUrl:e=>b("getShareUrl",[e]),getConfig:e=>b("getConfig",[e]),setConfig:e=>b("setConfig",[e]),getCode:()=>b("getCode"),show:(e,t)=>b("show",[e,t]),runTests:()=>b("runTests"),onChange:e=>j("code",e),watch:j,exec:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),o=1;oy.settled?b("destroy").then(E):f?Promise.reject(m):(E(),Promise.resolve())}}function s(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{appUrl:r="https://livecodes.io",params:n={},config:s={},headless:i,import:a,lite:l,view:c,...d}=t;try{e=new URL(r)}catch{throw Error(`${r} is not a valid URL.`)}let h=new URLSearchParams;Object.entries(d).forEach(t=>{let[r,o]=t;void 0!==o&&e.searchParams.set(r,String(o))});let u="headless"===t.view||i;if(l&&(console.warn('Deprecation notice: "lite" option is deprecated. Use "config: { mode: \'lite\' }" instead.'),"object"==typeof s&&null==s.mode?s.mode="lite":e.searchParams.set("lite","true")),c&&(console.warn('Deprecation notice: The "view" option has been moved to "config.view". For headless mode use "headless: true".'),"object"==typeof s&&null==s.view&&"headless"!==c?s.view=c:e.searchParams.set("view",c)),"string"==typeof s)try{new URL(s),e.searchParams.set("config",encodeURIComponent(s))}catch{throw Error('"config" is not a valid URL or configuration object.')}else s&&"object"==typeof s&&Object.keys(s).length>0&&(s.title&&"Untitled Project"!==s.title&&e.searchParams.set("title",s.title),s.description&&s.description.length>0&&e.searchParams.set("description",s.description),h.set("config","code/"+(0,o.compressToEncodedURIComponent)(JSON.stringify(s))));if(n&&"object"==typeof n&&Object.keys(n).length>0)try{h.set("params",(0,o.compressToEncodedURIComponent)(JSON.stringify(n)))}catch{Object.keys(n).forEach(t=>{e.searchParams.set(t,encodeURIComponent(String(n[t])))})}return a&&e.searchParams.set("x",encodeURIComponent(a)),u&&e.searchParams.set("headless","true"),e.hash=h.toString(),e.href}},65:function(e,t,r){"use strict";r.d(t,{Z:function(){return a},a:function(){return i}});var o=r(7294);let n={},s=o.createContext(n);function i(e){let t=o.useContext(s);return o.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(s.Provider,{value:t},e.children)}}}]);