@almadar/ui 5.85.0 → 5.87.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/dist/avl/index.cjs +139 -1415
- package/dist/avl/index.js +139 -1415
- package/dist/components/game/2d/molecules/index.d.ts +0 -2
- package/dist/components/game/shared/index.d.ts +0 -2
- package/dist/components/index.cjs +124 -1478
- package/dist/components/index.js +125 -1468
- package/dist/providers/index.cjs +109 -1385
- package/dist/providers/index.js +109 -1385
- package/dist/runtime/index.cjs +115 -1391
- package/dist/runtime/index.js +115 -1391
- package/package.json +1 -1
- package/dist/components/game/2d/organisms/CanvasEffect.d.ts +0 -70
- package/dist/components/game/shared/canvasEffects.d.ts +0 -50
- package/dist/components/game/shared/combatPresets.d.ts +0 -15
- package/dist/components/game/shared/hooks/useCanvasEffects.d.ts +0 -27
package/dist/providers/index.js
CHANGED
|
@@ -541,12 +541,12 @@ function kebabToPascal(name) {
|
|
|
541
541
|
}).join("");
|
|
542
542
|
}
|
|
543
543
|
function loadLib(key, importer) {
|
|
544
|
-
let
|
|
545
|
-
if (!
|
|
546
|
-
|
|
547
|
-
libPromises.set(key,
|
|
544
|
+
let p = libPromises.get(key);
|
|
545
|
+
if (!p) {
|
|
546
|
+
p = importer();
|
|
547
|
+
libPromises.set(key, p);
|
|
548
548
|
}
|
|
549
|
-
return
|
|
549
|
+
return p;
|
|
550
550
|
}
|
|
551
551
|
function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
|
|
552
552
|
const Lazy = React97__default.lazy(async () => {
|
|
@@ -5835,28 +5835,28 @@ var init_ConfettiEffect = __esm({
|
|
|
5835
5835
|
),
|
|
5836
5836
|
"aria-hidden": "true",
|
|
5837
5837
|
children: [
|
|
5838
|
-
particles.map((
|
|
5839
|
-
const rad =
|
|
5840
|
-
const tx = Math.cos(rad) *
|
|
5841
|
-
const ty = Math.sin(rad) *
|
|
5838
|
+
particles.map((p) => {
|
|
5839
|
+
const rad = p.angle * Math.PI / 180;
|
|
5840
|
+
const tx = Math.cos(rad) * p.distance;
|
|
5841
|
+
const ty = Math.sin(rad) * p.distance - 20;
|
|
5842
5842
|
return /* @__PURE__ */ jsx(
|
|
5843
5843
|
Box,
|
|
5844
5844
|
{
|
|
5845
5845
|
className: "absolute rounded-sm",
|
|
5846
5846
|
style: {
|
|
5847
|
-
left: `${
|
|
5847
|
+
left: `${p.left}%`,
|
|
5848
5848
|
top: "50%",
|
|
5849
|
-
width:
|
|
5850
|
-
height:
|
|
5851
|
-
backgroundColor:
|
|
5852
|
-
animation: `confetti-burst ${duration -
|
|
5849
|
+
width: p.size,
|
|
5850
|
+
height: p.size,
|
|
5851
|
+
backgroundColor: p.color,
|
|
5852
|
+
animation: `confetti-burst ${duration - p.delay}ms ease-out ${p.delay}ms forwards`,
|
|
5853
5853
|
opacity: 0,
|
|
5854
5854
|
"--confetti-tx": `${tx}px`,
|
|
5855
5855
|
"--confetti-ty": `${ty}px`,
|
|
5856
|
-
"--confetti-rotate": `${
|
|
5856
|
+
"--confetti-rotate": `${p.rotation}deg`
|
|
5857
5857
|
}
|
|
5858
5858
|
},
|
|
5859
|
-
|
|
5859
|
+
p.id
|
|
5860
5860
|
);
|
|
5861
5861
|
}),
|
|
5862
5862
|
/* @__PURE__ */ jsx("style", { children: `
|
|
@@ -6767,8 +6767,8 @@ var init_AnimatedGraphic = __esm({
|
|
|
6767
6767
|
const el = containerRef.current;
|
|
6768
6768
|
if (!el || !strokeColor) return;
|
|
6769
6769
|
const paths = el.querySelectorAll("path, line, polyline, polygon, circle, ellipse, rect");
|
|
6770
|
-
paths.forEach((
|
|
6771
|
-
|
|
6770
|
+
paths.forEach((p) => {
|
|
6771
|
+
p.style.stroke = strokeColor;
|
|
6772
6772
|
});
|
|
6773
6773
|
}, [resolvedSvg, strokeColor]);
|
|
6774
6774
|
useEffect(() => {
|
|
@@ -6776,23 +6776,23 @@ var init_AnimatedGraphic = __esm({
|
|
|
6776
6776
|
if (!el || !resolvedSvg) return;
|
|
6777
6777
|
if (animation === "draw" || animation === "fill") {
|
|
6778
6778
|
const paths = el.querySelectorAll("path, line, polyline, polygon, circle, ellipse, rect");
|
|
6779
|
-
paths.forEach((
|
|
6780
|
-
if ("getTotalLength" in
|
|
6781
|
-
const len =
|
|
6782
|
-
|
|
6783
|
-
|
|
6779
|
+
paths.forEach((p) => {
|
|
6780
|
+
if ("getTotalLength" in p && typeof p.getTotalLength === "function") {
|
|
6781
|
+
const len = p.getTotalLength();
|
|
6782
|
+
p.style.strokeDasharray = `${len}`;
|
|
6783
|
+
p.style.strokeDashoffset = `${len}`;
|
|
6784
6784
|
}
|
|
6785
6785
|
if (animation === "fill") {
|
|
6786
|
-
|
|
6786
|
+
p.style.fillOpacity = "0";
|
|
6787
6787
|
}
|
|
6788
6788
|
});
|
|
6789
6789
|
}
|
|
6790
6790
|
if (animation === "morph") {
|
|
6791
6791
|
const paths = el.querySelectorAll("path, circle, ellipse, rect, polygon");
|
|
6792
|
-
paths.forEach((
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
|
|
6792
|
+
paths.forEach((p) => {
|
|
6793
|
+
p.style.transform = "scale(0)";
|
|
6794
|
+
p.style.transformOrigin = "center";
|
|
6795
|
+
p.style.opacity = "0";
|
|
6796
6796
|
});
|
|
6797
6797
|
}
|
|
6798
6798
|
}, [resolvedSvg, animation]);
|
|
@@ -6897,14 +6897,8 @@ var init_TraitFrame = __esm({
|
|
|
6897
6897
|
});
|
|
6898
6898
|
|
|
6899
6899
|
// components/game/shared/effects.ts
|
|
6900
|
-
var EMPTY_EFFECT_STATE;
|
|
6901
6900
|
var init_effects = __esm({
|
|
6902
6901
|
"components/game/shared/effects.ts"() {
|
|
6903
|
-
EMPTY_EFFECT_STATE = {
|
|
6904
|
-
particles: [],
|
|
6905
|
-
sequences: [],
|
|
6906
|
-
overlays: []
|
|
6907
|
-
};
|
|
6908
6902
|
}
|
|
6909
6903
|
});
|
|
6910
6904
|
|
|
@@ -7300,1021 +7294,12 @@ var init_spriteAnimation = __esm({
|
|
|
7300
7294
|
}
|
|
7301
7295
|
});
|
|
7302
7296
|
|
|
7303
|
-
// components/game/shared/combatPresets.ts
|
|
7304
|
-
function p(manifest, key) {
|
|
7305
|
-
const particles = manifest.particles;
|
|
7306
|
-
if (!particles) return [];
|
|
7307
|
-
const val = particles[key];
|
|
7308
|
-
if (Array.isArray(val)) return val.map((v) => `${manifest.baseUrl}/${v}`);
|
|
7309
|
-
if (typeof val === "string") return [`${manifest.baseUrl}/${val}`];
|
|
7310
|
-
return [];
|
|
7311
|
-
}
|
|
7312
|
-
function anim(manifest, key) {
|
|
7313
|
-
const animations = manifest.animations;
|
|
7314
|
-
if (!animations) return [];
|
|
7315
|
-
const val = animations[key];
|
|
7316
|
-
if (Array.isArray(val)) return val.map((v) => `${manifest.baseUrl}/${v}`);
|
|
7317
|
-
return [];
|
|
7318
|
-
}
|
|
7319
|
-
function createCombatPresets(manifest) {
|
|
7320
|
-
return {
|
|
7321
|
-
// =====================================================================
|
|
7322
|
-
// MELEE — slash (red) + dirt + scratch + flash sequence
|
|
7323
|
-
// =====================================================================
|
|
7324
|
-
melee: (originX, originY) => {
|
|
7325
|
-
const particles = [
|
|
7326
|
-
{
|
|
7327
|
-
spriteUrls: p(manifest, "slash"),
|
|
7328
|
-
count: 6,
|
|
7329
|
-
originX,
|
|
7330
|
-
originY,
|
|
7331
|
-
spread: 8,
|
|
7332
|
-
velocityMin: 40,
|
|
7333
|
-
velocityMax: 120,
|
|
7334
|
-
angleMin: -PI2 * 0.8,
|
|
7335
|
-
angleMax: -PI2 * 0.2,
|
|
7336
|
-
gravity: 0,
|
|
7337
|
-
tint: { r: 255, g: 60, b: 40 },
|
|
7338
|
-
scaleMin: 0.3,
|
|
7339
|
-
scaleMax: 0.6,
|
|
7340
|
-
lifetimeMin: 300,
|
|
7341
|
-
lifetimeMax: 500,
|
|
7342
|
-
fadeRate: -2.5
|
|
7343
|
-
},
|
|
7344
|
-
{
|
|
7345
|
-
spriteUrls: p(manifest, "dirt"),
|
|
7346
|
-
count: 4,
|
|
7347
|
-
originX,
|
|
7348
|
-
originY: originY + 10,
|
|
7349
|
-
spread: 12,
|
|
7350
|
-
velocityMin: 20,
|
|
7351
|
-
velocityMax: 60,
|
|
7352
|
-
angleMin: -PI2 * 0.9,
|
|
7353
|
-
angleMax: -PI2 * 0.1,
|
|
7354
|
-
gravity: 120,
|
|
7355
|
-
tint: { r: 180, g: 140, b: 90 },
|
|
7356
|
-
scaleMin: 0.15,
|
|
7357
|
-
scaleMax: 0.3,
|
|
7358
|
-
lifetimeMin: 400,
|
|
7359
|
-
lifetimeMax: 700,
|
|
7360
|
-
fadeRate: -1.8
|
|
7361
|
-
},
|
|
7362
|
-
{
|
|
7363
|
-
spriteUrls: p(manifest, "scratch"),
|
|
7364
|
-
count: 2,
|
|
7365
|
-
originX,
|
|
7366
|
-
originY,
|
|
7367
|
-
spread: 5,
|
|
7368
|
-
velocityMin: 10,
|
|
7369
|
-
velocityMax: 30,
|
|
7370
|
-
angleMin: -PI2 * 0.7,
|
|
7371
|
-
angleMax: -PI2 * 0.3,
|
|
7372
|
-
gravity: 0,
|
|
7373
|
-
tint: { r: 255, g: 200, b: 150 },
|
|
7374
|
-
scaleMin: 0.25,
|
|
7375
|
-
scaleMax: 0.4,
|
|
7376
|
-
lifetimeMin: 200,
|
|
7377
|
-
lifetimeMax: 400,
|
|
7378
|
-
fadeRate: -3
|
|
7379
|
-
}
|
|
7380
|
-
];
|
|
7381
|
-
const sequences = [];
|
|
7382
|
-
const flashFrames = anim(manifest, "flash");
|
|
7383
|
-
if (flashFrames.length > 0) {
|
|
7384
|
-
sequences.push({
|
|
7385
|
-
frameUrls: flashFrames,
|
|
7386
|
-
originX,
|
|
7387
|
-
originY,
|
|
7388
|
-
frameDuration: 35,
|
|
7389
|
-
scale: 0.4
|
|
7390
|
-
});
|
|
7391
|
-
}
|
|
7392
|
-
return {
|
|
7393
|
-
particles: particles.filter((pc) => pc.spriteUrls.length > 0),
|
|
7394
|
-
sequences,
|
|
7395
|
-
overlays: [],
|
|
7396
|
-
screenShake: 4,
|
|
7397
|
-
screenFlash: null
|
|
7398
|
-
};
|
|
7399
|
-
},
|
|
7400
|
-
// =====================================================================
|
|
7401
|
-
// RANGED — muzzle + trace + smoke + explosion sequence
|
|
7402
|
-
// =====================================================================
|
|
7403
|
-
ranged: (originX, originY) => {
|
|
7404
|
-
const particles = [
|
|
7405
|
-
{
|
|
7406
|
-
spriteUrls: p(manifest, "muzzle"),
|
|
7407
|
-
count: 3,
|
|
7408
|
-
originX,
|
|
7409
|
-
originY,
|
|
7410
|
-
spread: 4,
|
|
7411
|
-
velocityMin: 60,
|
|
7412
|
-
velocityMax: 150,
|
|
7413
|
-
angleMin: -PI2 * 0.6,
|
|
7414
|
-
angleMax: -PI2 * 0.4,
|
|
7415
|
-
gravity: 0,
|
|
7416
|
-
tint: { r: 255, g: 220, b: 100 },
|
|
7417
|
-
scaleMin: 0.2,
|
|
7418
|
-
scaleMax: 0.4,
|
|
7419
|
-
lifetimeMin: 200,
|
|
7420
|
-
lifetimeMax: 400,
|
|
7421
|
-
fadeRate: -3
|
|
7422
|
-
},
|
|
7423
|
-
{
|
|
7424
|
-
spriteUrls: p(manifest, "trace"),
|
|
7425
|
-
count: 5,
|
|
7426
|
-
originX,
|
|
7427
|
-
originY,
|
|
7428
|
-
spread: 3,
|
|
7429
|
-
velocityMin: 100,
|
|
7430
|
-
velocityMax: 200,
|
|
7431
|
-
angleMin: -PI2 * 0.55,
|
|
7432
|
-
angleMax: -PI2 * 0.45,
|
|
7433
|
-
gravity: 0,
|
|
7434
|
-
tint: { r: 255, g: 200, b: 80 },
|
|
7435
|
-
scaleMin: 0.15,
|
|
7436
|
-
scaleMax: 0.3,
|
|
7437
|
-
lifetimeMin: 150,
|
|
7438
|
-
lifetimeMax: 300,
|
|
7439
|
-
fadeRate: -4
|
|
7440
|
-
},
|
|
7441
|
-
{
|
|
7442
|
-
spriteUrls: p(manifest, "smoke").slice(0, 3),
|
|
7443
|
-
count: 3,
|
|
7444
|
-
originX,
|
|
7445
|
-
originY: originY + 5,
|
|
7446
|
-
spread: 6,
|
|
7447
|
-
velocityMin: 10,
|
|
7448
|
-
velocityMax: 30,
|
|
7449
|
-
angleMin: -PI2 * 0.8,
|
|
7450
|
-
angleMax: -PI2 * 0.2,
|
|
7451
|
-
gravity: -20,
|
|
7452
|
-
tint: { r: 200, g: 200, b: 200 },
|
|
7453
|
-
scaleMin: 0.2,
|
|
7454
|
-
scaleMax: 0.35,
|
|
7455
|
-
lifetimeMin: 500,
|
|
7456
|
-
lifetimeMax: 800,
|
|
7457
|
-
fadeRate: -1.5
|
|
7458
|
-
}
|
|
7459
|
-
];
|
|
7460
|
-
const sequences = [];
|
|
7461
|
-
const explosionFrames = anim(manifest, "smokeExplosion");
|
|
7462
|
-
if (explosionFrames.length > 0) {
|
|
7463
|
-
sequences.push({
|
|
7464
|
-
frameUrls: explosionFrames,
|
|
7465
|
-
originX,
|
|
7466
|
-
originY,
|
|
7467
|
-
frameDuration: 50,
|
|
7468
|
-
scale: 0.35
|
|
7469
|
-
});
|
|
7470
|
-
}
|
|
7471
|
-
return {
|
|
7472
|
-
particles: particles.filter((pc) => pc.spriteUrls.length > 0),
|
|
7473
|
-
sequences,
|
|
7474
|
-
overlays: [],
|
|
7475
|
-
screenShake: 2,
|
|
7476
|
-
screenFlash: null
|
|
7477
|
-
};
|
|
7478
|
-
},
|
|
7479
|
-
// =====================================================================
|
|
7480
|
-
// MAGIC — twirl (purple) + spark (purple) + star
|
|
7481
|
-
// =====================================================================
|
|
7482
|
-
magic: (originX, originY) => {
|
|
7483
|
-
const particles = [
|
|
7484
|
-
{
|
|
7485
|
-
spriteUrls: p(manifest, "twirl"),
|
|
7486
|
-
count: 5,
|
|
7487
|
-
originX,
|
|
7488
|
-
originY,
|
|
7489
|
-
spread: 15,
|
|
7490
|
-
velocityMin: 20,
|
|
7491
|
-
velocityMax: 80,
|
|
7492
|
-
angleMin: 0,
|
|
7493
|
-
angleMax: PI2 * 2,
|
|
7494
|
-
gravity: -30,
|
|
7495
|
-
tint: { r: 180, g: 80, b: 255 },
|
|
7496
|
-
scaleMin: 0.2,
|
|
7497
|
-
scaleMax: 0.5,
|
|
7498
|
-
lifetimeMin: 500,
|
|
7499
|
-
lifetimeMax: 900,
|
|
7500
|
-
fadeRate: -1.2,
|
|
7501
|
-
blendMode: "lighter",
|
|
7502
|
-
rotationSpeedMin: -4,
|
|
7503
|
-
rotationSpeedMax: 4
|
|
7504
|
-
},
|
|
7505
|
-
{
|
|
7506
|
-
spriteUrls: p(manifest, "spark"),
|
|
7507
|
-
count: 8,
|
|
7508
|
-
originX,
|
|
7509
|
-
originY,
|
|
7510
|
-
spread: 20,
|
|
7511
|
-
velocityMin: 30,
|
|
7512
|
-
velocityMax: 100,
|
|
7513
|
-
angleMin: 0,
|
|
7514
|
-
angleMax: PI2 * 2,
|
|
7515
|
-
gravity: -15,
|
|
7516
|
-
tint: { r: 200, g: 120, b: 255 },
|
|
7517
|
-
scaleMin: 0.1,
|
|
7518
|
-
scaleMax: 0.25,
|
|
7519
|
-
lifetimeMin: 300,
|
|
7520
|
-
lifetimeMax: 600,
|
|
7521
|
-
fadeRate: -2,
|
|
7522
|
-
blendMode: "lighter"
|
|
7523
|
-
},
|
|
7524
|
-
{
|
|
7525
|
-
spriteUrls: p(manifest, "star"),
|
|
7526
|
-
count: 4,
|
|
7527
|
-
originX,
|
|
7528
|
-
originY,
|
|
7529
|
-
spread: 10,
|
|
7530
|
-
velocityMin: 15,
|
|
7531
|
-
velocityMax: 50,
|
|
7532
|
-
angleMin: -PI2,
|
|
7533
|
-
angleMax: 0,
|
|
7534
|
-
gravity: -40,
|
|
7535
|
-
tint: { r: 220, g: 180, b: 255 },
|
|
7536
|
-
scaleMin: 0.15,
|
|
7537
|
-
scaleMax: 0.3,
|
|
7538
|
-
lifetimeMin: 600,
|
|
7539
|
-
lifetimeMax: 1e3,
|
|
7540
|
-
fadeRate: -1,
|
|
7541
|
-
blendMode: "lighter"
|
|
7542
|
-
}
|
|
7543
|
-
];
|
|
7544
|
-
const overlays = [];
|
|
7545
|
-
const circleUrls = p(manifest, "circle");
|
|
7546
|
-
if (circleUrls.length > 0) {
|
|
7547
|
-
overlays.push({
|
|
7548
|
-
spriteUrl: circleUrls[0],
|
|
7549
|
-
originX,
|
|
7550
|
-
originY,
|
|
7551
|
-
alpha: 0.5,
|
|
7552
|
-
fadeRate: -0.6,
|
|
7553
|
-
pulseAmplitude: 0.2,
|
|
7554
|
-
pulseFrequency: 3,
|
|
7555
|
-
scale: 0.5,
|
|
7556
|
-
blendMode: "lighter",
|
|
7557
|
-
lifetime: 1200
|
|
7558
|
-
});
|
|
7559
|
-
}
|
|
7560
|
-
return {
|
|
7561
|
-
particles: particles.filter((pc) => pc.spriteUrls.length > 0),
|
|
7562
|
-
sequences: [],
|
|
7563
|
-
overlays,
|
|
7564
|
-
screenShake: 0,
|
|
7565
|
-
screenFlash: null
|
|
7566
|
-
};
|
|
7567
|
-
},
|
|
7568
|
-
// =====================================================================
|
|
7569
|
-
// HEAL — circle (green) + star (green) + light (green, pulse)
|
|
7570
|
-
// =====================================================================
|
|
7571
|
-
heal: (originX, originY) => {
|
|
7572
|
-
const particles = [
|
|
7573
|
-
{
|
|
7574
|
-
spriteUrls: p(manifest, "circle"),
|
|
7575
|
-
count: 6,
|
|
7576
|
-
originX,
|
|
7577
|
-
originY,
|
|
7578
|
-
spread: 15,
|
|
7579
|
-
velocityMin: 10,
|
|
7580
|
-
velocityMax: 40,
|
|
7581
|
-
angleMin: -PI2,
|
|
7582
|
-
angleMax: -PI2 * 0.3,
|
|
7583
|
-
gravity: -50,
|
|
7584
|
-
tint: { r: 80, g: 255, b: 120 },
|
|
7585
|
-
scaleMin: 0.15,
|
|
7586
|
-
scaleMax: 0.35,
|
|
7587
|
-
lifetimeMin: 600,
|
|
7588
|
-
lifetimeMax: 1e3,
|
|
7589
|
-
fadeRate: -0.8,
|
|
7590
|
-
blendMode: "lighter"
|
|
7591
|
-
},
|
|
7592
|
-
{
|
|
7593
|
-
spriteUrls: p(manifest, "star"),
|
|
7594
|
-
count: 5,
|
|
7595
|
-
originX,
|
|
7596
|
-
originY,
|
|
7597
|
-
spread: 12,
|
|
7598
|
-
velocityMin: 15,
|
|
7599
|
-
velocityMax: 50,
|
|
7600
|
-
angleMin: -PI2 * 0.9,
|
|
7601
|
-
angleMax: -PI2 * 0.1,
|
|
7602
|
-
gravity: -60,
|
|
7603
|
-
tint: { r: 100, g: 255, b: 140 },
|
|
7604
|
-
scaleMin: 0.1,
|
|
7605
|
-
scaleMax: 0.2,
|
|
7606
|
-
lifetimeMin: 500,
|
|
7607
|
-
lifetimeMax: 800,
|
|
7608
|
-
fadeRate: -1.2,
|
|
7609
|
-
blendMode: "lighter"
|
|
7610
|
-
}
|
|
7611
|
-
];
|
|
7612
|
-
const overlays = [];
|
|
7613
|
-
const lightUrls = p(manifest, "light");
|
|
7614
|
-
if (lightUrls.length > 0) {
|
|
7615
|
-
overlays.push({
|
|
7616
|
-
spriteUrl: lightUrls[0],
|
|
7617
|
-
originX,
|
|
7618
|
-
originY,
|
|
7619
|
-
alpha: 0.6,
|
|
7620
|
-
fadeRate: -0.4,
|
|
7621
|
-
pulseAmplitude: 0.25,
|
|
7622
|
-
pulseFrequency: 2.5,
|
|
7623
|
-
scale: 0.6,
|
|
7624
|
-
blendMode: "lighter",
|
|
7625
|
-
lifetime: 1500
|
|
7626
|
-
});
|
|
7627
|
-
}
|
|
7628
|
-
return {
|
|
7629
|
-
particles: particles.filter((pc) => pc.spriteUrls.length > 0),
|
|
7630
|
-
sequences: [],
|
|
7631
|
-
overlays,
|
|
7632
|
-
screenShake: 0,
|
|
7633
|
-
screenFlash: null
|
|
7634
|
-
};
|
|
7635
|
-
},
|
|
7636
|
-
// =====================================================================
|
|
7637
|
-
// DEFEND / SHIELD — star (blue) + circle (blue, pulse)
|
|
7638
|
-
// =====================================================================
|
|
7639
|
-
defend: (originX, originY) => {
|
|
7640
|
-
const particles = [
|
|
7641
|
-
{
|
|
7642
|
-
spriteUrls: p(manifest, "star"),
|
|
7643
|
-
count: 8,
|
|
7644
|
-
originX,
|
|
7645
|
-
originY,
|
|
7646
|
-
spread: 18,
|
|
7647
|
-
velocityMin: 10,
|
|
7648
|
-
velocityMax: 35,
|
|
7649
|
-
angleMin: 0,
|
|
7650
|
-
angleMax: PI2 * 2,
|
|
7651
|
-
gravity: 0,
|
|
7652
|
-
tint: { r: 80, g: 160, b: 255 },
|
|
7653
|
-
scaleMin: 0.12,
|
|
7654
|
-
scaleMax: 0.25,
|
|
7655
|
-
lifetimeMin: 600,
|
|
7656
|
-
lifetimeMax: 1e3,
|
|
7657
|
-
fadeRate: -0.8,
|
|
7658
|
-
blendMode: "lighter",
|
|
7659
|
-
rotationSpeedMin: -1,
|
|
7660
|
-
rotationSpeedMax: 1
|
|
7661
|
-
}
|
|
7662
|
-
];
|
|
7663
|
-
const overlays = [];
|
|
7664
|
-
const circleUrls = p(manifest, "circle");
|
|
7665
|
-
if (circleUrls.length > 0) {
|
|
7666
|
-
overlays.push({
|
|
7667
|
-
spriteUrl: circleUrls[0],
|
|
7668
|
-
originX,
|
|
7669
|
-
originY,
|
|
7670
|
-
alpha: 0.6,
|
|
7671
|
-
fadeRate: -0.3,
|
|
7672
|
-
pulseAmplitude: 0.2,
|
|
7673
|
-
pulseFrequency: 2,
|
|
7674
|
-
scale: 0.6,
|
|
7675
|
-
blendMode: "lighter",
|
|
7676
|
-
lifetime: 1500
|
|
7677
|
-
});
|
|
7678
|
-
}
|
|
7679
|
-
return {
|
|
7680
|
-
particles: particles.filter((pc) => pc.spriteUrls.length > 0),
|
|
7681
|
-
sequences: [],
|
|
7682
|
-
overlays,
|
|
7683
|
-
screenShake: 0,
|
|
7684
|
-
screenFlash: null
|
|
7685
|
-
};
|
|
7686
|
-
},
|
|
7687
|
-
// shield aliases to defend
|
|
7688
|
-
shield: (originX, originY) => {
|
|
7689
|
-
const particles = [
|
|
7690
|
-
{
|
|
7691
|
-
spriteUrls: p(manifest, "star"),
|
|
7692
|
-
count: 10,
|
|
7693
|
-
originX,
|
|
7694
|
-
originY,
|
|
7695
|
-
spread: 20,
|
|
7696
|
-
velocityMin: 8,
|
|
7697
|
-
velocityMax: 30,
|
|
7698
|
-
angleMin: 0,
|
|
7699
|
-
angleMax: PI2 * 2,
|
|
7700
|
-
gravity: 0,
|
|
7701
|
-
tint: { r: 60, g: 180, b: 255 },
|
|
7702
|
-
scaleMin: 0.1,
|
|
7703
|
-
scaleMax: 0.22,
|
|
7704
|
-
lifetimeMin: 700,
|
|
7705
|
-
lifetimeMax: 1200,
|
|
7706
|
-
fadeRate: -0.7,
|
|
7707
|
-
blendMode: "lighter",
|
|
7708
|
-
rotationSpeedMin: -0.8,
|
|
7709
|
-
rotationSpeedMax: 0.8
|
|
7710
|
-
}
|
|
7711
|
-
];
|
|
7712
|
-
const overlays = [];
|
|
7713
|
-
const circleUrls = p(manifest, "circle");
|
|
7714
|
-
if (circleUrls.length > 0) {
|
|
7715
|
-
overlays.push({
|
|
7716
|
-
spriteUrl: circleUrls[0],
|
|
7717
|
-
originX,
|
|
7718
|
-
originY,
|
|
7719
|
-
alpha: 0.7,
|
|
7720
|
-
fadeRate: -0.25,
|
|
7721
|
-
pulseAmplitude: 0.25,
|
|
7722
|
-
pulseFrequency: 1.8,
|
|
7723
|
-
scale: 0.7,
|
|
7724
|
-
blendMode: "lighter",
|
|
7725
|
-
lifetime: 1800
|
|
7726
|
-
});
|
|
7727
|
-
}
|
|
7728
|
-
return {
|
|
7729
|
-
particles: particles.filter((pc) => pc.spriteUrls.length > 0),
|
|
7730
|
-
sequences: [],
|
|
7731
|
-
overlays,
|
|
7732
|
-
screenShake: 0,
|
|
7733
|
-
screenFlash: null
|
|
7734
|
-
};
|
|
7735
|
-
},
|
|
7736
|
-
// =====================================================================
|
|
7737
|
-
// HIT — spark (orange) + flash (5 frames) + screen shake/flash
|
|
7738
|
-
// =====================================================================
|
|
7739
|
-
hit: (originX, originY) => {
|
|
7740
|
-
const particles = [
|
|
7741
|
-
{
|
|
7742
|
-
spriteUrls: p(manifest, "spark"),
|
|
7743
|
-
count: 10,
|
|
7744
|
-
originX,
|
|
7745
|
-
originY,
|
|
7746
|
-
spread: 8,
|
|
7747
|
-
velocityMin: 50,
|
|
7748
|
-
velocityMax: 150,
|
|
7749
|
-
angleMin: 0,
|
|
7750
|
-
angleMax: PI2 * 2,
|
|
7751
|
-
gravity: 80,
|
|
7752
|
-
tint: { r: 255, g: 180, b: 50 },
|
|
7753
|
-
scaleMin: 0.08,
|
|
7754
|
-
scaleMax: 0.2,
|
|
7755
|
-
lifetimeMin: 200,
|
|
7756
|
-
lifetimeMax: 500,
|
|
7757
|
-
fadeRate: -2.5
|
|
7758
|
-
}
|
|
7759
|
-
];
|
|
7760
|
-
const sequences = [];
|
|
7761
|
-
const flashFrames = anim(manifest, "flash");
|
|
7762
|
-
if (flashFrames.length > 0) {
|
|
7763
|
-
sequences.push({
|
|
7764
|
-
frameUrls: flashFrames.slice(0, 5),
|
|
7765
|
-
originX,
|
|
7766
|
-
originY,
|
|
7767
|
-
frameDuration: 40,
|
|
7768
|
-
scale: 0.3
|
|
7769
|
-
});
|
|
7770
|
-
}
|
|
7771
|
-
return {
|
|
7772
|
-
particles: particles.filter((pc) => pc.spriteUrls.length > 0),
|
|
7773
|
-
sequences,
|
|
7774
|
-
overlays: [],
|
|
7775
|
-
screenShake: 3,
|
|
7776
|
-
screenFlash: { r: 255, g: 50, b: 50, duration: 150 }
|
|
7777
|
-
};
|
|
7778
|
-
},
|
|
7779
|
-
// critical aliases to hit with bigger shake
|
|
7780
|
-
critical: (originX, originY) => {
|
|
7781
|
-
const particles = [
|
|
7782
|
-
{
|
|
7783
|
-
spriteUrls: p(manifest, "flame"),
|
|
7784
|
-
count: 8,
|
|
7785
|
-
originX,
|
|
7786
|
-
originY,
|
|
7787
|
-
spread: 12,
|
|
7788
|
-
velocityMin: 60,
|
|
7789
|
-
velocityMax: 180,
|
|
7790
|
-
angleMin: 0,
|
|
7791
|
-
angleMax: PI2 * 2,
|
|
7792
|
-
gravity: 60,
|
|
7793
|
-
tint: { r: 255, g: 120, b: 30 },
|
|
7794
|
-
scaleMin: 0.15,
|
|
7795
|
-
scaleMax: 0.4,
|
|
7796
|
-
lifetimeMin: 300,
|
|
7797
|
-
lifetimeMax: 600,
|
|
7798
|
-
fadeRate: -2
|
|
7799
|
-
},
|
|
7800
|
-
{
|
|
7801
|
-
spriteUrls: p(manifest, "spark"),
|
|
7802
|
-
count: 12,
|
|
7803
|
-
originX,
|
|
7804
|
-
originY,
|
|
7805
|
-
spread: 10,
|
|
7806
|
-
velocityMin: 80,
|
|
7807
|
-
velocityMax: 200,
|
|
7808
|
-
angleMin: 0,
|
|
7809
|
-
angleMax: PI2 * 2,
|
|
7810
|
-
gravity: 100,
|
|
7811
|
-
tint: { r: 255, g: 200, b: 60 },
|
|
7812
|
-
scaleMin: 0.06,
|
|
7813
|
-
scaleMax: 0.18,
|
|
7814
|
-
lifetimeMin: 200,
|
|
7815
|
-
lifetimeMax: 400,
|
|
7816
|
-
fadeRate: -3
|
|
7817
|
-
}
|
|
7818
|
-
];
|
|
7819
|
-
const sequences = [];
|
|
7820
|
-
const flashFrames = anim(manifest, "flash");
|
|
7821
|
-
if (flashFrames.length > 0) {
|
|
7822
|
-
sequences.push({
|
|
7823
|
-
frameUrls: flashFrames,
|
|
7824
|
-
originX,
|
|
7825
|
-
originY,
|
|
7826
|
-
frameDuration: 30,
|
|
7827
|
-
scale: 0.5
|
|
7828
|
-
});
|
|
7829
|
-
}
|
|
7830
|
-
return {
|
|
7831
|
-
particles: particles.filter((pc) => pc.spriteUrls.length > 0),
|
|
7832
|
-
sequences,
|
|
7833
|
-
overlays: [],
|
|
7834
|
-
screenShake: 6,
|
|
7835
|
-
screenFlash: { r: 255, g: 80, b: 0, duration: 200 }
|
|
7836
|
-
};
|
|
7837
|
-
},
|
|
7838
|
-
// =====================================================================
|
|
7839
|
-
// DEATH — dirt (gray) + explosion + black smoke + scorch (ground)
|
|
7840
|
-
// =====================================================================
|
|
7841
|
-
death: (originX, originY) => {
|
|
7842
|
-
const particles = [
|
|
7843
|
-
{
|
|
7844
|
-
spriteUrls: p(manifest, "dirt"),
|
|
7845
|
-
count: 8,
|
|
7846
|
-
originX,
|
|
7847
|
-
originY,
|
|
7848
|
-
spread: 10,
|
|
7849
|
-
velocityMin: 30,
|
|
7850
|
-
velocityMax: 100,
|
|
7851
|
-
angleMin: 0,
|
|
7852
|
-
angleMax: PI2 * 2,
|
|
7853
|
-
gravity: 100,
|
|
7854
|
-
tint: { r: 140, g: 140, b: 140 },
|
|
7855
|
-
scaleMin: 0.15,
|
|
7856
|
-
scaleMax: 0.35,
|
|
7857
|
-
lifetimeMin: 500,
|
|
7858
|
-
lifetimeMax: 900,
|
|
7859
|
-
fadeRate: -1.2
|
|
7860
|
-
}
|
|
7861
|
-
];
|
|
7862
|
-
const sequences = [];
|
|
7863
|
-
const explosionFrames = anim(manifest, "explosion");
|
|
7864
|
-
if (explosionFrames.length > 0) {
|
|
7865
|
-
sequences.push({
|
|
7866
|
-
frameUrls: explosionFrames,
|
|
7867
|
-
originX,
|
|
7868
|
-
originY,
|
|
7869
|
-
frameDuration: 60,
|
|
7870
|
-
scale: 0.5
|
|
7871
|
-
});
|
|
7872
|
-
}
|
|
7873
|
-
const blackSmokeFrames = anim(manifest, "blackSmoke");
|
|
7874
|
-
if (blackSmokeFrames.length > 0) {
|
|
7875
|
-
sequences.push({
|
|
7876
|
-
frameUrls: blackSmokeFrames,
|
|
7877
|
-
originX,
|
|
7878
|
-
originY: originY - 10,
|
|
7879
|
-
frameDuration: 50,
|
|
7880
|
-
scale: 0.4,
|
|
7881
|
-
alpha: 0.7
|
|
7882
|
-
});
|
|
7883
|
-
}
|
|
7884
|
-
const overlays = [];
|
|
7885
|
-
const scorchUrls = p(manifest, "scorch");
|
|
7886
|
-
if (scorchUrls.length > 0) {
|
|
7887
|
-
overlays.push({
|
|
7888
|
-
spriteUrl: scorchUrls[0],
|
|
7889
|
-
originX,
|
|
7890
|
-
originY: originY + 10,
|
|
7891
|
-
alpha: 0.6,
|
|
7892
|
-
fadeRate: -0.15,
|
|
7893
|
-
scale: 0.4,
|
|
7894
|
-
lifetime: 4e3
|
|
7895
|
-
});
|
|
7896
|
-
}
|
|
7897
|
-
return {
|
|
7898
|
-
particles: particles.filter((pc) => pc.spriteUrls.length > 0),
|
|
7899
|
-
sequences,
|
|
7900
|
-
overlays,
|
|
7901
|
-
screenShake: 0,
|
|
7902
|
-
screenFlash: null
|
|
7903
|
-
};
|
|
7904
|
-
},
|
|
7905
|
-
// =====================================================================
|
|
7906
|
-
// BUFF — star (gold) + symbol + flare (gold, pulse)
|
|
7907
|
-
// =====================================================================
|
|
7908
|
-
buff: (originX, originY) => {
|
|
7909
|
-
const particles = [
|
|
7910
|
-
{
|
|
7911
|
-
spriteUrls: p(manifest, "star"),
|
|
7912
|
-
count: 6,
|
|
7913
|
-
originX,
|
|
7914
|
-
originY,
|
|
7915
|
-
spread: 15,
|
|
7916
|
-
velocityMin: 15,
|
|
7917
|
-
velocityMax: 50,
|
|
7918
|
-
angleMin: -PI2,
|
|
7919
|
-
angleMax: 0,
|
|
7920
|
-
gravity: -30,
|
|
7921
|
-
tint: { r: 255, g: 215, b: 50 },
|
|
7922
|
-
scaleMin: 0.12,
|
|
7923
|
-
scaleMax: 0.25,
|
|
7924
|
-
lifetimeMin: 600,
|
|
7925
|
-
lifetimeMax: 1e3,
|
|
7926
|
-
fadeRate: -0.8,
|
|
7927
|
-
blendMode: "lighter"
|
|
7928
|
-
},
|
|
7929
|
-
{
|
|
7930
|
-
spriteUrls: p(manifest, "symbol"),
|
|
7931
|
-
count: 2,
|
|
7932
|
-
originX,
|
|
7933
|
-
originY: originY - 10,
|
|
7934
|
-
spread: 8,
|
|
7935
|
-
velocityMin: 5,
|
|
7936
|
-
velocityMax: 20,
|
|
7937
|
-
angleMin: -PI2 * 0.7,
|
|
7938
|
-
angleMax: -PI2 * 0.3,
|
|
7939
|
-
gravity: -20,
|
|
7940
|
-
tint: { r: 255, g: 230, b: 100 },
|
|
7941
|
-
scaleMin: 0.2,
|
|
7942
|
-
scaleMax: 0.35,
|
|
7943
|
-
lifetimeMin: 800,
|
|
7944
|
-
lifetimeMax: 1200,
|
|
7945
|
-
fadeRate: -0.6,
|
|
7946
|
-
blendMode: "lighter"
|
|
7947
|
-
}
|
|
7948
|
-
];
|
|
7949
|
-
const overlays = [];
|
|
7950
|
-
const flareUrls = p(manifest, "flare");
|
|
7951
|
-
if (flareUrls.length > 0) {
|
|
7952
|
-
overlays.push({
|
|
7953
|
-
spriteUrl: flareUrls[0],
|
|
7954
|
-
originX,
|
|
7955
|
-
originY,
|
|
7956
|
-
alpha: 0.5,
|
|
7957
|
-
fadeRate: -0.3,
|
|
7958
|
-
pulseAmplitude: 0.3,
|
|
7959
|
-
pulseFrequency: 2,
|
|
7960
|
-
scale: 0.5,
|
|
7961
|
-
blendMode: "lighter",
|
|
7962
|
-
lifetime: 1500
|
|
7963
|
-
});
|
|
7964
|
-
}
|
|
7965
|
-
return {
|
|
7966
|
-
particles: particles.filter((pc) => pc.spriteUrls.length > 0),
|
|
7967
|
-
sequences: [],
|
|
7968
|
-
overlays,
|
|
7969
|
-
screenShake: 0,
|
|
7970
|
-
screenFlash: null
|
|
7971
|
-
};
|
|
7972
|
-
},
|
|
7973
|
-
// =====================================================================
|
|
7974
|
-
// DEBUFF — scorch (dark) + smoke (purple tint)
|
|
7975
|
-
// =====================================================================
|
|
7976
|
-
debuff: (originX, originY) => {
|
|
7977
|
-
const particles = [
|
|
7978
|
-
{
|
|
7979
|
-
spriteUrls: p(manifest, "scorch"),
|
|
7980
|
-
count: 4,
|
|
7981
|
-
originX,
|
|
7982
|
-
originY,
|
|
7983
|
-
spread: 12,
|
|
7984
|
-
velocityMin: 15,
|
|
7985
|
-
velocityMax: 40,
|
|
7986
|
-
angleMin: -PI2,
|
|
7987
|
-
angleMax: 0,
|
|
7988
|
-
gravity: -20,
|
|
7989
|
-
tint: { r: 120, g: 40, b: 160 },
|
|
7990
|
-
scaleMin: 0.15,
|
|
7991
|
-
scaleMax: 0.3,
|
|
7992
|
-
lifetimeMin: 500,
|
|
7993
|
-
lifetimeMax: 800,
|
|
7994
|
-
fadeRate: -1
|
|
7995
|
-
},
|
|
7996
|
-
{
|
|
7997
|
-
spriteUrls: p(manifest, "smoke").slice(0, 3),
|
|
7998
|
-
count: 3,
|
|
7999
|
-
originX,
|
|
8000
|
-
originY,
|
|
8001
|
-
spread: 10,
|
|
8002
|
-
velocityMin: 8,
|
|
8003
|
-
velocityMax: 25,
|
|
8004
|
-
angleMin: -PI2 * 0.8,
|
|
8005
|
-
angleMax: -PI2 * 0.2,
|
|
8006
|
-
gravity: -15,
|
|
8007
|
-
tint: { r: 100, g: 50, b: 140 },
|
|
8008
|
-
scaleMin: 0.2,
|
|
8009
|
-
scaleMax: 0.35,
|
|
8010
|
-
lifetimeMin: 600,
|
|
8011
|
-
lifetimeMax: 1e3,
|
|
8012
|
-
fadeRate: -0.8
|
|
8013
|
-
}
|
|
8014
|
-
];
|
|
8015
|
-
const overlays = [];
|
|
8016
|
-
const circleUrls = p(manifest, "circle");
|
|
8017
|
-
if (circleUrls.length > 0) {
|
|
8018
|
-
overlays.push({
|
|
8019
|
-
spriteUrl: circleUrls[0],
|
|
8020
|
-
originX,
|
|
8021
|
-
originY,
|
|
8022
|
-
alpha: 0.4,
|
|
8023
|
-
fadeRate: -0.4,
|
|
8024
|
-
pulseAmplitude: 0.15,
|
|
8025
|
-
pulseFrequency: 2,
|
|
8026
|
-
scale: 0.45,
|
|
8027
|
-
lifetime: 1200
|
|
8028
|
-
});
|
|
8029
|
-
}
|
|
8030
|
-
return {
|
|
8031
|
-
particles: particles.filter((pc) => pc.spriteUrls.length > 0),
|
|
8032
|
-
sequences: [],
|
|
8033
|
-
overlays,
|
|
8034
|
-
screenShake: 0,
|
|
8035
|
-
screenFlash: null
|
|
8036
|
-
};
|
|
8037
|
-
},
|
|
8038
|
-
// =====================================================================
|
|
8039
|
-
// AOE — explosion (large) + flame + spark (radial) + screen shake
|
|
8040
|
-
// =====================================================================
|
|
8041
|
-
aoe: (originX, originY) => {
|
|
8042
|
-
const particles = [
|
|
8043
|
-
{
|
|
8044
|
-
spriteUrls: p(manifest, "flame"),
|
|
8045
|
-
count: 10,
|
|
8046
|
-
originX,
|
|
8047
|
-
originY,
|
|
8048
|
-
spread: 20,
|
|
8049
|
-
velocityMin: 40,
|
|
8050
|
-
velocityMax: 140,
|
|
8051
|
-
angleMin: 0,
|
|
8052
|
-
angleMax: PI2 * 2,
|
|
8053
|
-
gravity: 40,
|
|
8054
|
-
tint: { r: 255, g: 140, b: 30 },
|
|
8055
|
-
scaleMin: 0.2,
|
|
8056
|
-
scaleMax: 0.5,
|
|
8057
|
-
lifetimeMin: 400,
|
|
8058
|
-
lifetimeMax: 800,
|
|
8059
|
-
fadeRate: -1.5
|
|
8060
|
-
},
|
|
8061
|
-
{
|
|
8062
|
-
spriteUrls: p(manifest, "spark"),
|
|
8063
|
-
count: 15,
|
|
8064
|
-
originX,
|
|
8065
|
-
originY,
|
|
8066
|
-
spread: 15,
|
|
8067
|
-
velocityMin: 60,
|
|
8068
|
-
velocityMax: 200,
|
|
8069
|
-
angleMin: 0,
|
|
8070
|
-
angleMax: PI2 * 2,
|
|
8071
|
-
gravity: 60,
|
|
8072
|
-
tint: { r: 255, g: 180, b: 60 },
|
|
8073
|
-
scaleMin: 0.06,
|
|
8074
|
-
scaleMax: 0.15,
|
|
8075
|
-
lifetimeMin: 200,
|
|
8076
|
-
lifetimeMax: 500,
|
|
8077
|
-
fadeRate: -2.5
|
|
8078
|
-
}
|
|
8079
|
-
];
|
|
8080
|
-
const sequences = [];
|
|
8081
|
-
const explosionFrames = anim(manifest, "explosion");
|
|
8082
|
-
if (explosionFrames.length > 0) {
|
|
8083
|
-
sequences.push({
|
|
8084
|
-
frameUrls: explosionFrames,
|
|
8085
|
-
originX,
|
|
8086
|
-
originY,
|
|
8087
|
-
frameDuration: 50,
|
|
8088
|
-
scale: 0.6
|
|
8089
|
-
});
|
|
8090
|
-
}
|
|
8091
|
-
return {
|
|
8092
|
-
particles: particles.filter((pc) => pc.spriteUrls.length > 0),
|
|
8093
|
-
sequences,
|
|
8094
|
-
overlays: [],
|
|
8095
|
-
screenShake: 5,
|
|
8096
|
-
screenFlash: { r: 255, g: 160, b: 0, duration: 180 }
|
|
8097
|
-
};
|
|
8098
|
-
}
|
|
8099
|
-
};
|
|
8100
|
-
}
|
|
8101
|
-
var PI2;
|
|
8102
|
-
var init_combatPresets = __esm({
|
|
8103
|
-
"components/game/shared/combatPresets.ts"() {
|
|
8104
|
-
PI2 = Math.PI;
|
|
8105
|
-
}
|
|
8106
|
-
});
|
|
8107
|
-
|
|
8108
|
-
// components/game/shared/canvasEffects.ts
|
|
8109
|
-
function getOffscreenCtx(w, h) {
|
|
8110
|
-
if (!_offscreen) {
|
|
8111
|
-
if (typeof OffscreenCanvas !== "undefined") {
|
|
8112
|
-
_offscreen = new OffscreenCanvas(w, h);
|
|
8113
|
-
} else {
|
|
8114
|
-
_offscreen = document.createElement("canvas");
|
|
8115
|
-
}
|
|
8116
|
-
}
|
|
8117
|
-
if (_offscreen.width < w) _offscreen.width = w;
|
|
8118
|
-
if (_offscreen.height < h) _offscreen.height = h;
|
|
8119
|
-
if (!_offCtx) {
|
|
8120
|
-
_offCtx = _offscreen.getContext("2d");
|
|
8121
|
-
}
|
|
8122
|
-
return _offCtx;
|
|
8123
|
-
}
|
|
8124
|
-
function drawTintedImage(ctx, img, x, y, w, h, tint, alpha, blendMode = "source-over") {
|
|
8125
|
-
if (w <= 0 || h <= 0) return;
|
|
8126
|
-
const oc = getOffscreenCtx(w, h);
|
|
8127
|
-
oc.clearRect(0, 0, w, h);
|
|
8128
|
-
oc.globalCompositeOperation = "source-over";
|
|
8129
|
-
oc.drawImage(img, 0, 0, w, h);
|
|
8130
|
-
oc.globalCompositeOperation = "source-atop";
|
|
8131
|
-
oc.fillStyle = `rgb(${tint.r}, ${tint.g}, ${tint.b})`;
|
|
8132
|
-
oc.fillRect(0, 0, w, h);
|
|
8133
|
-
const prevAlpha = ctx.globalAlpha;
|
|
8134
|
-
const prevBlend = ctx.globalCompositeOperation;
|
|
8135
|
-
ctx.globalAlpha = alpha;
|
|
8136
|
-
ctx.globalCompositeOperation = blendMode;
|
|
8137
|
-
ctx.drawImage(_offscreen, 0, 0, w, h, x, y, w, h);
|
|
8138
|
-
ctx.globalAlpha = prevAlpha;
|
|
8139
|
-
ctx.globalCompositeOperation = prevBlend;
|
|
8140
|
-
}
|
|
8141
|
-
function randRange(min, max) {
|
|
8142
|
-
return min + Math.random() * (max - min);
|
|
8143
|
-
}
|
|
8144
|
-
function spawnParticles(config, animTime) {
|
|
8145
|
-
const particles = [];
|
|
8146
|
-
for (let i = 0; i < config.count; i++) {
|
|
8147
|
-
const angle = randRange(config.angleMin, config.angleMax);
|
|
8148
|
-
const speed = randRange(config.velocityMin, config.velocityMax);
|
|
8149
|
-
const spriteUrl = config.spriteUrls[Math.floor(Math.random() * config.spriteUrls.length)];
|
|
8150
|
-
particles.push({
|
|
8151
|
-
spriteUrl,
|
|
8152
|
-
x: config.originX + randRange(-config.spread, config.spread),
|
|
8153
|
-
y: config.originY + randRange(-config.spread, config.spread),
|
|
8154
|
-
vx: Math.cos(angle) * speed,
|
|
8155
|
-
vy: Math.sin(angle) * speed,
|
|
8156
|
-
gravity: config.gravity,
|
|
8157
|
-
rotation: Math.random() * Math.PI * 2,
|
|
8158
|
-
rotationSpeed: randRange(config.rotationSpeedMin ?? -2, config.rotationSpeedMax ?? 2),
|
|
8159
|
-
scale: randRange(config.scaleMin, config.scaleMax),
|
|
8160
|
-
scaleSpeed: config.scaleSpeed ?? 0,
|
|
8161
|
-
alpha: config.alpha ?? 1,
|
|
8162
|
-
fadeRate: config.fadeRate ?? -1.5,
|
|
8163
|
-
tint: { ...config.tint },
|
|
8164
|
-
blendMode: config.blendMode ?? "source-over",
|
|
8165
|
-
spawnTime: animTime,
|
|
8166
|
-
lifetime: randRange(config.lifetimeMin, config.lifetimeMax)
|
|
8167
|
-
});
|
|
8168
|
-
}
|
|
8169
|
-
return particles;
|
|
8170
|
-
}
|
|
8171
|
-
function spawnSequence(config, animTime) {
|
|
8172
|
-
return {
|
|
8173
|
-
frameUrls: config.frameUrls,
|
|
8174
|
-
x: config.originX,
|
|
8175
|
-
y: config.originY,
|
|
8176
|
-
frameDuration: config.frameDuration,
|
|
8177
|
-
startTime: animTime,
|
|
8178
|
-
loop: config.loop ?? false,
|
|
8179
|
-
scale: config.scale ?? 1,
|
|
8180
|
-
tint: config.tint ?? null,
|
|
8181
|
-
alpha: config.alpha ?? 1,
|
|
8182
|
-
blendMode: config.blendMode ?? "source-over"
|
|
8183
|
-
};
|
|
8184
|
-
}
|
|
8185
|
-
function spawnOverlay(config, animTime) {
|
|
8186
|
-
return {
|
|
8187
|
-
spriteUrl: config.spriteUrl,
|
|
8188
|
-
x: config.originX,
|
|
8189
|
-
y: config.originY,
|
|
8190
|
-
alpha: config.alpha ?? 0.8,
|
|
8191
|
-
fadeRate: config.fadeRate ?? -0.5,
|
|
8192
|
-
pulseAmplitude: config.pulseAmplitude ?? 0,
|
|
8193
|
-
pulseFrequency: config.pulseFrequency ?? 2,
|
|
8194
|
-
scale: config.scale ?? 1,
|
|
8195
|
-
blendMode: config.blendMode ?? "source-over",
|
|
8196
|
-
spawnTime: animTime,
|
|
8197
|
-
lifetime: config.lifetime ?? 2e3
|
|
8198
|
-
};
|
|
8199
|
-
}
|
|
8200
|
-
function updateEffectState(state, animTime, deltaMs) {
|
|
8201
|
-
const dt = deltaMs / 1e3;
|
|
8202
|
-
const particles = state.particles.map((p2) => ({
|
|
8203
|
-
...p2,
|
|
8204
|
-
x: p2.x + p2.vx * dt,
|
|
8205
|
-
y: p2.y + p2.vy * dt,
|
|
8206
|
-
vy: p2.vy + p2.gravity * dt,
|
|
8207
|
-
rotation: p2.rotation + p2.rotationSpeed * dt,
|
|
8208
|
-
scale: Math.max(0, p2.scale + p2.scaleSpeed * dt),
|
|
8209
|
-
alpha: Math.max(0, p2.alpha + p2.fadeRate * dt)
|
|
8210
|
-
})).filter((p2) => p2.alpha > 0.01 && animTime - p2.spawnTime < p2.lifetime);
|
|
8211
|
-
const sequences = state.sequences.filter((s) => {
|
|
8212
|
-
const elapsed = animTime - s.startTime;
|
|
8213
|
-
const totalDuration = s.frameUrls.length * s.frameDuration;
|
|
8214
|
-
return s.loop || elapsed < totalDuration;
|
|
8215
|
-
});
|
|
8216
|
-
const overlays = state.overlays.map((o) => ({
|
|
8217
|
-
...o,
|
|
8218
|
-
alpha: Math.max(0, o.alpha + o.fadeRate * dt)
|
|
8219
|
-
})).filter((o) => o.alpha > 0.01 && animTime - o.spawnTime < o.lifetime);
|
|
8220
|
-
return { particles, sequences, overlays };
|
|
8221
|
-
}
|
|
8222
|
-
function drawEffectState(ctx, state, animTime, getImage) {
|
|
8223
|
-
for (const o of state.overlays) {
|
|
8224
|
-
const img = getImage(o.spriteUrl);
|
|
8225
|
-
if (!img) continue;
|
|
8226
|
-
let alpha = o.alpha;
|
|
8227
|
-
if (o.pulseAmplitude > 0) {
|
|
8228
|
-
const elapsed = (animTime - o.spawnTime) / 1e3;
|
|
8229
|
-
alpha += Math.sin(elapsed * o.pulseFrequency * Math.PI * 2) * o.pulseAmplitude;
|
|
8230
|
-
alpha = Math.max(0, Math.min(1, alpha));
|
|
8231
|
-
}
|
|
8232
|
-
const w = img.naturalWidth * o.scale;
|
|
8233
|
-
const h = img.naturalHeight * o.scale;
|
|
8234
|
-
const prevAlpha = ctx.globalAlpha;
|
|
8235
|
-
const prevBlend = ctx.globalCompositeOperation;
|
|
8236
|
-
ctx.globalAlpha = alpha;
|
|
8237
|
-
ctx.globalCompositeOperation = o.blendMode;
|
|
8238
|
-
ctx.drawImage(img, o.x - w / 2, o.y - h / 2, w, h);
|
|
8239
|
-
ctx.globalAlpha = prevAlpha;
|
|
8240
|
-
ctx.globalCompositeOperation = prevBlend;
|
|
8241
|
-
}
|
|
8242
|
-
for (const s of state.sequences) {
|
|
8243
|
-
const elapsed = animTime - s.startTime;
|
|
8244
|
-
let frameIndex = Math.floor(elapsed / s.frameDuration);
|
|
8245
|
-
if (s.loop) {
|
|
8246
|
-
frameIndex = frameIndex % s.frameUrls.length;
|
|
8247
|
-
} else if (frameIndex >= s.frameUrls.length) {
|
|
8248
|
-
continue;
|
|
8249
|
-
}
|
|
8250
|
-
const img = getImage(s.frameUrls[frameIndex]);
|
|
8251
|
-
if (!img) continue;
|
|
8252
|
-
const w = img.naturalWidth * s.scale;
|
|
8253
|
-
const h = img.naturalHeight * s.scale;
|
|
8254
|
-
if (s.tint) {
|
|
8255
|
-
drawTintedImage(ctx, img, s.x - w / 2, s.y - h / 2, w, h, s.tint, s.alpha, s.blendMode);
|
|
8256
|
-
} else {
|
|
8257
|
-
const prevAlpha = ctx.globalAlpha;
|
|
8258
|
-
const prevBlend = ctx.globalCompositeOperation;
|
|
8259
|
-
ctx.globalAlpha = s.alpha;
|
|
8260
|
-
ctx.globalCompositeOperation = s.blendMode;
|
|
8261
|
-
ctx.drawImage(img, s.x - w / 2, s.y - h / 2, w, h);
|
|
8262
|
-
ctx.globalAlpha = prevAlpha;
|
|
8263
|
-
ctx.globalCompositeOperation = prevBlend;
|
|
8264
|
-
}
|
|
8265
|
-
}
|
|
8266
|
-
for (const p2 of state.particles) {
|
|
8267
|
-
const img = getImage(p2.spriteUrl);
|
|
8268
|
-
if (!img) continue;
|
|
8269
|
-
const w = img.naturalWidth * p2.scale;
|
|
8270
|
-
const h = img.naturalHeight * p2.scale;
|
|
8271
|
-
ctx.save();
|
|
8272
|
-
ctx.translate(p2.x, p2.y);
|
|
8273
|
-
ctx.rotate(p2.rotation);
|
|
8274
|
-
drawTintedImage(ctx, img, -w / 2, -h / 2, w, h, p2.tint, p2.alpha, p2.blendMode);
|
|
8275
|
-
ctx.restore();
|
|
8276
|
-
}
|
|
8277
|
-
}
|
|
8278
|
-
function hasActiveEffects(state) {
|
|
8279
|
-
return state.particles.length > 0 || state.sequences.length > 0 || state.overlays.length > 0;
|
|
8280
|
-
}
|
|
8281
|
-
function getAllEffectSpriteUrls(manifest) {
|
|
8282
|
-
const urls = [];
|
|
8283
|
-
const base = manifest.baseUrl;
|
|
8284
|
-
if (manifest.particles) {
|
|
8285
|
-
for (const value of Object.values(manifest.particles)) {
|
|
8286
|
-
if (Array.isArray(value)) {
|
|
8287
|
-
value.forEach((v) => urls.push(`${base}/${v}`));
|
|
8288
|
-
} else if (typeof value === "string") {
|
|
8289
|
-
urls.push(`${base}/${value}`);
|
|
8290
|
-
}
|
|
8291
|
-
}
|
|
8292
|
-
}
|
|
8293
|
-
if (manifest.animations) {
|
|
8294
|
-
for (const frames of Object.values(manifest.animations)) {
|
|
8295
|
-
if (Array.isArray(frames)) {
|
|
8296
|
-
frames.forEach((f3) => urls.push(`${base}/${f3}`));
|
|
8297
|
-
}
|
|
8298
|
-
}
|
|
8299
|
-
}
|
|
8300
|
-
return urls;
|
|
8301
|
-
}
|
|
8302
|
-
var _offscreen, _offCtx;
|
|
8303
|
-
var init_canvasEffects = __esm({
|
|
8304
|
-
"components/game/shared/canvasEffects.ts"() {
|
|
8305
|
-
_offscreen = null;
|
|
8306
|
-
_offCtx = null;
|
|
8307
|
-
}
|
|
8308
|
-
});
|
|
8309
|
-
|
|
8310
7297
|
// components/game/shared/index.ts
|
|
8311
7298
|
var init_shared = __esm({
|
|
8312
7299
|
"components/game/shared/index.ts"() {
|
|
8313
7300
|
init_effects();
|
|
8314
7301
|
init_boardEntity();
|
|
8315
7302
|
init_makeAsset();
|
|
8316
|
-
init_combatPresets();
|
|
8317
|
-
init_canvasEffects();
|
|
8318
7303
|
}
|
|
8319
7304
|
});
|
|
8320
7305
|
function GameIcon({ assetUrl, icon, size = "md", alt, className }) {
|
|
@@ -10649,13 +9634,13 @@ function useRenderInterpolation(options = {}) {
|
|
|
10649
9634
|
const prevMap = /* @__PURE__ */ new Map();
|
|
10650
9635
|
for (const e of prev.entities) prevMap.set(e.id, e);
|
|
10651
9636
|
for (const c of curr.entities) {
|
|
10652
|
-
const
|
|
10653
|
-
if (!
|
|
9637
|
+
const p = prevMap.get(c.id);
|
|
9638
|
+
if (!p) {
|
|
10654
9639
|
out.set(c.id, { x: c.x, y: c.y });
|
|
10655
9640
|
} else {
|
|
10656
9641
|
out.set(c.id, {
|
|
10657
|
-
x:
|
|
10658
|
-
y:
|
|
9642
|
+
x: p.x + (c.x - p.x) * alpha,
|
|
9643
|
+
y: p.y + (c.y - p.y) * alpha
|
|
10659
9644
|
});
|
|
10660
9645
|
}
|
|
10661
9646
|
}
|
|
@@ -11220,8 +10205,8 @@ function Canvas2D({
|
|
|
11220
10205
|
if (isFree) return 0;
|
|
11221
10206
|
return (gridHeight - 1) * (scaledTileWidth / 2);
|
|
11222
10207
|
}, [isFree, gridHeight, scaledTileWidth]);
|
|
11223
|
-
const validMoveSet = useMemo(() => new Set(validMoves.map((
|
|
11224
|
-
const attackTargetSet = useMemo(() => new Set(attackTargets.map((
|
|
10208
|
+
const validMoveSet = useMemo(() => new Set(validMoves.map((p) => `${p.x},${p.y}`)), [validMoves]);
|
|
10209
|
+
const attackTargetSet = useMemo(() => new Set(attackTargets.map((p) => `${p.x},${p.y}`)), [attackTargets]);
|
|
11225
10210
|
const spriteUrls = useMemo(() => {
|
|
11226
10211
|
const urls = [];
|
|
11227
10212
|
for (const tile of sortedTiles) {
|
|
@@ -11938,264 +10923,6 @@ var init_Canvas2D = __esm({
|
|
|
11938
10923
|
Canvas2D.displayName = "Canvas2D";
|
|
11939
10924
|
}
|
|
11940
10925
|
});
|
|
11941
|
-
function CanvasEffectEngine({
|
|
11942
|
-
actionType,
|
|
11943
|
-
x,
|
|
11944
|
-
y,
|
|
11945
|
-
duration = 2e3,
|
|
11946
|
-
intensity = 1,
|
|
11947
|
-
onComplete,
|
|
11948
|
-
className,
|
|
11949
|
-
assetManifest,
|
|
11950
|
-
width = 400,
|
|
11951
|
-
height = 300
|
|
11952
|
-
}) {
|
|
11953
|
-
const canvasRef = useRef(null);
|
|
11954
|
-
const stateRef = useRef({ ...EMPTY_EFFECT_STATE });
|
|
11955
|
-
const lastTimeRef = useRef(0);
|
|
11956
|
-
const rafRef = useRef(0);
|
|
11957
|
-
const imageCacheRef = useRef(/* @__PURE__ */ new Map());
|
|
11958
|
-
const [shakeOffset, setShakeOffset] = useState({ x: 0, y: 0 });
|
|
11959
|
-
const [flash, setFlash] = useState(null);
|
|
11960
|
-
const shakeRef = useRef({ x: 0, y: 0, intensity: 0 });
|
|
11961
|
-
const presets = useMemo(() => createCombatPresets(assetManifest), [assetManifest]);
|
|
11962
|
-
const spriteUrls = useMemo(() => getAllEffectSpriteUrls(assetManifest), [assetManifest]);
|
|
11963
|
-
useEffect(() => {
|
|
11964
|
-
const cache = imageCacheRef.current;
|
|
11965
|
-
for (const url of spriteUrls) {
|
|
11966
|
-
if (!cache.has(url)) {
|
|
11967
|
-
const img = new Image();
|
|
11968
|
-
img.crossOrigin = "anonymous";
|
|
11969
|
-
img.src = url;
|
|
11970
|
-
cache.set(url, img);
|
|
11971
|
-
}
|
|
11972
|
-
}
|
|
11973
|
-
}, [spriteUrls]);
|
|
11974
|
-
const getImage = useCallback((url) => {
|
|
11975
|
-
const img = imageCacheRef.current.get(url);
|
|
11976
|
-
return img?.complete ? img : void 0;
|
|
11977
|
-
}, []);
|
|
11978
|
-
useEffect(() => {
|
|
11979
|
-
const now = performance.now();
|
|
11980
|
-
const effectX = x || width / 2;
|
|
11981
|
-
const effectY = y || height / 2;
|
|
11982
|
-
const preset = presets[actionType](effectX, effectY);
|
|
11983
|
-
const state = stateRef.current;
|
|
11984
|
-
for (const emitter of preset.particles) {
|
|
11985
|
-
const scaledEmitter = { ...emitter, count: Math.round(emitter.count * intensity) };
|
|
11986
|
-
state.particles.push(...spawnParticles(scaledEmitter, now));
|
|
11987
|
-
}
|
|
11988
|
-
for (const seqConfig of preset.sequences) {
|
|
11989
|
-
state.sequences.push(spawnSequence(seqConfig, now));
|
|
11990
|
-
}
|
|
11991
|
-
for (const ovConfig of preset.overlays) {
|
|
11992
|
-
state.overlays.push(spawnOverlay(ovConfig, now));
|
|
11993
|
-
}
|
|
11994
|
-
if (preset.screenShake > 0) {
|
|
11995
|
-
shakeRef.current.intensity = preset.screenShake * intensity;
|
|
11996
|
-
}
|
|
11997
|
-
if (preset.screenFlash) {
|
|
11998
|
-
const { r, g, b, duration: flashDur } = preset.screenFlash;
|
|
11999
|
-
setFlash({ color: `rgb(${r}, ${g}, ${b})`, alpha: 0.3 });
|
|
12000
|
-
setTimeout(() => setFlash(null), flashDur);
|
|
12001
|
-
}
|
|
12002
|
-
const timer = setTimeout(() => {
|
|
12003
|
-
onComplete?.();
|
|
12004
|
-
}, duration);
|
|
12005
|
-
return () => clearTimeout(timer);
|
|
12006
|
-
}, []);
|
|
12007
|
-
useEffect(() => {
|
|
12008
|
-
const canvas = canvasRef.current;
|
|
12009
|
-
if (!canvas) return;
|
|
12010
|
-
const ctx = canvas.getContext("2d");
|
|
12011
|
-
if (!ctx) return;
|
|
12012
|
-
function loop(animTime) {
|
|
12013
|
-
const delta = lastTimeRef.current > 0 ? animTime - lastTimeRef.current : 16;
|
|
12014
|
-
lastTimeRef.current = animTime;
|
|
12015
|
-
stateRef.current = updateEffectState(stateRef.current, animTime, delta);
|
|
12016
|
-
if (shakeRef.current.intensity > 0.2) {
|
|
12017
|
-
const i = shakeRef.current.intensity;
|
|
12018
|
-
shakeRef.current.x = (Math.random() - 0.5) * i * 2;
|
|
12019
|
-
shakeRef.current.y = (Math.random() - 0.5) * i * 2;
|
|
12020
|
-
shakeRef.current.intensity *= 0.85;
|
|
12021
|
-
setShakeOffset({ x: shakeRef.current.x, y: shakeRef.current.y });
|
|
12022
|
-
} else if (shakeRef.current.intensity > 0) {
|
|
12023
|
-
shakeRef.current = { x: 0, y: 0, intensity: 0 };
|
|
12024
|
-
setShakeOffset({ x: 0, y: 0 });
|
|
12025
|
-
}
|
|
12026
|
-
ctx.clearRect(0, 0, width, height);
|
|
12027
|
-
drawEffectState(ctx, stateRef.current, animTime, getImage);
|
|
12028
|
-
if (hasActiveEffects(stateRef.current)) {
|
|
12029
|
-
rafRef.current = requestAnimationFrame(loop);
|
|
12030
|
-
}
|
|
12031
|
-
}
|
|
12032
|
-
rafRef.current = requestAnimationFrame(loop);
|
|
12033
|
-
return () => cancelAnimationFrame(rafRef.current);
|
|
12034
|
-
}, [width, height, getImage]);
|
|
12035
|
-
const shakeStyle = shakeOffset.x !== 0 || shakeOffset.y !== 0 ? { transform: `translate(${shakeOffset.x}px, ${shakeOffset.y}px)` } : {};
|
|
12036
|
-
return /* @__PURE__ */ jsxs(
|
|
12037
|
-
Box,
|
|
12038
|
-
{
|
|
12039
|
-
className: cn("absolute inset-0 pointer-events-none z-10", className),
|
|
12040
|
-
style: shakeStyle,
|
|
12041
|
-
children: [
|
|
12042
|
-
flash && /* @__PURE__ */ jsx(
|
|
12043
|
-
Box,
|
|
12044
|
-
{
|
|
12045
|
-
className: "absolute inset-0 z-20 pointer-events-none rounded-container",
|
|
12046
|
-
style: { backgroundColor: flash.color, opacity: flash.alpha }
|
|
12047
|
-
}
|
|
12048
|
-
),
|
|
12049
|
-
/* @__PURE__ */ jsx(
|
|
12050
|
-
"canvas",
|
|
12051
|
-
{
|
|
12052
|
-
ref: canvasRef,
|
|
12053
|
-
width,
|
|
12054
|
-
height,
|
|
12055
|
-
className: "absolute inset-0 w-full h-full",
|
|
12056
|
-
style: { imageRendering: "pixelated" }
|
|
12057
|
-
}
|
|
12058
|
-
)
|
|
12059
|
-
]
|
|
12060
|
-
}
|
|
12061
|
-
);
|
|
12062
|
-
}
|
|
12063
|
-
function EmojiEffect({
|
|
12064
|
-
actionType,
|
|
12065
|
-
x,
|
|
12066
|
-
y,
|
|
12067
|
-
duration = 800,
|
|
12068
|
-
intensity = 1,
|
|
12069
|
-
onComplete,
|
|
12070
|
-
className,
|
|
12071
|
-
effectSpriteUrl,
|
|
12072
|
-
assetBaseUrl
|
|
12073
|
-
}) {
|
|
12074
|
-
const [visible, setVisible] = useState(true);
|
|
12075
|
-
const [phase, setPhase] = useState("enter");
|
|
12076
|
-
useEffect(() => {
|
|
12077
|
-
const enterTimer = setTimeout(() => setPhase("active"), 100);
|
|
12078
|
-
const exitTimer = setTimeout(() => setPhase("exit"), duration * 0.7);
|
|
12079
|
-
const doneTimer = setTimeout(() => {
|
|
12080
|
-
setVisible(false);
|
|
12081
|
-
onComplete?.();
|
|
12082
|
-
}, duration);
|
|
12083
|
-
return () => {
|
|
12084
|
-
clearTimeout(enterTimer);
|
|
12085
|
-
clearTimeout(exitTimer);
|
|
12086
|
-
clearTimeout(doneTimer);
|
|
12087
|
-
};
|
|
12088
|
-
}, [duration, onComplete]);
|
|
12089
|
-
if (!visible) return null;
|
|
12090
|
-
const config = ACTION_EMOJI[actionType] ?? ACTION_EMOJI.melee;
|
|
12091
|
-
const scaleVal = phase === "enter" ? 0.3 : phase === "active" ? intensity : 0.5;
|
|
12092
|
-
const opacity = phase === "exit" ? 0 : 1;
|
|
12093
|
-
const resolvedSpriteUrl = effectSpriteUrl ? effectSpriteUrl.startsWith("http") || effectSpriteUrl.startsWith("/") ? effectSpriteUrl : assetBaseUrl ? `${assetBaseUrl.replace(/\/$/, "")}/${effectSpriteUrl}` : effectSpriteUrl : void 0;
|
|
12094
|
-
return /* @__PURE__ */ jsxs(
|
|
12095
|
-
Box,
|
|
12096
|
-
{
|
|
12097
|
-
className: cn(
|
|
12098
|
-
"fixed pointer-events-none z-50 flex items-center justify-center",
|
|
12099
|
-
"transition-all ease-out",
|
|
12100
|
-
className
|
|
12101
|
-
),
|
|
12102
|
-
style: {
|
|
12103
|
-
left: x,
|
|
12104
|
-
top: y,
|
|
12105
|
-
transform: `translate(-50%, -50%) scale(${scaleVal})`,
|
|
12106
|
-
opacity,
|
|
12107
|
-
transitionDuration: phase === "enter" ? "100ms" : "300ms"
|
|
12108
|
-
},
|
|
12109
|
-
children: [
|
|
12110
|
-
/* @__PURE__ */ jsx(
|
|
12111
|
-
Box,
|
|
12112
|
-
{
|
|
12113
|
-
className: "absolute rounded-pill animate-ping",
|
|
12114
|
-
style: {
|
|
12115
|
-
width: 48 * intensity,
|
|
12116
|
-
height: 48 * intensity,
|
|
12117
|
-
backgroundColor: config.color,
|
|
12118
|
-
opacity: 0.25
|
|
12119
|
-
}
|
|
12120
|
-
}
|
|
12121
|
-
),
|
|
12122
|
-
resolvedSpriteUrl ? /* @__PURE__ */ jsx(
|
|
12123
|
-
"img",
|
|
12124
|
-
{
|
|
12125
|
-
src: resolvedSpriteUrl,
|
|
12126
|
-
alt: config.label,
|
|
12127
|
-
className: "relative drop-shadow-lg",
|
|
12128
|
-
style: {
|
|
12129
|
-
width: `${3 * intensity}rem`,
|
|
12130
|
-
height: `${3 * intensity}rem`,
|
|
12131
|
-
objectFit: "contain",
|
|
12132
|
-
imageRendering: "pixelated"
|
|
12133
|
-
}
|
|
12134
|
-
}
|
|
12135
|
-
) : /* @__PURE__ */ jsx(
|
|
12136
|
-
"span",
|
|
12137
|
-
{
|
|
12138
|
-
className: "relative text-3xl drop-shadow-lg",
|
|
12139
|
-
style: { fontSize: `${2 * intensity}rem` },
|
|
12140
|
-
role: "img",
|
|
12141
|
-
"aria-label": config.label,
|
|
12142
|
-
children: config.emoji
|
|
12143
|
-
}
|
|
12144
|
-
)
|
|
12145
|
-
]
|
|
12146
|
-
}
|
|
12147
|
-
);
|
|
12148
|
-
}
|
|
12149
|
-
function CanvasEffect({
|
|
12150
|
-
effectSpriteUrl,
|
|
12151
|
-
assetBaseUrl,
|
|
12152
|
-
...props
|
|
12153
|
-
}) {
|
|
12154
|
-
const eventBus = useEventBus();
|
|
12155
|
-
const mergedProps = { effectSpriteUrl, assetBaseUrl, ...props };
|
|
12156
|
-
const { completeEvent, onComplete, ...rest } = mergedProps;
|
|
12157
|
-
const handleComplete = useCallback(() => {
|
|
12158
|
-
if (completeEvent) eventBus.emit(`UI:${completeEvent}`, {});
|
|
12159
|
-
onComplete?.();
|
|
12160
|
-
}, [completeEvent, eventBus, onComplete]);
|
|
12161
|
-
const enhancedProps = { ...rest, onComplete: handleComplete };
|
|
12162
|
-
if (rest.assetManifest) {
|
|
12163
|
-
return /* @__PURE__ */ jsx(CanvasEffectEngine, { ...enhancedProps, assetManifest: rest.assetManifest });
|
|
12164
|
-
}
|
|
12165
|
-
return /* @__PURE__ */ jsx(EmojiEffect, { ...enhancedProps });
|
|
12166
|
-
}
|
|
12167
|
-
var ACTION_EMOJI;
|
|
12168
|
-
var init_CanvasEffect = __esm({
|
|
12169
|
-
"components/game/2d/organisms/CanvasEffect.tsx"() {
|
|
12170
|
-
"use client";
|
|
12171
|
-
init_cn();
|
|
12172
|
-
init_useEventBus();
|
|
12173
|
-
init_Box();
|
|
12174
|
-
init_effects();
|
|
12175
|
-
init_canvasEffects();
|
|
12176
|
-
init_combatPresets();
|
|
12177
|
-
ACTION_EMOJI = {
|
|
12178
|
-
melee: { emoji: "\u2694\uFE0F", color: "var(--color-error)", label: "Slash" },
|
|
12179
|
-
ranged: { emoji: "\u{1F3F9}", color: "var(--color-warning)", label: "Arrow" },
|
|
12180
|
-
magic: { emoji: "\u2728", color: "var(--color-primary)", label: "Spell" },
|
|
12181
|
-
heal: { emoji: "\u{1F49A}", color: "var(--color-success)", label: "Heal" },
|
|
12182
|
-
buff: { emoji: "\u2B06\uFE0F", color: "var(--color-info)", label: "Buff" },
|
|
12183
|
-
debuff: { emoji: "\u2B07\uFE0F", color: "var(--color-warning)", label: "Debuff" },
|
|
12184
|
-
shield: { emoji: "\u{1F6E1}\uFE0F", color: "var(--color-info)", label: "Shield" },
|
|
12185
|
-
aoe: { emoji: "\u{1F4A5}", color: "var(--color-error)", label: "Explosion" },
|
|
12186
|
-
critical: { emoji: "\u{1F525}", color: "var(--color-error)", label: "Critical" },
|
|
12187
|
-
defend: { emoji: "\u{1F6E1}\uFE0F", color: "var(--color-info)", label: "Defend" },
|
|
12188
|
-
hit: { emoji: "\u{1F4A5}", color: "var(--color-error)", label: "Hit" },
|
|
12189
|
-
death: { emoji: "\u{1F480}", color: "var(--color-error)", label: "Death" }
|
|
12190
|
-
};
|
|
12191
|
-
CanvasEffect.displayName = "CanvasEffect";
|
|
12192
|
-
}
|
|
12193
|
-
});
|
|
12194
|
-
var init_useCanvasEffects = __esm({
|
|
12195
|
-
"components/game/shared/hooks/useCanvasEffects.ts"() {
|
|
12196
|
-
"use client";
|
|
12197
|
-
}
|
|
12198
|
-
});
|
|
12199
10926
|
var init_useGameAudio = __esm({
|
|
12200
10927
|
"components/game/shared/hooks/useGameAudio.ts"() {
|
|
12201
10928
|
"use client";
|
|
@@ -14815,7 +13542,7 @@ function NegotiatorBoard({
|
|
|
14815
13542
|
useEffect(() => {
|
|
14816
13543
|
if (currentRound > prevRoundRef.current && lastPlayerAction) {
|
|
14817
13544
|
const opponentPayoffEntry = payoffMatrix.find(
|
|
14818
|
-
(
|
|
13545
|
+
(p) => p.playerAction === lastPlayerAction && p.opponentAction === lastOpponentAction
|
|
14819
13546
|
);
|
|
14820
13547
|
setHistory((prev) => [
|
|
14821
13548
|
...prev,
|
|
@@ -15101,14 +13828,14 @@ function SimulationCanvas({
|
|
|
15101
13828
|
const ctx = canvas.getContext("2d");
|
|
15102
13829
|
if (!ctx) return;
|
|
15103
13830
|
const bodies = bodiesRef.current;
|
|
15104
|
-
const
|
|
13831
|
+
const p = presetRef.current;
|
|
15105
13832
|
const w = widthRef.current;
|
|
15106
13833
|
const h = heightRef.current;
|
|
15107
13834
|
ctx.clearRect(0, 0, w, h);
|
|
15108
|
-
ctx.fillStyle =
|
|
13835
|
+
ctx.fillStyle = p.backgroundColor ?? "#1a1a2e";
|
|
15109
13836
|
ctx.fillRect(0, 0, w, h);
|
|
15110
|
-
if (
|
|
15111
|
-
for (const c of
|
|
13837
|
+
if (p.constraints) {
|
|
13838
|
+
for (const c of p.constraints) {
|
|
15112
13839
|
const a = bodies[c.bodyA];
|
|
15113
13840
|
const b = bodies[c.bodyB];
|
|
15114
13841
|
if (a && b) {
|
|
@@ -15131,7 +13858,7 @@ function SimulationCanvas({
|
|
|
15131
13858
|
ctx.arc(pos.x, pos.y, body.radius, 0, Math.PI * 2);
|
|
15132
13859
|
ctx.fillStyle = body.color ?? "#e94560";
|
|
15133
13860
|
ctx.fill();
|
|
15134
|
-
if (
|
|
13861
|
+
if (p.showVelocity) {
|
|
15135
13862
|
ctx.beginPath();
|
|
15136
13863
|
ctx.moveTo(pos.x, pos.y);
|
|
15137
13864
|
ctx.lineTo(pos.x + body.vx * 0.1, pos.y + body.vy * 0.1);
|
|
@@ -15390,7 +14117,6 @@ var init_GameShell = __esm({
|
|
|
15390
14117
|
var init_molecules = __esm({
|
|
15391
14118
|
"components/game/2d/molecules/index.ts"() {
|
|
15392
14119
|
init_shared();
|
|
15393
|
-
init_useCanvasEffects();
|
|
15394
14120
|
init_puzzleObject();
|
|
15395
14121
|
}
|
|
15396
14122
|
});
|
|
@@ -15431,8 +14157,8 @@ function shapeBounds(shape) {
|
|
|
15431
14157
|
case "polygon":
|
|
15432
14158
|
if (!shape.points || shape.points.length === 0) return null;
|
|
15433
14159
|
{
|
|
15434
|
-
const xs = shape.points.map((
|
|
15435
|
-
const ys = shape.points.map((
|
|
14160
|
+
const xs = shape.points.map((p) => p.x);
|
|
14161
|
+
const ys = shape.points.map((p) => p.y);
|
|
15436
14162
|
const minX = Math.min(...xs);
|
|
15437
14163
|
const minY = Math.min(...ys);
|
|
15438
14164
|
return {
|
|
@@ -15558,13 +14284,13 @@ function drawShape(ctx, shape, width, height) {
|
|
|
15558
14284
|
}
|
|
15559
14285
|
case "path": {
|
|
15560
14286
|
if (!shape.path) break;
|
|
15561
|
-
const
|
|
14287
|
+
const p = new Path2D(shape.path);
|
|
15562
14288
|
if (fill) {
|
|
15563
14289
|
ctx.fillStyle = fill;
|
|
15564
|
-
ctx.fill(
|
|
14290
|
+
ctx.fill(p);
|
|
15565
14291
|
}
|
|
15566
14292
|
ctx.strokeStyle = stroke;
|
|
15567
|
-
ctx.stroke(
|
|
14293
|
+
ctx.stroke(p);
|
|
15568
14294
|
break;
|
|
15569
14295
|
}
|
|
15570
14296
|
case "text": {
|
|
@@ -21457,7 +20183,7 @@ function renderStateMachineToDomData(stateMachine, options = {}, config = DEFAUL
|
|
|
21457
20183
|
}
|
|
21458
20184
|
let domOutputs;
|
|
21459
20185
|
if (outputs.length > 0) {
|
|
21460
|
-
const maxX = Math.max(...Object.values(positions).map((
|
|
20186
|
+
const maxX = Math.max(...Object.values(positions).map((p) => p.x));
|
|
21461
20187
|
const maxOutputLength = Math.max(...outputs.map((o) => o.length));
|
|
21462
20188
|
const boxWidth = Math.max(200, maxOutputLength * 7 + 30);
|
|
21463
20189
|
const lineHeight = 22;
|
|
@@ -22439,7 +21165,7 @@ var init_BookViewer = __esm({
|
|
|
22439
21165
|
}
|
|
22440
21166
|
});
|
|
22441
21167
|
function BoxPattern({
|
|
22442
|
-
p
|
|
21168
|
+
p,
|
|
22443
21169
|
m,
|
|
22444
21170
|
bg = "transparent",
|
|
22445
21171
|
border = false,
|
|
@@ -22452,7 +21178,7 @@ function BoxPattern({
|
|
|
22452
21178
|
return /* @__PURE__ */ jsx(
|
|
22453
21179
|
Box,
|
|
22454
21180
|
{
|
|
22455
|
-
padding:
|
|
21181
|
+
padding: p,
|
|
22456
21182
|
margin: m,
|
|
22457
21183
|
bg,
|
|
22458
21184
|
border,
|
|
@@ -24221,10 +22947,10 @@ var init_Chart = __esm({
|
|
|
24221
22947
|
const set = [];
|
|
24222
22948
|
const seen = /* @__PURE__ */ new Set();
|
|
24223
22949
|
for (const s of series) {
|
|
24224
|
-
for (const
|
|
24225
|
-
if (!seen.has(
|
|
24226
|
-
seen.add(
|
|
24227
|
-
set.push(
|
|
22950
|
+
for (const p of s.data) {
|
|
22951
|
+
if (!seen.has(p.label)) {
|
|
22952
|
+
seen.add(p.label);
|
|
22953
|
+
set.push(p.label);
|
|
24228
22954
|
}
|
|
24229
22955
|
}
|
|
24230
22956
|
}
|
|
@@ -24232,8 +22958,8 @@ var init_Chart = __esm({
|
|
|
24232
22958
|
}, [series]);
|
|
24233
22959
|
const valueAt = useCallback(
|
|
24234
22960
|
(s, label) => {
|
|
24235
|
-
const
|
|
24236
|
-
return
|
|
22961
|
+
const p = s.data.find((d) => d.label === label);
|
|
22962
|
+
return p ? p.value : 0;
|
|
24237
22963
|
},
|
|
24238
22964
|
[]
|
|
24239
22965
|
);
|
|
@@ -24250,7 +22976,7 @@ var init_Chart = __esm({
|
|
|
24250
22976
|
}
|
|
24251
22977
|
let m = 1;
|
|
24252
22978
|
for (const s of series) {
|
|
24253
|
-
for (const
|
|
22979
|
+
for (const p of s.data) if (p.value > m) m = p.value;
|
|
24254
22980
|
}
|
|
24255
22981
|
return m;
|
|
24256
22982
|
}, [series, stack, columnTotals]);
|
|
@@ -24510,10 +23236,10 @@ var init_Chart = __esm({
|
|
|
24510
23236
|
const seen = /* @__PURE__ */ new Set();
|
|
24511
23237
|
const out = [];
|
|
24512
23238
|
for (const s of series) {
|
|
24513
|
-
for (const
|
|
24514
|
-
if (!seen.has(
|
|
24515
|
-
seen.add(
|
|
24516
|
-
out.push(
|
|
23239
|
+
for (const p of s.data) {
|
|
23240
|
+
if (!seen.has(p.label)) {
|
|
23241
|
+
seen.add(p.label);
|
|
23242
|
+
out.push(p.label);
|
|
24517
23243
|
}
|
|
24518
23244
|
}
|
|
24519
23245
|
}
|
|
@@ -24522,7 +23248,7 @@ var init_Chart = __esm({
|
|
|
24522
23248
|
const maxValue = useMemo(() => {
|
|
24523
23249
|
let m = 1;
|
|
24524
23250
|
for (const s of series) {
|
|
24525
|
-
for (const
|
|
23251
|
+
for (const p of s.data) if (p.value > m) m = p.value;
|
|
24526
23252
|
}
|
|
24527
23253
|
return m;
|
|
24528
23254
|
}, [series]);
|
|
@@ -24569,7 +23295,7 @@ var init_Chart = __esm({
|
|
|
24569
23295
|
label
|
|
24570
23296
|
};
|
|
24571
23297
|
});
|
|
24572
|
-
const linePath = points.map((
|
|
23298
|
+
const linePath = points.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ");
|
|
24573
23299
|
const areaPath = `${linePath} L ${points[points.length - 1]?.x ?? 0} ${padding.top + chartHeight} L ${padding.left} ${padding.top + chartHeight} Z`;
|
|
24574
23300
|
return /* @__PURE__ */ jsxs("g", { children: [
|
|
24575
23301
|
fill && /* @__PURE__ */ jsx(
|
|
@@ -24592,19 +23318,19 @@ var init_Chart = __esm({
|
|
|
24592
23318
|
strokeDasharray: s.dashed ? "6 4" : void 0
|
|
24593
23319
|
}
|
|
24594
23320
|
),
|
|
24595
|
-
points.map((
|
|
23321
|
+
points.map((p, idx) => /* @__PURE__ */ jsxs("g", { children: [
|
|
24596
23322
|
/* @__PURE__ */ jsx(
|
|
24597
23323
|
"circle",
|
|
24598
23324
|
{
|
|
24599
|
-
cx:
|
|
24600
|
-
cy:
|
|
23325
|
+
cx: p.x,
|
|
23326
|
+
cy: p.y,
|
|
24601
23327
|
r: "4",
|
|
24602
23328
|
fill: "var(--color-card)",
|
|
24603
23329
|
stroke: color,
|
|
24604
23330
|
strokeWidth: "2",
|
|
24605
23331
|
className: "cursor-pointer",
|
|
24606
23332
|
onClick: () => onPointClick?.(
|
|
24607
|
-
{ label:
|
|
23333
|
+
{ label: p.label, value: p.value, color },
|
|
24608
23334
|
s.name
|
|
24609
23335
|
)
|
|
24610
23336
|
}
|
|
@@ -24612,13 +23338,13 @@ var init_Chart = __esm({
|
|
|
24612
23338
|
showValues && series.length === 1 && /* @__PURE__ */ jsx(
|
|
24613
23339
|
"text",
|
|
24614
23340
|
{
|
|
24615
|
-
x:
|
|
24616
|
-
y:
|
|
23341
|
+
x: p.x,
|
|
23342
|
+
y: p.y - 10,
|
|
24617
23343
|
textAnchor: "middle",
|
|
24618
23344
|
fill: "var(--color-foreground)",
|
|
24619
23345
|
fontSize: "10",
|
|
24620
23346
|
fontWeight: "500",
|
|
24621
|
-
children:
|
|
23347
|
+
children: p.value
|
|
24622
23348
|
}
|
|
24623
23349
|
)
|
|
24624
23350
|
] }, idx))
|
|
@@ -24653,11 +23379,11 @@ var init_Chart = __esm({
|
|
|
24653
23379
|
let mxX = data[0].x;
|
|
24654
23380
|
let mnY = data[0].y;
|
|
24655
23381
|
let mxY = data[0].y;
|
|
24656
|
-
for (const
|
|
24657
|
-
if (
|
|
24658
|
-
if (
|
|
24659
|
-
if (
|
|
24660
|
-
if (
|
|
23382
|
+
for (const p of data) {
|
|
23383
|
+
if (p.x < mnX) mnX = p.x;
|
|
23384
|
+
if (p.x > mxX) mxX = p.x;
|
|
23385
|
+
if (p.y < mnY) mnY = p.y;
|
|
23386
|
+
if (p.y > mxY) mxY = p.y;
|
|
24661
23387
|
}
|
|
24662
23388
|
return { minX: mnX, maxX: mxX, minY: mnY, maxY: mxY };
|
|
24663
23389
|
}, [data]);
|
|
@@ -24687,11 +23413,11 @@ var init_Chart = __esm({
|
|
|
24687
23413
|
frac
|
|
24688
23414
|
);
|
|
24689
23415
|
}),
|
|
24690
|
-
data.map((
|
|
24691
|
-
const cx = padding.left + (
|
|
24692
|
-
const cy = padding.top + chartHeight - (
|
|
24693
|
-
const r =
|
|
24694
|
-
const color =
|
|
23416
|
+
data.map((p, idx) => {
|
|
23417
|
+
const cx = padding.left + (p.x - minX) / rangeX * chartWidth;
|
|
23418
|
+
const cy = padding.top + chartHeight - (p.y - minY) / rangeY * chartHeight;
|
|
23419
|
+
const r = p.size ?? 5;
|
|
23420
|
+
const color = p.color ?? CHART_COLORS[idx % CHART_COLORS.length];
|
|
24695
23421
|
return /* @__PURE__ */ jsx(
|
|
24696
23422
|
"circle",
|
|
24697
23423
|
{
|
|
@@ -24703,13 +23429,13 @@ var init_Chart = __esm({
|
|
|
24703
23429
|
className: "cursor-pointer hover:opacity-100",
|
|
24704
23430
|
onClick: () => onPointClick?.(
|
|
24705
23431
|
{
|
|
24706
|
-
label:
|
|
24707
|
-
value:
|
|
23432
|
+
label: p.label ?? `(${p.x}, ${p.y})`,
|
|
23433
|
+
value: p.y,
|
|
24708
23434
|
color
|
|
24709
23435
|
},
|
|
24710
23436
|
"default"
|
|
24711
23437
|
),
|
|
24712
|
-
children: /* @__PURE__ */ jsx("title", { children:
|
|
23438
|
+
children: /* @__PURE__ */ jsx("title", { children: p.label ?? `(${p.x}, ${p.y})` })
|
|
24713
23439
|
},
|
|
24714
23440
|
idx
|
|
24715
23441
|
);
|
|
@@ -30867,7 +29593,7 @@ var init_LineChart = __esm({
|
|
|
30867
29593
|
}, [sortedData, width, height]);
|
|
30868
29594
|
const linePath = useMemo(() => {
|
|
30869
29595
|
if (points.length === 0) return "";
|
|
30870
|
-
return points.map((
|
|
29596
|
+
return points.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ");
|
|
30871
29597
|
}, [points]);
|
|
30872
29598
|
const areaPath = useMemo(() => {
|
|
30873
29599
|
if (points.length === 0 || !showArea) return "";
|
|
@@ -31067,18 +29793,18 @@ var init_MathCanvas = __esm({
|
|
|
31067
29793
|
});
|
|
31068
29794
|
}
|
|
31069
29795
|
}
|
|
31070
|
-
for (const
|
|
31071
|
-
if (
|
|
29796
|
+
for (const p of points) {
|
|
29797
|
+
if (p.x < xMin || p.x > xMax || p.y < yMin || p.y > yMax) continue;
|
|
31072
29798
|
out.push({
|
|
31073
29799
|
type: "circle",
|
|
31074
|
-
x: mapX(
|
|
31075
|
-
y: mapY(
|
|
31076
|
-
radius:
|
|
31077
|
-
color:
|
|
31078
|
-
fill:
|
|
29800
|
+
x: mapX(p.x),
|
|
29801
|
+
y: mapY(p.y),
|
|
29802
|
+
radius: p.radius ?? 4,
|
|
29803
|
+
color: p.color ?? "#dc2626",
|
|
29804
|
+
fill: p.color ?? "#dc2626"
|
|
31079
29805
|
});
|
|
31080
|
-
if (
|
|
31081
|
-
out.push({ type: "text", x: mapX(
|
|
29806
|
+
if (p.label) {
|
|
29807
|
+
out.push({ type: "text", x: mapX(p.x) + 8, y: mapY(p.y) - 8, text: p.label, color: "#111827", fontSize: 12 });
|
|
31082
29808
|
}
|
|
31083
29809
|
}
|
|
31084
29810
|
for (const v of vectors) {
|
|
@@ -31597,13 +30323,13 @@ var init_MapView = __esm({
|
|
|
31597
30323
|
shadowSize: [41, 41]
|
|
31598
30324
|
});
|
|
31599
30325
|
L.Marker.prototype.options.icon = defaultIcon;
|
|
31600
|
-
const { useEffect:
|
|
30326
|
+
const { useEffect: useEffect68, useRef: useRef65, useCallback: useCallback104, useState: useState98 } = React97__default;
|
|
31601
30327
|
const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
|
|
31602
30328
|
const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
|
|
31603
30329
|
function MapUpdater({ centerLat, centerLng, zoom }) {
|
|
31604
30330
|
const map = useMap();
|
|
31605
|
-
const prevRef =
|
|
31606
|
-
|
|
30331
|
+
const prevRef = useRef65({ centerLat, centerLng, zoom });
|
|
30332
|
+
useEffect68(() => {
|
|
31607
30333
|
const prev = prevRef.current;
|
|
31608
30334
|
if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
|
|
31609
30335
|
map.setView([centerLat, centerLng], zoom);
|
|
@@ -31614,7 +30340,7 @@ var init_MapView = __esm({
|
|
|
31614
30340
|
}
|
|
31615
30341
|
function MapClickHandler({ onMapClick }) {
|
|
31616
30342
|
const map = useMap();
|
|
31617
|
-
|
|
30343
|
+
useEffect68(() => {
|
|
31618
30344
|
if (!onMapClick) return;
|
|
31619
30345
|
const handler = (e) => {
|
|
31620
30346
|
onMapClick(e.latlng.lat, e.latlng.lng);
|
|
@@ -31642,8 +30368,8 @@ var init_MapView = __esm({
|
|
|
31642
30368
|
showAttribution = true
|
|
31643
30369
|
}) {
|
|
31644
30370
|
const eventBus = useEventBus2();
|
|
31645
|
-
const [clickedPosition, setClickedPosition] =
|
|
31646
|
-
const handleMapClick =
|
|
30371
|
+
const [clickedPosition, setClickedPosition] = useState98(null);
|
|
30372
|
+
const handleMapClick = useCallback104((lat, lng) => {
|
|
31647
30373
|
if (showClickedPin) {
|
|
31648
30374
|
setClickedPosition({ lat, lng });
|
|
31649
30375
|
}
|
|
@@ -31652,7 +30378,7 @@ var init_MapView = __esm({
|
|
|
31652
30378
|
eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
|
|
31653
30379
|
}
|
|
31654
30380
|
}, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
|
|
31655
|
-
const handleMarkerClick =
|
|
30381
|
+
const handleMarkerClick = useCallback104((marker) => {
|
|
31656
30382
|
onMarkerClick?.(marker);
|
|
31657
30383
|
if (markerClickEvent) {
|
|
31658
30384
|
eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
|
|
@@ -32725,7 +31451,7 @@ function TableView({
|
|
|
32725
31451
|
children: [
|
|
32726
31452
|
header,
|
|
32727
31453
|
dnd.wrapContainer(body),
|
|
32728
|
-
hasMore && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: () => setVisibleCount((
|
|
31454
|
+
hasMore && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: () => setVisibleCount((p) => p + (pageSize || 5)), children: [
|
|
32729
31455
|
/* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
|
|
32730
31456
|
t("common.showMore"),
|
|
32731
31457
|
" (",
|
|
@@ -35447,7 +34173,7 @@ var init_QrScanner = __esm({
|
|
|
35447
34173
|
setCurrentFacing((f3) => f3 === "environment" ? "user" : "environment");
|
|
35448
34174
|
}, []);
|
|
35449
34175
|
const togglePause = useCallback(() => {
|
|
35450
|
-
setIsPaused((
|
|
34176
|
+
setIsPaused((p) => !p);
|
|
35451
34177
|
}, []);
|
|
35452
34178
|
const handleMockScan = useCallback(() => {
|
|
35453
34179
|
const result = {
|
|
@@ -38369,10 +37095,10 @@ var init_ModuleCard = __esm({
|
|
|
38369
37095
|
] })
|
|
38370
37096
|
] }, trait.name);
|
|
38371
37097
|
}),
|
|
38372
|
-
pages.length > 0 && /* @__PURE__ */ jsx("div", { className: "px-3 py-1.5 flex items-center gap-2 flex-wrap", children: pages.map((
|
|
37098
|
+
pages.length > 0 && /* @__PURE__ */ jsx("div", { className: "px-3 py-1.5 flex items-center gap-2 flex-wrap", children: pages.map((p) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5", children: [
|
|
38373
37099
|
/* @__PURE__ */ jsx("svg", { width: 10, height: 10, viewBox: "0 0 12 12", children: /* @__PURE__ */ jsx(AvlPage, { x: 6, y: 6, size: 5 }) }),
|
|
38374
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-mono text-[var(--color-muted-foreground)]", children:
|
|
38375
|
-
] },
|
|
37100
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-mono text-[var(--color-muted-foreground)]", children: p.route })
|
|
37101
|
+
] }, p.name)) })
|
|
38376
37102
|
]
|
|
38377
37103
|
}
|
|
38378
37104
|
);
|
|
@@ -39908,12 +38634,12 @@ var init_DocumentViewer = __esm({
|
|
|
39908
38634
|
const handleZoomIn = useCallback(() => setZoom((z) => Math.min(z + 25, 200)), []);
|
|
39909
38635
|
const handleZoomOut = useCallback(() => setZoom((z) => Math.max(z - 25, 50)), []);
|
|
39910
38636
|
const handlePagePrev = useCallback(() => {
|
|
39911
|
-
setCurrentPage((
|
|
38637
|
+
setCurrentPage((p) => Math.max(p - 1, 1));
|
|
39912
38638
|
eventBus.emit("UI:DOCUMENT_PAGE_CHANGE", { page: currentPage - 1 });
|
|
39913
38639
|
}, [eventBus, currentPage]);
|
|
39914
38640
|
const handlePageNext = useCallback(() => {
|
|
39915
38641
|
if (totalPages) {
|
|
39916
|
-
setCurrentPage((
|
|
38642
|
+
setCurrentPage((p) => Math.min(p + 1, totalPages));
|
|
39917
38643
|
eventBus.emit("UI:DOCUMENT_PAGE_CHANGE", { page: currentPage + 1 });
|
|
39918
38644
|
}
|
|
39919
38645
|
}, [totalPages, eventBus, currentPage]);
|
|
@@ -43996,7 +42722,7 @@ function WalkMinimap() {
|
|
|
43996
42722
|
const graphH = 120;
|
|
43997
42723
|
const nodeR = 10;
|
|
43998
42724
|
const positions = activeTrait ? layoutGraph(activeTrait.states, activeTrait.transitions, activeTrait.initialState, graphW, graphH) : [];
|
|
43999
|
-
const posMap = new Map(positions.map((
|
|
42725
|
+
const posMap = new Map(positions.map((p) => [p.state, p]));
|
|
44000
42726
|
const visitedStates = new Set(
|
|
44001
42727
|
coveredEdges.filter((e) => e.trait === walkStep.traitName).flatMap((e) => [e.from, e.to])
|
|
44002
42728
|
);
|
|
@@ -47266,7 +45992,6 @@ var init_component_registry_generated = __esm({
|
|
|
47266
45992
|
init_CTABanner();
|
|
47267
45993
|
init_CalendarGrid();
|
|
47268
45994
|
init_Canvas2D();
|
|
47269
|
-
init_CanvasEffect();
|
|
47270
45995
|
init_Card();
|
|
47271
45996
|
init_CardGrid();
|
|
47272
45997
|
init_Carousel();
|
|
@@ -47565,7 +46290,6 @@ var init_component_registry_generated = __esm({
|
|
|
47565
46290
|
"CTABanner": CTABanner,
|
|
47566
46291
|
"CalendarGrid": CalendarGrid,
|
|
47567
46292
|
"Canvas2D": Canvas2D,
|
|
47568
|
-
"CanvasEffect": CanvasEffect,
|
|
47569
46293
|
"Card": Card,
|
|
47570
46294
|
"CardGrid": CardGrid,
|
|
47571
46295
|
"Carousel": Carousel,
|
|
@@ -49484,7 +48208,7 @@ function UserProvider({
|
|
|
49484
48208
|
const hasAllPermissions = useCallback(
|
|
49485
48209
|
(permissions) => {
|
|
49486
48210
|
if (!user || !user.permissions) return false;
|
|
49487
|
-
return permissions.every((
|
|
48211
|
+
return permissions.every((p) => user.permissions?.includes(p));
|
|
49488
48212
|
},
|
|
49489
48213
|
[user]
|
|
49490
48214
|
);
|
|
@@ -49590,8 +48314,8 @@ function useEntitySchemaOptional6() {
|
|
|
49590
48314
|
}
|
|
49591
48315
|
var log11 = createLogger("almadar:ui:navigation");
|
|
49592
48316
|
function matchPath2(pattern, path) {
|
|
49593
|
-
const normalizeSegment = (
|
|
49594
|
-
let normalized =
|
|
48317
|
+
const normalizeSegment = (p) => {
|
|
48318
|
+
let normalized = p.trim();
|
|
49595
48319
|
if (!normalized.startsWith("/")) normalized = "/" + normalized;
|
|
49596
48320
|
if (normalized.length > 1 && normalized.endsWith("/")) {
|
|
49597
48321
|
normalized = normalized.slice(0, -1);
|