@lavitre/apps 1.49.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/LICENSE +21 -0
- package/README.md +121 -0
- package/dist/Common/AiChannel.d.ts +59 -0
- package/dist/Common/AiChannel.js +97 -0
- package/dist/Common/AiChannel.js.map +1 -0
- package/dist/Common/BlobStore.d.ts +44 -0
- package/dist/Common/BlobStore.js +186 -0
- package/dist/Common/BlobStore.js.map +1 -0
- package/dist/Common/Common.Model.d.ts +1020 -0
- package/dist/Common/Common.Model.js +21 -0
- package/dist/Common/Common.Model.js.map +1 -0
- package/dist/Common/CrdtChannel.d.ts +198 -0
- package/dist/Common/CrdtChannel.js +659 -0
- package/dist/Common/CrdtChannel.js.map +1 -0
- package/dist/Common/Version.d.ts +21 -0
- package/dist/Common/Version.js +62 -0
- package/dist/Common/Version.js.map +1 -0
- package/dist/Common/index.d.ts +6 -0
- package/dist/Common/index.js +32 -0
- package/dist/Common/index.js.map +1 -0
- package/dist/CompanionConnector/CompanionConnector.Model.d.ts +85 -0
- package/dist/CompanionConnector/CompanionConnector.Model.js +17 -0
- package/dist/CompanionConnector/CompanionConnector.Model.js.map +1 -0
- package/dist/CompanionConnector/CompanionConnector.d.ts +28 -0
- package/dist/CompanionConnector/CompanionConnector.js +385 -0
- package/dist/CompanionConnector/CompanionConnector.js.map +1 -0
- package/dist/CompanionConnector/index.d.ts +2 -0
- package/dist/CompanionConnector/index.js +3 -0
- package/dist/CompanionConnector/index.js.map +1 -0
- package/dist/CompanionFrame/CompanionFrame.d.ts +103 -0
- package/dist/CompanionFrame/CompanionFrame.js +100 -0
- package/dist/CompanionFrame/CompanionFrame.js.map +1 -0
- package/dist/CompanionFrame/index.d.ts +1 -0
- package/dist/CompanionFrame/index.js +2 -0
- package/dist/CompanionFrame/index.js.map +1 -0
- package/dist/Connector/Connector.Model.d.ts +567 -0
- package/dist/Connector/Connector.Model.js +2 -0
- package/dist/Connector/Connector.Model.js.map +1 -0
- package/dist/Connector/Connector.d.ts +227 -0
- package/dist/Connector/Connector.js +1337 -0
- package/dist/Connector/Connector.js.map +1 -0
- package/dist/Connector/index.d.ts +2 -0
- package/dist/Connector/index.js +3 -0
- package/dist/Connector/index.js.map +1 -0
- package/dist/Frame/Frame.Model.d.ts +533 -0
- package/dist/Frame/Frame.Model.js +2 -0
- package/dist/Frame/Frame.Model.js.map +1 -0
- package/dist/Frame/Frame.d.ts +309 -0
- package/dist/Frame/Frame.js +1408 -0
- package/dist/Frame/Frame.js.map +1 -0
- package/dist/Frame/SyncAdapter.d.ts +75 -0
- package/dist/Frame/SyncAdapter.js +134 -0
- package/dist/Frame/SyncAdapter.js.map +1 -0
- package/dist/Frame/index.d.ts +3 -0
- package/dist/Frame/index.js +4 -0
- package/dist/Frame/index.js.map +1 -0
- package/dist/MediaLink/MediaLink.d.ts +178 -0
- package/dist/MediaLink/MediaLink.js +1432 -0
- package/dist/MediaLink/MediaLink.js.map +1 -0
- package/dist/MediaLink/index.d.ts +1 -0
- package/dist/MediaLink/index.js +2 -0
- package/dist/MediaLink/index.js.map +1 -0
- package/dist/Native/index.d.ts +170 -0
- package/dist/Native/index.js +19 -0
- package/dist/Native/index.js.map +1 -0
- package/dist/Version.d.ts +1 -0
- package/dist/Version.js +2 -0
- package/dist/Version.js.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Use interaction property
|
|
3
|
+
*/
|
|
4
|
+
export var FrameTouchMode;
|
|
5
|
+
(function (FrameTouchMode) {
|
|
6
|
+
// Host will only allow manipulations. Touch events will not be forwarded to the webview
|
|
7
|
+
FrameTouchMode["ReadOnly"] = "readonly";
|
|
8
|
+
FrameTouchMode["FullscreenOnly"] = "fullscreenOnly";
|
|
9
|
+
// Host will show a toggle button for interacting with the webview
|
|
10
|
+
FrameTouchMode["HostButtonInOut"] = "hostButtonInOut";
|
|
11
|
+
FrameTouchMode["HostButtonMinimizeOnFullscreen"] = "hostButtonMinimizeOnFullscreen";
|
|
12
|
+
})(FrameTouchMode || (FrameTouchMode = {}));
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Use startPosition.isFullscreen
|
|
15
|
+
*/
|
|
16
|
+
export var FrameStartMode;
|
|
17
|
+
(function (FrameStartMode) {
|
|
18
|
+
FrameStartMode["Window"] = "window";
|
|
19
|
+
FrameStartMode["Fullscreen"] = "fullscreen";
|
|
20
|
+
})(FrameStartMode || (FrameStartMode = {}));
|
|
21
|
+
//# sourceMappingURL=Common.Model.js.map
|
|
@@ -0,0 +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"]}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import * as Y from 'yjs';
|
|
2
|
+
import { Awareness } from 'y-protocols/awareness';
|
|
3
|
+
export type CrdtOutboundMessage = {
|
|
4
|
+
type: 'crdtUpdate';
|
|
5
|
+
update: ArrayBufferLike;
|
|
6
|
+
} | {
|
|
7
|
+
type: 'crdtRequestSync';
|
|
8
|
+
stateVector?: ArrayBufferLike;
|
|
9
|
+
silent?: boolean;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'crdtAwarenessUpdate';
|
|
12
|
+
update: ArrayBufferLike;
|
|
13
|
+
} | {
|
|
14
|
+
type: 'crdtRequestAwareness';
|
|
15
|
+
} | {
|
|
16
|
+
type: 'crdtSubdocUpdate';
|
|
17
|
+
guid: string;
|
|
18
|
+
update: ArrayBufferLike;
|
|
19
|
+
} | {
|
|
20
|
+
type: 'crdtSubdocRequestSync';
|
|
21
|
+
guid: string;
|
|
22
|
+
};
|
|
23
|
+
export type CrdtInboundMessage = {
|
|
24
|
+
type: 'crdtUpdate';
|
|
25
|
+
update: ArrayBufferLike;
|
|
26
|
+
} | {
|
|
27
|
+
type: 'crdtSyncComplete';
|
|
28
|
+
} | {
|
|
29
|
+
type: 'crdtAwarenessUpdate';
|
|
30
|
+
update: ArrayBufferLike;
|
|
31
|
+
} | {
|
|
32
|
+
type: 'crdtRequestSync';
|
|
33
|
+
stateVector?: ArrayBufferLike;
|
|
34
|
+
} | {
|
|
35
|
+
type: 'crdtResync';
|
|
36
|
+
} | {
|
|
37
|
+
type: 'crdtSubdocUpdate';
|
|
38
|
+
guid: string;
|
|
39
|
+
update: ArrayBufferLike;
|
|
40
|
+
} | {
|
|
41
|
+
type: 'crdtSubdocSyncComplete';
|
|
42
|
+
guid: string;
|
|
43
|
+
} | {
|
|
44
|
+
type: 'crdtSubdocTransferProgress';
|
|
45
|
+
guid: string;
|
|
46
|
+
receivedBytes: number;
|
|
47
|
+
totalBytes: number;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'crdtSubdocRequestSync';
|
|
50
|
+
guid: string;
|
|
51
|
+
};
|
|
52
|
+
export type CrdtPostMessage = (message: CrdtOutboundMessage, transfer?: Transferable[]) => void;
|
|
53
|
+
export type CrdtAttachment = {
|
|
54
|
+
dispose(): void;
|
|
55
|
+
};
|
|
56
|
+
export declare const MIN_CRDT_HOST_VERSION = "26.5.1";
|
|
57
|
+
/**
|
|
58
|
+
* Yjs sync + awareness channel piped over the la Vitre app transport.
|
|
59
|
+
*
|
|
60
|
+
* By default exposes a `doc` and `awareness` already wired to the host —
|
|
61
|
+
* simple apps just use them. Libraries that bring their own `Y.Doc` /
|
|
62
|
+
* `Awareness` (Carbone, etc.) call `attach(doc, awareness)` to swap them in.
|
|
63
|
+
*
|
|
64
|
+
* Sync messages and awareness messages travel on separate envelope types
|
|
65
|
+
* (`crdtUpdate` vs `crdtAwarenessUpdate`), so the F# host can route, throttle
|
|
66
|
+
* and log them independently.
|
|
67
|
+
*/
|
|
68
|
+
export declare class CrdtChannel {
|
|
69
|
+
private readonly postMessage;
|
|
70
|
+
private _defaultDoc;
|
|
71
|
+
private _defaultAwareness;
|
|
72
|
+
private _doc;
|
|
73
|
+
private _awareness;
|
|
74
|
+
private _docUpdateHandler;
|
|
75
|
+
private _awarenessUpdateHandler;
|
|
76
|
+
private _onSyncedListeners;
|
|
77
|
+
private _syncedFired;
|
|
78
|
+
private _onUpdateListeners;
|
|
79
|
+
private _subdocs;
|
|
80
|
+
private _subdocBytes;
|
|
81
|
+
private _onSubdocBytesListeners;
|
|
82
|
+
private _onSubdocTransferProgressListeners;
|
|
83
|
+
private _onSubdocSyncedListeners;
|
|
84
|
+
private _handshakeScheduled;
|
|
85
|
+
private _destroyed;
|
|
86
|
+
private _recoverScheduled;
|
|
87
|
+
private _resyncTimer;
|
|
88
|
+
private _subdocsRecovering;
|
|
89
|
+
constructor(postMessage: CrdtPostMessage);
|
|
90
|
+
get doc(): Y.Doc;
|
|
91
|
+
get awareness(): Awareness;
|
|
92
|
+
/** Stable numeric identifier for this peer in the Yjs awareness protocol. */
|
|
93
|
+
get clientId(): number;
|
|
94
|
+
/**
|
|
95
|
+
* Swap the default `Y.Doc` / `Awareness` for caller-provided ones. The
|
|
96
|
+
* default ones remain alive but stop syncing. Call `dispose()` on the
|
|
97
|
+
* returned handle to revert.
|
|
98
|
+
*
|
|
99
|
+
* Typical use: a library like Carbone instantiates its own Y.Doc internally
|
|
100
|
+
* and exposes a `SyncAdapter` API that takes `(doc, awareness)`. The host
|
|
101
|
+
* app forwards them straight to `attach()`.
|
|
102
|
+
*/
|
|
103
|
+
attach(doc: Y.Doc, awareness?: Awareness): CrdtAttachment;
|
|
104
|
+
/** Subscribe to every sync-complete event — fires once after the initial
|
|
105
|
+
* handshake AND again after each subsequent `attach()` re-handshake.
|
|
106
|
+
* Returns an unsubscribe function. (The listener is NOT auto-removed
|
|
107
|
+
* after the first call.) */
|
|
108
|
+
onSynced(cb: () => void): () => void;
|
|
109
|
+
/** Subscribe to every Yjs doc update — local or remote. */
|
|
110
|
+
onUpdate(cb: (update: Uint8Array) => void): () => void;
|
|
111
|
+
/**
|
|
112
|
+
* Connect a yjs SUBDOCUMENT to this transport on its own channel, keyed
|
|
113
|
+
* by `subdoc.guid`. Returns a disposer.
|
|
114
|
+
*
|
|
115
|
+
* Re-attaching the SAME `Y.Doc` instance is a no-op (returns a disposer
|
|
116
|
+
* for it). Re-attaching a DIFFERENT instance under the same guid replaces
|
|
117
|
+
* the entry (off the old handler, on the new) — last attach wins, so a
|
|
118
|
+
* stale disposer never tears down a live doc's handler.
|
|
119
|
+
*
|
|
120
|
+
* `opts.requestSync` (default true) emits the on-demand pull request. The
|
|
121
|
+
* writer of a subdoc (e.g. `BlobStore.put`) already holds the
|
|
122
|
+
* authoritative state and can pass `false` to skip a wasted round-trip.
|
|
123
|
+
*
|
|
124
|
+
* Low-level primitive — the caller drives WHEN to attach and WHAT the
|
|
125
|
+
* subdoc contains. `frame.blobs` is the convenience built on top.
|
|
126
|
+
*/
|
|
127
|
+
attachSubdoc(subdoc: Y.Doc, opts?: {
|
|
128
|
+
requestSync?: boolean;
|
|
129
|
+
}): () => void;
|
|
130
|
+
/** Subscribe to cumulative inbound bytes for a subdoc (progress bar).
|
|
131
|
+
* Fires `(guid, totalReceivedBytes)` on every inbound subdoc update. */
|
|
132
|
+
onSubdocBytes(cb: (guid: string, receivedBytes: number) => void): () => void;
|
|
133
|
+
/** Subscribe to determinate transfer progress for a subdoc whose full state
|
|
134
|
+
* is streaming in (the host reassembles WebRTC fragments and reports bytes
|
|
135
|
+
* as they land). Fires `(guid, receivedBytes, totalBytes)` repeatedly
|
|
136
|
+
* DURING the transfer, BEFORE the update is applied — unlike `onSubdocBytes`
|
|
137
|
+
* which fires once, after apply, for an atomic subdoc that arrives as a
|
|
138
|
+
* single message. `receivedBytes` is monotonic (high-water on the host) and
|
|
139
|
+
* reaches `totalBytes` (the eventual update size, in the same units) on
|
|
140
|
+
* completion → a determinate progress bar. Returns an unsubscribe function.
|
|
141
|
+
*
|
|
142
|
+
* Requires a host that emits `crdtSubdocTransferProgress`; against an older
|
|
143
|
+
* host the callback simply never fires (fall back to an indeterminate
|
|
144
|
+
* spinner gated on `onSubdocSynced`). */
|
|
145
|
+
onSubdocTransferProgress(cb: (guid: string, receivedBytes: number, totalBytes: number) => void): () => void;
|
|
146
|
+
/** One-shot-per-handshake: fires when the host reports this subdoc's
|
|
147
|
+
* initial sync is complete. */
|
|
148
|
+
onSubdocSynced(guid: string, cb: () => void): () => void;
|
|
149
|
+
/** Stop transporting a subdoc by guid (symmetric to the disposer returned
|
|
150
|
+
* by `attachSubdoc`). Safe to call for an unknown guid.
|
|
151
|
+
*
|
|
152
|
+
* Pending `onSubdocSynced` waiters are FLUSHED (invoked) before the
|
|
153
|
+
* listener set is dropped — otherwise a `BlobStore.get()` awaiting this
|
|
154
|
+
* subdoc would hang forever when the blob is removed mid-flight. The
|
|
155
|
+
* woken callback re-reads and resolves (to null for a gone subdoc). */
|
|
156
|
+
detachSubdoc(guid: string): void;
|
|
157
|
+
/** Internal — dispatched by Connector / Frame on every crdt* message. */
|
|
158
|
+
handleMessage(msg: CrdtInboundMessage): void;
|
|
159
|
+
destroy(): void;
|
|
160
|
+
private _scheduleHandshake;
|
|
161
|
+
private _emitInitialHandshake;
|
|
162
|
+
/** After applying a remote update the doc may hold structs that depend on
|
|
163
|
+
* state we never received — a CAUSAL HOLE. Yjs parks them in
|
|
164
|
+
* `store.pendingStructs`: invisible, unrendered, and on a broadcast
|
|
165
|
+
* passe-plat (no per-peer retransmit) never refilled on their own. Holes
|
|
166
|
+
* form when an earlier update was dropped during connection ramp-up, or
|
|
167
|
+
* when the sender created local structs under a suppressed origin (e.g.
|
|
168
|
+
* derived writes made while applying a remote update, which the anti-loop
|
|
169
|
+
* guard then skips) — both leave a gap in a client's clock sequence.
|
|
170
|
+
* Re-advertise our state vector (SyncStep1); a holder answers with exactly
|
|
171
|
+
* the diff we're missing and the hole closes — the same round-trip as the
|
|
172
|
+
* initial handshake. Debounced so a burst of holey updates triggers one
|
|
173
|
+
* re-sync, and we re-check `pendingStructs` after the delay so a hole that
|
|
174
|
+
* closed on its own (a reordered tail arriving) costs nothing. */
|
|
175
|
+
private _recoverIfPending;
|
|
176
|
+
/** Periodic safety-net reconcile (RESYNC_INTERVAL_MS). Re-advertise our main
|
|
177
|
+
* state vector unconditionally — this is the ONLY thing that catches silent
|
|
178
|
+
* divergence the event path misses (a lost tail with no `pendingStructs`, a
|
|
179
|
+
* back-pressure eviction, a botched reconnect): the holder replies with a
|
|
180
|
+
* diff, normally empty. `silent` keeps it off the `onSynced` path. Subdocs
|
|
181
|
+
* are re-pulled only when they actually hold a hole (a full subdoc fetch is
|
|
182
|
+
* expensive, so we don't poll them blindly). */
|
|
183
|
+
private _periodicReconcile;
|
|
184
|
+
/** Subdoc analogue of `_recoverIfPending`: a subdoc update can land on a
|
|
185
|
+
* causal hole (a missing earlier chunk) just like the main doc. Debounced
|
|
186
|
+
* per guid; re-requests the subdoc's full state (subdocs carry no SV diff
|
|
187
|
+
* on the wire — `crdtSubdocRequestSync` answers with the whole thing). */
|
|
188
|
+
private _recoverSubdocIfPending;
|
|
189
|
+
/** Yjs' `'update'` event currently emits tight Uint8Arrays — but the
|
|
190
|
+
* transferable optimization assumes `update.buffer` IS the payload.
|
|
191
|
+
* Returning an exact-fit buffer (slicing when needed) makes that
|
|
192
|
+
* assumption explicit and survives any future Yjs change that yields
|
|
193
|
+
* a view over a larger backing buffer (e.g. a pooled scratch buffer).
|
|
194
|
+
*/
|
|
195
|
+
private _exactFitBuffer;
|
|
196
|
+
private _bind;
|
|
197
|
+
private _unbind;
|
|
198
|
+
}
|