mudlet-map-editor 0.7.1 → 0.9.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.
- package/dist-lib/ScriptCodeEditor-DYiJp5Tn.js +845 -0
- package/dist-lib/assets/editor.worker-CEcbUcrJ.js +26 -0
- package/dist-lib/assets/ts.worker-C20_IzgO.js +67719 -0
- package/dist-lib/components/panels/MapPanel.d.ts +36 -0
- package/dist-lib/components/panels/ScriptCodeEditor.d.ts +9 -0
- package/dist-lib/components/panels/ScriptHelpModal.d.ts +5 -0
- package/dist-lib/components/panels/ScriptLibraryModal.d.ts +14 -0
- package/dist-lib/components/panels/ScriptPanel.d.ts +8 -0
- package/dist-lib/components/panels/StubPanel.d.ts +14 -0
- package/dist-lib/dist-AeNML5QP.js +811 -0
- package/dist-lib/editor/clipboard.d.ts +24 -0
- package/dist-lib/editor/hitTest.d.ts +9 -0
- package/dist-lib/editor/script.d.ts +20 -0
- package/dist-lib/editor/scriptAiPrompt.d.ts +1 -0
- package/dist-lib/editor/scriptApiDocs.d.ts +29 -0
- package/dist-lib/editor/scriptTypes.d.ts +8 -0
- package/dist-lib/editor/store.d.ts +25 -1
- package/dist-lib/editor/types.d.ts +17 -0
- package/dist-lib/editor.api2-PX2PsJx9.js +113491 -0
- package/dist-lib/index.js +12468 -8248
- package/dist-lib/javascript-DJweRxI1.js +272 -0
- package/dist-lib/monaco.contribution-CRzon75s.js +116 -0
- package/dist-lib/styles.css +1 -1
- package/dist-lib/tsMode-J2Knw729.js +611 -0
- package/package.json +9 -5
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { MudletMap } from '../mapIO';
|
|
2
|
+
import { type RoomClipboard } from './store';
|
|
3
|
+
import type { SceneHandle } from './scene';
|
|
4
|
+
export declare function copyRoomsToClipboard(map: MudletMap, ids: number[]): number;
|
|
5
|
+
export type PasteResult = {
|
|
6
|
+
count: number;
|
|
7
|
+
newIds: number[];
|
|
8
|
+
externalExitsStubbed: number;
|
|
9
|
+
externalSpecialExitsDropped: number;
|
|
10
|
+
};
|
|
11
|
+
export declare function pasteClipboard(clipboard: RoomClipboard, target: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
z: number;
|
|
15
|
+
areaId: number;
|
|
16
|
+
}, scene: SceneHandle | null): PasteResult | null;
|
|
17
|
+
/** Copy → paste-at-offset in one step, without touching the user's clipboard. */
|
|
18
|
+
export declare function duplicateRooms(map: MudletMap, ids: number[], offset: {
|
|
19
|
+
dx: number;
|
|
20
|
+
dy: number;
|
|
21
|
+
}, target: {
|
|
22
|
+
areaId: number;
|
|
23
|
+
z: number;
|
|
24
|
+
}, scene: SceneHandle | null): PasteResult | null;
|
|
@@ -98,3 +98,12 @@ export declare function customLineSegmentAt(renderer: MapRenderer, roomId: numbe
|
|
|
98
98
|
* renderer-prepended room centre), or null.
|
|
99
99
|
*/
|
|
100
100
|
export declare function customLinePointAt(renderer: MapRenderer, roomId: number, exitName: string, mapX: number, mapY: number, roomSize: number): number | null;
|
|
101
|
+
/**
|
|
102
|
+
* Hit-test a `room.stubs` entry against the geometry the renderer actually
|
|
103
|
+
* drew. Non-cardinal stubs (up/down/in/out) render as zero-length segments
|
|
104
|
+
* and are implicitly skipped by the distance check.
|
|
105
|
+
*/
|
|
106
|
+
export declare function stubAt(renderer: MapRenderer, mapX: number, mapY: number, roomSize: number): {
|
|
107
|
+
roomId: number;
|
|
108
|
+
dir: Direction;
|
|
109
|
+
} | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SceneHandle } from './scene';
|
|
2
|
+
export type ScriptResult = {
|
|
3
|
+
commandCount: number;
|
|
4
|
+
logs: string[];
|
|
5
|
+
/** Value the script returned via `return …`. `undefined` means no return. */
|
|
6
|
+
returnValue?: unknown;
|
|
7
|
+
/** JSON-stringified form of `returnValue`, or an error marker if not serialisable. */
|
|
8
|
+
returnJson?: string;
|
|
9
|
+
error?: {
|
|
10
|
+
message: string;
|
|
11
|
+
name: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Run a user script against the current map. Each helper mutates the map
|
|
16
|
+
* eagerly (so subsequent reads see updated state) and records a Command. On
|
|
17
|
+
* success, all commands are pushed as a single batch to the undo stack. On
|
|
18
|
+
* error, every applied command is reverted.
|
|
19
|
+
*/
|
|
20
|
+
export declare function runScript(code: string, scene: SceneHandle): ScriptResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function buildAiPrompt(): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metadata for script API symbols — consumed by the CodeMirror completion
|
|
3
|
+
* source in ScriptPanel. Keep in sync with the `api` object in `script.ts`.
|
|
4
|
+
*/
|
|
5
|
+
export type ApiKind = 'function' | 'variable' | 'namespace';
|
|
6
|
+
/** Simplified return-type tag used to pick member completions after `x.` or `fn().`. */
|
|
7
|
+
export type ApiReturnType = 'Room' | 'RoomArray' | 'Area' | 'AreaArray' | 'Env' | 'EnvArray' | 'Direction' | 'DirectionArray' | 'void' | 'number' | 'string' | 'boolean' | 'unknown';
|
|
8
|
+
export interface ApiEntry {
|
|
9
|
+
name: string;
|
|
10
|
+
kind: ApiKind;
|
|
11
|
+
signature?: string;
|
|
12
|
+
detail: string;
|
|
13
|
+
/** Short human description shown in completion popup. */
|
|
14
|
+
info: string;
|
|
15
|
+
/** Return type for functions / inferred type for variables. Used by the completion engine. */
|
|
16
|
+
returns?: ApiReturnType;
|
|
17
|
+
}
|
|
18
|
+
export declare const SCRIPT_API: ApiEntry[];
|
|
19
|
+
/** Fields available on an Area, used as completions after `.` on an area variable. */
|
|
20
|
+
export declare const AREA_FIELDS: ApiEntry[];
|
|
21
|
+
/** Fields available on an Env snapshot, used as completions after `.` on an env variable. */
|
|
22
|
+
export declare const ENV_FIELDS: ApiEntry[];
|
|
23
|
+
/**
|
|
24
|
+
* A curated subset of Array.prototype members, used as completions after `.`
|
|
25
|
+
* on any expression whose inferred type is an array.
|
|
26
|
+
*/
|
|
27
|
+
export declare const ARRAY_METHODS: ApiEntry[];
|
|
28
|
+
/** Fields available on a Room snapshot, used as completions after `.` on a room variable. */
|
|
29
|
+
export declare const ROOM_FIELDS: ApiEntry[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ambient TypeScript declarations for the script sandbox, loaded into Monaco
|
|
3
|
+
* via addExtraLib() so the editor gives full type-aware autocomplete, hover,
|
|
4
|
+
* and signature help.
|
|
5
|
+
*
|
|
6
|
+
* Keep in sync with the `api` object in `script.ts`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SCRIPT_TYPES_DTS: string;
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
import type { MudletMap } from '../mapIO';
|
|
1
|
+
import type { MudletMap, MudletRoom } from '../mapIO';
|
|
2
2
|
import type { Command, HitItem, HoverTarget, LoadedMap, Pending, Selection, SwatchSet, ToolId } from './types';
|
|
3
|
+
export type RoomClipboard = {
|
|
4
|
+
/** Rooms captured at copy time; origId preserved for internal-exit remap. */
|
|
5
|
+
rooms: Array<{
|
|
6
|
+
origId: number;
|
|
7
|
+
room: MudletRoom;
|
|
8
|
+
}>;
|
|
9
|
+
/** Centroid of source rooms in raw Mudlet space — paste offset is computed relative to this. */
|
|
10
|
+
origin: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
z: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
3
16
|
interface UserSettings {
|
|
4
17
|
snapToGrid: boolean;
|
|
18
|
+
panelWidth: number;
|
|
5
19
|
}
|
|
6
20
|
export declare function saveUserSettings(patch: Partial<UserSettings>): void;
|
|
7
21
|
export declare function saveSwatchState(sets: SwatchSet[], activeSetId: string | null, activeSwatchId: string | null): void;
|
|
@@ -36,8 +50,18 @@ export interface EditorState {
|
|
|
36
50
|
x: number;
|
|
37
51
|
y: number;
|
|
38
52
|
} | null;
|
|
53
|
+
/** Last pointer position over the map in render-space (y-down), updated on every pointermove. */
|
|
54
|
+
cursorMap: {
|
|
55
|
+
x: number;
|
|
56
|
+
y: number;
|
|
57
|
+
} | null;
|
|
58
|
+
/** In-memory clipboard of copied rooms. Not persisted across reloads. */
|
|
59
|
+
clipboard: RoomClipboard | null;
|
|
39
60
|
sidebarTab: string;
|
|
40
61
|
panelCollapsed: boolean;
|
|
62
|
+
panelExpanded: boolean;
|
|
63
|
+
/** Side panel width in pixels (persisted). Ignored when the panel is collapsed or modal-expanded. */
|
|
64
|
+
panelWidth: number;
|
|
41
65
|
contextMenu: ContextMenuState;
|
|
42
66
|
savedUndoLength: number;
|
|
43
67
|
/** When set, the next area/z navigation pans to this map-space point instead of fitting. Consumed and cleared by App. */
|
|
@@ -65,6 +65,10 @@ export type HitItem = {
|
|
|
65
65
|
kind: 'customLine';
|
|
66
66
|
roomId: number;
|
|
67
67
|
exitName: string;
|
|
68
|
+
} | {
|
|
69
|
+
kind: 'stub';
|
|
70
|
+
roomId: number;
|
|
71
|
+
dir: Direction;
|
|
68
72
|
} | {
|
|
69
73
|
kind: 'label';
|
|
70
74
|
id: number;
|
|
@@ -83,6 +87,10 @@ export type Selection = {
|
|
|
83
87
|
roomId: number;
|
|
84
88
|
exitName: string;
|
|
85
89
|
pointIndex?: number;
|
|
90
|
+
} | {
|
|
91
|
+
kind: 'stub';
|
|
92
|
+
roomId: number;
|
|
93
|
+
dir: Direction;
|
|
86
94
|
} | {
|
|
87
95
|
kind: 'label';
|
|
88
96
|
id: number;
|
|
@@ -101,6 +109,10 @@ export type HoverTarget = {
|
|
|
101
109
|
kind: 'customLine';
|
|
102
110
|
roomId: number;
|
|
103
111
|
exitName: string;
|
|
112
|
+
} | {
|
|
113
|
+
kind: 'stub';
|
|
114
|
+
roomId: number;
|
|
115
|
+
dir: Direction;
|
|
104
116
|
} | {
|
|
105
117
|
kind: 'label';
|
|
106
118
|
id: number;
|
|
@@ -322,6 +334,11 @@ export type Command = {
|
|
|
322
334
|
field: 'name' | 'environment' | 'weight' | 'symbol';
|
|
323
335
|
from: string | number;
|
|
324
336
|
to: string | number;
|
|
337
|
+
} | {
|
|
338
|
+
kind: 'setRoomHash';
|
|
339
|
+
id: number;
|
|
340
|
+
from: string | null;
|
|
341
|
+
to: string | null;
|
|
325
342
|
} | {
|
|
326
343
|
kind: 'addArea';
|
|
327
344
|
id: number;
|