Fix compiler errors
This commit is contained in:
@ -46,35 +46,9 @@ export const makeExampleFactory = (application: Editor): Function => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const documentation_factory = (application: Editor) => {
|
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
|
// Initialize a data structure to store code examples by their unique IDs
|
||||||
application.api.codeExamples = {};
|
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()">⏸️ 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 {
|
return {
|
||||||
introduction: introduction(application),
|
introduction: introduction(application),
|
||||||
interface: software_interface(application),
|
interface: software_interface(application),
|
||||||
@ -88,8 +62,8 @@ export const documentation_factory = (application: Editor) => {
|
|||||||
ziffers: ziffers(application),
|
ziffers: ziffers(application),
|
||||||
midi: midi(application),
|
midi: midi(application),
|
||||||
functions: functions(application),
|
functions: functions(application),
|
||||||
reference: reference(application),
|
reference: reference(),
|
||||||
shortcuts: shortcuts(application),
|
shortcuts: shortcuts(),
|
||||||
about: about(application),
|
about: about(),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -42,6 +42,7 @@ export class SoundEvent extends AudibleEvent {
|
|||||||
zdelay = (value: number) => this.updateValue("zdelay", value);
|
zdelay = (value: number) => this.updateValue("zdelay", value);
|
||||||
sustainVolume = (value: number) => this.updateValue("sustainVolume", value);
|
sustainVolume = (value: number) => this.updateValue("sustainVolume", value);
|
||||||
decay = (value: number) => this.updateValue("decay", value);
|
decay = (value: number) => this.updateValue("decay", value);
|
||||||
|
dec = this.decay;
|
||||||
tremolo = (value: number) => this.updateValue("tremolo", value);
|
tremolo = (value: number) => this.updateValue("tremolo", value);
|
||||||
duration = (value: number) => this.updateValue("duration", value);
|
duration = (value: number) => this.updateValue("duration", value);
|
||||||
zzfx = (value: number[]) => this.updateValue("zzfx", value);
|
zzfx = (value: number[]) => this.updateValue("zzfx", value);
|
||||||
@ -68,8 +69,6 @@ export class SoundEvent extends AudibleEvent {
|
|||||||
fmw = this.fmwave;
|
fmw = this.fmwave;
|
||||||
attack = (value: number) => this.updateValue("attack", value);
|
attack = (value: number) => this.updateValue("attack", value);
|
||||||
atk = this.attack;
|
atk = this.attack;
|
||||||
decay = (value: number) => this.updateValue("decay", value);
|
|
||||||
dec = this.decay;
|
|
||||||
release = (value: number) => this.updateValue("release", value);
|
release = (value: number) => this.updateValue("release", value);
|
||||||
rel = this.release;
|
rel = this.release;
|
||||||
sustain = (value: number) => this.updateValue("sustain", value);
|
sustain = (value: number) => this.updateValue("sustain", value);
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
import { type Editor } from "../main";
|
export const about = (): string => {
|
||||||
|
|
||||||
export const about = (application: Editor): string => {
|
|
||||||
return `
|
return `
|
||||||
# About Topos
|
# About Topos
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { makeExampleFactory, key_shortcut } from "../Documentation";
|
import { makeExampleFactory } from "../Documentation";
|
||||||
import { type Editor } from "../main";
|
import { type Editor } from "../main";
|
||||||
|
|
||||||
export const chaining = (application: Editor): string => {
|
export const chaining = (application: Editor): string => {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { type Editor } from "../main";
|
import { type Editor } from "../main";
|
||||||
import { makeExampleFactory, key_shortcut } from "../Documentation";
|
import { makeExampleFactory } from "../Documentation";
|
||||||
|
|
||||||
export const functions = (application: Editor): string => {
|
export const functions = (application: Editor): string => {
|
||||||
const makeExample = makeExampleFactory(application);
|
const makeExample = makeExampleFactory(application);
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
import { type Editor } from "../main";
|
import { key_shortcut } from "../Documentation";
|
||||||
import { makeExampleFactory, key_shortcut } from "../Documentation";
|
|
||||||
|
|
||||||
export const shortcuts = (application: Editor): string => {
|
export const shortcuts = (): string => {
|
||||||
const makeExample = makeExampleFactory(application);
|
|
||||||
return `
|
return `
|
||||||
# Keybindings
|
# Keybindings
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { type Editor } from "../main";
|
import { type Editor } from "../main";
|
||||||
import { makeExampleFactory, key_shortcut } from "../Documentation";
|
import { makeExampleFactory } from "../Documentation";
|
||||||
|
|
||||||
export const patterns = (application: Editor): string => {
|
export const patterns = (application: Editor): string => {
|
||||||
const makeExample = makeExampleFactory(application);
|
const makeExample = makeExampleFactory(application);
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
import { type Editor } from "../main";
|
export const reference = (): string => {
|
||||||
|
|
||||||
export const reference = (application: Editor): string => {
|
|
||||||
return ``;
|
return ``;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { type Editor } from "../main";
|
import { type Editor } from "../main";
|
||||||
import { makeExampleFactory, key_shortcut } from "../Documentation";
|
import { makeExampleFactory } from "../Documentation";
|
||||||
|
|
||||||
export const synths = (application: Editor): string => {
|
export const synths = (application: Editor): string => {
|
||||||
const makeExample = makeExampleFactory(application);
|
const makeExample = makeExampleFactory(application);
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { makeExampleFactory, key_shortcut } from "../Documentation";
|
import { makeExampleFactory } from "../Documentation";
|
||||||
import { type Editor } from "../main";
|
import { type Editor } from "../main";
|
||||||
|
|
||||||
export const time = (application: Editor): string => {
|
export const time = (application: Editor): string => {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { type Editor } from "../main";
|
import { type Editor } from "../main";
|
||||||
import { makeExampleFactory, key_shortcut } from "../Documentation";
|
import { makeExampleFactory } from "../Documentation";
|
||||||
|
|
||||||
export const ziffers = (application: Editor): string => {
|
export const ziffers = (application: Editor): string => {
|
||||||
const makeExample = makeExampleFactory(application);
|
const makeExample = makeExampleFactory(application);
|
||||||
|
|||||||
Reference in New Issue
Block a user