@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.
@@ -5149,27 +5149,61 @@ var init_InfiniteScrollSentinel = __esm({
5149
5149
  InfiniteScrollSentinel.displayName = "InfiniteScrollSentinel";
5150
5150
  }
5151
5151
  });
5152
- function createParticles(count) {
5153
- return Array.from({ length: count }, () => {
5154
- particleIdCounter += 1;
5155
- return {
5156
- id: particleIdCounter,
5157
- color: CONFETTI_COLORS[Math.floor(Math.random() * CONFETTI_COLORS.length)],
5158
- left: 30 + Math.random() * 40,
5159
- delay: Math.random() * 300,
5160
- angle: Math.random() * 360,
5161
- distance: 40 + Math.random() * 80,
5162
- rotation: Math.random() * 720 - 360,
5163
- size: 4 + Math.random() * 6
5164
- };
5165
- });
5152
+
5153
+ // components/core/atoms/fx.ts
5154
+ function resolveFxView(item, presets) {
5155
+ const row = presets?.find((p) => p.type === item.type);
5156
+ if (!row) return item;
5157
+ return {
5158
+ ...item,
5159
+ space: item.space ?? row.space,
5160
+ effect: item.effect ?? row.effect,
5161
+ color: item.color ?? row.color,
5162
+ size: item.size ?? row.size,
5163
+ vx: item.vx ?? row.vx,
5164
+ vy: item.vy ?? row.vy,
5165
+ vz: item.vz ?? row.vz,
5166
+ particleCount: item.particleCount ?? row.particleCount,
5167
+ shape: row.shape,
5168
+ count: row.count,
5169
+ glow: row.glow,
5170
+ gravity: row.gravity,
5171
+ color2: row.color2
5172
+ };
5166
5173
  }
5167
- var CONFETTI_COLORS, particleIdCounter, ConfettiEffect;
5168
- var init_ConfettiEffect = __esm({
5169
- "components/core/atoms/ConfettiEffect.tsx"() {
5170
- "use client";
5171
- init_cn();
5172
- init_Box();
5174
+ function fxLifecycle(item, epochNowMs, tickMs) {
5175
+ const maxTtl = Math.max(item.maxTtl ?? item.ttl, item.ttl, 1);
5176
+ const lifeMs = maxTtl * tickMs;
5177
+ const ageMs = item.bornAt !== void 0 && epochNowMs > 0 ? Math.max(0, epochNowMs - item.bornAt) : (1 - item.ttl / maxTtl) * lifeMs;
5178
+ const progress = Math.min(1, Math.max(0, ageMs / lifeMs));
5179
+ return { lifeMs, ageMs, progress, fade: 1 - progress };
5180
+ }
5181
+ function fxHash01(seed, salt) {
5182
+ let h = 2166136261 ^ salt;
5183
+ for (let i = 0; i < seed.length; i++) {
5184
+ h ^= seed.charCodeAt(i);
5185
+ h = Math.imul(h, 16777619);
5186
+ }
5187
+ h ^= h >>> 13;
5188
+ h = Math.imul(h, 1274126177);
5189
+ h ^= h >>> 16;
5190
+ return (h >>> 0) / 4294967296;
5191
+ }
5192
+ function createConfettiParticles(count, seed) {
5193
+ return Array.from({ length: count }, (_, i) => ({
5194
+ id: i,
5195
+ color: CONFETTI_COLORS[Math.floor(fxHash01(seed, i * 7 + 1) * CONFETTI_COLORS.length)],
5196
+ left: 30 + fxHash01(seed, i * 7 + 2) * 40,
5197
+ delay: fxHash01(seed, i * 7 + 3) * 300,
5198
+ angle: fxHash01(seed, i * 7 + 4) * 360,
5199
+ distance: 40 + fxHash01(seed, i * 7 + 5) * 80,
5200
+ rotation: fxHash01(seed, i * 7 + 6) * 720 - 360,
5201
+ size: 4 + fxHash01(seed, i * 7 + 7) * 6
5202
+ }));
5203
+ }
5204
+ var CONFETTI_COLORS, CONFETTI_BURST_KEYFRAMES;
5205
+ var init_fx = __esm({
5206
+ "components/core/atoms/fx.ts"() {
5173
5207
  CONFETTI_COLORS = [
5174
5208
  "var(--color-primary)",
5175
5209
  "var(--color-success)",
@@ -5178,7 +5212,30 @@ var init_ConfettiEffect = __esm({
5178
5212
  "gold",
5179
5213
  "dodgerblue"
5180
5214
  ];
5181
- particleIdCounter = 0;
5215
+ CONFETTI_BURST_KEYFRAMES = `
5216
+ @keyframes confetti-burst {
5217
+ 0% {
5218
+ opacity: 1;
5219
+ transform: translate(0, 0) rotate(0deg) scale(1);
5220
+ }
5221
+ 70% {
5222
+ opacity: 1;
5223
+ }
5224
+ 100% {
5225
+ opacity: 0;
5226
+ transform: translate(var(--confetti-tx), var(--confetti-ty)) rotate(var(--confetti-rotate)) scale(0.5);
5227
+ }
5228
+ }
5229
+ `;
5230
+ }
5231
+ });
5232
+ var ConfettiEffect;
5233
+ var init_ConfettiEffect = __esm({
5234
+ "components/core/atoms/ConfettiEffect.tsx"() {
5235
+ "use client";
5236
+ init_cn();
5237
+ init_Box();
5238
+ init_fx();
5182
5239
  ConfettiEffect = ({
5183
5240
  trigger,
5184
5241
  duration = 2e3,
@@ -5187,11 +5244,13 @@ var init_ConfettiEffect = __esm({
5187
5244
  }) => {
5188
5245
  const [particles, setParticles] = useState([]);
5189
5246
  const previousTriggerRef = useRef(false);
5247
+ const burstRef = useRef(0);
5190
5248
  useEffect(() => {
5191
5249
  const wasFalse = !previousTriggerRef.current;
5192
5250
  previousTriggerRef.current = trigger;
5193
5251
  if (trigger && wasFalse) {
5194
- const newParticles = createParticles(particleCount);
5252
+ burstRef.current += 1;
5253
+ const newParticles = createConfettiParticles(particleCount, `confetti-${burstRef.current}`);
5195
5254
  setParticles(newParticles);
5196
5255
  const timer = window.setTimeout(() => {
5197
5256
  setParticles([]);
@@ -5239,21 +5298,7 @@ var init_ConfettiEffect = __esm({
5239
5298
  p.id
5240
5299
  );
5241
5300
  }),
5242
- /* @__PURE__ */ jsx("style", { children: `
5243
- @keyframes confetti-burst {
5244
- 0% {
5245
- opacity: 1;
5246
- transform: translate(0, 0) rotate(0deg) scale(1);
5247
- }
5248
- 70% {
5249
- opacity: 1;
5250
- }
5251
- 100% {
5252
- opacity: 0;
5253
- transform: translate(var(--confetti-tx), var(--confetti-ty)) rotate(var(--confetti-rotate)) scale(0.5);
5254
- }
5255
- }
5256
- ` })
5301
+ /* @__PURE__ */ jsx("style", { children: CONFETTI_BURST_KEYFRAMES })
5257
5302
  ]
5258
5303
  }
5259
5304
  );
@@ -18057,7 +18102,7 @@ var init_DrawShape = __esm({
18057
18102
  const cx = p.x + (node.offsetX ?? 0) * tw;
18058
18103
  const cy = p.y + (node.offsetY ?? 0) * tw;
18059
18104
  const rx = (node.radiusX ?? 0) * tw;
18060
- const ry = (node.radiusY ?? rx) * tw;
18105
+ const ry = (node.radiusY ?? node.radiusX ?? 0) * tw;
18061
18106
  if (pxFill) painter.fillEllipse(cx, cy, rx, ry, pxFill);
18062
18107
  if (patFill) painter.fillEllipse(cx, cy, rx, ry, patFill);
18063
18108
  if (pxStroke) painter.strokeEllipse(cx, cy, rx, ry, pxStroke, strokePx);
@@ -18247,6 +18292,172 @@ var init_DrawTextLayer = __esm({
18247
18292
  };
18248
18293
  }
18249
18294
  });
18295
+
18296
+ // components/game/molecules/DrawFxLayer.tsx
18297
+ function fxPosition(view, dim, ageSec) {
18298
+ const g = view.gravity ?? 0;
18299
+ const fall = 0.5 * g * ageSec * ageSec;
18300
+ {
18301
+ const base2 = view.position ?? { x: view.x, y: view.z ?? view.y ?? 0 };
18302
+ if (!Number.isFinite(base2.x) || !Number.isFinite(base2.y)) return void 0;
18303
+ return {
18304
+ x: base2.x + (view.vx ?? 0) * ageSec,
18305
+ y: base2.y + (view.vz ?? 0) * ageSec + fall
18306
+ };
18307
+ }
18308
+ }
18309
+ function sparkShape(view, pos, i, fade, progress) {
18310
+ const size = view.size ?? 0.5;
18311
+ const angle = fxHash01(view.id, i * 3) * Math.PI * 2;
18312
+ const dist = size * (0.4 + 0.6 * fxHash01(view.id, i * 3 + 1)) * easeOut2(progress);
18313
+ const r = size * (0.06 + 0.06 * fxHash01(view.id, i * 3 + 2));
18314
+ const color = view.color ?? DEFAULT_SPARK_COLOR;
18315
+ return {
18316
+ type: "draw-shape",
18317
+ shape: "ellipse",
18318
+ position: { ...pos, x: pos.x + Math.cos(angle) * dist, y: pos.y + Math.sin(angle) * dist },
18319
+ anchor: "center",
18320
+ radiusX: r,
18321
+ fill: color,
18322
+ blendMode: "lighter",
18323
+ opacity: fade,
18324
+ ...view.glow ? { shadow: { color, blur: view.glow } } : {}
18325
+ };
18326
+ }
18327
+ function proceduralShapes(view, pos, fade, progress) {
18328
+ const size = view.size ?? 0.5;
18329
+ const color = view.color ?? DEFAULT_SPARK_COLOR;
18330
+ switch (view.shape ?? "spark") {
18331
+ case "ring": {
18332
+ return [
18333
+ {
18334
+ type: "draw-shape",
18335
+ shape: "ellipse",
18336
+ position: pos,
18337
+ anchor: "center",
18338
+ radiusX: size * easeOut2(progress),
18339
+ stroke: view.color2 ?? color,
18340
+ strokeWidth: 2,
18341
+ blendMode: "lighter",
18342
+ opacity: fade,
18343
+ ...view.glow ? { shadow: { color, blur: view.glow } } : {}
18344
+ }
18345
+ ];
18346
+ }
18347
+ case "puff": {
18348
+ const count = view.count ?? 3;
18349
+ return Array.from({ length: count }, (_, i) => {
18350
+ const angle = fxHash01(view.id, i * 5) * Math.PI * 2;
18351
+ const drift = size * 0.3 * fxHash01(view.id, i * 5 + 1) * easeOut2(progress);
18352
+ return {
18353
+ type: "draw-shape",
18354
+ shape: "ellipse",
18355
+ position: { ...pos, x: pos.x + Math.cos(angle) * drift, y: pos.y + Math.sin(angle) * drift },
18356
+ anchor: "center",
18357
+ radiusX: size * (0.15 + 0.35 * progress) * (0.7 + 0.6 * fxHash01(view.id, i * 5 + 2)),
18358
+ fill: i === 0 && view.color2 ? view.color2 : color,
18359
+ opacity: fade * 0.6,
18360
+ ...view.glow ? { shadow: { color, blur: view.glow } } : {}
18361
+ };
18362
+ });
18363
+ }
18364
+ case "streak": {
18365
+ const count = view.count ?? 5;
18366
+ return Array.from({ length: count }, (_, i) => {
18367
+ const angle = fxHash01(view.id, i * 3) * Math.PI * 2;
18368
+ const inner = size * (0.2 + 0.8 * easeOut2(progress)) * (0.6 + 0.4 * fxHash01(view.id, i * 3 + 1));
18369
+ const len = size * 0.35;
18370
+ return {
18371
+ type: "draw-shape",
18372
+ shape: "ellipse",
18373
+ position: pos,
18374
+ anchor: "center",
18375
+ offsetX: inner + len / 2,
18376
+ offsetY: 0,
18377
+ radiusX: len / 2,
18378
+ radiusY: size * 0.04,
18379
+ rotate: angle,
18380
+ fill: color,
18381
+ blendMode: "lighter",
18382
+ opacity: fade,
18383
+ ...view.glow ? { shadow: { color, blur: view.glow } } : {}
18384
+ };
18385
+ });
18386
+ }
18387
+ default: {
18388
+ const count = view.count ?? 6;
18389
+ return Array.from({ length: count }, (_, i) => sparkShape(view, pos, i, fade, progress));
18390
+ }
18391
+ }
18392
+ }
18393
+ function expandFxItem(view, node, epochNowMs, dim) {
18394
+ if (view.space === "screen") return [];
18395
+ const tickMs = node.tickMs ?? DEFAULT_TICK_MS;
18396
+ const { ageMs, progress, fade } = fxLifecycle(view, epochNowMs, tickMs);
18397
+ if (progress >= 1) return [];
18398
+ const pos = fxPosition(view, dim, ageMs / 1e3);
18399
+ if (!pos) return [];
18400
+ const out = [];
18401
+ const artItems = node.art?.[view.type]?.["idle"];
18402
+ const sprite = node.sprites?.[view.type];
18403
+ if (Array.isArray(artItems)) {
18404
+ out.push({
18405
+ type: "draw-group",
18406
+ position: pos,
18407
+ opacity: fade,
18408
+ ...view.size !== void 0 ? { scale: view.size } : {},
18409
+ items: artItems
18410
+ });
18411
+ } else if (sprite?.url) {
18412
+ const spriteSize = view.size ?? 0.6;
18413
+ out.push({
18414
+ type: "draw-sprite",
18415
+ position: pos,
18416
+ asset: sprite,
18417
+ anchor: "center",
18418
+ width: spriteSize,
18419
+ height: spriteSize,
18420
+ opacity: fade
18421
+ });
18422
+ } else {
18423
+ out.push(...proceduralShapes(view, pos, fade, progress));
18424
+ }
18425
+ if (view.message) {
18426
+ const text = {
18427
+ type: "draw-text",
18428
+ text: view.message,
18429
+ position: pos,
18430
+ offsetY: -(0.15 + 0.55 * progress),
18431
+ color: view.color ?? node.textColor ?? DEFAULT_TEXT_COLOR,
18432
+ opacity: fade
18433
+ };
18434
+ out.push(text);
18435
+ }
18436
+ return out;
18437
+ }
18438
+ function expandFxLayer(node, epochNowMs, dim) {
18439
+ if (!Array.isArray(node.items)) return [];
18440
+ const out = [];
18441
+ for (const item of node.items) {
18442
+ if (!item || typeof item.id !== "string") continue;
18443
+ out.push(...expandFxItem(resolveFxView(item, node.presets), node, epochNowMs, dim));
18444
+ }
18445
+ return out;
18446
+ }
18447
+ function DrawFxLayer(_props) {
18448
+ return null;
18449
+ }
18450
+ var DEFAULT_TICK_MS, DEFAULT_TEXT_COLOR, DEFAULT_SPARK_COLOR, easeOut2;
18451
+ var init_DrawFxLayer = __esm({
18452
+ "components/game/molecules/DrawFxLayer.tsx"() {
18453
+ "use client";
18454
+ init_fx();
18455
+ DEFAULT_TICK_MS = 500;
18456
+ DEFAULT_TEXT_COLOR = "#ffe066";
18457
+ DEFAULT_SPARK_COLOR = "#ffffff";
18458
+ easeOut2 = (t) => 1 - (1 - t) * (1 - t);
18459
+ }
18460
+ });
18250
18461
  function paintDrawable(painter, node, dctx) {
18251
18462
  switch (node.type) {
18252
18463
  case "draw-sprite":
@@ -18294,6 +18505,11 @@ function paintDrawable(painter, node, dctx) {
18294
18505
  case "draw-text-layer":
18295
18506
  paintTextLayer(painter, node, dctx);
18296
18507
  break;
18508
+ case "draw-fx-layer": {
18509
+ const epochNow = dctx.time > 0 && typeof performance !== "undefined" ? performance.timeOrigin + dctx.time : 0;
18510
+ for (const child of expandFxLayer(node, epochNow, "2d")) paintDrawable(painter, child, dctx);
18511
+ break;
18512
+ }
18297
18513
  }
18298
18514
  }
18299
18515
  var paint2dLog, warnedUnsupported2d, warnUnsupported2d;
@@ -18308,6 +18524,7 @@ var init_paintDispatch = __esm({
18308
18524
  init_DrawSpriteLayer();
18309
18525
  init_DrawShapeLayer();
18310
18526
  init_DrawTextLayer();
18527
+ init_DrawFxLayer();
18311
18528
  paint2dLog = createLogger("almadar:ui:drawable-2d");
18312
18529
  warnedUnsupported2d = /* @__PURE__ */ new Set();
18313
18530
  warnUnsupported2d = (kind) => {
@@ -18556,6 +18773,7 @@ function Canvas2D({
18556
18773
  return isAnimatedGroup(node) || Array.isArray(node.items) && node.items.some(drawableIsAnimated);
18557
18774
  if (node.type === "draw-shape-layer") return Array.isArray(node.items) && node.items.some(isAnimatedShape);
18558
18775
  if (node.type === "draw-sprite-layer") return Array.isArray(node.items) && node.items.some(isAnimatedSprite);
18776
+ if (node.type === "draw-fx-layer") return Array.isArray(node.items) && node.items.length > 0;
18559
18777
  return false;
18560
18778
  };
18561
18779
  const animRafRef = useRef(0);
@@ -26478,6 +26696,196 @@ var init_PageTransition = __esm({
26478
26696
  PageTransition.displayName = "PageTransition";
26479
26697
  }
26480
26698
  });
26699
+ function ConfettiBurst({ item, lifeMs }) {
26700
+ const particles = createConfettiParticles(item.particleCount ?? 30, item.id);
26701
+ const left = (item.x ?? 0.5) * 100;
26702
+ const top = (item.z ?? item.y ?? 0.4) * 100;
26703
+ return /* @__PURE__ */ jsx(Box, { position: "absolute", style: { left: `${left}%`, top: `${top}%` }, children: particles.map((p) => {
26704
+ const rad = p.angle * Math.PI / 180;
26705
+ const tx = Math.cos(rad) * p.distance * (item.size ?? 1);
26706
+ const ty = Math.sin(rad) * p.distance * (item.size ?? 1) - 20;
26707
+ return /* @__PURE__ */ jsx(
26708
+ Box,
26709
+ {
26710
+ className: "absolute rounded-sm",
26711
+ style: {
26712
+ left: (p.left - 50) * 2,
26713
+ top: -10,
26714
+ width: p.size,
26715
+ height: p.size,
26716
+ backgroundColor: item.color ?? p.color,
26717
+ animation: `confetti-burst ${Math.max(lifeMs - p.delay, 200)}ms ease-out ${p.delay}ms forwards`,
26718
+ opacity: 0,
26719
+ "--confetti-tx": `${tx}px`,
26720
+ "--confetti-ty": `${ty}px`,
26721
+ "--confetti-rotate": `${p.rotation}deg`
26722
+ }
26723
+ },
26724
+ p.id
26725
+ );
26726
+ }) });
26727
+ }
26728
+ function SparkleBurst({ item, lifeMs }) {
26729
+ const count = item.particleCount ?? 8;
26730
+ const scale = item.size ?? 1;
26731
+ const left = (item.x ?? 0.5) * 100;
26732
+ const top = (item.z ?? item.y ?? 0.4) * 100;
26733
+ return /* @__PURE__ */ jsx(Box, { position: "absolute", style: { left: `${left}%`, top: `${top}%` }, children: Array.from({ length: count }, (_, i) => {
26734
+ const dx = (fxHash01(item.id, i * 4) - 0.5) * 160 * scale;
26735
+ const dy = (fxHash01(item.id, i * 4 + 1) - 0.5) * 120 * scale;
26736
+ const dot = (4 + fxHash01(item.id, i * 4 + 2) * 5) * scale;
26737
+ const delay = fxHash01(item.id, i * 4 + 3) * lifeMs * 0.4;
26738
+ return /* @__PURE__ */ jsx(
26739
+ Box,
26740
+ {
26741
+ className: "absolute rounded-full",
26742
+ style: {
26743
+ left: dx,
26744
+ top: dy,
26745
+ width: dot,
26746
+ height: dot,
26747
+ backgroundColor: item.color ?? "gold",
26748
+ opacity: 0,
26749
+ animation: `fx-overlay-sparkle ${Math.max(lifeMs - delay, 200)}ms ease-in-out ${delay}ms forwards`
26750
+ }
26751
+ },
26752
+ i
26753
+ );
26754
+ }) });
26755
+ }
26756
+ function OverlayFxNode({ item, tickMs }) {
26757
+ const lifeMs = lifeMsOf(item, tickMs);
26758
+ switch (item.effect ?? "sparkle") {
26759
+ case "confetti":
26760
+ return /* @__PURE__ */ jsx(ConfettiBurst, { item, lifeMs });
26761
+ case "flash":
26762
+ return /* @__PURE__ */ jsx(
26763
+ Box,
26764
+ {
26765
+ position: "absolute",
26766
+ className: "inset-0",
26767
+ style: {
26768
+ backgroundColor: item.color ?? "#ffffff",
26769
+ opacity: 0,
26770
+ animation: `fx-overlay-flash ${lifeMs}ms ease-out forwards`
26771
+ }
26772
+ }
26773
+ );
26774
+ case "streak-glow":
26775
+ return /* @__PURE__ */ jsx(
26776
+ Box,
26777
+ {
26778
+ position: "absolute",
26779
+ className: "inset-0",
26780
+ style: {
26781
+ boxShadow: `inset 0 0 ${60 * (item.size ?? 1)}px ${item.color ?? "var(--color-warning)"}`,
26782
+ opacity: 0,
26783
+ animation: `fx-overlay-glow ${lifeMs}ms ease-in-out forwards`
26784
+ }
26785
+ }
26786
+ );
26787
+ case "float-text": {
26788
+ if (!item.message) return null;
26789
+ return /* @__PURE__ */ jsx(
26790
+ Box,
26791
+ {
26792
+ position: "absolute",
26793
+ style: {
26794
+ left: `${(item.x ?? 0.5) * 100}%`,
26795
+ top: `${(item.z ?? item.y ?? 0.4) * 100}%`,
26796
+ color: item.color ?? "var(--color-success)",
26797
+ fontWeight: 700,
26798
+ fontSize: 16 * (item.size ?? 1),
26799
+ textShadow: "0 1px 2px rgba(0,0,0,0.4)",
26800
+ opacity: 0,
26801
+ animation: `fx-overlay-float ${lifeMs}ms ease-out forwards`,
26802
+ whiteSpace: "nowrap"
26803
+ },
26804
+ children: item.message
26805
+ }
26806
+ );
26807
+ }
26808
+ case "shake":
26809
+ return null;
26810
+ default:
26811
+ return /* @__PURE__ */ jsx(SparkleBurst, { item, lifeMs });
26812
+ }
26813
+ }
26814
+ var DEFAULT_TICK_MS2, FX_OVERLAY_KEYFRAMES, lifeMsOf, FxOverlay;
26815
+ var init_FxOverlay = __esm({
26816
+ "components/core/molecules/FxOverlay.tsx"() {
26817
+ "use client";
26818
+ init_cn();
26819
+ init_Box();
26820
+ init_fx();
26821
+ DEFAULT_TICK_MS2 = 500;
26822
+ FX_OVERLAY_KEYFRAMES = `
26823
+ ${CONFETTI_BURST_KEYFRAMES}
26824
+ @keyframes fx-overlay-flash {
26825
+ 0% { opacity: 0.75; }
26826
+ 100% { opacity: 0; }
26827
+ }
26828
+ @keyframes fx-overlay-glow {
26829
+ 0% { opacity: 0.9; }
26830
+ 60% { opacity: 0.6; }
26831
+ 100% { opacity: 0; }
26832
+ }
26833
+ @keyframes fx-overlay-sparkle {
26834
+ 0% { opacity: 0; transform: scale(0); }
26835
+ 30% { opacity: 1; transform: scale(1); }
26836
+ 100% { opacity: 0; transform: scale(0.3); }
26837
+ }
26838
+ @keyframes fx-overlay-float {
26839
+ 0% { opacity: 0; transform: translate(-50%, 8px); }
26840
+ 15% { opacity: 1; }
26841
+ 100% { opacity: 0; transform: translate(-50%, -40px); }
26842
+ }
26843
+ @keyframes fx-overlay-shake {
26844
+ 0% { transform: translateX(0); }
26845
+ 15% { transform: translateX(-6px); }
26846
+ 30% { transform: translateX(5px); }
26847
+ 45% { transform: translateX(-4px); }
26848
+ 60% { transform: translateX(3px); }
26849
+ 75% { transform: translateX(-2px); }
26850
+ 100% { transform: translateX(0); }
26851
+ }
26852
+ `;
26853
+ lifeMsOf = (it, tickMs) => Math.max(it.maxTtl ?? it.ttl, it.ttl, 1) * tickMs;
26854
+ FxOverlay = ({ items, tickMs = DEFAULT_TICK_MS2, children, className }) => {
26855
+ const screenItems = (Array.isArray(items) ? items : []).filter(
26856
+ (it) => Boolean(it) && typeof it.id === "string" && it.space !== "world"
26857
+ );
26858
+ const shakeItem = [...screenItems].reverse().find((it) => it.effect === "shake");
26859
+ const overlay = /* @__PURE__ */ jsxs(
26860
+ Box,
26861
+ {
26862
+ position: "absolute",
26863
+ className: cn("inset-0 pointer-events-none overflow-hidden z-50", !children && className),
26864
+ "aria-hidden": "true",
26865
+ children: [
26866
+ screenItems.map((it) => /* @__PURE__ */ jsx(OverlayFxNode, { item: it, tickMs }, it.id)),
26867
+ /* @__PURE__ */ jsx("style", { children: FX_OVERLAY_KEYFRAMES })
26868
+ ]
26869
+ }
26870
+ );
26871
+ if (children !== void 0 && children !== null) {
26872
+ return /* @__PURE__ */ jsxs(Box, { position: "relative", className, children: [
26873
+ /* @__PURE__ */ jsx(
26874
+ Box,
26875
+ {
26876
+ style: shakeItem ? { animation: `fx-overlay-shake ${Math.min(lifeMsOf(shakeItem, tickMs), 600)}ms ease-in-out` } : void 0,
26877
+ children
26878
+ },
26879
+ shakeItem?.id ?? "steady"
26880
+ ),
26881
+ overlay
26882
+ ] });
26883
+ }
26884
+ return overlay;
26885
+ };
26886
+ FxOverlay.displayName = "FxOverlay";
26887
+ }
26888
+ });
26481
26889
  function computePopoverStyle(position, triggerRect, popoverWidth) {
26482
26890
  if (position === "left" || position === "right") {
26483
26891
  return {
@@ -31167,7 +31575,7 @@ var init_MathCanvas = __esm({
31167
31575
  x: mapX((first.x + last.x) / 2),
31168
31576
  y: (mapY(region.samples[mid].y) + mapY(baseline)) / 2,
31169
31577
  text: region.label,
31170
- color: "#111827",
31578
+ color,
31171
31579
  fontSize: 11
31172
31580
  });
31173
31581
  }
@@ -31200,14 +31608,14 @@ var init_MathCanvas = __esm({
31200
31608
  const px = mapX(guide.at);
31201
31609
  out.push({ type: "line", x1: px, y1: margin, x2: px, y2: height - margin, color, dash });
31202
31610
  if (guide.label) {
31203
- out.push({ type: "text", x: px + 4, y: margin + 10, text: guide.label, color: "#111827", fontSize: 11 });
31611
+ out.push({ type: "text", x: px + 4, y: margin + 10, text: guide.label, color, fontSize: 11 });
31204
31612
  }
31205
31613
  } else {
31206
31614
  if (guide.at < yMin || guide.at > yMax) continue;
31207
31615
  const py = mapY(guide.at);
31208
31616
  out.push({ type: "line", x1: margin, y1: py, x2: width - margin, y2: py, color, dash });
31209
31617
  if (guide.label) {
31210
- out.push({ type: "text", x: width - margin - 4, y: py - 8, text: guide.label, color: "#111827", fontSize: 11, align: "right" });
31618
+ out.push({ type: "text", x: width - margin - 4, y: py - 8, text: guide.label, color, fontSize: 11, align: "right" });
31211
31619
  }
31212
31620
  }
31213
31621
  }
@@ -31273,7 +31681,7 @@ var init_MathCanvas = __esm({
31273
31681
  x: (x1 + x2) / 2,
31274
31682
  y: xAxisY - peak - 8,
31275
31683
  text: hop.label,
31276
- color: "#111827",
31684
+ color,
31277
31685
  fontSize: 10,
31278
31686
  align: "center"
31279
31687
  });
@@ -31300,7 +31708,7 @@ var init_MathCanvas = __esm({
31300
31708
  x: mapX(angle.x + 1.35 * radius * Math.cos(rad)),
31301
31709
  y: mapY(angle.y + 1.35 * radius * Math.sin(rad)),
31302
31710
  text: angle.label,
31303
- color: "#111827",
31711
+ color,
31304
31712
  fontSize: 11,
31305
31713
  align: "center"
31306
31714
  });
@@ -31318,7 +31726,7 @@ var init_MathCanvas = __esm({
31318
31726
  fill: isOpen ? "#ffffff" : p.color ?? "#dc2626"
31319
31727
  });
31320
31728
  if (p.label) {
31321
- out.push({ type: "text", x: mapX(p.x) + 8, y: mapY(p.y) - 8, text: p.label, color: "#111827", fontSize: 12 });
31729
+ out.push({ type: "text", x: mapX(p.x) + 8, y: mapY(p.y) - 8, text: p.label, color: p.color ?? "#111827", fontSize: 12 });
31322
31730
  }
31323
31731
  }
31324
31732
  for (const v of vectors) {
@@ -31329,7 +31737,7 @@ var init_MathCanvas = __esm({
31329
31737
  const y2 = mapY(v.y + v.vy);
31330
31738
  out.push({ type: "arrow", x1, y1, x2, y2, color: v.color ?? "#7c3aed", lineWidth: 2 });
31331
31739
  if (v.label) {
31332
- out.push({ type: "text", x: x2 + 6, y: y2 - 6, text: v.label, color: "#111827", fontSize: 12 });
31740
+ out.push({ type: "text", x: x2 + 6, y: y2 - 6, text: v.label, color: v.color ?? "#7c3aed", fontSize: 12 });
31333
31741
  }
31334
31742
  }
31335
31743
  out.push(...shapes);
@@ -42305,6 +42713,7 @@ var init_molecules2 = __esm({
42305
42713
  init_Menu();
42306
42714
  init_Modal();
42307
42715
  init_PageTransition();
42716
+ init_FxOverlay();
42308
42717
  init_Pagination();
42309
42718
  init_Popover();
42310
42719
  init_Coachmark();
@@ -49226,6 +49635,7 @@ var init_component_registry_generated = __esm({
49226
49635
  init_DocSidebar();
49227
49636
  init_DocTOC();
49228
49637
  init_DocumentViewer();
49638
+ init_DrawFxLayer();
49229
49639
  init_DrawGroup();
49230
49640
  init_DrawMesh();
49231
49641
  init_DrawShape();
@@ -49256,6 +49666,7 @@ var init_component_registry_generated = __esm({
49256
49666
  init_FormField();
49257
49667
  init_FormSection();
49258
49668
  init_FormSectionHeader();
49669
+ init_FxOverlay();
49259
49670
  init_GameAudioToggle();
49260
49671
  init_GameHud();
49261
49672
  init_GameIcon();
@@ -49496,6 +49907,7 @@ var init_component_registry_generated = __esm({
49496
49907
  "DocSidebar": DocSidebar,
49497
49908
  "DocTOC": DocTOC,
49498
49909
  "DocumentViewer": DocumentViewer,
49910
+ "DrawFxLayer": DrawFxLayer,
49499
49911
  "DrawGroup": DrawGroup,
49500
49912
  "DrawMesh": DrawMesh,
49501
49913
  "DrawShape": DrawShape,
@@ -49526,6 +49938,7 @@ var init_component_registry_generated = __esm({
49526
49938
  "FormField": FormField,
49527
49939
  "FormLayout": FormLayout,
49528
49940
  "FormSectionHeader": FormSectionHeader,
49941
+ "FxOverlay": FxOverlay,
49529
49942
  "GameAudioToggle": GameAudioToggle,
49530
49943
  "GameHud": GameHud,
49531
49944
  "GameIcon": GameIcon,
@@ -53201,4 +53614,4 @@ function useGitHubBranches(owner, repo, enabled = true) {
53201
53614
  });
53202
53615
  }
53203
53616
 
53204
- export { ALL_PRESETS, ALMADAR_DND_MIME, AR_BOOK_FIELDS, AboutPageTemplate, Accordion, Card2 as ActionCard, ActionPalette, ActionTile, ActivationBlock, Alert, AlgoGraphCanvas, AlgorithmCanvas, AnimatedCounter, AnimatedGraphic, AnimatedReveal, ArticleSection, Aside, AssetPicker, AtlasImage, AtlasPanel, AuthLayout, Avatar, Badge, BehaviorView, BiologyCanvas, BloomQuizBlock, BookChapterView, BookCoverPage, BookNavBar, BookTableOfContents, BookViewer, Box, BranchingLogicBuilder, Breadcrumb, Button, ButtonGroup, CTABanner, CalendarGrid, Canvas, Canvas2D, Card, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, CaseStudyCard, CaseStudyOrganism, Center, Chart, ChartLegend, ChatBar, Checkbox, ChemistryCanvas, ChoiceButton, Coachmark, CodeBlock, CodeRunnerPanel, CollapsibleSection, CommunityLinks, ConditionalWrapper, ConfettiEffect, ConfirmDialog, ConnectionBlock, Container, ContentRenderer, ContentSection, ControlButton, ControlGrid, CounterTemplate, DEFAULT_LIKERT_OPTIONS, DEFAULT_MATRIX_COLUMNS, DEFAULT_SLOTS, DIAMOND_TOP_Y, DashboardGrid, DashboardLayout, DataGrid, DataList, DataTable, DateRangePicker, DateRangeSelector, DayCell, DetailPanel, Dialog, DialogueBubble, Divider, DocBreadcrumb, DocPagination, DocSearch, DocSidebar, DocTOC, DocumentViewer, StateMachineView as DomStateMachineVisualizer, Drawer, DrawerSlot, ELEMENT_SELECTED_EVENT, EdgeDecoration, EditorCheckbox, EditorSelect, EditorSlider, EditorTextInput, EditorToolbar, EmojiPicker, EmptyState, EntityDisplayEvents, ErrorBoundary, ErrorState, FEATURE_COLORS, FEATURE_TYPES, FLOOR_HEIGHT, FeatureCard, FeatureDetailPageTemplate, FeatureGrid, FeatureGridOrganism, FileTree, FilterGroup, FilterPill, Flex, FlipCard, FlipContainer, FloatingActionButton, Form, FormActions, FormField, FormLayout, FormSection, FormSectionHeader, GameAudioToggle, GameHud, GameIcon, GameMenu, GameShell, GenericAppTemplate, GeometricPattern, GradientDivider, GraphCanvas, GraphView, Grid, GridPicker, HStack, Header, HealthBar, HeroOrganism, HeroSection, I18nProvider, IDENTITY_BOOK_FIELDS, Icon, IconPicker, ImportPreviewTree, ImportProgress, ImportSourcePicker, InfiniteScrollSentinel, Input, InputGroup, InstallBox, JazariStateMachine, JsonTreeEditor, Label, LandingPageTemplate, LawReferenceTooltip, LearningCanvas, LearningScene3D, Lightbox, LikertScale, LineChart2 as LineChart, List3 as List, LoadingState, MapView, MarkdownContent, MarketingFooter, MarketingStatCard, MasterDetail, MasterDetailLayout, MathCanvas, MatrixQuestion, MediaGallery, Menu, Meter, Modal, ModalSlot, ModuleCard, Navigation, NodeSlotEditor, NotifyListener, NumberStepper, OnboardingSpotlight, OptionConstraintGroup, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, Overlay, PageHeader, PageTransition, Pagination, PatternTile, PhysicsCanvas, Popover, PositionedCanvas, Presence, PricingCard, PricingGrid, PricingOrganism, PricingPageTemplate, ProgressBar, ProgressDots, PropertyInspector, PullQuote, PullToRefresh, QrScanner, QuizBlock, Radio, RangeSlider, ReflectionBlock, RelationSelect, RepeatableFormSection, ReplyTree, RichBlockEditor, RuntimeDebugger, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, ScoreDisplay, SearchInput, Section, SectionHeader, SegmentRenderer, Select, SequenceBar, ServiceCatalog, SharedEntityStoreContext, ShowcaseCard, ShowcaseOrganism, SidePanel, Sidebar, SignaturePad, SimpleGrid, Skeleton, SlotContentRenderer, SocialProof, SortableList, Spacer, Sparkline, Spinner, Split, SplitPane, SplitSection, Stack, StarRating, StatBadge, StatCard, StatDisplay, StateGraph, StateJsonView, StateMachineView, StateNode2 as StateNode, StatsGrid, StatsOrganism, StatusBar, StatusDot, StepFlow, StepFlowOrganism, SubagentTracePanel, SvgBranch, SvgConnection, SvgFlow, SvgGrid, SvgLobe, SvgMesh, SvgMorph, SvgNode, SvgPulse, SvgRing, SvgShield, SvgStack, SwipeableRow, Switch, TERRAIN_COLORS, TILE_HEIGHT, TILE_WIDTH, TabbedContainer, TableView, Tabs, TagCloud, TagInput, TeamCard, TeamOrganism, TerrainPalette, TextHighlight, Textarea, ThemeToggle, TimeSlotCell, Timeline, TimerDisplay, Toast, ToastSlot, Tooltip, TraitFrame, TraitSlot, TraitStateViewer, TransitionArrow, TrendIndicator, TypewriterText, Typography, UISlotComponent, UISlotRenderer, UploadDropZone, VStack, VersionDiff, ViolationAlert, VoteStack, WizardContainer, WizardNavigation, WizardProgress, arrowBetween, billboardLabel, boardEntity, bool, calculateAttackTargets, calculateValidMoves, cn, createInitialGameState, createSharedEntityStore, createTranslate, createUnitAnimationState, cylinderBetween, get3DClickPayload, getCurrentFrame, getTileDimensions, inferDirection, isoToScreen, makeAsset, makeAssetMap, mapBookData, meshSphere, num, objAvailableActions, objAvailableEvents, objCurrentState, objIcon, objId, objMaxRules, objName, objRules, objStates, parseEditFocus, parseLessonSegments, parseMarkdownWithCodeBlocks, parseQueryBinding, pendulum, projectileMotion, registerCodeLanguageLoader, renderPatternValue, resolveFieldMap, resolveFrame, resolveSheetDirection, rows, runTickFrame, screenToIso, springOscillator, str, tickAnimationState, toCodeLanguage, transitionAnimation, unitHealth, unitPosition, unitTeam, useAgentChat, useAnchorRect, useAtlasSliceDataUrl, useAuthContext, useCamera, useCanvasGestures, useCompile, useConnectGitHub, useDeepAgentGeneration, useDisconnectGitHub, useDragReorder, useDraggable, useDropZone, useEmitEvent, useEventBus, useEventListener, useExtensions, useFileEditor, useFileSystem, useGameAudio, useGitHubBranches, useGitHubRepo, useGitHubRepos, useGitHubStatus, useImageCache, useInfiniteScroll, useLongPress, useMediaQuery, useOrbitalHistory, usePresence, usePreview, usePullToRefresh, useQuerySingleton, useRenderInterpolation, useSharedEntitySnapshot, useSharedEntityStore, useSharedEntityStoreContext, useSwipeGesture, useTapReveal, useTraitListens, useTranslate114 as useTranslate, useUIEvents, useUISlotManager, useUnitSpriteAtlas, useValidation, vec2 };
53617
+ export { ALL_PRESETS, ALMADAR_DND_MIME, AR_BOOK_FIELDS, AboutPageTemplate, Accordion, Card2 as ActionCard, ActionPalette, ActionTile, ActivationBlock, Alert, AlgoGraphCanvas, AlgorithmCanvas, AnimatedCounter, AnimatedGraphic, AnimatedReveal, ArticleSection, Aside, AssetPicker, AtlasImage, AtlasPanel, AuthLayout, Avatar, Badge, BehaviorView, BiologyCanvas, BloomQuizBlock, BookChapterView, BookCoverPage, BookNavBar, BookTableOfContents, BookViewer, Box, BranchingLogicBuilder, Breadcrumb, Button, ButtonGroup, CTABanner, CalendarGrid, Canvas, Canvas2D, Card, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, CaseStudyCard, CaseStudyOrganism, Center, Chart, ChartLegend, ChatBar, Checkbox, ChemistryCanvas, ChoiceButton, Coachmark, CodeBlock, CodeRunnerPanel, CollapsibleSection, CommunityLinks, ConditionalWrapper, ConfettiEffect, ConfirmDialog, ConnectionBlock, Container, ContentRenderer, ContentSection, ControlButton, ControlGrid, CounterTemplate, DEFAULT_LIKERT_OPTIONS, DEFAULT_MATRIX_COLUMNS, DEFAULT_SLOTS, DIAMOND_TOP_Y, DashboardGrid, DashboardLayout, DataGrid, DataList, DataTable, DateRangePicker, DateRangeSelector, DayCell, DetailPanel, Dialog, DialogueBubble, Divider, DocBreadcrumb, DocPagination, DocSearch, DocSidebar, DocTOC, DocumentViewer, StateMachineView as DomStateMachineVisualizer, Drawer, DrawerSlot, ELEMENT_SELECTED_EVENT, EdgeDecoration, EditorCheckbox, EditorSelect, EditorSlider, EditorTextInput, EditorToolbar, EmojiPicker, EmptyState, EntityDisplayEvents, ErrorBoundary, ErrorState, FEATURE_COLORS, FEATURE_TYPES, FLOOR_HEIGHT, FeatureCard, FeatureDetailPageTemplate, FeatureGrid, FeatureGridOrganism, FileTree, FilterGroup, FilterPill, Flex, FlipCard, FlipContainer, FloatingActionButton, Form, FormActions, FormField, FormLayout, FormSection, FormSectionHeader, FxOverlay, GameAudioToggle, GameHud, GameIcon, GameMenu, GameShell, GenericAppTemplate, GeometricPattern, GradientDivider, GraphCanvas, GraphView, Grid, GridPicker, HStack, Header, HealthBar, HeroOrganism, HeroSection, I18nProvider, IDENTITY_BOOK_FIELDS, Icon, IconPicker, ImportPreviewTree, ImportProgress, ImportSourcePicker, InfiniteScrollSentinel, Input, InputGroup, InstallBox, JazariStateMachine, JsonTreeEditor, Label, LandingPageTemplate, LawReferenceTooltip, LearningCanvas, LearningScene3D, Lightbox, LikertScale, LineChart2 as LineChart, List3 as List, LoadingState, MapView, MarkdownContent, MarketingFooter, MarketingStatCard, MasterDetail, MasterDetailLayout, MathCanvas, MatrixQuestion, MediaGallery, Menu, Meter, Modal, ModalSlot, ModuleCard, Navigation, NodeSlotEditor, NotifyListener, NumberStepper, OnboardingSpotlight, OptionConstraintGroup, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, Overlay, PageHeader, PageTransition, Pagination, PatternTile, PhysicsCanvas, Popover, PositionedCanvas, Presence, PricingCard, PricingGrid, PricingOrganism, PricingPageTemplate, ProgressBar, ProgressDots, PropertyInspector, PullQuote, PullToRefresh, QrScanner, QuizBlock, Radio, RangeSlider, ReflectionBlock, RelationSelect, RepeatableFormSection, ReplyTree, RichBlockEditor, RuntimeDebugger, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, ScoreDisplay, SearchInput, Section, SectionHeader, SegmentRenderer, Select, SequenceBar, ServiceCatalog, SharedEntityStoreContext, ShowcaseCard, ShowcaseOrganism, SidePanel, Sidebar, SignaturePad, SimpleGrid, Skeleton, SlotContentRenderer, SocialProof, SortableList, Spacer, Sparkline, Spinner, Split, SplitPane, SplitSection, Stack, StarRating, StatBadge, StatCard, StatDisplay, StateGraph, StateJsonView, StateMachineView, StateNode2 as StateNode, StatsGrid, StatsOrganism, StatusBar, StatusDot, StepFlow, StepFlowOrganism, SubagentTracePanel, SvgBranch, SvgConnection, SvgFlow, SvgGrid, SvgLobe, SvgMesh, SvgMorph, SvgNode, SvgPulse, SvgRing, SvgShield, SvgStack, SwipeableRow, Switch, TERRAIN_COLORS, TILE_HEIGHT, TILE_WIDTH, TabbedContainer, TableView, Tabs, TagCloud, TagInput, TeamCard, TeamOrganism, TerrainPalette, TextHighlight, Textarea, ThemeToggle, TimeSlotCell, Timeline, TimerDisplay, Toast, ToastSlot, Tooltip, TraitFrame, TraitSlot, TraitStateViewer, TransitionArrow, TrendIndicator, TypewriterText, Typography, UISlotComponent, UISlotRenderer, UploadDropZone, VStack, VersionDiff, ViolationAlert, VoteStack, WizardContainer, WizardNavigation, WizardProgress, arrowBetween, billboardLabel, boardEntity, bool, calculateAttackTargets, calculateValidMoves, cn, createInitialGameState, createSharedEntityStore, createTranslate, createUnitAnimationState, cylinderBetween, get3DClickPayload, getCurrentFrame, getTileDimensions, inferDirection, isoToScreen, makeAsset, makeAssetMap, mapBookData, meshSphere, num, objAvailableActions, objAvailableEvents, objCurrentState, objIcon, objId, objMaxRules, objName, objRules, objStates, parseEditFocus, parseLessonSegments, parseMarkdownWithCodeBlocks, parseQueryBinding, pendulum, projectileMotion, registerCodeLanguageLoader, renderPatternValue, resolveFieldMap, resolveFrame, resolveSheetDirection, rows, runTickFrame, screenToIso, springOscillator, str, tickAnimationState, toCodeLanguage, transitionAnimation, unitHealth, unitPosition, unitTeam, useAgentChat, useAnchorRect, useAtlasSliceDataUrl, useAuthContext, useCamera, useCanvasGestures, useCompile, useConnectGitHub, useDeepAgentGeneration, useDisconnectGitHub, useDragReorder, useDraggable, useDropZone, useEmitEvent, useEventBus, useEventListener, useExtensions, useFileEditor, useFileSystem, useGameAudio, useGitHubBranches, useGitHubRepo, useGitHubRepos, useGitHubStatus, useImageCache, useInfiniteScroll, useLongPress, useMediaQuery, useOrbitalHistory, usePresence, usePreview, usePullToRefresh, useQuerySingleton, useRenderInterpolation, useSharedEntitySnapshot, useSharedEntityStore, useSharedEntityStoreContext, useSwipeGesture, useTapReveal, useTraitListens, useTranslate114 as useTranslate, useUIEvents, useUISlotManager, useUnitSpriteAtlas, useValidation, vec2 };