@air-jam/sdk 0.9.2 → 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 +185 -242
- package/dist/actions-D4eh6Xaa.d.cts +72 -0
- package/dist/actions-D4eh6Xaa.d.ts +72 -0
- package/dist/{agent-tooling-BSMGBix9.d.cts → agent-contract-DfLm4Mf-.d.ts} +3 -19
- package/dist/{agent-tooling-BSMGBix9.d.ts → agent-contract-TINzp-5Y.d.cts} +3 -19
- package/dist/agent-tooling.cjs +270 -42
- package/dist/agent-tooling.cjs.map +1 -1
- package/dist/agent-tooling.d.cts +117 -2
- package/dist/agent-tooling.d.ts +117 -2
- package/dist/agent-tooling.js +150 -11
- package/dist/agent-tooling.js.map +1 -1
- package/dist/air-jam-context-BCVCWiaT.d.ts +410 -0
- package/dist/air-jam-context-DavligpM.d.cts +410 -0
- package/dist/arcade/bridge/controller.cjs +872 -582
- 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 -26
- 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 -21
- 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 -479
- package/dist/arcade/host.cjs.map +1 -1
- package/dist/arcade/host.d.cts +1 -18
- package/dist/arcade/host.d.ts +1 -18
- package/dist/arcade/host.js +0 -13
- package/dist/arcade/host.js.map +1 -1
- package/dist/arcade/runtime.cjs +12163 -0
- package/dist/arcade/runtime.cjs.map +1 -0
- package/dist/arcade/runtime.d.cts +54 -0
- package/dist/arcade/runtime.d.ts +54 -0
- package/dist/arcade/runtime.js +45 -0
- package/dist/arcade/runtime.js.map +1 -0
- package/dist/arcade/surface.cjs +12 -35
- package/dist/arcade/surface.cjs.map +1 -1
- package/dist/arcade/surface.d.cts +19 -2
- package/dist/arcade/surface.d.ts +19 -2
- package/dist/arcade/surface.js +12 -14
- 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-ZLPL2R3R.js → chunk-5CRZFIN6.js} +2 -82
- 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-DY67S3LR.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-DA3TE4OP.js +16 -0
- 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-7OTQTT6H.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-I6TSHJF7.js +63 -0
- package/dist/chunk-I6TSHJF7.js.map +1 -0
- package/dist/{chunk-NCL6WJCL.js → chunk-JCGTL77W.js} +32 -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-QHBRHYMV.js +81 -0
- 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-NUJBMV3O.js → chunk-TFW4NJW2.js} +619 -646
- 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 +12406 -8020
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +106 -973
- package/dist/index.d.ts +106 -973
- package/dist/index.js +451 -4637
- 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 -17
- package/dist/metadata.d.ts +6 -17
- 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 +248 -18
- package/dist/platform-machine.cjs.map +1 -1
- package/dist/platform-machine.d.cts +1867 -96
- package/dist/platform-machine.d.ts +1867 -96
- package/dist/platform-machine.js +206 -18
- package/dist/platform-machine.js.map +1 -1
- package/dist/{platform-settings-cuor3i11.d.cts → platform-settings-Yb0fQ1dl.d.cts} +1 -3
- package/dist/{platform-settings-cuor3i11.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 +2269 -774
- package/dist/preview.cjs.map +1 -1
- package/dist/preview.d.cts +195 -38
- package/dist/preview.d.ts +195 -38
- package/dist/preview.js +494 -260
- package/dist/preview.js.map +1 -1
- package/dist/protocol.cjs +705 -396
- package/dist/protocol.cjs.map +1 -1
- package/dist/protocol.d.cts +49 -100
- package/dist/protocol.d.ts +49 -100
- package/dist/protocol.js +56 -75
- package/dist/protocol.js.map +1 -1
- package/dist/release.cjs +37 -0
- package/dist/release.cjs.map +1 -1
- package/dist/release.d.cts +29 -3
- package/dist/release.d.ts +29 -3
- package/dist/release.js +13 -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 +2150 -0
- package/dist/runtime-control.cjs.map +1 -0
- package/dist/runtime-control.d.cts +985 -0
- package/dist/runtime-control.d.ts +985 -0
- package/dist/runtime-control.js +268 -0
- package/dist/runtime-control.js.map +1 -0
- package/dist/runtime-inspection.cjs +1319 -0
- package/dist/runtime-inspection.cjs.map +1 -0
- package/dist/runtime-inspection.d.cts +555 -0
- package/dist/runtime-inspection.d.ts +555 -0
- package/dist/runtime-inspection.js +29 -0
- package/dist/runtime-inspection.js.map +1 -0
- 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-BucA5dYo.d.ts → standard-match-phase-D4N-AU0d.d.cts} +3 -13
- package/dist/{standard-match-phase-U2ra8J-0.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 +2324 -1051
- 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 +555 -389
- package/dist/ui.js.map +1 -1
- package/package.json +88 -37
- package/src/agent/agent-action.ts +0 -39
- package/src/agent/agent-contract-conformance.ts +208 -0
- 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 +8 -18
- 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/runtime.ts +6 -0
- package/src/arcade/surface.ts +6 -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 +64 -195
- 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 +47 -27
- package/src/diagnostics.ts +5 -6
- package/src/hooks/internal/use-controller-runtime-api.ts +58 -836
- package/src/hooks/internal/use-host-runtime-api.ts +98 -1013
- package/src/hooks/internal/use-runtime-inspection-contract.ts +14 -2
- package/src/hooks/use-air-jam-controller.ts +41 -62
- package/src/hooks/use-air-jam-host.ts +66 -107
- 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 +26 -106
- package/src/lifecycle/index.ts +0 -4
- package/src/lifecycle/standard-match-phase.ts +1 -22
- package/src/metadata/manifest.ts +8 -20
- package/src/metadata.ts +1 -1
- package/src/platform-machine.ts +236 -15
- 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 +137 -66
- package/src/preview.ts +27 -15
- package/src/protocol/actions.ts +58 -0
- package/src/protocol/arcade-platform-actions.ts +20 -16
- package/src/protocol/controller.ts +15 -169
- package/src/protocol/core.ts +8 -15
- package/src/protocol/dev-log-events.ts +5 -84
- 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 +78 -0
- package/src/protocol/signed-envelope.ts +176 -0
- package/src/protocol.ts +4 -7
- package/src/qrcode.d.ts +3 -13
- package/src/release.ts +32 -0
- 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 +53 -51
- package/src/runtime/air-jam-error-boundary.tsx +52 -2
- 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 +58 -0
- package/src/runtime/contracts/agent-control.ts +195 -0
- package/src/runtime/contracts/clip.ts +169 -0
- package/src/runtime/contracts/control.ts +744 -59
- 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 +54 -115
- package/src/runtime/controller-presentation.ts +47 -17
- package/src/runtime/controller-press.ts +271 -0
- package/src/runtime/create-air-jam-app.tsx +120 -83
- 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-reference-game-identity.ts +13 -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 +23 -86
- package/src/runtime/session-runtimes.tsx +231 -64
- package/src/runtime/stage-capture.ts +25 -0
- package/src/runtime-control.ts +44 -8
- package/src/runtime-inspection.ts +14 -7
- package/src/runtime-topology.ts +7 -8
- package/src/settings/platform-settings-runtime.tsx +48 -8
- package/src/settings/platform-settings.ts +0 -96
- 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/arcade/bridge.cjs +0 -1067
- 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 -76
- 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 -1737
- 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 -123
- package/dist/arcade.js.map +0 -1
- package/dist/capabilities.cjs +0 -39
- package/dist/capabilities.cjs.map +0 -1
- package/dist/capabilities.d.cts +0 -31
- package/dist/capabilities.d.ts +0 -31
- package/dist/capabilities.js +0 -12
- package/dist/capabilities.js.map +0 -1
- package/dist/chunk-32NYL7XI.js +0 -539
- package/dist/chunk-32NYL7XI.js.map +0 -1
- package/dist/chunk-3USU7GY2.js.map +0 -1
- package/dist/chunk-6CMB356F.js +0 -193
- package/dist/chunk-6CMB356F.js.map +0 -1
- package/dist/chunk-7OTQTT6H.js.map +0 -1
- package/dist/chunk-BE6Z4SIT.js.map +0 -1
- package/dist/chunk-CVYR5RJT.js +0 -184
- package/dist/chunk-CVYR5RJT.js.map +0 -1
- package/dist/chunk-DY67S3LR.js.map +0 -1
- package/dist/chunk-E5PVHEAX.js +0 -126
- package/dist/chunk-E5PVHEAX.js.map +0 -1
- package/dist/chunk-EDRQIOCV.js +0 -25
- package/dist/chunk-EDRQIOCV.js.map +0 -1
- package/dist/chunk-EVZJA6RN.js.map +0 -1
- package/dist/chunk-IKKDONQL.js +0 -1
- package/dist/chunk-IKKDONQL.js.map +0 -1
- package/dist/chunk-JO2HR5PV.js +0 -43
- package/dist/chunk-JO2HR5PV.js.map +0 -1
- package/dist/chunk-JTF47B56.js +0 -1
- package/dist/chunk-JTF47B56.js.map +0 -1
- package/dist/chunk-KOB73SPD.js +0 -216
- package/dist/chunk-KOB73SPD.js.map +0 -1
- package/dist/chunk-LIXPF4P6.js +0 -22
- package/dist/chunk-LIXPF4P6.js.map +0 -1
- package/dist/chunk-M4DKOI42.js +0 -32
- package/dist/chunk-M4DKOI42.js.map +0 -1
- package/dist/chunk-MPDMJIX5.js +0 -1
- package/dist/chunk-MPDMJIX5.js.map +0 -1
- package/dist/chunk-NCL6WJCL.js.map +0 -1
- package/dist/chunk-NUJBMV3O.js.map +0 -1
- package/dist/chunk-Q4UALQO4.js +0 -288
- package/dist/chunk-Q4UALQO4.js.map +0 -1
- package/dist/chunk-TGRTEWYV.js +0 -195
- package/dist/chunk-TGRTEWYV.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-YXHH3MQT.js +0 -230
- package/dist/chunk-YXHH3MQT.js.map +0 -1
- package/dist/chunk-ZLPL2R3R.js.map +0 -1
- package/dist/chunk-ZTQ5SP4H.js +0 -9
- package/dist/chunk-ZTQ5SP4H.js.map +0 -1
- package/dist/controller-Bod8YYr1.d.cts +0 -172
- package/dist/controller-DxVchfiA.d.ts +0 -172
- package/dist/dev-log-events-CVAM29hx.d.cts +0 -123
- package/dist/dev-log-events-CVAM29hx.d.ts +0 -123
- package/dist/handshake-CC_LrK5g.d.cts +0 -31
- package/dist/handshake-CC_LrK5g.d.ts +0 -31
- package/dist/host-8hmq_Sgc.d.cts +0 -109
- package/dist/host-Cw-N6e-5.d.ts +0 -109
- package/dist/notices-CnGaaS8B.d.ts +0 -38
- package/dist/notices-NyDM5Mtz.d.cts +0 -38
- package/dist/realtime-client-Cu8yVJFw.d.cts +0 -15
- package/dist/realtime-client-Cu8yVJFw.d.ts +0 -15
- package/dist/sync-B6QsNrXz.d.cts +0 -125
- package/dist/sync-B6QsNrXz.d.ts +0 -125
- package/src/arcade/bridge.ts +0 -3
- package/src/arcade.ts +0 -4
- package/src/capabilities/manifest.ts +0 -71
- package/src/capabilities.ts +0 -12
- package/src/context/socket-manager.ts +0 -79
- package/src/events.ts +0 -124
- package/src/hooks/internal/use-runtime-control-contract.ts +0 -15
- package/src/hooks/internal/use-runtime-observability-contract.ts +0 -24
- 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 -30
- 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 -185
- package/src/protocol/host.ts +0 -138
- package/src/protocol/notices.ts +0 -43
- package/src/protocol/signals.ts +0 -38
- package/src/protocol/socket-events.ts +0 -154
- package/src/protocol/sync.ts +0 -121
- package/src/runtime/contracts/observability.ts +0 -94
- package/src/runtime/controller-bridge.ts +0 -451
- package/src/runtime/controller-realtime-client.ts +0 -591
- package/src/runtime/host-bridge.ts +0 -388
- 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/runtime-observability.ts +0 -9
- package/src/state/connection-store.ts +0 -152
- package/src/store/create-air-jam-store.ts +0 -1141
- package/src/store/index.ts +0 -1
- package/src/utils/ids.ts +0 -31
package/dist/ui.js
CHANGED
|
@@ -1,37 +1,53 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "./chunk-CVYR5RJT.js";
|
|
2
|
+
publishEmbeddedControllerPresentation
|
|
3
|
+
} from "./chunk-QTNYGAZ7.js";
|
|
5
4
|
import {
|
|
6
|
-
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-X24K52DG.js";
|
|
5
|
+
useAirJamController
|
|
6
|
+
} from "./chunk-I6TSHJF7.js";
|
|
9
7
|
import {
|
|
10
8
|
Button,
|
|
11
9
|
Slider,
|
|
12
|
-
buttonVariants,
|
|
13
10
|
cn,
|
|
11
|
+
createSurfaceViewportScaleStyle,
|
|
12
|
+
resolveSurfaceViewportAvailableSize,
|
|
13
|
+
resolveSurfaceViewportReferenceSize,
|
|
14
|
+
resolveSurfaceViewportScale,
|
|
14
15
|
shellFieldClassName,
|
|
15
16
|
shellHeaderClassName,
|
|
16
17
|
shellHelperTextClassName,
|
|
17
18
|
shellLabelClassName,
|
|
18
19
|
shellUtilityButtonClassName
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import {
|
|
21
|
-
usePlatformAudioSettings
|
|
22
|
-
} from "./chunk-Q4UALQO4.js";
|
|
23
|
-
import "./chunk-7OTQTT6H.js";
|
|
24
|
-
import "./chunk-DY67S3LR.js";
|
|
20
|
+
} from "./chunk-6ZJUA63D.js";
|
|
25
21
|
import {
|
|
22
|
+
controllerRuntimeContext,
|
|
23
|
+
fixedControllerOrientationContext,
|
|
24
|
+
readEmbeddedHostChildSession,
|
|
25
|
+
usePlatformAudioSettings,
|
|
26
26
|
useSessionScope
|
|
27
|
-
} from "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
33
|
-
import "./chunk-
|
|
34
|
-
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";
|
|
35
51
|
|
|
36
52
|
// src/components/connection-status-pill.tsx
|
|
37
53
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -213,7 +229,7 @@ var ControllerPrimaryAction = ({
|
|
|
213
229
|
children: [
|
|
214
230
|
/* @__PURE__ */ jsxs3("div", { className: "min-w-0", children: [
|
|
215
231
|
/* @__PURE__ */ jsx3("div", { className: "truncate text-base font-black tracking-[0.12em] uppercase sm:text-lg", children: label }),
|
|
216
|
-
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
|
|
217
233
|
] }),
|
|
218
234
|
icon ? /* @__PURE__ */ jsx3("div", { className: "ml-4 flex shrink-0 items-center justify-center", children: icon }) : null
|
|
219
235
|
]
|
|
@@ -221,9 +237,332 @@ var ControllerPrimaryAction = ({
|
|
|
221
237
|
) });
|
|
222
238
|
};
|
|
223
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
|
+
|
|
224
563
|
// src/components/host-mute-button.tsx
|
|
225
564
|
import { Volume2, VolumeX } from "lucide-react";
|
|
226
|
-
import { jsx as
|
|
565
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
227
566
|
function HostMuteButton({
|
|
228
567
|
muted,
|
|
229
568
|
onToggle,
|
|
@@ -233,7 +572,7 @@ function HostMuteButton({
|
|
|
233
572
|
unmutedLabel = "Mute"
|
|
234
573
|
}) {
|
|
235
574
|
const label = muted ? mutedLabel : unmutedLabel;
|
|
236
|
-
return /* @__PURE__ */
|
|
575
|
+
return /* @__PURE__ */ jsxs6(
|
|
237
576
|
Button,
|
|
238
577
|
{
|
|
239
578
|
type: "button",
|
|
@@ -248,8 +587,8 @@ function HostMuteButton({
|
|
|
248
587
|
className
|
|
249
588
|
),
|
|
250
589
|
children: [
|
|
251
|
-
muted ? /* @__PURE__ */
|
|
252
|
-
/* @__PURE__ */
|
|
590
|
+
muted ? /* @__PURE__ */ jsx6(VolumeX, { className: "size-4" }) : /* @__PURE__ */ jsx6(Volume2, { className: "size-4" }),
|
|
591
|
+
/* @__PURE__ */ jsx6(
|
|
253
592
|
"span",
|
|
254
593
|
{
|
|
255
594
|
className: cn(
|
|
@@ -269,9 +608,9 @@ import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
|
269
608
|
import { createPortal } from "react-dom";
|
|
270
609
|
|
|
271
610
|
// src/components/room-qr-code.tsx
|
|
272
|
-
import {
|
|
273
|
-
import {
|
|
274
|
-
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";
|
|
275
614
|
var RoomQrCode = ({
|
|
276
615
|
value,
|
|
277
616
|
size = 180,
|
|
@@ -284,58 +623,24 @@ var RoomQrCode = ({
|
|
|
284
623
|
alt = "Room join QR code"
|
|
285
624
|
}) => {
|
|
286
625
|
const trimmed = value.trim();
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
void toDataURL(trimmed, {
|
|
299
|
-
width: size,
|
|
300
|
-
margin: padding,
|
|
301
|
-
errorCorrectionLevel,
|
|
302
|
-
color: {
|
|
303
|
-
dark: foregroundColor,
|
|
304
|
-
light: backgroundColor
|
|
305
|
-
}
|
|
306
|
-
}).then((nextUrl) => {
|
|
307
|
-
if (!cancelled) {
|
|
308
|
-
setQrState({
|
|
309
|
-
key: qrKey,
|
|
310
|
-
dataUrl: nextUrl,
|
|
311
|
-
error: false
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
}).catch(() => {
|
|
315
|
-
if (!cancelled) {
|
|
316
|
-
setQrState({
|
|
317
|
-
key: qrKey,
|
|
318
|
-
dataUrl: null,
|
|
319
|
-
error: true
|
|
320
|
-
});
|
|
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
|
+
}
|
|
321
637
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
}, [
|
|
327
|
-
|
|
328
|
-
errorCorrectionLevel,
|
|
329
|
-
foregroundColor,
|
|
330
|
-
padding,
|
|
331
|
-
size,
|
|
332
|
-
qrKey,
|
|
333
|
-
trimmed
|
|
334
|
-
]);
|
|
335
|
-
const imageSrc = trimmed && qrState.key === qrKey && qrState.dataUrl ? qrState.dataUrl : null;
|
|
336
|
-
const isLoading = !!trimmed && qrState.key !== qrKey;
|
|
337
|
-
const isUnavailable = !trimmed || qrState.key === qrKey && qrState.error;
|
|
338
|
-
return /* @__PURE__ */ jsx5(
|
|
638
|
+
return { path, size: modules.size };
|
|
639
|
+
} catch {
|
|
640
|
+
return null;
|
|
641
|
+
}
|
|
642
|
+
}, [trimmed, errorCorrectionLevel]);
|
|
643
|
+
return /* @__PURE__ */ jsx7(
|
|
339
644
|
"div",
|
|
340
645
|
{
|
|
341
646
|
className,
|
|
@@ -346,25 +651,37 @@ var RoomQrCode = ({
|
|
|
346
651
|
},
|
|
347
652
|
"aria-live": "polite",
|
|
348
653
|
"aria-label": alt,
|
|
349
|
-
children:
|
|
350
|
-
"
|
|
654
|
+
children: qr ? /* @__PURE__ */ jsxs7(
|
|
655
|
+
"svg",
|
|
351
656
|
{
|
|
352
|
-
|
|
353
|
-
alt,
|
|
657
|
+
role: "img",
|
|
658
|
+
"aria-label": alt,
|
|
354
659
|
width: size,
|
|
355
660
|
height: size,
|
|
356
|
-
|
|
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
|
+
]
|
|
357
677
|
}
|
|
358
|
-
) :
|
|
359
|
-
/* @__PURE__ */ jsx5("span", { className: "h-5 w-5 animate-spin rounded-full border-2 border-white/20 border-t-white/80" }),
|
|
360
|
-
/* @__PURE__ */ jsx5("span", { children: "Generating QR\u2026" })
|
|
361
|
-
] }) : /* @__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" })
|
|
362
679
|
}
|
|
363
680
|
);
|
|
364
681
|
};
|
|
365
682
|
|
|
366
683
|
// src/components/join-qr-overlay.tsx
|
|
367
|
-
import { jsx as
|
|
684
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
368
685
|
var JoinQrOverlay = ({
|
|
369
686
|
open,
|
|
370
687
|
value,
|
|
@@ -424,7 +741,7 @@ var JoinQrOverlay = ({
|
|
|
424
741
|
const handlePanelClick = (event) => {
|
|
425
742
|
event.stopPropagation();
|
|
426
743
|
};
|
|
427
|
-
const dialog = /* @__PURE__ */
|
|
744
|
+
const dialog = /* @__PURE__ */ jsx8(
|
|
428
745
|
"div",
|
|
429
746
|
{
|
|
430
747
|
role: "dialog",
|
|
@@ -436,7 +753,7 @@ var JoinQrOverlay = ({
|
|
|
436
753
|
className
|
|
437
754
|
),
|
|
438
755
|
onClick: onClose,
|
|
439
|
-
children: /* @__PURE__ */
|
|
756
|
+
children: /* @__PURE__ */ jsxs8(
|
|
440
757
|
"div",
|
|
441
758
|
{
|
|
442
759
|
className: cn(
|
|
@@ -446,11 +763,11 @@ var JoinQrOverlay = ({
|
|
|
446
763
|
),
|
|
447
764
|
onClick: handlePanelClick,
|
|
448
765
|
children: [
|
|
449
|
-
/* @__PURE__ */
|
|
450
|
-
/* @__PURE__ */
|
|
451
|
-
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
|
|
452
769
|
] }),
|
|
453
|
-
effectiveStatus === "loading" ? /* @__PURE__ */
|
|
770
|
+
effectiveStatus === "loading" ? /* @__PURE__ */ jsxs8(
|
|
454
771
|
"div",
|
|
455
772
|
{
|
|
456
773
|
className: cn(
|
|
@@ -463,11 +780,11 @@ var JoinQrOverlay = ({
|
|
|
463
780
|
aspectRatio: "1 / 1"
|
|
464
781
|
},
|
|
465
782
|
children: [
|
|
466
|
-
/* @__PURE__ */
|
|
467
|
-
/* @__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 })
|
|
468
785
|
]
|
|
469
786
|
}
|
|
470
|
-
) : effectiveStatus === "ready" ? /* @__PURE__ */
|
|
787
|
+
) : effectiveStatus === "ready" ? /* @__PURE__ */ jsx8(
|
|
471
788
|
RoomQrCode,
|
|
472
789
|
{
|
|
473
790
|
value: joinUrlValue,
|
|
@@ -486,7 +803,7 @@ var JoinQrOverlay = ({
|
|
|
486
803
|
},
|
|
487
804
|
alt: qrAlt ?? (roomId ? `QR code to join room ${roomId}` : "QR code to join as a controller")
|
|
488
805
|
}
|
|
489
|
-
) : /* @__PURE__ */
|
|
806
|
+
) : /* @__PURE__ */ jsx8(
|
|
490
807
|
"div",
|
|
491
808
|
{
|
|
492
809
|
className: cn(
|
|
@@ -501,7 +818,7 @@ var JoinQrOverlay = ({
|
|
|
501
818
|
children: unavailableLabel
|
|
502
819
|
}
|
|
503
820
|
),
|
|
504
|
-
/* @__PURE__ */
|
|
821
|
+
/* @__PURE__ */ jsx8(
|
|
505
822
|
"p",
|
|
506
823
|
{
|
|
507
824
|
className: cn(
|
|
@@ -511,7 +828,7 @@ var JoinQrOverlay = ({
|
|
|
511
828
|
children: description
|
|
512
829
|
}
|
|
513
830
|
),
|
|
514
|
-
showCloseButton ? /* @__PURE__ */
|
|
831
|
+
showCloseButton ? /* @__PURE__ */ jsx8(
|
|
515
832
|
Button,
|
|
516
833
|
{
|
|
517
834
|
type: "button",
|
|
@@ -538,7 +855,7 @@ var JoinQrOverlay = ({
|
|
|
538
855
|
|
|
539
856
|
// src/components/join-url-action-buttons.tsx
|
|
540
857
|
import { Check, Copy, ExternalLink, QrCode } from "lucide-react";
|
|
541
|
-
import { jsx as
|
|
858
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
542
859
|
var JoinUrlActionButtons = ({
|
|
543
860
|
hasValue,
|
|
544
861
|
copied = false,
|
|
@@ -550,7 +867,7 @@ var JoinUrlActionButtons = ({
|
|
|
550
867
|
buttonClassName
|
|
551
868
|
}) => {
|
|
552
869
|
const showsQrButton = typeof onToggleQr === "function";
|
|
553
|
-
return /* @__PURE__ */
|
|
870
|
+
return /* @__PURE__ */ jsxs9(
|
|
554
871
|
"div",
|
|
555
872
|
{
|
|
556
873
|
className: cn(
|
|
@@ -559,7 +876,7 @@ var JoinUrlActionButtons = ({
|
|
|
559
876
|
className
|
|
560
877
|
),
|
|
561
878
|
children: [
|
|
562
|
-
/* @__PURE__ */
|
|
879
|
+
/* @__PURE__ */ jsxs9(
|
|
563
880
|
Button,
|
|
564
881
|
{
|
|
565
882
|
type: "button",
|
|
@@ -574,12 +891,12 @@ var JoinUrlActionButtons = ({
|
|
|
574
891
|
buttonClassName
|
|
575
892
|
),
|
|
576
893
|
children: [
|
|
577
|
-
copied ? /* @__PURE__ */
|
|
578
|
-
/* @__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" })
|
|
579
896
|
]
|
|
580
897
|
}
|
|
581
898
|
),
|
|
582
|
-
/* @__PURE__ */
|
|
899
|
+
/* @__PURE__ */ jsxs9(
|
|
583
900
|
Button,
|
|
584
901
|
{
|
|
585
902
|
type: "button",
|
|
@@ -594,12 +911,12 @@ var JoinUrlActionButtons = ({
|
|
|
594
911
|
buttonClassName
|
|
595
912
|
),
|
|
596
913
|
children: [
|
|
597
|
-
/* @__PURE__ */
|
|
598
|
-
/* @__PURE__ */
|
|
914
|
+
/* @__PURE__ */ jsx9(ExternalLink, { className: "h-4 w-4", "aria-hidden": true }),
|
|
915
|
+
/* @__PURE__ */ jsx9("span", { className: "truncate", children: "New tab" })
|
|
599
916
|
]
|
|
600
917
|
}
|
|
601
918
|
),
|
|
602
|
-
showsQrButton ? /* @__PURE__ */
|
|
919
|
+
showsQrButton ? /* @__PURE__ */ jsxs9(
|
|
603
920
|
Button,
|
|
604
921
|
{
|
|
605
922
|
type: "button",
|
|
@@ -615,8 +932,8 @@ var JoinUrlActionButtons = ({
|
|
|
615
932
|
buttonClassName
|
|
616
933
|
),
|
|
617
934
|
children: [
|
|
618
|
-
/* @__PURE__ */
|
|
619
|
-
/* @__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" })
|
|
620
937
|
]
|
|
621
938
|
}
|
|
622
939
|
) : null
|
|
@@ -627,7 +944,7 @@ var JoinUrlActionButtons = ({
|
|
|
627
944
|
|
|
628
945
|
// src/components/join-url-field.tsx
|
|
629
946
|
import { useId } from "react";
|
|
630
|
-
import { jsx as
|
|
947
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
631
948
|
var JoinUrlField = ({
|
|
632
949
|
value,
|
|
633
950
|
label = "Controller link",
|
|
@@ -640,9 +957,9 @@ var JoinUrlField = ({
|
|
|
640
957
|
const hasValue = Boolean(value && value.trim().length > 0);
|
|
641
958
|
const generatedInputId = useId();
|
|
642
959
|
const resolvedInputId = inputId ?? generatedInputId;
|
|
643
|
-
return /* @__PURE__ */
|
|
644
|
-
/* @__PURE__ */
|
|
645
|
-
/* @__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(
|
|
646
963
|
"input",
|
|
647
964
|
{
|
|
648
965
|
id: resolvedInputId,
|
|
@@ -655,12 +972,12 @@ var JoinUrlField = ({
|
|
|
655
972
|
className: cn(shellFieldClassName, inputClassName)
|
|
656
973
|
}
|
|
657
974
|
),
|
|
658
|
-
helperText ? /* @__PURE__ */
|
|
975
|
+
helperText ? /* @__PURE__ */ jsx10("div", { className: shellHelperTextClassName, children: helperText }) : null
|
|
659
976
|
] });
|
|
660
977
|
};
|
|
661
978
|
|
|
662
979
|
// src/components/join-url-controls.tsx
|
|
663
|
-
import { jsx as
|
|
980
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
664
981
|
var JoinUrlControls = ({
|
|
665
982
|
value,
|
|
666
983
|
label = "Controller link",
|
|
@@ -674,9 +991,10 @@ var JoinUrlControls = ({
|
|
|
674
991
|
inputClassName,
|
|
675
992
|
buttonClassName
|
|
676
993
|
}) => {
|
|
994
|
+
if (readEmbeddedHostChildSession()) return null;
|
|
677
995
|
const hasValue = Boolean(value && value.trim().length > 0);
|
|
678
|
-
return /* @__PURE__ */
|
|
679
|
-
/* @__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(
|
|
680
998
|
JoinUrlField,
|
|
681
999
|
{
|
|
682
1000
|
value,
|
|
@@ -686,7 +1004,7 @@ var JoinUrlControls = ({
|
|
|
686
1004
|
inputClassName
|
|
687
1005
|
}
|
|
688
1006
|
),
|
|
689
|
-
/* @__PURE__ */
|
|
1007
|
+
/* @__PURE__ */ jsx11(
|
|
690
1008
|
JoinUrlActionButtons,
|
|
691
1009
|
{
|
|
692
1010
|
hasValue,
|
|
@@ -762,7 +1080,7 @@ var useLifecycleActionGroupModel = ({
|
|
|
762
1080
|
};
|
|
763
1081
|
|
|
764
1082
|
// src/components/lifecycle-action-group.tsx
|
|
765
|
-
import { jsx as
|
|
1083
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
766
1084
|
var LifecycleActionGroup = ({
|
|
767
1085
|
phase,
|
|
768
1086
|
runtimeState,
|
|
@@ -798,23 +1116,23 @@ var LifecycleActionGroup = ({
|
|
|
798
1116
|
const renderIcon = (kind, label) => {
|
|
799
1117
|
switch (kind) {
|
|
800
1118
|
case "start":
|
|
801
|
-
return /* @__PURE__ */
|
|
1119
|
+
return /* @__PURE__ */ jsx12(Play, { "aria-hidden": true, className: "size-4.5" });
|
|
802
1120
|
case "pause-toggle":
|
|
803
|
-
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" });
|
|
804
1122
|
case "restart":
|
|
805
|
-
return /* @__PURE__ */
|
|
1123
|
+
return /* @__PURE__ */ jsx12(RotateCcw, { "aria-hidden": true, className: "size-4.5" });
|
|
806
1124
|
case "back-to-lobby":
|
|
807
|
-
return /* @__PURE__ */
|
|
1125
|
+
return /* @__PURE__ */ jsx12(House, { "aria-hidden": true, className: "size-4.5" });
|
|
808
1126
|
}
|
|
809
1127
|
};
|
|
810
|
-
return /* @__PURE__ */
|
|
1128
|
+
return /* @__PURE__ */ jsx12(
|
|
811
1129
|
"div",
|
|
812
1130
|
{
|
|
813
1131
|
className: cn(
|
|
814
1132
|
"flex min-w-0 flex-nowrap items-center justify-end gap-1.5 overflow-x-auto",
|
|
815
1133
|
className
|
|
816
1134
|
),
|
|
817
|
-
children: actions.map((action) => /* @__PURE__ */
|
|
1135
|
+
children: actions.map((action) => /* @__PURE__ */ jsx12(
|
|
818
1136
|
Button,
|
|
819
1137
|
{
|
|
820
1138
|
type: "button",
|
|
@@ -837,7 +1155,8 @@ var LifecycleActionGroup = ({
|
|
|
837
1155
|
};
|
|
838
1156
|
|
|
839
1157
|
// src/components/player-avatar.tsx
|
|
840
|
-
import { Bot } from "lucide-react";
|
|
1158
|
+
import { Bot, UserRound } from "lucide-react";
|
|
1159
|
+
import { useState as useState4 } from "react";
|
|
841
1160
|
|
|
842
1161
|
// src/utils/player-avatar-url.ts
|
|
843
1162
|
var DIEBEAR_ADVENTURER_NEUTRAL_SVG_BASE = "https://api.dicebear.com/9.x/adventurer-neutral/svg";
|
|
@@ -869,7 +1188,7 @@ var getDiceBearAdventurerNeutralUrl = (seed) => `${DIEBEAR_ADVENTURER_NEUTRAL_SV
|
|
|
869
1188
|
var getPlayerAvatarImageUrl = (player) => getDiceBearAdventurerNeutralUrl(resolvePlayerAvatarSeed(player));
|
|
870
1189
|
|
|
871
1190
|
// src/components/player-avatar.tsx
|
|
872
|
-
import { jsx as
|
|
1191
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
873
1192
|
var hexToRgba = (hex, opacity) => {
|
|
874
1193
|
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
875
1194
|
if (!result) return `rgba(0, 0, 0, ${opacity})`;
|
|
@@ -884,6 +1203,7 @@ var PlayerAvatar = ({
|
|
|
884
1203
|
size = "md",
|
|
885
1204
|
className = ""
|
|
886
1205
|
}) => {
|
|
1206
|
+
const [failedSrc, setFailedSrc] = useState4(null);
|
|
887
1207
|
const accentColor = player.color || "hsl(var(--border))";
|
|
888
1208
|
const sizeClasses = {
|
|
889
1209
|
sm: "h-9 w-9 border-2",
|
|
@@ -906,7 +1226,7 @@ var PlayerAvatar = ({
|
|
|
906
1226
|
className
|
|
907
1227
|
);
|
|
908
1228
|
if (isBot) {
|
|
909
|
-
return /* @__PURE__ */
|
|
1229
|
+
return /* @__PURE__ */ jsx13(
|
|
910
1230
|
"div",
|
|
911
1231
|
{
|
|
912
1232
|
role: "img",
|
|
@@ -920,15 +1240,38 @@ var PlayerAvatar = ({
|
|
|
920
1240
|
color: accentColor,
|
|
921
1241
|
boxShadow: shadowStyles[size]
|
|
922
1242
|
},
|
|
923
|
-
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] })
|
|
924
1266
|
}
|
|
925
1267
|
);
|
|
926
1268
|
}
|
|
927
|
-
return /* @__PURE__ */
|
|
1269
|
+
return /* @__PURE__ */ jsx13(
|
|
928
1270
|
"img",
|
|
929
1271
|
{
|
|
930
|
-
src
|
|
1272
|
+
src,
|
|
931
1273
|
alt: player.label,
|
|
1274
|
+
onError: () => setFailedSrc(src),
|
|
932
1275
|
className: cn("bg-secondary/30", shellClassName),
|
|
933
1276
|
style: {
|
|
934
1277
|
borderColor: accentColor,
|
|
@@ -937,9 +1280,15 @@ var PlayerAvatar = ({
|
|
|
937
1280
|
}
|
|
938
1281
|
);
|
|
939
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("");
|
|
940
1289
|
|
|
941
1290
|
// src/components/player-avatar-strip.tsx
|
|
942
|
-
import { jsx as
|
|
1291
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
943
1292
|
var overflowSizeClasses = {
|
|
944
1293
|
sm: "h-9 w-9 min-h-9 min-w-9 text-[0.625rem]",
|
|
945
1294
|
md: "h-12 w-12 min-h-12 min-w-12 text-[11px]",
|
|
@@ -955,8 +1304,8 @@ var PlayerAvatarStrip = ({
|
|
|
955
1304
|
}) => {
|
|
956
1305
|
const visible = players.slice(0, maxVisible);
|
|
957
1306
|
const overflow = Math.max(0, players.length - maxVisible);
|
|
958
|
-
return /* @__PURE__ */
|
|
959
|
-
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(
|
|
960
1309
|
PlayerAvatar,
|
|
961
1310
|
{
|
|
962
1311
|
player,
|
|
@@ -965,7 +1314,7 @@ var PlayerAvatarStrip = ({
|
|
|
965
1314
|
},
|
|
966
1315
|
player.id
|
|
967
1316
|
)),
|
|
968
|
-
overflow > 0 && /* @__PURE__ */
|
|
1317
|
+
overflow > 0 && /* @__PURE__ */ jsxs12(
|
|
969
1318
|
"div",
|
|
970
1319
|
{
|
|
971
1320
|
className: cn(
|
|
@@ -984,14 +1333,14 @@ var PlayerAvatarStrip = ({
|
|
|
984
1333
|
};
|
|
985
1334
|
|
|
986
1335
|
// src/components/runtime-shell-header.tsx
|
|
987
|
-
import { jsx as
|
|
1336
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
988
1337
|
var RuntimeShellHeader = ({
|
|
989
1338
|
connectionStatus,
|
|
990
1339
|
leftSlot,
|
|
991
1340
|
rightSlot,
|
|
992
1341
|
className
|
|
993
1342
|
}) => {
|
|
994
|
-
return /* @__PURE__ */
|
|
1343
|
+
return /* @__PURE__ */ jsxs13(
|
|
995
1344
|
"header",
|
|
996
1345
|
{
|
|
997
1346
|
className: cn(
|
|
@@ -1000,10 +1349,10 @@ var RuntimeShellHeader = ({
|
|
|
1000
1349
|
className
|
|
1001
1350
|
),
|
|
1002
1351
|
children: [
|
|
1003
|
-
/* @__PURE__ */
|
|
1004
|
-
/* @__PURE__ */
|
|
1005
|
-
/* @__PURE__ */
|
|
1006
|
-
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
|
|
1007
1356
|
] })
|
|
1008
1357
|
]
|
|
1009
1358
|
}
|
|
@@ -1011,25 +1360,7 @@ var RuntimeShellHeader = ({
|
|
|
1011
1360
|
};
|
|
1012
1361
|
|
|
1013
1362
|
// src/components/surface-viewport.tsx
|
|
1014
|
-
import { useEffect as useEffect4, useMemo, useRef as
|
|
1015
|
-
|
|
1016
|
-
// src/runtime/controller-presentation.ts
|
|
1017
|
-
var publishEmbeddedControllerPresentation = (orientation) => {
|
|
1018
|
-
if (typeof window === "undefined" || window.parent === window) {
|
|
1019
|
-
return;
|
|
1020
|
-
}
|
|
1021
|
-
const runtimeParams = readEmbeddedControllerRuntimeParams();
|
|
1022
|
-
if (!runtimeParams) {
|
|
1023
|
-
return;
|
|
1024
|
-
}
|
|
1025
|
-
window.parent.postMessage(
|
|
1026
|
-
createControllerPresentationSyncMessage({
|
|
1027
|
-
orientation,
|
|
1028
|
-
arcadeSurface: runtimeParams.arcadeSurface
|
|
1029
|
-
}),
|
|
1030
|
-
runtimeParams.topology.embedParentOrigin ?? "*"
|
|
1031
|
-
);
|
|
1032
|
-
};
|
|
1363
|
+
import { useContext as useContext2, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef3, useState as useState5 } from "react";
|
|
1033
1364
|
|
|
1034
1365
|
// src/components/surface-orientation-layout.ts
|
|
1035
1366
|
var AIRJAM_SAFE_AREA_TOP = "env(safe-area-inset-top, 0px)";
|
|
@@ -1081,181 +1412,8 @@ var resolveForcedOrientationFrameStyle = (desired, needsRotation) => {
|
|
|
1081
1412
|
};
|
|
1082
1413
|
};
|
|
1083
1414
|
|
|
1084
|
-
// src/components/surface-viewport-layout.ts
|
|
1085
|
-
var CONTROLLER_REFERENCE_SIZE = {
|
|
1086
|
-
portrait: {
|
|
1087
|
-
width: 412,
|
|
1088
|
-
height: 915
|
|
1089
|
-
},
|
|
1090
|
-
landscape: {
|
|
1091
|
-
width: 915,
|
|
1092
|
-
height: 412
|
|
1093
|
-
}
|
|
1094
|
-
};
|
|
1095
|
-
var HOST_REFERENCE_SIZE = {
|
|
1096
|
-
portrait: {
|
|
1097
|
-
width: 900,
|
|
1098
|
-
height: 1600
|
|
1099
|
-
},
|
|
1100
|
-
landscape: {
|
|
1101
|
-
width: 1600,
|
|
1102
|
-
height: 900
|
|
1103
|
-
}
|
|
1104
|
-
};
|
|
1105
|
-
var resolveSurfaceViewportScopeReferenceSize = (sessionScope) => {
|
|
1106
|
-
if (sessionScope === "controller") {
|
|
1107
|
-
return CONTROLLER_REFERENCE_SIZE;
|
|
1108
|
-
}
|
|
1109
|
-
if (sessionScope === "host") {
|
|
1110
|
-
return HOST_REFERENCE_SIZE;
|
|
1111
|
-
}
|
|
1112
|
-
return null;
|
|
1113
|
-
};
|
|
1114
|
-
var resolveSurfaceViewportReferenceSize = ({
|
|
1115
|
-
sessionScope,
|
|
1116
|
-
designWidth,
|
|
1117
|
-
designHeight,
|
|
1118
|
-
orientation,
|
|
1119
|
-
availableWidth,
|
|
1120
|
-
availableHeight
|
|
1121
|
-
}) => {
|
|
1122
|
-
if (typeof designWidth === "number" && Number.isFinite(designWidth) && designWidth > 0 && typeof designHeight === "number" && Number.isFinite(designHeight) && designHeight > 0) {
|
|
1123
|
-
return {
|
|
1124
|
-
width: designWidth,
|
|
1125
|
-
height: designHeight
|
|
1126
|
-
};
|
|
1127
|
-
}
|
|
1128
|
-
const scopedReferenceSize = resolveSurfaceViewportScopeReferenceSize(sessionScope);
|
|
1129
|
-
if (scopedReferenceSize) {
|
|
1130
|
-
return scopedReferenceSize[orientation];
|
|
1131
|
-
}
|
|
1132
|
-
return {
|
|
1133
|
-
width: Math.max(availableWidth, 1),
|
|
1134
|
-
height: Math.max(availableHeight, 1)
|
|
1135
|
-
};
|
|
1136
|
-
};
|
|
1137
|
-
var SURFACE_VIEWPORT_TEXT_SIZE_BASES = {
|
|
1138
|
-
xs: "0.75rem",
|
|
1139
|
-
sm: "0.875rem",
|
|
1140
|
-
base: "1rem",
|
|
1141
|
-
lg: "1.125rem",
|
|
1142
|
-
xl: "1.25rem",
|
|
1143
|
-
"2xl": "1.5rem",
|
|
1144
|
-
"3xl": "1.875rem",
|
|
1145
|
-
"4xl": "2.25rem",
|
|
1146
|
-
"5xl": "3rem",
|
|
1147
|
-
"6xl": "3.75rem",
|
|
1148
|
-
"7xl": "4.5rem",
|
|
1149
|
-
"8xl": "6rem",
|
|
1150
|
-
"9xl": "8rem"
|
|
1151
|
-
};
|
|
1152
|
-
var SURFACE_VIEWPORT_CONTAINER_BASES = {
|
|
1153
|
-
"3xs": "16rem",
|
|
1154
|
-
"2xs": "18rem",
|
|
1155
|
-
xs: "20rem",
|
|
1156
|
-
sm: "24rem",
|
|
1157
|
-
md: "28rem",
|
|
1158
|
-
lg: "32rem",
|
|
1159
|
-
xl: "36rem",
|
|
1160
|
-
"2xl": "42rem",
|
|
1161
|
-
"3xl": "48rem",
|
|
1162
|
-
"4xl": "56rem",
|
|
1163
|
-
"5xl": "64rem",
|
|
1164
|
-
"6xl": "72rem",
|
|
1165
|
-
"7xl": "80rem"
|
|
1166
|
-
};
|
|
1167
|
-
var SURFACE_VIEWPORT_RADIUS_BASES = {
|
|
1168
|
-
xs: "0.125rem",
|
|
1169
|
-
sm: "0.375rem",
|
|
1170
|
-
md: "0.5rem",
|
|
1171
|
-
lg: "0.625rem",
|
|
1172
|
-
xl: "0.875rem",
|
|
1173
|
-
"2xl": "1rem",
|
|
1174
|
-
"3xl": "1.5rem",
|
|
1175
|
-
"4xl": "2rem"
|
|
1176
|
-
};
|
|
1177
|
-
var resolveSurfaceViewportAvailableSize = ({
|
|
1178
|
-
safeViewportWidth,
|
|
1179
|
-
safeViewportHeight,
|
|
1180
|
-
orientation,
|
|
1181
|
-
needsRotation
|
|
1182
|
-
}) => {
|
|
1183
|
-
if (!orientation || !needsRotation) {
|
|
1184
|
-
return {
|
|
1185
|
-
width: safeViewportWidth,
|
|
1186
|
-
height: safeViewportHeight
|
|
1187
|
-
};
|
|
1188
|
-
}
|
|
1189
|
-
return {
|
|
1190
|
-
width: safeViewportHeight,
|
|
1191
|
-
height: safeViewportWidth
|
|
1192
|
-
};
|
|
1193
|
-
};
|
|
1194
|
-
var resolveSurfaceViewportScale = ({
|
|
1195
|
-
availableWidth,
|
|
1196
|
-
availableHeight,
|
|
1197
|
-
referenceWidth,
|
|
1198
|
-
referenceHeight,
|
|
1199
|
-
scaleMode = "fit",
|
|
1200
|
-
uiScaleMultiplier = 1,
|
|
1201
|
-
minScale,
|
|
1202
|
-
maxScale
|
|
1203
|
-
}) => {
|
|
1204
|
-
const safeAvailableWidth = Math.max(availableWidth, 1);
|
|
1205
|
-
const safeAvailableHeight = Math.max(availableHeight, 1);
|
|
1206
|
-
const safeReferenceWidth = Math.max(referenceWidth, 1);
|
|
1207
|
-
const safeReferenceHeight = Math.max(referenceHeight, 1);
|
|
1208
|
-
const widthScale = safeAvailableWidth / safeReferenceWidth;
|
|
1209
|
-
const heightScale = safeAvailableHeight / safeReferenceHeight;
|
|
1210
|
-
const baseScale = scaleMode === "width" ? widthScale : scaleMode === "height" ? heightScale : Math.min(widthScale, heightScale);
|
|
1211
|
-
let scale = baseScale * uiScaleMultiplier;
|
|
1212
|
-
if (typeof minScale === "number" && Number.isFinite(minScale)) {
|
|
1213
|
-
scale = Math.max(scale, minScale);
|
|
1214
|
-
}
|
|
1215
|
-
if (typeof maxScale === "number" && Number.isFinite(maxScale)) {
|
|
1216
|
-
scale = Math.min(scale, maxScale);
|
|
1217
|
-
}
|
|
1218
|
-
return scale;
|
|
1219
|
-
};
|
|
1220
|
-
var createScaledVariableValue = (baseValue) => `calc(${baseValue} * var(--airjam-ui-scale))`;
|
|
1221
|
-
var createSurfaceViewportScaleStyle = ({
|
|
1222
|
-
scale,
|
|
1223
|
-
referenceWidth,
|
|
1224
|
-
referenceHeight
|
|
1225
|
-
}) => {
|
|
1226
|
-
const style = {
|
|
1227
|
-
position: "relative",
|
|
1228
|
-
width: "100%",
|
|
1229
|
-
height: "100%",
|
|
1230
|
-
overflow: "hidden",
|
|
1231
|
-
fontSize: createScaledVariableValue("1rem"),
|
|
1232
|
-
"--airjam-ui-scale": String(scale),
|
|
1233
|
-
"--airjam-ui-rem": createScaledVariableValue("1rem"),
|
|
1234
|
-
"--airjam-reference-width": `${referenceWidth}px`,
|
|
1235
|
-
"--airjam-reference-height": `${referenceHeight}px`,
|
|
1236
|
-
"--spacing": createScaledVariableValue("0.25rem"),
|
|
1237
|
-
"--radius": createScaledVariableValue("0.625rem")
|
|
1238
|
-
};
|
|
1239
|
-
for (const [name, baseValue] of Object.entries(
|
|
1240
|
-
SURFACE_VIEWPORT_TEXT_SIZE_BASES
|
|
1241
|
-
)) {
|
|
1242
|
-
style[`--text-${name}`] = createScaledVariableValue(baseValue);
|
|
1243
|
-
}
|
|
1244
|
-
for (const [name, baseValue] of Object.entries(
|
|
1245
|
-
SURFACE_VIEWPORT_CONTAINER_BASES
|
|
1246
|
-
)) {
|
|
1247
|
-
style[`--container-${name}`] = createScaledVariableValue(baseValue);
|
|
1248
|
-
}
|
|
1249
|
-
for (const [name, baseValue] of Object.entries(
|
|
1250
|
-
SURFACE_VIEWPORT_RADIUS_BASES
|
|
1251
|
-
)) {
|
|
1252
|
-
style[`--radius-${name}`] = createScaledVariableValue(baseValue);
|
|
1253
|
-
}
|
|
1254
|
-
return style;
|
|
1255
|
-
};
|
|
1256
|
-
|
|
1257
1415
|
// src/components/surface-viewport.tsx
|
|
1258
|
-
import { jsx as
|
|
1416
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1259
1417
|
var readLayoutViewportSize = () => {
|
|
1260
1418
|
if (typeof window === "undefined") {
|
|
1261
1419
|
return { width: 0, height: 0 };
|
|
@@ -1328,7 +1486,7 @@ var getOrientation = ({
|
|
|
1328
1486
|
};
|
|
1329
1487
|
var SurfaceViewport = ({
|
|
1330
1488
|
children,
|
|
1331
|
-
orientation,
|
|
1489
|
+
orientation: requestedOrientation,
|
|
1332
1490
|
lockOnGesture = true,
|
|
1333
1491
|
className,
|
|
1334
1492
|
contentClassName,
|
|
@@ -1339,9 +1497,16 @@ var SurfaceViewport = ({
|
|
|
1339
1497
|
minScale,
|
|
1340
1498
|
maxScale
|
|
1341
1499
|
}) => {
|
|
1342
|
-
const [viewport, setViewport] = useState4(null);
|
|
1343
|
-
const viewportRef = useRef2(null);
|
|
1344
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);
|
|
1345
1510
|
useEffect4(() => {
|
|
1346
1511
|
if (typeof window === "undefined") {
|
|
1347
1512
|
return;
|
|
@@ -1397,11 +1562,11 @@ var SurfaceViewport = ({
|
|
|
1397
1562
|
const currentOrientation = viewport ? getOrientation(viewport) : "portrait";
|
|
1398
1563
|
const effectiveOrientation = orientation ?? currentOrientation;
|
|
1399
1564
|
const needsRotation = orientation ? currentOrientation !== orientation : false;
|
|
1400
|
-
const shellStyle =
|
|
1565
|
+
const shellStyle = useMemo2(
|
|
1401
1566
|
() => orientation ? resolveForcedOrientationFrameStyle(orientation, needsRotation) : resolveForcedOrientationFrameStyle(effectiveOrientation, false),
|
|
1402
1567
|
[effectiveOrientation, needsRotation, orientation]
|
|
1403
1568
|
);
|
|
1404
|
-
const availableSize =
|
|
1569
|
+
const availableSize = useMemo2(
|
|
1405
1570
|
() => resolveSurfaceViewportAvailableSize({
|
|
1406
1571
|
safeViewportWidth: viewport?.width ?? 0,
|
|
1407
1572
|
safeViewportHeight: viewport?.height ?? 0,
|
|
@@ -1410,7 +1575,7 @@ var SurfaceViewport = ({
|
|
|
1410
1575
|
}),
|
|
1411
1576
|
[needsRotation, orientation, viewport]
|
|
1412
1577
|
);
|
|
1413
|
-
const referenceSize =
|
|
1578
|
+
const referenceSize = useMemo2(
|
|
1414
1579
|
() => resolveSurfaceViewportReferenceSize({
|
|
1415
1580
|
sessionScope,
|
|
1416
1581
|
designWidth,
|
|
@@ -1428,7 +1593,7 @@ var SurfaceViewport = ({
|
|
|
1428
1593
|
sessionScope
|
|
1429
1594
|
]
|
|
1430
1595
|
);
|
|
1431
|
-
const scale =
|
|
1596
|
+
const scale = useMemo2(() => {
|
|
1432
1597
|
const scaleMode = sessionScope === "controller" ? effectiveOrientation === "portrait" ? "width" : "height" : "fit";
|
|
1433
1598
|
return resolveSurfaceViewportScale({
|
|
1434
1599
|
availableWidth: availableSize.width,
|
|
@@ -1451,7 +1616,7 @@ var SurfaceViewport = ({
|
|
|
1451
1616
|
sessionScope,
|
|
1452
1617
|
uiScaleMultiplier
|
|
1453
1618
|
]);
|
|
1454
|
-
return /* @__PURE__ */
|
|
1619
|
+
return /* @__PURE__ */ jsx16(
|
|
1455
1620
|
"div",
|
|
1456
1621
|
{
|
|
1457
1622
|
className: cn("fixed inset-0 overflow-hidden", className),
|
|
@@ -1459,7 +1624,7 @@ var SurfaceViewport = ({
|
|
|
1459
1624
|
...createSurfaceViewportOuterStyle(),
|
|
1460
1625
|
...style
|
|
1461
1626
|
},
|
|
1462
|
-
children: /* @__PURE__ */
|
|
1627
|
+
children: /* @__PURE__ */ jsx16("div", { style: shellStyle, children: /* @__PURE__ */ jsx16(
|
|
1463
1628
|
"div",
|
|
1464
1629
|
{
|
|
1465
1630
|
className: cn("h-full w-full overflow-hidden", contentClassName),
|
|
@@ -1469,7 +1634,7 @@ var SurfaceViewport = ({
|
|
|
1469
1634
|
referenceWidth: referenceSize.width,
|
|
1470
1635
|
referenceHeight: referenceSize.height
|
|
1471
1636
|
}),
|
|
1472
|
-
children: /* @__PURE__ */
|
|
1637
|
+
children: /* @__PURE__ */ jsx16("div", { className: "h-full w-full", "data-airjam-surface-root": "true", children })
|
|
1473
1638
|
}
|
|
1474
1639
|
) })
|
|
1475
1640
|
}
|
|
@@ -1478,12 +1643,12 @@ var SurfaceViewport = ({
|
|
|
1478
1643
|
|
|
1479
1644
|
// src/components/volume-controls.tsx
|
|
1480
1645
|
import { Headphones, Music, Volume2 as Volume22 } from "lucide-react";
|
|
1481
|
-
import { jsx as
|
|
1646
|
+
import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1482
1647
|
function VolumeControls(props) {
|
|
1483
1648
|
if (props.values) {
|
|
1484
|
-
return /* @__PURE__ */
|
|
1649
|
+
return /* @__PURE__ */ jsx17(ControlledVolumeControls, { ...props });
|
|
1485
1650
|
}
|
|
1486
|
-
return /* @__PURE__ */
|
|
1651
|
+
return /* @__PURE__ */ jsx17(OwnedVolumeControls, { ...props });
|
|
1487
1652
|
}
|
|
1488
1653
|
function OwnedVolumeControls({ className, compact }) {
|
|
1489
1654
|
const {
|
|
@@ -1494,7 +1659,7 @@ function OwnedVolumeControls({ className, compact }) {
|
|
|
1494
1659
|
setMusicVolume,
|
|
1495
1660
|
setSfxVolume
|
|
1496
1661
|
} = usePlatformAudioSettings();
|
|
1497
|
-
return /* @__PURE__ */
|
|
1662
|
+
return /* @__PURE__ */ jsx17(
|
|
1498
1663
|
ControlledVolumeControls,
|
|
1499
1664
|
{
|
|
1500
1665
|
className,
|
|
@@ -1520,20 +1685,20 @@ function ControlledVolumeControls({
|
|
|
1520
1685
|
throw new Error("ControlledVolumeControls requires values");
|
|
1521
1686
|
}
|
|
1522
1687
|
const { masterVolume, musicVolume, sfxVolume } = values;
|
|
1523
|
-
return /* @__PURE__ */
|
|
1524
|
-
/* @__PURE__ */
|
|
1525
|
-
/* @__PURE__ */
|
|
1526
|
-
/* @__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" })
|
|
1527
1692
|
] }),
|
|
1528
|
-
/* @__PURE__ */
|
|
1529
|
-
/* @__PURE__ */
|
|
1530
|
-
/* @__PURE__ */
|
|
1531
|
-
/* @__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: [
|
|
1532
1697
|
Math.round(masterVolume * 100),
|
|
1533
1698
|
"%"
|
|
1534
1699
|
] })
|
|
1535
1700
|
] }),
|
|
1536
|
-
/* @__PURE__ */
|
|
1701
|
+
/* @__PURE__ */ jsx17(
|
|
1537
1702
|
Slider,
|
|
1538
1703
|
{
|
|
1539
1704
|
"data-testid": "platform-settings-master-volume",
|
|
@@ -1548,18 +1713,18 @@ function ControlledVolumeControls({
|
|
|
1548
1713
|
}
|
|
1549
1714
|
)
|
|
1550
1715
|
] }),
|
|
1551
|
-
/* @__PURE__ */
|
|
1552
|
-
/* @__PURE__ */
|
|
1553
|
-
/* @__PURE__ */
|
|
1554
|
-
/* @__PURE__ */
|
|
1555
|
-
/* @__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" })
|
|
1556
1721
|
] }),
|
|
1557
|
-
/* @__PURE__ */
|
|
1722
|
+
/* @__PURE__ */ jsxs14("span", { className: "text-muted-foreground font-mono text-xs", children: [
|
|
1558
1723
|
Math.round(musicVolume * 100),
|
|
1559
1724
|
"%"
|
|
1560
1725
|
] })
|
|
1561
1726
|
] }),
|
|
1562
|
-
/* @__PURE__ */
|
|
1727
|
+
/* @__PURE__ */ jsx17(
|
|
1563
1728
|
Slider,
|
|
1564
1729
|
{
|
|
1565
1730
|
"data-testid": "platform-settings-music-volume",
|
|
@@ -1574,18 +1739,18 @@ function ControlledVolumeControls({
|
|
|
1574
1739
|
}
|
|
1575
1740
|
)
|
|
1576
1741
|
] }),
|
|
1577
|
-
/* @__PURE__ */
|
|
1578
|
-
/* @__PURE__ */
|
|
1579
|
-
/* @__PURE__ */
|
|
1580
|
-
/* @__PURE__ */
|
|
1581
|
-
/* @__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" })
|
|
1582
1747
|
] }),
|
|
1583
|
-
/* @__PURE__ */
|
|
1748
|
+
/* @__PURE__ */ jsxs14("span", { className: "text-muted-foreground font-mono text-xs", children: [
|
|
1584
1749
|
Math.round(sfxVolume * 100),
|
|
1585
1750
|
"%"
|
|
1586
1751
|
] })
|
|
1587
1752
|
] }),
|
|
1588
|
-
/* @__PURE__ */
|
|
1753
|
+
/* @__PURE__ */ jsx17(
|
|
1589
1754
|
Slider,
|
|
1590
1755
|
{
|
|
1591
1756
|
"data-testid": "platform-settings-sfx-volume",
|
|
@@ -1661,7 +1826,7 @@ var useControllerShellStatus = ({
|
|
|
1661
1826
|
};
|
|
1662
1827
|
|
|
1663
1828
|
// src/hooks/use-host-join-controls.ts
|
|
1664
|
-
import { useCallback as
|
|
1829
|
+
import { useCallback as useCallback3, useEffect as useEffect5, useMemo as useMemo3, useRef as useRef4, useState as useState6 } from "react";
|
|
1665
1830
|
var copyTextToClipboard = async (text) => {
|
|
1666
1831
|
if (!text) {
|
|
1667
1832
|
return false;
|
|
@@ -1696,17 +1861,17 @@ var useHostJoinControls = ({
|
|
|
1696
1861
|
onStartMatch,
|
|
1697
1862
|
copiedDurationMs = 1800
|
|
1698
1863
|
}) => {
|
|
1699
|
-
const [copied, setCopied] =
|
|
1700
|
-
const [joinQrVisible, setJoinQrVisible] =
|
|
1701
|
-
const resetTimerRef =
|
|
1702
|
-
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]);
|
|
1703
1868
|
const hasJoinUrl = joinUrlValue.length > 0;
|
|
1704
1869
|
useEffect5(() => {
|
|
1705
1870
|
if (!hasJoinUrl) {
|
|
1706
1871
|
setJoinQrVisible(false);
|
|
1707
1872
|
}
|
|
1708
1873
|
}, [hasJoinUrl]);
|
|
1709
|
-
const handleCopy =
|
|
1874
|
+
const handleCopy = useCallback3(async () => {
|
|
1710
1875
|
if (!joinUrlValue) {
|
|
1711
1876
|
return;
|
|
1712
1877
|
}
|
|
@@ -1723,28 +1888,28 @@ var useHostJoinControls = ({
|
|
|
1723
1888
|
resetTimerRef.current = null;
|
|
1724
1889
|
}, copiedDurationMs);
|
|
1725
1890
|
}, [copiedDurationMs, joinUrlValue]);
|
|
1726
|
-
const handleOpen =
|
|
1891
|
+
const handleOpen = useCallback3(() => {
|
|
1727
1892
|
if (!joinUrlValue || typeof window === "undefined") {
|
|
1728
1893
|
return;
|
|
1729
1894
|
}
|
|
1730
1895
|
window.open(joinUrlValue, "_blank", "noopener,noreferrer");
|
|
1731
1896
|
}, [joinUrlValue]);
|
|
1732
|
-
const showJoinQr =
|
|
1897
|
+
const showJoinQr = useCallback3(() => {
|
|
1733
1898
|
if (!hasJoinUrl) {
|
|
1734
1899
|
return;
|
|
1735
1900
|
}
|
|
1736
1901
|
setJoinQrVisible(true);
|
|
1737
1902
|
}, [hasJoinUrl]);
|
|
1738
|
-
const hideJoinQr =
|
|
1903
|
+
const hideJoinQr = useCallback3(() => {
|
|
1739
1904
|
setJoinQrVisible(false);
|
|
1740
1905
|
}, []);
|
|
1741
|
-
const toggleJoinQr =
|
|
1906
|
+
const toggleJoinQr = useCallback3(() => {
|
|
1742
1907
|
if (!hasJoinUrl) {
|
|
1743
1908
|
return;
|
|
1744
1909
|
}
|
|
1745
1910
|
setJoinQrVisible((current) => !current);
|
|
1746
1911
|
}, [hasJoinUrl]);
|
|
1747
|
-
const handleStart =
|
|
1912
|
+
const handleStart = useCallback3(() => {
|
|
1748
1913
|
if (!canStartMatch) {
|
|
1749
1914
|
return;
|
|
1750
1915
|
}
|
|
@@ -1766,10 +1931,13 @@ var useHostJoinControls = ({
|
|
|
1766
1931
|
};
|
|
1767
1932
|
export {
|
|
1768
1933
|
AIRJAM_DEFAULT_AVATAR_SEEDS,
|
|
1934
|
+
AxisButton,
|
|
1769
1935
|
Button,
|
|
1770
1936
|
ConnectionStatusPill,
|
|
1937
|
+
ControlButton,
|
|
1771
1938
|
ControllerPlayerNameField,
|
|
1772
1939
|
ControllerPrimaryAction,
|
|
1940
|
+
GamepadLayout,
|
|
1773
1941
|
HostMuteButton,
|
|
1774
1942
|
JoinQrOverlay,
|
|
1775
1943
|
JoinUrlActionButtons,
|
|
@@ -1781,12 +1949,10 @@ export {
|
|
|
1781
1949
|
RoomQrCode,
|
|
1782
1950
|
RuntimeShellHeader,
|
|
1783
1951
|
Slider,
|
|
1952
|
+
Stick,
|
|
1784
1953
|
SurfaceViewport,
|
|
1785
1954
|
VolumeControls,
|
|
1786
|
-
buttonVariants,
|
|
1787
1955
|
getDiceBearAdventurerNeutralUrl,
|
|
1788
|
-
getPlayerAvatarImageUrl,
|
|
1789
|
-
resolvePlayerAvatarSeed,
|
|
1790
1956
|
useControllerLifecycleIntents,
|
|
1791
1957
|
useControllerLifecyclePermissions,
|
|
1792
1958
|
useControllerShellStatus,
|