| 1 | import { |
| 2 | resolveDeviceModelId, |
| 3 | type DeviceAccessorySource, |
| 4 | type DeviceModelSource, |
| 5 | } from "@t3tools/client-runtime/device/model"; |
| 6 | import type { DevicePlatform } from "@t3tools/contracts"; |
| 7 | import iphoneDuo from "./models/iphone-duo.glb?url"; |
| 8 | import iphone18Pro from "./models/iphone-18-pro.glb?url"; |
| 9 | import iphone18ProMax from "./models/iphone-18-pro-max.glb?url"; |
| 10 | import magicKeyboard from "./models/ipad-pro-13-m5-magic-keyboard.glb?url"; |
| 11 | import ipadPro13M5 from "./models/ipad-pro-13-m5.glb?url"; |
| 12 | |
| 13 | // Bundled URLs follow the client origin in local, desktop, hosted and remote sessions. |
| 14 | const models: Record<DeviceModelSource["id"], DeviceModelSource> = { |
| 15 | "iphone-duo": { id: "iphone-duo", url: iphoneDuo }, |
| 16 | "iphone-18-pro": { id: "iphone-18-pro", url: iphone18Pro }, |
| 17 | "iphone-18-pro-max": { id: "iphone-18-pro-max", url: iphone18ProMax }, |
| 18 | "ipad-pro-13-m5": { id: "ipad-pro-13-m5", url: ipadPro13M5 }, |
| 19 | }; |
| 20 | |
| 21 | export function deviceModel(platform: DevicePlatform, name: string): DeviceModelSource | null { |
| 22 | const id = resolveDeviceModelId(platform, name); |
| 23 | return id ? models[id] : null; |
| 24 | } |
| 25 | |
| 26 | const keyboard: DeviceAccessorySource = { |
| 27 | id: "ipad-pro-13-m5-magic-keyboard", |
| 28 | modelId: "ipad-pro-13-m5", |
| 29 | url: magicKeyboard, |
| 30 | }; |
| 31 | |
| 32 | export function deviceKeyboard( |
| 33 | platform: DevicePlatform, |
| 34 | name: string, |
| 35 | ): DeviceAccessorySource | null { |
| 36 | return resolveDeviceModelId(platform, name) === keyboard.modelId ? keyboard : null; |
| 37 | } |