mudlet-map-renderer 2.3.1 → 2.5.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.
@@ -5,6 +5,7 @@ import { Settings } from './types/Settings';
5
5
  import { default as ExitRenderer, ExitDrawData } from './ExitRenderer';
6
6
  import { GroupShape, Shape } from './scene/Shape';
7
7
  import { RoomLens } from './lens/RoomLens';
8
+ import { NeighborSpill } from './scene/NeighborProjector';
8
9
  type Bounds = {
9
10
  x: number;
10
11
  y: number;
@@ -186,6 +187,7 @@ export declare class ScenePipeline {
186
187
  private specialExitShapeRefs;
187
188
  private stubShapeRefs;
188
189
  private areaExitLabelShapeRefs;
190
+ private spilledRoomIds;
189
191
  constructor(mapReader: IMapReader, settings: Settings);
190
192
  /**
191
193
  * Build the full scene for an area/plane.
@@ -195,7 +197,7 @@ export declare class ScenePipeline {
195
197
  * The `lens` filters which rooms paint and how partially-visible exits are
196
198
  * treated. Pass {@link ALL_VISIBLE} (or omit) for an unfiltered build.
197
199
  */
198
- buildScene(area: IArea, plane: IPlane, zIndex: number, lens?: RoomLens): SceneBuildResult;
200
+ buildScene(area: IArea, plane: IPlane, zIndex: number, lens?: RoomLens, spill?: NeighborSpill): SceneBuildResult;
199
201
  getEffectiveBounds(area: IArea, plane: IPlane): {
200
202
  minX: number;
201
203
  maxX: number;
@@ -203,6 +205,13 @@ export declare class ScenePipeline {
203
205
  maxY: number;
204
206
  };
205
207
  private renderRooms;
208
+ /**
209
+ * Draw plain connector lines for the spill's regular/special exits (the room
210
+ * bodies, custom lines, stubs and inner exits are rendered through the normal
211
+ * room pass via {@link projectRoom} clones). Lines go on the link layer so
212
+ * they sit under the rooms, like ordinary exits.
213
+ */
214
+ private renderSpillConnectors;
206
215
  private renderLinkExits;
207
216
  /**
208
217
  * Build a stub anchored at the visible endpoint of an exit, pointing
@@ -23,8 +23,10 @@ export default class BinaryMapReader implements IMapReader {
23
23
  constructor(model: MudletMap);
24
24
  /**
25
25
  * Parse the given binary map buffer and construct a reader from it.
26
- * In Node, pass `fs.readFileSync(path)`; in the browser, construct a
27
- * `Buffer` from an `ArrayBuffer` (e.g. via the `buffer` polyfill).
26
+ * Accepts any `Uint8Array`: in Node pass `fs.readFileSync(path)`; in the
27
+ * browser pass `new Uint8Array(await file.arrayBuffer())`. The underlying
28
+ * `mudlet-map-binary-reader` (>=1.0.0) is browser-safe and needs no
29
+ * Node `Buffer` polyfill.
28
30
  */
29
31
  static fromBuffer(buf: Parameters<typeof readMapFromBuffer>[0]): BinaryMapReader;
30
32
  getArea(areaId: number): IArea;
@@ -1 +1 @@
1
- {"version":3,"file":"binary.mjs","names":[],"sources":["../src/binary/BinaryMapReader.ts"],"sourcesContent":["import {\n type MudletMap,\n readerExport,\n readMapFromBuffer,\n} from \"mudlet-map-binary-reader\";\nimport MapReader, {type IMapReader} from \"../reader/MapReader\";\nimport type {IArea} from \"../reader/Area\";\n\n/**\n * {@link IMapReader} implementation backed by a parsed Mudlet binary map.\n *\n * Convenience wrapper around the existing {@link MapReader} that converts a\n * {@link MudletMap} (the in-memory binary model from\n * `mudlet-map-binary-reader`) into the renderer's `{mapData, colors}` shape\n * via `readerExport()`, then forwards every `IMapReader` call to the wrapped\n * reader.\n *\n * Useful for downstream apps (the upstream Mudix client is one) that already\n * own binary `.dat` bytes and want a single object they can hand to\n * {@link MapRenderer} without staging a separate JSON export step.\n *\n * `mudlet-map-binary-reader` is a `peerDependency`; consumers who do not use\n * binary maps never pay the bundle cost.\n */\nexport default class BinaryMapReader implements IMapReader {\n private readonly reader: MapReader;\n\n /** Build directly from a parsed {@link MudletMap}. */\n constructor(model: MudletMap) {\n const {mapData, colors} = readerExport(model);\n // RendererRoom (binary-reader output) and MapData.Room (renderer\n // input) overlap structurally — RendererRoom is missing only\n // `areaId`, which the renderer never reads from rooms (only from\n // the area). Cast through `unknown` to bridge the nominal gap.\n this.reader = new MapReader(mapData as unknown as MapData.Map, colors);\n }\n\n /**\n * Parse the given binary map buffer and construct a reader from it.\n * In Node, pass `fs.readFileSync(path)`; in the browser, construct a\n * `Buffer` from an `ArrayBuffer` (e.g. via the `buffer` polyfill).\n */\n static fromBuffer(buf: Parameters<typeof readMapFromBuffer>[0]): BinaryMapReader {\n return new BinaryMapReader(readMapFromBuffer(buf));\n }\n\n // --- IMapReader forwarding ---\n\n getArea(areaId: number): IArea {\n return this.reader.getArea(areaId);\n }\n\n getAreas(): IArea[] {\n return this.reader.getAreas();\n }\n\n getRooms(): MapData.Room[] {\n return this.reader.getRooms();\n }\n\n getRoom(roomId: number): MapData.Room {\n return this.reader.getRoom(roomId);\n }\n\n getColorValue(envId: number): string {\n return this.reader.getColorValue(envId);\n }\n\n getSymbolColor(envId: number, opacity?: number): string {\n return this.reader.getSymbolColor(envId, opacity);\n }\n}\n"],"mappings":";;;AAwBA,IAAqB,IAArB,MAAqB,EAAsC;CAIvD,YAAY,GAAkB;EAC1B,IAAM,EAAC,YAAS,cAAU,EAAa,EAAM;AAK7C,OAAK,SAAS,IAAI,EAAU,GAAmC,EAAO;;CAQ1E,OAAO,WAAW,GAA+D;AAC7E,SAAO,IAAI,EAAgB,EAAkB,EAAI,CAAC;;CAKtD,QAAQ,GAAuB;AAC3B,SAAO,KAAK,OAAO,QAAQ,EAAO;;CAGtC,WAAoB;AAChB,SAAO,KAAK,OAAO,UAAU;;CAGjC,WAA2B;AACvB,SAAO,KAAK,OAAO,UAAU;;CAGjC,QAAQ,GAA8B;AAClC,SAAO,KAAK,OAAO,QAAQ,EAAO;;CAGtC,cAAc,GAAuB;AACjC,SAAO,KAAK,OAAO,cAAc,EAAM;;CAG3C,eAAe,GAAe,GAA0B;AACpD,SAAO,KAAK,OAAO,eAAe,GAAO,EAAQ"}
1
+ {"version":3,"file":"binary.mjs","names":[],"sources":["../src/binary/BinaryMapReader.ts"],"sourcesContent":["import {\n type MudletMap,\n readerExport,\n readMapFromBuffer,\n} from \"mudlet-map-binary-reader\";\nimport MapReader, {type IMapReader} from \"../reader/MapReader\";\nimport type {IArea} from \"../reader/Area\";\n\n/**\n * {@link IMapReader} implementation backed by a parsed Mudlet binary map.\n *\n * Convenience wrapper around the existing {@link MapReader} that converts a\n * {@link MudletMap} (the in-memory binary model from\n * `mudlet-map-binary-reader`) into the renderer's `{mapData, colors}` shape\n * via `readerExport()`, then forwards every `IMapReader` call to the wrapped\n * reader.\n *\n * Useful for downstream apps (the upstream Mudix client is one) that already\n * own binary `.dat` bytes and want a single object they can hand to\n * {@link MapRenderer} without staging a separate JSON export step.\n *\n * `mudlet-map-binary-reader` is a `peerDependency`; consumers who do not use\n * binary maps never pay the bundle cost.\n */\nexport default class BinaryMapReader implements IMapReader {\n private readonly reader: MapReader;\n\n /** Build directly from a parsed {@link MudletMap}. */\n constructor(model: MudletMap) {\n const {mapData, colors} = readerExport(model);\n // RendererRoom (binary-reader output) and MapData.Room (renderer\n // input) overlap structurally — RendererRoom is missing only\n // `areaId`, which the renderer never reads from rooms (only from\n // the area). Cast through `unknown` to bridge the nominal gap.\n this.reader = new MapReader(mapData as unknown as MapData.Map, colors);\n }\n\n /**\n * Parse the given binary map buffer and construct a reader from it.\n * Accepts any `Uint8Array`: in Node pass `fs.readFileSync(path)`; in the\n * browser pass `new Uint8Array(await file.arrayBuffer())`. The underlying\n * `mudlet-map-binary-reader` (>=1.0.0) is browser-safe and needs no\n * Node `Buffer` polyfill.\n */\n static fromBuffer(buf: Parameters<typeof readMapFromBuffer>[0]): BinaryMapReader {\n return new BinaryMapReader(readMapFromBuffer(buf));\n }\n\n // --- IMapReader forwarding ---\n\n getArea(areaId: number): IArea {\n return this.reader.getArea(areaId);\n }\n\n getAreas(): IArea[] {\n return this.reader.getAreas();\n }\n\n getRooms(): MapData.Room[] {\n return this.reader.getRooms();\n }\n\n getRoom(roomId: number): MapData.Room {\n return this.reader.getRoom(roomId);\n }\n\n getColorValue(envId: number): string {\n return this.reader.getColorValue(envId);\n }\n\n getSymbolColor(envId: number, opacity?: number): string {\n return this.reader.getSymbolColor(envId, opacity);\n }\n}\n"],"mappings":";;;AAwBA,IAAqB,IAArB,MAAqB,EAAsC;CAIvD,YAAY,GAAkB;EAC1B,IAAM,EAAC,YAAS,cAAU,EAAa,EAAM;AAK7C,OAAK,SAAS,IAAI,EAAU,GAAmC,EAAO;;CAU1E,OAAO,WAAW,GAA+D;AAC7E,SAAO,IAAI,EAAgB,EAAkB,EAAI,CAAC;;CAKtD,QAAQ,GAAuB;AAC3B,SAAO,KAAK,OAAO,QAAQ,EAAO;;CAGtC,WAAoB;AAChB,SAAO,KAAK,OAAO,UAAU;;CAGjC,WAA2B;AACvB,SAAO,KAAK,OAAO,UAAU;;CAGjC,QAAQ,GAA8B;AAClC,SAAO,KAAK,OAAO,QAAQ,EAAO;;CAGtC,cAAc,GAAuB;AACjC,SAAO,KAAK,OAAO,cAAc,EAAM;;CAG3C,eAAe,GAAe,GAA0B;AACpD,SAAO,KAAK,OAAO,eAAe,GAAO,EAAQ"}