@lavitre/apps 1.49.2 → 1.52.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.
Files changed (36) hide show
  1. package/README.md +38 -0
  2. package/dist/Common/Common.Model.d.ts +32 -2
  3. package/dist/Common/Common.Model.js.map +1 -1
  4. package/dist/Common/PreviewScaling.d.ts +62 -0
  5. package/dist/Common/PreviewScaling.js +132 -0
  6. package/dist/Common/PreviewScaling.js.map +1 -0
  7. package/dist/Common/index.d.ts +1 -0
  8. package/dist/Common/index.js +1 -0
  9. package/dist/Common/index.js.map +1 -1
  10. package/dist/CompanionFrame/CompanionFrame.d.ts +1 -1
  11. package/dist/CompanionFrame/CompanionFrame.js.map +1 -1
  12. package/dist/Connector/Connector.Model.d.ts +45 -2
  13. package/dist/Connector/Connector.Model.js.map +1 -1
  14. package/dist/Connector/Connector.js +6 -3
  15. package/dist/Connector/Connector.js.map +1 -1
  16. package/dist/Connector/SettingsSchema.d.ts +7 -0
  17. package/dist/Connector/SettingsSchema.js +19 -0
  18. package/dist/Connector/SettingsSchema.js.map +1 -0
  19. package/dist/Frame/Frame.Model.d.ts +10 -1
  20. package/dist/Frame/Frame.Model.js.map +1 -1
  21. package/dist/Frame/Frame.d.ts +31 -1
  22. package/dist/Frame/Frame.js +87 -2
  23. package/dist/Frame/Frame.js.map +1 -1
  24. package/dist/Frame/LocalPreview.d.ts +133 -0
  25. package/dist/Frame/LocalPreview.js +823 -0
  26. package/dist/Frame/LocalPreview.js.map +1 -0
  27. package/dist/Frame/ScaledStreamWorker.d.ts +9 -0
  28. package/dist/Frame/ScaledStreamWorker.js +34 -0
  29. package/dist/Frame/ScaledStreamWorker.js.map +1 -0
  30. package/dist/Frame/index.d.ts +1 -0
  31. package/dist/Frame/index.js +1 -0
  32. package/dist/Frame/index.js.map +1 -1
  33. package/dist/Version.d.ts +1 -1
  34. package/dist/Version.js +1 -1
  35. package/dist/Version.js.map +1 -1
  36. package/package.json +2 -1
@@ -1,4 +1,4 @@
1
- import type { AiInboundMessage, AiOutboundMessage, AppMessage, BluetoothFromApp, BluetoothToApp, BorderOptions, ChangePrivacy, ChangeTeamSpace, ChangeTeamSpaceGuest, CompanionFramePeerJoined, CompanionFramePeerLeft, CompanionFramePeersUpdated, ConnectedMediaDevice, ConnectionCodeUpdated, Device, DeviceFrameReference, DeviceFullscreenUpdated, DeviceJoined, DeviceLeft, DeviceMessageReceived, DevicePrivacyChanged, DeviceScalingUpdated, DisconnectGuests, EnumerateLoadedFrames, EnumerateLoadedFramesCompleted, EventTelemetry, FieldUpdated, FileData, CompanionInformation, FrameTouchMode, GetStats, HideNotification, HostInformation, I18nMap, Interaction, KnockKnock, LayoutPosition, LocalConnectorMessageReceived, MenuClicked, MenuEntry, NotificationButtonClicked, NotificationDismissed, NotificationInfo, PendingDevicesInfo, PositionUpdated, PrivacyChanged, Rect, RequestSerialPortAccess, SerialPortAccessResult, RequestStreamSizeUpdate, ResizeMode, SaveSettings, SendKnockKnock, SendMessageTo, SendMessageToAll, SendToLocalFrame, SendToSerialPort, SetReducedAudioMode, SettingsUpdated, SetVisibility, ShareDataRequest, ShareFileRequest, Size, StartEventTelemetry, StateReplaced, StatsResponse, StreamCapture, UpdateState, VideoContentHint, ViewMode, VisibilityChanged, VitreSettings, VitreSettingsSetter, VoiceAction, VoiceActionDetection } from '../Common/index.js';
1
+ import type { AiInboundMessage, AiOutboundMessage, AppMessage, BluetoothFromApp, BluetoothToApp, BorderOptions, ChangePrivacy, ChangeTeamSpace, ChangeTeamSpaceGuest, CompanionFramePeerJoined, CompanionFramePeerLeft, CompanionFramePeersUpdated, ConnectedMediaDevice, ConnectionCodeUpdated, Device, DeviceFrameReference, DeviceFullscreenUpdated, DeviceJoined, DeviceLeft, DeviceMessageReceived, DevicePrivacyChanged, DeviceScalingUpdated, DisconnectGuests, EnumerateLoadedFrames, EnumerateLoadedFramesCompleted, EventTelemetry, FieldUpdated, FileData, CompanionInformation, FrameTouchMode, GetStats, HideNotification, HostInformation, I18nMap, Interaction, KnockKnock, LayoutPosition, LocalConnectorMessageReceived, MenuClicked, MenuEntry, NotificationButtonClicked, NotificationDismissed, NotificationInfo, PendingDevicesInfo, PositionUpdated, SafeAreaInsets, SafeAreaInsetsUpdated, PrivacyChanged, Rect, RequestSerialPortAccess, SerialPortAccessResult, RequestStreamSizeUpdate, ResizeMode, SaveSettings, SendKnockKnock, SendMessageTo, SendMessageToAll, SendToLocalFrame, SendToSerialPort, SetReducedAudioMode, SettingsUpdated, SetVisibility, ShareDataRequest, ShareFileRequest, Size, StartEventTelemetry, StateReplaced, StatsResponse, StreamCapture, UpdateState, VideoContentHint, ViewMode, VisibilityChanged, VitreSettings, VitreSettingsSetter, VoiceAction, VoiceActionDetection } from '../Common/index.js';
2
2
  import type { MediaTrackInfo, ReplaceShareStream, ShareStream, ShareStreamCompleted, ShareStreamTrack, StopShareStream } from '../Connector/Connector.Model.js';
3
3
  export type SharedStreamAvailable = {
4
4
  streamId: string;
@@ -70,6 +70,13 @@ export type InitializeFrame = {
70
70
  isBorderless: boolean;
71
71
  state?: Record<string, any>;
72
72
  position: Rect;
73
+ /**
74
+ * Insets the frame must keep its controls clear of, when the host runs it
75
+ * edge-to-edge (`CompanionFrameOption.edgeToEdge`); later changes arrive
76
+ * as `safeAreaInsetsUpdated`. Absent from hosts before 1.51 — read as all
77
+ * zero. Added 1.51.
78
+ */
79
+ safeAreaInsets?: SafeAreaInsets;
73
80
  };
74
81
  export type FrameDefaultMenuCategory = {
75
82
  type: 'defaultMenu';
@@ -293,6 +300,8 @@ export type FrameApiMessagesIn = ({
293
300
  } & VisibilityChanged) | ({
294
301
  type: 'positionUpdated';
295
302
  } & PositionUpdated) | ({
303
+ type: 'safeAreaInsetsUpdated';
304
+ } & SafeAreaInsetsUpdated) | ({
296
305
  type: 'deviceScalingUpdated';
297
306
  } & DeviceScalingUpdated) | ({
298
307
  type: 'updateFrameName';
@@ -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"]}
@@ -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`
@@ -130,9 +147,22 @@ export declare class Frame {
130
147
  set yjsDoc(doc: Y.Doc);
131
148
  position: Rect;
132
149
  zIndex: number;
150
+ private deviceStateListeners;
151
+ /**
152
+ * Called after any change of `hostInformation.device`,
153
+ * `hostInformation.devicesInSpace` or the available media devices (device
154
+ * joined or left, privacy, fullscreen, scaling, media devices, Vitre
155
+ * settings), once the matching `on…` callback has run. Unlike those callbacks, several
156
+ * listeners can coexist: SDK helpers use this so they never replace a
157
+ * handler the app assigned. Returns the unsubscribe function. Added 1.52.
158
+ */
159
+ addDeviceStateListener(listener: () => void): () => void;
160
+ private notifyDeviceState;
133
161
  constructor(postMessage: PostMessageFrameApiOut, initMessage: InitializeFrame, options: ViewOptions, initState?: Record<string, any>);
134
162
  private resolveRequest;
135
163
  raiseMessage(msg: FrameApiMessagesIn): void;
164
+ /** Stores the insets and mirrors them as `--lavitre-safe-area-inset-*` on `<html>`. */
165
+ private applySafeAreaInsets;
136
166
  private _onStateReplaced;
137
167
  sendMessageTo(message: SendMessageTo): void;
138
168
  sendMessageToAll(message: SendMessageToAll): void;
@@ -14,6 +14,28 @@ export class Frame {
14
14
  set yjsDoc(doc) {
15
15
  this.crdt.attach(doc);
16
16
  }
17
+ /**
18
+ * Called after any change of `hostInformation.device`,
19
+ * `hostInformation.devicesInSpace` or the available media devices (device
20
+ * joined or left, privacy, fullscreen, scaling, media devices, Vitre
21
+ * settings), once the matching `on…` callback has run. Unlike those callbacks, several
22
+ * listeners can coexist: SDK helpers use this so they never replace a
23
+ * handler the app assigned. Returns the unsubscribe function. Added 1.52.
24
+ */
25
+ addDeviceStateListener(listener) {
26
+ this.deviceStateListeners.add(listener);
27
+ return () => this.deviceStateListeners.delete(listener);
28
+ }
29
+ notifyDeviceState() {
30
+ for (const listener of this.deviceStateListeners) {
31
+ try {
32
+ listener();
33
+ }
34
+ catch (error) {
35
+ console.error('[Frame] device state listener failed', error);
36
+ }
37
+ }
38
+ }
17
39
  constructor(
18
40
  // `protected` (not `private`) so the companion-only subclass
19
41
  // `CompanionFrameImpl` (CompanionFrame.ts) can post its companion-frame
@@ -237,6 +259,18 @@ export class Frame {
237
259
  writable: true,
238
260
  value: void 0
239
261
  });
262
+ /**
263
+ * The host moved a system bar over an edge-to-edge frame (device rotated,
264
+ * navigation mode switched). `safeAreaInsets` and the
265
+ * `--lavitre-safe-area-inset-*` CSS variables are already updated when
266
+ * this fires. Added 1.51.
267
+ */
268
+ Object.defineProperty(this, "onSafeAreaInsetsUpdated", {
269
+ enumerable: true,
270
+ configurable: true,
271
+ writable: true,
272
+ value: void 0
273
+ });
240
274
  Object.defineProperty(this, "onDeviceFullscreenUpdated", {
241
275
  enumerable: true,
242
276
  configurable: true,
@@ -319,6 +353,26 @@ export class Frame {
319
353
  writable: true,
320
354
  value: void 0
321
355
  });
356
+ /**
357
+ * Distances from the frame's edges to the area free of system UI, in CSS
358
+ * px. Non-zero only for a companion frame declared
359
+ * `CompanionFrameOption.edgeToEdge`, on a host drawing under the system
360
+ * bars (Android). Also exposed as `--lavitre-safe-area-inset-top|right|
361
+ * bottom|left` on `document.documentElement`, so plain CSS can use them:
362
+ * `padding-bottom: var(--lavitre-safe-area-inset-bottom, 0px)`. Updated in
363
+ * place before `onSafeAreaInsetsUpdated` fires. Added 1.51.
364
+ */
365
+ Object.defineProperty(this, "safeAreaInsets", {
366
+ enumerable: true,
367
+ configurable: true,
368
+ writable: true,
369
+ value: {
370
+ top: 0,
371
+ right: 0,
372
+ bottom: 0,
373
+ left: 0,
374
+ }
375
+ });
322
376
  /**
323
377
  * The companion's own identity/runtime context, present only when this
324
378
  * frame is loaded by a la Vitre **companion** (`hostInformation.isCompanion`
@@ -420,6 +474,12 @@ export class Frame {
420
474
  writable: true,
421
475
  value: void 0
422
476
  });
477
+ Object.defineProperty(this, "deviceStateListeners", {
478
+ enumerable: true,
479
+ configurable: true,
480
+ writable: true,
481
+ value: new Set()
482
+ });
423
483
  Object.defineProperty(this, "requestResolvers", {
424
484
  enumerable: true,
425
485
  configurable: true,
@@ -477,6 +537,8 @@ export class Frame {
477
537
  this.isFullscreen = initMessage.isFullscreen;
478
538
  this.position = initMessage.position;
479
539
  this.zIndex = 0;
540
+ if (initMessage.safeAreaInsets)
541
+ this.applySafeAreaInsets(initMessage.safeAreaInsets);
480
542
  this.isFullscreen = initMessage.isFullscreen;
481
543
  this.postMessage({
482
544
  type: 'frameInitialized',
@@ -559,6 +621,7 @@ export class Frame {
559
621
  ],
560
622
  };
561
623
  this.onDeviceJoined?.(msg.device);
624
+ this.notifyDeviceState();
562
625
  break;
563
626
  case 'deviceLeft':
564
627
  this.hostInformation = {
@@ -566,6 +629,7 @@ export class Frame {
566
629
  devicesInSpace: this.hostInformation.devicesInSpace.filter((d) => d.id !== msg.deviceId),
567
630
  };
568
631
  this.onDeviceLeft?.(msg.deviceId);
632
+ this.notifyDeviceState();
569
633
  break;
570
634
  case 'deviceMessageReceived':
571
635
  this.onDeviceMessageReceived?.(msg);
@@ -637,6 +701,7 @@ export class Frame {
637
701
  },
638
702
  };
639
703
  this.onVitreSettingsUpdated?.(msg);
704
+ this.notifyDeviceState();
640
705
  break;
641
706
  case 'connectionCodeUpdated':
642
707
  this.hostInformation = {
@@ -660,6 +725,7 @@ export class Frame {
660
725
  ],
661
726
  };
662
727
  this.onDevicePrivacyChanged?.(msg.device);
728
+ this.notifyDeviceState();
663
729
  break;
664
730
  case 'deviceFrameLoaded':
665
731
  this.onDeviceFrameLoaded?.(msg);
@@ -688,10 +754,15 @@ export class Frame {
688
754
  this.isFullscreen = msg.isFullscreen;
689
755
  this.onPositionUpdated?.(msg);
690
756
  break;
757
+ case 'safeAreaInsetsUpdated':
758
+ this.applySafeAreaInsets(msg.safeAreaInsets);
759
+ this.onSafeAreaInsetsUpdated?.(msg);
760
+ break;
691
761
  case 'deviceFullscreenUpdated':
692
762
  this.hostInformation.devicesInSpace =
693
763
  this.hostInformation.devicesInSpace.map((d) => d.id === msg.deviceId ? { ...d, fullscreen: msg.fullscreen } : d);
694
764
  this.onDeviceFullscreenUpdated?.(msg);
765
+ this.notifyDeviceState();
695
766
  break;
696
767
  case 'visibilityChanged':
697
768
  this.onVisibilityChanged?.(msg);
@@ -712,6 +783,7 @@ export class Frame {
712
783
  }
713
784
  : d);
714
785
  this.onDeviceScalingUpdated?.(msg);
786
+ this.notifyDeviceState();
715
787
  break;
716
788
  case 'updateFrameName':
717
789
  this.options.name = msg.name;
@@ -749,6 +821,7 @@ export class Frame {
749
821
  },
750
822
  };
751
823
  this.onMediaDevicesChanged?.(msg.devices);
824
+ this.notifyDeviceState();
752
825
  break;
753
826
  case 'bluetooth':
754
827
  this.onBluetoothMessage?.(msg);
@@ -778,6 +851,16 @@ export class Frame {
778
851
  }
779
852
  this.onMessageReceived?.(msg);
780
853
  }
854
+ /** Stores the insets and mirrors them as `--lavitre-safe-area-inset-*` on `<html>`. */
855
+ applySafeAreaInsets(insets) {
856
+ this.safeAreaInsets = insets;
857
+ const root = typeof document !== 'undefined' ? document.documentElement : undefined;
858
+ if (!root)
859
+ return;
860
+ for (const edge of ['top', 'right', 'bottom', 'left']) {
861
+ root.style.setProperty(`--lavitre-safe-area-inset-${edge}`, `${insets[edge]}px`);
862
+ }
863
+ }
781
864
  _onStateReplaced(msg) {
782
865
  const oldState = this.state;
783
866
  this.state = msg.state;
@@ -1040,7 +1123,8 @@ export class Frame {
1040
1123
  const requestId = randomUuid();
1041
1124
  const { tracks, transfer } = this.toShareTracks(stream);
1042
1125
  await this.postRequest({ type: 'shareStream', requestId, sharedStreamId, options, tracks }, (msg, resolve, reject) => {
1043
- if (msg.type === 'shareStreamCompleted' && msg.requestId === requestId) {
1126
+ if (msg.type === 'shareStreamCompleted' &&
1127
+ msg.requestId === requestId) {
1044
1128
  if (msg.error != null)
1045
1129
  reject(msg.error);
1046
1130
  else
@@ -1064,7 +1148,8 @@ export class Frame {
1064
1148
  const requestId = randomUuid();
1065
1149
  const { tracks, transfer } = this.toShareTracks(stream);
1066
1150
  await this.postRequest({ type: 'replaceShareStream', requestId, sharedStreamId, tracks }, (msg, resolve, reject) => {
1067
- if (msg.type === 'shareStreamCompleted' && msg.requestId === requestId) {
1151
+ if (msg.type === 'shareStreamCompleted' &&
1152
+ msg.requestId === requestId) {
1068
1153
  if (msg.error != null)
1069
1154
  reject(msg.error);
1070
1155
  else