@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/preview.js CHANGED
@@ -17,13 +17,13 @@ import {
17
17
  readPreviewControllerDeviceIdFromLocation,
18
18
  readPreviewControllerDeviceIdFromSearchParams,
19
19
  useAirJamHost
20
- } from "./chunk-W3YA5BWR.js";
20
+ } from "./chunk-E5PVHEAX.js";
21
21
  import {
22
22
  useOptionalPlatformSettingsOwnerApi,
23
23
  useResolvedPlatformSettingsSnapshot
24
- } from "./chunk-CEJ5RFSG.js";
25
- import "./chunk-FAT2KJ3K.js";
26
- import "./chunk-JEHV5C2X.js";
24
+ } from "./chunk-Q4UALQO4.js";
25
+ import "./chunk-7OTQTT6H.js";
26
+ import "./chunk-DY67S3LR.js";
27
27
  import {
28
28
  useAirJamConfig
29
29
  } from "./chunk-NUJBMV3O.js";
package/dist/ui.cjs CHANGED
@@ -1090,6 +1090,7 @@ function HostMuteButton({
1090
1090
 
1091
1091
  // src/components/join-qr-overlay.tsx
1092
1092
  var import_react7 = require("react");
1093
+ var import_react_dom = require("react-dom");
1093
1094
 
1094
1095
  // src/components/room-qr-code.tsx
1095
1096
  var import_qrcode = require("qrcode");
@@ -1192,24 +1193,35 @@ var shellLabelClassName = "text-[0.6875rem] font-semibold tracking-[0.22em] text
1192
1193
  var shellHelperTextClassName = "text-sm leading-5 text-white/52";
1193
1194
  var shellFieldClassName = "h-11 min-w-0 w-full rounded-2xl border border-white/10 bg-black/40 px-3.5 text-sm text-white shadow-[inset_0_1px_0_rgba(255,255,255,0.03)] outline-none placeholder:text-white/35";
1194
1195
  var shellUtilityButtonClassName = "rounded-2xl border-white/12 bg-white/[0.045] text-white/88 shadow-[inset_0_1px_0_rgba(255,255,255,0.03)] hover:bg-white/[0.085] hover:text-white disabled:border-white/8 disabled:bg-white/[0.03] disabled:text-white/35";
1195
- var shellPanelClassName = "rounded-[0.5rem] border border-white/10 bg-zinc-950/82 text-white shadow-[0_22px_70px_rgba(0,0,0,0.42)] backdrop-blur-md";
1196
1196
 
1197
1197
  // src/components/join-qr-overlay.tsx
1198
1198
  var import_jsx_runtime8 = require("react/jsx-runtime");
1199
1199
  var JoinQrOverlay = ({
1200
1200
  open,
1201
1201
  value,
1202
+ status = "ready",
1202
1203
  roomId,
1203
1204
  onClose,
1204
- title = "Scan to join",
1205
+ title = "Scan QR code to join as a controller",
1206
+ roomLabel = "Join room",
1205
1207
  description = "Scan with your phone to connect as a controller.",
1208
+ unavailableLabel = "Join URL unavailable right now.",
1209
+ loadingLabel = "Preparing join QR\u2026",
1210
+ qrAlt,
1211
+ showCloseButton = false,
1206
1212
  className,
1207
1213
  panelClassName,
1208
1214
  qrClassName,
1209
- size = 440
1215
+ bodyClassName,
1216
+ messageClassName,
1217
+ descriptionClassName,
1218
+ closeButtonClassName,
1219
+ size = 260
1210
1220
  }) => {
1211
1221
  const joinUrlValue = value?.trim() ?? "";
1212
- const hasJoinUrl = joinUrlValue.length > 0;
1222
+ const effectiveStatus = status === "ready" && joinUrlValue.length === 0 ? "unavailable" : status;
1223
+ const overlaySize = `min(72vw, ${size}px)`;
1224
+ const [entered, setEntered] = (0, import_react7.useState)(false);
1213
1225
  (0, import_react7.useEffect)(() => {
1214
1226
  if (!open || typeof window === "undefined") {
1215
1227
  return;
@@ -1224,20 +1236,34 @@ var JoinQrOverlay = ({
1224
1236
  window.removeEventListener("keydown", handleKeyDown);
1225
1237
  };
1226
1238
  }, [onClose, open]);
1239
+ (0, import_react7.useEffect)(() => {
1240
+ if (!open || typeof window === "undefined") {
1241
+ setEntered(false);
1242
+ return;
1243
+ }
1244
+ setEntered(false);
1245
+ const frame = window.requestAnimationFrame(() => {
1246
+ setEntered(true);
1247
+ });
1248
+ return () => {
1249
+ window.cancelAnimationFrame(frame);
1250
+ };
1251
+ }, [open]);
1227
1252
  if (!open) {
1228
1253
  return null;
1229
1254
  }
1230
1255
  const handlePanelClick = (event) => {
1231
1256
  event.stopPropagation();
1232
1257
  };
1233
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1258
+ const dialog = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1234
1259
  "div",
1235
1260
  {
1236
1261
  role: "dialog",
1237
1262
  "aria-modal": "true",
1238
1263
  "aria-label": roomId ? `Join room ${roomId}` : title,
1239
1264
  className: cn(
1240
- "absolute inset-0 z-50 flex items-center justify-center bg-black/82 px-6 py-8 backdrop-blur-md",
1265
+ "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",
1266
+ entered ? "opacity-100" : "opacity-0",
1241
1267
  className
1242
1268
  ),
1243
1269
  onClick: onClose,
@@ -1245,17 +1271,34 @@ var JoinQrOverlay = ({
1245
1271
  "div",
1246
1272
  {
1247
1273
  className: cn(
1248
- "flex w-full max-w-xl flex-col items-center gap-6 px-6 py-7 text-center",
1249
- shellPanelClassName,
1274
+ "flex cursor-default flex-col items-center gap-6 text-center transition-transform duration-200 ease-out",
1275
+ entered ? "translate-y-0" : "-translate-y-4",
1250
1276
  panelClassName
1251
1277
  ),
1252
1278
  onClick: handlePanelClick,
1253
1279
  children: [
1254
1280
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-1", children: [
1255
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-[0.6875rem] font-semibold tracking-[0.22em] text-white/52 uppercase", children: title }),
1256
- roomId ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-3xl font-semibold tracking-[0.12em] text-white uppercase tabular-nums", children: roomId }) : null
1281
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-[11px] tracking-[0.18em] text-slate-400 uppercase", children: roomLabel }),
1282
+ roomId ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-2xl font-semibold tracking-tight text-white tabular-nums", children: roomId }) : null
1257
1283
  ] }),
1258
- hasJoinUrl ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1284
+ effectiveStatus === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1285
+ "div",
1286
+ {
1287
+ className: cn(
1288
+ "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",
1289
+ bodyClassName
1290
+ ),
1291
+ style: {
1292
+ width: overlaySize,
1293
+ height: "auto",
1294
+ aspectRatio: "1 / 1"
1295
+ },
1296
+ children: [
1297
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "h-8 w-8 animate-spin rounded-full border-2 border-white/15 border-t-white/85" }),
1298
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: loadingLabel })
1299
+ ]
1300
+ }
1301
+ ) : effectiveStatus === "ready" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1259
1302
  RoomQrCode,
1260
1303
  {
1261
1304
  value: joinUrlValue,
@@ -1263,31 +1306,65 @@ var JoinQrOverlay = ({
1263
1306
  padding: 2,
1264
1307
  foregroundColor: "#111827",
1265
1308
  backgroundColor: "#ffffff",
1266
- className: cn("rounded-xl bg-white shadow-sm", qrClassName),
1309
+ className: cn(
1310
+ "rounded-lg border border-white/25 bg-white/6 shadow-sm",
1311
+ qrClassName
1312
+ ),
1267
1313
  style: {
1268
- width: "min(72vw, 26rem)",
1314
+ width: overlaySize,
1269
1315
  height: "auto",
1270
1316
  aspectRatio: "1 / 1"
1271
1317
  },
1272
- alt: roomId ? `QR code to join room ${roomId}` : "QR code to join as a controller"
1318
+ alt: qrAlt ?? (roomId ? `QR code to join room ${roomId}` : "QR code to join as a controller")
1273
1319
  }
1274
- ) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("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." }),
1275
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "max-w-md text-sm leading-6 text-white/68", children: description }),
1320
+ ) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1321
+ "div",
1322
+ {
1323
+ className: cn(
1324
+ "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",
1325
+ messageClassName
1326
+ ),
1327
+ style: {
1328
+ width: overlaySize,
1329
+ height: "auto",
1330
+ aspectRatio: "1 / 1"
1331
+ },
1332
+ children: unavailableLabel
1333
+ }
1334
+ ),
1276
1335
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1336
+ "p",
1337
+ {
1338
+ className: cn(
1339
+ "max-w-xs text-center text-sm text-slate-400",
1340
+ descriptionClassName
1341
+ ),
1342
+ children: description
1343
+ }
1344
+ ),
1345
+ showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1277
1346
  Button,
1278
1347
  {
1279
1348
  type: "button",
1280
1349
  variant: "outline",
1281
1350
  onClick: onClose,
1282
- className: cn("rounded-2xl px-5", shellUtilityButtonClassName),
1351
+ className: cn(
1352
+ "rounded-2xl px-5",
1353
+ shellUtilityButtonClassName,
1354
+ closeButtonClassName
1355
+ ),
1283
1356
  children: "Close"
1284
1357
  }
1285
- )
1358
+ ) : null
1286
1359
  ]
1287
1360
  }
1288
1361
  )
1289
1362
  }
1290
1363
  );
1364
+ if (typeof document === "undefined") {
1365
+ return dialog;
1366
+ }
1367
+ return (0, import_react_dom.createPortal)(dialog, document.body);
1291
1368
  };
1292
1369
 
1293
1370
  // src/components/join-url-action-buttons.tsx