@almadar/ui 5.152.0 → 5.153.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.
@@ -5224,27 +5224,61 @@ var init_InfiniteScrollSentinel = __esm({
5224
5224
  exports.InfiniteScrollSentinel.displayName = "InfiniteScrollSentinel";
5225
5225
  }
5226
5226
  });
5227
- function createParticles(count) {
5228
- return Array.from({ length: count }, () => {
5229
- particleIdCounter += 1;
5230
- return {
5231
- id: particleIdCounter,
5232
- color: CONFETTI_COLORS[Math.floor(Math.random() * CONFETTI_COLORS.length)],
5233
- left: 30 + Math.random() * 40,
5234
- delay: Math.random() * 300,
5235
- angle: Math.random() * 360,
5236
- distance: 40 + Math.random() * 80,
5237
- rotation: Math.random() * 720 - 360,
5238
- size: 4 + Math.random() * 6
5239
- };
5240
- });
5227
+
5228
+ // components/core/atoms/fx.ts
5229
+ function resolveFxView(item, presets) {
5230
+ const row = presets?.find((p) => p.type === item.type);
5231
+ if (!row) return item;
5232
+ return {
5233
+ ...item,
5234
+ space: item.space ?? row.space,
5235
+ effect: item.effect ?? row.effect,
5236
+ color: item.color ?? row.color,
5237
+ size: item.size ?? row.size,
5238
+ vx: item.vx ?? row.vx,
5239
+ vy: item.vy ?? row.vy,
5240
+ vz: item.vz ?? row.vz,
5241
+ particleCount: item.particleCount ?? row.particleCount,
5242
+ shape: row.shape,
5243
+ count: row.count,
5244
+ glow: row.glow,
5245
+ gravity: row.gravity,
5246
+ color2: row.color2
5247
+ };
5241
5248
  }
5242
- var CONFETTI_COLORS, particleIdCounter; exports.ConfettiEffect = void 0;
5243
- var init_ConfettiEffect = __esm({
5244
- "components/core/atoms/ConfettiEffect.tsx"() {
5245
- "use client";
5246
- init_cn();
5247
- init_Box();
5249
+ function fxLifecycle(item, epochNowMs, tickMs) {
5250
+ const maxTtl = Math.max(item.maxTtl ?? item.ttl, item.ttl, 1);
5251
+ const lifeMs = maxTtl * tickMs;
5252
+ const ageMs = item.bornAt !== void 0 && epochNowMs > 0 ? Math.max(0, epochNowMs - item.bornAt) : (1 - item.ttl / maxTtl) * lifeMs;
5253
+ const progress = Math.min(1, Math.max(0, ageMs / lifeMs));
5254
+ return { lifeMs, ageMs, progress, fade: 1 - progress };
5255
+ }
5256
+ function fxHash01(seed, salt) {
5257
+ let h = 2166136261 ^ salt;
5258
+ for (let i = 0; i < seed.length; i++) {
5259
+ h ^= seed.charCodeAt(i);
5260
+ h = Math.imul(h, 16777619);
5261
+ }
5262
+ h ^= h >>> 13;
5263
+ h = Math.imul(h, 1274126177);
5264
+ h ^= h >>> 16;
5265
+ return (h >>> 0) / 4294967296;
5266
+ }
5267
+ function createConfettiParticles(count, seed) {
5268
+ return Array.from({ length: count }, (_, i) => ({
5269
+ id: i,
5270
+ color: CONFETTI_COLORS[Math.floor(fxHash01(seed, i * 7 + 1) * CONFETTI_COLORS.length)],
5271
+ left: 30 + fxHash01(seed, i * 7 + 2) * 40,
5272
+ delay: fxHash01(seed, i * 7 + 3) * 300,
5273
+ angle: fxHash01(seed, i * 7 + 4) * 360,
5274
+ distance: 40 + fxHash01(seed, i * 7 + 5) * 80,
5275
+ rotation: fxHash01(seed, i * 7 + 6) * 720 - 360,
5276
+ size: 4 + fxHash01(seed, i * 7 + 7) * 6
5277
+ }));
5278
+ }
5279
+ var CONFETTI_COLORS, CONFETTI_BURST_KEYFRAMES;
5280
+ var init_fx = __esm({
5281
+ "components/core/atoms/fx.ts"() {
5248
5282
  CONFETTI_COLORS = [
5249
5283
  "var(--color-primary)",
5250
5284
  "var(--color-success)",
@@ -5253,7 +5287,30 @@ var init_ConfettiEffect = __esm({
5253
5287
  "gold",
5254
5288
  "dodgerblue"
5255
5289
  ];
5256
- particleIdCounter = 0;
5290
+ CONFETTI_BURST_KEYFRAMES = `
5291
+ @keyframes confetti-burst {
5292
+ 0% {
5293
+ opacity: 1;
5294
+ transform: translate(0, 0) rotate(0deg) scale(1);
5295
+ }
5296
+ 70% {
5297
+ opacity: 1;
5298
+ }
5299
+ 100% {
5300
+ opacity: 0;
5301
+ transform: translate(var(--confetti-tx), var(--confetti-ty)) rotate(var(--confetti-rotate)) scale(0.5);
5302
+ }
5303
+ }
5304
+ `;
5305
+ }
5306
+ });
5307
+ exports.ConfettiEffect = void 0;
5308
+ var init_ConfettiEffect = __esm({
5309
+ "components/core/atoms/ConfettiEffect.tsx"() {
5310
+ "use client";
5311
+ init_cn();
5312
+ init_Box();
5313
+ init_fx();
5257
5314
  exports.ConfettiEffect = ({
5258
5315
  trigger,
5259
5316
  duration = 2e3,
@@ -5262,11 +5319,13 @@ var init_ConfettiEffect = __esm({
5262
5319
  }) => {
5263
5320
  const [particles, setParticles] = React77.useState([]);
5264
5321
  const previousTriggerRef = React77.useRef(false);
5322
+ const burstRef = React77.useRef(0);
5265
5323
  React77.useEffect(() => {
5266
5324
  const wasFalse = !previousTriggerRef.current;
5267
5325
  previousTriggerRef.current = trigger;
5268
5326
  if (trigger && wasFalse) {
5269
- const newParticles = createParticles(particleCount);
5327
+ burstRef.current += 1;
5328
+ const newParticles = createConfettiParticles(particleCount, `confetti-${burstRef.current}`);
5270
5329
  setParticles(newParticles);
5271
5330
  const timer = window.setTimeout(() => {
5272
5331
  setParticles([]);
@@ -5314,21 +5373,7 @@ var init_ConfettiEffect = __esm({
5314
5373
  p.id
5315
5374
  );
5316
5375
  }),
5317
- /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
5318
- @keyframes confetti-burst {
5319
- 0% {
5320
- opacity: 1;
5321
- transform: translate(0, 0) rotate(0deg) scale(1);
5322
- }
5323
- 70% {
5324
- opacity: 1;
5325
- }
5326
- 100% {
5327
- opacity: 0;
5328
- transform: translate(var(--confetti-tx), var(--confetti-ty)) rotate(var(--confetti-rotate)) scale(0.5);
5329
- }
5330
- }
5331
- ` })
5376
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: CONFETTI_BURST_KEYFRAMES })
5332
5377
  ]
5333
5378
  }
5334
5379
  );
@@ -18132,7 +18177,7 @@ var init_DrawShape = __esm({
18132
18177
  const cx = p.x + (node.offsetX ?? 0) * tw;
18133
18178
  const cy = p.y + (node.offsetY ?? 0) * tw;
18134
18179
  const rx = (node.radiusX ?? 0) * tw;
18135
- const ry = (node.radiusY ?? rx) * tw;
18180
+ const ry = (node.radiusY ?? node.radiusX ?? 0) * tw;
18136
18181
  if (pxFill) painter.fillEllipse(cx, cy, rx, ry, pxFill);
18137
18182
  if (patFill) painter.fillEllipse(cx, cy, rx, ry, patFill);
18138
18183
  if (pxStroke) painter.strokeEllipse(cx, cy, rx, ry, pxStroke, strokePx);
@@ -18322,6 +18367,172 @@ var init_DrawTextLayer = __esm({
18322
18367
  };
18323
18368
  }
18324
18369
  });
18370
+
18371
+ // components/game/molecules/DrawFxLayer.tsx
18372
+ function fxPosition(view, dim, ageSec) {
18373
+ const g = view.gravity ?? 0;
18374
+ const fall = 0.5 * g * ageSec * ageSec;
18375
+ {
18376
+ const base2 = view.position ?? { x: view.x, y: view.z ?? view.y ?? 0 };
18377
+ if (!Number.isFinite(base2.x) || !Number.isFinite(base2.y)) return void 0;
18378
+ return {
18379
+ x: base2.x + (view.vx ?? 0) * ageSec,
18380
+ y: base2.y + (view.vz ?? 0) * ageSec + fall
18381
+ };
18382
+ }
18383
+ }
18384
+ function sparkShape(view, pos, i, fade, progress) {
18385
+ const size = view.size ?? 0.5;
18386
+ const angle = fxHash01(view.id, i * 3) * Math.PI * 2;
18387
+ const dist = size * (0.4 + 0.6 * fxHash01(view.id, i * 3 + 1)) * easeOut2(progress);
18388
+ const r = size * (0.06 + 0.06 * fxHash01(view.id, i * 3 + 2));
18389
+ const color = view.color ?? DEFAULT_SPARK_COLOR;
18390
+ return {
18391
+ type: "draw-shape",
18392
+ shape: "ellipse",
18393
+ position: { ...pos, x: pos.x + Math.cos(angle) * dist, y: pos.y + Math.sin(angle) * dist },
18394
+ anchor: "center",
18395
+ radiusX: r,
18396
+ fill: color,
18397
+ blendMode: "lighter",
18398
+ opacity: fade,
18399
+ ...view.glow ? { shadow: { color, blur: view.glow } } : {}
18400
+ };
18401
+ }
18402
+ function proceduralShapes(view, pos, fade, progress) {
18403
+ const size = view.size ?? 0.5;
18404
+ const color = view.color ?? DEFAULT_SPARK_COLOR;
18405
+ switch (view.shape ?? "spark") {
18406
+ case "ring": {
18407
+ return [
18408
+ {
18409
+ type: "draw-shape",
18410
+ shape: "ellipse",
18411
+ position: pos,
18412
+ anchor: "center",
18413
+ radiusX: size * easeOut2(progress),
18414
+ stroke: view.color2 ?? color,
18415
+ strokeWidth: 2,
18416
+ blendMode: "lighter",
18417
+ opacity: fade,
18418
+ ...view.glow ? { shadow: { color, blur: view.glow } } : {}
18419
+ }
18420
+ ];
18421
+ }
18422
+ case "puff": {
18423
+ const count = view.count ?? 3;
18424
+ return Array.from({ length: count }, (_, i) => {
18425
+ const angle = fxHash01(view.id, i * 5) * Math.PI * 2;
18426
+ const drift = size * 0.3 * fxHash01(view.id, i * 5 + 1) * easeOut2(progress);
18427
+ return {
18428
+ type: "draw-shape",
18429
+ shape: "ellipse",
18430
+ position: { ...pos, x: pos.x + Math.cos(angle) * drift, y: pos.y + Math.sin(angle) * drift },
18431
+ anchor: "center",
18432
+ radiusX: size * (0.15 + 0.35 * progress) * (0.7 + 0.6 * fxHash01(view.id, i * 5 + 2)),
18433
+ fill: i === 0 && view.color2 ? view.color2 : color,
18434
+ opacity: fade * 0.6,
18435
+ ...view.glow ? { shadow: { color, blur: view.glow } } : {}
18436
+ };
18437
+ });
18438
+ }
18439
+ case "streak": {
18440
+ const count = view.count ?? 5;
18441
+ return Array.from({ length: count }, (_, i) => {
18442
+ const angle = fxHash01(view.id, i * 3) * Math.PI * 2;
18443
+ const inner = size * (0.2 + 0.8 * easeOut2(progress)) * (0.6 + 0.4 * fxHash01(view.id, i * 3 + 1));
18444
+ const len = size * 0.35;
18445
+ return {
18446
+ type: "draw-shape",
18447
+ shape: "ellipse",
18448
+ position: pos,
18449
+ anchor: "center",
18450
+ offsetX: inner + len / 2,
18451
+ offsetY: 0,
18452
+ radiusX: len / 2,
18453
+ radiusY: size * 0.04,
18454
+ rotate: angle,
18455
+ fill: color,
18456
+ blendMode: "lighter",
18457
+ opacity: fade,
18458
+ ...view.glow ? { shadow: { color, blur: view.glow } } : {}
18459
+ };
18460
+ });
18461
+ }
18462
+ default: {
18463
+ const count = view.count ?? 6;
18464
+ return Array.from({ length: count }, (_, i) => sparkShape(view, pos, i, fade, progress));
18465
+ }
18466
+ }
18467
+ }
18468
+ function expandFxItem(view, node, epochNowMs, dim) {
18469
+ if (view.space === "screen") return [];
18470
+ const tickMs = node.tickMs ?? DEFAULT_TICK_MS;
18471
+ const { ageMs, progress, fade } = fxLifecycle(view, epochNowMs, tickMs);
18472
+ if (progress >= 1) return [];
18473
+ const pos = fxPosition(view, dim, ageMs / 1e3);
18474
+ if (!pos) return [];
18475
+ const out = [];
18476
+ const artItems = node.art?.[view.type]?.["idle"];
18477
+ const sprite = node.sprites?.[view.type];
18478
+ if (Array.isArray(artItems)) {
18479
+ out.push({
18480
+ type: "draw-group",
18481
+ position: pos,
18482
+ opacity: fade,
18483
+ ...view.size !== void 0 ? { scale: view.size } : {},
18484
+ items: artItems
18485
+ });
18486
+ } else if (sprite?.url) {
18487
+ const spriteSize = view.size ?? 0.6;
18488
+ out.push({
18489
+ type: "draw-sprite",
18490
+ position: pos,
18491
+ asset: sprite,
18492
+ anchor: "center",
18493
+ width: spriteSize,
18494
+ height: spriteSize,
18495
+ opacity: fade
18496
+ });
18497
+ } else {
18498
+ out.push(...proceduralShapes(view, pos, fade, progress));
18499
+ }
18500
+ if (view.message) {
18501
+ const text = {
18502
+ type: "draw-text",
18503
+ text: view.message,
18504
+ position: pos,
18505
+ offsetY: -(0.15 + 0.55 * progress),
18506
+ color: view.color ?? node.textColor ?? DEFAULT_TEXT_COLOR,
18507
+ opacity: fade
18508
+ };
18509
+ out.push(text);
18510
+ }
18511
+ return out;
18512
+ }
18513
+ function expandFxLayer(node, epochNowMs, dim) {
18514
+ if (!Array.isArray(node.items)) return [];
18515
+ const out = [];
18516
+ for (const item of node.items) {
18517
+ if (!item || typeof item.id !== "string") continue;
18518
+ out.push(...expandFxItem(resolveFxView(item, node.presets), node, epochNowMs, dim));
18519
+ }
18520
+ return out;
18521
+ }
18522
+ function DrawFxLayer(_props) {
18523
+ return null;
18524
+ }
18525
+ var DEFAULT_TICK_MS, DEFAULT_TEXT_COLOR, DEFAULT_SPARK_COLOR, easeOut2;
18526
+ var init_DrawFxLayer = __esm({
18527
+ "components/game/molecules/DrawFxLayer.tsx"() {
18528
+ "use client";
18529
+ init_fx();
18530
+ DEFAULT_TICK_MS = 500;
18531
+ DEFAULT_TEXT_COLOR = "#ffe066";
18532
+ DEFAULT_SPARK_COLOR = "#ffffff";
18533
+ easeOut2 = (t) => 1 - (1 - t) * (1 - t);
18534
+ }
18535
+ });
18325
18536
  function paintDrawable(painter, node, dctx) {
18326
18537
  switch (node.type) {
18327
18538
  case "draw-sprite":
@@ -18369,6 +18580,11 @@ function paintDrawable(painter, node, dctx) {
18369
18580
  case "draw-text-layer":
18370
18581
  paintTextLayer(painter, node, dctx);
18371
18582
  break;
18583
+ case "draw-fx-layer": {
18584
+ const epochNow = dctx.time > 0 && typeof performance !== "undefined" ? performance.timeOrigin + dctx.time : 0;
18585
+ for (const child of expandFxLayer(node, epochNow, "2d")) paintDrawable(painter, child, dctx);
18586
+ break;
18587
+ }
18372
18588
  }
18373
18589
  }
18374
18590
  var paint2dLog, warnedUnsupported2d, warnUnsupported2d;
@@ -18383,6 +18599,7 @@ var init_paintDispatch = __esm({
18383
18599
  init_DrawSpriteLayer();
18384
18600
  init_DrawShapeLayer();
18385
18601
  init_DrawTextLayer();
18602
+ init_DrawFxLayer();
18386
18603
  paint2dLog = logger.createLogger("almadar:ui:drawable-2d");
18387
18604
  warnedUnsupported2d = /* @__PURE__ */ new Set();
18388
18605
  warnUnsupported2d = (kind) => {
@@ -18631,6 +18848,7 @@ function Canvas2D({
18631
18848
  return isAnimatedGroup(node) || Array.isArray(node.items) && node.items.some(drawableIsAnimated);
18632
18849
  if (node.type === "draw-shape-layer") return Array.isArray(node.items) && node.items.some(isAnimatedShape);
18633
18850
  if (node.type === "draw-sprite-layer") return Array.isArray(node.items) && node.items.some(isAnimatedSprite);
18851
+ if (node.type === "draw-fx-layer") return Array.isArray(node.items) && node.items.length > 0;
18634
18852
  return false;
18635
18853
  };
18636
18854
  const animRafRef = React77.useRef(0);
@@ -26553,6 +26771,196 @@ var init_PageTransition = __esm({
26553
26771
  exports.PageTransition.displayName = "PageTransition";
26554
26772
  }
26555
26773
  });
26774
+ function ConfettiBurst({ item, lifeMs }) {
26775
+ const particles = createConfettiParticles(item.particleCount ?? 30, item.id);
26776
+ const left = (item.x ?? 0.5) * 100;
26777
+ const top = (item.z ?? item.y ?? 0.4) * 100;
26778
+ return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { position: "absolute", style: { left: `${left}%`, top: `${top}%` }, children: particles.map((p) => {
26779
+ const rad = p.angle * Math.PI / 180;
26780
+ const tx = Math.cos(rad) * p.distance * (item.size ?? 1);
26781
+ const ty = Math.sin(rad) * p.distance * (item.size ?? 1) - 20;
26782
+ return /* @__PURE__ */ jsxRuntime.jsx(
26783
+ exports.Box,
26784
+ {
26785
+ className: "absolute rounded-sm",
26786
+ style: {
26787
+ left: (p.left - 50) * 2,
26788
+ top: -10,
26789
+ width: p.size,
26790
+ height: p.size,
26791
+ backgroundColor: item.color ?? p.color,
26792
+ animation: `confetti-burst ${Math.max(lifeMs - p.delay, 200)}ms ease-out ${p.delay}ms forwards`,
26793
+ opacity: 0,
26794
+ "--confetti-tx": `${tx}px`,
26795
+ "--confetti-ty": `${ty}px`,
26796
+ "--confetti-rotate": `${p.rotation}deg`
26797
+ }
26798
+ },
26799
+ p.id
26800
+ );
26801
+ }) });
26802
+ }
26803
+ function SparkleBurst({ item, lifeMs }) {
26804
+ const count = item.particleCount ?? 8;
26805
+ const scale = item.size ?? 1;
26806
+ const left = (item.x ?? 0.5) * 100;
26807
+ const top = (item.z ?? item.y ?? 0.4) * 100;
26808
+ return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { position: "absolute", style: { left: `${left}%`, top: `${top}%` }, children: Array.from({ length: count }, (_, i) => {
26809
+ const dx = (fxHash01(item.id, i * 4) - 0.5) * 160 * scale;
26810
+ const dy = (fxHash01(item.id, i * 4 + 1) - 0.5) * 120 * scale;
26811
+ const dot = (4 + fxHash01(item.id, i * 4 + 2) * 5) * scale;
26812
+ const delay = fxHash01(item.id, i * 4 + 3) * lifeMs * 0.4;
26813
+ return /* @__PURE__ */ jsxRuntime.jsx(
26814
+ exports.Box,
26815
+ {
26816
+ className: "absolute rounded-full",
26817
+ style: {
26818
+ left: dx,
26819
+ top: dy,
26820
+ width: dot,
26821
+ height: dot,
26822
+ backgroundColor: item.color ?? "gold",
26823
+ opacity: 0,
26824
+ animation: `fx-overlay-sparkle ${Math.max(lifeMs - delay, 200)}ms ease-in-out ${delay}ms forwards`
26825
+ }
26826
+ },
26827
+ i
26828
+ );
26829
+ }) });
26830
+ }
26831
+ function OverlayFxNode({ item, tickMs }) {
26832
+ const lifeMs = lifeMsOf(item, tickMs);
26833
+ switch (item.effect ?? "sparkle") {
26834
+ case "confetti":
26835
+ return /* @__PURE__ */ jsxRuntime.jsx(ConfettiBurst, { item, lifeMs });
26836
+ case "flash":
26837
+ return /* @__PURE__ */ jsxRuntime.jsx(
26838
+ exports.Box,
26839
+ {
26840
+ position: "absolute",
26841
+ className: "inset-0",
26842
+ style: {
26843
+ backgroundColor: item.color ?? "#ffffff",
26844
+ opacity: 0,
26845
+ animation: `fx-overlay-flash ${lifeMs}ms ease-out forwards`
26846
+ }
26847
+ }
26848
+ );
26849
+ case "streak-glow":
26850
+ return /* @__PURE__ */ jsxRuntime.jsx(
26851
+ exports.Box,
26852
+ {
26853
+ position: "absolute",
26854
+ className: "inset-0",
26855
+ style: {
26856
+ boxShadow: `inset 0 0 ${60 * (item.size ?? 1)}px ${item.color ?? "var(--color-warning)"}`,
26857
+ opacity: 0,
26858
+ animation: `fx-overlay-glow ${lifeMs}ms ease-in-out forwards`
26859
+ }
26860
+ }
26861
+ );
26862
+ case "float-text": {
26863
+ if (!item.message) return null;
26864
+ return /* @__PURE__ */ jsxRuntime.jsx(
26865
+ exports.Box,
26866
+ {
26867
+ position: "absolute",
26868
+ style: {
26869
+ left: `${(item.x ?? 0.5) * 100}%`,
26870
+ top: `${(item.z ?? item.y ?? 0.4) * 100}%`,
26871
+ color: item.color ?? "var(--color-success)",
26872
+ fontWeight: 700,
26873
+ fontSize: 16 * (item.size ?? 1),
26874
+ textShadow: "0 1px 2px rgba(0,0,0,0.4)",
26875
+ opacity: 0,
26876
+ animation: `fx-overlay-float ${lifeMs}ms ease-out forwards`,
26877
+ whiteSpace: "nowrap"
26878
+ },
26879
+ children: item.message
26880
+ }
26881
+ );
26882
+ }
26883
+ case "shake":
26884
+ return null;
26885
+ default:
26886
+ return /* @__PURE__ */ jsxRuntime.jsx(SparkleBurst, { item, lifeMs });
26887
+ }
26888
+ }
26889
+ var DEFAULT_TICK_MS2, FX_OVERLAY_KEYFRAMES, lifeMsOf; exports.FxOverlay = void 0;
26890
+ var init_FxOverlay = __esm({
26891
+ "components/core/molecules/FxOverlay.tsx"() {
26892
+ "use client";
26893
+ init_cn();
26894
+ init_Box();
26895
+ init_fx();
26896
+ DEFAULT_TICK_MS2 = 500;
26897
+ FX_OVERLAY_KEYFRAMES = `
26898
+ ${CONFETTI_BURST_KEYFRAMES}
26899
+ @keyframes fx-overlay-flash {
26900
+ 0% { opacity: 0.75; }
26901
+ 100% { opacity: 0; }
26902
+ }
26903
+ @keyframes fx-overlay-glow {
26904
+ 0% { opacity: 0.9; }
26905
+ 60% { opacity: 0.6; }
26906
+ 100% { opacity: 0; }
26907
+ }
26908
+ @keyframes fx-overlay-sparkle {
26909
+ 0% { opacity: 0; transform: scale(0); }
26910
+ 30% { opacity: 1; transform: scale(1); }
26911
+ 100% { opacity: 0; transform: scale(0.3); }
26912
+ }
26913
+ @keyframes fx-overlay-float {
26914
+ 0% { opacity: 0; transform: translate(-50%, 8px); }
26915
+ 15% { opacity: 1; }
26916
+ 100% { opacity: 0; transform: translate(-50%, -40px); }
26917
+ }
26918
+ @keyframes fx-overlay-shake {
26919
+ 0% { transform: translateX(0); }
26920
+ 15% { transform: translateX(-6px); }
26921
+ 30% { transform: translateX(5px); }
26922
+ 45% { transform: translateX(-4px); }
26923
+ 60% { transform: translateX(3px); }
26924
+ 75% { transform: translateX(-2px); }
26925
+ 100% { transform: translateX(0); }
26926
+ }
26927
+ `;
26928
+ lifeMsOf = (it, tickMs) => Math.max(it.maxTtl ?? it.ttl, it.ttl, 1) * tickMs;
26929
+ exports.FxOverlay = ({ items, tickMs = DEFAULT_TICK_MS2, children, className }) => {
26930
+ const screenItems = (Array.isArray(items) ? items : []).filter(
26931
+ (it) => Boolean(it) && typeof it.id === "string" && it.space !== "world"
26932
+ );
26933
+ const shakeItem = [...screenItems].reverse().find((it) => it.effect === "shake");
26934
+ const overlay = /* @__PURE__ */ jsxRuntime.jsxs(
26935
+ exports.Box,
26936
+ {
26937
+ position: "absolute",
26938
+ className: cn("inset-0 pointer-events-none overflow-hidden z-50", !children && className),
26939
+ "aria-hidden": "true",
26940
+ children: [
26941
+ screenItems.map((it) => /* @__PURE__ */ jsxRuntime.jsx(OverlayFxNode, { item: it, tickMs }, it.id)),
26942
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: FX_OVERLAY_KEYFRAMES })
26943
+ ]
26944
+ }
26945
+ );
26946
+ if (children !== void 0 && children !== null) {
26947
+ return /* @__PURE__ */ jsxRuntime.jsxs(exports.Box, { position: "relative", className, children: [
26948
+ /* @__PURE__ */ jsxRuntime.jsx(
26949
+ exports.Box,
26950
+ {
26951
+ style: shakeItem ? { animation: `fx-overlay-shake ${Math.min(lifeMsOf(shakeItem, tickMs), 600)}ms ease-in-out` } : void 0,
26952
+ children
26953
+ },
26954
+ shakeItem?.id ?? "steady"
26955
+ ),
26956
+ overlay
26957
+ ] });
26958
+ }
26959
+ return overlay;
26960
+ };
26961
+ exports.FxOverlay.displayName = "FxOverlay";
26962
+ }
26963
+ });
26556
26964
  function computePopoverStyle(position, triggerRect, popoverWidth) {
26557
26965
  if (position === "left" || position === "right") {
26558
26966
  return {
@@ -31242,7 +31650,7 @@ var init_MathCanvas = __esm({
31242
31650
  x: mapX((first.x + last.x) / 2),
31243
31651
  y: (mapY(region.samples[mid].y) + mapY(baseline)) / 2,
31244
31652
  text: region.label,
31245
- color: "#111827",
31653
+ color,
31246
31654
  fontSize: 11
31247
31655
  });
31248
31656
  }
@@ -31275,14 +31683,14 @@ var init_MathCanvas = __esm({
31275
31683
  const px = mapX(guide.at);
31276
31684
  out.push({ type: "line", x1: px, y1: margin, x2: px, y2: height - margin, color, dash });
31277
31685
  if (guide.label) {
31278
- out.push({ type: "text", x: px + 4, y: margin + 10, text: guide.label, color: "#111827", fontSize: 11 });
31686
+ out.push({ type: "text", x: px + 4, y: margin + 10, text: guide.label, color, fontSize: 11 });
31279
31687
  }
31280
31688
  } else {
31281
31689
  if (guide.at < yMin || guide.at > yMax) continue;
31282
31690
  const py = mapY(guide.at);
31283
31691
  out.push({ type: "line", x1: margin, y1: py, x2: width - margin, y2: py, color, dash });
31284
31692
  if (guide.label) {
31285
- out.push({ type: "text", x: width - margin - 4, y: py - 8, text: guide.label, color: "#111827", fontSize: 11, align: "right" });
31693
+ out.push({ type: "text", x: width - margin - 4, y: py - 8, text: guide.label, color, fontSize: 11, align: "right" });
31286
31694
  }
31287
31695
  }
31288
31696
  }
@@ -31348,7 +31756,7 @@ var init_MathCanvas = __esm({
31348
31756
  x: (x1 + x2) / 2,
31349
31757
  y: xAxisY - peak - 8,
31350
31758
  text: hop.label,
31351
- color: "#111827",
31759
+ color,
31352
31760
  fontSize: 10,
31353
31761
  align: "center"
31354
31762
  });
@@ -31375,7 +31783,7 @@ var init_MathCanvas = __esm({
31375
31783
  x: mapX(angle.x + 1.35 * radius * Math.cos(rad)),
31376
31784
  y: mapY(angle.y + 1.35 * radius * Math.sin(rad)),
31377
31785
  text: angle.label,
31378
- color: "#111827",
31786
+ color,
31379
31787
  fontSize: 11,
31380
31788
  align: "center"
31381
31789
  });
@@ -31393,7 +31801,7 @@ var init_MathCanvas = __esm({
31393
31801
  fill: isOpen ? "#ffffff" : p.color ?? "#dc2626"
31394
31802
  });
31395
31803
  if (p.label) {
31396
- out.push({ type: "text", x: mapX(p.x) + 8, y: mapY(p.y) - 8, text: p.label, color: "#111827", fontSize: 12 });
31804
+ out.push({ type: "text", x: mapX(p.x) + 8, y: mapY(p.y) - 8, text: p.label, color: p.color ?? "#111827", fontSize: 12 });
31397
31805
  }
31398
31806
  }
31399
31807
  for (const v of vectors) {
@@ -31404,7 +31812,7 @@ var init_MathCanvas = __esm({
31404
31812
  const y2 = mapY(v.y + v.vy);
31405
31813
  out.push({ type: "arrow", x1, y1, x2, y2, color: v.color ?? "#7c3aed", lineWidth: 2 });
31406
31814
  if (v.label) {
31407
- out.push({ type: "text", x: x2 + 6, y: y2 - 6, text: v.label, color: "#111827", fontSize: 12 });
31815
+ out.push({ type: "text", x: x2 + 6, y: y2 - 6, text: v.label, color: v.color ?? "#7c3aed", fontSize: 12 });
31408
31816
  }
31409
31817
  }
31410
31818
  out.push(...shapes);
@@ -42380,6 +42788,7 @@ var init_molecules2 = __esm({
42380
42788
  init_Menu();
42381
42789
  init_Modal();
42382
42790
  init_PageTransition();
42791
+ init_FxOverlay();
42383
42792
  init_Pagination();
42384
42793
  init_Popover();
42385
42794
  init_Coachmark();
@@ -49301,6 +49710,7 @@ var init_component_registry_generated = __esm({
49301
49710
  init_DocSidebar();
49302
49711
  init_DocTOC();
49303
49712
  init_DocumentViewer();
49713
+ init_DrawFxLayer();
49304
49714
  init_DrawGroup();
49305
49715
  init_DrawMesh();
49306
49716
  init_DrawShape();
@@ -49331,6 +49741,7 @@ var init_component_registry_generated = __esm({
49331
49741
  init_FormField();
49332
49742
  init_FormSection();
49333
49743
  init_FormSectionHeader();
49744
+ init_FxOverlay();
49334
49745
  init_GameAudioToggle();
49335
49746
  init_GameHud();
49336
49747
  init_GameIcon();
@@ -49571,6 +49982,7 @@ var init_component_registry_generated = __esm({
49571
49982
  "DocSidebar": exports.DocSidebar,
49572
49983
  "DocTOC": exports.DocTOC,
49573
49984
  "DocumentViewer": exports.DocumentViewer,
49985
+ "DrawFxLayer": DrawFxLayer,
49574
49986
  "DrawGroup": DrawGroup,
49575
49987
  "DrawMesh": DrawMesh,
49576
49988
  "DrawShape": DrawShape,
@@ -49601,6 +50013,7 @@ var init_component_registry_generated = __esm({
49601
50013
  "FormField": exports.FormField,
49602
50014
  "FormLayout": exports.FormLayout,
49603
50015
  "FormSectionHeader": exports.FormSectionHeader,
50016
+ "FxOverlay": exports.FxOverlay,
49604
50017
  "GameAudioToggle": GameAudioToggle,
49605
50018
  "GameHud": GameHud,
49606
50019
  "GameIcon": GameIcon,