-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modules/webpack conversion. #58
Closed
+9,045
−196,036
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ef2a708
Converts project to being bundled by webpack
a7a005b
Update webpack to build prod
4726e74
Fix caching
78a70cb
Fix step export and service worker registering
24f9037
Try service worker webpack plugin
d464170
Clean up couple more things I noticed
65da625
Keep function names
1eccb08
File file select
26196c4
Merge remote-tracking branch 'upstream/master' into kurt/webpack
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"modules": false | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"rules": {}, | ||
"env": { | ||
"es6": true, | ||
"browser": true | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module" | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:prettier/recommended" | ||
], | ||
"globals": { | ||
"Atomics": "readonly", | ||
"SharedArrayBuffer": "readonly" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,80 +10,27 @@ | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta name="theme-color" content="#1e1e1e"> | ||
|
||
<!-- Include these early and directly so they happen first --> | ||
<script> | ||
// Install Cascade Studio as a Progressive Web App for Offline Access | ||
// This needs to be put before ANY HTTP Requests are made, so it can cache them. | ||
if ('serviceWorker' in navigator) { | ||
navigator.serviceWorker.register('service-worker.js').then(function(registration) { | ||
registration.update(); // Always update the registration for the latest assets | ||
}, function() { | ||
console.log('Could not register Cascade Studio for offline use!'); | ||
}); | ||
} else { | ||
console.log('Browser does not support offline access!'); | ||
} | ||
<link rel='shortcut icon' href='icon/favicon.ico' type='image/x-icon' > | ||
<link rel="manifest" href="manifest.webmanifest"> | ||
<link rel="apple-touch-icon" href="icon/apple-touch-icon.png"> | ||
|
||
// Begins loading the CAD Kernel Web Worker | ||
if (window.Worker) { | ||
var cascadeStudioWorker = new Worker('./js/CADWorker/CascadeStudioMainWorker.js'); | ||
// Ping Pong Messages Back and Forth based on their registration in messageHandlers | ||
var messageHandlers = {}; | ||
cascadeStudioWorker.onmessage = function (e) { | ||
if(e.data.type in messageHandlers){ | ||
let response = messageHandlers[e.data.type](e.data.payload); | ||
if (response) { cascadeStudioWorker.postMessage({ "type": e.data.type, payload: response }) }; | ||
} | ||
} | ||
} | ||
Comment on lines
-28
to
-38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worker init code has been moved into its own file |
||
</script> | ||
|
||
<link rel='shortcut icon' href='./icon/favicon.ico' type='image/x-icon' > | ||
<link rel="manifest" href="./manifest.webmanifest"> | ||
<link rel="apple-touch-icon" href="./icon/apple-touch-icon.png"> | ||
|
||
<script type="text/javascript" src="./node_modules/three/build/three.min.js"></script> | ||
<script type="text/javascript" src="./node_modules/three/examples/js/controls/DragControls.js"></script> | ||
<script type="text/javascript" src="./node_modules/three/examples/js/controls/OrbitControls.js"></script> | ||
<script type="text/javascript" src="./node_modules/three/examples/js/controls/TransformControls.js"></script> | ||
<script type="text/javascript" src="./node_modules/three/examples/js/exporters/STLExporter.js"></script> | ||
<script type="text/javascript" src="./node_modules/three/examples/js/exporters/OBJExporter.js"></script> | ||
|
||
<script type="text/javascript" src="./node_modules/controlkit/bin/controlKit.min.js"></script> | ||
|
||
<script type="text/javascript" src="./node_modules/jquery/dist/jquery.min.js"></script> | ||
<script type="text/javascript" src="./node_modules/golden-layout/dist/goldenlayout.min.js"></script> | ||
<link type="text/css" rel="stylesheet" href="./node_modules/golden-layout/src/css/goldenlayout-base.css" /> | ||
<link type="text/css" rel="stylesheet" href="./node_modules/golden-layout/src/css/goldenlayout-dark-theme.css" /> | ||
<link type="text/css" rel="stylesheet" href="./css/main.css" /> | ||
|
||
<script type="text/javascript" src="./node_modules/rawflate/rawdeflate.js"></script> | ||
<script type="text/javascript" src="./node_modules/rawflate/rawinflate.js"></script> | ||
<script type="text/javascript" src="./js/MainPage/CascadeViewHandles.js"></script> | ||
<script type="text/javascript" src="./js/MainPage/CascadeView.js"></script> | ||
</head> | ||
|
||
<body onload="initialize();" style="margin:0px; background-color:rgb(34, 34, 34); "><!--overflow:hidden; position:fixed;--> | ||
<body style="margin:0px; background-color:rgb(34, 34, 34); "><!--overflow:hidden; position:fixed;--> | ||
<h1 hidden></h1> <!-- Puts the Lighthouse Score over 90 heheh--> | ||
<div id="topnav" class="topnav"> | ||
<a href="https://github.com/zalo/CascadeStudio">Cascade Studio 0.0.6</a> | ||
<a href="#" title="Save Project to .json" onmouseup="saveProject();">Save Project</a> | ||
<a href="#" title="Load Project from .json" onmouseup="loadProject();">Load Project</a> | ||
<a href="#" onmouseup="threejsViewport.saveShapeSTEP();">Save STEP</a> | ||
<a href="#" onmouseup="threejsViewport.saveShapeSTL();">Save STL</a> | ||
<a href="#" onmouseup="threejsViewport.saveShapeOBJ();">Save OBJ</a> | ||
<a href="#" id="save-project" title="Save Project to .json">Save Project</a> | ||
<a href="#" id="load-project" title="Load Project from .json">Load Project</a> | ||
<a href="#" id="save-step">Save STEP</a> | ||
<a href="#" id="save-stl">Save STL</a> | ||
<a href="#" id="save-obj">Save OBJ</a> | ||
<label for="files" title="Import STEP, IGES, or (ASCII) STL from File">Import STEP/IGES/STL | ||
<input id="files" name="files" type="file" accept=".iges,.step,.igs,.stp,.stl" multiple style="display:none;" oninput="loadFiles();"/> | ||
<input id="files" name="files" type="file" accept=".iges,.step,.igs,.stp,.stl" multiple style="display:none;"/> | ||
</label> | ||
<a href="#" title="Clears the external step/iges/stl files stored in the project." onmouseup="clearExternalFiles();">Clear Imported Files</a> | ||
<a href="#" id="clear-external-files" title="Clears the external step/iges/stl files stored in the project.">Clear Imported Files</a> | ||
</div> | ||
<div id="appbody" style="height:auto"> | ||
<link data-name="vs/editor/editor.main" rel="stylesheet" href="./node_modules/monaco-editor/min/vs/editor/editor.main.css"> | ||
<script>var require = { paths: { 'vs': 'node_modules/monaco-editor/min/vs' } };</script> | ||
<script type="text/javascript" src="./node_modules/monaco-editor/min/vs/loader.js"></script> | ||
<script type="text/javascript" src="./node_modules/monaco-editor/min/vs/editor/editor.main.nls.js"></script> | ||
<script type="text/javascript" src="./node_modules/monaco-editor/min/vs/editor/editor.main.js"></script> | ||
<script type="text/javascript" src="./js/MainPage/CascadeMain.js"></script> | ||
</div> | ||
|
||
</body> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import openType from "opentype.js"; | ||
|
||
export const fonts = {}; | ||
|
||
// Preload the Various Fonts that are available via Text3D | ||
var preloadedFonts = [ | ||
"fonts/Roboto.ttf", | ||
"fonts/Papyrus.ttf", | ||
"fonts/Consolas.ttf" | ||
]; | ||
|
||
Promise.all(preloadedFonts.map(async fontURL => fetch("/" + fontURL))).then( | ||
async responses => { | ||
const arrayBuffers = await Promise.all( | ||
responses.map(response => response.arrayBuffer()) | ||
); | ||
arrayBuffers.forEach((buffer, index) => { | ||
let fontName = preloadedFonts[index].split("fonts/")[1].split(".ttf")[0]; | ||
fonts[fontName] = openType.parse(buffer); | ||
}); | ||
} | ||
); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code has been moved to
index.js
which is the entry file for the js