@mudlet/mudlet-web 0.5.0 → 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 (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 +22 -14
  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
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Replace every control character XML cannot represent with Mudlet's placeholder
3
+ * pair. Safe to run over any string bound for a document — text content and
4
+ * attribute values alike. Tab, LF and CR are legal in XML 1.0 and left alone.
5
+ *
6
+ * Divergence: desktop has no mapping for NUL (0x00) at all, and so still emits a
7
+ * document Qt rejects when a script holds one. We encode it as U+FFFC U+2400 — the
8
+ * glyph the Control Pictures block reserves for it. Desktop will not decode that
9
+ * back, leaving the placeholder visible in the script, but the file stays valid
10
+ * and everything around the NUL survives.
11
+ */
12
+ export declare function sanitizeControlChars(s: string): string;
13
+ /** Inverse of {@link sanitizeControlChars}. */
14
+ export declare function desanitizeControlChars(s: string): string;
@@ -1,21 +1,29 @@
1
1
  import type { ProfileSettings } from '../storage/schema';
2
2
  import { type MudletImportResult } from './mudletXmlImport';
3
3
  import { type MudletVariablePackage } from './mudletVariables';
4
- /**
5
- * Map a `<Host>` element to a partial ProfileSettings. Only keys actually
6
- * present in the XML are set, so the result can be merged over existing/default
7
- * settings without clobbering anything Mudlet didn't specify.
8
- */
4
+ import type { SavedStopwatch } from '../scripting/StopwatchManager';
9
5
  export declare function parseMudletHost(host: Element): Partial<ProfileSettings>;
10
6
  /** The connection identity a Mudlet `<Host>` carries: the profile name and the
11
- * MUD address (`<url>` host + `<port>`). Used to seed a new mudix connection. */
7
+ * MUD address (`<url>` host + `<port>`). Used to seed a new Mudlet Web connection. */
12
8
  export interface MudletProfileIdentity {
13
9
  name?: string;
14
10
  host?: string;
15
11
  port?: number;
12
+ /** `mSslTsl` — connect over TLS. The profile's `ssl_tsl` file, when it has
13
+ * one, is fresher (see buildMudletProfileBundle). */
14
+ tls?: boolean;
15
+ sslIgnoreExpired?: boolean;
16
+ sslIgnoreSelfSigned?: boolean;
17
+ sslIgnoreAll?: boolean;
16
18
  }
17
- /** Read `<name>`/`<url>`/`<port>` (direct children of `<Host>`). */
19
+ /** Read `<name>`/`<url>`/`<port>` (direct children of `<Host>`) and the TLS
20
+ * attributes. */
18
21
  export declare function parseMudletHostIdentity(host: Element): MudletProfileIdentity;
22
+ /** What Mudlet's own exporter puts above `<MudletPackage>`, reproduced so a file
23
+ * written here is byte-shaped like one written there. Nothing reads it —
24
+ * Mudlet's QXmlStreamReader ignores the doctype — but dropping it would make
25
+ * Mudlet Web's saves gratuitously different. */
26
+ export declare const MUDLET_XML_PROLOG = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE MudletPackage>";
19
27
  /**
20
28
  * Write the modeled ProfileSettings back onto an existing `<Host>` element,
21
29
  * in place — only the fields present in `s` are touched, so unmodeled Host
@@ -25,12 +33,67 @@ export declare function parseMudletHostIdentity(host: Element): MudletProfileIde
25
33
  * the rest of the QFont spec is preserved.
26
34
  */
27
35
  export declare function applyProfileSettingsToHost(host: Element, s: Partial<ProfileSettings>): void;
36
+ /** The identity a Mudlet `<Host>` carries for one profile: its name, the MUD
37
+ * address, and the packages Mudlet should consider installed. */
38
+ export interface MudletHostIdentity {
39
+ name: string;
40
+ url: string;
41
+ port: number;
42
+ installedPackages: string[];
43
+ }
44
+ /**
45
+ * Write the connection identity onto a `<Host>` in place. Unlike
46
+ * {@link applyProfileSettingsToHost} this always overwrites rather than only
47
+ * touching what's set: the live connection record and package set are
48
+ * authoritative, so a `<Host>` retained from an earlier import can't export the
49
+ * name, address or package list it had back then.
50
+ */
51
+ export declare function applyHostIdentity(host: Element, identity: MudletHostIdentity): void;
52
+ /**
53
+ * Replace `<Host><mInstalledPackages>` with `names`, creating it when absent.
54
+ * Desktop's `Host::saveProfile` always writes the live list, and a load takes
55
+ * the profile's package set from it — so a save that left it out (or kept a
56
+ * stale copy from the document it was based on) forgets every package on the
57
+ * next open.
58
+ */
59
+ export declare function applyInstalledPackages(host: Element, names: string[]): void;
60
+ /**
61
+ * Replace `<Host><stopwatches>` with the profile's persistent stopwatches,
62
+ * written as desktop's `XMLexport` writes them, so a save carries them as
63
+ * desktop's does rather than the copy the document was based on.
64
+ */
65
+ export declare function applyStopwatches(host: Element, watches: SavedStopwatch[]): void;
66
+ /**
67
+ * Reduce a full Mudlet profile save to a document holding just its
68
+ * `<HostPackage>`.
69
+ *
70
+ * Mudlet's `<Host>` is roughly 120 attributes, 26 child elements and 53 colour
71
+ * elements (`XMLimport.cpp:723-1305`); Mudlet Web models about a third of that. The
72
+ * rest — proxy and TLS configuration, logging setup, the spell dictionary,
73
+ * console buffer sizing, the map colours and sizes, `<stopwatches>`, `<MMCP>`,
74
+ * the `<experiment>` flags, the second-console palette — has no home in
75
+ * ProfileSettings, so it survives a round-trip only by being carried verbatim.
76
+ * Retaining this on import is what lets an export base its `<Host>` on the real
77
+ * one instead of a skeleton.
78
+ *
79
+ * Dropped on the way through:
80
+ * - the automation and variable packages, which are regenerated from live state
81
+ * on every write; keeping a copy here would ship the same data twice, in two
82
+ * formats, and let a stale one resurface.
83
+ * - `<mInstalledModules>`, because import re-registers each resolved module
84
+ * against a copy of its XML inside the new profile. A surviving reference
85
+ * would make Mudlet load it a second time from the absolute path it had on
86
+ * the original machine.
87
+ *
88
+ * Returns null if `profileXml` doesn't parse or carries no `<HostPackage>`.
89
+ */
90
+ export declare function extractHostPackageXml(profileXml: string): string | null;
28
91
  /** Names from `<Host><mInstalledPackages>` — the packages Mudlet considers
29
92
  * installed for this profile. Mudlet tracks these so package managers (mpkg) and
30
- * `getPackageInfo`/`getInstalledPackages` work; mudix registers a manifest per
93
+ * `getPackageInfo`/`getInstalledPackages` work; Mudlet Web registers a manifest per
31
94
  * entry on import. */
32
95
  export declare function parseInstalledPackages(host: Element): string[];
33
- /** Everything a full Mudlet profile XML carries that mudix can import. */
96
+ /** Everything a full Mudlet profile XML carries that Mudlet Web can import. */
34
97
  export interface MudletProfileImport {
35
98
  /** From `<Host>` — the profile name + MUD address for the connection record. */
36
99
  connection: MudletProfileIdentity;
@@ -59,7 +122,7 @@ export interface MudletModuleRef {
59
122
  /** Parse the repeated `<mInstalledModules>` blocks under `<Host>`. */
60
123
  export declare function parseInstalledModules(host: Element): MudletModuleRef[];
61
124
  /**
62
- * Parse a complete Mudlet profile XML (a `current/*.xml`) into the things mudix
125
+ * Parse a complete Mudlet profile XML (a `current/*.xml`) into the things Mudlet Web
63
126
  * can apply: the connection identity, profile settings, automation trees, and
64
127
  * saved variables. `<VariablePackage>` variable names become the seed of the
65
128
  * profile's save-list when applied. Throws on malformed XML.
@@ -1,3 +1,5 @@
1
+ import type { MudConnection } from '../storage/schema';
2
+ import { type DesktopProfileFiles } from './mudletProfileImport';
1
3
  export interface VfsReader {
2
4
  exists(path: string): boolean;
3
5
  readdir(path: string): string[];
@@ -6,6 +8,11 @@ export interface VfsReader {
6
8
  } | null;
7
9
  readFile(path: string): string;
8
10
  }
11
+ /** A {@link VfsReader} that also reads bytes — what a linked folder's
12
+ * desktop profile-data files need (they are not text; see qtProfileData.ts). */
13
+ export interface LinkedVfsReader extends VfsReader {
14
+ readBinaryFile(path: string): Uint8Array;
15
+ }
9
16
  /** current/*.xml paths (relative to the profile root) ordered newest-first.
10
17
  * Order is by mtime; when mtimes are unavailable (all zero) autosave.xml comes
11
18
  * first, then the latest timestamp filename. Empty when not a Mudlet profile. */
@@ -14,6 +21,18 @@ export declare function listCurrentXmlsByRecency(vfs: VfsReader): string[];
14
21
  export declare function findNewestCurrentXml(vfs: VfsReader): string | null;
15
22
  /** Whether a mounted VFS looks like a linked Mudlet profile (has current/*.xml). */
16
23
  export declare function isMudletProfileVfs(vfs: VfsReader): boolean;
24
+ /**
25
+ * Whether opening this profile loads it from its newest current/*.xml rather
26
+ * than `.mudlet/profile.json`: only a linked Mudlet folder, where desktop may
27
+ * have edited the save since. A Mudlet Web profile that called saveProfile()
28
+ * has a current/*.xml too, but nothing outside this app writes it and
29
+ * profile.json — flushed alongside it — is the fuller record (module
30
+ * manifests, install paths, …). Loading that one as a linked folder lost its
31
+ * installed packages and re-ran the default-package install (#259).
32
+ */
33
+ export declare function opensAsLinkedProfile(connection: {
34
+ mudletLinked?: boolean;
35
+ }, vfs: VfsReader): boolean;
17
36
  /**
18
37
  * The newest current/*.xml whose content actually parses as a Mudlet profile,
19
38
  * with its text. Skips a corrupt newest save (e.g. a truncated/garbage autosave
@@ -27,8 +46,40 @@ export declare function readNewestParseableXml(vfs: VfsReader): {
27
46
  } | null;
28
47
  /**
29
48
  * Hydrate the store for a Mudlet-linked profile from the newest current/*.xml,
30
- * layering the .mudix sidecar's mudix-only slices on top. Returns false if the
49
+ * layering the .mudlet sidecar's Mudlet Web-only slices on top. Returns false if the
31
50
  * VFS isn't a Mudlet profile (caller falls back to the normal profile.json load).
32
51
  * `installedAt` stamps the package manifests (pass an ISO timestamp).
33
52
  */
34
- export declare function loadMudletLinkedProfile(vfs: VfsReader, connectionId: string, installedAt: string): boolean;
53
+ export declare function loadMudletLinkedProfile(vfs: LinkedVfsReader, connectionId: string, installedAt: string): boolean;
54
+ /** {@link readDesktopProfileFiles} over a linked folder's root. */
55
+ export declare function readLinkedDesktopFiles(vfs: LinkedVfsReader, saveTls?: boolean): DesktopProfileFiles;
56
+ /** Where the last-merged `command_history_main` modification time is kept. */
57
+ export declare function linkedHistoryMarkerKey(connectionId: string): string;
58
+ /**
59
+ * Fold the folder's `command_history_main` into the command bar's history
60
+ * when the file has changed since it was last read: desktop's commands first
61
+ * (it was used since), then this client's own, one entry per command ignoring
62
+ * case. An unchanged file is skipped, so this client's history isn't
63
+ * reshuffled on every open.
64
+ */
65
+ export declare function mergeLinkedCommandHistory(vfs: LinkedVfsReader, connectionId: string, saveSize?: number): void;
66
+ /** Whether a connection-record change touches what a linked folder's
67
+ * profile-data files mirror (TLS, the character name), so a save must write
68
+ * them back. Nothing for a profile that is not a linked folder. */
69
+ export declare function linkedConnectionFilesChanged(conn: Pick<MudConnection, 'mudletLinked' | 'mode' | 'tls' | 'charLoginAccount'> | undefined, prev: Pick<MudConnection, 'mudletLinked' | 'mode' | 'tls' | 'charLoginAccount'> | undefined): boolean;
70
+ /** The settings a linked folder's profile-data files mirror. */
71
+ export interface DesktopProfileFileValues {
72
+ serverEncoding?: string;
73
+ /** Undefined for a connection where TLS isn't the profile's to say (websocket). */
74
+ tls?: boolean;
75
+ login?: string;
76
+ }
77
+ /**
78
+ * The profile-data files to write so a linked folder says what `want` does, in
79
+ * desktop's format, keyed by name. Only files whose value differs are listed —
80
+ * an unchanged file is not rewritten under a desktop Mudlet that may be
81
+ * running on the same folder — and none is created to say what its absence
82
+ * already means (no encoding chosen, TLS off, no character name). Never the
83
+ * password.
84
+ */
85
+ export declare function desktopProfileFileUpdates(vfs: LinkedVfsReader, want: DesktopProfileFileValues): Record<string, Uint8Array>;
@@ -4,9 +4,27 @@ import type { PersistedProfileData } from '../storage/profileVfsData';
4
4
  * filename when no mtimes are available, so the stamp has to be sortable. */
5
5
  export declare function formatSaveStamp(date: Date): string;
6
6
  /** Connection fields Mudlet's `<Host>` can't express (websocket mode, the proxy
7
- * override, auto-reconnect). Written beside the XML so a mudix→mudix round-trip
7
+ * override, auto-reconnect). Written beside the XML so a Mudlet Web→Mudlet Web round-trip
8
8
  * keeps them; desktop Mudlet ignores the dot-directory entirely. */
9
- export declare const CONNECTION_SIDECAR_PATH = ".mudix/connection.json";
9
+ export declare const CONNECTION_SIDECAR_PATH = ".mudlet/connection.json";
10
+ /** Where the sidecar lived in archives exported before the storage rename.
11
+ * Those zips are out in the wild, so import still has to look here. */
12
+ export declare const LEGACY_CONNECTION_SIDECAR_PATH = ".mudix/connection.json";
13
+ /** Where a profile imported from Mudlet keeps its original `<HostPackage>`,
14
+ * inside its own VFS. `extractHostPackageXml` produces it at import time; the
15
+ * export and `saveProfile()` base their `<Host>` on it so the settings Mudlet Web
16
+ * doesn't model don't revert to Mudlet's defaults. Dot-prefixed like the rest
17
+ * of Mudlet Web's bookkeeping, so desktop Mudlet ignores it.
18
+ *
19
+ * Absent for a profile created in Mudlet Web (nothing unmodeled to preserve), for a
20
+ * linked folder (its own `current/*.xml` is the live original), and for
21
+ * profiles imported before this file existed — their `<Host>` was already
22
+ * dropped at import and can't be recovered. */
23
+ export declare const RETAINED_HOST_PATH = ".mudlet/host.xml";
24
+ /** Pre-rename location of the retained host XML. A profile whose VFS has not
25
+ * been opened since the rename still keeps it here (see migrateLegacyDotDir),
26
+ * as does any archive exported before it. */
27
+ export declare const LEGACY_RETAINED_HOST_PATH = ".mudix/host.xml";
10
28
  export interface ConnectionSidecar {
11
29
  mode?: MudConnection['mode'];
12
30
  url?: string;
@@ -14,10 +32,21 @@ export interface ConnectionSidecar {
14
32
  port?: number;
15
33
  proxyUrl?: string;
16
34
  autoReconnect?: boolean;
35
+ reconnectOnDrop?: boolean;
17
36
  }
18
37
  export declare function buildConnectionSidecar(c: MudConnection): ConnectionSidecar;
38
+ /**
39
+ * The base `buildLinkedWriteback` writes this profile's automation and settings
40
+ * onto. The connection identity and package list are stamped on either way: a
41
+ * retained `<Host>` holds the name, address and packages the profile had when it
42
+ * was imported, and the live connection record is what's authoritative now.
43
+ */
44
+ export declare function buildHostBaseXml(connection: MudConnection, packageNames: string[], retained?: string): string;
19
45
  /** Serialize one profile's automation, variables and settings as Mudlet profile XML. */
20
- export declare function buildProfileXml(connection: MudConnection, data: PersistedProfileData): string;
46
+ export declare function buildProfileXml(connection: MudConnection, data: PersistedProfileData,
47
+ /** The profile's retained `<HostPackage>` (or a full save to take it from),
48
+ * so unmodeled Mudlet settings survive. See {@link RETAINED_HOST_PATH}. */
49
+ hostBaseXml?: string): string;
21
50
  /** One exported session log: `name` becomes the filename under `logs/`. */
22
51
  export interface ExportLog {
23
52
  name: string;
@@ -25,11 +54,15 @@ export interface ExportLog {
25
54
  }
26
55
  export interface ProfileExportSource {
27
56
  connection: MudConnection;
28
- /** Contents of `.mudix/profile.json`. */
57
+ /** Contents of `.mudlet/profile.json`. */
29
58
  data: PersistedProfileData;
30
59
  /** Loose VFS files (packages, fonts, sounds, …), keyed relative to the
31
- * profile root. `.mudix/` is expected to be filtered out by the collector. */
60
+ * profile root. `.mudlet/` is expected to be filtered out by the collector. */
32
61
  files: Record<string, Uint8Array>;
62
+ /** The profile's retained Mudlet `<HostPackage>` — `.mudlet/host.xml`, or a
63
+ * linked folder's own newest save. Undefined for a profile that was never
64
+ * imported from Mudlet: it has no unmodeled Host settings to preserve. */
65
+ hostBaseXml?: string;
33
66
  mapBytes?: Uint8Array;
34
67
  logs?: ExportLog[];
35
68
  }
@@ -8,9 +8,15 @@ export interface MudletProfileBundle {
8
8
  port?: number;
9
9
  /** Parsed settings + automation + variables from the newest current/*.xml. */
10
10
  profile: MudletProfileImport;
11
+ /** That save's `<HostPackage>`, verbatim. `profile.settings` covers only the
12
+ * Host fields Mudlet Web models; the other ~100 live here and nowhere else, so
13
+ * this is retained in the new profile's VFS for an export to base on.
14
+ * Undefined if the save carries no `<HostPackage>`. */
15
+ hostPackageXml?: string;
11
16
  /** Manifests for the profile's installed packages (from <mInstalledPackages>,
12
17
  * metadata from each package's config.lua). Registered on import so
13
- * getPackageInfo / package managers see them as installed. */
18
+ * getPackageInfo / package managers see them as installed. Folded-in
19
+ * modules join them as `kind: 'module'` manifests (addModuleToBundle). */
14
20
  packages: PackageManifest[];
15
21
  /** Modules the profile loads from external local XML files — unresolvable in a
16
22
  * browser; the import UI asks the user to upload or drop each. */
@@ -18,9 +24,52 @@ export interface MudletProfileBundle {
18
24
  /** Newest map/* binary, ready for mapStorage. Undefined if the profile has no map. */
19
25
  mapBytes?: Uint8Array;
20
26
  /** Remaining profile-root files to copy into the new VFS (packages, fonts,
21
- * sounds, …), keyed relative to the profile root. Excludes current/ and map/. */
27
+ * sounds, …), keyed relative to the profile root. Excludes current/ and map/,
28
+ * and the {@link CONSUMED_PROFILE_FILES} read into the fields below. */
22
29
  files: Record<string, Uint8Array>;
30
+ /** Connect over TLS: the profile's `ssl_tsl` file, else `<Host mSslTsl>`.
31
+ * Undefined when neither says. */
32
+ tls?: boolean;
33
+ /** Desktop's saved character name — the profile's `login` file, which it
34
+ * sends on its own two seconds after connecting. */
35
+ login?: string;
36
+ /** The saved password, from the profile's `password` file. Only there when
37
+ * desktop was not keeping passwords in the system keychain. Never written
38
+ * into the new profile's files: the caller hands it to the credential vault. */
39
+ password?: string;
40
+ /** The main command line's history (`command_history_main`), newest first,
41
+ * de-duplicated the way Mudlet Web's own history is. */
42
+ commandHistory?: string[];
43
+ /**
44
+ * Everything about this profile that could not be carried over faithfully,
45
+ * in the order it was noticed. Seeded from the XML parse
46
+ * (`profile.automation.warnings`) and appended to as the import proceeds —
47
+ * by `addModuleToBundle` for each folded-in module, and by
48
+ * `importMudletProfile` for files that would not write and a map that would
49
+ * not save.
50
+ *
51
+ * The single place the import UI reads: a profile import used to succeed in
52
+ * silence even when it dropped things, which made every fidelity gap a
53
+ * surprise discovered weeks later (issue #45).
54
+ */
55
+ warnings: string[];
23
56
  }
57
+ /**
58
+ * Profile-root files desktop keeps a connection detail in, one value per file
59
+ * (`MudletApp::readProfileData`). Each is read into the bundle — the connection
60
+ * record or the settings — rather than copied as a file: once imported, those
61
+ * are what's live, and a copy left in the profile would be stale the moment the
62
+ * setting changed (an export writes fresh ones, see buildProfileFolder). The
63
+ * password is kept out of the profile's files above all.
64
+ */
65
+ export declare const CONSUMED_PROFILE_FILES: readonly ["encoding", "ssl_tsl", "login", "password"];
66
+ /**
67
+ * Desktop's `command_history_main`: one command per line, newest first, often
68
+ * led by an empty line (TCommandLine::slot_saveHistory saves the line being
69
+ * typed too). Read into the shape Mudlet Web's history keeps — no blanks, one
70
+ * entry per command ignoring case, at most {@link MAX_HISTORY}.
71
+ */
72
+ export declare function parseCommandHistory(text: string): string[];
24
73
  /**
25
74
  * Build a manifest per installed package, reading metadata from each package's
26
75
  * config.lua via `readConfig(name)` (returns the file text or undefined).
@@ -28,10 +77,38 @@ export interface MudletProfileBundle {
28
77
  * Reusable across the file-map import path and the linked-folder (VFS) path.
29
78
  */
30
79
  export declare function buildPackageManifests(names: string[], readConfig: (name: string) => string | undefined): PackageManifest[];
80
+ /** Desktop's main command-line history file, beside the profile-data files. */
81
+ export declare const DESKTOP_HISTORY_FILE = "command_history_main";
82
+ /** What a desktop profile's own files say about its connection — see
83
+ * {@link readDesktopProfileFiles}. */
84
+ export interface DesktopProfileFiles {
85
+ /** The `encoding` file, in the listed spelling. Undefined when there is no
86
+ * file, or it names an encoding Mudlet Web cannot decode (then warned). */
87
+ serverEncoding?: string;
88
+ /** `ssl_tsl`, else the save's `mSslTsl` passed in. */
89
+ tls?: boolean;
90
+ login?: string;
91
+ password?: string;
92
+ /** `command_history_main`, newest first (see {@link parseCommandHistory}). */
93
+ commandHistory?: string[];
94
+ warnings: string[];
95
+ }
96
+ /**
97
+ * Read the files desktop keeps a profile's connection details in — the
98
+ * {@link CONSUMED_PROFILE_FILES}, serialised QStrings (see qtProfileData.ts),
99
+ * and the plain-text {@link DESKTOP_HISTORY_FILE}. `read` returns a file's
100
+ * bytes by its name at the profile root, or undefined when it is absent.
101
+ * Shared by the import and by a linked folder, which reads the same files in
102
+ * place. `saveTls` is the save's `<Host mSslTsl>`, the fallback for TLS.
103
+ */
104
+ export declare function readDesktopProfileFiles(read: (name: string) => Uint8Array | undefined, saveTls?: boolean): DesktopProfileFiles;
105
+ /** An `ssl_tsl` file's decoded text as on/off, or undefined when it holds no
106
+ * check state (missing, empty, or not a number). */
107
+ export declare function parseSslTsl(text: string | undefined): boolean | undefined;
31
108
  /**
32
109
  * Every profile root in the tree — the prefix before each `current/` directory.
33
110
  *
34
- * A tree with profiles side by side (mudix's multi-profile export) yields one
111
+ * A tree with profiles side by side (Mudlet Web's multi-profile export) yields one
35
112
  * root each. Nesting is resolved by depth: a root at the top wins over anything
36
113
  * inside it, so a single profile that happens to contain another `current/*.xml`
37
114
  * deeper down still imports as one profile, matching the old shallowest-wins
@@ -42,11 +119,21 @@ export declare function buildMudletProfileBundle(files: Record<string, Uint8Arra
42
119
  /** Import this specific root (from {@link findProfileRoots}) instead of the
43
120
  * shallowest one — used when one tree holds several profiles. */
44
121
  rootOverride?: string): MudletProfileBundle;
45
- /** Build a profile bundle from a `.zip` of a Mudlet profile directory. (Zip
46
- * entry mtimes aren't surfaced, so newest-save uses the autosave/timestamp
47
- * fallback.) */
122
+ /**
123
+ * Each entry's modification time (ms), keyed by name exactly as `unzipSync`
124
+ * keys it, read from the archive's central directory — fflate doesn't surface
125
+ * them. Uses the Info-ZIP extended-timestamp field (0x5455, true UTC to the
126
+ * second) when every entry has one, else the DOS date/time all entries carry
127
+ * (local time, two-second resolution). Either way the values only have to
128
+ * order entries of the same archive, so a DOS time is read as if it were UTC.
129
+ * Entries with no usable time are left out. Never throws: an archive this
130
+ * can't read just yields no times, and the import falls back to names.
131
+ */
132
+ export declare function zipEntryMtimes(bytes: Uint8Array): Record<string, number>;
133
+ /** Build a profile bundle from a `.zip` of a Mudlet profile directory, picking
134
+ * the newest save and map by the entries' modification times. */
48
135
  export declare function extractMudletProfileZip(bytes: Uint8Array, fallbackName?: string): MudletProfileBundle;
49
- /** One bundle per profile in the tree — a mudix multi-profile export, or a
136
+ /** One bundle per profile in the tree — a Mudlet Web multi-profile export, or a
50
137
  * single Mudlet profile (in which case this is a one-element list). */
51
138
  export declare function buildAllMudletProfileBundles(files: Record<string, Uint8Array>, fallbackName?: string, mtimes?: Record<string, number>): MudletProfileBundle[];
52
139
  /** Every profile in a `.zip`, in folder order. */
@@ -54,6 +141,8 @@ export declare function extractMudletProfileZipAll(bytes: Uint8Array, fallbackNa
54
141
  export interface ResolvedModule {
55
142
  ref: MudletModuleRef;
56
143
  xmlBytes: Uint8Array;
144
+ /** Where the file was found, as a `bundle.files` key. */
145
+ path: string;
57
146
  }
58
147
  /** Split a bundle's modules into those whose XML was found in the imported tree
59
148
  * (by filename) and those still missing. */
@@ -63,9 +152,18 @@ export declare function resolveModulesFromTree(bundle: MudletProfileBundle): {
63
152
  };
64
153
  /**
65
154
  * Fold a resolved/uploaded module's XML into the bundle: its triggers/aliases/…
66
- * are parsed (grouped + tagged under the module key, so it's a removable unit)
67
- * and appended to the automation, and a manifest is registered. Mutates and
68
- * returns the bundle. Treated as a package — the live-sync-to-disk behaviour
69
- * doesn't apply in a browser.
155
+ * are parsed (tagged under the module key) and appended to the automation, and
156
+ * a MODULE manifest is registered — `kind: 'module'`, the `<globalSave>` flag
157
+ * as `sync`, its `<priority>` — so getModules/getModulePriority/getModulePath
158
+ * see it the way desktop does, and getPackages does not (issue #279).
159
+ *
160
+ * The XML has to exist as a file for the module to reload from: `treePath` is
161
+ * where the import tree already holds it (see resolveModulesFromTree); an
162
+ * uploaded file is added to `bundle.files` under `<key>/<its filename>`. The
163
+ * manifest's `xmlVfsPath` is that path relative to the profile root until
164
+ * bundleToConnectionData anchors it in the new profile's VFS.
165
+ *
166
+ * `module` may be the bare key, in which case the rest of its entry is looked
167
+ * up in `bundle.modules`. Mutates and returns the bundle.
70
168
  */
71
- export declare function addModuleToBundle(bundle: MudletProfileBundle, key: string, xmlBytes: Uint8Array): MudletProfileBundle;
169
+ export declare function addModuleToBundle(bundle: MudletProfileBundle, module: MudletModuleRef | string, xmlBytes: Uint8Array, treePath?: string): MudletProfileBundle;
@@ -2,9 +2,10 @@ export declare const LUA_TBOOLEAN = 1;
2
2
  export declare const LUA_TNUMBER = 3;
3
3
  export declare const LUA_TSTRING = 4;
4
4
  export declare const LUA_TTABLE = 5;
5
- /** How a variable's key is typed in its parent table. Lua only distinguishes
6
- * string vs number keys here (Mudlet never saves other key types). */
7
- export type VarKeyKind = 'string' | 'number';
5
+ /** How a variable's key is typed in its parent table. Mudlet saves string,
6
+ * number and boolean keys (a boolean key's <name> is "true"/"false"); other
7
+ * key types are never saved. */
8
+ export type VarKeyKind = 'string' | 'number' | 'boolean';
8
9
  /** Scalar value types we round-trip. Tables are represented by `children`. */
9
10
  export type VarValueType = 'boolean' | 'number' | 'string' | 'table';
10
11
  /**
@@ -1,12 +1,26 @@
1
1
  import type { ProfileSettings } from '../storage/schema';
2
2
  import { type SerializeInput } from './mudletXmlExport';
3
3
  import { type MudletVariablePackage } from './mudletVariables';
4
+ import type { SavedStopwatch } from '../scripting/StopwatchManager';
4
5
  /**
5
6
  * Produce the updated profile XML: the base save with its automation + variable
6
7
  * packages replaced by `trees` / `variables`, the modeled `<Host>` settings
7
8
  * updated in place from `settings`, and HostPackage's unmodeled fields (plus any
8
9
  * unknown element) carried over verbatim. Throws if the base XML is malformed.
9
10
  */
10
- export declare function buildLinkedWriteback(baseXml: string, trees: SerializeInput, variables: MudletVariablePackage, settings?: Partial<ProfileSettings>): string;
11
+ export declare function buildLinkedWriteback(baseXml: string, trees: SerializeInput, variables: MudletVariablePackage, settings?: Partial<ProfileSettings>,
12
+ /** Leave the profile's own settings out, as Mudlet's "save as" does —
13
+ * Host::saveProfileAs goes through writeGenericPackage, which writes the
14
+ * seven item packages and nothing else. A document meant to be handed to
15
+ * someone else should not carry the sender's preferences. */
16
+ omitHostSettings?: boolean,
17
+ /** The profile's live package list, written into `<mInstalledPackages>`
18
+ * as desktop's `Host::saveProfile` does. Left out, the base's own list
19
+ * stands — right for an export whose base was already stamped, wrong for a
20
+ * save based on an older one, whose list predates any install since. */
21
+ installedPackages?: string[],
22
+ /** The profile's persistent stopwatches, written into `<stopwatches>` as
23
+ * desktop's save does. Left out, the base's own copy stands. */
24
+ stopwatches?: SavedStopwatch[]): string;
11
25
  /** Mudlet's profile-save filename stamp for `date`: `YYYY-MM-DD#HH-mm-ss`. */
12
26
  export declare function mudletTimestamp(date: Date): string;
@@ -1,4 +1,5 @@
1
1
  import type { AliasNode, ButtonNode, KeyNode, ScriptNode, TimerNode, TriggerNode } from '../storage/schema';
2
+ import { type MudletVariable } from './mudletVariables';
2
3
  export interface MudletImportResult {
3
4
  scripts: ScriptNode[];
4
5
  aliases: AliasNode[];
@@ -7,6 +8,44 @@ export interface MudletImportResult {
7
8
  keys: KeyNode[];
8
9
  buttons: ButtonNode[];
9
10
  warnings: string[];
11
+ /**
12
+ * The globals a `<VariablePackage>` carries, if any. A package may be
13
+ * nothing BUT these — a module of variables, fonts, images or a map loads
14
+ * completely and still leaves every one of the six item units empty — so an
15
+ * install that only looked at the units took such a package for one that had
16
+ * installed nothing at all.
17
+ */
18
+ variables?: MudletVariable[];
19
+ /**
20
+ * Why the document could not be read, when it could not. Set only for a
21
+ * caller that asked to be TOLD rather than thrown at — an install carries on
22
+ * with whatever loaded and reports the failure, because the package is
23
+ * listed either way and a silent one is a package the player cannot account
24
+ * for.
25
+ */
26
+ parseError?: string;
27
+ /**
28
+ * Set alongside {@link parseError} when the fault left nothing at all read
29
+ * out of the document — no item and no variable — because it broke before
30
+ * the first one, was not XML at all, or came from a later Mudlet and was
31
+ * refused whole (`'newer'`). A package made only of such documents is
32
+ * refused rather than listed empty; one that read anything, or one read
33
+ * through without a fault, empty or not, is the package.
34
+ */
35
+ nothingRead?: 'unreadable' | 'newer';
36
+ /**
37
+ * Why the document stopped being read, in the words desktop's streaming
38
+ * reader (QXmlStreamReader::errorString) gives — what Host::installPackage
39
+ * hands back for it, "<package>[/<file>]: <this>". Set alongside
40
+ * {@link parseError} for a malformed document.
41
+ */
42
+ xmlError?: string;
43
+ /**
44
+ * The install's "load errors": one "<package>[/<file>]: <xmlError>" per
45
+ * document of the package that could not be read whole, in the order they
46
+ * were read. Filled in by the package installer, which knows the files.
47
+ */
48
+ loadErrors?: string[];
10
49
  }
11
50
  export interface ParseOptions {
12
51
  /**
@@ -17,5 +56,12 @@ export interface ParseOptions {
17
56
  * cleanly removable by tag.
18
57
  */
19
58
  packageName?: string;
59
+ /**
60
+ * Report a malformed document instead of throwing on it. An install wants
61
+ * this: Mudlet's reader keeps whatever it read before the break and leaves
62
+ * the package listed, so throwing here would refuse an install Mudlet
63
+ * completes.
64
+ */
65
+ reportParseError?: boolean;
20
66
  }
21
67
  export declare function parseMudletXml(xml: string, opts?: ParseOptions): MudletImportResult;
@@ -0,0 +1,33 @@
1
+ import type { ProfileVFS } from '../scripting/vfs/ProfileVFS';
2
+ import type { PackageManifest } from '../storage/schema';
3
+ export interface PackageFontResult {
4
+ /** Families successfully registered, in the order they were found. */
5
+ registered: string[];
6
+ /** One line per font that could not be registered, for the error log. */
7
+ warnings: string[];
8
+ }
9
+ /**
10
+ * Register every font shipped inside one installed package.
11
+ *
12
+ * Every font found is in `document.fonts` by the time this returns its promise
13
+ * (see `loadFontFromVfs`); the promise settles when they have all loaded.
14
+ *
15
+ * Best-effort per file: a font that will not parse or will not load must not
16
+ * stop the ones beside it, and must not fail the install that is calling this —
17
+ * desktop's `loadFont` likewise reports and carries on. What it must not do is
18
+ * stay silent, which is the whole of issue #103, so each failure comes back as
19
+ * a warning for the caller to surface.
20
+ *
21
+ * Idempotent, because `refreshPackageFonts` re-runs it over packages whose
22
+ * fonts may already be registered: `loadFontFromVfs` keys what it has loaded by
23
+ * profile + path + family and returns early on a repeat.
24
+ */
25
+ export declare function installPackageFonts(manifest: PackageManifest, vfs: ProfileVFS): Promise<PackageFontResult>;
26
+ /**
27
+ * Re-register the fonts of every installed package — desktop's
28
+ * `Host::refreshPackageFonts`, called on profile open.
29
+ *
30
+ * Without it a package's font works until the tab is closed and then silently
31
+ * stops, which is a worse bug than never having worked.
32
+ */
33
+ export declare function refreshPackageFonts(manifests: readonly PackageManifest[], vfs: ProfileVFS): Promise<PackageFontResult>;