@almadar/ui 5.9.5 → 5.9.6

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.
@@ -30396,6 +30396,8 @@ function GameCanvas2D({
30396
30396
  height = 600,
30397
30397
  onDraw,
30398
30398
  onTick,
30399
+ tickEvent,
30400
+ drawEvent,
30399
30401
  fps = 60,
30400
30402
  className
30401
30403
  }) {
@@ -30403,10 +30405,17 @@ function GameCanvas2D({
30403
30405
  const rafRef = React98__namespace.useRef(0);
30404
30406
  const frameRef = React98__namespace.useRef(0);
30405
30407
  const lastTimeRef = React98__namespace.useRef(0);
30408
+ const emit = useEmitEvent();
30406
30409
  const onDrawRef = React98__namespace.useRef(onDraw);
30407
30410
  onDrawRef.current = onDraw;
30408
30411
  const onTickRef = React98__namespace.useRef(onTick);
30409
30412
  onTickRef.current = onTick;
30413
+ const tickEventRef = React98__namespace.useRef(tickEvent);
30414
+ tickEventRef.current = tickEvent;
30415
+ const drawEventRef = React98__namespace.useRef(drawEvent);
30416
+ drawEventRef.current = drawEvent;
30417
+ const emitRef = React98__namespace.useRef(emit);
30418
+ emitRef.current = emit;
30410
30419
  React98__namespace.useEffect(() => {
30411
30420
  const canvas = canvasRef.current;
30412
30421
  if (!canvas) return;
@@ -30423,8 +30432,15 @@ function GameCanvas2D({
30423
30432
  if (elapsed >= interval) {
30424
30433
  const dt = elapsed / 1e3;
30425
30434
  lastTimeRef.current = timestamp - elapsed % interval;
30435
+ const frame = frameRef.current;
30426
30436
  onTickRef.current?.(dt);
30427
- onDrawRef.current?.(ctx, frameRef.current);
30437
+ if (tickEventRef.current) {
30438
+ emitRef.current(tickEventRef.current, { dt, frame });
30439
+ }
30440
+ onDrawRef.current?.(ctx, frame);
30441
+ if (drawEventRef.current) {
30442
+ emitRef.current(drawEventRef.current, { frame });
30443
+ }
30428
30444
  frameRef.current += 1;
30429
30445
  }
30430
30446
  rafRef.current = requestAnimationFrame(loop);
@@ -30450,6 +30466,7 @@ var init_GameCanvas2D = __esm({
30450
30466
  "use client";
30451
30467
  init_cn();
30452
30468
  init_Box();
30469
+ init_useEventBus();
30453
30470
  GameCanvas2D.displayName = "GameCanvas2D";
30454
30471
  }
30455
30472
  });
package/dist/avl/index.js CHANGED
@@ -30347,6 +30347,8 @@ function GameCanvas2D({
30347
30347
  height = 600,
30348
30348
  onDraw,
30349
30349
  onTick,
30350
+ tickEvent,
30351
+ drawEvent,
30350
30352
  fps = 60,
30351
30353
  className
30352
30354
  }) {
@@ -30354,10 +30356,17 @@ function GameCanvas2D({
30354
30356
  const rafRef = React98.useRef(0);
30355
30357
  const frameRef = React98.useRef(0);
30356
30358
  const lastTimeRef = React98.useRef(0);
30359
+ const emit = useEmitEvent();
30357
30360
  const onDrawRef = React98.useRef(onDraw);
30358
30361
  onDrawRef.current = onDraw;
30359
30362
  const onTickRef = React98.useRef(onTick);
30360
30363
  onTickRef.current = onTick;
30364
+ const tickEventRef = React98.useRef(tickEvent);
30365
+ tickEventRef.current = tickEvent;
30366
+ const drawEventRef = React98.useRef(drawEvent);
30367
+ drawEventRef.current = drawEvent;
30368
+ const emitRef = React98.useRef(emit);
30369
+ emitRef.current = emit;
30361
30370
  React98.useEffect(() => {
30362
30371
  const canvas = canvasRef.current;
30363
30372
  if (!canvas) return;
@@ -30374,8 +30383,15 @@ function GameCanvas2D({
30374
30383
  if (elapsed >= interval) {
30375
30384
  const dt = elapsed / 1e3;
30376
30385
  lastTimeRef.current = timestamp - elapsed % interval;
30386
+ const frame = frameRef.current;
30377
30387
  onTickRef.current?.(dt);
30378
- onDrawRef.current?.(ctx, frameRef.current);
30388
+ if (tickEventRef.current) {
30389
+ emitRef.current(tickEventRef.current, { dt, frame });
30390
+ }
30391
+ onDrawRef.current?.(ctx, frame);
30392
+ if (drawEventRef.current) {
30393
+ emitRef.current(drawEventRef.current, { frame });
30394
+ }
30379
30395
  frameRef.current += 1;
30380
30396
  }
30381
30397
  rafRef.current = requestAnimationFrame(loop);
@@ -30401,6 +30417,7 @@ var init_GameCanvas2D = __esm({
30401
30417
  "use client";
30402
30418
  init_cn();
30403
30419
  init_Box();
30420
+ init_useEventBus();
30404
30421
  GameCanvas2D.displayName = "GameCanvas2D";
30405
30422
  }
30406
30423
  });
@@ -25781,6 +25781,8 @@ function GameCanvas2D({
25781
25781
  height = 600,
25782
25782
  onDraw,
25783
25783
  onTick,
25784
+ tickEvent,
25785
+ drawEvent,
25784
25786
  fps = 60,
25785
25787
  className
25786
25788
  }) {
@@ -25788,10 +25790,17 @@ function GameCanvas2D({
25788
25790
  const rafRef = React80__namespace.useRef(0);
25789
25791
  const frameRef = React80__namespace.useRef(0);
25790
25792
  const lastTimeRef = React80__namespace.useRef(0);
25793
+ const emit = useEmitEvent();
25791
25794
  const onDrawRef = React80__namespace.useRef(onDraw);
25792
25795
  onDrawRef.current = onDraw;
25793
25796
  const onTickRef = React80__namespace.useRef(onTick);
25794
25797
  onTickRef.current = onTick;
25798
+ const tickEventRef = React80__namespace.useRef(tickEvent);
25799
+ tickEventRef.current = tickEvent;
25800
+ const drawEventRef = React80__namespace.useRef(drawEvent);
25801
+ drawEventRef.current = drawEvent;
25802
+ const emitRef = React80__namespace.useRef(emit);
25803
+ emitRef.current = emit;
25795
25804
  React80__namespace.useEffect(() => {
25796
25805
  const canvas = canvasRef.current;
25797
25806
  if (!canvas) return;
@@ -25808,8 +25817,15 @@ function GameCanvas2D({
25808
25817
  if (elapsed >= interval) {
25809
25818
  const dt = elapsed / 1e3;
25810
25819
  lastTimeRef.current = timestamp - elapsed % interval;
25820
+ const frame = frameRef.current;
25811
25821
  onTickRef.current?.(dt);
25812
- onDrawRef.current?.(ctx, frameRef.current);
25822
+ if (tickEventRef.current) {
25823
+ emitRef.current(tickEventRef.current, { dt, frame });
25824
+ }
25825
+ onDrawRef.current?.(ctx, frame);
25826
+ if (drawEventRef.current) {
25827
+ emitRef.current(drawEventRef.current, { frame });
25828
+ }
25813
25829
  frameRef.current += 1;
25814
25830
  }
25815
25831
  rafRef.current = requestAnimationFrame(loop);
@@ -25835,6 +25851,7 @@ var init_GameCanvas2D = __esm({
25835
25851
  "use client";
25836
25852
  init_cn();
25837
25853
  init_Box();
25854
+ init_useEventBus();
25838
25855
  GameCanvas2D.displayName = "GameCanvas2D";
25839
25856
  }
25840
25857
  });
@@ -25732,6 +25732,8 @@ function GameCanvas2D({
25732
25732
  height = 600,
25733
25733
  onDraw,
25734
25734
  onTick,
25735
+ tickEvent,
25736
+ drawEvent,
25735
25737
  fps = 60,
25736
25738
  className
25737
25739
  }) {
@@ -25739,10 +25741,17 @@ function GameCanvas2D({
25739
25741
  const rafRef = React80.useRef(0);
25740
25742
  const frameRef = React80.useRef(0);
25741
25743
  const lastTimeRef = React80.useRef(0);
25744
+ const emit = useEmitEvent();
25742
25745
  const onDrawRef = React80.useRef(onDraw);
25743
25746
  onDrawRef.current = onDraw;
25744
25747
  const onTickRef = React80.useRef(onTick);
25745
25748
  onTickRef.current = onTick;
25749
+ const tickEventRef = React80.useRef(tickEvent);
25750
+ tickEventRef.current = tickEvent;
25751
+ const drawEventRef = React80.useRef(drawEvent);
25752
+ drawEventRef.current = drawEvent;
25753
+ const emitRef = React80.useRef(emit);
25754
+ emitRef.current = emit;
25746
25755
  React80.useEffect(() => {
25747
25756
  const canvas = canvasRef.current;
25748
25757
  if (!canvas) return;
@@ -25759,8 +25768,15 @@ function GameCanvas2D({
25759
25768
  if (elapsed >= interval) {
25760
25769
  const dt = elapsed / 1e3;
25761
25770
  lastTimeRef.current = timestamp - elapsed % interval;
25771
+ const frame = frameRef.current;
25762
25772
  onTickRef.current?.(dt);
25763
- onDrawRef.current?.(ctx, frameRef.current);
25773
+ if (tickEventRef.current) {
25774
+ emitRef.current(tickEventRef.current, { dt, frame });
25775
+ }
25776
+ onDrawRef.current?.(ctx, frame);
25777
+ if (drawEventRef.current) {
25778
+ emitRef.current(drawEventRef.current, { frame });
25779
+ }
25764
25780
  frameRef.current += 1;
25765
25781
  }
25766
25782
  rafRef.current = requestAnimationFrame(loop);
@@ -25786,6 +25802,7 @@ var init_GameCanvas2D = __esm({
25786
25802
  "use client";
25787
25803
  init_cn();
25788
25804
  init_Box();
25805
+ init_useEventBus();
25789
25806
  GameCanvas2D.displayName = "GameCanvas2D";
25790
25807
  }
25791
25808
  });
@@ -7,12 +7,16 @@ export interface GameCanvas2DProps {
7
7
  onDraw?: (ctx: CanvasRenderingContext2D, frame: number) => void;
8
8
  /** Called each tick with delta time in seconds */
9
9
  onTick?: (dt: number) => void;
10
+ /** Event name emitted each tick with { dt, frame } — for closed-circuit .orb integration */
11
+ tickEvent?: string;
12
+ /** Event name emitted each draw frame with { frame } — for closed-circuit .orb integration */
13
+ drawEvent?: string;
10
14
  /** Target frames per second */
11
15
  fps?: number;
12
16
  /** Additional CSS classes */
13
17
  className?: string;
14
18
  }
15
- export declare function GameCanvas2D({ width, height, onDraw, onTick, fps, className, }: GameCanvas2DProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare function GameCanvas2D({ width, height, onDraw, onTick, tickEvent, drawEvent, fps, className, }: GameCanvas2DProps): import("react/jsx-runtime").JSX.Element;
16
20
  export declare namespace GameCanvas2D {
17
21
  var displayName: string;
18
22
  }
@@ -26808,6 +26808,8 @@ function GameCanvas2D({
26808
26808
  height = 600,
26809
26809
  onDraw,
26810
26810
  onTick,
26811
+ tickEvent,
26812
+ drawEvent,
26811
26813
  fps = 60,
26812
26814
  className
26813
26815
  }) {
@@ -26815,10 +26817,17 @@ function GameCanvas2D({
26815
26817
  const rafRef = React86__namespace.useRef(0);
26816
26818
  const frameRef = React86__namespace.useRef(0);
26817
26819
  const lastTimeRef = React86__namespace.useRef(0);
26820
+ const emit = useEmitEvent();
26818
26821
  const onDrawRef = React86__namespace.useRef(onDraw);
26819
26822
  onDrawRef.current = onDraw;
26820
26823
  const onTickRef = React86__namespace.useRef(onTick);
26821
26824
  onTickRef.current = onTick;
26825
+ const tickEventRef = React86__namespace.useRef(tickEvent);
26826
+ tickEventRef.current = tickEvent;
26827
+ const drawEventRef = React86__namespace.useRef(drawEvent);
26828
+ drawEventRef.current = drawEvent;
26829
+ const emitRef = React86__namespace.useRef(emit);
26830
+ emitRef.current = emit;
26822
26831
  React86__namespace.useEffect(() => {
26823
26832
  const canvas = canvasRef.current;
26824
26833
  if (!canvas) return;
@@ -26835,8 +26844,15 @@ function GameCanvas2D({
26835
26844
  if (elapsed >= interval) {
26836
26845
  const dt = elapsed / 1e3;
26837
26846
  lastTimeRef.current = timestamp - elapsed % interval;
26847
+ const frame = frameRef.current;
26838
26848
  onTickRef.current?.(dt);
26839
- onDrawRef.current?.(ctx, frameRef.current);
26849
+ if (tickEventRef.current) {
26850
+ emitRef.current(tickEventRef.current, { dt, frame });
26851
+ }
26852
+ onDrawRef.current?.(ctx, frame);
26853
+ if (drawEventRef.current) {
26854
+ emitRef.current(drawEventRef.current, { frame });
26855
+ }
26840
26856
  frameRef.current += 1;
26841
26857
  }
26842
26858
  rafRef.current = requestAnimationFrame(loop);
@@ -26862,6 +26878,7 @@ var init_GameCanvas2D = __esm({
26862
26878
  "use client";
26863
26879
  init_cn();
26864
26880
  init_Box();
26881
+ init_useEventBus();
26865
26882
  GameCanvas2D.displayName = "GameCanvas2D";
26866
26883
  }
26867
26884
  });
@@ -26759,6 +26759,8 @@ function GameCanvas2D({
26759
26759
  height = 600,
26760
26760
  onDraw,
26761
26761
  onTick,
26762
+ tickEvent,
26763
+ drawEvent,
26762
26764
  fps = 60,
26763
26765
  className
26764
26766
  }) {
@@ -26766,10 +26768,17 @@ function GameCanvas2D({
26766
26768
  const rafRef = React86.useRef(0);
26767
26769
  const frameRef = React86.useRef(0);
26768
26770
  const lastTimeRef = React86.useRef(0);
26771
+ const emit = useEmitEvent();
26769
26772
  const onDrawRef = React86.useRef(onDraw);
26770
26773
  onDrawRef.current = onDraw;
26771
26774
  const onTickRef = React86.useRef(onTick);
26772
26775
  onTickRef.current = onTick;
26776
+ const tickEventRef = React86.useRef(tickEvent);
26777
+ tickEventRef.current = tickEvent;
26778
+ const drawEventRef = React86.useRef(drawEvent);
26779
+ drawEventRef.current = drawEvent;
26780
+ const emitRef = React86.useRef(emit);
26781
+ emitRef.current = emit;
26773
26782
  React86.useEffect(() => {
26774
26783
  const canvas = canvasRef.current;
26775
26784
  if (!canvas) return;
@@ -26786,8 +26795,15 @@ function GameCanvas2D({
26786
26795
  if (elapsed >= interval) {
26787
26796
  const dt = elapsed / 1e3;
26788
26797
  lastTimeRef.current = timestamp - elapsed % interval;
26798
+ const frame = frameRef.current;
26789
26799
  onTickRef.current?.(dt);
26790
- onDrawRef.current?.(ctx, frameRef.current);
26800
+ if (tickEventRef.current) {
26801
+ emitRef.current(tickEventRef.current, { dt, frame });
26802
+ }
26803
+ onDrawRef.current?.(ctx, frame);
26804
+ if (drawEventRef.current) {
26805
+ emitRef.current(drawEventRef.current, { frame });
26806
+ }
26791
26807
  frameRef.current += 1;
26792
26808
  }
26793
26809
  rafRef.current = requestAnimationFrame(loop);
@@ -26813,6 +26829,7 @@ var init_GameCanvas2D = __esm({
26813
26829
  "use client";
26814
26830
  init_cn();
26815
26831
  init_Box();
26832
+ init_useEventBus();
26816
26833
  GameCanvas2D.displayName = "GameCanvas2D";
26817
26834
  }
26818
26835
  });
@@ -26513,6 +26513,8 @@ function GameCanvas2D({
26513
26513
  height = 600,
26514
26514
  onDraw,
26515
26515
  onTick,
26516
+ tickEvent,
26517
+ drawEvent,
26516
26518
  fps = 60,
26517
26519
  className
26518
26520
  }) {
@@ -26520,10 +26522,17 @@ function GameCanvas2D({
26520
26522
  const rafRef = React85__namespace.useRef(0);
26521
26523
  const frameRef = React85__namespace.useRef(0);
26522
26524
  const lastTimeRef = React85__namespace.useRef(0);
26525
+ const emit = useEmitEvent();
26523
26526
  const onDrawRef = React85__namespace.useRef(onDraw);
26524
26527
  onDrawRef.current = onDraw;
26525
26528
  const onTickRef = React85__namespace.useRef(onTick);
26526
26529
  onTickRef.current = onTick;
26530
+ const tickEventRef = React85__namespace.useRef(tickEvent);
26531
+ tickEventRef.current = tickEvent;
26532
+ const drawEventRef = React85__namespace.useRef(drawEvent);
26533
+ drawEventRef.current = drawEvent;
26534
+ const emitRef = React85__namespace.useRef(emit);
26535
+ emitRef.current = emit;
26527
26536
  React85__namespace.useEffect(() => {
26528
26537
  const canvas = canvasRef.current;
26529
26538
  if (!canvas) return;
@@ -26540,8 +26549,15 @@ function GameCanvas2D({
26540
26549
  if (elapsed >= interval) {
26541
26550
  const dt = elapsed / 1e3;
26542
26551
  lastTimeRef.current = timestamp - elapsed % interval;
26552
+ const frame = frameRef.current;
26543
26553
  onTickRef.current?.(dt);
26544
- onDrawRef.current?.(ctx, frameRef.current);
26554
+ if (tickEventRef.current) {
26555
+ emitRef.current(tickEventRef.current, { dt, frame });
26556
+ }
26557
+ onDrawRef.current?.(ctx, frame);
26558
+ if (drawEventRef.current) {
26559
+ emitRef.current(drawEventRef.current, { frame });
26560
+ }
26545
26561
  frameRef.current += 1;
26546
26562
  }
26547
26563
  rafRef.current = requestAnimationFrame(loop);
@@ -26567,6 +26583,7 @@ var init_GameCanvas2D = __esm({
26567
26583
  "use client";
26568
26584
  init_cn();
26569
26585
  init_Box();
26586
+ init_useEventBus();
26570
26587
  GameCanvas2D.displayName = "GameCanvas2D";
26571
26588
  }
26572
26589
  });
@@ -26464,6 +26464,8 @@ function GameCanvas2D({
26464
26464
  height = 600,
26465
26465
  onDraw,
26466
26466
  onTick,
26467
+ tickEvent,
26468
+ drawEvent,
26467
26469
  fps = 60,
26468
26470
  className
26469
26471
  }) {
@@ -26471,10 +26473,17 @@ function GameCanvas2D({
26471
26473
  const rafRef = React85.useRef(0);
26472
26474
  const frameRef = React85.useRef(0);
26473
26475
  const lastTimeRef = React85.useRef(0);
26476
+ const emit = useEmitEvent();
26474
26477
  const onDrawRef = React85.useRef(onDraw);
26475
26478
  onDrawRef.current = onDraw;
26476
26479
  const onTickRef = React85.useRef(onTick);
26477
26480
  onTickRef.current = onTick;
26481
+ const tickEventRef = React85.useRef(tickEvent);
26482
+ tickEventRef.current = tickEvent;
26483
+ const drawEventRef = React85.useRef(drawEvent);
26484
+ drawEventRef.current = drawEvent;
26485
+ const emitRef = React85.useRef(emit);
26486
+ emitRef.current = emit;
26478
26487
  React85.useEffect(() => {
26479
26488
  const canvas = canvasRef.current;
26480
26489
  if (!canvas) return;
@@ -26491,8 +26500,15 @@ function GameCanvas2D({
26491
26500
  if (elapsed >= interval) {
26492
26501
  const dt = elapsed / 1e3;
26493
26502
  lastTimeRef.current = timestamp - elapsed % interval;
26503
+ const frame = frameRef.current;
26494
26504
  onTickRef.current?.(dt);
26495
- onDrawRef.current?.(ctx, frameRef.current);
26505
+ if (tickEventRef.current) {
26506
+ emitRef.current(tickEventRef.current, { dt, frame });
26507
+ }
26508
+ onDrawRef.current?.(ctx, frame);
26509
+ if (drawEventRef.current) {
26510
+ emitRef.current(drawEventRef.current, { frame });
26511
+ }
26496
26512
  frameRef.current += 1;
26497
26513
  }
26498
26514
  rafRef.current = requestAnimationFrame(loop);
@@ -26518,6 +26534,7 @@ var init_GameCanvas2D = __esm({
26518
26534
  "use client";
26519
26535
  init_cn();
26520
26536
  init_Box();
26537
+ init_useEventBus();
26521
26538
  GameCanvas2D.displayName = "GameCanvas2D";
26522
26539
  }
26523
26540
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "5.9.5",
3
+ "version": "5.9.6",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [