crossnote 0.9.36 → 0.9.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -14
- package/out/cjs/index.cjs +286 -271
- package/out/cli/index.cjs +265 -131
- package/out/esm/index.mjs +237 -222
- package/out/server-app/server-app.css +1 -1
- package/out/server-app/server-app.js +6 -6
- package/out/types/src/markdown-engine/index.d.ts +2 -1
- package/out/types/src/notebook/types.d.ts +1 -0
- package/out/types/src/serve/preview-host-shim.d.ts +1 -0
- package/out/types/src/server-app/components/FilePicker.d.ts +3 -1
- package/out/types/src/server-app/components/LayoutView.d.ts +1 -0
- package/out/types/src/server-app/components/PreviewFrame.d.ts +2 -1
- package/out/types/src/server-app/lib/api.d.ts +27 -10
- package/out/types/src/server-app/lib/wiki.d.ts +10 -0
- package/out/types/src/utility.d.ts +1 -1
- package/out/types/src/webview/containers/preview.d.ts +1 -0
- package/out/types/src/webview/lib/utility.d.ts +4 -0
- package/out/types/src/wiki/index.d.ts +13 -1
- package/out/types/test/nul-character.test.d.ts +1 -0
- package/out/types/test/server-app/wiki.test.d.ts +1 -0
- package/out/types/tsconfig.tsbuildinfo +1 -1
- package/out/webview/backlinks.css +1 -1
- package/out/webview/backlinks.js +4 -4
- package/out/webview/graph-view.css +1 -1
- package/out/webview/graph-view.js +6 -6
- package/out/webview/preview.css +1 -1
- package/out/webview/preview.js +190 -190
- package/package.json +1 -1
- package/out/types/src/wiki-app/wiki-app.d.ts +0 -17
- package/out/wiki-app/wiki-app.css +0 -1
- package/out/wiki-app/wiki-app.js +0 -18
|
@@ -59,7 +59,7 @@ export declare class MarkdownEngine {
|
|
|
59
59
|
private generateStylesForPreview;
|
|
60
60
|
private generateJSAndCssFilesForPreview;
|
|
61
61
|
private isPathInsideProjectDirectory;
|
|
62
|
-
generateHTMLTemplateForPreview({ inputString, body, webviewScript, scripts, styles, head, config, vscodePreviewPanel, contentSecurityPolicy, isVSCodeWebExtension, }: {
|
|
62
|
+
generateHTMLTemplateForPreview({ inputString, body, webviewScript, scripts, styles, head, config, vscodePreviewPanel, contentSecurityPolicy, isVSCodeWebExtension, parsedOutput, }: {
|
|
63
63
|
inputString?: string;
|
|
64
64
|
body?: string;
|
|
65
65
|
webviewScript?: string;
|
|
@@ -70,6 +70,7 @@ export declare class MarkdownEngine {
|
|
|
70
70
|
vscodePreviewPanel: vscode.WebviewPanel | null | undefined;
|
|
71
71
|
contentSecurityPolicy?: string;
|
|
72
72
|
isVSCodeWebExtension?: boolean;
|
|
73
|
+
parsedOutput?: MarkdownEngineOutput;
|
|
73
74
|
}): Promise<string>;
|
|
74
75
|
generateHTMLTemplateForGraphView({ vscodePreviewPanel, contentSecurityPolicy, }: {
|
|
75
76
|
vscodePreviewPanel: vscode.WebviewPanel | null | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function previewHostShimScript(targetOriginExpression: string): string;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { MarkdownFileInfo } from '../lib/api';
|
|
2
3
|
export interface FilePickerProps {
|
|
3
4
|
open: boolean;
|
|
4
5
|
recents: string[];
|
|
5
6
|
rootDirectories: string[];
|
|
7
|
+
embeddedFiles?: MarkdownFileInfo[];
|
|
6
8
|
onClose: () => void;
|
|
7
9
|
onOpenFile: (file: string) => void;
|
|
8
10
|
}
|
|
9
|
-
export default function FilePicker({ open, recents, rootDirectories, onClose, onOpenFile, }: FilePickerProps): React.JSX.Element | null;
|
|
11
|
+
export default function FilePicker({ open, recents, rootDirectories, embeddedFiles, onClose, onOpenFile, }: FilePickerProps): React.JSX.Element | null;
|
|
@@ -21,6 +21,7 @@ export interface LayoutActions {
|
|
|
21
21
|
onTabDragEnd: () => void;
|
|
22
22
|
onTabDrop: (paneId: string, insertionIndex: number) => void;
|
|
23
23
|
onPaneBodyDrop: (paneId: string, zone: DropZone) => void;
|
|
24
|
+
frameDocument?: (file: string) => string | undefined;
|
|
24
25
|
}
|
|
25
26
|
export declare function useLayoutActions(): LayoutActions;
|
|
26
27
|
export default function LayoutView({ node, actions, }: {
|
|
@@ -3,8 +3,9 @@ export interface PreviewFrameProps {
|
|
|
3
3
|
tabId: string;
|
|
4
4
|
file: string;
|
|
5
5
|
visible: boolean;
|
|
6
|
+
documentProvider?: (file: string) => string | undefined;
|
|
6
7
|
onRegister: (tabId: string, file: string, iframe: HTMLIFrameElement | null, reload: (() => void) | null) => void;
|
|
7
8
|
onBecameVisible: (tabId: string) => void;
|
|
8
9
|
onFrameFocus: (tabId: string) => void;
|
|
9
10
|
}
|
|
10
|
-
export default function PreviewFrame({ tabId, file, visible, onRegister, onBecameVisible, onFrameFocus, }: PreviewFrameProps): React.JSX.Element;
|
|
11
|
+
export default function PreviewFrame({ tabId, file, visible, documentProvider, onRegister, onBecameVisible, onFrameFocus, }: PreviewFrameProps): React.JSX.Element | null;
|
|
@@ -9,12 +9,38 @@ export interface ServerInfo {
|
|
|
9
9
|
vscode: boolean;
|
|
10
10
|
url: string;
|
|
11
11
|
}
|
|
12
|
+
export interface WikiNoteUpdate {
|
|
13
|
+
markdown: string;
|
|
14
|
+
html: string;
|
|
15
|
+
tocHTML: string;
|
|
16
|
+
totalLineCount: number;
|
|
17
|
+
sourceUri: string;
|
|
18
|
+
sourceScheme: string;
|
|
19
|
+
id: string;
|
|
20
|
+
class: string;
|
|
21
|
+
jsAndCssFiles?: string[];
|
|
22
|
+
}
|
|
23
|
+
export interface WikiFileMeta {
|
|
24
|
+
path: string;
|
|
25
|
+
root: string;
|
|
26
|
+
title: string;
|
|
27
|
+
mtimeMs: number;
|
|
28
|
+
html: string;
|
|
29
|
+
update: WikiNoteUpdate;
|
|
30
|
+
}
|
|
31
|
+
export interface WikiData {
|
|
32
|
+
rootDirectories: string[];
|
|
33
|
+
assets: Record<string, string>;
|
|
34
|
+
files: WikiFileMeta[];
|
|
35
|
+
}
|
|
12
36
|
declare global {
|
|
13
37
|
interface Window {
|
|
14
38
|
__CROSSNOTE_SERVER__?: ServerInfo;
|
|
39
|
+
__CROSSNOTE_WIKI__?: WikiData;
|
|
15
40
|
}
|
|
16
41
|
}
|
|
17
42
|
export declare function getServerInfo(): ServerInfo;
|
|
43
|
+
export declare function getWikiData(): WikiData | null;
|
|
18
44
|
export declare function rootContaining(rootDirectories: string[], filePath: string): number;
|
|
19
45
|
export declare function fetchFiles(): Promise<MarkdownFileInfo[]>;
|
|
20
46
|
export declare function sendCommand(file: string, command: string, args: unknown[]): Promise<void>;
|
|
@@ -31,15 +57,6 @@ export interface WebviewFinishLoadingArgs {
|
|
|
31
57
|
uri: string;
|
|
32
58
|
systemColorScheme: 'light' | 'dark';
|
|
33
59
|
}
|
|
34
|
-
export interface UpdateHtmlPayload {
|
|
60
|
+
export interface UpdateHtmlPayload extends WikiNoteUpdate {
|
|
35
61
|
command?: string;
|
|
36
|
-
markdown: string;
|
|
37
|
-
html: string;
|
|
38
|
-
tocHTML: string;
|
|
39
|
-
totalLineCount: number;
|
|
40
|
-
sourceUri: string;
|
|
41
|
-
sourceScheme: string;
|
|
42
|
-
id: string;
|
|
43
|
-
class: string;
|
|
44
|
-
jsAndCssFiles?: string[];
|
|
45
62
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WikiData, WikiFileMeta } from './api';
|
|
2
|
+
export declare function assembleWikiDocument(data: WikiData, file: WikiFileMeta): string;
|
|
3
|
+
export declare function wikiKeyOf(filePath: string): string;
|
|
4
|
+
export declare function createWikiIndex(data: WikiData): Map<string, WikiFileMeta>;
|
|
5
|
+
export declare function wikiFileList(data: WikiData): Array<{
|
|
6
|
+
absolutePath: string;
|
|
7
|
+
relativePath: string;
|
|
8
|
+
mtimeMs: number;
|
|
9
|
+
rootPath: string;
|
|
10
|
+
}>;
|
|
@@ -14,7 +14,7 @@ export declare function sleep(ms: number): Promise<void>;
|
|
|
14
14
|
export declare function parseYAML(yaml?: string): JsonObject;
|
|
15
15
|
export declare function setCrossnoteBuildDirectory(path: string): void;
|
|
16
16
|
export declare function getCrossnoteBuildDirectory(): string;
|
|
17
|
-
export declare function useExternalAddFileProtocolFunction(func: (filePath: string, vscodePreviewPanel?: vscode.WebviewPanel | null) => string): void;
|
|
17
|
+
export declare function useExternalAddFileProtocolFunction(func: ((filePath: string, vscodePreviewPanel?: vscode.WebviewPanel | null) => string) | null): () => void;
|
|
18
18
|
export declare function addFileProtocol(filePath: string, vscodePreviewPanel?: vscode.WebviewPanel | null): string;
|
|
19
19
|
export declare function removeFileProtocol(filePath: string): string;
|
|
20
20
|
export { uploadImage } from './tools/image-uploader';
|
|
@@ -20,6 +20,7 @@ declare const PreviewContainer: import("unstated-next").Container<{
|
|
|
20
20
|
isShowingTranslation: boolean;
|
|
21
21
|
isVSCode: boolean;
|
|
22
22
|
isVSCodeWebExtension: boolean;
|
|
23
|
+
isWiki: boolean;
|
|
23
24
|
markdown: string;
|
|
24
25
|
markdownEditorExpanded: boolean;
|
|
25
26
|
notice: string | undefined;
|
|
@@ -2,3 +2,7 @@ export declare function getElementBackgroundColor(element: HTMLElement): string;
|
|
|
2
2
|
export declare function isBackgroundColorLight(element: HTMLElement): boolean;
|
|
3
3
|
export declare function copyTextToClipboard(text: string): void;
|
|
4
4
|
export declare function copyBlobToClipboard(blob: Blob): void;
|
|
5
|
+
export declare function readLocalStorage(key: string): string | null;
|
|
6
|
+
export declare function writeLocalStorage(key: string, value: string): void;
|
|
7
|
+
export declare function readSessionStorage(key: string): string | null;
|
|
8
|
+
export declare function writeSessionStorage(key: string, value: string): void;
|
|
@@ -14,11 +14,23 @@ export interface WikiFileEntry {
|
|
|
14
14
|
path: string;
|
|
15
15
|
root: string;
|
|
16
16
|
title: string;
|
|
17
|
+
mtimeMs: number;
|
|
17
18
|
html: string;
|
|
19
|
+
update: {
|
|
20
|
+
markdown: string;
|
|
21
|
+
html: string;
|
|
22
|
+
tocHTML: string;
|
|
23
|
+
totalLineCount: number;
|
|
24
|
+
sourceUri: string;
|
|
25
|
+
sourceScheme: string;
|
|
26
|
+
id: string;
|
|
27
|
+
class: string;
|
|
28
|
+
jsAndCssFiles: string[];
|
|
29
|
+
};
|
|
18
30
|
}
|
|
19
31
|
export interface BuildWikiResult {
|
|
20
32
|
html: string;
|
|
21
|
-
files: Array<Pick<WikiFileEntry, 'path' | 'root' | 'title'>>;
|
|
33
|
+
files: Array<Pick<WikiFileEntry, 'path' | 'root' | 'title' | 'mtimeMs'>>;
|
|
22
34
|
rootDirectories: string[];
|
|
23
35
|
failures: Array<{
|
|
24
36
|
path: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|