@mudlet/mudlet-web 0.4.1 → 0.4.3
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.
- package/dist-lib/hooks/useOutput.d.ts +1 -2
- package/dist-lib/hooks/useViewportMode.d.ts +26 -1
- package/dist-lib/import/defaultPackages.d.ts +9 -5
- package/dist-lib/import/defaults/mpkg/mpkg.mpackage +0 -0
- package/dist-lib/index.js +8914 -8515
- package/dist-lib/map/xmlMapImport.d.ts +29 -0
- package/dist-lib/mud/MudSession.d.ts +1 -0
- package/dist-lib/mud/connection/MudClient.d.ts +6 -1
- package/dist-lib/mud/connection/PingTracker.d.ts +13 -0
- package/dist-lib/mud/connection/TelnetNegotiator.d.ts +6 -0
- package/dist-lib/mud/protocol/byteString.d.ts +33 -0
- package/dist-lib/mud/protocol/gmcp.d.ts +12 -7
- package/dist-lib/mud/protocol/index.d.ts +2 -1
- package/dist-lib/mud/protocol/mnes.d.ts +38 -9
- package/dist-lib/mud/text/hyperlinkConfig.d.ts +4 -0
- package/dist-lib/scripting/ScriptingAPI.d.ts +4 -0
- package/dist-lib/scripting/lua/bindings/commandLine.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/output.d.ts +1 -1
- package/dist-lib/storage/schema.d.ts +21 -0
- package/dist-lib/styles.css +1 -1
- package/dist-lib/ui/labels/LabelManager.d.ts +8 -0
- package/dist-lib/ui/labels/qtCss.d.ts +1 -0
- package/dist-lib/ui/layout/ContentLayout.d.ts +23 -0
- package/dist-lib/ui/layout/MobileLayout.d.ts +5 -1
- package/dist-lib/ui/output/OutputRenderer.d.ts +1 -3
- package/dist-lib/ui/scrollbox/ScrollBoxOverlay.d.ts +12 -2
- package/dist-lib/ui/sound/SoundManager.d.ts +16 -4
- package/dist-lib/ui/video/VideoManager.d.ts +6 -1
- package/dist-lib/ui/windows/WindowManager.d.ts +28 -0
- package/dist-lib/utils/githubRawUrl.d.ts +1 -0
- package/package.json +2 -2
|
@@ -62,6 +62,14 @@ export interface LabelState {
|
|
|
62
62
|
* `alignment`, it's a widget property that persists across a later
|
|
63
63
|
* stylesheet that omits it. */
|
|
64
64
|
scaledContents?: boolean;
|
|
65
|
+
/** Sticky Qt `wordWrap` widget property, captured from a
|
|
66
|
+
* `qproperty-wordWrap` declaration in any setStyleSheet call. QLabel
|
|
67
|
+
* defaults it to false (and TLabel never sets it), which is why label text
|
|
68
|
+
* in Mudlet runs past the widget edge and gets clipped instead of wrapping
|
|
69
|
+
* — LabelOverlay renders that as `white-space: nowrap`, and this property
|
|
70
|
+
* as `normal`. Sticky across a later stylesheet that omits it, like
|
|
71
|
+
* `alignment` and `scaledContents`. */
|
|
72
|
+
wordWrap?: boolean;
|
|
65
73
|
/** Mudlet setLinkStyle(labelName, linkColor, linkVisitedColor, underline) —
|
|
66
74
|
* styling for `<a>` links inside the label's HTML. Cleared by
|
|
67
75
|
* resetLinkStyle. Colors are any CSS color string (empty = leave default). */
|
|
@@ -55,3 +55,4 @@ export declare function qtDeclarationsToCss(css: string, important?: boolean): s
|
|
|
55
55
|
export declare function qtAlignmentToFlex(val: string): Record<string, string>;
|
|
56
56
|
export declare function extractQtAlignment(css: string): string | undefined;
|
|
57
57
|
export declare function extractQtScaledContents(css: string): boolean | undefined;
|
|
58
|
+
export declare function extractQtWordWrap(css: string): boolean | undefined;
|
|
@@ -16,4 +16,27 @@ interface ContentLayoutProps {
|
|
|
16
16
|
vfs?: ProfileVFS | null;
|
|
17
17
|
}
|
|
18
18
|
export declare function ContentLayout({ session, manager, connectionId, stickyLines, commandInputRef, commandBar, contextMenuHandlerRef, scriptingEngineRef, vfs, }: ContentLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
/**
|
|
20
|
+
* Holds the main console's DOM while a layout branch is on screen, and hands it
|
|
21
|
+
* back when that branch goes away.
|
|
22
|
+
*
|
|
23
|
+
* The console is mounted once, for the lifetime of ContentLayout, into a
|
|
24
|
+
* detached host div; the desktop tree and the phone tree each adopt that div
|
|
25
|
+
* rather than rendering an OutputArea of their own. Crossing the phone
|
|
26
|
+
* breakpoint therefore *moves* the console instead of destroying it.
|
|
27
|
+
*
|
|
28
|
+
* This is the same trick the content pool below uses for panels, and it is not
|
|
29
|
+
* a refinement: OutputArea's renderer appends lines imperatively into the
|
|
30
|
+
* wrapper it was handed at setup, and only ever appends *new* ones. Remounting
|
|
31
|
+
* it handed the renderer a fresh empty wrapper, so every line already on screen
|
|
32
|
+
* vanished while Console.history still held all of them — one resize across
|
|
33
|
+
* 600px emptied a session's scrollback with no way to bring it back.
|
|
34
|
+
*
|
|
35
|
+
* display:contents on the slot keeps the host in the parent's layout, so
|
|
36
|
+
* .main-viewport still measures and flexes exactly as it did before.
|
|
37
|
+
*/
|
|
38
|
+
export declare function ViewportSlot({ host, hidden }: {
|
|
39
|
+
host: HTMLDivElement;
|
|
40
|
+
hidden?: boolean;
|
|
41
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
19
42
|
export {};
|
|
@@ -4,6 +4,10 @@ import type { WindowManager } from '../windows/WindowManager';
|
|
|
4
4
|
interface MobileLayoutProps {
|
|
5
5
|
session: MudSession;
|
|
6
6
|
manager: WindowManager;
|
|
7
|
+
/** The one main console, mounted by ContentLayout and adopted here — never
|
|
8
|
+
* re-created, or the scrollback on screen would be lost on every
|
|
9
|
+
* breakpoint crossing. See ViewportSlot. */
|
|
10
|
+
outputHost: HTMLDivElement;
|
|
7
11
|
/** Already filtered to non-popped-out windows by ContentLayout. */
|
|
8
12
|
windows: ScriptWindowRenderData[];
|
|
9
13
|
stickyLines?: number;
|
|
@@ -18,5 +22,5 @@ interface MobileLayoutProps {
|
|
|
18
22
|
* portal-target divs WindowManager already maintains (same trick as the
|
|
19
23
|
* desktop TabGroupPanel), so panels stay live in the background.
|
|
20
24
|
*/
|
|
21
|
-
export declare function MobileLayout({
|
|
25
|
+
export declare function MobileLayout({ manager, windows, outputHost, commandBar }: MobileLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
22
26
|
export {};
|
|
@@ -44,8 +44,6 @@ type OutputHandlerOptions = {
|
|
|
44
44
|
stickyArea: HTMLElement;
|
|
45
45
|
isSplitView: () => boolean;
|
|
46
46
|
stickyLines: number;
|
|
47
|
-
maxElements?: number | (() => number);
|
|
48
|
-
trimSlack?: number;
|
|
49
47
|
suppressSplitView?: (durationMs: number) => void;
|
|
50
48
|
/** Whether new output should scroll the view to the tail. True for a
|
|
51
49
|
* scrollback; false for a console the writer rewrites wholesale — an MXP
|
|
@@ -66,5 +64,5 @@ export type OutputRendererControls = {
|
|
|
66
64
|
push: (message: string | AnsiAwareBuffer, type?: string, timestamp?: number) => void;
|
|
67
65
|
clear: () => void;
|
|
68
66
|
};
|
|
69
|
-
export declare function setupOutputRenderer(source: MessageSource | null, { outputWrapper, sentinel, stickyArea, isSplitView, stickyLines,
|
|
67
|
+
export declare function setupOutputRenderer(source: MessageSource | null, { outputWrapper, sentinel, stickyArea, isSplitView, stickyLines, suppressSplitView, followTail, onCursorReady, }: OutputHandlerOptions): OutputRendererControls;
|
|
70
68
|
export {};
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import type { ScrollBoxManager } from './ScrollBoxManager';
|
|
2
2
|
import type { LabelManager } from '../labels/LabelManager';
|
|
3
3
|
import type { CommandLineManager } from '../cmdline/CommandLineManager';
|
|
4
|
+
import type { WindowManager } from '../windows/WindowManager';
|
|
4
5
|
import './ScrollBoxOverlay.css';
|
|
5
6
|
interface ScrollBoxOverlayProps {
|
|
6
7
|
manager: ScrollBoxManager;
|
|
7
8
|
labels: LabelManager;
|
|
8
9
|
cmdLines: CommandLineManager;
|
|
10
|
+
/** Lets a box host the windows parented to it — Geyser.ScrollBox makes
|
|
11
|
+
* itself the `windowname` of its children, so a mini-console created
|
|
12
|
+
* inside one names the box as its parent. Optional only so a caller with
|
|
13
|
+
* no WindowManager to hand still renders labels and command lines. */
|
|
14
|
+
windows?: WindowManager;
|
|
9
15
|
/** Viewport whose scroll boxes this overlay renders ('main', a userwindow
|
|
10
16
|
* id, or — when nested — another scroll box's name). */
|
|
11
17
|
parent: string;
|
|
@@ -14,12 +20,16 @@ interface ScrollBoxOverlayProps {
|
|
|
14
20
|
* Renders the {@link ScrollBoxManager}'s boxes for a given parent viewport as
|
|
15
21
|
* absolutely-positioned scrollable containers. Each box hosts the child overlays
|
|
16
22
|
* (labels, command lines, and nested scroll boxes) scoped to the box's own name,
|
|
17
|
-
* so widgets created with `parent = boxName` render inside it.
|
|
23
|
+
* so widgets created with `parent = boxName` render inside it. Each box also
|
|
24
|
+
* registers its scroll content as that name's overlay host, so mini-consoles
|
|
25
|
+
* and mappers created inside it portal into the box (see
|
|
26
|
+
* FloatingWindowLayer.resolveParent) instead of escaping to the document-wide
|
|
27
|
+
* floating root.
|
|
18
28
|
*
|
|
19
29
|
* Scrolling: the children are absolutely positioned and don't expand their
|
|
20
30
|
* containers on their own, so each box wraps them in a content div sized to the
|
|
21
31
|
* extent of its children (the furthest child edge). When that extent exceeds the
|
|
22
32
|
* box, the box's `overflow:auto` produces real scrollbars.
|
|
23
33
|
*/
|
|
24
|
-
export declare function ScrollBoxOverlay({ manager, labels, cmdLines, parent }: ScrollBoxOverlayProps): import("react/jsx-runtime").JSX.Element | null;
|
|
34
|
+
export declare function ScrollBoxOverlay({ manager, labels, cmdLines, windows, parent }: ScrollBoxOverlayProps): import("react/jsx-runtime").JSX.Element | null;
|
|
25
35
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MediaCaptionInfo } from './closedCaption';
|
|
1
|
+
import type { MediaCaptionInfo, MediaKind } from './closedCaption';
|
|
2
2
|
type LoaderFn = (path: string) => Promise<ArrayBuffer | null>;
|
|
3
3
|
/** Which mute gate a playback belongs to. `api` = triggered by a Lua script
|
|
4
4
|
* (playSoundFile / playMusicFile); `game` = triggered by the server (MSP, and
|
|
@@ -54,13 +54,25 @@ export declare class SoundManager {
|
|
|
54
54
|
* tearing them down.
|
|
55
55
|
*/
|
|
56
56
|
private muted;
|
|
57
|
+
/**
|
|
58
|
+
* Raised when a tracked source starts playing. ScriptingEngine wires this
|
|
59
|
+
* to Mudlet's `sysMediaStarted(file, path, mediaType, key, tag)` — the same
|
|
60
|
+
* five arguments TMedia.cpp appends when a player reaches PlayingState.
|
|
61
|
+
*
|
|
62
|
+
* Fired after `source.start()` has actually been accepted, so a decode
|
|
63
|
+
* failure or a rejected start never announces a playback that isn't
|
|
64
|
+
* happening. Mudlet withholds it for preload-volume loads; mudix has no
|
|
65
|
+
* preload volume (`preload()` only warms the decode cache and never builds
|
|
66
|
+
* a source), so there is nothing to withhold it for.
|
|
67
|
+
*/
|
|
68
|
+
onMediaStarted?: (file: string, path: string, mediaType: MediaKind, key: string, tag: string) => void;
|
|
57
69
|
/**
|
|
58
70
|
* Raised when a tracked source ends — whether it played out naturally or
|
|
59
71
|
* was stopped. ScriptingEngine wires this to raise Mudlet's
|
|
60
|
-
* `sysMediaFinished(
|
|
61
|
-
* before stopping, so engine teardown never fires it.
|
|
72
|
+
* `sysMediaFinished(file, path, mediaType, key, tag)`. `stopAll()` nulls
|
|
73
|
+
* each source's onended before stopping, so engine teardown never fires it.
|
|
62
74
|
*/
|
|
63
|
-
onMediaFinished?: (
|
|
75
|
+
onMediaFinished?: (file: string, path: string, mediaType: MediaKind, key: string, tag: string) => void;
|
|
64
76
|
/**
|
|
65
77
|
* Raised when a tracked source starts ('plays') or ends ('stops'), so the
|
|
66
78
|
* engine can print a closed caption (Mudlet's enableClosedCaption). Fires
|
|
@@ -33,9 +33,14 @@ export declare class VideoManager {
|
|
|
33
33
|
* still reports what the script asked for.
|
|
34
34
|
*/
|
|
35
35
|
private muted;
|
|
36
|
+
/** Fires once the element has actually begun playing — mirrors Mudlet's
|
|
37
|
+
* sysMediaStarted. Deliberately after `el.play()` resolves rather than
|
|
38
|
+
* beside the caption below it: autoplay policy can reject the play, and an
|
|
39
|
+
* event announcing a playback that never started is worse than none. */
|
|
40
|
+
onStarted: ((file: string, path: string) => void) | null;
|
|
36
41
|
/** Fires when a video ends naturally or is stopped — mirrors Mudlet's
|
|
37
42
|
* sysMediaFinished. */
|
|
38
|
-
onEnded: ((
|
|
43
|
+
onEnded: ((file: string, path: string) => void) | null;
|
|
39
44
|
/** Raised when a video starts ('plays') or finishes ('stops') so the engine
|
|
40
45
|
* can print a closed caption (Mudlet's enableClosedCaption). */
|
|
41
46
|
onMediaCaption: ((info: MediaCaptionInfo) => void) | null;
|
|
@@ -38,6 +38,15 @@ export interface MapLoadProgress {
|
|
|
38
38
|
*/
|
|
39
39
|
phase: 'rooms' | 'building';
|
|
40
40
|
}
|
|
41
|
+
/** Geometry of one window nested under a parent viewport — enough for a
|
|
42
|
+
* container to size itself around its children (see subscribeChildWindows). */
|
|
43
|
+
export interface NestedWindowGeometry {
|
|
44
|
+
id: string;
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
}
|
|
41
50
|
export type WindowsChangedFn = (windows: ScriptWindowRenderData[], dockExtents: Record<DockSide, number>) => void;
|
|
42
51
|
export declare class WindowManager {
|
|
43
52
|
readonly overlayZ: OverlayLayerOrder;
|
|
@@ -49,6 +58,15 @@ export declare class WindowManager {
|
|
|
49
58
|
* from `elements` (the writable text/HTML target) so size queries report the
|
|
50
59
|
* full user-window box that labels live in, not the inner output area. */
|
|
51
60
|
private readonly viewports;
|
|
61
|
+
/** Overlay hosts contributed by widgets that are containers but not
|
|
62
|
+
* windows — today just Geyser.ScrollBox (see ScrollBoxOverlay). A scroll
|
|
63
|
+
* box sets `windowname = its own name`, so mini-consoles created inside
|
|
64
|
+
* it arrive here with the box's name as their parent and must portal into
|
|
65
|
+
* the box's scroll content instead of escaping to the floating root. */
|
|
66
|
+
private readonly overlayHosts;
|
|
67
|
+
/** Per-parent subscribers wanting the geometry of the windows nested under
|
|
68
|
+
* them — ScrollBoxOverlay sizes its scroll content to its children. */
|
|
69
|
+
private readonly childWindowListeners;
|
|
52
70
|
private readonly lineBuffers;
|
|
53
71
|
/** Per-window scroll/scrollbar overrides applied via CSS classes when the
|
|
54
72
|
* console's wrapper element registers. Mudlet's enable/disable Scrolling
|
|
@@ -257,6 +275,16 @@ export declare class WindowManager {
|
|
|
257
275
|
* context: `.main-overlay-root` for 'main', else the userwindow's own
|
|
258
276
|
* viewport (where its panel already renders the label overlays). */
|
|
259
277
|
getOverlayHost(parentId: string): HTMLElement | null;
|
|
278
|
+
/** Registers a non-window overlay host (a scroll box's scroll content) so
|
|
279
|
+
* windows parented to `id` portal into it. Notifies so a window that was
|
|
280
|
+
* created before its host mounted gets re-homed on the next render. */
|
|
281
|
+
registerOverlayHost(id: string, element: HTMLElement): void;
|
|
282
|
+
unregisterOverlayHost(id: string, element?: HTMLElement): void;
|
|
283
|
+
/** Geometry of the visible windows nested under `parentId`. */
|
|
284
|
+
listChildWindows(parentId: string): NestedWindowGeometry[];
|
|
285
|
+
/** Subscribe to {@link listChildWindows} for one parent. Fires immediately
|
|
286
|
+
* with the current list, like the label / cmd-line / scroll-box managers. */
|
|
287
|
+
subscribeChildWindows(parentId: string, fn: (children: NestedWindowGeometry[]) => void): () => void;
|
|
260
288
|
register(id: string, element: HTMLElement, _kind: 'html'): void;
|
|
261
289
|
pushBuffer(id: string, buffer: AnsiAwareBuffer): void;
|
|
262
290
|
/** Push the current partial-line buffer (script echo without a trailing
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function githubRawUrl(url: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mudlet/mudlet-web",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Mudlet Web — Mudlet in the browser, usable standalone or as a library for branded builds",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"@codemirror/state": "^6.6.0",
|
|
61
61
|
"@codemirror/theme-one-dark": "^6.1.3",
|
|
62
62
|
"@codemirror/view": "^6.41.1",
|
|
63
|
+
"@lezer/highlight": "^1.2.3",
|
|
63
64
|
"@sqlite.org/sqlite-wasm": "^3.53.0-build1",
|
|
64
|
-
"@types/dompurify": "^3.0.5",
|
|
65
65
|
"@zenfs/core": "^2.5.6",
|
|
66
66
|
"@zenfs/dom": "^1.2.9",
|
|
67
67
|
"dompurify": "^3.4.14",
|