{"version":3,"sources":["webpack://typescriptlang-org/./src/components/SuppressWhenTouch.tsx","webpack://typescriptlang-org/./src/components/devNav.tsx","webpack://typescriptlang-org/./src/lib/isTouchDevice.ts","webpack://typescriptlang-org/./src/pages/dev/sandbox.tsx"],"names":["SuppressWhenTouch","children","hideOnTouch","useEffect","isTouchDevice","suppressible","document","getElementById","firstChild","removeChild","h4","createElement","textContent","p","appendChild","id","DevNav","props","isActive","str","active","toLowerCase","className","style","display","href","withPrefix","hasTouchScreen","navigator","maxTouchPoints","msMaxTouchPoints","mQ","window","matchMedia","media","matches","UA","userAgent","test","Index","getLoaderScript","src","async","onload","re","global","require","config","paths","vs","sandbox","ignoreDuplicateModules","main","ts","sandboxEnv","parentNode","createTypeScriptSandbox","text","compilerOptions","domID","filetype","editor","focus","setTimeout","querySelectorAll","forEach","codeElement","monaco","colorize","tabSize","then","newHTML","innerHTML","body","title","description","lang","marginTop","borderLeft","role","height","codeSamples","map","code","key","blurb","trim","locale"],"mappings":"qLAOaA,EAAoB,SAAC,GAAoC,IAAlCC,EAAiC,EAAjCA,SAAUC,EAAuB,EAAvBA,YAwB5C,OAtBAC,gBAAU,WACR,IAAIC,SAAiB,CAInB,IADA,IAAMC,EAAeC,SAASC,eAAe,sBACtCF,EAAaG,YAClBH,EAAaI,YAAYJ,EAAaG,YAGxC,GAAIN,EAAa,OAEjB,IAAMQ,EAAKJ,SAASK,cAAc,MAClCD,EAAGE,YAAc,6BAEjB,IAAMC,EAAIP,SAASK,cAAc,KACjCE,EAAED,YAAc,yHAEhBP,EAAaS,YAAYJ,GACzBL,EAAaS,YAAYD,MAG1B,IAED,uBAAKE,GAAG,sBACLd,K,0FC1BMe,EAAS,SAACC,GACrB,IAAMC,EAAW,SAACC,GAAD,OACfF,EAAMG,QAAUH,EAAMG,OAAOC,gBAAkBF,EAAM,SAAW,IAElE,OAAO,uBAAKG,UAAU,wBACpB,sBAAIA,UAAU,OACZ,sBAAIA,UAAU,QAAO,8CACrB,sBAAIC,M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GAAG,UACN,uBAAKO,UAAU,YACb,4BACA,4BACA,4BACA,4BACA,4BACA,4BACA,4BACA,4BACA,6BAEF,qBAAGP,GAAG,kBAAkBgE,KAAK,UAA7B,2BAIF,uBACExD,MAAO,CAAEyD,OAAQ,QAASxD,QAAS,QACnCT,GAAG,2BAMX,uBAAKO,UAAU,6BACb,mCACA,kJAE4D,IAC1D,qBAAGG,KAAK,+CAAR,iBAEK,IALP,MAMK,uCANL,KAQA,sGAEc,IACZ,qBACEA,KAAK,6CACLiD,MAAM,uDAFR,UAQF,yCACA,+CACqB,0CADrB,wCAIA,2BACE,wBAAMpD,UAAU,aAAhB,m0FA4EF,6CACmB,0CADnB,8EAIA,sDACC2D,EAAYC,KAAI,SAAAC,GAAI,OACnB,uBAAK7D,UAAU,aAAa8D,IAAKD,EAAKE,OACpC,yBAAIF,EAAKE,OACT,2BACE,wBAAM/D,UAAU,WAAW6D,EAAKA,KAAKG,aAI3C,mEAC0C,IACxC,qBAAG7D,KAAK,4DAAR,qBAEK,IAJP,WAKW,IACT,qBAAGA,KAAK,kDAAR,yBANF,UAkBZ,mBAAgBR,GAAD,OACb,gBAAC,IAAD,CAAMsE,OAAO,MACX,gBAAChD,EAAUtB,KAIf,IAAMgE,EAAc,CAClB,CACEI,MAAO,mDACPF,KAAK,oKAMP,CACEE,MAAO,oCACPF,KAAK,mIAKP,CACEE,MAAO,qCACPF,KAAK,gUAQP,CACEE,MAAO,mDACPF,KAAK,4bAeP,CACEE,MAAO,oCACPF,KAAK,kZAoBP,CACEE,MAAO,8BACPF,KAAK","file":"component---src-pages-dev-sandbox-tsx-924ca291a49608609b66.js","sourcesContent":["import React, { useEffect } from \"react\"\nimport { isTouchDevice } from \"../lib/isTouchDevice\"\n\n/**\n * A React component which will remove its children (at runtime!)\n * from the hierarchy if we're on a touch device\n */\nexport const SuppressWhenTouch = ({ children, hideOnTouch }: any) => {\n\n useEffect(() => {\n if (isTouchDevice()) {\n // It's touch, so let's kill the content in the child and \n // replace it with a message that this section isn't good for mobile\n const suppressible = document.getElementById(\"touch-suppressible\")!\n while (suppressible.firstChild) {\n suppressible.removeChild(suppressible.firstChild)\n }\n\n if (hideOnTouch) return\n\n const h4 = document.createElement(\"h4\")\n h4.textContent = \"Section best on a computer\"\n\n const p = document.createElement(\"p\")\n p.textContent = \"This part of the site does not run well on a touch-oriented browser. We recommend switching to a computer to carry on.\"\n\n suppressible.appendChild(h4)\n suppressible.appendChild(p)\n }\n\n }, [])\n return (\n
\n A DOM library for interacting with TypeScript and JavaScript\n code, which powers the heart of the{\" \"}\n TypeScript playground\n
\nYou can use the TypeScript sandbox for:
\n\n For example, the sandbox to the side has grabbed the Types for{\" \"}\n DangerJS with no\n modifications for this code sample. This is because the\n Playground's Automatic Type Acquisition is enabled by default.\n It will also look for the same parameters for code, and\n selection indexes inside the URL.\n
\n\n Try clicking{\" \"}\n \n this URL\n {\" \"}\n to see that in action.{\" \"}\n
\n\n This library builds on top of the{\" \"}\n \n Monaco Editor\n \n , providing a higher level API but offering access to all the\n lower-level APIs via a single sandbox
object.\n
\n You can find the code for the TypeScript Sandbox inside the{\" \"}\n \n microsoft/TypeScript-Website\n {\" \"}\n mono-repo.\n
\n\n Downloading Sandbox...\n
\n\n A sandbox uses the same tools as monaco-editor, meaning this\n library is shipped as an AMD bundle which you can use the{\" \"}\n \n VSCode Loader\n {\" \"}\n to require
.\n
\n Because we need it for the TypeScript website, you can use our\n hosted copy{\" \"}\n \n here.\n \n
\n\n\n Create a new file: index.html
and paste this code\n into that file.\n
\n \n {`\n\n \n \n \n Loading...\n \n \n`}\n
\n
\n \n Opening the file index.html
in a web browser will\n load up the same sandbox up at the top of the page.\n
{code.blurb}
\n\n {code.code.trim()}
\n
\n \n The API is mainly a light shim over the{\" \"}\n \n monaco-editor API\n {\" \"}\n with the{\" \"}\n \n monaco-typescript API\n \n .\n
\n