@rpgjs/tiledmap 5.0.0-beta.1 → 5.0.0-beta.3

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/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2026 by Samuel Ronce
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -1,53 +1,39 @@
1
- import client from "./index2.js";
1
+ import { TiledParser } from "./index2.js";
2
+ import { prepareTiledPhysicsData } from "./index3.js";
3
+ import client_default from "./index4.js";
4
+ import component from "./index5.js";
2
5
  import { createModule } from "@rpgjs/common";
3
6
  import { provideLoadMap } from "@rpgjs/client";
4
- import { TiledParser } from "./index3.js";
5
- import component from "./index4.js";
6
- import { prepareTiledPhysicsData } from "./index5.js";
7
- const server = null;
7
+ //#region src/index.ts
8
+ var server = null;
8
9
  function provideTiledMap(options) {
9
- return createModule("TiledMap", [
10
- {
11
- server,
12
- client
13
- },
14
- provideLoadMap?.(async (map) => {
15
- const response = await fetch(`${options.basePath}/${map}.tmx`);
16
- const mapData = await response.text();
17
- const parser = new TiledParser(mapData);
18
- const parsedMap = parser.parseMap();
19
- const tilesets = [];
20
- for (let tileset of parsedMap.tilesets) {
21
- const response2 = await fetch(`${options.basePath}/${tileset.source}`);
22
- const tilesetData = await response2.text();
23
- const parser2 = new TiledParser(tilesetData);
24
- const parsedTileset = parser2.parseTileset();
25
- parsedTileset.image.source = `${options.basePath}/${parsedTileset.image.source}`;
26
- tilesets.push({
27
- ...tileset,
28
- // Preserve original properties including firstgid
29
- ...parsedTileset
30
- // Merge with parsed tileset data
31
- });
32
- }
33
- parsedMap.tilesets = tilesets;
34
- const obj = {
35
- data: mapData,
36
- component,
37
- parsedMap,
38
- id: map,
39
- params: {
40
- basePath: options.basePath
41
- }
42
- };
43
- prepareTiledPhysicsData(obj, obj);
44
- if (options.onLoadMap) {
45
- await options.onLoadMap(map);
46
- }
47
- return obj;
48
- })
49
- ]);
10
+ return createModule("TiledMap", [{
11
+ server,
12
+ client: client_default
13
+ }, provideLoadMap?.(async (map) => {
14
+ const mapData = await (await fetch(`${options.basePath}/${map}.tmx`)).text();
15
+ const parsedMap = new TiledParser(mapData).parseMap();
16
+ const tilesets = [];
17
+ for (let tileset of parsedMap.tilesets) {
18
+ const parsedTileset = new TiledParser(await (await fetch(`${options.basePath}/${tileset.source}`)).text()).parseTileset();
19
+ parsedTileset.image.source = `${options.basePath}/${parsedTileset.image.source}`;
20
+ tilesets.push({
21
+ ...tileset,
22
+ ...parsedTileset
23
+ });
24
+ }
25
+ parsedMap.tilesets = tilesets;
26
+ const obj = {
27
+ data: mapData,
28
+ component,
29
+ parsedMap,
30
+ id: map,
31
+ params: { basePath: options.basePath }
32
+ };
33
+ prepareTiledPhysicsData(obj, obj);
34
+ if (options.onLoadMap) await options.onLoadMap(map);
35
+ return obj;
36
+ })]);
50
37
  }
51
- export {
52
- provideTiledMap
53
- };
38
+ //#endregion
39
+ export { provideTiledMap };