@rb-games/core 0.1.0 → 0.1.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/dist/chunk-5BLUF2HG.js +25 -0
- package/dist/chunk-5BLUF2HG.js.map +1 -0
- package/dist/chunk-DOHQE2YZ.js +392 -0
- package/dist/chunk-DOHQE2YZ.js.map +1 -0
- package/dist/chunk-FOZO6TLY.js +673 -0
- package/dist/chunk-FOZO6TLY.js.map +1 -0
- package/dist/chunk-G3PMV62Z.js +33 -0
- package/dist/chunk-G3PMV62Z.js.map +1 -0
- package/dist/chunk-KOHCRCV3.js +490 -0
- package/dist/chunk-KOHCRCV3.js.map +1 -0
- package/dist/chunk-MI6BP7A6.js +11 -0
- package/dist/chunk-MI6BP7A6.js.map +1 -0
- package/dist/chunk-NQMORMNP.js +15 -0
- package/dist/chunk-NQMORMNP.js.map +1 -0
- package/dist/chunk-RAEOBW6E.js +133 -0
- package/dist/chunk-RAEOBW6E.js.map +1 -0
- package/dist/chunk-UE7T7Z45.js +884 -0
- package/dist/chunk-UE7T7Z45.js.map +1 -0
- package/dist/devtools/index.js +2 -882
- package/dist/devtools/index.js.map +1 -1
- package/dist/engine/index.js +6 -1267
- package/dist/engine/index.js.map +1 -1
- package/dist/filters/index.js +1 -1
- package/dist/helpers/index.js +6 -35
- package/dist/helpers/index.js.map +1 -1
- package/dist/i18n/index.js +4 -525
- package/dist/i18n/index.js.map +1 -1
- package/dist/layout/index.js +2 -671
- package/dist/layout/index.js.map +1 -1
- package/dist/particle/index.js +1 -6
- package/dist/particle/index.js.map +1 -1
- package/dist/plugins/Plugin.types.d.ts +4 -2
- package/dist/plugins/Plugin.types.d.ts.map +1 -1
- package/dist/plugins/index.js +6 -521
- package/dist/plugins/index.js.map +1 -1
- package/dist/state-machine/index.js +1 -1
- package/dist/store/index.js +1 -1
- package/dist/ui/index.js +5 -531
- package/dist/ui/index.js.map +1 -1
- package/dist/utils/index.js +4 -897
- package/dist/utils/index.js.map +1 -1
- package/dist/vite/index.js +1 -1
- package/package.json +3 -15
package/dist/engine/index.js
CHANGED
|
@@ -1,1278 +1,17 @@
|
|
|
1
|
+
import '../chunk-UE7T7Z45.js';
|
|
2
|
+
import { ENGINE_HOOKS } from '../chunk-MI6BP7A6.js';
|
|
3
|
+
import { getLogger } from '../chunk-DOHQE2YZ.js';
|
|
4
|
+
import '../chunk-G3PMV62Z.js';
|
|
1
5
|
import '@pixi/layout';
|
|
2
6
|
import '@pixi/layout/devtools';
|
|
3
7
|
import { Application, isMobile } from 'pixi.js';
|
|
4
8
|
|
|
5
|
-
// engine/PixiEngine.ts
|
|
6
|
-
|
|
7
|
-
// devtools/DraggableController.ts
|
|
8
|
-
var dragStates = /* @__PURE__ */ new WeakMap();
|
|
9
|
-
var originalEventModes = /* @__PURE__ */ new WeakMap();
|
|
10
|
-
var originalCursors = /* @__PURE__ */ new WeakMap();
|
|
11
|
-
function onDragStart(e) {
|
|
12
|
-
if (!this.__draggable) return;
|
|
13
|
-
this.__dragging = true;
|
|
14
|
-
this.cursor = "grabbing";
|
|
15
|
-
const parent = this.parent;
|
|
16
|
-
if (!parent) return;
|
|
17
|
-
const localPos = parent.toLocal(e.global);
|
|
18
|
-
dragStates.set(this, {
|
|
19
|
-
offsetX: localPos.x - this.x,
|
|
20
|
-
offsetY: localPos.y - this.y
|
|
21
|
-
});
|
|
22
|
-
e.stopPropagation();
|
|
23
|
-
}
|
|
24
|
-
function onDragMove(e) {
|
|
25
|
-
if (!this.__dragging) return;
|
|
26
|
-
const state = dragStates.get(this);
|
|
27
|
-
if (!state) return;
|
|
28
|
-
const parent = this.parent;
|
|
29
|
-
if (!parent) return;
|
|
30
|
-
const localPos = parent.toLocal(e.global);
|
|
31
|
-
this.x = localPos.x - state.offsetX;
|
|
32
|
-
this.y = localPos.y - state.offsetY;
|
|
33
|
-
}
|
|
34
|
-
function onDragEnd() {
|
|
35
|
-
if (!this.__dragging) return;
|
|
36
|
-
this.__dragging = false;
|
|
37
|
-
this.cursor = "grab";
|
|
38
|
-
dragStates.delete(this);
|
|
39
|
-
}
|
|
40
|
-
function enableDrag(container) {
|
|
41
|
-
originalEventModes.set(container, container.eventMode);
|
|
42
|
-
originalCursors.set(container, container.cursor);
|
|
43
|
-
container.eventMode = "static";
|
|
44
|
-
container.cursor = "grab";
|
|
45
|
-
container.on("pointerdown", onDragStart, container);
|
|
46
|
-
container.on("globalpointermove", onDragMove, container);
|
|
47
|
-
container.on("pointerup", onDragEnd, container);
|
|
48
|
-
container.on("pointerupoutside", onDragEnd, container);
|
|
49
|
-
}
|
|
50
|
-
function disableDrag(container) {
|
|
51
|
-
container.off("pointerdown", onDragStart, container);
|
|
52
|
-
container.off("globalpointermove", onDragMove, container);
|
|
53
|
-
container.off("pointerup", onDragEnd, container);
|
|
54
|
-
container.off("pointerupoutside", onDragEnd, container);
|
|
55
|
-
const originalMode = originalEventModes.get(container);
|
|
56
|
-
if (originalMode !== void 0) {
|
|
57
|
-
container.eventMode = originalMode;
|
|
58
|
-
}
|
|
59
|
-
const originalCursor = originalCursors.get(container);
|
|
60
|
-
if (originalCursor !== void 0) {
|
|
61
|
-
container.cursor = originalCursor;
|
|
62
|
-
}
|
|
63
|
-
container.__dragging = false;
|
|
64
|
-
dragStates.delete(container);
|
|
65
|
-
originalEventModes.delete(container);
|
|
66
|
-
originalCursors.delete(container);
|
|
67
|
-
}
|
|
68
|
-
function isDragging(container) {
|
|
69
|
-
return container.__dragging === true;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// devtools/ResizableController.ts
|
|
73
|
-
var resizeStates = /* @__PURE__ */ new WeakMap();
|
|
74
|
-
var HANDLE_SIZE = 10;
|
|
75
|
-
var cursors = {
|
|
76
|
-
nw: "nwse-resize",
|
|
77
|
-
n: "ns-resize",
|
|
78
|
-
ne: "nesw-resize",
|
|
79
|
-
e: "ew-resize",
|
|
80
|
-
se: "nwse-resize",
|
|
81
|
-
s: "ns-resize",
|
|
82
|
-
sw: "nesw-resize",
|
|
83
|
-
w: "ew-resize"
|
|
84
|
-
};
|
|
85
|
-
function getCanvasElement(container) {
|
|
86
|
-
var _a2, _b;
|
|
87
|
-
try {
|
|
88
|
-
const renderer = ((_a2 = container.__pixiApp) == null ? void 0 : _a2.renderer) ?? ((_b = globalThis.__PIXI_APP__) == null ? void 0 : _b.renderer);
|
|
89
|
-
if (renderer == null ? void 0 : renderer.canvas) return renderer.canvas;
|
|
90
|
-
return document.querySelector("canvas");
|
|
91
|
-
} catch {
|
|
92
|
-
return document.querySelector("canvas");
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function createOverlayContainer(canvas) {
|
|
96
|
-
var _a2;
|
|
97
|
-
const div = document.createElement("div");
|
|
98
|
-
div.className = "__pixi_resize_overlay__";
|
|
99
|
-
div.style.cssText = `
|
|
100
|
-
position: absolute;
|
|
101
|
-
top: 0;
|
|
102
|
-
left: 0;
|
|
103
|
-
width: 100%;
|
|
104
|
-
height: 100%;
|
|
105
|
-
pointer-events: none;
|
|
106
|
-
z-index: 10000;
|
|
107
|
-
`;
|
|
108
|
-
(_a2 = canvas.parentElement) == null ? void 0 : _a2.appendChild(div);
|
|
109
|
-
return div;
|
|
110
|
-
}
|
|
111
|
-
function createBorderDiv() {
|
|
112
|
-
const div = document.createElement("div");
|
|
113
|
-
div.style.cssText = `
|
|
114
|
-
position: absolute;
|
|
115
|
-
border: 2px dashed #00aaff;
|
|
116
|
-
pointer-events: none;
|
|
117
|
-
box-sizing: border-box;
|
|
118
|
-
`;
|
|
119
|
-
return div;
|
|
120
|
-
}
|
|
121
|
-
function createHandleDiv(pos) {
|
|
122
|
-
const div = document.createElement("div");
|
|
123
|
-
div.dataset.handle = pos;
|
|
124
|
-
div.style.cssText = `
|
|
125
|
-
position: absolute;
|
|
126
|
-
width: ${HANDLE_SIZE}px;
|
|
127
|
-
height: ${HANDLE_SIZE}px;
|
|
128
|
-
background: #00aaff;
|
|
129
|
-
border: 1px solid white;
|
|
130
|
-
border-radius: 2px;
|
|
131
|
-
cursor: ${cursors[pos]};
|
|
132
|
-
pointer-events: auto;
|
|
133
|
-
transform: translate(-50%, -50%);
|
|
134
|
-
transition: background 0.1s;
|
|
135
|
-
`;
|
|
136
|
-
div.addEventListener("mouseenter", () => {
|
|
137
|
-
div.style.background = "#ff6600";
|
|
138
|
-
});
|
|
139
|
-
div.addEventListener("mouseleave", () => {
|
|
140
|
-
div.style.background = "#00aaff";
|
|
141
|
-
});
|
|
142
|
-
return div;
|
|
143
|
-
}
|
|
144
|
-
function createResizeOverlay(container, canvas) {
|
|
145
|
-
const overlayContainer = createOverlayContainer(canvas);
|
|
146
|
-
const border = createBorderDiv();
|
|
147
|
-
overlayContainer.appendChild(border);
|
|
148
|
-
const handles = /* @__PURE__ */ new Map();
|
|
149
|
-
const positions = ["nw", "n", "ne", "e", "se", "s", "sw", "w"];
|
|
150
|
-
positions.forEach((pos) => {
|
|
151
|
-
const handle = createHandleDiv(pos);
|
|
152
|
-
handles.set(pos, handle);
|
|
153
|
-
overlayContainer.appendChild(handle);
|
|
154
|
-
handle.addEventListener("pointerdown", (e) => {
|
|
155
|
-
e.preventDefault();
|
|
156
|
-
e.stopPropagation();
|
|
157
|
-
onResizeStart(container, pos, e);
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
return {
|
|
161
|
-
container: overlayContainer,
|
|
162
|
-
handles,
|
|
163
|
-
border,
|
|
164
|
-
animationId: null
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
function updateOverlayPositions(container, canvas) {
|
|
168
|
-
var _a2, _b;
|
|
169
|
-
const overlay = container.__resizeOverlay;
|
|
170
|
-
if (!overlay) return;
|
|
171
|
-
const bounds = container.getBounds();
|
|
172
|
-
const canvasRect = canvas.getBoundingClientRect();
|
|
173
|
-
const renderer = ((_a2 = globalThis.__PIXI_APP__) == null ? void 0 : _a2.renderer) ?? ((_b = container.__pixiApp) == null ? void 0 : _b.renderer);
|
|
174
|
-
let scaleX = 1;
|
|
175
|
-
let scaleY = 1;
|
|
176
|
-
if (renderer) {
|
|
177
|
-
scaleX = canvasRect.width / renderer.width;
|
|
178
|
-
scaleY = canvasRect.height / renderer.height;
|
|
179
|
-
}
|
|
180
|
-
const x = bounds.x * scaleX;
|
|
181
|
-
const y = bounds.y * scaleY;
|
|
182
|
-
const w = bounds.width * scaleX;
|
|
183
|
-
const h = bounds.height * scaleY;
|
|
184
|
-
overlay.border.style.left = `${x}px`;
|
|
185
|
-
overlay.border.style.top = `${y}px`;
|
|
186
|
-
overlay.border.style.width = `${w}px`;
|
|
187
|
-
overlay.border.style.height = `${h}px`;
|
|
188
|
-
const handlePositions = {
|
|
189
|
-
nw: { x, y },
|
|
190
|
-
n: { x: x + w / 2, y },
|
|
191
|
-
ne: { x: x + w, y },
|
|
192
|
-
e: { x: x + w, y: y + h / 2 },
|
|
193
|
-
se: { x: x + w, y: y + h },
|
|
194
|
-
s: { x: x + w / 2, y: y + h },
|
|
195
|
-
sw: { x, y: y + h },
|
|
196
|
-
w: { x, y: y + h / 2 }
|
|
197
|
-
};
|
|
198
|
-
overlay.handles.forEach((handle, pos) => {
|
|
199
|
-
const { x: hx, y: hy } = handlePositions[pos];
|
|
200
|
-
handle.style.left = `${hx}px`;
|
|
201
|
-
handle.style.top = `${hy}px`;
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
function startUpdateLoop(container, canvas) {
|
|
205
|
-
const overlay = container.__resizeOverlay;
|
|
206
|
-
if (!overlay) return;
|
|
207
|
-
const update = () => {
|
|
208
|
-
if (!container.__resizable || !container.__resizeOverlay) return;
|
|
209
|
-
updateOverlayPositions(container, canvas);
|
|
210
|
-
overlay.animationId = requestAnimationFrame(update);
|
|
211
|
-
};
|
|
212
|
-
overlay.animationId = requestAnimationFrame(update);
|
|
213
|
-
}
|
|
214
|
-
function stopUpdateLoop(overlay) {
|
|
215
|
-
if (overlay.animationId !== null) {
|
|
216
|
-
cancelAnimationFrame(overlay.animationId);
|
|
217
|
-
overlay.animationId = null;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
function onResizeStart(container, handle, e) {
|
|
221
|
-
if (!container.__resizable) return;
|
|
222
|
-
container.__resizing = true;
|
|
223
|
-
const bounds = container.getLocalBounds();
|
|
224
|
-
resizeStates.set(container, {
|
|
225
|
-
handle,
|
|
226
|
-
startX: e.clientX,
|
|
227
|
-
startY: e.clientY,
|
|
228
|
-
startScaleX: container.scale.x,
|
|
229
|
-
startScaleY: container.scale.y,
|
|
230
|
-
startPosX: container.x,
|
|
231
|
-
startPosY: container.y,
|
|
232
|
-
startBounds: { width: bounds.width, height: bounds.height }
|
|
233
|
-
});
|
|
234
|
-
const onMove = (moveEvent) => {
|
|
235
|
-
onResizeMove(container, moveEvent);
|
|
236
|
-
};
|
|
237
|
-
const onUp = () => {
|
|
238
|
-
onResizeEnd(container);
|
|
239
|
-
document.removeEventListener("pointermove", onMove);
|
|
240
|
-
document.removeEventListener("pointerup", onUp);
|
|
241
|
-
};
|
|
242
|
-
document.addEventListener("pointermove", onMove);
|
|
243
|
-
document.addEventListener("pointerup", onUp);
|
|
244
|
-
}
|
|
245
|
-
function onResizeMove(container, e) {
|
|
246
|
-
const state = resizeStates.get(container);
|
|
247
|
-
if (!state || !container.__resizing) return;
|
|
248
|
-
const dx = e.clientX - state.startX;
|
|
249
|
-
const dy = e.clientY - state.startY;
|
|
250
|
-
const baseWidth = state.startBounds.width;
|
|
251
|
-
const baseHeight = state.startBounds.height;
|
|
252
|
-
const startWidth = baseWidth * state.startScaleX;
|
|
253
|
-
const startHeight = baseHeight * state.startScaleY;
|
|
254
|
-
let newScaleX = state.startScaleX;
|
|
255
|
-
let newScaleY = state.startScaleY;
|
|
256
|
-
let newX = state.startPosX;
|
|
257
|
-
let newY = state.startPosY;
|
|
258
|
-
switch (state.handle) {
|
|
259
|
-
case "e":
|
|
260
|
-
newScaleX = (startWidth + dx) / baseWidth;
|
|
261
|
-
break;
|
|
262
|
-
case "w":
|
|
263
|
-
newScaleX = (startWidth - dx) / baseWidth;
|
|
264
|
-
newX = state.startPosX + dx;
|
|
265
|
-
break;
|
|
266
|
-
case "s":
|
|
267
|
-
newScaleY = (startHeight + dy) / baseHeight;
|
|
268
|
-
break;
|
|
269
|
-
case "n":
|
|
270
|
-
newScaleY = (startHeight - dy) / baseHeight;
|
|
271
|
-
newY = state.startPosY + dy;
|
|
272
|
-
break;
|
|
273
|
-
case "se":
|
|
274
|
-
newScaleX = (startWidth + dx) / baseWidth;
|
|
275
|
-
newScaleY = (startHeight + dy) / baseHeight;
|
|
276
|
-
break;
|
|
277
|
-
case "sw":
|
|
278
|
-
newScaleX = (startWidth - dx) / baseWidth;
|
|
279
|
-
newScaleY = (startHeight + dy) / baseHeight;
|
|
280
|
-
newX = state.startPosX + dx;
|
|
281
|
-
break;
|
|
282
|
-
case "ne":
|
|
283
|
-
newScaleX = (startWidth + dx) / baseWidth;
|
|
284
|
-
newScaleY = (startHeight - dy) / baseHeight;
|
|
285
|
-
newY = state.startPosY + dy;
|
|
286
|
-
break;
|
|
287
|
-
case "nw":
|
|
288
|
-
newScaleX = (startWidth - dx) / baseWidth;
|
|
289
|
-
newScaleY = (startHeight - dy) / baseHeight;
|
|
290
|
-
newX = state.startPosX + dx;
|
|
291
|
-
newY = state.startPosY + dy;
|
|
292
|
-
break;
|
|
293
|
-
}
|
|
294
|
-
if (newScaleX > 0.1) {
|
|
295
|
-
container.scale.x = newScaleX;
|
|
296
|
-
container.x = newX;
|
|
297
|
-
}
|
|
298
|
-
if (newScaleY > 0.1) {
|
|
299
|
-
container.scale.y = newScaleY;
|
|
300
|
-
container.y = newY;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
function onResizeEnd(container) {
|
|
304
|
-
container.__resizing = false;
|
|
305
|
-
resizeStates.delete(container);
|
|
306
|
-
}
|
|
307
|
-
function enableResize(container) {
|
|
308
|
-
if (container.__resizeOverlay) return;
|
|
309
|
-
const canvas = getCanvasElement(container);
|
|
310
|
-
if (!canvas) {
|
|
311
|
-
console.warn("[ResizableController] Canvas not found");
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
const overlay = createResizeOverlay(container, canvas);
|
|
315
|
-
container.__resizeOverlay = overlay;
|
|
316
|
-
updateOverlayPositions(container, canvas);
|
|
317
|
-
startUpdateLoop(container, canvas);
|
|
318
|
-
}
|
|
319
|
-
function disableResize(container) {
|
|
320
|
-
const overlay = container.__resizeOverlay;
|
|
321
|
-
if (overlay) {
|
|
322
|
-
stopUpdateLoop(overlay);
|
|
323
|
-
overlay.container.remove();
|
|
324
|
-
container.__resizeOverlay = void 0;
|
|
325
|
-
}
|
|
326
|
-
container.__resizing = false;
|
|
327
|
-
resizeStates.delete(container);
|
|
328
|
-
}
|
|
329
|
-
function isResizing(container) {
|
|
330
|
-
return container.__resizing === true;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
// devtools/treePlugin.ts
|
|
334
|
-
var draggableTreePlugin = {
|
|
335
|
-
extension: {
|
|
336
|
-
name: "draggable-tree",
|
|
337
|
-
type: "sceneTree"
|
|
338
|
-
},
|
|
339
|
-
updateNodeMetadata(node, metadata) {
|
|
340
|
-
metadata.buttons.push({
|
|
341
|
-
name: "drag",
|
|
342
|
-
icon: "\u270B",
|
|
343
|
-
type: "toggle",
|
|
344
|
-
value: node.__draggable ?? false
|
|
345
|
-
});
|
|
346
|
-
metadata.buttons.push({
|
|
347
|
-
name: "resize",
|
|
348
|
-
icon: "\u2921",
|
|
349
|
-
type: "toggle",
|
|
350
|
-
value: node.__resizable ?? false
|
|
351
|
-
});
|
|
352
|
-
const suffixes = [];
|
|
353
|
-
if (node.__draggable) suffixes.push("\u{1F500}");
|
|
354
|
-
if (node.__resizable) suffixes.push("\u{1F4D0}");
|
|
355
|
-
if (suffixes.length > 0) {
|
|
356
|
-
metadata.suffix = (metadata.suffix ?? "") + " " + suffixes.join("");
|
|
357
|
-
}
|
|
358
|
-
return metadata;
|
|
359
|
-
},
|
|
360
|
-
onButtonPress(container, buttonName, pressed) {
|
|
361
|
-
if (buttonName === "drag") {
|
|
362
|
-
container.__draggable = pressed;
|
|
363
|
-
if (pressed) {
|
|
364
|
-
enableDrag(container);
|
|
365
|
-
} else {
|
|
366
|
-
disableDrag(container);
|
|
367
|
-
}
|
|
368
|
-
} else if (buttonName === "resize") {
|
|
369
|
-
container.__resizable = pressed;
|
|
370
|
-
if (pressed) {
|
|
371
|
-
enableResize(container);
|
|
372
|
-
} else {
|
|
373
|
-
disableResize(container);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
// devtools/overlayPlugin.ts
|
|
380
|
-
var defaultSelectedStyle = {
|
|
381
|
-
backgroundColor: "hsla(340, 70%, 44%, 0.35)",
|
|
382
|
-
border: "1px solid hsla(0, 0%, 100%, 0.5)"
|
|
383
|
-
};
|
|
384
|
-
var defaultHoverStyle = {
|
|
385
|
-
backgroundColor: "hsla(192, 84%, 40%, 0.40)",
|
|
386
|
-
border: "1px solid hsla(0, 0%, 100%, 0.5)"
|
|
387
|
-
};
|
|
388
|
-
var draggableOverlayPlugin = {
|
|
389
|
-
extension: {
|
|
390
|
-
name: "draggable-overlay",
|
|
391
|
-
type: "overlay"
|
|
392
|
-
},
|
|
393
|
-
getSelectedStyle(node) {
|
|
394
|
-
const n = node;
|
|
395
|
-
if (n && isDragging(n)) {
|
|
396
|
-
return {
|
|
397
|
-
backgroundColor: "rgba(255, 165, 0, 0.3)",
|
|
398
|
-
border: "2px dashed orange"
|
|
399
|
-
};
|
|
400
|
-
}
|
|
401
|
-
if (n && isResizing(n)) {
|
|
402
|
-
return {
|
|
403
|
-
backgroundColor: "rgba(255, 165, 0, 0.3)",
|
|
404
|
-
border: "2px dashed orange"
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
if (n && (n.__draggable || n.__resizable)) {
|
|
408
|
-
return {
|
|
409
|
-
backgroundColor: "rgba(255, 165, 0, 0.2)",
|
|
410
|
-
border: "2px solid orange"
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
return defaultSelectedStyle;
|
|
414
|
-
},
|
|
415
|
-
getHoverStyle(node) {
|
|
416
|
-
const n = node;
|
|
417
|
-
if (n && (n.__draggable || n.__resizable)) {
|
|
418
|
-
return {
|
|
419
|
-
backgroundColor: "rgba(255, 165, 0, 0.15)",
|
|
420
|
-
border: "1px dashed orange"
|
|
421
|
-
};
|
|
422
|
-
}
|
|
423
|
-
return defaultHoverStyle;
|
|
424
|
-
}
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
// devtools/spriteTextPropertiesPlugin.ts
|
|
428
|
-
var SECTION = "SpriteText";
|
|
429
|
-
var spriteTextProps = [
|
|
430
|
-
"spriteText.text",
|
|
431
|
-
"spriteText.font",
|
|
432
|
-
"spriteText.tint",
|
|
433
|
-
"spriteText.fontSize",
|
|
434
|
-
"spriteText.pivotHorizontal",
|
|
435
|
-
"spriteText.pivotVertical",
|
|
436
|
-
"spriteText.lineAlign",
|
|
437
|
-
"spriteText.letterSpacing",
|
|
438
|
-
"spriteText.spaceWidth",
|
|
439
|
-
"spriteText.wordWrap",
|
|
440
|
-
"spriteText.wordWrapWidth",
|
|
441
|
-
"spriteText.breakWord",
|
|
442
|
-
"spriteText.allowLineBreak",
|
|
443
|
-
"spriteText.kerningEnabled",
|
|
444
|
-
"spriteText.curveEnabled",
|
|
445
|
-
"spriteText.curveControlXPercent",
|
|
446
|
-
"spriteText.curveControlYPercent"
|
|
447
|
-
];
|
|
448
|
-
function isSpriteText(container) {
|
|
449
|
-
const name = container.constructor.name;
|
|
450
|
-
if (name === "SpriteText") return true;
|
|
451
|
-
const c = container;
|
|
452
|
-
const isDuck = c._text !== void 0 && c._font !== void 0 && c._glyphs !== void 0;
|
|
453
|
-
if (isDuck) {
|
|
454
|
-
console.log("[SpriteText Plugin] Detected via duck typing:", name);
|
|
455
|
-
}
|
|
456
|
-
return isDuck;
|
|
457
|
-
}
|
|
458
|
-
var spriteTextPropertiesPlugin = {
|
|
459
|
-
extension: {
|
|
460
|
-
type: "sceneProperties",
|
|
461
|
-
name: "spritetext-properties",
|
|
462
|
-
priority: 10
|
|
463
|
-
},
|
|
464
|
-
testNode(container) {
|
|
465
|
-
return isSpriteText(container);
|
|
466
|
-
},
|
|
467
|
-
testProp(prop) {
|
|
468
|
-
return spriteTextProps.includes(prop);
|
|
469
|
-
},
|
|
470
|
-
setProperty(container, prop, value) {
|
|
471
|
-
const spriteText = container;
|
|
472
|
-
const propName = prop.replace("spriteText.", "");
|
|
473
|
-
switch (propName) {
|
|
474
|
-
case "text":
|
|
475
|
-
spriteText.text = value;
|
|
476
|
-
break;
|
|
477
|
-
case "font":
|
|
478
|
-
spriteText.font = value;
|
|
479
|
-
break;
|
|
480
|
-
case "tint":
|
|
481
|
-
if (typeof value === "string") {
|
|
482
|
-
spriteText.tint = parseInt(value.replace("#", ""), 16);
|
|
483
|
-
} else {
|
|
484
|
-
spriteText.tint = value;
|
|
485
|
-
}
|
|
486
|
-
break;
|
|
487
|
-
case "fontSize":
|
|
488
|
-
spriteText.fontSize = value;
|
|
489
|
-
break;
|
|
490
|
-
case "pivotHorizontal":
|
|
491
|
-
spriteText.pivotHorizontal = value;
|
|
492
|
-
break;
|
|
493
|
-
case "pivotVertical":
|
|
494
|
-
spriteText.pivotVertical = value;
|
|
495
|
-
break;
|
|
496
|
-
case "lineAlign":
|
|
497
|
-
spriteText.lineAlign = value;
|
|
498
|
-
break;
|
|
499
|
-
case "letterSpacing":
|
|
500
|
-
spriteText.letterSpacing = value;
|
|
501
|
-
break;
|
|
502
|
-
case "spaceWidth":
|
|
503
|
-
spriteText.spaceWidth = value;
|
|
504
|
-
break;
|
|
505
|
-
case "wordWrap":
|
|
506
|
-
spriteText.wordWrap = value;
|
|
507
|
-
break;
|
|
508
|
-
case "wordWrapWidth":
|
|
509
|
-
spriteText.wordWrapWidth = value;
|
|
510
|
-
break;
|
|
511
|
-
case "breakWord":
|
|
512
|
-
spriteText.breakWord = value;
|
|
513
|
-
break;
|
|
514
|
-
case "allowLineBreak":
|
|
515
|
-
spriteText.allowLineBreak = value;
|
|
516
|
-
break;
|
|
517
|
-
case "kerningEnabled":
|
|
518
|
-
spriteText.kerningEnabled = value;
|
|
519
|
-
break;
|
|
520
|
-
case "curveEnabled":
|
|
521
|
-
spriteText.curveEnabled = value;
|
|
522
|
-
break;
|
|
523
|
-
case "curveControlXPercent":
|
|
524
|
-
spriteText.curveControlXPercent = value;
|
|
525
|
-
break;
|
|
526
|
-
case "curveControlYPercent":
|
|
527
|
-
spriteText.curveControlYPercent = value;
|
|
528
|
-
break;
|
|
529
|
-
}
|
|
530
|
-
},
|
|
531
|
-
getProperties(container) {
|
|
532
|
-
try {
|
|
533
|
-
const spriteText = container;
|
|
534
|
-
return [
|
|
535
|
-
{
|
|
536
|
-
prop: "spriteText.text",
|
|
537
|
-
value: spriteText.text,
|
|
538
|
-
entry: {
|
|
539
|
-
section: SECTION,
|
|
540
|
-
label: "Text",
|
|
541
|
-
type: "text"
|
|
542
|
-
}
|
|
543
|
-
},
|
|
544
|
-
{
|
|
545
|
-
prop: "spriteText.plainText",
|
|
546
|
-
value: spriteText.plainText,
|
|
547
|
-
entry: {
|
|
548
|
-
section: SECTION,
|
|
549
|
-
label: "Plain Text",
|
|
550
|
-
type: "text"
|
|
551
|
-
}
|
|
552
|
-
},
|
|
553
|
-
{
|
|
554
|
-
prop: "spriteText.bbcodeEnabled",
|
|
555
|
-
value: spriteText.bbcodeEnabled,
|
|
556
|
-
entry: {
|
|
557
|
-
section: SECTION,
|
|
558
|
-
label: "BBCode Enabled",
|
|
559
|
-
type: "boolean"
|
|
560
|
-
}
|
|
561
|
-
},
|
|
562
|
-
{
|
|
563
|
-
prop: "spriteText.font",
|
|
564
|
-
value: spriteText.font,
|
|
565
|
-
entry: {
|
|
566
|
-
section: SECTION,
|
|
567
|
-
label: "Font",
|
|
568
|
-
type: "text"
|
|
569
|
-
}
|
|
570
|
-
},
|
|
571
|
-
{
|
|
572
|
-
prop: "spriteText.fonts",
|
|
573
|
-
value: spriteText.fonts.join(", "),
|
|
574
|
-
entry: {
|
|
575
|
-
section: SECTION,
|
|
576
|
-
label: "Fonts",
|
|
577
|
-
type: "text"
|
|
578
|
-
}
|
|
579
|
-
},
|
|
580
|
-
{
|
|
581
|
-
prop: "spriteText.tint",
|
|
582
|
-
// DevTools color picker expects number
|
|
583
|
-
value: spriteText.tint,
|
|
584
|
-
entry: {
|
|
585
|
-
section: SECTION,
|
|
586
|
-
label: "Tint",
|
|
587
|
-
type: "color"
|
|
588
|
-
}
|
|
589
|
-
},
|
|
590
|
-
{
|
|
591
|
-
prop: "spriteText.fontSize",
|
|
592
|
-
value: spriteText.fontSize,
|
|
593
|
-
entry: {
|
|
594
|
-
section: SECTION,
|
|
595
|
-
label: "Font Size",
|
|
596
|
-
type: "number"
|
|
597
|
-
}
|
|
598
|
-
},
|
|
599
|
-
{
|
|
600
|
-
prop: "spriteText.pivotHorizontal",
|
|
601
|
-
value: spriteText.pivotHorizontal,
|
|
602
|
-
entry: {
|
|
603
|
-
section: SECTION,
|
|
604
|
-
label: "Pivot H",
|
|
605
|
-
type: "select",
|
|
606
|
-
options: { options: ["left", "center", "right"] }
|
|
607
|
-
}
|
|
608
|
-
},
|
|
609
|
-
{
|
|
610
|
-
prop: "spriteText.pivotVertical",
|
|
611
|
-
value: spriteText.pivotVertical,
|
|
612
|
-
entry: {
|
|
613
|
-
section: SECTION,
|
|
614
|
-
label: "Pivot V",
|
|
615
|
-
type: "select",
|
|
616
|
-
options: { options: ["top", "middle", "bottom"] }
|
|
617
|
-
}
|
|
618
|
-
},
|
|
619
|
-
{
|
|
620
|
-
prop: "spriteText.lineAlign",
|
|
621
|
-
value: spriteText.lineAlign,
|
|
622
|
-
entry: {
|
|
623
|
-
section: SECTION,
|
|
624
|
-
label: "Line Align",
|
|
625
|
-
type: "select",
|
|
626
|
-
options: { options: ["left", "center", "right"] }
|
|
627
|
-
}
|
|
628
|
-
},
|
|
629
|
-
{
|
|
630
|
-
prop: "spriteText.letterSpacing",
|
|
631
|
-
value: spriteText.letterSpacing,
|
|
632
|
-
entry: {
|
|
633
|
-
section: SECTION,
|
|
634
|
-
label: "Letter Spacing",
|
|
635
|
-
type: "number"
|
|
636
|
-
}
|
|
637
|
-
},
|
|
638
|
-
{
|
|
639
|
-
prop: "spriteText.spaceWidth",
|
|
640
|
-
value: spriteText.spaceWidth,
|
|
641
|
-
entry: {
|
|
642
|
-
section: SECTION,
|
|
643
|
-
label: "Space Width",
|
|
644
|
-
type: "number"
|
|
645
|
-
}
|
|
646
|
-
},
|
|
647
|
-
{
|
|
648
|
-
prop: "spriteText.wordWrap",
|
|
649
|
-
value: spriteText.wordWrap,
|
|
650
|
-
entry: {
|
|
651
|
-
section: SECTION,
|
|
652
|
-
label: "Word Wrap",
|
|
653
|
-
type: "boolean"
|
|
654
|
-
}
|
|
655
|
-
},
|
|
656
|
-
{
|
|
657
|
-
prop: "spriteText.wordWrapWidth",
|
|
658
|
-
value: spriteText.wordWrapWidth,
|
|
659
|
-
entry: {
|
|
660
|
-
section: SECTION,
|
|
661
|
-
label: "Wrap Width",
|
|
662
|
-
type: "number"
|
|
663
|
-
}
|
|
664
|
-
},
|
|
665
|
-
{
|
|
666
|
-
prop: "spriteText.breakWord",
|
|
667
|
-
value: spriteText.breakWord,
|
|
668
|
-
entry: {
|
|
669
|
-
section: SECTION,
|
|
670
|
-
label: "Break Word",
|
|
671
|
-
type: "boolean"
|
|
672
|
-
}
|
|
673
|
-
},
|
|
674
|
-
{
|
|
675
|
-
prop: "spriteText.allowLineBreak",
|
|
676
|
-
value: spriteText.allowLineBreak,
|
|
677
|
-
entry: {
|
|
678
|
-
section: SECTION,
|
|
679
|
-
label: "Allow Line Break",
|
|
680
|
-
type: "boolean"
|
|
681
|
-
}
|
|
682
|
-
},
|
|
683
|
-
{
|
|
684
|
-
prop: "spriteText.kerningEnabled",
|
|
685
|
-
value: spriteText.kerningEnabled,
|
|
686
|
-
entry: {
|
|
687
|
-
section: SECTION,
|
|
688
|
-
label: "Kerning",
|
|
689
|
-
type: "boolean"
|
|
690
|
-
}
|
|
691
|
-
},
|
|
692
|
-
{
|
|
693
|
-
prop: "spriteText.curveEnabled",
|
|
694
|
-
value: spriteText.curveEnabled,
|
|
695
|
-
entry: {
|
|
696
|
-
section: SECTION,
|
|
697
|
-
label: "Curve Enabled",
|
|
698
|
-
type: "boolean"
|
|
699
|
-
}
|
|
700
|
-
},
|
|
701
|
-
{
|
|
702
|
-
prop: "spriteText.curveControlXPercent",
|
|
703
|
-
value: spriteText.curveControlXPercent,
|
|
704
|
-
entry: {
|
|
705
|
-
section: SECTION,
|
|
706
|
-
label: "Curve X %",
|
|
707
|
-
type: "number"
|
|
708
|
-
}
|
|
709
|
-
},
|
|
710
|
-
{
|
|
711
|
-
prop: "spriteText.curveControlYPercent",
|
|
712
|
-
value: spriteText.curveControlYPercent,
|
|
713
|
-
entry: {
|
|
714
|
-
section: SECTION,
|
|
715
|
-
label: "Curve Y %",
|
|
716
|
-
type: "number"
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
];
|
|
720
|
-
} catch (e) {
|
|
721
|
-
console.error("[SpriteText Plugin] Error getting properties:", e);
|
|
722
|
-
return [];
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
};
|
|
726
|
-
|
|
727
|
-
// devtools/spinePropertiesPlugin.ts
|
|
728
|
-
var SECTION2 = "Spine";
|
|
729
|
-
var spineProps = [
|
|
730
|
-
"spine.currentAnimation",
|
|
731
|
-
"spine.currentSkin",
|
|
732
|
-
"spine.autoUpdate",
|
|
733
|
-
"spine.playAnimation"
|
|
734
|
-
];
|
|
735
|
-
function isSpine(container) {
|
|
736
|
-
var _a2, _b;
|
|
737
|
-
const name = container.constructor.name;
|
|
738
|
-
if (name === "Spine") return true;
|
|
739
|
-
const c = container;
|
|
740
|
-
return c.skeleton !== void 0 && c.state !== void 0 && ((_b = (_a2 = c.skeleton) == null ? void 0 : _a2.data) == null ? void 0 : _b.animations) !== void 0;
|
|
741
|
-
}
|
|
742
|
-
function getAnimationNames(spine) {
|
|
743
|
-
try {
|
|
744
|
-
return spine.skeleton.data.animations.map((a) => a.name);
|
|
745
|
-
} catch {
|
|
746
|
-
return [];
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
function getSkinNames(spine) {
|
|
750
|
-
try {
|
|
751
|
-
return spine.skeleton.data.skins.map((s) => s.name);
|
|
752
|
-
} catch {
|
|
753
|
-
return [];
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
function getCurrentAnimation(spine) {
|
|
757
|
-
var _a2;
|
|
758
|
-
try {
|
|
759
|
-
const track = spine.state.tracks[0];
|
|
760
|
-
return ((_a2 = track == null ? void 0 : track.animation) == null ? void 0 : _a2.name) ?? "(none)";
|
|
761
|
-
} catch {
|
|
762
|
-
return "(none)";
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
function getCurrentSkin(spine) {
|
|
766
|
-
var _a2;
|
|
767
|
-
try {
|
|
768
|
-
return ((_a2 = spine.skeleton.skin) == null ? void 0 : _a2.name) ?? "default";
|
|
769
|
-
} catch {
|
|
770
|
-
return "default";
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
var spinePropertiesPlugin = {
|
|
774
|
-
extension: {
|
|
775
|
-
type: "sceneProperties",
|
|
776
|
-
name: "spine-properties",
|
|
777
|
-
priority: 10
|
|
778
|
-
},
|
|
779
|
-
testNode(container) {
|
|
780
|
-
return isSpine(container);
|
|
781
|
-
},
|
|
782
|
-
testProp(prop) {
|
|
783
|
-
return spineProps.includes(prop);
|
|
784
|
-
},
|
|
785
|
-
setProperty(container, prop, value) {
|
|
786
|
-
const spine = container;
|
|
787
|
-
const propName = prop.replace("spine.", "");
|
|
788
|
-
switch (propName) {
|
|
789
|
-
case "currentSkin":
|
|
790
|
-
try {
|
|
791
|
-
spine.skeleton.setSkinByName(value);
|
|
792
|
-
spine.skeleton.setSlotsToSetupPose();
|
|
793
|
-
} catch (e) {
|
|
794
|
-
console.error("[Spine Plugin] Error setting skin:", e);
|
|
795
|
-
}
|
|
796
|
-
break;
|
|
797
|
-
case "playAnimation":
|
|
798
|
-
try {
|
|
799
|
-
if (value && value !== "(none)") {
|
|
800
|
-
spine.state.setAnimation(0, value, true);
|
|
801
|
-
} else {
|
|
802
|
-
spine.state.setEmptyAnimation(0, 0.2);
|
|
803
|
-
}
|
|
804
|
-
} catch (e) {
|
|
805
|
-
console.error("[Spine Plugin] Error playing animation:", e);
|
|
806
|
-
}
|
|
807
|
-
break;
|
|
808
|
-
case "autoUpdate":
|
|
809
|
-
spine.autoUpdate = value;
|
|
810
|
-
break;
|
|
811
|
-
}
|
|
812
|
-
},
|
|
813
|
-
getProperties(container) {
|
|
814
|
-
try {
|
|
815
|
-
const spine = container;
|
|
816
|
-
const animations = getAnimationNames(spine);
|
|
817
|
-
const skins = getSkinNames(spine);
|
|
818
|
-
const currentAnim = getCurrentAnimation(spine);
|
|
819
|
-
const currentSkin = getCurrentSkin(spine);
|
|
820
|
-
return [
|
|
821
|
-
{
|
|
822
|
-
prop: "spine.currentAnimation",
|
|
823
|
-
value: currentAnim,
|
|
824
|
-
entry: {
|
|
825
|
-
section: SECTION2,
|
|
826
|
-
label: "Current Animation",
|
|
827
|
-
type: "text",
|
|
828
|
-
options: { disabled: true }
|
|
829
|
-
}
|
|
830
|
-
},
|
|
831
|
-
{
|
|
832
|
-
prop: "spine.playAnimation",
|
|
833
|
-
value: currentAnim,
|
|
834
|
-
entry: {
|
|
835
|
-
section: SECTION2,
|
|
836
|
-
label: "Play Animation",
|
|
837
|
-
type: "select",
|
|
838
|
-
options: { options: ["(none)", ...animations] }
|
|
839
|
-
}
|
|
840
|
-
},
|
|
841
|
-
{
|
|
842
|
-
prop: "spine.currentSkin",
|
|
843
|
-
value: currentSkin,
|
|
844
|
-
entry: {
|
|
845
|
-
section: SECTION2,
|
|
846
|
-
label: "Skin",
|
|
847
|
-
type: "select",
|
|
848
|
-
options: { options: skins }
|
|
849
|
-
}
|
|
850
|
-
},
|
|
851
|
-
{
|
|
852
|
-
prop: "spine.autoUpdate",
|
|
853
|
-
value: spine.autoUpdate,
|
|
854
|
-
entry: {
|
|
855
|
-
section: SECTION2,
|
|
856
|
-
label: "Auto Update",
|
|
857
|
-
type: "boolean"
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
];
|
|
861
|
-
} catch (e) {
|
|
862
|
-
console.error("[Spine Plugin] Error getting properties:", e);
|
|
863
|
-
return [];
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
};
|
|
867
|
-
|
|
868
|
-
// devtools/index.ts
|
|
869
|
-
var gThis = globalThis;
|
|
870
|
-
var _a;
|
|
871
|
-
gThis.__PIXI_DEVTOOLS__ = {
|
|
872
|
-
...gThis.__PIXI_DEVTOOLS__,
|
|
873
|
-
extensions: [
|
|
874
|
-
...((_a = gThis.__PIXI_DEVTOOLS__) == null ? void 0 : _a.extensions) ?? [],
|
|
875
|
-
draggableTreePlugin,
|
|
876
|
-
draggableOverlayPlugin,
|
|
877
|
-
spriteTextPropertiesPlugin,
|
|
878
|
-
spinePropertiesPlugin
|
|
879
|
-
]
|
|
880
|
-
};
|
|
881
|
-
|
|
882
|
-
// utils/Logger.ts
|
|
883
|
-
var Logger = class _Logger {
|
|
884
|
-
static instance;
|
|
885
|
-
config;
|
|
886
|
-
// Terminal colors (for Node.js environment)
|
|
887
|
-
terminalColors = {
|
|
888
|
-
reset: "\x1B[0m",
|
|
889
|
-
red: "\x1B[31m",
|
|
890
|
-
yellow: "\x1B[33m",
|
|
891
|
-
blue: "\x1B[34m",
|
|
892
|
-
green: "\x1B[32m",
|
|
893
|
-
gray: "\x1B[90m",
|
|
894
|
-
cyan: "\x1B[36m",
|
|
895
|
-
magenta: "\x1B[35m",
|
|
896
|
-
white: "\x1B[37m"
|
|
897
|
-
};
|
|
898
|
-
// Browser console colors (using CSS)
|
|
899
|
-
browserColors = {
|
|
900
|
-
timestamp: "color: gray",
|
|
901
|
-
context: "color: cyan; font-weight: bold",
|
|
902
|
-
message: "color: white",
|
|
903
|
-
error: "color: red; font-weight: bold",
|
|
904
|
-
warn: "color: orange; font-weight: bold",
|
|
905
|
-
info: "color: dodgerblue; font-weight: bold",
|
|
906
|
-
debug: "color: green",
|
|
907
|
-
trace: "color: gray"
|
|
908
|
-
};
|
|
909
|
-
levelLabels = {
|
|
910
|
-
[0 /* ERROR */]: "ERROR",
|
|
911
|
-
[1 /* WARN */]: "WARN",
|
|
912
|
-
[2 /* INFO */]: "INFO",
|
|
913
|
-
[3 /* DEBUG */]: "DEBUG",
|
|
914
|
-
[4 /* TRACE */]: "TRACE"
|
|
915
|
-
};
|
|
916
|
-
levelColors = {
|
|
917
|
-
[0 /* ERROR */]: this.terminalColors.red,
|
|
918
|
-
[1 /* WARN */]: this.terminalColors.yellow,
|
|
919
|
-
[2 /* INFO */]: this.terminalColors.blue,
|
|
920
|
-
[3 /* DEBUG */]: this.terminalColors.green,
|
|
921
|
-
[4 /* TRACE */]: this.terminalColors.gray
|
|
922
|
-
};
|
|
923
|
-
levelBrowserColors = {
|
|
924
|
-
[0 /* ERROR */]: this.browserColors.error,
|
|
925
|
-
[1 /* WARN */]: this.browserColors.warn,
|
|
926
|
-
[2 /* INFO */]: this.browserColors.info,
|
|
927
|
-
[3 /* DEBUG */]: this.browserColors.debug,
|
|
928
|
-
[4 /* TRACE */]: this.browserColors.trace
|
|
929
|
-
};
|
|
930
|
-
/**
|
|
931
|
-
* Private constructor for singleton pattern
|
|
932
|
-
*/
|
|
933
|
-
constructor() {
|
|
934
|
-
var _a2;
|
|
935
|
-
this.config = {
|
|
936
|
-
level: 3 /* DEBUG */,
|
|
937
|
-
// Default log level
|
|
938
|
-
enabled: true,
|
|
939
|
-
// Logging enabled by default
|
|
940
|
-
showTimestamp: false,
|
|
941
|
-
// Show timestamps by default
|
|
942
|
-
showColors: true
|
|
943
|
-
// Show colors by default
|
|
944
|
-
};
|
|
945
|
-
if ((_a2 = import.meta.env) == null ? void 0 : _a2.DEV) {
|
|
946
|
-
console.warn(
|
|
947
|
-
"[Logger] For better debugging experience, add Logger.ts to DevTools ignore list:\nDevTools \u2192 Settings (F1) \u2192 Ignore List \u2192 Add pattern: /Logger\\.ts$"
|
|
948
|
-
);
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
/**
|
|
952
|
-
* Get the singleton instance of the Logger
|
|
953
|
-
*/
|
|
954
|
-
static getInstance() {
|
|
955
|
-
if (!_Logger.instance) {
|
|
956
|
-
_Logger.instance = new _Logger();
|
|
957
|
-
}
|
|
958
|
-
return _Logger.instance;
|
|
959
|
-
}
|
|
960
|
-
/**
|
|
961
|
-
* Configure the logger
|
|
962
|
-
* @param config Configuration options
|
|
963
|
-
*/
|
|
964
|
-
configure(config) {
|
|
965
|
-
this.config = { ...this.config, ...config };
|
|
966
|
-
}
|
|
967
|
-
/**
|
|
968
|
-
* Enable or disable logging
|
|
969
|
-
* @param enabled Whether logging is enabled
|
|
970
|
-
*/
|
|
971
|
-
setEnabled(enabled) {
|
|
972
|
-
this.config.enabled = enabled;
|
|
973
|
-
}
|
|
974
|
-
/**
|
|
975
|
-
* Set the log level
|
|
976
|
-
* @param level The log level to set
|
|
977
|
-
*/
|
|
978
|
-
setLevel(level) {
|
|
979
|
-
this.config.level = level;
|
|
980
|
-
}
|
|
981
|
-
/**
|
|
982
|
-
* Get the current log level
|
|
983
|
-
*/
|
|
984
|
-
getLevel() {
|
|
985
|
-
return this.config.level;
|
|
986
|
-
}
|
|
987
|
-
/**
|
|
988
|
-
* Log an error message
|
|
989
|
-
* @param message The message to log
|
|
990
|
-
* @param args Additional arguments to log
|
|
991
|
-
*/
|
|
992
|
-
error(message, ...args) {
|
|
993
|
-
this.log(0 /* ERROR */, message, ...args);
|
|
994
|
-
}
|
|
995
|
-
/**
|
|
996
|
-
* Log a warning message
|
|
997
|
-
* @param message The message to log
|
|
998
|
-
* @param args Additional arguments to log
|
|
999
|
-
*/
|
|
1000
|
-
warn(message, ...args) {
|
|
1001
|
-
this.log(1 /* WARN */, message, ...args);
|
|
1002
|
-
}
|
|
1003
|
-
/**
|
|
1004
|
-
* Log an info message
|
|
1005
|
-
* @param message The message to log
|
|
1006
|
-
* @param args Additional arguments to log
|
|
1007
|
-
*/
|
|
1008
|
-
info(message, ...args) {
|
|
1009
|
-
this.log(2 /* INFO */, message, ...args);
|
|
1010
|
-
}
|
|
1011
|
-
/**
|
|
1012
|
-
* Log a debug message
|
|
1013
|
-
* @param message The message to log
|
|
1014
|
-
* @param args Additional arguments to log
|
|
1015
|
-
*/
|
|
1016
|
-
debug(message, ...args) {
|
|
1017
|
-
this.log(3 /* DEBUG */, message, ...args);
|
|
1018
|
-
}
|
|
1019
|
-
/**
|
|
1020
|
-
* Log a trace message
|
|
1021
|
-
* @param message The message to log
|
|
1022
|
-
* @param args Additional arguments to log
|
|
1023
|
-
*/
|
|
1024
|
-
trace(message, ...args) {
|
|
1025
|
-
this.log(4 /* TRACE */, message, ...args);
|
|
1026
|
-
}
|
|
1027
|
-
/**
|
|
1028
|
-
* Log a message with a specific log level
|
|
1029
|
-
* @param level The log level
|
|
1030
|
-
* @param message The message to log
|
|
1031
|
-
* @param args Additional arguments to log
|
|
1032
|
-
*/
|
|
1033
|
-
log(level, message, ...args) {
|
|
1034
|
-
if (!this.config.enabled || level > this.config.level) {
|
|
1035
|
-
return;
|
|
1036
|
-
}
|
|
1037
|
-
if (!this.shouldLogMessage(message)) {
|
|
1038
|
-
return;
|
|
1039
|
-
}
|
|
1040
|
-
const isBrowser = typeof window !== "undefined";
|
|
1041
|
-
if (isBrowser && this.config.showColors) {
|
|
1042
|
-
this.logBrowser(level, message, ...args);
|
|
1043
|
-
} else {
|
|
1044
|
-
this.logTerminal(level, message, ...args);
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
extractContext(message) {
|
|
1048
|
-
const contextMatch = message.match(/^\[([^\]]+)\]\s(.*)$/);
|
|
1049
|
-
if (!contextMatch) {
|
|
1050
|
-
return {
|
|
1051
|
-
context: "",
|
|
1052
|
-
messageContent: message
|
|
1053
|
-
};
|
|
1054
|
-
}
|
|
1055
|
-
return {
|
|
1056
|
-
context: contextMatch[1],
|
|
1057
|
-
messageContent: contextMatch[2]
|
|
1058
|
-
};
|
|
1059
|
-
}
|
|
1060
|
-
matchesFilter(value, matchers) {
|
|
1061
|
-
if (!(matchers == null ? void 0 : matchers.length)) {
|
|
1062
|
-
return false;
|
|
1063
|
-
}
|
|
1064
|
-
return matchers.some((matcher) => {
|
|
1065
|
-
if (typeof matcher === "string") {
|
|
1066
|
-
return value.includes(matcher);
|
|
1067
|
-
}
|
|
1068
|
-
matcher.lastIndex = 0;
|
|
1069
|
-
return matcher.test(value);
|
|
1070
|
-
});
|
|
1071
|
-
}
|
|
1072
|
-
shouldLogMessage(message) {
|
|
1073
|
-
var _a2, _b;
|
|
1074
|
-
const filter = this.config.filter;
|
|
1075
|
-
if (!filter) {
|
|
1076
|
-
return true;
|
|
1077
|
-
}
|
|
1078
|
-
const hasFilters = Boolean(((_a2 = filter.contexts) == null ? void 0 : _a2.length) || ((_b = filter.messages) == null ? void 0 : _b.length));
|
|
1079
|
-
if (!hasFilters) {
|
|
1080
|
-
return true;
|
|
1081
|
-
}
|
|
1082
|
-
const { context, messageContent } = this.extractContext(message);
|
|
1083
|
-
const contextMatches = this.matchesFilter(context, filter.contexts);
|
|
1084
|
-
const messageMatches = this.matchesFilter(messageContent, filter.messages);
|
|
1085
|
-
const matches = contextMatches || messageMatches;
|
|
1086
|
-
return filter.mode === "exclude" ? !matches : matches;
|
|
1087
|
-
}
|
|
1088
|
-
/**
|
|
1089
|
-
* Log a message in terminal/node environment
|
|
1090
|
-
*/
|
|
1091
|
-
logTerminal(level, message, ...args) {
|
|
1092
|
-
let timestamp = "";
|
|
1093
|
-
let levelStr = "";
|
|
1094
|
-
let contextPart = "";
|
|
1095
|
-
const contextMatch = message.match(/^\[([^\]]+)\]\s(.*)$/);
|
|
1096
|
-
let messageContent = message;
|
|
1097
|
-
if (contextMatch) {
|
|
1098
|
-
contextPart = `[${contextMatch[1]}] `;
|
|
1099
|
-
messageContent = contextMatch[2];
|
|
1100
|
-
}
|
|
1101
|
-
if (this.config.showTimestamp) {
|
|
1102
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1103
|
-
timestamp = `[${now}] `;
|
|
1104
|
-
}
|
|
1105
|
-
levelStr = `[${this.levelLabels[level]}] `;
|
|
1106
|
-
if (this.config.showColors) {
|
|
1107
|
-
const levelColor = this.levelColors[level];
|
|
1108
|
-
const contextColor = this.terminalColors.cyan;
|
|
1109
|
-
const timestampColor = this.terminalColors.gray;
|
|
1110
|
-
const messageColor = this.terminalColors.white;
|
|
1111
|
-
timestamp = `${timestampColor}${timestamp}${this.terminalColors.reset}`;
|
|
1112
|
-
levelStr = `${levelColor}${levelStr}${this.terminalColors.reset}`;
|
|
1113
|
-
if (contextPart) {
|
|
1114
|
-
contextPart = `${contextColor}${contextPart}${this.terminalColors.reset}`;
|
|
1115
|
-
}
|
|
1116
|
-
messageContent = `${messageColor}${messageContent}${this.terminalColors.reset}`;
|
|
1117
|
-
}
|
|
1118
|
-
const formattedMessage = timestamp + levelStr + contextPart + messageContent;
|
|
1119
|
-
switch (level) {
|
|
1120
|
-
case 0 /* ERROR */:
|
|
1121
|
-
console.error(formattedMessage, ...args);
|
|
1122
|
-
break;
|
|
1123
|
-
case 1 /* WARN */:
|
|
1124
|
-
console.warn(formattedMessage, ...args);
|
|
1125
|
-
break;
|
|
1126
|
-
case 2 /* INFO */:
|
|
1127
|
-
console.info(formattedMessage, ...args);
|
|
1128
|
-
break;
|
|
1129
|
-
case 3 /* DEBUG */:
|
|
1130
|
-
case 4 /* TRACE */:
|
|
1131
|
-
default:
|
|
1132
|
-
console.log(formattedMessage, ...args);
|
|
1133
|
-
break;
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
/**
|
|
1137
|
-
* Log a message in browser environment with CSS styling
|
|
1138
|
-
*/
|
|
1139
|
-
logBrowser(level, message, ...args) {
|
|
1140
|
-
const contextMatch = message.match(/^\[([^\]]+)\]\s(.*)$/);
|
|
1141
|
-
let context = "";
|
|
1142
|
-
let messageContent = message;
|
|
1143
|
-
if (contextMatch) {
|
|
1144
|
-
context = contextMatch[1];
|
|
1145
|
-
messageContent = contextMatch[2];
|
|
1146
|
-
}
|
|
1147
|
-
let format = "";
|
|
1148
|
-
const formatArgs = [];
|
|
1149
|
-
if (this.config.showTimestamp) {
|
|
1150
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1151
|
-
format += "%c[" + now + "] ";
|
|
1152
|
-
formatArgs.push(this.browserColors.timestamp);
|
|
1153
|
-
}
|
|
1154
|
-
format += "%c[" + this.levelLabels[level] + "] ";
|
|
1155
|
-
formatArgs.push(this.levelBrowserColors[level]);
|
|
1156
|
-
if (context) {
|
|
1157
|
-
format += "%c[" + context + "] ";
|
|
1158
|
-
formatArgs.push(this.browserColors.context);
|
|
1159
|
-
}
|
|
1160
|
-
format += "%c" + messageContent;
|
|
1161
|
-
formatArgs.push(this.browserColors.message);
|
|
1162
|
-
switch (level) {
|
|
1163
|
-
case 0 /* ERROR */:
|
|
1164
|
-
console.error(format, ...formatArgs, ...args);
|
|
1165
|
-
break;
|
|
1166
|
-
case 1 /* WARN */:
|
|
1167
|
-
console.warn(format, ...formatArgs, ...args);
|
|
1168
|
-
break;
|
|
1169
|
-
case 2 /* INFO */:
|
|
1170
|
-
console.info(format, ...formatArgs, ...args);
|
|
1171
|
-
break;
|
|
1172
|
-
case 3 /* DEBUG */:
|
|
1173
|
-
case 4 /* TRACE */:
|
|
1174
|
-
default:
|
|
1175
|
-
console.log(format, ...formatArgs, ...args);
|
|
1176
|
-
break;
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
/**
|
|
1180
|
-
* Creates a context-specific logger.
|
|
1181
|
-
*
|
|
1182
|
-
* Context loggers automatically prefix all log messages with a context tag.
|
|
1183
|
-
* Commonly used in plugins and classes to identify log sources.
|
|
1184
|
-
*
|
|
1185
|
-
* @param context - Context name (e.g., 'MyPlugin', 'SceneManager')
|
|
1186
|
-
* @returns ContextLogger instance
|
|
1187
|
-
*
|
|
1188
|
-
* @example
|
|
1189
|
-
* ```typescript
|
|
1190
|
-
* class DisplayPlugin {
|
|
1191
|
-
* private logger = logger.createContextLogger('DisplayPlugin');
|
|
1192
|
-
*
|
|
1193
|
-
* initialize() {
|
|
1194
|
-
* this.logger.info('Initializing display');
|
|
1195
|
-
* // Output: [INFO] [DisplayPlugin] Initializing display
|
|
1196
|
-
* }
|
|
1197
|
-
* }
|
|
1198
|
-
* ```
|
|
1199
|
-
*/
|
|
1200
|
-
createContextLogger(context) {
|
|
1201
|
-
return new ContextLogger(this, context);
|
|
1202
|
-
}
|
|
1203
|
-
};
|
|
1204
|
-
var ContextLogger = class {
|
|
1205
|
-
logger;
|
|
1206
|
-
context;
|
|
1207
|
-
constructor(logger2, context) {
|
|
1208
|
-
this.logger = logger2;
|
|
1209
|
-
this.context = context;
|
|
1210
|
-
}
|
|
1211
|
-
/**
|
|
1212
|
-
* Log an error message
|
|
1213
|
-
* @param message The message to log
|
|
1214
|
-
* @param args Additional arguments to log
|
|
1215
|
-
*/
|
|
1216
|
-
error(message, ...args) {
|
|
1217
|
-
this.logger.error(`[${this.context}] ${message}`, ...args);
|
|
1218
|
-
}
|
|
1219
|
-
/**
|
|
1220
|
-
* Log a warning message
|
|
1221
|
-
* @param message The message to log
|
|
1222
|
-
* @param args Additional arguments to log
|
|
1223
|
-
*/
|
|
1224
|
-
warn(message, ...args) {
|
|
1225
|
-
this.logger.warn(`[${this.context}] ${message}`, ...args);
|
|
1226
|
-
}
|
|
1227
|
-
/**
|
|
1228
|
-
* Log an info message
|
|
1229
|
-
* @param message The message to log
|
|
1230
|
-
* @param args Additional arguments to log
|
|
1231
|
-
*/
|
|
1232
|
-
info(message, ...args) {
|
|
1233
|
-
this.logger.info(`[${this.context}] ${message}`, ...args);
|
|
1234
|
-
}
|
|
1235
|
-
/**
|
|
1236
|
-
* Log a debug message
|
|
1237
|
-
* @param message The message to log
|
|
1238
|
-
* @param args Additional arguments to log
|
|
1239
|
-
*/
|
|
1240
|
-
debug(message, ...args) {
|
|
1241
|
-
this.logger.debug(`[${this.context}] ${message}`, ...args);
|
|
1242
|
-
}
|
|
1243
|
-
/**
|
|
1244
|
-
* Log a trace message
|
|
1245
|
-
* @param message The message to log
|
|
1246
|
-
* @param args Additional arguments to log
|
|
1247
|
-
*/
|
|
1248
|
-
trace(message, ...args) {
|
|
1249
|
-
this.logger.trace(`[${this.context}] ${message}`, ...args);
|
|
1250
|
-
}
|
|
1251
|
-
};
|
|
1252
|
-
var logger = Logger.getInstance();
|
|
1253
|
-
var contextLoggers = /* @__PURE__ */ new Map();
|
|
1254
|
-
function getLogger(context) {
|
|
1255
|
-
let cached = contextLoggers.get(context);
|
|
1256
|
-
if (!cached) {
|
|
1257
|
-
cached = new ContextLogger(logger, context);
|
|
1258
|
-
contextLoggers.set(context, cached);
|
|
1259
|
-
}
|
|
1260
|
-
return cached;
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
// plugins/Plugin.types.ts
|
|
1264
|
-
var ENGINE_HOOKS = {
|
|
1265
|
-
onEngineReady: Symbol("onEngineReady"),
|
|
1266
|
-
onPause: Symbol("onPause"),
|
|
1267
|
-
onResume: Symbol("onResume"),
|
|
1268
|
-
onResize: Symbol("onResize")
|
|
1269
|
-
};
|
|
1270
9
|
var devtools = globalThis.__PIXI_DEVTOOLS__;
|
|
1271
10
|
if (devtools == null ? void 0 : devtools.extensions) {
|
|
1272
11
|
devtools.extensions = devtools.extensions.filter(
|
|
1273
12
|
(e) => {
|
|
1274
|
-
var
|
|
1275
|
-
return ((
|
|
13
|
+
var _a;
|
|
14
|
+
return ((_a = e == null ? void 0 : e.extension) == null ? void 0 : _a.name) !== "layout-scene-overlay";
|
|
1276
15
|
}
|
|
1277
16
|
);
|
|
1278
17
|
}
|