@codexo/exojs-tilemap 0.14.0 → 0.15.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/esm/ImageLayer.d.ts +81 -0
- package/dist/esm/ImageLayer.js +67 -0
- package/dist/esm/ImageLayer.js.map +1 -0
- package/dist/esm/ObjectLayer.d.ts +42 -3
- package/dist/esm/ObjectLayer.js +42 -2
- package/dist/esm/ObjectLayer.js.map +1 -1
- package/dist/esm/TileAnimator.d.ts +62 -0
- package/dist/esm/TileAnimator.js +169 -0
- package/dist/esm/TileAnimator.js.map +1 -0
- package/dist/esm/TileLayer.d.ts +33 -2
- package/dist/esm/TileLayer.js +26 -2
- package/dist/esm/TileLayer.js.map +1 -1
- package/dist/esm/TileLayerNode.d.ts +9 -2
- package/dist/esm/TileLayerNode.js +35 -7
- package/dist/esm/TileLayerNode.js.map +1 -1
- package/dist/esm/TileMap.d.ts +49 -1
- package/dist/esm/TileMap.js +68 -1
- package/dist/esm/TileMap.js.map +1 -1
- package/dist/esm/TileSet.d.ts +12 -0
- package/dist/esm/TileSet.js +29 -1
- package/dist/esm/TileSet.js.map +1 -1
- package/dist/esm/WangSet.d.ts +79 -0
- package/dist/esm/WangSet.js +81 -0
- package/dist/esm/WangSet.js.map +1 -0
- package/dist/esm/autoTile.d.ts +83 -0
- package/dist/esm/autoTile.js +214 -0
- package/dist/esm/autoTile.js.map +1 -0
- package/dist/esm/chunkGeometry.js +4 -3
- package/dist/esm/chunkGeometry.js.map +1 -1
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/public.d.ts +10 -3
- package/dist/esm/register.js +5 -1
- package/dist/esm/register.js.map +1 -1
- package/dist/esm/types.d.ts +86 -4
- package/dist/esm/types.js +18 -1
- package/dist/esm/types.js.map +1 -1
- package/package.json +3 -3
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,17 +1,76 @@
|
|
|
1
|
+
import type { TileMapObject } from './ObjectLayer';
|
|
1
2
|
import type { TileSet } from './TileSet';
|
|
3
|
+
/**
|
|
4
|
+
* Discriminant for the three structured, non-scalar {@link TilePropertyValue}
|
|
5
|
+
* variants: {@link TilePropertyPoint}, {@link TilePropertyObjectRef}, and
|
|
6
|
+
* {@link TilePropertyTileRef}.
|
|
7
|
+
*
|
|
8
|
+
* Modelled as a frozen string map (not a TS `enum`) so the values stay
|
|
9
|
+
* wire-stable, survive `verbatimModuleSyntax` (no emitted runtime helper),
|
|
10
|
+
* and follow the package convention for enum-like constants (see
|
|
11
|
+
* {@link import('./ObjectLayer').ObjectKind}).
|
|
12
|
+
* @stable
|
|
13
|
+
*/
|
|
14
|
+
export declare const TilePropertyKind: {
|
|
15
|
+
readonly Point: "point";
|
|
16
|
+
readonly ObjectRef: "objectRef";
|
|
17
|
+
readonly TileRef: "tileRef";
|
|
18
|
+
};
|
|
19
|
+
/** Structured-value discriminant for {@link TilePropertyValue}. */
|
|
20
|
+
export type TilePropertyKind = (typeof TilePropertyKind)[keyof typeof TilePropertyKind];
|
|
21
|
+
/** A 2D point-valued tile property (e.g. an LDtk `Point` field). */
|
|
22
|
+
export interface TilePropertyPoint {
|
|
23
|
+
readonly kind: typeof TilePropertyKind.Point;
|
|
24
|
+
readonly cx: number;
|
|
25
|
+
readonly cy: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A reference to another object/entity. `id` is the referenced object's
|
|
29
|
+
* identity — Tiled's numeric object id, or LDtk's `entityIid`. The extra
|
|
30
|
+
* fields are LDtk-only navigation context (`undefined` for Tiled-sourced
|
|
31
|
+
* refs) that lets a consumer resolve the reference without searching the
|
|
32
|
+
* whole level tree.
|
|
33
|
+
*/
|
|
34
|
+
export interface TilePropertyObjectRef {
|
|
35
|
+
readonly kind: typeof TilePropertyKind.ObjectRef;
|
|
36
|
+
readonly id: string | number;
|
|
37
|
+
readonly layerIid?: string;
|
|
38
|
+
readonly levelIid?: string;
|
|
39
|
+
readonly worldIid?: string;
|
|
40
|
+
}
|
|
41
|
+
/** A reference into a tileset region (e.g. an LDtk `Tile`-typed field). */
|
|
42
|
+
export interface TilePropertyTileRef {
|
|
43
|
+
readonly kind: typeof TilePropertyKind.TileRef;
|
|
44
|
+
readonly tilesetUid: number;
|
|
45
|
+
readonly x: number;
|
|
46
|
+
readonly y: number;
|
|
47
|
+
readonly w: number;
|
|
48
|
+
readonly h: number;
|
|
49
|
+
}
|
|
2
50
|
/**
|
|
3
51
|
* Union of legal tile-property value types in the generic runtime.
|
|
4
|
-
* Format-neutral; adapters map their native property systems into this set
|
|
52
|
+
* Format-neutral; adapters map their native property systems into this set —
|
|
53
|
+
* including the structured {@link TilePropertyPoint}, {@link TilePropertyObjectRef},
|
|
54
|
+
* and {@link TilePropertyTileRef} variants, arrays of any of the above, and
|
|
55
|
+
* nested property bags (e.g. Tiled `class`-typed properties).
|
|
5
56
|
* @advanced
|
|
6
57
|
*/
|
|
7
|
-
export type TilePropertyValue = null | boolean | number | string;
|
|
58
|
+
export type TilePropertyValue = null | boolean | number | string | TilePropertyPoint | TilePropertyObjectRef | TilePropertyTileRef | readonly TilePropertyValue[] | TileProperties;
|
|
8
59
|
/**
|
|
9
60
|
* An immutable, flat key-value bag of generic tile properties.
|
|
10
61
|
* Adapters copy and freeze source properties; the runtime never retains
|
|
11
62
|
* a caller-owned mutable object.
|
|
63
|
+
*
|
|
64
|
+
* Declared as an interface (not a `Record<...>` type alias) so it can
|
|
65
|
+
* mutually recurse with {@link TilePropertyValue} — a nested-bag member of
|
|
66
|
+
* that union — without TypeScript's "circularly references itself" alias
|
|
67
|
+
* restriction; structurally it behaves exactly like
|
|
68
|
+
* `Readonly<Record<string, TilePropertyValue>>`.
|
|
12
69
|
* @advanced
|
|
13
70
|
*/
|
|
14
|
-
export
|
|
71
|
+
export interface TileProperties {
|
|
72
|
+
readonly [key: string]: TilePropertyValue;
|
|
73
|
+
}
|
|
15
74
|
/**
|
|
16
75
|
* Describes the orientation of a placed tile independent of source-format
|
|
17
76
|
* flip-bit encodings. The eight legal combinations map to the eight distinct
|
|
@@ -101,9 +160,20 @@ export interface ResolvedTile {
|
|
|
101
160
|
/** Orientation transform for this placed tile. */
|
|
102
161
|
readonly transform: TileTransform;
|
|
103
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* One frame of a tile animation: which local tile to show, and for how long.
|
|
165
|
+
* Mirrors Tiled's per-tile animation frame model.
|
|
166
|
+
* @advanced
|
|
167
|
+
*/
|
|
168
|
+
export interface TileAnimationFrame {
|
|
169
|
+
/** Local tile ID shown during this frame (within the tile's own tileset). */
|
|
170
|
+
readonly localTileId: number;
|
|
171
|
+
/** Frame duration in milliseconds. */
|
|
172
|
+
readonly duration: number;
|
|
173
|
+
}
|
|
104
174
|
/**
|
|
105
175
|
* Optional per-tile metadata in a {@link TileSet}. Sparse — only defined
|
|
106
|
-
* tiles carry a definition.
|
|
176
|
+
* tiles carry a definition.
|
|
107
177
|
* @advanced
|
|
108
178
|
*/
|
|
109
179
|
export interface TileDefinition {
|
|
@@ -111,6 +181,18 @@ export interface TileDefinition {
|
|
|
111
181
|
readonly localTileId: number;
|
|
112
182
|
/** Tile properties (copied and frozen by the tileset). */
|
|
113
183
|
readonly properties?: TileProperties;
|
|
184
|
+
/**
|
|
185
|
+
* Animation frame sequence for this tile, if animated. The frames are
|
|
186
|
+
* driven at runtime by a {@link import('./TileAnimator').TileAnimator};
|
|
187
|
+
* frame[0] is the tile's resting/base frame.
|
|
188
|
+
*/
|
|
189
|
+
readonly animation?: readonly TileAnimationFrame[];
|
|
190
|
+
/**
|
|
191
|
+
* Per-tile collision shapes sourced from the Tiled `objectgroup` on the tile.
|
|
192
|
+
* Shapes are in tile-local pixel space (origin = top-left of the tile cell).
|
|
193
|
+
* Only present when the source map defines collision geometry for this tile.
|
|
194
|
+
*/
|
|
195
|
+
readonly collision?: readonly TileMapObject[];
|
|
114
196
|
}
|
|
115
197
|
/** A signed chunk coordinate pair. */
|
|
116
198
|
export interface ChunkCoord {
|
package/dist/esm/types.js
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
// ── Properties ────────────────────────────────────────────────────────────
|
|
2
|
+
/**
|
|
3
|
+
* Discriminant for the three structured, non-scalar {@link TilePropertyValue}
|
|
4
|
+
* variants: {@link TilePropertyPoint}, {@link TilePropertyObjectRef}, and
|
|
5
|
+
* {@link TilePropertyTileRef}.
|
|
6
|
+
*
|
|
7
|
+
* Modelled as a frozen string map (not a TS `enum`) so the values stay
|
|
8
|
+
* wire-stable, survive `verbatimModuleSyntax` (no emitted runtime helper),
|
|
9
|
+
* and follow the package convention for enum-like constants (see
|
|
10
|
+
* {@link import('./ObjectLayer').ObjectKind}).
|
|
11
|
+
* @stable
|
|
12
|
+
*/
|
|
13
|
+
const TilePropertyKind = {
|
|
14
|
+
Point: 'point',
|
|
15
|
+
ObjectRef: 'objectRef',
|
|
16
|
+
TileRef: 'tileRef',
|
|
17
|
+
};
|
|
1
18
|
/** The identity transform: no flip, no diagonal. */
|
|
2
19
|
const TILE_TRANSFORM_IDENTITY = Object.freeze({
|
|
3
20
|
flipX: false,
|
|
@@ -117,5 +134,5 @@ function validateInteger(value, label) {
|
|
|
117
134
|
}
|
|
118
135
|
}
|
|
119
136
|
|
|
120
|
-
export { MAX_LOCAL_TILE_ID, MAX_TILESET_INDEX, PACKED_LOCAL_BITS, PACKED_LOCAL_MASK, PACKED_TILESET_BITS, PACKED_TILESET_MASK, PACKED_TILESET_SHIFT, PACKED_TRANSFORM_BITS, PACKED_TRANSFORM_MASK, PACKED_TRANSFORM_SHIFT, TILE_TRANSFORM_IDENTITY, packTile, tileToChunkCoord, tileToLocalInChunk, unpackTile, validateInteger, validateNonNegativeInteger, validatePositiveInteger };
|
|
137
|
+
export { MAX_LOCAL_TILE_ID, MAX_TILESET_INDEX, PACKED_LOCAL_BITS, PACKED_LOCAL_MASK, PACKED_TILESET_BITS, PACKED_TILESET_MASK, PACKED_TILESET_SHIFT, PACKED_TRANSFORM_BITS, PACKED_TRANSFORM_MASK, PACKED_TRANSFORM_SHIFT, TILE_TRANSFORM_IDENTITY, TilePropertyKind, packTile, tileToChunkCoord, tileToLocalInChunk, unpackTile, validateInteger, validateNonNegativeInteger, validatePositiveInteger };
|
|
121
138
|
//# sourceMappingURL=types.js.map
|
package/dist/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../src/types.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../src/types.ts"],"sourcesContent":[null],"names":[],"mappings":"AAGA;AAEA;;;;;;;;;;AAUG;AACI,MAAM,gBAAgB,GAAG;AAC9B,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,SAAS,EAAE,WAAW;AACtB,IAAA,OAAO,EAAE,SAAS;;AA6FpB;AACO,MAAM,uBAAuB,GAA4B,MAAM,CAAC,MAAM,CAAC;AAC5E,IAAA,KAAK,EAAE,KAAK;AACZ,IAAA,KAAK,EAAE,KAAK;AACZ,IAAA,QAAQ,EAAE,KAAK;AAChB,CAAA;AAkCD;AACO,MAAM,iBAAiB,GAAG;AACjC;AACO,MAAM,mBAAmB,GAAG;AACnC;AACO,MAAM,qBAAqB,GAAG;AAE9B,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,iBAAiB,IAAI;AACrD,MAAM,mBAAmB,GAAG,CAAC,CAAC,CAAC,IAAI,mBAAmB,IAAI,CAAC,KAAK;AAChE,MAAM,qBAAqB,GAAG,CAAC,CAAC,CAAC,IAAI,qBAAqB,IAAI,CAAC,MAAM,iBAAiB,GAAG,mBAAmB;AAE5G,MAAM,oBAAoB,GAAG;AAC7B,MAAM,sBAAsB,GAAG,iBAAiB,GAAG;AAE1D;AACO,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,mBAAmB,IAAI;AAC9D;AACO,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,iBAAiB,IAAI;AAE5D;AACA,MAAM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AAK,CAAA,iCAAA,EAAoC,KAAK,CAAA,EAAA,CAAI,CAAC;IACxE;AACF;AAEA;;AAEG;AACG,SAAU,0BAA0B,CAAC,KAAa,EAAE,KAAa,EAAA;IACrE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE;QACpE,MAAM,IAAI,KAAK,CAAC,CAAA,EAAG,KAAK,CAAA,qCAAA,EAAwC,KAAK,CAAA,EAAA,CAAI,CAAC;IAC5E;AACF;AAEA;;AAEG;AACG,SAAU,eAAe,CAAC,KAAa,EAAE,KAAa,EAAA;AAC1D,IAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;QACvD,MAAM,IAAI,KAAK,CAAC,CAAA,EAAG,KAAK,CAAA,+BAAA,EAAkC,KAAK,CAAA,EAAA,CAAI,CAAC;IACtE;AACF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codexo/exojs-tilemap",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "Generic, format-independent tilemap runtime for ExoJS.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"LICENSE"
|
|
34
34
|
],
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@codexo/exojs": "0.
|
|
36
|
+
"@codexo/exojs": "0.15.x"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@codexo/exojs": "0.
|
|
39
|
+
"@codexo/exojs": "0.15.1",
|
|
40
40
|
"@codexo/exojs-config": "0.0.0"
|
|
41
41
|
},
|
|
42
42
|
"license": "MIT",
|