@lavitre/apps 1.49.1 → 1.51.0
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 +18 -0
- package/dist/Common/Common.Model.d.ts +32 -2
- package/dist/Common/Common.Model.js.map +1 -1
- package/dist/Common/Uuid.d.ts +1 -0
- package/dist/Common/Uuid.js +17 -0
- package/dist/Common/Uuid.js.map +1 -0
- package/dist/CompanionFrame/CompanionFrame.d.ts +1 -1
- package/dist/CompanionFrame/CompanionFrame.js.map +1 -1
- package/dist/Connector/Connector.Model.d.ts +45 -2
- package/dist/Connector/Connector.Model.js.map +1 -1
- package/dist/Connector/Connector.js +17 -14
- package/dist/Connector/Connector.js.map +1 -1
- package/dist/Connector/SettingsSchema.d.ts +7 -0
- package/dist/Connector/SettingsSchema.js +19 -0
- package/dist/Connector/SettingsSchema.js.map +1 -0
- package/dist/Frame/Frame.Model.d.ts +10 -1
- package/dist/Frame/Frame.Model.js.map +1 -1
- package/dist/Frame/Frame.d.ts +20 -1
- package/dist/Frame/Frame.js +54 -11
- package/dist/Frame/Frame.js.map +1 -1
- package/dist/MediaLink/MediaLink.js +2 -1
- package/dist/MediaLink/MediaLink.js.map +1 -1
- package/dist/Version.d.ts +1 -1
- package/dist/Version.js +1 -1
- package/dist/Version.js.map +1 -1
- package/package.json +1 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Frame.Model.js","sourceRoot":"","sources":["../../Frame/Frame.Model.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AiInboundMessage,\n AiOutboundMessage,\n AppMessage,\n BluetoothFromApp,\n BluetoothToApp,\n BorderOptions,\n ChangePrivacy,\n ChangeTeamSpace,\n ChangeTeamSpaceGuest,\n CompanionFramePeerJoined,\n CompanionFramePeerLeft,\n CompanionFramePeersUpdated,\n ConnectedMediaDevice,\n ConnectionCodeUpdated,\n Device,\n DeviceFrameReference,\n DeviceFullscreenUpdated,\n DeviceJoined,\n DeviceLeft,\n DeviceMessageReceived,\n DevicePrivacyChanged,\n DeviceScalingUpdated,\n DisconnectGuests,\n EnumerateLoadedFrames,\n EnumerateLoadedFramesCompleted,\n EventTelemetry,\n FieldUpdated,\n FileData,\n CompanionInformation,\n FrameTouchMode,\n GetStats,\n HideNotification,\n HostInformation,\n I18nMap,\n Interaction,\n KnockKnock,\n LayoutPosition,\n LocalConnectorMessageReceived,\n MenuClicked,\n MenuEntry,\n NotificationButtonClicked,\n NotificationDismissed,\n NotificationInfo,\n PendingDevicesInfo,\n PositionUpdated,\n PrivacyChanged,\n Rect,\n RequestSerialPortAccess,\n SerialPortAccessResult,\n RequestStreamSizeUpdate,\n ResizeMode,\n SaveSettings,\n SendKnockKnock,\n SendMessageTo,\n SendMessageToAll,\n SendToLocalFrame,\n SendToSerialPort,\n SetReducedAudioMode,\n SettingsUpdated,\n SetVisibility,\n ShareDataRequest,\n ShareFileRequest,\n Size,\n StartEventTelemetry,\n StateReplaced,\n StatsResponse,\n StreamCapture,\n UpdateState,\n VideoContentHint,\n ViewMode,\n VisibilityChanged,\n VitreSettings,\n VitreSettingsSetter,\n VoiceAction,\n VoiceActionDetection,\n} from '../Common/index.js'\nimport type {\n MediaTrackInfo,\n ReplaceShareStream,\n ShareStream,\n ShareStreamCompleted,\n ShareStreamTrack,\n StopShareStream,\n} from '../Connector/Connector.Model.js'\n\n/// Host → Frame (reverse breakout box): the Vitre exposes a live `MediaStream`\n/// it owns into a frame. Each track carries a transferable `readable`\n/// (MediaStreamTrackProcessor output); the frame rebuilds a live\n/// MediaStreamTrack via MediaStreamTrackGenerator. `streamId` lets the frame\n/// match a later `sharedStreamRemoved`. Symmetric inverse of `ShareStream`.\nexport type SharedStreamAvailable = {\n streamId: string\n tracks: ShareStreamTrack[]\n}\n\nexport type SharedStreamRemoved = {\n streamId: string\n}\n\nexport type AvailableExportSource = {\n supportedFormats: string[]\n label: I18nMap\n fileSuffix?: string\n fileExtension?: string\n binaryHeader?: ArrayBufferLike\n tag?: any\n id: string\n menu?: MenuEntry[]\n /**\n * SDK 1.46 — whether this export source is offered to connected\n * companions. Defaults to `true`.\n *\n * When `false` the Vitre never advertises the source to a companion, so\n * it appears in no companion menu: neither \"share to another app\" nor\n * \"download to this device\". The Vitre's own export menu is unaffected.\n *\n * Use it for sources that only make sense on the Vitre (huge payloads,\n * formats a phone cannot open, host-local side effects).\n */\n availableForCompanion?: boolean\n}\n\nexport type LoadingFileData = {\n id: string\n name: string\n mime: string\n}\n\nexport type InitFrameOptions = {\n frameConnectorId: string\n streamId?: string\n name: string\n url: string\n size: Size\n minSize?: Size\n maxSize?: Size\n touchMode: FrameTouchMode\n allowFullscreen: boolean\n resizeMode: ResizeMode\n data?: any\n file?: FileData\n border: BorderOptions\n syncedTimeOffset: number\n}\n\nexport type InitializeFrame = {\n hostInfo: HostInformation\n /**\n * The companion's own identity/runtime context, present only when this\n * frame is loaded by a la Vitre **companion** (mirrors\n * `hostInfo.isCompanion`). Surfaced as `frame.companionInformation`.\n * Undefined on Vitre-side frames. Added 1.19.\n */\n companionInfo?: CompanionInformation\n initiator: Device\n id: string\n appId?: string\n options: InitFrameOptions\n isFullscreen: boolean\n /**\n * @deprecated Use options.border.mode\n */\n isBorderless: boolean\n state?: Record<string, any>\n position: Rect\n}\n\nexport type FrameDefaultMenuCategory = {\n type: 'defaultMenu'\n label?: string\n description?: string\n order?: number\n}\n\nexport type FrameMenuCategory = { type: 'iconMenu' } | FrameDefaultMenuCategory\n\nexport type FrameMenuEntry = Omit<MenuEntry, 'category'> & {\n category?: FrameMenuCategory\n}\n\nexport type SetFrameMenu = {\n menu: FrameMenuEntry[]\n}\n\nexport type ViewOptions = {\n name: string\n minSize?: Size\n maxSize?: Size\n size?: Size\n /**\n * @deprecated Use interaction property\n */\n touchMode?: FrameTouchMode\n allowFullscreen?: boolean\n hideMenu?: boolean\n resizeMode?: ResizeMode\n menu?: FrameMenuEntry[]\n exportSources?: AvailableExportSource[]\n /**\n * @deprecated Use interaction property\n */\n interactionEnabled?: boolean\n interaction?: Interaction\n mode?: ViewMode\n closable?: boolean\n closeLabel?: string\n}\n\nexport type FrameInitialized = {\n options: ViewOptions\n}\n\nexport type SetFullscreen = {\n type: 'setFullscreen'\n}\n\nexport type SetWindowed = {\n type: 'setWindowed'\n}\n\n/**\n * Replace the video track of THIS frame's shared stream with a new\n * `getUserMedia` capture (e.g. switch camera) while keeping the same share\n * (same `sharedStreamId`) — results in a `replaceTrack` on the host, no\n * WebRTC renegotiation. The host applies an `{ exact }` deviceId constraint.\n */\nexport type ReplaceFrameStream = {\n requestId: string\n constraints: MediaStreamConstraints\n}\n\nexport type ApplyStreamAdvancedConstraints = {\n streamId?: string\n contentHint?: VideoContentHint\n whiteBalanceMode?: string\n focusMode?: string\n resizeMode?: string\n exposureMode?: string\n\n colorTemperature?: number\n exposureCompensation?: number\n brightness?: number\n contrast?: number\n exposureTime?: number\n saturation?: number\n sharpness?: number\n focusDistance?: number\n width?: number\n height?: number\n mirror?: boolean\n}\n\nexport type IsInteractingChanged = {\n isInteracting: boolean\n}\n\nexport type FileProgress = {\n bytes: number\n totalBytes: number\n}\n\nexport type FileLoaded = {\n file: ArrayBufferLike\n}\n\nexport type SetExportSources = {\n /**\n * The full replacement list. Was mistyped as a single\n * `AvailableExportSource` until 1.47; the host has always decoded an\n * array here (`Decode.array` on the `setExportSources` message), so no\n * emitter can have relied on the singular form — nothing shipped could\n * send this message before 1.47 anyway, `Frame.setExportSources` being\n * the first emitter.\n */\n exportSources: AvailableExportSource[]\n}\n\nexport type ExportRequest = {\n id: string\n format?: string\n tag?: any\n exportSourceId: string\n menuId?: string\n}\n\nexport type ExportData = {\n format: string\n name: string\n buffer: ArrayBufferLike\n}\n\nexport type ExportDone = {\n request: ExportRequest\n data?: ExportData\n error?: string\n}\n\nexport type SetSize = {\n width: number\n height: number\n}\n\nexport type BorderlessUpdated = {\n isBorderless: boolean\n}\n\nexport type FullscreenUpdated = {\n isFullscreen: boolean\n}\n\nexport type UpdateFrameName = { name: string }\n\nexport type UpdateName = { name: string }\n\nexport type SharedStreamPlayState = 'playing' | 'paused'\n\nexport type LocalSharedStreamUpdate = {\n volume: number\n}\n\nexport type StreamAction =\n | { action: 'play' }\n | { action: 'pause' }\n | { action: 'seek'; position: number; isRelative: boolean }\n | { action: 'volume'; volume: number; muted: boolean }\n\nexport type FrameApiMessagesIn =\n | ({\n type: 'enumerateLoadedFramesCompleted'\n } & EnumerateLoadedFramesCompleted)\n | ({ type: 'initialize' } & InitializeFrame)\n | ({ type: 'deviceJoined' } & DeviceJoined)\n | ({ type: 'deviceLeft' } & DeviceLeft)\n | ({ type: 'deviceMessageReceived' } & DeviceMessageReceived)\n | ({ type: 'localConnectorMessageReceived' } & LocalConnectorMessageReceived)\n | ({ type: 'menuClicked' } & MenuClicked)\n | ({ type: 'fieldUpdated' } & FieldUpdated)\n | ({ type: 'privacyChanged' } & PrivacyChanged)\n | ({ type: 'isInteractingChanged' } & IsInteractingChanged)\n | ({ type: 'fileLoaded' } & FileLoaded)\n | ({ type: 'fileProgress' } & FileProgress)\n | ({ type: 'exportRequest' } & ExportRequest)\n | ({ type: 'vitreSettingsResponse' } & VitreSettings)\n | ({ type: 'knockKnockReceived' } & KnockKnock)\n | ({ type: 'settingsUpdated' } & SettingsUpdated)\n | ({ type: 'vitreSettingsUpdated' } & VitreSettings)\n | ({ type: 'notificationDismissed' } & NotificationDismissed)\n | ({ type: 'notificationButtonClicked' } & NotificationButtonClicked)\n | ({ type: 'devicePrivacyChanged' } & DevicePrivacyChanged)\n | ({ type: 'deviceFrameUnloaded' } & DeviceFrameReference)\n | ({ type: 'deviceFrameLoaded' } & DeviceFrameReference)\n | ({ type: 'deviceFrameConnectorLoaded' } & DeviceFrameReference)\n | ({ type: 'pendingDevicesConnectionRequested' } & PendingDevicesInfo)\n | ({ type: 'borderlessUpdated' } & BorderlessUpdated)\n | ({ type: 'fullscreenUpdated' } & FullscreenUpdated)\n | ({ type: 'borderOptionsUpdated' } & BorderOptions)\n | ({ type: 'voiceActionDetected' } & VoiceActionDetection)\n | {\n type: 'streamFrameCapturedResponse'\n requestId: string\n response?: StreamCapture\n error: string\n }\n | {\n type: 'replaceFrameStreamCompleted'\n requestId: string\n tracks?: MediaTrackInfo[]\n error?: string\n }\n | ({ type: 'stateReplaced' } & StateReplaced)\n | ({ type: 'deviceFullscreenUpdated' } & DeviceFullscreenUpdated)\n | ({ type: 'visibilityChanged' } & VisibilityChanged)\n | ({ type: 'positionUpdated' } & PositionUpdated)\n | ({ type: 'deviceScalingUpdated' } & DeviceScalingUpdated)\n | ({ type: 'updateFrameName' } & UpdateFrameName)\n | ({ type: 'localSharedStreamUpdate' } & LocalSharedStreamUpdate)\n | ({ type: 'statsResponse' } & StatsResponse)\n | { type: 'iceServersResponse'; requestId: string; iceServers: IceServerConfig[] }\n | ({ type: 'serialPortAccessResult'; requestId: string } & SerialPortAccessResult)\n | ({ type: 'connectionCodeUpdated' } & ConnectionCodeUpdated)\n | ({ type: 'mediaDevicesChanged' } & MediaDevicesChanged)\n | ({ type: 'bluetooth' } & BluetoothToApp)\n | { type: 'crdtUpdate'; update: ArrayBufferLike }\n | { type: 'crdtSyncComplete' }\n | { type: 'crdtRequestSync' }\n | { type: 'crdtAwarenessUpdate'; update: ArrayBufferLike }\n | { type: 'crdtSubdocUpdate'; guid: string; update: ArrayBufferLike }\n | { type: 'crdtSubdocSyncComplete'; guid: string }\n | {\n type: 'crdtSubdocTransferProgress'\n guid: string\n receivedBytes: number\n totalBytes: number\n }\n | { type: 'crdtSubdocRequestSync'; guid: string }\n | ({ type: 'companionFramePeerJoined' } & CompanionFramePeerJoined)\n | ({ type: 'companionFramePeerLeft' } & CompanionFramePeerLeft)\n | ({ type: 'companionFramePeersUpdated' } & CompanionFramePeersUpdated)\n | ({ type: 'shareStreamCompleted' } & ShareStreamCompleted)\n | ({ type: 'sharedStreamAvailable' } & SharedStreamAvailable)\n | ({ type: 'sharedStreamRemoved' } & SharedStreamRemoved)\n | { type: 'attachStreamCompleted'; requestId: string; error?: string }\n // AI tool channel: the host asks this frame to run one of its registered tools.\n | AiInboundMessage\n\nexport type MediaDevicesChanged = {\n devices: ConnectedMediaDevice[]\n}\n\n/** Companion frame → Vitre main connector (see CompanionFrame.sendMessageToVitreConnector). */\nexport type SendToVitreConnector = {\n frameConnectorId: string\n message: string\n fileData?: FileData\n}\n\n/**\n * ICE / TURN server config the HOST already uses for its own WebRTC P2P,\n * sourced from the connection handshake (`StartWebRTCOffer.IceServers` on a\n * Vitre, `WebRTCOffer.iceServers` on a companion). The shape matches the\n * browser `RTCIceServer` so the result of {@link Frame.getIceServers} can be\n * passed straight to `new RTCPeerConnection({ iceServers })` — letting an app\n * stand up its own peer connection (e.g. a companion-camera frame connecting\n * directly to its paired Vitre transform frame) that traverses NAT through the\n * same TURN relays as the platform, without shipping its own credentials.\n */\nexport type IceServerConfig = {\n urls: string[]\n username?: string\n credential?: string\n}\n\nexport type FrameApiMessagesOut =\n | ({ type: 'sendMessageTo' } & SendMessageTo)\n | ({ type: 'sendMessageToAll' } & SendMessageToAll)\n | ({ type: 'frameInitialized' } & FrameInitialized)\n | { type: 'setFullscreen' }\n | { type: 'setWindowed' }\n | { type: 'close' }\n | ({ type: 'setFrameMenu' } & SetFrameMenu)\n | ({ type: 'sendToLocalFrame' } & SendToLocalFrame)\n | ({ type: 'sendToVitreConnector' } & SendToVitreConnector)\n | ({ type: 'enumerateLoadedFrames' } & EnumerateLoadedFrames)\n | ({ type: 'setExportSources' } & SetExportSources)\n | ({\n type: 'applyStreamAdvancedConstraints'\n } & ApplyStreamAdvancedConstraints)\n | ({ type: 'replaceFrameStream' } & ReplaceFrameStream)\n | { type: 'stopInteracting' }\n | { type: 'startInteracting' }\n | ({ type: 'exportDone' } & ExportDone)\n | ({ type: 'setSize' } & SetSize)\n | { type: 'getVitreSettings' }\n | ({ type: 'setVitreSettings' } & VitreSettingsSetter)\n | ({ type: 'shareFile' } & ShareFileRequest)\n | ({ type: 'shareData' } & ShareDataRequest)\n | ({ type: 'saveSettings' } & SaveSettings)\n | ({ type: 'changeTeamSpace' } & ChangeTeamSpace)\n | ({ type: 'changeTeamSpaceGuest' } & ChangeTeamSpaceGuest)\n | ({ type: 'showNotification' } & NotificationInfo)\n | ({ type: 'hideNotification' } & HideNotification)\n | ({ type: 'changePrivacy' } & ChangePrivacy)\n | ({ type: 'appMessage' } & AppMessage)\n | ({ type: 'extensionMessage' } & AppMessage)\n | ({ type: 'trackEvent' } & EventTelemetry)\n | ({ type: 'startTrackEvent' } & StartEventTelemetry)\n | ({ type: 'stopTrackEvent' } & EventTelemetry)\n | ({ type: 'setBorderOptions' } & BorderOptions)\n | { type: 'setVoiceActions'; actions: VoiceAction[] }\n | { type: 'streamFrameCaptureRequest'; requestId: string }\n | ({ type: 'updateState' } & UpdateState)\n | ({ type: 'setPosition' } & LayoutPosition)\n | ({ type: 'setVisibility' } & SetVisibility)\n | ({ type: 'sharedStreamAction' } & StreamAction)\n | ({ type: 'sendKnockKnock' } & SendKnockKnock)\n | ({ type: 'getStats' } & GetStats)\n | { type: 'getIceServers'; requestId: string }\n | ({ type: 'setReducedAudioMode' } & SetReducedAudioMode)\n | ({ type: 'sendToSerialPort' } & SendToSerialPort)\n | ({ type: 'requestSerialPortAccess'; requestId: string } & RequestSerialPortAccess)\n | ({ type: 'bluetooth' } & BluetoothFromApp)\n | ({ type: 'disconnectGuests' } & DisconnectGuests)\n | ({ type: 'requestStreamSizeUpdate' } & RequestStreamSizeUpdate)\n | ({ type: 'updateName' } & UpdateName)\n | ({ type: 'shareStream' } & ShareStream)\n | ({ type: 'replaceShareStream' } & ReplaceShareStream)\n | ({ type: 'stopShareStream' } & StopShareStream)\n | {\n type: 'attachStream'\n requestId: string\n targetFrameConnectorId?: string\n tracks: ShareStreamTrack[]\n }\n | { type: 'detachStream'; targetFrameConnectorId?: string }\n | { type: 'crdtUpdate'; update: ArrayBufferLike }\n | { type: 'crdtRequestSync' }\n | { type: 'crdtAwarenessUpdate'; update: ArrayBufferLike }\n | { type: 'crdtRequestAwareness' }\n | { type: 'crdtSubdocUpdate'; guid: string; update: ArrayBufferLike }\n | { type: 'crdtSubdocRequestSync'; guid: string }\n /**\n * Companion-frame-only: close the iframe locally on the companion and\n * remove this companion from the per-frame `framePresence` on the Vitre,\n * WITHOUT closing the Vitre's own frame (which keeps showing for other\n * peers + the local Vitre app). The companion's resulting state matches\n * \"frame was open on the Vitre when I late-joined the space\": iframe\n * unmounted, not in framePresence, can be re-opened by clicking the\n * matching menu entry again or by autoOpen on next reconnect.\n *\n * Sent by `CompanionFrame.closeOnCompanion()`. The Vitre host's path is\n * the existing `CompanionToVitreReq.FrameClosed` — semantics are\n * \"remove from presence, don't kill the Vitre frame\" so no new wire\n * case is needed. The `close` arm of this union remains the global\n * close (deprecated for use on companion frames).\n */\n | { type: 'closeOnCompanion' }\n // AI tool channel: publish/withdraw this frame's tool catalog + answer invocations.\n | AiOutboundMessage\n"]}
|
|
1
|
+
{"version":3,"file":"Frame.Model.js","sourceRoot":"","sources":["../../Frame/Frame.Model.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AiInboundMessage,\n AiOutboundMessage,\n AppMessage,\n BluetoothFromApp,\n BluetoothToApp,\n BorderOptions,\n ChangePrivacy,\n ChangeTeamSpace,\n ChangeTeamSpaceGuest,\n CompanionFramePeerJoined,\n CompanionFramePeerLeft,\n CompanionFramePeersUpdated,\n ConnectedMediaDevice,\n ConnectionCodeUpdated,\n Device,\n DeviceFrameReference,\n DeviceFullscreenUpdated,\n DeviceJoined,\n DeviceLeft,\n DeviceMessageReceived,\n DevicePrivacyChanged,\n DeviceScalingUpdated,\n DisconnectGuests,\n EnumerateLoadedFrames,\n EnumerateLoadedFramesCompleted,\n EventTelemetry,\n FieldUpdated,\n FileData,\n CompanionInformation,\n FrameTouchMode,\n GetStats,\n HideNotification,\n HostInformation,\n I18nMap,\n Interaction,\n KnockKnock,\n LayoutPosition,\n LocalConnectorMessageReceived,\n MenuClicked,\n MenuEntry,\n NotificationButtonClicked,\n NotificationDismissed,\n NotificationInfo,\n PendingDevicesInfo,\n PositionUpdated,\n SafeAreaInsets,\n SafeAreaInsetsUpdated,\n PrivacyChanged,\n Rect,\n RequestSerialPortAccess,\n SerialPortAccessResult,\n RequestStreamSizeUpdate,\n ResizeMode,\n SaveSettings,\n SendKnockKnock,\n SendMessageTo,\n SendMessageToAll,\n SendToLocalFrame,\n SendToSerialPort,\n SetReducedAudioMode,\n SettingsUpdated,\n SetVisibility,\n ShareDataRequest,\n ShareFileRequest,\n Size,\n StartEventTelemetry,\n StateReplaced,\n StatsResponse,\n StreamCapture,\n UpdateState,\n VideoContentHint,\n ViewMode,\n VisibilityChanged,\n VitreSettings,\n VitreSettingsSetter,\n VoiceAction,\n VoiceActionDetection,\n} from '../Common/index.js'\nimport type {\n MediaTrackInfo,\n ReplaceShareStream,\n ShareStream,\n ShareStreamCompleted,\n ShareStreamTrack,\n StopShareStream,\n} from '../Connector/Connector.Model.js'\n\n/// Host → Frame (reverse breakout box): the Vitre exposes a live `MediaStream`\n/// it owns into a frame. Each track carries a transferable `readable`\n/// (MediaStreamTrackProcessor output); the frame rebuilds a live\n/// MediaStreamTrack via MediaStreamTrackGenerator. `streamId` lets the frame\n/// match a later `sharedStreamRemoved`. Symmetric inverse of `ShareStream`.\nexport type SharedStreamAvailable = {\n streamId: string\n tracks: ShareStreamTrack[]\n}\n\nexport type SharedStreamRemoved = {\n streamId: string\n}\n\nexport type AvailableExportSource = {\n supportedFormats: string[]\n label: I18nMap\n fileSuffix?: string\n fileExtension?: string\n binaryHeader?: ArrayBufferLike\n tag?: any\n id: string\n menu?: MenuEntry[]\n /**\n * SDK 1.46 — whether this export source is offered to connected\n * companions. Defaults to `true`.\n *\n * When `false` the Vitre never advertises the source to a companion, so\n * it appears in no companion menu: neither \"share to another app\" nor\n * \"download to this device\". The Vitre's own export menu is unaffected.\n *\n * Use it for sources that only make sense on the Vitre (huge payloads,\n * formats a phone cannot open, host-local side effects).\n */\n availableForCompanion?: boolean\n}\n\nexport type LoadingFileData = {\n id: string\n name: string\n mime: string\n}\n\nexport type InitFrameOptions = {\n frameConnectorId: string\n streamId?: string\n name: string\n url: string\n size: Size\n minSize?: Size\n maxSize?: Size\n touchMode: FrameTouchMode\n allowFullscreen: boolean\n resizeMode: ResizeMode\n data?: any\n file?: FileData\n border: BorderOptions\n syncedTimeOffset: number\n}\n\nexport type InitializeFrame = {\n hostInfo: HostInformation\n /**\n * The companion's own identity/runtime context, present only when this\n * frame is loaded by a la Vitre **companion** (mirrors\n * `hostInfo.isCompanion`). Surfaced as `frame.companionInformation`.\n * Undefined on Vitre-side frames. Added 1.19.\n */\n companionInfo?: CompanionInformation\n initiator: Device\n id: string\n appId?: string\n options: InitFrameOptions\n isFullscreen: boolean\n /**\n * @deprecated Use options.border.mode\n */\n isBorderless: boolean\n state?: Record<string, any>\n position: Rect\n /**\n * Insets the frame must keep its controls clear of, when the host runs it\n * edge-to-edge (`CompanionFrameOption.edgeToEdge`); later changes arrive\n * as `safeAreaInsetsUpdated`. Absent from hosts before 1.51 — read as all\n * zero. Added 1.51.\n */\n safeAreaInsets?: SafeAreaInsets\n}\n\nexport type FrameDefaultMenuCategory = {\n type: 'defaultMenu'\n label?: string\n description?: string\n order?: number\n}\n\nexport type FrameMenuCategory = { type: 'iconMenu' } | FrameDefaultMenuCategory\n\nexport type FrameMenuEntry = Omit<MenuEntry, 'category'> & {\n category?: FrameMenuCategory\n}\n\nexport type SetFrameMenu = {\n menu: FrameMenuEntry[]\n}\n\nexport type ViewOptions = {\n name: string\n minSize?: Size\n maxSize?: Size\n size?: Size\n /**\n * @deprecated Use interaction property\n */\n touchMode?: FrameTouchMode\n allowFullscreen?: boolean\n hideMenu?: boolean\n resizeMode?: ResizeMode\n menu?: FrameMenuEntry[]\n exportSources?: AvailableExportSource[]\n /**\n * @deprecated Use interaction property\n */\n interactionEnabled?: boolean\n interaction?: Interaction\n mode?: ViewMode\n closable?: boolean\n closeLabel?: string\n}\n\nexport type FrameInitialized = {\n options: ViewOptions\n}\n\nexport type SetFullscreen = {\n type: 'setFullscreen'\n}\n\nexport type SetWindowed = {\n type: 'setWindowed'\n}\n\n/**\n * Replace the video track of THIS frame's shared stream with a new\n * `getUserMedia` capture (e.g. switch camera) while keeping the same share\n * (same `sharedStreamId`) — results in a `replaceTrack` on the host, no\n * WebRTC renegotiation. The host applies an `{ exact }` deviceId constraint.\n */\nexport type ReplaceFrameStream = {\n requestId: string\n constraints: MediaStreamConstraints\n}\n\nexport type ApplyStreamAdvancedConstraints = {\n streamId?: string\n contentHint?: VideoContentHint\n whiteBalanceMode?: string\n focusMode?: string\n resizeMode?: string\n exposureMode?: string\n\n colorTemperature?: number\n exposureCompensation?: number\n brightness?: number\n contrast?: number\n exposureTime?: number\n saturation?: number\n sharpness?: number\n focusDistance?: number\n width?: number\n height?: number\n mirror?: boolean\n}\n\nexport type IsInteractingChanged = {\n isInteracting: boolean\n}\n\nexport type FileProgress = {\n bytes: number\n totalBytes: number\n}\n\nexport type FileLoaded = {\n file: ArrayBufferLike\n}\n\nexport type SetExportSources = {\n /**\n * The full replacement list. Was mistyped as a single\n * `AvailableExportSource` until 1.47; the host has always decoded an\n * array here (`Decode.array` on the `setExportSources` message), so no\n * emitter can have relied on the singular form — nothing shipped could\n * send this message before 1.47 anyway, `Frame.setExportSources` being\n * the first emitter.\n */\n exportSources: AvailableExportSource[]\n}\n\nexport type ExportRequest = {\n id: string\n format?: string\n tag?: any\n exportSourceId: string\n menuId?: string\n}\n\nexport type ExportData = {\n format: string\n name: string\n buffer: ArrayBufferLike\n}\n\nexport type ExportDone = {\n request: ExportRequest\n data?: ExportData\n error?: string\n}\n\nexport type SetSize = {\n width: number\n height: number\n}\n\nexport type BorderlessUpdated = {\n isBorderless: boolean\n}\n\nexport type FullscreenUpdated = {\n isFullscreen: boolean\n}\n\nexport type UpdateFrameName = { name: string }\n\nexport type UpdateName = { name: string }\n\nexport type SharedStreamPlayState = 'playing' | 'paused'\n\nexport type LocalSharedStreamUpdate = {\n volume: number\n}\n\nexport type StreamAction =\n | { action: 'play' }\n | { action: 'pause' }\n | { action: 'seek'; position: number; isRelative: boolean }\n | { action: 'volume'; volume: number; muted: boolean }\n\nexport type FrameApiMessagesIn =\n | ({\n type: 'enumerateLoadedFramesCompleted'\n } & EnumerateLoadedFramesCompleted)\n | ({ type: 'initialize' } & InitializeFrame)\n | ({ type: 'deviceJoined' } & DeviceJoined)\n | ({ type: 'deviceLeft' } & DeviceLeft)\n | ({ type: 'deviceMessageReceived' } & DeviceMessageReceived)\n | ({ type: 'localConnectorMessageReceived' } & LocalConnectorMessageReceived)\n | ({ type: 'menuClicked' } & MenuClicked)\n | ({ type: 'fieldUpdated' } & FieldUpdated)\n | ({ type: 'privacyChanged' } & PrivacyChanged)\n | ({ type: 'isInteractingChanged' } & IsInteractingChanged)\n | ({ type: 'fileLoaded' } & FileLoaded)\n | ({ type: 'fileProgress' } & FileProgress)\n | ({ type: 'exportRequest' } & ExportRequest)\n | ({ type: 'vitreSettingsResponse' } & VitreSettings)\n | ({ type: 'knockKnockReceived' } & KnockKnock)\n | ({ type: 'settingsUpdated' } & SettingsUpdated)\n | ({ type: 'vitreSettingsUpdated' } & VitreSettings)\n | ({ type: 'notificationDismissed' } & NotificationDismissed)\n | ({ type: 'notificationButtonClicked' } & NotificationButtonClicked)\n | ({ type: 'devicePrivacyChanged' } & DevicePrivacyChanged)\n | ({ type: 'deviceFrameUnloaded' } & DeviceFrameReference)\n | ({ type: 'deviceFrameLoaded' } & DeviceFrameReference)\n | ({ type: 'deviceFrameConnectorLoaded' } & DeviceFrameReference)\n | ({ type: 'pendingDevicesConnectionRequested' } & PendingDevicesInfo)\n | ({ type: 'borderlessUpdated' } & BorderlessUpdated)\n | ({ type: 'fullscreenUpdated' } & FullscreenUpdated)\n | ({ type: 'borderOptionsUpdated' } & BorderOptions)\n | ({ type: 'voiceActionDetected' } & VoiceActionDetection)\n | {\n type: 'streamFrameCapturedResponse'\n requestId: string\n response?: StreamCapture\n error: string\n }\n | {\n type: 'replaceFrameStreamCompleted'\n requestId: string\n tracks?: MediaTrackInfo[]\n error?: string\n }\n | ({ type: 'stateReplaced' } & StateReplaced)\n | ({ type: 'deviceFullscreenUpdated' } & DeviceFullscreenUpdated)\n | ({ type: 'visibilityChanged' } & VisibilityChanged)\n | ({ type: 'positionUpdated' } & PositionUpdated)\n | ({ type: 'safeAreaInsetsUpdated' } & SafeAreaInsetsUpdated)\n | ({ type: 'deviceScalingUpdated' } & DeviceScalingUpdated)\n | ({ type: 'updateFrameName' } & UpdateFrameName)\n | ({ type: 'localSharedStreamUpdate' } & LocalSharedStreamUpdate)\n | ({ type: 'statsResponse' } & StatsResponse)\n | { type: 'iceServersResponse'; requestId: string; iceServers: IceServerConfig[] }\n | ({ type: 'serialPortAccessResult'; requestId: string } & SerialPortAccessResult)\n | ({ type: 'connectionCodeUpdated' } & ConnectionCodeUpdated)\n | ({ type: 'mediaDevicesChanged' } & MediaDevicesChanged)\n | ({ type: 'bluetooth' } & BluetoothToApp)\n | { type: 'crdtUpdate'; update: ArrayBufferLike }\n | { type: 'crdtSyncComplete' }\n | { type: 'crdtRequestSync' }\n | { type: 'crdtAwarenessUpdate'; update: ArrayBufferLike }\n | { type: 'crdtSubdocUpdate'; guid: string; update: ArrayBufferLike }\n | { type: 'crdtSubdocSyncComplete'; guid: string }\n | {\n type: 'crdtSubdocTransferProgress'\n guid: string\n receivedBytes: number\n totalBytes: number\n }\n | { type: 'crdtSubdocRequestSync'; guid: string }\n | ({ type: 'companionFramePeerJoined' } & CompanionFramePeerJoined)\n | ({ type: 'companionFramePeerLeft' } & CompanionFramePeerLeft)\n | ({ type: 'companionFramePeersUpdated' } & CompanionFramePeersUpdated)\n | ({ type: 'shareStreamCompleted' } & ShareStreamCompleted)\n | ({ type: 'sharedStreamAvailable' } & SharedStreamAvailable)\n | ({ type: 'sharedStreamRemoved' } & SharedStreamRemoved)\n | { type: 'attachStreamCompleted'; requestId: string; error?: string }\n // AI tool channel: the host asks this frame to run one of its registered tools.\n | AiInboundMessage\n\nexport type MediaDevicesChanged = {\n devices: ConnectedMediaDevice[]\n}\n\n/** Companion frame → Vitre main connector (see CompanionFrame.sendMessageToVitreConnector). */\nexport type SendToVitreConnector = {\n frameConnectorId: string\n message: string\n fileData?: FileData\n}\n\n/**\n * ICE / TURN server config the HOST already uses for its own WebRTC P2P,\n * sourced from the connection handshake (`StartWebRTCOffer.IceServers` on a\n * Vitre, `WebRTCOffer.iceServers` on a companion). The shape matches the\n * browser `RTCIceServer` so the result of {@link Frame.getIceServers} can be\n * passed straight to `new RTCPeerConnection({ iceServers })` — letting an app\n * stand up its own peer connection (e.g. a companion-camera frame connecting\n * directly to its paired Vitre transform frame) that traverses NAT through the\n * same TURN relays as the platform, without shipping its own credentials.\n */\nexport type IceServerConfig = {\n urls: string[]\n username?: string\n credential?: string\n}\n\nexport type FrameApiMessagesOut =\n | ({ type: 'sendMessageTo' } & SendMessageTo)\n | ({ type: 'sendMessageToAll' } & SendMessageToAll)\n | ({ type: 'frameInitialized' } & FrameInitialized)\n | { type: 'setFullscreen' }\n | { type: 'setWindowed' }\n | { type: 'close' }\n | ({ type: 'setFrameMenu' } & SetFrameMenu)\n | ({ type: 'sendToLocalFrame' } & SendToLocalFrame)\n | ({ type: 'sendToVitreConnector' } & SendToVitreConnector)\n | ({ type: 'enumerateLoadedFrames' } & EnumerateLoadedFrames)\n | ({ type: 'setExportSources' } & SetExportSources)\n | ({\n type: 'applyStreamAdvancedConstraints'\n } & ApplyStreamAdvancedConstraints)\n | ({ type: 'replaceFrameStream' } & ReplaceFrameStream)\n | { type: 'stopInteracting' }\n | { type: 'startInteracting' }\n | ({ type: 'exportDone' } & ExportDone)\n | ({ type: 'setSize' } & SetSize)\n | { type: 'getVitreSettings' }\n | ({ type: 'setVitreSettings' } & VitreSettingsSetter)\n | ({ type: 'shareFile' } & ShareFileRequest)\n | ({ type: 'shareData' } & ShareDataRequest)\n | ({ type: 'saveSettings' } & SaveSettings)\n | ({ type: 'changeTeamSpace' } & ChangeTeamSpace)\n | ({ type: 'changeTeamSpaceGuest' } & ChangeTeamSpaceGuest)\n | ({ type: 'showNotification' } & NotificationInfo)\n | ({ type: 'hideNotification' } & HideNotification)\n | ({ type: 'changePrivacy' } & ChangePrivacy)\n | ({ type: 'appMessage' } & AppMessage)\n | ({ type: 'extensionMessage' } & AppMessage)\n | ({ type: 'trackEvent' } & EventTelemetry)\n | ({ type: 'startTrackEvent' } & StartEventTelemetry)\n | ({ type: 'stopTrackEvent' } & EventTelemetry)\n | ({ type: 'setBorderOptions' } & BorderOptions)\n | { type: 'setVoiceActions'; actions: VoiceAction[] }\n | { type: 'streamFrameCaptureRequest'; requestId: string }\n | ({ type: 'updateState' } & UpdateState)\n | ({ type: 'setPosition' } & LayoutPosition)\n | ({ type: 'setVisibility' } & SetVisibility)\n | ({ type: 'sharedStreamAction' } & StreamAction)\n | ({ type: 'sendKnockKnock' } & SendKnockKnock)\n | ({ type: 'getStats' } & GetStats)\n | { type: 'getIceServers'; requestId: string }\n | ({ type: 'setReducedAudioMode' } & SetReducedAudioMode)\n | ({ type: 'sendToSerialPort' } & SendToSerialPort)\n | ({ type: 'requestSerialPortAccess'; requestId: string } & RequestSerialPortAccess)\n | ({ type: 'bluetooth' } & BluetoothFromApp)\n | ({ type: 'disconnectGuests' } & DisconnectGuests)\n | ({ type: 'requestStreamSizeUpdate' } & RequestStreamSizeUpdate)\n | ({ type: 'updateName' } & UpdateName)\n | ({ type: 'shareStream' } & ShareStream)\n | ({ type: 'replaceShareStream' } & ReplaceShareStream)\n | ({ type: 'stopShareStream' } & StopShareStream)\n | {\n type: 'attachStream'\n requestId: string\n targetFrameConnectorId?: string\n tracks: ShareStreamTrack[]\n }\n | { type: 'detachStream'; targetFrameConnectorId?: string }\n | { type: 'crdtUpdate'; update: ArrayBufferLike }\n | { type: 'crdtRequestSync' }\n | { type: 'crdtAwarenessUpdate'; update: ArrayBufferLike }\n | { type: 'crdtRequestAwareness' }\n | { type: 'crdtSubdocUpdate'; guid: string; update: ArrayBufferLike }\n | { type: 'crdtSubdocRequestSync'; guid: string }\n /**\n * Companion-frame-only: close the iframe locally on the companion and\n * remove this companion from the per-frame `framePresence` on the Vitre,\n * WITHOUT closing the Vitre's own frame (which keeps showing for other\n * peers + the local Vitre app). The companion's resulting state matches\n * \"frame was open on the Vitre when I late-joined the space\": iframe\n * unmounted, not in framePresence, can be re-opened by clicking the\n * matching menu entry again or by autoOpen on next reconnect.\n *\n * Sent by `CompanionFrame.closeOnCompanion()`. The Vitre host's path is\n * the existing `CompanionToVitreReq.FrameClosed` — semantics are\n * \"remove from presence, don't kill the Vitre frame\" so no new wire\n * case is needed. The `close` arm of this union remains the global\n * close (deprecated for use on companion frames).\n */\n | { type: 'closeOnCompanion' }\n // AI tool channel: publish/withdraw this frame's tool catalog + answer invocations.\n | AiOutboundMessage\n"]}
|
package/dist/Frame/Frame.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type * as Y from 'yjs';
|
|
|
2
2
|
import { CrdtChannel } from '../Common/CrdtChannel.js';
|
|
3
3
|
import { BlobStore } from '../Common/BlobStore.js';
|
|
4
4
|
import { AiChannel } from '../Common/AiChannel.js';
|
|
5
|
-
import type { AppId, BluetoothFromApp, BluetoothToApp, BorderOptions, CompanionInformation, ConnectedMediaDevice, Device, DeviceFrameReference, DeviceFullscreenUpdated, DeviceMessageReceived, DeviceScalingUpdated, Field, FileData, FramePeer, HostInformation, KnockKnock, LayoutPosition, LoadedFrame, MessageTarget, NotificationButtonClicked, NotificationInfo, PositionUpdated, Privacy, Rect, ReplacedBy, RequestSerialPortAccess, RequestStreamSizeUpdate, SendKnockKnock, SendMessageTo, SendMessageToAll, SendToSerialPort, StatsResponse, StreamCapture, UpdatedStateEntry, UpdateStateEntry, Visibility, VisibilityChanged, VitreSettings, VitreSettingsSetter, VoiceAction, VoiceActionDetection } from '../Common/index.js';
|
|
5
|
+
import type { AppId, BluetoothFromApp, BluetoothToApp, BorderOptions, CompanionInformation, ConnectedMediaDevice, Device, DeviceFrameReference, DeviceFullscreenUpdated, DeviceMessageReceived, DeviceScalingUpdated, Field, FileData, FramePeer, HostInformation, KnockKnock, LayoutPosition, LoadedFrame, MessageTarget, NotificationButtonClicked, NotificationInfo, PositionUpdated, SafeAreaInsets, SafeAreaInsetsUpdated, Privacy, Rect, ReplacedBy, RequestSerialPortAccess, RequestStreamSizeUpdate, SendKnockKnock, SendMessageTo, SendMessageToAll, SendToSerialPort, StatsResponse, StreamCapture, UpdatedStateEntry, UpdateStateEntry, Visibility, VisibilityChanged, VitreSettings, VitreSettingsSetter, VoiceAction, VoiceActionDetection } from '../Common/index.js';
|
|
6
6
|
import type { Connector, ShareStreamOptions } from '../Connector/index.js';
|
|
7
7
|
import type { MediaTrackInfo } from '../Connector/Connector.Model.js';
|
|
8
8
|
import type { ApplyStreamAdvancedConstraints, AvailableExportSource, ExportData, ExportRequest, FrameApiMessagesIn, FrameApiMessagesOut, FrameMenuEntry, IceServerConfig, InitFrameOptions, InitializeFrame, SharedStreamPlayState, ViewOptions } from './Frame.Model.js';
|
|
@@ -68,6 +68,13 @@ export declare class Frame {
|
|
|
68
68
|
onVoiceActionDetected?: (voiceAction: VoiceActionDetection) => void;
|
|
69
69
|
onStateReplaced?: (newState: Record<string, any>, oldState: Record<string, any>, replacedBy: ReplacedBy, delta: UpdatedStateEntry[]) => void;
|
|
70
70
|
onPositionUpdated?: (positionUpdate: PositionUpdated) => void;
|
|
71
|
+
/**
|
|
72
|
+
* The host moved a system bar over an edge-to-edge frame (device rotated,
|
|
73
|
+
* navigation mode switched). `safeAreaInsets` and the
|
|
74
|
+
* `--lavitre-safe-area-inset-*` CSS variables are already updated when
|
|
75
|
+
* this fires. Added 1.51.
|
|
76
|
+
*/
|
|
77
|
+
onSafeAreaInsetsUpdated?: (msg: SafeAreaInsetsUpdated) => void;
|
|
71
78
|
onDeviceFullscreenUpdated?: (deviceFullscreenUpdated: DeviceFullscreenUpdated) => void;
|
|
72
79
|
onVisibilityChanged?: (msg: VisibilityChanged) => void;
|
|
73
80
|
onDeviceScalingUpdated?: (msg: DeviceScalingUpdated) => void;
|
|
@@ -90,6 +97,16 @@ export declare class Frame {
|
|
|
90
97
|
/** @deprecated Subscribe via `crdt.doc.on('update', ...)` instead. */
|
|
91
98
|
onYjsUpdate?: (update: Uint8Array) => void;
|
|
92
99
|
hostInformation: HostInformation;
|
|
100
|
+
/**
|
|
101
|
+
* Distances from the frame's edges to the area free of system UI, in CSS
|
|
102
|
+
* px. Non-zero only for a companion frame declared
|
|
103
|
+
* `CompanionFrameOption.edgeToEdge`, on a host drawing under the system
|
|
104
|
+
* bars (Android). Also exposed as `--lavitre-safe-area-inset-top|right|
|
|
105
|
+
* bottom|left` on `document.documentElement`, so plain CSS can use them:
|
|
106
|
+
* `padding-bottom: var(--lavitre-safe-area-inset-bottom, 0px)`. Updated in
|
|
107
|
+
* place before `onSafeAreaInsetsUpdated` fires. Added 1.51.
|
|
108
|
+
*/
|
|
109
|
+
safeAreaInsets: SafeAreaInsets;
|
|
93
110
|
/**
|
|
94
111
|
* The companion's own identity/runtime context, present only when this
|
|
95
112
|
* frame is loaded by a la Vitre **companion** (`hostInformation.isCompanion`
|
|
@@ -133,6 +150,8 @@ export declare class Frame {
|
|
|
133
150
|
constructor(postMessage: PostMessageFrameApiOut, initMessage: InitializeFrame, options: ViewOptions, initState?: Record<string, any>);
|
|
134
151
|
private resolveRequest;
|
|
135
152
|
raiseMessage(msg: FrameApiMessagesIn): void;
|
|
153
|
+
/** Stores the insets and mirrors them as `--lavitre-safe-area-inset-*` on `<html>`. */
|
|
154
|
+
private applySafeAreaInsets;
|
|
136
155
|
private _onStateReplaced;
|
|
137
156
|
sendMessageTo(message: SendMessageTo): void;
|
|
138
157
|
sendMessageToAll(message: SendMessageToAll): void;
|
package/dist/Frame/Frame.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference path="../Connector/insertable-streams.d.ts" />
|
|
2
|
-
import {
|
|
2
|
+
import { randomUuid } from '../Common/Uuid.js';
|
|
3
3
|
import { CrdtChannel, MIN_CRDT_HOST_VERSION } from '../Common/CrdtChannel.js';
|
|
4
4
|
import { BlobStore } from '../Common/BlobStore.js';
|
|
5
5
|
import { AiChannel, MIN_AI_HOST_VERSION } from '../Common/AiChannel.js';
|
|
@@ -237,6 +237,18 @@ export class Frame {
|
|
|
237
237
|
writable: true,
|
|
238
238
|
value: void 0
|
|
239
239
|
});
|
|
240
|
+
/**
|
|
241
|
+
* The host moved a system bar over an edge-to-edge frame (device rotated,
|
|
242
|
+
* navigation mode switched). `safeAreaInsets` and the
|
|
243
|
+
* `--lavitre-safe-area-inset-*` CSS variables are already updated when
|
|
244
|
+
* this fires. Added 1.51.
|
|
245
|
+
*/
|
|
246
|
+
Object.defineProperty(this, "onSafeAreaInsetsUpdated", {
|
|
247
|
+
enumerable: true,
|
|
248
|
+
configurable: true,
|
|
249
|
+
writable: true,
|
|
250
|
+
value: void 0
|
|
251
|
+
});
|
|
240
252
|
Object.defineProperty(this, "onDeviceFullscreenUpdated", {
|
|
241
253
|
enumerable: true,
|
|
242
254
|
configurable: true,
|
|
@@ -319,6 +331,21 @@ export class Frame {
|
|
|
319
331
|
writable: true,
|
|
320
332
|
value: void 0
|
|
321
333
|
});
|
|
334
|
+
/**
|
|
335
|
+
* Distances from the frame's edges to the area free of system UI, in CSS
|
|
336
|
+
* px. Non-zero only for a companion frame declared
|
|
337
|
+
* `CompanionFrameOption.edgeToEdge`, on a host drawing under the system
|
|
338
|
+
* bars (Android). Also exposed as `--lavitre-safe-area-inset-top|right|
|
|
339
|
+
* bottom|left` on `document.documentElement`, so plain CSS can use them:
|
|
340
|
+
* `padding-bottom: var(--lavitre-safe-area-inset-bottom, 0px)`. Updated in
|
|
341
|
+
* place before `onSafeAreaInsetsUpdated` fires. Added 1.51.
|
|
342
|
+
*/
|
|
343
|
+
Object.defineProperty(this, "safeAreaInsets", {
|
|
344
|
+
enumerable: true,
|
|
345
|
+
configurable: true,
|
|
346
|
+
writable: true,
|
|
347
|
+
value: { top: 0, right: 0, bottom: 0, left: 0 }
|
|
348
|
+
});
|
|
322
349
|
/**
|
|
323
350
|
* The companion's own identity/runtime context, present only when this
|
|
324
351
|
* frame is loaded by a la Vitre **companion** (`hostInformation.isCompanion`
|
|
@@ -477,6 +504,8 @@ export class Frame {
|
|
|
477
504
|
this.isFullscreen = initMessage.isFullscreen;
|
|
478
505
|
this.position = initMessage.position;
|
|
479
506
|
this.zIndex = 0;
|
|
507
|
+
if (initMessage.safeAreaInsets)
|
|
508
|
+
this.applySafeAreaInsets(initMessage.safeAreaInsets);
|
|
480
509
|
this.isFullscreen = initMessage.isFullscreen;
|
|
481
510
|
this.postMessage({
|
|
482
511
|
type: 'frameInitialized',
|
|
@@ -688,6 +717,10 @@ export class Frame {
|
|
|
688
717
|
this.isFullscreen = msg.isFullscreen;
|
|
689
718
|
this.onPositionUpdated?.(msg);
|
|
690
719
|
break;
|
|
720
|
+
case 'safeAreaInsetsUpdated':
|
|
721
|
+
this.applySafeAreaInsets(msg.safeAreaInsets);
|
|
722
|
+
this.onSafeAreaInsetsUpdated?.(msg);
|
|
723
|
+
break;
|
|
691
724
|
case 'deviceFullscreenUpdated':
|
|
692
725
|
this.hostInformation.devicesInSpace =
|
|
693
726
|
this.hostInformation.devicesInSpace.map((d) => d.id === msg.deviceId ? { ...d, fullscreen: msg.fullscreen } : d);
|
|
@@ -778,6 +811,16 @@ export class Frame {
|
|
|
778
811
|
}
|
|
779
812
|
this.onMessageReceived?.(msg);
|
|
780
813
|
}
|
|
814
|
+
/** Stores the insets and mirrors them as `--lavitre-safe-area-inset-*` on `<html>`. */
|
|
815
|
+
applySafeAreaInsets(insets) {
|
|
816
|
+
this.safeAreaInsets = insets;
|
|
817
|
+
const root = typeof document !== 'undefined' ? document.documentElement : undefined;
|
|
818
|
+
if (!root)
|
|
819
|
+
return;
|
|
820
|
+
for (const edge of ['top', 'right', 'bottom', 'left']) {
|
|
821
|
+
root.style.setProperty(`--lavitre-safe-area-inset-${edge}`, `${insets[edge]}px`);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
781
824
|
_onStateReplaced(msg) {
|
|
782
825
|
const oldState = this.state;
|
|
783
826
|
this.state = msg.state;
|
|
@@ -871,7 +914,7 @@ export class Frame {
|
|
|
871
914
|
* Resolves with the new track infos so the frame can rebuild its menu.
|
|
872
915
|
*/
|
|
873
916
|
async requestReplaceStream(constraints) {
|
|
874
|
-
const requestId =
|
|
917
|
+
const requestId = randomUuid();
|
|
875
918
|
return await this.postRequest({ type: 'replaceFrameStream', requestId, constraints }, (msg, resolve, reject) => {
|
|
876
919
|
if (msg.type === 'replaceFrameStreamCompleted' &&
|
|
877
920
|
msg.requestId === requestId) {
|
|
@@ -968,7 +1011,7 @@ export class Frame {
|
|
|
968
1011
|
/// With `{ port }` the host pre-grants it; with no argument the host shows
|
|
969
1012
|
/// its port-picker and resolves with the chosen port.
|
|
970
1013
|
async requestSerialPortAccess(request) {
|
|
971
|
-
const requestId =
|
|
1014
|
+
const requestId = randomUuid();
|
|
972
1015
|
return await this.postRequest({ type: 'requestSerialPortAccess', requestId, port: request?.port }, (msg, resolve, reject) => {
|
|
973
1016
|
if (msg.type === 'serialPortAccessResult' &&
|
|
974
1017
|
msg.requestId === requestId) {
|
|
@@ -1036,8 +1079,8 @@ export class Frame {
|
|
|
1036
1079
|
if (!this.canShareStream()) {
|
|
1037
1080
|
throw new Error('shareStream is not supported in this runtime (requires Chromium MediaStreamTrackProcessor and same-site hosting)');
|
|
1038
1081
|
}
|
|
1039
|
-
const sharedStreamId =
|
|
1040
|
-
const requestId =
|
|
1082
|
+
const sharedStreamId = randomUuid();
|
|
1083
|
+
const requestId = randomUuid();
|
|
1041
1084
|
const { tracks, transfer } = this.toShareTracks(stream);
|
|
1042
1085
|
await this.postRequest({ type: 'shareStream', requestId, sharedStreamId, options, tracks }, (msg, resolve, reject) => {
|
|
1043
1086
|
if (msg.type === 'shareStreamCompleted' && msg.requestId === requestId) {
|
|
@@ -1061,7 +1104,7 @@ export class Frame {
|
|
|
1061
1104
|
const stream = streamOrTrack instanceof MediaStream
|
|
1062
1105
|
? streamOrTrack
|
|
1063
1106
|
: new MediaStream([streamOrTrack]);
|
|
1064
|
-
const requestId =
|
|
1107
|
+
const requestId = randomUuid();
|
|
1065
1108
|
const { tracks, transfer } = this.toShareTracks(stream);
|
|
1066
1109
|
await this.postRequest({ type: 'replaceShareStream', requestId, sharedStreamId, tracks }, (msg, resolve, reject) => {
|
|
1067
1110
|
if (msg.type === 'shareStreamCompleted' && msg.requestId === requestId) {
|
|
@@ -1103,7 +1146,7 @@ export class Frame {
|
|
|
1103
1146
|
if (!this.canShareStream()) {
|
|
1104
1147
|
throw new Error('attachStream is not supported in this runtime (requires Chromium MediaStreamTrackProcessor and same-site hosting)');
|
|
1105
1148
|
}
|
|
1106
|
-
const requestId =
|
|
1149
|
+
const requestId = randomUuid();
|
|
1107
1150
|
const { tracks, transfer } = this.toShareTracks(stream);
|
|
1108
1151
|
await this.postRequest({
|
|
1109
1152
|
type: 'attachStream',
|
|
@@ -1145,7 +1188,7 @@ export class Frame {
|
|
|
1145
1188
|
* {@link IceServerConfig}.
|
|
1146
1189
|
*/
|
|
1147
1190
|
async getIceServers() {
|
|
1148
|
-
const requestId =
|
|
1191
|
+
const requestId = randomUuid();
|
|
1149
1192
|
return await this.postRequest({ type: 'getIceServers', requestId }, (msg, resolve, _reject) => {
|
|
1150
1193
|
if (msg.type === 'iceServersResponse' && msg.requestId === requestId) {
|
|
1151
1194
|
resolve(msg.iceServers ?? []);
|
|
@@ -1179,7 +1222,7 @@ export class Frame {
|
|
|
1179
1222
|
});
|
|
1180
1223
|
}
|
|
1181
1224
|
async requestEnumerateLocalFrames() {
|
|
1182
|
-
const requestId =
|
|
1225
|
+
const requestId = randomUuid();
|
|
1183
1226
|
return await this.postRequest({ type: 'enumerateLoadedFrames', requestId }, (msg, resolve, _reject) => {
|
|
1184
1227
|
if (msg.type === 'enumerateLoadedFramesCompleted' &&
|
|
1185
1228
|
msg.requestId === requestId) {
|
|
@@ -1329,7 +1372,7 @@ export class Frame {
|
|
|
1329
1372
|
});
|
|
1330
1373
|
}
|
|
1331
1374
|
async requestStreamCapture() {
|
|
1332
|
-
const requestId =
|
|
1375
|
+
const requestId = randomUuid();
|
|
1333
1376
|
return await this.postRequest({ type: 'streamFrameCaptureRequest', requestId }, (msg, resolve, reject) => {
|
|
1334
1377
|
if (msg.type === 'streamFrameCapturedResponse' &&
|
|
1335
1378
|
msg.requestId === requestId) {
|
|
@@ -1343,7 +1386,7 @@ export class Frame {
|
|
|
1343
1386
|
});
|
|
1344
1387
|
}
|
|
1345
1388
|
async requestStats() {
|
|
1346
|
-
const requestId =
|
|
1389
|
+
const requestId = randomUuid();
|
|
1347
1390
|
return await this.postRequest({ type: 'getStats', requestId }, (msg, resolve, _reject) => {
|
|
1348
1391
|
if (msg.type === 'statsResponse' && msg.requestId === requestId) {
|
|
1349
1392
|
resolve(msg);
|