@bendyline/docblocks 2.2.0 → 2.2.2
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/THIRD_PARTY_NOTICES.txt +1911 -0
- package/dist/{chunk-M2PUNKHS.js → chunk-2WDJ27EH.js} +26 -0
- package/dist/filesystem/electron.d.ts +1 -1
- package/dist/filesystem/electron.js +1 -1
- package/dist/filesystem/index.d.ts +1 -1
- package/dist/filesystem/index.js +1 -1
- package/dist/host/index.d.ts +11 -3
- package/dist/host/index.js +7 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -2
- package/dist/{types-Cv4uiosG.d.ts → types-CHhtLOXM.d.ts} +27 -1
- package/dist/vscode/index.d.ts +24 -2
- package/dist/vscode/index.js +45 -4
- package/dist/workspace/index.d.ts +1 -1
- package/package.json +8 -4
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/host/wire-policy.ts
|
|
2
|
+
var MAX_HOST_PINNED_DOCUMENTS = 50;
|
|
2
3
|
var HOST_WIRE_LIMITS = Object.freeze({
|
|
3
4
|
identifierCharacters: 256,
|
|
4
5
|
labelCharacters: 1024,
|
|
@@ -37,6 +38,29 @@ function parseOpenRequest(value) {
|
|
|
37
38
|
}
|
|
38
39
|
return null;
|
|
39
40
|
}
|
|
41
|
+
function parsePinnedMenuDocuments(value) {
|
|
42
|
+
if (!Array.isArray(value)) return [];
|
|
43
|
+
const documents = [];
|
|
44
|
+
const seen = /* @__PURE__ */ new Set();
|
|
45
|
+
for (const entry of value) {
|
|
46
|
+
if (documents.length >= MAX_HOST_PINNED_DOCUMENTS) break;
|
|
47
|
+
if (typeof entry !== "object" || entry === null || Array.isArray(entry)) continue;
|
|
48
|
+
const record = entry;
|
|
49
|
+
if (!hasExactKeys(record, ["workspaceId", "workspaceName", "path"])) continue;
|
|
50
|
+
if (!isBoundedString(record.workspaceId, HOST_WIRE_LIMITS.identifierCharacters, 1)) continue;
|
|
51
|
+
if (!isBoundedString(record.workspaceName, HOST_WIRE_LIMITS.labelCharacters, 1)) continue;
|
|
52
|
+
if (!isBoundedString(record.path, HOST_WIRE_LIMITS.pathCharacters, 1)) continue;
|
|
53
|
+
const key = `${record.workspaceId}\0${record.path}`;
|
|
54
|
+
if (seen.has(key)) continue;
|
|
55
|
+
seen.add(key);
|
|
56
|
+
documents.push({
|
|
57
|
+
workspaceId: record.workspaceId,
|
|
58
|
+
workspaceName: record.workspaceName,
|
|
59
|
+
path: record.path
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return documents;
|
|
63
|
+
}
|
|
40
64
|
function parseExternalHttpUrl(value) {
|
|
41
65
|
if (!isBoundedString(value, HOST_WIRE_LIMITS.urlCharacters, 1)) return null;
|
|
42
66
|
try {
|
|
@@ -65,10 +89,12 @@ function isTrustedRendererUrl(value, developmentOrigin) {
|
|
|
65
89
|
}
|
|
66
90
|
|
|
67
91
|
export {
|
|
92
|
+
MAX_HOST_PINNED_DOCUMENTS,
|
|
68
93
|
HOST_WIRE_LIMITS,
|
|
69
94
|
isBoundedString,
|
|
70
95
|
isBoundedBytePayload,
|
|
71
96
|
parseOpenRequest,
|
|
97
|
+
parsePinnedMenuDocuments,
|
|
72
98
|
parseExternalHttpUrl,
|
|
73
99
|
isTrustedRendererUrl
|
|
74
100
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { s as FileSystemProviderV2, r as FileSystemProviderCapabilities, k as FileSystemEntrySnapshot, m as FileSystemFileRead, K as FileSystemWriteOptions, n as FileSystemFileSnapshot, g as FileSystemCreateDirectoryOptions, h as FileSystemDirectorySnapshot, u as FileSystemRemoveOptions, v as FileSystemRemoveResult, o as FileSystemMoveOptions, w as FileSystemSnapshot, C as FileSystemWatchEvent, H as FileSystemWatchOptions, I as FileSystemWatchSubscription, q as FileSystemProvider, F as FileCommitResult, j as FileSystemEntry, b as FileMeta } from '../types-BEg5SQ1_.js';
|
|
2
2
|
import { a as WorkspacePath } from '../workspace-path-CWVrcuPL.js';
|
|
3
3
|
export { isElectronHost } from '../host/index.js';
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../types-CHhtLOXM.js';
|
|
5
5
|
|
|
6
6
|
/** Pure renderer-side client for the typed Electron filesystem v2 transport. */
|
|
7
7
|
declare class ElectronFileSystemProviderV2 implements FileSystemProviderV2 {
|
|
@@ -10,7 +10,7 @@ import { MediaProvider } from '@bendyline/squisq/schemas';
|
|
|
10
10
|
export { NativeFileSystemMovePathState, NativeFileSystemMoveRecoveryError, NativeFileSystemMoveRecoveryState, NativeFileSystemProvider, NativeFileSystemProviderV2, isNativeFileSystemSupported, loadDirectoryHandle, openNativeFolder, removeDirectoryHandle, restoreNativeFolder, storeDirectoryHandle } from './native.js';
|
|
11
11
|
export { ElectronFileSystemProvider, ElectronFileSystemProviderV2 } from './electron.js';
|
|
12
12
|
export { isElectronHost } from '../host/index.js';
|
|
13
|
-
import '../types-
|
|
13
|
+
import '../types-CHhtLOXM.js';
|
|
14
14
|
|
|
15
15
|
interface DecodeUtf8TextOptions {
|
|
16
16
|
/** User-facing description of the payload being decoded. */
|
package/dist/filesystem/index.js
CHANGED
package/dist/host/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { a as DocBlocksHostExportAPI, b as DocBlocksHostExternalAPI, c as DocBlocksHostFfmpegAPI, d as DocBlocksHostFsAPI, e as DocBlocksHostFsV2API, f as DocBlocksHostGitAPI, g as DocBlocksHostLifecycleAPI, h as
|
|
1
|
+
import { P as OpenRequest, L as HostPinnedDocument, D as DocBlocksHostAPI } from '../types-CHhtLOXM.js';
|
|
2
|
+
export { a as DocBlocksHostExportAPI, b as DocBlocksHostExternalAPI, c as DocBlocksHostFfmpegAPI, d as DocBlocksHostFsAPI, e as DocBlocksHostFsV2API, f as DocBlocksHostGitAPI, g as DocBlocksHostLifecycleAPI, h as DocBlocksHostMenuAPI, i as DocBlocksHostShellAPI, j as DocBlocksHostUpdaterAPI, k as DocBlocksHostWorkspacesAPI, E as ELECTRON_FILE_SYSTEM_V2_CAPABILITIES, l as ElectronWorkspaceInfo, m as ExternalBinaryCommitResult, G as GitBranchInfo, n as GitCapabilities, o as GitCloneHandle, p as GitCloneProgress, q as GitError, r as GitErrorCode, s as GitFileAtRevision, t as GitFileChange, u as GitFileStatusCode, v as GitLogEntry, w as GitLogOptions, x as GitRemoteInfo, y as GitRepoDetection, z as GitResult, A as GitRevision, B as GitStatus, H as HostCloseReason, C as HostEnvironment, F as HostExportTargetGrant, I as HostFileSystemV2OpenRequest, J as HostFileSystemV2Result, K as HostFileSystemV2WatchMessage, M as HostPrepareCloseRequest, N as HostPrepareCloseResult, O as MenuCommand, U as UpdateCheckResult, Q as UpdateInstallResult, R as UpdaterStatus } from '../types-CHhtLOXM.js';
|
|
3
3
|
import '../types-BEg5SQ1_.js';
|
|
4
4
|
import '../workspace-path-CWVrcuPL.js';
|
|
5
5
|
|
|
6
|
+
/** Upper bound on shortcuts mirrored into the native menu, to keep it usable. */
|
|
7
|
+
declare const MAX_HOST_PINNED_DOCUMENTS = 50;
|
|
6
8
|
/** Quantitative limits shared by privileged host boundaries. */
|
|
7
9
|
declare const HOST_WIRE_LIMITS: Readonly<{
|
|
8
10
|
identifierCharacters: 256;
|
|
@@ -19,6 +21,12 @@ declare function isBoundedString(value: unknown, maximumCharacters: number, mini
|
|
|
19
21
|
declare function isBoundedBytePayload(value: unknown, maximumBytes?: number): value is ArrayBuffer | Uint8Array;
|
|
20
22
|
/** Parse one exact, bounded main-to-renderer open request. */
|
|
21
23
|
declare function parseOpenRequest(value: unknown): OpenRequest | null;
|
|
24
|
+
/**
|
|
25
|
+
* Validate a renderer-published pinned-document list before the main process
|
|
26
|
+
* builds native menu items from it. Renderer input is untrusted: drop any
|
|
27
|
+
* malformed, oversized, or duplicate entries and cap the total.
|
|
28
|
+
*/
|
|
29
|
+
declare function parsePinnedMenuDocuments(value: unknown): HostPinnedDocument[];
|
|
22
30
|
/** Return one canonical HTTP(S) URL, or null when external navigation is unsafe. */
|
|
23
31
|
declare function parseExternalHttpUrl(value: unknown): string | null;
|
|
24
32
|
/** True only for the packaged renderer origin or the exact configured dev origin. */
|
|
@@ -37,4 +45,4 @@ declare function getDocBlocksHost(): DocBlocksHostAPI;
|
|
|
37
45
|
/** Return the host API, or null if not running under Electron. */
|
|
38
46
|
declare function maybeGetDocBlocksHost(): DocBlocksHostAPI | null;
|
|
39
47
|
|
|
40
|
-
export { DocBlocksHostAPI, HOST_WIRE_LIMITS, OpenRequest, getDocBlocksHost, isBoundedBytePayload, isBoundedString, isElectronHost, isTrustedRendererUrl, maybeGetDocBlocksHost, parseExternalHttpUrl, parseOpenRequest };
|
|
48
|
+
export { DocBlocksHostAPI, HOST_WIRE_LIMITS, HostPinnedDocument, MAX_HOST_PINNED_DOCUMENTS, OpenRequest, getDocBlocksHost, isBoundedBytePayload, isBoundedString, isElectronHost, isTrustedRendererUrl, maybeGetDocBlocksHost, parseExternalHttpUrl, parseOpenRequest, parsePinnedMenuDocuments };
|
package/dist/host/index.js
CHANGED
|
@@ -6,15 +6,18 @@ import {
|
|
|
6
6
|
} from "../chunk-6XHOOBYF.js";
|
|
7
7
|
import {
|
|
8
8
|
HOST_WIRE_LIMITS,
|
|
9
|
+
MAX_HOST_PINNED_DOCUMENTS,
|
|
9
10
|
isBoundedBytePayload,
|
|
10
11
|
isBoundedString,
|
|
11
12
|
isTrustedRendererUrl,
|
|
12
13
|
parseExternalHttpUrl,
|
|
13
|
-
parseOpenRequest
|
|
14
|
-
|
|
14
|
+
parseOpenRequest,
|
|
15
|
+
parsePinnedMenuDocuments
|
|
16
|
+
} from "../chunk-2WDJ27EH.js";
|
|
15
17
|
export {
|
|
16
18
|
ELECTRON_FILE_SYSTEM_V2_CAPABILITIES,
|
|
17
19
|
HOST_WIRE_LIMITS,
|
|
20
|
+
MAX_HOST_PINNED_DOCUMENTS,
|
|
18
21
|
getDocBlocksHost,
|
|
19
22
|
isBoundedBytePayload,
|
|
20
23
|
isBoundedString,
|
|
@@ -22,5 +25,6 @@ export {
|
|
|
22
25
|
isTrustedRendererUrl,
|
|
23
26
|
maybeGetDocBlocksHost,
|
|
24
27
|
parseExternalHttpUrl,
|
|
25
|
-
parseOpenRequest
|
|
28
|
+
parseOpenRequest,
|
|
29
|
+
parsePinnedMenuDocuments
|
|
26
30
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ export { NativeFileSystemMovePathState, NativeFileSystemMoveRecoveryError, Nativ
|
|
|
7
7
|
export { ElectronFileSystemProvider, ElectronFileSystemProviderV2 } from './filesystem/electron.js';
|
|
8
8
|
export { DOCUMENT_RECOVERY_JOURNAL_SCHEMA_VERSION, DOCUMENT_RECOVERY_JOURNAL_STORAGE_KEY, DocumentCommitConflictError, DocumentCommitRequest, DocumentCommitResult, DocumentCommitTarget, DocumentConflictStrategy, DocumentExternalChangeResult, DocumentExternalSnapshot, DocumentExternalVersion, DocumentRecoveryAcknowledgement, DocumentRecoveryJournal, DocumentRecoveryJournalOptions, DocumentRecoveryRecord, DocumentRecoveryStorage, DocumentRecoveryWrite, DocumentRecoveryWriteFailure, DocumentRecoveryWriteResult, DocumentSaveReason, DocumentSession, DocumentSessionConflict, DocumentSessionConflictError, DocumentSessionEditScope, DocumentSessionLifecycle, DocumentSessionOptions, DocumentSessionSnapshot, DocumentSessionStatus, DocumentSessionTransition, FileSystemDocumentTargetOptions, createFileSystemDocumentTarget, getDefaultDocumentRecoveryStorage } from './document/index.js';
|
|
9
9
|
export { ElectronWorkspaceReconciliation, TransientOrigin, WorkspaceDescriptor, ensureDefaultWorkspace, getTransientWorkspace, getWorkspace, listWorkspaces, parsePersistedWorkspaceList, reconcileElectronWorkspaceDescriptors, registerTransientWorkspace, removeWorkspace, saveWorkspace, touchWorkspace, unregisterTransientWorkspace } from './workspace/index.js';
|
|
10
|
-
export { HOST_WIRE_LIMITS, getDocBlocksHost, isBoundedBytePayload, isBoundedString, isElectronHost, isTrustedRendererUrl, maybeGetDocBlocksHost, parseExternalHttpUrl, parseOpenRequest } from './host/index.js';
|
|
10
|
+
export { HOST_WIRE_LIMITS, MAX_HOST_PINNED_DOCUMENTS, getDocBlocksHost, isBoundedBytePayload, isBoundedString, isElectronHost, isTrustedRendererUrl, maybeGetDocBlocksHost, parseExternalHttpUrl, parseOpenRequest, parsePinnedMenuDocuments } from './host/index.js';
|
|
11
11
|
export { SHARED_DOCUMENT_LIMITS, SharedDocumentHashParseResult, SharedDocumentMode, SharedDocumentPayload, createSharedDocumentHash, createSharedDocumentUrl, parseSharedDocumentHash } from './share/index.js';
|
|
12
|
-
export { D as DocBlocksHostAPI, a as DocBlocksHostExportAPI, b as DocBlocksHostExternalAPI, c as DocBlocksHostFfmpegAPI, d as DocBlocksHostFsAPI, e as DocBlocksHostFsV2API, f as DocBlocksHostGitAPI, g as DocBlocksHostLifecycleAPI, h as
|
|
12
|
+
export { D as DocBlocksHostAPI, a as DocBlocksHostExportAPI, b as DocBlocksHostExternalAPI, c as DocBlocksHostFfmpegAPI, d as DocBlocksHostFsAPI, e as DocBlocksHostFsV2API, f as DocBlocksHostGitAPI, g as DocBlocksHostLifecycleAPI, h as DocBlocksHostMenuAPI, i as DocBlocksHostShellAPI, j as DocBlocksHostUpdaterAPI, k as DocBlocksHostWorkspacesAPI, E as ELECTRON_FILE_SYSTEM_V2_CAPABILITIES, l as ElectronWorkspaceInfo, m as ExternalBinaryCommitResult, G as GitBranchInfo, n as GitCapabilities, o as GitCloneHandle, p as GitCloneProgress, q as GitError, r as GitErrorCode, s as GitFileAtRevision, t as GitFileChange, u as GitFileStatusCode, v as GitLogEntry, w as GitLogOptions, x as GitRemoteInfo, y as GitRepoDetection, z as GitResult, A as GitRevision, B as GitStatus, H as HostCloseReason, C as HostEnvironment, F as HostExportTargetGrant, I as HostFileSystemV2OpenRequest, J as HostFileSystemV2Result, K as HostFileSystemV2WatchMessage, L as HostPinnedDocument, M as HostPrepareCloseRequest, N as HostPrepareCloseResult, O as MenuCommand, P as OpenRequest, U as UpdateCheckResult, Q as UpdateInstallResult, R as UpdaterStatus } from './types-CHhtLOXM.js';
|
|
13
13
|
import '@bendyline/squisq/storage';
|
|
14
14
|
import '@bendyline/squisq/schemas';
|
package/dist/index.js
CHANGED
|
@@ -47,12 +47,14 @@ import {
|
|
|
47
47
|
} from "./chunk-6XHOOBYF.js";
|
|
48
48
|
import {
|
|
49
49
|
HOST_WIRE_LIMITS,
|
|
50
|
+
MAX_HOST_PINNED_DOCUMENTS,
|
|
50
51
|
isBoundedBytePayload,
|
|
51
52
|
isBoundedString,
|
|
52
53
|
isTrustedRendererUrl,
|
|
53
54
|
parseExternalHttpUrl,
|
|
54
|
-
parseOpenRequest
|
|
55
|
-
|
|
55
|
+
parseOpenRequest,
|
|
56
|
+
parsePinnedMenuDocuments
|
|
57
|
+
} from "./chunk-2WDJ27EH.js";
|
|
56
58
|
import "./chunk-73OOROXH.js";
|
|
57
59
|
import {
|
|
58
60
|
parseFileSystemVersion,
|
|
@@ -135,6 +137,7 @@ export {
|
|
|
135
137
|
IndexedDBFileSystemProvider,
|
|
136
138
|
IndexedDBFileSystemProviderV2,
|
|
137
139
|
LegacyFileSystemProviderV2Adapter,
|
|
140
|
+
MAX_HOST_PINNED_DOCUMENTS,
|
|
138
141
|
MemoryFileSystemProvider,
|
|
139
142
|
MemoryFileSystemProviderV2,
|
|
140
143
|
NativeFileSystemMoveRecoveryError,
|
|
@@ -181,6 +184,7 @@ export {
|
|
|
181
184
|
parseFileSystemVersion,
|
|
182
185
|
parseOpenRequest,
|
|
183
186
|
parsePersistedWorkspaceList,
|
|
187
|
+
parsePinnedMenuDocuments,
|
|
184
188
|
parseSharedDocumentHash,
|
|
185
189
|
parseWorkspacePath,
|
|
186
190
|
reconcileElectronWorkspaceDescriptors,
|
|
@@ -382,6 +382,31 @@ type UpdaterStatus = {
|
|
|
382
382
|
};
|
|
383
383
|
/** Menu-command events pushed from the main process to the renderer. */
|
|
384
384
|
type MenuCommand = 'file:new' | 'file:openFolder' | 'file:revealWorkspace' | 'file:settings' | 'git:commit' | 'git:push' | 'git:pull' | 'git:fetch' | 'git:newBranch' | 'git:switchBranch' | 'git:history' | 'git:clone' | 'git:openOnRemote' | 'git:createPullRequest' | 'help:about' | 'help:checkForUpdates' | 'help:viewOnGitHub';
|
|
385
|
+
/**
|
|
386
|
+
* One pinned document mirrored from the renderer into native menu surfaces.
|
|
387
|
+
*
|
|
388
|
+
* The renderer owns the authoritative pinned list (localStorage). The main
|
|
389
|
+
* process only caches the latest snapshot so the tray / menu bar can offer a
|
|
390
|
+
* one-click shortcut per document; it never persists or mutates it.
|
|
391
|
+
*/
|
|
392
|
+
interface HostPinnedDocument {
|
|
393
|
+
readonly workspaceId: string;
|
|
394
|
+
readonly workspaceName: string;
|
|
395
|
+
/** Canonical, root-relative workspace path. */
|
|
396
|
+
readonly path: string;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Renderer-to-main channel that keeps native menu surfaces in sync with
|
|
400
|
+
* renderer-owned state.
|
|
401
|
+
*/
|
|
402
|
+
interface DocBlocksHostMenuAPI {
|
|
403
|
+
/**
|
|
404
|
+
* Publish the current pinned-document list so the desktop tray can offer a
|
|
405
|
+
* shortcut per document that activates it in the main window. Replaces any
|
|
406
|
+
* previously published list; send an empty array to clear the shortcuts.
|
|
407
|
+
*/
|
|
408
|
+
setPinnedDocuments(documents: readonly HostPinnedDocument[]): void;
|
|
409
|
+
}
|
|
385
410
|
/**
|
|
386
411
|
* OS open-file / deep-link event resolved by the host.
|
|
387
412
|
* - 'workspace-file': a file inside an already-registered workspace.
|
|
@@ -486,6 +511,7 @@ interface DocBlocksHostAPI {
|
|
|
486
511
|
git: DocBlocksHostGitAPI;
|
|
487
512
|
updater: DocBlocksHostUpdaterAPI;
|
|
488
513
|
lifecycle: DocBlocksHostLifecycleAPI;
|
|
514
|
+
menu: DocBlocksHostMenuAPI;
|
|
489
515
|
/**
|
|
490
516
|
* Subscribe to menu commands dispatched by the native menu.
|
|
491
517
|
* Returns an unsubscribe function.
|
|
@@ -498,4 +524,4 @@ interface DocBlocksHostAPI {
|
|
|
498
524
|
onOpenRequest(listener: (request: OpenRequest) => void): () => void;
|
|
499
525
|
}
|
|
500
526
|
|
|
501
|
-
export { type
|
|
527
|
+
export { type GitRevision as A, type GitStatus as B, type HostEnvironment as C, type DocBlocksHostAPI as D, ELECTRON_FILE_SYSTEM_V2_CAPABILITIES as E, type HostExportTargetGrant as F, type GitBranchInfo as G, type HostCloseReason as H, type HostFileSystemV2OpenRequest as I, type HostFileSystemV2Result as J, type HostFileSystemV2WatchMessage as K, type HostPinnedDocument as L, type HostPrepareCloseRequest as M, type HostPrepareCloseResult as N, type MenuCommand as O, type OpenRequest as P, type UpdateInstallResult as Q, type UpdaterStatus as R, type UpdateCheckResult as U, type DocBlocksHostExportAPI as a, type DocBlocksHostExternalAPI as b, type DocBlocksHostFfmpegAPI as c, type DocBlocksHostFsAPI as d, type DocBlocksHostFsV2API as e, type DocBlocksHostGitAPI as f, type DocBlocksHostLifecycleAPI as g, type DocBlocksHostMenuAPI as h, type DocBlocksHostShellAPI as i, type DocBlocksHostUpdaterAPI as j, type DocBlocksHostWorkspacesAPI as k, type ElectronWorkspaceInfo as l, type ExternalBinaryCommitResult as m, type GitCapabilities as n, type GitCloneHandle as o, type GitCloneProgress as p, type GitError as q, type GitErrorCode as r, type GitFileAtRevision as s, type GitFileChange as t, type GitFileStatusCode as u, type GitLogEntry as v, type GitLogOptions as w, type GitRemoteInfo as x, type GitRepoDetection as y, type GitResult as z };
|
package/dist/vscode/index.d.ts
CHANGED
|
@@ -22,11 +22,22 @@ declare const DOCBLOCKS_ACCENT_COLORS: readonly ["brown", "green", "blue", "purp
|
|
|
22
22
|
type DocBlocksAccentColor = (typeof DOCBLOCKS_ACCENT_COLORS)[number];
|
|
23
23
|
declare const DOCBLOCKS_WRITE_CANVAS_TEXT_SIZE_MIN = 12;
|
|
24
24
|
declare const DOCBLOCKS_WRITE_CANVAS_TEXT_SIZE_MAX = 32;
|
|
25
|
-
declare const DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MIN = 1
|
|
25
|
+
declare const DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MIN = 1;
|
|
26
26
|
declare const DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MAX = 2.4;
|
|
27
|
+
/**
|
|
28
|
+
* Stable ids for the Write-canvas font schemes. This is the wire/persisted
|
|
29
|
+
* contract for the font choice; the human labels and the resolved CSS
|
|
30
|
+
* font-family strings live with the UI in `@bendyline/docblocks-react`
|
|
31
|
+
* (`WRITE_CANVAS_FONT_SCHEMES`). A guard test keeps this list, the react
|
|
32
|
+
* registry, and the VS Code `package.json` enum in sync. `'theme'` is the
|
|
33
|
+
* default and means "inherit from the active theme override".
|
|
34
|
+
*/
|
|
35
|
+
declare const DOCBLOCKS_WRITE_CANVAS_FONT_SCHEMES: readonly ["theme", "serif-sans", "sans-sans", "serif-serif", "pt-serif", "hanken", "playfair-pt-serif", "hanken-lora", "dm-serif-dm-sans", "inter"];
|
|
36
|
+
type DocBlocksWriteCanvasFontScheme = (typeof DOCBLOCKS_WRITE_CANVAS_FONT_SCHEMES)[number];
|
|
27
37
|
interface VscodeWriteCanvasSettings {
|
|
28
38
|
textSize: number;
|
|
29
39
|
lineSpacing: number;
|
|
40
|
+
fontScheme: DocBlocksWriteCanvasFontScheme;
|
|
30
41
|
}
|
|
31
42
|
declare const DEFAULT_VSCODE_WRITE_CANVAS_SETTINGS: Readonly<VscodeWriteCanvasSettings>;
|
|
32
43
|
interface VscodeEditorSettings {
|
|
@@ -219,7 +230,18 @@ declare function parseExtensionToWebviewMessage(value: unknown): ExtensionToWebv
|
|
|
219
230
|
declare function isDocBlocksAccentColor(value: unknown): value is DocBlocksAccentColor;
|
|
220
231
|
declare function isDocBlocksWriteCanvasTextSize(value: unknown): value is number;
|
|
221
232
|
declare function isDocBlocksWriteCanvasLineSpacing(value: unknown): value is number;
|
|
233
|
+
declare function isDocBlocksWriteCanvasFontScheme(value: unknown): value is DocBlocksWriteCanvasFontScheme;
|
|
222
234
|
declare function isSafeExportFilename(value: unknown): value is string;
|
|
223
235
|
declare function isSafeMimeType(value: unknown): value is string;
|
|
224
236
|
|
|
225
|
-
|
|
237
|
+
/**
|
|
238
|
+
* Return whether two document snapshots differ by more than whitespace.
|
|
239
|
+
*
|
|
240
|
+
* VS Code's DocBlocks webview is allowed to hydrate and navigate without
|
|
241
|
+
* authoring a file edit. Before the user's first substantive edit, hosts use
|
|
242
|
+
* this comparison to discard serializer churn that only changes line breaks,
|
|
243
|
+
* indentation, or other whitespace.
|
|
244
|
+
*/
|
|
245
|
+
declare function hasSubstantiveTextChange(baseline: string, candidate: string): boolean;
|
|
246
|
+
|
|
247
|
+
export { DEFAULT_VSCODE_WRITE_CANVAS_SETTINGS, DOCBLOCKS_ACCENT_COLORS, DOCBLOCKS_WRITE_CANVAS_FONT_SCHEMES, DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MAX, DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MIN, DOCBLOCKS_WRITE_CANVAS_TEXT_SIZE_MAX, DOCBLOCKS_WRITE_CANVAS_TEXT_SIZE_MIN, type DocBlocksAccentColor, type DocBlocksWriteCanvasFontScheme, type DocumentConflictChoice, type DocumentConflictDetailsMessage, type DocumentSessionMessageStatus, type ExportTargetGrantMessage, type ExtensionToWebviewMessage, type MediaEntryMessage, type VscodeEditorSettings, type VscodeWriteCanvasSettings, type WebviewToExtensionMessage, hasSubstantiveTextChange, isDocBlocksAccentColor, isDocBlocksWriteCanvasFontScheme, isDocBlocksWriteCanvasLineSpacing, isDocBlocksWriteCanvasTextSize, isSafeExportFilename, isSafeMimeType, parseExtensionToWebviewMessage, parseWebviewToExtensionMessage };
|
package/dist/vscode/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HOST_WIRE_LIMITS,
|
|
3
3
|
isBoundedString
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-2WDJ27EH.js";
|
|
5
5
|
|
|
6
6
|
// src/vscode/messages.ts
|
|
7
7
|
var MAX_REQUEST_ID = 2147483647;
|
|
@@ -16,11 +16,24 @@ var DOCBLOCKS_ACCENT_COLORS = [
|
|
|
16
16
|
];
|
|
17
17
|
var DOCBLOCKS_WRITE_CANVAS_TEXT_SIZE_MIN = 12;
|
|
18
18
|
var DOCBLOCKS_WRITE_CANVAS_TEXT_SIZE_MAX = 32;
|
|
19
|
-
var DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MIN = 1
|
|
19
|
+
var DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MIN = 1;
|
|
20
20
|
var DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MAX = 2.4;
|
|
21
|
+
var DOCBLOCKS_WRITE_CANVAS_FONT_SCHEMES = [
|
|
22
|
+
"theme",
|
|
23
|
+
"serif-sans",
|
|
24
|
+
"sans-sans",
|
|
25
|
+
"serif-serif",
|
|
26
|
+
"pt-serif",
|
|
27
|
+
"hanken",
|
|
28
|
+
"playfair-pt-serif",
|
|
29
|
+
"hanken-lora",
|
|
30
|
+
"dm-serif-dm-sans",
|
|
31
|
+
"inter"
|
|
32
|
+
];
|
|
21
33
|
var DEFAULT_VSCODE_WRITE_CANVAS_SETTINGS = {
|
|
22
34
|
textSize: 16,
|
|
23
|
-
lineSpacing: 1.7
|
|
35
|
+
lineSpacing: 1.7,
|
|
36
|
+
fontScheme: "theme"
|
|
24
37
|
};
|
|
25
38
|
function parseWebviewToExtensionMessage(value) {
|
|
26
39
|
if (!isRecord(value) || typeof value.type !== "string") return null;
|
|
@@ -295,8 +308,11 @@ function isDocBlocksWriteCanvasLineSpacing(value) {
|
|
|
295
308
|
DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MAX
|
|
296
309
|
);
|
|
297
310
|
}
|
|
311
|
+
function isDocBlocksWriteCanvasFontScheme(value) {
|
|
312
|
+
return DOCBLOCKS_WRITE_CANVAS_FONT_SCHEMES.some((scheme) => scheme === value);
|
|
313
|
+
}
|
|
298
314
|
function parseVscodeWriteCanvasSettings(value) {
|
|
299
|
-
return isRecord(value) && hasOnlyKeys(value, ["textSize", "lineSpacing"]) && isDocBlocksWriteCanvasTextSize(value.textSize) && isDocBlocksWriteCanvasLineSpacing(value.lineSpacing) ? { textSize: value.textSize, lineSpacing: value.lineSpacing } : null;
|
|
315
|
+
return isRecord(value) && hasOnlyKeys(value, ["textSize", "lineSpacing", "fontScheme"]) && isDocBlocksWriteCanvasTextSize(value.textSize) && isDocBlocksWriteCanvasLineSpacing(value.lineSpacing) && isDocBlocksWriteCanvasFontScheme(value.fontScheme) ? { textSize: value.textSize, lineSpacing: value.lineSpacing, fontScheme: value.fontScheme } : null;
|
|
300
316
|
}
|
|
301
317
|
function numberInRange(value, min, max) {
|
|
302
318
|
return typeof value === "number" && Number.isFinite(value) && value >= min && value <= max;
|
|
@@ -372,14 +388,39 @@ function isSafeMimeType(value) {
|
|
|
372
388
|
value
|
|
373
389
|
);
|
|
374
390
|
}
|
|
391
|
+
|
|
392
|
+
// src/vscode/text-change.ts
|
|
393
|
+
function hasSubstantiveTextChange(baseline, candidate) {
|
|
394
|
+
let baselineIndex = 0;
|
|
395
|
+
let candidateIndex = 0;
|
|
396
|
+
while (true) {
|
|
397
|
+
baselineIndex = skipWhitespace(baseline, baselineIndex);
|
|
398
|
+
candidateIndex = skipWhitespace(candidate, candidateIndex);
|
|
399
|
+
const baselineEnded = baselineIndex === baseline.length;
|
|
400
|
+
const candidateEnded = candidateIndex === candidate.length;
|
|
401
|
+
if (baselineEnded || candidateEnded) return baselineEnded !== candidateEnded;
|
|
402
|
+
if (baseline[baselineIndex] !== candidate[candidateIndex]) return true;
|
|
403
|
+
baselineIndex += 1;
|
|
404
|
+
candidateIndex += 1;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
var WHITESPACE_CHARACTER = /\s/u;
|
|
408
|
+
function skipWhitespace(value, start) {
|
|
409
|
+
let index = start;
|
|
410
|
+
while (index < value.length && WHITESPACE_CHARACTER.test(value[index])) index += 1;
|
|
411
|
+
return index;
|
|
412
|
+
}
|
|
375
413
|
export {
|
|
376
414
|
DEFAULT_VSCODE_WRITE_CANVAS_SETTINGS,
|
|
377
415
|
DOCBLOCKS_ACCENT_COLORS,
|
|
416
|
+
DOCBLOCKS_WRITE_CANVAS_FONT_SCHEMES,
|
|
378
417
|
DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MAX,
|
|
379
418
|
DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MIN,
|
|
380
419
|
DOCBLOCKS_WRITE_CANVAS_TEXT_SIZE_MAX,
|
|
381
420
|
DOCBLOCKS_WRITE_CANVAS_TEXT_SIZE_MIN,
|
|
421
|
+
hasSubstantiveTextChange,
|
|
382
422
|
isDocBlocksAccentColor,
|
|
423
|
+
isDocBlocksWriteCanvasFontScheme,
|
|
383
424
|
isDocBlocksWriteCanvasLineSpacing,
|
|
384
425
|
isDocBlocksWriteCanvasTextSize,
|
|
385
426
|
isSafeExportFilename,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { q as FileSystemProvider } from '../types-BEg5SQ1_.js';
|
|
2
|
-
import {
|
|
2
|
+
import { l as ElectronWorkspaceInfo, C as HostEnvironment } from '../types-CHhtLOXM.js';
|
|
3
3
|
import '../workspace-path-CWVrcuPL.js';
|
|
4
4
|
|
|
5
5
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/docblocks",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "Core data structures and filesystem abstractions for DocBlocks",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Bendyline",
|
|
@@ -23,9 +23,13 @@
|
|
|
23
23
|
"main": "./dist/index.js",
|
|
24
24
|
"module": "./dist/index.js",
|
|
25
25
|
"types": "./dist/index.d.ts",
|
|
26
|
-
"sideEffects":
|
|
26
|
+
"//sideEffects": "tsup's split multi-entry build emits bare imports for shared chunks. Mark only those generated chunks as side-effectful so consumer bundlers retain them without treating the public entries as side-effectful.",
|
|
27
|
+
"sideEffects": [
|
|
28
|
+
"./dist/chunk-*.js"
|
|
29
|
+
],
|
|
27
30
|
"files": [
|
|
28
|
-
"dist"
|
|
31
|
+
"dist",
|
|
32
|
+
"THIRD_PARTY_NOTICES.txt"
|
|
29
33
|
],
|
|
30
34
|
"exports": {
|
|
31
35
|
".": {
|
|
@@ -99,7 +103,7 @@
|
|
|
99
103
|
"typecheck": "tsc --noEmit"
|
|
100
104
|
},
|
|
101
105
|
"dependencies": {
|
|
102
|
-
"@bendyline/squisq": "2.
|
|
106
|
+
"@bendyline/squisq": "2.4.1",
|
|
103
107
|
"zod": "3.25.76"
|
|
104
108
|
}
|
|
105
109
|
}
|