@the-inclusionist/engine 6.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.md +107 -0
- package/app/css/style.css +622 -0
- package/app/public/vendor/fonts/andika-400-ext.woff2 +0 -0
- package/app/public/vendor/fonts/andika-400.woff2 +0 -0
- package/app/public/vendor/fonts/andika-700-ext.woff2 +0 -0
- package/app/public/vendor/fonts/andika-700.woff2 +0 -0
- package/app/public/vendor/fonts/atkinson-400-ext.woff2 +0 -0
- package/app/public/vendor/fonts/atkinson-400.woff2 +0 -0
- package/app/public/vendor/fonts/atkinson-700-ext.woff2 +0 -0
- package/app/public/vendor/fonts/atkinson-700.woff2 +0 -0
- package/app/public/vendor/fonts/atkinson-mono-400-ext.woff2 +0 -0
- package/app/public/vendor/fonts/atkinson-mono-400.woff2 +0 -0
- package/app/public/vendor/fonts/comicneue-400.woff2 +0 -0
- package/app/public/vendor/fonts/comicneue-700.woff2 +0 -0
- package/app/public/vendor/fonts/greatvibes-400.woff2 +0 -0
- package/app/public/vendor/fonts/inter-400.woff2 +0 -0
- package/app/public/vendor/fonts/inter-700.woff2 +0 -0
- package/app/public/vendor/fonts/lato-400.woff2 +0 -0
- package/app/public/vendor/fonts/lato-700.woff2 +0 -0
- package/app/public/vendor/fonts/lexend-400-ext.woff2 +0 -0
- package/app/public/vendor/fonts/lexend-400.woff2 +0 -0
- package/app/public/vendor/fonts/lexend-700-ext.woff2 +0 -0
- package/app/public/vendor/fonts/lexend-700.woff2 +0 -0
- package/app/public/vendor/fonts/literata-400.woff2 +0 -0
- package/app/public/vendor/fonts/literata-700.woff2 +0 -0
- package/app/public/vendor/fonts/newsreader-400.woff2 +0 -0
- package/app/public/vendor/fonts/newsreader-700.woff2 +0 -0
- package/app/public/vendor/fonts/opensans-400.woff2 +0 -0
- package/app/public/vendor/fonts/opensans-700.woff2 +0 -0
- package/app/public/vendor/fonts/pinyon-400.woff2 +0 -0
- package/app/public/vendor/fonts/quattro-400.woff2 +0 -0
- package/app/public/vendor/fonts/quattro-700.woff2 +0 -0
- package/app/public/vendor/fonts/sourcesans-400.woff2 +0 -0
- package/app/public/vendor/fonts/sourcesans-700.woff2 +0 -0
- package/app/public/vendor/fonts/sourceserif-400.woff2 +0 -0
- package/app/public/vendor/fonts/sourceserif-700.woff2 +0 -0
- package/app/public/vendor/fonts/ufcook-700.woff2 +0 -0
- package/app/public/vendor/fonts/ufmag-400.woff2 +0 -0
- package/app/public/vendor/fonts.css +88 -0
- package/dist-pkg/boot/create-game.d.ts +159 -0
- package/dist-pkg/boot/create-game.js +266 -0
- package/dist-pkg/core/a11y-sr.d.ts +4 -0
- package/dist-pkg/core/a11y-sr.js +20 -0
- package/dist-pkg/core/actions.d.ts +100 -0
- package/dist-pkg/core/actions.js +149 -0
- package/dist-pkg/core/anel.d.ts +17 -0
- package/dist-pkg/core/anel.js +31 -0
- package/dist-pkg/core/collision.d.ts +21 -0
- package/dist-pkg/core/collision.js +62 -0
- package/dist-pkg/core/constants.d.ts +84 -0
- package/dist-pkg/core/constants.js +64 -0
- package/dist-pkg/core/contract.d.ts +227 -0
- package/dist-pkg/core/contract.js +184 -0
- package/dist-pkg/core/dom-query.d.ts +9 -0
- package/dist-pkg/core/dom-query.js +25 -0
- package/dist-pkg/core/entity.d.ts +150 -0
- package/dist-pkg/core/entity.js +38 -0
- package/dist-pkg/core/escape-html.d.ts +16 -0
- package/dist-pkg/core/escape-html.js +32 -0
- package/dist-pkg/core/i18n.d.ts +71 -0
- package/dist-pkg/core/i18n.js +236 -0
- package/dist-pkg/core/layers.d.ts +39 -0
- package/dist-pkg/core/layers.js +71 -0
- package/dist-pkg/core/letter-grid.d.ts +55 -0
- package/dist-pkg/core/letter-grid.js +116 -0
- package/dist-pkg/core/loop.d.ts +17 -0
- package/dist-pkg/core/loop.js +36 -0
- package/dist-pkg/core/password.d.ts +34 -0
- package/dist-pkg/core/password.js +205 -0
- package/dist-pkg/core/rng.d.ts +20 -0
- package/dist-pkg/core/rng.js +61 -0
- package/dist-pkg/core/rotulo-acessivel.d.ts +17 -0
- package/dist-pkg/core/rotulo-acessivel.js +41 -0
- package/dist-pkg/core/run-state.d.ts +115 -0
- package/dist-pkg/core/run-state.js +40 -0
- package/dist-pkg/core/scenes.d.ts +68 -0
- package/dist-pkg/core/scenes.js +64 -0
- package/dist-pkg/core/screens.d.ts +16 -0
- package/dist-pkg/core/screens.js +28 -0
- package/dist-pkg/core/state.d.ts +138 -0
- package/dist-pkg/core/state.js +290 -0
- package/dist-pkg/core/tiles.d.ts +12 -0
- package/dist-pkg/core/tiles.js +61 -0
- package/dist-pkg/core/world.d.ts +4 -0
- package/dist-pkg/core/world.js +58 -0
- package/dist-pkg/educational/activities-registry.d.ts +47 -0
- package/dist-pkg/educational/activities-registry.js +95 -0
- package/dist-pkg/i18n/en.d.ts +3 -0
- package/dist-pkg/i18n/en.js +560 -0
- package/dist-pkg/i18n/es.d.ts +3 -0
- package/dist-pkg/i18n/es.js +558 -0
- package/dist-pkg/i18n/pt.d.ts +3 -0
- package/dist-pkg/i18n/pt.js +618 -0
- package/dist-pkg/input/default-bindings.d.ts +24 -0
- package/dist-pkg/input/default-bindings.js +122 -0
- package/dist-pkg/input/devices.d.ts +15 -0
- package/dist-pkg/input/devices.js +31 -0
- package/dist-pkg/input/edges.d.ts +58 -0
- package/dist-pkg/input/edges.js +49 -0
- package/dist-pkg/input/gamepad.d.ts +203 -0
- package/dist-pkg/input/gamepad.js +531 -0
- package/dist-pkg/input/keyboard-runtime.d.ts +61 -0
- package/dist-pkg/input/keyboard-runtime.js +83 -0
- package/dist-pkg/input/keyboard.d.ts +45 -0
- package/dist-pkg/input/keyboard.js +80 -0
- package/dist-pkg/input/keydown.d.ts +270 -0
- package/dist-pkg/input/keydown.js +381 -0
- package/dist-pkg/input/latch.d.ts +30 -0
- package/dist-pkg/input/latch.js +63 -0
- package/dist-pkg/input/pointer-space.d.ts +40 -0
- package/dist-pkg/input/pointer-space.js +51 -0
- package/dist-pkg/input/state.d.ts +11 -0
- package/dist-pkg/input/state.js +12 -0
- package/dist-pkg/input/touch-bindings.d.ts +210 -0
- package/dist-pkg/input/touch-bindings.js +365 -0
- package/dist-pkg/input/touch.d.ts +173 -0
- package/dist-pkg/input/touch.js +314 -0
- package/dist-pkg/input/transports.d.ts +90 -0
- package/dist-pkg/input/transports.js +96 -0
- package/dist-pkg/input/vocabulary-migration.d.ts +58 -0
- package/dist-pkg/input/vocabulary-migration.js +125 -0
- package/dist-pkg/platform/audio-ambient.d.ts +27 -0
- package/dist-pkg/platform/audio-ambient.js +89 -0
- package/dist-pkg/platform/audio-earcons.d.ts +24 -0
- package/dist-pkg/platform/audio-earcons.js +62 -0
- package/dist-pkg/platform/audio-jingles.d.ts +17 -0
- package/dist-pkg/platform/audio-jingles.js +54 -0
- package/dist-pkg/platform/audio-mixer.d.ts +14 -0
- package/dist-pkg/platform/audio-mixer.js +62 -0
- package/dist-pkg/platform/audio-nav.d.ts +51 -0
- package/dist-pkg/platform/audio-nav.js +99 -0
- package/dist-pkg/platform/audio-sonar.d.ts +71 -0
- package/dist-pkg/platform/audio-sonar.js +173 -0
- package/dist-pkg/platform/audio.d.ts +32 -0
- package/dist-pkg/platform/audio.js +191 -0
- package/dist-pkg/platform/interruptible-speech.d.ts +19 -0
- package/dist-pkg/platform/interruptible-speech.js +79 -0
- package/dist-pkg/platform/speech.d.ts +2 -0
- package/dist-pkg/platform/speech.js +35 -0
- package/dist-pkg/platform/storage.d.ts +87 -0
- package/dist-pkg/platform/storage.js +148 -0
- package/dist-pkg/platform/tts.d.ts +33 -0
- package/dist-pkg/platform/tts.js +142 -0
- package/dist-pkg/render/camera.d.ts +58 -0
- package/dist-pkg/render/camera.js +105 -0
- package/dist-pkg/render/canvas.d.ts +13 -0
- package/dist-pkg/render/canvas.js +26 -0
- package/dist-pkg/render/cenario-data.d.ts +127 -0
- package/dist-pkg/render/cenario-data.js +145 -0
- package/dist-pkg/render/city-tex.d.ts +63 -0
- package/dist-pkg/render/city-tex.js +228 -0
- package/dist-pkg/render/city-tiles.d.ts +11 -0
- package/dist-pkg/render/city-tiles.js +140 -0
- package/dist-pkg/render/crt.d.ts +19 -0
- package/dist-pkg/render/crt.js +92 -0
- package/dist-pkg/render/cvd-matrices.d.ts +35 -0
- package/dist-pkg/render/cvd-matrices.js +91 -0
- package/dist-pkg/render/draw.d.ts +149 -0
- package/dist-pkg/render/draw.js +221 -0
- package/dist-pkg/render/fx.d.ts +63 -0
- package/dist-pkg/render/fx.js +123 -0
- package/dist-pkg/render/hc-role-data.d.ts +14 -0
- package/dist-pkg/render/hc-role-data.js +24 -0
- package/dist-pkg/render/high-contrast.d.ts +109 -0
- package/dist-pkg/render/high-contrast.js +254 -0
- package/dist-pkg/render/lq-filter.d.ts +37 -0
- package/dist-pkg/render/lq-filter.js +94 -0
- package/dist-pkg/render/minimap.d.ts +11 -0
- package/dist-pkg/render/minimap.js +94 -0
- package/dist-pkg/render/parallax.d.ts +85 -0
- package/dist-pkg/render/parallax.js +158 -0
- package/dist-pkg/render/player-anim.d.ts +71 -0
- package/dist-pkg/render/player-anim.js +152 -0
- package/dist-pkg/render/port.d.ts +143 -0
- package/dist-pkg/render/port.js +29 -0
- package/dist-pkg/render/recycling-tex.d.ts +48 -0
- package/dist-pkg/render/recycling-tex.js +164 -0
- package/dist-pkg/render/scene-city.d.ts +77 -0
- package/dist-pkg/render/scene-city.js +181 -0
- package/dist-pkg/render/scene-parallax.d.ts +72 -0
- package/dist-pkg/render/scene-parallax.js +426 -0
- package/dist-pkg/render/scene-sky.d.ts +126 -0
- package/dist-pkg/render/scene-sky.js +295 -0
- package/dist-pkg/render/screen-pipeline.d.ts +134 -0
- package/dist-pkg/render/screen-pipeline.js +177 -0
- package/dist-pkg/render/set-cenario.d.ts +54 -0
- package/dist-pkg/render/set-cenario.js +103 -0
- package/dist-pkg/render/sprite-fx.d.ts +3 -0
- package/dist-pkg/render/sprite-fx.js +40 -0
- package/dist-pkg/render/textures.d.ts +75 -0
- package/dist-pkg/render/textures.js +240 -0
- package/dist-pkg/render/title-scene.d.ts +46 -0
- package/dist-pkg/render/title-scene.js +75 -0
- package/dist-pkg/render/viewports.d.ts +52 -0
- package/dist-pkg/render/viewports.js +185 -0
- package/dist-pkg/render/viz-axes.d.ts +98 -0
- package/dist-pkg/render/viz-axes.js +184 -0
- package/dist-pkg/render/viz-modes.d.ts +61 -0
- package/dist-pkg/render/viz-modes.js +74 -0
- package/dist-pkg/render/viz-setters.d.ts +130 -0
- package/dist-pkg/render/viz-setters.js +244 -0
- package/dist-pkg/render/weather.d.ts +96 -0
- package/dist-pkg/render/weather.js +171 -0
- package/dist-pkg/render/wheelchair-sprites.d.ts +24 -0
- package/dist-pkg/render/wheelchair-sprites.js +63 -0
- package/dist-pkg/render/world-tex.d.ts +18 -0
- package/dist-pkg/render/world-tex.js +87 -0
- package/dist-pkg/ui/activities-menu.d.ts +258 -0
- package/dist-pkg/ui/activities-menu.js +648 -0
- package/dist-pkg/ui/caa-sets.d.ts +39 -0
- package/dist-pkg/ui/caa-sets.js +65 -0
- package/dist-pkg/ui/changed-mark.d.ts +15 -0
- package/dist-pkg/ui/changed-mark.js +96 -0
- package/dist-pkg/ui/debug-panel.d.ts +67 -0
- package/dist-pkg/ui/debug-panel.js +173 -0
- package/dist-pkg/ui/dom.d.ts +24 -0
- package/dist-pkg/ui/dom.js +47 -0
- package/dist-pkg/ui/focus-trap.d.ts +71 -0
- package/dist-pkg/ui/focus-trap.js +99 -0
- package/dist-pkg/ui/fonts.d.ts +41 -0
- package/dist-pkg/ui/fonts.js +59 -0
- package/dist-pkg/ui/hud.d.ts +137 -0
- package/dist-pkg/ui/hud.js +229 -0
- package/dist-pkg/ui/item-announcement.d.ts +19 -0
- package/dist-pkg/ui/item-announcement.js +36 -0
- package/dist-pkg/ui/layout.d.ts +6 -0
- package/dist-pkg/ui/layout.js +54 -0
- package/dist-pkg/ui/loop-crash.d.ts +19 -0
- package/dist-pkg/ui/loop-crash.js +60 -0
- package/dist-pkg/ui/map-hub.d.ts +56 -0
- package/dist-pkg/ui/map-hub.js +138 -0
- package/dist-pkg/ui/menu-nav.d.ts +141 -0
- package/dist-pkg/ui/menu-nav.js +390 -0
- package/dist-pkg/ui/pause-icons.d.ts +327 -0
- package/dist-pkg/ui/pause-icons.js +620 -0
- package/dist-pkg/ui/reach-notice.d.ts +34 -0
- package/dist-pkg/ui/reach-notice.js +71 -0
- package/dist-pkg/ui/settings-audio.d.ts +139 -0
- package/dist-pkg/ui/settings-audio.js +544 -0
- package/dist-pkg/ui/settings-caa.d.ts +45 -0
- package/dist-pkg/ui/settings-caa.js +137 -0
- package/dist-pkg/ui/settings-controls.d.ts +100 -0
- package/dist-pkg/ui/settings-controls.js +152 -0
- package/dist-pkg/ui/settings-empathy.d.ts +62 -0
- package/dist-pkg/ui/settings-empathy.js +137 -0
- package/dist-pkg/ui/settings-motion.d.ts +95 -0
- package/dist-pkg/ui/settings-motion.js +282 -0
- package/dist-pkg/ui/settings-motor.d.ts +77 -0
- package/dist-pkg/ui/settings-motor.js +215 -0
- package/dist-pkg/ui/settings-panel.d.ts +76 -0
- package/dist-pkg/ui/settings-panel.js +187 -0
- package/dist-pkg/ui/settings-typo.d.ts +74 -0
- package/dist-pkg/ui/settings-typo.js +150 -0
- package/dist-pkg/ui/settings-visual.d.ts +111 -0
- package/dist-pkg/ui/settings-visual.js +252 -0
- package/dist-pkg/ui/shell.d.ts +239 -0
- package/dist-pkg/ui/shell.js +430 -0
- package/dist-pkg/ui/title.d.ts +36 -0
- package/dist-pkg/ui/title.js +60 -0
- package/dist-pkg/ui/vlibras.d.ts +11 -0
- package/dist-pkg/ui/vlibras.js +87 -0
- package/dist-pkg/ui/webcam.d.ts +7 -0
- package/dist-pkg/ui/webcam.js +88 -0
- package/docs/CREDITS.md +64 -0
- package/docs/LICENSES.md +132 -0
- package/package.json +115 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
/**
|
|
3
|
+
* AS FRASES DO AVISO, na ordem em que são lidas. Vazio = não há nada a dizer, e é o caso comum.
|
|
4
|
+
*
|
|
5
|
+
* ⚠️ A ÚLTIMA LINHA TEM DUAS FORMAS, e a diferença entre elas é a diferença entre ajudar e mentir:
|
|
6
|
+
*
|
|
7
|
+
* · há transporte que serviria se ligado → «ligue um controle», que é acionável.
|
|
8
|
+
* · não há nenhum → dizer «ligue um controle» seria mandar a criança procurar uma coisa que não resolve.
|
|
9
|
+
* Nesse caso o problema é do JOGO, que pede mais posições do que qualquer transporte deste aparelho
|
|
10
|
+
* oferece, e a frase honesta é outra.
|
|
11
|
+
*/
|
|
12
|
+
export function linhasDoAviso(a, t) {
|
|
13
|
+
if (a.ok)
|
|
14
|
+
return [];
|
|
15
|
+
const nome = (id) => t('reach.nome.' + id);
|
|
16
|
+
const linhas = [t('reach.titulo', { pedidas: a.pedidas })];
|
|
17
|
+
for (const c of a.curtos) {
|
|
18
|
+
linhas.push(t('reach.curto', { transporte: nome(c.id), lugares: c.slots }));
|
|
19
|
+
}
|
|
20
|
+
linhas.push(a.serviriamSeLigados.length
|
|
21
|
+
? t('reach.ligue', { saida: a.serviriamSeLigados.map(nome).join(t('reach.ou')) })
|
|
22
|
+
: t('reach.semSaida'));
|
|
23
|
+
return linhas;
|
|
24
|
+
}
|
|
25
|
+
/** O id do cartão. Estável porque o teste e a folha de estilo o procuram. */
|
|
26
|
+
export const REACH_NOTICE_ID = 'reach-notice';
|
|
27
|
+
/**
|
|
28
|
+
* Mostra o aviso, se houver o que dizer. Devolve `true` quando mostrou.
|
|
29
|
+
*
|
|
30
|
+
* ⚠️ MONTA POR NÓS E NÃO POR `innerHTML`. As frases passam por `t()` e um dicionário é conteúdo que muda sem
|
|
31
|
+
* passar por revisão de código — é exatamente a fronteira que a issue #106 mapeia. `textContent` fecha a
|
|
32
|
+
* questão sem precisar de escapar nada.
|
|
33
|
+
*/
|
|
34
|
+
export function mostrarAvisoDeAlcance(ctx, a) {
|
|
35
|
+
const linhas = linhasDoAviso(a, ctx.t);
|
|
36
|
+
if (linhas.length === 0)
|
|
37
|
+
return false;
|
|
38
|
+
const dentro = ctx.procurar('#game-region');
|
|
39
|
+
if (!dentro)
|
|
40
|
+
return false; // sem a marcação do hospedeiro não há onde mostrar; o `problems` já o denuncia
|
|
41
|
+
const fora = ctx.criar('div');
|
|
42
|
+
fora.id = REACH_NOTICE_ID;
|
|
43
|
+
fora.className = 'overlay';
|
|
44
|
+
const cartao = ctx.criar('div');
|
|
45
|
+
cartao.className = 'overlay__card';
|
|
46
|
+
cartao.setAttribute('role', 'dialog');
|
|
47
|
+
cartao.setAttribute('aria-modal', 'true');
|
|
48
|
+
cartao.setAttribute('tabindex', '-1');
|
|
49
|
+
for (const [i, texto] of linhas.entries()) {
|
|
50
|
+
const p = ctx.criar('p');
|
|
51
|
+
p.textContent = texto;
|
|
52
|
+
if (i === 0)
|
|
53
|
+
p.className = 'reach-notice__titulo';
|
|
54
|
+
cartao.appendChild(p);
|
|
55
|
+
}
|
|
56
|
+
// ⚠️ O BOTÃO É O QUE FAZ DISTO UM AVISO E NÃO UMA PORTA FECHADA. Ver o cabeçalho: a detecção de teclado
|
|
57
|
+
// erra, e o erro só é aceitável enquanto a criança puder seguir em frente.
|
|
58
|
+
const seguir = ctx.criar('button');
|
|
59
|
+
seguir.setAttribute('type', 'button');
|
|
60
|
+
seguir.className = 'mode-btn';
|
|
61
|
+
seguir.textContent = ctx.t('reach.continuar');
|
|
62
|
+
seguir.addEventListener('click', () => fora.remove());
|
|
63
|
+
cartao.appendChild(seguir);
|
|
64
|
+
fora.appendChild(cartao);
|
|
65
|
+
dentro.appendChild(fora);
|
|
66
|
+
// O foco vai para o cartão, não para o botão: a criança tem de OUVIR o motivo antes de encontrar a saída.
|
|
67
|
+
// (Se fosse para o botão, o leitor de tela leria «Jogar assim mesmo» e o resto ficaria para quem procurasse.)
|
|
68
|
+
cartao.focus();
|
|
69
|
+
ctx.srAlert(linhas.join(' '));
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
import type { PlayerView } from '../core/entity.js';
|
|
3
|
+
import type { PlayerAudioOut } from '../platform/audio-sonar.js';
|
|
4
|
+
import type { DomQuery } from '../core/dom-query.js';
|
|
5
|
+
export type { DomQuery } from '../core/dom-query.js';
|
|
6
|
+
/** Minimal platform/storage.ts shape this module needs (get/set only — no direct localStorage access). */
|
|
7
|
+
export interface AudioStore {
|
|
8
|
+
get(key: string, fallback?: string | null): string | null;
|
|
9
|
+
set(key: string, value: string | number | boolean): boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface AudioCatDef {
|
|
12
|
+
k: string;
|
|
13
|
+
lbl: string;
|
|
14
|
+
}
|
|
15
|
+
export interface AudioCatState {
|
|
16
|
+
on: boolean;
|
|
17
|
+
vol: number;
|
|
18
|
+
}
|
|
19
|
+
export interface TtsPanelEngine {
|
|
20
|
+
id: string;
|
|
21
|
+
speak: (text: string) => void;
|
|
22
|
+
}
|
|
23
|
+
/** Minimal shape of the injected `tts` (platform/tts.ts's createTts() instance) this panel drives. */
|
|
24
|
+
export interface TtsPanel {
|
|
25
|
+
getEngineSel: () => string;
|
|
26
|
+
setEngineSel: (v: string) => void;
|
|
27
|
+
getEngine: () => TtsPanelEngine | null;
|
|
28
|
+
getVoiceObj: () => SpeechSynthesisVoice | null;
|
|
29
|
+
setVoiceObj: (v: SpeechSynthesisVoice | null) => void;
|
|
30
|
+
loadTTS: () => void;
|
|
31
|
+
narrate: (text: string) => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Saída de áudio dedicada de um jogador: o id do dispositivo e o AudioContext/ganho que ele abriu.
|
|
35
|
+
*
|
|
36
|
+
* O id é da entidade (é preferência do jogador, persistida); o par `_ac`/`_acOut` é do
|
|
37
|
+
* `platform/audio-sonar`, que os cria. Daí a intersecção em vez de três chaves numa vista só.
|
|
38
|
+
*/
|
|
39
|
+
export type SinkPlayer = PlayerView<'audioSink'> & PlayerAudioOut;
|
|
40
|
+
export interface SettingsAudioCtx {
|
|
41
|
+
/** DOM selector (querySelector), injected — never reaches `document` globally. */
|
|
42
|
+
$: DomQuery;
|
|
43
|
+
/** Screen-reader "polite" announcement (core/a11y-sr's srSay), injected. */
|
|
44
|
+
srSay: (msg: string) => void;
|
|
45
|
+
/** Persistence (platform/storage.ts) — only the TTS engine/voice choice and the per-player audio sink live
|
|
46
|
+
* here; the mixer categories persist through `setCatGain` (platform/audio.ts already saves them). */
|
|
47
|
+
store: AudioStore;
|
|
48
|
+
/** Category catalog (platform/audio-mixer.ts's AUDIO_CATS) — pure data, injected like game.js's own import. */
|
|
49
|
+
audioCats: readonly AudioCatDef[];
|
|
50
|
+
/** Shared helper (game.js): toggles a button's .is-on/aria-pressed. Used by many other panels too — not ours. */
|
|
51
|
+
toggleBtn: (b: HTMLElement, on: boolean) => void;
|
|
52
|
+
/** Shared: current player count (core/state.ts's numPlayers, read live via game.js). */
|
|
53
|
+
getNumPlayers: () => number;
|
|
54
|
+
/** Shared: the live players array (core/state.ts) — only `.audioSink`/`._ac`/`._acOut` are touched here. */
|
|
55
|
+
getPlayers: () => SinkPlayer[];
|
|
56
|
+
/** Master mute (platform/audio.ts's soundOn), read/write live via game.js's re-export. */
|
|
57
|
+
getSoundOn: () => boolean;
|
|
58
|
+
setSoundOn: (on: boolean) => void;
|
|
59
|
+
/** Master volume 0..1 (platform/audio.ts's volume). */
|
|
60
|
+
getVolume: () => number;
|
|
61
|
+
setVolume: (v: number) => void;
|
|
62
|
+
/** The live per-category mixer state (platform/audio.ts's audioCat) — mutated in place, never reassigned. */
|
|
63
|
+
getAudioCat: () => Record<string, AudioCatState> | null;
|
|
64
|
+
/** Re-applies a category's gain to the audio graph AND persists it (platform/audio.ts's setCatGain). */
|
|
65
|
+
setCatGain: (cat: string) => void;
|
|
66
|
+
/** Narration engine/voice panel API (platform/tts.ts's createTts() instance). */
|
|
67
|
+
tts: TtsPanel;
|
|
68
|
+
/** Core collision state (NOT owned by this panel — core/collision.ts reads it via isModoCego). The toggle's
|
|
69
|
+
* widget lives inside #audio; the state and its gameplay side effects (setupExtras) stay in game.js. */
|
|
70
|
+
getModoCego: () => boolean;
|
|
71
|
+
setModoCego: (on: boolean) => void;
|
|
72
|
+
/** Core collision state (cane hit spacing). Same reasoning as modo cego. */
|
|
73
|
+
getCaneBlockDiv: () => number;
|
|
74
|
+
setCaneBlockDiv: (div: number) => void;
|
|
75
|
+
}
|
|
76
|
+
export interface SettingsAudioApi {
|
|
77
|
+
/** Re-renders the whole #audio overlay content (master, categories, nav-sound, TTS panel, sinks, modo-cego and
|
|
78
|
+
* cane-div sync) and re-wires whatever it (re)creates. Idempotent; game.js's openAudio() calls it every open. */
|
|
79
|
+
renderAudio: () => void;
|
|
80
|
+
/** Refreshes the #opt-modocego button. Exported because game.js's setModoCego() calls it directly. */
|
|
81
|
+
reflectModoCego: () => void;
|
|
82
|
+
/** Refreshes the #opt-tts button + #tts-engine selection. Exported because the pause-menu icon bar's
|
|
83
|
+
* iconAct('tts', …) toggles audioCat.tts.on itself and then calls this. */
|
|
84
|
+
reflectTts: () => void;
|
|
85
|
+
}
|
|
86
|
+
/** Categorias de NAVEGAÇÃO SONORA (bengala/sonar/guarda/guia) — volume geral separado do som do jogo. */
|
|
87
|
+
export declare const NAV_CATS: readonly ["sonar", "guard", "guide"];
|
|
88
|
+
/** Categorias GERAIS do jogo (TTS fica na seção Voz, fora desta lista). */
|
|
89
|
+
export declare const GEN_CATS: readonly ["music", "ambient", "interact", "earcons", "other"];
|
|
90
|
+
/** 0..1 -> 0..100 rounded (slider display value). */
|
|
91
|
+
export declare function volPercent(v: number): number;
|
|
92
|
+
/** One category row's markup (volume slider + on/off switch). Pure — resolves label/state from the given data,
|
|
93
|
+
* never from a global. Returns '' for an unknown/missing category (defensive; never hit with real catalogs). */
|
|
94
|
+
export declare function catRowHTML(k: string, cats: readonly AudioCatDef[], state: Readonly<Record<string, AudioCatState>>): string;
|
|
95
|
+
/** Full innerHTML for a category list (#audio-list or #navsound-list). Pure string building — no DOM. */
|
|
96
|
+
export declare function catsListHTML(keys: readonly string[], cats: readonly AudioCatDef[], state: Readonly<Record<string, AudioCatState>>): string;
|
|
97
|
+
/** #navsound-master's value: the loudest of the nav categories, as a 0..100 slider value. */
|
|
98
|
+
export declare function navMasterVolume(state: Readonly<Record<string, AudioCatState>>, navCats?: readonly string[]): number;
|
|
99
|
+
/** Cane-hit spacing select -> validated int (garbage/empty -> 1, "a batida por bloco"). */
|
|
100
|
+
export declare function parseCaneDiv(raw: string): number;
|
|
101
|
+
/** srSay text for a cane-hit spacing choice. The two halves are ONE sentence per case, not a shared prefix
|
|
102
|
+
* plus a tail: a language that renders this as "One tap per block (cane)" needs to move the word "cane". */
|
|
103
|
+
export declare function caneDivMessage(div: number): string;
|
|
104
|
+
/** #tts-engine's option catalog: (value, i18n KEY of the label). The engine NAMES are proper nouns and stay
|
|
105
|
+
* put; what translates is the parenthetical that explains each one. Keys, not text — see input/devices. */
|
|
106
|
+
export declare const TTS_ENGINE_OPTIONS: readonly (readonly [string, string])[];
|
|
107
|
+
export interface VoiceLike {
|
|
108
|
+
name: string;
|
|
109
|
+
lang: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* As vozes do sistema no idioma pedido; sem nenhuma, a lista inteira.
|
|
113
|
+
*
|
|
114
|
+
* Chamava-se `pickPtVoices` e filtrava `/^pt/i` fixo, de modo que o jogo em inglês oferecia à pessoa uma
|
|
115
|
+
* lista de vozes PORTUGUESAS para ler texto em inglês. O nome dizia a verdade sobre o que fazia e mentia
|
|
116
|
+
* sobre o que devia fazer.
|
|
117
|
+
*
|
|
118
|
+
* A comparação é pelo PREFIXO de idioma, não pela etiqueta inteira: quem joga em pt-BR também deve poder
|
|
119
|
+
* escolher uma voz pt-PT se for a única instalada, e o navegador de uma escola raramente tem a variante
|
|
120
|
+
* exata. O recuo para a lista inteira fica: uma lista vazia seria pior que uma lista no idioma errado, que
|
|
121
|
+
* ao menos a pessoa pode ouvir e rejeitar.
|
|
122
|
+
*/
|
|
123
|
+
export declare function pickVoicesFor<T extends VoiceLike>(voices: readonly T[], lang: string): readonly T[];
|
|
124
|
+
/** "<name> (<lang>)" option label. */
|
|
125
|
+
export declare function voiceLabel(v: VoiceLike): string;
|
|
126
|
+
/** Whether the browser can list/switch audio outputs at all (gates the #audio-sinks hint copy). */
|
|
127
|
+
export declare function sinksSupported(hasEnumerateDevices: boolean, hasAudioContextCtor: boolean): boolean;
|
|
128
|
+
export interface SinkDeviceLike {
|
|
129
|
+
deviceId: string;
|
|
130
|
+
label?: string;
|
|
131
|
+
}
|
|
132
|
+
/** A device's option label, falling back to a 1-based "Saída N" when the browser withholds the real label
|
|
133
|
+
* (no getUserMedia permission granted yet). */
|
|
134
|
+
export declare function sinkOptionLabel(d: SinkDeviceLike, index: number): string;
|
|
135
|
+
/** A player's current sink select value ('' = default/shared). */
|
|
136
|
+
export declare function sinkSelectValue(p: {
|
|
137
|
+
audioSink?: string | null;
|
|
138
|
+
} | undefined): string;
|
|
139
|
+
export declare function initSettingsAudio(ctx: SettingsAudioCtx): SettingsAudioApi;
|