@bendyline/docblocks 0.1.0 → 1.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/LICENSE +21 -21
- package/dist/chunk-AOBPNSU6.js +23 -0
- package/dist/chunk-AOBPNSU6.js.map +1 -0
- package/dist/{chunk-NSVTXALR.js → chunk-OGJN2J4P.js} +218 -2
- package/dist/chunk-OGJN2J4P.js.map +1 -0
- package/dist/filesystem/electron-provider.d.ts +32 -0
- package/dist/filesystem/electron-provider.d.ts.map +1 -0
- package/dist/filesystem/electron-provider.js +64 -0
- package/dist/filesystem/electron-provider.js.map +1 -0
- package/dist/filesystem/file-media-provider.d.ts +23 -0
- package/dist/filesystem/file-media-provider.d.ts.map +1 -0
- package/dist/filesystem/file-media-provider.js +85 -0
- package/dist/filesystem/file-media-provider.js.map +1 -0
- package/dist/filesystem/filesystem-content-container.d.ts +24 -0
- package/dist/filesystem/filesystem-content-container.d.ts.map +1 -0
- package/dist/filesystem/filesystem-content-container.js +103 -0
- package/dist/filesystem/filesystem-content-container.js.map +1 -0
- package/dist/filesystem/index.d.ts +3 -0
- package/dist/filesystem/index.d.ts.map +1 -1
- package/dist/filesystem/index.js +3 -0
- package/dist/filesystem/index.js.map +1 -1
- package/dist/host/index.d.ts +14 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +28 -0
- package/dist/host/index.js.map +1 -0
- package/dist/host/types.d.ts +149 -0
- package/dist/host/types.d.ts.map +1 -0
- package/dist/host/types.js +10 -0
- package/dist/host/types.js.map +1 -0
- package/dist/index-TtDaQ3vS.d.ts +213 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/workspace/types.d.ts +9 -2
- package/dist/workspace/types.d.ts.map +1 -1
- package/package.json +12 -7
- package/src/filesystem/electron-provider.ts +88 -0
- package/src/filesystem/file-media-provider.ts +103 -0
- package/src/filesystem/filesystem-content-container.ts +115 -0
- package/src/filesystem/index.ts +4 -0
- package/src/host/index.ts +47 -0
- package/src/host/types.ts +153 -0
- package/src/index.ts +2 -1
- package/src/workspace/types.ts +9 -2
- package/dist/chunk-NSVTXALR.js.map +0 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createFileMediaProvider — per-file media storage following the pandoc /
|
|
3
|
+
* Word convention: a markdown file `notes.md` gets a sibling folder
|
|
4
|
+
* `notes_files/` that holds its images, audio, and video.
|
|
5
|
+
*
|
|
6
|
+
* Given:
|
|
7
|
+
* • `container` — a ContentContainer scoped to the markdown file's
|
|
8
|
+
* parent directory (so `readFile('notes_files/image.png')` maps to the
|
|
9
|
+
* parent-relative path)
|
|
10
|
+
* • `markdownBasename` — e.g. `"notes.md"`
|
|
11
|
+
*
|
|
12
|
+
* Returns a MediaProvider that:
|
|
13
|
+
* • Writes new media under `{basename}_files/{name}` in the parent dir
|
|
14
|
+
* • Returns the folder-qualified path (`notes_files/image.png`) from
|
|
15
|
+
* addMedia so the markdown stays portable outside DocBlocks
|
|
16
|
+
* • Resolves both bare (`image.png`) and folder-qualified
|
|
17
|
+
* (`notes_files/image.png`) references — so legacy markdown and
|
|
18
|
+
* exports from other tools both work
|
|
19
|
+
*/
|
|
20
|
+
function stripExt(name) {
|
|
21
|
+
return name.replace(/\.[^.]+$/, '');
|
|
22
|
+
}
|
|
23
|
+
export function createFileMediaProvider(container, markdownBasename) {
|
|
24
|
+
const folder = stripExt(markdownBasename) + '_files';
|
|
25
|
+
const prefix = folder + '/';
|
|
26
|
+
const blobUrlCache = new Map();
|
|
27
|
+
function toKey(ref) {
|
|
28
|
+
const clean = ref.replace(/^\/+/, '');
|
|
29
|
+
return clean.startsWith(prefix) ? clean : prefix + clean;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
async resolveUrl(ref) {
|
|
33
|
+
const key = toKey(ref);
|
|
34
|
+
const cached = blobUrlCache.get(key);
|
|
35
|
+
if (cached)
|
|
36
|
+
return cached;
|
|
37
|
+
const data = await container.readFile(key);
|
|
38
|
+
if (!data)
|
|
39
|
+
return ref;
|
|
40
|
+
const entries = await container.listFiles();
|
|
41
|
+
const entry = entries.find((e) => e.path === key);
|
|
42
|
+
const mimeType = entry?.mimeType ?? 'application/octet-stream';
|
|
43
|
+
const url = URL.createObjectURL(new Blob([data], { type: mimeType }));
|
|
44
|
+
blobUrlCache.set(key, url);
|
|
45
|
+
return url;
|
|
46
|
+
},
|
|
47
|
+
async listMedia() {
|
|
48
|
+
const entries = await container.listFiles(prefix);
|
|
49
|
+
return entries
|
|
50
|
+
.filter((e) => !e.path.toLowerCase().endsWith('.md'))
|
|
51
|
+
.map((e) => ({
|
|
52
|
+
name: e.path,
|
|
53
|
+
mimeType: e.mimeType,
|
|
54
|
+
size: e.size,
|
|
55
|
+
}));
|
|
56
|
+
},
|
|
57
|
+
async addMedia(name, data, mimeType) {
|
|
58
|
+
const key = toKey(name);
|
|
59
|
+
const cached = blobUrlCache.get(key);
|
|
60
|
+
if (cached) {
|
|
61
|
+
URL.revokeObjectURL(cached);
|
|
62
|
+
blobUrlCache.delete(key);
|
|
63
|
+
}
|
|
64
|
+
const buffer = data instanceof Blob ? new Uint8Array(await data.arrayBuffer()) : data;
|
|
65
|
+
await container.writeFile(key, buffer, mimeType);
|
|
66
|
+
return key;
|
|
67
|
+
},
|
|
68
|
+
async removeMedia(ref) {
|
|
69
|
+
const key = toKey(ref);
|
|
70
|
+
const cached = blobUrlCache.get(key);
|
|
71
|
+
if (cached) {
|
|
72
|
+
URL.revokeObjectURL(cached);
|
|
73
|
+
blobUrlCache.delete(key);
|
|
74
|
+
}
|
|
75
|
+
await container.removeFile(key);
|
|
76
|
+
},
|
|
77
|
+
dispose() {
|
|
78
|
+
for (const url of blobUrlCache.values()) {
|
|
79
|
+
URL.revokeObjectURL(url);
|
|
80
|
+
}
|
|
81
|
+
blobUrlCache.clear();
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=file-media-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-media-provider.js","sourceRoot":"","sources":["../../src/filesystem/file-media-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,SAA2B,EAC3B,gBAAwB;IAExB,MAAM,MAAM,GAAG,QAAQ,CAAC,gBAAgB,CAAC,GAAG,QAAQ,CAAC;IACrD,MAAM,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;IAC5B,MAAM,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE/C,SAAS,KAAK,CAAC,GAAW;QACxB,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACtC,OAAO,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC;IAC3D,CAAC;IAED,OAAO;QACL,KAAK,CAAC,UAAU,CAAC,GAAW;YAC1B,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;YACvB,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACrC,IAAI,MAAM;gBAAE,OAAO,MAAM,CAAC;YAE1B,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAC3C,IAAI,CAAC,IAAI;gBAAE,OAAO,GAAG,CAAC;YAEtB,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,SAAS,EAAE,CAAC;YAC5C,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC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EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YACtF,MAAM,SAAS,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;YACjD,OAAO,GAAG,CAAC;QACb,CAAC;QAED,KAAK,CAAC,WAAW,CAAC,GAAW;YAC3B,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;YACvB,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACrC,IAAI,MAAM,EAAE,CAAC;gBACX,GAAG,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;gBAC5B,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC3B,CAAC;YACD,MAAM,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAClC,CAAC;QAED,OAAO;YACL,KAAK,MAAM,GAAG,IAAI,YAAY,CAAC,MAAM,EAAE,EAAE,CAAC;gBACxC,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;YAC3B,CAAC;YACD,YAAY,CAAC,KAAK,EAAE,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FileSystemContentContainer — a ContentContainer backed by any
|
|
3
|
+
* FileSystemProvider, scoped to a sub-path (e.g., ".docblocks/media/").
|
|
4
|
+
*
|
|
5
|
+
* Used by the Electron desktop app so media lives inside the workspace
|
|
6
|
+
* folder (visible as regular files) rather than in a separate IndexedDB
|
|
7
|
+
* origin that only the app can see.
|
|
8
|
+
*/
|
|
9
|
+
import type { ContentContainer, ContentEntry } from '@bendyline/squisq/storage';
|
|
10
|
+
import type { FileSystemProvider } from './types.js';
|
|
11
|
+
export declare class FileSystemContentContainer implements ContentContainer {
|
|
12
|
+
private readonly provider;
|
|
13
|
+
private readonly prefix;
|
|
14
|
+
constructor(provider: FileSystemProvider, prefix?: string);
|
|
15
|
+
readFile(path: string): Promise<ArrayBuffer | null>;
|
|
16
|
+
writeFile(path: string, data: ArrayBuffer | Uint8Array, _mimeType?: string): Promise<void>;
|
|
17
|
+
removeFile(path: string): Promise<void>;
|
|
18
|
+
listFiles(prefix?: string): Promise<ContentEntry[]>;
|
|
19
|
+
exists(path: string): Promise<boolean>;
|
|
20
|
+
getDocumentPath(): Promise<string | null>;
|
|
21
|
+
readDocument(): Promise<string | null>;
|
|
22
|
+
writeDocument(markdown: string, filename?: string): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=filesystem-content-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem-content-container.d.ts","sourceRoot":"","sources":["../../src/filesystem/filesystem-content-container.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEhF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAgCrD,qBAAa,0BAA2B,YAAW,gBAAgB;IAI/D,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAH3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAGb,QAAQ,EAAE,kBAAkB,EAC7C,MAAM,SAAqB;IAKvB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAInD,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1F,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IA4BnD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAItC,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIzC,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAQtC,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAKxE"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FileSystemContentContainer — a ContentContainer backed by any
|
|
3
|
+
* FileSystemProvider, scoped to a sub-path (e.g., ".docblocks/media/").
|
|
4
|
+
*
|
|
5
|
+
* Used by the Electron desktop app so media lives inside the workspace
|
|
6
|
+
* folder (visible as regular files) rather than in a separate IndexedDB
|
|
7
|
+
* origin that only the app can see.
|
|
8
|
+
*/
|
|
9
|
+
import { findDocumentPath } from '@bendyline/squisq/storage';
|
|
10
|
+
const EXTENSION_MIME_MAP = {
|
|
11
|
+
'.md': 'text/markdown',
|
|
12
|
+
'.txt': 'text/plain',
|
|
13
|
+
'.json': 'application/json',
|
|
14
|
+
'.jpg': 'image/jpeg',
|
|
15
|
+
'.jpeg': 'image/jpeg',
|
|
16
|
+
'.png': 'image/png',
|
|
17
|
+
'.gif': 'image/gif',
|
|
18
|
+
'.svg': 'image/svg+xml',
|
|
19
|
+
'.webp': 'image/webp',
|
|
20
|
+
'.avif': 'image/avif',
|
|
21
|
+
'.mp4': 'video/mp4',
|
|
22
|
+
'.webm': 'video/webm',
|
|
23
|
+
'.mp3': 'audio/mpeg',
|
|
24
|
+
'.wav': 'audio/wav',
|
|
25
|
+
'.ogg': 'audio/ogg',
|
|
26
|
+
};
|
|
27
|
+
function guessMimeType(path) {
|
|
28
|
+
const dot = path.lastIndexOf('.');
|
|
29
|
+
if (dot === -1)
|
|
30
|
+
return 'application/octet-stream';
|
|
31
|
+
const ext = path.slice(dot).toLowerCase();
|
|
32
|
+
return EXTENSION_MIME_MAP[ext] ?? 'application/octet-stream';
|
|
33
|
+
}
|
|
34
|
+
function joinPrefix(prefix, p) {
|
|
35
|
+
const clean = p.replace(/^\/+/, '');
|
|
36
|
+
return prefix.replace(/\/+$/, '') + '/' + clean;
|
|
37
|
+
}
|
|
38
|
+
export class FileSystemContentContainer {
|
|
39
|
+
constructor(provider, prefix = '.docblocks/media') {
|
|
40
|
+
this.provider = provider;
|
|
41
|
+
this.prefix = prefix.replace(/^\/+/, '').replace(/\/+$/, '');
|
|
42
|
+
}
|
|
43
|
+
async readFile(path) {
|
|
44
|
+
return this.provider.readBinary(joinPrefix(this.prefix, path));
|
|
45
|
+
}
|
|
46
|
+
async writeFile(path, data, _mimeType) {
|
|
47
|
+
await this.provider.writeBinary(joinPrefix(this.prefix, path), data);
|
|
48
|
+
}
|
|
49
|
+
async removeFile(path) {
|
|
50
|
+
await this.provider.delete(joinPrefix(this.prefix, path));
|
|
51
|
+
}
|
|
52
|
+
async listFiles(prefix) {
|
|
53
|
+
const entries = [];
|
|
54
|
+
const walk = async (dir) => {
|
|
55
|
+
let children;
|
|
56
|
+
try {
|
|
57
|
+
children = await this.provider.readDirectory(dir);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
for (const child of children) {
|
|
63
|
+
if (child.kind === 'directory') {
|
|
64
|
+
await walk(child.path);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
const rel = child.path.replace(new RegExp('^/?' + this.prefix + '/?'), '');
|
|
68
|
+
if (prefix && !rel.startsWith(prefix))
|
|
69
|
+
continue;
|
|
70
|
+
const meta = await this.provider.stat(child.path);
|
|
71
|
+
entries.push({
|
|
72
|
+
path: rel,
|
|
73
|
+
mimeType: guessMimeType(rel),
|
|
74
|
+
size: meta?.size ?? 0,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
await walk('/' + this.prefix);
|
|
80
|
+
return entries;
|
|
81
|
+
}
|
|
82
|
+
async exists(path) {
|
|
83
|
+
return this.provider.exists(joinPrefix(this.prefix, path));
|
|
84
|
+
}
|
|
85
|
+
async getDocumentPath() {
|
|
86
|
+
return findDocumentPath(await this.listFiles());
|
|
87
|
+
}
|
|
88
|
+
async readDocument() {
|
|
89
|
+
const docPath = await this.getDocumentPath();
|
|
90
|
+
if (!docPath)
|
|
91
|
+
return null;
|
|
92
|
+
const data = await this.readFile(docPath);
|
|
93
|
+
if (!data)
|
|
94
|
+
return null;
|
|
95
|
+
return new TextDecoder().decode(data);
|
|
96
|
+
}
|
|
97
|
+
async writeDocument(markdown, filename) {
|
|
98
|
+
const name = filename ?? 'index.md';
|
|
99
|
+
const data = new TextEncoder().encode(markdown);
|
|
100
|
+
await this.writeFile(name, data, 'text/markdown');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=filesystem-content-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem-content-container.js","sourceRoot":"","sources":["../../src/filesystem/filesystem-content-container.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAG7D,MAAM,kBAAkB,GAA2B;IACjD,KAAK,EAAE,eAAe;IACtB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,kBAAkB;IAC3B,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,eAAe;IACvB,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,WAAW;CACpB,CAAC;AAEF,SAAS,aAAa,CAAC,IAAY;IACjC,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACl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AAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,OAAO,gBAAgB,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAC7C,IAAI,CAAC,OAAO;YAAE,OAAO,IAAI,CAAC;QAC1B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QACvB,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,QAAgB,EAAE,QAAiB;QACrD,MAAM,IAAI,GAAG,QAAQ,IAAI,UAAU,CAAC;QACpC,MAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAChD,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;IACpD,CAAC;CACF"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export type { FileSystemProvider, FileSystemEntry, FileEntry, FolderEntry, FileMeta, } from './types.js';
|
|
2
2
|
export { IndexedDBFileSystemProvider } from './indexeddb-provider.js';
|
|
3
3
|
export { IndexedDBContentContainer } from './indexeddb-content-container.js';
|
|
4
|
+
export { FileSystemContentContainer } from './filesystem-content-container.js';
|
|
5
|
+
export { createFileMediaProvider } from './file-media-provider.js';
|
|
4
6
|
export { NativeFileSystemProvider, isNativeFileSystemSupported, openNativeFolder, restoreNativeFolder, storeDirectoryHandle, loadDirectoryHandle, removeDirectoryHandle, } from './native-provider.js';
|
|
7
|
+
export { ElectronFileSystemProvider, isElectronHost } from './electron-provider.js';
|
|
5
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/filesystem/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,eAAe,EACf,SAAS,EACT,WAAW,EACX,QAAQ,GACT,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/filesystem/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,eAAe,EACf,SAAS,EACT,WAAW,EACX,QAAQ,GACT,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/filesystem/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { IndexedDBFileSystemProvider } from './indexeddb-provider.js';
|
|
2
2
|
export { IndexedDBContentContainer } from './indexeddb-content-container.js';
|
|
3
|
+
export { FileSystemContentContainer } from './filesystem-content-container.js';
|
|
4
|
+
export { createFileMediaProvider } from './file-media-provider.js';
|
|
3
5
|
export { NativeFileSystemProvider, isNativeFileSystemSupported, openNativeFolder, restoreNativeFolder, storeDirectoryHandle, loadDirectoryHandle, removeDirectoryHandle, } from './native-provider.js';
|
|
6
|
+
export { ElectronFileSystemProvider, isElectronHost } from './electron-provider.js';
|
|
4
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/filesystem/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/filesystem/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host bridge — shared types + runtime access for the Electron desktop
|
|
3
|
+
* host. The renderer calls `getDocblocksHost()` to reach the preload
|
|
4
|
+
* contextBridge; `isElectronHost()` gates desktop-only UI branches.
|
|
5
|
+
*/
|
|
6
|
+
export type { DocblocksHostAPI, DocblocksHostFsAPI, DocblocksHostWorkspacesAPI, DocblocksHostShellAPI, DocblocksHostFfmpegAPI, DocblocksHostUpdaterAPI, ElectronWorkspaceInfo, HostEnvironment, MenuCommand, OpenRequest, UpdaterStatus, } from './types.js';
|
|
7
|
+
import type { DocblocksHostAPI } from './types.js';
|
|
8
|
+
/** True when running inside the Electron desktop shell. */
|
|
9
|
+
export declare function isElectronHost(): boolean;
|
|
10
|
+
/** Return the host API, or throw if not running under Electron. */
|
|
11
|
+
export declare function getDocblocksHost(): DocblocksHostAPI;
|
|
12
|
+
/** Return the host API, or null if not running under Electron. */
|
|
13
|
+
export declare function maybeGetDocblocksHost(): DocblocksHostAPI | null;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/host/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,EACf,WAAW,EACX,WAAW,EACX,aAAa,GACd,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,2DAA2D;AAC3D,wBAAgB,cAAc,IAAI,OAAO,CASxC;AAED,mEAAmE;AACnE,wBAAgB,gBAAgB,IAAI,gBAAgB,CAMnD;AAED,kEAAkE;AAClE,wBAAgB,qBAAqB,IAAI,gBAAgB,GAAG,IAAI,CAE/D"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host bridge — shared types + runtime access for the Electron desktop
|
|
3
|
+
* host. The renderer calls `getDocblocksHost()` to reach the preload
|
|
4
|
+
* contextBridge; `isElectronHost()` gates desktop-only UI branches.
|
|
5
|
+
*/
|
|
6
|
+
/** True when running inside the Electron desktop shell. */
|
|
7
|
+
export function isElectronHost() {
|
|
8
|
+
if (typeof globalThis === 'undefined')
|
|
9
|
+
return false;
|
|
10
|
+
const host = globalThis.docblocksHost;
|
|
11
|
+
return (typeof host === 'object' &&
|
|
12
|
+
host !== null &&
|
|
13
|
+
typeof host.fs === 'object' &&
|
|
14
|
+
host.fs !== null);
|
|
15
|
+
}
|
|
16
|
+
/** Return the host API, or throw if not running under Electron. */
|
|
17
|
+
export function getDocblocksHost() {
|
|
18
|
+
const host = globalThis.docblocksHost;
|
|
19
|
+
if (!host) {
|
|
20
|
+
throw new Error('docblocksHost is not available — not running under Electron?');
|
|
21
|
+
}
|
|
22
|
+
return host;
|
|
23
|
+
}
|
|
24
|
+
/** Return the host API, or null if not running under Electron. */
|
|
25
|
+
export function maybeGetDocblocksHost() {
|
|
26
|
+
return globalThis.docblocksHost ?? null;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/host/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,2DAA2D;AAC3D,MAAM,UAAU,cAAc;IAC5B,IAAI,OAAO,UAAU,KAAK,WAAW;QAAE,OAAO,KAAK,CAAC;IACpD,MAAM,IAAI,GAAI,UAA0C,CAAC,aAAa,CAAC;IACvE,OAAO,CACL,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,OAAQ,IAAyB,CAAC,EAAE,KAAK,QAAQ;QAChD,IAAyB,CAAC,EAAE,KAAK,IAAI,CACvC,CAAC;AACJ,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,gBAAgB;IAC9B,MAAM,IAAI,GAAI,UAAmD,CAAC,aAAa,CAAC;IAChF,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;IAClF,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,qBAAqB;IACnC,OAAQ,UAAmD,CAAC,aAAa,IAAI,IAAI,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DocblocksHostAPI — the contract exposed by the Electron desktop shell
|
|
3
|
+
* to its renderer process via contextBridge.
|
|
4
|
+
*
|
|
5
|
+
* This file is the single source of truth for the host ↔ renderer
|
|
6
|
+
* bridge. The Electron preload script exposes an implementation matching
|
|
7
|
+
* this shape; the React renderer calls it through `window.docblocksHost`.
|
|
8
|
+
*/
|
|
9
|
+
import type { FileSystemEntry, FileMeta } from '../filesystem/types.js';
|
|
10
|
+
/** Filesystem operations scoped to a registered absolute root path. */
|
|
11
|
+
export interface DocblocksHostFsAPI {
|
|
12
|
+
readFile(rootPath: string, path: string): Promise<string | null>;
|
|
13
|
+
writeFile(rootPath: string, path: string, content: string): Promise<void>;
|
|
14
|
+
delete(rootPath: string, path: string): Promise<void>;
|
|
15
|
+
rename(rootPath: string, oldPath: string, newPath: string): Promise<void>;
|
|
16
|
+
readDirectory(rootPath: string, path: string): Promise<FileSystemEntry[]>;
|
|
17
|
+
exists(rootPath: string, path: string): Promise<boolean>;
|
|
18
|
+
createDirectory(rootPath: string, path: string): Promise<void>;
|
|
19
|
+
stat(rootPath: string, path: string): Promise<FileMeta | null>;
|
|
20
|
+
readBinary(rootPath: string, path: string): Promise<ArrayBuffer | null>;
|
|
21
|
+
writeBinary(rootPath: string, path: string, data: ArrayBuffer | Uint8Array): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Subscribe to change notifications for a watched root. Returns an
|
|
24
|
+
* unsubscribe function. The main process uses chokidar under the hood.
|
|
25
|
+
*/
|
|
26
|
+
watch(rootPath: string, onChange: (path: string) => void): () => void;
|
|
27
|
+
}
|
|
28
|
+
/** Descriptor returned for an Electron-managed workspace (backed by a folder). */
|
|
29
|
+
export interface ElectronWorkspaceInfo {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
rootPath: string;
|
|
33
|
+
}
|
|
34
|
+
/** Workspace-management operations exposed to the renderer. */
|
|
35
|
+
export interface DocblocksHostWorkspacesAPI {
|
|
36
|
+
/**
|
|
37
|
+
* Return the default workspace (creating ~/Documents/DocBlocks on first
|
|
38
|
+
* call, or the user's configured default).
|
|
39
|
+
*/
|
|
40
|
+
getDefault(): Promise<ElectronWorkspaceInfo>;
|
|
41
|
+
/**
|
|
42
|
+
* Open the native folder picker. Returns null if the user cancels.
|
|
43
|
+
* The selected folder is registered in the main process whitelist.
|
|
44
|
+
*/
|
|
45
|
+
pickFolder(): Promise<ElectronWorkspaceInfo | null>;
|
|
46
|
+
/**
|
|
47
|
+
* Re-register a previously known workspace so its rootPath is trusted
|
|
48
|
+
* for subsequent fs calls. Called on app startup for persisted
|
|
49
|
+
* electron-native workspaces before any fs operation.
|
|
50
|
+
*/
|
|
51
|
+
register(info: ElectronWorkspaceInfo): Promise<void>;
|
|
52
|
+
/** Remove a workspace from the trusted whitelist. */
|
|
53
|
+
unregister(id: string): Promise<void>;
|
|
54
|
+
}
|
|
55
|
+
/** Shell operations — reveal in Finder/Explorer, open external URLs. */
|
|
56
|
+
export interface DocblocksHostShellAPI {
|
|
57
|
+
/** Reveal a file (by absolute path) in the OS file manager. */
|
|
58
|
+
revealInFolder(absolutePath: string): Promise<void>;
|
|
59
|
+
/** Open a URL in the default browser. */
|
|
60
|
+
openExternal(url: string): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
/** System ffmpeg detection and invocation. */
|
|
63
|
+
export interface DocblocksHostFfmpegAPI {
|
|
64
|
+
/** True if `ffmpeg` is available on PATH (or bundled). */
|
|
65
|
+
available(): Promise<boolean>;
|
|
66
|
+
/** Version string from `ffmpeg -version`, or null if unavailable. */
|
|
67
|
+
version(): Promise<string | null>;
|
|
68
|
+
/**
|
|
69
|
+
* Render a markdown file at the given absolute path to MP4 using the
|
|
70
|
+
* existing squisq-video CLI pipeline. Returns the absolute path to the
|
|
71
|
+
* produced MP4 file, or throws on failure.
|
|
72
|
+
*/
|
|
73
|
+
renderVideo(markdownAbsolutePath: string, options: {
|
|
74
|
+
fps?: number;
|
|
75
|
+
quality?: 'draft' | 'normal' | 'high';
|
|
76
|
+
}): Promise<string>;
|
|
77
|
+
}
|
|
78
|
+
/** Auto-updater control. */
|
|
79
|
+
export interface DocblocksHostUpdaterAPI {
|
|
80
|
+
/** Kick off a check; resolves to true if an update is available. */
|
|
81
|
+
checkForUpdates(): Promise<boolean>;
|
|
82
|
+
/** Current app version string. */
|
|
83
|
+
getVersion(): Promise<string>;
|
|
84
|
+
/**
|
|
85
|
+
* Quit the app and apply a downloaded update. Should only be called
|
|
86
|
+
* after an `UpdaterStatus` of kind `'downloaded'` has been observed.
|
|
87
|
+
*/
|
|
88
|
+
quitAndInstall(): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Subscribe to updater status events. Returns an unsubscribe function.
|
|
91
|
+
*/
|
|
92
|
+
onStatus(listener: (status: UpdaterStatus) => void): () => void;
|
|
93
|
+
}
|
|
94
|
+
export type UpdaterStatus = {
|
|
95
|
+
kind: 'checking';
|
|
96
|
+
} | {
|
|
97
|
+
kind: 'available';
|
|
98
|
+
version: string;
|
|
99
|
+
releaseNotes?: string;
|
|
100
|
+
releaseUrl?: string;
|
|
101
|
+
} | {
|
|
102
|
+
kind: 'not-available';
|
|
103
|
+
} | {
|
|
104
|
+
kind: 'downloading';
|
|
105
|
+
percent: number;
|
|
106
|
+
} | {
|
|
107
|
+
kind: 'downloaded';
|
|
108
|
+
version: string;
|
|
109
|
+
releaseNotes?: string;
|
|
110
|
+
releaseUrl?: string;
|
|
111
|
+
} | {
|
|
112
|
+
kind: 'error';
|
|
113
|
+
message: string;
|
|
114
|
+
};
|
|
115
|
+
/** Menu-command events pushed from the main process to the renderer. */
|
|
116
|
+
export type MenuCommand = 'file:new' | 'file:openFolder' | 'file:revealWorkspace' | 'file:settings' | 'help:about' | 'help:checkForUpdates' | 'help:viewOnGitHub';
|
|
117
|
+
/** Deep-link event: the user opened a docblocks:// URL or dropped a file. */
|
|
118
|
+
export interface OpenRequest {
|
|
119
|
+
/** For docblocks:// URLs — the full URL string. */
|
|
120
|
+
url?: string;
|
|
121
|
+
/** For file drops / open-with — absolute path to the file. */
|
|
122
|
+
filePath?: string;
|
|
123
|
+
}
|
|
124
|
+
/** Environment metadata provided by the host. */
|
|
125
|
+
export interface HostEnvironment {
|
|
126
|
+
platform: 'darwin' | 'win32' | 'linux';
|
|
127
|
+
appVersion: string;
|
|
128
|
+
isDev: boolean;
|
|
129
|
+
}
|
|
130
|
+
/** The full DocBlocks desktop host API. */
|
|
131
|
+
export interface DocblocksHostAPI {
|
|
132
|
+
env: HostEnvironment;
|
|
133
|
+
fs: DocblocksHostFsAPI;
|
|
134
|
+
workspaces: DocblocksHostWorkspacesAPI;
|
|
135
|
+
shell: DocblocksHostShellAPI;
|
|
136
|
+
ffmpeg: DocblocksHostFfmpegAPI;
|
|
137
|
+
updater: DocblocksHostUpdaterAPI;
|
|
138
|
+
/**
|
|
139
|
+
* Subscribe to menu commands dispatched by the native menu.
|
|
140
|
+
* Returns an unsubscribe function.
|
|
141
|
+
*/
|
|
142
|
+
onMenuCommand(listener: (cmd: MenuCommand) => void): () => void;
|
|
143
|
+
/**
|
|
144
|
+
* Subscribe to open-file / open-url requests from the OS.
|
|
145
|
+
* Returns an unsubscribe function.
|
|
146
|
+
*/
|
|
147
|
+
onOpenRequest(listener: (request: OpenRequest) => void): () => void;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/host/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAExE,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACjE,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC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OAAO,EAAE,uBAAuB,CAAC;IACjC;;;OAGG;IACH,aAAa,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAChE;;;OAGG;IACH,aAAa,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CACrE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DocblocksHostAPI — the contract exposed by the Electron desktop shell
|
|
3
|
+
* to its renderer process via contextBridge.
|
|
4
|
+
*
|
|
5
|
+
* This file is the single source of truth for the host ↔ renderer
|
|
6
|
+
* bridge. The Electron preload script exposes an implementation matching
|
|
7
|
+
* this shape; the React renderer calls it through `window.docblocksHost`.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/host/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|