parse-tmx 2.35.0 → 2.37.2
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 +1 -1
- package/dist/index.d.ts +80 -81
- package/dist/index.js +135 -128
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ pnpm i parse-tmx
|
|
|
24
24
|
|
|
25
25
|
## <a name="documentation">📖 Documentation</a>
|
|
26
26
|
|
|
27
|
-
We highly recommend you take a look at the [documentation](https://esposter.com/docs/modules/parse-tmx.html) to level up.
|
|
27
|
+
We highly recommend you take a look at the [documentation](https://esposter.com/docs/api/modules/parse-tmx.html) to level up.
|
|
28
28
|
|
|
29
29
|
### Usage
|
|
30
30
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
interface TMXEditorSettingsParsed extends Record<string, unknown> {}
|
|
2
|
-
interface TMXFlipsParsed {
|
|
1
|
+
export interface TMXEditorSettingsParsed extends Record<string, unknown> {}
|
|
2
|
+
export interface TMXFlipsParsed {
|
|
3
3
|
Diagonal: boolean;
|
|
4
4
|
Horizontal: boolean;
|
|
5
5
|
Vertical: boolean;
|
|
6
6
|
}
|
|
7
|
-
interface TMXImageShared {
|
|
7
|
+
export interface TMXImageShared {
|
|
8
8
|
height: number;
|
|
9
9
|
source: string;
|
|
10
10
|
width: number;
|
|
11
11
|
}
|
|
12
|
-
interface TMXImageParsed extends TMXImageShared {}
|
|
13
|
-
declare enum Shape {
|
|
12
|
+
export interface TMXImageParsed extends TMXImageShared {}
|
|
13
|
+
export declare enum Shape {
|
|
14
14
|
Ellipse = "ellipse",
|
|
15
15
|
Point = "point",
|
|
16
16
|
Polygon = "polygon",
|
|
17
17
|
Rectangle = "rectangle"
|
|
18
18
|
}
|
|
19
|
-
type TMXPropertiesParsed = Record<string, unknown>[];
|
|
20
|
-
interface TMXObjectShared {
|
|
19
|
+
export type TMXPropertiesParsed = Record<string, unknown>[];
|
|
20
|
+
export interface TMXObjectShared {
|
|
21
21
|
gid: number;
|
|
22
22
|
height: number;
|
|
23
23
|
id: number;
|
|
@@ -26,7 +26,7 @@ interface TMXObjectShared {
|
|
|
26
26
|
x: number;
|
|
27
27
|
y: number;
|
|
28
28
|
}
|
|
29
|
-
interface TMXObjectParsed extends TMXObjectShared {
|
|
29
|
+
export interface TMXObjectParsed extends TMXObjectShared {
|
|
30
30
|
flips?: TMXFlipsParsed;
|
|
31
31
|
name: string;
|
|
32
32
|
points?: [number, number][];
|
|
@@ -35,7 +35,7 @@ interface TMXObjectParsed extends TMXObjectShared {
|
|
|
35
35
|
text?: string;
|
|
36
36
|
value: string;
|
|
37
37
|
}
|
|
38
|
-
interface TMXLayerShared {
|
|
38
|
+
export interface TMXLayerShared {
|
|
39
39
|
height: number;
|
|
40
40
|
id: number;
|
|
41
41
|
locked?: number;
|
|
@@ -52,28 +52,28 @@ interface TMXLayerShared {
|
|
|
52
52
|
x?: number;
|
|
53
53
|
y?: number;
|
|
54
54
|
}
|
|
55
|
-
interface TMXLayerParsed extends TMXLayerShared {
|
|
55
|
+
export interface TMXLayerParsed extends TMXLayerShared {
|
|
56
56
|
data?: number[];
|
|
57
57
|
flips?: TMXFlipsParsed[];
|
|
58
58
|
image?: TMXImageParsed;
|
|
59
59
|
objects?: TMXObjectParsed[];
|
|
60
60
|
properties?: TMXPropertiesParsed;
|
|
61
61
|
}
|
|
62
|
-
interface TMXGroupLayerShared {
|
|
62
|
+
export interface TMXGroupLayerShared {
|
|
63
63
|
id: number;
|
|
64
64
|
name: string;
|
|
65
65
|
type: string;
|
|
66
66
|
}
|
|
67
|
-
interface TMXGroupLayerParsed extends TMXGroupLayerShared {
|
|
67
|
+
export interface TMXGroupLayerParsed extends TMXGroupLayerShared {
|
|
68
68
|
layers: TMXLayerParsed[];
|
|
69
69
|
properties?: TMXPropertiesParsed;
|
|
70
70
|
}
|
|
71
|
-
interface TMXTileShared {
|
|
71
|
+
export interface TMXTileShared {
|
|
72
72
|
gid?: number;
|
|
73
73
|
id: number;
|
|
74
74
|
probability?: number;
|
|
75
75
|
}
|
|
76
|
-
interface TMXTileParsed extends TMXTileShared {
|
|
76
|
+
export interface TMXTileParsed extends TMXTileShared {
|
|
77
77
|
animation?: {
|
|
78
78
|
frames: number[];
|
|
79
79
|
};
|
|
@@ -82,10 +82,10 @@ interface TMXTileParsed extends TMXTileShared {
|
|
|
82
82
|
properties?: TMXPropertiesParsed;
|
|
83
83
|
type: string;
|
|
84
84
|
}
|
|
85
|
-
interface TMXBaseTilesetShared {
|
|
85
|
+
export interface TMXBaseTilesetShared {
|
|
86
86
|
firstgid: number;
|
|
87
87
|
}
|
|
88
|
-
interface TMXEmbeddedTilesetShared extends TMXBaseTilesetShared {
|
|
88
|
+
export interface TMXEmbeddedTilesetShared extends TMXBaseTilesetShared {
|
|
89
89
|
columns: number;
|
|
90
90
|
imageheight: number;
|
|
91
91
|
imagewidth: number;
|
|
@@ -96,16 +96,16 @@ interface TMXEmbeddedTilesetShared extends TMXBaseTilesetShared {
|
|
|
96
96
|
tileheight: number;
|
|
97
97
|
tilewidth: number;
|
|
98
98
|
}
|
|
99
|
-
interface TMXEmbeddedTilesetParsed extends TMXEmbeddedTilesetShared {
|
|
99
|
+
export interface TMXEmbeddedTilesetParsed extends TMXEmbeddedTilesetShared {
|
|
100
100
|
image: TMXImageParsed;
|
|
101
101
|
tiles: TMXTileParsed[];
|
|
102
102
|
}
|
|
103
|
-
interface TMXExternalTilesetShared extends TMXBaseTilesetShared {
|
|
103
|
+
export interface TMXExternalTilesetShared extends TMXBaseTilesetShared {
|
|
104
104
|
source: string;
|
|
105
105
|
}
|
|
106
|
-
interface TMXExternalTilesetParsed extends TMXExternalTilesetShared {}
|
|
107
|
-
type TMXTilesetParsed = TMXEmbeddedTilesetParsed | TMXExternalTilesetParsed;
|
|
108
|
-
declare class TMXMapShared {
|
|
106
|
+
export interface TMXExternalTilesetParsed extends TMXExternalTilesetShared {}
|
|
107
|
+
export type TMXTilesetParsed = TMXEmbeddedTilesetParsed | TMXExternalTilesetParsed;
|
|
108
|
+
export declare class TMXMapShared {
|
|
109
109
|
height: number;
|
|
110
110
|
infinite: number;
|
|
111
111
|
nextlayerid: number;
|
|
@@ -118,58 +118,72 @@ declare class TMXMapShared {
|
|
|
118
118
|
version: number;
|
|
119
119
|
width: number;
|
|
120
120
|
}
|
|
121
|
-
declare class TMXMapParsed extends TMXMapShared {
|
|
121
|
+
export declare class TMXMapParsed extends TMXMapShared {
|
|
122
122
|
editorsettings: TMXEditorSettingsParsed;
|
|
123
123
|
layers: (TMXGroupLayerParsed | TMXLayerParsed)[];
|
|
124
124
|
properties: TMXPropertiesParsed;
|
|
125
125
|
tilesets: TMXTilesetParsed[];
|
|
126
126
|
constructor(init?: Partial<TMXMapParsed>);
|
|
127
127
|
}
|
|
128
|
-
declare class TMXParsed {
|
|
128
|
+
export declare class TMXParsed {
|
|
129
129
|
map: TMXMapParsed;
|
|
130
130
|
constructor(map?: TMXMapParsed);
|
|
131
131
|
}
|
|
132
|
-
declare const parseTmx: (xmlString: string, translateFlips?: boolean) => Promise<TMXParsed>;
|
|
133
|
-
declare enum Compression {
|
|
132
|
+
export declare const parseTmx: (xmlString: string, translateFlips?: boolean) => Promise<TMXParsed>;
|
|
133
|
+
export declare enum Compression {
|
|
134
134
|
Gzip = "gzip",
|
|
135
135
|
Zlib = "zlib"
|
|
136
136
|
}
|
|
137
|
-
declare enum Encoding {
|
|
137
|
+
export declare enum Encoding {
|
|
138
138
|
Base64 = "base64",
|
|
139
139
|
Csv = "csv"
|
|
140
140
|
}
|
|
141
|
-
declare enum Flipped {
|
|
141
|
+
export declare enum Flipped {
|
|
142
142
|
Diagonally = 536870912,
|
|
143
143
|
Vertically = 1073741824,
|
|
144
144
|
Horizontally = 2147483648
|
|
145
145
|
}
|
|
146
|
-
declare const Flippeds: readonly Flipped[];
|
|
147
|
-
declare
|
|
148
|
-
|
|
146
|
+
export declare const Flippeds: readonly Flipped[];
|
|
147
|
+
export declare enum TMXNodeType {
|
|
148
|
+
Data = "data",
|
|
149
|
+
EditorSettings = "editorsettings",
|
|
150
|
+
Export = "export",
|
|
151
|
+
Group = "group",
|
|
152
|
+
Image = "image",
|
|
153
|
+
ImageLayer = "imagelayer",
|
|
154
|
+
Layer = "layer",
|
|
155
|
+
Object = "object",
|
|
156
|
+
Objectgroup = "objectgroup",
|
|
157
|
+
Properties = "properties",
|
|
158
|
+
Property = "property",
|
|
159
|
+
Tileset = "tileset"
|
|
160
|
+
}
|
|
161
|
+
export declare class BaseTMXNode<T> {
|
|
149
162
|
[key: string]: unknown;
|
|
163
|
+
readonly "#name": TMXNodeType;
|
|
150
164
|
$: T;
|
|
151
165
|
}
|
|
152
|
-
declare const cloneNodeWithType: <TParsed>(node: BaseTMXNode<unknown>) => TParsed;
|
|
153
|
-
declare const getDecompressedBytes: (bytes: Uint8Array, compression: Compression.Gzip | Compression.Zlib) => Promise<Uint8Array>;
|
|
154
|
-
declare const isExternalTileset: (tileset: TMXEmbeddedTilesetShared | TMXExternalTilesetShared) => tileset is TMXExternalTilesetShared;
|
|
155
|
-
type TMXNode<T, TChildNode extends BaseTMXNode<unknown> | undefined = undefined> = BaseTMXNode<T> & {
|
|
166
|
+
export declare const cloneNodeWithType: <TParsed>(node: BaseTMXNode<unknown>) => TParsed;
|
|
167
|
+
export declare const getDecompressedBytes: (bytes: Uint8Array, compression: Compression.Gzip | Compression.Zlib) => Promise<Uint8Array>;
|
|
168
|
+
export declare const isExternalTileset: (tileset: TMXEmbeddedTilesetShared | TMXExternalTilesetShared) => tileset is TMXExternalTilesetShared;
|
|
169
|
+
export type TMXNode<T, TChildNode extends BaseTMXNode<unknown> | undefined = undefined> = BaseTMXNode<T> & {
|
|
156
170
|
$$: TChildNode extends undefined ? undefined : TChildNode[];
|
|
157
171
|
};
|
|
158
|
-
interface TMXDataNode extends TMXNode<{
|
|
172
|
+
export interface TMXDataNode extends TMXNode<{
|
|
159
173
|
compression?: Compression;
|
|
160
174
|
encoding: Encoding;
|
|
161
175
|
}> {
|
|
162
176
|
_: string;
|
|
163
177
|
}
|
|
164
|
-
interface TMXImageNode extends TMXNode<TMXImageShared> {}
|
|
165
|
-
interface TMXPropertyNode extends TMXNode<{
|
|
178
|
+
export interface TMXImageNode extends TMXNode<TMXImageShared> {}
|
|
179
|
+
export interface TMXPropertyNode extends TMXNode<{
|
|
166
180
|
name: string;
|
|
167
181
|
value?: string;
|
|
168
182
|
}> {
|
|
169
183
|
_: string;
|
|
170
184
|
}
|
|
171
|
-
interface TMXPropertiesNode extends TMXNode<Record<string, never>, TMXPropertyNode> {}
|
|
172
|
-
interface TMXObjectNode extends TMXNode<TMXObjectShared, TMXDataNode | TMXPropertiesNode> {
|
|
185
|
+
export interface TMXPropertiesNode extends TMXNode<Record<string, never>, TMXPropertyNode> {}
|
|
186
|
+
export interface TMXObjectNode extends TMXNode<TMXObjectShared, TMXDataNode | TMXPropertiesNode> {
|
|
173
187
|
polygon?: TMXNode<{
|
|
174
188
|
points: string;
|
|
175
189
|
}>[];
|
|
@@ -178,19 +192,19 @@ interface TMXObjectNode extends TMXNode<TMXObjectShared, TMXDataNode | TMXProper
|
|
|
178
192
|
}[];
|
|
179
193
|
text?: TMXDataNode[];
|
|
180
194
|
}
|
|
181
|
-
interface TMXTileNode extends TMXNode<TMXTileShared, TMXPropertiesNode> {
|
|
195
|
+
export interface TMXTileNode extends TMXNode<TMXTileShared, TMXPropertiesNode> {
|
|
182
196
|
animation?: Record<string, TMXNode<number>[]>[];
|
|
183
197
|
objectgroup?: Record<string, TMXObjectNode[]>[];
|
|
184
198
|
properties?: {
|
|
185
199
|
property: TMXPropertyNode[];
|
|
186
200
|
}[];
|
|
187
201
|
}
|
|
188
|
-
interface TMXEmbeddedTilesetNode extends TMXNode<TMXEmbeddedTilesetShared, TMXImageNode | TMXTileNode> {
|
|
202
|
+
export interface TMXEmbeddedTilesetNode extends TMXNode<TMXEmbeddedTilesetShared, TMXImageNode | TMXTileNode> {
|
|
189
203
|
tile?: TMXTileNode[];
|
|
190
204
|
}
|
|
191
|
-
declare const isTMXEmbeddedTilesetNode: (node: TMXDataNode | TMXEmbeddedTilesetNode) => node is TMXEmbeddedTilesetNode;
|
|
192
|
-
declare const parseFlips: (gid: number) => TMXFlipsParsed;
|
|
193
|
-
interface TMXLayerNode extends TMXNode<TMXLayerShared, TMXDataNode | TMXEmbeddedTilesetNode | TMXPropertiesNode> {
|
|
205
|
+
export declare const isTMXEmbeddedTilesetNode: (node: TMXDataNode | TMXEmbeddedTilesetNode) => node is TMXEmbeddedTilesetNode;
|
|
206
|
+
export declare const parseFlips: (gid: number) => TMXFlipsParsed;
|
|
207
|
+
export interface TMXLayerNode extends TMXNode<TMXLayerShared, TMXDataNode | TMXEmbeddedTilesetNode | TMXPropertiesNode> {
|
|
194
208
|
data?: TMXDataNode[] | TMXEmbeddedTilesetNode[];
|
|
195
209
|
image?: TMXImageNode[];
|
|
196
210
|
object?: TMXObjectNode[];
|
|
@@ -198,51 +212,36 @@ interface TMXLayerNode extends TMXNode<TMXLayerShared, TMXDataNode | TMXEmbedded
|
|
|
198
212
|
property: TMXPropertyNode[];
|
|
199
213
|
}[];
|
|
200
214
|
}
|
|
201
|
-
interface TMXGroupLayerNode extends TMXNode<TMXGroupLayerShared, TMXLayerNode> {
|
|
215
|
+
export interface TMXGroupLayerNode extends TMXNode<TMXGroupLayerShared, TMXLayerNode> {
|
|
202
216
|
properties?: {
|
|
203
217
|
property: TMXPropertyNode[];
|
|
204
218
|
}[];
|
|
205
219
|
}
|
|
206
|
-
declare const parseGroup: (node: TMXGroupLayerNode, expectedCount: number, translateFlips: boolean) => Promise<TMXGroupLayerParsed>;
|
|
207
|
-
declare const parseLayer: (node: TMXLayerNode) => TMXLayerParsed;
|
|
208
|
-
declare const parseNode: <TNode extends TMXGroupLayerNode | TMXLayerNode, TParsedNode = TNode extends TMXLayerNode ? TMXLayerParsed : TMXGroupLayerParsed>(node: TNode, expectedCount: number, translateFlips: boolean) => Promise<TParsedNode>;
|
|
209
|
-
declare const parseObject: (node: TMXObjectNode) => TMXObjectParsed;
|
|
210
|
-
declare const parseObjectShape: (node: TMXObjectNode) => Shape;
|
|
211
|
-
declare const parseProperties: (properties: {
|
|
220
|
+
export declare const parseGroup: (node: TMXGroupLayerNode, expectedCount: number, translateFlips: boolean) => Promise<TMXGroupLayerParsed>;
|
|
221
|
+
export declare const parseLayer: (node: TMXLayerNode) => TMXLayerParsed;
|
|
222
|
+
export declare const parseNode: <TNode extends TMXGroupLayerNode | TMXLayerNode, TParsedNode = TNode extends TMXLayerNode ? TMXLayerParsed : TMXGroupLayerParsed>(node: TNode, expectedCount: number, translateFlips: boolean) => Promise<TParsedNode>;
|
|
223
|
+
export declare const parseObject: (node: TMXObjectNode) => TMXObjectParsed;
|
|
224
|
+
export declare const parseObjectShape: (node: TMXObjectNode) => Shape;
|
|
225
|
+
export declare const parseProperties: (properties: {
|
|
212
226
|
property: TMXPropertyNode[];
|
|
213
227
|
}[]) => TMXPropertiesParsed;
|
|
214
|
-
declare const parseTile: (node: TMXTileNode) => TMXTileParsed;
|
|
215
|
-
declare const parseTileId: (gid: number) => number;
|
|
216
|
-
declare const parseTileLayer: (node: TMXLayerNode, expectedCount: number, translateFlips: boolean) => Promise<TMXLayerParsed>;
|
|
217
|
-
interface TMXExternalTilesetNode extends TMXNode<TMXExternalTilesetShared> {}
|
|
218
|
-
type TMXTilesetNode = TMXEmbeddedTilesetNode | TMXExternalTilesetNode;
|
|
219
|
-
declare const parseTileset: (node: TMXTilesetNode) => TMXTilesetParsed;
|
|
220
|
-
declare const parseXmlString: <T extends object>(xmlString: string) => Promise<T>;
|
|
221
|
-
declare const parseXmlValue: (value: string) => boolean | number | string;
|
|
222
|
-
declare const unpackTileBytes: (bytes: Uint8Array, expectedCount: number) => number[];
|
|
223
|
-
interface TMXExportShared {
|
|
228
|
+
export declare const parseTile: (node: TMXTileNode) => TMXTileParsed;
|
|
229
|
+
export declare const parseTileId: (gid: number) => number;
|
|
230
|
+
export declare const parseTileLayer: (node: TMXLayerNode, expectedCount: number, translateFlips: boolean) => Promise<TMXLayerParsed>;
|
|
231
|
+
export interface TMXExternalTilesetNode extends TMXNode<TMXExternalTilesetShared> {}
|
|
232
|
+
export type TMXTilesetNode = TMXEmbeddedTilesetNode | TMXExternalTilesetNode;
|
|
233
|
+
export declare const parseTileset: (node: TMXTilesetNode) => TMXTilesetParsed;
|
|
234
|
+
export declare const parseXmlString: <T extends object>(xmlString: string) => Promise<T>;
|
|
235
|
+
export declare const parseXmlValue: (value: string) => boolean | number | string;
|
|
236
|
+
export declare const unpackTileBytes: (bytes: Uint8Array, expectedCount: number) => number[];
|
|
237
|
+
export interface TMXExportShared {
|
|
224
238
|
format: string;
|
|
225
239
|
target: string;
|
|
226
240
|
}
|
|
227
|
-
interface TMXExportNode extends TMXNode<TMXExportShared> {}
|
|
228
|
-
interface TMXEditorSettingsNode extends TMXNode<Record<string, never>, TMXExportNode> {}
|
|
229
|
-
interface TMXMapNode extends TMXNode<TMXMapShared, TMXEditorSettingsNode | TMXGroupLayerNode | TMXPropertiesNode | TMXTilesetNode> {}
|
|
230
|
-
interface TMX {
|
|
241
|
+
export interface TMXExportNode extends TMXNode<TMXExportShared> {}
|
|
242
|
+
export interface TMXEditorSettingsNode extends TMXNode<Record<string, never>, TMXExportNode> {}
|
|
243
|
+
export interface TMXMapNode extends TMXNode<TMXMapShared, TMXEditorSettingsNode | TMXGroupLayerNode | TMXPropertiesNode | TMXTilesetNode> {}
|
|
244
|
+
export interface TMX {
|
|
231
245
|
map: TMXMapNode;
|
|
232
246
|
}
|
|
233
|
-
|
|
234
|
-
Data = "data",
|
|
235
|
-
EditorSettings = "editorsettings",
|
|
236
|
-
Export = "export",
|
|
237
|
-
Group = "group",
|
|
238
|
-
Image = "image",
|
|
239
|
-
ImageLayer = "imagelayer",
|
|
240
|
-
Layer = "layer",
|
|
241
|
-
Object = "object",
|
|
242
|
-
Objectgroup = "objectgroup",
|
|
243
|
-
Properties = "properties",
|
|
244
|
-
Property = "property",
|
|
245
|
-
Tileset = "tileset"
|
|
246
|
-
}
|
|
247
|
-
interface TMXExportParsed extends TMXExportShared {}
|
|
248
|
-
export { BaseTMXNode, Compression, Encoding, Flipped, Flippeds, Shape, TMX, TMXBaseTilesetShared, TMXDataNode, TMXEditorSettingsNode, TMXEditorSettingsParsed, TMXEmbeddedTilesetNode, TMXEmbeddedTilesetParsed, TMXEmbeddedTilesetShared, TMXExportNode, TMXExportParsed, TMXExportShared, TMXExternalTilesetNode, TMXExternalTilesetParsed, TMXExternalTilesetShared, TMXFlipsParsed, TMXGroupLayerNode, TMXGroupLayerParsed, TMXGroupLayerShared, TMXImageNode, TMXImageParsed, TMXImageShared, TMXLayerNode, TMXLayerParsed, TMXLayerShared, TMXMapNode, TMXMapParsed, TMXMapShared, TMXNode, TMXNodeType, TMXObjectNode, TMXObjectParsed, TMXObjectShared, TMXParsed, TMXPropertiesNode, TMXPropertiesParsed, TMXPropertyNode, TMXTileNode, TMXTileParsed, TMXTileShared, TMXTilesetNode, TMXTilesetParsed, cloneNodeWithType, getDecompressedBytes, isExternalTileset, isTMXEmbeddedTilesetNode, parseFlips, parseGroup, parseLayer, parseNode, parseObject, parseObjectShape, parseProperties, parseTile, parseTileId, parseTileLayer, parseTileset, parseTmx, parseXmlString, parseXmlValue, unpackTileBytes };
|
|
247
|
+
export interface TMXExportParsed extends TMXExportShared {}
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
34
34
|
}
|
|
35
35
|
return to;
|
|
36
36
|
};
|
|
37
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
37
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
38
38
|
value: mod,
|
|
39
39
|
enumerable: true
|
|
40
40
|
}) : target, mod));
|
|
@@ -212,7 +212,7 @@ const parseTileLayer = async (node, expectedCount, translateFlips) => {
|
|
|
212
212
|
break;
|
|
213
213
|
}
|
|
214
214
|
case "csv":
|
|
215
|
-
layer.data = layerData.split(",").map(
|
|
215
|
+
layer.data = layerData.split(",").map(Number);
|
|
216
216
|
break;
|
|
217
217
|
default: exhaustiveGuard(encoding);
|
|
218
218
|
}
|
|
@@ -238,7 +238,7 @@ const isExternalTileset = (tileset) => "source" in tileset;
|
|
|
238
238
|
const parseTile = (node) => {
|
|
239
239
|
const { $, animation, objectgroup, properties } = node;
|
|
240
240
|
const tile = structuredClone($);
|
|
241
|
-
if (animation) tile.animation = { frames: takeOne(takeOne(animation), "frame").map(({
|
|
241
|
+
if (animation) tile.animation = { frames: takeOne(takeOne(animation), "frame").map(({ $: frameData }) => structuredClone(frameData)) };
|
|
242
242
|
if (objectgroup) tile.objects = takeOne(takeOne(objectgroup), "object").map((o) => parseObject(o));
|
|
243
243
|
if (properties) tile.properties = parseProperties(properties);
|
|
244
244
|
return tile;
|
|
@@ -262,10 +262,8 @@ const NUMBER_REGEX = /^[+-]?\d+(?<decimal>\.\d+)?$/u;
|
|
|
262
262
|
const parseXmlValue = (value) => {
|
|
263
263
|
if (value === "true") return true;
|
|
264
264
|
else if (value === "false") return false;
|
|
265
|
-
else if (NUMBER_REGEX.test(value))
|
|
266
|
-
|
|
267
|
-
return isNaN(parsedValue) ? value : parsedValue;
|
|
268
|
-
} else return value;
|
|
265
|
+
else if (NUMBER_REGEX.test(value)) return Number(value);
|
|
266
|
+
else return value;
|
|
269
267
|
};
|
|
270
268
|
var require_utils$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
271
269
|
exports.removeLeadingAndTrailingHTTPWhitespace = (string) => {
|
|
@@ -1940,9 +1938,7 @@ var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1940
1938
|
case "value":
|
|
1941
1939
|
result = value;
|
|
1942
1940
|
break;
|
|
1943
|
-
case "key+value":
|
|
1944
|
-
result = [key, value];
|
|
1945
|
-
break;
|
|
1941
|
+
case "key+value": result = [key, value];
|
|
1946
1942
|
}
|
|
1947
1943
|
return {
|
|
1948
1944
|
value: result,
|
|
@@ -23149,19 +23145,20 @@ function unwrap(res, t, pos) {
|
|
|
23149
23145
|
let code = 0;
|
|
23150
23146
|
for (let i = 0; i < t.length; i++) {
|
|
23151
23147
|
let x = t[i];
|
|
23152
|
-
if (typeof x === "number")
|
|
23153
|
-
|
|
23154
|
-
if (x < 0) {
|
|
23155
|
-
code -= x;
|
|
23156
|
-
x = 1;
|
|
23157
|
-
} else code += t[++i];
|
|
23158
|
-
for (let k = 0; k < x; k++, pos++, code++) if (code <= 65535) res[pos] = code;
|
|
23148
|
+
if (typeof x === "number") {
|
|
23149
|
+
if (x === 0) pos += t[++i];
|
|
23159
23150
|
else {
|
|
23160
|
-
|
|
23161
|
-
|
|
23151
|
+
if (x < 0) {
|
|
23152
|
+
code -= x;
|
|
23153
|
+
x = 1;
|
|
23154
|
+
} else code += t[++i];
|
|
23155
|
+
for (let k = 0; k < x; k++, pos++, code++) if (code <= 65535) res[pos] = code;
|
|
23156
|
+
else {
|
|
23157
|
+
const c = String.fromCodePoint(code);
|
|
23158
|
+
res[pos] = c.charCodeAt(0) << 16 | c.charCodeAt(1);
|
|
23159
|
+
}
|
|
23162
23160
|
}
|
|
23163
|
-
}
|
|
23164
|
-
else if (x[0] === "$" && Object.hasOwn(indices, x)) pos = unwrap(res, indices[x], pos);
|
|
23161
|
+
} else if (x[0] === "$" && Object.hasOwn(indices, x)) pos = unwrap(res, indices[x], pos);
|
|
23165
23162
|
else {
|
|
23166
23163
|
let last;
|
|
23167
23164
|
for (const c of utf16toString(loadBase64(x), "uint8-le")) {
|
|
@@ -23384,16 +23381,17 @@ function multibyteEncoder$1(enc, onError) {
|
|
|
23384
23381
|
};
|
|
23385
23382
|
for (let j = i; j < length; j++) {
|
|
23386
23383
|
const x = str.charCodeAt(j);
|
|
23387
|
-
if (x >= 55296 && x < 57344)
|
|
23388
|
-
|
|
23389
|
-
const x1 = str.charCodeAt(j + 1);
|
|
23390
|
-
if (x1 < 56320 || x1 >= 57344) i += err(x);
|
|
23384
|
+
if (x >= 55296 && x < 57344) {
|
|
23385
|
+
if (x >= 56320 || j + 1 === length) i += err(x);
|
|
23391
23386
|
else {
|
|
23392
|
-
j
|
|
23393
|
-
|
|
23387
|
+
const x1 = str.charCodeAt(j + 1);
|
|
23388
|
+
if (x1 < 56320 || x1 >= 57344) i += err(x);
|
|
23389
|
+
else {
|
|
23390
|
+
j++;
|
|
23391
|
+
encode(65536 + (x1 & 1023 | (x & 1023) << 10));
|
|
23392
|
+
}
|
|
23394
23393
|
}
|
|
23395
|
-
}
|
|
23396
|
-
else {
|
|
23394
|
+
} else {
|
|
23397
23395
|
const e = map[x];
|
|
23398
23396
|
if (e & 65280) {
|
|
23399
23397
|
u8[i++] = e >> 8;
|
|
@@ -23416,16 +23414,17 @@ function multibyteEncoder$1(enc, onError) {
|
|
|
23416
23414
|
};
|
|
23417
23415
|
for (let j = i; j < length; j++) {
|
|
23418
23416
|
const x = str.charCodeAt(j);
|
|
23419
|
-
if (x >= 55296 && x < 57344)
|
|
23420
|
-
|
|
23421
|
-
const x1 = str.charCodeAt(j + 1);
|
|
23422
|
-
if (x1 < 56320 || x1 >= 57344) i += err(x);
|
|
23417
|
+
if (x >= 55296 && x < 57344) {
|
|
23418
|
+
if (x >= 56320 || j + 1 === length) i += err(x);
|
|
23423
23419
|
else {
|
|
23424
|
-
j
|
|
23425
|
-
|
|
23420
|
+
const x1 = str.charCodeAt(j + 1);
|
|
23421
|
+
if (x1 < 56320 || x1 >= 57344) i += err(x);
|
|
23422
|
+
else {
|
|
23423
|
+
j++;
|
|
23424
|
+
long(65536 + (x1 & 1023 | (x & 1023) << 10));
|
|
23425
|
+
}
|
|
23426
23426
|
}
|
|
23427
|
-
}
|
|
23428
|
-
else {
|
|
23427
|
+
} else {
|
|
23429
23428
|
const e = map[x];
|
|
23430
23429
|
if (e & 65280) {
|
|
23431
23430
|
u8[i++] = e >> 8;
|
|
@@ -23826,39 +23825,42 @@ var init_multi_byte$1 = __esmMin((() => {
|
|
|
23826
23825
|
}
|
|
23827
23826
|
while (i < end || pushback.length > 0) {
|
|
23828
23827
|
const b = pushback.length > 0 ? pushback.pop() : arr[i++];
|
|
23829
|
-
if (g1)
|
|
23830
|
-
|
|
23831
|
-
|
|
23832
|
-
|
|
23833
|
-
|
|
23834
|
-
|
|
23835
|
-
|
|
23836
|
-
|
|
23837
|
-
|
|
23838
|
-
|
|
23839
|
-
|
|
23840
|
-
|
|
23841
|
-
|
|
23842
|
-
|
|
23843
|
-
|
|
23844
|
-
|
|
23845
|
-
|
|
23846
|
-
|
|
23847
|
-
|
|
23848
|
-
|
|
23849
|
-
|
|
23850
|
-
|
|
23851
|
-
|
|
23852
|
-
|
|
23853
|
-
if (b
|
|
23854
|
-
g1 = 0;
|
|
23855
|
-
if (cp) o16[oi++] = cp;
|
|
23828
|
+
if (g1) {
|
|
23829
|
+
if (g2) {
|
|
23830
|
+
if (g3) {
|
|
23831
|
+
if (b <= 57 && b >= 48) {
|
|
23832
|
+
const p = index((g1 - 129) * 12600 + (g2 - 48) * 1260 + (g3 - 129) * 10 + b - 48);
|
|
23833
|
+
g1 = g2 = g3 = 0;
|
|
23834
|
+
if (p === void 0) o16[oi++] = err();
|
|
23835
|
+
else if (p <= 65535) o16[oi++] = p;
|
|
23836
|
+
else {
|
|
23837
|
+
const d = p - 65536;
|
|
23838
|
+
o16[oi++] = 55296 | d >> 10;
|
|
23839
|
+
o16[oi++] = 56320 | d & 1023;
|
|
23840
|
+
}
|
|
23841
|
+
} else {
|
|
23842
|
+
pushback.push(b, g3, g2);
|
|
23843
|
+
g1 = g2 = g3 = 0;
|
|
23844
|
+
o16[oi++] = err();
|
|
23845
|
+
}
|
|
23846
|
+
} else if (b >= 129 && b <= 254) g3 = b;
|
|
23847
|
+
else {
|
|
23848
|
+
pushback.push(b, g2);
|
|
23849
|
+
g1 = g2 = 0;
|
|
23850
|
+
o16[oi++] = err();
|
|
23851
|
+
}
|
|
23852
|
+
} else if (b <= 57 && b >= 48) g2 = b;
|
|
23856
23853
|
else {
|
|
23857
|
-
|
|
23858
|
-
if (b
|
|
23854
|
+
let cp;
|
|
23855
|
+
if (b >= 64 && b <= 254 && b !== 127) cp = gb18030[(g1 - 129) * 190 + b - (b < 127 ? 64 : 65)];
|
|
23856
|
+
g1 = 0;
|
|
23857
|
+
if (cp) o16[oi++] = cp;
|
|
23858
|
+
else {
|
|
23859
|
+
o16[oi++] = err();
|
|
23860
|
+
if (b < 128) o16[oi++] = b;
|
|
23861
|
+
}
|
|
23859
23862
|
}
|
|
23860
|
-
}
|
|
23861
|
-
else if (b < 128) o16[oi++] = b;
|
|
23863
|
+
} else if (b < 128) o16[oi++] = b;
|
|
23862
23864
|
else if (b === 128) o16[oi++] = 8364;
|
|
23863
23865
|
else if (b === 255) o16[oi++] = err();
|
|
23864
23866
|
else g1 = b;
|
|
@@ -25882,7 +25884,7 @@ var init_punycode_es6 = __esmMin((() => {
|
|
|
25882
25884
|
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
25883
25885
|
"invalid-input": "Invalid input"
|
|
25884
25886
|
};
|
|
25885
|
-
baseMinusTMin =
|
|
25887
|
+
baseMinusTMin = 35;
|
|
25886
25888
|
floor = Math.floor;
|
|
25887
25889
|
stringFromCharCode = String.fromCharCode;
|
|
25888
25890
|
ucs2encode = (codePoints) => String.fromCodePoint(...codePoints);
|
|
@@ -59850,9 +59852,7 @@ var require_tr46 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
59850
59852
|
if (transitionalProcessing) processed += mapping;
|
|
59851
59853
|
else processed += ch;
|
|
59852
59854
|
break;
|
|
59853
|
-
case STATUS_MAPPING.valid:
|
|
59854
|
-
processed += ch;
|
|
59855
|
-
break;
|
|
59855
|
+
case STATUS_MAPPING.valid: processed += ch;
|
|
59856
59856
|
}
|
|
59857
59857
|
}
|
|
59858
59858
|
return processed;
|
|
@@ -60325,8 +60325,10 @@ var require_url_state_machine = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
60325
60325
|
let numbersSeen = 0;
|
|
60326
60326
|
while (input[pointer] !== void 0) {
|
|
60327
60327
|
let ipv4Piece = null;
|
|
60328
|
-
if (numbersSeen > 0)
|
|
60329
|
-
|
|
60328
|
+
if (numbersSeen > 0) {
|
|
60329
|
+
if (input[pointer] === p(".") && numbersSeen < 4) ++pointer;
|
|
60330
|
+
else return failure;
|
|
60331
|
+
}
|
|
60330
60332
|
if (!infra.isASCIIDigit(input[pointer])) return failure;
|
|
60331
60333
|
while (infra.isASCIIDigit(input[pointer])) {
|
|
60332
60334
|
const number = parseInt(at(input, pointer));
|
|
@@ -61143,13 +61145,14 @@ var require_URLSearchParams_impl = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
61143
61145
|
set(name, value) {
|
|
61144
61146
|
let found = false;
|
|
61145
61147
|
let i = 0;
|
|
61146
|
-
while (i < this._list.length) if (this._list[i][0] === name)
|
|
61147
|
-
|
|
61148
|
-
|
|
61149
|
-
|
|
61150
|
-
|
|
61151
|
-
|
|
61152
|
-
|
|
61148
|
+
while (i < this._list.length) if (this._list[i][0] === name) {
|
|
61149
|
+
if (found) this._list.splice(i, 1);
|
|
61150
|
+
else {
|
|
61151
|
+
found = true;
|
|
61152
|
+
this._list[i][1] = value;
|
|
61153
|
+
i++;
|
|
61154
|
+
}
|
|
61155
|
+
} else i++;
|
|
61153
61156
|
if (!found) this._list.push([name, value]);
|
|
61154
61157
|
this._updateSteps();
|
|
61155
61158
|
}
|
|
@@ -61246,54 +61249,57 @@ var require_URLSearchParams = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
61246
61249
|
const args = [];
|
|
61247
61250
|
{
|
|
61248
61251
|
let curArg = arguments[0];
|
|
61249
|
-
if (curArg !== void 0)
|
|
61250
|
-
|
|
61251
|
-
|
|
61252
|
-
|
|
61253
|
-
|
|
61254
|
-
|
|
61252
|
+
if (curArg !== void 0) {
|
|
61253
|
+
if (utils.isObject(curArg)) {
|
|
61254
|
+
if (curArg[Symbol.iterator] !== void 0) {
|
|
61255
|
+
if (!utils.isObject(curArg)) throw new globalObject.TypeError("Failed to construct 'URLSearchParams': parameter 1 sequence is not an iterable object.");
|
|
61256
|
+
else {
|
|
61257
|
+
const V = [];
|
|
61258
|
+
const tmp = curArg;
|
|
61259
|
+
for (let nextItem of tmp) {
|
|
61260
|
+
if (!utils.isObject(nextItem)) throw new globalObject.TypeError("Failed to construct 'URLSearchParams': parameter 1 sequence's element is not an iterable object.");
|
|
61261
|
+
else {
|
|
61262
|
+
const V = [];
|
|
61263
|
+
const tmp = nextItem;
|
|
61264
|
+
for (let nextItem of tmp) {
|
|
61265
|
+
nextItem = conversions["USVString"](nextItem, {
|
|
61266
|
+
context: "Failed to construct 'URLSearchParams': parameter 1 sequence's element's element",
|
|
61267
|
+
globals: globalObject
|
|
61268
|
+
});
|
|
61269
|
+
V.push(nextItem);
|
|
61270
|
+
}
|
|
61271
|
+
nextItem = V;
|
|
61272
|
+
}
|
|
61273
|
+
V.push(nextItem);
|
|
61274
|
+
}
|
|
61275
|
+
curArg = V;
|
|
61276
|
+
}
|
|
61277
|
+
} else if (!utils.isObject(curArg)) throw new globalObject.TypeError("Failed to construct 'URLSearchParams': parameter 1 record is not an object.");
|
|
61255
61278
|
else {
|
|
61256
|
-
const
|
|
61257
|
-
const
|
|
61258
|
-
|
|
61259
|
-
|
|
61260
|
-
|
|
61261
|
-
|
|
61262
|
-
|
|
61263
|
-
|
|
61279
|
+
const result = Object.create(null);
|
|
61280
|
+
for (const key of Reflect.ownKeys(curArg)) {
|
|
61281
|
+
const desc = Object.getOwnPropertyDescriptor(curArg, key);
|
|
61282
|
+
if (desc && desc.enumerable) {
|
|
61283
|
+
let typedKey = key;
|
|
61284
|
+
typedKey = conversions["USVString"](typedKey, {
|
|
61285
|
+
context: "Failed to construct 'URLSearchParams': parameter 1 record's key",
|
|
61286
|
+
globals: globalObject
|
|
61287
|
+
});
|
|
61288
|
+
let typedValue = curArg[key];
|
|
61289
|
+
typedValue = conversions["USVString"](typedValue, {
|
|
61290
|
+
context: "Failed to construct 'URLSearchParams': parameter 1 record's value",
|
|
61291
|
+
globals: globalObject
|
|
61292
|
+
});
|
|
61293
|
+
result[typedKey] = typedValue;
|
|
61294
|
+
}
|
|
61264
61295
|
}
|
|
61265
|
-
|
|
61296
|
+
curArg = result;
|
|
61266
61297
|
}
|
|
61267
|
-
|
|
61268
|
-
|
|
61269
|
-
|
|
61270
|
-
|
|
61271
|
-
else
|
|
61272
|
-
else {
|
|
61273
|
-
const result = Object.create(null);
|
|
61274
|
-
for (const key of Reflect.ownKeys(curArg)) {
|
|
61275
|
-
const desc = Object.getOwnPropertyDescriptor(curArg, key);
|
|
61276
|
-
if (desc && desc.enumerable) {
|
|
61277
|
-
let typedKey = key;
|
|
61278
|
-
typedKey = conversions["USVString"](typedKey, {
|
|
61279
|
-
context: "Failed to construct 'URLSearchParams': parameter 1 record's key",
|
|
61280
|
-
globals: globalObject
|
|
61281
|
-
});
|
|
61282
|
-
let typedValue = curArg[key];
|
|
61283
|
-
typedValue = conversions["USVString"](typedValue, {
|
|
61284
|
-
context: "Failed to construct 'URLSearchParams': parameter 1 record's value",
|
|
61285
|
-
globals: globalObject
|
|
61286
|
-
});
|
|
61287
|
-
result[typedKey] = typedValue;
|
|
61288
|
-
}
|
|
61289
|
-
}
|
|
61290
|
-
curArg = result;
|
|
61291
|
-
}
|
|
61292
|
-
else curArg = conversions["USVString"](curArg, {
|
|
61293
|
-
context: "Failed to construct 'URLSearchParams': parameter 1",
|
|
61294
|
-
globals: globalObject
|
|
61295
|
-
});
|
|
61296
|
-
else curArg = "";
|
|
61298
|
+
} else curArg = conversions["USVString"](curArg, {
|
|
61299
|
+
context: "Failed to construct 'URLSearchParams': parameter 1",
|
|
61300
|
+
globals: globalObject
|
|
61301
|
+
});
|
|
61302
|
+
} else curArg = "";
|
|
61297
61303
|
args.push(curArg);
|
|
61298
61304
|
}
|
|
61299
61305
|
return exports.setup(Object.create(new.target.prototype), globalObject, args);
|
|
@@ -62092,7 +62098,8 @@ var import_parser = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exp
|
|
|
62092
62098
|
};
|
|
62093
62099
|
})))(), 1);
|
|
62094
62100
|
const parseXmlString = (xmlString) => {
|
|
62095
|
-
|
|
62101
|
+
const xml = (0, import_parser.default)(xmlString) ?? xmlString;
|
|
62102
|
+
return parseStringPromise(xml, {
|
|
62096
62103
|
attrValueProcessors: [(value) => parseXmlValue(value)],
|
|
62097
62104
|
explicitChildren: true,
|
|
62098
62105
|
preserveChildrenOrder: true
|
|
@@ -62135,7 +62142,7 @@ const parseTmx = async (xmlString, translateFlips = false) => {
|
|
|
62135
62142
|
return new TMXParsed(map);
|
|
62136
62143
|
};
|
|
62137
62144
|
var BaseTMXNode = class {
|
|
62145
|
+
"#name";
|
|
62138
62146
|
$;
|
|
62139
|
-
#name;
|
|
62140
62147
|
};
|
|
62141
62148
|
export { BaseTMXNode, Compression, Encoding, Flipped, Flippeds, Shape, TMXMapParsed, TMXMapShared, TMXNodeType, TMXParsed, cloneNodeWithType, getDecompressedBytes, isExternalTileset, isTMXEmbeddedTilesetNode, parseFlips, parseGroup, parseLayer, parseNode, parseObject, parseObjectShape, parseProperties, parseTile, parseTileId, parseTileLayer, parseTileset, parseTmx, parseXmlString, parseXmlValue, unpackTileBytes };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "parse-tmx",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.37.2",
|
|
4
4
|
"description": "A parser for tmx.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"game-development",
|
|
@@ -45,19 +45,19 @@
|
|
|
45
45
|
"typecheck": "tsgo"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@esposter/shared": "2.
|
|
49
|
-
"@esposter/xml2js": "2.
|
|
48
|
+
"@esposter/shared": "2.37.2",
|
|
49
|
+
"@esposter/xml2js": "2.37.2",
|
|
50
50
|
"data-urls": "^7.0.0",
|
|
51
51
|
"dayjs": "^1.11.21"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@esposter/configuration": "2.
|
|
54
|
+
"@esposter/configuration": "2.37.2",
|
|
55
55
|
"@types/data-urls": "^3.0.5",
|
|
56
56
|
"@types/xml2js": "^0.4.14",
|
|
57
|
-
"ctix": "^2.8.
|
|
58
|
-
"rolldown": "^1.
|
|
57
|
+
"ctix": "^2.8.2",
|
|
58
|
+
"rolldown": "^1.2.4",
|
|
59
59
|
"type-fest": "^5.8.0",
|
|
60
60
|
"vitest": "^4.1.10"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "4d775dbd8289e6caaee48f08038b65fddb4babbc"
|
|
63
63
|
}
|