@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.
- package/README.md +38 -0
- package/dist/Common/Common.Model.d.ts +32 -2
- package/dist/Common/Common.Model.js.map +1 -1
- package/dist/Common/PreviewScaling.d.ts +62 -0
- package/dist/Common/PreviewScaling.js +132 -0
- package/dist/Common/PreviewScaling.js.map +1 -0
- package/dist/Common/index.d.ts +1 -0
- package/dist/Common/index.js +1 -0
- package/dist/Common/index.js.map +1 -1
- 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 +6 -3
- 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 +31 -1
- package/dist/Frame/Frame.js +87 -2
- package/dist/Frame/Frame.js.map +1 -1
- package/dist/Frame/LocalPreview.d.ts +133 -0
- package/dist/Frame/LocalPreview.js +823 -0
- package/dist/Frame/LocalPreview.js.map +1 -0
- package/dist/Frame/ScaledStreamWorker.d.ts +9 -0
- package/dist/Frame/ScaledStreamWorker.js +34 -0
- package/dist/Frame/ScaledStreamWorker.js.map +1 -0
- package/dist/Frame/index.d.ts +1 -0
- package/dist/Frame/index.js +1 -0
- package/dist/Frame/index.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 +2 -1
package/README.md
CHANGED
|
@@ -108,6 +108,44 @@ frame.crdt.onSynced(cb) // fires once when the initial doc snaps
|
|
|
108
108
|
|
|
109
109
|
`createVitreSyncAdapter(frame)` returns a generic Yjs `SyncAdapter` (structurally compatible with the y-sync adapter contract used by Carbone, tldraw, etc.). Calling `.connect(doc, awareness)` is shorthand for `frame.crdt.attach(doc, awareness)`. Doc and awareness updates then ride the SDK's WebRTC data channels (separate envelopes `crdtUpdate` / `crdtAwarenessUpdate` so the F# host can route, throttle, and log them independently).
|
|
110
110
|
|
|
111
|
+
### App settings — `settingsSchema` is a map of fields
|
|
112
|
+
|
|
113
|
+
`ConnectorOptions.settingsSchema` (and `setSettingsSchema({ schema, schemaUI })`) takes **one key per setting**, the same keys the app reads back from `hostInformation.settings`. It is *not* a full JSON schema: the host builds the enclosing `{ type: 'object', title: <app name>, properties: … }` itself.
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
// RIGHT
|
|
117
|
+
settingsSchema: {
|
|
118
|
+
city: { type: 'string', title: 'City', default: 'Paris' },
|
|
119
|
+
showWeather: { type: 'boolean', title: 'Show weather', default: true },
|
|
120
|
+
layout: { type: 'object', title: 'Layout', properties: { columns: { type: 'number', default: 2 } } },
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// WRONG — a full JSON schema
|
|
124
|
+
settingsSchema: { type: 'object', properties: { city: { type: 'string' } } }
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
`type: 'object'` + `properties` is only for a setting that is itself an object. The wrong shape is a type error since 1.50 (`SettingsSchemaProperties`), and plain-JS apps get it unwrapped at runtime with a `console.error` — hosts that predate the 2026-09 fix crash their settings form on it. Every `properties` value and `items` must be a schema object (never `items: 'string'`), and `required` is an array of key names on the enclosing object. Always read settings through `ensureDefaultValue(hostInformation.settings, defaults)`: the value may be `null` or partial.
|
|
128
|
+
|
|
129
|
+
### Local camera preview — `LocalPreview`
|
|
130
|
+
|
|
131
|
+
Shows the Vitre's main camera the way the participants see it: zoom and offsets of the device in fullscreen (else of this device), rotation and mirror of the local camera. Same rendering as the host's own video element.
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
import { LocalPreview } from '@lavitre/apps/Frame'
|
|
135
|
+
|
|
136
|
+
const preview = new LocalPreview(frame) // opens the camera, retries, follows scaling updates
|
|
137
|
+
preview.attach(document.getElementById('view')!) // CSS transforms, no per-frame cost
|
|
138
|
+
video.srcObject = preview.getScaledStream() // or: frames already cropped (WebGL, recorder…)
|
|
139
|
+
const jpeg = await preview.capture() // still image, e.g. for onExportRequest
|
|
140
|
+
preview.dispose()
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
It listens through `frame.addDeviceStateListener`, so the app's `onDeviceScalingUpdated` & co. stay its own. While the camera cannot be opened, `preview.error` (also in `addListener`'s state) says why — `NotAllowedError`, `NotFoundError`, `TimeoutError`… — and retries continue with a growing delay. `getScaledStream` redraws each frame in a worker on Chromium (insertable streams), on the main thread when the worker cannot run (CSP without `blob:` in `worker-src`), and with a canvas elsewhere. Apps drawing the preview themselves use the pure helpers from `@lavitre/apps/Common`: `resolvePreviewScaling(hostInformation)` → `computePreviewLayout(scaling)` → `previewMatrix(layout, srcW, srcH, outW, outH)`, a matrix for `ctx.setTransform` or CSS `matrix()`.
|
|
144
|
+
|
|
145
|
+
## Development
|
|
146
|
+
|
|
147
|
+
`pnpm typecheck`, `pnpm build`, and `pnpm test` for the unit tests (`node:test`; Node ≥ 22.18 runs the TypeScript directly).
|
|
148
|
+
|
|
111
149
|
## Versioning
|
|
112
150
|
|
|
113
151
|
The package ships compiled ESM + `.d.ts` (`pnpm build` → `dist/`); import paths (`@lavitre/apps/<Module>`) are unchanged. `Version.ts` carries `apiVersion`, refreshed at build time by `replaceVersion.js`. The host enforces a minimum SDK version on initialize — bumping a breaking change requires a major-version bump in `package.json`.
|
|
@@ -308,8 +308,13 @@ export type CompanionFrameAudience = 'all' | 'administrator';
|
|
|
308
308
|
* close UI); the user can still leave via the device /
|
|
309
309
|
* browser back gesture. Defaults to `true` (shown).
|
|
310
310
|
*
|
|
311
|
-
* `
|
|
312
|
-
*
|
|
311
|
+
* - `edgeToEdge`: lets the frame cover the companion's whole surface,
|
|
312
|
+
* system bars included; the app then keeps its controls
|
|
313
|
+
* clear of them with `frame.safeAreaInsets`. See the
|
|
314
|
+
* field doc.
|
|
315
|
+
*
|
|
316
|
+
* `url` is mandatory; `autoOpen` / `menuVisibility` / `showBackButton` /
|
|
317
|
+
* `edgeToEdge` are independent and may be set together. If `autoOpen` and `menuVisibility`
|
|
313
318
|
* are both absent the companion mounts nothing — no navigation, no menu —
|
|
314
319
|
* and only the Vitre-side frame is shown.
|
|
315
320
|
*/
|
|
@@ -343,6 +348,16 @@ export type CompanionFrameOption = {
|
|
|
343
348
|
* label the entry with the frame's `name` (no icon / category).
|
|
344
349
|
*/
|
|
345
350
|
openMenuEntry?: CompanionFrameOpenMenuEntry;
|
|
351
|
+
/**
|
|
352
|
+
* Whether the full-page companion frame covers the companion's whole
|
|
353
|
+
* surface, system bars included (Android edge-to-edge: the navigation bar
|
|
354
|
+
* is drawn translucent over the content). Set `true` only when the app
|
|
355
|
+
* shifts its own controls with `frame.safeAreaInsets` — or with the
|
|
356
|
+
* `--lavitre-safe-area-inset-*` CSS variables the SDK sets from it. When
|
|
357
|
+
* unset or `false` the host keeps the iframe clear of the bars itself, so
|
|
358
|
+
* a frame that knows nothing about insets is never covered. Added 1.51.
|
|
359
|
+
*/
|
|
360
|
+
edgeToEdge?: boolean;
|
|
346
361
|
};
|
|
347
362
|
export type PositionType = 'Local' | 'Synced';
|
|
348
363
|
export type Interaction = 'notAllowed' | 'autoActiveOnFullscreen' | 'allowed';
|
|
@@ -857,6 +872,21 @@ export type PositionUpdated = {
|
|
|
857
872
|
isFullscreen: boolean;
|
|
858
873
|
zIndex: number;
|
|
859
874
|
};
|
|
875
|
+
/**
|
|
876
|
+
* Distances, in CSS px of the frame's own viewport, from each edge of the
|
|
877
|
+
* frame to the nearest edge of the area the host guarantees free of system
|
|
878
|
+
* UI (Android navigation bar, display cutout, …). All zero unless the host
|
|
879
|
+
* runs the frame edge-to-edge (`CompanionFrameOption.edgeToEdge`). Added 1.51.
|
|
880
|
+
*/
|
|
881
|
+
export type SafeAreaInsets = {
|
|
882
|
+
top: number;
|
|
883
|
+
right: number;
|
|
884
|
+
bottom: number;
|
|
885
|
+
left: number;
|
|
886
|
+
};
|
|
887
|
+
export type SafeAreaInsetsUpdated = {
|
|
888
|
+
safeAreaInsets: SafeAreaInsets;
|
|
889
|
+
};
|
|
860
890
|
export type Visibility = 'hidden' | 'visible' | 'visibleInFullscreenOnly';
|
|
861
891
|
export type MenuVisibility = 'hidden' | 'visible' | 'visibleInFullscreenOnly';
|
|
862
892
|
export type VisibilityChanged = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Common.Model.js","sourceRoot":"","sources":["../../Common/Common.Model.ts"],"names":[],"mappings":"AA4kBA;;GAEG;AACH,MAAM,CAAN,IAAY,cAOX;AAPD,WAAY,cAAc;IACxB,wFAAwF;IACxF,uCAAqB,CAAA;IACrB,mDAAiC,CAAA;IACjC,kEAAkE;IAClE,qDAAmC,CAAA;IACnC,mFAAiE,CAAA;AACnE,CAAC,EAPW,cAAc,KAAd,cAAc,QAOzB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,2CAAyB,CAAA;AAC3B,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB","sourcesContent":["export type DeviceType =\n | 'vitre'\n | 'guest'\n | 'vitreMini'\n | 'vitrePrimary'\n | 'vitreSecondary'\n | 'tableau'\n | 'vitreGuest'\n | 'companion'\n\nexport type Privacy = 'none' | 'muted' | 'blurred' | 'mutedSender'\n\nexport type Language = 'fr' | 'en' | 'it'\n\n/// A signed-in companion user. `isAdministrator` is derived host-side from\n/// `roles.includes('administrator')` and surfaced as a boolean so apps can\n/// gate features without hard-coding the magic role string; `roles` is still\n/// available for fine-grained checks.\nexport type CompanionUser = {\n id: string\n firstName: string\n lastName: string\n roles: string[]\n isAdministrator: boolean\n}\n\n/// A companion's own identity and runtime context. Surfaced as\n/// `connector.companionInformation` (CompanionConnector) and\n/// `frame.companionInformation` (companion-side Frame / CompanionFrame).\n/// Strictly distinct from the Vitre identity (`hostInformation`).\n///\n/// `name` is the companion's chosen display name — a mandatory field on the\n/// connect page (account fullname, mobile device name, or manually entered,\n/// stored locally). It is also what the Vitre shows as this companion peer's\n/// name. `user` is present only when signed in (guest sessions omit it).\n/// `language` / `origin` / `version` describe the companion runtime, not the\n/// Vitre. Undefined on Vitre-side frames (a Vitre has no companion identity).\nexport type CompanionInformation = {\n /// Stable identifier for this companion as a participant (the signed-in\n /// user id, or a fallback for guest sessions). Distinct from the Vitre's\n /// `hostInformation.device.id`. Apps that render the companion as a\n /// collaboration peer (cursors, awareness) should key on this.\n id: string\n name: string\n /// The companion participant's colour (cursor / awareness). Distinct from\n /// the Vitre's `hostInformation.device.color`.\n color: string\n user?: CompanionUser\n language: Language\n origin: string\n version?: string\n}\n\n/**\n * @deprecated Use string\n */\nexport type LegacyI18nMap = {\n fr: string\n en: string\n it: string\n}\nexport type I18nMap = string | LegacyI18nMap\n\nexport type FileData = {\n id?: string\n name: string\n mime: string\n data: ArrayBufferLike\n shareTargetId?: string\n}\n\nexport type DeviceScalingVersion = 'legacy' | 'rotationIndependent'\n\nexport type Ratio = 'ratio16_9' | 'ratio9_16'\n\nexport type CropMode = 'cropped' | 'notCropped'\n\nexport type DeviceScaling = {\n scale: number\n offsetX: number\n offsetY: number\n orientation?: Orientation\n orientationBy?: OrientationBy\n ratio?: Ratio\n cropMode?: CropMode\n version?: DeviceScalingVersion\n}\n\nexport type DeviceFullscreen = 'fullscreen' | 'localDevice' | 'notFullscreen'\n\nexport type Device = {\n id: string\n name: string\n color: string\n type: DeviceType\n privacy: Privacy\n mainDeviceId?: string\n /**\n * represent the scaling applied on the local camera stream when sending to this device\n */\n sendingScaling?: DeviceScaling\n orientation?: Orientation\n orientationBy?: OrientationBy\n fullscreen?: DeviceFullscreen\n}\n\nexport type TeamInfo = {\n id: string\n name: string\n domain: string\n}\n\nexport type HostInformation = {\n language: Language\n device: Device\n version?: string\n devicesInSpace: Device[]\n spaceTeam: TeamInfo\n owner: TeamInfo\n origin: string\n team: string\n teamId: string\n space: Space\n color: string\n privacy: Privacy\n guestInviteUrl: string\n displays: Display[]\n settings?: any\n vitreSettings: VitreSettings\n companionCode?: string\n /**\n * `true` when the frame iframe is loaded by a la Vitre **companion**\n * (i.e. the host is `lavitre-companion`, not a Vitre). Apps can use\n * this to pick the right SDK surface — `initializeCompanionFrame` /\n * `CompanionFrame` on the companion side, `initializeFrame` / `Frame`\n * on the Vitre side — and to branch UI / behaviour that genuinely\n * differs between the two contexts (e.g. show a \"Leave this frame\"\n * button on the companion that calls `closeOnCompanion()`, omit it on\n * the Vitre).\n *\n * Undefined / false on the Vitre side. Set by\n * `lavitre-companion/.../CompanionApps.State.fs:buildVitreLikeHostInformation`.\n * Backward-compat: old hosts simply omit the field, so apps that read\n * it as `?? false` keep working unchanged. Added 1.15.\n */\n isCompanion?: boolean\n}\n\nexport type SendMessageTo = {\n connectorId?: string\n deviceIds?: string[]\n message: string\n fileData?: FileData\n}\n\nexport type SendMessageToAll = {\n connectorId?: string\n message: string\n fileData?: FileData\n}\n\nexport type SendKnockKnock = {\n deviceIds?: string[]\n}\n\nexport type DeviceJoined = {\n device: Device\n}\n\nexport type DeviceLeft = {\n deviceId: string\n}\n\nexport type DeviceMessageReceived = {\n from: string\n message: string\n fileData?: FileData\n fromConnectorId?: string\n}\n\nexport type MenuCategory = {\n label: string\n description?: string\n order?: number\n}\n\nexport type NumberRange = {\n id: string\n min: number\n max: number\n value: number\n step: number\n}\n\nexport type Field = { type: 'numberRange' } & NumberRange\n\nexport type Availability = {\n vitre?: boolean\n companion?: boolean\n companionAdmin?: boolean\n}\n\n/**\n * Declares that clicking a MenuEntry on the companion opens a frame on\n * the companion side (and on the Vitre too, if `kind === 'normal'`).\n *\n * `kind === 'local'` — the frame lives only on the companion that opened\n * it; its lifecycle is independent of any frame on the Vitre.\n *\n * `kind === 'normal'` — the frame on the companion is paired with a\n * frame on the Vitre via the same `frameConnectorId`. Per-frame messages\n * and yjs CRDT updates flow between them transparently.\n */\nexport type CompanionFrameTarget = {\n kind: 'local' | 'normal'\n frameConnectorId: string\n options: Omit<OpenFrameOptions, 'frameConnectorId'>\n}\n\nexport type EntryType = 'button' | 'toggle' | 'companionOpenLink'\n\nexport type OverlayIcon = {\n iconUrl?: string\n iconUrlChecked?: string\n iconUrlUnchecked?: string\n}\n\nexport type MenuEntry = {\n label: string\n id: string\n tag?: any\n order?: number\n hasConfirm?: boolean\n isChecked?: boolean\n isDisabled?: boolean\n category?: MenuCategory\n maskIconUrl?: string\n iconUrl?: string\n maskIconUrlChecked?: string\n iconUrlChecked?: string\n overlayIcons?: OverlayIcon[]\n menu?: MenuEntry[]\n description?: string\n isCloseOnClick?: boolean\n type?: EntryType\n focus?: boolean\n field?: Field\n linkUrl?: string\n radioGroup?: string\n availability?: Availability\n /**\n * If set, the host opens a companion frame when this entry is clicked\n * on the companion. The connector does not have to react to the\n * `menuClicked` event for this case — the frame opens automatically.\n *\n * Only honored when `availability.companion === true`.\n */\n opensCompanionFrame?: CompanionFrameTarget\n}\n\nexport type Size = {\n width: number\n height: number\n}\n\nexport type Rect = {\n x: number\n y: number\n width: number\n height: number\n}\n\nexport type Display = {\n bounds: Rect\n}\n\nexport type MonitorReference =\n | { type: 'contentMonitor' }\n | { type: 'monitorIndex'; index: number }\n\nexport type LayoutPosition = {\n /**\n * @deprecated Use left\n */\n x?: string\n /**\n * @deprecated Use top\n */\n y?: string\n width?: string\n height?: string\n left?: string\n top?: string\n right?: string\n bottom?: string\n centerX?: string\n centerY?: string\n monitor?: MonitorReference\n isFullscreen?: boolean\n}\n\nexport type DeviceRule = { deviceType?: DeviceType }\n\nexport type LayoutPositionRule = { type: 'deviceRule' } & DeviceRule\n\nexport type LayoutPositionWithRules = {\n width?: string\n height?: string\n left?: string\n top?: string\n right?: string\n bottom?: string\n centerX?: string\n centerY?: string\n monitor?: MonitorReference\n isFullscreen?: boolean\n rules?: LayoutPositionRule[]\n}\n\nexport type ViewMode = 'frame' | 'overlay'\n\nexport type FramePrivacy = 'shared' | 'pinned' | 'local'\n\n/**\n * Audience filter for the companion-frame open-on-companion behaviour. See\n * `CompanionFrameOption`. `'all'` means every connected companion is\n * targeted; `'administrator'` means only companions whose authenticated\n * user has the `administrator` role.\n */\nexport type CompanionFrameAudience = 'all' | 'administrator'\n\n/**\n * Declares how an opened frame should surface on connected companions. Lives\n * on `OpenFrameOptions` so the behaviour is decided per `connector.openFrame`\n * call. Companion side honours this at `FrameOpenedByVitre` reception time\n * (see `CompanionApps.State.fs`):\n *\n * - `autoOpen`: when set and the audience matches, the companion\n * auto-navigates to the new frame full-page IF it is\n * currently on the main Vitre page. If it is busy\n * (already on a frame, camera-share, etc.) the\n * auto-open is suppressed and a menu entry is added\n * to the CURRENT page's options instead. Auto-open\n * never preempts a busy companion.\n *\n * - `menuVisibility`: when set, a menu entry is added on the companion\n * side (in the current frame's options menu) for the\n * target audience, regardless of `autoOpen`. The\n * entry, when clicked, navigates to the frame.\n *\n * - `url`: REQUIRED. The URL the companion loads in its own\n * paired iframe. This is intentionally separate from\n * the Vitre frame's `OpenFrameOptions.url` so the\n * companion can present a different UI (and load its\n * own companion-frame entry point, e.g.\n * `companionFrame.html` initialised with\n * `initializeCompanionFrame`). The companion frame is\n * paired with the Vitre frame by the same\n * `frameConnectorId`, so per-frame messages and yjs\n * CRDT updates still flow between them.\n *\n * - `showBackButton`: controls the host's own \"back\" affordance on the\n * companion's full-page frame. The companion renders\n * the frame chrome-free (no la Vitre header) except a\n * single back button — the same control as the\n * camera-share page — that dismisses the frame. Set\n * `false` to hide it (e.g. when the app draws its own\n * close UI); the user can still leave via the device /\n * browser back gesture. Defaults to `true` (shown).\n *\n * `url` is mandatory; `autoOpen` / `menuVisibility` / `showBackButton` are\n * independent and may be set together. If `autoOpen` and `menuVisibility`\n * are both absent the companion mounts nothing — no navigation, no menu —\n * and only the Vitre-side frame is shown.\n */\n/**\n * Subset of `MenuEntry` used to customise the companion menu entry that\n * (re)opens this companion frame — the entry surfaced when an `autoOpen` is\n * suppressed because the companion was busy, or added via `menuVisibility`.\n * Only the fields relevant to a host-driven open are exposed; the entry's\n * `id` and click behaviour are owned by the host. Any field left unset falls\n * back to the frame's `name` (label), no icon, and default ordering.\n */\nexport type CompanionFrameOpenMenuEntry = Pick<\n MenuEntry,\n 'label' | 'maskIconUrl' | 'iconUrl' | 'category' | 'description' | 'order'\n>\n\nexport type CompanionFrameOption = {\n url: string\n autoOpen?: CompanionFrameAudience\n menuVisibility?: CompanionFrameAudience\n /**\n * @deprecated Renamed to `showCloseButton`. Still honoured for backward\n * compatibility, but `showCloseButton` takes precedence when both are set.\n */\n showBackButton?: boolean\n /**\n * Whether the full-page companion frame shows the host's close button (the\n * control that dismisses the frame). Defaults to `true` when unset. Renamed\n * from the deprecated `showBackButton`.\n */\n showCloseButton?: boolean\n /**\n * Customises the companion menu entry that (re)opens this frame — the\n * busy-`autoOpen` fallback entry or the `menuVisibility` entry. Omit to\n * label the entry with the frame's `name` (no icon / category).\n */\n openMenuEntry?: CompanionFrameOpenMenuEntry\n}\n\nexport type PositionType = 'Local' | 'Synced'\n\nexport type Interaction = 'notAllowed' | 'autoActiveOnFullscreen' | 'allowed'\n\nexport type BorderMode = 'borderLess' | 'border'\n\nexport type BorderOptions = {\n mode: BorderMode\n showToggleInMenu?: boolean\n}\n\nexport type StreamCapture = {\n data: ArrayBufferLike\n}\n\nexport type VoiceAction = {\n id: string\n message: I18nMap\n}\n\nexport type VoiceActionDetection = {\n id: string\n message: string\n language: string\n confidence: number\n}\n\nexport type OpenFrameOptions = {\n frameConnectorId: string\n streamId?: string\n name: string\n url: string\n size?: Size\n minSize?: Size\n maxSize?: Size\n startPosition?: LayoutPosition\n startPositions?: LayoutPositionWithRules[]\n /**\n * @deprecated Use startPosition.isFullscreen\n */\n startMode?: FrameStartMode\n /**\n * @deprecated Use interaction property\n */\n touchMode?: FrameTouchMode\n interaction?: Interaction\n allowFullscreen?: boolean\n menuVisibility?: MenuVisibility\n /**\n * @deprecated Use menuVisibility property vitre v20\n */\n hideMenu?: boolean\n startInteractive?: boolean\n resizeMode?: ResizeMode\n border?: BorderOptions\n data?: any\n file?: FileData\n mode?: ViewMode\n privacy?: FramePrivacy\n positionType?: PositionType\n voiceActions?: VoiceAction[]\n state?: Record<string, any>\n visibility?: Visibility\n closable?: boolean\n closeLabel?: string\n /**\n * Optional declaration of how this frame should surface on connected\n * companions. See `CompanionFrameOption`. When omitted the companion\n * side ignores the open (no auto-navigation, no menu) — the same\n * behaviour pre-1.13.\n */\n companionFrame?: CompanionFrameOption\n /**\n * Optional id of the device (see `HostInformation.devicesInSpace[].id`)\n * that should *own* the shared frame. The owner drives the languette\n * colour and, when it is a Vitre, takes over hosting the frame so it\n * survives the opener disconnecting (ownership transfer). When omitted\n * the opener owns the frame, as before. Change it afterwards with\n * `connector.setFrameOwner(frameConnectorId, owner)`.\n */\n owner?: string\n /**\n * SDK 1.32 — when `true`, the `file` is delivered ONLY to the opening\n * Vitre. The frame still opens and syncs on other peers, but the file\n * bytes are not propagated and the remote frames open without it. The\n * `data` field keeps syncing normally. The host strips the file before\n * cross-vitre sync — this is purely sender-side, so no peer-version gate\n * is needed (older receivers simply get a frame with no file, a state\n * they already handle). Has no effect when no `file` is provided.\n */\n localFile?: boolean\n /**\n * Icon shown for this frame's shared content on connected companions. A\n * bitmap (full colour). May be a path relative to the connector URL — the\n * host resolves it to an absolute URL. When both `iconUrl` and `maskIconUrl`\n * are set the companion prefers `maskIconUrl`. When neither is set the\n * companion falls back to the app icon (`ConnectorOptions.iconUrl`).\n */\n iconUrl?: string\n /**\n * Monochrome mask icon for this frame's shared content, tinted by the\n * companion theme (CSS `mask`). May be relative to the connector URL —\n * resolved absolute by the host. Preferred over `iconUrl` when both are set.\n */\n maskIconUrl?: string\n /**\n * CSS background applied to this frame's shared-content surface on the\n * Vitre (and on peer Vitres / tableaux showing it). Any CSS `background`\n * value — a colour, gradient, or `url(...)`. When set it overrides the\n * default surface background (`.lavitre-shared-object-content`, normally\n * black). Not resolved against the connector URL: pass an absolute URL if\n * you reference an image. When omitted the default background is kept.\n */\n background?: string\n /**\n * CSS `box-shadow` applied to this frame's shared-content surface on the\n * Vitre (and on peer Vitres / tableaux showing it). When set it overrides\n * the default surface shadow (`.lavitre-shared-object-content`). Pass\n * `'none'` to remove the shadow. When omitted the default shadow is kept.\n */\n boxShadow?: string\n /**\n * CSS `drop-shadow` filter applied to this frame's shared-content surface on\n * the Vitre (and on peer Vitres / tableaux showing it). The value is the\n * argument of the CSS `drop-shadow()` filter function — e.g.\n * `'0 4px 8px rgba(0,0,0,.5)'` — which the host wraps as\n * `filter: drop-shadow(<value>)`. Unlike `boxShadow` it follows the rendered\n * alpha shape, so it casts a shadow around non-rectangular / transparent\n * content (pair it with a transparent `background`). Pass `'none'` to remove\n * any filter. When omitted no drop-shadow filter is applied.\n */\n dropShadow?: string\n /**\n * CSS `backdrop-filter: blur(...)` applied to this frame's shared-content\n * surface on the Vitre (and on peer Vitres / tableaux showing it). The value\n * is the argument of the CSS `blur()` function — e.g. `'8px'` — which the\n * host wraps as `backdrop-filter: blur(<value>)`. It blurs whatever is\n * *behind* the surface (frosted-glass effect), so pair it with a translucent\n * `background`. Pass `'none'` to remove the backdrop filter. When omitted no\n * backdrop blur is applied.\n */\n backdropBlur?: string\n /**\n * Name to report for this frame in usage analytics (\"insights\"), instead of\n * the app's own name. A single app can open several kinds of frames — e.g.\n * Carbone opens \"Page blanche\", \"PDF\", \"Image\" — and by default every frame\n * is recorded under the app name (\"Carbone\"). Set `insightsName` per open to\n * distinguish them in the stats. When omitted the analytics fall back to the\n * current behaviour (the app name, then the frame `name`). Purely a reporting\n * label — it does not affect the frame UI (`name` still drives the visible\n * label) and never reaches other peers.\n */\n insightsName?: string\n}\n\n/**\n * Visual style of a frame's shared-content surface and its companion icon,\n * settable at open time (subset of `OpenFrameOptions`) and updatable at any\n * time with `connector.setChromeStyle(frameConnectorId, style)`. Every field\n * is optional: a field left `undefined` keeps the current value; pass an empty\n * string to clear an override back to the host default (e.g. `background: ''`).\n */\nexport type ChromeStyle = {\n /** See `OpenFrameOptions.background`. */\n background?: string\n /** See `OpenFrameOptions.boxShadow`. */\n boxShadow?: string\n /** See `OpenFrameOptions.dropShadow`. */\n dropShadow?: string\n /** See `OpenFrameOptions.backdropBlur`. */\n backdropBlur?: string\n /** See `OpenFrameOptions.iconUrl` (companion icon, bitmap). */\n iconUrl?: string\n /** See `OpenFrameOptions.maskIconUrl` (companion icon, monochrome mask). */\n maskIconUrl?: string\n}\n\n/**\n * @deprecated Use interaction property\n */\nexport enum FrameTouchMode {\n // Host will only allow manipulations. Touch events will not be forwarded to the webview\n ReadOnly = 'readonly',\n FullscreenOnly = 'fullscreenOnly',\n // Host will show a toggle button for interacting with the webview\n HostButtonInOut = 'hostButtonInOut',\n HostButtonMinimizeOnFullscreen = 'hostButtonMinimizeOnFullscreen',\n}\n\n/**\n * @deprecated Use startPosition.isFullscreen\n */\nexport enum FrameStartMode {\n Window = 'window',\n Fullscreen = 'fullscreen',\n}\n\nexport type ResizeMode =\n /**\n * @deprecated The method should not be used\n */\n | 'scale'\n /**\n * @deprecated The method should not be used\n */\n | 'resize'\n /**\n * @deprecated The method should not be used\n */\n | 'resizeAndKeepRatio'\n | 'no'\n | 'uniformRenderTransform'\n | 'freeRenderTransform'\n | 'uniformResize'\n | 'freeResize'\n\nexport type VideoContentHint = 'motion' | 'detail'\n\nexport type MenuClicked = {\n menuId: string\n isChecked: boolean\n tag: any | undefined\n}\n\nexport type LoadedFrame = {\n src: string\n name: string\n frameConnectorId: string\n}\n\nexport type LocalConnectorMessageReceived = {\n data: any\n fileData?: FileData\n from?: string\n}\n\nexport type SendToLocalFrame = {\n frameConnectorId?: string\n data: any\n fileData?: FileData\n}\n\nexport type EnumerateLoadedFramesCompleted = {\n requestId: string\n frames: LoadedFrame[]\n}\n\nexport type EnumerateLoadedFrames = {\n requestId: string\n}\n\nexport type PrivacyChanged = {\n privacy: Privacy\n}\n\nexport type MessageTargetCompanion = {\n type: 'companion'\n companionConnectionId: string\n}\n\nexport type MessageTarget = MessageTargetCompanion\n\n/**\n * A peer (Vitre or companion) that currently has a given frame open on\n * its side. Identified by the host's connection id so apps can address\n * it individually with the per-peer messaging APIs.\n */\nexport type FramePeer = {\n peerId: string\n deviceType: DeviceType\n name?: string\n}\n\n/**\n * Companion frame peer-presence wire events.\n *\n * `CompanionFramePeersUpdated` is the authoritative full snapshot — it\n * carries the complete current peer set and fires on every change.\n * `CompanionFramePeerJoined` / `CompanionFramePeerLeft` are convenience\n * incremental events derived from the same stream. Consumers should\n * subscribe to ONE model (snapshot OR incremental pair), not both, to\n * avoid double-counting every transition.\n */\nexport type CompanionFramePeerJoined = {\n peer: FramePeer\n}\n\nexport type CompanionFramePeerLeft = {\n peerId: string\n}\n\nexport type CompanionFramePeersUpdated = {\n peers: FramePeer[]\n}\n\nexport type AppMessage = {\n data: any\n fileData?: FileData\n target?: MessageTarget\n}\n\nexport type CameraExposureValue = {\n type: 'manual'\n exposure: number\n compensation: number\n}\n\nexport type CameraExposureAuto = {\n type: 'auto'\n}\n\nexport type CameraSettings = {\n exposure: CameraExposureAuto | CameraExposureValue\n deviceId?: string\n deviceName?: string\n}\n\nexport type StreamUsage = 'mainStream' | 'sharedStream'\n\nexport type Orientation = 'left' | 'right' | 'top' | 'bottom'\nexport type OrientationBy = 'system' | 'emulated'\n\nexport type ConnectedMediaDevice = {\n deviceId: string\n groupId: string\n kind: MediaDeviceKind\n label: string\n inUseBy: StreamUsage[]\n orientation?: Orientation\n orientationBySystem?: boolean\n}\n\nexport type AuthenticationMode = 'open' | 'userAccount'\n\nexport type SecuritySettings = {\n authentication: AuthenticationMode\n}\n\nexport type GuestSpace = {\n type: 'guestSpace'\n space: string\n teamDomain: string\n label: string\n}\n\nexport type TeamSpace = {\n type: 'teamSpace'\n space: string\n}\n\nexport type Space = GuestSpace | TeamSpace\n\n/**\n * Snapshot of the current active preset's noise filter selection.\n *\n * `active` and entries in `available` are the string ids of the F#\n * `Settings.Audio.AudioFilterLevel` enum. The current set is:\n *\n * \"none\" | \"rnnoise\" | \"rnnoise2\" | \"speex\" | \"noisegate\" | \"deepfilternet3\"\n *\n * Apps should treat the list as open — newer la Vitre builds may surface\n * additional filter ids the app doesn't know about. Render unknown ids\n * gracefully (e.g. as a generic option) rather than asserting on the set.\n */\nexport type AudioFilterView = {\n active: string\n available: string[]\n}\n\n/**\n * User-editable subset of the voice-profile chain (the \"custom\" profile).\n * Only meaningful when the active profile is \"custom\"; for the four frozen\n * profiles an app shows their fixed values read-only from its own table.\n */\nexport type CustomVoiceProfileView = {\n /** EQ presence (clarity) gain, dB. */\n presenceDb: number\n /** Compressor threshold, dB. */\n compThresholdDb: number\n /** Compressor ratio, >= 1. */\n compRatio: number\n /** De-esser sibilance cut, dB (negative). */\n deEsserCutDb: number\n}\n\nexport type CustomVoiceProfileSettingsSetter = {\n presenceDb?: number\n compThresholdDb?: number\n compRatio?: number\n deEsserCutDb?: number\n}\n\n/**\n * Voice profile (EQ + compressor + de-esser preset) applied for every\n * filter — including `none`. Ids:\n *\n * \"naturel\" | \"broadcast\" | \"douce\" | \"antifatigue\" | \"custom\"\n */\nexport type VoiceProfileView = {\n active: string\n available: string[]\n /** Persisted custom params (always present; edited only when\n * `active === 'custom'`). */\n custom: CustomVoiceProfileView\n}\n\n/**\n * DeepFilterNet 3 live-tunable knobs.\n *\n * `inputGainDb` and `wetDryMix` exist server-side but are intentionally\n * NOT exposed to apps — the SDK contract only covers the noise-reduction\n * tuning knobs that make sense in a \"voice quality\" UI.\n */\nexport type Dfn3View = {\n /** Suppression cap, 0..100 dB. Higher = more aggressive denoising. */\n attenLimDb: number\n /** Post-filter strength, 0..0.1. 0 disables it. */\n postFilterBeta: number\n}\n\nexport type Dfn3SettingsSetter = {\n attenLimDb?: number\n postFilterBeta?: number\n}\n\nexport type AudioSettings = {\n volume: number\n isMuted: boolean\n selectedPreset: string\n audioPresets: string[]\n /**\n * The following three are optional on the wire — older la Vitre builds\n * don't emit them. When undefined, treat as \"feature not available on\n * this Vitre\" rather than as a default value.\n */\n filter?: AudioFilterView\n voiceProfile?: VoiceProfileView\n dfn3?: Dfn3View\n}\n\nexport type AudioSettingsSetter = {\n volume?: number\n isMuted?: boolean\n selectedPreset?: string\n /**\n * Use one of `AudioFilterView.available` ids — unknown values are\n * silently dropped host-side rather than crashing the audio pipeline.\n */\n filter?: string\n voiceProfile?: string\n /**\n * Partial setter — only the fields present in the object are written.\n * Existing DFN3 properties not listed here (including `inputGainDb`\n * and `wetDryMix` which apps cannot manipulate) are preserved.\n */\n dfn3?: Dfn3SettingsSetter\n /**\n * Partial setter for the \"custom\" voice profile knobs. Only applied\n * when the active voice profile is \"custom\"; persisted regardless.\n */\n customVoiceProfile?: CustomVoiceProfileSettingsSetter\n}\n\nexport type VitreSettings = {\n availableMediaDevices: ConnectedMediaDevice[]\n audioSettings: AudioSettings\n cameraSettings: CameraSettings\n security: SecuritySettings\n spaces: Space[]\n currentSpace: Space\n language: Language\n color: string\n name?: string\n}\n\nexport type VitreSettingsSetter = {\n cameraSettings?: CameraSettings\n audioSettings?: AudioSettingsSetter\n}\n\nexport type DeviceTarget = 'all' | 'single'\n\nexport type KnockKnock = {\n from: Device\n target: DeviceTarget\n}\n\nexport type AppId = string\n\nexport type ShareFileRequest = {\n fileData: FileData\n targetAppId?: AppId\n /** SDK 1.20 — explicit owner device id for the resulting share. */\n owner?: string\n}\n\nexport type ShareDataRequest = {\n url: string\n targetAppId?: AppId\n /** SDK 1.20 — explicit owner device id for the resulting share. */\n owner?: string\n}\n\nexport type SaveSettings = {\n settings: any\n}\n\nexport type SettingsUpdated = {\n settings: any\n}\n\nexport type ChangeTeamSpace = {\n space: string\n}\n\nexport type ChangeTeamSpaceGuest = {\n space: string\n teamDomain: string\n}\n\nexport type NotificationButton = {\n id: string\n tag?: any\n iconUrl: string\n dismissOnClick?: boolean\n}\n\nexport type NotificationInfo = {\n id: string\n message: string\n iconUrl: string\n buttons?: NotificationButton[]\n closeTimeout?: number\n}\n\nexport type HideNotification = {\n id: string\n}\n\nexport type NotificationDismissed = {\n id: string\n}\n\nexport type NotificationButtonClicked = {\n id: string\n buttonId: string\n tag?: any\n}\n\nexport type DevicePrivacyChanged = { device: Device }\n\nexport type SDKInitRequest = {\n type: 'SDKInitRequest'\n version: string\n}\n\nexport type ChangePrivacy = {\n privacy: Privacy\n}\n\nexport type DeviceFrameReference = {\n frameConnectorId: string\n deviceId: string\n}\n\nexport type PendingDevicesInfo = {\n pendingDevices: Device[]\n}\n\nexport type EventTelemetry = {\n name: string\n properties?: Record<string, any>\n}\n\nexport type StartEventTelemetry = { name: string }\n\nexport type DeviceFullscreenUpdated = {\n deviceId: string\n fullscreen: DeviceFullscreen\n}\n\nexport type PositionUpdated = {\n position: Rect\n isFullscreen: boolean\n zIndex: number\n}\n\nexport type Visibility = 'hidden' | 'visible' | 'visibleInFullscreenOnly'\nexport type MenuVisibility = 'hidden' | 'visible' | 'visibleInFullscreenOnly'\n\nexport type VisibilityChanged = {\n visibility: Visibility\n}\n\nexport type SetVisibility = { visibility: Visibility }\n\nexport type DeviceScalingUpdated = {\n deviceId: string\n sendingScaling: DeviceScaling\n orientation: Orientation\n orientationBy: OrientationBy\n}\n\nexport type UpdateStateEntry =\n | {\n action: 'add'\n key: string\n value: any\n }\n | {\n action: 'addOwned'\n key: string\n value: any\n }\n | {\n action: 'remove'\n key: string\n }\n\nexport type UpdatedStateEntry =\n | {\n action: 'add'\n key: string\n value: any\n }\n | {\n action: 'remove'\n key: string\n }\n | {\n action: 'addOwned'\n key: string\n value: any\n owner: string\n }\n\nexport type UpdateState = {\n updates: UpdateStateEntry[]\n}\n\nexport type ReplacedBy = 'local' | 'remote'\n\nexport type StateReplaced = {\n state: Record<string, any>\n delta: UpdatedStateEntry[]\n replacedBy: ReplacedBy\n}\n\nexport type GetStats = { requestId: string }\n\nexport type SetReducedAudioMode = { enabled: boolean }\n\nexport type DeviceTransceiverWebRTCStats = {\n deviceId: string\n transceiverId: string\n receiverStats?: any[]\n receiverStatsError?: string\n senderStats?: any[]\n senderStatsError?: string\n videoSendingParameters?: VideoSendingParameters\n /** Since 1.44: label of the outgoing track (originalTrack when the host wraps it). Absent on older hosts; explicit null on newer hosts when the transceiver has no sender track. */\n trackLabel?: string\n /** Since 1.44: sender track getSettings(), unwrapped via originalTrack when present. Absent on older hosts; null on newer hosts without a sender track. */\n trackSettings?: MediaTrackSettings\n /** Since 1.44: sender track getConstraints(). Absent on older hosts; null on newer hosts without a sender track. */\n trackConstraints?: MediaTrackConstraints\n /** Since 1.44: sender track muted flag. Absent on older hosts; null on newer hosts without a sender track. */\n trackMuted?: boolean\n /** Since 1.44: sender track enabled flag. Absent on older hosts; null on newer hosts without a sender track. */\n trackEnabled?: boolean\n /** Since 1.44: host sending parameters isEnabled (false under confidentiality). Absent on older hosts; null on newer hosts without a sender track. */\n sendingEnabled?: boolean\n}\n\nexport type MemoryInfo = {\n slotsInUse: number\n slots: number\n mbAvailable?: number\n}\n\nexport type VideoSendingParameters = {\n size?: Size\n bitrate?: number\n}\n\nexport type StatsResponse = {\n requestId: string\n webrtcStats: DeviceTransceiverWebRTCStats[]\n memory?: MemoryInfo\n cpuUsage?: number\n audioFilter?: string\n}\n\nexport type ConnectionCodeUpdated = {\n companionCode?: string\n}\n\nexport type FieldUpdated = {\n field: Field\n}\n\nexport type SendToSerialPort = {\n com: number\n baudRate: number\n readTimeout: number\n ackLineStartsWith?: string\n nackLineStartsWith?: string\n lines: string[]\n}\n\n/// Ask the host for access to a serial port. Resolves with the granted port\n/// name (empty string if denied/cancelled).\n/// - `port` given: the host pre-grants that port (so the next\n/// `navigator.serial.requestPort()` resolves to it silently) and resolves\n/// with `port`.\n/// - `port` omitted: the host shows its port-picker; resolves with the port\n/// the user chose (and pre-grants it).\n/// Honoured only when the app holds the WebSerial authorization.\nexport type RequestSerialPortAccess = {\n port?: string\n}\n\n/// Reply to RequestSerialPortAccess. On success `port` is the granted port\n/// name. On failure `port` is omitted and `reason` is one of the failure codes\n/// (the SDK rejects the promise with that reason).\nexport type SerialPortAccessReason = 'denied' | 'cancelled' | 'timeout'\nexport type SerialPortAccessResult = {\n port?: string\n reason?: SerialPortAccessReason\n}\n\nexport type StreamSizeUpdate = {\n deviceId: string\n size: Size\n}\n\nexport type RequestStreamSizeUpdate = {\n updates: StreamSizeUpdate[]\n}\n\nexport type DisconnectGuests = {\n deviceIds: string[]\n}\n\nexport type Characteristic = {\n uuid: string\n description: string\n properties: string\n}\n\nexport type OpenBTService = {\n serviceId: string\n requestId: string\n}\n\nexport type CloseBTService = {\n handleId: string\n}\n\nexport type WriteToCharacteristic = {\n handleId: string\n uuid: string\n buffer: ArrayBufferLike\n}\n\nexport type BluetoothFromApp =\n | ({ '@BluetoothFromApp': 'openBTService' } & OpenBTService)\n | ({ '@BluetoothFromApp': 'closeBTService' } & CloseBTService)\n | ({ '@BluetoothFromApp': 'writeToCharacteristic' } & WriteToCharacteristic)\n\nexport type OpenBTServiceResponseData = {\n requestId: string\n handleId: string\n characteristics: Characteristic[]\n}\n\nexport type OpenBTServiceResponse = {\n requestId: string\n isSuccess: boolean\n response?: OpenBTServiceResponseData\n error?: string\n}\n\nexport type BluetoothToApp = {\n '@BluetoothToApp': 'openBTServiceResponse'\n} & OpenBTServiceResponse\n"]}
|
|
1
|
+
{"version":3,"file":"Common.Model.js","sourceRoot":"","sources":["../../Common/Common.Model.ts"],"names":[],"mappings":"AA2lBA;;GAEG;AACH,MAAM,CAAN,IAAY,cAOX;AAPD,WAAY,cAAc;IACxB,wFAAwF;IACxF,uCAAqB,CAAA;IACrB,mDAAiC,CAAA;IACjC,kEAAkE;IAClE,qDAAmC,CAAA;IACnC,mFAAiE,CAAA;AACnE,CAAC,EAPW,cAAc,KAAd,cAAc,QAOzB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,2CAAyB,CAAA;AAC3B,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB","sourcesContent":["export type DeviceType =\n | 'vitre'\n | 'guest'\n | 'vitreMini'\n | 'vitrePrimary'\n | 'vitreSecondary'\n | 'tableau'\n | 'vitreGuest'\n | 'companion'\n\nexport type Privacy = 'none' | 'muted' | 'blurred' | 'mutedSender'\n\nexport type Language = 'fr' | 'en' | 'it'\n\n/// A signed-in companion user. `isAdministrator` is derived host-side from\n/// `roles.includes('administrator')` and surfaced as a boolean so apps can\n/// gate features without hard-coding the magic role string; `roles` is still\n/// available for fine-grained checks.\nexport type CompanionUser = {\n id: string\n firstName: string\n lastName: string\n roles: string[]\n isAdministrator: boolean\n}\n\n/// A companion's own identity and runtime context. Surfaced as\n/// `connector.companionInformation` (CompanionConnector) and\n/// `frame.companionInformation` (companion-side Frame / CompanionFrame).\n/// Strictly distinct from the Vitre identity (`hostInformation`).\n///\n/// `name` is the companion's chosen display name — a mandatory field on the\n/// connect page (account fullname, mobile device name, or manually entered,\n/// stored locally). It is also what the Vitre shows as this companion peer's\n/// name. `user` is present only when signed in (guest sessions omit it).\n/// `language` / `origin` / `version` describe the companion runtime, not the\n/// Vitre. Undefined on Vitre-side frames (a Vitre has no companion identity).\nexport type CompanionInformation = {\n /// Stable identifier for this companion as a participant (the signed-in\n /// user id, or a fallback for guest sessions). Distinct from the Vitre's\n /// `hostInformation.device.id`. Apps that render the companion as a\n /// collaboration peer (cursors, awareness) should key on this.\n id: string\n name: string\n /// The companion participant's colour (cursor / awareness). Distinct from\n /// the Vitre's `hostInformation.device.color`.\n color: string\n user?: CompanionUser\n language: Language\n origin: string\n version?: string\n}\n\n/**\n * @deprecated Use string\n */\nexport type LegacyI18nMap = {\n fr: string\n en: string\n it: string\n}\nexport type I18nMap = string | LegacyI18nMap\n\nexport type FileData = {\n id?: string\n name: string\n mime: string\n data: ArrayBufferLike\n shareTargetId?: string\n}\n\nexport type DeviceScalingVersion = 'legacy' | 'rotationIndependent'\n\nexport type Ratio = 'ratio16_9' | 'ratio9_16'\n\nexport type CropMode = 'cropped' | 'notCropped'\n\nexport type DeviceScaling = {\n scale: number\n offsetX: number\n offsetY: number\n orientation?: Orientation\n orientationBy?: OrientationBy\n ratio?: Ratio\n cropMode?: CropMode\n version?: DeviceScalingVersion\n}\n\nexport type DeviceFullscreen = 'fullscreen' | 'localDevice' | 'notFullscreen'\n\nexport type Device = {\n id: string\n name: string\n color: string\n type: DeviceType\n privacy: Privacy\n mainDeviceId?: string\n /**\n * represent the scaling applied on the local camera stream when sending to this device\n */\n sendingScaling?: DeviceScaling\n orientation?: Orientation\n orientationBy?: OrientationBy\n fullscreen?: DeviceFullscreen\n}\n\nexport type TeamInfo = {\n id: string\n name: string\n domain: string\n}\n\nexport type HostInformation = {\n language: Language\n device: Device\n version?: string\n devicesInSpace: Device[]\n spaceTeam: TeamInfo\n owner: TeamInfo\n origin: string\n team: string\n teamId: string\n space: Space\n color: string\n privacy: Privacy\n guestInviteUrl: string\n displays: Display[]\n settings?: any\n vitreSettings: VitreSettings\n companionCode?: string\n /**\n * `true` when the frame iframe is loaded by a la Vitre **companion**\n * (i.e. the host is `lavitre-companion`, not a Vitre). Apps can use\n * this to pick the right SDK surface — `initializeCompanionFrame` /\n * `CompanionFrame` on the companion side, `initializeFrame` / `Frame`\n * on the Vitre side — and to branch UI / behaviour that genuinely\n * differs between the two contexts (e.g. show a \"Leave this frame\"\n * button on the companion that calls `closeOnCompanion()`, omit it on\n * the Vitre).\n *\n * Undefined / false on the Vitre side. Set by\n * `lavitre-companion/.../CompanionApps.State.fs:buildVitreLikeHostInformation`.\n * Backward-compat: old hosts simply omit the field, so apps that read\n * it as `?? false` keep working unchanged. Added 1.15.\n */\n isCompanion?: boolean\n}\n\nexport type SendMessageTo = {\n connectorId?: string\n deviceIds?: string[]\n message: string\n fileData?: FileData\n}\n\nexport type SendMessageToAll = {\n connectorId?: string\n message: string\n fileData?: FileData\n}\n\nexport type SendKnockKnock = {\n deviceIds?: string[]\n}\n\nexport type DeviceJoined = {\n device: Device\n}\n\nexport type DeviceLeft = {\n deviceId: string\n}\n\nexport type DeviceMessageReceived = {\n from: string\n message: string\n fileData?: FileData\n fromConnectorId?: string\n}\n\nexport type MenuCategory = {\n label: string\n description?: string\n order?: number\n}\n\nexport type NumberRange = {\n id: string\n min: number\n max: number\n value: number\n step: number\n}\n\nexport type Field = { type: 'numberRange' } & NumberRange\n\nexport type Availability = {\n vitre?: boolean\n companion?: boolean\n companionAdmin?: boolean\n}\n\n/**\n * Declares that clicking a MenuEntry on the companion opens a frame on\n * the companion side (and on the Vitre too, if `kind === 'normal'`).\n *\n * `kind === 'local'` — the frame lives only on the companion that opened\n * it; its lifecycle is independent of any frame on the Vitre.\n *\n * `kind === 'normal'` — the frame on the companion is paired with a\n * frame on the Vitre via the same `frameConnectorId`. Per-frame messages\n * and yjs CRDT updates flow between them transparently.\n */\nexport type CompanionFrameTarget = {\n kind: 'local' | 'normal'\n frameConnectorId: string\n options: Omit<OpenFrameOptions, 'frameConnectorId'>\n}\n\nexport type EntryType = 'button' | 'toggle' | 'companionOpenLink'\n\nexport type OverlayIcon = {\n iconUrl?: string\n iconUrlChecked?: string\n iconUrlUnchecked?: string\n}\n\nexport type MenuEntry = {\n label: string\n id: string\n tag?: any\n order?: number\n hasConfirm?: boolean\n isChecked?: boolean\n isDisabled?: boolean\n category?: MenuCategory\n maskIconUrl?: string\n iconUrl?: string\n maskIconUrlChecked?: string\n iconUrlChecked?: string\n overlayIcons?: OverlayIcon[]\n menu?: MenuEntry[]\n description?: string\n isCloseOnClick?: boolean\n type?: EntryType\n focus?: boolean\n field?: Field\n linkUrl?: string\n radioGroup?: string\n availability?: Availability\n /**\n * If set, the host opens a companion frame when this entry is clicked\n * on the companion. The connector does not have to react to the\n * `menuClicked` event for this case — the frame opens automatically.\n *\n * Only honored when `availability.companion === true`.\n */\n opensCompanionFrame?: CompanionFrameTarget\n}\n\nexport type Size = {\n width: number\n height: number\n}\n\nexport type Rect = {\n x: number\n y: number\n width: number\n height: number\n}\n\nexport type Display = {\n bounds: Rect\n}\n\nexport type MonitorReference =\n | { type: 'contentMonitor' }\n | { type: 'monitorIndex'; index: number }\n\nexport type LayoutPosition = {\n /**\n * @deprecated Use left\n */\n x?: string\n /**\n * @deprecated Use top\n */\n y?: string\n width?: string\n height?: string\n left?: string\n top?: string\n right?: string\n bottom?: string\n centerX?: string\n centerY?: string\n monitor?: MonitorReference\n isFullscreen?: boolean\n}\n\nexport type DeviceRule = { deviceType?: DeviceType }\n\nexport type LayoutPositionRule = { type: 'deviceRule' } & DeviceRule\n\nexport type LayoutPositionWithRules = {\n width?: string\n height?: string\n left?: string\n top?: string\n right?: string\n bottom?: string\n centerX?: string\n centerY?: string\n monitor?: MonitorReference\n isFullscreen?: boolean\n rules?: LayoutPositionRule[]\n}\n\nexport type ViewMode = 'frame' | 'overlay'\n\nexport type FramePrivacy = 'shared' | 'pinned' | 'local'\n\n/**\n * Audience filter for the companion-frame open-on-companion behaviour. See\n * `CompanionFrameOption`. `'all'` means every connected companion is\n * targeted; `'administrator'` means only companions whose authenticated\n * user has the `administrator` role.\n */\nexport type CompanionFrameAudience = 'all' | 'administrator'\n\n/**\n * Declares how an opened frame should surface on connected companions. Lives\n * on `OpenFrameOptions` so the behaviour is decided per `connector.openFrame`\n * call. Companion side honours this at `FrameOpenedByVitre` reception time\n * (see `CompanionApps.State.fs`):\n *\n * - `autoOpen`: when set and the audience matches, the companion\n * auto-navigates to the new frame full-page IF it is\n * currently on the main Vitre page. If it is busy\n * (already on a frame, camera-share, etc.) the\n * auto-open is suppressed and a menu entry is added\n * to the CURRENT page's options instead. Auto-open\n * never preempts a busy companion.\n *\n * - `menuVisibility`: when set, a menu entry is added on the companion\n * side (in the current frame's options menu) for the\n * target audience, regardless of `autoOpen`. The\n * entry, when clicked, navigates to the frame.\n *\n * - `url`: REQUIRED. The URL the companion loads in its own\n * paired iframe. This is intentionally separate from\n * the Vitre frame's `OpenFrameOptions.url` so the\n * companion can present a different UI (and load its\n * own companion-frame entry point, e.g.\n * `companionFrame.html` initialised with\n * `initializeCompanionFrame`). The companion frame is\n * paired with the Vitre frame by the same\n * `frameConnectorId`, so per-frame messages and yjs\n * CRDT updates still flow between them.\n *\n * - `showBackButton`: controls the host's own \"back\" affordance on the\n * companion's full-page frame. The companion renders\n * the frame chrome-free (no la Vitre header) except a\n * single back button — the same control as the\n * camera-share page — that dismisses the frame. Set\n * `false` to hide it (e.g. when the app draws its own\n * close UI); the user can still leave via the device /\n * browser back gesture. Defaults to `true` (shown).\n *\n * - `edgeToEdge`: lets the frame cover the companion's whole surface,\n * system bars included; the app then keeps its controls\n * clear of them with `frame.safeAreaInsets`. See the\n * field doc.\n *\n * `url` is mandatory; `autoOpen` / `menuVisibility` / `showBackButton` /\n * `edgeToEdge` are independent and may be set together. If `autoOpen` and `menuVisibility`\n * are both absent the companion mounts nothing — no navigation, no menu —\n * and only the Vitre-side frame is shown.\n */\n/**\n * Subset of `MenuEntry` used to customise the companion menu entry that\n * (re)opens this companion frame — the entry surfaced when an `autoOpen` is\n * suppressed because the companion was busy, or added via `menuVisibility`.\n * Only the fields relevant to a host-driven open are exposed; the entry's\n * `id` and click behaviour are owned by the host. Any field left unset falls\n * back to the frame's `name` (label), no icon, and default ordering.\n */\nexport type CompanionFrameOpenMenuEntry = Pick<\n MenuEntry,\n 'label' | 'maskIconUrl' | 'iconUrl' | 'category' | 'description' | 'order'\n>\n\nexport type CompanionFrameOption = {\n url: string\n autoOpen?: CompanionFrameAudience\n menuVisibility?: CompanionFrameAudience\n /**\n * @deprecated Renamed to `showCloseButton`. Still honoured for backward\n * compatibility, but `showCloseButton` takes precedence when both are set.\n */\n showBackButton?: boolean\n /**\n * Whether the full-page companion frame shows the host's close button (the\n * control that dismisses the frame). Defaults to `true` when unset. Renamed\n * from the deprecated `showBackButton`.\n */\n showCloseButton?: boolean\n /**\n * Customises the companion menu entry that (re)opens this frame — the\n * busy-`autoOpen` fallback entry or the `menuVisibility` entry. Omit to\n * label the entry with the frame's `name` (no icon / category).\n */\n openMenuEntry?: CompanionFrameOpenMenuEntry\n /**\n * Whether the full-page companion frame covers the companion's whole\n * surface, system bars included (Android edge-to-edge: the navigation bar\n * is drawn translucent over the content). Set `true` only when the app\n * shifts its own controls with `frame.safeAreaInsets` — or with the\n * `--lavitre-safe-area-inset-*` CSS variables the SDK sets from it. When\n * unset or `false` the host keeps the iframe clear of the bars itself, so\n * a frame that knows nothing about insets is never covered. Added 1.51.\n */\n edgeToEdge?: boolean\n}\n\nexport type PositionType = 'Local' | 'Synced'\n\nexport type Interaction = 'notAllowed' | 'autoActiveOnFullscreen' | 'allowed'\n\nexport type BorderMode = 'borderLess' | 'border'\n\nexport type BorderOptions = {\n mode: BorderMode\n showToggleInMenu?: boolean\n}\n\nexport type StreamCapture = {\n data: ArrayBufferLike\n}\n\nexport type VoiceAction = {\n id: string\n message: I18nMap\n}\n\nexport type VoiceActionDetection = {\n id: string\n message: string\n language: string\n confidence: number\n}\n\nexport type OpenFrameOptions = {\n frameConnectorId: string\n streamId?: string\n name: string\n url: string\n size?: Size\n minSize?: Size\n maxSize?: Size\n startPosition?: LayoutPosition\n startPositions?: LayoutPositionWithRules[]\n /**\n * @deprecated Use startPosition.isFullscreen\n */\n startMode?: FrameStartMode\n /**\n * @deprecated Use interaction property\n */\n touchMode?: FrameTouchMode\n interaction?: Interaction\n allowFullscreen?: boolean\n menuVisibility?: MenuVisibility\n /**\n * @deprecated Use menuVisibility property vitre v20\n */\n hideMenu?: boolean\n startInteractive?: boolean\n resizeMode?: ResizeMode\n border?: BorderOptions\n data?: any\n file?: FileData\n mode?: ViewMode\n privacy?: FramePrivacy\n positionType?: PositionType\n voiceActions?: VoiceAction[]\n state?: Record<string, any>\n visibility?: Visibility\n closable?: boolean\n closeLabel?: string\n /**\n * Optional declaration of how this frame should surface on connected\n * companions. See `CompanionFrameOption`. When omitted the companion\n * side ignores the open (no auto-navigation, no menu) — the same\n * behaviour pre-1.13.\n */\n companionFrame?: CompanionFrameOption\n /**\n * Optional id of the device (see `HostInformation.devicesInSpace[].id`)\n * that should *own* the shared frame. The owner drives the languette\n * colour and, when it is a Vitre, takes over hosting the frame so it\n * survives the opener disconnecting (ownership transfer). When omitted\n * the opener owns the frame, as before. Change it afterwards with\n * `connector.setFrameOwner(frameConnectorId, owner)`.\n */\n owner?: string\n /**\n * SDK 1.32 — when `true`, the `file` is delivered ONLY to the opening\n * Vitre. The frame still opens and syncs on other peers, but the file\n * bytes are not propagated and the remote frames open without it. The\n * `data` field keeps syncing normally. The host strips the file before\n * cross-vitre sync — this is purely sender-side, so no peer-version gate\n * is needed (older receivers simply get a frame with no file, a state\n * they already handle). Has no effect when no `file` is provided.\n */\n localFile?: boolean\n /**\n * Icon shown for this frame's shared content on connected companions. A\n * bitmap (full colour). May be a path relative to the connector URL — the\n * host resolves it to an absolute URL. When both `iconUrl` and `maskIconUrl`\n * are set the companion prefers `maskIconUrl`. When neither is set the\n * companion falls back to the app icon (`ConnectorOptions.iconUrl`).\n */\n iconUrl?: string\n /**\n * Monochrome mask icon for this frame's shared content, tinted by the\n * companion theme (CSS `mask`). May be relative to the connector URL —\n * resolved absolute by the host. Preferred over `iconUrl` when both are set.\n */\n maskIconUrl?: string\n /**\n * CSS background applied to this frame's shared-content surface on the\n * Vitre (and on peer Vitres / tableaux showing it). Any CSS `background`\n * value — a colour, gradient, or `url(...)`. When set it overrides the\n * default surface background (`.lavitre-shared-object-content`, normally\n * black). Not resolved against the connector URL: pass an absolute URL if\n * you reference an image. When omitted the default background is kept.\n */\n background?: string\n /**\n * CSS `box-shadow` applied to this frame's shared-content surface on the\n * Vitre (and on peer Vitres / tableaux showing it). When set it overrides\n * the default surface shadow (`.lavitre-shared-object-content`). Pass\n * `'none'` to remove the shadow. When omitted the default shadow is kept.\n */\n boxShadow?: string\n /**\n * CSS `drop-shadow` filter applied to this frame's shared-content surface on\n * the Vitre (and on peer Vitres / tableaux showing it). The value is the\n * argument of the CSS `drop-shadow()` filter function — e.g.\n * `'0 4px 8px rgba(0,0,0,.5)'` — which the host wraps as\n * `filter: drop-shadow(<value>)`. Unlike `boxShadow` it follows the rendered\n * alpha shape, so it casts a shadow around non-rectangular / transparent\n * content (pair it with a transparent `background`). Pass `'none'` to remove\n * any filter. When omitted no drop-shadow filter is applied.\n */\n dropShadow?: string\n /**\n * CSS `backdrop-filter: blur(...)` applied to this frame's shared-content\n * surface on the Vitre (and on peer Vitres / tableaux showing it). The value\n * is the argument of the CSS `blur()` function — e.g. `'8px'` — which the\n * host wraps as `backdrop-filter: blur(<value>)`. It blurs whatever is\n * *behind* the surface (frosted-glass effect), so pair it with a translucent\n * `background`. Pass `'none'` to remove the backdrop filter. When omitted no\n * backdrop blur is applied.\n */\n backdropBlur?: string\n /**\n * Name to report for this frame in usage analytics (\"insights\"), instead of\n * the app's own name. A single app can open several kinds of frames — e.g.\n * Carbone opens \"Page blanche\", \"PDF\", \"Image\" — and by default every frame\n * is recorded under the app name (\"Carbone\"). Set `insightsName` per open to\n * distinguish them in the stats. When omitted the analytics fall back to the\n * current behaviour (the app name, then the frame `name`). Purely a reporting\n * label — it does not affect the frame UI (`name` still drives the visible\n * label) and never reaches other peers.\n */\n insightsName?: string\n}\n\n/**\n * Visual style of a frame's shared-content surface and its companion icon,\n * settable at open time (subset of `OpenFrameOptions`) and updatable at any\n * time with `connector.setChromeStyle(frameConnectorId, style)`. Every field\n * is optional: a field left `undefined` keeps the current value; pass an empty\n * string to clear an override back to the host default (e.g. `background: ''`).\n */\nexport type ChromeStyle = {\n /** See `OpenFrameOptions.background`. */\n background?: string\n /** See `OpenFrameOptions.boxShadow`. */\n boxShadow?: string\n /** See `OpenFrameOptions.dropShadow`. */\n dropShadow?: string\n /** See `OpenFrameOptions.backdropBlur`. */\n backdropBlur?: string\n /** See `OpenFrameOptions.iconUrl` (companion icon, bitmap). */\n iconUrl?: string\n /** See `OpenFrameOptions.maskIconUrl` (companion icon, monochrome mask). */\n maskIconUrl?: string\n}\n\n/**\n * @deprecated Use interaction property\n */\nexport enum FrameTouchMode {\n // Host will only allow manipulations. Touch events will not be forwarded to the webview\n ReadOnly = 'readonly',\n FullscreenOnly = 'fullscreenOnly',\n // Host will show a toggle button for interacting with the webview\n HostButtonInOut = 'hostButtonInOut',\n HostButtonMinimizeOnFullscreen = 'hostButtonMinimizeOnFullscreen',\n}\n\n/**\n * @deprecated Use startPosition.isFullscreen\n */\nexport enum FrameStartMode {\n Window = 'window',\n Fullscreen = 'fullscreen',\n}\n\nexport type ResizeMode =\n /**\n * @deprecated The method should not be used\n */\n | 'scale'\n /**\n * @deprecated The method should not be used\n */\n | 'resize'\n /**\n * @deprecated The method should not be used\n */\n | 'resizeAndKeepRatio'\n | 'no'\n | 'uniformRenderTransform'\n | 'freeRenderTransform'\n | 'uniformResize'\n | 'freeResize'\n\nexport type VideoContentHint = 'motion' | 'detail'\n\nexport type MenuClicked = {\n menuId: string\n isChecked: boolean\n tag: any | undefined\n}\n\nexport type LoadedFrame = {\n src: string\n name: string\n frameConnectorId: string\n}\n\nexport type LocalConnectorMessageReceived = {\n data: any\n fileData?: FileData\n from?: string\n}\n\nexport type SendToLocalFrame = {\n frameConnectorId?: string\n data: any\n fileData?: FileData\n}\n\nexport type EnumerateLoadedFramesCompleted = {\n requestId: string\n frames: LoadedFrame[]\n}\n\nexport type EnumerateLoadedFrames = {\n requestId: string\n}\n\nexport type PrivacyChanged = {\n privacy: Privacy\n}\n\nexport type MessageTargetCompanion = {\n type: 'companion'\n companionConnectionId: string\n}\n\nexport type MessageTarget = MessageTargetCompanion\n\n/**\n * A peer (Vitre or companion) that currently has a given frame open on\n * its side. Identified by the host's connection id so apps can address\n * it individually with the per-peer messaging APIs.\n */\nexport type FramePeer = {\n peerId: string\n deviceType: DeviceType\n name?: string\n}\n\n/**\n * Companion frame peer-presence wire events.\n *\n * `CompanionFramePeersUpdated` is the authoritative full snapshot — it\n * carries the complete current peer set and fires on every change.\n * `CompanionFramePeerJoined` / `CompanionFramePeerLeft` are convenience\n * incremental events derived from the same stream. Consumers should\n * subscribe to ONE model (snapshot OR incremental pair), not both, to\n * avoid double-counting every transition.\n */\nexport type CompanionFramePeerJoined = {\n peer: FramePeer\n}\n\nexport type CompanionFramePeerLeft = {\n peerId: string\n}\n\nexport type CompanionFramePeersUpdated = {\n peers: FramePeer[]\n}\n\nexport type AppMessage = {\n data: any\n fileData?: FileData\n target?: MessageTarget\n}\n\nexport type CameraExposureValue = {\n type: 'manual'\n exposure: number\n compensation: number\n}\n\nexport type CameraExposureAuto = {\n type: 'auto'\n}\n\nexport type CameraSettings = {\n exposure: CameraExposureAuto | CameraExposureValue\n deviceId?: string\n deviceName?: string\n}\n\nexport type StreamUsage = 'mainStream' | 'sharedStream'\n\nexport type Orientation = 'left' | 'right' | 'top' | 'bottom'\nexport type OrientationBy = 'system' | 'emulated'\n\nexport type ConnectedMediaDevice = {\n deviceId: string\n groupId: string\n kind: MediaDeviceKind\n label: string\n inUseBy: StreamUsage[]\n orientation?: Orientation\n orientationBySystem?: boolean\n}\n\nexport type AuthenticationMode = 'open' | 'userAccount'\n\nexport type SecuritySettings = {\n authentication: AuthenticationMode\n}\n\nexport type GuestSpace = {\n type: 'guestSpace'\n space: string\n teamDomain: string\n label: string\n}\n\nexport type TeamSpace = {\n type: 'teamSpace'\n space: string\n}\n\nexport type Space = GuestSpace | TeamSpace\n\n/**\n * Snapshot of the current active preset's noise filter selection.\n *\n * `active` and entries in `available` are the string ids of the F#\n * `Settings.Audio.AudioFilterLevel` enum. The current set is:\n *\n * \"none\" | \"rnnoise\" | \"rnnoise2\" | \"speex\" | \"noisegate\" | \"deepfilternet3\"\n *\n * Apps should treat the list as open — newer la Vitre builds may surface\n * additional filter ids the app doesn't know about. Render unknown ids\n * gracefully (e.g. as a generic option) rather than asserting on the set.\n */\nexport type AudioFilterView = {\n active: string\n available: string[]\n}\n\n/**\n * User-editable subset of the voice-profile chain (the \"custom\" profile).\n * Only meaningful when the active profile is \"custom\"; for the four frozen\n * profiles an app shows their fixed values read-only from its own table.\n */\nexport type CustomVoiceProfileView = {\n /** EQ presence (clarity) gain, dB. */\n presenceDb: number\n /** Compressor threshold, dB. */\n compThresholdDb: number\n /** Compressor ratio, >= 1. */\n compRatio: number\n /** De-esser sibilance cut, dB (negative). */\n deEsserCutDb: number\n}\n\nexport type CustomVoiceProfileSettingsSetter = {\n presenceDb?: number\n compThresholdDb?: number\n compRatio?: number\n deEsserCutDb?: number\n}\n\n/**\n * Voice profile (EQ + compressor + de-esser preset) applied for every\n * filter — including `none`. Ids:\n *\n * \"naturel\" | \"broadcast\" | \"douce\" | \"antifatigue\" | \"custom\"\n */\nexport type VoiceProfileView = {\n active: string\n available: string[]\n /** Persisted custom params (always present; edited only when\n * `active === 'custom'`). */\n custom: CustomVoiceProfileView\n}\n\n/**\n * DeepFilterNet 3 live-tunable knobs.\n *\n * `inputGainDb` and `wetDryMix` exist server-side but are intentionally\n * NOT exposed to apps — the SDK contract only covers the noise-reduction\n * tuning knobs that make sense in a \"voice quality\" UI.\n */\nexport type Dfn3View = {\n /** Suppression cap, 0..100 dB. Higher = more aggressive denoising. */\n attenLimDb: number\n /** Post-filter strength, 0..0.1. 0 disables it. */\n postFilterBeta: number\n}\n\nexport type Dfn3SettingsSetter = {\n attenLimDb?: number\n postFilterBeta?: number\n}\n\nexport type AudioSettings = {\n volume: number\n isMuted: boolean\n selectedPreset: string\n audioPresets: string[]\n /**\n * The following three are optional on the wire — older la Vitre builds\n * don't emit them. When undefined, treat as \"feature not available on\n * this Vitre\" rather than as a default value.\n */\n filter?: AudioFilterView\n voiceProfile?: VoiceProfileView\n dfn3?: Dfn3View\n}\n\nexport type AudioSettingsSetter = {\n volume?: number\n isMuted?: boolean\n selectedPreset?: string\n /**\n * Use one of `AudioFilterView.available` ids — unknown values are\n * silently dropped host-side rather than crashing the audio pipeline.\n */\n filter?: string\n voiceProfile?: string\n /**\n * Partial setter — only the fields present in the object are written.\n * Existing DFN3 properties not listed here (including `inputGainDb`\n * and `wetDryMix` which apps cannot manipulate) are preserved.\n */\n dfn3?: Dfn3SettingsSetter\n /**\n * Partial setter for the \"custom\" voice profile knobs. Only applied\n * when the active voice profile is \"custom\"; persisted regardless.\n */\n customVoiceProfile?: CustomVoiceProfileSettingsSetter\n}\n\nexport type VitreSettings = {\n availableMediaDevices: ConnectedMediaDevice[]\n audioSettings: AudioSettings\n cameraSettings: CameraSettings\n security: SecuritySettings\n spaces: Space[]\n currentSpace: Space\n language: Language\n color: string\n name?: string\n}\n\nexport type VitreSettingsSetter = {\n cameraSettings?: CameraSettings\n audioSettings?: AudioSettingsSetter\n}\n\nexport type DeviceTarget = 'all' | 'single'\n\nexport type KnockKnock = {\n from: Device\n target: DeviceTarget\n}\n\nexport type AppId = string\n\nexport type ShareFileRequest = {\n fileData: FileData\n targetAppId?: AppId\n /** SDK 1.20 — explicit owner device id for the resulting share. */\n owner?: string\n}\n\nexport type ShareDataRequest = {\n url: string\n targetAppId?: AppId\n /** SDK 1.20 — explicit owner device id for the resulting share. */\n owner?: string\n}\n\nexport type SaveSettings = {\n settings: any\n}\n\nexport type SettingsUpdated = {\n settings: any\n}\n\nexport type ChangeTeamSpace = {\n space: string\n}\n\nexport type ChangeTeamSpaceGuest = {\n space: string\n teamDomain: string\n}\n\nexport type NotificationButton = {\n id: string\n tag?: any\n iconUrl: string\n dismissOnClick?: boolean\n}\n\nexport type NotificationInfo = {\n id: string\n message: string\n iconUrl: string\n buttons?: NotificationButton[]\n closeTimeout?: number\n}\n\nexport type HideNotification = {\n id: string\n}\n\nexport type NotificationDismissed = {\n id: string\n}\n\nexport type NotificationButtonClicked = {\n id: string\n buttonId: string\n tag?: any\n}\n\nexport type DevicePrivacyChanged = { device: Device }\n\nexport type SDKInitRequest = {\n type: 'SDKInitRequest'\n version: string\n}\n\nexport type ChangePrivacy = {\n privacy: Privacy\n}\n\nexport type DeviceFrameReference = {\n frameConnectorId: string\n deviceId: string\n}\n\nexport type PendingDevicesInfo = {\n pendingDevices: Device[]\n}\n\nexport type EventTelemetry = {\n name: string\n properties?: Record<string, any>\n}\n\nexport type StartEventTelemetry = { name: string }\n\nexport type DeviceFullscreenUpdated = {\n deviceId: string\n fullscreen: DeviceFullscreen\n}\n\nexport type PositionUpdated = {\n position: Rect\n isFullscreen: boolean\n zIndex: number\n}\n\n/**\n * Distances, in CSS px of the frame's own viewport, from each edge of the\n * frame to the nearest edge of the area the host guarantees free of system\n * UI (Android navigation bar, display cutout, …). All zero unless the host\n * runs the frame edge-to-edge (`CompanionFrameOption.edgeToEdge`). Added 1.51.\n */\nexport type SafeAreaInsets = {\n top: number\n right: number\n bottom: number\n left: number\n}\n\nexport type SafeAreaInsetsUpdated = {\n safeAreaInsets: SafeAreaInsets\n}\n\nexport type Visibility = 'hidden' | 'visible' | 'visibleInFullscreenOnly'\nexport type MenuVisibility = 'hidden' | 'visible' | 'visibleInFullscreenOnly'\n\nexport type VisibilityChanged = {\n visibility: Visibility\n}\n\nexport type SetVisibility = { visibility: Visibility }\n\nexport type DeviceScalingUpdated = {\n deviceId: string\n sendingScaling: DeviceScaling\n orientation: Orientation\n orientationBy: OrientationBy\n}\n\nexport type UpdateStateEntry =\n | {\n action: 'add'\n key: string\n value: any\n }\n | {\n action: 'addOwned'\n key: string\n value: any\n }\n | {\n action: 'remove'\n key: string\n }\n\nexport type UpdatedStateEntry =\n | {\n action: 'add'\n key: string\n value: any\n }\n | {\n action: 'remove'\n key: string\n }\n | {\n action: 'addOwned'\n key: string\n value: any\n owner: string\n }\n\nexport type UpdateState = {\n updates: UpdateStateEntry[]\n}\n\nexport type ReplacedBy = 'local' | 'remote'\n\nexport type StateReplaced = {\n state: Record<string, any>\n delta: UpdatedStateEntry[]\n replacedBy: ReplacedBy\n}\n\nexport type GetStats = { requestId: string }\n\nexport type SetReducedAudioMode = { enabled: boolean }\n\nexport type DeviceTransceiverWebRTCStats = {\n deviceId: string\n transceiverId: string\n receiverStats?: any[]\n receiverStatsError?: string\n senderStats?: any[]\n senderStatsError?: string\n videoSendingParameters?: VideoSendingParameters\n /** Since 1.44: label of the outgoing track (originalTrack when the host wraps it). Absent on older hosts; explicit null on newer hosts when the transceiver has no sender track. */\n trackLabel?: string\n /** Since 1.44: sender track getSettings(), unwrapped via originalTrack when present. Absent on older hosts; null on newer hosts without a sender track. */\n trackSettings?: MediaTrackSettings\n /** Since 1.44: sender track getConstraints(). Absent on older hosts; null on newer hosts without a sender track. */\n trackConstraints?: MediaTrackConstraints\n /** Since 1.44: sender track muted flag. Absent on older hosts; null on newer hosts without a sender track. */\n trackMuted?: boolean\n /** Since 1.44: sender track enabled flag. Absent on older hosts; null on newer hosts without a sender track. */\n trackEnabled?: boolean\n /** Since 1.44: host sending parameters isEnabled (false under confidentiality). Absent on older hosts; null on newer hosts without a sender track. */\n sendingEnabled?: boolean\n}\n\nexport type MemoryInfo = {\n slotsInUse: number\n slots: number\n mbAvailable?: number\n}\n\nexport type VideoSendingParameters = {\n size?: Size\n bitrate?: number\n}\n\nexport type StatsResponse = {\n requestId: string\n webrtcStats: DeviceTransceiverWebRTCStats[]\n memory?: MemoryInfo\n cpuUsage?: number\n audioFilter?: string\n}\n\nexport type ConnectionCodeUpdated = {\n companionCode?: string\n}\n\nexport type FieldUpdated = {\n field: Field\n}\n\nexport type SendToSerialPort = {\n com: number\n baudRate: number\n readTimeout: number\n ackLineStartsWith?: string\n nackLineStartsWith?: string\n lines: string[]\n}\n\n/// Ask the host for access to a serial port. Resolves with the granted port\n/// name (empty string if denied/cancelled).\n/// - `port` given: the host pre-grants that port (so the next\n/// `navigator.serial.requestPort()` resolves to it silently) and resolves\n/// with `port`.\n/// - `port` omitted: the host shows its port-picker; resolves with the port\n/// the user chose (and pre-grants it).\n/// Honoured only when the app holds the WebSerial authorization.\nexport type RequestSerialPortAccess = {\n port?: string\n}\n\n/// Reply to RequestSerialPortAccess. On success `port` is the granted port\n/// name. On failure `port` is omitted and `reason` is one of the failure codes\n/// (the SDK rejects the promise with that reason).\nexport type SerialPortAccessReason = 'denied' | 'cancelled' | 'timeout'\nexport type SerialPortAccessResult = {\n port?: string\n reason?: SerialPortAccessReason\n}\n\nexport type StreamSizeUpdate = {\n deviceId: string\n size: Size\n}\n\nexport type RequestStreamSizeUpdate = {\n updates: StreamSizeUpdate[]\n}\n\nexport type DisconnectGuests = {\n deviceIds: string[]\n}\n\nexport type Characteristic = {\n uuid: string\n description: string\n properties: string\n}\n\nexport type OpenBTService = {\n serviceId: string\n requestId: string\n}\n\nexport type CloseBTService = {\n handleId: string\n}\n\nexport type WriteToCharacteristic = {\n handleId: string\n uuid: string\n buffer: ArrayBufferLike\n}\n\nexport type BluetoothFromApp =\n | ({ '@BluetoothFromApp': 'openBTService' } & OpenBTService)\n | ({ '@BluetoothFromApp': 'closeBTService' } & CloseBTService)\n | ({ '@BluetoothFromApp': 'writeToCharacteristic' } & WriteToCharacteristic)\n\nexport type OpenBTServiceResponseData = {\n requestId: string\n handleId: string\n characteristics: Characteristic[]\n}\n\nexport type OpenBTServiceResponse = {\n requestId: string\n isSuccess: boolean\n response?: OpenBTServiceResponseData\n error?: string\n}\n\nexport type BluetoothToApp = {\n '@BluetoothToApp': 'openBTServiceResponse'\n} & OpenBTServiceResponse\n"]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { CropMode, Device, DeviceScaling, HostInformation } from './Common.Model.js';
|
|
2
|
+
export declare const DEFAULT_DEVICE_SCALING: DeviceScaling;
|
|
3
|
+
/**
|
|
4
|
+
* How the source pixels are laid out in the preview before cropping:
|
|
5
|
+
* - `mirror`: flipped horizontally (emulated `top`, or no emulated rotation)
|
|
6
|
+
* - `transpose` / `antiTranspose`: emulated `left` / `right` — a quarter
|
|
7
|
+
* turn combined with the mirror, so the result is a diagonal flip
|
|
8
|
+
* - `flipY`: emulated `bottom` — half turn combined with the mirror
|
|
9
|
+
*/
|
|
10
|
+
export type PreviewOrientation = 'mirror' | 'transpose' | 'antiTranspose' | 'flipY';
|
|
11
|
+
export type PreviewLayout = {
|
|
12
|
+
orientation: PreviewOrientation;
|
|
13
|
+
/** True when the preview swaps width and height of the source. */
|
|
14
|
+
swapsAxes: boolean;
|
|
15
|
+
scale: number;
|
|
16
|
+
/** Offsets of the cropped area, already adjusted for the mirror. */
|
|
17
|
+
offsetX: number;
|
|
18
|
+
offsetY: number;
|
|
19
|
+
cropMode?: CropMode;
|
|
20
|
+
};
|
|
21
|
+
/** 2D affine matrix in canvas `setTransform(a, b, c, d, e, f)` order. */
|
|
22
|
+
export type PreviewMatrix = [number, number, number, number, number, number];
|
|
23
|
+
/**
|
|
24
|
+
* The scaling the host applies to this camera when sending it to `device`.
|
|
25
|
+
* Falls back to the pre-`sendingScaling` field of older hosts.
|
|
26
|
+
*/
|
|
27
|
+
export declare const getDeviceScaling: (device?: Device) => DeviceScaling | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Converts a `legacy` scaling (offsets relative to a 16:9 frame whatever the
|
|
30
|
+
* rotation) to `rotationIndependent`. A top/bottom camera is already 16:9, so
|
|
31
|
+
* only its version changes — same rule as the host.
|
|
32
|
+
*/
|
|
33
|
+
export declare const toRotationIndependent: (scaling: DeviceScaling) => DeviceScaling;
|
|
34
|
+
/**
|
|
35
|
+
* The scaling the local preview must show: zoom and offsets of the device in
|
|
36
|
+
* fullscreen (what the person looking at us sees), else our own; orientation,
|
|
37
|
+
* crop mode and ratio always from the local device, since they describe our
|
|
38
|
+
* camera.
|
|
39
|
+
*/
|
|
40
|
+
export declare const resolvePreviewScaling: (host: HostInformation) => DeviceScaling;
|
|
41
|
+
/**
|
|
42
|
+
* Turns a scaling into a renderer-independent layout. The horizontal offset
|
|
43
|
+
* is mirrored for `left`/`right` only, whatever `orientationBy` says: that is
|
|
44
|
+
* the host's `mirrorScaling`, keep them in step.
|
|
45
|
+
*/
|
|
46
|
+
export declare const computePreviewLayout: (scaling: DeviceScaling) => PreviewLayout;
|
|
47
|
+
/** Width / height of the preview for a source of the given size. */
|
|
48
|
+
export declare const previewAspectRatio: (layout: PreviewLayout, sourceWidth: number, sourceHeight: number) => number;
|
|
49
|
+
/**
|
|
50
|
+
* Matrix mapping source pixels (`sourceWidth` × `sourceHeight`) to preview
|
|
51
|
+
* pixels (`outputWidth` × `outputHeight`). Use it as is with
|
|
52
|
+
* `CanvasRenderingContext2D.setTransform` before `drawImage(source, 0, 0)`,
|
|
53
|
+
* or as a CSS `matrix()` on an element of the source size with
|
|
54
|
+
* `transform-origin: 0 0`. The output should have the aspect ratio given by
|
|
55
|
+
* `previewAspectRatio`, otherwise the image is stretched.
|
|
56
|
+
*/
|
|
57
|
+
export declare const previewMatrix: (layout: PreviewLayout, sourceWidth: number, sourceHeight: number, outputWidth: number, outputHeight: number) => PreviewMatrix;
|
|
58
|
+
/** Pixel size of the preview of a source: the source size, rotated, capped so its longest side is at most `maxSize`. */
|
|
59
|
+
export declare const previewOutputSize: (layout: PreviewLayout, sourceWidth: number, sourceHeight: number, maxSize: number) => {
|
|
60
|
+
width: number;
|
|
61
|
+
height: number;
|
|
62
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure geometry of the local camera preview: what the participants of the
|
|
3
|
+
* space see of this device's camera, expressed so that any renderer (CSS,
|
|
4
|
+
* canvas, WebGL) can reproduce it. No DOM access — usable in a worker.
|
|
5
|
+
*
|
|
6
|
+
* Follows the host's own rendering of a camera (lavitre-app
|
|
7
|
+
* `VideoElement`), which the core app's `localpreview` copied with two
|
|
8
|
+
* divergences fixed here: an emulated `top` is mirrored, and a `legacy`
|
|
9
|
+
* top/bottom scaling keeps its offsets.
|
|
10
|
+
*/
|
|
11
|
+
/** Ratio the host assumes when converting a `legacy` scaling. */
|
|
12
|
+
const LEGACY_RATIO = 16 / 9;
|
|
13
|
+
export const DEFAULT_DEVICE_SCALING = {
|
|
14
|
+
scale: 1,
|
|
15
|
+
offsetX: 0,
|
|
16
|
+
offsetY: 0,
|
|
17
|
+
version: 'rotationIndependent',
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The scaling the host applies to this camera when sending it to `device`.
|
|
21
|
+
* Falls back to the pre-`sendingScaling` field of older hosts.
|
|
22
|
+
*/
|
|
23
|
+
export const getDeviceScaling = (device) => device ? (device.sendingScaling ?? device.scaling) : undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Converts a `legacy` scaling (offsets relative to a 16:9 frame whatever the
|
|
26
|
+
* rotation) to `rotationIndependent`. A top/bottom camera is already 16:9, so
|
|
27
|
+
* only its version changes — same rule as the host.
|
|
28
|
+
*/
|
|
29
|
+
export const toRotationIndependent = (scaling) => scaling.version === 'rotationIndependent'
|
|
30
|
+
? scaling
|
|
31
|
+
: scaling.version === 'legacy' &&
|
|
32
|
+
(scaling.orientation === 'top' || scaling.orientation === 'bottom')
|
|
33
|
+
? { ...scaling, version: 'rotationIndependent' }
|
|
34
|
+
: {
|
|
35
|
+
...scaling,
|
|
36
|
+
offsetX: scaling.offsetX * LEGACY_RATIO,
|
|
37
|
+
offsetY: scaling.offsetY / LEGACY_RATIO,
|
|
38
|
+
version: 'rotationIndependent',
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The scaling the local preview must show: zoom and offsets of the device in
|
|
42
|
+
* fullscreen (what the person looking at us sees), else our own; orientation,
|
|
43
|
+
* crop mode and ratio always from the local device, since they describe our
|
|
44
|
+
* camera.
|
|
45
|
+
*/
|
|
46
|
+
export const resolvePreviewScaling = (host) => {
|
|
47
|
+
const local = getDeviceScaling(host.device);
|
|
48
|
+
const remote = getDeviceScaling(host.devicesInSpace.find((d) => d.fullscreen === 'fullscreen')) ?? local;
|
|
49
|
+
if (!remote)
|
|
50
|
+
return DEFAULT_DEVICE_SCALING;
|
|
51
|
+
return toRotationIndependent({
|
|
52
|
+
...(local ?? DEFAULT_DEVICE_SCALING),
|
|
53
|
+
scale: remote.scale,
|
|
54
|
+
offsetX: remote.offsetX,
|
|
55
|
+
offsetY: remote.offsetY,
|
|
56
|
+
version: remote.version,
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Emulated orientations are rotated by the app; `system` ones arrive already
|
|
61
|
+
* rotated, so only the mirror applies.
|
|
62
|
+
*/
|
|
63
|
+
const previewOrientation = (scaling) => {
|
|
64
|
+
if ((scaling.orientationBy ?? 'emulated') !== 'emulated')
|
|
65
|
+
return 'mirror';
|
|
66
|
+
switch (scaling.orientation) {
|
|
67
|
+
case 'left':
|
|
68
|
+
return 'transpose';
|
|
69
|
+
case 'right':
|
|
70
|
+
return 'antiTranspose';
|
|
71
|
+
case 'top':
|
|
72
|
+
return 'mirror';
|
|
73
|
+
case 'bottom':
|
|
74
|
+
return 'flipY';
|
|
75
|
+
default:
|
|
76
|
+
return 'mirror';
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Turns a scaling into a renderer-independent layout. The horizontal offset
|
|
81
|
+
* is mirrored for `left`/`right` only, whatever `orientationBy` says: that is
|
|
82
|
+
* the host's `mirrorScaling`, keep them in step.
|
|
83
|
+
*/
|
|
84
|
+
export const computePreviewLayout = (scaling) => {
|
|
85
|
+
const s = toRotationIndependent(scaling);
|
|
86
|
+
const orientation = previewOrientation(s);
|
|
87
|
+
const mirrorsOffset = s.orientation === 'left' || s.orientation === 'right';
|
|
88
|
+
return {
|
|
89
|
+
orientation,
|
|
90
|
+
swapsAxes: orientation === 'transpose' || orientation === 'antiTranspose',
|
|
91
|
+
scale: s.scale,
|
|
92
|
+
offsetX: mirrorsOffset ? -(s.scale + s.offsetX - 1) : s.offsetX,
|
|
93
|
+
offsetY: s.offsetY,
|
|
94
|
+
cropMode: s.cropMode,
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
/** Width / height of the preview for a source of the given size. */
|
|
98
|
+
export const previewAspectRatio = (layout, sourceWidth, sourceHeight) => layout.swapsAxes ? sourceHeight / sourceWidth : sourceWidth / sourceHeight;
|
|
99
|
+
const ORIENTATION_MATRICES = {
|
|
100
|
+
mirror: [-1, 0, 0, 1, 1, 0],
|
|
101
|
+
transpose: [0, 1, 1, 0, 0, 0],
|
|
102
|
+
antiTranspose: [0, -1, -1, 0, 1, 1],
|
|
103
|
+
flipY: [1, 0, 0, -1, 0, 1],
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Matrix mapping source pixels (`sourceWidth` × `sourceHeight`) to preview
|
|
107
|
+
* pixels (`outputWidth` × `outputHeight`). Use it as is with
|
|
108
|
+
* `CanvasRenderingContext2D.setTransform` before `drawImage(source, 0, 0)`,
|
|
109
|
+
* or as a CSS `matrix()` on an element of the source size with
|
|
110
|
+
* `transform-origin: 0 0`. The output should have the aspect ratio given by
|
|
111
|
+
* `previewAspectRatio`, otherwise the image is stretched.
|
|
112
|
+
*/
|
|
113
|
+
export const previewMatrix = (layout, sourceWidth, sourceHeight, outputWidth, outputHeight) => {
|
|
114
|
+
const [a, b, c, d, e, f] = ORIENTATION_MATRICES[layout.orientation];
|
|
115
|
+
const s = layout.scale;
|
|
116
|
+
return [
|
|
117
|
+
(a * s * outputWidth) / sourceWidth,
|
|
118
|
+
(b * s * outputHeight) / sourceWidth,
|
|
119
|
+
(c * s * outputWidth) / sourceHeight,
|
|
120
|
+
(d * s * outputHeight) / sourceHeight,
|
|
121
|
+
(e * s + layout.offsetX) * outputWidth,
|
|
122
|
+
(f * s + layout.offsetY) * outputHeight,
|
|
123
|
+
];
|
|
124
|
+
};
|
|
125
|
+
/** Pixel size of the preview of a source: the source size, rotated, capped so its longest side is at most `maxSize`. */
|
|
126
|
+
export const previewOutputSize = (layout, sourceWidth, sourceHeight, maxSize) => {
|
|
127
|
+
const w = layout.swapsAxes ? sourceHeight : sourceWidth;
|
|
128
|
+
const h = layout.swapsAxes ? sourceWidth : sourceHeight;
|
|
129
|
+
const k = Math.min(1, maxSize / Math.max(w, h));
|
|
130
|
+
return { width: Math.round(w * k), height: Math.round(h * k) };
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=PreviewScaling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviewScaling.js","sourceRoot":"","sources":["../../Common/PreviewScaling.ts"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AAEH,iEAAiE;AACjE,MAAM,YAAY,GAAG,EAAE,GAAG,CAAC,CAAA;AAE3B,MAAM,CAAC,MAAM,sBAAsB,GAAkB;IACnD,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,qBAAqB;CAC/B,CAAA;AA6BD;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAe,EAA6B,EAAE,CAC7E,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,IAAK,MAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAEzE;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,OAAsB,EAAiB,EAAE,CAC7E,OAAO,CAAC,OAAO,KAAK,qBAAqB;IACvC,CAAC,CAAC,OAAO;IACT,CAAC,CAAC,OAAO,CAAC,OAAO,KAAK,QAAQ;QAC1B,CAAC,OAAO,CAAC,WAAW,KAAK,KAAK,IAAI,OAAO,CAAC,WAAW,KAAK,QAAQ,CAAC;QACrE,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE;QAChD,CAAC,CAAC;YACE,GAAG,OAAO;YACV,OAAO,EAAE,OAAO,CAAC,OAAO,GAAG,YAAY;YACvC,OAAO,EAAE,OAAO,CAAC,OAAO,GAAG,YAAY;YACvC,OAAO,EAAE,qBAAqB;SAC/B,CAAA;AAET;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAAqB,EAAiB,EAAE;IAC5E,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3C,MAAM,MAAM,GACV,gBAAgB,CACd,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,YAAY,CAAC,CAC/D,IAAI,KAAK,CAAA;IACZ,IAAI,CAAC,MAAM;QAAE,OAAO,sBAAsB,CAAA;IAC1C,OAAO,qBAAqB,CAAC;QAC3B,GAAG,CAAC,KAAK,IAAI,sBAAsB,CAAC;QACpC,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC,CAAA;AACJ,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,kBAAkB,GAAG,CAAC,OAAsB,EAAsB,EAAE;IACxE,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,UAAU,CAAC,KAAK,UAAU;QAAE,OAAO,QAAQ,CAAA;IACzE,QAAQ,OAAO,CAAC,WAAW,EAAE,CAAC;QAC5B,KAAK,MAAM;YACT,OAAO,WAAW,CAAA;QACpB,KAAK,OAAO;YACV,OAAO,eAAe,CAAA;QACxB,KAAK,KAAK;YACR,OAAO,QAAQ,CAAA;QACjB,KAAK,QAAQ;YACX,OAAO,OAAO,CAAA;QAChB;YACE,OAAO,QAAQ,CAAA;IACnB,CAAC;AACH,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAsB,EAAiB,EAAE;IAC5E,MAAM,CAAC,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAA;IACxC,MAAM,WAAW,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAA;IACzC,MAAM,aAAa,GAAG,CAAC,CAAC,WAAW,KAAK,MAAM,IAAI,CAAC,CAAC,WAAW,KAAK,OAAO,CAAA;IAC3E,OAAO;QACL,WAAW;QACX,SAAS,EAAE,WAAW,KAAK,WAAW,IAAI,WAAW,KAAK,eAAe;QACzE,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO;QAC/D,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,QAAQ,EAAE,CAAC,CAAC,QAAQ;KACrB,CAAA;AACH,CAAC,CAAA;AAED,oEAAoE;AACpE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,MAAqB,EACrB,WAAmB,EACnB,YAAoB,EACpB,EAAE,CACF,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,GAAG,YAAY,CAAA;AAE5E,MAAM,oBAAoB,GAA8C;IACtE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC3B,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC7B,aAAa,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACnC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;CAC3B,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,MAAqB,EACrB,WAAmB,EACnB,YAAoB,EACpB,WAAmB,EACnB,YAAoB,EACL,EAAE;IACjB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,oBAAoB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;IACnE,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAA;IACtB,OAAO;QACL,CAAC,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,WAAW;QACnC,CAAC,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,WAAW;QACpC,CAAC,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,YAAY;QACpC,CAAC,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,YAAY;QACrC,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,WAAW;QACtC,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,YAAY;KACxC,CAAA;AACH,CAAC,CAAA;AAED,wHAAwH;AACxH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,MAAqB,EACrB,WAAmB,EACnB,YAAoB,EACpB,OAAe,EACf,EAAE;IACF,MAAM,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,CAAA;IACvD,MAAM,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,CAAA;IACvD,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAC/C,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAA;AAChE,CAAC,CAAA","sourcesContent":["import type {\n CropMode,\n Device,\n DeviceScaling,\n HostInformation,\n} from './Common.Model.js'\n\n/**\n * Pure geometry of the local camera preview: what the participants of the\n * space see of this device's camera, expressed so that any renderer (CSS,\n * canvas, WebGL) can reproduce it. No DOM access — usable in a worker.\n *\n * Follows the host's own rendering of a camera (lavitre-app\n * `VideoElement`), which the core app's `localpreview` copied with two\n * divergences fixed here: an emulated `top` is mirrored, and a `legacy`\n * top/bottom scaling keeps its offsets.\n */\n\n/** Ratio the host assumes when converting a `legacy` scaling. */\nconst LEGACY_RATIO = 16 / 9\n\nexport const DEFAULT_DEVICE_SCALING: DeviceScaling = {\n scale: 1,\n offsetX: 0,\n offsetY: 0,\n version: 'rotationIndependent',\n}\n\n/**\n * How the source pixels are laid out in the preview before cropping:\n * - `mirror`: flipped horizontally (emulated `top`, or no emulated rotation)\n * - `transpose` / `antiTranspose`: emulated `left` / `right` — a quarter\n * turn combined with the mirror, so the result is a diagonal flip\n * - `flipY`: emulated `bottom` — half turn combined with the mirror\n */\nexport type PreviewOrientation =\n | 'mirror'\n | 'transpose'\n | 'antiTranspose'\n | 'flipY'\n\nexport type PreviewLayout = {\n orientation: PreviewOrientation\n /** True when the preview swaps width and height of the source. */\n swapsAxes: boolean\n scale: number\n /** Offsets of the cropped area, already adjusted for the mirror. */\n offsetX: number\n offsetY: number\n cropMode?: CropMode\n}\n\n/** 2D affine matrix in canvas `setTransform(a, b, c, d, e, f)` order. */\nexport type PreviewMatrix = [number, number, number, number, number, number]\n\n/**\n * The scaling the host applies to this camera when sending it to `device`.\n * Falls back to the pre-`sendingScaling` field of older hosts.\n */\nexport const getDeviceScaling = (device?: Device): DeviceScaling | undefined =>\n device ? (device.sendingScaling ?? (device as any).scaling) : undefined\n\n/**\n * Converts a `legacy` scaling (offsets relative to a 16:9 frame whatever the\n * rotation) to `rotationIndependent`. A top/bottom camera is already 16:9, so\n * only its version changes — same rule as the host.\n */\nexport const toRotationIndependent = (scaling: DeviceScaling): DeviceScaling =>\n scaling.version === 'rotationIndependent'\n ? scaling\n : scaling.version === 'legacy' &&\n (scaling.orientation === 'top' || scaling.orientation === 'bottom')\n ? { ...scaling, version: 'rotationIndependent' }\n : {\n ...scaling,\n offsetX: scaling.offsetX * LEGACY_RATIO,\n offsetY: scaling.offsetY / LEGACY_RATIO,\n version: 'rotationIndependent',\n }\n\n/**\n * The scaling the local preview must show: zoom and offsets of the device in\n * fullscreen (what the person looking at us sees), else our own; orientation,\n * crop mode and ratio always from the local device, since they describe our\n * camera.\n */\nexport const resolvePreviewScaling = (host: HostInformation): DeviceScaling => {\n const local = getDeviceScaling(host.device)\n const remote =\n getDeviceScaling(\n host.devicesInSpace.find((d) => d.fullscreen === 'fullscreen'),\n ) ?? local\n if (!remote) return DEFAULT_DEVICE_SCALING\n return toRotationIndependent({\n ...(local ?? DEFAULT_DEVICE_SCALING),\n scale: remote.scale,\n offsetX: remote.offsetX,\n offsetY: remote.offsetY,\n version: remote.version,\n })\n}\n\n/**\n * Emulated orientations are rotated by the app; `system` ones arrive already\n * rotated, so only the mirror applies.\n */\nconst previewOrientation = (scaling: DeviceScaling): PreviewOrientation => {\n if ((scaling.orientationBy ?? 'emulated') !== 'emulated') return 'mirror'\n switch (scaling.orientation) {\n case 'left':\n return 'transpose'\n case 'right':\n return 'antiTranspose'\n case 'top':\n return 'mirror'\n case 'bottom':\n return 'flipY'\n default:\n return 'mirror'\n }\n}\n\n/**\n * Turns a scaling into a renderer-independent layout. The horizontal offset\n * is mirrored for `left`/`right` only, whatever `orientationBy` says: that is\n * the host's `mirrorScaling`, keep them in step.\n */\nexport const computePreviewLayout = (scaling: DeviceScaling): PreviewLayout => {\n const s = toRotationIndependent(scaling)\n const orientation = previewOrientation(s)\n const mirrorsOffset = s.orientation === 'left' || s.orientation === 'right'\n return {\n orientation,\n swapsAxes: orientation === 'transpose' || orientation === 'antiTranspose',\n scale: s.scale,\n offsetX: mirrorsOffset ? -(s.scale + s.offsetX - 1) : s.offsetX,\n offsetY: s.offsetY,\n cropMode: s.cropMode,\n }\n}\n\n/** Width / height of the preview for a source of the given size. */\nexport const previewAspectRatio = (\n layout: PreviewLayout,\n sourceWidth: number,\n sourceHeight: number,\n) =>\n layout.swapsAxes ? sourceHeight / sourceWidth : sourceWidth / sourceHeight\n\nconst ORIENTATION_MATRICES: Record<PreviewOrientation, PreviewMatrix> = {\n mirror: [-1, 0, 0, 1, 1, 0],\n transpose: [0, 1, 1, 0, 0, 0],\n antiTranspose: [0, -1, -1, 0, 1, 1],\n flipY: [1, 0, 0, -1, 0, 1],\n}\n\n/**\n * Matrix mapping source pixels (`sourceWidth` × `sourceHeight`) to preview\n * pixels (`outputWidth` × `outputHeight`). Use it as is with\n * `CanvasRenderingContext2D.setTransform` before `drawImage(source, 0, 0)`,\n * or as a CSS `matrix()` on an element of the source size with\n * `transform-origin: 0 0`. The output should have the aspect ratio given by\n * `previewAspectRatio`, otherwise the image is stretched.\n */\nexport const previewMatrix = (\n layout: PreviewLayout,\n sourceWidth: number,\n sourceHeight: number,\n outputWidth: number,\n outputHeight: number,\n): PreviewMatrix => {\n const [a, b, c, d, e, f] = ORIENTATION_MATRICES[layout.orientation]\n const s = layout.scale\n return [\n (a * s * outputWidth) / sourceWidth,\n (b * s * outputHeight) / sourceWidth,\n (c * s * outputWidth) / sourceHeight,\n (d * s * outputHeight) / sourceHeight,\n (e * s + layout.offsetX) * outputWidth,\n (f * s + layout.offsetY) * outputHeight,\n ]\n}\n\n/** Pixel size of the preview of a source: the source size, rotated, capped so its longest side is at most `maxSize`. */\nexport const previewOutputSize = (\n layout: PreviewLayout,\n sourceWidth: number,\n sourceHeight: number,\n maxSize: number,\n) => {\n const w = layout.swapsAxes ? sourceHeight : sourceWidth\n const h = layout.swapsAxes ? sourceWidth : sourceHeight\n const k = Math.min(1, maxSize / Math.max(w, h))\n return { width: Math.round(w * k), height: Math.round(h * k) }\n}\n"]}
|
package/dist/Common/index.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export { CrdtChannel, MIN_CRDT_HOST_VERSION, type CrdtAttachment, type CrdtInbou
|
|
|
4
4
|
export { BlobStore } from './BlobStore.js';
|
|
5
5
|
export { AiChannel, MIN_AI_HOST_VERSION, type AiTool, type AiToolHandler, type AiInboundMessage, type AiOutboundMessage, type AiPostMessage, } from './AiChannel.js';
|
|
6
6
|
export declare const ensureDefaultValue: <T>(value: Partial<T> | null, defaultValue: T) => T;
|
|
7
|
+
export * from './PreviewScaling.js';
|
package/dist/Common/index.js
CHANGED
package/dist/Common/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../Common/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,EACL,WAAW,EACX,qBAAqB,GAKtB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EACL,SAAS,EACT,mBAAmB,GAMpB,MAAM,gBAAgB,CAAA;AAEvB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,KAAwB,EACxB,YAAe,EACf,EAAE;IACF,MAAM,WAAW,GAAG,CAAC,KAAU,EAAE,YAAiB,EAAE,EAAE;QACpD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,KAAK,CAAA;QACd,CAAC;QAED,IAAI,OAAO,KAAK,KAAK,OAAO,YAAY,EAAE,CAAC;YACzC,OAAO,YAAY,CAAA;QACrB,CAAC;QAED,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;YACrC,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;gBAChC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC1B,OAAO,YAAY,CAAA;gBACrB,CAAC;qBAAM,CAAC;oBACN,OAAO,KAAK,CAAA;gBACd,CAAC;YACH,CAAC;YAED,KAAK,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;YACzD,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBACxC,KAAK,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;YAChE,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,KAAK,CAAA;IACd,CAAC,CAAA;IAED,OAAO,WAAW,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,YAAY,CAAM,CAAA;AACzE,CAAC,CAAA","sourcesContent":["export * from './Common.Model.js'\nexport { compareVersions, isMinVersion } from './Version.js'\nexport {\n CrdtChannel,\n MIN_CRDT_HOST_VERSION,\n type CrdtAttachment,\n type CrdtInboundMessage,\n type CrdtOutboundMessage,\n type CrdtPostMessage,\n} from './CrdtChannel.js'\nexport { BlobStore } from './BlobStore.js'\nexport {\n AiChannel,\n MIN_AI_HOST_VERSION,\n type AiTool,\n type AiToolHandler,\n type AiInboundMessage,\n type AiOutboundMessage,\n type AiPostMessage,\n} from './AiChannel.js'\n\nexport const ensureDefaultValue = <T>(\n value: Partial<T> | null,\n defaultValue: T,\n) => {\n const ensureValue = (value: any, defaultValue: any) => {\n if (defaultValue === undefined) {\n return value\n }\n\n if (typeof value !== typeof defaultValue) {\n return defaultValue\n }\n\n if (typeof defaultValue === 'object') {\n if (Array.isArray(defaultValue)) {\n if (!Array.isArray(value)) {\n return defaultValue\n } else {\n return value\n }\n }\n\n value = value === undefined || value == null ? {} : value\n Object.keys(defaultValue).forEach((key) => {\n value[key] = ensureDefaultValue(value[key], defaultValue[key])\n })\n }\n\n return value\n }\n\n return ensureValue(value === undefined ? {} : value, defaultValue) as T\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../Common/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,EACL,WAAW,EACX,qBAAqB,GAKtB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EACL,SAAS,EACT,mBAAmB,GAMpB,MAAM,gBAAgB,CAAA;AAEvB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,KAAwB,EACxB,YAAe,EACf,EAAE;IACF,MAAM,WAAW,GAAG,CAAC,KAAU,EAAE,YAAiB,EAAE,EAAE;QACpD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,KAAK,CAAA;QACd,CAAC;QAED,IAAI,OAAO,KAAK,KAAK,OAAO,YAAY,EAAE,CAAC;YACzC,OAAO,YAAY,CAAA;QACrB,CAAC;QAED,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;YACrC,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;gBAChC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC1B,OAAO,YAAY,CAAA;gBACrB,CAAC;qBAAM,CAAC;oBACN,OAAO,KAAK,CAAA;gBACd,CAAC;YACH,CAAC;YAED,KAAK,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;YACzD,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBACxC,KAAK,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;YAChE,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,KAAK,CAAA;IACd,CAAC,CAAA;IAED,OAAO,WAAW,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,YAAY,CAAM,CAAA;AACzE,CAAC,CAAA;AACD,cAAc,qBAAqB,CAAA","sourcesContent":["export * from './Common.Model.js'\nexport { compareVersions, isMinVersion } from './Version.js'\nexport {\n CrdtChannel,\n MIN_CRDT_HOST_VERSION,\n type CrdtAttachment,\n type CrdtInboundMessage,\n type CrdtOutboundMessage,\n type CrdtPostMessage,\n} from './CrdtChannel.js'\nexport { BlobStore } from './BlobStore.js'\nexport {\n AiChannel,\n MIN_AI_HOST_VERSION,\n type AiTool,\n type AiToolHandler,\n type AiInboundMessage,\n type AiOutboundMessage,\n type AiPostMessage,\n} from './AiChannel.js'\n\nexport const ensureDefaultValue = <T>(\n value: Partial<T> | null,\n defaultValue: T,\n) => {\n const ensureValue = (value: any, defaultValue: any) => {\n if (defaultValue === undefined) {\n return value\n }\n\n if (typeof value !== typeof defaultValue) {\n return defaultValue\n }\n\n if (typeof defaultValue === 'object') {\n if (Array.isArray(defaultValue)) {\n if (!Array.isArray(value)) {\n return defaultValue\n } else {\n return value\n }\n }\n\n value = value === undefined || value == null ? {} : value\n Object.keys(defaultValue).forEach((key) => {\n value[key] = ensureDefaultValue(value[key], defaultValue[key])\n })\n }\n\n return value\n }\n\n return ensureValue(value === undefined ? {} : value, defaultValue) as T\n}\nexport * from './PreviewScaling.js'\n"]}
|
|
@@ -57,7 +57,7 @@ declare class CompanionFrameImpl extends Frame {
|
|
|
57
57
|
* using `createVitreSyncAdapter(frame)` unchanged — the adapter only touches
|
|
58
58
|
* `frame.crdt`.
|
|
59
59
|
*/
|
|
60
|
-
export type CompanionFrame = Pick<CompanionFrameImpl, 'id' | 'appId' | 'options' | 'initOptions' | 'initiator' | 'hostInformation' | 'companionInformation' | 'state' | 'crdt' | 'blobs' | 'yjsDoc' | 'isFullscreen' | 'isBorderless' | 'position' | 'zIndex' | 'setFullscreen' | 'setWindowed' | 'setMenu' | 'sendToVitreFrame' | 'sendMessageToVitreConnector' | 'canShareStream' | 'shareStream' | 'replaceShareStream' | 'stopShareStream' | 'attachStream' | 'detachStream' | 'getIceServers' | 'onSharedStream' | 'onSharedStreamRemoved' | 'close' | 'closeOnCompanion' | 'onLocalConnectorMessageReceived' | 'onMessageReceived' | 'onMenuClicked' | 'onFieldUpdated' | 'onFullscreenChanged' | 'onBorderlessChanged' | 'onYjsSynced' | 'onYjsUpdate'>;
|
|
60
|
+
export type CompanionFrame = Pick<CompanionFrameImpl, 'id' | 'appId' | 'options' | 'initOptions' | 'initiator' | 'hostInformation' | 'companionInformation' | 'state' | 'crdt' | 'blobs' | 'yjsDoc' | 'isFullscreen' | 'isBorderless' | 'position' | 'zIndex' | 'safeAreaInsets' | 'setFullscreen' | 'setWindowed' | 'setMenu' | 'sendToVitreFrame' | 'sendMessageToVitreConnector' | 'canShareStream' | 'shareStream' | 'replaceShareStream' | 'stopShareStream' | 'attachStream' | 'detachStream' | 'getIceServers' | 'onSharedStream' | 'onSharedStreamRemoved' | 'close' | 'closeOnCompanion' | 'onLocalConnectorMessageReceived' | 'onMessageReceived' | 'onMenuClicked' | 'onFieldUpdated' | 'onFullscreenChanged' | 'onBorderlessChanged' | 'onSafeAreaInsetsUpdated' | 'onYjsSynced' | 'onYjsUpdate'>;
|
|
61
61
|
/**
|
|
62
62
|
* Mirror of `initializeFrame` for the companion side. Same wire-level
|
|
63
63
|
* handshake (`connectorInitializationRequest` posted with a MessageChannel
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompanionFrame.js","sourceRoot":"","sources":["../../CompanionFrame/CompanionFrame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAI1D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,kBAAmB,SAAQ,KAAK;IACpC;;;;;;;;OAQG;IACI,2BAA2B,CAAC,OAAe,EAAE,QAAmB;QACrE,IAAI,CAAC,WAAW,CAAC;YACf,IAAI,EAAE,sBAAsB;YAC5B,gBAAgB,EAAE,IAAI,CAAC,EAAE;YACzB,OAAO;YACP,QAAQ;SACT,CAAC,CAAA;IACJ,CAAC;IAED;;;;;OAKG;IACI,gBAAgB;QACrB,IAAI,CAAC,WAAW,CAAC;YACf,IAAI,EAAE,kBAAkB;SACzB,CAAC,CAAA;IACJ,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"CompanionFrame.js","sourceRoot":"","sources":["../../CompanionFrame/CompanionFrame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAI1D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,kBAAmB,SAAQ,KAAK;IACpC;;;;;;;;OAQG;IACI,2BAA2B,CAAC,OAAe,EAAE,QAAmB;QACrE,IAAI,CAAC,WAAW,CAAC;YACf,IAAI,EAAE,sBAAsB;YAC5B,gBAAgB,EAAE,IAAI,CAAC,EAAE;YACzB,OAAO;YACP,QAAQ;SACT,CAAC,CAAA;IACJ,CAAC;IAED;;;;;OAKG;IACI,gBAAgB;QACrB,IAAI,CAAC,WAAW,CAAC;YACf,IAAI,EAAE,kBAAkB;SACzB,CAAC,CAAA;IACJ,CAAC;CACF;AAuGD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,IAKgB;IAEhB,6EAA6E;IAC7E,6EAA6E;IAC7E,8EAA8E;IAC9E,kDAAkD;IAClD,OAAO,MAAM,eAAe,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAA;AACxD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,gBAAgB,CAAC,eAAgC;IAC/D,OAAO,eAAe,CAAC,WAAW,KAAK,IAAI,CAAA;AAC7C,CAAC","sourcesContent":["import { Frame, initializeFrame } from '../Frame/Frame.js'\nimport type { InitFrameOptions, ViewOptions } from '../Frame/Frame.Model.js'\nimport type { Device, FileData, HostInformation } from '../Common/index.js'\n\n/**\n * Runtime class for a frame iframe loaded by the la Vitre **companion**.\n * Extends the shared `Frame` runtime (same wire, same lifecycle) with the two\n * send methods that ONLY make sense — and are ONLY decoded by the host — on the\n * companion side:\n *\n * - `sendMessageToVitreConnector` → host message `sendToVitreConnector`, which\n * the companion host relays to the app's Vitre-side main `Connector`\n * (`onMessageFromCompanionFrame`).\n * - `closeOnCompanion` → host message `closeOnCompanion` (local companion\n * close; the Vitre keeps its own frame).\n *\n * Both live HERE, not on `Frame`: the Vitre host does NOT decode those message\n * types, so calling them from a Vitre frame produced a \"case type not found\"\n * parse error on the Vitre. Keeping them off `Frame` makes that misuse a\n * compile error. A Vitre frame that needs to reach its own connector uses\n * `sendToLocalMainConnector` instead.\n */\nclass CompanionFrameImpl extends Frame {\n /**\n * Send a message straight to this app's Vitre-side main `Connector` — even\n * when there is NO paired Vitre frame (a local companion frame). The Vitre\n * connector receives it on `onMessageFromCompanionFrame(fromCompanionId,\n * frameConnectorId, message, fileData)`, `frameConnectorId` set to this\n * frame's id so the app can tell which companion frame spoke. Frame-side\n * counterpart of `CompanionConnector.sendMessageToVitreConnector` (which has\n * no frame id).\n */\n public sendMessageToVitreConnector(message: string, fileData?: FileData) {\n this.postMessage({\n type: 'sendToVitreConnector',\n frameConnectorId: this.id,\n message,\n fileData,\n })\n }\n\n /**\n * Close the iframe locally on the companion and remove this companion from\n * the per-frame `framePresence` on the Vitre. The Vitre keeps its own frame\n * open (`openFrame` re-shows the same frame); use `close()` to close globally.\n * See `FrameApiMessagesOut`'s `closeOnCompanion` arm doc for the rationale.\n */\n public closeOnCompanion() {\n this.postMessage({\n type: 'closeOnCompanion',\n })\n }\n}\n\n/**\n * SDK surface intended for apps running inside a frame iframe loaded by the\n * la Vitre **companion** (not by a Vitre). Mirrors the `Connector` /\n * `CompanionConnector` split: a companion frame talks to its paired Vitre frame\n * and to its own host, but has no notion of other Vitres in the space — so the\n * broadcast-style send methods (`sendMessageTo`, `sendMessageToAll`,\n * `sendKnockKnock`) and the Vitre-only side effects (`setVitreSettings`,\n * `setShareTarget`, the device-event callbacks) are deliberately not exposed.\n * Conversely, the companion-only `sendMessageToVitreConnector` /\n * `closeOnCompanion` (see {@link CompanionFrameImpl}) are exposed HERE and\n * nowhere else — in particular NOT on the Vitre `Frame`.\n *\n * `crdt` flows through the la Vitre Yjs transport identical to the Vitre side —\n * the same Y.Doc and Awareness end up in sync on the Vitre frame, on other\n * companions of the same `(appId, frameId)` presence set, and on this\n * companion. Apps using carbone or any other Y-doc-backed library can keep\n * using `createVitreSyncAdapter(frame)` unchanged — the adapter only touches\n * `frame.crdt`.\n */\nexport type CompanionFrame = Pick<\n CompanionFrameImpl,\n // Identity\n | 'id'\n | 'appId'\n | 'options'\n | 'initOptions'\n | 'initiator'\n | 'hostInformation'\n | 'companionInformation'\n | 'state'\n\n // CRDT\n | 'crdt'\n | 'blobs'\n | 'yjsDoc'\n\n // Lifecycle and visual state\n | 'isFullscreen'\n | 'isBorderless'\n | 'position'\n | 'zIndex'\n | 'safeAreaInsets'\n | 'setFullscreen'\n | 'setWindowed'\n | 'setMenu'\n\n // Send to paired Vitre frame (the only useful peer for a companion frame)\n | 'sendToVitreFrame'\n\n // Companion-only: send straight to the app's Vitre-side main Connector —\n // works even with no paired Vitre frame (a local companion frame). Lands on\n // the Vitre connector's `onMessageFromCompanionFrame`.\n | 'sendMessageToVitreConnector'\n\n // Stream share — a companion frame (e.g. a camera page opened via\n // `openCompanionFrame`) can originate a MediaStream toward the Vitre. The\n // companion host forwards it over its Vitre P2P, tagged for this app; the\n // app's Vitre frame then receives it via `onSharedStream` (reverse\n // exposure), optionally transforms it, and reshares to the space. Same\n // runtime as the Vitre `Frame` — only surfaced here in the type.\n | 'canShareStream'\n | 'shareStream'\n | 'replaceShareStream'\n | 'stopShareStream'\n | 'attachStream'\n | 'detachStream'\n // ICE/TURN config the companion host already holds (from its `WebRTCOffer`)\n // — lets a companion-camera frame open its own RTCPeerConnection directly to\n // the paired Vitre transform frame, NAT-traversing via the same relays.\n | 'getIceServers'\n // Receive a stream the host exposes into this companion frame (symmetric\n // to the Vitre side; harmless if the host never pushes one).\n | 'onSharedStream'\n | 'onSharedStreamRemoved'\n\n // Close behaviours\n // - `close` is the existing GLOBAL close (kills the Vitre frame too —\n // the same as `connector.closeFrame(frameConnectorId)`). Keep it\n // exposed for the rare app that genuinely wants to close for\n // everyone from the companion side.\n | 'close'\n // - `closeOnCompanion` is the *local* close: companion's iframe\n // unmounts + companion is removed from the frame's `framePresence`\n // on the Vitre, but the Vitre keeps its own frame open. Equivalent\n // to the late-join state: `openFrame` will re-show the same frame.\n | 'closeOnCompanion'\n\n // Inbound surface — same as Frame but only the events that fire on a\n // companion frame are useful in practice. Apps wire whichever they\n // need; the unused callbacks stay `undefined`.\n | 'onLocalConnectorMessageReceived' // messages from the paired Vitre frame\n | 'onMessageReceived' // catch-all (every inbound type)\n | 'onMenuClicked'\n | 'onFieldUpdated'\n | 'onFullscreenChanged'\n | 'onBorderlessChanged'\n | 'onSafeAreaInsetsUpdated'\n | 'onYjsSynced'\n | 'onYjsUpdate'\n>\n\n/**\n * Mirror of `initializeFrame` for the companion side. Same wire-level\n * handshake (`connectorInitializationRequest` posted with a MessageChannel\n * `port2` transferred to the parent) — the companion host's behaviour is\n * identical to the Vitre's at that protocol point (see\n * `lavitre-companion/.../CompanionApps.State.fs:postFrameInit`). It instantiates\n * the companion runtime subclass `CompanionFrameImpl`, so the returned\n * `CompanionFrame` carries the companion-only send methods; existing helpers\n * like `createVitreSyncAdapter` keep working (they only touch `frame.crdt`).\n *\n * Usage:\n * const frame = await initializeCompanionFrame((host, initiator, opts) => ({\n * name: 'My App',\n * allowFullscreen: true,\n * }))\n * frame.sendToVitreFrame({ kind: 'hello', from: 'companion' })\n * frame.closeOnCompanion()\n */\nexport async function initializeCompanionFrame(\n init: (\n info: HostInformation,\n initiator: Device,\n options: InitFrameOptions,\n state?: Record<string, any>,\n ) => ViewOptions,\n): Promise<CompanionFrame> {\n // Instantiate the companion runtime subclass. The wire protocol is identical\n // to the Vitre side at the `connectorInitializationRequest` boundary, so the\n // host (Vitre or companion) routes by its own context; the subclass just adds\n // the companion-only send methods to the surface.\n return await initializeFrame(init, CompanionFrameImpl)\n}\n\n/**\n * Convenience guard for apps that ship a single `frame.tsx` entry but want to\n * branch behaviour based on context. Reads the dedicated\n * `hostInformation.isCompanion` flag set by `lavitre-companion`\n * (CompanionApps.State.fs:buildVitreLikeHostInformation). Old hosts that\n * predate the flag omit it, in which case we conservatively return `false` and\n * the caller behaves as on a Vitre — the safer default since the Vitre surface\n * is the superset.\n *\n * Note: to USE the companion-only send methods (`sendMessageToVitreConnector`,\n * `closeOnCompanion`) you need a `CompanionFrame` from `initializeCompanionFrame`\n * (ship a dedicated companion entry). This guard only narrows behaviour/UX, not\n * the static type — a value from `initializeFrame` stays a Vitre `Frame`.\n *\n * Usage:\n * const frame = await initializeFrame(init)\n * if (isCompanionFrame(frame.hostInformation)) {\n * // Apply companion-only UX (e.g. a \"Leave this frame\" button)\n * } else {\n * // Vitre surface: sendMessageTo / sendKnockKnock / setVitreSettings / …\n * }\n */\nexport function isCompanionFrame(hostInformation: HostInformation): boolean {\n return hostInformation.isCompanion === true\n}\n"]}
|