Fix compiler errors

This commit is contained in:
2023-08-31 16:02:25 +02:00
parent f4937c3739
commit ffe37e451f
11 changed files with 14 additions and 47 deletions

View File

@ -46,35 +46,9 @@ export const makeExampleFactory = (application: Editor): Function => {
};
export const documentation_factory = (application: Editor) => {
let counter = 0; // Counter to generate unique IDs for code snippets
// Initialize a data structure to store code examples by their unique IDs
application.api.codeExamples = {};
const makeExample = (
description: string,
code: string,
open: boolean = false
): string => {
const codeId = `codeExample${counter++}`;
// Store the code snippet in the data structure
application.api.codeExamples[codeId] = code;
return `
<details ${open ? "open" : ""}>
<summary >${description}
<button class="py-1 align-top text-base rounded-lg pl-2 pr-2 hover:bg-green-700 bg-green-600 inline-block" onclick="app.api._playDocExample(app.api.codeExamples['${codeId}'])">▶️ Play</button>
<button class="py-1 text-base rounded-lg pl-2 pr-2 hover:bg-neutral-600 bg-neutral-500 inline-block pl-2" onclick="stop()">&#x23f8;&#xFE0F; Pause</button>
<button class="py-1 text-base rounded-lg pl-2 pr-2 hover:bg-neutral-900 bg-neutral-800 inline-block " onclick="navigator.clipboard.writeText(app.api.codeExamples['${codeId}'])">📎 Copy</button>
</summary>
\`\`\`javascript
${code}
\`\`\`
</details>
`;
};
return {
introduction: introduction(application),
interface: software_interface(application),
@ -88,8 +62,8 @@ export const documentation_factory = (application: Editor) => {
ziffers: ziffers(application),
midi: midi(application),
functions: functions(application),
reference: reference(application),
shortcuts: shortcuts(application),
about: about(application),
reference: reference(),
shortcuts: shortcuts(),
about: about(),
};
};

View File

@ -42,6 +42,7 @@ export class SoundEvent extends AudibleEvent {
zdelay = (value: number) => this.updateValue("zdelay", value);
sustainVolume = (value: number) => this.updateValue("sustainVolume", value);
decay = (value: number) => this.updateValue("decay", value);
dec = this.decay;
tremolo = (value: number) => this.updateValue("tremolo", value);
duration = (value: number) => this.updateValue("duration", value);
zzfx = (value: number[]) => this.updateValue("zzfx", value);
@ -68,8 +69,6 @@ export class SoundEvent extends AudibleEvent {
fmw = this.fmwave;
attack = (value: number) => this.updateValue("attack", value);
atk = this.attack;
decay = (value: number) => this.updateValue("decay", value);
dec = this.decay;
release = (value: number) => this.updateValue("release", value);
rel = this.release;
sustain = (value: number) => this.updateValue("sustain", value);

View File

@ -1,6 +1,4 @@
import { type Editor } from "../main";
export const about = (application: Editor): string => {
export const about = (): string => {
return `
# About Topos

View File

@ -1,4 +1,4 @@
import { makeExampleFactory, key_shortcut } from "../Documentation";
import { makeExampleFactory } from "../Documentation";
import { type Editor } from "../main";
export const chaining = (application: Editor): string => {

View File

@ -1,5 +1,5 @@
import { type Editor } from "../main";
import { makeExampleFactory, key_shortcut } from "../Documentation";
import { makeExampleFactory } from "../Documentation";
export const functions = (application: Editor): string => {
const makeExample = makeExampleFactory(application);

View File

@ -1,8 +1,6 @@
import { type Editor } from "../main";
import { makeExampleFactory, key_shortcut } from "../Documentation";
import { key_shortcut } from "../Documentation";
export const shortcuts = (application: Editor): string => {
const makeExample = makeExampleFactory(application);
export const shortcuts = (): string => {
return `
# Keybindings

View File

@ -1,5 +1,5 @@
import { type Editor } from "../main";
import { makeExampleFactory, key_shortcut } from "../Documentation";
import { makeExampleFactory } from "../Documentation";
export const patterns = (application: Editor): string => {
const makeExample = makeExampleFactory(application);

View File

@ -1,5 +1,3 @@
import { type Editor } from "../main";
export const reference = (application: Editor): string => {
export const reference = (): string => {
return ``;
};

View File

@ -1,5 +1,5 @@
import { type Editor } from "../main";
import { makeExampleFactory, key_shortcut } from "../Documentation";
import { makeExampleFactory } from "../Documentation";
export const synths = (application: Editor): string => {
const makeExample = makeExampleFactory(application);

View File

@ -1,4 +1,4 @@
import { makeExampleFactory, key_shortcut } from "../Documentation";
import { makeExampleFactory } from "../Documentation";
import { type Editor } from "../main";
export const time = (application: Editor): string => {

View File

@ -1,5 +1,5 @@
import { type Editor } from "../main";
import { makeExampleFactory, key_shortcut } from "../Documentation";
import { makeExampleFactory } from "../Documentation";
export const ziffers = (application: Editor): string => {
const makeExample = makeExampleFactory(application);