@bendyline/docblocks-react 2.6.1 → 2.7.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/README.md +3 -10
- package/THIRD_PARTY_NOTICES.txt +4284 -3651
- package/dist/AiDiagrams-XWOM3YZX.js +13 -0
- package/dist/AiEditorAssistant-M4LI2CRY.js +771 -0
- package/dist/AudioExportDialog-F23QXNPB.js +253 -0
- package/dist/DocumentConflictDialog-5LRVIGXS.js +111 -0
- package/dist/ExportDialog-L6FG6W3H.js +9 -0
- package/dist/{ExportToolbarControls-QYLBRWM7.js → ExportToolbarControls-BRCPZ7H3.js} +108 -42
- package/dist/{GitUI-L5T3XHZG.js → GitUI-LZW3IUXO.js} +5 -5
- package/dist/PresentationMaker-622NHMIN.js +9 -0
- package/dist/QuickOpenDialog-2KK4SEBU.js +356 -0
- package/dist/Settings-DuXk6baH.d.ts +144 -0
- package/dist/{ShareDialog-4OX3UPJ4.js → ShareDialog-N7GPM4SB.js} +10 -59
- package/dist/SpeechToolbarControl-UZQKGQWD.js +434 -0
- package/dist/TextFromNarration-XYRAB6O2.js +598 -0
- package/dist/WorkspaceSearchPanel-OUQQ5DOM.js +328 -0
- package/dist/chunk-2IYBBFQX.js +201 -0
- package/dist/{chunk-LG6HAWCK.js → chunk-56KO2LYN.js} +35 -4
- package/dist/chunk-5OZBGIIT.js +1826 -0
- package/dist/chunk-6B7G33D5.js +88 -0
- package/dist/chunk-ARATARVJ.js +40 -0
- package/dist/{chunk-ODYNOPC3.js → chunk-BCQZTWE5.js} +57 -17
- package/dist/chunk-EA4BO6E4.js +73 -0
- package/dist/chunk-G4MFB3IO.js +208 -0
- package/dist/chunk-I44HKDQX.js +314 -0
- package/dist/chunk-K4I3NJFL.js +49 -0
- package/dist/chunk-KBDZDFPU.js +61 -0
- package/dist/{chunk-FNSRCCBC.js → chunk-KWG6UP5O.js} +0 -10
- package/dist/chunk-MMOTEQK6.js +518 -0
- package/dist/chunk-OINKNX26.js +574 -0
- package/dist/chunk-Q5ZVP5LV.js +1711 -0
- package/dist/chunk-RP3DVNTI.js +62 -0
- package/dist/{chunk-FMDLZ4ZG.js → chunk-SGQKTKDX.js} +2 -2
- package/dist/chunk-TBLZBNQF.js +25 -0
- package/dist/{chunk-M5Y5WO7Z.js → chunk-UG4G7PJ4.js} +1 -1
- package/dist/chunk-UONFWKJ7.js +22 -0
- package/dist/chunk-VO2JYYQZ.js +40 -0
- package/dist/{chunk-EBWYGTN7.js → chunk-X437UAF7.js} +6 -0
- package/dist/chunk-YS4HVWIO.js +63 -0
- package/dist/editor.d.ts +36 -1
- package/dist/editor.js +16 -1
- package/dist/export/index.d.ts +27 -11
- package/dist/export/index.js +11 -7
- package/dist/index.d.ts +100 -13
- package/dist/index.js +3916 -1633
- package/dist/{run-export-I2XOVGG4.js → run-export-47X5FTYZ.js} +3 -3
- package/dist/settings/index.d.ts +32 -101
- package/dist/settings/index.js +14 -2
- package/package.json +9 -9
- package/src/styles/docblocks.css +2337 -650
- package/dist/ExportDialog-Q4VWI43H.js +0 -9
- package/dist/chunk-JDJVRDOP.js +0 -92
- package/dist/chunk-Q6XNIKDG.js +0 -669
- package/dist/{GitToolbarControl-O5AXBC6T.js → GitToolbarControl-J4UYZDV6.js} +3 -3
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// src/Export/video-export-doc.ts
|
|
2
|
+
import { parseMarkdown } from "@bendyline/squisq/markdown";
|
|
3
|
+
var DATA_PREVIEW_ROWS = 50;
|
|
4
|
+
var TRANSFORM_KEY = "squisq-transform";
|
|
5
|
+
var LEGACY_TRANSFORM_KEY = "transform-style";
|
|
6
|
+
function persistedTransformStyle(frontmatter, knownIds) {
|
|
7
|
+
if (!frontmatter) return null;
|
|
8
|
+
const value = Object.prototype.hasOwnProperty.call(frontmatter, TRANSFORM_KEY) ? frontmatter[TRANSFORM_KEY] : frontmatter[LEGACY_TRANSFORM_KEY];
|
|
9
|
+
if (typeof value !== "string") return null;
|
|
10
|
+
const normalized = value.trim().toLowerCase().replace(/\s+/g, "-");
|
|
11
|
+
const id = normalized === "datadriven" ? "data-driven" : normalized;
|
|
12
|
+
return knownIds.has(id) ? id : null;
|
|
13
|
+
}
|
|
14
|
+
async function withDataPreviews(doc, container, resolveDataReferences) {
|
|
15
|
+
try {
|
|
16
|
+
const { defaultDataReaders } = await import("@bendyline/squisq-formats/data");
|
|
17
|
+
const resolved = await resolveDataReferences(doc, container, {
|
|
18
|
+
readers: defaultDataReaders(),
|
|
19
|
+
maxPreviewRows: DATA_PREVIEW_ROWS
|
|
20
|
+
});
|
|
21
|
+
return resolved.doc;
|
|
22
|
+
} catch {
|
|
23
|
+
return doc;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function buildVideoExportDoc(markdownSource, options = {}) {
|
|
27
|
+
const [
|
|
28
|
+
{
|
|
29
|
+
buildPreviewDoc,
|
|
30
|
+
documentTitleFromFileName,
|
|
31
|
+
markdownToDoc,
|
|
32
|
+
resolveAudioMapping,
|
|
33
|
+
resolveDataReferences
|
|
34
|
+
},
|
|
35
|
+
{ applyTransform, getTransformStyleSummaries }
|
|
36
|
+
] = await Promise.all([import("@bendyline/squisq/doc"), import("@bendyline/squisq/transform")]);
|
|
37
|
+
let doc = markdownToDoc(parseMarkdown(markdownSource));
|
|
38
|
+
const container = options.workspaceContainer;
|
|
39
|
+
if (container) {
|
|
40
|
+
doc = await resolveAudioMapping(doc, container).catch(() => doc);
|
|
41
|
+
doc = await withDataPreviews(doc, container, resolveDataReferences);
|
|
42
|
+
}
|
|
43
|
+
const knownIds = new Set(getTransformStyleSummaries().map((summary) => summary.id));
|
|
44
|
+
const transformStyle = persistedTransformStyle(doc.frontmatter, knownIds);
|
|
45
|
+
const contentDoc = transformStyle ? applyTransform(doc, transformStyle).doc : doc;
|
|
46
|
+
const narrationOwnsTimeline = (contentDoc.documentMedia ?? []).some(
|
|
47
|
+
(clip) => clip.anchor === "document"
|
|
48
|
+
);
|
|
49
|
+
const projected = buildPreviewDoc(contentDoc, {
|
|
50
|
+
documentTitle: documentTitleFromFileName(options.fileName ?? void 0),
|
|
51
|
+
interleaveImages: !narrationOwnsTimeline
|
|
52
|
+
});
|
|
53
|
+
const invalidPresentation = projected.diagnostics?.find(
|
|
54
|
+
(diagnostic) => diagnostic.code === "presentation-invalid"
|
|
55
|
+
);
|
|
56
|
+
if (invalidPresentation) throw new Error(invalidPresentation.message);
|
|
57
|
+
return { ...projected, audio: contentDoc.audio };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
buildVideoExportDoc
|
|
62
|
+
};
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
FORMAT_LABELS,
|
|
6
6
|
saveExportOptions
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-X437UAF7.js";
|
|
8
8
|
import {
|
|
9
9
|
Dialog
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-56KO2LYN.js";
|
|
11
11
|
|
|
12
12
|
// src/Export/ExportDialog.tsx
|
|
13
13
|
import { useState, useCallback, useEffect, useMemo } from "react";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// src/components/HighlightedText.tsx
|
|
2
|
+
import { Fragment } from "react";
|
|
3
|
+
import { Fragment as Fragment2, jsx } from "react/jsx-runtime";
|
|
4
|
+
function HighlightedText({ text, ranges }) {
|
|
5
|
+
const parts = [];
|
|
6
|
+
let cursor = 0;
|
|
7
|
+
for (const [rawStart, rawEnd] of ranges) {
|
|
8
|
+
const start = Math.max(cursor, Math.min(rawStart, text.length));
|
|
9
|
+
const end = Math.min(rawEnd, text.length);
|
|
10
|
+
if (end <= start) continue;
|
|
11
|
+
if (start > cursor)
|
|
12
|
+
parts.push(/* @__PURE__ */ jsx(Fragment, { children: text.slice(cursor, start) }, `t${cursor}`));
|
|
13
|
+
parts.push(
|
|
14
|
+
/* @__PURE__ */ jsx("mark", { className: "db-search-match", children: text.slice(start, end) }, `m${start}`)
|
|
15
|
+
);
|
|
16
|
+
cursor = end;
|
|
17
|
+
}
|
|
18
|
+
if (cursor < text.length)
|
|
19
|
+
parts.push(/* @__PURE__ */ jsx(Fragment, { children: text.slice(cursor) }, `t${cursor}`));
|
|
20
|
+
return /* @__PURE__ */ jsx(Fragment2, { children: parts });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
HighlightedText
|
|
25
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/Export/host-error.ts
|
|
2
|
+
function hostErrorDetail(caught) {
|
|
3
|
+
return caught instanceof Error ? caught.message.replace(/^Error invoking remote method '[^']+': Error:\s*/, "").trim() : "";
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
// src/Export/image-save.ts
|
|
7
|
+
function createImageSaveOutput(adapter) {
|
|
8
|
+
return async (blob, filename) => {
|
|
9
|
+
try {
|
|
10
|
+
const target = await adapter.pickTarget(filename, null);
|
|
11
|
+
if (!target) return false;
|
|
12
|
+
return await adapter.saveBlob(blob, filename, target) !== null;
|
|
13
|
+
} catch (caught) {
|
|
14
|
+
throw new Error(hostErrorDetail(caught) || `Couldn't save "${filename}".`);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
hostErrorDetail,
|
|
21
|
+
createImageSaveOutput
|
|
22
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/Speech/useSpeechStatus.ts
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
function useSpeechStatus(speech) {
|
|
4
|
+
const [status, setStatus] = useState(null);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
let live = true;
|
|
7
|
+
const unsubscribe = speech.onStatus((next) => {
|
|
8
|
+
if (live) setStatus(next);
|
|
9
|
+
});
|
|
10
|
+
void speech.status().then(
|
|
11
|
+
(initial) => {
|
|
12
|
+
if (live) setStatus((current) => current ?? initial);
|
|
13
|
+
},
|
|
14
|
+
() => {
|
|
15
|
+
if (live)
|
|
16
|
+
setStatus(
|
|
17
|
+
(current) => current ?? {
|
|
18
|
+
stt: {
|
|
19
|
+
state: "unavailable",
|
|
20
|
+
reason: "Speech status is unavailable. Try opening Settings."
|
|
21
|
+
},
|
|
22
|
+
tts: {
|
|
23
|
+
state: "unavailable",
|
|
24
|
+
reason: "Speech status is unavailable. Try opening Settings."
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
return () => {
|
|
31
|
+
live = false;
|
|
32
|
+
unsubscribe();
|
|
33
|
+
};
|
|
34
|
+
}, [speech]);
|
|
35
|
+
return status;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
useSpeechStatus
|
|
40
|
+
};
|
|
@@ -26,6 +26,11 @@ var DEFAULT_OPTIONS = {
|
|
|
26
26
|
includeLinkedDocs: false,
|
|
27
27
|
entryAsIndex: false
|
|
28
28
|
};
|
|
29
|
+
function resolveExportDialogInitial(lastOptions, docThemeId, workspaceThemeId) {
|
|
30
|
+
const base = lastOptions ?? DEFAULT_OPTIONS;
|
|
31
|
+
const themeId = docThemeId || workspaceThemeId;
|
|
32
|
+
return themeId ? { ...base, themeId } : base;
|
|
33
|
+
}
|
|
29
34
|
function loadLastExportOptions() {
|
|
30
35
|
try {
|
|
31
36
|
const raw = localStorage.getItem(STORAGE_KEY);
|
|
@@ -47,6 +52,7 @@ export {
|
|
|
47
52
|
FORMAT_LABELS,
|
|
48
53
|
FORMAT_EXTENSIONS,
|
|
49
54
|
DEFAULT_OPTIONS,
|
|
55
|
+
resolveExportDialogInitial,
|
|
50
56
|
loadLastExportOptions,
|
|
51
57
|
saveExportOptions
|
|
52
58
|
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// src/Export/shared-document.ts
|
|
2
|
+
import {
|
|
3
|
+
SHARED_DOCUMENT_LIMITS,
|
|
4
|
+
createSharedDocumentUrl
|
|
5
|
+
} from "@bendyline/docblocks/share";
|
|
6
|
+
var PUBLIC_DOCBLOCKS_SHARE_URL = "https://docblocks.com/";
|
|
7
|
+
function resolveSharedDocumentBaseUrl(currentUrl) {
|
|
8
|
+
try {
|
|
9
|
+
const current = new URL(currentUrl);
|
|
10
|
+
if (current.protocol === "http:" || current.protocol === "https:") {
|
|
11
|
+
current.hash = "";
|
|
12
|
+
current.searchParams.delete("action");
|
|
13
|
+
return current.toString();
|
|
14
|
+
}
|
|
15
|
+
} catch {
|
|
16
|
+
}
|
|
17
|
+
return PUBLIC_DOCBLOCKS_SHARE_URL;
|
|
18
|
+
}
|
|
19
|
+
function sharedDocumentFilename(selectedFile) {
|
|
20
|
+
const basename = selectedFile?.replace(/\\/gu, "/").split("/").pop() ?? "shared.md";
|
|
21
|
+
const stem = basename.replace(/\.md$/iu, "").replace(/[^A-Za-z0-9._-]+/gu, "-");
|
|
22
|
+
const bounded = stem.replace(/^-+|-+$/gu, "").slice(0, 80) || "shared";
|
|
23
|
+
return `${bounded}.md`;
|
|
24
|
+
}
|
|
25
|
+
async function createSharedDocumentArchive(markdown, selectedFile) {
|
|
26
|
+
const encoded = new TextEncoder().encode(markdown);
|
|
27
|
+
if (encoded.byteLength > SHARED_DOCUMENT_LIMITS.markdownBytes) {
|
|
28
|
+
throw new Error(
|
|
29
|
+
`This document is too large for a shared URL (maximum ${SHARED_DOCUMENT_LIMITS.markdownBytes.toLocaleString()} UTF-8 bytes).`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
const [{ MemoryContentContainer }, { containerToZip }] = await Promise.all([
|
|
33
|
+
import("@bendyline/squisq/storage"),
|
|
34
|
+
import("@bendyline/squisq-formats/container")
|
|
35
|
+
]);
|
|
36
|
+
const container = new MemoryContentContainer();
|
|
37
|
+
await container.writeFile(sharedDocumentFilename(selectedFile), encoded, "text/markdown");
|
|
38
|
+
const blob = await containerToZip(container, { compression: "DEFLATE", compressionLevel: 9 });
|
|
39
|
+
return new Uint8Array(await blob.arrayBuffer());
|
|
40
|
+
}
|
|
41
|
+
function buildSharedDocumentUrl(baseUrl, archive, mode) {
|
|
42
|
+
return createSharedDocumentUrl(resolveSharedDocumentBaseUrl(baseUrl), archive, mode);
|
|
43
|
+
}
|
|
44
|
+
function buildSharedDocumentQrUrl(archive, mode) {
|
|
45
|
+
const url = createSharedDocumentUrl(PUBLIC_DOCBLOCKS_SHARE_URL, archive, mode);
|
|
46
|
+
if (url.length > SHARED_DOCUMENT_LIMITS.qrUrlCharacters) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
"This document is too large for a reliable QR code (maximum " + SHARED_DOCUMENT_LIMITS.qrUrlCharacters.toLocaleString() + " URL characters). Copy the share link instead."
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
return url;
|
|
52
|
+
}
|
|
53
|
+
function sharedDocumentQrFilename(selectedFile) {
|
|
54
|
+
return sharedDocumentFilename(selectedFile).replace(/\.md$/iu, "-qr.png");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export {
|
|
58
|
+
sharedDocumentFilename,
|
|
59
|
+
createSharedDocumentArchive,
|
|
60
|
+
buildSharedDocumentUrl,
|
|
61
|
+
buildSharedDocumentQrUrl,
|
|
62
|
+
sharedDocumentQrFilename
|
|
63
|
+
};
|
package/dist/editor.d.ts
CHANGED
|
@@ -1,4 +1,39 @@
|
|
|
1
1
|
import { ViewportPreset } from '@bendyline/squisq/schemas';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { DocBlocksHostAiAPI } from '@bendyline/docblocks/host';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
declare function PresentationMaker({ ai, onClose, }: {
|
|
7
|
+
ai?: DocBlocksHostAiAPI;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
}): react.ReactPortal;
|
|
10
|
+
|
|
11
|
+
interface FindButtonProps {
|
|
12
|
+
readonly active: boolean;
|
|
13
|
+
readonly onActiveChange: (active: boolean) => void;
|
|
14
|
+
/** Platform label for the shortcut (e.g. `Ctrl+F` or `⌘F`), shown in the tooltip. */
|
|
15
|
+
readonly shortcutLabel?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Toolbar toggle for Squisq's Find mode. Squisq ships the find bar but no
|
|
19
|
+
* trigger, so every host that mounts `EditorShell` renders this in a toolbar
|
|
20
|
+
* slot and passes the state through `findMode` / `onFindModeChange`.
|
|
21
|
+
*/
|
|
22
|
+
declare function FindButton({ active, onActiveChange, shortcutLabel }: FindButtonProps): react_jsx_runtime.JSX.Element;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Re-focus an already-open find bar and select its query. Squisq focuses the
|
|
26
|
+
* input only when the bar mounts, so a repeated Ctrl/Cmd+F needs this.
|
|
27
|
+
*/
|
|
28
|
+
declare function focusFindInput(scope?: ParentNode): void;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Cmd/Ctrl+F, for hosts that mount Squisq's `EditorShell` without the shell's
|
|
32
|
+
* listener (the VS Code webview) but still want one find UI everywhere.
|
|
33
|
+
*/
|
|
34
|
+
declare function isFindShortcut(event: KeyboardEvent): boolean;
|
|
35
|
+
/** Tooltip label for the find shortcut on the current platform. */
|
|
36
|
+
declare function findShortcutLabel(): string;
|
|
2
37
|
|
|
3
38
|
declare const PORTRAIT_FORM_FACTOR_QUERY = "(orientation: portrait)";
|
|
4
39
|
/** Map the host surface orientation to Squisq's matching preview canvas. */
|
|
@@ -19,4 +54,4 @@ type EmptyDocumentPrompt = (typeof EMPTY_DOCUMENT_PROMPTS)[number];
|
|
|
19
54
|
/** Pick a prompt using the supplied random source, or `Math.random`. */
|
|
20
55
|
declare function pickEmptyDocumentPrompt(random?: () => number): EmptyDocumentPrompt;
|
|
21
56
|
|
|
22
|
-
export { EMPTY_DOCUMENT_PROMPTS, type EmptyDocumentPrompt, PORTRAIT_FORM_FACTOR_QUERY, pickEmptyDocumentPrompt, previewViewportPresetForOrientation, useResponsivePreviewViewportPreset };
|
|
57
|
+
export { EMPTY_DOCUMENT_PROMPTS, type EmptyDocumentPrompt, FindButton, type FindButtonProps, PORTRAIT_FORM_FACTOR_QUERY, PresentationMaker, findShortcutLabel, focusFindInput, isFindShortcut, pickEmptyDocumentPrompt, previewViewportPresetForOrientation, useResponsivePreviewViewportPreset };
|
package/dist/editor.js
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EMPTY_DOCUMENT_PROMPTS,
|
|
3
|
+
FindButton,
|
|
3
4
|
PORTRAIT_FORM_FACTOR_QUERY,
|
|
5
|
+
findShortcutLabel,
|
|
6
|
+
focusFindInput,
|
|
7
|
+
isFindShortcut,
|
|
4
8
|
pickEmptyDocumentPrompt,
|
|
5
9
|
previewViewportPresetForOrientation,
|
|
6
10
|
useResponsivePreviewViewportPreset
|
|
7
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-G4MFB3IO.js";
|
|
12
|
+
import {
|
|
13
|
+
PresentationMaker
|
|
14
|
+
} from "./chunk-MMOTEQK6.js";
|
|
15
|
+
import "./chunk-5OZBGIIT.js";
|
|
16
|
+
import "./chunk-K4I3NJFL.js";
|
|
17
|
+
import "./chunk-56KO2LYN.js";
|
|
8
18
|
export {
|
|
9
19
|
EMPTY_DOCUMENT_PROMPTS,
|
|
20
|
+
FindButton,
|
|
10
21
|
PORTRAIT_FORM_FACTOR_QUERY,
|
|
22
|
+
PresentationMaker,
|
|
23
|
+
findShortcutLabel,
|
|
24
|
+
focusFindInput,
|
|
25
|
+
isFindShortcut,
|
|
11
26
|
pickEmptyDocumentPrompt,
|
|
12
27
|
previewViewportPresetForOrientation,
|
|
13
28
|
useResponsivePreviewViewportPreset
|
package/dist/export/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as _bendyline_squisq_formats_pptx from '@bendyline/squisq-formats/pptx';
|
|
3
3
|
import { ContentContainer } from '@bendyline/squisq/storage';
|
|
4
|
+
import { DiagramRasterizer } from '@bendyline/squisq-formats/diagrams';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Export option types and localStorage persistence for quick-export.
|
|
@@ -52,6 +53,14 @@ interface ExportOptions {
|
|
|
52
53
|
declare const FORMAT_LABELS: Record<ExportFormat, string>;
|
|
53
54
|
declare const FORMAT_EXTENSIONS: Record<ExportFormat, string>;
|
|
54
55
|
declare const DEFAULT_OPTIONS: ExportOptions;
|
|
56
|
+
/**
|
|
57
|
+
* Options that populate the export dialog. Layered: built-in defaults → the
|
|
58
|
+
* user's last-chosen options → the workspace default theme → the document's
|
|
59
|
+
* own theme (wins). "Set a theme, then export" therefore pre-selects that
|
|
60
|
+
* theme instead of whatever was picked for an unrelated previous document,
|
|
61
|
+
* and documents without a theme export in their folder's default.
|
|
62
|
+
*/
|
|
63
|
+
declare function resolveExportDialogInitial(lastOptions: ExportOptions | null, docThemeId: string | null | undefined, workspaceThemeId?: string | null): ExportOptions;
|
|
55
64
|
declare function loadLastExportOptions(): ExportOptions | null;
|
|
56
65
|
declare function saveExportOptions(options: ExportOptions): void;
|
|
57
66
|
|
|
@@ -61,6 +70,11 @@ type ExportBlobSaver = (blob: Blob, filename: string) => Promise<void> | void;
|
|
|
61
70
|
/** Host-provided converters that must be loaded before an export begins. */
|
|
62
71
|
interface ExportConverterOverrides {
|
|
63
72
|
docToPptx?: (typeof _bendyline_squisq_formats_pptx)['docToPptx'];
|
|
73
|
+
/**
|
|
74
|
+
* Draws diagrams as pictures. Defaults to Squisq's browser renderer; tests
|
|
75
|
+
* pass a stand-in because drawing needs a real canvas.
|
|
76
|
+
*/
|
|
77
|
+
diagramRenderer?: DiagramRasterizer;
|
|
64
78
|
}
|
|
65
79
|
/** Run the export and trigger a download. */
|
|
66
80
|
declare function runExport(markdown: string, selectedFile: string | null, options: ExportOptions, mediaContainer?: ContentContainer | null, saveBlob?: ExportBlobSaver, converterOverrides?: ExportConverterOverrides): Promise<void>;
|
|
@@ -102,25 +116,27 @@ declare function ExportDialog({ initial, exporting, error, destination, onExport
|
|
|
102
116
|
declare function updateExportTargetExtension(targetPath: string, suggestedFilename: string): string;
|
|
103
117
|
|
|
104
118
|
/**
|
|
105
|
-
* Host persistence for
|
|
119
|
+
* Host persistence for Squisq's rendered-output exporters.
|
|
106
120
|
*
|
|
107
|
-
* Squisq renders
|
|
108
|
-
* browser and hands the host a finished blob; DocBlocks owns where that
|
|
109
|
-
* blob lands. The
|
|
110
|
-
* (`DashboardImageSaveOutput` is an alias of `CoverImageSaveOutput
|
|
111
|
-
*
|
|
121
|
+
* Squisq renders the cover image, the Dashboard image, and exported video in
|
|
122
|
+
* the browser and hands the host a finished blob; DocBlocks owns where that
|
|
123
|
+
* blob lands. The exporters share one save-output contract upstream
|
|
124
|
+
* (`DashboardImageSaveOutput` is an alias of `CoverImageSaveOutput`, and the
|
|
125
|
+
* video dialog's `saveOutput` has the same shape), so they share one adapter
|
|
126
|
+
* here rather than identical copies.
|
|
112
127
|
*/
|
|
113
|
-
/** Host persistence shape required by the editor's
|
|
128
|
+
/** Host persistence shape required by the editor's rendered-output exporters. */
|
|
114
129
|
interface ImageSaveAdapter<TTarget> {
|
|
115
130
|
pickTarget(filename: string, currentTarget?: TTarget | null): Promise<TTarget | null>;
|
|
116
131
|
saveBlob(blob: Blob, filename: string, target?: TTarget | null): Promise<TTarget | null>;
|
|
117
132
|
}
|
|
118
133
|
type ImageSaveOutput = (blob: Blob, filename: string) => Promise<boolean | void>;
|
|
119
134
|
/**
|
|
120
|
-
* Adapt DocBlocks' two-step host destination flow to Squisq's rendered
|
|
121
|
-
*
|
|
122
|
-
*
|
|
135
|
+
* Adapt DocBlocks' two-step host destination flow to Squisq's rendered output
|
|
136
|
+
* callback. The picker stays host-owned, and cancellation is reported as
|
|
137
|
+
* `false` so the export dialog remains open without showing an error. Squisq
|
|
138
|
+
* shows a failure's message verbatim, so it arrives without IPC internals.
|
|
123
139
|
*/
|
|
124
140
|
declare function createImageSaveOutput<TTarget>(adapter: ImageSaveAdapter<TTarget>): ImageSaveOutput;
|
|
125
141
|
|
|
126
|
-
export { type ImageSaveAdapter as CoverImageSaveAdapter, type ImageSaveOutput as CoverImageSaveOutput, DEFAULT_OPTIONS, type ImageSaveAdapter as DashboardImageSaveAdapter, type ImageSaveOutput as DashboardImageSaveOutput, type ExportBlobSaver, type ExportConverterOverrides, type ExportDestinationControl, ExportDialog, type ExportDialogProps, type ExportFormat, type ExportOptions, FORMAT_EXTENSIONS, FORMAT_LABELS, type HtmlBundle, type HtmlStyle, type ImageSaveAdapter, type ImageSaveOutput, buildExportFilename, createImageSaveOutput as createCoverImageSaveOutput, createImageSaveOutput as createDashboardImageSaveOutput, createImageSaveOutput, loadLastExportOptions, runExport, saveExportOptions, updateExportTargetExtension };
|
|
142
|
+
export { type ImageSaveAdapter as CoverImageSaveAdapter, type ImageSaveOutput as CoverImageSaveOutput, DEFAULT_OPTIONS, type ImageSaveAdapter as DashboardImageSaveAdapter, type ImageSaveOutput as DashboardImageSaveOutput, type ExportBlobSaver, type ExportConverterOverrides, type ExportDestinationControl, ExportDialog, type ExportDialogProps, type ExportFormat, type ExportOptions, FORMAT_EXTENSIONS, FORMAT_LABELS, type HtmlBundle, type HtmlStyle, type ImageSaveAdapter, type ImageSaveOutput, buildExportFilename, createImageSaveOutput as createCoverImageSaveOutput, createImageSaveOutput as createDashboardImageSaveOutput, createImageSaveOutput, loadLastExportOptions, resolveExportDialogInitial, runExport, saveExportOptions, updateExportTargetExtension };
|
package/dist/export/index.js
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
|
-
createImageSaveOutput,
|
|
3
2
|
updateExportTargetExtension
|
|
4
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-KWG6UP5O.js";
|
|
5
4
|
import {
|
|
6
5
|
runExport
|
|
7
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-BCQZTWE5.js";
|
|
7
|
+
import {
|
|
8
|
+
createImageSaveOutput
|
|
9
|
+
} from "../chunk-UONFWKJ7.js";
|
|
8
10
|
import {
|
|
9
11
|
buildExportFilename
|
|
10
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-UG4G7PJ4.js";
|
|
11
13
|
import {
|
|
12
14
|
ExportDialog
|
|
13
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-SGQKTKDX.js";
|
|
14
16
|
import "../chunk-YBEYTVU2.js";
|
|
15
17
|
import {
|
|
16
18
|
DEFAULT_OPTIONS,
|
|
17
19
|
FORMAT_EXTENSIONS,
|
|
18
20
|
FORMAT_LABELS,
|
|
19
21
|
loadLastExportOptions,
|
|
22
|
+
resolveExportDialogInitial,
|
|
20
23
|
saveExportOptions
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
24
|
+
} from "../chunk-X437UAF7.js";
|
|
25
|
+
import "../chunk-56KO2LYN.js";
|
|
23
26
|
export {
|
|
24
27
|
DEFAULT_OPTIONS,
|
|
25
28
|
ExportDialog,
|
|
@@ -30,6 +33,7 @@ export {
|
|
|
30
33
|
createImageSaveOutput as createDashboardImageSaveOutput,
|
|
31
34
|
createImageSaveOutput,
|
|
32
35
|
loadLastExportOptions,
|
|
36
|
+
resolveExportDialogInitial,
|
|
33
37
|
runExport,
|
|
34
38
|
saveExportOptions,
|
|
35
39
|
updateExportTargetExtension
|