@mudlet/mudlet-web 0.3.0
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 +338 -0
- package/README.md +150 -0
- package/dist-lib/App.d.ts +1 -0
- package/dist-lib/MudletWebApp.d.ts +11 -0
- package/dist-lib/ProfileSession.d.ts +15 -0
- package/dist-lib/assets/mapParser.worker-t-3rd1zR.js +9 -0
- package/dist-lib/branding.d.ts +213 -0
- package/dist-lib/core/EventBus.d.ts +29 -0
- package/dist-lib/db/sqliteClient.d.ts +25 -0
- package/dist-lib/hooks/useEngines.d.ts +12 -0
- package/dist-lib/hooks/useMudSession.d.ts +10 -0
- package/dist-lib/hooks/useOutput.d.ts +17 -0
- package/dist-lib/hooks/useViewportMode.d.ts +14 -0
- package/dist-lib/import/applyMudletProfile.d.ts +57 -0
- package/dist-lib/import/collectProfileExport.d.ts +16 -0
- package/dist-lib/import/defaultPackages.d.ts +81 -0
- package/dist-lib/import/defaults/mudlet-mapper.xml +13023 -0
- package/dist-lib/import/defaults/run-lua-code.mpackage +0 -0
- package/dist-lib/import/mudletHost.d.ts +67 -0
- package/dist-lib/import/mudletLink.d.ts +34 -0
- package/dist-lib/import/mudletProfileExport.d.ts +49 -0
- package/dist-lib/import/mudletProfileImport.d.ts +71 -0
- package/dist-lib/import/mudletVariables.d.ts +49 -0
- package/dist-lib/import/mudletWriteback.d.ts +12 -0
- package/dist-lib/import/mudletXmlExport.d.ts +16 -0
- package/dist-lib/import/mudletXmlImport.d.ts +21 -0
- package/dist-lib/import/packageInstaller.d.ts +72 -0
- package/dist-lib/import/packageRepository.d.ts +54 -0
- package/dist-lib/import/remotePackageInstall.d.ts +52 -0
- package/dist-lib/index.d.ts +30 -0
- package/dist-lib/index.js +42307 -0
- package/dist-lib/logging/SessionLogger.d.ts +41 -0
- package/dist-lib/main.d.ts +2 -0
- package/dist-lib/map/MapSelectionOverlay.d.ts +15 -0
- package/dist-lib/map/MapStore.d.ts +1067 -0
- package/dist-lib/map/MudixMapReader.d.ts +90 -0
- package/dist-lib/map/MudletHighlightOverlay.d.ts +18 -0
- package/dist-lib/map/mapImageExport.d.ts +26 -0
- package/dist-lib/map/mapParser.worker.d.ts +1 -0
- package/dist-lib/map/mapParserClient.d.ts +35 -0
- package/dist-lib/map/pathfinding.d.ts +52 -0
- package/dist-lib/map/xmlMapImport.d.ts +28 -0
- package/dist-lib/mud/MudSession.d.ts +236 -0
- package/dist-lib/mud/PatternEngine.d.ts +28 -0
- package/dist-lib/mud/aliases/AliasEngine.d.ts +15 -0
- package/dist-lib/mud/connection/LineAssembler.d.ts +84 -0
- package/dist-lib/mud/connection/MudClient.d.ts +268 -0
- package/dist-lib/mud/connection/PingTracker.d.ts +28 -0
- package/dist-lib/mud/connection/TelnetNegotiator.d.ts +188 -0
- package/dist-lib/mud/connection/telnetDebug.d.ts +54 -0
- package/dist-lib/mud/events.d.ts +160 -0
- package/dist-lib/mud/keybindings/KeyEngine.d.ts +36 -0
- package/dist-lib/mud/keybindings/browserReservedKeys.d.ts +45 -0
- package/dist-lib/mud/keybindings/qtKeys.d.ts +33 -0
- package/dist-lib/mud/protocol/charset.d.ts +105 -0
- package/dist-lib/mud/protocol/constants.d.ts +116 -0
- package/dist-lib/mud/protocol/echo.d.ts +63 -0
- package/dist-lib/mud/protocol/gmcp.d.ts +28 -0
- package/dist-lib/mud/protocol/index.d.ts +11 -0
- package/dist-lib/mud/protocol/mccp.d.ts +18 -0
- package/dist-lib/mud/protocol/mnes.d.ts +83 -0
- package/dist-lib/mud/protocol/msdp.d.ts +19 -0
- package/dist-lib/mud/protocol/msp.d.ts +47 -0
- package/dist-lib/mud/protocol/mssp.d.ts +25 -0
- package/dist-lib/mud/protocol/mxp.d.ts +188 -0
- package/dist-lib/mud/protocol/naws.d.ts +7 -0
- package/dist-lib/mud/replay/ReplayPlayer.d.ts +31 -0
- package/dist-lib/mud/replay/ReplayRecorder.d.ts +18 -0
- package/dist-lib/mud/replay/replayFormat.d.ts +49 -0
- package/dist-lib/mud/text/Console.d.ts +183 -0
- package/dist-lib/mud/text/FormatState.d.ts +256 -0
- package/dist-lib/mud/text/ansiEscapes.d.ts +88 -0
- package/dist-lib/mud/text/cellRender.d.ts +21 -0
- package/dist-lib/mud/text/colorParsers.d.ts +54 -0
- package/dist-lib/mud/text/colors.d.ts +31 -0
- package/dist-lib/mud/text/controlCharacterMode.d.ts +13 -0
- package/dist-lib/mud/text/controlChars.d.ts +31 -0
- package/dist-lib/mud/text/hyperlinkConfig.d.ts +164 -0
- package/dist-lib/mud/text/hyperlinkVisibility.d.ts +37 -0
- package/dist-lib/mud/text/oscLinkManager.d.ts +35 -0
- package/dist-lib/mud/text/wcwidth.d.ts +44 -0
- package/dist-lib/mud/text/xterm256.d.ts +2 -0
- package/dist-lib/mud/timers/TimerEngine.d.ts +61 -0
- package/dist-lib/mud/triggers/ChunkProcessor.d.ts +11 -0
- package/dist-lib/mud/triggers/TriggerEngine.d.ts +188 -0
- package/dist-lib/mud/triggers/pcre/Pcre2.d.ts +26 -0
- package/dist-lib/scripting/EngineHost.d.ts +152 -0
- package/dist-lib/scripting/GlobalEventChannel.d.ts +36 -0
- package/dist-lib/scripting/IScriptingRuntime.d.ts +95 -0
- package/dist-lib/scripting/MapOpenNotifier.d.ts +19 -0
- package/dist-lib/scripting/ScriptingAPI.d.ts +1691 -0
- package/dist-lib/scripting/ScriptingEngine.d.ts +806 -0
- package/dist-lib/scripting/StopwatchManager.d.ts +94 -0
- package/dist-lib/scripting/heldModifiers.d.ts +3 -0
- package/dist-lib/scripting/http/HttpService.d.ts +23 -0
- package/dist-lib/scripting/lua/LuaRuntime.d.ts +190 -0
- package/dist-lib/scripting/lua/bindings/automation.d.ts +10 -0
- package/dist-lib/scripting/lua/bindings/commandLine.d.ts +11 -0
- package/dist-lib/scripting/lua/bindings/context.d.ts +87 -0
- package/dist-lib/scripting/lua/bindings/cursor.d.ts +10 -0
- package/dist-lib/scripting/lua/bindings/diagnostics.d.ts +9 -0
- package/dist-lib/scripting/lua/bindings/map.d.ts +14 -0
- package/dist-lib/scripting/lua/bindings/media.d.ts +24 -0
- package/dist-lib/scripting/lua/bindings/output.d.ts +10 -0
- package/dist-lib/scripting/lua/bindings/packages.d.ts +10 -0
- package/dist-lib/scripting/lua/bindings/session.d.ts +16 -0
- package/dist-lib/scripting/lua/bindings/textEdit.d.ts +9 -0
- package/dist-lib/scripting/lua/bindings/userWindows.d.ts +11 -0
- package/dist-lib/scripting/lua/bindings/window.d.ts +10 -0
- package/dist-lib/scripting/lua/imageSize.d.ts +4 -0
- package/dist-lib/scripting/lua/luaCompletions.d.ts +9 -0
- package/dist-lib/scripting/lua/mudlet-lua/generic-mapper/generic_mapper.mpackage +0 -0
- package/dist-lib/scripting/lua/rex.d.ts +3 -0
- package/dist-lib/scripting/lua/sqlRowEncoder.d.ts +1 -0
- package/dist-lib/scripting/lua/yajl.d.ts +11 -0
- package/dist-lib/scripting/profilesPresence.d.ts +50 -0
- package/dist-lib/scripting/vfs/ProfileVFS.d.ts +62 -0
- package/dist-lib/scripting/vfs/cssRewrite.d.ts +21 -0
- package/dist-lib/scripting/vfs/folderHandleStore.d.ts +16 -0
- package/dist-lib/scripting/vfs/folderSync.d.ts +59 -0
- package/dist-lib/scripting/vfs/htmlRewrite.d.ts +26 -0
- package/dist-lib/scripting/vfs/vfsBridge.d.ts +16 -0
- package/dist-lib/services/cloudflare.d.ts +54 -0
- package/dist-lib/storage/appStore.d.ts +132 -0
- package/dist-lib/storage/crossTabSync.d.ts +3 -0
- package/dist-lib/storage/debouncedStorage.d.ts +18 -0
- package/dist-lib/storage/hooks.d.ts +17 -0
- package/dist-lib/storage/index.d.ts +4 -0
- package/dist-lib/storage/logExport.d.ts +32 -0
- package/dist-lib/storage/logStorage.d.ts +45 -0
- package/dist-lib/storage/mapStorage.d.ts +2 -0
- package/dist-lib/storage/profileVfsData.d.ts +47 -0
- package/dist-lib/storage/schema.d.ts +638 -0
- package/dist-lib/styles.css +2 -0
- package/dist-lib/ui/AboutModal.d.ts +8 -0
- package/dist-lib/ui/BrandLoginFields.d.ts +25 -0
- package/dist-lib/ui/BrandLoginScreen.d.ts +11 -0
- package/dist-lib/ui/CharLoginModal.d.ts +32 -0
- package/dist-lib/ui/CmdLineMenuRegistry.d.ts +27 -0
- package/dist-lib/ui/CodeEditorPreview.d.ts +19 -0
- package/dist-lib/ui/CommandBar.d.ts +17 -0
- package/dist-lib/ui/ConnectionFormModal.d.ts +13 -0
- package/dist-lib/ui/ConnectionGrid.d.ts +18 -0
- package/dist-lib/ui/ConnectionScreen.d.ts +14 -0
- package/dist-lib/ui/FileBrowserModal.d.ts +20 -0
- package/dist-lib/ui/FilePickerModal.d.ts +21 -0
- package/dist-lib/ui/FolderPermissionScreen.d.ts +16 -0
- package/dist-lib/ui/JsonPreview.d.ts +15 -0
- package/dist-lib/ui/LogBrowserModal.d.ts +7 -0
- package/dist-lib/ui/MapEditorModal.d.ts +9 -0
- package/dist-lib/ui/MarkdownPreview.d.ts +15 -0
- package/dist-lib/ui/MergeConflictModal.d.ts +17 -0
- package/dist-lib/ui/ModuleResolveModal.d.ts +22 -0
- package/dist-lib/ui/MouseEventRegistry.d.ts +31 -0
- package/dist-lib/ui/ProfileBusyScreen.d.ts +12 -0
- package/dist-lib/ui/ProfileExportModal.d.ts +7 -0
- package/dist-lib/ui/ProxyInfoModal.d.ts +6 -0
- package/dist-lib/ui/ProxyWhyModal.d.ts +6 -0
- package/dist-lib/ui/ProxyWizardModal.d.ts +6 -0
- package/dist-lib/ui/QuickOpenPalette.d.ts +8 -0
- package/dist-lib/ui/ResizableModal.d.ts +17 -0
- package/dist-lib/ui/ScriptingDocsModal.d.ts +12 -0
- package/dist-lib/ui/SettingsModal.d.ts +9 -0
- package/dist-lib/ui/Toolbar.d.ts +29 -0
- package/dist-lib/ui/bufferWords.d.ts +38 -0
- package/dist-lib/ui/buttons/ButtonsBar.d.ts +21 -0
- package/dist-lib/ui/cmdline/CommandLineManager.d.ts +97 -0
- package/dist-lib/ui/cmdline/CommandLineOverlay.d.ts +8 -0
- package/dist-lib/ui/codemirror/theme.d.ts +5 -0
- package/dist-lib/ui/commandHistory.d.ts +31 -0
- package/dist-lib/ui/components/Button.d.ts +9 -0
- package/dist-lib/ui/components/ConfirmDialog.d.ts +29 -0
- package/dist-lib/ui/components/ContextMenu.d.ts +9 -0
- package/dist-lib/ui/components/FontPicker.d.ts +9 -0
- package/dist-lib/ui/components/FormField.d.ts +16 -0
- package/dist-lib/ui/components/HelpTip.d.ts +7 -0
- package/dist-lib/ui/components/Input.d.ts +6 -0
- package/dist-lib/ui/components/Toggle.d.ts +10 -0
- package/dist-lib/ui/components/index.d.ts +9 -0
- package/dist-lib/ui/components/useModalFocus.d.ts +18 -0
- package/dist-lib/ui/labels/LabelManager.d.ts +220 -0
- package/dist-lib/ui/labels/LabelOverlay.d.ts +9 -0
- package/dist-lib/ui/labels/backgroundImageSize.d.ts +10 -0
- package/dist-lib/ui/labels/cursorShapes.d.ts +6 -0
- package/dist-lib/ui/labels/gifMovie.d.ts +100 -0
- package/dist-lib/ui/labels/qtCss.d.ts +57 -0
- package/dist-lib/ui/layout/ContentLayout.d.ts +19 -0
- package/dist-lib/ui/layout/DockArea.d.ts +14 -0
- package/dist-lib/ui/layout/DockedPanel.d.ts +13 -0
- package/dist-lib/ui/layout/FloatingWindowLayer.d.ts +10 -0
- package/dist-lib/ui/layout/MobileLayout.d.ts +22 -0
- package/dist-lib/ui/layout/PopoutWindow.d.ts +35 -0
- package/dist-lib/ui/layout/ScriptWindow.d.ts +29 -0
- package/dist-lib/ui/layout/SplitGroupPanel.d.ts +17 -0
- package/dist-lib/ui/layout/TabGroupPanel.d.ts +12 -0
- package/dist-lib/ui/layout/WindowContextMenu.d.ts +11 -0
- package/dist-lib/ui/layout/dockDetect.d.ts +26 -0
- package/dist-lib/ui/layout/overlayLayerOrder.d.ts +71 -0
- package/dist-lib/ui/markdown.d.ts +1 -0
- package/dist-lib/ui/output/CaretReviewPanel.d.ts +22 -0
- package/dist-lib/ui/output/OutputArea.d.ts +9 -0
- package/dist-lib/ui/output/OutputContextMenu.d.ts +23 -0
- package/dist-lib/ui/output/OutputRenderer.d.ts +64 -0
- package/dist-lib/ui/output/ScreenReaderLog.d.ts +23 -0
- package/dist-lib/ui/output/StickyOutputPanel.d.ts +28 -0
- package/dist-lib/ui/output/backgroundImageStyle.d.ts +17 -0
- package/dist-lib/ui/output/caretMode.d.ts +40 -0
- package/dist-lib/ui/output/linkNavigation.d.ts +29 -0
- package/dist-lib/ui/output/osc8Menu.d.ts +16 -0
- package/dist-lib/ui/output/outputCopy.d.ts +15 -0
- package/dist-lib/ui/preventPinchZoom.d.ts +1 -0
- package/dist-lib/ui/scrollbox/ScrollBoxManager.d.ts +62 -0
- package/dist-lib/ui/scrollbox/ScrollBoxOverlay.d.ts +25 -0
- package/dist-lib/ui/sound/SoundManager.d.ts +149 -0
- package/dist-lib/ui/sound/closedCaption.d.ts +37 -0
- package/dist-lib/ui/textedit/TextEditManager.d.ts +56 -0
- package/dist-lib/ui/tts/TtsManager.d.ts +68 -0
- package/dist-lib/ui/useBrandLogin.d.ts +19 -0
- package/dist-lib/ui/useCommandHistory.d.ts +7 -0
- package/dist-lib/ui/video/VideoManager.d.ts +56 -0
- package/dist-lib/ui/windows/ScriptEditorModal.d.ts +13 -0
- package/dist-lib/ui/windows/WindowManager.d.ts +694 -0
- package/dist-lib/ui/windows/panels/HtmlPanel.d.ts +27 -0
- package/dist-lib/ui/windows/panels/LuaEditor.d.ts +14 -0
- package/dist-lib/ui/windows/panels/MapPanel.d.ts +8 -0
- package/dist-lib/ui/windows/panels/PackageRepositoryModal.d.ts +18 -0
- package/dist-lib/ui/windows/panels/ScriptEditorPanel.d.ts +24 -0
- package/dist-lib/ui/windows/panels/ScriptSearch.d.ts +12 -0
- package/dist-lib/ui/windows/panels/TextPanel.d.ts +35 -0
- package/dist-lib/ui/windows/panels/VariablesView.d.ts +21 -0
- package/dist-lib/ui/windows/panels/VfsModulePickerModal.d.ts +8 -0
- package/dist-lib/ui/windows/panels/WindowCmdLine.d.ts +23 -0
- package/dist-lib/ui/windows/types.d.ts +145 -0
- package/dist-lib/utils/documentTitle.d.ts +33 -0
- package/dist-lib/utils/fontLoader.d.ts +52 -0
- package/dist-lib/utils/profileLock.d.ts +26 -0
- package/dist-lib/utils/sessionCredentials.d.ts +16 -0
- package/dist-lib/version.d.ts +39 -0
- package/dist-lib/vfs-sw.js +131 -0
- package/dist-lib/vite.d.ts +2 -0
- package/dist-lib/vite.js +154 -0
- package/package.json +93 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/** Backing store for persistent stopwatches (localStorage in the browser). */
|
|
2
|
+
export interface StopwatchStore {
|
|
3
|
+
load(): string | null;
|
|
4
|
+
save(data: string): void;
|
|
5
|
+
}
|
|
6
|
+
/** Build a localStorage-backed store scoped to a connection, or undefined when
|
|
7
|
+
* localStorage is unavailable (tests / SSR) — in which case persistence is a
|
|
8
|
+
* no-op and watches behave as memory-only. */
|
|
9
|
+
export declare function localStorageStopwatchStore(connectionId: string): StopwatchStore | undefined;
|
|
10
|
+
/** Broken-down elapsed time, mirroring Mudlet's generateElapsedTimeTable. */
|
|
11
|
+
export interface BrokenDownTime {
|
|
12
|
+
negative: boolean;
|
|
13
|
+
days: number;
|
|
14
|
+
hours: number;
|
|
15
|
+
minutes: number;
|
|
16
|
+
seconds: number;
|
|
17
|
+
milliSeconds: number;
|
|
18
|
+
/** Signed total seconds (matches Mudlet's elapsedMilliSeconds / 1000). */
|
|
19
|
+
decimalSeconds: number;
|
|
20
|
+
}
|
|
21
|
+
/** Per-watch record returned by getStopWatches (keyed by stringified id). */
|
|
22
|
+
export interface StopwatchSummary {
|
|
23
|
+
name: string;
|
|
24
|
+
isRunning: boolean;
|
|
25
|
+
isPersistent: boolean;
|
|
26
|
+
elapsedTime: BrokenDownTime;
|
|
27
|
+
}
|
|
28
|
+
export declare class StopwatchManager {
|
|
29
|
+
private readonly storage?;
|
|
30
|
+
private readonly watches;
|
|
31
|
+
private nextId;
|
|
32
|
+
constructor(storage?: StopwatchStore | undefined);
|
|
33
|
+
private now;
|
|
34
|
+
private elapsedMs;
|
|
35
|
+
/**
|
|
36
|
+
* Resolve a watchID-or-name argument. Numbers (and numeric strings, which
|
|
37
|
+
* Mudlet's lua_isnumber treats as ids) look up by id; other strings look up
|
|
38
|
+
* by name. An empty string returns the first unnamed watch — Mudlet's
|
|
39
|
+
* findStopWatchId("") behaviour.
|
|
40
|
+
*/
|
|
41
|
+
private resolve;
|
|
42
|
+
/** Rehydrate persistent watches from the backing store (called once on construction). */
|
|
43
|
+
private restore;
|
|
44
|
+
/** Write the current set of persistent watches to the backing store. */
|
|
45
|
+
private persist;
|
|
46
|
+
/**
|
|
47
|
+
* Mudlet createStopWatch([name], [autostart]). Returns the new id, or null
|
|
48
|
+
* when `name` is given and already in use (Mudlet rejects duplicate names).
|
|
49
|
+
*/
|
|
50
|
+
create(name: string, autoStart: boolean): number | null;
|
|
51
|
+
/**
|
|
52
|
+
* Mudlet startStopWatch. `resetAndRestart` replicates the legacy behaviour
|
|
53
|
+
* for a numeric id called bare: reset to zero and run from there. Otherwise
|
|
54
|
+
* a stopped watch resumes and a running one is left untouched. Returns false
|
|
55
|
+
* for an unknown watch.
|
|
56
|
+
*/
|
|
57
|
+
start(arg: number | string, resetAndRestart: boolean): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Mudlet stopStopWatch. Pauses the watch and returns the elapsed seconds
|
|
60
|
+
* once (legacy behaviour preserved by Mudlet). null for an unknown watch.
|
|
61
|
+
*/
|
|
62
|
+
stop(arg: number | string): number | null;
|
|
63
|
+
/** Mudlet getStopWatchTime — elapsed seconds without stopping. */
|
|
64
|
+
getTime(arg: number | string): number | null;
|
|
65
|
+
/** Mudlet getStopWatchBrokenDownTime — elapsed time as a day/hour/minute/
|
|
66
|
+
* second/millisecond table. null for an unknown watch. */
|
|
67
|
+
getBrokenDownTime(arg: number | string): BrokenDownTime | null;
|
|
68
|
+
/**
|
|
69
|
+
* Mudlet setStopWatchName(watchID|currentName, newName). Assigns or renames
|
|
70
|
+
* a watch. Returns false for an unknown watch, an empty new name, or when
|
|
71
|
+
* another watch already uses the new name (Mudlet rejects duplicate names).
|
|
72
|
+
*/
|
|
73
|
+
/**
|
|
74
|
+
* Mudlet `setStopWatchName(id|name, newName)`. Refuses a name another
|
|
75
|
+
* stopwatch already carries, naming that one — the reason has to reach the
|
|
76
|
+
* caller, so this returns the message (null on success) rather than a bare
|
|
77
|
+
* boolean the binding would have to guess a reason for.
|
|
78
|
+
*/
|
|
79
|
+
setName(arg: number | string, newName: string): boolean | string;
|
|
80
|
+
/** Mudlet resetStopWatch — zero the elapsed time; a running watch keeps running. */
|
|
81
|
+
reset(arg: number | string): boolean;
|
|
82
|
+
/** Mudlet adjustStopWatch — add `seconds` (may be negative) to the elapsed time. */
|
|
83
|
+
adjust(arg: number | string, seconds: number): boolean;
|
|
84
|
+
/** Mudlet deleteStopWatch. */
|
|
85
|
+
delete(arg: number | string): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Mudlet setStopWatchPersistence(id|name, state). Marks whether the watch is
|
|
88
|
+
* saved to (and restored from) the backing store across reloads. Returns
|
|
89
|
+
* false for an unknown watch.
|
|
90
|
+
*/
|
|
91
|
+
setPersistence(arg: number | string, state: boolean): boolean;
|
|
92
|
+
/** Mudlet getStopWatches — record keyed by stringified id (Bridge.lua re-keys to ints). */
|
|
93
|
+
getAll(): Record<string, StopwatchSummary>;
|
|
94
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ProfileVFS } from '../vfs/ProfileVFS';
|
|
2
|
+
type EmitFn = (event: string, args: unknown[]) => void;
|
|
3
|
+
type VFSGetter = () => ProfileVFS | null;
|
|
4
|
+
type ProxyUrlGetter = () => string | undefined;
|
|
5
|
+
export declare class HttpService {
|
|
6
|
+
private readonly emit;
|
|
7
|
+
private readonly vfsGetter;
|
|
8
|
+
private readonly proxyUrlGetter;
|
|
9
|
+
private readonly proxiedOrigins;
|
|
10
|
+
constructor(emit: EmitFn, vfsGetter: VFSGetter, proxyUrlGetter?: ProxyUrlGetter);
|
|
11
|
+
downloadFile(saveTo: string, url: string): void;
|
|
12
|
+
getHTTP(url: string, headers?: Record<string, string>): void;
|
|
13
|
+
postHTTP(data: string | null, url: string, headers?: Record<string, string>, file?: string): void;
|
|
14
|
+
putHTTP(data: string | null, url: string, headers?: Record<string, string>, file?: string): void;
|
|
15
|
+
deleteHTTP(url: string, headers?: Record<string, string>): void;
|
|
16
|
+
customHTTP(method: string, data: string | null, url: string, headers?: Record<string, string>, file?: string): void;
|
|
17
|
+
private runDownload;
|
|
18
|
+
private readWithProgress;
|
|
19
|
+
private bodyForUpload;
|
|
20
|
+
private runRequest;
|
|
21
|
+
private fetchWithFallback;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import type { IScriptingRuntime, CaptureSpan, LuaGlobalEntry } from '../IScriptingRuntime';
|
|
2
|
+
import type { ScriptingAPI } from '../ScriptingAPI';
|
|
3
|
+
import type { ProfileVFS } from '../vfs/ProfileVFS';
|
|
4
|
+
import { type MudletVariable } from '../../import/mudletVariables';
|
|
5
|
+
export declare class LuaRuntime implements IScriptingRuntime {
|
|
6
|
+
private readonly lua;
|
|
7
|
+
private readonly api;
|
|
8
|
+
private vfs;
|
|
9
|
+
private readonly proxyUrlGetter;
|
|
10
|
+
private readonly tempIds;
|
|
11
|
+
private nextTempId;
|
|
12
|
+
private readonly labelCbIds;
|
|
13
|
+
private cmdLineActionCbId;
|
|
14
|
+
private windowCmdLineActionCbIds;
|
|
15
|
+
private overlayCmdLineActionCbIds;
|
|
16
|
+
private currentMatches;
|
|
17
|
+
private currentCaptureSpans;
|
|
18
|
+
private currentNamedSpans;
|
|
19
|
+
private currentFullMatchSpan;
|
|
20
|
+
private _denyCurrentSend;
|
|
21
|
+
private destroyed;
|
|
22
|
+
private readonly watchedPaths;
|
|
23
|
+
private readonly rawFnPtrs;
|
|
24
|
+
private http;
|
|
25
|
+
private tts;
|
|
26
|
+
private globalEvents;
|
|
27
|
+
private flushPendingSqlSnapshots;
|
|
28
|
+
private toLuaValue;
|
|
29
|
+
private constructor();
|
|
30
|
+
static create(api: ScriptingAPI, vfs?: ProfileVFS | null, proxyUrlGetter?: () => string | undefined): Promise<LuaRuntime>;
|
|
31
|
+
private setup;
|
|
32
|
+
private installFastColorEcho;
|
|
33
|
+
private setupAnsiColorTable;
|
|
34
|
+
/**
|
|
35
|
+
* True when a script-created (temp) alias/trigger with this id is live and of
|
|
36
|
+
* the given type. Backs exists(id, "alias"/"trigger") for temp items, which
|
|
37
|
+
* don't live in the persisted store the way permanent items do.
|
|
38
|
+
*/
|
|
39
|
+
tempItemExists(id: number, type: string): boolean;
|
|
40
|
+
/** enableTrigger/disableTrigger/enableAlias/disableAlias with a numeric id.
|
|
41
|
+
* False when no temp item of that id is live. */
|
|
42
|
+
setTempItemEnabled(id: number, enabled: boolean): boolean;
|
|
43
|
+
/** Whether a live temp item is enabled — backs isActive(id, type). */
|
|
44
|
+
tempItemEnabled(id: number): boolean;
|
|
45
|
+
private setupBustedBridge;
|
|
46
|
+
private setupSqlBridge;
|
|
47
|
+
/**
|
|
48
|
+
* Fire sysPathChanged for any addFileWatch subscription whose path equals
|
|
49
|
+
* `changedPath` or is an ancestor directory of it. Mudlet's QFileSystemWatcher
|
|
50
|
+
* reports the *watched* path (not the inner file) for directory watches, so
|
|
51
|
+
* we do the same — handlers comparing `path == watchedPath` round-trip.
|
|
52
|
+
*/
|
|
53
|
+
private notifyVfsPathChange;
|
|
54
|
+
private setupVFS;
|
|
55
|
+
load(code: string, name: string): void;
|
|
56
|
+
run(code: string, name: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Restore saved Lua globals (a parsed Mudlet `<VariablePackage>` tree) into
|
|
59
|
+
* `_G`. Call on profile load, after the bundle is up but before user scripts
|
|
60
|
+
* run, so handlers see their persisted state. No-op for an empty list.
|
|
61
|
+
*/
|
|
62
|
+
restoreVariables(vars: MudletVariable[]): void;
|
|
63
|
+
/**
|
|
64
|
+
* Snapshot the current values of the save-listed globals out of `_G` into a
|
|
65
|
+
* `MudletVariable[]` tree (for serialization to `<VariablePackage>` / the
|
|
66
|
+
* profile JSON). `saveList` is the set of top-level global names flagged to
|
|
67
|
+
* persist (Mudlet's VarUnit::mSaveList). Names that are unset or hold a
|
|
68
|
+
* non-serializable value (function/userdata/thread) are skipped.
|
|
69
|
+
*/
|
|
70
|
+
captureVariables(saveList: string[]): MudletVariable[];
|
|
71
|
+
/** Enumerate `_G` (user globals as a nested tree, built-ins flagged) for the
|
|
72
|
+
* Variables view. See {@link LuaGlobalEntry}. */
|
|
73
|
+
listGlobals(): LuaGlobalEntry[];
|
|
74
|
+
runWithMatches(code: string, name: string, matches: (string | undefined)[], multimatches?: (string | undefined)[][], namedGroups?: Record<string, string>, captureSpans?: CaptureSpan[], namedSpans?: Record<string, CaptureSpan>, fullMatchSpan?: CaptureSpan): void;
|
|
75
|
+
private setMatches;
|
|
76
|
+
/** Push a 1-indexed Lua table of capture strings (`matches[1]` = whole match),
|
|
77
|
+
* optionally merging named captures as string keys (`matches.hp`). Same shape
|
|
78
|
+
* the old `oneIndexed()` + `global.set` produced, via raw stack ops. An
|
|
79
|
+
* unmatched optional group (`undefined`) is left unset → nil, as before. */
|
|
80
|
+
private pushMatchesTable;
|
|
81
|
+
private exec;
|
|
82
|
+
private execInner;
|
|
83
|
+
private runChunk;
|
|
84
|
+
private static readonly FILE_DIALOG_SENTINEL;
|
|
85
|
+
/** Threads suspended in invokeFileDialog, tracked so destroy() forgets
|
|
86
|
+
* them (their registry refs die with the closed Lua state). */
|
|
87
|
+
private readonly parkedDialogs;
|
|
88
|
+
/**
|
|
89
|
+
* A thread resume returned LUA_YIELD. If it is invokeFileDialog's yield
|
|
90
|
+
* (sentinel first), read the request off the thread stack, anchor the
|
|
91
|
+
* thread, and open the picker — returns true. Any other yield reaching
|
|
92
|
+
* the handler boundary is a script bug (stock Lua 5.1 errors with
|
|
93
|
+
* "attempt to yield from outside a coroutine" there): report and abandon
|
|
94
|
+
* the thread — returns false.
|
|
95
|
+
*
|
|
96
|
+
* First park: the thread still sits at `threadIndex` on the global stack
|
|
97
|
+
* (the caller's finally pops it), so take a registry ref now. Re-park
|
|
98
|
+
* (`existingRef` set): the previous ref already anchors this thread.
|
|
99
|
+
*/
|
|
100
|
+
private parkDialogThread;
|
|
101
|
+
/** Continue a parked handler with the picked VFS path ('' = cancelled). */
|
|
102
|
+
private resumeDialogThread;
|
|
103
|
+
private dispatchCb;
|
|
104
|
+
private dispatchCbWithArg;
|
|
105
|
+
private unregisterCb;
|
|
106
|
+
private execModule;
|
|
107
|
+
private dispatchingEvent;
|
|
108
|
+
private readonly pendingEvents;
|
|
109
|
+
emitEvent(event: string, args: unknown[]): void;
|
|
110
|
+
private dispatchEventNow;
|
|
111
|
+
setGmcpValue(path: string, value: unknown): void;
|
|
112
|
+
setMsdpValue(path: string, value: unknown): void;
|
|
113
|
+
setMsspValue(name: string, value: string): void;
|
|
114
|
+
/**
|
|
115
|
+
* Bridges one use of a server-defined MXP element into the Lua `mxp` global
|
|
116
|
+
* as `mxp.<element>` — a fresh table each time, with every attribute key
|
|
117
|
+
* lowercased and a `text` field, exactly as Mudlet's signalMXPEvent builds
|
|
118
|
+
* it. Values keep their case.
|
|
119
|
+
*/
|
|
120
|
+
setMxpElement(name: string, attrs: Record<string, string>): void;
|
|
121
|
+
/**
|
|
122
|
+
* Mudlet-style async unzip. Reads the zip from the profile VFS, decodes
|
|
123
|
+
* it on a worker (fflate falls back to a chunked main-thread decode where
|
|
124
|
+
* workers aren't available), writes every entry under destDir, then
|
|
125
|
+
* raises sysUnzipDone / sysUnzipError. Always fire-and-forget.
|
|
126
|
+
*/
|
|
127
|
+
private runUnzipAsync;
|
|
128
|
+
setCurrentLine(line: string, _isPrompt: boolean): void;
|
|
129
|
+
setCommand(command: string): void;
|
|
130
|
+
dispatchSendRequest(text: string): boolean;
|
|
131
|
+
killScriptHandlers(scriptId: string): void;
|
|
132
|
+
/**
|
|
133
|
+
* Mudlet REGEX_LUA_CODE: the pattern body runs as a Lua function on every
|
|
134
|
+
* incoming line. Side effects (raiseEvent, etc.) always run; the trigger
|
|
135
|
+
* "matches" only when the body returns a truthy value.
|
|
136
|
+
*/
|
|
137
|
+
evalTriggerPattern(code: string): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Invoke a `registerMapInfo` contributor. The Lua dispatcher pcalls the
|
|
140
|
+
* stashed callback and writes its multi-return into scalar globals
|
|
141
|
+
* (`__mudix_mapinfo_text` / _bold / _italic / _r / _g / _b). Returning
|
|
142
|
+
* `null` covers three cases: runtime is being torn down, callback id is
|
|
143
|
+
* stale, or the callback returned a nil/empty text — the panel treats
|
|
144
|
+
* all three the same (skip the entry).
|
|
145
|
+
*/
|
|
146
|
+
private evaluateMapInfo;
|
|
147
|
+
/**
|
|
148
|
+
* Invoke a `setExitWeightFilter` callback for a single candidate exit.
|
|
149
|
+
* The Lua dispatcher pcalls the stashed callback and normalises its return
|
|
150
|
+
* into two scalar globals, mirroring Mudlet's applyExitWeightFilter
|
|
151
|
+
* (TLuaInterpreterMapper.cpp): boolean `false` or the string "block"
|
|
152
|
+
* (case-insensitive) blocks the exit; a number becomes a weight override
|
|
153
|
+
* clamped to [1, INT_MAX]; nil, `true` and anything else are ignored.
|
|
154
|
+
*
|
|
155
|
+
* Runs re-entrantly — findPath calls this while Lua is already suspended
|
|
156
|
+
* inside the `__getPath` JS call — so it must not touch the output queue or
|
|
157
|
+
* any other state a live Lua frame could also be mutating.
|
|
158
|
+
*/
|
|
159
|
+
private evaluateExitWeightFilter;
|
|
160
|
+
/**
|
|
161
|
+
* Push a JS value onto `L`'s stack via the raw lua_* C API, mirroring
|
|
162
|
+
* wasmoon's pushValue conventions EXACTLY so behaviour is byte-identical to
|
|
163
|
+
* the generic path — only the O(n²) ref/unref bookkeeping wasmoon's
|
|
164
|
+
* pushTable does (see issue #2) is gone:
|
|
165
|
+
* - integer-valued numbers → lua_pushinteger, others → lua_pushnumber
|
|
166
|
+
* - arrays keyed by Object.keys + lua_rawseti, so dense 0-based arrays
|
|
167
|
+
* (map getters) stay 0-indexed and the sparse 1-based arrays toLuaValue
|
|
168
|
+
* builds stay 1-indexed — identical to wasmoon's arrIndexs handling
|
|
169
|
+
* - plain objects → string keys via lua_setfield
|
|
170
|
+
* Anything that isn't a primitive / plain array / plain object (wasmoon
|
|
171
|
+
* LuaTable proxies such as the yajl.null sentinel, functions, Maps, class
|
|
172
|
+
* instances) is delegated to wasmoon's own pushValue, which is O(1) for
|
|
173
|
+
* these leaves and preserves their reference identity. Such values only
|
|
174
|
+
* appear as leaves of GMCP/MSDP payloads (toLuaValue rebuilds every
|
|
175
|
+
* container as a fresh plain array/object) and always push on the main
|
|
176
|
+
* thread; on a coroutine stack we can't safely delegate, so degrade to nil.
|
|
177
|
+
*/
|
|
178
|
+
private pushJsValue;
|
|
179
|
+
/**
|
|
180
|
+
* Register `name` as a raw lua_CFunction (bypassing wasmoon's generic
|
|
181
|
+
* pushValue marshalling for the return value). `fn` receives the lua_State
|
|
182
|
+
* pointer, reads its args via the raw lua_* API, pushes its results with
|
|
183
|
+
* pushJsValue(), and returns the result count. A throw across the WASM
|
|
184
|
+
* trampoline would corrupt the C stack, so it is contained and the getter
|
|
185
|
+
* degrades to a single nil (these are read-only queries — a nil miss is a
|
|
186
|
+
* safe fallback).
|
|
187
|
+
*/
|
|
188
|
+
private registerRawGlobal;
|
|
189
|
+
destroy(): void;
|
|
190
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BindingContext } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* Enable/disable/exists/kill for the six automation node types (scripts,
|
|
4
|
+
* triggers, aliases, timers, keys, buttons), plus the perm* constructors that
|
|
5
|
+
* create them from Lua and the toolbar/button state accessors.
|
|
6
|
+
*
|
|
7
|
+
* Every one of these is a thin forward into ScriptingAPI, which in turn routes
|
|
8
|
+
* through the engine callbacks so mutations land in the appStore tree.
|
|
9
|
+
*/
|
|
10
|
+
export declare function installAutomationBindings({ lua, api }: BindingContext): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BindingContext } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* The main command bar and Mudlet's createCommandLine overlays: reading and
|
|
4
|
+
* writing the input text, styling, autocomplete suggestions, and the
|
|
5
|
+
* right-click context menu Lua can populate.
|
|
6
|
+
*
|
|
7
|
+
* 'Command line' here covers three distinct targets - the main command bar, a
|
|
8
|
+
* user window's embedded input, and a free-floating createCommandLine widget -
|
|
9
|
+
* which cmdLineKind below resolves from the name Lua passed.
|
|
10
|
+
*/
|
|
11
|
+
export declare function installCommandLineBindings({ lua, api, channel, emitEvent }: BindingContext): void;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { Lua } from 'wasmoon-lua5.1';
|
|
2
|
+
import type { ScriptingAPI } from '../../ScriptingAPI';
|
|
3
|
+
import type { ExitWeightFilterResult } from '../../../map/pathfinding';
|
|
4
|
+
import type { ProfileVFS } from '../../vfs/ProfileVFS';
|
|
5
|
+
/** wasmoon doesn't re-export its opaque lua_State pointer type; derive it from
|
|
6
|
+
* the public API so raw lua_* bindings can be typed without reaching into the
|
|
7
|
+
* package internals. Mirrors the alias in LuaRuntime. */
|
|
8
|
+
export type LuaState = Lua['global']['address'];
|
|
9
|
+
/** What a `registerMapInfo` callback yields once evaluated on the Lua side. */
|
|
10
|
+
export interface MapInfoEvaluation {
|
|
11
|
+
text: string;
|
|
12
|
+
isBold: boolean;
|
|
13
|
+
isItalic: boolean;
|
|
14
|
+
color?: {
|
|
15
|
+
r: number;
|
|
16
|
+
g: number;
|
|
17
|
+
b: number;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The slice of {@link LuaRuntime} internals that the extracted binding modules
|
|
22
|
+
* are allowed to touch.
|
|
23
|
+
*
|
|
24
|
+
* Historically every Mudlet global was registered inside a single 3,700-line
|
|
25
|
+
* `LuaRuntime.setup()`, so each binding closed over `this` and could reach any
|
|
26
|
+
* private field. Splitting those registrations into per-domain modules needs a
|
|
27
|
+
* deliberate seam: this interface *is* that seam. Anything a binding module
|
|
28
|
+
* needs from the runtime is declared here, which keeps the dependency surface
|
|
29
|
+
* visible (and reviewable) instead of implicit.
|
|
30
|
+
*
|
|
31
|
+
* Mutable runtime state is exposed as accessor methods rather than fields —
|
|
32
|
+
* a plain field copy would snapshot the value at context-construction time and
|
|
33
|
+
* miss every later mutation (`nextTempId`, the match arrays, and the callback
|
|
34
|
+
* id counters are all reassigned during normal operation).
|
|
35
|
+
*/
|
|
36
|
+
export interface BindingContext {
|
|
37
|
+
/** The live Lua VM. Bindings register globals via `lua.global.set(...)`. */
|
|
38
|
+
readonly lua: Lua;
|
|
39
|
+
/** The bridge into MUD sends, windows, timers, sound, the map, and so on. */
|
|
40
|
+
readonly api: ScriptingAPI;
|
|
41
|
+
/**
|
|
42
|
+
* Coerce a Lua-passed value to an integer colour channel in 0..255,
|
|
43
|
+
* returning null when it is non-finite or out of range. Mudlet validates
|
|
44
|
+
* each channel this way and silently no-ops on a bad one, so callers treat
|
|
45
|
+
* null as "leave the pen alone".
|
|
46
|
+
*
|
|
47
|
+
* Shared rather than per-module: nine different binding domains (labels,
|
|
48
|
+
* borders, env colours, room highlights, sounds, …) validate channels.
|
|
49
|
+
*/
|
|
50
|
+
channel(v: unknown): number | null;
|
|
51
|
+
/**
|
|
52
|
+
* Invoke a Lua callback previously registered through `__mudix_register_cb`.
|
|
53
|
+
* `what` names the call site and is used only to attribute errors.
|
|
54
|
+
*/
|
|
55
|
+
dispatchCb(id: number, what: string): void;
|
|
56
|
+
/** Release a registered Lua callback slot so its chunk can be collected. */
|
|
57
|
+
releaseCb(id: number): void;
|
|
58
|
+
/** Raise a Mudlet event on the Lua side (deferred if a dispatch is live). */
|
|
59
|
+
emitEvent(name: string, args: unknown[]): void;
|
|
60
|
+
/** This profile's virtual filesystem, or null before one is mounted.
|
|
61
|
+
* Never reassigned after the runtime is constructed, so a plain reference
|
|
62
|
+
* is safe here. */
|
|
63
|
+
readonly vfs: ProfileVFS | null;
|
|
64
|
+
/** Drop a Lua-side callback registration by id (the registry slot behind
|
|
65
|
+
* `__mudix_register_cb`). Distinct from {@link releaseCb}, which goes
|
|
66
|
+
* through Lua; this is the direct JS-side removal. */
|
|
67
|
+
unregisterCb(cbId: number): void;
|
|
68
|
+
/** Marshal a JS value onto the Lua stack. Used by the raw lua_CFunction
|
|
69
|
+
* getters that return tables too large to round-trip through wasmoon's
|
|
70
|
+
* automatic conversion. */
|
|
71
|
+
pushJsValue(L: LuaState, value: unknown, depth?: number): void;
|
|
72
|
+
/** Register a global implemented as a raw lua_CFunction rather than a
|
|
73
|
+
* wasmoon-wrapped JS function. */
|
|
74
|
+
registerRawGlobal(name: string, fn: (L: LuaState) => number): void;
|
|
75
|
+
/** Callback-registry ids for `setCmdLineAction` handlers bound to overlay
|
|
76
|
+
* command lines (createCommandLine widgets), keyed by widget name. Held so
|
|
77
|
+
* a re-bind or a delete can free the previous Lua registry slot instead of
|
|
78
|
+
* leaking it. Mutated in place and never reassigned, so a reference is
|
|
79
|
+
* enough. */
|
|
80
|
+
readonly overlayCmdLineActionCbIds: Map<string, number>;
|
|
81
|
+
/** Run a registerMapInfo callback and read back what it produced. */
|
|
82
|
+
evaluateMapInfo(cbId: number, roomId: number | null, selectionSize: number, areaId: number, displayedAreaId: number): MapInfoEvaluation | null;
|
|
83
|
+
/** Run a `setExitWeightFilter` callback for one candidate exit and read
|
|
84
|
+
* back its verdict. Called from inside findPath — i.e. re-entrantly,
|
|
85
|
+
* while Lua is already suspended in the `__getPath` JS call. */
|
|
86
|
+
evaluateExitWeightFilter(cbId: number, roomId: number, exitCommand: string): ExitWeightFilterResult;
|
|
87
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BindingContext } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* Line, cursor, and scrollback inspection: reading the buffer, moving the
|
|
4
|
+
* output cursor, scrolling, wrap settings, column/row geometry, and the
|
|
5
|
+
* selection primitives triggers use to recolour matched text.
|
|
6
|
+
*
|
|
7
|
+
* Mudlet models a console as a cursor over a line buffer, so most of these are
|
|
8
|
+
* stateful with respect to the currently selected window.
|
|
9
|
+
*/
|
|
10
|
+
export declare function installCursorBindings({ lua, api }: BindingContext): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BindingContext } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* Error reporting and the send/alias expansion primitives.
|
|
4
|
+
*
|
|
5
|
+
* Grouped because both are about what user code does *around* a command rather
|
|
6
|
+
* than with the console: raising a script error the editor can attribute, and
|
|
7
|
+
* expanding an alias without executing it.
|
|
8
|
+
*/
|
|
9
|
+
export declare function installDiagnosticsBindings({ lua, api }: BindingContext): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BindingContext } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* Mudlet's map API: the 2D view, room and area CRUD, exits, doors, custom
|
|
4
|
+
* lines, labels, highlights, selection, per-room styling, user data, and the
|
|
5
|
+
* mapInfo / context-menu extension points.
|
|
6
|
+
*
|
|
7
|
+
* This is by far the widest binding surface in the runtime — it mirrors
|
|
8
|
+
* Mudlet's map Lua API essentially one-for-one — so it lives in its own
|
|
9
|
+
* module. The heavy lifting is all in MapStore behind `api.map`; the code
|
|
10
|
+
* here is argument coercion and Mudlet's return-shape conventions (notably
|
|
11
|
+
* alse where Mudlet returns nil, which Bridge.lua unpacks into the
|
|
12
|
+
* documented (nil, errMsg) multi-returns).
|
|
13
|
+
*/
|
|
14
|
+
export declare function installMapBindings({ lua, api, vfs, channel, emitEvent, unregisterCb, pushJsValue, registerRawGlobal, evaluateMapInfo, evaluateExitWeightFilter, }: BindingContext): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TtsManager } from '../../../ui/tts/TtsManager';
|
|
2
|
+
import type { BindingContext } from './context';
|
|
3
|
+
/**
|
|
4
|
+
* Mudlet playSoundFile / playMusicFile / stopSounds / stopMusic and friends.
|
|
5
|
+
* Web Audio backend lives on session.sounds.
|
|
6
|
+
*/
|
|
7
|
+
export declare function installSoundBindings({ lua, api }: BindingContext): void;
|
|
8
|
+
/**
|
|
9
|
+
* Mudlet playVideoFile / pauseVideos / stopVideos.
|
|
10
|
+
* Same VFS-or-URL loader as sounds; videos mount on the main viewport.
|
|
11
|
+
* playVideoFile(path [, volume, loops]) | playVideoFile{name=..., ...}.
|
|
12
|
+
*/
|
|
13
|
+
export declare function installVideoBindings({ lua, api }: BindingContext): void;
|
|
14
|
+
/**
|
|
15
|
+
* Mudlet ttsSpeak / ttsQueue / ttsSetRate / … — Web Speech API backend.
|
|
16
|
+
*
|
|
17
|
+
* The manager is constructed by the runtime (it needs the runtime's own event
|
|
18
|
+
* emitter) and passed in, so this module stays free of runtime internals.
|
|
19
|
+
*
|
|
20
|
+
* These globals are bound BEFORE LuaGlobal.lua loads Other.lua, so its
|
|
21
|
+
* `if not ttsSpeak` guard sees real implementations and skips installing the
|
|
22
|
+
* no-op dummy stubs.
|
|
23
|
+
*/
|
|
24
|
+
export declare function installTtsBindings({ lua }: BindingContext, tts: TtsManager): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BindingContext } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* Console output and text formatting: the echo family's targets, foreground/
|
|
4
|
+
* background pens, bold/italic/underline/strikethrough attributes, hyperlink
|
|
5
|
+
* and popup insertion, and the format-state reset primitives.
|
|
6
|
+
*
|
|
7
|
+
* Colour channels are validated through the shared 0..255 coercion; Mudlet
|
|
8
|
+
* silently no-ops on an out-of-range channel rather than raising.
|
|
9
|
+
*/
|
|
10
|
+
export declare function installOutputBindings({ lua, api, channel }: BindingContext): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BindingContext } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* Mudlet package and module management: install/uninstall, the module sync and
|
|
4
|
+
* priority accessors, and the manifest info getters/setters.
|
|
5
|
+
*
|
|
6
|
+
* Modules differ from packages by being backed by a file on disk that can be
|
|
7
|
+
* synced back; the requireModule helper below centralises the 'does this module
|
|
8
|
+
* exist' guard the Mudlet API applies before every module operation.
|
|
9
|
+
*/
|
|
10
|
+
export declare function installPackageBindings({ lua, api }: BindingContext): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { GlobalEventChannel } from '../../GlobalEventChannel';
|
|
2
|
+
import type { BindingContext } from './context';
|
|
3
|
+
/**
|
|
4
|
+
* Session-level introspection and event raising: stopwatches, the console
|
|
5
|
+
* width, connection info, desktop notifications, screen-reader announcements,
|
|
6
|
+
* the clock, and raiseEvent / raiseGlobalEvent.
|
|
7
|
+
*
|
|
8
|
+
* These share no subsystem - what groups them is that each answers a question
|
|
9
|
+
* about (or acts on) the session as a whole rather than a specific window,
|
|
10
|
+
* which is why they were interleaved in the original setup().
|
|
11
|
+
*
|
|
12
|
+
* The cross-tab channel behind raiseGlobalEvent is constructed by the runtime
|
|
13
|
+
* and passed in: it needs the runtime's event emitter and the live profile
|
|
14
|
+
* name, neither of which belongs in this module.
|
|
15
|
+
*/
|
|
16
|
+
export declare function installSessionBindings({ lua, api, emitEvent }: BindingContext, globalEvents: GlobalEventChannel): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BindingContext } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* Mudlet createTextEdit widgets - a plain multi-line text box addressed by
|
|
4
|
+
* name, with get/set/append/clear and the usual geometry and styling setters.
|
|
5
|
+
*
|
|
6
|
+
* Backed by TextEditManager, which is a pure data-model registry; the React
|
|
7
|
+
* overlay renders whatever the model holds.
|
|
8
|
+
*/
|
|
9
|
+
export declare function installTextEditBindings({ lua, api, channel }: BindingContext): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BindingContext } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* Creating and destroying the addressable UI surfaces Lua can open:
|
|
4
|
+
* user windows, the map widget, mini-consoles, command lines, and scroll
|
|
5
|
+
* boxes - plus windowType(), which reports what a given name resolves to.
|
|
6
|
+
*
|
|
7
|
+
* Deletion is the interesting half. Each destroy path has to free whatever
|
|
8
|
+
* Lua-side callback slots the widget had bound before dropping it, or the
|
|
9
|
+
* registry entry leaks for the lifetime of the runtime.
|
|
10
|
+
*/
|
|
11
|
+
export declare function installUserWindowBindings({ lua, api, emitEvent, unregisterCb, overlayCmdLineActionCbIds, }: BindingContext): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BindingContext } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* Main-window and user-window geometry, border sizes/colours, and the Mudlet
|
|
4
|
+
* 4.21 memory-introspection helpers.
|
|
5
|
+
*
|
|
6
|
+
* Borders here are the *main console's* insets (Mudlet's setBorderTop and
|
|
7
|
+
* friends), not per-window padding - they shrink the area the MUD output wraps
|
|
8
|
+
* into, which is how Geyser reserves room for docked labels and gauges.
|
|
9
|
+
*/
|
|
10
|
+
export declare function installWindowBindings({ lua, api, channel }: BindingContext): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Completion, CompletionContext, CompletionResult } from '@codemirror/autocomplete';
|
|
2
|
+
export interface ReferenceGroup {
|
|
3
|
+
title: string;
|
|
4
|
+
prefix: string;
|
|
5
|
+
entries: Completion[];
|
|
6
|
+
}
|
|
7
|
+
export declare const REFERENCE_GROUPS: ReferenceGroup[];
|
|
8
|
+
export declare const HOVER_MAP: Map<string, Completion>;
|
|
9
|
+
export declare function luaCompletionSource(context: CompletionContext): CompletionResult | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function encodeRowsToLuaSource(rows: unknown[][]): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Lua } from 'wasmoon-lua5.1';
|
|
2
|
+
export type LuaValueTransform = (v: unknown) => unknown;
|
|
3
|
+
/**
|
|
4
|
+
* Serialise a JSON-decoded value as a Lua chunk returning it. The chunk takes
|
|
5
|
+
* the null sentinel as its vararg so nulls survive without a global lookup.
|
|
6
|
+
* Returns null when the value nests too deeply to express as source.
|
|
7
|
+
*/
|
|
8
|
+
export declare function luaChunkForValue(v: unknown): string | null;
|
|
9
|
+
export declare function setupYajl(lua: Lua): {
|
|
10
|
+
transform: LuaValueTransform;
|
|
11
|
+
};
|