@air-jam/sdk 0.9.3 → 1.0.0-beta.1
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.
- package/README.md +168 -205
- package/dist/actions-D4eh6Xaa.d.cts +72 -0
- package/dist/actions-D4eh6Xaa.d.ts +72 -0
- package/dist/{agent-contract-CD2QnbBJ.d.cts → agent-contract-DfLm4Mf-.d.ts} +3 -19
- package/dist/{agent-contract-CD2QnbBJ.d.ts → agent-contract-TINzp-5Y.d.cts} +3 -19
- package/dist/agent-tooling.cjs +135 -46
- package/dist/agent-tooling.cjs.map +1 -1
- package/dist/agent-tooling.d.cts +96 -5
- package/dist/agent-tooling.d.ts +96 -5
- package/dist/agent-tooling.js +15 -14
- package/dist/agent-tooling.js.map +1 -1
- package/dist/{use-air-jam-host-COLy8t4s.d.ts → air-jam-context-BCVCWiaT.d.ts} +121 -114
- package/dist/{use-air-jam-host-DM-ybB3C.d.cts → air-jam-context-DavligpM.d.cts} +121 -114
- package/dist/arcade/bridge/controller.cjs +873 -603
- package/dist/arcade/bridge/controller.cjs.map +1 -1
- package/dist/arcade/bridge/controller.d.cts +28 -76
- package/dist/arcade/bridge/controller.d.ts +28 -76
- package/dist/arcade/bridge/controller.js +27 -28
- package/dist/arcade/bridge/controller.js.map +1 -1
- package/dist/arcade/bridge/host.cjs +1017 -252
- package/dist/arcade/bridge/host.cjs.map +1 -1
- package/dist/arcade/bridge/host.d.cts +6 -72
- package/dist/arcade/bridge/host.d.ts +6 -72
- package/dist/arcade/bridge/host.js +19 -22
- package/dist/arcade/bridge/host.js.map +1 -1
- package/dist/arcade/bridge/iframe.cjs +3 -31
- package/dist/arcade/bridge/iframe.cjs.map +1 -1
- package/dist/arcade/bridge/iframe.d.cts +4 -46
- package/dist/arcade/bridge/iframe.d.ts +4 -46
- package/dist/arcade/bridge/iframe.js +6 -18
- package/dist/arcade/bridge/iframe.js.map +1 -1
- package/dist/arcade/host.cjs +0 -502
- package/dist/arcade/host.cjs.map +1 -1
- package/dist/arcade/host.d.cts +1 -19
- package/dist/arcade/host.d.ts +1 -19
- package/dist/arcade/host.js +0 -14
- package/dist/arcade/host.js.map +1 -1
- package/dist/arcade/runtime.cjs +10354 -4690
- package/dist/arcade/runtime.cjs.map +1 -1
- package/dist/arcade/runtime.d.cts +45 -13
- package/dist/arcade/runtime.d.ts +45 -13
- package/dist/arcade/runtime.js +37 -24
- package/dist/arcade/runtime.js.map +1 -1
- package/dist/arcade/surface.cjs +3 -35
- package/dist/arcade/surface.cjs.map +1 -1
- package/dist/arcade/surface.d.cts +14 -2
- package/dist/arcade/surface.d.ts +14 -2
- package/dist/arcade/surface.js +7 -13
- package/dist/arcade/surface.js.map +1 -1
- package/dist/arcade/url.cjs +45 -283
- package/dist/arcade/url.cjs.map +1 -1
- package/dist/arcade/url.d.cts +3 -56
- package/dist/arcade/url.d.ts +3 -56
- package/dist/arcade/url.js +33 -16
- package/dist/arcade/url.js.map +1 -1
- package/dist/chunk-24NZZOIO.js +700 -0
- package/dist/chunk-24NZZOIO.js.map +1 -0
- package/dist/chunk-27QLKLZL.js +469 -0
- package/dist/chunk-27QLKLZL.js.map +1 -0
- package/dist/{chunk-UWJOIVON.js → chunk-2H2FGF3H.js} +3 -6
- package/dist/chunk-2H2FGF3H.js.map +1 -0
- package/dist/chunk-2QZADUGA.js +188 -0
- package/dist/chunk-2QZADUGA.js.map +1 -0
- package/dist/chunk-3LDQCQL2.js +307 -0
- package/dist/chunk-3LDQCQL2.js.map +1 -0
- package/dist/chunk-3M7656SU.js +389 -0
- package/dist/chunk-3M7656SU.js.map +1 -0
- package/dist/{chunk-K4OZ54UD.js → chunk-5CRZFIN6.js} +2 -55
- package/dist/chunk-5CRZFIN6.js.map +1 -0
- package/dist/chunk-5TVVPBQI.js +7 -0
- package/dist/chunk-5TVVPBQI.js.map +1 -0
- package/dist/chunk-6Y3F6Y2K.js +343 -0
- package/dist/chunk-6Y3F6Y2K.js.map +1 -0
- package/dist/{chunk-EVZJA6RN.js → chunk-6ZJUA63D.js} +183 -2
- package/dist/chunk-6ZJUA63D.js.map +1 -0
- package/dist/chunk-A6EOGRRG.js +49 -0
- package/dist/chunk-A6EOGRRG.js.map +1 -0
- package/dist/chunk-BEM77SVQ.js +57 -0
- package/dist/chunk-BEM77SVQ.js.map +1 -0
- package/dist/chunk-C5722GTG.js +176 -0
- package/dist/chunk-C5722GTG.js.map +1 -0
- package/dist/{chunk-CV3PBXPT.js → chunk-C5GS2GMK.js} +99 -105
- package/dist/chunk-C5GS2GMK.js.map +1 -0
- package/dist/chunk-CDL7LYZH.js +19 -0
- package/dist/chunk-CDL7LYZH.js.map +1 -0
- package/dist/{chunk-PSUYTD2L.js → chunk-DA3TE4OP.js} +1 -1
- package/dist/chunk-DA3TE4OP.js.map +1 -0
- package/dist/chunk-DBF7NJ3S.js +72 -0
- package/dist/chunk-DBF7NJ3S.js.map +1 -0
- package/dist/chunk-DHFKL3DI.js +2477 -0
- package/dist/chunk-DHFKL3DI.js.map +1 -0
- package/dist/chunk-DRBPVG47.js +89 -0
- package/dist/chunk-DRBPVG47.js.map +1 -0
- package/dist/{chunk-MIMPMB7O.js → chunk-EG25EXSA.js} +24 -3
- package/dist/chunk-EG25EXSA.js.map +1 -0
- package/dist/chunk-FCG42U7D.js +131 -0
- package/dist/chunk-FCG42U7D.js.map +1 -0
- package/dist/chunk-FJ4J2BEC.js +26 -0
- package/dist/chunk-FJ4J2BEC.js.map +1 -0
- package/dist/chunk-H4DEVMTO.js +221 -0
- package/dist/chunk-H4DEVMTO.js.map +1 -0
- package/dist/{chunk-X35LLCWV.js → chunk-I6TSHJF7.js} +6 -8
- package/dist/chunk-I6TSHJF7.js.map +1 -0
- package/dist/{chunk-IG6GZZSS.js → chunk-JCGTL77W.js} +1 -1
- package/dist/chunk-JCGTL77W.js.map +1 -0
- package/dist/chunk-JJVCBUYM.js +98 -0
- package/dist/chunk-JJVCBUYM.js.map +1 -0
- package/dist/chunk-K6BJJJJM.js +138 -0
- package/dist/chunk-K6BJJJJM.js.map +1 -0
- package/dist/chunk-KSYN4I5Y.js +50 -0
- package/dist/chunk-KSYN4I5Y.js.map +1 -0
- package/dist/chunk-KUGROY5S.js +265 -0
- package/dist/chunk-KUGROY5S.js.map +1 -0
- package/dist/chunk-LX6CTPDW.js +16 -0
- package/dist/chunk-LX6CTPDW.js.map +1 -0
- package/dist/{chunk-BE6Z4SIT.js → chunk-M5553I2G.js} +2 -11
- package/dist/chunk-M5553I2G.js.map +1 -0
- package/dist/{chunk-X24K52DG.js → chunk-MD25536W.js} +1 -1
- package/dist/chunk-MD25536W.js.map +1 -0
- package/dist/{chunk-3USU7GY2.js → chunk-MJAWAHLT.js} +1 -1
- package/dist/chunk-MJAWAHLT.js.map +1 -0
- package/dist/chunk-OAXCFPZ7.js +14 -0
- package/dist/chunk-OAXCFPZ7.js.map +1 -0
- package/dist/{chunk-D4VDEVTZ.js → chunk-QHBRHYMV.js} +18 -17
- package/dist/chunk-QHBRHYMV.js.map +1 -0
- package/dist/chunk-QTNYGAZ7.js +45 -0
- package/dist/chunk-QTNYGAZ7.js.map +1 -0
- package/dist/chunk-S3TN7Y7L.js +921 -0
- package/dist/chunk-S3TN7Y7L.js.map +1 -0
- package/dist/chunk-SMKD4JY3.js +129 -0
- package/dist/chunk-SMKD4JY3.js.map +1 -0
- package/dist/{chunk-O6X7FJ6N.js → chunk-TFW4NJW2.js} +619 -643
- package/dist/chunk-TFW4NJW2.js.map +1 -0
- package/dist/chunk-UBBP2UY3.js +83 -0
- package/dist/chunk-UBBP2UY3.js.map +1 -0
- package/dist/chunk-URVBMQCK.js +802 -0
- package/dist/chunk-URVBMQCK.js.map +1 -0
- package/dist/chunk-VGX2274F.js +1995 -0
- package/dist/chunk-VGX2274F.js.map +1 -0
- package/dist/chunk-WAFGYJZN.js +1513 -0
- package/dist/chunk-WAFGYJZN.js.map +1 -0
- package/dist/chunk-WGHNGQUS.js +78 -0
- package/dist/chunk-WGHNGQUS.js.map +1 -0
- package/dist/chunk-XLY44PXZ.js +46 -0
- package/dist/chunk-XLY44PXZ.js.map +1 -0
- package/dist/connection-store-BYpQ50W2.d.ts +41 -0
- package/dist/connection-store-D6QqzXU1.d.cts +41 -0
- package/dist/control-Bv8dWjyp.d.ts +1400 -0
- package/dist/control-CNzybWMd.d.cts +1400 -0
- package/dist/controller-0CVO1t_3.d.cts +26 -0
- package/dist/controller-agent-vOiuK7T6.d.cts +130 -0
- package/dist/controller-agent-vOiuK7T6.d.ts +130 -0
- package/dist/controller-bridge.cjs +992 -0
- package/dist/controller-bridge.cjs.map +1 -0
- package/dist/controller-bridge.d.cts +52 -0
- package/dist/controller-bridge.d.ts +52 -0
- package/dist/controller-bridge.js +23 -0
- package/dist/controller-bridge.js.map +1 -0
- package/dist/controller-capture-2GKKGHJ2.js +8 -0
- package/dist/controller-capture-2GKKGHJ2.js.map +1 -0
- package/dist/controller-h9M2Nngd.d.ts +26 -0
- package/dist/controller-press-EWWIMVXP.js +231 -0
- package/dist/controller-press-EWWIMVXP.js.map +1 -0
- package/dist/core-BAO0pHrJ.d.cts +15 -0
- package/dist/core-BAO0pHrJ.d.ts +15 -0
- package/dist/core.cjs +5931 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +232 -0
- package/dist/core.d.ts +232 -0
- package/dist/core.js +906 -0
- package/dist/core.js.map +1 -0
- package/dist/dev-events-BffobOfb.d.ts +31 -0
- package/dist/dev-events-Ct7QEgKb.d.cts +31 -0
- package/dist/dev-log-events-B1_B3guZ.d.cts +47 -0
- package/dist/dev-log-events-B1_B3guZ.d.ts +47 -0
- package/dist/frames-D-xKuODS.d.cts +686 -0
- package/dist/frames-D-xKuODS.d.ts +686 -0
- package/dist/game-Db58JNk3.d.cts +77 -0
- package/dist/game-bySEy-QO.d.ts +77 -0
- package/dist/host-runtime-BuLhGQx5.d.ts +399 -0
- package/dist/host-runtime-_06jpW5v.d.cts +399 -0
- package/dist/index.cjs +11580 -7584
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +100 -358
- package/dist/index.d.ts +100 -358
- package/dist/index.js +414 -1903
- package/dist/index.js.map +1 -1
- package/dist/input-Xvs80gqG.d.cts +92 -0
- package/dist/input-Xvs80gqG.d.ts +92 -0
- package/dist/input-bindings-BaEFrgRb.d.cts +129 -0
- package/dist/input-bindings-BgsJRLPm.d.ts +129 -0
- package/dist/leased-control-BEg4JuXA.d.cts +158 -0
- package/dist/leased-control-BEg4JuXA.d.ts +158 -0
- package/dist/metadata.cjs +3 -9
- package/dist/metadata.cjs.map +1 -1
- package/dist/metadata.d.cts +6 -16
- package/dist/metadata.d.ts +6 -16
- package/dist/metadata.js +8 -76
- package/dist/metadata.js.map +1 -1
- package/dist/phone-room-session-Ca6rlxJr.d.ts +439 -0
- package/dist/phone-room-session-DkPR-K6e.d.cts +439 -0
- package/dist/platform-machine.cjs +133 -3
- package/dist/platform-machine.cjs.map +1 -1
- package/dist/platform-machine.d.cts +525 -27
- package/dist/platform-machine.d.ts +525 -27
- package/dist/platform-machine.js +119 -4
- package/dist/platform-machine.js.map +1 -1
- package/dist/{platform-settings-DUWs4JTy.d.cts → platform-settings-Yb0fQ1dl.d.cts} +1 -3
- package/dist/{platform-settings-DUWs4JTy.d.ts → platform-settings-Yb0fQ1dl.d.ts} +1 -3
- package/dist/prefabs.cjs +134 -3
- package/dist/prefabs.cjs.map +1 -1
- package/dist/prefabs.d.cts +23 -47
- package/dist/prefabs.d.ts +23 -47
- package/dist/prefabs.js +23 -4
- package/dist/prefabs.js.map +1 -1
- package/dist/preview.cjs +2214 -767
- package/dist/preview.cjs.map +1 -1
- package/dist/preview.d.cts +193 -38
- package/dist/preview.d.ts +193 -38
- package/dist/preview.js +478 -254
- package/dist/preview.js.map +1 -1
- package/dist/protocol.cjs +585 -391
- package/dist/protocol.cjs.map +1 -1
- package/dist/protocol.d.cts +13 -117
- package/dist/protocol.d.ts +13 -117
- package/dist/protocol.js +43 -80
- package/dist/protocol.js.map +1 -1
- package/dist/release.cjs.map +1 -1
- package/dist/release.d.cts +2 -2
- package/dist/release.d.ts +2 -2
- package/dist/release.js +1 -1
- package/dist/release.js.map +1 -1
- package/dist/replay-input-log-BvX4As2f.d.ts +31 -0
- package/dist/replay-input-log-Vcl0VDIy.d.cts +31 -0
- package/dist/room-protocol.cjs +794 -0
- package/dist/room-protocol.cjs.map +1 -0
- package/dist/room-protocol.d.cts +63 -0
- package/dist/room-protocol.d.ts +63 -0
- package/dist/room-protocol.js +143 -0
- package/dist/room-protocol.js.map +1 -0
- package/dist/room-session.cjs +2336 -0
- package/dist/room-session.cjs.map +1 -0
- package/dist/room-session.d.cts +77 -0
- package/dist/room-session.d.ts +77 -0
- package/dist/room-session.js +103 -0
- package/dist/room-session.js.map +1 -0
- package/dist/runtime/prefab-inspection-bridge.cjs +207 -0
- package/dist/runtime/prefab-inspection-bridge.cjs.map +1 -0
- package/dist/runtime/prefab-inspection-bridge.d.cts +156 -0
- package/dist/runtime/prefab-inspection-bridge.d.ts +156 -0
- package/dist/runtime/prefab-inspection-bridge.js +22 -0
- package/dist/runtime/prefab-inspection-bridge.js.map +1 -0
- package/dist/runtime-control.cjs +2112 -8
- package/dist/runtime-control.cjs.map +1 -1
- package/dist/runtime-control.d.cts +980 -12
- package/dist/runtime-control.d.ts +980 -12
- package/dist/runtime-control.js +264 -4
- package/dist/runtime-control.js.map +1 -1
- package/dist/runtime-inspection.cjs +1222 -558
- package/dist/runtime-inspection.cjs.map +1 -1
- package/dist/runtime-inspection.d.cts +530 -22
- package/dist/runtime-inspection.d.ts +530 -22
- package/dist/runtime-inspection.js +21 -22
- package/dist/runtime-inspection.js.map +1 -1
- package/dist/runtime-reporting-K_ZXpubu.d.cts +43 -0
- package/dist/runtime-reporting-K_ZXpubu.d.ts +43 -0
- package/dist/runtime-topology.cjs +2 -5
- package/dist/runtime-topology.cjs.map +1 -1
- package/dist/runtime-topology.d.cts +1 -1
- package/dist/runtime-topology.d.ts +1 -1
- package/dist/runtime-topology.js +1 -1
- package/dist/runtime-topology.js.map +1 -1
- package/dist/scoped-connector-CiiWu06D.d.ts +66 -0
- package/dist/scoped-connector-D7252pn0.d.cts +66 -0
- package/dist/sdk-channels-S6j6AH8v.d.cts +103 -0
- package/dist/sdk-channels-S6j6AH8v.d.ts +103 -0
- package/dist/simulation-BfRnC4rg.d.ts +782 -0
- package/dist/simulation-BwZx2pgt.d.cts +782 -0
- package/dist/{standard-match-phase-BzSgBYFg.d.ts → standard-match-phase-D4N-AU0d.d.cts} +3 -13
- package/dist/{standard-match-phase-CvJUW8Oe.d.cts → standard-match-phase-abt8ZjCh.d.ts} +3 -13
- package/dist/transport-CWF29jU6.d.cts +173 -0
- package/dist/transport-CWF29jU6.d.ts +173 -0
- package/dist/types-p28maMEo.d.cts +102 -0
- package/dist/types-p28maMEo.d.ts +102 -0
- package/dist/ui.cjs +2182 -892
- package/dist/ui.cjs.map +1 -1
- package/dist/ui.d.cts +75 -17
- package/dist/ui.d.ts +75 -17
- package/dist/ui.js +554 -393
- package/dist/ui.js.map +1 -1
- package/package.json +38 -21
- package/src/agent/agent-action.ts +0 -39
- package/src/agent/agent-contract-conformance.ts +8 -1
- package/src/agent/agent-contract.ts +2 -4
- package/src/agent/agent-evaluator.ts +95 -0
- package/src/agent/capture-canvas.ts +79 -0
- package/src/agent/host-canvas-capture.ts +189 -0
- package/src/agent-tooling.ts +5 -20
- package/src/arcade/bridge/controller.ts +8 -11
- package/src/arcade/bridge/host.ts +6 -11
- package/src/arcade/bridge/iframe.ts +1 -50
- package/src/arcade/host.ts +0 -1
- package/src/arcade/surface.ts +5 -1
- package/src/arcade/url.ts +2 -9
- package/src/audio/audio-manager.ts +23 -47
- package/src/audio/hooks.tsx +59 -72
- package/src/components/controller-player-name-field.tsx +2 -2
- package/src/components/controller-primary-action.tsx +1 -1
- package/src/components/controls.tsx +398 -0
- package/src/components/gamepad-layout.tsx +69 -0
- package/src/components/join-url-controls.tsx +5 -1
- package/src/components/lifecycle-action-group.tsx +1 -1
- package/src/components/player-avatar.tsx +50 -3
- package/src/components/room-qr-code.tsx +36 -77
- package/src/components/stage-capture-surface.tsx +91 -0
- package/src/components/surface-viewport.tsx +16 -3
- package/src/components/ui/button.tsx +1 -1
- package/src/constants.ts +0 -15
- package/src/context/air-jam-context.tsx +56 -187
- package/src/context/session-providers.tsx +13 -10
- package/src/controller-bridge.ts +7 -0
- package/src/core/assets.ts +48 -0
- package/src/core/config.ts +70 -0
- package/src/core/connection-store.ts +77 -0
- package/src/core/controller-input.ts +147 -0
- package/src/core/controller-runtime.ts +427 -0
- package/src/core/dev-events.ts +18 -0
- package/src/core/environment.ts +132 -0
- package/src/core/game-description.ts +44 -0
- package/src/core/game.ts +130 -0
- package/src/core/host-input.ts +207 -0
- package/src/core/host-runtime.ts +988 -0
- package/src/core/hosted-rooms.ts +26 -0
- package/src/core/input-bindings.ts +180 -0
- package/src/core/input-log.ts +144 -0
- package/src/core/input.ts +228 -0
- package/src/core/local-input.ts +319 -0
- package/src/core/replay-input-log.ts +298 -0
- package/src/core/replicated-store.ts +1178 -0
- package/src/core/room-action-ack.ts +43 -0
- package/src/core/settings.ts +202 -0
- package/src/core/simulation.ts +307 -0
- package/src/core/theme.ts +33 -0
- package/src/core.ts +162 -0
- package/src/dev/browser-log-sink.ts +35 -12
- package/src/diagnostics.ts +5 -6
- package/src/hooks/internal/use-controller-runtime-api.ts +58 -925
- package/src/hooks/internal/use-host-runtime-api.ts +98 -1270
- package/src/hooks/internal/use-runtime-inspection-contract.ts +14 -2
- package/src/hooks/use-air-jam-controller.ts +32 -53
- package/src/hooks/use-air-jam-host.ts +59 -100
- package/src/hooks/use-air-jam-settings.ts +27 -0
- package/src/hooks/use-controller-toasts.ts +16 -19
- package/src/hooks/use-host-agent-capture.ts +31 -0
- package/src/hooks/use-lifecycle-action-group-model.ts +1 -1
- package/src/hooks/use-send-signal.ts +23 -156
- package/src/hooks/use-simulation.ts +83 -0
- package/src/index.ts +24 -85
- package/src/lifecycle/index.ts +0 -4
- package/src/lifecycle/standard-match-phase.ts +1 -22
- package/src/metadata/manifest.ts +8 -19
- package/src/metadata.ts +1 -1
- package/src/platform-machine.ts +127 -3
- package/src/prefabs/types.ts +91 -20
- package/src/prefabs/view.ts +82 -0
- package/src/prefabs.ts +19 -0
- package/src/preview/host-workspace.tsx +4 -9
- package/src/preview/identity.ts +31 -23
- package/src/preview/layout.ts +5 -1
- package/src/preview/manager.ts +205 -78
- package/src/preview/messages.ts +47 -0
- package/src/preview/ownership.ts +6 -1
- package/src/preview/url.ts +46 -23
- package/src/preview/window.tsx +26 -69
- package/src/preview/workspace-local-seats.ts +166 -0
- package/src/preview/workspace.tsx +89 -37
- package/src/preview.ts +27 -15
- package/src/protocol/actions.ts +58 -0
- package/src/protocol/arcade-platform-actions.ts +2 -16
- package/src/protocol/controller.ts +14 -174
- package/src/protocol/core.ts +8 -15
- package/src/protocol/dev-log-events.ts +5 -81
- package/src/protocol/leased-control.ts +177 -0
- package/src/protocol/room/addressing.ts +35 -0
- package/src/protocol/room/close-codes.ts +33 -0
- package/src/protocol/room/frames.ts +343 -0
- package/src/protocol/room/input-codec.ts +182 -0
- package/src/protocol/room/limits.ts +58 -0
- package/src/protocol/room/patch.ts +135 -0
- package/src/protocol/room/sdk-channels.ts +81 -0
- package/src/protocol/room/seat-id.ts +31 -0
- package/src/protocol/room/transport.ts +63 -0
- package/src/protocol/room/weight.ts +58 -0
- package/src/protocol/runtime-reporting.ts +56 -10
- package/src/protocol.ts +2 -7
- package/src/qrcode.d.ts +3 -13
- package/src/room-protocol.ts +10 -0
- package/src/room-session/browser-wake-events.ts +14 -0
- package/src/room-session/channel-state.ts +293 -0
- package/src/room-session/clock.ts +24 -0
- package/src/room-session/host-room-session.ts +379 -0
- package/src/room-session/input-lane.ts +125 -0
- package/src/room-session/listeners.ts +22 -0
- package/src/room-session/loopback-link.ts +58 -0
- package/src/room-session/phone-room-session.ts +368 -0
- package/src/room-session/port-link.ts +116 -0
- package/src/room-session/room-key.ts +9 -0
- package/src/room-session/roster.ts +23 -0
- package/src/room-session/scoped-connector.ts +577 -0
- package/src/room-session/session-link.ts +306 -0
- package/src/room-session/web-socket-link.ts +57 -0
- package/src/room-session.ts +12 -0
- package/src/runtime/air-jam-config.ts +49 -37
- package/src/runtime/air-jam-error-boundary.tsx +9 -3
- package/src/runtime/arcade-runtime-url.ts +8 -9
- package/src/runtime/browser-controller-environment.ts +116 -0
- package/src/runtime/browser-host-environment.ts +137 -0
- package/src/runtime/browser-replay.ts +211 -0
- package/src/runtime/browser-room.ts +41 -0
- package/src/runtime/connected-runtime-error-boundary.tsx +35 -8
- package/src/runtime/contracts/agent-control.ts +195 -0
- package/src/runtime/contracts/clip.ts +169 -0
- package/src/runtime/contracts/control.ts +653 -16
- package/src/runtime/contracts/controller-agent.ts +130 -0
- package/src/runtime/contracts/input-log.ts +38 -0
- package/src/runtime/contracts/inspection.ts +25 -22
- package/src/runtime/contracts/observation.ts +186 -0
- package/src/runtime/contracts/runtime-identity.ts +43 -0
- package/src/runtime/contracts/timeline.ts +59 -0
- package/src/runtime/controller-agent-bridge.ts +152 -0
- package/src/runtime/controller-bridge-context.ts +29 -0
- package/src/runtime/controller-capture.ts +50 -0
- package/src/runtime/controller-identity.ts +53 -142
- package/src/runtime/controller-presentation.ts +47 -17
- package/src/runtime/controller-press.ts +271 -0
- package/src/runtime/create-air-jam-app.tsx +103 -74
- package/src/runtime/dev-runtime-events.ts +6 -18
- package/src/runtime/embedded-parent.ts +22 -0
- package/src/runtime/embedded-runtime-adapters.ts +10 -9
- package/src/runtime/host-agent-bridge.ts +127 -0
- package/src/runtime/host-capture-boundary.tsx +92 -0
- package/src/runtime/host-capture-context.ts +7 -0
- package/src/runtime/host-clip-reader.ts +93 -0
- package/src/runtime/host-clip-recorder.ts +342 -0
- package/src/runtime/host-input-log-reader.ts +120 -0
- package/src/runtime/host-observation.ts +207 -0
- package/src/runtime/host-pace.ts +36 -0
- package/src/runtime/host-runtime-fault.ts +51 -0
- package/src/runtime/host-timeline.ts +152 -0
- package/src/runtime/local-players.tsx +96 -0
- package/src/runtime/local-seats.ts +612 -0
- package/src/runtime/participant-control.ts +162 -0
- package/src/runtime/prefab-inspection-bridge.ts +174 -0
- package/src/runtime/prefab-inspection-clock.ts +12 -0
- package/src/runtime/prefab-inspection-context.ts +20 -0
- package/src/runtime/prefab-inspection-runtime.tsx +328 -0
- package/src/runtime/preview-inspection-bridge.ts +130 -0
- package/src/runtime/replay-runtime.tsx +101 -0
- package/src/runtime/room-bridge.ts +110 -0
- package/src/runtime/runtime-owner-contexts.tsx +9 -0
- package/src/runtime/runtime-session-params.ts +20 -23
- package/src/runtime/session-runtimes.tsx +231 -64
- package/src/runtime/stage-capture.ts +25 -0
- package/src/runtime-control.ts +41 -0
- package/src/runtime-inspection.ts +14 -7
- package/src/runtime-topology.ts +7 -8
- package/src/settings/platform-settings-runtime.tsx +47 -2
- package/src/settings/platform-settings.ts +0 -65
- package/src/store/use-air-jam-store.ts +73 -0
- package/src/ui.ts +3 -3
- package/src/utils/is-rpc-serializable.ts +11 -19
- package/src/utils/url-builder.ts +0 -7
- package/dist/air-jam-context-BlLPvCup.d.cts +0 -175
- package/dist/air-jam-context-DTsxF-tP.d.ts +0 -175
- package/dist/arcade/bridge.cjs +0 -1087
- package/dist/arcade/bridge.cjs.map +0 -1
- package/dist/arcade/bridge.d.cts +0 -11
- package/dist/arcade/bridge.d.ts +0 -11
- package/dist/arcade/bridge.js +0 -78
- package/dist/arcade/bridge.js.map +0 -1
- package/dist/arcade-runtime-url-BW-MUAOY.d.cts +0 -28
- package/dist/arcade-runtime-url-l8qj01Pg.d.ts +0 -28
- package/dist/arcade.cjs +0 -1767
- package/dist/arcade.cjs.map +0 -1
- package/dist/arcade.d.cts +0 -18
- package/dist/arcade.d.ts +0 -18
- package/dist/arcade.js +0 -129
- package/dist/arcade.js.map +0 -1
- package/dist/chunk-2SZ2YYGJ.js +0 -280
- package/dist/chunk-2SZ2YYGJ.js.map +0 -1
- package/dist/chunk-32RSSFSF.js +0 -214
- package/dist/chunk-32RSSFSF.js.map +0 -1
- package/dist/chunk-3USU7GY2.js.map +0 -1
- package/dist/chunk-3YMUAKPU.js +0 -10
- package/dist/chunk-3YMUAKPU.js.map +0 -1
- package/dist/chunk-56DM2KEW.js +0 -14
- package/dist/chunk-56DM2KEW.js.map +0 -1
- package/dist/chunk-BE6Z4SIT.js.map +0 -1
- package/dist/chunk-CM53YLT5.js +0 -59
- package/dist/chunk-CM53YLT5.js.map +0 -1
- package/dist/chunk-CV3PBXPT.js.map +0 -1
- package/dist/chunk-D4VDEVTZ.js.map +0 -1
- package/dist/chunk-EVZJA6RN.js.map +0 -1
- package/dist/chunk-FUA6EMSJ.js +0 -90
- package/dist/chunk-FUA6EMSJ.js.map +0 -1
- package/dist/chunk-GMLU7RI5.js +0 -70
- package/dist/chunk-GMLU7RI5.js.map +0 -1
- package/dist/chunk-IG6GZZSS.js.map +0 -1
- package/dist/chunk-IKKDONQL.js +0 -1
- package/dist/chunk-IKKDONQL.js.map +0 -1
- package/dist/chunk-ITMQSBTH.js +0 -26
- package/dist/chunk-ITMQSBTH.js.map +0 -1
- package/dist/chunk-J5MCII33.js +0 -620
- package/dist/chunk-J5MCII33.js.map +0 -1
- package/dist/chunk-JTF47B56.js +0 -1
- package/dist/chunk-JTF47B56.js.map +0 -1
- package/dist/chunk-K4OZ54UD.js.map +0 -1
- package/dist/chunk-LIHEEAVE.js +0 -191
- package/dist/chunk-LIHEEAVE.js.map +0 -1
- package/dist/chunk-LIXPF4P6.js +0 -22
- package/dist/chunk-LIXPF4P6.js.map +0 -1
- package/dist/chunk-MIMPMB7O.js.map +0 -1
- package/dist/chunk-MPDMJIX5.js +0 -1
- package/dist/chunk-MPDMJIX5.js.map +0 -1
- package/dist/chunk-O6X7FJ6N.js.map +0 -1
- package/dist/chunk-PSUYTD2L.js.map +0 -1
- package/dist/chunk-QO4KFUEI.js +0 -32
- package/dist/chunk-QO4KFUEI.js.map +0 -1
- package/dist/chunk-QTLYZADF.js +0 -125
- package/dist/chunk-QTLYZADF.js.map +0 -1
- package/dist/chunk-TGRTEWYV.js +0 -195
- package/dist/chunk-TGRTEWYV.js.map +0 -1
- package/dist/chunk-TTQDHKXL.js +0 -3017
- package/dist/chunk-TTQDHKXL.js.map +0 -1
- package/dist/chunk-UCPY7UJC.js +0 -8
- package/dist/chunk-UCPY7UJC.js.map +0 -1
- package/dist/chunk-UPV6YWT5.js +0 -43
- package/dist/chunk-UPV6YWT5.js.map +0 -1
- package/dist/chunk-UWJOIVON.js.map +0 -1
- package/dist/chunk-W2VK36RO.js +0 -11
- package/dist/chunk-W2VK36RO.js.map +0 -1
- package/dist/chunk-X24K52DG.js.map +0 -1
- package/dist/chunk-X35LLCWV.js.map +0 -1
- package/dist/chunk-YXHH3MQT.js +0 -230
- package/dist/chunk-YXHH3MQT.js.map +0 -1
- package/dist/controller-PZEM_1cH.d.ts +0 -176
- package/dist/controller-vj82tKm4.d.cts +0 -176
- package/dist/dev-log-events-BCJKmygo.d.cts +0 -120
- package/dist/dev-log-events-BCJKmygo.d.ts +0 -120
- package/dist/handshake-CC_LrK5g.d.cts +0 -31
- package/dist/handshake-CC_LrK5g.d.ts +0 -31
- package/dist/host-B9pRy0Aa.d.cts +0 -122
- package/dist/host-DylGsX7p.d.ts +0 -122
- package/dist/notices-C4bao3oi.d.ts +0 -38
- package/dist/notices-DNdOjwtj.d.cts +0 -38
- package/dist/realtime-client-Cu8yVJFw.d.cts +0 -15
- package/dist/realtime-client-Cu8yVJFw.d.ts +0 -15
- package/dist/runtime-reporting-pe-eryVz.d.cts +0 -27
- package/dist/runtime-reporting-pe-eryVz.d.ts +0 -27
- package/dist/signals-ZHftIKuc.d.cts +0 -33
- package/dist/signals-ZHftIKuc.d.ts +0 -33
- package/dist/sync-xtPfWhif.d.cts +0 -81
- package/dist/sync-xtPfWhif.d.ts +0 -81
- package/src/arcade/bridge.ts +0 -3
- package/src/arcade.ts +0 -4
- package/src/context/socket-manager.ts +0 -72
- package/src/events.ts +0 -119
- package/src/hooks/use-connection-status.ts +0 -8
- package/src/hooks/use-controller-tick.ts +0 -65
- package/src/hooks/use-get-input.ts +0 -100
- package/src/hooks/use-host-arcade-restore.ts +0 -35
- package/src/hooks/use-host-tick.ts +0 -171
- package/src/hooks/use-input-writer.ts +0 -83
- package/src/hooks/use-players.ts +0 -12
- package/src/internal/input-manager.ts +0 -356
- package/src/protocol/errors.ts +0 -21
- package/src/protocol/host-grant.ts +0 -103
- package/src/protocol/host.ts +0 -150
- package/src/protocol/notices.ts +0 -43
- package/src/protocol/signals.ts +0 -38
- package/src/protocol/socket-events.ts +0 -152
- package/src/protocol/sync.ts +0 -105
- package/src/runtime/admission-retry.ts +0 -62
- package/src/runtime/bridge-envelope-args.ts +0 -21
- package/src/runtime/controller-bridge.ts +0 -439
- package/src/runtime/controller-realtime-client.ts +0 -552
- package/src/runtime/host-bridge.ts +0 -380
- package/src/runtime/host-realtime-client.ts +0 -550
- package/src/runtime/realtime-client.ts +0 -20
- package/src/runtime/validate-arcade-bridge-attach.ts +0 -14
- package/src/state/connection-store.ts +0 -159
- package/src/store/create-air-jam-store.ts +0 -1193
- package/src/store/index.ts +0 -1
- package/src/utils/ids.ts +0 -58
package/dist/ui.js
CHANGED
|
@@ -1,42 +1,53 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
publishEmbeddedControllerPresentation
|
|
3
|
+
} from "./chunk-QTNYGAZ7.js";
|
|
4
4
|
import {
|
|
5
5
|
useAirJamController
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
createControllerPresentationSyncMessage
|
|
9
|
-
} from "./chunk-32RSSFSF.js";
|
|
10
|
-
import "./chunk-56DM2KEW.js";
|
|
11
|
-
import "./chunk-X24K52DG.js";
|
|
6
|
+
} from "./chunk-I6TSHJF7.js";
|
|
12
7
|
import {
|
|
13
8
|
Button,
|
|
14
9
|
Slider,
|
|
15
|
-
buttonVariants,
|
|
16
10
|
cn,
|
|
11
|
+
createSurfaceViewportScaleStyle,
|
|
12
|
+
resolveSurfaceViewportAvailableSize,
|
|
13
|
+
resolveSurfaceViewportReferenceSize,
|
|
14
|
+
resolveSurfaceViewportScale,
|
|
17
15
|
shellFieldClassName,
|
|
18
16
|
shellHeaderClassName,
|
|
19
17
|
shellHelperTextClassName,
|
|
20
18
|
shellLabelClassName,
|
|
21
19
|
shellUtilityButtonClassName
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import {
|
|
24
|
-
usePlatformAudioSettings
|
|
25
|
-
} from "./chunk-2SZ2YYGJ.js";
|
|
26
|
-
import "./chunk-3YMUAKPU.js";
|
|
27
|
-
import "./chunk-BE6Z4SIT.js";
|
|
28
|
-
import "./chunk-MIMPMB7O.js";
|
|
29
|
-
import "./chunk-CV3PBXPT.js";
|
|
20
|
+
} from "./chunk-6ZJUA63D.js";
|
|
30
21
|
import {
|
|
22
|
+
controllerRuntimeContext,
|
|
23
|
+
fixedControllerOrientationContext,
|
|
24
|
+
readEmbeddedHostChildSession,
|
|
25
|
+
usePlatformAudioSettings,
|
|
31
26
|
useSessionScope
|
|
32
|
-
} from "./chunk-
|
|
33
|
-
import "./chunk-
|
|
34
|
-
import "./chunk-
|
|
35
|
-
import "./chunk-
|
|
36
|
-
import "./chunk-
|
|
37
|
-
import "./chunk-
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
27
|
+
} from "./chunk-TFW4NJW2.js";
|
|
28
|
+
import "./chunk-QHBRHYMV.js";
|
|
29
|
+
import "./chunk-M5553I2G.js";
|
|
30
|
+
import "./chunk-EG25EXSA.js";
|
|
31
|
+
import "./chunk-2QZADUGA.js";
|
|
32
|
+
import "./chunk-LX6CTPDW.js";
|
|
33
|
+
import "./chunk-FJ4J2BEC.js";
|
|
34
|
+
import "./chunk-MD25536W.js";
|
|
35
|
+
import "./chunk-C5GS2GMK.js";
|
|
36
|
+
import "./chunk-5TVVPBQI.js";
|
|
37
|
+
import {
|
|
38
|
+
createAirJamDiagnosticError
|
|
39
|
+
} from "./chunk-DBF7NJ3S.js";
|
|
40
|
+
import "./chunk-KUGROY5S.js";
|
|
41
|
+
import "./chunk-MJAWAHLT.js";
|
|
42
|
+
import "./chunk-6Y3F6Y2K.js";
|
|
43
|
+
import "./chunk-KSYN4I5Y.js";
|
|
44
|
+
import "./chunk-CDL7LYZH.js";
|
|
45
|
+
import "./chunk-WAFGYJZN.js";
|
|
46
|
+
import "./chunk-H4DEVMTO.js";
|
|
47
|
+
import "./chunk-2H2FGF3H.js";
|
|
48
|
+
import "./chunk-C5722GTG.js";
|
|
49
|
+
import "./chunk-5CRZFIN6.js";
|
|
50
|
+
import "./chunk-24NZZOIO.js";
|
|
40
51
|
|
|
41
52
|
// src/components/connection-status-pill.tsx
|
|
42
53
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -218,7 +229,7 @@ var ControllerPrimaryAction = ({
|
|
|
218
229
|
children: [
|
|
219
230
|
/* @__PURE__ */ jsxs3("div", { className: "min-w-0", children: [
|
|
220
231
|
/* @__PURE__ */ jsx3("div", { className: "truncate text-base font-black tracking-[0.12em] uppercase sm:text-lg", children: label }),
|
|
221
|
-
helper ? /* @__PURE__ */ jsx3("div", { className: "mt-1 text-sm/5 font-medium tracking-normal normal-case opacity-80", children: helper }) : null
|
|
232
|
+
helper ? /* @__PURE__ */ jsx3("div", { className: "mt-1 text-sm/5 font-medium tracking-normal whitespace-normal normal-case opacity-80", children: helper }) : null
|
|
222
233
|
] }),
|
|
223
234
|
icon ? /* @__PURE__ */ jsx3("div", { className: "ml-4 flex shrink-0 items-center justify-center", children: icon }) : null
|
|
224
235
|
]
|
|
@@ -226,9 +237,332 @@ var ControllerPrimaryAction = ({
|
|
|
226
237
|
) });
|
|
227
238
|
};
|
|
228
239
|
|
|
240
|
+
// src/components/controls.tsx
|
|
241
|
+
import {
|
|
242
|
+
useCallback as useCallback2,
|
|
243
|
+
useContext,
|
|
244
|
+
useEffect as useEffect2,
|
|
245
|
+
useRef as useRef2,
|
|
246
|
+
useState as useState2,
|
|
247
|
+
useSyncExternalStore
|
|
248
|
+
} from "react";
|
|
249
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
250
|
+
var useControllerInput = () => {
|
|
251
|
+
const runtime = useContext(
|
|
252
|
+
controllerRuntimeContext
|
|
253
|
+
);
|
|
254
|
+
if (!runtime?.input)
|
|
255
|
+
throw createAirJamDiagnosticError(
|
|
256
|
+
"AJ_INPUT_NOT_DECLARED",
|
|
257
|
+
"Phone controls send declared controls. Declare them with defineAirJamGame({ input }) and render controls inside <airjam.Controller>."
|
|
258
|
+
);
|
|
259
|
+
return runtime.input;
|
|
260
|
+
};
|
|
261
|
+
var capturePointer = (event) => {
|
|
262
|
+
try {
|
|
263
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
264
|
+
} catch {
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
var isPressKey = (event) => event.key === " " || event.key === "Enter";
|
|
268
|
+
var usePress = (start, disabled, onActiveChange) => {
|
|
269
|
+
const release = useRef2(null);
|
|
270
|
+
const pointer = useRef2(null);
|
|
271
|
+
const [active, setActive] = useState2(false);
|
|
272
|
+
const onActiveChangeRef = useRef2(onActiveChange);
|
|
273
|
+
useEffect2(() => {
|
|
274
|
+
onActiveChangeRef.current = onActiveChange;
|
|
275
|
+
});
|
|
276
|
+
const begin = useCallback2(() => {
|
|
277
|
+
if (release.current) return false;
|
|
278
|
+
release.current = start();
|
|
279
|
+
setActive(true);
|
|
280
|
+
onActiveChangeRef.current?.(true);
|
|
281
|
+
return true;
|
|
282
|
+
}, [start]);
|
|
283
|
+
const end = useCallback2(() => {
|
|
284
|
+
pointer.current = null;
|
|
285
|
+
if (!release.current) return;
|
|
286
|
+
release.current();
|
|
287
|
+
release.current = null;
|
|
288
|
+
setActive(false);
|
|
289
|
+
onActiveChangeRef.current?.(false);
|
|
290
|
+
}, []);
|
|
291
|
+
useEffect2(() => {
|
|
292
|
+
if (disabled) end();
|
|
293
|
+
}, [disabled, end]);
|
|
294
|
+
useEffect2(() => end, [end]);
|
|
295
|
+
const endPointer = (event) => {
|
|
296
|
+
if (event.pointerId === pointer.current) end();
|
|
297
|
+
};
|
|
298
|
+
return {
|
|
299
|
+
active,
|
|
300
|
+
handlers: {
|
|
301
|
+
onPointerDown: (event) => {
|
|
302
|
+
if (disabled || event.button !== 0 || !begin()) return;
|
|
303
|
+
event.preventDefault();
|
|
304
|
+
pointer.current = event.pointerId;
|
|
305
|
+
capturePointer(event);
|
|
306
|
+
},
|
|
307
|
+
onPointerUp: endPointer,
|
|
308
|
+
onPointerCancel: endPointer,
|
|
309
|
+
onLostPointerCapture: endPointer,
|
|
310
|
+
onKeyDown: (event) => {
|
|
311
|
+
if (disabled || !isPressKey(event)) return;
|
|
312
|
+
event.preventDefault();
|
|
313
|
+
if (!event.repeat) begin();
|
|
314
|
+
},
|
|
315
|
+
onKeyUp: (event) => {
|
|
316
|
+
if (!isPressKey(event)) return;
|
|
317
|
+
event.preventDefault();
|
|
318
|
+
end();
|
|
319
|
+
},
|
|
320
|
+
// Focus leaving ends a key hold; a finger still down keeps its press.
|
|
321
|
+
onBlur: () => {
|
|
322
|
+
if (pointer.current === null) end();
|
|
323
|
+
},
|
|
324
|
+
onContextMenu: (event) => event.preventDefault()
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
var ControlButton = ({
|
|
329
|
+
control,
|
|
330
|
+
disabled = false,
|
|
331
|
+
onActiveChange,
|
|
332
|
+
className,
|
|
333
|
+
...props
|
|
334
|
+
}) => {
|
|
335
|
+
const input = useControllerInput();
|
|
336
|
+
const press = useCallback2(
|
|
337
|
+
() => input.press(control.name),
|
|
338
|
+
[input, control.name]
|
|
339
|
+
);
|
|
340
|
+
const { active, handlers } = usePress(press, disabled, onActiveChange);
|
|
341
|
+
return /* @__PURE__ */ jsx4(
|
|
342
|
+
"button",
|
|
343
|
+
{
|
|
344
|
+
type: "button",
|
|
345
|
+
...props,
|
|
346
|
+
...handlers,
|
|
347
|
+
disabled,
|
|
348
|
+
"data-active": active,
|
|
349
|
+
className: cn("touch-none select-none", className)
|
|
350
|
+
}
|
|
351
|
+
);
|
|
352
|
+
};
|
|
353
|
+
var AxisButton = ({
|
|
354
|
+
control,
|
|
355
|
+
value,
|
|
356
|
+
disabled = false,
|
|
357
|
+
onActiveChange,
|
|
358
|
+
className,
|
|
359
|
+
...props
|
|
360
|
+
}) => {
|
|
361
|
+
const input = useControllerInput();
|
|
362
|
+
const hold = useCallback2(
|
|
363
|
+
() => input.hold(control.name, value),
|
|
364
|
+
[input, control.name, value]
|
|
365
|
+
);
|
|
366
|
+
const { active, handlers } = usePress(hold, disabled, onActiveChange);
|
|
367
|
+
return /* @__PURE__ */ jsx4(
|
|
368
|
+
"button",
|
|
369
|
+
{
|
|
370
|
+
type: "button",
|
|
371
|
+
...props,
|
|
372
|
+
...handlers,
|
|
373
|
+
disabled,
|
|
374
|
+
"data-active": active,
|
|
375
|
+
className: cn("touch-none select-none", className)
|
|
376
|
+
}
|
|
377
|
+
);
|
|
378
|
+
};
|
|
379
|
+
var centre = (element) => {
|
|
380
|
+
const rect = element?.getBoundingClientRect();
|
|
381
|
+
return rect ? { x: rect.x + rect.width / 2, y: rect.y + rect.height / 2 } : null;
|
|
382
|
+
};
|
|
383
|
+
var resolveStickPoint = (point, origin, right, bottom) => {
|
|
384
|
+
const xAxis = { x: right.x - origin.x, y: right.y - origin.y };
|
|
385
|
+
const yAxis = { x: bottom.x - origin.x, y: bottom.y - origin.y };
|
|
386
|
+
const determinant = xAxis.x * yAxis.y - xAxis.y * yAxis.x;
|
|
387
|
+
if (!Number.isFinite(determinant) || Math.abs(determinant) < 1e-3)
|
|
388
|
+
return { x: 0, y: 0 };
|
|
389
|
+
const offset = { x: point.x - origin.x, y: point.y - origin.y };
|
|
390
|
+
const across = (offset.x * yAxis.y - offset.y * yAxis.x) / determinant;
|
|
391
|
+
const down = (xAxis.x * offset.y - xAxis.y * offset.x) / determinant;
|
|
392
|
+
return { x: 2 * across - 1, y: 2 * down - 1 };
|
|
393
|
+
};
|
|
394
|
+
var shapeStick = (vector, directions, deadzone) => {
|
|
395
|
+
const length = Math.hypot(vector.x, vector.y);
|
|
396
|
+
if (length <= deadzone) return { x: 0, y: 0 };
|
|
397
|
+
if (directions === "4-way")
|
|
398
|
+
return Math.abs(vector.x) > Math.abs(vector.y) ? { x: Math.sign(vector.x), y: 0 } : { x: 0, y: Math.sign(vector.y) };
|
|
399
|
+
return length > 1 ? { x: vector.x / length, y: vector.y / length } : vector;
|
|
400
|
+
};
|
|
401
|
+
var CENTRE = { x: 0, y: 0 };
|
|
402
|
+
var Stick = ({
|
|
403
|
+
control,
|
|
404
|
+
directions = "any",
|
|
405
|
+
deadzone = 0,
|
|
406
|
+
disabled = false,
|
|
407
|
+
knobClassName,
|
|
408
|
+
knob,
|
|
409
|
+
children,
|
|
410
|
+
onActiveChange,
|
|
411
|
+
className,
|
|
412
|
+
...props
|
|
413
|
+
}) => {
|
|
414
|
+
const fixedOrientation = useContext(fixedControllerOrientationContext);
|
|
415
|
+
if (fixedOrientation === null)
|
|
416
|
+
throw new Error(
|
|
417
|
+
"Stick requires joystick input: declare 'joystick' in inputModalities in airjam.config."
|
|
418
|
+
);
|
|
419
|
+
const input = useControllerInput();
|
|
420
|
+
const origin = useRef2(null);
|
|
421
|
+
const right = useRef2(null);
|
|
422
|
+
const bottom = useRef2(null);
|
|
423
|
+
const pointer = useRef2(null);
|
|
424
|
+
const [active, setActive] = useState2(false);
|
|
425
|
+
const subscribe = useCallback2(
|
|
426
|
+
(listener) => input.subscribe(listener),
|
|
427
|
+
[input]
|
|
428
|
+
);
|
|
429
|
+
const value = useSyncExternalStore(
|
|
430
|
+
subscribe,
|
|
431
|
+
() => input.value(control.name),
|
|
432
|
+
() => CENTRE
|
|
433
|
+
);
|
|
434
|
+
const setActiveState = (next) => {
|
|
435
|
+
setActive(next);
|
|
436
|
+
onActiveChange?.(next);
|
|
437
|
+
};
|
|
438
|
+
const follow = (event) => {
|
|
439
|
+
const corners = [origin, right, bottom].map(
|
|
440
|
+
({ current }) => centre(current)
|
|
441
|
+
);
|
|
442
|
+
const [topLeft, topRight, bottomLeft] = corners;
|
|
443
|
+
if (!topLeft || !topRight || !bottomLeft) return;
|
|
444
|
+
input.set(
|
|
445
|
+
control.name,
|
|
446
|
+
shapeStick(
|
|
447
|
+
resolveStickPoint(
|
|
448
|
+
{ x: event.clientX, y: event.clientY },
|
|
449
|
+
topLeft,
|
|
450
|
+
topRight,
|
|
451
|
+
bottomLeft
|
|
452
|
+
),
|
|
453
|
+
directions,
|
|
454
|
+
deadzone
|
|
455
|
+
)
|
|
456
|
+
);
|
|
457
|
+
};
|
|
458
|
+
const end = (event) => {
|
|
459
|
+
if (event.pointerId !== pointer.current) return;
|
|
460
|
+
pointer.current = null;
|
|
461
|
+
input.set(control.name, CENTRE);
|
|
462
|
+
setActiveState(false);
|
|
463
|
+
};
|
|
464
|
+
useEffect2(() => {
|
|
465
|
+
if (!disabled || pointer.current === null) return;
|
|
466
|
+
pointer.current = null;
|
|
467
|
+
input.set(control.name, CENTRE);
|
|
468
|
+
setActive(false);
|
|
469
|
+
}, [disabled, input, control.name]);
|
|
470
|
+
const marker = "pointer-events-none absolute size-0";
|
|
471
|
+
return /* @__PURE__ */ jsxs4(
|
|
472
|
+
"div",
|
|
473
|
+
{
|
|
474
|
+
role: "application",
|
|
475
|
+
"aria-label": "Joystick",
|
|
476
|
+
...props,
|
|
477
|
+
"data-active": active,
|
|
478
|
+
className: cn("relative touch-none select-none", className),
|
|
479
|
+
onPointerDown: (event) => {
|
|
480
|
+
if (disabled || pointer.current !== null || event.button !== 0) return;
|
|
481
|
+
event.preventDefault();
|
|
482
|
+
pointer.current = event.pointerId;
|
|
483
|
+
capturePointer(event);
|
|
484
|
+
setActiveState(true);
|
|
485
|
+
follow(event);
|
|
486
|
+
},
|
|
487
|
+
onPointerMove: (event) => {
|
|
488
|
+
if (event.pointerId === pointer.current) follow(event);
|
|
489
|
+
},
|
|
490
|
+
onPointerUp: end,
|
|
491
|
+
onPointerCancel: end,
|
|
492
|
+
onLostPointerCapture: end,
|
|
493
|
+
onContextMenu: (event) => event.preventDefault(),
|
|
494
|
+
children: [
|
|
495
|
+
/* @__PURE__ */ jsx4("span", { ref: origin, className: cn(marker, "top-0 left-0") }),
|
|
496
|
+
/* @__PURE__ */ jsx4("span", { ref: right, className: cn(marker, "top-0 left-full") }),
|
|
497
|
+
/* @__PURE__ */ jsx4("span", { ref: bottom, className: cn(marker, "top-full left-0") }),
|
|
498
|
+
typeof children === "function" ? children({ value, active }) : /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
499
|
+
children,
|
|
500
|
+
/* @__PURE__ */ jsx4(
|
|
501
|
+
"span",
|
|
502
|
+
{
|
|
503
|
+
className: cn(
|
|
504
|
+
"pointer-events-none absolute top-1/2 left-1/2 flex size-1/3 items-center justify-center rounded-full bg-current/30",
|
|
505
|
+
!active && "transition-transform duration-150 ease-out",
|
|
506
|
+
knobClassName
|
|
507
|
+
),
|
|
508
|
+
style: {
|
|
509
|
+
transform: `translate(calc(-50% + ${value.x * 100}%), calc(-50% + ${value.y * 100}%))`
|
|
510
|
+
},
|
|
511
|
+
children: knob
|
|
512
|
+
}
|
|
513
|
+
)
|
|
514
|
+
] })
|
|
515
|
+
]
|
|
516
|
+
}
|
|
517
|
+
);
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
// src/components/gamepad-layout.tsx
|
|
521
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
522
|
+
var layoutStyle = {
|
|
523
|
+
containerType: "size",
|
|
524
|
+
"--airjam-thumb-size": "min(62cqh, 27cqw)",
|
|
525
|
+
"--airjam-thumb-margin": "min(10cqh, 5cqw)"
|
|
526
|
+
};
|
|
527
|
+
var zoneStyle = {
|
|
528
|
+
width: "calc(var(--airjam-thumb-size) + 2 * var(--airjam-thumb-margin))"
|
|
529
|
+
};
|
|
530
|
+
var slotStyle = {
|
|
531
|
+
width: "var(--airjam-thumb-size)",
|
|
532
|
+
height: "var(--airjam-thumb-size)"
|
|
533
|
+
};
|
|
534
|
+
var ThumbZone = ({ children }) => /* @__PURE__ */ jsx5(
|
|
535
|
+
"div",
|
|
536
|
+
{
|
|
537
|
+
className: "flex h-full flex-none items-center justify-center",
|
|
538
|
+
style: zoneStyle,
|
|
539
|
+
children: /* @__PURE__ */ jsx5("div", { className: "grid *:size-full", style: slotStyle, children })
|
|
540
|
+
}
|
|
541
|
+
);
|
|
542
|
+
var GamepadLayout = ({
|
|
543
|
+
left,
|
|
544
|
+
right,
|
|
545
|
+
center,
|
|
546
|
+
className,
|
|
547
|
+
style,
|
|
548
|
+
...props
|
|
549
|
+
}) => /* @__PURE__ */ jsxs5(
|
|
550
|
+
"div",
|
|
551
|
+
{
|
|
552
|
+
...props,
|
|
553
|
+
className: cn("flex h-full w-full items-center", className),
|
|
554
|
+
style: { ...layoutStyle, ...style },
|
|
555
|
+
children: [
|
|
556
|
+
/* @__PURE__ */ jsx5(ThumbZone, { children: left }),
|
|
557
|
+
/* @__PURE__ */ jsx5("div", { className: "flex h-full min-w-0 flex-1 flex-col items-center justify-center gap-2 text-center", children: center }),
|
|
558
|
+
/* @__PURE__ */ jsx5(ThumbZone, { children: right })
|
|
559
|
+
]
|
|
560
|
+
}
|
|
561
|
+
);
|
|
562
|
+
|
|
229
563
|
// src/components/host-mute-button.tsx
|
|
230
564
|
import { Volume2, VolumeX } from "lucide-react";
|
|
231
|
-
import { jsx as
|
|
565
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
232
566
|
function HostMuteButton({
|
|
233
567
|
muted,
|
|
234
568
|
onToggle,
|
|
@@ -238,7 +572,7 @@ function HostMuteButton({
|
|
|
238
572
|
unmutedLabel = "Mute"
|
|
239
573
|
}) {
|
|
240
574
|
const label = muted ? mutedLabel : unmutedLabel;
|
|
241
|
-
return /* @__PURE__ */
|
|
575
|
+
return /* @__PURE__ */ jsxs6(
|
|
242
576
|
Button,
|
|
243
577
|
{
|
|
244
578
|
type: "button",
|
|
@@ -253,8 +587,8 @@ function HostMuteButton({
|
|
|
253
587
|
className
|
|
254
588
|
),
|
|
255
589
|
children: [
|
|
256
|
-
muted ? /* @__PURE__ */
|
|
257
|
-
/* @__PURE__ */
|
|
590
|
+
muted ? /* @__PURE__ */ jsx6(VolumeX, { className: "size-4" }) : /* @__PURE__ */ jsx6(Volume2, { className: "size-4" }),
|
|
591
|
+
/* @__PURE__ */ jsx6(
|
|
258
592
|
"span",
|
|
259
593
|
{
|
|
260
594
|
className: cn(
|
|
@@ -274,9 +608,9 @@ import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
|
274
608
|
import { createPortal } from "react-dom";
|
|
275
609
|
|
|
276
610
|
// src/components/room-qr-code.tsx
|
|
277
|
-
import {
|
|
278
|
-
import {
|
|
279
|
-
import { jsx as
|
|
611
|
+
import { create } from "qrcode";
|
|
612
|
+
import { useMemo } from "react";
|
|
613
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
280
614
|
var RoomQrCode = ({
|
|
281
615
|
value,
|
|
282
616
|
size = 180,
|
|
@@ -289,58 +623,24 @@ var RoomQrCode = ({
|
|
|
289
623
|
alt = "Room join QR code"
|
|
290
624
|
}) => {
|
|
291
625
|
const trimmed = value.trim();
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
void toDataURL(trimmed, {
|
|
304
|
-
width: size,
|
|
305
|
-
margin: padding,
|
|
306
|
-
errorCorrectionLevel,
|
|
307
|
-
color: {
|
|
308
|
-
dark: foregroundColor,
|
|
309
|
-
light: backgroundColor
|
|
310
|
-
}
|
|
311
|
-
}).then((nextUrl) => {
|
|
312
|
-
if (!cancelled) {
|
|
313
|
-
setQrState({
|
|
314
|
-
key: qrKey,
|
|
315
|
-
dataUrl: nextUrl,
|
|
316
|
-
error: false
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
}).catch(() => {
|
|
320
|
-
if (!cancelled) {
|
|
321
|
-
setQrState({
|
|
322
|
-
key: qrKey,
|
|
323
|
-
dataUrl: null,
|
|
324
|
-
error: true
|
|
325
|
-
});
|
|
626
|
+
const qr = useMemo(() => {
|
|
627
|
+
if (!trimmed) return null;
|
|
628
|
+
try {
|
|
629
|
+
const { modules } = create(trimmed, { errorCorrectionLevel });
|
|
630
|
+
let path = "";
|
|
631
|
+
for (let row = 0; row < modules.size; row += 1) {
|
|
632
|
+
for (let column = 0; column < modules.size; column += 1) {
|
|
633
|
+
if (modules.data[row * modules.size + column]) {
|
|
634
|
+
path += `M${column},${row}h1v1h-1z`;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
326
637
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
}
|
|
331
|
-
}, [
|
|
332
|
-
|
|
333
|
-
errorCorrectionLevel,
|
|
334
|
-
foregroundColor,
|
|
335
|
-
padding,
|
|
336
|
-
size,
|
|
337
|
-
qrKey,
|
|
338
|
-
trimmed
|
|
339
|
-
]);
|
|
340
|
-
const imageSrc = trimmed && qrState.key === qrKey && qrState.dataUrl ? qrState.dataUrl : null;
|
|
341
|
-
const isLoading = !!trimmed && qrState.key !== qrKey;
|
|
342
|
-
const isUnavailable = !trimmed || qrState.key === qrKey && qrState.error;
|
|
343
|
-
return /* @__PURE__ */ jsx5(
|
|
638
|
+
return { path, size: modules.size };
|
|
639
|
+
} catch {
|
|
640
|
+
return null;
|
|
641
|
+
}
|
|
642
|
+
}, [trimmed, errorCorrectionLevel]);
|
|
643
|
+
return /* @__PURE__ */ jsx7(
|
|
344
644
|
"div",
|
|
345
645
|
{
|
|
346
646
|
className,
|
|
@@ -351,25 +651,37 @@ var RoomQrCode = ({
|
|
|
351
651
|
},
|
|
352
652
|
"aria-live": "polite",
|
|
353
653
|
"aria-label": alt,
|
|
354
|
-
children:
|
|
355
|
-
"
|
|
654
|
+
children: qr ? /* @__PURE__ */ jsxs7(
|
|
655
|
+
"svg",
|
|
356
656
|
{
|
|
357
|
-
|
|
358
|
-
alt,
|
|
657
|
+
role: "img",
|
|
658
|
+
"aria-label": alt,
|
|
359
659
|
width: size,
|
|
360
660
|
height: size,
|
|
361
|
-
|
|
661
|
+
viewBox: `${-padding} ${-padding} ${qr.size + padding * 2} ${qr.size + padding * 2}`,
|
|
662
|
+
shapeRendering: "crispEdges",
|
|
663
|
+
className: "h-full w-full rounded-md",
|
|
664
|
+
children: [
|
|
665
|
+
/* @__PURE__ */ jsx7(
|
|
666
|
+
"rect",
|
|
667
|
+
{
|
|
668
|
+
x: -padding,
|
|
669
|
+
y: -padding,
|
|
670
|
+
width: qr.size + padding * 2,
|
|
671
|
+
height: qr.size + padding * 2,
|
|
672
|
+
fill: backgroundColor
|
|
673
|
+
}
|
|
674
|
+
),
|
|
675
|
+
/* @__PURE__ */ jsx7("path", { d: qr.path, fill: foregroundColor })
|
|
676
|
+
]
|
|
362
677
|
}
|
|
363
|
-
) :
|
|
364
|
-
/* @__PURE__ */ jsx5("span", { className: "h-5 w-5 animate-spin rounded-full border-2 border-white/20 border-t-white/80" }),
|
|
365
|
-
/* @__PURE__ */ jsx5("span", { children: "Generating QR\u2026" })
|
|
366
|
-
] }) : /* @__PURE__ */ jsx5("div", { className: "flex h-full w-full items-center justify-center rounded-md bg-black/15 text-xs text-white/70", children: isUnavailable ? "QR unavailable" : "Generating QR\u2026" })
|
|
678
|
+
) : /* @__PURE__ */ jsx7("div", { className: "flex h-full w-full items-center justify-center rounded-md bg-black/15 text-xs text-white/70", children: "QR unavailable" })
|
|
367
679
|
}
|
|
368
680
|
);
|
|
369
681
|
};
|
|
370
682
|
|
|
371
683
|
// src/components/join-qr-overlay.tsx
|
|
372
|
-
import { jsx as
|
|
684
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
373
685
|
var JoinQrOverlay = ({
|
|
374
686
|
open,
|
|
375
687
|
value,
|
|
@@ -429,7 +741,7 @@ var JoinQrOverlay = ({
|
|
|
429
741
|
const handlePanelClick = (event) => {
|
|
430
742
|
event.stopPropagation();
|
|
431
743
|
};
|
|
432
|
-
const dialog = /* @__PURE__ */
|
|
744
|
+
const dialog = /* @__PURE__ */ jsx8(
|
|
433
745
|
"div",
|
|
434
746
|
{
|
|
435
747
|
role: "dialog",
|
|
@@ -441,7 +753,7 @@ var JoinQrOverlay = ({
|
|
|
441
753
|
className
|
|
442
754
|
),
|
|
443
755
|
onClick: onClose,
|
|
444
|
-
children: /* @__PURE__ */
|
|
756
|
+
children: /* @__PURE__ */ jsxs8(
|
|
445
757
|
"div",
|
|
446
758
|
{
|
|
447
759
|
className: cn(
|
|
@@ -451,11 +763,11 @@ var JoinQrOverlay = ({
|
|
|
451
763
|
),
|
|
452
764
|
onClick: handlePanelClick,
|
|
453
765
|
children: [
|
|
454
|
-
/* @__PURE__ */
|
|
455
|
-
/* @__PURE__ */
|
|
456
|
-
roomId ? /* @__PURE__ */
|
|
766
|
+
/* @__PURE__ */ jsxs8("div", { className: "space-y-1", children: [
|
|
767
|
+
/* @__PURE__ */ jsx8("p", { className: "text-[11px] tracking-[0.18em] text-slate-400 uppercase", children: roomLabel }),
|
|
768
|
+
roomId ? /* @__PURE__ */ jsx8("p", { className: "text-2xl font-semibold tracking-tight text-white tabular-nums", children: roomId }) : null
|
|
457
769
|
] }),
|
|
458
|
-
effectiveStatus === "loading" ? /* @__PURE__ */
|
|
770
|
+
effectiveStatus === "loading" ? /* @__PURE__ */ jsxs8(
|
|
459
771
|
"div",
|
|
460
772
|
{
|
|
461
773
|
className: cn(
|
|
@@ -468,11 +780,11 @@ var JoinQrOverlay = ({
|
|
|
468
780
|
aspectRatio: "1 / 1"
|
|
469
781
|
},
|
|
470
782
|
children: [
|
|
471
|
-
/* @__PURE__ */
|
|
472
|
-
/* @__PURE__ */
|
|
783
|
+
/* @__PURE__ */ jsx8("span", { className: "h-8 w-8 animate-spin rounded-full border-2 border-white/15 border-t-white/85" }),
|
|
784
|
+
/* @__PURE__ */ jsx8("span", { children: loadingLabel })
|
|
473
785
|
]
|
|
474
786
|
}
|
|
475
|
-
) : effectiveStatus === "ready" ? /* @__PURE__ */
|
|
787
|
+
) : effectiveStatus === "ready" ? /* @__PURE__ */ jsx8(
|
|
476
788
|
RoomQrCode,
|
|
477
789
|
{
|
|
478
790
|
value: joinUrlValue,
|
|
@@ -491,7 +803,7 @@ var JoinQrOverlay = ({
|
|
|
491
803
|
},
|
|
492
804
|
alt: qrAlt ?? (roomId ? `QR code to join room ${roomId}` : "QR code to join as a controller")
|
|
493
805
|
}
|
|
494
|
-
) : /* @__PURE__ */
|
|
806
|
+
) : /* @__PURE__ */ jsx8(
|
|
495
807
|
"div",
|
|
496
808
|
{
|
|
497
809
|
className: cn(
|
|
@@ -506,7 +818,7 @@ var JoinQrOverlay = ({
|
|
|
506
818
|
children: unavailableLabel
|
|
507
819
|
}
|
|
508
820
|
),
|
|
509
|
-
/* @__PURE__ */
|
|
821
|
+
/* @__PURE__ */ jsx8(
|
|
510
822
|
"p",
|
|
511
823
|
{
|
|
512
824
|
className: cn(
|
|
@@ -516,7 +828,7 @@ var JoinQrOverlay = ({
|
|
|
516
828
|
children: description
|
|
517
829
|
}
|
|
518
830
|
),
|
|
519
|
-
showCloseButton ? /* @__PURE__ */
|
|
831
|
+
showCloseButton ? /* @__PURE__ */ jsx8(
|
|
520
832
|
Button,
|
|
521
833
|
{
|
|
522
834
|
type: "button",
|
|
@@ -543,7 +855,7 @@ var JoinQrOverlay = ({
|
|
|
543
855
|
|
|
544
856
|
// src/components/join-url-action-buttons.tsx
|
|
545
857
|
import { Check, Copy, ExternalLink, QrCode } from "lucide-react";
|
|
546
|
-
import { jsx as
|
|
858
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
547
859
|
var JoinUrlActionButtons = ({
|
|
548
860
|
hasValue,
|
|
549
861
|
copied = false,
|
|
@@ -555,7 +867,7 @@ var JoinUrlActionButtons = ({
|
|
|
555
867
|
buttonClassName
|
|
556
868
|
}) => {
|
|
557
869
|
const showsQrButton = typeof onToggleQr === "function";
|
|
558
|
-
return /* @__PURE__ */
|
|
870
|
+
return /* @__PURE__ */ jsxs9(
|
|
559
871
|
"div",
|
|
560
872
|
{
|
|
561
873
|
className: cn(
|
|
@@ -564,7 +876,7 @@ var JoinUrlActionButtons = ({
|
|
|
564
876
|
className
|
|
565
877
|
),
|
|
566
878
|
children: [
|
|
567
|
-
/* @__PURE__ */
|
|
879
|
+
/* @__PURE__ */ jsxs9(
|
|
568
880
|
Button,
|
|
569
881
|
{
|
|
570
882
|
type: "button",
|
|
@@ -579,12 +891,12 @@ var JoinUrlActionButtons = ({
|
|
|
579
891
|
buttonClassName
|
|
580
892
|
),
|
|
581
893
|
children: [
|
|
582
|
-
copied ? /* @__PURE__ */
|
|
583
|
-
/* @__PURE__ */
|
|
894
|
+
copied ? /* @__PURE__ */ jsx9(Check, { className: "h-4 w-4", "aria-hidden": true }) : /* @__PURE__ */ jsx9(Copy, { className: "h-4 w-4", "aria-hidden": true }),
|
|
895
|
+
/* @__PURE__ */ jsx9("span", { className: "truncate", children: copied ? "Copied" : "Copy" })
|
|
584
896
|
]
|
|
585
897
|
}
|
|
586
898
|
),
|
|
587
|
-
/* @__PURE__ */
|
|
899
|
+
/* @__PURE__ */ jsxs9(
|
|
588
900
|
Button,
|
|
589
901
|
{
|
|
590
902
|
type: "button",
|
|
@@ -599,12 +911,12 @@ var JoinUrlActionButtons = ({
|
|
|
599
911
|
buttonClassName
|
|
600
912
|
),
|
|
601
913
|
children: [
|
|
602
|
-
/* @__PURE__ */
|
|
603
|
-
/* @__PURE__ */
|
|
914
|
+
/* @__PURE__ */ jsx9(ExternalLink, { className: "h-4 w-4", "aria-hidden": true }),
|
|
915
|
+
/* @__PURE__ */ jsx9("span", { className: "truncate", children: "New tab" })
|
|
604
916
|
]
|
|
605
917
|
}
|
|
606
918
|
),
|
|
607
|
-
showsQrButton ? /* @__PURE__ */
|
|
919
|
+
showsQrButton ? /* @__PURE__ */ jsxs9(
|
|
608
920
|
Button,
|
|
609
921
|
{
|
|
610
922
|
type: "button",
|
|
@@ -620,8 +932,8 @@ var JoinUrlActionButtons = ({
|
|
|
620
932
|
buttonClassName
|
|
621
933
|
),
|
|
622
934
|
children: [
|
|
623
|
-
/* @__PURE__ */
|
|
624
|
-
/* @__PURE__ */
|
|
935
|
+
/* @__PURE__ */ jsx9(QrCode, { className: "h-4 w-4", "aria-hidden": true }),
|
|
936
|
+
/* @__PURE__ */ jsx9("span", { className: "truncate", children: qrVisible ? "Hide QR" : "QR code" })
|
|
625
937
|
]
|
|
626
938
|
}
|
|
627
939
|
) : null
|
|
@@ -632,7 +944,7 @@ var JoinUrlActionButtons = ({
|
|
|
632
944
|
|
|
633
945
|
// src/components/join-url-field.tsx
|
|
634
946
|
import { useId } from "react";
|
|
635
|
-
import { jsx as
|
|
947
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
636
948
|
var JoinUrlField = ({
|
|
637
949
|
value,
|
|
638
950
|
label = "Controller link",
|
|
@@ -645,9 +957,9 @@ var JoinUrlField = ({
|
|
|
645
957
|
const hasValue = Boolean(value && value.trim().length > 0);
|
|
646
958
|
const generatedInputId = useId();
|
|
647
959
|
const resolvedInputId = inputId ?? generatedInputId;
|
|
648
|
-
return /* @__PURE__ */
|
|
649
|
-
/* @__PURE__ */
|
|
650
|
-
/* @__PURE__ */
|
|
960
|
+
return /* @__PURE__ */ jsxs10("div", { className: cn("space-y-2.5", className), children: [
|
|
961
|
+
/* @__PURE__ */ jsx10("label", { className: shellLabelClassName, htmlFor: resolvedInputId, children: label }),
|
|
962
|
+
/* @__PURE__ */ jsx10(
|
|
651
963
|
"input",
|
|
652
964
|
{
|
|
653
965
|
id: resolvedInputId,
|
|
@@ -660,12 +972,12 @@ var JoinUrlField = ({
|
|
|
660
972
|
className: cn(shellFieldClassName, inputClassName)
|
|
661
973
|
}
|
|
662
974
|
),
|
|
663
|
-
helperText ? /* @__PURE__ */
|
|
975
|
+
helperText ? /* @__PURE__ */ jsx10("div", { className: shellHelperTextClassName, children: helperText }) : null
|
|
664
976
|
] });
|
|
665
977
|
};
|
|
666
978
|
|
|
667
979
|
// src/components/join-url-controls.tsx
|
|
668
|
-
import { jsx as
|
|
980
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
669
981
|
var JoinUrlControls = ({
|
|
670
982
|
value,
|
|
671
983
|
label = "Controller link",
|
|
@@ -679,9 +991,10 @@ var JoinUrlControls = ({
|
|
|
679
991
|
inputClassName,
|
|
680
992
|
buttonClassName
|
|
681
993
|
}) => {
|
|
994
|
+
if (readEmbeddedHostChildSession()) return null;
|
|
682
995
|
const hasValue = Boolean(value && value.trim().length > 0);
|
|
683
|
-
return /* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
996
|
+
return /* @__PURE__ */ jsx11("div", { className: cn("w-full space-y-3", className), children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-3", children: [
|
|
997
|
+
/* @__PURE__ */ jsx11(
|
|
685
998
|
JoinUrlField,
|
|
686
999
|
{
|
|
687
1000
|
value,
|
|
@@ -691,7 +1004,7 @@ var JoinUrlControls = ({
|
|
|
691
1004
|
inputClassName
|
|
692
1005
|
}
|
|
693
1006
|
),
|
|
694
|
-
/* @__PURE__ */
|
|
1007
|
+
/* @__PURE__ */ jsx11(
|
|
695
1008
|
JoinUrlActionButtons,
|
|
696
1009
|
{
|
|
697
1010
|
hasValue,
|
|
@@ -767,7 +1080,7 @@ var useLifecycleActionGroupModel = ({
|
|
|
767
1080
|
};
|
|
768
1081
|
|
|
769
1082
|
// src/components/lifecycle-action-group.tsx
|
|
770
|
-
import { jsx as
|
|
1083
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
771
1084
|
var LifecycleActionGroup = ({
|
|
772
1085
|
phase,
|
|
773
1086
|
runtimeState,
|
|
@@ -803,23 +1116,23 @@ var LifecycleActionGroup = ({
|
|
|
803
1116
|
const renderIcon = (kind, label) => {
|
|
804
1117
|
switch (kind) {
|
|
805
1118
|
case "start":
|
|
806
|
-
return /* @__PURE__ */
|
|
1119
|
+
return /* @__PURE__ */ jsx12(Play, { "aria-hidden": true, className: "size-4.5" });
|
|
807
1120
|
case "pause-toggle":
|
|
808
|
-
return label.toLowerCase() === "resume" ? /* @__PURE__ */
|
|
1121
|
+
return label.toLowerCase() === "resume" ? /* @__PURE__ */ jsx12(Play, { "aria-hidden": true, className: "size-4.5" }) : /* @__PURE__ */ jsx12(Pause, { "aria-hidden": true, className: "size-4.5" });
|
|
809
1122
|
case "restart":
|
|
810
|
-
return /* @__PURE__ */
|
|
1123
|
+
return /* @__PURE__ */ jsx12(RotateCcw, { "aria-hidden": true, className: "size-4.5" });
|
|
811
1124
|
case "back-to-lobby":
|
|
812
|
-
return /* @__PURE__ */
|
|
1125
|
+
return /* @__PURE__ */ jsx12(House, { "aria-hidden": true, className: "size-4.5" });
|
|
813
1126
|
}
|
|
814
1127
|
};
|
|
815
|
-
return /* @__PURE__ */
|
|
1128
|
+
return /* @__PURE__ */ jsx12(
|
|
816
1129
|
"div",
|
|
817
1130
|
{
|
|
818
1131
|
className: cn(
|
|
819
1132
|
"flex min-w-0 flex-nowrap items-center justify-end gap-1.5 overflow-x-auto",
|
|
820
1133
|
className
|
|
821
1134
|
),
|
|
822
|
-
children: actions.map((action) => /* @__PURE__ */
|
|
1135
|
+
children: actions.map((action) => /* @__PURE__ */ jsx12(
|
|
823
1136
|
Button,
|
|
824
1137
|
{
|
|
825
1138
|
type: "button",
|
|
@@ -842,7 +1155,8 @@ var LifecycleActionGroup = ({
|
|
|
842
1155
|
};
|
|
843
1156
|
|
|
844
1157
|
// src/components/player-avatar.tsx
|
|
845
|
-
import { Bot } from "lucide-react";
|
|
1158
|
+
import { Bot, UserRound } from "lucide-react";
|
|
1159
|
+
import { useState as useState4 } from "react";
|
|
846
1160
|
|
|
847
1161
|
// src/utils/player-avatar-url.ts
|
|
848
1162
|
var DIEBEAR_ADVENTURER_NEUTRAL_SVG_BASE = "https://api.dicebear.com/9.x/adventurer-neutral/svg";
|
|
@@ -874,7 +1188,7 @@ var getDiceBearAdventurerNeutralUrl = (seed) => `${DIEBEAR_ADVENTURER_NEUTRAL_SV
|
|
|
874
1188
|
var getPlayerAvatarImageUrl = (player) => getDiceBearAdventurerNeutralUrl(resolvePlayerAvatarSeed(player));
|
|
875
1189
|
|
|
876
1190
|
// src/components/player-avatar.tsx
|
|
877
|
-
import { jsx as
|
|
1191
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
878
1192
|
var hexToRgba = (hex, opacity) => {
|
|
879
1193
|
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
880
1194
|
if (!result) return `rgba(0, 0, 0, ${opacity})`;
|
|
@@ -889,6 +1203,7 @@ var PlayerAvatar = ({
|
|
|
889
1203
|
size = "md",
|
|
890
1204
|
className = ""
|
|
891
1205
|
}) => {
|
|
1206
|
+
const [failedSrc, setFailedSrc] = useState4(null);
|
|
892
1207
|
const accentColor = player.color || "hsl(var(--border))";
|
|
893
1208
|
const sizeClasses = {
|
|
894
1209
|
sm: "h-9 w-9 border-2",
|
|
@@ -911,7 +1226,7 @@ var PlayerAvatar = ({
|
|
|
911
1226
|
className
|
|
912
1227
|
);
|
|
913
1228
|
if (isBot) {
|
|
914
|
-
return /* @__PURE__ */
|
|
1229
|
+
return /* @__PURE__ */ jsx13(
|
|
915
1230
|
"div",
|
|
916
1231
|
{
|
|
917
1232
|
role: "img",
|
|
@@ -925,15 +1240,38 @@ var PlayerAvatar = ({
|
|
|
925
1240
|
color: accentColor,
|
|
926
1241
|
boxShadow: shadowStyles[size]
|
|
927
1242
|
},
|
|
928
|
-
children: /* @__PURE__ */
|
|
1243
|
+
children: /* @__PURE__ */ jsx13(Bot, { "aria-hidden": "true", className: iconSizeClasses[size] })
|
|
1244
|
+
}
|
|
1245
|
+
);
|
|
1246
|
+
}
|
|
1247
|
+
const src = getPlayerAvatarImageUrl(player);
|
|
1248
|
+
if (failedSrc === src) {
|
|
1249
|
+
const initials = playerInitials(player.label);
|
|
1250
|
+
return /* @__PURE__ */ jsx13(
|
|
1251
|
+
"div",
|
|
1252
|
+
{
|
|
1253
|
+
role: "img",
|
|
1254
|
+
"aria-label": player.label,
|
|
1255
|
+
className: cn(
|
|
1256
|
+
"bg-secondary/40 flex items-center justify-center font-semibold uppercase",
|
|
1257
|
+
initialsSizeClasses[size],
|
|
1258
|
+
shellClassName
|
|
1259
|
+
),
|
|
1260
|
+
style: {
|
|
1261
|
+
borderColor: accentColor,
|
|
1262
|
+
color: accentColor,
|
|
1263
|
+
boxShadow: shadowStyles[size]
|
|
1264
|
+
},
|
|
1265
|
+
children: initials ? /* @__PURE__ */ jsx13("span", { "aria-hidden": "true", children: initials }) : /* @__PURE__ */ jsx13(UserRound, { "aria-hidden": "true", className: iconSizeClasses[size] })
|
|
929
1266
|
}
|
|
930
1267
|
);
|
|
931
1268
|
}
|
|
932
|
-
return /* @__PURE__ */
|
|
1269
|
+
return /* @__PURE__ */ jsx13(
|
|
933
1270
|
"img",
|
|
934
1271
|
{
|
|
935
|
-
src
|
|
1272
|
+
src,
|
|
936
1273
|
alt: player.label,
|
|
1274
|
+
onError: () => setFailedSrc(src),
|
|
937
1275
|
className: cn("bg-secondary/30", shellClassName),
|
|
938
1276
|
style: {
|
|
939
1277
|
borderColor: accentColor,
|
|
@@ -942,9 +1280,15 @@ var PlayerAvatar = ({
|
|
|
942
1280
|
}
|
|
943
1281
|
);
|
|
944
1282
|
};
|
|
1283
|
+
var initialsSizeClasses = {
|
|
1284
|
+
sm: "text-xs",
|
|
1285
|
+
md: "text-sm",
|
|
1286
|
+
lg: "text-base"
|
|
1287
|
+
};
|
|
1288
|
+
var playerInitials = (label) => label.trim().split(/\s+/).filter(Boolean).slice(0, 2).map((word) => Array.from(word)[0] ?? "").join("");
|
|
945
1289
|
|
|
946
1290
|
// src/components/player-avatar-strip.tsx
|
|
947
|
-
import { jsx as
|
|
1291
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
948
1292
|
var overflowSizeClasses = {
|
|
949
1293
|
sm: "h-9 w-9 min-h-9 min-w-9 text-[0.625rem]",
|
|
950
1294
|
md: "h-12 w-12 min-h-12 min-w-12 text-[11px]",
|
|
@@ -960,8 +1304,8 @@ var PlayerAvatarStrip = ({
|
|
|
960
1304
|
}) => {
|
|
961
1305
|
const visible = players.slice(0, maxVisible);
|
|
962
1306
|
const overflow = Math.max(0, players.length - maxVisible);
|
|
963
|
-
return /* @__PURE__ */
|
|
964
|
-
visible.map((player) => /* @__PURE__ */
|
|
1307
|
+
return /* @__PURE__ */ jsxs12("div", { className: cn("flex items-center -space-x-2", className), children: [
|
|
1308
|
+
visible.map((player) => /* @__PURE__ */ jsx14(
|
|
965
1309
|
PlayerAvatar,
|
|
966
1310
|
{
|
|
967
1311
|
player,
|
|
@@ -970,7 +1314,7 @@ var PlayerAvatarStrip = ({
|
|
|
970
1314
|
},
|
|
971
1315
|
player.id
|
|
972
1316
|
)),
|
|
973
|
-
overflow > 0 && /* @__PURE__ */
|
|
1317
|
+
overflow > 0 && /* @__PURE__ */ jsxs12(
|
|
974
1318
|
"div",
|
|
975
1319
|
{
|
|
976
1320
|
className: cn(
|
|
@@ -989,14 +1333,14 @@ var PlayerAvatarStrip = ({
|
|
|
989
1333
|
};
|
|
990
1334
|
|
|
991
1335
|
// src/components/runtime-shell-header.tsx
|
|
992
|
-
import { jsx as
|
|
1336
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
993
1337
|
var RuntimeShellHeader = ({
|
|
994
1338
|
connectionStatus,
|
|
995
1339
|
leftSlot,
|
|
996
1340
|
rightSlot,
|
|
997
1341
|
className
|
|
998
1342
|
}) => {
|
|
999
|
-
return /* @__PURE__ */
|
|
1343
|
+
return /* @__PURE__ */ jsxs13(
|
|
1000
1344
|
"header",
|
|
1001
1345
|
{
|
|
1002
1346
|
className: cn(
|
|
@@ -1005,10 +1349,10 @@ var RuntimeShellHeader = ({
|
|
|
1005
1349
|
className
|
|
1006
1350
|
),
|
|
1007
1351
|
children: [
|
|
1008
|
-
/* @__PURE__ */
|
|
1009
|
-
/* @__PURE__ */
|
|
1010
|
-
/* @__PURE__ */
|
|
1011
|
-
rightSlot ? /* @__PURE__ */
|
|
1352
|
+
/* @__PURE__ */ jsx15("div", { className: "min-w-0 flex-1", children: leftSlot }),
|
|
1353
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex shrink-0 items-center gap-2.5", children: [
|
|
1354
|
+
/* @__PURE__ */ jsx15(ConnectionStatusPill, { status: connectionStatus }),
|
|
1355
|
+
rightSlot ? /* @__PURE__ */ jsx15("div", { className: "flex items-center justify-end", children: rightSlot }) : null
|
|
1012
1356
|
] })
|
|
1013
1357
|
]
|
|
1014
1358
|
}
|
|
@@ -1016,25 +1360,7 @@ var RuntimeShellHeader = ({
|
|
|
1016
1360
|
};
|
|
1017
1361
|
|
|
1018
1362
|
// src/components/surface-viewport.tsx
|
|
1019
|
-
import { useEffect as useEffect4, useMemo, useRef as
|
|
1020
|
-
|
|
1021
|
-
// src/runtime/controller-presentation.ts
|
|
1022
|
-
var publishEmbeddedControllerPresentation = (orientation) => {
|
|
1023
|
-
if (typeof window === "undefined" || window.parent === window) {
|
|
1024
|
-
return;
|
|
1025
|
-
}
|
|
1026
|
-
const runtimeParams = readEmbeddedControllerRuntimeParams();
|
|
1027
|
-
if (!runtimeParams) {
|
|
1028
|
-
return;
|
|
1029
|
-
}
|
|
1030
|
-
window.parent.postMessage(
|
|
1031
|
-
createControllerPresentationSyncMessage({
|
|
1032
|
-
orientation,
|
|
1033
|
-
arcadeSurface: runtimeParams.arcadeSurface
|
|
1034
|
-
}),
|
|
1035
|
-
runtimeParams.topology.embedParentOrigin ?? "*"
|
|
1036
|
-
);
|
|
1037
|
-
};
|
|
1363
|
+
import { useContext as useContext2, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef3, useState as useState5 } from "react";
|
|
1038
1364
|
|
|
1039
1365
|
// src/components/surface-orientation-layout.ts
|
|
1040
1366
|
var AIRJAM_SAFE_AREA_TOP = "env(safe-area-inset-top, 0px)";
|
|
@@ -1086,181 +1412,8 @@ var resolveForcedOrientationFrameStyle = (desired, needsRotation) => {
|
|
|
1086
1412
|
};
|
|
1087
1413
|
};
|
|
1088
1414
|
|
|
1089
|
-
// src/components/surface-viewport-layout.ts
|
|
1090
|
-
var CONTROLLER_REFERENCE_SIZE = {
|
|
1091
|
-
portrait: {
|
|
1092
|
-
width: 412,
|
|
1093
|
-
height: 915
|
|
1094
|
-
},
|
|
1095
|
-
landscape: {
|
|
1096
|
-
width: 915,
|
|
1097
|
-
height: 412
|
|
1098
|
-
}
|
|
1099
|
-
};
|
|
1100
|
-
var HOST_REFERENCE_SIZE = {
|
|
1101
|
-
portrait: {
|
|
1102
|
-
width: 900,
|
|
1103
|
-
height: 1600
|
|
1104
|
-
},
|
|
1105
|
-
landscape: {
|
|
1106
|
-
width: 1600,
|
|
1107
|
-
height: 900
|
|
1108
|
-
}
|
|
1109
|
-
};
|
|
1110
|
-
var resolveSurfaceViewportScopeReferenceSize = (sessionScope) => {
|
|
1111
|
-
if (sessionScope === "controller") {
|
|
1112
|
-
return CONTROLLER_REFERENCE_SIZE;
|
|
1113
|
-
}
|
|
1114
|
-
if (sessionScope === "host") {
|
|
1115
|
-
return HOST_REFERENCE_SIZE;
|
|
1116
|
-
}
|
|
1117
|
-
return null;
|
|
1118
|
-
};
|
|
1119
|
-
var resolveSurfaceViewportReferenceSize = ({
|
|
1120
|
-
sessionScope,
|
|
1121
|
-
designWidth,
|
|
1122
|
-
designHeight,
|
|
1123
|
-
orientation,
|
|
1124
|
-
availableWidth,
|
|
1125
|
-
availableHeight
|
|
1126
|
-
}) => {
|
|
1127
|
-
if (typeof designWidth === "number" && Number.isFinite(designWidth) && designWidth > 0 && typeof designHeight === "number" && Number.isFinite(designHeight) && designHeight > 0) {
|
|
1128
|
-
return {
|
|
1129
|
-
width: designWidth,
|
|
1130
|
-
height: designHeight
|
|
1131
|
-
};
|
|
1132
|
-
}
|
|
1133
|
-
const scopedReferenceSize = resolveSurfaceViewportScopeReferenceSize(sessionScope);
|
|
1134
|
-
if (scopedReferenceSize) {
|
|
1135
|
-
return scopedReferenceSize[orientation];
|
|
1136
|
-
}
|
|
1137
|
-
return {
|
|
1138
|
-
width: Math.max(availableWidth, 1),
|
|
1139
|
-
height: Math.max(availableHeight, 1)
|
|
1140
|
-
};
|
|
1141
|
-
};
|
|
1142
|
-
var SURFACE_VIEWPORT_TEXT_SIZE_BASES = {
|
|
1143
|
-
xs: "0.75rem",
|
|
1144
|
-
sm: "0.875rem",
|
|
1145
|
-
base: "1rem",
|
|
1146
|
-
lg: "1.125rem",
|
|
1147
|
-
xl: "1.25rem",
|
|
1148
|
-
"2xl": "1.5rem",
|
|
1149
|
-
"3xl": "1.875rem",
|
|
1150
|
-
"4xl": "2.25rem",
|
|
1151
|
-
"5xl": "3rem",
|
|
1152
|
-
"6xl": "3.75rem",
|
|
1153
|
-
"7xl": "4.5rem",
|
|
1154
|
-
"8xl": "6rem",
|
|
1155
|
-
"9xl": "8rem"
|
|
1156
|
-
};
|
|
1157
|
-
var SURFACE_VIEWPORT_CONTAINER_BASES = {
|
|
1158
|
-
"3xs": "16rem",
|
|
1159
|
-
"2xs": "18rem",
|
|
1160
|
-
xs: "20rem",
|
|
1161
|
-
sm: "24rem",
|
|
1162
|
-
md: "28rem",
|
|
1163
|
-
lg: "32rem",
|
|
1164
|
-
xl: "36rem",
|
|
1165
|
-
"2xl": "42rem",
|
|
1166
|
-
"3xl": "48rem",
|
|
1167
|
-
"4xl": "56rem",
|
|
1168
|
-
"5xl": "64rem",
|
|
1169
|
-
"6xl": "72rem",
|
|
1170
|
-
"7xl": "80rem"
|
|
1171
|
-
};
|
|
1172
|
-
var SURFACE_VIEWPORT_RADIUS_BASES = {
|
|
1173
|
-
xs: "0.125rem",
|
|
1174
|
-
sm: "0.375rem",
|
|
1175
|
-
md: "0.5rem",
|
|
1176
|
-
lg: "0.625rem",
|
|
1177
|
-
xl: "0.875rem",
|
|
1178
|
-
"2xl": "1rem",
|
|
1179
|
-
"3xl": "1.5rem",
|
|
1180
|
-
"4xl": "2rem"
|
|
1181
|
-
};
|
|
1182
|
-
var resolveSurfaceViewportAvailableSize = ({
|
|
1183
|
-
safeViewportWidth,
|
|
1184
|
-
safeViewportHeight,
|
|
1185
|
-
orientation,
|
|
1186
|
-
needsRotation
|
|
1187
|
-
}) => {
|
|
1188
|
-
if (!orientation || !needsRotation) {
|
|
1189
|
-
return {
|
|
1190
|
-
width: safeViewportWidth,
|
|
1191
|
-
height: safeViewportHeight
|
|
1192
|
-
};
|
|
1193
|
-
}
|
|
1194
|
-
return {
|
|
1195
|
-
width: safeViewportHeight,
|
|
1196
|
-
height: safeViewportWidth
|
|
1197
|
-
};
|
|
1198
|
-
};
|
|
1199
|
-
var resolveSurfaceViewportScale = ({
|
|
1200
|
-
availableWidth,
|
|
1201
|
-
availableHeight,
|
|
1202
|
-
referenceWidth,
|
|
1203
|
-
referenceHeight,
|
|
1204
|
-
scaleMode = "fit",
|
|
1205
|
-
uiScaleMultiplier = 1,
|
|
1206
|
-
minScale,
|
|
1207
|
-
maxScale
|
|
1208
|
-
}) => {
|
|
1209
|
-
const safeAvailableWidth = Math.max(availableWidth, 1);
|
|
1210
|
-
const safeAvailableHeight = Math.max(availableHeight, 1);
|
|
1211
|
-
const safeReferenceWidth = Math.max(referenceWidth, 1);
|
|
1212
|
-
const safeReferenceHeight = Math.max(referenceHeight, 1);
|
|
1213
|
-
const widthScale = safeAvailableWidth / safeReferenceWidth;
|
|
1214
|
-
const heightScale = safeAvailableHeight / safeReferenceHeight;
|
|
1215
|
-
const baseScale = scaleMode === "width" ? widthScale : scaleMode === "height" ? heightScale : Math.min(widthScale, heightScale);
|
|
1216
|
-
let scale = baseScale * uiScaleMultiplier;
|
|
1217
|
-
if (typeof minScale === "number" && Number.isFinite(minScale)) {
|
|
1218
|
-
scale = Math.max(scale, minScale);
|
|
1219
|
-
}
|
|
1220
|
-
if (typeof maxScale === "number" && Number.isFinite(maxScale)) {
|
|
1221
|
-
scale = Math.min(scale, maxScale);
|
|
1222
|
-
}
|
|
1223
|
-
return scale;
|
|
1224
|
-
};
|
|
1225
|
-
var createScaledVariableValue = (baseValue) => `calc(${baseValue} * var(--airjam-ui-scale))`;
|
|
1226
|
-
var createSurfaceViewportScaleStyle = ({
|
|
1227
|
-
scale,
|
|
1228
|
-
referenceWidth,
|
|
1229
|
-
referenceHeight
|
|
1230
|
-
}) => {
|
|
1231
|
-
const style = {
|
|
1232
|
-
position: "relative",
|
|
1233
|
-
width: "100%",
|
|
1234
|
-
height: "100%",
|
|
1235
|
-
overflow: "hidden",
|
|
1236
|
-
fontSize: createScaledVariableValue("1rem"),
|
|
1237
|
-
"--airjam-ui-scale": String(scale),
|
|
1238
|
-
"--airjam-ui-rem": createScaledVariableValue("1rem"),
|
|
1239
|
-
"--airjam-reference-width": `${referenceWidth}px`,
|
|
1240
|
-
"--airjam-reference-height": `${referenceHeight}px`,
|
|
1241
|
-
"--spacing": createScaledVariableValue("0.25rem"),
|
|
1242
|
-
"--radius": createScaledVariableValue("0.625rem")
|
|
1243
|
-
};
|
|
1244
|
-
for (const [name, baseValue] of Object.entries(
|
|
1245
|
-
SURFACE_VIEWPORT_TEXT_SIZE_BASES
|
|
1246
|
-
)) {
|
|
1247
|
-
style[`--text-${name}`] = createScaledVariableValue(baseValue);
|
|
1248
|
-
}
|
|
1249
|
-
for (const [name, baseValue] of Object.entries(
|
|
1250
|
-
SURFACE_VIEWPORT_CONTAINER_BASES
|
|
1251
|
-
)) {
|
|
1252
|
-
style[`--container-${name}`] = createScaledVariableValue(baseValue);
|
|
1253
|
-
}
|
|
1254
|
-
for (const [name, baseValue] of Object.entries(
|
|
1255
|
-
SURFACE_VIEWPORT_RADIUS_BASES
|
|
1256
|
-
)) {
|
|
1257
|
-
style[`--radius-${name}`] = createScaledVariableValue(baseValue);
|
|
1258
|
-
}
|
|
1259
|
-
return style;
|
|
1260
|
-
};
|
|
1261
|
-
|
|
1262
1415
|
// src/components/surface-viewport.tsx
|
|
1263
|
-
import { jsx as
|
|
1416
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1264
1417
|
var readLayoutViewportSize = () => {
|
|
1265
1418
|
if (typeof window === "undefined") {
|
|
1266
1419
|
return { width: 0, height: 0 };
|
|
@@ -1333,7 +1486,7 @@ var getOrientation = ({
|
|
|
1333
1486
|
};
|
|
1334
1487
|
var SurfaceViewport = ({
|
|
1335
1488
|
children,
|
|
1336
|
-
orientation,
|
|
1489
|
+
orientation: requestedOrientation,
|
|
1337
1490
|
lockOnGesture = true,
|
|
1338
1491
|
className,
|
|
1339
1492
|
contentClassName,
|
|
@@ -1344,9 +1497,16 @@ var SurfaceViewport = ({
|
|
|
1344
1497
|
minScale,
|
|
1345
1498
|
maxScale
|
|
1346
1499
|
}) => {
|
|
1347
|
-
const [viewport, setViewport] = useState4(null);
|
|
1348
|
-
const viewportRef = useRef2(null);
|
|
1349
1500
|
const sessionScope = useSessionScope();
|
|
1501
|
+
const declaredOrientation = useContext2(fixedControllerOrientationContext);
|
|
1502
|
+
const fixedOrientation = sessionScope === "controller" ? declaredOrientation : null;
|
|
1503
|
+
if (fixedOrientation && requestedOrientation && requestedOrientation !== fixedOrientation)
|
|
1504
|
+
throw new Error(
|
|
1505
|
+
"SurfaceViewport orientation conflicts with inputModalities: ['joystick'] in airjam.config: joystick games always use landscape; omit orientation."
|
|
1506
|
+
);
|
|
1507
|
+
const orientation = fixedOrientation ?? requestedOrientation;
|
|
1508
|
+
const [viewport, setViewport] = useState5(null);
|
|
1509
|
+
const viewportRef = useRef3(null);
|
|
1350
1510
|
useEffect4(() => {
|
|
1351
1511
|
if (typeof window === "undefined") {
|
|
1352
1512
|
return;
|
|
@@ -1402,11 +1562,11 @@ var SurfaceViewport = ({
|
|
|
1402
1562
|
const currentOrientation = viewport ? getOrientation(viewport) : "portrait";
|
|
1403
1563
|
const effectiveOrientation = orientation ?? currentOrientation;
|
|
1404
1564
|
const needsRotation = orientation ? currentOrientation !== orientation : false;
|
|
1405
|
-
const shellStyle =
|
|
1565
|
+
const shellStyle = useMemo2(
|
|
1406
1566
|
() => orientation ? resolveForcedOrientationFrameStyle(orientation, needsRotation) : resolveForcedOrientationFrameStyle(effectiveOrientation, false),
|
|
1407
1567
|
[effectiveOrientation, needsRotation, orientation]
|
|
1408
1568
|
);
|
|
1409
|
-
const availableSize =
|
|
1569
|
+
const availableSize = useMemo2(
|
|
1410
1570
|
() => resolveSurfaceViewportAvailableSize({
|
|
1411
1571
|
safeViewportWidth: viewport?.width ?? 0,
|
|
1412
1572
|
safeViewportHeight: viewport?.height ?? 0,
|
|
@@ -1415,7 +1575,7 @@ var SurfaceViewport = ({
|
|
|
1415
1575
|
}),
|
|
1416
1576
|
[needsRotation, orientation, viewport]
|
|
1417
1577
|
);
|
|
1418
|
-
const referenceSize =
|
|
1578
|
+
const referenceSize = useMemo2(
|
|
1419
1579
|
() => resolveSurfaceViewportReferenceSize({
|
|
1420
1580
|
sessionScope,
|
|
1421
1581
|
designWidth,
|
|
@@ -1433,7 +1593,7 @@ var SurfaceViewport = ({
|
|
|
1433
1593
|
sessionScope
|
|
1434
1594
|
]
|
|
1435
1595
|
);
|
|
1436
|
-
const scale =
|
|
1596
|
+
const scale = useMemo2(() => {
|
|
1437
1597
|
const scaleMode = sessionScope === "controller" ? effectiveOrientation === "portrait" ? "width" : "height" : "fit";
|
|
1438
1598
|
return resolveSurfaceViewportScale({
|
|
1439
1599
|
availableWidth: availableSize.width,
|
|
@@ -1456,7 +1616,7 @@ var SurfaceViewport = ({
|
|
|
1456
1616
|
sessionScope,
|
|
1457
1617
|
uiScaleMultiplier
|
|
1458
1618
|
]);
|
|
1459
|
-
return /* @__PURE__ */
|
|
1619
|
+
return /* @__PURE__ */ jsx16(
|
|
1460
1620
|
"div",
|
|
1461
1621
|
{
|
|
1462
1622
|
className: cn("fixed inset-0 overflow-hidden", className),
|
|
@@ -1464,7 +1624,7 @@ var SurfaceViewport = ({
|
|
|
1464
1624
|
...createSurfaceViewportOuterStyle(),
|
|
1465
1625
|
...style
|
|
1466
1626
|
},
|
|
1467
|
-
children: /* @__PURE__ */
|
|
1627
|
+
children: /* @__PURE__ */ jsx16("div", { style: shellStyle, children: /* @__PURE__ */ jsx16(
|
|
1468
1628
|
"div",
|
|
1469
1629
|
{
|
|
1470
1630
|
className: cn("h-full w-full overflow-hidden", contentClassName),
|
|
@@ -1474,7 +1634,7 @@ var SurfaceViewport = ({
|
|
|
1474
1634
|
referenceWidth: referenceSize.width,
|
|
1475
1635
|
referenceHeight: referenceSize.height
|
|
1476
1636
|
}),
|
|
1477
|
-
children: /* @__PURE__ */
|
|
1637
|
+
children: /* @__PURE__ */ jsx16("div", { className: "h-full w-full", "data-airjam-surface-root": "true", children })
|
|
1478
1638
|
}
|
|
1479
1639
|
) })
|
|
1480
1640
|
}
|
|
@@ -1483,12 +1643,12 @@ var SurfaceViewport = ({
|
|
|
1483
1643
|
|
|
1484
1644
|
// src/components/volume-controls.tsx
|
|
1485
1645
|
import { Headphones, Music, Volume2 as Volume22 } from "lucide-react";
|
|
1486
|
-
import { jsx as
|
|
1646
|
+
import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1487
1647
|
function VolumeControls(props) {
|
|
1488
1648
|
if (props.values) {
|
|
1489
|
-
return /* @__PURE__ */
|
|
1649
|
+
return /* @__PURE__ */ jsx17(ControlledVolumeControls, { ...props });
|
|
1490
1650
|
}
|
|
1491
|
-
return /* @__PURE__ */
|
|
1651
|
+
return /* @__PURE__ */ jsx17(OwnedVolumeControls, { ...props });
|
|
1492
1652
|
}
|
|
1493
1653
|
function OwnedVolumeControls({ className, compact }) {
|
|
1494
1654
|
const {
|
|
@@ -1499,7 +1659,7 @@ function OwnedVolumeControls({ className, compact }) {
|
|
|
1499
1659
|
setMusicVolume,
|
|
1500
1660
|
setSfxVolume
|
|
1501
1661
|
} = usePlatformAudioSettings();
|
|
1502
|
-
return /* @__PURE__ */
|
|
1662
|
+
return /* @__PURE__ */ jsx17(
|
|
1503
1663
|
ControlledVolumeControls,
|
|
1504
1664
|
{
|
|
1505
1665
|
className,
|
|
@@ -1525,20 +1685,20 @@ function ControlledVolumeControls({
|
|
|
1525
1685
|
throw new Error("ControlledVolumeControls requires values");
|
|
1526
1686
|
}
|
|
1527
1687
|
const { masterVolume, musicVolume, sfxVolume } = values;
|
|
1528
|
-
return /* @__PURE__ */
|
|
1529
|
-
/* @__PURE__ */
|
|
1530
|
-
/* @__PURE__ */
|
|
1531
|
-
/* @__PURE__ */
|
|
1688
|
+
return /* @__PURE__ */ jsxs14("div", { className: cn("flex flex-col gap-3", compact && "gap-1", className), children: [
|
|
1689
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
|
|
1690
|
+
/* @__PURE__ */ jsx17(Volume22, { className: "text-muted-foreground h-4 w-4" }),
|
|
1691
|
+
/* @__PURE__ */ jsx17("span", { className: "text-sm font-medium", children: "Volume" })
|
|
1532
1692
|
] }),
|
|
1533
|
-
/* @__PURE__ */
|
|
1534
|
-
/* @__PURE__ */
|
|
1535
|
-
/* @__PURE__ */
|
|
1536
|
-
/* @__PURE__ */
|
|
1693
|
+
/* @__PURE__ */ jsxs14("div", { className: "space-y-1.5", children: [
|
|
1694
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between", children: [
|
|
1695
|
+
/* @__PURE__ */ jsx17("label", { className: "text-muted-foreground text-xs", children: "Master" }),
|
|
1696
|
+
/* @__PURE__ */ jsxs14("span", { className: "text-muted-foreground font-mono text-xs", children: [
|
|
1537
1697
|
Math.round(masterVolume * 100),
|
|
1538
1698
|
"%"
|
|
1539
1699
|
] })
|
|
1540
1700
|
] }),
|
|
1541
|
-
/* @__PURE__ */
|
|
1701
|
+
/* @__PURE__ */ jsx17(
|
|
1542
1702
|
Slider,
|
|
1543
1703
|
{
|
|
1544
1704
|
"data-testid": "platform-settings-master-volume",
|
|
@@ -1553,18 +1713,18 @@ function ControlledVolumeControls({
|
|
|
1553
1713
|
}
|
|
1554
1714
|
)
|
|
1555
1715
|
] }),
|
|
1556
|
-
/* @__PURE__ */
|
|
1557
|
-
/* @__PURE__ */
|
|
1558
|
-
/* @__PURE__ */
|
|
1559
|
-
/* @__PURE__ */
|
|
1560
|
-
/* @__PURE__ */
|
|
1716
|
+
/* @__PURE__ */ jsxs14("div", { className: "space-y-1.5", children: [
|
|
1717
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between", children: [
|
|
1718
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-1.5", children: [
|
|
1719
|
+
/* @__PURE__ */ jsx17(Music, { className: "text-muted-foreground h-3 w-3" }),
|
|
1720
|
+
/* @__PURE__ */ jsx17("label", { className: "text-muted-foreground text-xs", children: "Music" })
|
|
1561
1721
|
] }),
|
|
1562
|
-
/* @__PURE__ */
|
|
1722
|
+
/* @__PURE__ */ jsxs14("span", { className: "text-muted-foreground font-mono text-xs", children: [
|
|
1563
1723
|
Math.round(musicVolume * 100),
|
|
1564
1724
|
"%"
|
|
1565
1725
|
] })
|
|
1566
1726
|
] }),
|
|
1567
|
-
/* @__PURE__ */
|
|
1727
|
+
/* @__PURE__ */ jsx17(
|
|
1568
1728
|
Slider,
|
|
1569
1729
|
{
|
|
1570
1730
|
"data-testid": "platform-settings-music-volume",
|
|
@@ -1579,18 +1739,18 @@ function ControlledVolumeControls({
|
|
|
1579
1739
|
}
|
|
1580
1740
|
)
|
|
1581
1741
|
] }),
|
|
1582
|
-
/* @__PURE__ */
|
|
1583
|
-
/* @__PURE__ */
|
|
1584
|
-
/* @__PURE__ */
|
|
1585
|
-
/* @__PURE__ */
|
|
1586
|
-
/* @__PURE__ */
|
|
1742
|
+
/* @__PURE__ */ jsxs14("div", { className: "space-y-1.5", children: [
|
|
1743
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between", children: [
|
|
1744
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-1.5", children: [
|
|
1745
|
+
/* @__PURE__ */ jsx17(Headphones, { className: "text-muted-foreground h-3 w-3" }),
|
|
1746
|
+
/* @__PURE__ */ jsx17("label", { className: "text-muted-foreground text-xs", children: "SFX" })
|
|
1587
1747
|
] }),
|
|
1588
|
-
/* @__PURE__ */
|
|
1748
|
+
/* @__PURE__ */ jsxs14("span", { className: "text-muted-foreground font-mono text-xs", children: [
|
|
1589
1749
|
Math.round(sfxVolume * 100),
|
|
1590
1750
|
"%"
|
|
1591
1751
|
] })
|
|
1592
1752
|
] }),
|
|
1593
|
-
/* @__PURE__ */
|
|
1753
|
+
/* @__PURE__ */ jsx17(
|
|
1594
1754
|
Slider,
|
|
1595
1755
|
{
|
|
1596
1756
|
"data-testid": "platform-settings-sfx-volume",
|
|
@@ -1666,7 +1826,7 @@ var useControllerShellStatus = ({
|
|
|
1666
1826
|
};
|
|
1667
1827
|
|
|
1668
1828
|
// src/hooks/use-host-join-controls.ts
|
|
1669
|
-
import { useCallback as
|
|
1829
|
+
import { useCallback as useCallback3, useEffect as useEffect5, useMemo as useMemo3, useRef as useRef4, useState as useState6 } from "react";
|
|
1670
1830
|
var copyTextToClipboard = async (text) => {
|
|
1671
1831
|
if (!text) {
|
|
1672
1832
|
return false;
|
|
@@ -1701,17 +1861,17 @@ var useHostJoinControls = ({
|
|
|
1701
1861
|
onStartMatch,
|
|
1702
1862
|
copiedDurationMs = 1800
|
|
1703
1863
|
}) => {
|
|
1704
|
-
const [copied, setCopied] =
|
|
1705
|
-
const [joinQrVisible, setJoinQrVisible] =
|
|
1706
|
-
const resetTimerRef =
|
|
1707
|
-
const joinUrlValue =
|
|
1864
|
+
const [copied, setCopied] = useState6(false);
|
|
1865
|
+
const [joinQrVisible, setJoinQrVisible] = useState6(false);
|
|
1866
|
+
const resetTimerRef = useRef4(null);
|
|
1867
|
+
const joinUrlValue = useMemo3(() => joinUrl ?? "", [joinUrl]);
|
|
1708
1868
|
const hasJoinUrl = joinUrlValue.length > 0;
|
|
1709
1869
|
useEffect5(() => {
|
|
1710
1870
|
if (!hasJoinUrl) {
|
|
1711
1871
|
setJoinQrVisible(false);
|
|
1712
1872
|
}
|
|
1713
1873
|
}, [hasJoinUrl]);
|
|
1714
|
-
const handleCopy =
|
|
1874
|
+
const handleCopy = useCallback3(async () => {
|
|
1715
1875
|
if (!joinUrlValue) {
|
|
1716
1876
|
return;
|
|
1717
1877
|
}
|
|
@@ -1728,28 +1888,28 @@ var useHostJoinControls = ({
|
|
|
1728
1888
|
resetTimerRef.current = null;
|
|
1729
1889
|
}, copiedDurationMs);
|
|
1730
1890
|
}, [copiedDurationMs, joinUrlValue]);
|
|
1731
|
-
const handleOpen =
|
|
1891
|
+
const handleOpen = useCallback3(() => {
|
|
1732
1892
|
if (!joinUrlValue || typeof window === "undefined") {
|
|
1733
1893
|
return;
|
|
1734
1894
|
}
|
|
1735
1895
|
window.open(joinUrlValue, "_blank", "noopener,noreferrer");
|
|
1736
1896
|
}, [joinUrlValue]);
|
|
1737
|
-
const showJoinQr =
|
|
1897
|
+
const showJoinQr = useCallback3(() => {
|
|
1738
1898
|
if (!hasJoinUrl) {
|
|
1739
1899
|
return;
|
|
1740
1900
|
}
|
|
1741
1901
|
setJoinQrVisible(true);
|
|
1742
1902
|
}, [hasJoinUrl]);
|
|
1743
|
-
const hideJoinQr =
|
|
1903
|
+
const hideJoinQr = useCallback3(() => {
|
|
1744
1904
|
setJoinQrVisible(false);
|
|
1745
1905
|
}, []);
|
|
1746
|
-
const toggleJoinQr =
|
|
1906
|
+
const toggleJoinQr = useCallback3(() => {
|
|
1747
1907
|
if (!hasJoinUrl) {
|
|
1748
1908
|
return;
|
|
1749
1909
|
}
|
|
1750
1910
|
setJoinQrVisible((current) => !current);
|
|
1751
1911
|
}, [hasJoinUrl]);
|
|
1752
|
-
const handleStart =
|
|
1912
|
+
const handleStart = useCallback3(() => {
|
|
1753
1913
|
if (!canStartMatch) {
|
|
1754
1914
|
return;
|
|
1755
1915
|
}
|
|
@@ -1771,10 +1931,13 @@ var useHostJoinControls = ({
|
|
|
1771
1931
|
};
|
|
1772
1932
|
export {
|
|
1773
1933
|
AIRJAM_DEFAULT_AVATAR_SEEDS,
|
|
1934
|
+
AxisButton,
|
|
1774
1935
|
Button,
|
|
1775
1936
|
ConnectionStatusPill,
|
|
1937
|
+
ControlButton,
|
|
1776
1938
|
ControllerPlayerNameField,
|
|
1777
1939
|
ControllerPrimaryAction,
|
|
1940
|
+
GamepadLayout,
|
|
1778
1941
|
HostMuteButton,
|
|
1779
1942
|
JoinQrOverlay,
|
|
1780
1943
|
JoinUrlActionButtons,
|
|
@@ -1786,12 +1949,10 @@ export {
|
|
|
1786
1949
|
RoomQrCode,
|
|
1787
1950
|
RuntimeShellHeader,
|
|
1788
1951
|
Slider,
|
|
1952
|
+
Stick,
|
|
1789
1953
|
SurfaceViewport,
|
|
1790
1954
|
VolumeControls,
|
|
1791
|
-
buttonVariants,
|
|
1792
1955
|
getDiceBearAdventurerNeutralUrl,
|
|
1793
|
-
getPlayerAvatarImageUrl,
|
|
1794
|
-
resolvePlayerAvatarSeed,
|
|
1795
1956
|
useControllerLifecycleIntents,
|
|
1796
1957
|
useControllerLifecyclePermissions,
|
|
1797
1958
|
useControllerShellStatus,
|