@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.
Files changed (242) hide show
  1. package/LICENSE +338 -0
  2. package/README.md +150 -0
  3. package/dist-lib/App.d.ts +1 -0
  4. package/dist-lib/MudletWebApp.d.ts +11 -0
  5. package/dist-lib/ProfileSession.d.ts +15 -0
  6. package/dist-lib/assets/mapParser.worker-t-3rd1zR.js +9 -0
  7. package/dist-lib/branding.d.ts +213 -0
  8. package/dist-lib/core/EventBus.d.ts +29 -0
  9. package/dist-lib/db/sqliteClient.d.ts +25 -0
  10. package/dist-lib/hooks/useEngines.d.ts +12 -0
  11. package/dist-lib/hooks/useMudSession.d.ts +10 -0
  12. package/dist-lib/hooks/useOutput.d.ts +17 -0
  13. package/dist-lib/hooks/useViewportMode.d.ts +14 -0
  14. package/dist-lib/import/applyMudletProfile.d.ts +57 -0
  15. package/dist-lib/import/collectProfileExport.d.ts +16 -0
  16. package/dist-lib/import/defaultPackages.d.ts +81 -0
  17. package/dist-lib/import/defaults/mudlet-mapper.xml +13023 -0
  18. package/dist-lib/import/defaults/run-lua-code.mpackage +0 -0
  19. package/dist-lib/import/mudletHost.d.ts +67 -0
  20. package/dist-lib/import/mudletLink.d.ts +34 -0
  21. package/dist-lib/import/mudletProfileExport.d.ts +49 -0
  22. package/dist-lib/import/mudletProfileImport.d.ts +71 -0
  23. package/dist-lib/import/mudletVariables.d.ts +49 -0
  24. package/dist-lib/import/mudletWriteback.d.ts +12 -0
  25. package/dist-lib/import/mudletXmlExport.d.ts +16 -0
  26. package/dist-lib/import/mudletXmlImport.d.ts +21 -0
  27. package/dist-lib/import/packageInstaller.d.ts +72 -0
  28. package/dist-lib/import/packageRepository.d.ts +54 -0
  29. package/dist-lib/import/remotePackageInstall.d.ts +52 -0
  30. package/dist-lib/index.d.ts +30 -0
  31. package/dist-lib/index.js +42307 -0
  32. package/dist-lib/logging/SessionLogger.d.ts +41 -0
  33. package/dist-lib/main.d.ts +2 -0
  34. package/dist-lib/map/MapSelectionOverlay.d.ts +15 -0
  35. package/dist-lib/map/MapStore.d.ts +1067 -0
  36. package/dist-lib/map/MudixMapReader.d.ts +90 -0
  37. package/dist-lib/map/MudletHighlightOverlay.d.ts +18 -0
  38. package/dist-lib/map/mapImageExport.d.ts +26 -0
  39. package/dist-lib/map/mapParser.worker.d.ts +1 -0
  40. package/dist-lib/map/mapParserClient.d.ts +35 -0
  41. package/dist-lib/map/pathfinding.d.ts +52 -0
  42. package/dist-lib/map/xmlMapImport.d.ts +28 -0
  43. package/dist-lib/mud/MudSession.d.ts +236 -0
  44. package/dist-lib/mud/PatternEngine.d.ts +28 -0
  45. package/dist-lib/mud/aliases/AliasEngine.d.ts +15 -0
  46. package/dist-lib/mud/connection/LineAssembler.d.ts +84 -0
  47. package/dist-lib/mud/connection/MudClient.d.ts +268 -0
  48. package/dist-lib/mud/connection/PingTracker.d.ts +28 -0
  49. package/dist-lib/mud/connection/TelnetNegotiator.d.ts +188 -0
  50. package/dist-lib/mud/connection/telnetDebug.d.ts +54 -0
  51. package/dist-lib/mud/events.d.ts +160 -0
  52. package/dist-lib/mud/keybindings/KeyEngine.d.ts +36 -0
  53. package/dist-lib/mud/keybindings/browserReservedKeys.d.ts +45 -0
  54. package/dist-lib/mud/keybindings/qtKeys.d.ts +33 -0
  55. package/dist-lib/mud/protocol/charset.d.ts +105 -0
  56. package/dist-lib/mud/protocol/constants.d.ts +116 -0
  57. package/dist-lib/mud/protocol/echo.d.ts +63 -0
  58. package/dist-lib/mud/protocol/gmcp.d.ts +28 -0
  59. package/dist-lib/mud/protocol/index.d.ts +11 -0
  60. package/dist-lib/mud/protocol/mccp.d.ts +18 -0
  61. package/dist-lib/mud/protocol/mnes.d.ts +83 -0
  62. package/dist-lib/mud/protocol/msdp.d.ts +19 -0
  63. package/dist-lib/mud/protocol/msp.d.ts +47 -0
  64. package/dist-lib/mud/protocol/mssp.d.ts +25 -0
  65. package/dist-lib/mud/protocol/mxp.d.ts +188 -0
  66. package/dist-lib/mud/protocol/naws.d.ts +7 -0
  67. package/dist-lib/mud/replay/ReplayPlayer.d.ts +31 -0
  68. package/dist-lib/mud/replay/ReplayRecorder.d.ts +18 -0
  69. package/dist-lib/mud/replay/replayFormat.d.ts +49 -0
  70. package/dist-lib/mud/text/Console.d.ts +183 -0
  71. package/dist-lib/mud/text/FormatState.d.ts +256 -0
  72. package/dist-lib/mud/text/ansiEscapes.d.ts +88 -0
  73. package/dist-lib/mud/text/cellRender.d.ts +21 -0
  74. package/dist-lib/mud/text/colorParsers.d.ts +54 -0
  75. package/dist-lib/mud/text/colors.d.ts +31 -0
  76. package/dist-lib/mud/text/controlCharacterMode.d.ts +13 -0
  77. package/dist-lib/mud/text/controlChars.d.ts +31 -0
  78. package/dist-lib/mud/text/hyperlinkConfig.d.ts +164 -0
  79. package/dist-lib/mud/text/hyperlinkVisibility.d.ts +37 -0
  80. package/dist-lib/mud/text/oscLinkManager.d.ts +35 -0
  81. package/dist-lib/mud/text/wcwidth.d.ts +44 -0
  82. package/dist-lib/mud/text/xterm256.d.ts +2 -0
  83. package/dist-lib/mud/timers/TimerEngine.d.ts +61 -0
  84. package/dist-lib/mud/triggers/ChunkProcessor.d.ts +11 -0
  85. package/dist-lib/mud/triggers/TriggerEngine.d.ts +188 -0
  86. package/dist-lib/mud/triggers/pcre/Pcre2.d.ts +26 -0
  87. package/dist-lib/scripting/EngineHost.d.ts +152 -0
  88. package/dist-lib/scripting/GlobalEventChannel.d.ts +36 -0
  89. package/dist-lib/scripting/IScriptingRuntime.d.ts +95 -0
  90. package/dist-lib/scripting/MapOpenNotifier.d.ts +19 -0
  91. package/dist-lib/scripting/ScriptingAPI.d.ts +1691 -0
  92. package/dist-lib/scripting/ScriptingEngine.d.ts +806 -0
  93. package/dist-lib/scripting/StopwatchManager.d.ts +94 -0
  94. package/dist-lib/scripting/heldModifiers.d.ts +3 -0
  95. package/dist-lib/scripting/http/HttpService.d.ts +23 -0
  96. package/dist-lib/scripting/lua/LuaRuntime.d.ts +190 -0
  97. package/dist-lib/scripting/lua/bindings/automation.d.ts +10 -0
  98. package/dist-lib/scripting/lua/bindings/commandLine.d.ts +11 -0
  99. package/dist-lib/scripting/lua/bindings/context.d.ts +87 -0
  100. package/dist-lib/scripting/lua/bindings/cursor.d.ts +10 -0
  101. package/dist-lib/scripting/lua/bindings/diagnostics.d.ts +9 -0
  102. package/dist-lib/scripting/lua/bindings/map.d.ts +14 -0
  103. package/dist-lib/scripting/lua/bindings/media.d.ts +24 -0
  104. package/dist-lib/scripting/lua/bindings/output.d.ts +10 -0
  105. package/dist-lib/scripting/lua/bindings/packages.d.ts +10 -0
  106. package/dist-lib/scripting/lua/bindings/session.d.ts +16 -0
  107. package/dist-lib/scripting/lua/bindings/textEdit.d.ts +9 -0
  108. package/dist-lib/scripting/lua/bindings/userWindows.d.ts +11 -0
  109. package/dist-lib/scripting/lua/bindings/window.d.ts +10 -0
  110. package/dist-lib/scripting/lua/imageSize.d.ts +4 -0
  111. package/dist-lib/scripting/lua/luaCompletions.d.ts +9 -0
  112. package/dist-lib/scripting/lua/mudlet-lua/generic-mapper/generic_mapper.mpackage +0 -0
  113. package/dist-lib/scripting/lua/rex.d.ts +3 -0
  114. package/dist-lib/scripting/lua/sqlRowEncoder.d.ts +1 -0
  115. package/dist-lib/scripting/lua/yajl.d.ts +11 -0
  116. package/dist-lib/scripting/profilesPresence.d.ts +50 -0
  117. package/dist-lib/scripting/vfs/ProfileVFS.d.ts +62 -0
  118. package/dist-lib/scripting/vfs/cssRewrite.d.ts +21 -0
  119. package/dist-lib/scripting/vfs/folderHandleStore.d.ts +16 -0
  120. package/dist-lib/scripting/vfs/folderSync.d.ts +59 -0
  121. package/dist-lib/scripting/vfs/htmlRewrite.d.ts +26 -0
  122. package/dist-lib/scripting/vfs/vfsBridge.d.ts +16 -0
  123. package/dist-lib/services/cloudflare.d.ts +54 -0
  124. package/dist-lib/storage/appStore.d.ts +132 -0
  125. package/dist-lib/storage/crossTabSync.d.ts +3 -0
  126. package/dist-lib/storage/debouncedStorage.d.ts +18 -0
  127. package/dist-lib/storage/hooks.d.ts +17 -0
  128. package/dist-lib/storage/index.d.ts +4 -0
  129. package/dist-lib/storage/logExport.d.ts +32 -0
  130. package/dist-lib/storage/logStorage.d.ts +45 -0
  131. package/dist-lib/storage/mapStorage.d.ts +2 -0
  132. package/dist-lib/storage/profileVfsData.d.ts +47 -0
  133. package/dist-lib/storage/schema.d.ts +638 -0
  134. package/dist-lib/styles.css +2 -0
  135. package/dist-lib/ui/AboutModal.d.ts +8 -0
  136. package/dist-lib/ui/BrandLoginFields.d.ts +25 -0
  137. package/dist-lib/ui/BrandLoginScreen.d.ts +11 -0
  138. package/dist-lib/ui/CharLoginModal.d.ts +32 -0
  139. package/dist-lib/ui/CmdLineMenuRegistry.d.ts +27 -0
  140. package/dist-lib/ui/CodeEditorPreview.d.ts +19 -0
  141. package/dist-lib/ui/CommandBar.d.ts +17 -0
  142. package/dist-lib/ui/ConnectionFormModal.d.ts +13 -0
  143. package/dist-lib/ui/ConnectionGrid.d.ts +18 -0
  144. package/dist-lib/ui/ConnectionScreen.d.ts +14 -0
  145. package/dist-lib/ui/FileBrowserModal.d.ts +20 -0
  146. package/dist-lib/ui/FilePickerModal.d.ts +21 -0
  147. package/dist-lib/ui/FolderPermissionScreen.d.ts +16 -0
  148. package/dist-lib/ui/JsonPreview.d.ts +15 -0
  149. package/dist-lib/ui/LogBrowserModal.d.ts +7 -0
  150. package/dist-lib/ui/MapEditorModal.d.ts +9 -0
  151. package/dist-lib/ui/MarkdownPreview.d.ts +15 -0
  152. package/dist-lib/ui/MergeConflictModal.d.ts +17 -0
  153. package/dist-lib/ui/ModuleResolveModal.d.ts +22 -0
  154. package/dist-lib/ui/MouseEventRegistry.d.ts +31 -0
  155. package/dist-lib/ui/ProfileBusyScreen.d.ts +12 -0
  156. package/dist-lib/ui/ProfileExportModal.d.ts +7 -0
  157. package/dist-lib/ui/ProxyInfoModal.d.ts +6 -0
  158. package/dist-lib/ui/ProxyWhyModal.d.ts +6 -0
  159. package/dist-lib/ui/ProxyWizardModal.d.ts +6 -0
  160. package/dist-lib/ui/QuickOpenPalette.d.ts +8 -0
  161. package/dist-lib/ui/ResizableModal.d.ts +17 -0
  162. package/dist-lib/ui/ScriptingDocsModal.d.ts +12 -0
  163. package/dist-lib/ui/SettingsModal.d.ts +9 -0
  164. package/dist-lib/ui/Toolbar.d.ts +29 -0
  165. package/dist-lib/ui/bufferWords.d.ts +38 -0
  166. package/dist-lib/ui/buttons/ButtonsBar.d.ts +21 -0
  167. package/dist-lib/ui/cmdline/CommandLineManager.d.ts +97 -0
  168. package/dist-lib/ui/cmdline/CommandLineOverlay.d.ts +8 -0
  169. package/dist-lib/ui/codemirror/theme.d.ts +5 -0
  170. package/dist-lib/ui/commandHistory.d.ts +31 -0
  171. package/dist-lib/ui/components/Button.d.ts +9 -0
  172. package/dist-lib/ui/components/ConfirmDialog.d.ts +29 -0
  173. package/dist-lib/ui/components/ContextMenu.d.ts +9 -0
  174. package/dist-lib/ui/components/FontPicker.d.ts +9 -0
  175. package/dist-lib/ui/components/FormField.d.ts +16 -0
  176. package/dist-lib/ui/components/HelpTip.d.ts +7 -0
  177. package/dist-lib/ui/components/Input.d.ts +6 -0
  178. package/dist-lib/ui/components/Toggle.d.ts +10 -0
  179. package/dist-lib/ui/components/index.d.ts +9 -0
  180. package/dist-lib/ui/components/useModalFocus.d.ts +18 -0
  181. package/dist-lib/ui/labels/LabelManager.d.ts +220 -0
  182. package/dist-lib/ui/labels/LabelOverlay.d.ts +9 -0
  183. package/dist-lib/ui/labels/backgroundImageSize.d.ts +10 -0
  184. package/dist-lib/ui/labels/cursorShapes.d.ts +6 -0
  185. package/dist-lib/ui/labels/gifMovie.d.ts +100 -0
  186. package/dist-lib/ui/labels/qtCss.d.ts +57 -0
  187. package/dist-lib/ui/layout/ContentLayout.d.ts +19 -0
  188. package/dist-lib/ui/layout/DockArea.d.ts +14 -0
  189. package/dist-lib/ui/layout/DockedPanel.d.ts +13 -0
  190. package/dist-lib/ui/layout/FloatingWindowLayer.d.ts +10 -0
  191. package/dist-lib/ui/layout/MobileLayout.d.ts +22 -0
  192. package/dist-lib/ui/layout/PopoutWindow.d.ts +35 -0
  193. package/dist-lib/ui/layout/ScriptWindow.d.ts +29 -0
  194. package/dist-lib/ui/layout/SplitGroupPanel.d.ts +17 -0
  195. package/dist-lib/ui/layout/TabGroupPanel.d.ts +12 -0
  196. package/dist-lib/ui/layout/WindowContextMenu.d.ts +11 -0
  197. package/dist-lib/ui/layout/dockDetect.d.ts +26 -0
  198. package/dist-lib/ui/layout/overlayLayerOrder.d.ts +71 -0
  199. package/dist-lib/ui/markdown.d.ts +1 -0
  200. package/dist-lib/ui/output/CaretReviewPanel.d.ts +22 -0
  201. package/dist-lib/ui/output/OutputArea.d.ts +9 -0
  202. package/dist-lib/ui/output/OutputContextMenu.d.ts +23 -0
  203. package/dist-lib/ui/output/OutputRenderer.d.ts +64 -0
  204. package/dist-lib/ui/output/ScreenReaderLog.d.ts +23 -0
  205. package/dist-lib/ui/output/StickyOutputPanel.d.ts +28 -0
  206. package/dist-lib/ui/output/backgroundImageStyle.d.ts +17 -0
  207. package/dist-lib/ui/output/caretMode.d.ts +40 -0
  208. package/dist-lib/ui/output/linkNavigation.d.ts +29 -0
  209. package/dist-lib/ui/output/osc8Menu.d.ts +16 -0
  210. package/dist-lib/ui/output/outputCopy.d.ts +15 -0
  211. package/dist-lib/ui/preventPinchZoom.d.ts +1 -0
  212. package/dist-lib/ui/scrollbox/ScrollBoxManager.d.ts +62 -0
  213. package/dist-lib/ui/scrollbox/ScrollBoxOverlay.d.ts +25 -0
  214. package/dist-lib/ui/sound/SoundManager.d.ts +149 -0
  215. package/dist-lib/ui/sound/closedCaption.d.ts +37 -0
  216. package/dist-lib/ui/textedit/TextEditManager.d.ts +56 -0
  217. package/dist-lib/ui/tts/TtsManager.d.ts +68 -0
  218. package/dist-lib/ui/useBrandLogin.d.ts +19 -0
  219. package/dist-lib/ui/useCommandHistory.d.ts +7 -0
  220. package/dist-lib/ui/video/VideoManager.d.ts +56 -0
  221. package/dist-lib/ui/windows/ScriptEditorModal.d.ts +13 -0
  222. package/dist-lib/ui/windows/WindowManager.d.ts +694 -0
  223. package/dist-lib/ui/windows/panels/HtmlPanel.d.ts +27 -0
  224. package/dist-lib/ui/windows/panels/LuaEditor.d.ts +14 -0
  225. package/dist-lib/ui/windows/panels/MapPanel.d.ts +8 -0
  226. package/dist-lib/ui/windows/panels/PackageRepositoryModal.d.ts +18 -0
  227. package/dist-lib/ui/windows/panels/ScriptEditorPanel.d.ts +24 -0
  228. package/dist-lib/ui/windows/panels/ScriptSearch.d.ts +12 -0
  229. package/dist-lib/ui/windows/panels/TextPanel.d.ts +35 -0
  230. package/dist-lib/ui/windows/panels/VariablesView.d.ts +21 -0
  231. package/dist-lib/ui/windows/panels/VfsModulePickerModal.d.ts +8 -0
  232. package/dist-lib/ui/windows/panels/WindowCmdLine.d.ts +23 -0
  233. package/dist-lib/ui/windows/types.d.ts +145 -0
  234. package/dist-lib/utils/documentTitle.d.ts +33 -0
  235. package/dist-lib/utils/fontLoader.d.ts +52 -0
  236. package/dist-lib/utils/profileLock.d.ts +26 -0
  237. package/dist-lib/utils/sessionCredentials.d.ts +16 -0
  238. package/dist-lib/version.d.ts +39 -0
  239. package/dist-lib/vfs-sw.js +131 -0
  240. package/dist-lib/vite.d.ts +2 -0
  241. package/dist-lib/vite.js +154 -0
  242. package/package.json +93 -0
@@ -0,0 +1,638 @@
1
+ import type { WindowOpenOptions } from '../ui/windows/types';
2
+ import type { MudletVariable } from '../import/mudletVariables';
3
+ export declare const DEFAULT_PROXY_URL = "wss://mudix.delwing.workers.dev";
4
+ export type ConnectionMode = 'mud' | 'websocket';
5
+ export interface MudConnection {
6
+ id: string;
7
+ name: string;
8
+ mode?: ConnectionMode;
9
+ url?: string;
10
+ host?: string;
11
+ port?: number;
12
+ proxyUrl?: string;
13
+ /** When true, opening this profile (via the "Open" button or a `?profile=`
14
+ * deep link) immediately dials the connection instead of opening offline.
15
+ * `undefined`/`false` = open offline (default); the "Connect" button always
16
+ * dials regardless. */
17
+ autoReconnect?: boolean;
18
+ /** Profile icon shown on the connection-selection screen (Mudlet's profile
19
+ * icon, set by setProfileIcon / read by getProfileIcon / cleared by
20
+ * resetProfileIcon). Stored as a self-contained `data:` URI. Lives on the
21
+ * connection record (not the VFS-backed profile settings) so the picker
22
+ * screen can render it without mounting the profile. Empty/undefined =
23
+ * fall back to the auto-generated name tile. */
24
+ icon?: string;
25
+ /** GMCP `Char.Login` account/username. Prefills the login popup and the
26
+ * connection editor's credential fields. Non-sensitive on its own. Lives on
27
+ * the connection record so the editor can read/write it without mounting the
28
+ * profile. */
29
+ charLoginAccount?: string;
30
+ /** GMCP `Char.Login` password. ⚠ SECURITY: persisted in **plaintext** in
31
+ * localStorage (the app store is not encrypted) — only ever written when the
32
+ * user explicitly opts in. Convenient for auto-login but not secure on a
33
+ * shared machine. Never logged; relayed straight to the server on login. */
34
+ charLoginPassword?: string;
35
+ /** Set when this profile was created by linking a Mudlet folder (Link mode):
36
+ * the folder is the source of truth — its `current/*.xml` is re-read on every
37
+ * open and written back on save. Drives the linked badge on the connection
38
+ * screen. The folder handle itself lives in folderHandleStore (IndexedDB). */
39
+ mudletLinked?: boolean;
40
+ /** Set when this profile was created by importing (copying) a Mudlet profile
41
+ * folder/archive. Like {@link mudletLinked}, it marks the profile's own
42
+ * package set as authoritative: `ensureDefaultPackages` never adds the stock
43
+ * defaults (mapper, run-lua-code) to a Mudlet-originated profile that doesn't
44
+ * already ship them — Mudlet installs those only into brand-new profiles, so
45
+ * their absence in an imported profile is a real choice, not a gap to fill. */
46
+ mudletImported?: boolean;
47
+ /** Free-text profile description (Mudlet's profile "description" field, read/
48
+ * written by getProfileInformation / setProfileInformation /
49
+ * clearProfileInformation). Lives on the connection record — not the VFS-
50
+ * backed profile settings — so it's editable from the connection screen and
51
+ * visible to `getProfiles()` for every profile (open or not, across tabs via
52
+ * the synced connection index) without mounting each profile. */
53
+ description?: string;
54
+ }
55
+ /** Stock theme ids plus any brand-defined theme id (`BrandConfig.themes`) —
56
+ * the `(string & {})` arm admits custom ids while keeping autocomplete for
57
+ * the stock ones. */
58
+ export type Theme = 'dark' | 'light' | 'graylight' | 'amber' | 'sky' | (string & {});
59
+ /**
60
+ * Where the output font came from. `system` is the default — a name typed by
61
+ * the user or chosen from `navigator.fonts.query()`; nothing is registered.
62
+ * `url` injects a `<link rel="stylesheet">` into <head> (e.g. Google Fonts).
63
+ * `vfs` reads font bytes from the active profile's VFS and registers them via
64
+ * the FontFace API. URL/VFS sources need to be re-applied on every page load.
65
+ */
66
+ export type OutputFontSource = {
67
+ kind: 'system';
68
+ family: string;
69
+ } | {
70
+ kind: 'url';
71
+ family: string;
72
+ url: string;
73
+ } | {
74
+ kind: 'vfs';
75
+ family: string;
76
+ path: string;
77
+ };
78
+ /** App-wide preferences that apply regardless of which profile is active. */
79
+ export interface ClientSettings {
80
+ /** Launcher/default theme — used by the connection screen (no profile open)
81
+ * and as the fallback when a profile sets no theme of its own. A profile's
82
+ * own `ProfileSettings.theme` overrides this while that profile is open. */
83
+ theme: Theme;
84
+ /** The user's own deployed proxy URL (from the deploy wizard). When set,
85
+ * ConnectionScreen uses this as the placeholder/default instead of
86
+ * DEFAULT_PROXY_URL, so new connections route through the user's worker. */
87
+ userProxyUrl?: string;
88
+ /** Opt-in to desktop notifications (Mudlet's `showNotification`). `undefined`
89
+ * / `false` means off — `showNotification` is a no-op until the user enables
90
+ * this in Settings, which is also where the browser permission prompt is
91
+ * triggered (a real user gesture), so the first script notification can fire
92
+ * without a surprise permission pop-up. */
93
+ notificationsEnabled?: boolean;
94
+ }
95
+ /** Per-profile settings. Scripts (setBorder, setFont, setBackgroundColor, …) and
96
+ * the in-profile settings modal write here. Each field's value falls through to
97
+ * PROFILE_DEFAULTS when the profile hasn't overridden it. */
98
+ export interface ProfileSettings {
99
+ /** Per-profile theme override. Undefined = fall through to the launcher
100
+ * theme (`ClientSettings.theme`). Applied to the document while this
101
+ * profile is the foreground/open one. */
102
+ theme?: Theme;
103
+ /** When true (default — treat `undefined` as true), MUDs may request a
104
+ * package install via the `Client.GUI` GMCP message (URL downloaded and
105
+ * installed automatically). Disable to ignore those requests. Per-profile
106
+ * so each MUD is trusted independently. */
107
+ allowMudPackageInstall?: boolean;
108
+ showTimestamps: boolean;
109
+ fontSize: number;
110
+ outputBackground: string;
111
+ /** Default text color for the main output area. Empty/undefined = theme default. */
112
+ outputForeground?: string;
113
+ /** Background of the command-line input. Empty/undefined = theme default. */
114
+ inputBackground?: string;
115
+ /** Text color of the command-line input. Empty/undefined = theme default. */
116
+ inputForeground?: string;
117
+ /** Foreground color for the local echo of commands you send. Empty/undefined = #717100. */
118
+ commandEchoForeground?: string;
119
+ /** Background color for the local echo of commands you send. Empty/undefined = none. */
120
+ commandEchoBackground?: string;
121
+ outputFont?: OutputFontSource;
122
+ /** Mudlet setWindowWrap("main", N). 0/undefined disables character-based wrap
123
+ * (text fills the window width). */
124
+ outputWrapAt?: number;
125
+ /** Mudlet setWindowWrapIndent("main", N). Indent (chars) of newline-started lines. */
126
+ outputWrapIndent?: number;
127
+ /** Mudlet setWindowWrapHangingIndent("main", N). Indent (chars) of wrapped continuation lines. */
128
+ outputWrapHangingIndent?: number;
129
+ /** Mudlet setBackgroundColor for the main window. rgba 0..255. Takes precedence over outputBackground when set. */
130
+ outputBackgroundColor?: {
131
+ r: number;
132
+ g: number;
133
+ b: number;
134
+ a: number;
135
+ };
136
+ /** Mudlet setBackgroundImage for the main window. `url` is the resolved
137
+ * image href for modes 1-3, or the raw stylesheet body for mode 4 (style).
138
+ * `mode` mirrors `mudlet.BgImageMode`: 1=border (stretched), 2=center,
139
+ * 3=tile, 4=style. Cleared by resetBackgroundImage(). */
140
+ outputBackgroundImage?: {
141
+ url: string;
142
+ mode: number;
143
+ };
144
+ /** Mudlet setBorderTop/Bottom/Left/Right. Pixel insets carved from the main window for label placement; 0 / undefined = no border. */
145
+ outputBorders?: {
146
+ top: number;
147
+ right: number;
148
+ bottom: number;
149
+ left: number;
150
+ };
151
+ /** Mudlet setBorderColor — fill color for the carved border area. rgba 0..255; undefined = inherit page background. */
152
+ outputBorderColor?: {
153
+ r: number;
154
+ g: number;
155
+ b: number;
156
+ a: number;
157
+ };
158
+ /** User-overridden ANSI 16-color palette. Indices 0–7 are the dark colors
159
+ * (black, red, green, yellow, blue, magenta, cyan, white); 8–15 are the
160
+ * bright variants. Each entry is `#rrggbb` or undefined (fall through to
161
+ * the built-in default). `undefined` for the whole array = no override. */
162
+ ansiPalette?: (string | undefined)[];
163
+ /** Mudlet "Allow server to redefine your colors". When enabled, the server
164
+ * may remap the ANSI/256 palette at runtime via OSC 4 (set color) / OSC 104
165
+ * (reset). When disabled, those sequences are ignored and the user palette
166
+ * stands. Off by default — only an explicit `true` enables it. */
167
+ serverRedefineColors?: boolean;
168
+ /** Mudlet "Network packet timeout": how long (ms) to buffer a partial line
169
+ * (text after the last `\n` of a WebSocket frame) before flushing it as a
170
+ * prompt. Mitigates spurious mid-line breaks when long MUD lines arrive
171
+ * fragmented. `undefined` = use MudClient's built-in default (300ms). */
172
+ promptTimeoutMs?: number;
173
+ /** Per-area MapPanel last-viewed z-level. Each area remembers which level
174
+ * you were on so switching between areas (or reopening the panel) restores
175
+ * it. Zoom is no longer kept here — it lives in the map file (per-area
176
+ * userData, see {@link MapStore.setAreaZoom}); pan isn't remembered at all
177
+ * (areas open centered on the area's middle). Updated when the level
178
+ * changes. */
179
+ mapViewStates?: Record<number, {
180
+ level: number;
181
+ }>;
182
+ /** The area id the user was viewing last. Restored as the initial
183
+ * area on panel mount; the matching {@link mapViewStates} entry drives
184
+ * the initial level. Falls through to the first area in the map. */
185
+ mapLastAreaId?: number;
186
+ /** Whether the map widget's control bar — area picker, z-level buttons,
187
+ * options menu — is shown. Mudlet's `Host::mShowPanel`: toggled by the
188
+ * collapse arrow drawn over the map, readable/writable from Lua as
189
+ * `getConfig`/`setConfig("mapperPanelVisible", …)`, and persisted per
190
+ * profile (Mudlet keeps it in the profile XML as `mShowPanel`). Treat
191
+ * `undefined` as true, matching Mudlet's default. Note this hides only the
192
+ * bar — the map window itself is `openMapWidget`/`closeMapWidget`. */
193
+ mapperPanelVisible?: boolean;
194
+ /** Record gameplay output (and your echoed commands) to the persistent log
195
+ * store, browsable via the toolbar's Logs button. Treat `undefined` as
196
+ * enabled so existing profiles opt in without a migration; set to `false`
197
+ * to stop recording for this profile. */
198
+ loggingEnabled?: boolean;
199
+ /** Flash the browser tab title (Mudlet's taskbar-blink equivalent) when new
200
+ * server data arrives while the mudix tab/window is unfocused. Off unless
201
+ * explicitly set to true. */
202
+ notifyOnNewData?: boolean;
203
+ /** Mirror script/trigger/alias/timer errors into the main output window (in
204
+ * red), in addition to the script editor's Errors tab. Mudlet's "Show
205
+ * errors in main console" preference. Off unless explicitly set to true. */
206
+ showErrorsInMainWindow?: boolean;
207
+ /** Fullscreen mode: hide the top toolbar so the output area fills the whole
208
+ * window, revealing the toolbar only when the pointer nears the top edge (or
209
+ * it takes keyboard focus). Off unless explicitly set to true. */
210
+ fullscreen?: boolean;
211
+ /** User-tunable subset of mudlet-map-renderer's Settings object. Fields
212
+ * are forwarded onto the live renderer.settings on mount and whenever
213
+ * the user changes them in the Mapper tab. Missing fields fall through
214
+ * to MAPPER_DEFAULTS, which in turn defer to the renderer's own
215
+ * createSettings() default for anything we don't override. */
216
+ mapper?: MapperSettings;
217
+ /** Clear the command line after sending. When false (default), the input is
218
+ * selected-all instead so the next keystroke overtypes it. */
219
+ autoClearInput?: boolean;
220
+ /** Separator that splits one Enter into multiple commands (Mudlet's
221
+ * "command separator", default `;;`). Each split is run through aliases
222
+ * and sent independently. Empty string disables splitting. */
223
+ commandSeparator?: string;
224
+ /** Per-profile telnet protocol toggles. Patches merge so flipping one
225
+ * field doesn't wipe siblings. Missing fields fall through to
226
+ * PROTOCOL_DEFAULTS. Takes effect on the next connect. */
227
+ protocols?: ProtocolSettings;
228
+ /** Names of packages the user explicitly uninstalled. Consulted by
229
+ * `ensureDefaultPackages` so a deleted default/brand package stays
230
+ * deleted instead of reinstalling on the next profile open (Mudlet's
231
+ * `deletedDefaultMuds` equivalent). A name is removed again when the
232
+ * package is (re)installed. Recorded for every uninstall — non-default
233
+ * names are inert. */
234
+ uninstalledPackages?: string[];
235
+ /** Catch-all bag for Mudlet `setConfig`/`getConfig` option keys that have no
236
+ * dedicated structured home above (accessibility, input-line, and other
237
+ * preferences mudix persists for round-trip fidelity but does not yet act
238
+ * on). Keys with a structured home — protocol toggles, mapper settings,
239
+ * autoClearInput — are NOT stored here; the registry in ScriptingAPI reads
240
+ * and writes their real fields so the Settings UI stays in sync. Merged
241
+ * shallowly on patch like {@link mapper}/{@link protocols}. */
242
+ config?: Record<string, unknown>;
243
+ }
244
+ /** Per-profile telnet protocol toggles. Each field gates the client's
245
+ * negotiation response for one option — see MudClientOptions for the
246
+ * wire-level meaning. Add a new entry here (and a toggle in the General
247
+ * tab + a `MudClient` switch) when exposing another option. */
248
+ export interface ProtocolSettings {
249
+ /** Telnet GMCP (option 201). */
250
+ gmcp?: boolean;
251
+ /** Telnet TERMINAL-TYPE / MTTS (option 24). */
252
+ mtts?: boolean;
253
+ /** Telnet MSDP (option 69). */
254
+ msdp?: boolean;
255
+ /** Telnet MSSP (option 70). Mud Server Status Protocol — populates the
256
+ * read-only `mssp` Lua table with the server's self-reported status. */
257
+ mssp?: boolean;
258
+ /** Telnet CHARSET (option 42 / RFC 2066). When enabled, the client
259
+ * accepts the server's REQUEST and switches its byte→char codec to the
260
+ * agreed encoding — typically UTF-8. */
261
+ charset?: boolean;
262
+ /** Telnet MSP / MUD Sound Protocol (option 90). When enabled, inline
263
+ * `!!SOUND(...)` and `!!MUSIC(...)` tags are stripped from text and
264
+ * routed to the sound manager. */
265
+ msp?: boolean;
266
+ /** Telnet MCCP / MUD Client Compression Protocol (option 86 / MCCP2). When
267
+ * enabled, the client accepts the server's `WILL COMPRESS2` and transparently
268
+ * inflates the stream (via pako). On by default; disabling it forces
269
+ * compression off — the client ignores the server's offer and never sends
270
+ * `DO COMPRESS2`, so the stream stays uncompressed (Mudlet's
271
+ * `specialForceCompressionOff`). */
272
+ mccp?: boolean;
273
+ /** Telnet MXP / MUD eXtension Protocol (option 91). When enabled, the
274
+ * client negotiates MXP and parses in-band HTML-like markup — formatting
275
+ * tags, clickable `<SEND>`/`<A>` links, entities, and custom element
276
+ * definitions — from the text stream. On by default. */
277
+ mxp?: boolean;
278
+ /** Telnet MNES — Mud New-Environ Standard (option 39). When enabled, the
279
+ * client reports the five MNES core variables (CHARSET / CLIENT_NAME /
280
+ * CLIENT_VERSION / MTTS / TERMINAL_TYPE) to servers that request them. Off
281
+ * by default. MNES is the restricted subset of NEW-ENVIRON below; when both
282
+ * are on, MNES wins (matching Mudlet, which exposes them as two toggles over
283
+ * the same telnet option). */
284
+ mnes?: boolean;
285
+ /** Telnet NEW-ENVIRON — Client Variables Standard (option 39, RFC 1572). When
286
+ * enabled (and MNES off), the client reports the five core variables plus an
287
+ * extended capability set (ANSI, 256_COLORS, TRUECOLOR, UTF-8, TLS,
288
+ * WORD_WRAP, OSC_COLOR_PALETTE, OSC_HYPERLINKS_*, …) framed as USERVAR.
289
+ * On by default — this is the block servers' baudtests show, and it's how
290
+ * Mudlet reports itself. */
291
+ newEnviron?: boolean;
292
+ /** Telnet NAWS / Negotiate About Window Size (option 31). When enabled, the
293
+ * client offers NAWS and reports the main output area's character grid
294
+ * (columns × rows) to the server, re-sending it on every resize. On by
295
+ * default — servers use it for word-wrap and pagination. */
296
+ naws?: boolean;
297
+ /** WebSocket subprotocols to advertise in the opening handshake's
298
+ * `Sec-WebSocket-Protocol` header (RFC 6455), in preference order — the
299
+ * server selects at most one. These are mutually-exclusive stream *modes*,
300
+ * not layers (see {@link WS_SUBPROTOCOL_CHOICES}). Defaults to `['binary']`:
301
+ * the raw telnet stream over binary frames is exactly what mudix decodes,
302
+ * and `binary` is accepted by both FluffOS and servers like last-outpost.com.
303
+ * An empty list opens a bare socket (no header). Applies to direct
304
+ * `websocket`-mode connections; the bundled telnet proxy ignores it. */
305
+ wsSubprotocols?: string[];
306
+ }
307
+ /** Defaults used when a protocol field is undefined. Off-by-default for MSDP
308
+ * matches Mudlet's "MSDP support" preference; GMCP/MTTS/CHARSET/MSP/MSSP are on
309
+ * by default because most modern MUDs expect them (Mudlet also enables MSSP by
310
+ * default — it's read-only status the server pushes once per connection). MSP is on so `!!SOUND/!!MUSIC`
311
+ * tags are stripped and routed to sound inline (the zMUD model — most MSP MUDs
312
+ * never negotiate option 90, they just emit the tags); the tag bytes are
313
+ * legitimate text on non-MSP MUDs but that collision is rare in practice. */
314
+ export declare const PROTOCOL_DEFAULTS: Required<ProtocolSettings>;
315
+ /** The WebSocket subprotocol names mudix can advertise, in canonical preference
316
+ * order. Mutually-exclusive stream modes the server picks *one* of — not
317
+ * layers that stack:
318
+ * - `binary` — raw telnet byte stream over WebSocket binary frames. Every byte
319
+ * (IAC, GMCP/MSDP, MCCP, high-bit charset) survives; this is the
320
+ * only mode mudix's binary-frame decoder actually consumes.
321
+ * - `telnet` — FluffOS binds this to the same telnet handler as `binary`; an
322
+ * alternate name some servers register instead of `binary`.
323
+ * - `telnet.mudstandards.org` — the mudstandards.org WebSocket proposal, same
324
+ * on-the-wire profile under the standardised name.
325
+ * (`ascii` — text frames with telnet stripped — is deliberately omitted: it's a
326
+ * dumb-terminal mode mudix can't decode.) The Settings UI renders one checkbox
327
+ * per entry; the selection is passed to MudClient in this order so the server
328
+ * sees `binary` first. */
329
+ export declare const WS_SUBPROTOCOL_CHOICES: readonly ["binary", "telnet", "telnet.mudstandards.org"];
330
+ /** The boolean-valued protocol toggles — every {@link ProtocolSettings} field
331
+ * except the `string[]` {@link ProtocolSettings.wsSubprotocols}. Helpers that
332
+ * flip a single on/off protocol (Lua's `enableProtocol`, Mudlet `<Host>`
333
+ * import) key off this so they never touch the list-valued field. */
334
+ export type BooleanProtocolKey = {
335
+ [K in keyof ProtocolSettings]-?: NonNullable<ProtocolSettings[K]> extends boolean ? K : never;
336
+ }[keyof ProtocolSettings];
337
+ /** User-tunable subset of the map renderer's Settings. Add new entries here
338
+ * (and a matching control in the Settings modal + a wire-up in MapPanel) as
339
+ * more renderer options get exposed. Keep all fields optional so the
340
+ * patcher can ship partial updates and unset fields fall through to the
341
+ * renderer's own createSettings() defaults. */
342
+ export interface MapperSettings {
343
+ /** renderer.settings.roomSize — diameter/side of a room in map units. */
344
+ roomSize?: number;
345
+ /** renderer.settings.roomShape. */
346
+ roomShape?: 'rectangle' | 'circle' | 'roundedRectangle';
347
+ /** renderer.settings.borders — draw a stroke around each room. */
348
+ borders?: boolean;
349
+ /** renderer.settings.lineWidth — exit/edge stroke width in map units. */
350
+ lineWidth?: number;
351
+ /** renderer.settings.backgroundColor — hex (#rrggbb). Unset defaults to
352
+ * opaque black (#000000), matching Mudlet's 2D map; a transparent canvas
353
+ * composited over the window/page behind it incorrectly. */
354
+ backgroundColor?: string;
355
+ /** renderer.settings.lineColor — exit color, hex (#rrggbb). */
356
+ lineColor?: string;
357
+ /** renderer.settings.gridEnabled — background grid overlay. */
358
+ gridEnabled?: boolean;
359
+ /** renderer.settings.lodEnabled — level-of-detail for very dense planes.
360
+ * Above {@link lodExitBudget} rooms on the drawn (area, z-level) the
361
+ * renderer drops exit lines, and above {@link lodRoomBudget} it replaces
362
+ * the vector scene with a raster overview (one box per room) until you
363
+ * zoom back in. On by default: the tiers only engage at densities where
364
+ * the full vector scene takes seconds per rebuild anyway. */
365
+ lodEnabled?: boolean;
366
+ /** renderer.settings.lodRoomBudget — rooms per plane above which zoomed-out
367
+ * views switch to the raster overview. */
368
+ lodRoomBudget?: number;
369
+ /** renderer.settings.lodExitBudget — rooms per plane above which exit lines
370
+ * are dropped but rooms still draw as real vector shapes. Set at or above
371
+ * {@link lodRoomBudget} to skip this tier entirely. */
372
+ lodExitBudget?: number;
373
+ /** renderer.settings.lodHitTestBudget — rooms on screen above which the
374
+ * hit-test index is skipped, so clicks and hover stop resolving to a room
375
+ * until you zoom in further. Measured against what the current viewport
376
+ * materialises, not the whole level. */
377
+ lodHitTestBudget?: number;
378
+ }
379
+ /** Mirrors the renderer's createSettings() defaults so the Settings modal can
380
+ * show meaningful placeholder/fallback values when a field is still
381
+ * undefined. MapPanel itself does NOT use these — it only forwards fields
382
+ * that the user has actually set, so the renderer's own defaults stay in
383
+ * charge for anything untouched. */
384
+ export declare const MAPPER_DEFAULTS: Required<MapperSettings>;
385
+ /** RGBA channels (0..255) for the map-info widget background. Stored in the
386
+ * profile `config` bag under `mapInfoColor` (Mudlet's `setConfig` key) and
387
+ * painted by MapPanel behind the map-info lines. */
388
+ export interface MapInfoBgColor {
389
+ r: number;
390
+ g: number;
391
+ b: number;
392
+ a: number;
393
+ }
394
+ /** Mudlet's default `mapInfoColor` (mMapInfoBg) — translucent grey. */
395
+ export declare const MAP_INFO_BG_DEFAULT: MapInfoBgColor;
396
+ /** Defaults for profile settings. Reads fall through to these whenever a
397
+ * profile hasn't set the field. */
398
+ export declare const PROFILE_DEFAULTS: ProfileSettings;
399
+ interface BaseNode {
400
+ id: string;
401
+ name: string;
402
+ enabled: boolean;
403
+ isGroup: boolean;
404
+ parentId: string | null;
405
+ /** When set, this node was installed by a package; uninstall removes all nodes with the same tag. */
406
+ packageName?: string;
407
+ }
408
+ export type PackageKind = 'package' | 'module';
409
+ export interface PackageManifest {
410
+ name: string;
411
+ version?: string;
412
+ author?: string;
413
+ title?: string;
414
+ description?: string;
415
+ /** Filename of the icon inside the package dir (e.g. "mudlet.png"), as declared in config.lua. */
416
+ icon?: string;
417
+ /** Author-declared creation date from config.lua (free-form string, often ISO-8601). */
418
+ created?: string;
419
+ /** Path of the XML file inside the package directory, relative to <profilePath>/<name>/ */
420
+ xmlPath?: string;
421
+ /**
422
+ * Modules only: absolute VFS path of the XML, when the module references a file
423
+ * that lives outside the managed package directory. Reload and sync read/write
424
+ * this path verbatim and no pkgDir is ever created. Mutually exclusive with
425
+ * `xmlPath` in practice — if both are set, `xmlVfsPath` wins.
426
+ */
427
+ xmlVfsPath?: string;
428
+ /** Source filename (e.g. "GenericMapper.mpackage"), useful for display. */
429
+ sourceFile?: string;
430
+ /** When the package was installed via a remote URL (e.g. a `Client.GUI`
431
+ * GMCP message), records the originating URL so subsequent install
432
+ * requests for the same URL can be deduplicated against this manifest
433
+ * even when the on-disk package name differs from the filename. */
434
+ sourceUrl?: string;
435
+ /** The version the *server* declared for this URL in its `Client.GUI`
436
+ * message — a delivery revision, not the package's own version. Mudlet
437
+ * keeps these apart too (`Host::mServerGUI_Package_version`): the package
438
+ * manifest keeps whatever version its author wrote, and only this field
439
+ * decides whether a `Client.GUI` request is a re-delivery of something
440
+ * already installed. Writing the server's value into `version` instead
441
+ * would make `getPackageInfo(name).version` report the server's counter,
442
+ * breaking any package that self-updates off its own version. */
443
+ sourceVersion?: string;
444
+ /** Wall-clock install time, ISO-8601. */
445
+ installedAt: string;
446
+ /**
447
+ * 'package' (default) — parsed once, nodes persist in the store, source files may be discarded.
448
+ * 'module' — XML on disk is the source of truth; reloaded on profile open. With `sync`
449
+ * enabled, in-app edits to the module's nodes are written back to the XML.
450
+ */
451
+ kind?: PackageKind;
452
+ /** Modules only: when true, mutations to this module's nodes are flushed back to the XML on disk. */
453
+ sync?: boolean;
454
+ /**
455
+ * Modules only: load priority. Mirrors Mudlet's TPackage::mPriority. Default 0.
456
+ * Negative-priority modules load before profile scripts (useful for setting up
457
+ * infrastructure that profile scripts rely on); non-negative priorities load
458
+ * after. Within the same priority, modules load in install order.
459
+ */
460
+ priority?: number;
461
+ }
462
+ export interface ScriptNode extends BaseNode {
463
+ code: string;
464
+ language: 'lua' | 'js';
465
+ eventHandlers: string[];
466
+ }
467
+ export interface AliasNode extends BaseNode {
468
+ pattern: string;
469
+ command: string;
470
+ code: string;
471
+ language: 'lua' | 'js';
472
+ }
473
+ export type TriggerPatternType = 'substring' | 'regex' | 'startOfLine' | 'exactMatch' | 'luaFunction' | 'lineSpacer' | 'colorTrigger' | 'prompt';
474
+ export interface TriggerPattern {
475
+ text: string;
476
+ type: TriggerPatternType;
477
+ }
478
+ export interface TriggerNode extends BaseNode {
479
+ patterns: TriggerPattern[];
480
+ code: string;
481
+ language: 'lua' | 'js';
482
+ fireLength: number;
483
+ multipleMatches: boolean;
484
+ multiline: boolean;
485
+ delta: number;
486
+ isFilter: boolean;
487
+ highlight?: {
488
+ fg?: string;
489
+ bg?: string;
490
+ };
491
+ command?: string;
492
+ }
493
+ export interface TimerNode extends BaseNode {
494
+ seconds: number;
495
+ code: string;
496
+ language: 'lua' | 'js';
497
+ repeat: boolean;
498
+ command?: string;
499
+ }
500
+ export interface KeyNode extends BaseNode {
501
+ key: string;
502
+ modifiers: string[];
503
+ code: string;
504
+ language: 'lua' | 'js';
505
+ command?: string;
506
+ }
507
+ export type ButtonLocation = 'top' | 'bottom' | 'left' | 'right' | 'floating';
508
+ export type ButtonOrientation = 'horizontal' | 'vertical';
509
+ /**
510
+ * Mudlet-style action node. Groups are toolbars; leaves are buttons.
511
+ * Mirrors Mudlet's TAction (mLocation/mOrientation/mPushDownButton/...).
512
+ * `styleSheet` is persisted but not applied yet (no stylesheet support).
513
+ */
514
+ export interface ButtonNode extends BaseNode {
515
+ orientation: ButtonOrientation;
516
+ location: ButtonLocation;
517
+ /** Number of columns for the toolbar grid. 0 = auto / single line (Mudlet TToolBar.mButtonColumns). */
518
+ columns: number;
519
+ /** Floating-toolbar geometry (groups with location='floating'). */
520
+ posX?: number;
521
+ posY?: number;
522
+ sizeX?: number;
523
+ sizeY?: number;
524
+ /** Two-state (push-down) button. */
525
+ isPushDown: boolean;
526
+ /** Current state for two-state buttons (false = up, true = down). */
527
+ buttonState: boolean;
528
+ /** Path to icon image, relative to the profile VFS root (typically inside a package dir). */
529
+ icon?: string;
530
+ tooltip?: string;
531
+ /** Lua code; runs on every click regardless of state direction (Mudlet TAction.mScript). */
532
+ code: string;
533
+ language: 'lua' | 'js';
534
+ /** Command sent on single-state click OR when a two-state button goes UP (Mudlet commandButtonUp). */
535
+ command?: string;
536
+ /** Command sent only when a two-state button goes DOWN (Mudlet commandButtonDown). */
537
+ commandDown?: string;
538
+ /** Accepted but currently unused — Mudlet stylesheet text. */
539
+ styleSheet?: string;
540
+ }
541
+ /** Returns true if the item and all its ancestors are enabled. */
542
+ export declare function isEffectivelyEnabled<T extends {
543
+ id: string;
544
+ enabled: boolean;
545
+ parentId: string | null;
546
+ }>(item: T, allItems: T[]): boolean;
547
+ /**
548
+ * One-pass build of the set of ids whose item and every ancestor is enabled.
549
+ * Engines iterating large trees should call this once per loadPerm rather than
550
+ * isEffectivelyEnabled per item — that path is O(N²) (rebuilds the id map on
551
+ * every call); this is O(N) amortized via memoization.
552
+ */
553
+ export declare function buildEffectivelyEnabledIds<T extends {
554
+ id: string;
555
+ enabled: boolean;
556
+ parentId: string | null;
557
+ }>(items: T[]): Set<string>;
558
+ export interface ModalBounds {
559
+ x: number;
560
+ y: number;
561
+ width: number;
562
+ height: number;
563
+ }
564
+ /**
565
+ * Mudlet saveWindowLayout/loadWindowLayout snapshot — frozen copy of the
566
+ * window hints + dock extents at the moment the script called save. A later
567
+ * loadWindowLayout() re-applies these values to the live WindowManager.
568
+ */
569
+ export interface WindowLayoutSnapshot {
570
+ hints: Record<string, WindowOpenOptions>;
571
+ dockExtents: Record<string, number>;
572
+ }
573
+ export interface ScriptEditorBounds extends ModalBounds {
574
+ listWidth?: number;
575
+ }
576
+ /**
577
+ * Mudlet saved-variables state for one profile (its `<VariablePackage>`).
578
+ * `saveList` is the user-curated set of top-level global names flagged to
579
+ * persist (Mudlet's VarUnit::mSaveList) — this is the configuration the
580
+ * Variables view edits. `values` is the last captured snapshot of those
581
+ * globals' contents, restored into `_G` on the next profile open. Captured
582
+ * fresh from the live Lua state on each profile save, so it can lag the
583
+ * running session between saves without harm.
584
+ */
585
+ export interface ProfileVariables {
586
+ saveList: string[];
587
+ values: MudletVariable[];
588
+ }
589
+ export interface AppSchema {
590
+ connections: MudConnection[];
591
+ /** App-wide preferences that apply regardless of which profile is active
592
+ * (currently just theme). Settable from both the connection screen and
593
+ * in-profile settings modal. */
594
+ client: ClientSettings;
595
+ /** Per-profile setting overrides. Scripts (setBorderBottom, setFont, …)
596
+ * and the in-profile settings modal write here; unset fields fall through
597
+ * to PROFILE_DEFAULTS so script mutations stay scoped to one profile. */
598
+ connectionProfile: Record<string, Partial<ProfileSettings>>;
599
+ connectionWindowHints: Record<string, Record<string, WindowOpenOptions>>;
600
+ /** Per-connection dock area extents: { left, right, top, bottom } in pixels. */
601
+ connectionDockExtents: Record<string, Record<string, number>>;
602
+ connectionScripts: Record<string, ScriptNode[]>;
603
+ connectionAliases: Record<string, AliasNode[]>;
604
+ connectionTriggers: Record<string, TriggerNode[]>;
605
+ connectionTimers: Record<string, TimerNode[]>;
606
+ connectionKeybindings: Record<string, KeyNode[]>;
607
+ connectionButtons: Record<string, ButtonNode[]>;
608
+ connectionScriptEditorBounds: Record<string, ScriptEditorBounds>;
609
+ connectionModalBounds: Record<string, Record<string, ModalBounds>>;
610
+ connectionPackages: Record<string, PackageManifest[]>;
611
+ /** Per-connection saveWindowLayout snapshot — captured by Lua's
612
+ * `saveWindowLayout()`, restored by `loadWindowLayout()`. Missing key
613
+ * means no snapshot exists yet for that connection. */
614
+ connectionLayoutSnapshots: Record<string, WindowLayoutSnapshot>;
615
+ /** Per-connection Mudlet saved-variables (save-list + last captured values).
616
+ * Persisted in the profile VFS like the automation slices, not localStorage.
617
+ * Missing key = nothing flagged to save for that profile. */
618
+ connectionVariables: Record<string, ProfileVariables>;
619
+ }
620
+ export declare const APP_DEFAULTS: AppSchema;
621
+ /**
622
+ * Reads a single ProfileSettings field for `connectionId`, falling through to
623
+ * PROFILE_DEFAULTS when the profile hasn't set it. Returns the default when
624
+ * `connectionId` is null (no active profile). Designed as a Zustand selector:
625
+ * `useAppStore(s => selectProfileField(s, id, 'fontSize'))`.
626
+ */
627
+ export declare function selectProfileField<K extends keyof ProfileSettings>(s: Pick<AppSchema, 'connectionProfile'>, connectionId: string | null, key: K): ProfileSettings[K];
628
+ export declare function connectionUrl(c: MudConnection, userProxyUrl?: string): string;
629
+ export declare function connectionDisplayAddr(c: MudConnection): string;
630
+ /** Whether the connection's link to the *game server* is TLS-encrypted — the
631
+ * signal reported as the NEW-ENVIRON `TLS` variable. In `websocket` mode the
632
+ * browser connects straight to the game, so a `wss://` URL is end-to-end TLS.
633
+ * In `mud` (proxy) mode the browser↔proxy hop may be `wss://`, but the proxy
634
+ * reaches the MUD over a raw TCP telnet socket (`net.connect`, no upstream
635
+ * TLS) — so the server's inbound connection is always plaintext and this is
636
+ * false regardless of the proxy URL scheme. */
637
+ export declare function connectionSecureTransport(c: MudConnection): boolean;
638
+ export {};