Continue source code restructuring

This commit is contained in:
2024-04-14 16:11:58 +02:00
parent 7cef78bc3b
commit a21d6c9a88
68 changed files with 34 additions and 36 deletions

View File

@ -9,10 +9,10 @@ import {
import { tryEvaluate, evaluateOnce } from "./Evaluator";
import { DrunkWalk } from "./Utils/Drunk";
import { Editor } from "./main";
import { SoundEvent } from "./classes/SoundEvent";
import { MidiEvent, MidiParams } from "./classes/MidiEvent";
import { SoundEvent } from "./Classes/SoundEvent";
import { MidiEvent, MidiParams } from "./Classes/MidiEvent";
import { LRUCache } from "lru-cache";
import { InputOptions, Player } from "./classes/ZPlayer";
import { InputOptions, Player } from "./Classes/ZPlayer";
import { isGenerator, isGeneratorFunction, maybeToNumber } from "./Utils/Generic";
import {
loadUniverse,
@ -27,12 +27,12 @@ import {
soundMap,
// @ts-ignore
} from "superdough";
import { Speaker } from "./extensions/StringExtensions";
import { Speaker } from "./Extensions/StringExtensions";
import { getScaleNotes } from "zifferjs";
import { OscilloscopeConfig } from "./DOM/Visuals/Oscilloscope";
import { blinkScript } from "./DOM/Visuals/Blinkers";
import { SkipEvent } from "./classes/SkipEvent";
import { AbstractEvent, EventOperation } from "./classes/AbstractEvents";
import { SkipEvent } from "./Classes/SkipEvent";
import { AbstractEvent, EventOperation } from "./Classes/AbstractEvents";
import drums from "./tidal-drum-machines.json";
import { ShapeObject, createConicGradient, createLinearGradient, createRadialGradient, drawBackground, drawBall, drawBalloid, drawDonut, drawEquilateral, drawImage, drawPie, drawSmiley, drawStar, drawStroke, drawText, drawTriangular } from "./DOM/Visuals/CanvasVisuals";

View File

@ -1,7 +1,7 @@
import { type Editor } from "../main";
import { vim } from "@replit/codemirror-vim";
import { tryEvaluate } from "../Evaluator";
import { hideDocumentation, showDocumentation } from "../documentation/Documentation";
import { hideDocumentation, showDocumentation } from "../Docs/Documentation";
import { openSettingsModal, openUniverseModal } from "../Editor/FileManagement";
export const registerFillKeys = (app: Editor) => {

View File

@ -8,7 +8,7 @@ import {
hideDocumentation,
showDocumentation,
updateDocumentationContent,
} from "../documentation/Documentation";
} from "../Docs/Documentation";
import {
type Universe,
template_universe,
@ -21,7 +21,7 @@ import {
} from "../Editor/FileManagement";
import { loadSamples } from "../API";
import { tryEvaluate } from "../Evaluator";
import { inlineHoveringTips } from "../documentation/inlineHelp";
import { inlineHoveringTips } from "../Docs/inlineHelp";
import { lineNumbers } from "@codemirror/view";
import { jsCompletions } from "../Editor/EditorSetup";
import { saveState } from "./WindowBehavior";

View File

@ -1,4 +1,4 @@
import { type Editor } from "../main";
import { type Editor } from "../../main";
export const drawCircle = (
/**

View File

@ -1,6 +1,6 @@
// @ts-ignore
import { getAnalyser } from "superdough";
import { Editor } from "../main";
import { Editor } from "../../main";
export interface OscilloscopeConfig {
enabled: boolean;

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -31,7 +31,7 @@ import { Compartment } from "@codemirror/state";
import { Editor } from "../main";
import { EditorView } from "codemirror";
import { javascript } from "@codemirror/lang-javascript";
import { inlineHoveringTips, toposCompletions, soundCompletions } from "../documentation/inlineHelp";
import { inlineHoveringTips, toposCompletions, soundCompletions } from "../Docs/inlineHelp";
import { javascriptLanguage } from "@codemirror/lang-javascript";
export const getCodeMirrorTheme = (theme: { [key: string]: string }): Extension => {

View File

@ -1,5 +1,5 @@
import type { Editor } from "./main";
import type { File } from "./FileManagement";
import type { File } from "./Editor/FileManagement";
const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));
const codeReplace = (code: string): string => code.replace(/->|::/g, "&&");

View File

@ -1,5 +1,5 @@
import { UserAPI } from "../API";
import { AppSettings } from "../FileManagement";
import { AppSettings } from "../Editor/FileManagement";
export type MidiNoteEvent = {
note: number;
@ -578,8 +578,7 @@ export class MidiConnection {
if (typeof output === "number") {
if (output < 0 || output >= this.midiOutputs.length) {
console.error(
`Invalid MIDI output index. Index must be in the range 0-${
this.midiOutputs.length - 1
`Invalid MIDI output index. Index must be in the range 0-${this.midiOutputs.length - 1
}.`,
);
return this.currentOutputIndex;
@ -608,8 +607,7 @@ export class MidiConnection {
if (typeof input === "number") {
if (input < 0 || input >= this.midiInputs.length) {
console.error(
`Invalid MIDI input index. Index must be in the range 0-${
this.midiInputs.length - 1
`Invalid MIDI input index. Index must be in the range 0-${this.midiInputs.length - 1
}.`,
);
return -1;

View File

@ -6,8 +6,8 @@ import {
resolvePitchBend,
safeScale,
} from "zifferjs";
import { SkipEvent } from "./SkipEvent";
import { SoundParams } from "./SoundEvent";
import { SkipEvent } from "../Classes/SkipEvent";
import { SoundParams } from "../Classes/SoundEvent";
import { centsToSemitones, edoToSemitones, ratiosToSemitones } from "zifferjs/src/scale";
import { safeMod } from "zifferjs/src/utils";

View File

@ -1,10 +1,10 @@
import { Chord, Pitch, Rest as ZRest, Ziffers } from "zifferjs";
import { Editor } from "../main";
import { AbstractEvent } from "./AbstractEvents";
import { SkipEvent } from "./SkipEvent";
import { SoundEvent, SoundParams } from "./SoundEvent";
import { MidiEvent, MidiParams } from "./MidiEvent";
import { RestEvent } from "./RestEvent";
import { AbstractEvent } from "../Classes/AbstractEvents";
import { SkipEvent } from "../Classes/SkipEvent";
import { SoundEvent, SoundParams } from "../Classes/SoundEvent";
import { MidiEvent, MidiParams } from "../Classes/MidiEvent";
import { RestEvent } from "../Classes/RestEvent";
import { arrayOfObjectsToObjectWithArrays, isGenerator } from "../Utils/Generic";
import { TonnetzSpaces } from "zifferjs/src/tonnetz";
import { safeMod } from "zifferjs/src/utils";

View File

@ -1,8 +1,8 @@
import { type UserAPI } from "../API";
import { MidiEvent } from "../classes/MidiEvent";
import { Player } from "../classes/ZPlayer";
import { SoundEvent } from "../classes/SoundEvent";
import { SkipEvent } from "../classes/SkipEvent";
import { MidiEvent } from "../Classes/MidiEvent";
import { Player } from "../Classes/ZPlayer";
import { SoundEvent } from "../Classes/SoundEvent";
import { SkipEvent } from "../Classes/SkipEvent";
declare global {

View File

@ -1,6 +1,6 @@
import { noteNameToMidi } from "zifferjs";
import { type UserAPI } from "../API";
import { Player } from "../classes/ZPlayer";
import { Player } from "../Classes/ZPlayer";
export {};
// Extend String prototype

View File

@ -15,25 +15,25 @@ import {
import { singleElements, buttonGroups, ElementMap, createDocumentationStyle } from "./DOM/DomElements";
import { registerFillKeys, registerOnKeyDown } from "./DOM/Keyboard";
import { installEditor } from "./Editor/EditorSetup";
import { documentation_factory, documentation_pages, showDocumentation, updateDocumentationContent } from "./documentation/Documentation";
import { documentation_factory, documentation_pages, showDocumentation, updateDocumentationContent } from "./Docs/Documentation";
import { EditorView } from "codemirror";
import { Clock } from "./clock/Clock";
import { Clock } from "./Clock/Clock";
import { loadSamples, UserAPI } from "./API";
import * as oeis from "jisg";
import * as zpatterns from "zifferjs/src/patterns.ts";
import { makeArrayExtensions } from "./extensions/ArrayExtensions";
import { makeArrayExtensions } from "./Extensions/ArrayExtensions";
import "./style.css";
import { Universes, File } from "./Editor/FileManagement";
import { tryEvaluate } from "./Evaluator";
// @ts-ignore
import showdown from "showdown";
import { makeStringExtensions } from "./extensions/StringExtensions";
import { makeStringExtensions } from "./Extensions/StringExtensions";
import { installInterfaceLogic } from "./DOM/UILogic";
import { installWindowBehaviors } from "./DOM/WindowBehavior";
import { makeNumberExtensions } from "./extensions/NumberExtensions";
import { makeNumberExtensions } from "./Extensions/NumberExtensions";
import colors from "./Editor/colors.json";
// @ts-ignore
const images = import.meta.glob("./assets/*")
const images = import.meta.glob("./Assets/*")
export class Editor {
// Universes and settings