@mudlet/mudlet-web 0.4.5 → 1.0.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 (308) 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 +50660 -29735
  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 +432 -59
  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 +54 -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 +1039 -213
  149. package/dist-lib/scripting/ScriptingEngine.d.ts +753 -103
  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 +521 -44
  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/CharLoginModal.d.ts +24 -15
  192. package/dist-lib/ui/CmdLineMenuRegistry.d.ts +14 -5
  193. package/dist-lib/ui/CommandBar.d.ts +8 -8
  194. package/dist-lib/ui/ConnectionFormModal.d.ts +25 -1
  195. package/dist-lib/ui/ConnectionScreen.d.ts +9 -1
  196. package/dist-lib/ui/GameLinkPrompt.d.ts +28 -0
  197. package/dist-lib/ui/HelpModal.d.ts +5 -1
  198. package/dist-lib/ui/MapSymbolUsageModal.d.ts +32 -0
  199. package/dist-lib/ui/MouseEventRegistry.d.ts +31 -4
  200. package/dist-lib/ui/NotepadModal.d.ts +22 -0
  201. package/dist-lib/ui/ResizableModal.d.ts +16 -1
  202. package/dist-lib/ui/SettingsModal.d.ts +10 -1
  203. package/dist-lib/ui/TlsAlertBanner.d.ts +3 -1
  204. package/dist-lib/ui/Toolbar.d.ts +22 -1
  205. package/dist-lib/ui/VaultManageButton.d.ts +20 -0
  206. package/dist-lib/ui/VaultModal.d.ts +5 -0
  207. package/dist-lib/ui/VaultUnlockPrompt.d.ts +15 -0
  208. package/dist-lib/ui/buttons/ButtonsBar.d.ts +3 -1
  209. package/dist-lib/ui/buttons/inactiveButtons.d.ts +25 -0
  210. package/dist-lib/ui/cmdline/CommandLineManager.d.ts +19 -0
  211. package/dist-lib/ui/cmdline/plainText.d.ts +16 -0
  212. package/dist-lib/ui/cmdline/subCommandLine.d.ts +78 -0
  213. package/dist-lib/ui/cmdline/useCmdLineSelection.d.ts +26 -0
  214. package/dist-lib/ui/cmdline/useSubCommandLineKeys.d.ts +33 -0
  215. package/dist-lib/ui/codemirror/lineParagraphMarks.d.ts +19 -0
  216. package/dist-lib/ui/codemirror/luaHover.d.ts +7 -0
  217. package/dist-lib/ui/codemirror/options.d.ts +33 -0
  218. package/dist-lib/ui/codemirror/theme.d.ts +29 -5
  219. package/dist-lib/ui/commands/addonCommands.d.ts +134 -0
  220. package/dist-lib/ui/commands/appShortcuts.d.ts +86 -0
  221. package/dist-lib/ui/commands/hostCommands.d.ts +88 -0
  222. package/dist-lib/ui/commands/keyMatch.d.ts +20 -0
  223. package/dist-lib/ui/commands/keySequence.d.ts +57 -0
  224. package/dist-lib/ui/components/ContextMenu.d.ts +21 -1
  225. package/dist-lib/ui/components/FontPicker.d.ts +5 -1
  226. package/dist-lib/ui/components/useModalFocus.d.ts +13 -1
  227. package/dist-lib/ui/helpTopics.d.ts +15 -0
  228. package/dist-lib/ui/labels/LabelManager.d.ts +172 -9
  229. package/dist-lib/ui/labels/LabelOverlay.d.ts +19 -0
  230. package/dist-lib/ui/labels/backgroundImageSize.d.ts +19 -0
  231. package/dist-lib/ui/labels/labelModel.d.ts +64 -0
  232. package/dist-lib/ui/labels/qColor.d.ts +13 -0
  233. package/dist-lib/ui/labels/qtCss.d.ts +12 -4
  234. package/dist-lib/ui/landmarks.d.ts +9 -0
  235. package/dist-lib/ui/launcher/ActionMenu.d.ts +19 -0
  236. package/dist-lib/ui/launcher/GameDetails.d.ts +21 -0
  237. package/dist-lib/ui/launcher/GameSection.d.ts +18 -0
  238. package/dist-lib/ui/launcher/LauncherSearch.d.ts +23 -0
  239. package/dist-lib/ui/launcher/ProfileArt.d.ts +20 -0
  240. package/dist-lib/ui/launcher/ProfileSection.d.ts +43 -0
  241. package/dist-lib/ui/launcher/launcherModel.d.ts +72 -0
  242. package/dist-lib/ui/layout/overlayLayerOrder.d.ts +2 -2
  243. package/dist-lib/ui/menu/MenuBar.d.ts +31 -0
  244. package/dist-lib/ui/menu/SplitButton.d.ts +39 -0
  245. package/dist-lib/ui/menu/anchoredPopup.d.ts +74 -0
  246. package/dist-lib/ui/menu/appMenus.d.ts +65 -0
  247. package/dist-lib/ui/menu/menuModel.d.ts +88 -0
  248. package/dist-lib/ui/menu/toolbarModel.d.ts +56 -0
  249. package/dist-lib/ui/notepad.d.ts +76 -0
  250. package/dist-lib/ui/openSignInPage.d.ts +14 -0
  251. package/dist-lib/ui/output/OutputContextMenu.d.ts +14 -1
  252. package/dist-lib/ui/output/OutputRenderer.d.ts +5 -0
  253. package/dist-lib/ui/output/OutputSearchBar.d.ts +5 -1
  254. package/dist-lib/ui/output/StickyOutputPanel.d.ts +17 -3
  255. package/dist-lib/ui/output/TextAnalyzerModal.d.ts +25 -0
  256. package/dist-lib/ui/output/caretMode.d.ts +3 -2
  257. package/dist-lib/ui/output/clearSplit.d.ts +11 -0
  258. package/dist-lib/ui/output/outputCopy.d.ts +41 -2
  259. package/dist-lib/ui/output/outputRows.d.ts +43 -0
  260. package/dist-lib/ui/output/selectionGesture.d.ts +35 -0
  261. package/dist-lib/ui/output/wordSelection.d.ts +33 -0
  262. package/dist-lib/ui/search/matcher.d.ts +14 -4
  263. package/dist-lib/ui/settings/SettingsShell.d.ts +91 -0
  264. package/dist-lib/ui/settings/ShortcutEditor.d.ts +13 -0
  265. package/dist-lib/ui/sound/SoundManager.d.ts +210 -44
  266. package/dist-lib/ui/sound/closedCaption.d.ts +4 -1
  267. package/dist-lib/ui/sound/mediaDirection.d.ts +35 -0
  268. package/dist-lib/ui/tabCompletion.d.ts +53 -0
  269. package/dist-lib/ui/textedit/TextEditManager.d.ts +11 -2
  270. package/dist-lib/ui/useOpenProfiles.d.ts +1 -1
  271. package/dist-lib/ui/useVaultSaver.d.ts +26 -0
  272. package/dist-lib/ui/video/VideoManager.d.ts +7 -0
  273. package/dist-lib/ui/windows/WindowManager.d.ts +452 -37
  274. package/dist-lib/ui/windows/panels/ScriptEditorPanel.d.ts +14 -0
  275. package/dist-lib/ui/windows/panels/ScriptSearch.d.ts +6 -1
  276. package/dist-lib/ui/windows/panels/TextPanel.d.ts +4 -1
  277. package/dist-lib/ui/windows/panels/VariablesView.d.ts +37 -7
  278. package/dist-lib/ui/windows/panels/WindowCmdLine.d.ts +4 -2
  279. package/dist-lib/ui/windows/panels/aliasLoop.d.ts +24 -0
  280. package/dist-lib/ui/windows/panels/editorClipboard.d.ts +45 -0
  281. package/dist-lib/ui/windows/panels/editorUndo.d.ts +79 -0
  282. package/dist-lib/ui/windows/panels/mapAreaChange.d.ts +10 -0
  283. package/dist-lib/utils/appShellCache.d.ts +25 -0
  284. package/dist-lib/utils/fontFamilyName.d.ts +13 -0
  285. package/dist-lib/utils/fontLoader.d.ts +31 -0
  286. package/dist-lib/utils/formatBytes.d.ts +4 -0
  287. package/dist-lib/utils/mustBeOneOf.d.ts +9 -0
  288. package/dist-lib/utils/profileLock.d.ts +1 -1
  289. package/dist-lib/utils/storedCredentials.d.ts +31 -0
  290. package/dist-lib/utils/systemTheme.d.ts +24 -0
  291. package/dist-lib/utils/timeZone.d.ts +10 -0
  292. package/dist-lib/vault/CredentialVault.d.ts +197 -0
  293. package/dist-lib/vault/deviceUnlock.d.ts +47 -0
  294. package/dist-lib/vault/passkeyPrf.d.ts +56 -0
  295. package/dist-lib/vault/useVault.d.ts +8 -0
  296. package/dist-lib/vault/vaultAccess.d.ts +80 -0
  297. package/dist-lib/vault/vaultCrypto.d.ts +56 -0
  298. package/dist-lib/vault/vaultHelpTopic.d.ts +9 -0
  299. package/dist-lib/vault/vaultRecord.d.ts +92 -0
  300. package/dist-lib/vfs-sw.js +220 -11
  301. package/dist-lib/vite.d.ts +1 -1
  302. package/dist-lib/vite.js +66 -43
  303. package/package.json +22 -14
  304. package/dist-lib/assets/mapParser.worker-t-3rd1zR.js +0 -9
  305. package/dist-lib/mud/connection/PingTracker.d.ts +0 -41
  306. package/dist-lib/ui/BundledGameGrid.d.ts +0 -21
  307. package/dist-lib/ui/ConnectionGrid.d.ts +0 -21
  308. package/dist-lib/ui/bufferWords.d.ts +0 -38
@@ -1,9 +1,10 @@
1
- import { type OscPaletteOp } from "./ansiEscapes";
2
1
  import { HyperlinkPresetRegistry, type HyperlinkConfig, type UnderlineStyle } from "./hyperlinkConfig";
3
- /** Apply OSC 4/104 palette operations to the global colour tables. Palette
4
- * changes affect text parsed *after* this point — which is exactly document
5
- * order, since lines are fed to the parser in the order the server sent them. */
6
- export declare function applyOscPaletteOps(ops: ReadonlyArray<OscPaletteOp>): void;
2
+ /** Obey a Linux-console palette OSC (`ESC]P…` / `ESC]R`, see
3
+ * {@link parseOscPalette}) against the global colour tables. Palette changes
4
+ * affect text parsed *after* this point — which is exactly document order,
5
+ * since lines are fed to the parser in the order the server sent them. Any
6
+ * other payload — xterm's OSC 4/104 included — changes nothing. */
7
+ export declare function applyOscPalette(payload: string): void;
7
8
  export interface FormatHyperlink {
8
9
  onClick?: (ev: MouseEvent) => void;
9
10
  onContextMenu?: (ev: MouseEvent) => void;
@@ -36,6 +37,12 @@ export interface FormatHyperlink {
36
37
  * for it (`{"style":{"underline":true}}` / a matching pseudo-class state).
37
38
  */
38
39
  autoUnderline?: boolean;
40
+ /**
41
+ * The Lua code a scripted link runs — every entry, for a popup. Read by
42
+ * the clipboard, which holds its own reference to each function a copied
43
+ * link calls (see `ScriptingAPI.clipboardLinkCommands`).
44
+ */
45
+ luaCommands?: string[];
39
46
  }
40
47
  export interface IndexedColor {
41
48
  space: "indexed";
@@ -77,6 +84,13 @@ export interface FormatStateSnapshot {
77
84
  overline?: boolean;
78
85
  slowBlink?: boolean;
79
86
  rapidBlink?: boolean;
87
+ /** SGR 8: the text is there and not drawn. */
88
+ concealed?: boolean;
89
+ /** SGR 11-19 select one of nine alternate fonts, SGR 10 the primary one.
90
+ * Carried for parity with Mudlet's getTextFormat: Mudlet Web has no alternate
91
+ * font to switch to, so the number is recorded and nothing renders
92
+ * differently — but a script reading it back gets the truth. */
93
+ alternateFont?: number;
80
94
  dim?: DimEffect;
81
95
  hyperlink?: FormatHyperlink;
82
96
  cssClass?: string;
@@ -100,6 +114,8 @@ export declare class FormatState {
100
114
  overline?: boolean;
101
115
  slowBlink?: boolean;
102
116
  rapidBlink?: boolean;
117
+ concealed?: boolean;
118
+ alternateFont?: number;
103
119
  dim?: DimEffect;
104
120
  hyperlink?: FormatHyperlink;
105
121
  private fgNormal?;
@@ -108,6 +124,12 @@ export declare class FormatState {
108
124
  * SGR 0 and SGR 39 leave it. Bold never brightens a default foreground. */
109
125
  private fgIsDefault;
110
126
  private _foreground?;
127
+ /** Mudlet's `!mIsDefaultColor` exactly — which is narrower than
128
+ * `!fgIsDefault`: TBuffer::decodeSGR clears mIsDefaultColor only for one of
129
+ * the sixteen ANSI colours (30–37, 90–97, and `38;5`/`48;5` below 16), not
130
+ * for a 256-colour or 24-bit one. It decides one thing here: whether SGR 1
131
+ * makes the characters written bold (see {@link toCellSnapshot}). */
132
+ private ansiColored;
111
133
  /** The foreground in force, both variants already resolved. */
112
134
  get foreground(): FormatColor | undefined;
113
135
  /** Writing the foreground from outside the SGR decoder — `setFgColor`, MXP
@@ -119,6 +141,21 @@ export declare class FormatState {
119
141
  constructor(initial?: FormatStateSnapshot);
120
142
  private applySnapshot;
121
143
  reset(): void;
144
+ /** The attributes an SGR-decoded character is written with. Mudlet's
145
+ * TBuffer gives a cell the Bold flag as `mIsDefaultColor ? mBold : false`:
146
+ * on one of the sixteen ANSI colours, SGR 1 only picks the bright twin
147
+ * (already resolved into `foreground`) and the character itself is not
148
+ * bold. The bold state is still carried — `toSnapshot` keeps it — so a
149
+ * colour that arrives later is brightened. */
150
+ toCellSnapshot(): FormatStateSnapshot;
151
+ /** The attributes the spaces a `CSI n C` (cursor forward) stands for are
152
+ * written with: the current ones, with the foreground set to the
153
+ * background so the gap stays transparent — an underline or strike-out in
154
+ * force does not show across it (TBuffer's
155
+ * `TChar(mBackGroundColor, mBackGroundColor, computeCurrentAttributeFlags())`).
156
+ * A default background leaves the foreground default too: the parser has
157
+ * no profile colours to resolve it to. */
158
+ toCursorForwardSnapshot(): FormatStateSnapshot;
122
159
  toSnapshot(): FormatStateSnapshot;
123
160
  applySgr(params: SgrParam[]): void;
124
161
  /**
@@ -156,12 +193,12 @@ export declare class FormatState {
156
193
  *
157
194
  * The distinction matters for exactly one reason, but it matters a lot: `4:3` is
158
195
  * a *curly underline*, one parameter with a sub-parameter, while `4;3` is an
159
- * underline followed by italics. Flattening both — which mudix did, to make
196
+ * underline followed by italics. Flattening both — which Mudlet Web did, to make
160
197
  * `38:5:1` work alongside `38;5;1` — turned every styled underline into an
161
198
  * accidental italic. Extended colours still read either form, since applySgr
162
199
  * looks ahead across parameters for the `38;5;n` spelling.
163
200
  */
164
- export declare function parseSgrCodes(sequence: string): SgrParam[];
201
+ export declare function parseSgrCodes(sequence: string): SgrParam[] | null;
165
202
  /**
166
203
  * A run of text with its visual attributes resolved to concrete CSS colour
167
204
  * strings — the shape a canvas/image renderer wants. `color`/`background` are
@@ -185,7 +222,16 @@ export declare class AnsiAwareBuffer {
185
222
  private _onRender?;
186
223
  private _textCache;
187
224
  private _renderContainer;
225
+ private _lineElement;
226
+ /** The OSC 8 link still open where a string `initial` ends, which the
227
+ * next line of the same stream starts inside (see computeTrailingState). */
228
+ readonly openHyperlink?: FormatHyperlink;
188
229
  constructor(initial?: string | BufferSegment[], state?: FormatStateSnapshot, presets?: HyperlinkPresetRegistry);
230
+ /** A buffer holding `text` exactly as given — every character, an ESC
231
+ * included, stored as text in `state`. The string constructor decodes
232
+ * escape sequences instead; this is for text that must not be decoded
233
+ * (a script's echo — see Console.echoText). */
234
+ static literal(text: string, state?: FormatStateSnapshot): AnsiAwareBuffer;
189
235
  get deleted(): boolean;
190
236
  markAsDeleted(): this;
191
237
  /** Per-line prompt flag. Mudlet's TBuffer tracks isPrompt on each line so
@@ -198,10 +244,37 @@ export declare class AnsiAwareBuffer {
198
244
  * buffer is built right as its line is echoed/received, so construction
199
245
  * time is the line's timestamp. */
200
246
  timestamp: number;
247
+ /** True for a line that wrapping split off the end of the one above it.
248
+ * Mudlet marks those by giving them a blank timestamp rather than a time,
249
+ * which is both what getTimestamp() hands back for them and how a later
250
+ * wrapLine() knows to give them the hanging indent rather than the first. */
251
+ continuation: boolean;
252
+ /** Columns of indent a wrap put in front of this line, when it starts a
253
+ * paragraph — desktop's wrapGapBuffer entry for such a line. Leading
254
+ * spaces alone can't tell the indent from text, so a later wrapLine()
255
+ * reads this (and that the spaces are still there) to know the line
256
+ * already carries its indent and must not be given it again. */
257
+ wrapIndent: number;
201
258
  removeFromDom(): void;
259
+ /**
260
+ * `removeFromDom()` for a whole eviction batch at once. A trim takes a run
261
+ * of lines off the head of a buffer, and their rows normally sit side by
262
+ * side at the top of the console — those go a block or a Range deletion
263
+ * at a time rather than one removeChild apiece, which on a 20,000-line
264
+ * trim was half a second of mutation bookkeeping alone (#443). Rows with
265
+ * a gap between them (some other element in the way) fall back to the
266
+ * per-line removal, so nothing that is not one of these lines is touched.
267
+ */
268
+ static removeAllFromDom(buffers: readonly AnsiAwareBuffer[]): void;
202
269
  onRender(callback: (container: HTMLElement) => void): this;
203
- /** @internal */
204
- notifyRender(container: HTMLElement): void;
270
+ /**
271
+ * @internal
272
+ * `container` is the element `rerender()` rewrites — the content slot.
273
+ * `lineElement` is the whole row `removeFromDom()` has to detach; pass it
274
+ * whenever the row is more than the content slot. Omit it and the content
275
+ * element doubles as the row.
276
+ */
277
+ notifyRender(container: HTMLElement, lineElement?: HTMLElement): void;
205
278
  /** Re-renders the buffer into its previously notified container. No-op if not yet rendered. */
206
279
  rerender(): void;
207
280
  /** Removes all formatting from a range (clears colors, bold, etc.). */
@@ -233,15 +306,24 @@ export declare class AnsiAwareBuffer {
233
306
  hyperlink?: FormatHyperlink;
234
307
  }[];
235
308
  color(range: TextRange, color: number | FormatStateSnapshot): this;
309
+ /**
310
+ * Overlays the attributes set in `format` on every segment in `range`,
311
+ * keeping everything else each character already had — the way
312
+ * TBuffer::applyBold/applyFgColor/… touch only the one attribute they set.
313
+ * A coloured selection stays coloured when it is made bold, and a
314
+ * recoloured one keeps its per-character backgrounds and attributes.
315
+ */
236
316
  applyFormat(range: TextRange, format: FormatStateSnapshot): this;
237
317
  /**
238
318
  * Overlays a hyperlink on every segment in `range`, preserving each
239
319
  * segment's existing colors/attributes. Pass `undefined` to clear any
240
- * hyperlinks in the range. Unlike `applyFormat` (which homogenizes
241
- * formatting across the range), this is segment-wise — used by Mudlet
242
- * `setLink` so coloured selections remain coloured after becoming clickable.
320
+ * hyperlinks in the range. Used by Mudlet `setLink` so coloured selections
321
+ * remain coloured after becoming clickable.
243
322
  */
244
323
  setHyperlink(range: TextRange, hyperlink?: FormatHyperlink): this;
324
+ /** Split the segments at `range`'s ends and let `edit` change a copy of
325
+ * each covered segment's state in place. */
326
+ private overlaySegments;
245
327
  /**
246
328
  * Wire deferred URL hyperlinks (recorded by the ANSI parser for OSC 8 links
247
329
  * as a bare `url` with no handlers) into live, clickable links. `factory`
@@ -264,7 +346,40 @@ export declare class AnsiAwareBuffer {
264
346
  * overlay this reproduces the plain SGR rendering exactly.
265
347
  */
266
348
  private visualDecls;
267
- toHtml(): string;
349
+ /**
350
+ * `transparentBackground` is what a fully transparent background stands
351
+ * for. On screen the console shows through it, but a log document has no
352
+ * console behind it, so TBuffer::bufferToHtml paints the console's own
353
+ * colour there instead (#10592) — otherwise it reads as black.
354
+ */
355
+ toHtml(opts?: {
356
+ transparentBackground?: {
357
+ r: number;
358
+ g: number;
359
+ b: number;
360
+ };
361
+ }): string;
362
+ /**
363
+ * This line as TBuffer::bufferToHtml writes it into an HTML session log:
364
+ * every run in a span naming BOTH colours outright (text with no colour of
365
+ * its own takes the console's — Mudlet's TChar always carries one), then
366
+ * `<br>` and a line feed. The `<br>` is what breaks the lines: the log's
367
+ * stylesheet sets `white-space: nowrap` on the body, so without it a browser
368
+ * draws the whole session as one line. Only `<` and `>` are escaped, as
369
+ * desktop does.
370
+ */
371
+ toLogHtml(defaults: {
372
+ foreground: {
373
+ r: number;
374
+ g: number;
375
+ b: number;
376
+ };
377
+ background: {
378
+ r: number;
379
+ g: number;
380
+ b: number;
381
+ };
382
+ }): string;
268
383
  /**
269
384
  * Resolve the buffer's segments to styled runs with concrete CSS colours,
270
385
  * for rendering to a canvas (copy-as-image). Mirrors {@link toHtml}'s colour
@@ -275,6 +390,14 @@ export declare class AnsiAwareBuffer {
275
390
  toStyledRuns(): OutputStyledRun[];
276
391
  toDom(): DocumentFragment;
277
392
  private escapeHtml;
393
+ /**
394
+ * A colour as the HTML consumers want it written: `rgb(r,g,b)`, decimal and
395
+ * unspaced, which is what TBuffer::bufferToHtml emits and what anything
396
+ * reading a Mudlet log back parses. Falls through to {@link colorToHex} for
397
+ * the forms that are not plain opaque RGB (a named/hex colour stays as it
398
+ * is, a translucent one keeps its rgba()).
399
+ */
400
+ private colorToCss;
278
401
  private colorToHex;
279
402
  private prepareStyle;
280
403
  private appendSegmentAtEnd;
@@ -316,4 +439,4 @@ export { cloneState as cloneFormatState, statesEqual as formatStatesEqual };
316
439
  * - text with no ANSI codes → returns `baseState` unchanged
317
440
  * Used to carry SGR state across line breaks the way Mudlet's TBuffer does.
318
441
  */
319
- export declare function computeTrailingState(text: string, baseState?: FormatStateSnapshot): FormatStateSnapshot | undefined;
442
+ export declare function computeTrailingState(text: string, baseState?: FormatStateSnapshot, openHyperlink?: FormatHyperlink): FormatStateSnapshot | undefined;
@@ -27,6 +27,34 @@ export interface EscapeScan {
27
27
  * for the next line.
28
28
  */
29
29
  export declare function scanEscape(text: string, start: number): EscapeScan;
30
+ /**
31
+ * Where the escape sequence `text` leaves unfinished begins, scanning from
32
+ * `from`, or -1 when every sequence in it is complete. Sequences are walked
33
+ * from the start rather than from the last ESC, as an ESC inside an OSC or
34
+ * string payload belongs to that sequence.
35
+ */
36
+ export declare function unfinishedEscapeStart(text: string, from?: number): number;
37
+ /**
38
+ * How many spaces a `CSI n C` (CUF, cursor forward) stands for — the one cursor
39
+ * movement Mudlet emulates (TBuffer::translateToPlainText's 'C' case, added for
40
+ * games that column-align with it). The parameter has to read whole as a
41
+ * positive integer (`QByteArray::toInt`): `ESC[C`, `ESC[0C` and anything like
42
+ * `ESC[1;2C` stand for nothing and return 0.
43
+ */
44
+ export declare function cursorForwardCount(params: string | undefined): number;
45
+ /** TBuffer::translateToPlainText's `rightMargin`: the column a cursor-forward
46
+ * stops at. See {@link cursorForwardSpaces}. */
47
+ export declare const MAX_CURSOR_FORWARD = 1000;
48
+ /**
49
+ * How many spaces a cursor-forward of `count` (from {@link cursorForwardCount})
50
+ * actually writes at `column` (the line's length so far) —
51
+ * TBuffer::translateToPlainText's 'C' case. Like a terminal's, the cursor stops
52
+ * at the right margin: the count comes from the game, and unbounded, one
53
+ * sequence (or a run of them) could ask for gigabytes of spaces. The margin is
54
+ * {@link MAX_CURSOR_FORWARD}, not the window's wrap: games send lines longer
55
+ * than that, and the spaces have to survive the wrap that splits them.
56
+ */
57
+ export declare function cursorForwardSpaces(count: number, column: number): number;
30
58
  export interface Osc8Link {
31
59
  /** The link target. An empty string means "close the current hyperlink". */
32
60
  uri: string;
@@ -57,7 +85,7 @@ export type HyperlinkAction = {
57
85
  kind: "url";
58
86
  url: string;
59
87
  };
60
- /** URI schemes mudix is willing to make clickable from server output. */
88
+ /** URI schemes Mudlet Web is willing to make clickable from server output. */
61
89
  export declare const ALLOWED_HYPERLINK_SCHEMES: readonly ["send", "prompt", "http", "https", "ftp"];
62
90
  /** Percent-decode a send/prompt command, like Mudlet's `QUrl::fromPercentEncoding`,
63
91
  * so `cast%20fireball` reaches the MUD as `cast fireball`. Malformed escapes are
@@ -70,19 +98,7 @@ export type OscPaletteOp = {
70
98
  color: string;
71
99
  } | {
72
100
  kind: "reset";
73
- index: number;
74
- } | {
75
- kind: "reset-all";
76
101
  };
77
- /**
78
- * Parse an XParseColor spec into a `#rrggbb` string, or null if unrecognised.
79
- * Handles the two forms MUDs use in practice — `rgb:r/g/b` and `#`-hex — and
80
- * rejects named colours and other X forms (`rgbi:`, `cmyk:`, …).
81
- */
82
- export declare function parseXColorSpec(spec: string): string | null;
83
- /**
84
- * Parse an OSC payload as an OSC 4 (set) or OSC 104 (reset) palette command.
85
- * Returns the ordered list of operations, or null if the payload is neither.
86
- * Malformed index/spec pairs are skipped rather than aborting the whole list.
87
- */
88
- export declare function parseOscColorPalette(payload: string): OscPaletteOp[] | null;
102
+ /** Parse an OSC payload as a Linux-console palette command, or null if it is
103
+ * not one (or is a malformed one). */
104
+ export declare function parseOscPalette(payload: string): OscPaletteOp | null;
@@ -1,6 +1,8 @@
1
1
  import type { FormatColor, FormatStateSnapshot } from './FormatState';
2
- /** Resolve an MXP color spec — an HTML named color, `#RGB`, `#RRGGBB`, or
3
- * `rgb(r,g,b)` — into a {@link FormatColor}, or null when unrecognized.
2
+ /** Resolve an MXP color spec into a {@link FormatColor}, or null when
3
+ * unrecognized — what Mudlet's `QColor(name)` accepts (a hex form or a
4
+ * colour name, see {@link SVG_COLORS}), then, as this client's own
5
+ * additions, `rgb(r,g,b)` and the Mudlet palette names.
4
6
  * Used by the MXP parser for `<COLOR>`/`<FONT>` foreground and background. */
5
7
  export declare function mxpColor(spec: string): FormatColor | null;
6
8
  export declare function namedColorToAnsi(name: string, bg?: boolean): string;
@@ -41,6 +43,16 @@ export declare function dechoToAnsiFast(str: string): string | null;
41
43
  * drift again.
42
44
  */
43
45
  export declare function cechoToAnsiFast(str: string): string | null;
46
+ /**
47
+ * The palette {@link cechoToAnsiFast} resolves names against, as a Lua table
48
+ * constructor (`{["red"]={255,0,0},…}`). Mudlet's cecho reads the live
49
+ * `color_table` for every tag, so a script that sets `color_table.red` changes
50
+ * what `<red>` draws. The fast-path wrapper in LuaRuntime compares each tag's
51
+ * `color_table` entry with this table and hands the call back to the Lua
52
+ * `xEcho` whenever they disagree — a per-tag lookup, and only overridden
53
+ * names pay for the slow path.
54
+ */
55
+ export declare function cechoFastPaletteLua(): string;
44
56
  /**
45
57
  * Fast-path for `hecho` — see {@link dechoToAnsiFast}. Handles ONLY a plain
46
58
  * foreground `#RRGGBB` and the `#r` reset. Falls back to Lua `xEcho` for
@@ -0,0 +1,2 @@
1
+ export declare function getExpectColorSpaceId(): boolean;
2
+ export declare function setExpectColorSpaceId(expect: boolean): void;
@@ -8,24 +8,31 @@ export declare const colorCodes: {
8
8
  /** Built-in 16-color ANSI palette. Index 0–7 dark, 8–15 bright. The Settings
9
9
  * modal uses this as the fallback when a profile hasn't overridden a slot. */
10
10
  export declare const DEFAULT_ANSI_PALETTE: readonly string[];
11
- /** Enable/disable server-driven OSC 4/104 palette redefinition. */
11
+ /** Enable/disable server-driven palette redefinition. */
12
12
  export declare function setServerRedefineColorsAllowed(allowed: boolean): void;
13
13
  /** Whether the server is currently allowed to redefine palette colors. */
14
14
  export declare function isServerRedefineColorsAllowed(): boolean;
15
+ /** Run `listener` after every change to the sixteen ANSI colours. Returns the
16
+ * unsubscribe function. */
17
+ export declare function onAnsiPaletteChange(listener: () => void): () => void;
18
+ /** The sixteen ANSI colours in force, `#rrggbb`, dark (0–7) then bright (8–15). */
19
+ export declare function getAnsi16Palette(): string[];
15
20
  /** Apply an override palette to the global ANSI table (mutates colorCodes.ansi
16
21
  * in place so FormatState picks it up without plumbing). Pass `undefined` or
17
22
  * a sparse array to restore defaults for unspecified / invalid slots. The
18
23
  * palette layout is `[...dark(8), ...bright(8)]`. */
19
24
  export declare function applyAnsiPalette(palette?: readonly (string | undefined)[]): void;
20
25
  /**
21
- * OSC 4 palette redefinition: point colour index `index` (0–255) at `hex`
22
- * (`#rrggbb`). Indices 0–15 also update the 16-colour ANSI table so subsequent
23
- * SGR 30–37/40–47/90–107 pick up the change, keeping the two tables coherent.
24
- * Out-of-range indices and malformed colours are ignored.
26
+ * The server's `ESC ] P <i> <rrggbb>`: point ANSI colour `index` (0–15) at
27
+ * `hex` (`#rrggbb`) — SGR 30–37/40–47/90–107, `38;5;0..15` and `color_table`
28
+ * alike (TBuffer::decodeOSC). Out-of-range indices and malformed colours are
29
+ * ignored.
25
30
  */
26
- export declare function setPaletteColor(index: number, hex: string): void;
27
- /** OSC 104 single-index reset: restore one palette entry to its base value (the
28
- * user palette for 0–15, the built-in xterm default otherwise). */
29
- export declare function resetPaletteColor(index: number): void;
30
- /** OSC 104 with no index: restore the entire palette to its base state. */
31
+ export declare function setAnsiPaletteColor(index: number, hex: string): void;
32
+ /** The server's `ESC ] R`: the sixteen ANSI colours go back to the built-in
33
+ * ones — not to the profile's own, which desktop's TBuffer::resetColors
34
+ * overwrites with Qt's black/darkRed/… just the same. */
35
+ export declare function resetAnsiPaletteToDefaults(): void;
36
+ /** Restore the entire palette to its base state: the profile's own sixteen
37
+ * colours, the built-in 256-colour table above them. */
31
38
  export declare function resetAllPaletteColors(): void;
@@ -2,7 +2,7 @@
2
2
  * The active profile's `controlCharacterHandling` display mode (Mudlet
3
3
  * `setConfig`/`getConfig`: `"asis"` / `"oem"` / `"picture"`). Mirrors Mudlet's
4
4
  * `Host::mControlCharacter` — a single per-profile value read at paint time by
5
- * every console/mini-console/text window. mudix renders exactly one active
5
+ * every console/mini-console/text window. Mudlet Web renders exactly one active
6
6
  * connection's output at a time, so a module-level value (kept in sync by
7
7
  * `MudSession.setControlCharacterMode`) covers the main output, script
8
8
  * windows, and logging/copy paths without threading a parameter through all
@@ -46,7 +46,7 @@ export declare class HyperlinkVisibilityController {
46
46
  * Whether a link with these settings is written concealed and revealed later.
47
47
  *
48
48
  * Only the timed reveals are, unlike Mudlet, which also conceals a reveal armed
49
- * on an expire trigger. mudix drives expire triggers off the rendered element
49
+ * on an expire trigger. Mudlet Web drives expire triggers off the rendered element
50
50
  * (see {@link HyperlinkVisibilityController}), and that path only ever conceals
51
51
  * — a link the buffer blanked with nothing to un-blank it would lose its text
52
52
  * for good, which is worse than showing it early.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Where `text` may break: `breaks[p]` is 1 when a line may start at UTF-16
3
+ * offset `p`. `breaks[0]` is 0 and `breaks[text.length]` is 1, as in Qt.
4
+ */
5
+ export declare function lineBreakOpportunities(text: string): Uint8Array;
@@ -13,7 +13,7 @@
13
13
  * tested directly, and so the pipeline glue in `ScriptingEngine` stays readable.
14
14
  *
15
15
  * **Visible text, not raw.** Mudlet judges `mMudLine`, which is plain characters
16
- * with the styling held alongside in a `TChar` buffer. mudix keeps styling
16
+ * with the styling held alongside in a `TChar` buffer. Mudlet Web keeps styling
17
17
  * inline as ANSI escapes, so every predicate here takes text that has been put
18
18
  * through {@link visibleText} first — otherwise a colour-heavy line would be
19
19
  * measured as far longer than the player sees, and its escape punctuation would
@@ -163,7 +163,7 @@ export declare function shouldCommitPendingBeforeJoin(visibleNext: string, nextI
163
163
  * and its continuation, restoring the space the game's wrapper swallowed when
164
164
  * neither side already carries one.
165
165
  *
166
- * Operates on the **raw** lines (escapes and all): mudix's styling is inline, so
166
+ * Operates on the **raw** lines (escapes and all): Mudlet Web's styling is inline, so
167
167
  * a plain concatenation carries each half's colour across untouched — the
168
168
  * `TChar`-buffer splice Mudlet needs has no equivalent here. The space-insertion
169
169
  * test looks at the visible text so a trailing colour reset can't hide the space
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Mudlet's text analyser, ported from `TTextEdit::slot_analyseSelection` and
3
+ * `TTextEdit::convertWhitespaceToVisual` (Mudlet/src/TTextEdit.cpp:2717-3300).
4
+ *
5
+ * Desktop puts a context-menu entry on the main display — gated on the
6
+ * "Enable text analyzer" preference — that reports, for the selected text, how
7
+ * each character is encoded: its UTF-16 code units, a visible stand-in for
8
+ * characters that draw as nothing, its UTF-8 bytes, and the `\ddd` escapes Lua
9
+ * needs to write the same character into a string literal. That last column is
10
+ * the point of the whole feature: a pattern that will not match usually has a
11
+ * character in it the player cannot see, and the analyser is how they find out
12
+ * which one and how to type it.
13
+ *
14
+ * This module is the analysis; the table lives in `TextAnalyzerModal`. Both
15
+ * halves stay pure of Qt's quirks: desktop escapes `<` and `>` because it
16
+ * builds an HTML tooltip by hand, and pads its counts with spaces so a
17
+ * `QTableWidget` sorts them correctly. Neither applies here.
18
+ */
19
+ /** One grapheme cluster of the analysed text, with everything the report shows
20
+ * about it. A cluster, not a code point: `é` written as `e` + U+0301 is one
21
+ * cell on screen and one row here, carrying both of its code points. */
22
+ export interface AnalysedGrapheme {
23
+ /** The cluster itself, for rendering as the game drew it. */
24
+ text: string;
25
+ /** 1-based index of the cluster's first UTF-16 code unit, so it lines up
26
+ * with what a Qt/JS string index would report. */
27
+ utf16Index: number;
28
+ /** The cluster's UTF-16 code units, in order. */
29
+ utf16Units: number[];
30
+ /** The cluster's Unicode code points (surrogate pairs already joined). */
31
+ codePoints: number[];
32
+ /** 1-based index of the cluster's first UTF-8 byte. Mudlet starts this at 1
33
+ * "so that it directly maps to string indexing in Lua" (TTextEdit.cpp:2975). */
34
+ utf8Index: number;
35
+ /** The cluster's UTF-8 bytes, in order. */
36
+ utf8Bytes: number[];
37
+ /** A name in braces for a character that draws as nothing or as whitespace
38
+ * ("{zero width space}"), or undefined when the cluster draws as itself. */
39
+ label?: string;
40
+ }
41
+ /**
42
+ * The brace-wrapped name for a code point that draws as nothing, or undefined
43
+ * when it draws as itself. C0 controls other than tab / LF / CR have no name in
44
+ * Mudlet's table (they are filtered out of its buffer long before this), but
45
+ * they can reach a browser selection through a script's `echo`, so they are
46
+ * named here as their Unicode abbreviations rather than left invisible.
47
+ */
48
+ export declare function codePointLabel(cp: number): string | undefined;
49
+ /** Uppercase hex, zero-padded — the spelling Mudlet uses for code points
50
+ * (`U+0200B`) and, at width 2, for UTF-8 bytes (`0x0a`, which it leaves
51
+ * lower-case; this pads both the same and lower-cases the byte column at the
52
+ * point of display). */
53
+ export declare function hex(value: number, width: number): string;
54
+ /**
55
+ * How Lua would have to spell one UTF-8 byte inside a string literal —
56
+ * Mudlet's `byteToLuaCodeOrChar` (TTextEdit.cpp:2919). Printable ASCII is
57
+ * itself; everything else is the decimal escape `\ddd`, which is what a player
58
+ * copies into a trigger pattern to match a character they cannot type.
59
+ */
60
+ export declare function byteToLuaCode(byte: number): string;
61
+ /**
62
+ * Analyse one line of text into per-grapheme rows.
63
+ *
64
+ * Mudlet analyses only the first line of a selection (its menu entry says so:
65
+ * "only the first line!"), because its buffer is a list of lines and the
66
+ * selection's second line starts over at column 0. The caller here does the
67
+ * same trimming, so this takes text that is already one line.
68
+ */
69
+ export declare function analyseText(text: string): AnalysedGrapheme[];
70
+ /**
71
+ * The first line of a selection, which is all Mudlet analyses (its menu entry
72
+ * says so: "only the first line!"). A selection spanning several lines is cut
73
+ * at the first line break; the modal says so rather than silently analysing a
74
+ * fragment.
75
+ */
76
+ export declare function firstLineOf(text: string): {
77
+ line: string;
78
+ truncated: boolean;
79
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Lookup over one of the run-length tables in unicodeTables.generated.ts.
3
+ *
4
+ * The Basic Multilingual Plane — where nearly every character a game sends
5
+ * lives — is expanded into a flat array on first use, so a lookup there is a
6
+ * single index. The rest stays as runs and is binary-searched.
7
+ */
8
+ export interface RunLookup {
9
+ (cp: number): number;
10
+ }
11
+ export declare function runLookup<T extends Uint8Array | Uint16Array>(encoded: string, make: (n: number) => T): RunLookup;
@@ -0,0 +1,3 @@
1
+ export declare const WIDTH_RUNS: string;
2
+ export declare const LINE_BREAK_RUNS: string;
3
+ export declare const LINE_BREAK_PAIRS: string;
@@ -1,29 +1,28 @@
1
1
  /**
2
- * Terminal display-width tables (a wcwidth-style implementation).
3
- *
4
- * MUD output is laid out on a monospace grid: every character occupies an
5
- * integer number of cells (0, 1, or 2). Browsers don't enforce that — a glyph
6
- * the chosen font lacks falls back to another font with a different advance
7
- * width, wide CJK/emoji render at their natural width, and combining marks add
8
- * code-unit length but no visual width. The renderer uses these tables to box
9
- * each grapheme into a fixed `Nch` cell so columns stay aligned regardless of
10
- * the font.
11
- *
12
- * Ranges follow Markus Kuhn's wcwidth (combining + East Asian Wide/Fullwidth),
13
- * extended with the Supplementary-plane emoji/symbol blocks. BMP dingbats and
14
- * miscellaneous symbols (☎ ★ ♠ …) are East Asian *Ambiguous* and kept at width
15
- * 1, matching the common "narrow" terminal rendering.
16
- */
17
- /**
18
- * Display width of a single Unicode code point, in monospace cells.
19
- * Returns 0 for combining/zero-width, 2 for wide, 1 otherwise. C0/C1 control
20
- * characters (which shouldn't reach the renderer) are treated as 0.
2
+ * Display width of a single Unicode code point, in monospace cells — Mudlet's
3
+ * graphemeInfo::codepointWidth. Nonprinting characters (C0/C1 controls, soft
4
+ * hyphen, zero-width spaces, lone surrogates), non-characters and combining
5
+ * marks are 0; wide and "widened in Unicode 9" (emoji presentation) are 2;
6
+ * East Asian ambiguous follows {@link setAmbiguousWidthWide}; everything else,
7
+ * private use and unassigned included, is 1.
21
8
  */
22
9
  export declare function codePointWidth(cp: number): 0 | 1 | 2;
10
+ /** Set by the profile's `ambiguousWidthWide` preference. Off is the common
11
+ * "narrow" terminal rendering and stays the default; on matches a CJK locale's
12
+ * terminal, which is what the games drawing box art out of these expect. */
13
+ export declare function setAmbiguousWidthWide(wide: boolean): void;
14
+ export declare function isAmbiguousWidthWide(): boolean;
15
+ /** Whether ambiguous-width characters are drawn wide, given the profile's
16
+ * choice (`ambiguousWidthWide`: true/false, or undefined for Mudlet's "auto")
17
+ * and the server encoding. "auto" is wide for the CJK encodings only. */
18
+ export declare function effectiveAmbiguousWidthWide(choice: boolean | undefined, encoding: string): boolean;
23
19
  /**
24
- * Display width of a grapheme cluster (base + any combining marks / ZWJ
25
- * sequence). Width is the widest code point in the cluster, so an emoji ZWJ
26
- * sequence stays 2 and a base+diacritic stays at the base's width.
20
+ * Display width of a grapheme cluster (base + any combining marks, variation
21
+ * selectors, ZWJ sequence): the width of its base character, the way Mudlet
22
+ * measures every grapheme. So an emoji ZWJ sequence takes its first emoji's 2,
23
+ * a letter with diacritics its letter's 1, and U+2764 + VS16 the 2 Mudlet
24
+ * gives the heart itself. A cluster that starts with an unpaired surrogate
25
+ * measures that surrogate, which is nonprinting.
27
26
  */
28
27
  export declare function clusterWidth(cluster: string): 0 | 1 | 2;
29
28
  /** Total display width of a string, in monospace cells. */
@@ -40,5 +39,11 @@ export interface DisplayCell {
40
39
  * their base), falling back to per-code-point iteration where it is missing.
41
40
  */
42
41
  export declare function segmentCells(text: string): DisplayCell[];
42
+ /**
43
+ * Where each grapheme of `text` ends, indexed by the UTF-16 offset it starts
44
+ * at (-1 at offsets inside a grapheme). The same clusters as
45
+ * {@link segmentCells} without an object per cell, for the wrap's scan.
46
+ */
47
+ export declare function graphemeEnds(text: string): Int32Array;
43
48
  /** Fast check: pure printable ASCII renders at exactly 1 cell with no boxing. */
44
49
  export declare function isPlainAscii(text: string): boolean;