@rpgjs/tiledmap 5.0.0-alpha.18 → 5.0.0-alpha.19

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,13 +5,12 @@ import { TiledParser } from "./index3.js";
5
5
  import component from "./index4.js";
6
6
  const server = null;
7
7
  function provideTiledMap(options) {
8
- var _a;
9
8
  return createModule("TiledMap", [
10
9
  {
11
10
  server,
12
11
  client
13
12
  },
14
- (_a = provideLoadMap) == null ? void 0 : _a(async (map) => {
13
+ provideLoadMap?.(async (map) => {
15
14
  const response = await fetch(`${options.basePath}/${map}.tmx`);
16
15
  const mapData = await response.text();
17
16
  const parser = new TiledParser(mapData);
@@ -135,7 +135,6 @@ function requireBase64Js() {
135
135
  return base64Js;
136
136
  }
137
137
  var ieee754 = {};
138
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
139
138
  var hasRequiredIeee754;
140
139
  function requireIeee754() {
141
140
  if (hasRequiredIeee754) return ieee754;
@@ -219,12 +218,6 @@ function requireIeee754() {
219
218
  };
220
219
  return ieee754;
221
220
  }
222
- /*!
223
- * The buffer module from node.js, for the browser.
224
- *
225
- * @author Feross Aboukhadijeh <https://feross.org>
226
- * @license MIT
227
- */
228
221
  var hasRequiredBuffer;
229
222
  function requireBuffer() {
230
223
  if (hasRequiredBuffer) return buffer;
@@ -1816,7 +1809,6 @@ function requireBuffer() {
1816
1809
  })(buffer);
1817
1810
  return buffer;
1818
1811
  }
1819
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
1820
1812
  var hasRequiredSafeBuffer;
1821
1813
  function requireSafeBuffer() {
1822
1814
  if (hasRequiredSafeBuffer) return safeBuffer.exports;
@@ -3524,7 +3516,6 @@ function requireSax() {
3524
3516
  }
3525
3517
  return parser;
3526
3518
  }
3527
- /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */
3528
3519
  if (!String.fromCodePoint) {
3529
3520
  (function() {
3530
3521
  var stringFromCharCode = String.fromCharCode;
@@ -4378,7 +4369,6 @@ const _TiledParser = class _TiledParser {
4378
4369
  this.basePath = basePath;
4379
4370
  this.layers = /* @__PURE__ */ new Map();
4380
4371
  this.transform = (obj) => {
4381
- var _a, _b;
4382
4372
  if (!obj) return;
4383
4373
  const attr = obj.attributes || obj._attributes;
4384
4374
  if (!attr) return obj;
@@ -4452,7 +4442,7 @@ const _TiledParser = class _TiledParser {
4452
4442
  break;
4453
4443
  case "class":
4454
4444
  val = {
4455
- ...((_a = this.transform(prop)) == null ? void 0 : _a.properties) ?? {},
4445
+ ...this.transform(prop)?.properties ?? {},
4456
4446
  _classname: attr2.propertytype
4457
4447
  };
4458
4448
  break;
@@ -4496,7 +4486,7 @@ const _TiledParser = class _TiledParser {
4496
4486
  newObj.source = this.getImagePath(newObj.source);
4497
4487
  }
4498
4488
  }
4499
- const objectgroup = newObj.object || ((_b = newObj.objectgroup) == null ? void 0 : _b.object);
4489
+ const objectgroup = newObj.object || newObj.objectgroup?.object;
4500
4490
  if (objectgroup) {
4501
4491
  newObj.objects = _TiledParser.toArray(objectgroup).map((object) => {
4502
4492
  return this.transform(object);
@@ -4573,12 +4563,11 @@ const _TiledParser = class _TiledParser {
4573
4563
  };
4574
4564
  recursiveObjectGroup(json.map);
4575
4565
  const recursiveLayer = (elements, array = []) => {
4576
- var _a;
4577
4566
  if (!elements) return array;
4578
4567
  for (let element of elements) {
4579
4568
  const { name } = element;
4580
4569
  if (!["layer", "group", "imagelayer", "objectgroup"].includes(name)) continue;
4581
- const data = (_a = element.elements) == null ? void 0 : _a.find((el) => el.name == "data");
4570
+ const data = element.elements?.find((el) => el.name == "data");
4582
4571
  element.layer = this.layers.get(+element.attributes.id);
4583
4572
  const obj = {
4584
4573
  ...this.transform(data) ?? {},
@@ -9,7 +9,7 @@ function provideTiledMap(options) {
9
9
  server,
10
10
  client
11
11
  },
12
- provideLoadMap == null ? void 0 : provideLoadMap()
12
+ provideLoadMap?.()
13
13
  ]);
14
14
  }
15
15
  export {
@@ -95,11 +95,10 @@ const server = defineModule({
95
95
  }
96
96
  });
97
97
  function applyTileCollisionToEntity(owner, map) {
98
- var _a;
99
- if (!(owner == null ? void 0 : owner.id) || !(map == null ? void 0 : map._blockedTiles)) {
98
+ if (!owner?.id || !map?._blockedTiles) {
100
99
  return;
101
100
  }
102
- const entity = (_a = map.physic) == null ? void 0 : _a.getEntityByUUID(owner.id);
101
+ const entity = map.physic?.getEntityByUUID(owner.id);
103
102
  if (!entity) {
104
103
  return;
105
104
  }
@@ -119,7 +118,7 @@ function applyTileCollisionToEntity(owner, map) {
119
118
  });
120
119
  }
121
120
  function applyTileCollisionToEntities(map) {
122
- if (!(map == null ? void 0 : map._blockedTiles)) {
121
+ if (!map?._blockedTiles) {
123
122
  return;
124
123
  }
125
124
  if (map.players && typeof map.players === "function") {
@@ -139,7 +139,6 @@ function requireBase64Js() {
139
139
  return base64Js;
140
140
  }
141
141
  var ieee754 = {};
142
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
143
142
  var hasRequiredIeee754;
144
143
  function requireIeee754() {
145
144
  if (hasRequiredIeee754) return ieee754;
@@ -223,12 +222,6 @@ function requireIeee754() {
223
222
  };
224
223
  return ieee754;
225
224
  }
226
- /*!
227
- * The buffer module from node.js, for the browser.
228
- *
229
- * @author Feross Aboukhadijeh <https://feross.org>
230
- * @license MIT
231
- */
232
225
  var hasRequiredBuffer;
233
226
  function requireBuffer() {
234
227
  if (hasRequiredBuffer) return buffer;
@@ -1820,7 +1813,6 @@ function requireBuffer() {
1820
1813
  })(buffer);
1821
1814
  return buffer;
1822
1815
  }
1823
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
1824
1816
  var hasRequiredSafeBuffer;
1825
1817
  function requireSafeBuffer() {
1826
1818
  if (hasRequiredSafeBuffer) return safeBuffer.exports;
@@ -3528,7 +3520,6 @@ function requireSax() {
3528
3520
  }
3529
3521
  return parser;
3530
3522
  }
3531
- /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */
3532
3523
  if (!String.fromCodePoint) {
3533
3524
  (function() {
3534
3525
  var stringFromCharCode = String.fromCharCode;
@@ -4378,7 +4369,7 @@ requireBuffer();
4378
4369
  class TiledProperties {
4379
4370
  constructor(data) {
4380
4371
  this.properties = {};
4381
- this.properties = (data == null ? void 0 : data.properties) ?? {};
4372
+ this.properties = data?.properties ?? {};
4382
4373
  }
4383
4374
  getProperty(name, defaultValue) {
4384
4375
  const val = this.properties[name];
@@ -4405,7 +4396,7 @@ class TileGid extends TiledProperties {
4405
4396
  constructor(obj) {
4406
4397
  super(obj);
4407
4398
  this.obj = obj;
4408
- this._gid = obj == null ? void 0 : obj.gid;
4399
+ this._gid = obj?.gid;
4409
4400
  }
4410
4401
  static getRealGid(gid) {
4411
4402
  return gid & 268435455;
@@ -4446,7 +4437,7 @@ class TiledObjectClass extends TileGid {
4446
4437
  super(object);
4447
4438
  this.layerName = "";
4448
4439
  Object.assign(this, object);
4449
- if (object == null ? void 0 : object.gid) {
4440
+ if (object?.gid) {
4450
4441
  this.y -= this.height;
4451
4442
  }
4452
4443
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpgjs/tiledmap",
3
- "version": "5.0.0-alpha.18",
3
+ "version": "5.0.0-alpha.19",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -23,23 +23,23 @@
23
23
  "description": "RPGJS is a framework for creating RPG/MMORPG games",
24
24
  "peerDependencies": {
25
25
  "@canvasengine/presets": "^2.0.0-beta.33",
26
- "@rpgjs/client": "5.0.0-alpha.18",
27
- "@rpgjs/common": "5.0.0-alpha.18",
28
- "@rpgjs/server": "5.0.0-alpha.18",
29
- "@rpgjs/vite": "5.0.0-alpha.18",
26
+ "@rpgjs/client": "5.0.0-alpha.19",
27
+ "@rpgjs/common": "5.0.0-alpha.19",
28
+ "@rpgjs/server": "5.0.0-alpha.19",
29
+ "@rpgjs/vite": "5.0.0-alpha.19",
30
30
  "canvasengine": "^2.0.0-beta.33"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
35
  "devDependencies": {
36
- "@canvasengine/compiler": "^2.0.0-beta.33",
36
+ "@canvasengine/compiler": "^2.0.0-beta.34",
37
37
  "vite": "^7.2.4",
38
38
  "vite-plugin-dts": "^4.5.4"
39
39
  },
40
40
  "type": "module",
41
41
  "dependencies": {
42
- "@canvasengine/tiled": "^2.0.0-beta.33"
42
+ "@canvasengine/tiled": "^2.0.0-beta.34"
43
43
  },
44
44
  "scripts": {
45
45
  "dev": "vite build --watch",