mudlet-map-editor 0.12.0 → 0.14.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/README.md +6 -0
- package/dist-lib/components/RendererSettingsModal.d.ts +22 -0
- package/dist-lib/components/Toolbar.d.ts +2 -1
- package/dist-lib/editor/effects/ConnectHandlesEffect.d.ts +5 -2
- package/dist-lib/editor/effects/GhostRoomsEffect.d.ts +4 -2
- package/dist-lib/editor/effects/HoverHaloEffect.d.ts +5 -2
- package/dist-lib/editor/effects/SelectedLinkEffect.d.ts +3 -1
- package/dist-lib/editor/effects/SelectionHaloEffect.d.ts +4 -2
- package/dist-lib/editor/effects/SnapIndicatorEffect.d.ts +5 -2
- package/dist-lib/editor/plugin.d.ts +16 -0
- package/dist-lib/editor/warnings.d.ts +7 -0
- package/dist-lib/index.d.ts +1 -1
- package/dist-lib/index.js +1383 -1005
- package/dist-lib/styles.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,6 +58,12 @@ npm run build # Type-check and bundle for production
|
|
|
58
58
|
npm run preview # Preview the production build
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
+
## Extending with plugins
|
|
62
|
+
|
|
63
|
+
Drop a file at `src/plugins/<name>/index.ts` with a default export implementing `EditorPlugin` and it is picked up automatically at build time. Plugins can add sidebar tabs, room panel sections, swatch presets, map check warnings, and lifecycle hooks (map open/close/save, app ready, custom overlay UI).
|
|
64
|
+
|
|
65
|
+
See [docs/plugins.md](docs/plugins.md) for the full interface reference and examples.
|
|
66
|
+
|
|
61
67
|
## Tech Stack
|
|
62
68
|
|
|
63
69
|
- **React 19** + **TypeScript**
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import type { SceneHandle } from '../editor/scene';
|
|
3
|
+
type RoomShape = 'rectangle' | 'circle' | 'roundedRectangle';
|
|
4
|
+
export type PersistedRendererSettings = {
|
|
5
|
+
roomShape: RoomShape;
|
|
6
|
+
roomSize: number;
|
|
7
|
+
lineWidth: number;
|
|
8
|
+
lineColor: string;
|
|
9
|
+
borders: boolean;
|
|
10
|
+
frameMode: boolean;
|
|
11
|
+
coloredMode: boolean;
|
|
12
|
+
emboss: boolean;
|
|
13
|
+
backgroundColor: string;
|
|
14
|
+
areaName: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function loadRendererSettings(): Partial<PersistedRendererSettings>;
|
|
17
|
+
export declare function applyRendererSettings(scene: SceneHandle, settings: Partial<PersistedRendererSettings>): void;
|
|
18
|
+
export declare function RendererSettingsModal({ onClose, sceneRef, }: {
|
|
19
|
+
onClose: () => void;
|
|
20
|
+
sceneRef: RefObject<SceneHandle | null>;
|
|
21
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export declare function Toolbar({ title, onHelpClick, onLoadFromUrl, onSave, onSearchClick }: {
|
|
1
|
+
export declare function Toolbar({ title, onHelpClick, onLoadFromUrl, onSave, onSearchClick, onSettingsClick }: {
|
|
2
2
|
title?: string;
|
|
3
3
|
onHelpClick: () => void;
|
|
4
4
|
onLoadFromUrl: () => void;
|
|
5
5
|
onSave?: (bytes: Uint8Array) => void;
|
|
6
6
|
onSearchClick?: () => void;
|
|
7
|
+
onSettingsClick?: () => void;
|
|
7
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,17 +2,20 @@ import Konva from 'konva';
|
|
|
2
2
|
import type { CoordinateTransform, LiveEffect, ViewportBounds } from 'mudlet-map-renderer';
|
|
3
3
|
import type { SceneHandle } from '../scene';
|
|
4
4
|
export declare class ConnectHandlesEffect implements LiveEffect {
|
|
5
|
-
private readonly
|
|
5
|
+
private readonly settings;
|
|
6
6
|
private readonly sceneRef;
|
|
7
7
|
private source?;
|
|
8
8
|
private target?;
|
|
9
9
|
private layer?;
|
|
10
10
|
private unsubscribe?;
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(settings: {
|
|
12
|
+
roomSize: number;
|
|
13
|
+
}, sceneRef: {
|
|
12
14
|
current: SceneHandle | null;
|
|
13
15
|
});
|
|
14
16
|
attach(layer: Konva.Layer): void;
|
|
15
17
|
updateViewport(_bounds: ViewportBounds, scale: number, _transform: CoordinateTransform): void;
|
|
18
|
+
syncPositions(): void;
|
|
16
19
|
destroy(): void;
|
|
17
20
|
private buildHandleSet;
|
|
18
21
|
private placeHandles;
|
|
@@ -2,14 +2,16 @@ import Konva from 'konva';
|
|
|
2
2
|
import type { CoordinateTransform, LiveEffect, ViewportBounds } from 'mudlet-map-renderer';
|
|
3
3
|
import type { SceneHandle } from '../scene';
|
|
4
4
|
export declare class GhostRoomsEffect implements LiveEffect {
|
|
5
|
-
private readonly
|
|
5
|
+
private readonly settings;
|
|
6
6
|
private readonly sceneRef;
|
|
7
7
|
private rects;
|
|
8
8
|
private layer?;
|
|
9
9
|
private unsubscribe?;
|
|
10
10
|
private strokeWidth;
|
|
11
11
|
private dash;
|
|
12
|
-
constructor(
|
|
12
|
+
constructor(settings: {
|
|
13
|
+
roomSize: number;
|
|
14
|
+
}, sceneRef: {
|
|
13
15
|
current: SceneHandle | null;
|
|
14
16
|
});
|
|
15
17
|
attach(layer: Konva.Layer): void;
|
|
@@ -2,18 +2,21 @@ import Konva from 'konva';
|
|
|
2
2
|
import type { CoordinateTransform, LiveEffect, ViewportBounds } from 'mudlet-map-renderer';
|
|
3
3
|
import type { SceneHandle } from '../scene';
|
|
4
4
|
export declare class HoverHaloEffect implements LiveEffect {
|
|
5
|
-
private readonly
|
|
5
|
+
private readonly settings;
|
|
6
6
|
private readonly sceneRef;
|
|
7
7
|
private roomRect?;
|
|
8
8
|
private linkGroup?;
|
|
9
9
|
private layer?;
|
|
10
10
|
private unsubscribe?;
|
|
11
11
|
private currentScale;
|
|
12
|
-
constructor(
|
|
12
|
+
constructor(settings: {
|
|
13
|
+
roomSize: number;
|
|
14
|
+
}, sceneRef: {
|
|
13
15
|
current: SceneHandle | null;
|
|
14
16
|
});
|
|
15
17
|
attach(layer: Konva.Layer): void;
|
|
16
18
|
updateViewport(_bounds: ViewportBounds, scale: number, _transform: CoordinateTransform): void;
|
|
19
|
+
syncPositions(): void;
|
|
17
20
|
destroy(): void;
|
|
18
21
|
private sync;
|
|
19
22
|
}
|
|
@@ -9,7 +9,9 @@ export declare class SelectedLinkEffect implements LiveEffect {
|
|
|
9
9
|
private unsubscribe?;
|
|
10
10
|
constructor(sceneRef: {
|
|
11
11
|
current: SceneHandle | null;
|
|
12
|
-
},
|
|
12
|
+
}, _settings: {
|
|
13
|
+
roomSize: number;
|
|
14
|
+
});
|
|
13
15
|
attach(layer: Konva.Layer): void;
|
|
14
16
|
updateViewport(_bounds: ViewportBounds, scale: number, _transform: CoordinateTransform): void;
|
|
15
17
|
destroy(): void;
|
|
@@ -2,14 +2,16 @@ import Konva from 'konva';
|
|
|
2
2
|
import type { CoordinateTransform, LiveEffect, ViewportBounds } from 'mudlet-map-renderer';
|
|
3
3
|
import type { SceneHandle } from '../scene';
|
|
4
4
|
export declare class SelectionHaloEffect implements LiveEffect {
|
|
5
|
-
private readonly
|
|
5
|
+
private readonly settings;
|
|
6
6
|
private readonly sceneRef;
|
|
7
7
|
private rects;
|
|
8
8
|
private layer?;
|
|
9
9
|
private unsubscribe?;
|
|
10
10
|
private strokeWidth;
|
|
11
11
|
private dash;
|
|
12
|
-
constructor(
|
|
12
|
+
constructor(settings: {
|
|
13
|
+
roomSize: number;
|
|
14
|
+
}, sceneRef: {
|
|
13
15
|
current: SceneHandle | null;
|
|
14
16
|
});
|
|
15
17
|
attach(layer: Konva.Layer): void;
|
|
@@ -2,13 +2,16 @@ import Konva from 'konva';
|
|
|
2
2
|
import type { CoordinateTransform, LiveEffect, ViewportBounds } from 'mudlet-map-renderer';
|
|
3
3
|
/** Room silhouette preview at the snapped cell — used for Add Room. */
|
|
4
4
|
export declare class SnapIndicatorEffect implements LiveEffect {
|
|
5
|
-
private readonly
|
|
5
|
+
private readonly settings;
|
|
6
6
|
private rect?;
|
|
7
7
|
private layer?;
|
|
8
8
|
private unsubscribe?;
|
|
9
|
-
constructor(
|
|
9
|
+
constructor(settings: {
|
|
10
|
+
roomSize: number;
|
|
11
|
+
});
|
|
10
12
|
attach(layer: Konva.Layer): void;
|
|
11
13
|
updateViewport(_bounds: ViewportBounds, scale: number, _transform: CoordinateTransform): void;
|
|
14
|
+
syncPositions(): void;
|
|
12
15
|
destroy(): void;
|
|
13
16
|
private sync;
|
|
14
17
|
}
|
|
@@ -2,6 +2,16 @@ import type { ReactNode } from 'react';
|
|
|
2
2
|
import type { MudletMap, MudletRoom } from '../mapIO';
|
|
3
3
|
import type { SwatchSet } from './types';
|
|
4
4
|
import type { SceneHandle } from './scene';
|
|
5
|
+
export interface PluginCheckResult {
|
|
6
|
+
/** Stable identifier for this warning instance; used to namespace ack keys. */
|
|
7
|
+
id: string;
|
|
8
|
+
/** Bold title shown in the warnings list. */
|
|
9
|
+
message: string;
|
|
10
|
+
/** Optional secondary description. */
|
|
11
|
+
detail?: string;
|
|
12
|
+
/** If set, the "Go" button navigates to this room. */
|
|
13
|
+
roomId?: number;
|
|
14
|
+
}
|
|
5
15
|
export interface SidebarTab {
|
|
6
16
|
id: string;
|
|
7
17
|
label: string;
|
|
@@ -22,6 +32,8 @@ export interface RoomPanelSection {
|
|
|
22
32
|
render(props: RoomSectionProps): ReactNode;
|
|
23
33
|
}
|
|
24
34
|
export interface EditorPlugin {
|
|
35
|
+
/** Stable identifier used to namespace plugin warning ack keys. Defaults to array index if omitted. */
|
|
36
|
+
id?: string;
|
|
25
37
|
onAppReady?(): Promise<void>;
|
|
26
38
|
onMapOpened?(map: MudletMap): void;
|
|
27
39
|
onMapClosed?(): void;
|
|
@@ -31,4 +43,8 @@ export interface EditorPlugin {
|
|
|
31
43
|
swatchSets?(): SwatchSet[];
|
|
32
44
|
/** Contribute additional sections rendered at the bottom of the room selection panel. */
|
|
33
45
|
roomPanelSections?(): RoomPanelSection[];
|
|
46
|
+
/** Return custom map warnings. Called whenever built-in warnings are recomputed. */
|
|
47
|
+
mapChecks?(map: MudletMap, sceneRef: {
|
|
48
|
+
current: SceneHandle | null;
|
|
49
|
+
}): PluginCheckResult[];
|
|
34
50
|
}
|
|
@@ -37,6 +37,13 @@ export type MapWarning = {
|
|
|
37
37
|
dir: string;
|
|
38
38
|
targetId: number;
|
|
39
39
|
areaName: string;
|
|
40
|
+
} | {
|
|
41
|
+
kind: 'plugin';
|
|
42
|
+
pluginId: string;
|
|
43
|
+
id: string;
|
|
44
|
+
message: string;
|
|
45
|
+
detail?: string;
|
|
46
|
+
roomId?: number;
|
|
40
47
|
};
|
|
41
48
|
export declare function warningKey(w: MapWarning): string;
|
|
42
49
|
export declare function collectWarnings(sceneRef: {
|
package/dist-lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './styles.css';
|
|
2
2
|
export { default as App } from './App';
|
|
3
|
-
export type { EditorPlugin, SidebarTab, RoomPanelSection, RoomSectionProps } from './editor/plugin';
|
|
3
|
+
export type { EditorPlugin, SidebarTab, RoomPanelSection, RoomSectionProps, PluginCheckResult } from './editor/plugin';
|
|
4
4
|
export type { SwatchSet, Swatch } from './editor/types';
|
|
5
5
|
export { loadUrlIntoStore } from './editor/loadFile';
|
|
6
6
|
export { getMapBytes } from './editor/mapBytes';
|