Update framework

This commit is contained in:
2022-11-26 02:22:02 +01:00
parent 9a6ce1f832
commit ae057940af
508 changed files with 26011 additions and 14248 deletions

11
framework/tts/outputs/aria.d.ts vendored Normal file
View File

@@ -0,0 +1,11 @@
import { BaseOutput } from './base-output';
export declare class AriaOutput extends BaseOutput {
private container;
private speechDisplay;
private timeout;
constructor(options?: any);
private init;
speak(text: string): void;
stop(): void;
clearDisplay(): void;
}

View File

@@ -0,0 +1,32 @@
import { BaseOutput } from './base-output';
export class AriaOutput extends BaseOutput {
constructor(options = {}) {
super();
this.timeout = 100;
this.timeout = options.timeout || 100;
this.init();
}
init() {
this.container = document.createElement('div');
this.container.setAttribute('aria-live', 'polite');
this.speechDisplay = document.createElement('div');
this.speechDisplay.setAttribute('aria-live', 'polite');
this.container.append(this.speechDisplay);
document.body.appendChild(this.container);
document.body.insertBefore(this.container, document.body.firstChild);
}
speak(text) {
this.clearDisplay();
const node = document.createTextNode(text);
const para = document.createElement('p');
para.appendChild(node);
this.speechDisplay.appendChild(para);
setTimeout(this.clearDisplay.bind(this), this.timeout);
}
stop() {
this.clearDisplay();
}
clearDisplay() {
this.speechDisplay.innerHTML = '';
}
}

View File

@@ -0,0 +1,5 @@
export declare class BaseOutput {
speak(text: string): void;
stop(): void;
setOptions(options: any): void;
}

View File

@@ -0,0 +1,11 @@
export class BaseOutput {
speak(text) {
return;
}
stop() {
return;
}
setOptions(options) {
return;
}
}

3
framework/tts/outputs/webtts.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { BaseOutput } from './base-output';
export declare class WebTTSOutput extends BaseOutput {
}

View File

@@ -0,0 +1,3 @@
import { BaseOutput } from './base-output';
export class WebTTSOutput extends BaseOutput {
}