@brass-build/client 0.1.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/AGENTS.md +255 -0
- package/CHANGELOG.md +15 -0
- package/LICENSE +21 -0
- package/README.md +836 -0
- package/dist/api-fetch.d.ts +16 -0
- package/dist/api-fetch.d.ts.map +1 -0
- package/dist/api-fetch.js +97 -0
- package/dist/api-fetch.js.map +1 -0
- package/dist/api-headers.d.ts +3 -0
- package/dist/api-headers.d.ts.map +1 -0
- package/dist/api-headers.js +25 -0
- package/dist/api-headers.js.map +1 -0
- package/dist/auth-flow.d.ts +23 -0
- package/dist/auth-flow.d.ts.map +1 -0
- package/dist/auth-flow.js +76 -0
- package/dist/auth-flow.js.map +1 -0
- package/dist/client.d.ts +106 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +1278 -0
- package/dist/client.js.map +1 -0
- package/dist/doc-url-sync.d.ts +19 -0
- package/dist/doc-url-sync.d.ts.map +1 -0
- package/dist/doc-url-sync.js +181 -0
- package/dist/doc-url-sync.js.map +1 -0
- package/dist/document-branches.d.ts +32 -0
- package/dist/document-branches.d.ts.map +1 -0
- package/dist/document-branches.js +89 -0
- package/dist/document-branches.js.map +1 -0
- package/dist/document-checkpoints.d.ts +24 -0
- package/dist/document-checkpoints.d.ts.map +1 -0
- package/dist/document-checkpoints.js +115 -0
- package/dist/document-checkpoints.js.map +1 -0
- package/dist/document-commands.d.ts +93 -0
- package/dist/document-commands.d.ts.map +1 -0
- package/dist/document-commands.js +423 -0
- package/dist/document-commands.js.map +1 -0
- package/dist/document-signals.d.ts +53 -0
- package/dist/document-signals.d.ts.map +1 -0
- package/dist/document-signals.js +114 -0
- package/dist/document-signals.js.map +1 -0
- package/dist/document-streams.d.ts +22 -0
- package/dist/document-streams.d.ts.map +1 -0
- package/dist/document-streams.js +98 -0
- package/dist/document-streams.js.map +1 -0
- package/dist/document-thumbnail-capture.d.ts +27 -0
- package/dist/document-thumbnail-capture.d.ts.map +1 -0
- package/dist/document-thumbnail-capture.js +160 -0
- package/dist/document-thumbnail-capture.js.map +1 -0
- package/dist/documents-namespace.d.ts +134 -0
- package/dist/documents-namespace.d.ts.map +1 -0
- package/dist/documents-namespace.js +190 -0
- package/dist/documents-namespace.js.map +1 -0
- package/dist/documents.d.ts +146 -0
- package/dist/documents.d.ts.map +1 -0
- package/dist/documents.js +2045 -0
- package/dist/documents.js.map +1 -0
- package/dist/emitter.d.ts +15 -0
- package/dist/emitter.d.ts.map +1 -0
- package/dist/emitter.js +90 -0
- package/dist/emitter.js.map +1 -0
- package/dist/errors.d.ts +18 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +22 -0
- package/dist/errors.js.map +1 -0
- package/dist/export-guest.d.ts +9 -0
- package/dist/export-guest.d.ts.map +1 -0
- package/dist/export-guest.js +225 -0
- package/dist/export-guest.js.map +1 -0
- package/dist/fetch-retry.d.ts +16 -0
- package/dist/fetch-retry.d.ts.map +1 -0
- package/dist/fetch-retry.js +90 -0
- package/dist/fetch-retry.js.map +1 -0
- package/dist/guest-link.d.ts +3 -0
- package/dist/guest-link.d.ts.map +1 -0
- package/dist/guest-link.js +13 -0
- package/dist/guest-link.js.map +1 -0
- package/dist/handles.d.ts +57 -0
- package/dist/handles.d.ts.map +1 -0
- package/dist/handles.js +1375 -0
- package/dist/handles.js.map +1 -0
- package/dist/hosted-runtime.d.ts +33 -0
- package/dist/hosted-runtime.d.ts.map +1 -0
- package/dist/hosted-runtime.js +99 -0
- package/dist/hosted-runtime.js.map +1 -0
- package/dist/hosted-ui.d.ts +84 -0
- package/dist/hosted-ui.d.ts.map +1 -0
- package/dist/hosted-ui.js +673 -0
- package/dist/hosted-ui.js.map +1 -0
- package/dist/importer.d.ts +22 -0
- package/dist/importer.d.ts.map +1 -0
- package/dist/importer.js +54 -0
- package/dist/importer.js.map +1 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +132 -0
- package/dist/index.js.map +1 -0
- package/dist/init-keys.d.ts +3 -0
- package/dist/init-keys.d.ts.map +1 -0
- package/dist/init-keys.js +13 -0
- package/dist/init-keys.js.map +1 -0
- package/dist/internal.d.ts +6 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +17 -0
- package/dist/internal.js.map +1 -0
- package/dist/jwt.d.ts +3 -0
- package/dist/jwt.d.ts.map +1 -0
- package/dist/jwt.js +22 -0
- package/dist/jwt.js.map +1 -0
- package/dist/launch-context.d.ts +4 -0
- package/dist/launch-context.d.ts.map +1 -0
- package/dist/launch-context.js +44 -0
- package/dist/launch-context.js.map +1 -0
- package/dist/login-hint.d.ts +4 -0
- package/dist/login-hint.d.ts.map +1 -0
- package/dist/login-hint.js +63 -0
- package/dist/login-hint.js.map +1 -0
- package/dist/mutate-batching.d.ts +14 -0
- package/dist/mutate-batching.d.ts.map +1 -0
- package/dist/mutate-batching.js +65 -0
- package/dist/mutate-batching.js.map +1 -0
- package/dist/open-document.d.ts +127 -0
- package/dist/open-document.d.ts.map +1 -0
- package/dist/open-document.js +2121 -0
- package/dist/open-document.js.map +1 -0
- package/dist/page-title.d.ts +3 -0
- package/dist/page-title.d.ts.map +1 -0
- package/dist/page-title.js +32 -0
- package/dist/page-title.js.map +1 -0
- package/dist/perf.d.ts +9 -0
- package/dist/perf.d.ts.map +1 -0
- package/dist/perf.js +39 -0
- package/dist/perf.js.map +1 -0
- package/dist/presence.d.ts +62 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +331 -0
- package/dist/presence.js.map +1 -0
- package/dist/record-paging.d.ts +99 -0
- package/dist/record-paging.d.ts.map +1 -0
- package/dist/record-paging.js +220 -0
- package/dist/record-paging.js.map +1 -0
- package/dist/schema-conflict-dialog.d.ts +10 -0
- package/dist/schema-conflict-dialog.d.ts.map +1 -0
- package/dist/schema-conflict-dialog.js +164 -0
- package/dist/schema-conflict-dialog.js.map +1 -0
- package/dist/selection-persistence.d.ts +5 -0
- package/dist/selection-persistence.d.ts.map +1 -0
- package/dist/selection-persistence.js +90 -0
- package/dist/selection-persistence.js.map +1 -0
- package/dist/serializer.d.ts +3 -0
- package/dist/serializer.d.ts.map +1 -0
- package/dist/serializer.js +2 -0
- package/dist/serializer.js.map +1 -0
- package/dist/session-persistence.d.ts +4 -0
- package/dist/session-persistence.d.ts.map +1 -0
- package/dist/session-persistence.js +68 -0
- package/dist/session-persistence.js.map +1 -0
- package/dist/session-toolbar.d.ts +62 -0
- package/dist/session-toolbar.d.ts.map +1 -0
- package/dist/session-toolbar.js +1205 -0
- package/dist/session-toolbar.js.map +1 -0
- package/dist/session.d.ts +69 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +926 -0
- package/dist/session.js.map +1 -0
- package/dist/tail-ops.d.ts +28 -0
- package/dist/tail-ops.d.ts.map +1 -0
- package/dist/tail-ops.js +46 -0
- package/dist/tail-ops.js.map +1 -0
- package/dist/topic-lifecycle.d.ts +41 -0
- package/dist/topic-lifecycle.d.ts.map +1 -0
- package/dist/topic-lifecycle.js +169 -0
- package/dist/topic-lifecycle.js.map +1 -0
- package/dist/types.d.ts +22 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/undo.d.ts +18 -0
- package/dist/undo.d.ts.map +1 -0
- package/dist/undo.js +110 -0
- package/dist/undo.js.map +1 -0
- package/dist/version-bar.d.ts +22 -0
- package/dist/version-bar.d.ts.map +1 -0
- package/dist/version-bar.js +169 -0
- package/dist/version-bar.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +8 -0
- package/dist/version.js.map +1 -0
- package/dist/vite.d.ts +15 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +36 -0
- package/dist/vite.js.map +1 -0
- package/dist/ws-client.d.ts +53 -0
- package/dist/ws-client.d.ts.map +1 -0
- package/dist/ws-client.js +604 -0
- package/dist/ws-client.js.map +1 -0
- package/dist/ws-frame-limit.d.ts +21 -0
- package/dist/ws-frame-limit.d.ts.map +1 -0
- package/dist/ws-frame-limit.js +40 -0
- package/dist/ws-frame-limit.js.map +1 -0
- package/docs/app-manifest.md +65 -0
- package/docs/custom-chrome.md +147 -0
- package/docs/hosted-ui-advanced.md +77 -0
- package/docs/imported-documents.md +261 -0
- package/docs/presence.md +129 -0
- package/docs/schemas.md +135 -0
- package/docs/streams.md +248 -0
- package/package.json +60 -0
- package/scripts/prepare.mjs +50 -0
- package/src/api-fetch.ts +127 -0
- package/src/api-headers.ts +28 -0
- package/src/auth-flow.ts +125 -0
- package/src/client.ts +1457 -0
- package/src/doc-url-sync.ts +183 -0
- package/src/document-branches.ts +124 -0
- package/src/document-checkpoints.ts +135 -0
- package/src/document-commands.ts +651 -0
- package/src/document-signals.ts +234 -0
- package/src/document-streams.ts +132 -0
- package/src/document-thumbnail-capture.ts +191 -0
- package/src/documents-namespace.ts +516 -0
- package/src/documents.ts +2426 -0
- package/src/emitter.ts +129 -0
- package/src/errors.ts +45 -0
- package/src/export-guest.ts +282 -0
- package/src/fetch-retry.ts +119 -0
- package/src/guest-link.ts +14 -0
- package/src/handles.ts +1731 -0
- package/src/hosted-runtime.ts +109 -0
- package/src/hosted-ui.ts +1020 -0
- package/src/importer.ts +89 -0
- package/src/index.ts +267 -0
- package/src/init-keys.ts +15 -0
- package/src/internal.ts +23 -0
- package/src/jwt.ts +18 -0
- package/src/launch-context.ts +43 -0
- package/src/login-hint.ts +60 -0
- package/src/mutate-batching.ts +63 -0
- package/src/open-document.ts +2869 -0
- package/src/page-title.ts +33 -0
- package/src/perf.ts +46 -0
- package/src/presence.ts +471 -0
- package/src/record-paging.ts +270 -0
- package/src/schema-conflict-dialog.ts +176 -0
- package/src/selection-persistence.ts +98 -0
- package/src/serializer.ts +15 -0
- package/src/session-persistence.ts +69 -0
- package/src/session-toolbar.ts +1457 -0
- package/src/session.ts +1262 -0
- package/src/tail-ops.ts +63 -0
- package/src/topic-lifecycle.ts +217 -0
- package/src/types.ts +75 -0
- package/src/undo.ts +125 -0
- package/src/version-bar.ts +221 -0
- package/src/version.ts +8 -0
- package/src/vite.ts +49 -0
- package/src/ws-client.ts +678 -0
- package/src/ws-frame-limit.ts +52 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { DocumentHistoryResult, DocumentSettingsFocus, DocumentSettingsResult, DriveResolveResult } from './hosted-ui.js';
|
|
2
|
+
import type { BranchSummary } from './documents-namespace.js';
|
|
3
|
+
export interface HostedUiProvider {
|
|
4
|
+
documentHistory(docId: string, options?: {
|
|
5
|
+
branch?: string;
|
|
6
|
+
}): Promise<DocumentHistoryResult | null>;
|
|
7
|
+
documentSettings(docId: string, options?: {
|
|
8
|
+
focus?: DocumentSettingsFocus;
|
|
9
|
+
}): Promise<DocumentSettingsResult | null>;
|
|
10
|
+
refreshName?: (docId: string) => Promise<string | null>;
|
|
11
|
+
openSiblingDoc?: (docId: string, options: {
|
|
12
|
+
branch?: string;
|
|
13
|
+
version?: number;
|
|
14
|
+
}) => Promise<void>;
|
|
15
|
+
selectBranch?: (docId: string, options?: {
|
|
16
|
+
branch?: string;
|
|
17
|
+
}) => Promise<{
|
|
18
|
+
branch_id: string;
|
|
19
|
+
} | null>;
|
|
20
|
+
driveResolve?: (docId: string) => Promise<DriveResolveResult | null>;
|
|
21
|
+
acquireOrganization?: () => Promise<{
|
|
22
|
+
organization_id: string;
|
|
23
|
+
} | null>;
|
|
24
|
+
documentDownloadable?: (docId: string) => Promise<boolean | null>;
|
|
25
|
+
}
|
|
26
|
+
export interface Command {
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly label: string;
|
|
29
|
+
readonly group: CommandGroup;
|
|
30
|
+
readonly surface: CommandSurface;
|
|
31
|
+
readonly enabled: boolean;
|
|
32
|
+
readonly running: boolean;
|
|
33
|
+
readonly children?: readonly Command[];
|
|
34
|
+
readonly selected?: boolean;
|
|
35
|
+
run(): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
export type CommandGroup = 'session' | 'document' | 'edit';
|
|
38
|
+
export type CommandSurface = 'menu' | 'toolbar';
|
|
39
|
+
export declare function makeLiveCommand(spec: Pick<Command, 'id' | 'group' | 'surface' | 'selected'> & {
|
|
40
|
+
label: string | (() => string);
|
|
41
|
+
isEnabled?: () => boolean;
|
|
42
|
+
impl: () => Promise<void> | void;
|
|
43
|
+
}, wiring: {
|
|
44
|
+
running?: Map<string, boolean>;
|
|
45
|
+
onError: (err: unknown) => void;
|
|
46
|
+
notify?: () => void;
|
|
47
|
+
}): Command;
|
|
48
|
+
export interface CommandMenuHost {
|
|
49
|
+
docId(): string | null;
|
|
50
|
+
branchId(): string | null;
|
|
51
|
+
readOnly(): boolean;
|
|
52
|
+
isLive(): boolean;
|
|
53
|
+
canUndo(): boolean;
|
|
54
|
+
canRedo(): boolean;
|
|
55
|
+
undo(): void;
|
|
56
|
+
redo(): void;
|
|
57
|
+
checkoutVersion(version: number): Promise<void>;
|
|
58
|
+
browseVersions(): void;
|
|
59
|
+
branches(): readonly BranchSummary[];
|
|
60
|
+
hasBranchProvider(): boolean;
|
|
61
|
+
createBranch(input: {
|
|
62
|
+
name?: string;
|
|
63
|
+
from_version?: number;
|
|
64
|
+
}): Promise<BranchSummary>;
|
|
65
|
+
refreshBranches(): Promise<void>;
|
|
66
|
+
setName(name: string): void;
|
|
67
|
+
onCommandsChanged(): void;
|
|
68
|
+
}
|
|
69
|
+
export declare class CommandMenu {
|
|
70
|
+
private readonly host;
|
|
71
|
+
private _hostedUi;
|
|
72
|
+
private readonly _builtinRunning;
|
|
73
|
+
private _builtinCommands;
|
|
74
|
+
private _onError;
|
|
75
|
+
private _downloadable;
|
|
76
|
+
private _downloadableSettled;
|
|
77
|
+
private _downloadableInFlight;
|
|
78
|
+
private _downloadableAttempts;
|
|
79
|
+
private _downloadableRetryAt;
|
|
80
|
+
constructor(host: CommandMenuHost);
|
|
81
|
+
setHostedUiProvider(provider: HostedUiProvider | null): void;
|
|
82
|
+
setErrorReporter(reporter: ((err: Error) => void) | null): void;
|
|
83
|
+
get commands(): readonly Command[];
|
|
84
|
+
private _resolveDownloadable;
|
|
85
|
+
run(commandId: string): Promise<void>;
|
|
86
|
+
forkFromVersion(fromVersion: number, name?: string): Promise<void>;
|
|
87
|
+
private _builtins;
|
|
88
|
+
private _reportError;
|
|
89
|
+
private _buildCommand;
|
|
90
|
+
private _openDuplicate;
|
|
91
|
+
private _buildBranchesCommand;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=document-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-commands.d.ts","sourceRoot":"","sources":["../src/document-commands.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAK9D,MAAM,WAAW,gBAAgB;IAC/B,eAAe,CACb,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAC5B,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAAC;IAGzC,gBAAgB,CACd,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,qBAAqB,CAAA;KAAE,GAC1C,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAC;IAK1C,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAMxD,cAAc,CAAC,EAAE,CACf,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAC3C,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,YAAY,C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AAC,eAAe,CAA8B;IAI9D,OAAO,CAAC,gBAAgB,CAAmC;IAI3D,OAAO,CAAC,QAAQ,CAAuC;IAIvD,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,oBAAoB,CAAS;IACrC,OAAO,CAAC,qBAAqB,CAAS;IACtC,OAAO,CAAC,qBAAqB,CAAK;IAClC,OAAO,CAAC,oBAAoB,CAAK;gBAEJ,IAAI,EAAE,eAAe;IAElD,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,GAAG,IAAI;IAO5D,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI;IAO/D,IAAI,QAAQ,IAAI,SAAS,OAAO,EAAE,CAGjC;IAaD,OAAO,CAAC,oBAAoB;IA8BtB,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWrC,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBxE,OAAO,CAAC,SAAS;IAwHjB,OAAO,CAAC,YAAY,CAGlB;IAIF,OAAO,CAAC,aAAa;YAuBP,cAAc;IAa5B,OAAO,CAAC,qBAAqB;CAuG9B"}
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
// Document file-menu commands: the per-doc list of built-in actions a
|
|
2
|
+
// multi-doc app reads as data and places into its own chrome (Version
|
|
3
|
+
// history / Branches / Details / Share / Delete suggested for the menu,
|
|
4
|
+
// Undo / Redo suggested for the toolbar), plus the branches submenu.
|
|
5
|
+
//
|
|
6
|
+
// The SDK owns the action set, each command's live `enabled` / `running`
|
|
7
|
+
// state, and its `run()`; the app owns placement and styling. Each
|
|
8
|
+
// command carries a `surface` hint ('menu' | 'toolbar') the app is free
|
|
9
|
+
// to honor or ignore. The SDK does not render the menu itself: an app
|
|
10
|
+
// surfaces its own actions with its own buttons and calls SDK methods
|
|
11
|
+
// directly.
|
|
12
|
+
// Built-in doc-scoped command labels. The session adds 'new' / 'open'
|
|
13
|
+
// (which don't need an active doc) at its own level.
|
|
14
|
+
const DOC_COMMAND_LABELS = {
|
|
15
|
+
history: 'Version history...',
|
|
16
|
+
branches: 'Branches...',
|
|
17
|
+
// Rename / move / delete are one surface ("the document's place in the
|
|
18
|
+
// filesystem"), so they are one menu entry, not separate Details + Delete.
|
|
19
|
+
manage: 'Manage...',
|
|
20
|
+
share: 'Share...',
|
|
21
|
+
undo: 'Undo',
|
|
22
|
+
redo: 'Redo',
|
|
23
|
+
};
|
|
24
|
+
// The `share` label on a document someone can take a file away from.
|
|
25
|
+
// Taking a copy out is one row of the share dialog, beside the access
|
|
26
|
+
// roster, the way a phone's share sheet holds "save a file" next to "send
|
|
27
|
+
// to a person", so it earns a name in the entry that opens that dialog
|
|
28
|
+
// rather than a menu entry of its own. A document with no file to hand
|
|
29
|
+
// over keeps the plain label, so the entry never names a download the
|
|
30
|
+
// dialog does not offer.
|
|
31
|
+
const SHARE_WITH_DOWNLOAD_LABEL = 'Share / Download...';
|
|
32
|
+
// How many times a document's downloadable read may be attempted before the
|
|
33
|
+
// label stays as it is for the rest of the document's life, and how long a
|
|
34
|
+
// read that could not tell holds off the next attempt. The delay is what
|
|
35
|
+
// makes the retry cover the case it exists for: a session emits several
|
|
36
|
+
// times in its first second, so retrying per render would spend every
|
|
37
|
+
// attempt before the install that refused the read has landed.
|
|
38
|
+
const DOWNLOADABLE_MAX_ATTEMPTS = 3;
|
|
39
|
+
const DOWNLOADABLE_RETRY_DELAY_MS = 5000;
|
|
40
|
+
// Suggested chrome per built-in: the per-doc actions live in the file
|
|
41
|
+
// menu; Undo / Redo are toolbar buttons (the shape canvas / text apps
|
|
42
|
+
// reach for). 'branches' is built separately but shares the 'menu' hint.
|
|
43
|
+
const DOC_COMMAND_SURFACES = {
|
|
44
|
+
history: 'menu',
|
|
45
|
+
branches: 'menu',
|
|
46
|
+
manage: 'menu',
|
|
47
|
+
share: 'menu',
|
|
48
|
+
undo: 'toolbar',
|
|
49
|
+
redo: 'toolbar',
|
|
50
|
+
};
|
|
51
|
+
function commandToError(err) {
|
|
52
|
+
return err instanceof Error ? err : new Error(String(err));
|
|
53
|
+
}
|
|
54
|
+
// Assemble a live `Command`. The returned object exposes `label` /
|
|
55
|
+
// `enabled` / `running` as getters over the injected state, so one stable
|
|
56
|
+
// instance reflects state changes and reconcilers match it by reference;
|
|
57
|
+
// never spread it (`{ ...cmd }` snapshots the getters into frozen values).
|
|
58
|
+
export function makeLiveCommand(spec, wiring) {
|
|
59
|
+
const { running: map, onError, notify } = wiring;
|
|
60
|
+
const label = spec.label;
|
|
61
|
+
const readLabel = typeof label === 'function' ? label : () => label;
|
|
62
|
+
let localFlag = false;
|
|
63
|
+
const readRunning = map
|
|
64
|
+
? () => map.get(spec.id) === true
|
|
65
|
+
: () => localFlag;
|
|
66
|
+
const setRunning = (value) => {
|
|
67
|
+
if (map)
|
|
68
|
+
map.set(spec.id, value);
|
|
69
|
+
else
|
|
70
|
+
localFlag = value;
|
|
71
|
+
notify?.();
|
|
72
|
+
};
|
|
73
|
+
const isEnabled = spec.isEnabled ?? (() => !readRunning());
|
|
74
|
+
return {
|
|
75
|
+
id: spec.id,
|
|
76
|
+
group: spec.group,
|
|
77
|
+
surface: spec.surface,
|
|
78
|
+
...(spec.selected !== undefined ? { selected: spec.selected } : {}),
|
|
79
|
+
get label() {
|
|
80
|
+
return readLabel();
|
|
81
|
+
},
|
|
82
|
+
get enabled() {
|
|
83
|
+
return isEnabled();
|
|
84
|
+
},
|
|
85
|
+
get running() {
|
|
86
|
+
return readRunning();
|
|
87
|
+
},
|
|
88
|
+
async run() {
|
|
89
|
+
if (readRunning() || !isEnabled())
|
|
90
|
+
return;
|
|
91
|
+
setRunning(true);
|
|
92
|
+
try {
|
|
93
|
+
await spec.impl();
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
onError(err);
|
|
97
|
+
}
|
|
98
|
+
finally {
|
|
99
|
+
setRunning(false);
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export class CommandMenu {
|
|
105
|
+
host;
|
|
106
|
+
// Hosted-UI provider for built-in commands. `null` until the factory
|
|
107
|
+
// wires it; the built-ins' `enabled` rule reads `_hostedUi !== null`
|
|
108
|
+
// so they disable in tests / offline flows.
|
|
109
|
+
_hostedUi = null;
|
|
110
|
+
// Per-built-in `running` flag, set during a command's `run()` and
|
|
111
|
+
// cleared after. Drives the pending-affordance UI.
|
|
112
|
+
_builtinRunning = new Map();
|
|
113
|
+
// Lazily-built built-in command instances. The `Command` shape
|
|
114
|
+
// exposes getters that read live state (`enabled` / `running`), so
|
|
115
|
+
// the same object reflects state changes without recreating.
|
|
116
|
+
_builtinCommands = null;
|
|
117
|
+
// Optional error reporter for built-in command failures. Wired by
|
|
118
|
+
// the factory to `Brass.onError`'s emit path; `null` falls back
|
|
119
|
+
// to `console.error`.
|
|
120
|
+
_onError = null;
|
|
121
|
+
// Whether this document has a file someone can take away, which is what
|
|
122
|
+
// the `share` label names. `false` until the read lands, so the entry
|
|
123
|
+
// only ever promises what is confirmed.
|
|
124
|
+
_downloadable = false;
|
|
125
|
+
_downloadableSettled = false;
|
|
126
|
+
_downloadableInFlight = false;
|
|
127
|
+
_downloadableAttempts = 0;
|
|
128
|
+
_downloadableRetryAt = 0;
|
|
129
|
+
constructor(host) {
|
|
130
|
+
this.host = host;
|
|
131
|
+
}
|
|
132
|
+
setHostedUiProvider(provider) {
|
|
133
|
+
this._hostedUi = provider;
|
|
134
|
+
}
|
|
135
|
+
// Optional error sink for the doc's built-in commands. Wired by
|
|
136
|
+
// the factory to `Brass.onError`'s emit path so async failures
|
|
137
|
+
// surface through one stream. `null` falls back to `console.error`.
|
|
138
|
+
setErrorReporter(reporter) {
|
|
139
|
+
this._onError = reporter;
|
|
140
|
+
}
|
|
141
|
+
// The per-doc file menu, as data. Each Document carries its own list
|
|
142
|
+
// with its own `running` state; multi-doc apps render one menu per
|
|
143
|
+
// pane. The app filters by `surface` to place each command.
|
|
144
|
+
get commands() {
|
|
145
|
+
this._resolveDownloadable();
|
|
146
|
+
return this._builtins();
|
|
147
|
+
}
|
|
148
|
+
// Ask, on a read of the list, whether this document has a file to hand
|
|
149
|
+
// over. Reading the list is what every menu renderer does as it mounts,
|
|
150
|
+
// so the answer lands long before a reader opens the menu, while an app
|
|
151
|
+
// that renders no menu never spends the request.
|
|
152
|
+
//
|
|
153
|
+
// A read that could not tell (`null`: refused, or failed) leaves the
|
|
154
|
+
// plain `Share...` label and lets a later render try again, because the
|
|
155
|
+
// moment it is most likely to be refused is the first create in an
|
|
156
|
+
// organization, where the install lands seconds afterwards and the
|
|
157
|
+
// document becomes readable. The delay and the attempt cap are what keep
|
|
158
|
+
// that to a few spaced requests rather than one per render.
|
|
159
|
+
_resolveDownloadable() {
|
|
160
|
+
if (this._downloadableSettled || this._downloadableInFlight)
|
|
161
|
+
return;
|
|
162
|
+
if (this._downloadableAttempts >= DOWNLOADABLE_MAX_ATTEMPTS)
|
|
163
|
+
return;
|
|
164
|
+
if (Date.now() < this._downloadableRetryAt)
|
|
165
|
+
return;
|
|
166
|
+
const resolve = this._hostedUi?.documentDownloadable;
|
|
167
|
+
const docId = this.host.docId();
|
|
168
|
+
if (!resolve || docId === null)
|
|
169
|
+
return;
|
|
170
|
+
this._downloadableAttempts++;
|
|
171
|
+
this._downloadableInFlight = true;
|
|
172
|
+
void resolve(docId).then((downloadable) => {
|
|
173
|
+
this._downloadableInFlight = false;
|
|
174
|
+
if (downloadable === null) {
|
|
175
|
+
this._downloadableRetryAt = Date.now() + DOWNLOADABLE_RETRY_DELAY_MS;
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
this._downloadableSettled = true;
|
|
179
|
+
if (downloadable === this._downloadable)
|
|
180
|
+
return;
|
|
181
|
+
this._downloadable = downloadable;
|
|
182
|
+
this.host.onCommandsChanged();
|
|
183
|
+
}, () => {
|
|
184
|
+
this._downloadableInFlight = false;
|
|
185
|
+
this._downloadableRetryAt = Date.now() + DOWNLOADABLE_RETRY_DELAY_MS;
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
// Invoke a command by id. A convenience for keyboard shortcuts
|
|
189
|
+
// (`Ctrl-Z` -> `doc.run('undo')`). No-op for an unknown id.
|
|
190
|
+
async run(commandId) {
|
|
191
|
+
const command = this.commands.find((c) => c.id === commandId);
|
|
192
|
+
if (command)
|
|
193
|
+
await command.run();
|
|
194
|
+
}
|
|
195
|
+
// Fork a new branch from a historical version and switch to it. Drives
|
|
196
|
+
// the hosted version bar's "Branch from here": create the branch at
|
|
197
|
+
// `fromVersion` (with the bar-supplied initial `name`, e.g. the version's
|
|
198
|
+
// timestamp), then open it via the same instance-swap the branches
|
|
199
|
+
// submenu's create uses. No-op without a hosted provider (offline /
|
|
200
|
+
// tests) or an open doc.
|
|
201
|
+
async forkFromVersion(fromVersion, name) {
|
|
202
|
+
const hosted = this._hostedUi;
|
|
203
|
+
const docId = this.host.docId();
|
|
204
|
+
if (!hosted || docId === null)
|
|
205
|
+
return;
|
|
206
|
+
const created = await this.host.createBranch({
|
|
207
|
+
from_version: fromVersion,
|
|
208
|
+
...(name ? { name } : {}),
|
|
209
|
+
});
|
|
210
|
+
if (hosted.openSiblingDoc) {
|
|
211
|
+
await hosted.openSiblingDoc(docId, { branch: created.branch_id });
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// Internal: lazy-build the doc-scoped built-in command list. The
|
|
215
|
+
// returned `Command` objects have getters that read live state, so
|
|
216
|
+
// an `enabled` / `running` change is reflected without recreating.
|
|
217
|
+
_builtins() {
|
|
218
|
+
if (this._builtinCommands !== null)
|
|
219
|
+
return this._builtinCommands;
|
|
220
|
+
const hasHostedUi = () => this._hostedUi !== null;
|
|
221
|
+
const editable = () => !this.host.readOnly() && this.host.isLive();
|
|
222
|
+
const list = [
|
|
223
|
+
this._buildCommand('history', DOC_COMMAND_LABELS.history, 'document', DOC_COMMAND_SURFACES.history, hasHostedUi, async () => {
|
|
224
|
+
const hosted = this._hostedUi;
|
|
225
|
+
const docId = this.host.docId();
|
|
226
|
+
if (!hosted || docId === null)
|
|
227
|
+
return;
|
|
228
|
+
const branchId = this.host.branchId();
|
|
229
|
+
const result = await hosted.documentHistory(docId, branchId ? { branch: branchId } : undefined);
|
|
230
|
+
if (!result)
|
|
231
|
+
return;
|
|
232
|
+
// Same-branch version preview folds onto this doc in place.
|
|
233
|
+
// Cross-branch / fork outcomes can't (they switch state
|
|
234
|
+
// entirely), so delegate to `openSiblingDoc`. Discriminate on
|
|
235
|
+
// `typeof === 'number'`, not `!== undefined`: the hosted embed
|
|
236
|
+
// evolves independently, and a fork serialized as `version: null`
|
|
237
|
+
// (a natural JSON shape) must not be misread as a version open,
|
|
238
|
+
// which would drop the user into a read-only checkout at a bogus
|
|
239
|
+
// version instead of their new editable branch.
|
|
240
|
+
const version = typeof result.version === 'number' ? result.version : null;
|
|
241
|
+
// Browse-in-the-app carries no version: it opens the host's
|
|
242
|
+
// version surface where the reader already is, so it is checked
|
|
243
|
+
// before the version / fork split rather than falling into the
|
|
244
|
+
// fork branch on its absent version.
|
|
245
|
+
if (version === null && result.browse === true) {
|
|
246
|
+
this.host.browseVersions();
|
|
247
|
+
}
|
|
248
|
+
else if (version !== null && result.branch_id === branchId) {
|
|
249
|
+
await this.host.checkoutVersion(version);
|
|
250
|
+
}
|
|
251
|
+
else if (hosted.openSiblingDoc) {
|
|
252
|
+
await hosted.openSiblingDoc(docId, {
|
|
253
|
+
branch: result.branch_id,
|
|
254
|
+
...(version !== null ? { version } : {}),
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
}),
|
|
258
|
+
this._buildBranchesCommand(),
|
|
259
|
+
this._buildCommand('share', () => this._downloadable
|
|
260
|
+
? SHARE_WITH_DOWNLOAD_LABEL
|
|
261
|
+
: DOC_COMMAND_LABELS.share, 'document', DOC_COMMAND_SURFACES.share, hasHostedUi, async () => {
|
|
262
|
+
const hosted = this._hostedUi;
|
|
263
|
+
const docId = this.host.docId();
|
|
264
|
+
if (!hosted || docId === null)
|
|
265
|
+
return;
|
|
266
|
+
// The two surfaces are one dialog with a cross-link, so a
|
|
267
|
+
// duplicate started from Share reports its copy here too.
|
|
268
|
+
const outcome = await hosted.documentSettings(docId, {
|
|
269
|
+
focus: 'share',
|
|
270
|
+
});
|
|
271
|
+
await this._openDuplicate(outcome);
|
|
272
|
+
}),
|
|
273
|
+
// Last of the document's entries, because it is the one holding a
|
|
274
|
+
// delete.
|
|
275
|
+
this._buildCommand('manage', DOC_COMMAND_LABELS.manage, 'document', DOC_COMMAND_SURFACES.manage, hasHostedUi, async () => {
|
|
276
|
+
const hosted = this._hostedUi;
|
|
277
|
+
const docId = this.host.docId();
|
|
278
|
+
if (!hosted || docId === null)
|
|
279
|
+
return;
|
|
280
|
+
// The Manage surface is rename + move + duplicate + delete in
|
|
281
|
+
// one. A delete there ends via the server's `doc_gone` frame
|
|
282
|
+
// (routed into `close()`); a rename is reflected by the
|
|
283
|
+
// refreshName pull below.
|
|
284
|
+
const outcome = await hosted.documentSettings(docId, {
|
|
285
|
+
focus: 'details',
|
|
286
|
+
});
|
|
287
|
+
if (await this._openDuplicate(outcome))
|
|
288
|
+
return;
|
|
289
|
+
if (hosted.refreshName) {
|
|
290
|
+
const newName = await hosted.refreshName(docId);
|
|
291
|
+
if (newName !== null)
|
|
292
|
+
this.host.setName(newName);
|
|
293
|
+
}
|
|
294
|
+
}),
|
|
295
|
+
this._buildCommand('undo', DOC_COMMAND_LABELS.undo, 'edit', DOC_COMMAND_SURFACES.undo, () => editable() && this.host.canUndo(), () => {
|
|
296
|
+
this.host.undo();
|
|
297
|
+
}),
|
|
298
|
+
this._buildCommand('redo', DOC_COMMAND_LABELS.redo, 'edit', DOC_COMMAND_SURFACES.redo, () => editable() && this.host.canRedo(), () => {
|
|
299
|
+
this.host.redo();
|
|
300
|
+
}),
|
|
301
|
+
];
|
|
302
|
+
this._builtinCommands = list;
|
|
303
|
+
return list;
|
|
304
|
+
}
|
|
305
|
+
_reportError = (err) => {
|
|
306
|
+
if (this._onError)
|
|
307
|
+
this._onError(commandToError(err));
|
|
308
|
+
else
|
|
309
|
+
console.error('[Brass] doc command failed:', err);
|
|
310
|
+
};
|
|
311
|
+
// Build a single command over the shared per-id running map, notifying
|
|
312
|
+
// the host on each flip so the menu re-renders.
|
|
313
|
+
_buildCommand(id, label, group, surface, isEnabled, impl) {
|
|
314
|
+
return makeLiveCommand({ id, label, group, surface, isEnabled, impl }, {
|
|
315
|
+
running: this._builtinRunning,
|
|
316
|
+
onError: this._reportError,
|
|
317
|
+
notify: () => this.host.onCommandsChanged(),
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
// Open the copy a settings-surface duplicate produced. The copy is a
|
|
321
|
+
// different document, not another state of this one, so it goes through
|
|
322
|
+
// the same coordinator a branch switch does. Reports whether it opened,
|
|
323
|
+
// so a caller can skip the follow-up reads that describe the doc it just
|
|
324
|
+
// navigated away from.
|
|
325
|
+
async _openDuplicate(outcome) {
|
|
326
|
+
const hosted = this._hostedUi;
|
|
327
|
+
if (!outcome || !hosted?.openSiblingDoc)
|
|
328
|
+
return false;
|
|
329
|
+
await hosted.openSiblingDoc(outcome.newDocId, {});
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
// Build the branches submenu command. The parent is always present
|
|
333
|
+
// (enabled when the doc has a hostedUi provider for openSiblingDoc);
|
|
334
|
+
// its children are rebuilt dynamically from `doc.branches` on every
|
|
335
|
+
// access so the menu tracks branch creation / refresh reactively.
|
|
336
|
+
_buildBranchesCommand() {
|
|
337
|
+
const isEnabled = () => this._hostedUi !== null;
|
|
338
|
+
const readRunning = () => this._builtinRunning.get('branches') === true;
|
|
339
|
+
const buildChild = (id, label, selected, impl) => makeLiveCommand({
|
|
340
|
+
id,
|
|
341
|
+
label,
|
|
342
|
+
group: 'document',
|
|
343
|
+
surface: DOC_COMMAND_SURFACES.branches,
|
|
344
|
+
selected,
|
|
345
|
+
impl,
|
|
346
|
+
}, { onError: this._reportError });
|
|
347
|
+
const buildChildren = () => {
|
|
348
|
+
const items = [];
|
|
349
|
+
const docId = this.host.docId();
|
|
350
|
+
const branchId = this.host.branchId();
|
|
351
|
+
for (const b of this.host.branches()) {
|
|
352
|
+
const isCurrent = b.branch_id === branchId;
|
|
353
|
+
items.push(buildChild(`branch:${b.branch_id}`, b.name, isCurrent, async () => {
|
|
354
|
+
if (isCurrent)
|
|
355
|
+
return;
|
|
356
|
+
const hosted = this._hostedUi;
|
|
357
|
+
if (hosted?.openSiblingDoc && docId) {
|
|
358
|
+
await hosted.openSiblingDoc(docId, {
|
|
359
|
+
branch: b.branch_id,
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
}));
|
|
363
|
+
}
|
|
364
|
+
if (this.host.hasBranchProvider() && docId !== null) {
|
|
365
|
+
items.push(buildChild('branch:new', 'New branch...', false, async () => {
|
|
366
|
+
await this.host.createBranch({});
|
|
367
|
+
const branches = this.host.branches();
|
|
368
|
+
const newest = branches[branches.length - 1];
|
|
369
|
+
if (newest) {
|
|
370
|
+
const hosted = this._hostedUi;
|
|
371
|
+
if (hosted?.openSiblingDoc && docId) {
|
|
372
|
+
await hosted.openSiblingDoc(docId, {
|
|
373
|
+
branch: newest.branch_id,
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}));
|
|
378
|
+
}
|
|
379
|
+
return items;
|
|
380
|
+
};
|
|
381
|
+
return {
|
|
382
|
+
id: 'branches',
|
|
383
|
+
label: DOC_COMMAND_LABELS.branches,
|
|
384
|
+
group: 'document',
|
|
385
|
+
surface: DOC_COMMAND_SURFACES.branches,
|
|
386
|
+
get enabled() {
|
|
387
|
+
return isEnabled();
|
|
388
|
+
},
|
|
389
|
+
get running() {
|
|
390
|
+
return readRunning();
|
|
391
|
+
},
|
|
392
|
+
get children() {
|
|
393
|
+
return buildChildren();
|
|
394
|
+
},
|
|
395
|
+
run: async () => {
|
|
396
|
+
const hosted = this._hostedUi;
|
|
397
|
+
const docId = this.host.docId();
|
|
398
|
+
if (!hosted || !docId)
|
|
399
|
+
return;
|
|
400
|
+
if (hosted.selectBranch) {
|
|
401
|
+
const branchId = this.host.branchId();
|
|
402
|
+
const result = await hosted.selectBranch(docId, branchId ? { branch: branchId } : undefined);
|
|
403
|
+
if (result && result.branch_id !== branchId && hosted.openSiblingDoc) {
|
|
404
|
+
// A different branch was chosen: reopening on it reloads the
|
|
405
|
+
// branch list as part of the open.
|
|
406
|
+
await hosted.openSiblingDoc(docId, {
|
|
407
|
+
branch: result.branch_id,
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
// No switch (dialog dismissed, or the active branch re-picked).
|
|
412
|
+
// The dialog can rename / set-default in place, so re-pull the
|
|
413
|
+
// list; a rename of the current branch otherwise leaves the
|
|
414
|
+
// branch chip + page title stale (they read the name from the
|
|
415
|
+
// cached list, which the dialog never touches).
|
|
416
|
+
await this.host.refreshBranches();
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
//# sourceMappingURL=document-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-commands.js","sourceRoot":"","sources":["../src/document-commands.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,wEAAwE;AACxE,qEAAqE;AACrE,EAAE;AACF,yEAAyE;AACzE,mEAAmE;AACnE,wEAAwE;AACxE,sEAAsE;AACtE,sEAAsE;AACtE,YAAY;AA8GZ,sEAAsE;AACtE,qDAAqD;AACrD,MAAM,kBAAkB,GAAG;IACzB,OAAO,EAAE,oBAAoB;IAC7B,QAAQ,EAAE,aAAa;IACvB,uEAAuE;IACvE,2EAA2E;IAC3E,M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AI,MAAM,CAAC,SAAS,KAAK,QAAQ,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;wBACrE,6DAA6D;wBAC7D,mCAAmC;wBACnC,MAAM,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE;4BACjC,MAAM,EAAE,MAAM,CAAC,SAAS;yBACzB,CAAC,CAAC;oBACL,CAAC;yBAAM,CAAC;wBACN,gEAAgE;wBAChE,+DAA+D;wBAC/D,4DAA4D;wBAC5D,8DAA8D;wBAC9D,gDAAgD;wBAChD,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;oBACpC,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export type DocumentGoneReason = 'deleted' | 'moved';
|
|
2
|
+
export type DocumentGoneListener = (reason: DocumentGoneReason) => void;
|
|
3
|
+
export type DocumentGoneUnsubscribe = () => void;
|
|
4
|
+
export interface DocumentWorkStatus {
|
|
5
|
+
message: string;
|
|
6
|
+
progress?: number;
|
|
7
|
+
pending: boolean;
|
|
8
|
+
blocking?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type DocumentStatusListener = (status: DocumentWorkStatus) => void;
|
|
11
|
+
export type DocumentStatusUnsubscribe = () => void;
|
|
12
|
+
export type DocumentDriveTrackingState = 'unhydrated' | 'synced' | 'ahead' | 'behind' | 'diverged';
|
|
13
|
+
export type DriveMirrorDirection = 'two_way' | 'import_only';
|
|
14
|
+
export interface DocumentDriveStatus {
|
|
15
|
+
driveType: string;
|
|
16
|
+
driveName: string;
|
|
17
|
+
state: DocumentDriveTrackingState;
|
|
18
|
+
canPush: boolean;
|
|
19
|
+
label: string | null;
|
|
20
|
+
detail: string | null;
|
|
21
|
+
broken: boolean;
|
|
22
|
+
pushReplacesRemote: boolean;
|
|
23
|
+
mirrorDirection: DriveMirrorDirection;
|
|
24
|
+
ref: string;
|
|
25
|
+
refUpdatedAt: string;
|
|
26
|
+
itemName: string;
|
|
27
|
+
itemUrl: string;
|
|
28
|
+
publishing: boolean;
|
|
29
|
+
}
|
|
30
|
+
export type DocumentDriveStatusListener = (status: DocumentDriveStatus) => void;
|
|
31
|
+
export type DocumentDriveStatusUnsubscribe = () => void;
|
|
32
|
+
export declare class GoneSignal {
|
|
33
|
+
private readonly _emitter;
|
|
34
|
+
get reason(): DocumentGoneReason | null;
|
|
35
|
+
on(cb: DocumentGoneListener): DocumentGoneUnsubscribe;
|
|
36
|
+
mark(reason: DocumentGoneReason): void;
|
|
37
|
+
clearListeners(): void;
|
|
38
|
+
}
|
|
39
|
+
export declare class WorkStatusSignal {
|
|
40
|
+
private readonly _emitter;
|
|
41
|
+
get status(): DocumentWorkStatus | null;
|
|
42
|
+
on(cb: DocumentStatusListener): DocumentStatusUnsubscribe;
|
|
43
|
+
emit(status: DocumentWorkStatus): void;
|
|
44
|
+
clearListeners(): void;
|
|
45
|
+
}
|
|
46
|
+
export declare class DriveStatusSignal {
|
|
47
|
+
private readonly _emitter;
|
|
48
|
+
get status(): DocumentDriveStatus | null;
|
|
49
|
+
on(cb: DocumentDriveStatusListener): DocumentDriveStatusUnsubscribe;
|
|
50
|
+
emit(status: DocumentDriveStatus): void;
|
|
51
|
+
clearListeners(): void;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=document-signals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-signals.d.ts","sourceRoot":"","sources":["../src/document-signals.ts"],"names":[],"mappings":"AAeA,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,OAAO,CAAC;AAErD,MAAM,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;AACxE,MAAM,MAAM,uBAAuB,GAAG,MAAM,IAAI,CAAC;AAOjD,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,O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