howard 2021-04-19 00:30:59 -07:00
parent 6de49366a8
commit 6c8e87a4a3
7 changed files with 259 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -4,6 +4,47 @@ object-assign
@license MIT
*/
/**
* Checks if an event is supported in the current execution environment.
*
* NOTE: This will not work correctly for non-generic events such as `change`,
* `reset`, `load`, `error`, and `select`.
*
* Borrows from Modernizr.
*
* @param {string} eventNameSuffix Event name, e.g. "click".
* @return {boolean} True if the event is supported.
* @internal
* @license Modernizr 3.0.0pre (Custom Build) | MIT
*/
/** @license React v0.20.2
* scheduler-tracing.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v0.20.2
* scheduler-tracing.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v0.20.2
* scheduler.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v0.20.2
* scheduler.production.min.js
*
@ -13,6 +54,15 @@ object-assign
* LICENSE file in the root directory of this source tree.
*/
/** @license React v16.13.1
* react-is.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v16.13.1
* react-is.production.min.js
*
@ -22,6 +72,15 @@ object-assign
* LICENSE file in the root directory of this source tree.
*/
/** @license React v17.0.2
* react-dom.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v17.0.2
* react-dom.production.min.js
*
@ -31,6 +90,15 @@ object-assign
* LICENSE file in the root directory of this source tree.
*/
/** @license React v17.0.2
* react.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v17.0.2
* react.production.min.js
*

40
app.css
View File

@ -1,3 +1,7 @@
.bg-transparent {
background-color: transparent;
}
.bg-gray-700 {
--tw-bg-opacity: 1;
background-color: rgba(64, 64, 64, var(--tw-bg-opacity));
@ -13,6 +17,10 @@
border-color: rgba(250, 250, 250, var(--tw-border-opacity));
}
.border-0 {
border-width: 0px;
}
.border-t-0 {
border-top-width: 0px;
}
@ -69,6 +77,10 @@
height: 1.75rem;
}
.h-9 {
height: 2.25rem;
}
.h-full {
height: 100%;
}
@ -78,6 +90,20 @@
line-height: 1.25rem;
}
.text-lg {
font-size: 1.125rem;
line-height: 1.75rem;
}
.mx-1 {
margin-left: 0.25rem;
margin-right: 0.25rem;
}
.mr-2 {
margin-right: 0.5rem;
}
.mr-6 {
margin-right: 1.5rem;
}
@ -86,6 +112,11 @@
margin-left: auto;
}
.focus\:outline-none:focus {
outline: 2px solid transparent;
outline-offset: 2px;
}
.p-1 {
padding: 0.25rem;
}
@ -257,6 +288,15 @@ body {
color: rgba(229, 229, 229, var(--tw-text-opacity));
}
.active-btn {
cursor: pointer;
--tw-bg-opacity: 1;
background-color: rgba(52, 211, 153, var(--tw-bg-opacity));
fill: currentColor;
--tw-text-opacity: 1;
color: rgba(229, 229, 229, var(--tw-text-opacity))
}
.btn-green {
cursor: pointer;
background-color: transparent;

148
fs-helpers.js Normal file
View File

@ -0,0 +1,148 @@
/**
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
/* exported getFileHandle, getNewFileHandle, readFile, verifyPermission,
writeFile */
/**
* Open a handle to an existing file on the local file system.
*
* @return {!Promise<FileSystemFileHandle>} Handle to the existing file.
*/
function getFileHandle() {
// For Chrome 86 and later...
if ('showOpenFilePicker' in window) {
return window.showOpenFilePicker().then((handles) => handles[0]);
}
// For Chrome 85 and earlier...
return window.chooseFileSystemEntries();
}
/**
* Create a handle to a new (text) file on the local file system.
*
* @return {!Promise<FileSystemFileHandle>} Handle to the new file.
*/
function getNewFileHandle() {
// For Chrome 86 and later...
if ('showSaveFilePicker' in window) {
const opts = {
types: [{
description: 'Text file',
accept: {'text/plain': ['.txt']},
}],
};
return window.showSaveFilePicker(opts);
}
// For Chrome 85 and earlier...
const opts = {
type: 'save-file',
accepts: [{
description: 'Text file',
extensions: ['txt'],
mimeTypes: ['text/plain'],
}],
};
return window.chooseFileSystemEntries(opts);
}
/**
* Reads the raw text from a file.
*
* @param {File} file
* @return {!Promise<string>} A promise that resolves to the parsed string.
*/
function readFile(file) {
// If the new .text() reader is available, use it.
if (file.text) {
return file.text();
}
// Otherwise use the traditional file reading technique.
return _readFileLegacy(file);
}
/**
* Reads the raw text from a file.
*
* @private
* @param {File} file
* @return {Promise<string>} A promise that resolves to the parsed string.
*/
function _readFileLegacy(file) {
return new Promise((resolve) => {
const reader = new FileReader();
reader.addEventListener('loadend', (e) => {
const text = e.srcElement.result;
resolve(text);
});
reader.readAsText(file);
});
}
/**
* Writes the contents to disk.
*
* @param {FileSystemFileHandle} fileHandle File handle to write to.
* @param {string} contents Contents to write.
*/
async function writeFile(fileHandle, contents) {
// Support for Chrome 82 and earlier.
if (fileHandle.createWriter) {
// Create a writer (request permission if necessary).
const writer = await fileHandle.createWriter();
// Write the full length of the contents
await writer.write(0, contents);
// Close the file and write the contents to disk
await writer.close();
return;
}
// For Chrome 83 and later.
// Create a FileSystemWritableFileStream to write to.
const writable = await fileHandle.createWritable();
// Write the contents of the file to the stream.
await writable.write(contents);
// Close the file and write the contents to disk.
await writable.close();
}
/**
* Verify the user has granted permission to read or write to the file, if
* permission hasn't been granted, request permission.
*
* @param {FileSystemFileHandle} fileHandle File handle to check.
* @param {boolean} withWrite True if write permission should be checked.
* @return {boolean} True if the user has granted read/write permission.
*/
async function verifyPermission(fileHandle, withWrite) {
const opts = {};
if (withWrite) {
opts.writable = true;
// For Chrome 86 and later...
opts.mode = 'readwrite';
}
// Check if we already have permission, if so, return true.
if (await fileHandle.queryPermission(opts) === 'granted') {
return true;
}
// Request permission to the file, if the user grants permission, return true.
if (await fileHandle.requestPermission(opts) === 'granted') {
return true;
}
// The user did nt grant permission, return false.
return false;
}

View File

@ -25,6 +25,7 @@
<script src="app.bundle.js"></script>
<script src="scene.bundle.js"></script>
<script src="solver.js"></script>
<script src="fs-helpers.js"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

Binary file not shown.