@mudlet/mudlet-web 0.3.1 → 0.4.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 (97) hide show
  1. package/README.md +8 -0
  2. package/dist-lib/assets/qt-resources/index.d.ts +16 -0
  3. package/dist-lib/branding.d.ts +1 -1
  4. package/dist-lib/hooks/useMudSession.d.ts +1 -1
  5. package/dist-lib/hooks/useOutput.d.ts +3 -1
  6. package/dist-lib/import/defaultPackages.d.ts +35 -2
  7. package/dist-lib/import/defaults/generic_mapper/generic_mapper.mpackage +0 -0
  8. package/dist-lib/import/defaults/gui-drop/gui-drop.mpackage +0 -0
  9. package/dist-lib/import/defaults/{run-lua-code.mpackage → mudlet-base-ui/mudlet-base-ui.mpackage} +0 -0
  10. package/dist-lib/import/defaults/run-lua-code/run-lua-code.mpackage +0 -0
  11. package/dist-lib/import/packageExport.d.ts +71 -0
  12. package/dist-lib/import/packageInstaller.d.ts +4 -1
  13. package/dist-lib/index.js +45935 -40688
  14. package/dist-lib/logging/SessionLogger.d.ts +66 -1
  15. package/dist-lib/map/MapStore.d.ts +32 -4
  16. package/dist-lib/map/mapImageExport.d.ts +1 -1
  17. package/dist-lib/map/mapZoom.d.ts +71 -0
  18. package/dist-lib/mud/ItemIdSequence.d.ts +23 -0
  19. package/dist-lib/mud/MudSession.d.ts +113 -11
  20. package/dist-lib/mud/PatternEngine.d.ts +6 -1
  21. package/dist-lib/mud/commandSplit.d.ts +16 -0
  22. package/dist-lib/mud/connection/LineAssembler.d.ts +56 -0
  23. package/dist-lib/mud/connection/MudClient.d.ts +120 -16
  24. package/dist-lib/mud/connection/TelnetNegotiator.d.ts +39 -0
  25. package/dist-lib/mud/connection/telnetByteTags.d.ts +35 -0
  26. package/dist-lib/mud/events.d.ts +19 -4
  27. package/dist-lib/mud/games/bundledGames.d.ts +29 -0
  28. package/dist-lib/mud/games/gameIcons.d.ts +5 -0
  29. package/dist-lib/mud/keybindings/KeyEngine.d.ts +9 -2
  30. package/dist-lib/mud/keybindings/browserReservedKeys.d.ts +5 -1
  31. package/dist-lib/mud/keybindings/keyEventTarget.d.ts +17 -0
  32. package/dist-lib/mud/keybindings/qtKeys.d.ts +2 -0
  33. package/dist-lib/mud/protocol/charLoginFlow.d.ts +68 -0
  34. package/dist-lib/mud/protocol/charset.d.ts +27 -5
  35. package/dist-lib/mud/protocol/constants.d.ts +1 -0
  36. package/dist-lib/mud/protocol/gmcp.d.ts +19 -3
  37. package/dist-lib/mud/protocol/index.d.ts +1 -1
  38. package/dist-lib/mud/protocol/mxp.d.ts +28 -5
  39. package/dist-lib/mud/replay/ReplayPlayer.d.ts +17 -0
  40. package/dist-lib/mud/text/Console.d.ts +64 -0
  41. package/dist-lib/mud/text/FormatState.d.ts +66 -3
  42. package/dist-lib/mud/text/hyperlinkVisibility.d.ts +35 -0
  43. package/dist-lib/mud/text/osc8Docs.d.ts +23 -0
  44. package/dist-lib/mud/text/serverWrap.d.ts +191 -0
  45. package/dist-lib/mud/timers/TimerEngine.d.ts +43 -12
  46. package/dist-lib/mud/triggers/TriggerEngine.d.ts +112 -3
  47. package/dist-lib/scripting/EngineHost.d.ts +56 -3
  48. package/dist-lib/scripting/IScriptingRuntime.d.ts +16 -0
  49. package/dist-lib/scripting/MxpFrameManager.d.ts +118 -0
  50. package/dist-lib/scripting/ScriptingAPI.d.ts +323 -54
  51. package/dist-lib/scripting/ScriptingEngine.d.ts +180 -23
  52. package/dist-lib/scripting/http/HttpService.d.ts +51 -1
  53. package/dist-lib/scripting/lua/LuaRuntime.d.ts +151 -2
  54. package/dist-lib/scripting/lua/bindings/map.d.ts +0 -12
  55. package/dist-lib/scripting/lua/utf8Patterns.d.ts +59 -0
  56. package/dist-lib/storage/index.d.ts +1 -1
  57. package/dist-lib/storage/persistentStorage.d.ts +10 -0
  58. package/dist-lib/storage/schema.d.ts +116 -0
  59. package/dist-lib/styles.css +1 -1
  60. package/dist-lib/ui/BundledGameGrid.d.ts +21 -0
  61. package/dist-lib/ui/CommandBar.d.ts +7 -1
  62. package/dist-lib/ui/ConnectionGrid.d.ts +4 -1
  63. package/dist-lib/ui/FilePickerModal.d.ts +3 -3
  64. package/dist-lib/ui/HelpModal.d.ts +11 -0
  65. package/dist-lib/ui/LogBrowserModal.d.ts +4 -1
  66. package/dist-lib/ui/PlayerMarkerPreview.d.ts +20 -0
  67. package/dist-lib/ui/Toolbar.d.ts +2 -1
  68. package/dist-lib/ui/VfsPickerModal.d.ts +26 -0
  69. package/dist-lib/ui/components/FileSourceButton.d.ts +47 -0
  70. package/dist-lib/ui/components/index.d.ts +1 -0
  71. package/dist-lib/ui/helpTopics.d.ts +19 -0
  72. package/dist-lib/ui/labels/LabelManager.d.ts +7 -0
  73. package/dist-lib/ui/layout/ScriptWindow.d.ts +11 -2
  74. package/dist-lib/ui/markdown.d.ts +10 -1
  75. package/dist-lib/ui/output/OutputArea.d.ts +11 -1
  76. package/dist-lib/ui/output/OutputContextMenu.d.ts +3 -1
  77. package/dist-lib/ui/output/OutputRenderer.d.ts +7 -1
  78. package/dist-lib/ui/output/OutputSearchBar.d.ts +25 -0
  79. package/dist-lib/ui/output/StickyOutputPanel.d.ts +5 -1
  80. package/dist-lib/ui/output/outputSearch.d.ts +130 -0
  81. package/dist-lib/ui/search/matcher.d.ts +15 -0
  82. package/dist-lib/ui/search/useDebounced.d.ts +3 -0
  83. package/dist-lib/ui/tts/TtsManager.d.ts +3 -0
  84. package/dist-lib/ui/useCommandHistory.d.ts +4 -2
  85. package/dist-lib/ui/useOpenProfiles.d.ts +26 -0
  86. package/dist-lib/ui/video/VideoManager.d.ts +17 -0
  87. package/dist-lib/ui/windows/WindowManager.d.ts +132 -2
  88. package/dist-lib/ui/windows/panels/MapPanel.d.ts +4 -1
  89. package/dist-lib/ui/windows/panels/PackageExportModal.d.ts +18 -0
  90. package/dist-lib/ui/windows/panels/TextPanel.d.ts +3 -1
  91. package/dist-lib/ui/windows/types.d.ts +35 -0
  92. package/dist-lib/utils/describeThrown.d.ts +22 -0
  93. package/dist-lib/utils/fontLoader.d.ts +5 -0
  94. package/dist-lib/vite.js +22 -0
  95. package/package.json +10 -6
  96. package/dist-lib/scripting/lua/mudlet-lua/generic-mapper/generic_mapper.mpackage +0 -0
  97. package/dist-lib/ui/windows/panels/VfsModulePickerModal.d.ts +0 -8
package/README.md CHANGED
@@ -78,6 +78,12 @@ yarn start # listens on ws://localhost:3001 by default
78
78
 
79
79
  Then choose **MUD (host:port)** mode when creating a connection. Servers that expose a native WebSocket endpoint don't need the proxy — use **WebSocket** mode and point it straight at the `ws(s)://` URL.
80
80
 
81
+ ### Already play in desktop Mudlet?
82
+
83
+ Your existing profile comes across whole — triggers, aliases, scripts, keybindings, buttons, saved variables, installed packages, your map, and your colours and fonts. **[docs/help/migrating.md](docs/help/migrating.md)** walks through it: where the profile folder lives on each platform, the three ways in (copy a folder, import a `.zip`, or link the folder and keep using both), what doesn't come across, and how to export back to desktop Mudlet.
84
+
85
+ The same guide — plus [connecting](docs/help/connecting.md), [storage and backups](docs/help/storage.md), and [browsers and limits](docs/help/browsers.md) — is built into the app behind the **Help** button, on the start screen and in the toolbar.
86
+
81
87
  ## 🛠️ Development
82
88
 
83
89
  ```bash
@@ -145,6 +151,8 @@ Lua scripts and packages that Mudlet Web merely *runs* (your profile scripts, in
145
151
 
146
152
  Mudlet Web also bundles **Bitstream Vera Sans Mono** (`src/assets/fonts/bitstream-vera-sans-mono/`) as the default console output and command-line font, matching Mudlet's own default console typeface. It's under the separate, permissive [Bitstream Vera license](src/assets/fonts/bitstream-vera-sans-mono/COPYRIGHT.TXT) (free redistribution and embedding; just don't sell the font standalone or rename a modified copy while keeping "Bitstream"/"Vera" in the name).
147
153
 
154
+ **Ubuntu** and **Ubuntu Mono** (`src/assets/fonts/ubuntu/`, regular/bold/italic/bold-italic each) are bundled for the same reason: Mudlet registers both families into Qt's font database at startup, so packages written for Mudlet — including the bundled `mudlet-base-ui` — ask for them by name for labels, headers, and miniconsole stylesheets. They're under the [Ubuntu Font Licence 1.0](src/assets/fonts/ubuntu/LICENCE.txt) (free redistribution and embedding; modified copies must be renamed).
155
+
148
156
  <div align="center">
149
157
  <sub>Built with React, TypeScript, and a lot of WebAssembly. Happy MUDding. 🐉</sub>
150
158
  </div>
@@ -0,0 +1,16 @@
1
+ /** Whether `path` uses Qt's resource syntax. Mudlet also accepts the `qrc:///`
2
+ * URL form for the same bundle. */
3
+ export declare function isQtResourcePath(path: string): boolean;
4
+ /**
5
+ * A `:/…` path as a URL usable anywhere a browser wants one — an `<img>` src, a
6
+ * CSS `url(...)`, a background image. Null when the resource isn't vendored.
7
+ */
8
+ export declare function qtResourceUrl(path: string): string | null;
9
+ /**
10
+ * The bytes behind a `:/…` path, decoded synchronously. Null when the resource
11
+ * isn't vendored, or the entry isn't a base64 data URI (which would mean the
12
+ * bundler emitted it as a file instead of inlining it).
13
+ */
14
+ export declare function qtResourceBytes(path: string): Uint8Array | null;
15
+ /** Every vendored resource path, in Qt form. For diagnostics and tests. */
16
+ export declare function qtResourcePaths(): string[];
@@ -70,7 +70,7 @@ export declare const STOCK_THEMES: {
70
70
  /** Ids of the stock toolbar buttons, for `BrandToolbarConfig.hide`.
71
71
  * `connection` is the Reconnect/Disconnect pair; `close` closes the profile;
72
72
  * `record` toggles Mudlet-format replay recording. */
73
- export type StockToolbarButton = 'scripts' | 'files' | 'map' | 'logs' | 'docs' | 'reportBug' | 'settings' | 'record' | 'connection' | 'close';
73
+ export type StockToolbarButton = 'scripts' | 'files' | 'map' | 'logs' | 'docs' | 'help' | 'reportBug' | 'settings' | 'record' | 'connection' | 'close';
74
74
  /** What a brand toolbar button can do when clicked. */
75
75
  export interface BrandToolbarContext {
76
76
  connectionId: string;
@@ -6,5 +6,5 @@ export declare function useMudSession(options?: MudSessionOptions): {
6
6
  passwordMode: boolean;
7
7
  connect: (url: string) => void;
8
8
  disconnect: () => void;
9
- send: (text: string, echo?: boolean) => void;
9
+ send: (text: string, echo?: boolean, isGameCommand?: boolean) => void;
10
10
  };
@@ -5,6 +5,8 @@ export interface UseStickyOutputOptions {
5
5
  maxElements?: number;
6
6
  splitViewThreshold?: number;
7
7
  showTimestamps?: boolean;
8
+ /** See OutputHandlerOptions.followTail. Omit for a normal scrollback. */
9
+ followTail?: () => boolean;
8
10
  }
9
11
  export interface UseStickyOutputResult {
10
12
  outputRef: React.RefObject<HTMLDivElement | null>;
@@ -14,4 +16,4 @@ export interface UseStickyOutputResult {
14
16
  scrollToBottom: () => void;
15
17
  controls: OutputRendererControls | null;
16
18
  }
17
- export declare function useStickyOutput(source: MessageSource | null, { stickyLines, maxElements, splitViewThreshold, showTimestamps, }?: UseStickyOutputOptions): UseStickyOutputResult;
19
+ export declare function useStickyOutput(source: MessageSource | null, { stickyLines, maxElements, splitViewThreshold, showTimestamps, followTail, }?: UseStickyOutputOptions): UseStickyOutputResult;
@@ -15,6 +15,13 @@ interface DefaultPackage {
15
15
  * `mudlet-mapper.xml` row of `defaultScripts` in mudlet.cpp.
16
16
  */
17
17
  export declare const IRE_MAPPER_GAMES: string[];
18
+ /**
19
+ * Games whose own bundled loader installs a full interface, so the starter UI is
20
+ * not preinstalled for them — it would only fight the game's GUI for the same
21
+ * screen space. Mirrors the `providesOwnUi` entries of `TGameDetails.h`'s
22
+ * `scmDefaultGames`, including each game's `alternateHostUrls`.
23
+ */
24
+ export declare const GAMES_WITH_OWN_UI: string[];
18
25
  /** Every bundled default, whatever the host — for tests and tooling. */
19
26
  export declare const ALL_DEFAULTS: DefaultPackage[];
20
27
  /**
@@ -29,8 +36,32 @@ export declare const ALL_DEFAULTS: DefaultPackage[];
29
36
  * Exactly one mapper, always. `centerview()` is the only thing that moves the
30
37
  * map view and only a mapper calls it, so a profile with no mapper never follows
31
38
  * the player — and two mappers would both fire on the same movement.
39
+ *
40
+ * The starter UI is the one conditional pick: Mudlet skips it for players who
41
+ * aren't new (`experiencedMudletPlayer()` — any profile folder older than six
42
+ * months) because "veterans will have their own layouts already", and for games
43
+ * whose own loader installs a full interface. mudix has no profile-age signal to
44
+ * mirror the first, so `createdAt` stands in for it — see {@link isNewProfile}.
45
+ */
46
+ export declare function stockDefaults(host?: string, conn?: {
47
+ createdAt?: string;
48
+ }): DefaultPackage[];
49
+ /**
50
+ * Whether a profile is new enough to be offered the starter UI.
51
+ *
52
+ * `addConnection` stamps `createdAt` on every profile it creates, so a profile
53
+ * without one was made before the field existed — i.e. someone has already been
54
+ * using it, quite possibly with a layout of their own. That's mudix's stand-in
55
+ * for Mudlet's "no profile folder older than six months" check: it errs the safe
56
+ * way, since dropping a dock, gauges and a chat window onto an established
57
+ * profile is far more disruptive than withholding them from a new one.
58
+ *
59
+ * No profile at all (tooling, a preview, `stockDefaults()` with no argument)
60
+ * counts as new — nothing established is at risk.
32
61
  */
33
- export declare function stockDefaults(host?: string): DefaultPackage[];
62
+ export declare function isNewProfile(conn?: {
63
+ createdAt?: string;
64
+ }): boolean;
34
65
  /** A default or brand package as the install loop sees it. */
35
66
  export type InstallablePackage = DefaultPackage & {
36
67
  removable?: boolean;
@@ -42,7 +73,9 @@ export type InstallablePackage = DefaultPackage & {
42
73
  * them — `[]` preinstalls nothing, and a brand shipping its own mapper simply
43
74
  * doesn't list ours. Unset means no opinion: the stock defaults for this game.
44
75
  */
45
- export declare function resolveDefaultPackages(brandPackages: InstallablePackage[] | undefined, host?: string): InstallablePackage[];
76
+ export declare function resolveDefaultPackages(brandPackages: InstallablePackage[] | undefined, host?: string, conn?: {
77
+ createdAt?: string;
78
+ }): InstallablePackage[];
46
79
  /** Hostname `stockDefaults` matches its game lists against, lowercased. */
47
80
  export declare function connectionHost(conn: {
48
81
  mode?: string;
@@ -0,0 +1,71 @@
1
+ import { type SerializeInput } from './mudletXmlExport';
2
+ export interface PackageExportMeta {
3
+ /** Package identity — also the XML filename and the install directory name. */
4
+ name: string;
5
+ author?: string;
6
+ title?: string;
7
+ description?: string;
8
+ version?: string;
9
+ helpURL?: string;
10
+ dependencies?: string[];
11
+ /** Icon filename as stored under `.mudlet/Icon/`; empty when there's no icon. */
12
+ icon?: string;
13
+ /** ISO-8601 creation stamp. Passed in rather than read from the clock so the
14
+ * builders stay pure and testable. */
15
+ created: string;
16
+ }
17
+ /** Strip characters that are illegal in zip entry / filesystem names. */
18
+ export declare function sanitizePackageName(raw: string, fallback?: string): string;
19
+ /**
20
+ * Mudlet's `config.lua`: every key is written even when empty, in the order
21
+ * dlgPackageExporter emits them, with `created` as a plain quoted string.
22
+ */
23
+ export declare function buildConfigLua(meta: PackageExportMeta): string;
24
+ interface TreeNode {
25
+ id: string;
26
+ parentId: string | null;
27
+ isGroup: boolean;
28
+ }
29
+ /** Every descendant id of `rootId`, excluding the root itself. */
30
+ export declare function descendantIds<T extends TreeNode>(nodes: T[], rootId: string): string[];
31
+ /**
32
+ * Reduce a category's nodes to the selected ones, re-parenting any node whose
33
+ * parent wasn't selected to the top level.
34
+ *
35
+ * Mudlet drops such a node instead: its exporter walks from the roots and never
36
+ * reaches a selected child under an unselected group, so checking one trigger
37
+ * inside a folder exports nothing. Re-rooting keeps the item and makes the
38
+ * selection mean what it looks like; a fully-checked subtree serializes
39
+ * identically either way.
40
+ */
41
+ export declare function selectExportNodes<T extends TreeNode>(nodes: T[], selected: ReadonlySet<string>): T[];
42
+ /** Ids of every category, as the modal tracks them. */
43
+ export interface PackageSelection {
44
+ scripts: ReadonlySet<string>;
45
+ aliases: ReadonlySet<string>;
46
+ triggers: ReadonlySet<string>;
47
+ timers: ReadonlySet<string>;
48
+ keys: ReadonlySet<string>;
49
+ buttons: ReadonlySet<string>;
50
+ }
51
+ /** Apply a selection across all six categories at once. */
52
+ export declare function selectExportInput(all: SerializeInput, selection: PackageSelection): SerializeInput;
53
+ export declare function countSelected(input: SerializeInput): number;
54
+ export interface PackageExportInput {
55
+ meta: PackageExportMeta;
56
+ /** Already filtered through `selectExportInput`. */
57
+ nodes: SerializeInput;
58
+ /** Extra files to carry, keyed by path relative to the package root. */
59
+ assets?: Record<string, Uint8Array>;
60
+ /** Icon bytes; stored at `.mudlet/Icon/<meta.icon>` when `meta.icon` is set. */
61
+ iconBytes?: Uint8Array;
62
+ }
63
+ /**
64
+ * Build the package's file map. `config.lua` and `<name>.xml` are written last
65
+ * and always win: an asset list harvested from an installed package directory
66
+ * contains the *previous* pair, and letting those through would ship stale
67
+ * metadata alongside the freshly serialized items.
68
+ */
69
+ export declare function buildPackageEntries(input: PackageExportInput): Record<string, Uint8Array>;
70
+ export declare function buildPackageZip(input: PackageExportInput): Uint8Array;
71
+ export {};
@@ -69,4 +69,7 @@ export declare function reloadModuleFromVfs(manifest: PackageManifest, vfs: Prof
69
69
  *
70
70
  * Throws on read/parse failures.
71
71
  */
72
- export declare function installModuleFromVfsPath(absolutePath: string, vfs: ProfileVFS): InstallResult;
72
+ export declare function installModuleFromVfsPath(absolutePath: string, vfs: ProfileVFS,
73
+ /** Consulted first, so a module under the read-only /lua/ namespace installs
74
+ * as readily as one in the profile — see LuaRuntime.readBuiltinBytes. */
75
+ readBuiltin?: (path: string) => Uint8Array | null): InstallResult;