diff --git a/index.html b/index.html index a9cde9c..133ac8f 100644 --- a/index.html +++ b/index.html @@ -198,7 +198,7 @@ ChucK API Reference
  • - WebChucK Docs + Learn WebChucK
  • Discord Community @@ -214,10 +214,7 @@
  • - Learn WebChucK -
  • -
  • - +
  • diff --git a/src/components/chuckBar.ts b/src/components/chuckBar/chuckBar.ts similarity index 92% rename from src/components/chuckBar.ts rename to src/components/chuckBar/chuckBar.ts index e4033ce..4367d78 100644 --- a/src/components/chuckBar.ts +++ b/src/components/chuckBar/chuckBar.ts @@ -15,11 +15,10 @@ //-------------------------------------------------------------------- import { theChuck, startChuck, connectMic } from "@/host"; -import Editor from "@/components/monaco/editor"; +import Editor from "@/components/editor/monaco/editor"; import VmMonitor from "@/components/vmMonitor"; -import Recorder, { RecordState } from "@/components/recorder"; -import Console from "@/components/console"; - +import Recorder, { RecordState } from "./recorder"; +import Console from "@/components/outputPanel/console"; // detect operating system const isWindows = navigator.userAgent.includes("Windows"); @@ -83,9 +82,12 @@ export default class ChuckBar { static runEditorCode() { theChuck?.runCode(Editor.getEditorCode()).then( // Success - (shredID: number) => { + (shredID: number) => { VmMonitor.addShredRow(shredID); - Console.print("[chuck]: \x1b[32m" + `(VM) sporking incoming shred: ${shredID} (compiled.code)...\x1b[0m`) + Console.print( + "[chuck]: \x1b[32m" + + `(VM) sporking incoming shred: ${shredID} (compiled.code)...\x1b[0m` + ); }, () => {} // Failure, do nothing ); diff --git a/src/components/recorder.ts b/src/components/chuckBar/recorder.ts similarity index 97% rename from src/components/recorder.ts rename to src/components/chuckBar/recorder.ts index 5bb17e9..65bcd6b 100644 --- a/src/components/recorder.ts +++ b/src/components/chuckBar/recorder.ts @@ -10,9 +10,9 @@ // date: April 2024 //-------------------------------------------------------- -import Console from "./console"; -import ProjectSystem from "./fileExplorer/projectSystem"; -import VmMonitor from "./vmMonitor"; +import Console from "@components/outputPanel/console"; +import ProjectSystem from "@components/fileExplorer/projectSystem"; +import VmMonitor from "@components/vmMonitor"; export enum RecordState { stopped = 0, diff --git a/src/components/panelHeader/editorPanelHeader.ts b/src/components/editor/editorPanelHeader.ts similarity index 100% rename from src/components/panelHeader/editorPanelHeader.ts rename to src/components/editor/editorPanelHeader.ts diff --git a/src/components/monaco/chuck-modules.ts b/src/components/editor/monaco/chuck-modules.ts similarity index 100% rename from src/components/monaco/chuck-modules.ts rename to src/components/editor/monaco/chuck-modules.ts diff --git a/src/components/monaco/ckdoc.json b/src/components/editor/monaco/ckdoc.json similarity index 100% rename from src/components/monaco/ckdoc.json rename to src/components/editor/monaco/ckdoc.json diff --git a/src/components/monaco/editor.ts b/src/components/editor/monaco/editor.ts similarity index 96% rename from src/components/monaco/editor.ts rename to src/components/editor/monaco/editor.ts index cf657cf..5233855 100644 --- a/src/components/monaco/editor.ts +++ b/src/components/editor/monaco/editor.ts @@ -7,17 +7,17 @@ // date: May 2023 //------------------------------------------------------------------ -import ChuckBar from "@components/chuckBar"; +import ChuckBar from "@/components/chuckBar/chuckBar"; import { monaco } from "./monacoLite"; import { editorConfig } from "./chuck-lang"; import { initVimMode, VimMode } from "monaco-vim"; import { miniAudicleLight, miniAudicleDark } from "./miniAudicleTheme"; import { File, fetchTextFile } from "@/utils/fileLoader"; -import EditorPanelHeader from "@components/panelHeader/editorPanelHeader"; -import Console from "@components/console"; -import ProjectSystem from "../fileExplorer/projectSystem"; -import GUI from "@components/gui/gui"; +import EditorPanelHeader from "@/components/editor/editorPanelHeader"; +import Console from "@/components/outputPanel/console"; +import ProjectSystem from "../../fileExplorer/projectSystem"; +import GUI from "@/components/inputPanel/gui/gui"; // Constants const HEADER_HEIGHT: string = "2rem"; diff --git a/src/components/monaco/miniAudicleTheme.ts b/src/components/editor/monaco/miniAudicleTheme.ts similarity index 100% rename from src/components/monaco/miniAudicleTheme.ts rename to src/components/editor/monaco/miniAudicleTheme.ts diff --git a/src/components/monaco/monaco-vim.d.ts b/src/components/editor/monaco/monaco-vim.d.ts similarity index 100% rename from src/components/monaco/monaco-vim.d.ts rename to src/components/editor/monaco/monaco-vim.d.ts diff --git a/src/components/monaco/monacoLite.ts b/src/components/editor/monaco/monacoLite.ts similarity index 100% rename from src/components/monaco/monacoLite.ts rename to src/components/editor/monaco/monacoLite.ts diff --git a/src/components/fileExplorer/projectFile.ts b/src/components/fileExplorer/projectFile.ts index da4ccda..2fd0e08 100644 --- a/src/components/fileExplorer/projectFile.ts +++ b/src/components/fileExplorer/projectFile.ts @@ -7,7 +7,7 @@ //------------------------------------------------------------------ import { isPlaintextFile } from "webchuck/dist/utils"; -import Editor from "@components/monaco/editor"; +import Editor from "@/components/editor/monaco/editor"; export default class ProjectFile { private readonly filename: string; diff --git a/src/components/fileExplorer/projectSystem.ts b/src/components/fileExplorer/projectSystem.ts index 874be53..e82198f 100644 --- a/src/components/fileExplorer/projectSystem.ts +++ b/src/components/fileExplorer/projectSystem.ts @@ -14,7 +14,7 @@ import { fetchDataFile, fetchTextFile, } from "@/utils/fileLoader"; -import Console from "../console"; +import Console from "../outputPanel/console"; import ProjectFile from "./projectFile"; export default class ProjectSystem { diff --git a/src/components/gui/eventButton.ts b/src/components/inputPanel/gui/eventButton.ts similarity index 100% rename from src/components/gui/eventButton.ts rename to src/components/inputPanel/gui/eventButton.ts diff --git a/src/components/gui/floatSlider.ts b/src/components/inputPanel/gui/floatSlider.ts similarity index 100% rename from src/components/gui/floatSlider.ts rename to src/components/inputPanel/gui/floatSlider.ts diff --git a/src/components/gui/gui.ts b/src/components/inputPanel/gui/gui.ts similarity index 99% rename from src/components/gui/gui.ts rename to src/components/inputPanel/gui/gui.ts index 8ceccb2..da895d1 100644 --- a/src/components/gui/gui.ts +++ b/src/components/inputPanel/gui/gui.ts @@ -7,7 +7,7 @@ // date: March 2024 //--------------------------------------------------------- -import Editor from "@components/monaco/editor"; +import Editor from "@/components/editor/monaco/editor"; import EventButton from "./eventButton"; import FloatSlider from "./floatSlider"; import { getColorScheme } from "@/utils/theme"; diff --git a/src/components/hidPanel.ts b/src/components/inputPanel/hidPanel.ts similarity index 100% rename from src/components/hidPanel.ts rename to src/components/inputPanel/hidPanel.ts diff --git a/src/components/inputPanel/inputMonitor.ts b/src/components/inputPanel/inputMonitor.ts new file mode 100644 index 0000000..1ceeeee --- /dev/null +++ b/src/components/inputPanel/inputMonitor.ts @@ -0,0 +1,96 @@ +import NavBar from "./navbar"; + +// Keep track of current open dropdown +let currentDropdown: Dropdown | null = null; + +/** + * Dropdown class + * @class Dropdown + * @param {HTMLDivElement} container - The container div + * @param {HTMLButtonElement} button - The button element + * @param {HTMLDivElement} dropdown - The dropdown div + * @param {boolean} open - Whether the dropdown is open or not + */ +export default class Dropdown { + public container: HTMLDivElement; + public button: HTMLButtonElement; + public dropdown: HTMLDivElement; + + private open: boolean = false; + + constructor( + container: HTMLDivElement, + button: HTMLButtonElement, + dropdown: HTMLDivElement + ) { + this.container = container; + this.button = button; + this.dropdown = dropdown; + + // Open and Close + this.button.addEventListener("click", (/* event: MouseEvent */) => { + // TODO: Fix this, shouldn't need to stop propagation + // event?.stopPropagation(); + if (currentDropdown && currentDropdown !== this) { + currentDropdown.close(); + } + // Get the position of the button + const pos = this.button.getBoundingClientRect(); + // Set the position of the dropdown relative to the button + this.dropdown.style.left = `${pos.left}px`; + this.dropdown.style.top = `${pos.bottom}px`; + + this.toggle(); + // eslint-disable-next-line @typescript-eslint/no-this-alias + currentDropdown = this; + }); + + this.container.addEventListener("click", () => { + const mouseLeaveHandler = () => { + this.close(); + this.container.removeEventListener( + "mouseleave", + mouseLeaveHandler + ); + }; + this.container.addEventListener("mouseleave", mouseLeaveHandler); + }); + + document.addEventListener("click", (event: MouseEvent) => { + if ( + !this.button.contains(event.target as Node) && + !this.container.contains(event.target as Node) + ) { + this.close(); + } + }); + + // Move the dropdown when navbar scrolls + NavBar.navbar.addEventListener("scroll", () => { + const pos = this.button.getBoundingClientRect(); + this.dropdown.style.left = `${pos.left}px`; + this.dropdown.style.top = `${pos.bottom}px`; + }); + } + + toggle() { + if (this.open) { + this.close(); + this.open = false; + return; + } + // set focus to file button + this.button.focus(); + this.open = true; + this.dropdown.classList.remove("hidden"); + } + + close() { + if (!this.open) return; + this.open = false; + this.dropdown.classList.add("hidden"); + if (currentDropdown === this) { + currentDropdown = null; + } + } +} diff --git a/src/components/panelHeader/inputPanelHeader.ts b/src/components/inputPanel/inputPanelHeader.ts similarity index 97% rename from src/components/panelHeader/inputPanelHeader.ts rename to src/components/inputPanel/inputPanelHeader.ts index 32561df..9d665a1 100644 --- a/src/components/panelHeader/inputPanelHeader.ts +++ b/src/components/inputPanel/inputPanelHeader.ts @@ -1,5 +1,5 @@ import InputHeaderToggle from "@components/toggle/inputHeaderToggle"; -import GUI from "@components/gui/gui"; +import GUI from "@/components/inputPanel/gui/gui"; import { openInputPanel } from "@/utils/appLayout"; export default class InputPanelHeader { diff --git a/src/components/monaco/chuck-lang.ts b/src/components/monaco/chuck-lang.ts deleted file mode 100644 index 7ba4291..0000000 --- a/src/components/monaco/chuck-lang.ts +++ /dev/null @@ -1,387 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/ban-ts-comment - -import { monaco } from "./monacoLite"; -import { chuck_modules, chuck_libraries } from "./chuck-modules"; -import ckdocJSON from "./ckdoc.json"; - -// Documentation Type for ckdoc -interface docType { - title: string; - description: string; - constructors: string[]; - functions: string[]; - examples: string[]; - link: string; -} -const ckdoc: { [key: string]: docType } = ckdocJSON; - -// Register a new language for Monaco -monaco.languages.register({ id: "chuck" }); - -// Register a tokens provider for the language -monaco.languages.setMonarchTokensProvider("chuck", { - // Set defaultToken to invalid to see what you do not tokenize yet - // defaultToken: 'invalid', - - keywords: [ - "if", - "else", - "while", - "until", - "for", - "repeat", - "break", - "continue", - "return", - "switch", - "class", - "extends", - "public", - "static", - "pure", - "this", - "super", - "interface", - "implements", - "protected", - "private", - "function", - "fun", - "spork", - "new", - "const", - "global", - "now", - "true", - "false", - "maybe", - "null", - "NULL", - "me", - "pi", - "samp", - "ms", - "second", - "minute", - "hour", - "day", - "week", - "eon", - "dac", - "adc", - "blackhole", - "bunghole", - ], - - typeKeywords: [ - "int", - "float", - "time", - "dur", - "void", - "vec3", - "vec4", - "complex", - "polar", - "string", - ], - - library: ["Object", "Event", "Shred", "Math", "Machine", "Std"], - - operators: [ - "++", - "--", - ":", - "+", - "-", - "*", - "/", - "%", - "::", - "==", - "!=", - "<", - ">", - "<=", - ">=", - "&&", - "||", - "&", - "|", - "^", - ">>", - "<<", - "=", - "?", - "!", - "~", - "<<<", - ">>>", - "=>", - "!=>", - "=^", - "=v", - "@=>", - "+=>", - "-=>", - "*=>", - "/=>", - "&=>", - "|=>", - "^=>", - ">>=>", - "<<=>", - "%=>", - "@", - "@@", - "->", - "<-", - ], - - ugens: chuck_modules, - - // we include these common regular expressions - symbols: /[=>](?!@symbols)/, "@brackets"], - [ - /@symbols/, - { - cases: { - "@operators": "operator", - "@default": "", - }, - }, - ], - - // @ annotations. - // As an example, we emit a debugging log message on these tokens. - // Note: message are supressed during the first load -- change some lines to see them. - [/@\s*[a-zA-Z_$][\w$]*/, { token: "annotation" }], - - // numbers - [/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"], - [/0[xX][0-9a-fA-F]+/, "number.hex"], - [/\d+/, "number"], - - // delimiter: after number because of .\d floats - [/[;,.]/, "delimiter"], - - // strings - [/"([^"\\]|\\.)*$/, "string.invalid"], // non-teminated string - [/"/, { token: "string.quote", bracket: "@open", next: "@string" }], - - // characters - [/'[^\\']'/, "string"], - [/(')(@escapes)(')/, ["string", "string.escape", "string"]], - [/'/, "string.invalid"], - ], - - comment: [ - [/[^\/*]+/, "comment"], - [/\/\*/, "comment", "@push"], // nested comment - ["\\*/", "comment", "@pop"], - [/[\/*]/, "comment"], - ], - - string: [ - [/[^\\"]+/, "string"], - [/@escapes/, "string.escape"], - [/\\./, "string.escape.invalid"], - [/"/, { token: "string.quote", bracket: "@close", next: "@pop" }], - ], - - whitespace: [ - [/[ \t\r\n]+/, "white"], - [/\/\*/, "comment", "@comment"], - [/\/\/.*$/, "comment"], - ], - }, -}); - -// Register comment support for the new language -monaco.languages.setLanguageConfiguration("chuck", { - comments: { - lineComment: "//", - blockComment: ["/*", "*/"], - }, -}); - -// Register a completion item provider for the new language -monaco.languages.registerCompletionItemProvider("chuck", { - provideCompletionItems: (model, position) => { - const word = model.getWordUntilPosition(position); - const range = { - startLineNumber: position.lineNumber, - endLineNumber: position.lineNumber, - startColumn: word.startColumn, - endColumn: word.endColumn, - }; - - const textUntilPosition = model.getValueInRange({ - startLineNumber: 1, - startColumn: 1, - endLineNumber: position.lineNumber, - endColumn: position.column, - }); - - const statement_suggestions = [ - { - label: "random", - kind: monaco.languages.CompletionItemKind.Keyword, - insertText: "Math.random2f(${1:condition})", - insertTextRules: - monaco.languages.CompletionItemInsertTextRule - .InsertAsSnippet, - range: range, - }, - { - label: "ifelse", - kind: monaco.languages.CompletionItemKind.Snippet, - insertText: [ - "if (${1:condition}) {", - "\t$0", - "} else {", - "\t", - "}", - ].join("\n"), - insertTextRules: - monaco.languages.CompletionItemInsertTextRule - .InsertAsSnippet, - documentation: "If-Else Statement", - range: range, - }, - { - label: "for", - kind: monaco.languages.CompletionItemKind.Snippet, - insertText: [ - "for (0 => int i; i < ${1:condition}; ++i)", - "{", - "\t$0", - "}", - ].join("\n"), - insertTextRules: - monaco.languages.CompletionItemInsertTextRule - .InsertAsSnippet, - documentation: "For Statement", - range: range, - }, - { - label: "while", - kind: monaco.languages.CompletionItemKind.Snippet, - insertText: ["while (${1:condition})", "{", "\t$0", "}"].join( - "\n" - ), - insertTextRules: - monaco.languages.CompletionItemInsertTextRule - .InsertAsSnippet, - documentation: "While Statement", - range: range, - }, - ]; - - const words = textUntilPosition - .split(/\W+/) - .concat(chuck_modules) - .filter( - (word) => - !statement_suggestions.map((s) => s.label).includes(word) - ); - const uniqueWords = Array.from(new Set(words)); - const word_suggestions = uniqueWords.map((word) => ({ - label: word, - kind: monaco.languages.CompletionItemKind.Text, - insertText: word, - range: range, - })); - - var suggestions = word_suggestions.concat(statement_suggestions); - return { suggestions: suggestions }; - }, -}); - -// Register a hover provider for the new language -monaco.languages.registerHoverProvider("chuck", { - provideHover: function (model, position) { - // Get the word at current mouse position - const word: monaco.editor.IWordAtPosition = - model.getWordAtPosition(position)!; // ! TS check that word is not null - const token: string = word?.word; - - // If we have a hover for that word - // if (chuck_modules.includes(token)) { - if (ckdoc[token]) { - const word_doc: docType = ckdoc[token]; - return { - // Where to show the hover - range: new monaco.Range( - position.lineNumber, - word.startColumn, - position.lineNumber, - word.endColumn - ), - // Hover contents - contents: [ - { - value: word_doc.title, - }, - { - value: word_doc.description, - }, - { - value: word_doc.constructors.join("\n\n"), - }, - { - value: word_doc.functions.join("\n\n"), - }, - { - value: word_doc.examples.join("\n\n"), - }, - { - value: word_doc.link, - }, - ], - }; - } - - // If we don't have a hover - return null; - }, -}); - -export const editorConfig = monaco.editor.createModel("", "chuck"); diff --git a/src/components/navbar/navbar.ts b/src/components/navbar/navbar.ts index a8a18fa..9ea4cc5 100644 --- a/src/components/navbar/navbar.ts +++ b/src/components/navbar/navbar.ts @@ -8,7 +8,7 @@ import Dropdown from "@/components/navbar/dropdown"; import NestedDropdown from "./nestedDropdown"; -import Console from "@/components/console"; +import Console from "@/components/outputPanel/console"; import { version } from "@/../package.json"; import { chuckVersion } from "@/host"; diff --git a/src/components/console.ts b/src/components/outputPanel/console.ts similarity index 100% rename from src/components/console.ts rename to src/components/outputPanel/console.ts diff --git a/src/components/panelHeader/outputPanelHeader.ts b/src/components/outputPanel/outputPanelHeader.ts similarity index 97% rename from src/components/panelHeader/outputPanelHeader.ts rename to src/components/outputPanel/outputPanelHeader.ts index efc73f6..4b7a9d2 100644 --- a/src/components/panelHeader/outputPanelHeader.ts +++ b/src/components/outputPanel/outputPanelHeader.ts @@ -1,4 +1,4 @@ -import Console from "@/components/console"; +import Console from "@/components/outputPanel/console"; import OutputHeaderToggle from "@components/toggle/outputHeaderToggle"; import { visual } from "@/host"; import { openOutputPanel } from "@/utils/appLayout"; diff --git a/src/components/visualizer.ts b/src/components/outputPanel/visualizer.ts similarity index 96% rename from src/components/visualizer.ts rename to src/components/outputPanel/visualizer.ts index c4795f8..9efbdbf 100644 --- a/src/components/visualizer.ts +++ b/src/components/outputPanel/visualizer.ts @@ -1,7 +1,9 @@ //-------------------------------------------------- -// title: visualizer -// desc: audio visualizer for webchuck output -// uses web audio api, WebAnalyzerNode +// title: Visualizer +// desc: Audio visualizer for WebChucK output +// Uses Web Audio API's AnalyzerNode +// https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode +// // author: terry feng (original from celeste betancur) // date: November 2023 //-------------------------------------------------- diff --git a/src/components/resizer.ts b/src/components/resizer.ts index 3a8637b..fda27a3 100644 --- a/src/components/resizer.ts +++ b/src/components/resizer.ts @@ -3,10 +3,10 @@ import { setAppColumnWidths, setContainerRowHeights, } from "@utils/appLayout"; -import Editor from "@components/monaco/editor"; -import Console from "@/components/console"; +import Editor from "@/components/editor/monaco/editor"; +import Console from "@/components/outputPanel/console"; import { visual } from "@/host"; -import GUI from "./gui/gui"; +import GUI from "./inputPanel/gui/gui"; /** * Resizer class draggable splitters in App (the main section of the IDE) diff --git a/src/components/settings.ts b/src/components/settings.ts index fefd348..2a66d33 100644 --- a/src/components/settings.ts +++ b/src/components/settings.ts @@ -1,3 +1,11 @@ +//--------------------------------------------------- +// title: Settings +// desc: IDE settings modal for ChucK versions +// +// author: terry feng +// date: April 2024 +//--------------------------------------------------- + import { selectChuckSrc } from "@/host"; const versionString = Object.freeze({ diff --git a/src/components/toggle/inputHeaderToggle.ts b/src/components/toggle/inputHeaderToggle.ts index 669b983..7b5a1e3 100644 --- a/src/components/toggle/inputHeaderToggle.ts +++ b/src/components/toggle/inputHeaderToggle.ts @@ -14,7 +14,7 @@ import { TEXT_COLOR_CLASS, } from "@/utils/theme"; import HeaderToggle from "./headerToggle"; -import InputPanelHeader from "../panelHeader/inputPanelHeader"; +import InputPanelHeader from "../inputPanel/inputPanelHeader"; export default class InputHeaderToggle extends HeaderToggle { public tabIndex: number; diff --git a/src/components/toggle/outputHeaderToggle.ts b/src/components/toggle/outputHeaderToggle.ts index bab8f2c..7da5240 100644 --- a/src/components/toggle/outputHeaderToggle.ts +++ b/src/components/toggle/outputHeaderToggle.ts @@ -6,7 +6,7 @@ // author: terry feng // date: December 2023 //--------------------------------------------------------- -import OutputPanelHeader from "@/components/panelHeader/outputPanelHeader"; +import OutputPanelHeader from "@/components/outputPanel/outputPanelHeader"; import { ACCENT_COLOR_CLASS, DARK_HOVER_COLOR_CLASS, diff --git a/src/components/vmMonitor.ts b/src/components/vmMonitor.ts index 52bca89..da7287a 100644 --- a/src/components/vmMonitor.ts +++ b/src/components/vmMonitor.ts @@ -9,10 +9,10 @@ import { getChuckNow, sampleRate, theChuck } from "@/host"; import { displayFormatTime, samplesToTimeHMSS } from "@/utils/time"; -import Editor from "@components/monaco/editor"; +import Editor from "@/components/editor/monaco/editor"; /** - * VmMonitor Class for handling VM time and shred table + * Vm Monitor Class for handling VM time and shred table */ export default class VmMonitor { public static vmContainer: HTMLDivElement; diff --git a/src/host.ts b/src/host.ts index f552a42..e8c6734 100644 --- a/src/host.ts +++ b/src/host.ts @@ -14,12 +14,12 @@ import { Chuck, HID } from "webchuck"; import { calculateDisplayDigits } from "@utils/time"; import { ChuckNow } from "@/components/vmMonitor"; import { loadWebChugins } from "@/utils/webChugins"; -import Console from "@/components/console"; -import Visualizer from "@/components/visualizer"; -import HidPanel from "@/components/hidPanel"; -import ChuckBar from "@/components/chuckBar"; +import Console from "@/components/outputPanel/console"; +import Visualizer from "@/components/outputPanel/visualizer"; +import HidPanel from "@/components/inputPanel/hidPanel"; +import ChuckBar from "@/components/chuckBar/chuckBar"; import ProjectSystem from "@/components/fileExplorer/projectSystem"; -import Recorder from "@/components/recorder"; +import Recorder from "@/components/chuckBar/recorder"; import NavBar from "./components/navbar/navbar"; // WebChucK source @@ -142,28 +142,34 @@ export async function startChuck() { // TODO: EZScore HACKS @terryfeng @alexhan try { - await Promise.all([ - theChuck - .loadFile( - "https://raw.githubusercontent.com/tae1han/ChucKTonal/main/src/ezchord.ck" - ) - .then(() => theChuck.runFile("ezchord.ck")), - theChuck - .loadFile( - "https://raw.githubusercontent.com/tae1han/ChucKTonal/main/src/ezscore.ck" - ) - .then(() => theChuck.runFile("ezscore.ck")), - theChuck - .loadFile( - "https://raw.githubusercontent.com/tae1han/ChucKTonal/main/src/ezscale.ck" - ) - .then(() => theChuck.runFile("ezscale.ck")), - theChuck - .loadFile( - "https://raw.githubusercontent.com/tae1han/ChucKTonal/main/src/scoreplayer.ck" - ) - .then(() => theChuck.runFile("scoreplayer.ck")), - ]); + await theChuck + .loadFile( + "https://raw.githubusercontent.com/tae1han/ChucKTonal/main/src/ezchord.ck" + ) + .then(() => { + theChuck.runFile("ezchord.ck"); + }); + await theChuck + .loadFile( + "https://raw.githubusercontent.com/tae1han/ChucKTonal/main/src/ezscore.ck" + ) + .then(() => { + theChuck.runFile("ezscore.ck"); + }); + await theChuck + .loadFile( + "https://raw.githubusercontent.com/tae1han/ChucKTonal/main/src/ezscale.ck" + ) + .then(() => { + theChuck.runFile("ezscale.ck"); + }); + await theChuck + .loadFile( + "https://raw.githubusercontent.com/tae1han/ChucKTonal/main/src/scoreplayer.ck" + ) + .then(() => { + theChuck.runFile("scoreplayer.ck"); + }); } catch (error) { console.error("Failed to load EZScore", error); } diff --git a/src/main.ts b/src/main.ts index 7adfda2..8931c73 100644 --- a/src/main.ts +++ b/src/main.ts @@ -7,18 +7,18 @@ //------------------------------------------------------------------- import NavBar from "@/components/navbar/navbar"; -import ChuckBar from "@components/chuckBar"; -import Editor from "@components/monaco/editor"; -import EditorPanelHeader from "@/components/panelHeader/editorPanelHeader"; -import InputPanelHeader from "@/components/panelHeader/inputPanelHeader"; -import OutputPanelHeader from "@/components/panelHeader/outputPanelHeader"; -import Console from "@/components/console"; +import ChuckBar from "@/components/chuckBar/chuckBar"; +import Editor from "@/components/editor/monaco/editor"; +import EditorPanelHeader from "@/components/editor/editorPanelHeader"; +import InputPanelHeader from "@/components/inputPanel/inputPanelHeader"; +import OutputPanelHeader from "@/components/outputPanel/outputPanelHeader"; +import Console from "@/components/outputPanel/console"; import VmMonitor from "@/components/vmMonitor"; import ProjectSystem from "@/components/fileExplorer/projectSystem"; import Examples from "@/components/examples/examples"; import MoreExamples from "@/components/examples/moreExamples"; import Settings from "@/components/settings"; -import GUI from "@components/gui/gui"; +import GUI from "@/components/inputPanel/gui/gui"; import { initChuck } from "@/host"; import { initAppSplitters } from "@utils/appLayout"; diff --git a/src/services/export/exportWebchuck.ts b/src/services/export/exportWebchuck.ts index d483284..74827b7 100644 --- a/src/services/export/exportWebchuck.ts +++ b/src/services/export/exportWebchuck.ts @@ -1,6 +1,6 @@ import JSZip from "jszip"; import ProjectSystem from "@/components/fileExplorer/projectSystem"; -import Editor from "@/components/monaco/editor"; +import Editor from "@/components/editor/monaco/editor"; import { getGlobalVariables } from "@/utils/chuckPreprocess"; import { MIXER_JS } from "./exportSnippets"; diff --git a/src/services/shareCode.ts b/src/services/shareCode.ts index e5b8556..29dbdd7 100644 --- a/src/services/shareCode.ts +++ b/src/services/shareCode.ts @@ -1,4 +1,4 @@ -import Editor from "@/components/monaco/editor"; +import Editor from "@/components/editor/monaco/editor"; import pako from "pako"; const shareCodeButton = diff --git a/src/utils/appLayout.ts b/src/utils/appLayout.ts index 0347299..4132363 100644 --- a/src/utils/appLayout.ts +++ b/src/utils/appLayout.ts @@ -12,9 +12,9 @@ // date: September 2023 //------------------------------------------------------------ -import Editor from "@/components/monaco/editor"; +import Editor from "@/components/editor/monaco/editor"; import Resizer from "@/components/resizer"; -import Console from "@/components/console"; +import Console from "@/components/outputPanel/console"; const CLASS_V_SPLIT: string = "vSplit"; const CLASS_H_SPLIT: string = "hSplit"; diff --git a/src/utils/theme.ts b/src/utils/theme.ts index 1d4c0c0..c4ee69f 100644 --- a/src/utils/theme.ts +++ b/src/utils/theme.ts @@ -6,9 +6,9 @@ // date: August 2023 //-------------------------------------------------------------------- -import Console from "@components/console"; -import GUI from "@components/gui/gui"; -import Editor from "@components/monaco/editor"; +import Console from "@/components/outputPanel/console"; +import GUI from "@/components/inputPanel/gui/gui"; +import Editor from "@/components/editor/monaco/editor"; import { visual } from "@/host"; let darkModeToggle: HTMLButtonElement;