@codexo/exojs-aseprite 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/README.md +83 -0
- package/dist/esm/AsepriteData.d.ts +5 -0
- package/dist/esm/AsepriteData.js.map +1 -1
- package/dist/esm/AsepriteSheet.d.ts +29 -5
- package/dist/esm/AsepriteSheet.js +123 -21
- package/dist/esm/AsepriteSheet.js.map +1 -1
- package/dist/esm/asepriteBinding.js +5 -1
- package/dist/esm/asepriteBinding.js.map +1 -1
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# @codexo/exojs-aseprite
|
|
2
|
+
|
|
3
|
+
Official ExoJS extension for loading [Aseprite](https://www.aseprite.org) JSON sprite-sheet
|
|
4
|
+
exports into a ready-to-animate sprite, with one animation clip per Aseprite frame tag.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install @codexo/exojs @codexo/exojs-aseprite
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`@codexo/exojs` is a peer dependency. This package has no other runtime dependencies.
|
|
13
|
+
|
|
14
|
+
> Export your sprite sheet from Aseprite as a **JSON + PNG** pair (`File → Export Sprite Sheet`,
|
|
15
|
+
> *Output → JSON Data*). Either array or hash frame mode works; frame tags become animation clips.
|
|
16
|
+
|
|
17
|
+
## What this package provides
|
|
18
|
+
|
|
19
|
+
- `AsepriteSheet` — parsed sprite sheet; the result of `loader.load(AsepriteSheet, url)`. Exposes
|
|
20
|
+
the underlying `spritesheet`, a `clips` map (one `AnimatedSpriteClipDefinition` per frame tag),
|
|
21
|
+
and `createAnimatedSprite()` for a ready-to-play `AnimatedSprite`
|
|
22
|
+
- `asepriteExtension` — extension descriptor registering the Aseprite asset binding
|
|
23
|
+
- `asepriteBinding` — the underlying `AssetBinding` (advanced/custom wiring)
|
|
24
|
+
- `AsepriteFormatError` — typed error thrown on malformed Aseprite JSON
|
|
25
|
+
- `AsepriteData` and related types (`AsepriteFrameData`, `AsepriteFrameTag`, `AsepriteMeta`,
|
|
26
|
+
`AsepriteSlice`, …) plus the `isAsepriteArrayData` guard
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
Register the extension, load an Aseprite JSON export, and create an animated sprite. The extension
|
|
31
|
+
fetches the JSON, resolves and loads the packed texture, and builds one clip per frame tag:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { Application } from '@codexo/exojs';
|
|
35
|
+
import { AsepriteSheet, asepriteExtension } from '@codexo/exojs-aseprite';
|
|
36
|
+
|
|
37
|
+
const app = new Application({ extensions: [asepriteExtension] });
|
|
38
|
+
|
|
39
|
+
const sheet = await app.loader.load(AsepriteSheet, 'sprites/hero.aseprite.json');
|
|
40
|
+
|
|
41
|
+
const sprite = sheet.createAnimatedSprite();
|
|
42
|
+
sprite.play('run'); // 'run' is an Aseprite frame-tag name
|
|
43
|
+
app.scene.root.addChild(sprite);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Clip frame rate is derived from each frame's Aseprite `duration` (falling back to 12 fps). Frame
|
|
47
|
+
indices in a tag are resolved against the ordered frame array; out-of-range indices are skipped.
|
|
48
|
+
|
|
49
|
+
## `/register` convenience entry
|
|
50
|
+
|
|
51
|
+
Importing `/register` registers `asepriteExtension` in the global `ExtensionRegistry`, so
|
|
52
|
+
subsequently created Applications that use global defaults pick it up automatically:
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
// Side effect: registers asepriteExtension in the global ExtensionRegistry.
|
|
56
|
+
import '@codexo/exojs-aseprite/register';
|
|
57
|
+
|
|
58
|
+
// All named exports are also re-exported from /register:
|
|
59
|
+
import { AsepriteSheet, asepriteExtension } from '@codexo/exojs-aseprite/register';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
This is the only side-effectful entry — importing the package root (`@codexo/exojs-aseprite`) does
|
|
63
|
+
**not** register anything.
|
|
64
|
+
|
|
65
|
+
## Texture ownership
|
|
66
|
+
|
|
67
|
+
The packed texture is loaded via the Loader and stays in the Loader cache. `AsepriteSheet.destroy()`
|
|
68
|
+
releases the parsed sprite sheet; the Loader handles texture lifecycle and deduplication.
|
|
69
|
+
|
|
70
|
+
## Core compatibility
|
|
71
|
+
|
|
72
|
+
| `@codexo/exojs-aseprite` | `@codexo/exojs` |
|
|
73
|
+
|---|---|
|
|
74
|
+
| 0.14.x | 0.14.x |
|
|
75
|
+
|
|
76
|
+
## Links
|
|
77
|
+
|
|
78
|
+
- [API reference](https://exojs.dev/api/exojs-aseprite)
|
|
79
|
+
- [Aseprite](https://www.aseprite.org)
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
MIT © Codexo
|
|
@@ -35,6 +35,11 @@ export interface AsepriteFrameTag {
|
|
|
35
35
|
/** Inclusive start frame index. */
|
|
36
36
|
readonly from: number;
|
|
37
37
|
readonly name: string;
|
|
38
|
+
/**
|
|
39
|
+
* Number of times the tag plays before stopping, as a numeric string
|
|
40
|
+
* (e.g. `"1"`, `"2"`). Absent means the tag loops indefinitely.
|
|
41
|
+
*/
|
|
42
|
+
readonly repeat?: string;
|
|
38
43
|
}
|
|
39
44
|
/** A single layer entry in the Aseprite JSON metadata. */
|
|
40
45
|
export interface AsepriteLayer {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsepriteData.js","sources":["../../../src/AsepriteData.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;
|
|
1
|
+
{"version":3,"file":"AsepriteData.js","sources":["../../../src/AsepriteData.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AAuGA;AACM,SAAU,mBAAmB,CAAC,IAAkB,EAAA;IACpD,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;AACnC;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnimatedSprite, type AnimatedSpriteClipDefinition, Spritesheet, type Texture } from '@codexo/exojs';
|
|
2
|
-
import { type AsepriteData } from './AsepriteData';
|
|
2
|
+
import { type AsepriteData, type AsepriteSlice } from './AsepriteData';
|
|
3
3
|
/**
|
|
4
4
|
* Parsed representation of an Aseprite JSON sprite sheet export.
|
|
5
5
|
*
|
|
@@ -29,12 +29,21 @@ export declare class AsepriteSheet {
|
|
|
29
29
|
* they are cloned automatically when passed to {@link AnimatedSprite.defineClip}.
|
|
30
30
|
*/
|
|
31
31
|
readonly clips: ReadonlyMap<string, AnimatedSpriteClipDefinition>;
|
|
32
|
+
/**
|
|
33
|
+
* Named slices from the Aseprite `meta.slices` metadata, keyed by slice
|
|
34
|
+
* name. Slices describe editor-defined regions — hitboxes, nine-patch
|
|
35
|
+
* borders, UI anchor points — that aren't part of the frame/animation
|
|
36
|
+
* data itself. Each {@link AsepriteSlice} carries one {@link AsepriteSliceKey}
|
|
37
|
+
* per frame at which its bounds change; consumers resolve the applicable
|
|
38
|
+
* key for a given frame index themselves.
|
|
39
|
+
*/
|
|
40
|
+
readonly slices: ReadonlyMap<string, AsepriteSlice>;
|
|
32
41
|
/**
|
|
33
42
|
* @internal — use {@link AsepriteSheet.parse} to create instances.
|
|
34
43
|
* The public modifier is required for the Loader's `AssetConstructor` token
|
|
35
44
|
* contract; users should call `parse()` instead of constructing directly.
|
|
36
45
|
*/
|
|
37
|
-
constructor(spritesheet: Spritesheet, clips: ReadonlyMap<string, AnimatedSpriteClipDefinition>);
|
|
46
|
+
constructor(spritesheet: Spritesheet, clips: ReadonlyMap<string, AnimatedSpriteClipDefinition>, slices: ReadonlyMap<string, AsepriteSlice>);
|
|
38
47
|
/**
|
|
39
48
|
* Parse a raw {@link AsepriteData} document and the already-loaded
|
|
40
49
|
* {@link Texture} into an {@link AsepriteSheet}.
|
|
@@ -43,9 +52,24 @@ export declare class AsepriteSheet {
|
|
|
43
52
|
* `frameTags` are resolved against the ordered frame array; out-of-range
|
|
44
53
|
* indices are silently skipped.
|
|
45
54
|
*
|
|
46
|
-
*
|
|
47
|
-
* `
|
|
48
|
-
*
|
|
55
|
+
* A tag's `direction` determines the expanded frame sequence fed into the
|
|
56
|
+
* clip — `forward` and `reverse` play the `[from, to]` range in order or
|
|
57
|
+
* in reverse, while `pingpong`/`pingpong_reverse` append a backward pass
|
|
58
|
+
* (excluding both endpoints) so the bounce plays back correctly on the
|
|
59
|
+
* engine's forward-only {@link AnimatedSprite} playback. The tag's
|
|
60
|
+
* `repeat` field maps directly onto {@link AnimatedSpriteClipDefinition.repeat}:
|
|
61
|
+
* absent means the clip loops indefinitely (`repeat: -1`); a numeric
|
|
62
|
+
* string (`"1"`, `"2"`, …) means it plays exactly that many full cycles
|
|
63
|
+
* before stopping.
|
|
64
|
+
*
|
|
65
|
+
* Each clip's `frameDurations` carries the real per-frame `duration` from
|
|
66
|
+
* the export (falling back to the tag's average when a frame's duration is
|
|
67
|
+
* non-positive), so uneven hold-frames survive into playback instead of
|
|
68
|
+
* being flattened to a uniform fps. `frameOffsets` carries each frame's
|
|
69
|
+
* `spriteSourceSize` `{x,y}` — its trimmed content's offset within the
|
|
70
|
+
* untrimmed canvas — whenever any frame in the tag is trimmed, so frames
|
|
71
|
+
* trimmed by different amounts stay anchored instead of jittering; it's
|
|
72
|
+
* omitted entirely for tags with no trimmed frames.
|
|
49
73
|
*/
|
|
50
74
|
static parse(data: AsepriteData, texture: Texture): AsepriteSheet;
|
|
51
75
|
/**
|
|
@@ -13,17 +13,63 @@ function normaliseFrames(data) {
|
|
|
13
13
|
return Object.values(data.frames);
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* Expands a frame tag's inclusive `[from, to]` range into the ordered
|
|
17
|
+
* sequence of frame indices it actually plays, according to its
|
|
18
|
+
* {@link AsepriteDirection}. Indices are not bounds-checked against the
|
|
19
|
+
* frame array here; callers filter out-of-range entries separately.
|
|
20
|
+
*
|
|
21
|
+
* - `forward`: `[from, from+1, ..., to]`.
|
|
22
|
+
* - `reverse`: `[to, to-1, ..., from]`.
|
|
23
|
+
* - `pingpong`: a forward pass followed by a backward pass that excludes
|
|
24
|
+
* both endpoints, e.g. `[0,1,2]` becomes `[0,1,2,1]`.
|
|
25
|
+
* - `pingpong_reverse`: the mirrored shape, starting from `to`.
|
|
26
|
+
* - A single-frame tag (`from === to`) always yields just that one frame.
|
|
27
|
+
*/
|
|
28
|
+
function expandFrameIndices(tag) {
|
|
29
|
+
const { from, to } = tag;
|
|
30
|
+
if (from === to) {
|
|
31
|
+
return [from];
|
|
32
|
+
}
|
|
33
|
+
const indices = [];
|
|
34
|
+
switch (tag.direction) {
|
|
35
|
+
case 'reverse':
|
|
36
|
+
for (let i = to; i >= from; i--)
|
|
37
|
+
indices.push(i);
|
|
38
|
+
break;
|
|
39
|
+
case 'pingpong':
|
|
40
|
+
for (let i = from; i <= to; i++)
|
|
41
|
+
indices.push(i);
|
|
42
|
+
for (let i = to - 1; i > from; i--)
|
|
43
|
+
indices.push(i);
|
|
44
|
+
break;
|
|
45
|
+
case 'pingpong_reverse':
|
|
46
|
+
for (let i = to; i >= from; i--)
|
|
47
|
+
indices.push(i);
|
|
48
|
+
for (let i = from + 1; i < to; i++)
|
|
49
|
+
indices.push(i);
|
|
50
|
+
break;
|
|
51
|
+
case 'forward':
|
|
52
|
+
default:
|
|
53
|
+
for (let i = from; i <= to; i++)
|
|
54
|
+
indices.push(i);
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
return indices;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Calculates the average frames-per-second for a sequence of frame indices,
|
|
61
|
+
* based on the per-frame `duration` field (milliseconds per frame) exported
|
|
62
|
+
* by Aseprite. Every occurrence of an index counts toward the average — for
|
|
63
|
+
* ping-pong sequences that means repeated (bounced) frames are weighted twice.
|
|
64
|
+
* Falls back to `12` fps when all durations are zero or the sequence is empty.
|
|
19
65
|
*/
|
|
20
|
-
function avgFps(
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
66
|
+
function avgFps(frameArray, indices) {
|
|
67
|
+
const durations = indices.filter(i => i >= 0 && i < frameArray.length).map(i => frameArray[i].duration);
|
|
68
|
+
if (durations.length === 0) {
|
|
23
69
|
return 12;
|
|
24
70
|
}
|
|
25
|
-
const totalMs =
|
|
26
|
-
const avgMs = totalMs /
|
|
71
|
+
const totalMs = durations.reduce((sum, d) => sum + d, 0);
|
|
72
|
+
const avgMs = totalMs / durations.length;
|
|
27
73
|
return avgMs > 0 ? 1000 / avgMs : 12;
|
|
28
74
|
}
|
|
29
75
|
/**
|
|
@@ -55,14 +101,24 @@ class AsepriteSheet {
|
|
|
55
101
|
* they are cloned automatically when passed to {@link AnimatedSprite.defineClip}.
|
|
56
102
|
*/
|
|
57
103
|
clips;
|
|
104
|
+
/**
|
|
105
|
+
* Named slices from the Aseprite `meta.slices` metadata, keyed by slice
|
|
106
|
+
* name. Slices describe editor-defined regions — hitboxes, nine-patch
|
|
107
|
+
* borders, UI anchor points — that aren't part of the frame/animation
|
|
108
|
+
* data itself. Each {@link AsepriteSlice} carries one {@link AsepriteSliceKey}
|
|
109
|
+
* per frame at which its bounds change; consumers resolve the applicable
|
|
110
|
+
* key for a given frame index themselves.
|
|
111
|
+
*/
|
|
112
|
+
slices;
|
|
58
113
|
/**
|
|
59
114
|
* @internal — use {@link AsepriteSheet.parse} to create instances.
|
|
60
115
|
* The public modifier is required for the Loader's `AssetConstructor` token
|
|
61
116
|
* contract; users should call `parse()` instead of constructing directly.
|
|
62
117
|
*/
|
|
63
|
-
constructor(spritesheet, clips) {
|
|
118
|
+
constructor(spritesheet, clips, slices) {
|
|
64
119
|
this.spritesheet = spritesheet;
|
|
65
120
|
this.clips = clips;
|
|
121
|
+
this.slices = slices;
|
|
66
122
|
}
|
|
67
123
|
/**
|
|
68
124
|
* Parse a raw {@link AsepriteData} document and the already-loaded
|
|
@@ -72,9 +128,24 @@ class AsepriteSheet {
|
|
|
72
128
|
* `frameTags` are resolved against the ordered frame array; out-of-range
|
|
73
129
|
* indices are silently skipped.
|
|
74
130
|
*
|
|
75
|
-
*
|
|
76
|
-
* `
|
|
77
|
-
*
|
|
131
|
+
* A tag's `direction` determines the expanded frame sequence fed into the
|
|
132
|
+
* clip — `forward` and `reverse` play the `[from, to]` range in order or
|
|
133
|
+
* in reverse, while `pingpong`/`pingpong_reverse` append a backward pass
|
|
134
|
+
* (excluding both endpoints) so the bounce plays back correctly on the
|
|
135
|
+
* engine's forward-only {@link AnimatedSprite} playback. The tag's
|
|
136
|
+
* `repeat` field maps directly onto {@link AnimatedSpriteClipDefinition.repeat}:
|
|
137
|
+
* absent means the clip loops indefinitely (`repeat: -1`); a numeric
|
|
138
|
+
* string (`"1"`, `"2"`, …) means it plays exactly that many full cycles
|
|
139
|
+
* before stopping.
|
|
140
|
+
*
|
|
141
|
+
* Each clip's `frameDurations` carries the real per-frame `duration` from
|
|
142
|
+
* the export (falling back to the tag's average when a frame's duration is
|
|
143
|
+
* non-positive), so uneven hold-frames survive into playback instead of
|
|
144
|
+
* being flattened to a uniform fps. `frameOffsets` carries each frame's
|
|
145
|
+
* `spriteSourceSize` `{x,y}` — its trimmed content's offset within the
|
|
146
|
+
* untrimmed canvas — whenever any frame in the tag is trimmed, so frames
|
|
147
|
+
* trimmed by different amounts stay anchored instead of jittering; it's
|
|
148
|
+
* omitted entirely for tags with no trimmed frames.
|
|
78
149
|
*/
|
|
79
150
|
static parse(data, texture) {
|
|
80
151
|
const frameArray = normaliseFrames(data);
|
|
@@ -89,22 +160,53 @@ class AsepriteSheet {
|
|
|
89
160
|
const clips = new Map();
|
|
90
161
|
const frameTags = data.meta.frameTags ?? [];
|
|
91
162
|
for (const tag of frameTags) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
163
|
+
// Out-of-range indices are silently skipped; `validIndices` parallels
|
|
164
|
+
// `frames` exactly, so it's the basis for every other per-frame array
|
|
165
|
+
// (durations, offsets) built below.
|
|
166
|
+
const validIndices = expandFrameIndices(tag).filter(i => i >= 0 && i < frameArray.length);
|
|
167
|
+
const frames = validIndices.map(i => spritesheet.getFrame(String(i)));
|
|
98
168
|
if (frames.length === 0) {
|
|
99
169
|
continue;
|
|
100
170
|
}
|
|
171
|
+
// Aseprite's `tag.repeat` (a numeric string, `'1'` through any N) maps
|
|
172
|
+
// directly onto the engine's `repeat` count. Absent means the tag
|
|
173
|
+
// loops indefinitely, the engine's `-1` sentinel.
|
|
174
|
+
const repeat = tag.repeat !== undefined ? Number(tag.repeat) : -1;
|
|
175
|
+
const fps = avgFps(frameArray, validIndices);
|
|
176
|
+
// Per-frame hold duration (Aseprite "duration"), so uneven hold-frames
|
|
177
|
+
// (e.g. a lingering idle frame) survive into playback instead of being
|
|
178
|
+
// flattened to the tag's average fps. A non-positive duration (same
|
|
179
|
+
// degenerate case `avgFps` guards against) falls back to the average.
|
|
180
|
+
const avgDurationFallback = 1000 / fps;
|
|
181
|
+
const frameDurations = validIndices.map(i => {
|
|
182
|
+
const duration = frameArray[i].duration;
|
|
183
|
+
return duration > 0 ? duration : avgDurationFallback;
|
|
184
|
+
});
|
|
185
|
+
// Per-frame trim offset (Aseprite "spriteSourceSize"), so frames trimmed
|
|
186
|
+
// by different amounts stay anchored to the same point in the untrimmed
|
|
187
|
+
// canvas instead of jittering frame to frame. Omitted entirely when no
|
|
188
|
+
// frame in the tag is trimmed, to avoid noise on untrimmed sheets.
|
|
189
|
+
const anyTrimmed = validIndices.some(i => frameArray[i].trimmed);
|
|
190
|
+
const frameOffsets = anyTrimmed
|
|
191
|
+
? validIndices.map(i => {
|
|
192
|
+
const { x, y } = frameArray[i].spriteSourceSize;
|
|
193
|
+
return { x, y };
|
|
194
|
+
})
|
|
195
|
+
: undefined;
|
|
101
196
|
clips.set(tag.name, {
|
|
102
|
-
fps
|
|
197
|
+
fps,
|
|
103
198
|
frames,
|
|
104
|
-
|
|
199
|
+
repeat,
|
|
200
|
+
frameDurations,
|
|
201
|
+
...(frameOffsets ? { frameOffsets } : {}),
|
|
105
202
|
});
|
|
106
203
|
}
|
|
107
|
-
|
|
204
|
+
// Build the slices map from meta.slices, keyed by slice name.
|
|
205
|
+
const slices = new Map();
|
|
206
|
+
for (const slice of data.meta.slices ?? []) {
|
|
207
|
+
slices.set(slice.name, slice);
|
|
208
|
+
}
|
|
209
|
+
return new AsepriteSheet(spritesheet, clips, slices);
|
|
108
210
|
}
|
|
109
211
|
/**
|
|
110
212
|
* Create an {@link AnimatedSprite} with all frame-tag clips pre-defined.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsepriteSheet.js","sources":["../../../src/AsepriteSheet.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAIA;;;;AAIG;AACH,SAAS,eAAe,CAAC,IAAkB,EAAA;AACzC,IAAA,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAE;AAC7B,QAAA,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;IACzB;IAEA,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;AACnC;AAEA
|
|
1
|
+
{"version":3,"file":"AsepriteSheet.js","sources":["../../../src/AsepriteSheet.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAIA;;;;AAIG;AACH,SAAS,eAAe,CAAC,IAAkB,EAAA;AACzC,IAAA,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAE;AAC7B,QAAA,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;IACzB;IAEA,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;AACnC;AAEA;;;;;;;;;;;;AAYG;AACH,SAAS,kBAAkB,CAAC,GAAqB,EAAA;AAC/C,IAAA,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,GAAG;AAExB,IAAA,IAAI,IAAI,KAAK,EAAE,E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,GAAG,CAAC,CAAC,IAAG;AACnB,oBAAA,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,UAAU,CAAC,CAAC,CAAE,CAAC,gBAAgB;AAEhD,oBAAA,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE;AACjB,gBAAA,CAAC;kBACD,SAAS;AAEb,YAAA,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE;gBAClB,GAAG;gBACH,MAAM;gBACN,MAAM;gBACN,cAAc;AACd,gBAAA,IAAI,YAAY,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC;AAC1C,aAAA,CAAC;QACJ;;AAGA,QAAA,MAAM,MAAM,GAAG,IAAI,GAAG,EAAyB;QAE/C,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE;YAC1C,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;QAC/B;QAEA,OAAO,IAAI,aAAa,CAAC,WAAW,EAAE,KAAK,EAAE,MAAM,CAAC;IACtD;AAEA;;;;;;AAMG;IACI,oBAAoB,GAAA;QACzB,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;QAE3D,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE;AACrC,YAAA,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC;QAC/B;AAEA,QAAA,OAAO,MAAM;IACf;;IAGO,OAAO,GAAA;AACZ,QAAA,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;IAC5B;AACD;;;;"}
|
|
@@ -29,7 +29,11 @@ function resolveAsepriteUrl(ref, base) {
|
|
|
29
29
|
return new URL(ref, base).href;
|
|
30
30
|
}
|
|
31
31
|
const resolved = new URL(ref, syntheticOrigin + base.replace(/^\/+/, ''));
|
|
32
|
-
|
|
32
|
+
const relative = resolved.href.slice(syntheticOrigin.length);
|
|
33
|
+
// A root-relative base must produce a root-relative result again — dropping
|
|
34
|
+
// the leading slash would make the browser re-resolve the reference against
|
|
35
|
+
// the document base URL (e.g. `/site/assets/x.png` → `/site/site/assets/…`).
|
|
36
|
+
return base.startsWith('/') ? `/${relative}` : relative;
|
|
33
37
|
}
|
|
34
38
|
// ── Validation ───────────────────────────────────────────────────────────────
|
|
35
39
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asepriteBinding.js","sources":["../../../src/asepriteBinding.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;AACA;AACA;AACA;AAQA;AAEA;AACA,MAAM,kBAAkB,GAAG,iCAAiC;AAE5D;AACA,MAAM,mBAAmB,GAAG,qBAAqB;AAEjD;AACA,MAAM,eAAe,GAAG,wBAAwB;AAEhD;;;;;;;;AAQG;AACH,SAAS,kBAAkB,CAAC,GAAW,EAAE,IAAY,EAAA;AACnD,IAAA,IAAI,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;AAChC,QAAA,OAAO,GAAG;IACZ;AAEA,IAAA,IAAI,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAClC,OAAO,IAAI,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,IAAI;IAChC;AAEA,IAAA,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"asepriteBinding.js","sources":["../../../src/asepriteBinding.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;AACA;AACA;AACA;AAQA;AAEA;AACA,MAAM,kBAAkB,GAAG,iCAAiC;AAE5D;AACA,MAAM,mBAAmB,GAAG,qBAAqB;AAEjD;AACA,MAAM,eAAe,GAAG,wBAAwB;AAEhD;;;;;;;;AAQG;AACH,SAAS,kBAAkB,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O,IAAI,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAY;gBAErE,OAAO,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC;YAC3C,CAAC;SACoC;IACzC,CAAC;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codexo/exojs-aseprite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "Aseprite sprite sheet asset extension 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",
|