@air-jam/sdk 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/arcade/bridge/controller.cjs +1 -1
  2. package/dist/arcade/bridge/controller.js +2 -2
  3. package/dist/arcade/bridge/host.cjs +1 -1
  4. package/dist/arcade/bridge/host.js +2 -2
  5. package/dist/arcade/bridge/iframe.cjs +1 -1
  6. package/dist/arcade/bridge/iframe.js +3 -3
  7. package/dist/arcade/bridge.cjs +1 -1
  8. package/dist/arcade/bridge.js +5 -5
  9. package/dist/arcade.cjs +1 -1
  10. package/dist/arcade.js +5 -5
  11. package/dist/{chunk-KXAFI5OP.js → chunk-6CMB356F.js} +2 -2
  12. package/dist/{chunk-FAT2KJ3K.js → chunk-7OTQTT6H.js} +2 -2
  13. package/dist/{chunk-CABEUV65.js → chunk-CVYR5RJT.js} +2 -2
  14. package/dist/{chunk-JEHV5C2X.js → chunk-DY67S3LR.js} +2 -2
  15. package/dist/{chunk-W3YA5BWR.js → chunk-E5PVHEAX.js} +2 -2
  16. package/dist/{chunk-VKBMZHMQ.js → chunk-KOB73SPD.js} +2 -2
  17. package/dist/{chunk-7UXSWCZZ.js → chunk-M4DKOI42.js} +2 -2
  18. package/dist/{chunk-CEJ5RFSG.js → chunk-Q4UALQO4.js} +2 -2
  19. package/dist/index.cjs +172 -100
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +8 -1
  22. package/dist/index.d.ts +8 -1
  23. package/dist/index.js +160 -89
  24. package/dist/index.js.map +1 -1
  25. package/dist/preview.js +4 -4
  26. package/dist/ui.cjs +95 -18
  27. package/dist/ui.cjs.map +1 -1
  28. package/dist/ui.d.cts +11 -1
  29. package/dist/ui.d.ts +11 -1
  30. package/dist/ui.js +106 -29
  31. package/dist/ui.js.map +1 -1
  32. package/package.json +1 -1
  33. package/src/components/join-qr-overlay.tsx +115 -31
  34. package/src/hooks/use-host-audio-mute-preference.ts +99 -0
  35. package/src/index.ts +4 -0
  36. /package/dist/{chunk-KXAFI5OP.js.map → chunk-6CMB356F.js.map} +0 -0
  37. /package/dist/{chunk-FAT2KJ3K.js.map → chunk-7OTQTT6H.js.map} +0 -0
  38. /package/dist/{chunk-CABEUV65.js.map → chunk-CVYR5RJT.js.map} +0 -0
  39. /package/dist/{chunk-JEHV5C2X.js.map → chunk-DY67S3LR.js.map} +0 -0
  40. /package/dist/{chunk-W3YA5BWR.js.map → chunk-E5PVHEAX.js.map} +0 -0
  41. /package/dist/{chunk-VKBMZHMQ.js.map → chunk-KOB73SPD.js.map} +0 -0
  42. /package/dist/{chunk-7UXSWCZZ.js.map → chunk-M4DKOI42.js.map} +0 -0
  43. /package/dist/{chunk-CEJ5RFSG.js.map → chunk-Q4UALQO4.js.map} +0 -0
package/dist/ui.d.cts CHANGED
@@ -55,16 +55,26 @@ declare function HostMuteButton({ muted, onToggle, className, labelClassName, mu
55
55
  interface JoinQrOverlayProps {
56
56
  open: boolean;
57
57
  value: string | null | undefined;
58
+ status?: "ready" | "loading" | "unavailable";
58
59
  roomId?: string | null;
59
60
  onClose?: () => void;
60
61
  title?: string;
62
+ roomLabel?: string;
61
63
  description?: string;
64
+ unavailableLabel?: string;
65
+ loadingLabel?: string;
66
+ qrAlt?: string;
67
+ showCloseButton?: boolean;
62
68
  className?: string;
63
69
  panelClassName?: string;
64
70
  qrClassName?: string;
71
+ bodyClassName?: string;
72
+ messageClassName?: string;
73
+ descriptionClassName?: string;
74
+ closeButtonClassName?: string;
65
75
  size?: number;
66
76
  }
67
- declare const JoinQrOverlay: ({ open, value, roomId, onClose, title, description, className, panelClassName, qrClassName, size, }: JoinQrOverlayProps) => JSX.Element | null;
77
+ declare const JoinQrOverlay: ({ open, value, status, roomId, onClose, title, roomLabel, description, unavailableLabel, loadingLabel, qrAlt, showCloseButton, className, panelClassName, qrClassName, bodyClassName, messageClassName, descriptionClassName, closeButtonClassName, size, }: JoinQrOverlayProps) => JSX.Element | null;
68
78
 
69
79
  interface JoinUrlActionButtonsProps {
70
80
  hasValue: boolean;
package/dist/ui.d.ts CHANGED
@@ -55,16 +55,26 @@ declare function HostMuteButton({ muted, onToggle, className, labelClassName, mu
55
55
  interface JoinQrOverlayProps {
56
56
  open: boolean;
57
57
  value: string | null | undefined;
58
+ status?: "ready" | "loading" | "unavailable";
58
59
  roomId?: string | null;
59
60
  onClose?: () => void;
60
61
  title?: string;
62
+ roomLabel?: string;
61
63
  description?: string;
64
+ unavailableLabel?: string;
65
+ loadingLabel?: string;
66
+ qrAlt?: string;
67
+ showCloseButton?: boolean;
62
68
  className?: string;
63
69
  panelClassName?: string;
64
70
  qrClassName?: string;
71
+ bodyClassName?: string;
72
+ messageClassName?: string;
73
+ descriptionClassName?: string;
74
+ closeButtonClassName?: string;
65
75
  size?: number;
66
76
  }
67
- declare const JoinQrOverlay: ({ open, value, roomId, onClose, title, description, className, panelClassName, qrClassName, size, }: JoinQrOverlayProps) => JSX.Element | null;
77
+ declare const JoinQrOverlay: ({ open, value, status, roomId, onClose, title, roomLabel, description, unavailableLabel, loadingLabel, qrAlt, showCloseButton, className, panelClassName, qrClassName, bodyClassName, messageClassName, descriptionClassName, closeButtonClassName, size, }: JoinQrOverlayProps) => JSX.Element | null;
68
78
 
69
79
  interface JoinUrlActionButtonsProps {
70
80
  hasValue: boolean;
package/dist/ui.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  readEmbeddedControllerRuntimeParams,
3
3
  useAirJamController
4
- } from "./chunk-CABEUV65.js";
4
+ } from "./chunk-CVYR5RJT.js";
5
5
  import {
6
6
  createControllerPresentationSyncMessage
7
- } from "./chunk-VKBMZHMQ.js";
7
+ } from "./chunk-KOB73SPD.js";
8
8
  import "./chunk-X24K52DG.js";
9
9
  import {
10
10
  Button,
@@ -15,14 +15,13 @@ import {
15
15
  shellHeaderClassName,
16
16
  shellHelperTextClassName,
17
17
  shellLabelClassName,
18
- shellPanelClassName,
19
18
  shellUtilityButtonClassName
20
19
  } from "./chunk-EVZJA6RN.js";
21
20
  import {
22
21
  usePlatformAudioSettings
23
- } from "./chunk-CEJ5RFSG.js";
24
- import "./chunk-FAT2KJ3K.js";
25
- import "./chunk-JEHV5C2X.js";
22
+ } from "./chunk-Q4UALQO4.js";
23
+ import "./chunk-7OTQTT6H.js";
24
+ import "./chunk-DY67S3LR.js";
26
25
  import {
27
26
  useSessionScope
28
27
  } from "./chunk-NUJBMV3O.js";
@@ -266,7 +265,8 @@ function HostMuteButton({
266
265
  }
267
266
 
268
267
  // src/components/join-qr-overlay.tsx
269
- import { useEffect as useEffect3 } from "react";
268
+ import { useEffect as useEffect3, useState as useState3 } from "react";
269
+ import { createPortal } from "react-dom";
270
270
 
271
271
  // src/components/room-qr-code.tsx
272
272
  import { toDataURL } from "qrcode";
@@ -368,17 +368,29 @@ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
368
368
  var JoinQrOverlay = ({
369
369
  open,
370
370
  value,
371
+ status = "ready",
371
372
  roomId,
372
373
  onClose,
373
- title = "Scan to join",
374
+ title = "Scan QR code to join as a controller",
375
+ roomLabel = "Join room",
374
376
  description = "Scan with your phone to connect as a controller.",
377
+ unavailableLabel = "Join URL unavailable right now.",
378
+ loadingLabel = "Preparing join QR\u2026",
379
+ qrAlt,
380
+ showCloseButton = false,
375
381
  className,
376
382
  panelClassName,
377
383
  qrClassName,
378
- size = 440
384
+ bodyClassName,
385
+ messageClassName,
386
+ descriptionClassName,
387
+ closeButtonClassName,
388
+ size = 260
379
389
  }) => {
380
390
  const joinUrlValue = value?.trim() ?? "";
381
- const hasJoinUrl = joinUrlValue.length > 0;
391
+ const effectiveStatus = status === "ready" && joinUrlValue.length === 0 ? "unavailable" : status;
392
+ const overlaySize = `min(72vw, ${size}px)`;
393
+ const [entered, setEntered] = useState3(false);
382
394
  useEffect3(() => {
383
395
  if (!open || typeof window === "undefined") {
384
396
  return;
@@ -393,20 +405,34 @@ var JoinQrOverlay = ({
393
405
  window.removeEventListener("keydown", handleKeyDown);
394
406
  };
395
407
  }, [onClose, open]);
408
+ useEffect3(() => {
409
+ if (!open || typeof window === "undefined") {
410
+ setEntered(false);
411
+ return;
412
+ }
413
+ setEntered(false);
414
+ const frame = window.requestAnimationFrame(() => {
415
+ setEntered(true);
416
+ });
417
+ return () => {
418
+ window.cancelAnimationFrame(frame);
419
+ };
420
+ }, [open]);
396
421
  if (!open) {
397
422
  return null;
398
423
  }
399
424
  const handlePanelClick = (event) => {
400
425
  event.stopPropagation();
401
426
  };
402
- return /* @__PURE__ */ jsx6(
427
+ const dialog = /* @__PURE__ */ jsx6(
403
428
  "div",
404
429
  {
405
430
  role: "dialog",
406
431
  "aria-modal": "true",
407
432
  "aria-label": roomId ? `Join room ${roomId}` : title,
408
433
  className: cn(
409
- "absolute inset-0 z-50 flex items-center justify-center bg-black/82 px-6 py-8 backdrop-blur-md",
434
+ "pointer-events-auto fixed inset-0 z-[120] flex cursor-pointer flex-col items-center justify-center bg-black/85 px-6 backdrop-blur-md transition-opacity duration-200 ease-out",
435
+ entered ? "opacity-100" : "opacity-0",
410
436
  className
411
437
  ),
412
438
  onClick: onClose,
@@ -414,17 +440,34 @@ var JoinQrOverlay = ({
414
440
  "div",
415
441
  {
416
442
  className: cn(
417
- "flex w-full max-w-xl flex-col items-center gap-6 px-6 py-7 text-center",
418
- shellPanelClassName,
443
+ "flex cursor-default flex-col items-center gap-6 text-center transition-transform duration-200 ease-out",
444
+ entered ? "translate-y-0" : "-translate-y-4",
419
445
  panelClassName
420
446
  ),
421
447
  onClick: handlePanelClick,
422
448
  children: [
423
449
  /* @__PURE__ */ jsxs6("div", { className: "space-y-1", children: [
424
- /* @__PURE__ */ jsx6("p", { className: "text-[0.6875rem] font-semibold tracking-[0.22em] text-white/52 uppercase", children: title }),
425
- roomId ? /* @__PURE__ */ jsx6("p", { className: "text-3xl font-semibold tracking-[0.12em] text-white uppercase tabular-nums", children: roomId }) : null
450
+ /* @__PURE__ */ jsx6("p", { className: "text-[11px] tracking-[0.18em] text-slate-400 uppercase", children: roomLabel }),
451
+ roomId ? /* @__PURE__ */ jsx6("p", { className: "text-2xl font-semibold tracking-tight text-white tabular-nums", children: roomId }) : null
426
452
  ] }),
427
- hasJoinUrl ? /* @__PURE__ */ jsx6(
453
+ effectiveStatus === "loading" ? /* @__PURE__ */ jsxs6(
454
+ "div",
455
+ {
456
+ className: cn(
457
+ "flex flex-col items-center justify-center gap-3 rounded-lg border border-white/25 bg-white/6 px-5 py-10 text-sm text-white/70 shadow-sm",
458
+ bodyClassName
459
+ ),
460
+ style: {
461
+ width: overlaySize,
462
+ height: "auto",
463
+ aspectRatio: "1 / 1"
464
+ },
465
+ children: [
466
+ /* @__PURE__ */ jsx6("span", { className: "h-8 w-8 animate-spin rounded-full border-2 border-white/15 border-t-white/85" }),
467
+ /* @__PURE__ */ jsx6("span", { children: loadingLabel })
468
+ ]
469
+ }
470
+ ) : effectiveStatus === "ready" ? /* @__PURE__ */ jsx6(
428
471
  RoomQrCode,
429
472
  {
430
473
  value: joinUrlValue,
@@ -432,31 +475,65 @@ var JoinQrOverlay = ({
432
475
  padding: 2,
433
476
  foregroundColor: "#111827",
434
477
  backgroundColor: "#ffffff",
435
- className: cn("rounded-xl bg-white shadow-sm", qrClassName),
478
+ className: cn(
479
+ "rounded-lg border border-white/25 bg-white/6 shadow-sm",
480
+ qrClassName
481
+ ),
482
+ style: {
483
+ width: overlaySize,
484
+ height: "auto",
485
+ aspectRatio: "1 / 1"
486
+ },
487
+ alt: qrAlt ?? (roomId ? `QR code to join room ${roomId}` : "QR code to join as a controller")
488
+ }
489
+ ) : /* @__PURE__ */ jsx6(
490
+ "div",
491
+ {
492
+ className: cn(
493
+ "flex items-center justify-center rounded-lg border border-white/25 bg-white/6 px-5 py-10 text-sm text-white/70 shadow-sm",
494
+ messageClassName
495
+ ),
436
496
  style: {
437
- width: "min(72vw, 26rem)",
497
+ width: overlaySize,
438
498
  height: "auto",
439
499
  aspectRatio: "1 / 1"
440
500
  },
441
- alt: roomId ? `QR code to join room ${roomId}` : "QR code to join as a controller"
501
+ children: unavailableLabel
442
502
  }
443
- ) : /* @__PURE__ */ jsx6("div", { className: "flex w-full max-w-[26rem] items-center justify-center rounded-xl border border-white/12 bg-white/6 px-5 py-10 text-sm leading-6 text-white/68", children: "Join URL unavailable right now." }),
444
- /* @__PURE__ */ jsx6("p", { className: "max-w-md text-sm leading-6 text-white/68", children: description }),
503
+ ),
445
504
  /* @__PURE__ */ jsx6(
505
+ "p",
506
+ {
507
+ className: cn(
508
+ "max-w-xs text-center text-sm text-slate-400",
509
+ descriptionClassName
510
+ ),
511
+ children: description
512
+ }
513
+ ),
514
+ showCloseButton ? /* @__PURE__ */ jsx6(
446
515
  Button,
447
516
  {
448
517
  type: "button",
449
518
  variant: "outline",
450
519
  onClick: onClose,
451
- className: cn("rounded-2xl px-5", shellUtilityButtonClassName),
520
+ className: cn(
521
+ "rounded-2xl px-5",
522
+ shellUtilityButtonClassName,
523
+ closeButtonClassName
524
+ ),
452
525
  children: "Close"
453
526
  }
454
- )
527
+ ) : null
455
528
  ]
456
529
  }
457
530
  )
458
531
  }
459
532
  );
533
+ if (typeof document === "undefined") {
534
+ return dialog;
535
+ }
536
+ return createPortal(dialog, document.body);
460
537
  };
461
538
 
462
539
  // src/components/join-url-action-buttons.tsx
@@ -934,7 +1011,7 @@ var RuntimeShellHeader = ({
934
1011
  };
935
1012
 
936
1013
  // src/components/surface-viewport.tsx
937
- import { useEffect as useEffect4, useMemo, useRef as useRef2, useState as useState3 } from "react";
1014
+ import { useEffect as useEffect4, useMemo, useRef as useRef2, useState as useState4 } from "react";
938
1015
 
939
1016
  // src/runtime/controller-presentation.ts
940
1017
  var publishEmbeddedControllerPresentation = (orientation) => {
@@ -1262,7 +1339,7 @@ var SurfaceViewport = ({
1262
1339
  minScale,
1263
1340
  maxScale
1264
1341
  }) => {
1265
- const [viewport, setViewport] = useState3(null);
1342
+ const [viewport, setViewport] = useState4(null);
1266
1343
  const viewportRef = useRef2(null);
1267
1344
  const sessionScope = useSessionScope();
1268
1345
  useEffect4(() => {
@@ -1584,7 +1661,7 @@ var useControllerShellStatus = ({
1584
1661
  };
1585
1662
 
1586
1663
  // src/hooks/use-host-join-controls.ts
1587
- import { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo2, useRef as useRef3, useState as useState4 } from "react";
1664
+ import { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo2, useRef as useRef3, useState as useState5 } from "react";
1588
1665
  var copyTextToClipboard = async (text) => {
1589
1666
  if (!text) {
1590
1667
  return false;
@@ -1619,8 +1696,8 @@ var useHostJoinControls = ({
1619
1696
  onStartMatch,
1620
1697
  copiedDurationMs = 1800
1621
1698
  }) => {
1622
- const [copied, setCopied] = useState4(false);
1623
- const [joinQrVisible, setJoinQrVisible] = useState4(false);
1699
+ const [copied, setCopied] = useState5(false);
1700
+ const [joinQrVisible, setJoinQrVisible] = useState5(false);
1624
1701
  const resetTimerRef = useRef3(null);
1625
1702
  const joinUrlValue = useMemo2(() => joinUrl ?? "", [joinUrl]);
1626
1703
  const hasJoinUrl = joinUrlValue.length > 0;