mudlet-map-renderer 2.4.0 → 2.5.1
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/binary/BinaryMapReader.d.ts +4 -2
- package/dist/binary.mjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -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
|
-
*
|
|
27
|
-
*
|
|
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;
|
package/dist/binary.mjs.map
CHANGED
|
@@ -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 *
|
|
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"}
|
package/dist/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ var ve = Object.create, ye = Object.defineProperty, be = Object.getOwnPropertyDe
|
|
|
11
11
|
}, Te = (e, t, n) => (n = e == null ? {} : ve(Se(e)), we(t || !e || !e.__esModule ? ye(n, "default", {
|
|
12
12
|
value: e,
|
|
13
13
|
enumerable: !0
|
|
14
|
-
}) : n, e)), Ee = .6, De = .025, Oe = "rgb(225,
|
|
14
|
+
}) : n, e)), Ee = .6, De = .025, Oe = "rgb(225, 225, 225)";
|
|
15
15
|
function ke() {
|
|
16
16
|
return {
|
|
17
17
|
roomSize: Ee,
|