@mudlet/mudlet-web 0.5.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/README.md +1 -1
  2. package/dist-lib/analytics.d.ts +27 -0
  3. package/dist-lib/assets/fonts/Vera.woff2 +0 -0
  4. package/dist-lib/assets/fonts/VeraBI.woff2 +0 -0
  5. package/dist-lib/assets/fonts/VeraBd.woff2 +0 -0
  6. package/dist-lib/assets/fonts/VeraIt.woff2 +0 -0
  7. package/dist-lib/assets/mapParser.worker-DrVZ3wg_.js +9 -0
  8. package/dist-lib/backupImport-wt8r7JXI.js +233 -0
  9. package/dist-lib/branding.d.ts +111 -13
  10. package/dist-lib/db/sqliteClient.d.ts +195 -7
  11. package/dist-lib/hooks/useAutoReconnect.d.ts +61 -0
  12. package/dist-lib/hooks/useDocumentFullscreen.d.ts +23 -0
  13. package/dist-lib/hooks/useKeyboardShortcuts.d.ts +37 -0
  14. package/dist-lib/hooks/useRecordLastPlayed.d.ts +10 -0
  15. package/dist-lib/import/applyMudletProfile.d.ts +35 -9
  16. package/dist-lib/import/backupImport.d.ts +118 -0
  17. package/dist-lib/import/collectProfileExport.d.ts +33 -2
  18. package/dist-lib/import/defaultPackages.d.ts +57 -14
  19. package/dist-lib/import/defaults/CF-loader/CF-loader.mpackage +0 -0
  20. package/dist-lib/import/defaults/MedBootstrap/MedBootstrap.mpackage +0 -0
  21. package/dist-lib/import/defaults/deleteOldProfiles/deleteOldProfiles.mpackage +0 -0
  22. package/dist-lib/import/defaults/echo/echo.mpackage +0 -0
  23. package/dist-lib/import/defaults/enable-accessibility/enable-accessibility.mpackage +0 -0
  24. package/dist-lib/import/defaults/generic_mapper/generic_mapper.mpackage +0 -0
  25. package/dist-lib/import/defaults/gui-drop/gui-drop.mpackage +0 -0
  26. package/dist-lib/import/defaults/icesus-loader/icesus-loader.mpackage +0 -0
  27. package/dist-lib/import/defaults/mg-loader/mg-loader.mpackage +0 -0
  28. package/dist-lib/import/defaults/mudlet-base-ui/mudlet-base-ui.mpackage +0 -0
  29. package/dist-lib/import/defaults/mudlet-mapper.xml +1215 -389
  30. package/dist-lib/import/mudletControlChars.d.ts +14 -0
  31. package/dist-lib/import/mudletHost.d.ts +73 -10
  32. package/dist-lib/import/mudletLink.d.ts +53 -2
  33. package/dist-lib/import/mudletProfileExport.d.ts +38 -5
  34. package/dist-lib/import/mudletProfileImport.d.ts +110 -12
  35. package/dist-lib/import/mudletVariables.d.ts +4 -3
  36. package/dist-lib/import/mudletWriteback.d.ts +15 -1
  37. package/dist-lib/import/mudletXmlImport.d.ts +46 -0
  38. package/dist-lib/import/packageFonts.d.ts +33 -0
  39. package/dist-lib/import/packageInstaller.d.ts +111 -7
  40. package/dist-lib/import/qtProfileData.d.ts +10 -0
  41. package/dist-lib/import/remotePackageInstall.d.ts +23 -7
  42. package/dist-lib/import/zipEntries.d.ts +45 -0
  43. package/dist-lib/index.d.ts +7 -3
  44. package/dist-lib/index.js +50508 -29836
  45. package/dist-lib/logging/SessionLogger.d.ts +75 -15
  46. package/dist-lib/map/MapSelectionOverlay.d.ts +2 -2
  47. package/dist-lib/map/MapStore.d.ts +387 -60
  48. package/dist-lib/map/MudletHighlightOverlay.d.ts +2 -2
  49. package/dist-lib/map/{MudixMapReader.d.ts → MudletMapReader.d.ts} +2 -2
  50. package/dist-lib/map/areaGraph.d.ts +120 -0
  51. package/dist-lib/map/environmentKit.d.ts +36 -0
  52. package/dist-lib/map/labelPixmap.d.ts +90 -0
  53. package/dist-lib/map/mapImageExport.d.ts +36 -2
  54. package/dist-lib/map/mapStyle.d.ts +11 -0
  55. package/dist-lib/map/mapVersion.d.ts +66 -0
  56. package/dist-lib/map/pathfinding.d.ts +2 -2
  57. package/dist-lib/mud/CharLoginController.d.ts +230 -0
  58. package/dist-lib/mud/ItemIdSequence.d.ts +1 -1
  59. package/dist-lib/mud/MudSession.d.ts +279 -22
  60. package/dist-lib/mud/PatternEngine.d.ts +153 -14
  61. package/dist-lib/mud/aliases/AliasEngine.d.ts +55 -9
  62. package/dist-lib/mud/autoLogin.d.ts +59 -0
  63. package/dist-lib/mud/commandSplit.d.ts +9 -0
  64. package/dist-lib/mud/connection/LineAssembler.d.ts +38 -11
  65. package/dist-lib/mud/connection/MudClient.d.ts +291 -53
  66. package/dist-lib/mud/connection/SubnegotiationRepair.d.ts +24 -0
  67. package/dist-lib/mud/connection/TelnetNegotiator.d.ts +208 -68
  68. package/dist-lib/mud/connection/telnetDebug.d.ts +8 -8
  69. package/dist-lib/mud/events.d.ts +102 -23
  70. package/dist-lib/mud/games/bundledGames.d.ts +12 -7
  71. package/dist-lib/mud/games/gameLinks.d.ts +40 -0
  72. package/dist-lib/mud/games/icons/3Kingdoms.png +0 -0
  73. package/dist-lib/mud/games/icons/3Scapes.png +0 -0
  74. package/dist-lib/mud/games/icons/achaea.png +0 -0
  75. package/dist-lib/mud/games/icons/aetolia.png +0 -0
  76. package/dist-lib/mud/games/icons/banner_astaria.png +0 -0
  77. package/dist-lib/mud/games/icons/banner_darkmists.png +0 -0
  78. package/dist-lib/mud/games/icons/banner_dreamland.png +0 -0
  79. package/dist-lib/mud/games/icons/banner_petria.jpg +0 -0
  80. package/dist-lib/mud/games/icons/banner_ropmud.png +0 -0
  81. package/dist-lib/mud/games/icons/blackmud.png +0 -0
  82. package/dist-lib/mud/games/icons/carrionfields.png +0 -0
  83. package/dist-lib/mud/games/icons/dragonfire_icon.png +0 -0
  84. package/dist-lib/mud/games/icons/fed2-logo.png +0 -0
  85. package/dist-lib/mud/games/icons/icesus_480x120.png +0 -0
  86. package/dist-lib/mud/games/icons/imperian.png +0 -0
  87. package/dist-lib/mud/games/icons/infinity_480x120.png +0 -0
  88. package/dist-lib/mud/games/icons/lusternia.png +0 -0
  89. package/dist-lib/mud/games/icons/morgengrauen_480x120.png +0 -0
  90. package/dist-lib/mud/games/icons/mudlet-tutorial.png +0 -0
  91. package/dist-lib/mud/games/icons/phoenixmud_480x120.png +0 -0
  92. package/dist-lib/mud/games/icons/starmourn.png +0 -0
  93. package/dist-lib/mud/games/icons/voidmud_icon.png +0 -0
  94. package/dist-lib/mud/games/icons/wotmudicon.png +0 -0
  95. package/dist-lib/mud/games/websiteLinks.d.ts +21 -0
  96. package/dist-lib/mud/keybindings/KeyEngine.d.ts +110 -4
  97. package/dist-lib/mud/keybindings/browserReservedKeys.d.ts +2 -2
  98. package/dist-lib/mud/keybindings/keyEventTarget.d.ts +61 -0
  99. package/dist-lib/mud/keybindings/qtKeys.d.ts +91 -12
  100. package/dist-lib/mud/protocol/atcp.d.ts +19 -0
  101. package/dist-lib/mud/protocol/byteString.d.ts +24 -0
  102. package/dist-lib/mud/protocol/charLoginFlow.d.ts +243 -16
  103. package/dist-lib/mud/protocol/charset.d.ts +111 -46
  104. package/dist-lib/mud/protocol/codePages.d.ts +10 -0
  105. package/dist-lib/mud/protocol/constants.d.ts +17 -10
  106. package/dist-lib/mud/protocol/echo.d.ts +23 -27
  107. package/dist-lib/mud/protocol/gmcp.d.ts +36 -6
  108. package/dist-lib/mud/protocol/index.d.ts +3 -2
  109. package/dist-lib/mud/protocol/luaLiteral.d.ts +12 -0
  110. package/dist-lib/mud/protocol/mccp.d.ts +83 -1
  111. package/dist-lib/mud/protocol/mnes.d.ts +41 -58
  112. package/dist-lib/mud/protocol/msdp.d.ts +11 -4
  113. package/dist-lib/mud/protocol/msp.d.ts +3 -2
  114. package/dist-lib/mud/protocol/mssp.d.ts +9 -4
  115. package/dist-lib/mud/protocol/multiByte.d.ts +51 -0
  116. package/dist-lib/mud/protocol/multiByteEncode.d.ts +42 -0
  117. package/dist-lib/mud/protocol/mxp.d.ts +193 -14
  118. package/dist-lib/mud/protocol/oauthClientFlow.d.ts +128 -0
  119. package/dist-lib/mud/protocol/qtCodePages.generated.d.ts +1 -0
  120. package/dist-lib/mud/protocol/tlsCodes.d.ts +40 -3
  121. package/dist-lib/mud/replay/ReplayPlayer.d.ts +16 -1
  122. package/dist-lib/mud/replay/replayFormat.d.ts +29 -2
  123. package/dist-lib/mud/text/Console.d.ts +255 -49
  124. package/dist-lib/mud/text/FormatState.d.ts +137 -14
  125. package/dist-lib/mud/text/ansiEscapes.d.ts +32 -16
  126. package/dist-lib/mud/text/colorParsers.d.ts +14 -2
  127. package/dist-lib/mud/text/colorSpaceId.d.ts +2 -0
  128. package/dist-lib/mud/text/colors.d.ts +17 -10
  129. package/dist-lib/mud/text/controlCharacterMode.d.ts +1 -1
  130. package/dist-lib/mud/text/hyperlinkVisibility.d.ts +1 -1
  131. package/dist-lib/mud/text/lineBreak.d.ts +5 -0
  132. package/dist-lib/mud/text/serverWrap.d.ts +2 -2
  133. package/dist-lib/mud/text/textAnalyzer.d.ts +79 -0
  134. package/dist-lib/mud/text/unicodeRuns.d.ts +11 -0
  135. package/dist-lib/mud/text/unicodeTables.generated.d.ts +3 -0
  136. package/dist-lib/mud/text/wcwidth.d.ts +27 -22
  137. package/dist-lib/mud/timers/TimerEngine.d.ts +163 -11
  138. package/dist-lib/mud/timers/workerClock.d.ts +67 -0
  139. package/dist-lib/mud/triggers/TriggerEngine.d.ts +449 -47
  140. package/dist-lib/mud/triggers/legacyColorPatterns.d.ts +58 -0
  141. package/dist-lib/mud/triggers/pcre/Pcre2.d.ts +83 -1
  142. package/dist-lib/oauth-callback.html +94 -0
  143. package/dist-lib/pcre2Wasm.d.ts +54 -0
  144. package/dist-lib/pcre2Wasm.js +241 -0
  145. package/dist-lib/scripting/EngineHost.d.ts +45 -21
  146. package/dist-lib/scripting/IScriptingRuntime.d.ts +103 -27
  147. package/dist-lib/scripting/MxpFrameManager.d.ts +10 -1
  148. package/dist-lib/scripting/ScriptingAPI.d.ts +1030 -213
  149. package/dist-lib/scripting/ScriptingEngine.d.ts +727 -106
  150. package/dist-lib/scripting/StopwatchManager.d.ts +97 -36
  151. package/dist-lib/scripting/http/HttpService.d.ts +9 -1
  152. package/dist-lib/scripting/http/userUrl.d.ts +41 -0
  153. package/dist-lib/scripting/lua/LuaRuntime.d.ts +352 -77
  154. package/dist-lib/scripting/lua/argContracts.d.ts +71 -0
  155. package/dist-lib/scripting/lua/bindings/automation.d.ts +1 -1
  156. package/dist-lib/scripting/lua/bindings/commands.d.ts +13 -0
  157. package/dist-lib/scripting/lua/bindings/context.d.ts +20 -2
  158. package/dist-lib/scripting/lua/bindings/diagnostics.d.ts +1 -1
  159. package/dist-lib/scripting/lua/bindings/map.d.ts +1 -1
  160. package/dist-lib/scripting/lua/bindings/media.d.ts +2 -2
  161. package/dist-lib/scripting/lua/bindings/output.d.ts +1 -1
  162. package/dist-lib/scripting/lua/bindings/session.d.ts +2 -2
  163. package/dist-lib/scripting/lua/bindings/textEdit.d.ts +1 -1
  164. package/dist-lib/scripting/lua/bindings/userWindows.d.ts +1 -1
  165. package/dist-lib/scripting/lua/byteArmor.d.ts +36 -0
  166. package/dist-lib/scripting/lua/imageSize.d.ts +7 -0
  167. package/dist-lib/scripting/lua/rex.d.ts +4 -2
  168. package/dist-lib/scripting/lua/sqlRowEncoder.d.ts +6 -1
  169. package/dist-lib/scripting/lua/utf8CaseMap.d.ts +1 -0
  170. package/dist-lib/scripting/lua/utf8Patterns.d.ts +21 -1
  171. package/dist-lib/scripting/lua/wellFormedStrings.d.ts +40 -0
  172. package/dist-lib/scripting/lua/yajl.d.ts +43 -5
  173. package/dist-lib/scripting/profilesPresence.d.ts +20 -2
  174. package/dist-lib/scripting/vfs/ProfileVFS.d.ts +164 -10
  175. package/dist-lib/scripting/vfs/fsErrors.d.ts +28 -0
  176. package/dist-lib/scripting/vfs/idbCommit.d.ts +20 -0
  177. package/dist-lib/storage/appStore.d.ts +24 -9
  178. package/dist-lib/storage/hooks.d.ts +5 -1
  179. package/dist-lib/storage/index.d.ts +2 -2
  180. package/dist-lib/storage/mapStorage.d.ts +2 -0
  181. package/dist-lib/storage/persistentStorage.d.ts +3 -1
  182. package/dist-lib/storage/profileStorage.d.ts +15 -0
  183. package/dist-lib/storage/profileVfsData.d.ts +3 -3
  184. package/dist-lib/storage/schema.d.ts +512 -40
  185. package/dist-lib/storage/storageMigration.d.ts +82 -0
  186. package/dist-lib/storage-g5V1b-c1.js +2039 -0
  187. package/dist-lib/styles.css +1 -1
  188. package/dist-lib/ui/AboutModal.d.ts +1 -1
  189. package/dist-lib/ui/BrandLoginFields.d.ts +1 -1
  190. package/dist-lib/ui/BrowserSignInModal.d.ts +23 -0
  191. package/dist-lib/ui/CmdLineMenuRegistry.d.ts +14 -5
  192. package/dist-lib/ui/CommandBar.d.ts +8 -8
  193. package/dist-lib/ui/ConnectionFormModal.d.ts +20 -1
  194. package/dist-lib/ui/ConnectionScreen.d.ts +9 -1
  195. package/dist-lib/ui/GameLinkPrompt.d.ts +28 -0
  196. package/dist-lib/ui/HelpModal.d.ts +5 -1
  197. package/dist-lib/ui/MapSymbolUsageModal.d.ts +32 -0
  198. package/dist-lib/ui/MouseEventRegistry.d.ts +31 -4
  199. package/dist-lib/ui/NotepadModal.d.ts +22 -0
  200. package/dist-lib/ui/ResizableModal.d.ts +16 -1
  201. package/dist-lib/ui/SettingsModal.d.ts +10 -1
  202. package/dist-lib/ui/TlsAlertBanner.d.ts +3 -1
  203. package/dist-lib/ui/Toolbar.d.ts +22 -1
  204. package/dist-lib/ui/VaultManageButton.d.ts +10 -5
  205. package/dist-lib/ui/VaultModal.d.ts +3 -0
  206. package/dist-lib/ui/buttons/ButtonsBar.d.ts +3 -1
  207. package/dist-lib/ui/buttons/inactiveButtons.d.ts +25 -0
  208. package/dist-lib/ui/cmdline/CommandLineManager.d.ts +19 -0
  209. package/dist-lib/ui/cmdline/plainText.d.ts +16 -0
  210. package/dist-lib/ui/cmdline/subCommandLine.d.ts +78 -0
  211. package/dist-lib/ui/cmdline/useCmdLineSelection.d.ts +26 -0
  212. package/dist-lib/ui/cmdline/useSubCommandLineKeys.d.ts +33 -0
  213. package/dist-lib/ui/codemirror/lineParagraphMarks.d.ts +19 -0
  214. package/dist-lib/ui/codemirror/luaHover.d.ts +7 -0
  215. package/dist-lib/ui/codemirror/options.d.ts +33 -0
  216. package/dist-lib/ui/codemirror/theme.d.ts +29 -5
  217. package/dist-lib/ui/commands/addonCommands.d.ts +134 -0
  218. package/dist-lib/ui/commands/appShortcuts.d.ts +86 -0
  219. package/dist-lib/ui/commands/hostCommands.d.ts +88 -0
  220. package/dist-lib/ui/commands/keyMatch.d.ts +20 -0
  221. package/dist-lib/ui/commands/keySequence.d.ts +57 -0
  222. package/dist-lib/ui/components/ContextMenu.d.ts +21 -1
  223. package/dist-lib/ui/components/FontPicker.d.ts +5 -1
  224. package/dist-lib/ui/components/useModalFocus.d.ts +13 -1
  225. package/dist-lib/ui/helpTopics.d.ts +15 -0
  226. package/dist-lib/ui/labels/LabelManager.d.ts +172 -9
  227. package/dist-lib/ui/labels/LabelOverlay.d.ts +19 -0
  228. package/dist-lib/ui/labels/backgroundImageSize.d.ts +19 -0
  229. package/dist-lib/ui/labels/labelModel.d.ts +64 -0
  230. package/dist-lib/ui/labels/qColor.d.ts +13 -0
  231. package/dist-lib/ui/labels/qtCss.d.ts +12 -4
  232. package/dist-lib/ui/landmarks.d.ts +9 -0
  233. package/dist-lib/ui/launcher/ActionMenu.d.ts +19 -0
  234. package/dist-lib/ui/launcher/GameDetails.d.ts +21 -0
  235. package/dist-lib/ui/launcher/GameSection.d.ts +18 -0
  236. package/dist-lib/ui/launcher/LauncherSearch.d.ts +23 -0
  237. package/dist-lib/ui/launcher/ProfileArt.d.ts +20 -0
  238. package/dist-lib/ui/launcher/ProfileSection.d.ts +43 -0
  239. package/dist-lib/ui/launcher/launcherModel.d.ts +72 -0
  240. package/dist-lib/ui/layout/overlayLayerOrder.d.ts +2 -2
  241. package/dist-lib/ui/menu/MenuBar.d.ts +31 -0
  242. package/dist-lib/ui/menu/SplitButton.d.ts +39 -0
  243. package/dist-lib/ui/menu/anchoredPopup.d.ts +74 -0
  244. package/dist-lib/ui/menu/appMenus.d.ts +65 -0
  245. package/dist-lib/ui/menu/menuModel.d.ts +88 -0
  246. package/dist-lib/ui/menu/toolbarModel.d.ts +56 -0
  247. package/dist-lib/ui/notepad.d.ts +76 -0
  248. package/dist-lib/ui/openSignInPage.d.ts +14 -0
  249. package/dist-lib/ui/output/OutputContextMenu.d.ts +14 -1
  250. package/dist-lib/ui/output/OutputRenderer.d.ts +5 -0
  251. package/dist-lib/ui/output/OutputSearchBar.d.ts +5 -1
  252. package/dist-lib/ui/output/StickyOutputPanel.d.ts +17 -3
  253. package/dist-lib/ui/output/TextAnalyzerModal.d.ts +25 -0
  254. package/dist-lib/ui/output/caretMode.d.ts +3 -2
  255. package/dist-lib/ui/output/clearSplit.d.ts +11 -0
  256. package/dist-lib/ui/output/outputCopy.d.ts +41 -2
  257. package/dist-lib/ui/output/outputRows.d.ts +43 -0
  258. package/dist-lib/ui/output/selectionGesture.d.ts +35 -0
  259. package/dist-lib/ui/output/wordSelection.d.ts +33 -0
  260. package/dist-lib/ui/search/matcher.d.ts +14 -4
  261. package/dist-lib/ui/settings/SettingsShell.d.ts +91 -0
  262. package/dist-lib/ui/settings/ShortcutEditor.d.ts +13 -0
  263. package/dist-lib/ui/sound/SoundManager.d.ts +210 -44
  264. package/dist-lib/ui/sound/closedCaption.d.ts +4 -1
  265. package/dist-lib/ui/sound/mediaDirection.d.ts +35 -0
  266. package/dist-lib/ui/tabCompletion.d.ts +53 -0
  267. package/dist-lib/ui/textedit/TextEditManager.d.ts +11 -2
  268. package/dist-lib/ui/useOpenProfiles.d.ts +1 -1
  269. package/dist-lib/ui/video/VideoManager.d.ts +7 -0
  270. package/dist-lib/ui/windows/WindowManager.d.ts +452 -37
  271. package/dist-lib/ui/windows/panels/ScriptEditorPanel.d.ts +14 -0
  272. package/dist-lib/ui/windows/panels/ScriptSearch.d.ts +6 -1
  273. package/dist-lib/ui/windows/panels/TextPanel.d.ts +4 -1
  274. package/dist-lib/ui/windows/panels/VariablesView.d.ts +37 -7
  275. package/dist-lib/ui/windows/panels/WindowCmdLine.d.ts +4 -2
  276. package/dist-lib/ui/windows/panels/aliasLoop.d.ts +24 -0
  277. package/dist-lib/ui/windows/panels/editorClipboard.d.ts +45 -0
  278. package/dist-lib/ui/windows/panels/editorUndo.d.ts +79 -0
  279. package/dist-lib/ui/windows/panels/mapAreaChange.d.ts +10 -0
  280. package/dist-lib/utils/appShellCache.d.ts +25 -0
  281. package/dist-lib/utils/fontFamilyName.d.ts +13 -0
  282. package/dist-lib/utils/fontLoader.d.ts +31 -0
  283. package/dist-lib/utils/formatBytes.d.ts +4 -0
  284. package/dist-lib/utils/mustBeOneOf.d.ts +9 -0
  285. package/dist-lib/utils/profileLock.d.ts +1 -1
  286. package/dist-lib/utils/systemTheme.d.ts +24 -0
  287. package/dist-lib/utils/timeZone.d.ts +10 -0
  288. package/dist-lib/vault/CredentialVault.d.ts +51 -5
  289. package/dist-lib/vault/deviceUnlock.d.ts +47 -0
  290. package/dist-lib/vault/vaultAccess.d.ts +24 -2
  291. package/dist-lib/vault/vaultHelpTopic.d.ts +9 -0
  292. package/dist-lib/vault/vaultRecord.d.ts +33 -1
  293. package/dist-lib/vfs-sw.js +220 -11
  294. package/dist-lib/vite.d.ts +1 -1
  295. package/dist-lib/vite.js +66 -43
  296. package/package.json +23 -15
  297. package/dist-lib/assets/mapParser.worker-t-3rd1zR.js +0 -9
  298. package/dist-lib/mud/connection/PingTracker.d.ts +0 -41
  299. package/dist-lib/ui/BundledGameGrid.d.ts +0 -21
  300. package/dist-lib/ui/ConnectionGrid.d.ts +0 -21
  301. package/dist-lib/ui/bufferWords.d.ts +0 -38
@@ -1,13 +1,13 @@
1
1
  import type { MapState, SceneOverlay, SceneOverlayContext, Shape, ViewportBounds } from 'mudlet-map-renderer';
2
2
  import type { MapStore } from './MapStore';
3
- import type { MudixMapReader } from './MudixMapReader';
3
+ import type { MudletMapReader } from './MudletMapReader';
4
4
  export declare class MudletHighlightOverlay implements SceneOverlay {
5
5
  private readonly mapStore;
6
6
  private readonly reader;
7
7
  private ctx?;
8
8
  private mapStoreUnsub?;
9
9
  private areaHandler?;
10
- constructor(mapStore: MapStore, reader: MudixMapReader);
10
+ constructor(mapStore: MapStore, reader: MudletMapReader);
11
11
  attach(ctx: SceneOverlayContext): void;
12
12
  detach(): void;
13
13
  /** Force a re-render from outside. The renderer's `refresh()` doesn't
@@ -2,7 +2,7 @@ import type { MapReader, IArea, IMapReader, ViewportBounds, ViewportDataSource,
2
2
  import type { MapStore } from './MapStore';
3
3
  type RoomShape = ReturnType<MapReader['getRoom']>;
4
4
  /**
5
- * Live {@link IMapReader} backed by Mudix's {@link MapStore}.
5
+ * Live {@link IMapReader} backed by Mudlet's {@link MapStore}.
6
6
  *
7
7
  * The renderer is constructed once on panel mount and held for the lifetime of
8
8
  * the panel. Whenever the store mutates (script-built rooms, binary load,
@@ -33,7 +33,7 @@ type RoomShape = ReturnType<MapReader['getRoom']>;
33
33
  * binary-reader pipeline applies. Doing it inside the reader (instead of in
34
34
  * the panel) keeps `MapPanel` pure-view: it never sees the wire format.
35
35
  */
36
- export declare class MudixMapReader implements IMapReader, ViewportDataSource, HashLookupCapable {
36
+ export declare class MudletMapReader implements IMapReader, ViewportDataSource, HashLookupCapable {
37
37
  private readonly store;
38
38
  readonly viewportAware: true;
39
39
  readonly hashLookupCapable: true;
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Desktop's area graph (TAreaGraph.cpp): the areas of a map as a graph — a
3
+ * node per area, a link per pair of areas joined by at least one normal or
4
+ * special exit — and a 2D world position per area from a deterministic
5
+ * force-directed layout. Areas have no shared coordinates of their own, so
6
+ * this is what places them relative to each other in a world view.
7
+ *
8
+ * A position is where the centre of the area's room bounding box goes, in
9
+ * room units. Positions are kept in the map user data under
10
+ * {@link AREA_GRAPH_LAYOUT_KEY}, so they travel with the map file. Areas that
11
+ * already have one keep it when others are added, moving only to make way for
12
+ * an area that grew into them; setPosition() pins an area so it never moves.
13
+ *
14
+ * A port, step for step: the layout is part of the map file, so the same map
15
+ * has to come out the same way here as there. The randomness is desktop's own
16
+ * splitmix64 over the area ids (in BigInt, as it is 64-bit arithmetic), and
17
+ * every loop walks in the order desktop's does, since the order the pushes are
18
+ * applied in decides where areas end up.
19
+ */
20
+ /** TAreaGraph::cLayoutUserDataKey. */
21
+ export declare const AREA_GRAPH_LAYOUT_KEY = "system.areaGraphLayout";
22
+ /** TAreaGraph::cMaxCoordinate: positions further out are refused, which keeps
23
+ * the layout's grid cell arithmetic in range; computed ones are clamped. */
24
+ export declare const AREA_GRAPH_MAX_COORDINATE = 1000000000000000;
25
+ type Point = [number, number];
26
+ export interface AreaGraphNode {
27
+ areaId: number;
28
+ name: string;
29
+ roomCount: number;
30
+ /** Half the diagonal of the room bounding box, at least 2: how much room the area needs. */
31
+ radius: number;
32
+ position: Point;
33
+ pinned: boolean;
34
+ }
35
+ export interface AreaGraphLink {
36
+ /** fromArea < toArea; an exit counts once in whichever direction it runs. */
37
+ fromArea: number;
38
+ toArea: number;
39
+ exitCount: number;
40
+ }
41
+ /** A room as the graph reads it: where it is, and where its exits lead. */
42
+ export interface AreaGraphRoom {
43
+ area: number;
44
+ x: number;
45
+ y: number;
46
+ /** The twelve normal exits' targets, then the special exits' — ≤ 0 is none. */
47
+ exits(): Iterable<number>;
48
+ }
49
+ /** What the graph reads from the map it belongs to. */
50
+ export interface AreaGraphSource {
51
+ /** Every area with a name, by id (setAreaName makes one with only a name). */
52
+ areaNames(): ReadonlyMap<number, string>;
53
+ /** Every area that exists as an area, with its rooms. */
54
+ areaRooms(): ReadonlyMap<number, readonly number[]>;
55
+ room(id: number): AreaGraphRoom | undefined;
56
+ rooms(): Iterable<AreaGraphRoom>;
57
+ getUserData(key: string): string | undefined;
58
+ /** Undefined removes the key. */
59
+ setUserData(key: string, value: string | undefined): void;
60
+ }
61
+ export declare class AreaGraph {
62
+ private readonly source;
63
+ private nodes;
64
+ private links;
65
+ private stored;
66
+ /** What the user data held when this last read or wrote it, to notice a
67
+ * load or a script changing it. */
68
+ private storedLayoutText;
69
+ private storedDirty;
70
+ private storedLayoutRead;
71
+ private built;
72
+ constructor(source: AreaGraphSource);
73
+ /** TAreaGraph::radiusOf — in double, as the span of int room coordinates can overflow an int. */
74
+ static radiusOf(minX: number, maxX: number, minY: number, maxY: number): number;
75
+ /** The nodes in area id order, each with its position. Call {@link refresh} first. */
76
+ getNodes(): AreaGraphNode[];
77
+ /** Sorted by (fromArea, toArea). */
78
+ getLinks(): AreaGraphLink[];
79
+ /**
80
+ * TAreaGraph::refresh. Desktop skips the rebuild when the map's revision
81
+ * has not moved; Mudlet Web keeps no such counter, so the graph is rebuilt
82
+ * every time and laid out again only when, as there, an area came, went or
83
+ * changed size, or the stored layout changed under it.
84
+ */
85
+ refresh(): void;
86
+ /** Pins the area there. False if there is no such area or a coordinate
87
+ * is not finite or beyond the limit. */
88
+ setPosition(areaId: number, position: Point): boolean;
89
+ /** Discards the stored positions (but the pinned ones, if asked) and lays everything out again. */
90
+ resetLayout(keepPinned: boolean): void;
91
+ /** Drops a deleted area's stored position, which a later area given the
92
+ * same id would otherwise take. */
93
+ forgetArea(areaId: number): void;
94
+ /** True if an area was added or removed or changed size. */
95
+ private rebuildGraph;
96
+ private rebuildLinks;
97
+ private readStoredLayout;
98
+ private writeStoredLayout;
99
+ private radiusOfArea;
100
+ private nodeIds;
101
+ /** Places areas with no position, then pushes apart any that overlap. */
102
+ private layoutAreas;
103
+ private placeNewAreas;
104
+ /** Shelf-packs components laid out on their own into rows below what is already placed. */
105
+ private packComponents;
106
+ /**
107
+ * Fruchterman-Reingold in its grid form — areas repel only within twice
108
+ * their ideal distance, which keeps a step near linear in the number of
109
+ * areas — with each pair's ideal distance set by the two areas' sizes.
110
+ * Only areas not in `fixed` move.
111
+ */
112
+ private simulate;
113
+ /**
114
+ * Pushes apart overlapping areas. Of a pair, the one with the higher
115
+ * mobility moves, both move if equal, and neither if both are pinned; an
116
+ * area missing from `mobilityOf` is new.
117
+ */
118
+ private removeOverlaps;
119
+ }
120
+ export {};
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Desktop's environment kits (EnvironmentKit.cpp): the kind of ground an
3
+ * environment is, for the 3D map styles that draw rooms by it rather than by
4
+ * colour alone. A game names the kit for an environment with
5
+ * setMapEnvironmentKit; until it does, one is guessed from the colour the
6
+ * environment is drawn in. Mudlet Web draws no 3D map, but the names are map
7
+ * data — kept in the map's user data, so they travel with the map file — and
8
+ * the guess is what a script reads back, so both follow desktop exactly.
9
+ */
10
+ /** The kits, in the order desktop's refusal lists them. */
11
+ export declare const ENVIRONMENT_KITS: readonly ["plain", "water", "road", "forest", "building"];
12
+ export type EnvironmentKit = typeof ENVIRONMENT_KITS[number];
13
+ /** The map user data key the named kits are saved under, as a JSON object of
14
+ * environment id to kit name. */
15
+ export declare const ENVIRONMENT_KIT_USER_DATA_KEY = "system.mapStyle.environmentKits";
16
+ export declare const isEnvironmentKit: (name: unknown) => name is EnvironmentKit;
17
+ /**
18
+ * EnvironmentKit::guess: blue is water, green forest, grey, brown and tan
19
+ * road, anything else a building. Nearly black is a road and nearly white a
20
+ * building, as neither has a hue to go by. Worked in HSL, as QColor::toHsl.
21
+ */
22
+ export declare function guessEnvironmentKit([r255, g255, b255]: readonly [number, number, number]): EnvironmentKit;
23
+ /** EnvironmentKit::stored: the kits the map names. An entry that cannot be
24
+ * read — a key that is not a number, a name that is not a kit — is left out,
25
+ * as is everything when what is saved is not a JSON object. */
26
+ export declare function storedEnvironmentKits(saved: string | undefined): Map<number, EnvironmentKit>;
27
+ /**
28
+ * EnvironmentKit::store: set or, with no kit, clear one environment's kit,
29
+ * keeping every other entry as it was, even one that cannot be read. Answers
30
+ * the new saved value — undefined when nothing is left, which removes the key —
31
+ * or null, refusing, when what is saved is not a JSON object, rather than
32
+ * overwrite it.
33
+ */
34
+ export declare function storeEnvironmentKit(saved: string | undefined, environmentId: number, kit: EnvironmentKit | null): {
35
+ value: string | undefined;
36
+ } | null;
@@ -0,0 +1,90 @@
1
+ import type { MudletMap } from 'mudlet-map-binary-reader';
2
+ /**
3
+ * The image a text map label carries, drawn the way TMap::createMapLabel draws
4
+ * it. Desktop renders the label once, at creation, into a pixmap — background
5
+ * fill, a one-pixel outline made of four offset copies of the text when the
6
+ * outline colour differs from the foreground, then the text — crops it to the
7
+ * text's bounding rectangle, and stores that pixmap in the map file. Its 2D map
8
+ * paints labels from the pixmap alone, so a label saved without one opens blank
9
+ * on desktop.
10
+ */
11
+ export interface LabelPixmapInput {
12
+ text: string;
13
+ /** Point size, as passed to createMapLabel. */
14
+ fontSize: number;
15
+ /** Font family; empty means the default face. */
16
+ fontName?: string;
17
+ fg: {
18
+ r: number;
19
+ g: number;
20
+ b: number;
21
+ a: number;
22
+ };
23
+ bg: {
24
+ r: number;
25
+ g: number;
26
+ b: number;
27
+ a: number;
28
+ };
29
+ outline: {
30
+ r: number;
31
+ g: number;
32
+ b: number;
33
+ a: number;
34
+ };
35
+ }
36
+ export interface LabelPixmap {
37
+ /** The PNG, base64-encoded — how MapStore holds every label pixmap. */
38
+ base64: string;
39
+ /** The pixmap's size in pixels — desktop's label box before the zoom divide. */
40
+ width: number;
41
+ height: number;
42
+ }
43
+ /**
44
+ * Render a label's pixmap, or null when there is no canvas to draw with (a
45
+ * worker, a test DOM) — the label then keeps an empty pixmap, as before.
46
+ */
47
+ export declare function renderLabelPixmap(input: LabelPixmapInput): LabelPixmap | null;
48
+ /**
49
+ * The map with every label pixmap as raw bytes, which is what
50
+ * `writeMapToBuffer` needs. MapStore holds pixmaps as base64 strings (cheap to
51
+ * clone and to JSON); handed one, the writer emits the string's characters in
52
+ * place of the PNG and the file no longer reads back — in Mudlet or here.
53
+ * Labels are copied, never changed in place, so the store keeps its strings.
54
+ *
55
+ * A string that is not a base64 PNG (a pixmap from a map written before image
56
+ * labels carried their image, which kept the file's path there) is written as no image: decoded, it would be junk bytes the
57
+ * reader cannot find the end of, and every record after it would misparse.
58
+ */
59
+ export declare function withLabelPixmapBytes(map: MudletMap): MudletMap;
60
+ export declare const isPng: (b: Uint8Array) => boolean;
61
+ /**
62
+ * The pixmap an image label is created with, the way TMap::createMapImageLabel
63
+ * makes it: a transparent `width * zoom` by `height * zoom` pixmap with the image
64
+ * painted over it, kept as a base64 PNG — so getMapLabel, the map file and
65
+ * saveJsonMap carry the picture and never the path.
66
+ *
67
+ * Built synchronously, since createMapImageLabel answers at once:
68
+ * - a PNG file is that data already and is kept as it is;
69
+ * - an XPM (text, so a script can write one) is read and scaled here;
70
+ * - a missing or empty file is the bare transparent pixmap, as on desktop.
71
+ * Any other format needs the browser to decode it, which is asynchronous:
72
+ * `pending` then resolves to the finished pixmap (null where there is no canvas
73
+ * to draw with), and until it does the label holds the transparent one.
74
+ */
75
+ export declare function imageLabelPixmap(bytes: Uint8Array | null, width: number, height: number, zoom: number): {
76
+ pixmap: string;
77
+ pending?: Promise<string | null>;
78
+ };
79
+ interface Rgba {
80
+ width: number;
81
+ height: number;
82
+ data: Uint8Array;
83
+ }
84
+ /** An XPM (version 3) image as RGBA, or null when the bytes are not one. */
85
+ export declare function readXpm(bytes: Uint8Array): Rgba | null;
86
+ export declare function crc32(bytes: Uint8Array): number;
87
+ /** RGBA pixels as a base64 PNG, encoded synchronously — what a pixmap has to
88
+ * be before a label can hold it, without waiting on a canvas. */
89
+ export declare function encodePngBase64(rgba: Uint8Array, width: number, height: number): string;
90
+ export {};
@@ -1,10 +1,44 @@
1
1
  import type { Settings as MapRendererSettings } from 'mudlet-map-renderer';
2
2
  import type { MapStore } from './MapStore';
3
3
  import { type MapperSettings } from '../storage/schema';
4
+ /**
5
+ * One profile-supplied font family as a CSS string literal, safe to concatenate
6
+ * into a `font-family` list.
7
+ *
8
+ * The backslash must be escaped *before* the quote, and escaping the quote
9
+ * alone is worse than not escaping at all. Take a family ending in a single
10
+ * backslash: quote-only escaping emits `'Foo\'`, whose closing quote is now
11
+ * itself escaped, so the literal never terminates and the rest of the
12
+ * declaration is swallowed as string content. Doubling the backslash first
13
+ * gives `'Foo\\'`, which closes properly around one literal backslash.
14
+ * (CodeQL alert 23 caught the original, which escaped only the quote.)
15
+ *
16
+ * Line terminators cannot appear in a CSS string at all, escaped or not, so
17
+ * they are dropped rather than encoded. The value reaches the renderer's canvas
18
+ * `font` shorthand today, where a malformed string merely fails to parse — but
19
+ * it is a profile field a package can set through the mapper settings, and the
20
+ * next consumer might be a stylesheet.
21
+ */
22
+ export declare function cssFontFamilyLiteral(family: string): string;
23
+ /** The bundled room-symbol font. Mudlet's default too, and the reason it has one:
24
+ * a generic family picks a different glyph shape per operating system, so the
25
+ * same map looks different on each machine. */
26
+ export declare const BUNDLED_SYMBOL_FONT = "Bitstream Vera Sans Mono";
27
+ /**
28
+ * The CSS `font-family` room symbols are drawn with — the profile's chosen font
29
+ * first, the bundled one behind it, so a family this device does not have still
30
+ * lands somewhere sensible.
31
+ *
32
+ * One function because three places have to agree on the answer: the renderer,
33
+ * the map image export that configures it, and the symbol-usage report, which
34
+ * would be lying if it drew a symbol in a different font from the map.
35
+ */
36
+ export declare function mapSymbolFontStack(mapper: MapperSettings | undefined): string;
4
37
  /**
5
38
  * Copy user-set fields from MapperSettings onto a live renderer settings
6
- * object. Anything left undefined in `mapper` is intentionally not touched
7
- * so the renderer's own createSettings() defaults stay in effect.
39
+ * object. Most fields left undefined in `mapper` are intentionally not touched
40
+ * so the renderer's own createSettings() defaults stay in effect; room size and
41
+ * exit width are the exception (see below).
8
42
  */
9
43
  export declare function applyMapperSettings(target: MapRendererSettings, mapper: MapperSettings | undefined): void;
10
44
  /**
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The styles desktop's modern 3D mapper draws in (MapStyle::ids()), in the
3
+ * order its setConfig refusal names them. Mudlet Web has no 3D view to draw
4
+ * them with, but the choice is ordinary profile data: getConfig/setConfig
5
+ * read and write it, and the profile save carries it as `<Host mapStyle="…">`,
6
+ * so a profile moved to desktop opens in the style it was set to.
7
+ */
8
+ export declare const MAP_STYLES: readonly string[];
9
+ /** MapStyle::defaultId(): what a new profile, and a save that names none or an
10
+ * unknown one, starts on. */
11
+ export declare const DEFAULT_MAP_STYLE = "tiles";
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Mudlet map format-version gate.
3
+ *
4
+ * Mudlet's own reader checks the leading format-version int *before* it parses
5
+ * anything and tells the player, on the main console, exactly why a map file
6
+ * was refused (`TMap::readMap`, src/TMap.cpp:1531-1573). `mudlet-map-binary-reader`
7
+ * has no equivalent: it throws a bare `Error("Unsupported Mudlet map version
8
+ * N. Supported version(s): 16, 17, 18, 19, 20.")` that every map entry point
9
+ * used to swallow into a `console.warn`, leaving the player with a blank map
10
+ * window and nothing to act on.
11
+ *
12
+ * So the version is read here, on this side of the library, and classified into
13
+ * the same cases Mudlet reports — with Mudlet's wording, since the player is
14
+ * being told the same thing.
15
+ */
16
+ /**
17
+ * Highest format version this build can read.
18
+ *
19
+ * Mudlet desktop's `mMaxVersion` (src/TMap.h:351) is also 20; here the ceiling
20
+ * comes from `mudlet-map-binary-reader`, which registers version models for
21
+ * 16-20 only (see its `getSupportedVersions`, not exported — hence the literal;
22
+ * `tests/map/mapVersionMessages.test.ts` pins these constants against the
23
+ * library's actual behaviour so a dependency bump cannot silently desync them).
24
+ */
25
+ export declare const MAP_MAX_SUPPORTED_VERSION = 20;
26
+ /**
27
+ * Lowest format version this build can read. Desktop Mudlet reads much older
28
+ * maps (down to version 1, warning from below 4 — src/TMap.cpp:1561), so a map
29
+ * we reject here is not necessarily lost: desktop can still open it and re-save
30
+ * it in the current format.
31
+ */
32
+ export declare const MAP_MIN_SUPPORTED_VERSION = 16;
33
+ /** Why a map buffer was refused, in the three shapes Mudlet distinguishes. */
34
+ export type MapVersionFault = 'not-a-map' | 'too-new' | 'too-old';
35
+ /**
36
+ * A map buffer whose format version this build cannot read.
37
+ *
38
+ * `messages` carries the console lines to post, already in Mudlet's
39
+ * `"[ PREFIX ] - body"` form (see `cTelnet::postMessage`, src/ctelnet.cpp:4436,
40
+ * which colours off that prefix); `summary` is the one-line version for UI that
41
+ * has a small error slot rather than a console.
42
+ */
43
+ export declare class MapVersionError extends Error {
44
+ readonly fault: MapVersionFault;
45
+ readonly version: number;
46
+ readonly messages: string[];
47
+ readonly summary: string;
48
+ constructor(fault: MapVersionFault, version: number, messages: string[], summary: string);
49
+ }
50
+ /**
51
+ * The format version a Mudlet `.dat` buffer declares: the very first value in
52
+ * the stream, a Qt `qint32` written big-endian by `QDataStream`
53
+ * (`mudlet-map-binary-reader`'s own `readMapVersion` reads the same four bytes
54
+ * through `QInt.read`). Returns `NaN` when the buffer is too short to hold one.
55
+ */
56
+ export declare function readMapFormatVersion(buf: ArrayBuffer): number;
57
+ /**
58
+ * Throw {@link MapVersionError} when `buf` declares a format version this build
59
+ * cannot read, mirroring `TMap::readMap`'s pre-parse gate (src/TMap.cpp:1531-1573).
60
+ * Returns the version otherwise.
61
+ *
62
+ * `source` is the file name / origin to quote in the message, when the caller
63
+ * has one (Mudlet always does; here a buffer can come from IndexedDB or a
64
+ * download, in which case the clause is simply left off).
65
+ */
66
+ export declare function assertReadableMapVersion(buf: ArrayBuffer, source?: string): number;
@@ -10,8 +10,8 @@ export interface ExitWeightFilterResult {
10
10
  weightOverride?: number;
11
11
  }
12
12
  /**
13
- * Called once per candidate exit while the graph is explored, with the room
14
- * being expanded and the exit's key — the short direction name ("e", "up") for
13
+ * Called once for every exit in the map before a search (see filterEveryExit),
14
+ * with the exit's source room and its key — the short direction name ("e", "up") for
15
15
  * stock exits, or the verbatim command for special exits. Mirrors Mudlet's
16
16
  * `applyExitWeightFilter(source, exitKey)` (TMap.cpp).
17
17
  */
@@ -0,0 +1,230 @@
1
+ /**
2
+ * GMCP `Char.Login` sign-in, versions 1 and 2, for one profile's session.
3
+ *
4
+ * Port of Mudlet's `GMCPAuthenticator` (development branch): it reads the
5
+ * game's `Char.Login.Default`, decides how to answer (see `charLoginFlow`),
6
+ * replays and stores password-less reconnect tokens, offers `Char.Login.URL`
7
+ * sign-in pages, and runs the client-driven OAuth flow (`oauthClientFlow`).
8
+ * React stays out of it — `ProfileSession` supplies the UI through
9
+ * {@link CharLoginUi} and forwards the session's events.
10
+ *
11
+ * Where it differs from desktop, and why:
12
+ *
13
+ * - **No browser launch.** Mudlet opens the system browser itself when it has
14
+ * evidence the player wants to sign in. A browser blocks a tab opened outside
15
+ * a user gesture, so every sign-in page becomes a button (and a console link)
16
+ * the player clicks.
17
+ * - **Storage is the credential vault.** Mudlet writes tokens to the OS
18
+ * keychain. Ours go into the vault, encrypted, and nowhere else: with no
19
+ * vault, or a locked one, `token_storage` says false and an arriving token
20
+ * is dropped, as the standard requires of a client that said so.
21
+ * - **One session per profile.** Mudlet's rotated-token retry and rejected-token
22
+ * fingerprint exist because two desktop instances can share one keychain
23
+ * entry. A profile here is held by one tab at a time (per-profile Web Locks),
24
+ * so a rejected token is simply dead.
25
+ * - **A version 1 popup.** Mudlet Web raises `CharLoginModal` when a version 1
26
+ * game rejects a saved password; Mudlet does not. Version 2 never opens it.
27
+ */
28
+ import type { VaultSignIn } from '../vault/vaultRecord';
29
+ import { type CharLoginCapabilities, type CharLoginResult, type CharLoginToken, type CharLoginUrl } from './protocol/charLoginFlow';
30
+ import { OAuthClientFlow, type OAuthAuthorization, type OAuthClientFlowOptions } from './protocol/oauthClientFlow';
31
+ /** A sign-in page waiting for the player to open it. */
32
+ export interface SignInOffer {
33
+ url: string;
34
+ provider?: string;
35
+ /** `server`: a `Char.Login.URL` — the game finishes the sign-in itself.
36
+ * `client`: our own OAuth flow, which is waiting for the redirect. */
37
+ flow: 'server' | 'client';
38
+ }
39
+ /** The session operations the controller drives (a `MudSession` satisfies it). */
40
+ export interface CharLoginSession {
41
+ sendCharLoginCredentials(account?: string, password?: string, tokenStorage?: boolean): void;
42
+ sendCharLoginReconnect(account: string, token: string, secureOnly: boolean, tokenStorage?: boolean): boolean;
43
+ sendCharLoginResume(account: string, provider: string, tokenStorage?: boolean): void;
44
+ sendCharLoginAuthCode(auth: OAuthAuthorization, tokenStorage?: boolean): boolean;
45
+ readonly gameTransportSecure: boolean;
46
+ dontReconnect: boolean;
47
+ reconnect(): boolean;
48
+ }
49
+ /** Where saved sign-ins live — the credential vault, via `vaultAccess`. */
50
+ export interface CharLoginVault {
51
+ /** A saved password or token for this profile sits in a locked vault. */
52
+ needsUnlock(): boolean;
53
+ /** The saved sign-in, when there is one and the vault is open. */
54
+ signIn(): VaultSignIn | undefined;
55
+ /** A vault exists and is locked. */
56
+ locked(): boolean;
57
+ /** No vault exists, but one could be set up here. False in a build that
58
+ * ships no vault, which must not be pointed at one. */
59
+ missing(): boolean;
60
+ /** Whether the vault holds a token for this profile — answerable locked. */
61
+ hasSignIn(): boolean;
62
+ /** Whether a token handed to us now would be kept (`token_storage`). */
63
+ canStore(): boolean;
64
+ save(entry: VaultSignIn | null): Promise<boolean>;
65
+ }
66
+ /** What the controller needs from the UI. */
67
+ export interface CharLoginUi {
68
+ /** Text auto-login (Mudlet's login timers) — GMCP takes the login over. */
69
+ cancelTextAutoLogin(): void;
70
+ /** Raise the version 1 credentials popup, keeping one already up. */
71
+ showPrompt(): void;
72
+ /** Show a rejected attempt's reason in the popup (raising it if needed). */
73
+ showPromptError(message: string): void;
74
+ closePrompt(): void;
75
+ /** Ask to unlock the vault; answer with {@link CharLoginController.vaultUnlockDone}. */
76
+ requestUnlock(reason: 'read' | 'store'): void;
77
+ /** Offer to set up a vault — once a visit, when none exists and the game
78
+ * could have handed over a sign-in to keep. */
79
+ suggestVaultSetup(): void;
80
+ /** Show (or with null, withdraw) a sign-in page for the player to open. */
81
+ offerSignIn(offer: SignInOffer | null): void;
82
+ /** A console notice in Mudlet's house style. */
83
+ post(level: 'INFO' | 'WARN', text: string): void;
84
+ }
85
+ export interface CharLoginControllerOptions {
86
+ session: CharLoginSession;
87
+ vault: CharLoginVault;
88
+ ui: CharLoginUi;
89
+ /** The player's saved account + password (`utils/storedCredentials`). */
90
+ readStoredLogin(): {
91
+ account: string;
92
+ password: string;
93
+ };
94
+ /** The client-driven OAuth redirect URI, or null when this page cannot run
95
+ * the flow at all (no WebCrypto, no BroadcastChannel). */
96
+ oauthRedirectUri(): string | null;
97
+ /** Seams for tests. */
98
+ createOAuthFlow?: (opts: OAuthClientFlowOptions) => Pick<OAuthClientFlow, 'start' | 'abort' | 'done'>;
99
+ now?: () => number;
100
+ setTimer?: (fn: () => void, ms: number) => unknown;
101
+ clearTimer?: (handle: unknown) => void;
102
+ }
103
+ /** A server can pack many `Char.Login.Default` frames into one burst, and each
104
+ * attempt reads the vault and may send a frame. One attempt a second, the
105
+ * burst folded into one — Mudlet's `scmSignInAttemptInterval`. */
106
+ export declare const SIGN_IN_ATTEMPT_INTERVAL_MS = 1000;
107
+ /** How long a replayed token waits for the `Char.Login.Result` that answers it
108
+ * before the game is treated as one that ignores `Char.Login.Reconnect` —
109
+ * Mudlet's `scmReconnectResultTimeout`. */
110
+ export declare const RECONNECT_RESULT_TIMEOUT_MS = 15000;
111
+ export declare class CharLoginController {
112
+ private readonly opts;
113
+ /** Credentials have been sent once this connection. */
114
+ private attempted;
115
+ /** The player chose "Use text login". */
116
+ private declined;
117
+ /** The player dismissed the vault unlock prompt this connection. */
118
+ private vaultDeclined;
119
+ /** A Char.Login request is parked behind the vault unlock prompt. */
120
+ private vaultPending;
121
+ /** Why the parked request asked. */
122
+ private vaultPendingReason;
123
+ /** The player said "Not now" to opening the vault just to keep a new
124
+ * sign-in. Lasts the visit, not the connection: the vault stays locked
125
+ * across reconnects, and asking at every one would nag. */
126
+ private storeDeclined;
127
+ /** The "set up saved logins" hint went out. Once a visit. */
128
+ private noVaultHinted;
129
+ /** Credentials went out and the game has said nothing since. */
130
+ private unanswered;
131
+ /** Any `Char.Login.Default` this connection named a way to sign in. A token
132
+ * arriving without one is ignored: nothing would replay it. */
133
+ private signInOffered;
134
+ private reconnectAttempted;
135
+ private resumeAttempted;
136
+ private oauthAttempted;
137
+ /** The last capabilities the game advertised, for re-deciding after an
138
+ * unlock or a deadline. */
139
+ private caps;
140
+ /** The account the player last handed over, for the retry popup. */
141
+ lastLoginAttempt: {
142
+ account: string;
143
+ save: boolean;
144
+ } | null;
145
+ private awaitingReconnectResult;
146
+ /** This connection is running on a token it replayed, so a token arriving
147
+ * now is a silent rotation rather than a first save worth announcing. */
148
+ private reconnectingWithToken;
149
+ /** The provider this account signs in with — from the stored entry or this
150
+ * connection's `Char.Login.URL`. Saved with the token. */
151
+ private accountProvider;
152
+ private reconnectAccount;
153
+ /** A token was rejected: the next attempt reads the store but does not
154
+ * replay. Consumed by that attempt. Mudlet's `mReconnectRejected`. */
155
+ private tokenRejected;
156
+ /** Bumped on every connect, disconnect and sign-in attempt, so async work
157
+ * that started under an older one stops. */
158
+ private generation;
159
+ private announcedSaveFor;
160
+ private lastAttemptAt;
161
+ private pendingAttempt;
162
+ private reconnectDeadline;
163
+ private oauthFlow;
164
+ private offerShown;
165
+ private offerFlow;
166
+ private readonly now;
167
+ private readonly setTimer;
168
+ private readonly clearTimer;
169
+ constructor(opts: CharLoginControllerOptions);
170
+ /** The game link came up: a fresh connection signs in from scratch. */
171
+ connected(): void;
172
+ /** The connection went. If credentials are still unanswered, this drop *is*
173
+ * the game's answer — say so before the popup goes (measured on Achaea). */
174
+ disconnected(): void;
175
+ /** The player pressed Disconnect: hanging up on ourselves is not the game
176
+ * refusing the login. */
177
+ userDisconnecting(): void;
178
+ /** Any server output: the game is still talking, so whatever happens later
179
+ * is not a silent hang-up on the login. */
180
+ serverOutput(): void;
181
+ dispose(): void;
182
+ private resetSocket;
183
+ private resetAttempt;
184
+ request(caps: CharLoginCapabilities): void;
185
+ private scheduleAttempt;
186
+ private clearPendingAttempt;
187
+ private requestState;
188
+ /** Mudlet's `attemptReconnect` → `readStoredSignIn` → `selectAuthMethod`. */
189
+ private attempt;
190
+ private get tokenStorage();
191
+ private execute;
192
+ /** The vault unlock prompt closed. When a request was parked behind it,
193
+ * answer it now — the game withholds its own prompt until we reply. */
194
+ vaultUnlockDone(result: 'created' | 'unlocked' | 'closed'): void;
195
+ /** The player submitted the credentials popup. */
196
+ promptSubmitted(account: string, password: string, save: boolean): void;
197
+ /** The player chose "Use text login". */
198
+ promptDeclined(): void;
199
+ result(result: CharLoginResult): void;
200
+ /** A replayed token was refused. Drop it — keeping the account and
201
+ * provider as a resume hint so the next sign-in needs no provider menu —
202
+ * and reconnect so the player signs in on a fresh, stable connection:
203
+ * servers commonly hang up right after rejecting one. */
204
+ private tokenRejected_;
205
+ private armReconnectDeadline;
206
+ private clearReconnectDeadline;
207
+ url(link: CharLoginUrl | null): void;
208
+ private offer;
209
+ private withdrawOffer;
210
+ /** Close a `Char.Login.URL` offer once the game has moved past it. The
211
+ * game only says the page is done by what it does next — a token, a
212
+ * result, its next `Default` — and some (StickMUD, for a sign-in not yet
213
+ * linked to a character) send nothing but text. Our own OAuth offer has
214
+ * its own ending (captured / failed) and is left alone. */
215
+ private withdrawServerOffer;
216
+ /** The player sent a command. A game waiting on a browser sign-in takes
217
+ * input as "cancel" or as the next answer, so its page is done with. */
218
+ playerInput(): void;
219
+ token(t: CharLoginToken): void;
220
+ private startOAuthFlow;
221
+ private sendAuthCode;
222
+ private oauthFailed;
223
+ /** The player chose the game's own sign-in over our browser flow. */
224
+ useGameSignIn(): void;
225
+ /** The player dismissed a server-driven sign-in offer. The console link
226
+ * stays; nothing is sent. */
227
+ dismissOffer(): void;
228
+ private handOff;
229
+ private cancelOAuthFlow;
230
+ }
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Mudlet hands every trigger, alias, timer, key, button and script its id from
5
5
  * a single running number — temporary and permanent alike — so `tempAlias()`
6
- * followed by `permAlias()` followed by `tempAlias()` yields n, n+1, n+2. mudix
6
+ * followed by `permAlias()` followed by `tempAlias()` yields n, n+1, n+2. Mudlet Web
7
7
  * grew a counter per engine plus one for the permanent tree, which meant a
8
8
  * temporary item and a permanent one could be handed the *same* id: two
9
9
  * different things answering to one number, which `killAlias(id)` and