1
0
Fork 0
mirror of https://github.com/voltbonn/profile-picture-generator.git synced 2024-12-23 00:05:09 +00:00
profile.volt.link/static/js/main.f98f9ce2.chunk.js.map
2021-01-21 19:58:36 +00:00

1 line
No EOL
12 KiB
Text

{"version":3,"sources":["frames lazy /^/.//.*/.png$/ groupOptions: {} namespace object","FrameChooser.js","HeaderImage.svg","App.js","reportWebVitals.js","index.js"],"names":["map","webpackAsyncContext","req","__webpack_require__","o","Promise","resolve","then","e","Error","code","ids","id","keys","Object","module","exports","FrameChooser","onFrameChange","useState","frames","setFrames","choosenFrame","setChoosenFrame","useEffect","a","all","frame_filename","name","src","new_frames","console","log","default","loadFrames","handleImageChoosing","useCallback","event","target","dataset","className","frame","frame_src_path","isChoosen","alt","data-src","onClick","frameSize","App","frameURL","setFrameURL","originalPhoto","setOriginalPhoto","photo","setPhoto","combinedImage","setCombinedImage","handleFrameURL","newFrameURL","handleImage","files_event","reader","FileReader","onload","reader_event","img","Image","offscreenCanvas","document","createElement","width","height","offscreenCanvas_ctx","getContext","alpha","drawImage","pngUrl","toDataURL","result","readAsDataURL","files","mergeImages","b64","HeaderImage","tabIndex","style","outline","onChange","type","accept","display","download","reportWebVitals","onPerfEntry","Function","getCLS","getFID","getFCP","getLCP","getTTFB","ReactDOM","render","StrictMode","getElementById"],"mappings":"qJAAA,IAAIA,EAAM,CACT,8BAA+B,CAC9B,GACA,GAED,+BAAgC,CAC/B,GACA,GAED,gCAAiC,CAChC,GACA,GAED,gCAAiC,CAChC,GACA,GAED,4BAA6B,CAC5B,GACA,GAED,8BAA+B,CAC9B,GACA,GAED,8BAA+B,CAC9B,GACA,IAED,gCAAiC,CAChC,GACA,IAED,iCAAkC,CACjC,GACA,KAGF,SAASC,EAAoBC,GAC5B,IAAIC,EAAoBC,EAAEJ,EAAKE,GAC9B,OAAOG,QAAQC,UAAUC,MAAK,WAC7B,IAAIC,EAAI,IAAIC,MAAM,uBAAyBP,EAAM,KAEjD,MADAM,EAAEE,KAAO,mBACHF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,SAAS,IAAIC,MAAO,CAACC,QAAQ,QAA5D,UACOjC,EAAQ,qBAAKxB,IAAKsB,EAAeP,IAAI,YAAe,KACvD,+BAASS,EAAQ,eAAiB,eAClC,uBAAOkC,SAAU5B,EAAa6B,KAAK,OAAOC,OAAO,UAAUJ,MAAO,CAACK,QAAS,aAGhF,cAAC,EAAD,CAAcxE,cAAeuC,IAE7B,sDACA,qBAAK5B,IAAK0B,EAAef,UAAU,gBAAgBI,IAAI,mBACvD,wBAAQE,QAAS,kBAAM6C,IAASpC,EAAe,2BAA4B,cAA3E,0CCxEOqC,EAZS,SAAAC,GAClBA,GAAeA,aAAuBC,UACxC,6BAAqBvF,MAAK,YAAkD,IAA/CwF,EAA8C,EAA9CA,OAAQC,EAAsC,EAAtCA,OAAQC,EAA8B,EAA9BA,OAAQC,EAAsB,EAAtBA,OAAQC,EAAc,EAAdA,QAC3DJ,EAAOF,GACPG,EAAOH,GACPI,EAAOJ,GACPK,EAAOL,GACPM,EAAQN,OCFdO,IAASC,OACP,cAAC,IAAMC,WAAP,UACE,cAAC,EAAD,MAEFlC,SAASmC,eAAe,SAM1BX,M","file":"static/js/main.f98f9ce2.chunk.js","sourcesContent":["var map = {\n\t\"./ProfileFrame B&G Bars.png\": [\n\t\t21,\n\t\t4\n\t],\n\t\"./ProfileFrame Blue Bars.png\": [\n\t\t22,\n\t\t5\n\t],\n\t\"./ProfileFrame Green Bars.png\": [\n\t\t23,\n\t\t6\n\t],\n\t\"./ProfileFrame Mixed Bars.png\": [\n\t\t24,\n\t\t7\n\t],\n\t\"./ProfileFrame Purple.png\": [\n\t\t25,\n\t\t8\n\t],\n\t\"./ProfileFrame R&Y Bars.png\": [\n\t\t26,\n\t\t9\n\t],\n\t\"./ProfileFrame Red Bars.png\": [\n\t\t27,\n\t\t10\n\t],\n\t\"./ProfileFrame White Bars.png\": [\n\t\t28,\n\t\t11\n\t],\n\t\"./ProfileFrame Yellow Bars.png\": [\n\t\t29,\n\t\t12\n\t]\n};\nfunction webpackAsyncContext(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\treturn Promise.resolve().then(function() {\n\t\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\t\te.code = 'MODULE_NOT_FOUND';\n\t\t\tthrow e;\n\t\t});\n\t}\n\n\tvar ids = map[req], id = ids[0];\n\treturn __webpack_require__.e(ids[1]).then(function() {\n\t\treturn __webpack_require__(id);\n\t});\n}\nwebpackAsyncContext.keys = function webpackAsyncContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackAsyncContext.id = 19;\nmodule.exports = webpackAsyncContext;","import { useState, useEffect, useCallback } from 'react'\n\nfunction FrameChooser({onFrameChange}) {\n const [frames, setFrames] = useState([])\n const [choosenFrame, setChoosenFrame] = useState(null)\n\n useEffect(() => {\n async function loadFrames(){\n Promise.all(\n [\n 'ProfileFrame Purple',\n 'ProfileFrame Yellow Bars',\n 'ProfileFrame Red Bars',\n 'ProfileFrame Blue Bars',\n 'ProfileFrame Green Bars',\n 'ProfileFrame White Bars',\n 'ProfileFrame Mixed Bars',\n 'ProfileFrame R&Y Bars',\n 'ProfileFrame B&G Bars',\n ]\n .map(async frame_filename => {\n return {\n name: frame_filename,\n src: await import(`./frames/${frame_filename}.png`),\n }\n })\n )\n .then(new_frames => {\n console.log(new_frames)\n setFrames(new_frames)\n setChoosenFrame(new_frames[0].src.default)\n })\n }\n loadFrames()\n }, [])\n\n const handleImageChoosing = useCallback(event => {\n setChoosenFrame(event.target.dataset.src)\n }, [setChoosenFrame])\n\n useEffect(() => {\n onFrameChange(choosenFrame)\n }, [onFrameChange, choosenFrame])\n\n return (\n <div className=\"FrameChooser\">\n <h2>Choose a frame:</h2>\n {\n frames.map(frame => {\n const frame_src_path = frame.src.default\n const isChoosen = choosenFrame === frame_src_path\n return <img alt={frame.name} key={frame_src_path} data-src={frame_src_path} src={frame_src_path} className={isChoosen ? 'frame choosen' : 'frame'} onClick={handleImageChoosing}/>\n })\n } \n </div>\n )\n}\n\nexport default FrameChooser;\n","export default __webpack_public_path__ + \"static/media/HeaderImage.f98423dd.svg\";","import { useState, useEffect, useCallback } from 'react'\nimport './App.css'\nimport download from 'downloadjs'\nimport FrameChooser from './FrameChooser.js'\nimport HeaderImage from './HeaderImage.svg'\n\nimport mergeImages from 'merge-images'\n\nconst frameSize = 1080\n\nfunction App() {\n const [frameURL, setFrameURL] = useState(null)\n const [originalPhoto, setOriginalPhoto] = useState(null)\n const [photo, setPhoto] = useState(null)\n const [combinedImage, setCombinedImage] = useState(null)\n\n const handleFrameURL = useCallback(newFrameURL => {\n setFrameURL(newFrameURL)\n }, [setFrameURL])\n\n const handleImage = useCallback(files_event => {\n const reader = new FileReader()\n reader.onload = reader_event => {\n const img = new Image()\n img.onload = function () {\n const offscreenCanvas = document.createElement('canvas')\n offscreenCanvas.width = frameSize\n offscreenCanvas.height = frameSize\n\n const offscreenCanvas_ctx = offscreenCanvas.getContext('2d', { alpha: true })\n\n let width, height;\n if (img.width < img.height) {\n height = (img.height / img.width) * frameSize\n width = frameSize\n } else {\n height = frameSize\n width = (img.width / img.height) * frameSize\n }\n \n offscreenCanvas_ctx.drawImage(\n img,\n (frameSize - width) / 2,\n (frameSize - height) / 2,\n width,\n height,\n );\n\n const pngUrl = offscreenCanvas.toDataURL()\n setPhoto(pngUrl)\n }\n img.src = reader_event.target.result\n setOriginalPhoto(reader_event.target.result)\n }\n reader.readAsDataURL(files_event.target.files[0])\n }, [setPhoto])\n\n useEffect(() => {\n mergeImages([\n ...(photo ? [photo] : []),\n ...(frameURL ? [frameURL] : []),\n ])\n .then(b64 => setCombinedImage(b64))\n }, [photo, frameURL])\n\n\n\nreturn (\n <div className=\"App\">\n <img src={HeaderImage} className=\"HeaderImage\" alt=\"Volt Logo\" />\n\n <h2>Choose your Photo:</h2>\n <p>It should best be a square image or your face in the middle. The photo is not saved and never leaves your computer.</p>\n\n <label className=\"labelButton\" tabIndex=\"0\" style={{outline:'none'}}>\n {!!photo ? <img src={originalPhoto} alt=\"Preview\" /> : null}\n <span>{!!photo ? 'Change Photo' : 'Load Photo'}</span>\n <input onChange={handleImage} type=\"file\" accept=\"image/*\" style={{display: 'none'}} />\n </label>\n\n <FrameChooser onFrameChange={handleFrameURL} />\n \n <h2>Download your Photo:</h2>\n <img src={combinedImage} className=\"FinishedFrame\" alt=\"Finished Frame\" />\n <button onClick={() => download(combinedImage, \"volt-profile-picture.png\", \"image/png\")}>Download Profile Picture</button>\n </div>\n)\n}\n\nexport default App;\n","const reportWebVitals = onPerfEntry => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry);\n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n};\n\nexport default reportWebVitals;\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport App from './App';\nimport reportWebVitals from './reportWebVitals';\n\nReactDOM.render(\n <React.StrictMode>\n <App />\n </React.StrictMode>,\n document.getElementById('root')\n);\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals();\n"],"sourceRoot":""}