@roost2d/pixi 0.1.0-rc.0

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,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # @roost2d/pixi
2
+
3
+ PixiJS v8 application, camera, layer, atlas-texture, and Rig2D display adapters.
4
+
5
+ ```sh
6
+ npm install pixi.js @roost2d/pixi
7
+ ```
8
+
9
+ ```ts
10
+ import { PixiApplicationHost } from '@roost2d/pixi';
11
+ const host = await PixiApplicationHost.create({ mount: document.querySelector('#app')!, resizeTo: window });
12
+ ```
13
+
14
+ Use `PixiAssetLoader` with `@roost2d/assets` to turn a logical atlas-frame ID into a cropped Pixi texture:
15
+
16
+ ```ts
17
+ import { AssetManifestResolver, LazyAssetLoader } from '@roost2d/assets';
18
+ import { PixiAssetLoader } from '@roost2d/pixi';
19
+
20
+ const resolver = new AssetManifestResolver(manifest, { baseUrl });
21
+ const textures = new PixiAssetLoader(resolver, new LazyAssetLoader(resolver));
22
+ const texture = await textures.load('chikn-flat/admiral');
23
+ ```
24
+
25
+ The `LazyAssetLoader` is required: every texture is decoded from bytes it has already integrity-checked, and the URL is never fetched a second time. Because these sources stay outside Pixi's `Assets` cache, `unload(assetId)` and `clear()` own their teardown — call one of them, plus `host.dispose()`, during teardown. [Complete quick start](https://github.com/Roost2D/roost2d/blob/main/docs/getting-started.md).
@@ -0,0 +1,116 @@
1
+ import { Application, Container, Texture, type ApplicationOptions, type PointData } from 'pixi.js';
2
+ import type { AssetManifestResolver, LazyAssetLoader } from '@roost2d/assets';
3
+ import type { RigDisplayFactory, RigDisplayNode } from '@roost2d/rig2d';
4
+ import type { TextureRef } from '@roost2d/contracts';
5
+ export interface PixiHostOptions extends Partial<ApplicationOptions> {
6
+ mount: HTMLElement;
7
+ resizeTo?: Window | HTMLElement;
8
+ onContextLost?: (event: Event) => void;
9
+ onContextRestored?: (event: Event) => void;
10
+ }
11
+ export declare class PixiApplicationHost {
12
+ readonly mount: HTMLElement;
13
+ readonly app: Application<import("pixi.js").Renderer>;
14
+ private resizeObserver?;
15
+ private readonly listeners;
16
+ private constructor();
17
+ static create(options: PixiHostOptions): Promise<PixiApplicationHost>;
18
+ resize(width: number, height: number): void;
19
+ dispose(): void;
20
+ private observeResize;
21
+ }
22
+ export interface LayerDefinition<Id extends string = string> {
23
+ id: Id;
24
+ order: number;
25
+ sortable?: boolean;
26
+ }
27
+ export declare class LayerStack<Id extends string = string> {
28
+ readonly root: Container<import("pixi.js").ContainerChild>;
29
+ private readonly layers;
30
+ constructor(definitions: readonly LayerDefinition<Id>[]);
31
+ get(id: Id): Container;
32
+ add(id: Id, child: Container): Container;
33
+ remove(id: Id, child: Container): Container;
34
+ destroy(): void;
35
+ }
36
+ export interface CameraBounds {
37
+ x: number;
38
+ y: number;
39
+ width: number;
40
+ height: number;
41
+ }
42
+ export declare class Camera2D {
43
+ readonly container: Container<import("pixi.js").ContainerChild>;
44
+ private viewportWidth;
45
+ private viewportHeight;
46
+ private bounds?;
47
+ minZoom: number;
48
+ maxZoom: number;
49
+ setViewport(width: number, height: number): void;
50
+ setBounds(bounds?: CameraBounds): void;
51
+ setPosition(x: number, y: number): void;
52
+ pan(deltaX: number, deltaY: number): void;
53
+ setZoom(zoom: number, focusScreen?: PointData): void;
54
+ worldToScreen(point: PointData): PointData;
55
+ screenToWorld(point: PointData): PointData;
56
+ follow(point: PointData, smoothing?: number): void;
57
+ private clamp;
58
+ }
59
+ /**
60
+ * Resolves logical frame assets into cropped Pixi textures, sharing each atlas page source.
61
+ *
62
+ * Every texture is decoded from bytes `LazyAssetLoader` has already integrity-checked. The loader
63
+ * deliberately never asks Pixi to fetch the URL itself: two independent requests let a host serve
64
+ * clean bytes to the verifying one and hostile bytes to the rendering one, and the check would
65
+ * still pass. Because these sources are outside Pixi's `Assets` cache, nothing else will collect
66
+ * them — `unload`/`clear` own their teardown.
67
+ */
68
+ export declare class PixiAssetLoader {
69
+ private readonly resolver;
70
+ private readonly integrityLoader;
71
+ private readonly textures;
72
+ private readonly pages;
73
+ private readonly pageUrls;
74
+ constructor(resolver: AssetManifestResolver, integrityLoader: LazyAssetLoader);
75
+ load(assetId: string): Promise<Texture>;
76
+ unload(assetId: string): void;
77
+ clear(): Promise<void>;
78
+ private tryResolve;
79
+ private openPage;
80
+ private decode;
81
+ private closePage;
82
+ }
83
+ export declare class PixiRigNode implements RigDisplayNode {
84
+ readonly display: Container;
85
+ constructor(display: Container);
86
+ get x(): number;
87
+ set x(value: number);
88
+ get y(): number;
89
+ set y(value: number);
90
+ get rotation(): number;
91
+ set rotation(value: number);
92
+ get scaleX(): number;
93
+ set scaleX(value: number);
94
+ get scaleY(): number;
95
+ set scaleY(value: number);
96
+ get alpha(): number;
97
+ set alpha(value: number);
98
+ get visible(): boolean;
99
+ set visible(value: boolean);
100
+ get zIndex(): number;
101
+ set zIndex(value: number);
102
+ get tint(): number | undefined;
103
+ set tint(value: number | undefined);
104
+ }
105
+ /** Pixi display adapter for renderer-neutral RigRuntime. Textures must be preloaded. */
106
+ export declare class PixiRigFactory implements RigDisplayFactory {
107
+ private readonly textures;
108
+ readonly root: Container<import("pixi.js").ContainerChild>;
109
+ constructor(textures: ReadonlyMap<string, Texture>);
110
+ createBone(id: string): PixiRigNode;
111
+ createAttachment(id: string, texture: TextureRef): PixiRigNode;
112
+ attach(parent: RigDisplayNode | undefined, child: RigDisplayNode): void;
113
+ destroy(node: RigDisplayNode): void;
114
+ destroyRoot(): void;
115
+ }
116
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAkC,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,SAAS,EAAsB,MAAM,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;IAC/G,IAAI,IAAI,IAAI,MAAM,GAAG,SAAS,CAA2E;IAAC,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAgF;CAC7N;AAED,wFAAwF;AACxF,qBAAa,cAAe,YAAW,iBAAiB;IAE1C,OAAO,CAAC,QAAQ,CAAC,QAAQ;IADrC,QAAQ,CAAC,IAAI,8CAAmB;gBACH,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC;IACnE,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW;IACnC,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,WAAW;IAK9D,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI;IACvE,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IACnC,WAAW,IAAI,IAAI;CACpB"}
package/dist/index.js ADDED
@@ -0,0 +1,271 @@
1
+ import { Application, Container, ImageSource, Rectangle, Sprite, Texture } from 'pixi.js';
2
+ export class PixiApplicationHost {
3
+ mount;
4
+ app = new Application();
5
+ resizeObserver;
6
+ listeners = [];
7
+ constructor(mount) {
8
+ this.mount = mount;
9
+ }
10
+ static async create(options) {
11
+ const host = new PixiApplicationHost(options.mount);
12
+ const { mount, resizeTo, onContextLost, onContextRestored, ...applicationOptions } = options;
13
+ await host.app.init({ antialias: true, autoDensity: true, resolution: globalThis.devicePixelRatio || 1, ...applicationOptions });
14
+ mount.replaceChildren(host.app.canvas);
15
+ if (resizeTo)
16
+ host.observeResize(resizeTo);
17
+ const canvas = host.app.canvas;
18
+ if (onContextLost) {
19
+ canvas.addEventListener('webglcontextlost', onContextLost);
20
+ host.listeners.push(() => canvas.removeEventListener('webglcontextlost', onContextLost));
21
+ }
22
+ if (onContextRestored) {
23
+ canvas.addEventListener('webglcontextrestored', onContextRestored);
24
+ host.listeners.push(() => canvas.removeEventListener('webglcontextrestored', onContextRestored));
25
+ }
26
+ return host;
27
+ }
28
+ resize(width, height) { this.app.renderer.resize(Math.max(1, width), Math.max(1, height)); }
29
+ dispose() {
30
+ this.resizeObserver?.disconnect();
31
+ for (const remove of this.listeners.splice(0))
32
+ remove();
33
+ this.app.destroy({ removeView: true }, { children: true, texture: false, textureSource: false });
34
+ }
35
+ observeResize(target) {
36
+ if (target instanceof Window) {
37
+ const resize = () => this.resize(target.innerWidth, target.innerHeight);
38
+ target.addEventListener('resize', resize);
39
+ this.listeners.push(() => target.removeEventListener('resize', resize));
40
+ resize();
41
+ return;
42
+ }
43
+ this.resizeObserver = new ResizeObserver(([entry]) => { if (entry)
44
+ this.resize(entry.contentRect.width, entry.contentRect.height); });
45
+ this.resizeObserver.observe(target);
46
+ }
47
+ }
48
+ export class LayerStack {
49
+ root = new Container();
50
+ layers = new Map();
51
+ constructor(definitions) {
52
+ this.root.sortableChildren = true;
53
+ for (const definition of definitions) {
54
+ if (this.layers.has(definition.id))
55
+ throw new Error(`Duplicate layer: ${definition.id}`);
56
+ const layer = new Container();
57
+ layer.label = definition.id;
58
+ layer.zIndex = definition.order;
59
+ layer.sortableChildren = definition.sortable ?? true;
60
+ this.layers.set(definition.id, layer);
61
+ this.root.addChild(layer);
62
+ }
63
+ }
64
+ get(id) { const layer = this.layers.get(id); if (!layer)
65
+ throw new Error(`Unknown layer: ${id}`); return layer; }
66
+ add(id, child) { this.get(id).addChild(child); return child; }
67
+ remove(id, child) { this.get(id).removeChild(child); return child; }
68
+ destroy() { this.root.destroy({ children: true }); this.layers.clear(); }
69
+ }
70
+ export class Camera2D {
71
+ container = new Container();
72
+ viewportWidth = 1;
73
+ viewportHeight = 1;
74
+ bounds;
75
+ minZoom = 0.1;
76
+ maxZoom = 8;
77
+ setViewport(width, height) { this.viewportWidth = Math.max(1, width); this.viewportHeight = Math.max(1, height); this.clamp(); }
78
+ setBounds(bounds) { this.bounds = bounds; this.clamp(); }
79
+ setPosition(x, y) { this.container.pivot.set(x, y); this.container.position.set(this.viewportWidth / 2, this.viewportHeight / 2); this.clamp(); }
80
+ pan(deltaX, deltaY) { this.setPosition(this.container.pivot.x + deltaX, this.container.pivot.y + deltaY); }
81
+ setZoom(zoom, focusScreen) {
82
+ const before = focusScreen ? this.screenToWorld(focusScreen) : undefined;
83
+ const next = Math.max(this.minZoom, Math.min(this.maxZoom, zoom));
84
+ this.container.scale.set(next);
85
+ if (before && focusScreen) {
86
+ const after = this.screenToWorld(focusScreen);
87
+ this.container.pivot.x += before.x - after.x;
88
+ this.container.pivot.y += before.y - after.y;
89
+ }
90
+ this.clamp();
91
+ }
92
+ worldToScreen(point) { return this.container.toGlobal(point); }
93
+ screenToWorld(point) { return this.container.toLocal(point); }
94
+ follow(point, smoothing = 1) {
95
+ const amount = Math.max(0, Math.min(1, smoothing));
96
+ this.setPosition(this.container.pivot.x + (point.x - this.container.pivot.x) * amount, this.container.pivot.y + (point.y - this.container.pivot.y) * amount);
97
+ }
98
+ clamp() {
99
+ this.container.position.set(this.viewportWidth / 2, this.viewportHeight / 2);
100
+ if (!this.bounds)
101
+ return;
102
+ const halfWidth = this.viewportWidth / (2 * this.container.scale.x);
103
+ const halfHeight = this.viewportHeight / (2 * this.container.scale.y);
104
+ const minX = this.bounds.x + Math.min(halfWidth, this.bounds.width / 2);
105
+ const maxX = this.bounds.x + Math.max(this.bounds.width - halfWidth, this.bounds.width / 2);
106
+ const minY = this.bounds.y + Math.min(halfHeight, this.bounds.height / 2);
107
+ const maxY = this.bounds.y + Math.max(this.bounds.height - halfHeight, this.bounds.height / 2);
108
+ this.container.pivot.set(Math.max(minX, Math.min(maxX, this.container.pivot.x)), Math.max(minY, Math.min(maxY, this.container.pivot.y)));
109
+ }
110
+ }
111
+ /**
112
+ * Resolves logical frame assets into cropped Pixi textures, sharing each atlas page source.
113
+ *
114
+ * Every texture is decoded from bytes `LazyAssetLoader` has already integrity-checked. The loader
115
+ * deliberately never asks Pixi to fetch the URL itself: two independent requests let a host serve
116
+ * clean bytes to the verifying one and hostile bytes to the rendering one, and the check would
117
+ * still pass. Because these sources are outside Pixi's `Assets` cache, nothing else will collect
118
+ * them — `unload`/`clear` own their teardown.
119
+ */
120
+ export class PixiAssetLoader {
121
+ resolver;
122
+ integrityLoader;
123
+ textures = new Map();
124
+ pages = new Map();
125
+ pageUrls = new Map();
126
+ constructor(resolver, integrityLoader) {
127
+ this.resolver = resolver;
128
+ this.integrityLoader = integrityLoader;
129
+ if (!integrityLoader)
130
+ throw new Error('PixiAssetLoader requires a LazyAssetLoader: textures are only built from integrity-checked bytes');
131
+ }
132
+ async load(assetId) {
133
+ const resolved = this.resolver.resolve(assetId);
134
+ const canonicalId = resolved.file.id;
135
+ const existing = this.textures.get(canonicalId);
136
+ if (existing)
137
+ return existing;
138
+ const url = resolved.url.href;
139
+ const page = this.pages.get(url) ?? this.openPage(url, canonicalId);
140
+ const source = await page.pending;
141
+ const settled = this.textures.get(canonicalId);
142
+ if (settled)
143
+ return settled; // a concurrent load won the race
144
+ const frame = resolved.variant.frame;
145
+ const texture = new Texture(frame ? { source, frame: new Rectangle(frame.x, frame.y, frame.width, frame.height) } : { source });
146
+ texture.label = resolved.variant.frameId ?? canonicalId;
147
+ page.refCount += 1;
148
+ this.textures.set(canonicalId, texture);
149
+ this.pageUrls.set(canonicalId, url);
150
+ return texture;
151
+ }
152
+ unload(assetId) {
153
+ const resolved = this.tryResolve(assetId);
154
+ if (!resolved)
155
+ return;
156
+ const canonicalId = resolved.file.id;
157
+ const texture = this.textures.get(canonicalId);
158
+ if (!texture)
159
+ return;
160
+ this.textures.delete(canonicalId);
161
+ texture.destroy(false);
162
+ const url = this.pageUrls.get(canonicalId);
163
+ this.pageUrls.delete(canonicalId);
164
+ this.integrityLoader.unload(canonicalId);
165
+ if (url === undefined)
166
+ return;
167
+ const page = this.pages.get(url);
168
+ if (!page)
169
+ return;
170
+ page.refCount -= 1;
171
+ if (page.refCount <= 0)
172
+ this.closePage(url, page);
173
+ }
174
+ async clear() {
175
+ // Settle in-flight decodes first so nothing is destroyed while it is still being built.
176
+ await Promise.allSettled([...this.pages.values()].map((page) => page.pending));
177
+ for (const texture of this.textures.values())
178
+ texture.destroy(false);
179
+ this.textures.clear();
180
+ this.pageUrls.clear();
181
+ for (const [url, page] of [...this.pages])
182
+ this.closePage(url, page);
183
+ this.integrityLoader.clear();
184
+ }
185
+ tryResolve(assetId) { try {
186
+ return this.resolver.resolve(assetId);
187
+ }
188
+ catch {
189
+ return undefined;
190
+ } }
191
+ openPage(url, assetId) {
192
+ // `pending` is assigned on the very next line; the cast keeps the page identity available to decode().
193
+ const page = { refCount: 0, pending: undefined };
194
+ page.pending = this.decode(assetId, page).catch((error) => { this.pages.delete(url); throw error; });
195
+ this.pages.set(url, page);
196
+ return page;
197
+ }
198
+ async decode(assetId, page) {
199
+ const { bytes, asset } = await this.integrityLoader.load(assetId);
200
+ const bitmap = await createImageBitmap(new Blob([bytes], { type: asset.file.mediaType }));
201
+ let source;
202
+ try {
203
+ source = new ImageSource({ resource: bitmap });
204
+ }
205
+ catch (error) {
206
+ bitmap.close();
207
+ throw error;
208
+ }
209
+ page.bitmap = bitmap;
210
+ page.source = source;
211
+ return source;
212
+ }
213
+ closePage(url, page) {
214
+ this.pages.delete(url);
215
+ try {
216
+ page.source?.destroy();
217
+ }
218
+ finally {
219
+ page.bitmap?.close();
220
+ }
221
+ }
222
+ }
223
+ export class PixiRigNode {
224
+ display;
225
+ constructor(display) {
226
+ this.display = display;
227
+ }
228
+ get x() { return this.display.x; }
229
+ set x(value) { this.display.x = value; }
230
+ get y() { return this.display.y; }
231
+ set y(value) { this.display.y = value; }
232
+ get rotation() { return this.display.rotation; }
233
+ set rotation(value) { this.display.rotation = value; }
234
+ get scaleX() { return this.display.scale.x; }
235
+ set scaleX(value) { this.display.scale.x = value; }
236
+ get scaleY() { return this.display.scale.y; }
237
+ set scaleY(value) { this.display.scale.y = value; }
238
+ get alpha() { return this.display.alpha; }
239
+ set alpha(value) { this.display.alpha = value; }
240
+ get visible() { return this.display.visible; }
241
+ set visible(value) { this.display.visible = value; }
242
+ get zIndex() { return this.display.zIndex; }
243
+ set zIndex(value) { this.display.zIndex = value; }
244
+ get tint() { return this.display instanceof Sprite ? this.display.tint : undefined; }
245
+ set tint(value) { if (this.display instanceof Sprite)
246
+ this.display.tint = value ?? 0xffffff; }
247
+ }
248
+ /** Pixi display adapter for renderer-neutral RigRuntime. Textures must be preloaded. */
249
+ export class PixiRigFactory {
250
+ textures;
251
+ root = new Container();
252
+ constructor(textures) {
253
+ this.textures = textures;
254
+ this.root.sortableChildren = true;
255
+ }
256
+ createBone(id) { const display = new Container(); display.label = id; display.sortableChildren = true; return new PixiRigNode(display); }
257
+ createAttachment(id, texture) {
258
+ const resolved = this.textures.get(texture.frameId ? `${texture.assetId}#${texture.frameId}` : texture.assetId) ?? this.textures.get(texture.assetId);
259
+ if (!resolved)
260
+ throw new Error(`Rig texture is not preloaded: ${texture.assetId}${texture.frameId ? `#${texture.frameId}` : ''}`);
261
+ const display = new Sprite(resolved);
262
+ display.label = id;
263
+ return new PixiRigNode(display);
264
+ }
265
+ attach(parent, child) { const parentDisplay = parent instanceof PixiRigNode ? parent.display : this.root; const childDisplay = child instanceof PixiRigNode ? child.display : undefined; if (!childDisplay)
266
+ throw new Error('PixiRigFactory received a foreign display node'); parentDisplay.addChild(childDisplay); }
267
+ destroy(node) { if (node instanceof PixiRigNode)
268
+ node.display.destroy({ children: false, texture: false, textureSource: false }); }
269
+ destroyRoot() { this.root.destroy({ children: true, texture: false, textureSource: false }); }
270
+ }
271
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAA+D,MAAM,SAAS,CAAC;AAYvJ,MAAM,OAAO,mBAAmB;IAID;IAHpB,GAAG,GAAG,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,CAAC,IAAI,CAAC,CAAC,MAAM,YAAY,GAAG,KAAK,YAAY,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,YAAY;QAAE,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACxW,OAAO,CAAC,IAAoB,IAAU,IAAI,IAAI,YAAY,WAAW;QAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;IACzJ,WAAW,KAAW,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;CACrG"}
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@roost2d/pixi",
3
+ "version": "0.1.0-rc.0",
4
+ "description": "PixiJS v8 renderer adapter for Roost2D.",
5
+ "license": "Apache-2.0",
6
+ "repository": { "type": "git", "url": "git+https://github.com/Roost2D/roost2d.git", "directory": "packages/pixi" },
7
+ "type": "module",
8
+ "sideEffects": false,
9
+ "files": ["dist", "README.md", "LICENSE"],
10
+ "exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" } },
11
+ "dependencies": { "@roost2d/assets": "0.1.0-rc.0", "@roost2d/contracts": "0.1.0-rc.0", "@roost2d/rig2d": "0.1.0-rc.0" },
12
+ "peerDependencies": { "pixi.js": "^8.0.0" },
13
+ "publishConfig": { "access": "public" },
14
+ "scripts": { "build": "tsc -p tsconfig.json", "check": "tsc --noEmit -p tsconfig.json", "test": "node --test test/*.test.mjs" }
15
+ }