mudlet-map-editor 0.21.0 → 0.22.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/components/MapDiffModal.d.ts +3 -0
- package/dist-lib/components/Toolbar.d.ts +2 -1
- package/dist-lib/editor/diff/DiffHighlightOverlay.d.ts +48 -0
- package/dist-lib/editor/diff/diffScene.d.ts +27 -0
- package/dist-lib/editor/diff/mapDiff.d.ts +47 -0
- package/dist-lib/i18n/locales/en.d.ts +2 -0
- package/dist-lib/i18n/locales/modals.en.d.ts +16 -0
- package/dist-lib/index.js +11985 -11109
- package/dist-lib/styles.css +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import type { ToolbarAction } from '../editor/plugin';
|
|
|
5
5
|
* `null` — is rendered as-is, so a plugin can explicitly hide the slot.
|
|
6
6
|
* `transformActions` is the composed plugin transform applied to the built-in
|
|
7
7
|
* file-action list (see EditorPlugin#toolbarActions). */
|
|
8
|
-
export declare function Toolbar({ title, logo, transformActions, onHelpClick, onLoadFromUrl, onSave, onSearchClick, onSettingsClick }: {
|
|
8
|
+
export declare function Toolbar({ title, logo, transformActions, onHelpClick, onLoadFromUrl, onSave, onSearchClick, onSettingsClick, onDiffClick }: {
|
|
9
9
|
title?: string;
|
|
10
10
|
logo?: ReactNode;
|
|
11
11
|
transformActions?: (actions: ToolbarAction[]) => ToolbarAction[];
|
|
@@ -14,4 +14,5 @@ export declare function Toolbar({ title, logo, transformActions, onHelpClick, on
|
|
|
14
14
|
onSave?: (bytes: Uint8Array) => void;
|
|
15
15
|
onSearchClick?: () => void;
|
|
16
16
|
onSettingsClick?: () => void;
|
|
17
|
+
onDiffClick?: () => void;
|
|
17
18
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { SceneOverlay, SceneOverlayContext, Shape } from 'mudlet-map-renderer';
|
|
2
|
+
import type { MudletMap } from '../../mapIO';
|
|
3
|
+
import type { MapDiff } from './mapDiff';
|
|
4
|
+
export type DiffStatus = 'added' | 'deleted' | 'changed';
|
|
5
|
+
/** Stable keys shared between the sidebar entries and the pane highlights. */
|
|
6
|
+
export declare const roomKey: (status: DiffStatus, id: number) => string;
|
|
7
|
+
export declare const labelKey: (status: DiffStatus, areaId: number, labelId: number) => string;
|
|
8
|
+
/** A room/label to tint, in renderer world space (renderY = -rawY). */
|
|
9
|
+
export interface DiffHighlight {
|
|
10
|
+
key: string;
|
|
11
|
+
renderX: number;
|
|
12
|
+
renderY: number;
|
|
13
|
+
z: number;
|
|
14
|
+
area: number;
|
|
15
|
+
status: DiffStatus;
|
|
16
|
+
/** Half-extents of the rect in world units (room half-size, or label w/2 & h/2). */
|
|
17
|
+
halfX: number;
|
|
18
|
+
halfY: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A {@link SceneOverlay} that tints changed rooms/labels for the currently
|
|
22
|
+
* displayed area + z-level. Filtering by view keeps each pane in sync with its
|
|
23
|
+
* `drawArea(area, z)` call.
|
|
24
|
+
*/
|
|
25
|
+
export declare class DiffHighlightOverlay implements SceneOverlay {
|
|
26
|
+
private readonly highlights;
|
|
27
|
+
private ctx?;
|
|
28
|
+
private area;
|
|
29
|
+
private z;
|
|
30
|
+
private enabled;
|
|
31
|
+
private hoverKey;
|
|
32
|
+
constructor(highlights: DiffHighlight[]);
|
|
33
|
+
attach(ctx: SceneOverlayContext): void;
|
|
34
|
+
detach(): void;
|
|
35
|
+
setView(area: number, z: number): void;
|
|
36
|
+
setEnabled(enabled: boolean): void;
|
|
37
|
+
setHoverKey(key: string | null): void;
|
|
38
|
+
render(): Shape | Shape[] | void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Build the highlight list for one side of the diff.
|
|
42
|
+
*
|
|
43
|
+
* @param diff the computed diff (v1 = old / left, v2 = new / right)
|
|
44
|
+
* @param map the map shown on this side (used to resolve coords of changed rooms/labels)
|
|
45
|
+
* @param side 'old' shows deletions + changes, 'new' shows additions + changes
|
|
46
|
+
* @param roomSize renderer room size (world units)
|
|
47
|
+
*/
|
|
48
|
+
export declare function collectHighlights(diff: MapDiff, map: MudletMap, side: 'old' | 'new', roomSize: number): DiffHighlight[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { MapRenderer } from 'mudlet-map-renderer';
|
|
2
|
+
import type { MudletMap } from '../../mapIO';
|
|
3
|
+
import { EditorMapReader } from '../reader/EditorMapReader';
|
|
4
|
+
import { DiffHighlightOverlay } from './DiffHighlightOverlay';
|
|
5
|
+
import type { MapDiff } from './mapDiff';
|
|
6
|
+
export interface DiffPane {
|
|
7
|
+
renderer: MapRenderer;
|
|
8
|
+
reader: EditorMapReader;
|
|
9
|
+
overlay: DiffHighlightOverlay;
|
|
10
|
+
setView(areaId: number, z: number): void;
|
|
11
|
+
/** Show or hide the diff highlight tints. */
|
|
12
|
+
setHighlightsEnabled(enabled: boolean): void;
|
|
13
|
+
/** Emphasize a single change by its key (or clear with null). */
|
|
14
|
+
setHover(key: string | null): void;
|
|
15
|
+
/** Pan to a map-space room/point (raw Mudlet coords; Y is flipped internally). */
|
|
16
|
+
panToRoom(rawX: number, rawY: number): void;
|
|
17
|
+
destroy(): void;
|
|
18
|
+
}
|
|
19
|
+
/** A bare, read-only renderer pane for one side of a map diff. */
|
|
20
|
+
export declare function createDiffPane(map: MudletMap, container: HTMLDivElement, diff: MapDiff, side: 'old' | 'new'): DiffPane;
|
|
21
|
+
/** Copy zoom + center from one pane to another (programmatic; emits no events). */
|
|
22
|
+
export declare function alignCamera(from: DiffPane, to: DiffPane): void;
|
|
23
|
+
/**
|
|
24
|
+
* Mirror pan/zoom between two panes. Returns an unsubscribe function.
|
|
25
|
+
* Reentrancy is guarded so a mirrored move does not echo back.
|
|
26
|
+
*/
|
|
27
|
+
export declare function linkCameras(a: DiffPane, b: DiffPane): () => void;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { MudletMap, MudletRoom } from '../../mapIO';
|
|
2
|
+
import type { MudletLabel, MudletArea } from 'mudlet-map-binary-reader';
|
|
3
|
+
export interface PropertyChange {
|
|
4
|
+
from: any;
|
|
5
|
+
to: any;
|
|
6
|
+
}
|
|
7
|
+
export type PropertyDiff = Record<string, PropertyChange>;
|
|
8
|
+
export interface EntityDiff<T> {
|
|
9
|
+
added: T[];
|
|
10
|
+
deleted: T[];
|
|
11
|
+
updated: Record<string, PropertyDiff>;
|
|
12
|
+
}
|
|
13
|
+
export interface MapDiff {
|
|
14
|
+
rooms: EntityDiff<MudletRoom & {
|
|
15
|
+
id: number;
|
|
16
|
+
}>;
|
|
17
|
+
labels: EntityDiff<MudletLabel & {
|
|
18
|
+
areaId: number;
|
|
19
|
+
}>;
|
|
20
|
+
areas: EntityDiff<MudletArea & {
|
|
21
|
+
id: number;
|
|
22
|
+
}>;
|
|
23
|
+
map: PropertyDiff;
|
|
24
|
+
}
|
|
25
|
+
export declare function getPropertyDiff(obj1: unknown, obj2: unknown): PropertyDiff;
|
|
26
|
+
/** Compute a structural diff between two in-memory maps (v1 = old, v2 = new). */
|
|
27
|
+
export declare function computeMapDiff(v1: MudletMap, v2: MudletMap): MapDiff;
|
|
28
|
+
export interface DiffCounts {
|
|
29
|
+
rooms: {
|
|
30
|
+
added: number;
|
|
31
|
+
deleted: number;
|
|
32
|
+
updated: number;
|
|
33
|
+
};
|
|
34
|
+
labels: {
|
|
35
|
+
added: number;
|
|
36
|
+
deleted: number;
|
|
37
|
+
updated: number;
|
|
38
|
+
};
|
|
39
|
+
areas: {
|
|
40
|
+
added: number;
|
|
41
|
+
deleted: number;
|
|
42
|
+
updated: number;
|
|
43
|
+
};
|
|
44
|
+
map: number;
|
|
45
|
+
total: number;
|
|
46
|
+
}
|
|
47
|
+
export declare function countDiff(diff: MapDiff): DiffCounts;
|
|
@@ -13,6 +13,8 @@ export declare const en: {
|
|
|
13
13
|
readonly fit: "Fit";
|
|
14
14
|
readonly search: "Search";
|
|
15
15
|
readonly searchTitle: "Search rooms and labels ({{modKey}}+F)";
|
|
16
|
+
readonly diff: "Diff";
|
|
17
|
+
readonly diffTitle: "Compare this map with another file";
|
|
16
18
|
readonly rendererSettings: "Renderer settings";
|
|
17
19
|
readonly helpTitle: "Help (keyboard shortcuts)";
|
|
18
20
|
readonly snapTitle: "Snap to grid (G)";
|
|
@@ -29,6 +29,22 @@ export declare const modalsEn: {
|
|
|
29
29
|
readonly load: "Load";
|
|
30
30
|
readonly corsNote: "The server must allow cross-origin requests (CORS). If loading fails, download the file and use \"Load .dat\" instead.";
|
|
31
31
|
};
|
|
32
|
+
readonly diff: {
|
|
33
|
+
readonly title: "Changes this session";
|
|
34
|
+
readonly sessionStart: "Session start";
|
|
35
|
+
readonly now: "Now";
|
|
36
|
+
readonly computing: "Computing diff…";
|
|
37
|
+
readonly noChanges: "No changes this session";
|
|
38
|
+
readonly highlights: "Highlight changes";
|
|
39
|
+
readonly area: "Area";
|
|
40
|
+
readonly level: "Level";
|
|
41
|
+
readonly rooms: "Rooms";
|
|
42
|
+
readonly labels: "Labels";
|
|
43
|
+
readonly areas: "Areas";
|
|
44
|
+
readonly label: "Label";
|
|
45
|
+
readonly mapProps: "Map properties";
|
|
46
|
+
readonly dragHint: "Drag to resize";
|
|
47
|
+
};
|
|
32
48
|
};
|
|
33
49
|
export type ModalsLocale = {
|
|
34
50
|
[K in keyof typeof modalsEn]: {
|