wordinweb 0.2.5 → 0.3.1
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 +5 -1
- package/dist/{chunk-ALLQ5KWP.js → chunk-FFQBNFND.js} +24797 -7481
- package/dist/chunk-FFQBNFND.js.map +1 -0
- package/dist/collab.d.ts +109 -4
- package/dist/collab.js +572 -160
- package/dist/collab.js.map +1 -1
- package/dist/{index-CGp6gVjn.d.ts → index-C_oyKJu0.d.ts} +2529 -281
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -3
- package/package.json +1 -1
- package/dist/chunk-ALLQ5KWP.js.map +0 -1
package/dist/collab.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { X as XmlElement, D as DocxDocument, C as ClientMessage, S as ServerMessage, P as PresencePosition, R as RosterEntry, a as ParticipantProfile, I as Intent, b as IdSidecar, L as LineageHead, T as ToolbarFeature, c as ToolbarMode, d as DocxViewApi, W as WriteStatus, U as UndoOutcome } from './index-
|
|
3
|
-
export { e as bytesToB64, f as deriveEpochKeys, g as docKeyFromFragment, m as mintDocKey, s as sealCheckpoint, h as stretchShareCode } from './index-
|
|
2
|
+
import { X as XmlElement, D as DocxDocument, C as ClientMessage, S as ServerMessage, P as PresencePosition, R as RosterEntry, a as ParticipantProfile, I as Intent, b as IdSidecar, L as LineageHead, T as ToolbarFeature, c as ToolbarMode, d as DocxViewApi, W as WriteStatus, U as UndoOutcome } from './index-C_oyKJu0.js';
|
|
3
|
+
export { e as bytesToB64, f as deriveEpochKeys, g as docKeyFromFragment, m as mintDocKey, s as sealCheckpoint, h as stretchShareCode } from './index-C_oyKJu0.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* How much of the document an applied intent disturbed — the input to
|
|
@@ -206,6 +206,26 @@ interface ConnectionCallbacks {
|
|
|
206
206
|
onEpochChange?: (storedGenesisId: string, currentGenesisId: string) => void;
|
|
207
207
|
/** The session roster changed (join/leave/rename) — full snapshot. */
|
|
208
208
|
onRoster?: (roster: RosterEntry[]) => void;
|
|
209
|
+
onAgentInviteRegistered?: (invite: {
|
|
210
|
+
inviteId: string;
|
|
211
|
+
expiresAt: number;
|
|
212
|
+
}) => void;
|
|
213
|
+
onAgentInviteRefused?: (invite: {
|
|
214
|
+
inviteId: string;
|
|
215
|
+
reason: string;
|
|
216
|
+
}) => void;
|
|
217
|
+
onAgentConnected?: (agent: {
|
|
218
|
+
inviteId: string;
|
|
219
|
+
agentClientId: string;
|
|
220
|
+
profile: ParticipantProfile;
|
|
221
|
+
}) => void;
|
|
222
|
+
onAgentChat?: (message: {
|
|
223
|
+
agentClientId: string;
|
|
224
|
+
messageId: string;
|
|
225
|
+
sender: "inviter" | "agent";
|
|
226
|
+
iv: string;
|
|
227
|
+
ciphertext: string;
|
|
228
|
+
}) => void;
|
|
209
229
|
/**
|
|
210
230
|
* The connection detected that the local OPTIMISTIC replica drifted from
|
|
211
231
|
* the canonical document at quiescence and rebuilt it in place (encrypted
|
|
@@ -236,6 +256,22 @@ interface ConnectionCallbacks {
|
|
|
236
256
|
* per-intent — the connection stays perfectly usable.
|
|
237
257
|
*/
|
|
238
258
|
onSubmitDropped?: (reason: "not-ready") => void;
|
|
259
|
+
/**
|
|
260
|
+
* The QUEUED-UNDO count changed (encrypted connection only — see
|
|
261
|
+
* EncryptedCollabConnection.undoLast). An undo pressed while this client's
|
|
262
|
+
* own edits are still in flight is held until they are confirmed, so
|
|
263
|
+
* `queued` is how many presses are waiting; it drops back as they run.
|
|
264
|
+
*
|
|
265
|
+
* `expired` means the wait ran out and the held presses were DROPPED — the
|
|
266
|
+
* connection is not carrying edits to confirmation any more, and executing
|
|
267
|
+
* the undo against a stale mirror would reverse the wrong action. The
|
|
268
|
+
* consumer must show something: a press that produces nothing and says
|
|
269
|
+
* nothing is the failure this whole gate exists to remove.
|
|
270
|
+
*/
|
|
271
|
+
onUndoQueue?: (state: {
|
|
272
|
+
queued: number;
|
|
273
|
+
expired: boolean;
|
|
274
|
+
}) => void;
|
|
239
275
|
/**
|
|
240
276
|
* Something threw on an async path that has nowhere to return an error —
|
|
241
277
|
* a seal, a transport send, a persistence write. These used to die in a
|
|
@@ -338,6 +374,20 @@ interface ConnectionCallbacks {
|
|
|
338
374
|
* ClientReplica (optimistic apply + reconciliation), and relays presence.
|
|
339
375
|
* The editor layer submits local intents and reads `replica.doc`.
|
|
340
376
|
*/
|
|
377
|
+
/**
|
|
378
|
+
* The connection surface every caller actually depends on.
|
|
379
|
+
*
|
|
380
|
+
* DERIVED from CollabConnection with Pick rather than hand-written, so it
|
|
381
|
+
* cannot drift from the plaintext implementation — adding a member here is a
|
|
382
|
+
* compile error until the real class has it.
|
|
383
|
+
*
|
|
384
|
+
* It exists because EncryptedCollabConnection extends nothing: the two classes
|
|
385
|
+
* are unrelated types that happen to offer the same members, and callers
|
|
386
|
+
* bridged that with `as unknown as CollabConnection` — a claim nothing checked.
|
|
387
|
+
* Pick also drops the private fields, which are what made the two nominally
|
|
388
|
+
* incompatible in the first place.
|
|
389
|
+
*/
|
|
390
|
+
type CollabConnectionLike = Pick<CollabConnection, "join" | "resume" | "submit" | "submitPreApplied" | "ready" | "pendingCount" | "doc" | "takeRenderScope" | "setPresence" | "setProfile" | "uploadMedia" | "exportBundle" | "exportBundleAsync" | "admin" | "activity" | "registerAgentInvite" | "revokeAgentInvite" | "sendAgentChat" | "mediaMaxBlobBytes" | "docEpoch" | "docVersion" | "genesisId" | "allocIds">;
|
|
341
391
|
declare class CollabConnection {
|
|
342
392
|
private transport;
|
|
343
393
|
private clientId;
|
|
@@ -403,7 +453,14 @@ declare class CollabConnection {
|
|
|
403
453
|
profile?: ParticipantProfile;
|
|
404
454
|
codeProof?: string;
|
|
405
455
|
ownerToken?: string;
|
|
456
|
+
agentInvite?: {
|
|
457
|
+
inviteId: string;
|
|
458
|
+
token: string;
|
|
459
|
+
};
|
|
406
460
|
}): void;
|
|
461
|
+
registerAgentInvite(inviteId: string, token: string, expiresAt: number): void;
|
|
462
|
+
revokeAgentInvite(inviteId: string): void;
|
|
463
|
+
sendAgentChat(agentClientId: string, messageId: string, iv: string, ciphertext: string): void;
|
|
407
464
|
/** Owner admin op (doc 14 §2.5): honored only if this connection proved
|
|
408
465
|
* the owner token at hello — otherwise the server refuses `not-owner`. */
|
|
409
466
|
admin(action: {
|
|
@@ -706,7 +763,7 @@ declare class BundlePersister {
|
|
|
706
763
|
* every in-flight write (round-4 F8: the flush is only meaningful if it
|
|
707
764
|
* durably lands the latest state before pagehide). */
|
|
708
765
|
private chain;
|
|
709
|
-
constructor(conn:
|
|
766
|
+
constructor(conn: CollabConnectionLike, store: BundleStore, docId: string, opts?: {
|
|
710
767
|
throttleMs?: number;
|
|
711
768
|
now?: () => number;
|
|
712
769
|
setTimer?: (fn: () => void, ms: number) => unknown;
|
|
@@ -891,6 +948,18 @@ interface UseCollabOptions {
|
|
|
891
948
|
*/
|
|
892
949
|
offlineTailCap?: number;
|
|
893
950
|
}
|
|
951
|
+
interface AgentConnectionInfo {
|
|
952
|
+
inviteId: string;
|
|
953
|
+
agentClientId: string;
|
|
954
|
+
profile: ParticipantProfile;
|
|
955
|
+
}
|
|
956
|
+
interface AgentChatEnvelope {
|
|
957
|
+
agentClientId: string;
|
|
958
|
+
messageId: string;
|
|
959
|
+
sender: "inviter" | "agent";
|
|
960
|
+
iv: string;
|
|
961
|
+
ciphertext: string;
|
|
962
|
+
}
|
|
894
963
|
interface CollabSession {
|
|
895
964
|
/** The live document to render (null until the welcome arrives). */
|
|
896
965
|
doc: DocxDocument | null;
|
|
@@ -1239,8 +1308,40 @@ interface CollabSession {
|
|
|
1239
1308
|
* different message from having nothing to undo), and `unavailable` means
|
|
1240
1309
|
* this connection has no collaborative undo at all — today the plaintext
|
|
1241
1310
|
* connection, whose authority lives on the server.
|
|
1311
|
+
*
|
|
1312
|
+
* `queued` means the press was HELD until this user's own edits confirm,
|
|
1313
|
+
* because the undo stack cannot see them yet — see {@link undoQueued}.
|
|
1242
1314
|
*/
|
|
1243
1315
|
undoLast: () => UndoOutcome;
|
|
1316
|
+
/**
|
|
1317
|
+
* Undo presses waiting for this user's own edits to be confirmed. Typing
|
|
1318
|
+
* and pressing Ctrl+Z before the edit round-trips would otherwise undo an
|
|
1319
|
+
* OLDER action, so the press is held and runs on the drain.
|
|
1320
|
+
*
|
|
1321
|
+
* Nonzero is a transient, normal state — a room under load sits here for a
|
|
1322
|
+
* round trip. Consumers can show that undo is on its way; they do not have
|
|
1323
|
+
* to, because the undo does arrive.
|
|
1324
|
+
*/
|
|
1325
|
+
undoQueued: number;
|
|
1326
|
+
/**
|
|
1327
|
+
* The held undos were DROPPED because the pending edits never confirmed —
|
|
1328
|
+
* the connection stopped carrying writes, and reversing a stale action
|
|
1329
|
+
* would have been worse than doing nothing.
|
|
1330
|
+
*
|
|
1331
|
+
* This one DOES need to be visible: the user pressed Ctrl+Z and nothing
|
|
1332
|
+
* happened. It sits beside {@link writesBlocked} and {@link offline}, which
|
|
1333
|
+
* carry the reason. Cleared by the next press.
|
|
1334
|
+
*/
|
|
1335
|
+
undoExpired: boolean;
|
|
1336
|
+
agentConnections: AgentConnectionInfo[];
|
|
1337
|
+
agentChat: AgentChatEnvelope[];
|
|
1338
|
+
agentInviteError: {
|
|
1339
|
+
inviteId: string;
|
|
1340
|
+
reason: string;
|
|
1341
|
+
} | null;
|
|
1342
|
+
registerAgentInvite: (inviteId: string, token: string, expiresAt: number) => void;
|
|
1343
|
+
revokeAgentInvite: (inviteId: string) => void;
|
|
1344
|
+
sendAgentChat: (agentClientId: string, messageId: string, iv: string, ciphertext: string) => void;
|
|
1244
1345
|
}
|
|
1245
1346
|
declare function useCollab(opts: UseCollabOptions): CollabSession;
|
|
1246
1347
|
/**
|
|
@@ -1267,6 +1368,10 @@ declare function useCollab(opts: UseCollabOptions): CollabSession;
|
|
|
1267
1368
|
declare const COLLAB_TOOLBAR_DEFAULTS: Partial<Record<ToolbarFeature, boolean>>;
|
|
1268
1369
|
declare function CollabEditor(opts: UseCollabOptions & {
|
|
1269
1370
|
editable?: boolean;
|
|
1371
|
+
/** Author name stamped on comments and tracked suggestions. */
|
|
1372
|
+
commentAuthor?: string;
|
|
1373
|
+
/** Connected collaborator names offered as @mention shortcuts in comments. */
|
|
1374
|
+
commentMentions?: string[];
|
|
1270
1375
|
/** Tracked-change display. Use markup to show suggestions in the document. */
|
|
1271
1376
|
revisions?: "final" | "markup";
|
|
1272
1377
|
/** Render the Word-style ribbon toolbar above the page (default true). */
|
|
@@ -1297,4 +1402,4 @@ declare function CollabEditor(opts: UseCollabOptions & {
|
|
|
1297
1402
|
}) => ReactNode;
|
|
1298
1403
|
}): ReactNode;
|
|
1299
1404
|
|
|
1300
|
-
export { BundlePersister, type BundleStore, COLLAB_TOOLBAR_DEFAULTS, CollabEditor, type CollabSession, type DocBundle, InMemoryBundleStore, IndexedDbBundleStore, type CollabSession as InjectedCollabSession, type ParsedBundleKey, type StoredDocKind, type StoredDocSummary, UndoOutcome, type UseCollabOptions, docHash, draftKey, mediaAddressesOf, parseBundleKey, supersededKey, useCollab, versionKey };
|
|
1405
|
+
export { type AgentChatEnvelope, type AgentConnectionInfo, BundlePersister, type BundleStore, COLLAB_TOOLBAR_DEFAULTS, CollabEditor, type CollabSession, type DocBundle, InMemoryBundleStore, IndexedDbBundleStore, type CollabSession as InjectedCollabSession, type ParsedBundleKey, type StoredDocKind, type StoredDocSummary, UndoOutcome, type UseCollabOptions, docHash, draftKey, mediaAddressesOf, parseBundleKey, supersededKey, useCollab, versionKey };
|