@bendyline/docblocks-react 2.0.0 → 2.1.1
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 +18 -3
- package/dist/ExportDialog-VYATD5UC.js +9 -0
- package/dist/{ExportToolbarControls-D2YDWOXW.js → ExportToolbarControls-5HUE3LSX.js} +206 -42
- package/dist/{GitToolbarControl-LMIR4R7I.js → GitToolbarControl-FW3BZFXV.js} +62 -44
- package/dist/{GitUI-KGF5MSNV.js → GitUI-GMH3PAYL.js} +225 -141
- package/dist/{LazyEditorShell-EF2BWRXU.js → LazyEditorShell-RF54B5UD.js} +0 -1
- package/dist/ShareDialog-PAMOQQFB.js +212 -0
- package/dist/chunk-3CZ27FOA.js +359 -0
- package/dist/chunk-3QSZY74C.js +255 -0
- package/{src/Export/export-destination.ts → dist/chunk-BI7NVU6T.js} +16 -15
- package/dist/{chunk-VHDP4IPL.js → chunk-BPGEBGAN.js} +0 -1
- package/dist/{chunk-DD4VFJQI.js → chunk-EBWYGTN7.js} +2 -1
- package/dist/{chunk-ZI56BNB7.js → chunk-GHQ4X7KM.js} +27 -7
- package/dist/{chunk-5A4KEWKT.js → chunk-HFYPTTCH.js} +0 -1
- package/dist/chunk-LG6HAWCK.js +109 -0
- package/dist/chunk-TFMO7EVO.js +88 -0
- package/dist/{chunk-4XXSWN3T.js → chunk-YBEYTVU2.js} +0 -1
- package/dist/editor.d.ts +5 -4
- package/dist/editor.js +8 -70
- package/dist/export/index.d.ts +24 -8
- package/dist/export/index.js +10 -6
- package/dist/index.d.ts +355 -21
- package/dist/index.js +6419 -21
- package/dist/run-export-Z5BVFLIR.js +9 -0
- package/dist/settings/index.d.ts +9 -1
- package/dist/settings/index.js +6 -5
- package/package.json +18 -13
- package/src/styles/docblocks.css +985 -35
- package/dist/AppMenu/AppMenu.d.ts +0 -53
- package/dist/AppMenu/AppMenu.d.ts.map +0 -1
- package/dist/AppMenu/AppMenu.js +0 -67
- package/dist/AppMenu/AppMenu.js.map +0 -1
- package/dist/AppMenu/index.d.ts +0 -3
- package/dist/AppMenu/index.d.ts.map +0 -1
- package/dist/AppMenu/index.js +0 -2
- package/dist/AppMenu/index.js.map +0 -1
- package/dist/DocBlocksShell/DocBlocksShell.d.ts +0 -49
- package/dist/DocBlocksShell/DocBlocksShell.d.ts.map +0 -1
- package/dist/DocBlocksShell/DocBlocksShell.js +0 -2730
- package/dist/DocBlocksShell/DocBlocksShell.js.map +0 -1
- package/dist/DocBlocksShell/LazyEditorShell.d.ts +0 -3
- package/dist/DocBlocksShell/LazyEditorShell.d.ts.map +0 -1
- package/dist/DocBlocksShell/LazyEditorShell.js +0 -3
- package/dist/DocBlocksShell/LazyEditorShell.js.map +0 -1
- package/dist/DocBlocksShell/UpdateAvailableNotice.d.ts +0 -13
- package/dist/DocBlocksShell/UpdateAvailableNotice.d.ts.map +0 -1
- package/dist/DocBlocksShell/UpdateAvailableNotice.js +0 -16
- package/dist/DocBlocksShell/UpdateAvailableNotice.js.map +0 -1
- package/dist/DocBlocksShell/document-title.d.ts +0 -3
- package/dist/DocBlocksShell/document-title.d.ts.map +0 -1
- package/dist/DocBlocksShell/document-title.js +0 -17
- package/dist/DocBlocksShell/document-title.js.map +0 -1
- package/dist/DocBlocksShell/index.d.ts +0 -3
- package/dist/DocBlocksShell/index.d.ts.map +0 -1
- package/dist/DocBlocksShell/index.js +0 -2
- package/dist/DocBlocksShell/index.js.map +0 -1
- package/dist/DocBlocksShell/workspace-authority-barrier.d.ts +0 -14
- package/dist/DocBlocksShell/workspace-authority-barrier.d.ts.map +0 -1
- package/dist/DocBlocksShell/workspace-authority-barrier.js +0 -23
- package/dist/DocBlocksShell/workspace-authority-barrier.js.map +0 -1
- package/dist/Export/DeferredExportToolbarControls.d.ts +0 -5
- package/dist/Export/DeferredExportToolbarControls.d.ts.map +0 -1
- package/dist/Export/DeferredExportToolbarControls.js +0 -10
- package/dist/Export/DeferredExportToolbarControls.js.map +0 -1
- package/dist/Export/ExportDialog.d.ts +0 -25
- package/dist/Export/ExportDialog.d.ts.map +0 -1
- package/dist/Export/ExportDialog.js +0 -160
- package/dist/Export/ExportDialog.js.map +0 -1
- package/dist/Export/ExportToolbarControls.d.ts +0 -37
- package/dist/Export/ExportToolbarControls.d.ts.map +0 -1
- package/dist/Export/ExportToolbarControls.js +0 -285
- package/dist/Export/ExportToolbarControls.js.map +0 -1
- package/dist/Export/export-destination.d.ts +0 -3
- package/dist/Export/export-destination.d.ts.map +0 -1
- package/dist/Export/export-destination.js +0 -32
- package/dist/Export/export-destination.js.map +0 -1
- package/dist/Export/export-options.d.ts +0 -53
- package/dist/Export/export-options.d.ts.map +0 -1
- package/dist/Export/export-options.js +0 -49
- package/dist/Export/export-options.js.map +0 -1
- package/dist/Export/index.d.ts +0 -10
- package/dist/Export/index.d.ts.map +0 -1
- package/dist/Export/index.js +0 -6
- package/dist/Export/index.js.map +0 -1
- package/dist/Export/public-api.d.ts +0 -12
- package/dist/Export/public-api.d.ts.map +0 -1
- package/dist/Export/public-api.js +0 -9
- package/dist/Export/public-api.js.map +0 -1
- package/dist/Export/run-export.d.ts +0 -10
- package/dist/Export/run-export.d.ts.map +0 -1
- package/dist/Export/run-export.js +0 -313
- package/dist/Export/run-export.js.map +0 -1
- package/dist/Export/transform-summaries.d.ts +0 -7
- package/dist/Export/transform-summaries.d.ts.map +0 -1
- package/dist/Export/transform-summaries.js +0 -6
- package/dist/Export/transform-summaries.js.map +0 -1
- package/dist/ExportDialog-MEUISWZX.js +0 -9
- package/dist/ExportDialog-MEUISWZX.js.map +0 -1
- package/dist/ExportToolbarControls-D2YDWOXW.js.map +0 -1
- package/dist/FileExplorer/FileExplorer.d.ts +0 -43
- package/dist/FileExplorer/FileExplorer.d.ts.map +0 -1
- package/dist/FileExplorer/FileExplorer.js +0 -315
- package/dist/FileExplorer/FileExplorer.js.map +0 -1
- package/dist/FileExplorer/FileTreeNode.d.ts +0 -39
- package/dist/FileExplorer/FileTreeNode.d.ts.map +0 -1
- package/dist/FileExplorer/FileTreeNode.js +0 -131
- package/dist/FileExplorer/FileTreeNode.js.map +0 -1
- package/dist/FileExplorer/index.d.ts +0 -6
- package/dist/FileExplorer/index.d.ts.map +0 -1
- package/dist/FileExplorer/index.js +0 -4
- package/dist/FileExplorer/index.js.map +0 -1
- package/dist/FileExplorer/useFileTree.d.ts +0 -37
- package/dist/FileExplorer/useFileTree.d.ts.map +0 -1
- package/dist/FileExplorer/useFileTree.js +0 -284
- package/dist/FileExplorer/useFileTree.js.map +0 -1
- package/dist/Git/GitAuthGuidanceDialog.d.ts +0 -18
- package/dist/Git/GitAuthGuidanceDialog.d.ts.map +0 -1
- package/dist/Git/GitAuthGuidanceDialog.js +0 -27
- package/dist/Git/GitAuthGuidanceDialog.js.map +0 -1
- package/dist/Git/GitBranchesDialog.d.ts +0 -13
- package/dist/Git/GitBranchesDialog.d.ts.map +0 -1
- package/dist/Git/GitBranchesDialog.js +0 -59
- package/dist/Git/GitBranchesDialog.js.map +0 -1
- package/dist/Git/GitCloneDialog.d.ts +0 -14
- package/dist/Git/GitCloneDialog.d.ts.map +0 -1
- package/dist/Git/GitCloneDialog.js +0 -79
- package/dist/Git/GitCloneDialog.js.map +0 -1
- package/dist/Git/GitCommitDialog.d.ts +0 -12
- package/dist/Git/GitCommitDialog.d.ts.map +0 -1
- package/dist/Git/GitCommitDialog.js +0 -38
- package/dist/Git/GitCommitDialog.js.map +0 -1
- package/dist/Git/GitConflictsDialog.d.ts +0 -12
- package/dist/Git/GitConflictsDialog.d.ts.map +0 -1
- package/dist/Git/GitConflictsDialog.js +0 -17
- package/dist/Git/GitConflictsDialog.js.map +0 -1
- package/dist/Git/GitContext.d.ts +0 -89
- package/dist/Git/GitContext.d.ts.map +0 -1
- package/dist/Git/GitContext.js +0 -15
- package/dist/Git/GitContext.js.map +0 -1
- package/dist/Git/GitDiffDialog.d.ts +0 -20
- package/dist/Git/GitDiffDialog.d.ts.map +0 -1
- package/dist/Git/GitDiffDialog.js +0 -100
- package/dist/Git/GitDiffDialog.js.map +0 -1
- package/dist/Git/GitDiffView.d.ts +0 -23
- package/dist/Git/GitDiffView.d.ts.map +0 -1
- package/dist/Git/GitDiffView.js +0 -77
- package/dist/Git/GitDiffView.js.map +0 -1
- package/dist/Git/GitHistoryDialog.d.ts +0 -15
- package/dist/Git/GitHistoryDialog.d.ts.map +0 -1
- package/dist/Git/GitHistoryDialog.js +0 -107
- package/dist/Git/GitHistoryDialog.js.map +0 -1
- package/dist/Git/GitStatusBar.d.ts +0 -8
- package/dist/Git/GitStatusBar.d.ts.map +0 -1
- package/dist/Git/GitStatusBar.js +0 -49
- package/dist/Git/GitStatusBar.js.map +0 -1
- package/dist/Git/GitToolbarControl.d.ts +0 -15
- package/dist/Git/GitToolbarControl.d.ts.map +0 -1
- package/dist/Git/GitToolbarControl.js +0 -51
- package/dist/Git/GitToolbarControl.js.map +0 -1
- package/dist/Git/GitUI.d.ts +0 -14
- package/dist/Git/GitUI.d.ts.map +0 -1
- package/dist/Git/GitUI.js +0 -21
- package/dist/Git/GitUI.js.map +0 -1
- package/dist/Git/commit-selection.d.ts +0 -22
- package/dist/Git/commit-selection.d.ts.map +0 -1
- package/dist/Git/commit-selection.js +0 -47
- package/dist/Git/commit-selection.js.map +0 -1
- package/dist/Git/git-clone-utils.d.ts +0 -8
- package/dist/Git/git-clone-utils.d.ts.map +0 -1
- package/dist/Git/git-clone-utils.js +0 -26
- package/dist/Git/git-clone-utils.js.map +0 -1
- package/dist/Git/git-status.d.ts +0 -24
- package/dist/Git/git-status.d.ts.map +0 -1
- package/dist/Git/git-status.js +0 -105
- package/dist/Git/git-status.js.map +0 -1
- package/dist/Git/useGit.d.ts +0 -15
- package/dist/Git/useGit.d.ts.map +0 -1
- package/dist/Git/useGit.js +0 -206
- package/dist/Git/useGit.js.map +0 -1
- package/dist/Git/useGitStatus.d.ts +0 -17
- package/dist/Git/useGitStatus.d.ts.map +0 -1
- package/dist/Git/useGitStatus.js +0 -63
- package/dist/Git/useGitStatus.js.map +0 -1
- package/dist/GitToolbarControl-LMIR4R7I.js.map +0 -1
- package/dist/GitUI-KGF5MSNV.js.map +0 -1
- package/dist/LazyEditorShell-EF2BWRXU.js.map +0 -1
- package/dist/Settings/Settings.d.ts +0 -23
- package/dist/Settings/Settings.d.ts.map +0 -1
- package/dist/Settings/Settings.js +0 -22
- package/dist/Settings/Settings.js.map +0 -1
- package/dist/Settings/public-api.d.ts +0 -3
- package/dist/Settings/public-api.d.ts.map +0 -1
- package/dist/Settings/public-api.js +0 -2
- package/dist/Settings/public-api.js.map +0 -1
- package/dist/WorkspacePicker/WorkspacePicker.d.ts +0 -22
- package/dist/WorkspacePicker/WorkspacePicker.d.ts.map +0 -1
- package/dist/WorkspacePicker/WorkspacePicker.js +0 -74
- package/dist/WorkspacePicker/WorkspacePicker.js.map +0 -1
- package/dist/WorkspacePicker/WorkspaceSettingsButton.d.ts +0 -11
- package/dist/WorkspacePicker/WorkspaceSettingsButton.d.ts.map +0 -1
- package/dist/WorkspacePicker/WorkspaceSettingsButton.js +0 -27
- package/dist/WorkspacePicker/WorkspaceSettingsButton.js.map +0 -1
- package/dist/WorkspacePicker/WorkspaceSettingsDialog.d.ts +0 -20
- package/dist/WorkspacePicker/WorkspaceSettingsDialog.d.ts.map +0 -1
- package/dist/WorkspacePicker/WorkspaceSettingsDialog.js +0 -36
- package/dist/WorkspacePicker/WorkspaceSettingsDialog.js.map +0 -1
- package/dist/WorkspacePicker/index.d.ts +0 -3
- package/dist/WorkspacePicker/index.d.ts.map +0 -1
- package/dist/WorkspacePicker/index.js +0 -2
- package/dist/WorkspacePicker/index.js.map +0 -1
- package/dist/chunk-3SAXDU2U.js +0 -157
- package/dist/chunk-3SAXDU2U.js.map +0 -1
- package/dist/chunk-4XXSWN3T.js.map +0 -1
- package/dist/chunk-5A4KEWKT.js.map +0 -1
- package/dist/chunk-AOVTHZU7.js +0 -321
- package/dist/chunk-AOVTHZU7.js.map +0 -1
- package/dist/chunk-DD4VFJQI.js.map +0 -1
- package/dist/chunk-GSNZSCIK.js +0 -55
- package/dist/chunk-GSNZSCIK.js.map +0 -1
- package/dist/chunk-VHDP4IPL.js.map +0 -1
- package/dist/chunk-ZI56BNB7.js.map +0 -1
- package/dist/components/Dialog.d.ts +0 -22
- package/dist/components/Dialog.d.ts.map +0 -1
- package/dist/components/Dialog.js +0 -33
- package/dist/components/Dialog.js.map +0 -1
- package/dist/editor.d.ts.map +0 -1
- package/dist/editor.js.map +0 -1
- package/dist/export/index.js.map +0 -1
- package/dist/hooks/index.d.ts +0 -3
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js +0 -2
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/useDocumentSession.d.ts +0 -16
- package/dist/hooks/useDocumentSession.d.ts.map +0 -1
- package/dist/hooks/useDocumentSession.js +0 -18
- package/dist/hooks/useDocumentSession.js.map +0 -1
- package/dist/icons.d.ts +0 -12
- package/dist/icons.d.ts.map +0 -1
- package/dist/icons.js +0 -28
- package/dist/icons.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/preferences/theme.d.ts +0 -18
- package/dist/preferences/theme.d.ts.map +0 -1
- package/dist/preferences/theme.js +0 -63
- package/dist/preferences/theme.js.map +0 -1
- package/dist/preferences/versioning.d.ts +0 -27
- package/dist/preferences/versioning.d.ts.map +0 -1
- package/dist/preferences/versioning.js +0 -62
- package/dist/preferences/versioning.js.map +0 -1
- package/dist/provider-lease.d.ts +0 -10
- package/dist/provider-lease.d.ts.map +0 -1
- package/dist/provider-lease.js +0 -42
- package/dist/provider-lease.js.map +0 -1
- package/dist/run-export-ICTZITXC.js +0 -10
- package/dist/run-export-ICTZITXC.js.map +0 -1
- package/dist/settings/index.js.map +0 -1
- package/src/AppMenu/AppMenu.tsx +0 -334
- package/src/AppMenu/index.ts +0 -2
- package/src/DocBlocksShell/DocBlocksShell.tsx +0 -3398
- package/src/DocBlocksShell/LazyEditorShell.ts +0 -2
- package/src/DocBlocksShell/UpdateAvailableNotice.tsx +0 -60
- package/src/DocBlocksShell/document-title.ts +0 -19
- package/src/DocBlocksShell/index.ts +0 -2
- package/src/DocBlocksShell/workspace-authority-barrier.ts +0 -26
- package/src/Export/DeferredExportToolbarControls.tsx +0 -23
- package/src/Export/ExportDialog.tsx +0 -437
- package/src/Export/ExportToolbarControls.tsx +0 -511
- package/src/Export/export-options.ts +0 -99
- package/src/Export/index.ts +0 -19
- package/src/Export/public-api.ts +0 -17
- package/src/Export/run-export.ts +0 -374
- package/src/Export/transform-summaries.ts +0 -14
- package/src/FileExplorer/FileExplorer.tsx +0 -528
- package/src/FileExplorer/FileTreeNode.tsx +0 -306
- package/src/FileExplorer/index.ts +0 -5
- package/src/FileExplorer/useFileTree.ts +0 -352
- package/src/Git/GitAuthGuidanceDialog.tsx +0 -84
- package/src/Git/GitBranchesDialog.tsx +0 -144
- package/src/Git/GitCloneDialog.tsx +0 -200
- package/src/Git/GitCommitDialog.tsx +0 -119
- package/src/Git/GitConflictsDialog.tsx +0 -62
- package/src/Git/GitContext.tsx +0 -88
- package/src/Git/GitDiffDialog.tsx +0 -147
- package/src/Git/GitDiffView.tsx +0 -105
- package/src/Git/GitHistoryDialog.tsx +0 -195
- package/src/Git/GitStatusBar.tsx +0 -157
- package/src/Git/GitToolbarControl.tsx +0 -123
- package/src/Git/GitUI.tsx +0 -68
- package/src/Git/commit-selection.ts +0 -63
- package/src/Git/git-clone-utils.ts +0 -23
- package/src/Git/git-status.ts +0 -113
- package/src/Git/useGit.ts +0 -279
- package/src/Git/useGitStatus.ts +0 -78
- package/src/Settings/Settings.tsx +0 -118
- package/src/Settings/public-api.ts +0 -8
- package/src/WorkspacePicker/WorkspacePicker.tsx +0 -191
- package/src/WorkspacePicker/WorkspaceSettingsButton.tsx +0 -88
- package/src/WorkspacePicker/WorkspaceSettingsDialog.tsx +0 -121
- package/src/WorkspacePicker/index.ts +0 -2
- package/src/components/Dialog.tsx +0 -81
- package/src/editor.ts +0 -72
- package/src/hooks/index.ts +0 -2
- package/src/hooks/useDocumentSession.ts +0 -37
- package/src/icons.tsx +0 -48
- package/src/index.ts +0 -61
- package/src/preferences/theme.ts +0 -67
- package/src/preferences/versioning.ts +0 -69
- package/src/provider-lease.ts +0 -52
- package/src/types/pwa-dom.d.ts +0 -31
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
// src/Export/ShareDialog.tsx
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { SHARED_DOCUMENT_LIMITS as SHARED_DOCUMENT_LIMITS2 } from "@bendyline/docblocks/share";
|
|
4
|
+
|
|
5
|
+
// src/Export/shared-document.ts
|
|
6
|
+
import {
|
|
7
|
+
SHARED_DOCUMENT_LIMITS,
|
|
8
|
+
createSharedDocumentUrl
|
|
9
|
+
} from "@bendyline/docblocks/share";
|
|
10
|
+
var PUBLIC_DOCBLOCKS_SHARE_URL = "https://bendyline.github.io/docblocks/";
|
|
11
|
+
function resolveSharedDocumentBaseUrl(currentUrl) {
|
|
12
|
+
try {
|
|
13
|
+
const current = new URL(currentUrl);
|
|
14
|
+
if (current.protocol === "http:" || current.protocol === "https:") {
|
|
15
|
+
current.hash = "";
|
|
16
|
+
current.searchParams.delete("action");
|
|
17
|
+
return current.toString();
|
|
18
|
+
}
|
|
19
|
+
} catch {
|
|
20
|
+
}
|
|
21
|
+
return PUBLIC_DOCBLOCKS_SHARE_URL;
|
|
22
|
+
}
|
|
23
|
+
function sharedDocumentFilename(selectedFile) {
|
|
24
|
+
const basename = selectedFile?.replace(/\\/gu, "/").split("/").pop() ?? "shared.md";
|
|
25
|
+
const stem = basename.replace(/\.md$/iu, "").replace(/[^A-Za-z0-9._-]+/gu, "-");
|
|
26
|
+
const bounded = stem.replace(/^-+|-+$/gu, "").slice(0, 80) || "shared";
|
|
27
|
+
return `${bounded}.md`;
|
|
28
|
+
}
|
|
29
|
+
async function createSharedDocumentArchive(markdown, selectedFile) {
|
|
30
|
+
const encoded = new TextEncoder().encode(markdown);
|
|
31
|
+
if (encoded.byteLength > SHARED_DOCUMENT_LIMITS.markdownBytes) {
|
|
32
|
+
throw new Error(
|
|
33
|
+
`This document is too large for a shared URL (maximum ${SHARED_DOCUMENT_LIMITS.markdownBytes.toLocaleString()} UTF-8 bytes).`
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
const [{ MemoryContentContainer }, { containerToZip }] = await Promise.all([
|
|
37
|
+
import("@bendyline/squisq/storage"),
|
|
38
|
+
import("@bendyline/squisq-formats/container")
|
|
39
|
+
]);
|
|
40
|
+
const container = new MemoryContentContainer();
|
|
41
|
+
await container.writeFile(sharedDocumentFilename(selectedFile), encoded, "text/markdown");
|
|
42
|
+
const blob = await containerToZip(container, { compression: "DEFLATE", compressionLevel: 9 });
|
|
43
|
+
return new Uint8Array(await blob.arrayBuffer());
|
|
44
|
+
}
|
|
45
|
+
function buildSharedDocumentUrl(baseUrl, archive, mode) {
|
|
46
|
+
return createSharedDocumentUrl(resolveSharedDocumentBaseUrl(baseUrl), archive, mode);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// src/Export/ShareDialog.tsx
|
|
50
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
51
|
+
var MODES = [
|
|
52
|
+
{ value: "", label: "Write (no default)" },
|
|
53
|
+
{ value: "slideshow", label: "Slideshow" },
|
|
54
|
+
{ value: "video", label: "Video" },
|
|
55
|
+
{ value: "page", label: "Page" },
|
|
56
|
+
{ value: "document", label: "Document" },
|
|
57
|
+
{ value: "narrate", label: "Narrate" }
|
|
58
|
+
];
|
|
59
|
+
function ShareDialog({ markdown, selectedFile, baseUrl, onClose }) {
|
|
60
|
+
const [mode, setMode] = useState("");
|
|
61
|
+
const [archive, setArchive] = useState(null);
|
|
62
|
+
const [archiveError, setArchiveError] = useState(null);
|
|
63
|
+
const [copyStatus, setCopyStatus] = useState("idle");
|
|
64
|
+
const linkRef = useRef(null);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
let cancelled = false;
|
|
67
|
+
setArchive(null);
|
|
68
|
+
setArchiveError(null);
|
|
69
|
+
void createSharedDocumentArchive(markdown, selectedFile).then((nextArchive) => {
|
|
70
|
+
if (!cancelled) setArchive(nextArchive);
|
|
71
|
+
}).catch((error) => {
|
|
72
|
+
if (!cancelled) {
|
|
73
|
+
setArchiveError(
|
|
74
|
+
error instanceof Error ? error.message : "DocBlocks could not create the shared link."
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return () => {
|
|
79
|
+
cancelled = true;
|
|
80
|
+
};
|
|
81
|
+
}, [markdown, selectedFile]);
|
|
82
|
+
const linkResult = useMemo(() => {
|
|
83
|
+
if (!archive) return { url: "", error: archiveError };
|
|
84
|
+
try {
|
|
85
|
+
return { url: buildSharedDocumentUrl(baseUrl, archive, mode || null), error: null };
|
|
86
|
+
} catch (error) {
|
|
87
|
+
return {
|
|
88
|
+
url: "",
|
|
89
|
+
error: error instanceof Error ? error.message : "DocBlocks could not create the shared link."
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}, [archive, archiveError, baseUrl, mode]);
|
|
93
|
+
useEffect(() => setCopyStatus("idle"), [linkResult.url]);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
const handleKeyDown = (event) => {
|
|
96
|
+
if (event.key === "Escape") onClose();
|
|
97
|
+
};
|
|
98
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
99
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
100
|
+
}, [onClose]);
|
|
101
|
+
const copyLink = useCallback(async () => {
|
|
102
|
+
if (!linkResult.url) return;
|
|
103
|
+
try {
|
|
104
|
+
if (navigator.clipboard?.writeText) {
|
|
105
|
+
await navigator.clipboard.writeText(linkResult.url);
|
|
106
|
+
} else {
|
|
107
|
+
linkRef.current?.focus();
|
|
108
|
+
linkRef.current?.select();
|
|
109
|
+
if (typeof document.execCommand !== "function" || !document.execCommand("copy")) {
|
|
110
|
+
throw new Error("Clipboard access is unavailable.");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
setCopyStatus("copied");
|
|
114
|
+
} catch {
|
|
115
|
+
linkRef.current?.focus();
|
|
116
|
+
linkRef.current?.select();
|
|
117
|
+
setCopyStatus("failed");
|
|
118
|
+
}
|
|
119
|
+
}, [linkResult.url]);
|
|
120
|
+
const isLong = linkResult.url.length > SHARED_DOCUMENT_LIMITS2.portableUrlCharacters;
|
|
121
|
+
return /* @__PURE__ */ jsx(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
className: "db-dialog-overlay",
|
|
125
|
+
onClick: (event) => {
|
|
126
|
+
if (event.target === event.currentTarget) onClose();
|
|
127
|
+
},
|
|
128
|
+
children: /* @__PURE__ */ jsxs(
|
|
129
|
+
"div",
|
|
130
|
+
{
|
|
131
|
+
className: "db-dialog db-export-dialog db-share-dialog",
|
|
132
|
+
role: "dialog",
|
|
133
|
+
"aria-modal": "true",
|
|
134
|
+
"aria-labelledby": "db-share-dialog-title",
|
|
135
|
+
children: [
|
|
136
|
+
/* @__PURE__ */ jsxs("div", { className: "db-dialog-header", children: [
|
|
137
|
+
/* @__PURE__ */ jsx("h2", { className: "db-dialog-title", id: "db-share-dialog-title", children: "Share document via URL" }),
|
|
138
|
+
/* @__PURE__ */ jsx("button", { className: "db-dialog-close", type: "button", onClick: onClose, "aria-label": "Close", children: "\xD7" })
|
|
139
|
+
] }),
|
|
140
|
+
/* @__PURE__ */ jsxs("div", { className: "db-dialog-body", children: [
|
|
141
|
+
/* @__PURE__ */ jsx("div", { className: "db-share-warning", role: "note", children: "The contents of this document are embedded in the URL. Anyone with the link receives a copy of the document, so do not use it for secrets." }),
|
|
142
|
+
/* @__PURE__ */ jsxs("div", { className: "db-export-field", children: [
|
|
143
|
+
/* @__PURE__ */ jsx("label", { className: "db-export-label", htmlFor: "db-share-mode", children: "Default mode (optional)" }),
|
|
144
|
+
/* @__PURE__ */ jsx(
|
|
145
|
+
"select",
|
|
146
|
+
{
|
|
147
|
+
id: "db-share-mode",
|
|
148
|
+
className: "db-export-select",
|
|
149
|
+
value: mode,
|
|
150
|
+
onChange: (event) => setMode(event.target.value),
|
|
151
|
+
children: MODES.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value || "write"))
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
/* @__PURE__ */ jsx("span", { className: "db-export-hint", children: "Without a default, the copied document opens in Write. Other choices open directly in Use." })
|
|
155
|
+
] }),
|
|
156
|
+
/* @__PURE__ */ jsxs("div", { className: "db-export-field", children: [
|
|
157
|
+
/* @__PURE__ */ jsx("label", { className: "db-export-label", htmlFor: "db-share-link", children: "Share link" }),
|
|
158
|
+
/* @__PURE__ */ jsx(
|
|
159
|
+
"textarea",
|
|
160
|
+
{
|
|
161
|
+
ref: linkRef,
|
|
162
|
+
id: "db-share-link",
|
|
163
|
+
className: "db-share-link",
|
|
164
|
+
value: linkResult.url,
|
|
165
|
+
readOnly: true,
|
|
166
|
+
rows: 3,
|
|
167
|
+
spellCheck: false,
|
|
168
|
+
"aria-describedby": "db-share-link-status",
|
|
169
|
+
placeholder: linkResult.error ? "" : "Creating link..."
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
/* @__PURE__ */ jsx(
|
|
173
|
+
"span",
|
|
174
|
+
{
|
|
175
|
+
id: "db-share-link-status",
|
|
176
|
+
className: `db-export-hint${isLong ? " db-share-length-warning" : ""}`,
|
|
177
|
+
children: linkResult.error ? linkResult.error : linkResult.url ? isLong ? `${linkResult.url.length.toLocaleString()} characters. Links longer than 4,096 characters may be truncated by messaging or email tools.` : `${linkResult.url.length.toLocaleString()} characters.` : "Compressing this document into a Markdown-only DBK..."
|
|
178
|
+
}
|
|
179
|
+
)
|
|
180
|
+
] }),
|
|
181
|
+
/* @__PURE__ */ jsx("p", { className: "db-share-temporary-note", children: "Opening the link creates a temporary workspace. Changes there do not alter this document or the link." })
|
|
182
|
+
] }),
|
|
183
|
+
/* @__PURE__ */ jsxs("div", { className: "db-export-footer", children: [
|
|
184
|
+
/* @__PURE__ */ jsx(
|
|
185
|
+
"button",
|
|
186
|
+
{
|
|
187
|
+
className: "db-export-btn db-export-btn--secondary",
|
|
188
|
+
type: "button",
|
|
189
|
+
onClick: onClose,
|
|
190
|
+
children: "Close"
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
/* @__PURE__ */ jsx(
|
|
194
|
+
"button",
|
|
195
|
+
{
|
|
196
|
+
className: "db-export-btn db-export-btn--primary",
|
|
197
|
+
type: "button",
|
|
198
|
+
onClick: () => void copyLink(),
|
|
199
|
+
disabled: !linkResult.url,
|
|
200
|
+
children: copyStatus === "copied" ? "Copied" : copyStatus === "failed" ? "Select and copy" : "Copy link"
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
] })
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
export {
|
|
211
|
+
ShareDialog
|
|
212
|
+
};
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadTransformStyleSummaries
|
|
3
|
+
} from "./chunk-YBEYTVU2.js";
|
|
4
|
+
import {
|
|
5
|
+
Dialog
|
|
6
|
+
} from "./chunk-LG6HAWCK.js";
|
|
7
|
+
import {
|
|
8
|
+
FORMAT_LABELS,
|
|
9
|
+
saveExportOptions
|
|
10
|
+
} from "./chunk-EBWYGTN7.js";
|
|
11
|
+
|
|
12
|
+
// src/Export/ExportDialog.tsx
|
|
13
|
+
import { useState, useCallback, useEffect, useMemo } from "react";
|
|
14
|
+
import { getThemeSummaries } from "@bendyline/squisq/schemas";
|
|
15
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
var FORMATS = ["pdf", "docx", "pptx", "epub", "html", "md"];
|
|
17
|
+
var FORMAT_CHIP_LABELS = {
|
|
18
|
+
pdf: "PDF",
|
|
19
|
+
docx: "Word",
|
|
20
|
+
pptx: "PowerPoint",
|
|
21
|
+
epub: "EPUB",
|
|
22
|
+
html: "HTML",
|
|
23
|
+
md: "Markdown"
|
|
24
|
+
};
|
|
25
|
+
var HTML_STYLE_CHIPS = [
|
|
26
|
+
{
|
|
27
|
+
key: "plain",
|
|
28
|
+
label: "Plain",
|
|
29
|
+
hint: "A lightweight static HTML document."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
key: "rendered",
|
|
33
|
+
label: "Rendered",
|
|
34
|
+
hint: "Renders via SquisqPlayer with themes and playback support."
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
var HTML_BUNDLE_CHIPS = [
|
|
38
|
+
{
|
|
39
|
+
key: "single",
|
|
40
|
+
label: "Single file",
|
|
41
|
+
hint: "One .html file with images embedded as base64 data URIs."
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
key: "zip",
|
|
45
|
+
label: "ZIP archive",
|
|
46
|
+
hint: "A .zip with index.html plus separate image (and JS) files."
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
function ChipRadioGroup({
|
|
50
|
+
name,
|
|
51
|
+
value,
|
|
52
|
+
options,
|
|
53
|
+
onChange
|
|
54
|
+
}) {
|
|
55
|
+
return /* @__PURE__ */ jsx("div", { className: "db-export-chips", role: "radiogroup", "aria-label": name, children: options.map((opt) => {
|
|
56
|
+
const active = opt.key === value;
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
"button",
|
|
59
|
+
{
|
|
60
|
+
type: "button",
|
|
61
|
+
role: "radio",
|
|
62
|
+
"aria-checked": active,
|
|
63
|
+
className: `db-export-chip${active ? " db-export-chip--active" : ""}`,
|
|
64
|
+
onClick: () => onChange(opt.key),
|
|
65
|
+
title: opt.title,
|
|
66
|
+
children: opt.label
|
|
67
|
+
},
|
|
68
|
+
opt.key
|
|
69
|
+
);
|
|
70
|
+
}) });
|
|
71
|
+
}
|
|
72
|
+
function ExportDialog({
|
|
73
|
+
initial,
|
|
74
|
+
exporting,
|
|
75
|
+
error,
|
|
76
|
+
destination,
|
|
77
|
+
onExport,
|
|
78
|
+
onOptionsChange,
|
|
79
|
+
onAnimatedGifExport,
|
|
80
|
+
onClose
|
|
81
|
+
}) {
|
|
82
|
+
const [format, setFormat] = useState(initial.format);
|
|
83
|
+
const [themeId, setThemeId] = useState(initial.themeId);
|
|
84
|
+
const [transformStyle, setTransformStyle] = useState(initial.transformStyle);
|
|
85
|
+
const [pageSize, setPageSize] = useState(initial.pageSize);
|
|
86
|
+
const [htmlStyle, setHtmlStyle] = useState(initial.htmlStyle);
|
|
87
|
+
const [htmlBundle, setHtmlBundle] = useState(initial.htmlBundle);
|
|
88
|
+
const [includeLinkedDocs, setIncludeLinkedDocs] = useState(initial.includeLinkedDocs);
|
|
89
|
+
const [entryAsIndex, setEntryAsIndex] = useState(initial.entryAsIndex);
|
|
90
|
+
const [transforms, setTransforms] = useState([]);
|
|
91
|
+
const themes = getThemeSummaries();
|
|
92
|
+
const showTheme = format === "docx" || format === "pdf" || format === "pptx" || format === "epub" || format === "html";
|
|
93
|
+
const showTransform = format === "pptx";
|
|
94
|
+
const showPageSize = format === "pdf";
|
|
95
|
+
const showHtmlOptions = format === "html";
|
|
96
|
+
const showIncludeLinked = format === "html";
|
|
97
|
+
const showHtmlBundle = showHtmlOptions && !includeLinkedDocs;
|
|
98
|
+
const showEntryAsIndex = showHtmlOptions && (htmlBundle === "single" || includeLinkedDocs);
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (!showTransform) return;
|
|
101
|
+
let cancelled = false;
|
|
102
|
+
loadTransformStyleSummaries().then((nextTransforms) => {
|
|
103
|
+
if (!cancelled) setTransforms(nextTransforms);
|
|
104
|
+
}).catch(() => {
|
|
105
|
+
if (!cancelled) setTransforms([]);
|
|
106
|
+
});
|
|
107
|
+
return () => {
|
|
108
|
+
cancelled = true;
|
|
109
|
+
};
|
|
110
|
+
}, [showTransform]);
|
|
111
|
+
const currentOptions = useMemo(
|
|
112
|
+
() => ({
|
|
113
|
+
format,
|
|
114
|
+
themeId,
|
|
115
|
+
transformStyle,
|
|
116
|
+
pageSize,
|
|
117
|
+
htmlStyle,
|
|
118
|
+
htmlBundle,
|
|
119
|
+
includeLinkedDocs: showIncludeLinked && includeLinkedDocs,
|
|
120
|
+
entryAsIndex: showEntryAsIndex && entryAsIndex
|
|
121
|
+
}),
|
|
122
|
+
[
|
|
123
|
+
format,
|
|
124
|
+
themeId,
|
|
125
|
+
transformStyle,
|
|
126
|
+
pageSize,
|
|
127
|
+
htmlStyle,
|
|
128
|
+
htmlBundle,
|
|
129
|
+
includeLinkedDocs,
|
|
130
|
+
entryAsIndex,
|
|
131
|
+
showIncludeLinked,
|
|
132
|
+
showEntryAsIndex
|
|
133
|
+
]
|
|
134
|
+
);
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
onOptionsChange?.(currentOptions);
|
|
137
|
+
}, [currentOptions, onOptionsChange]);
|
|
138
|
+
const handleExport = useCallback(() => {
|
|
139
|
+
if (destination?.error) return;
|
|
140
|
+
saveExportOptions(currentOptions);
|
|
141
|
+
onExport(currentOptions);
|
|
142
|
+
}, [currentOptions, destination?.error, onExport]);
|
|
143
|
+
return /* @__PURE__ */ jsxs(
|
|
144
|
+
Dialog,
|
|
145
|
+
{
|
|
146
|
+
title: "Export Document",
|
|
147
|
+
onClose,
|
|
148
|
+
className: "db-export-dialog",
|
|
149
|
+
footerClassName: "db-export-footer",
|
|
150
|
+
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
151
|
+
/* @__PURE__ */ jsx(
|
|
152
|
+
"button",
|
|
153
|
+
{
|
|
154
|
+
type: "button",
|
|
155
|
+
className: "db-export-btn db-export-btn--secondary",
|
|
156
|
+
onClick: onClose,
|
|
157
|
+
children: "Cancel"
|
|
158
|
+
}
|
|
159
|
+
),
|
|
160
|
+
/* @__PURE__ */ jsx(
|
|
161
|
+
"button",
|
|
162
|
+
{
|
|
163
|
+
type: "button",
|
|
164
|
+
className: "db-export-btn db-export-btn--primary",
|
|
165
|
+
onClick: handleExport,
|
|
166
|
+
disabled: exporting || Boolean(destination?.error),
|
|
167
|
+
children: exporting ? "Exporting..." : "Export"
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
] }),
|
|
171
|
+
children: [
|
|
172
|
+
/* @__PURE__ */ jsxs("div", { className: "db-export-field", children: [
|
|
173
|
+
/* @__PURE__ */ jsx("span", { className: "db-export-label", children: "Format" }),
|
|
174
|
+
/* @__PURE__ */ jsx(
|
|
175
|
+
ChipRadioGroup,
|
|
176
|
+
{
|
|
177
|
+
name: "Format",
|
|
178
|
+
value: format,
|
|
179
|
+
options: FORMATS.map((f) => ({
|
|
180
|
+
key: f,
|
|
181
|
+
label: FORMAT_CHIP_LABELS[f],
|
|
182
|
+
title: FORMAT_LABELS[f]
|
|
183
|
+
})),
|
|
184
|
+
onChange: setFormat
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
] }),
|
|
188
|
+
destination && /* @__PURE__ */ jsxs("div", { className: "db-export-field", children: [
|
|
189
|
+
/* @__PURE__ */ jsx("label", { className: "db-export-label", htmlFor: "db-export-path", children: "Export to" }),
|
|
190
|
+
/* @__PURE__ */ jsxs("div", { className: "db-export-path-row", children: [
|
|
191
|
+
/* @__PURE__ */ jsx(
|
|
192
|
+
"input",
|
|
193
|
+
{
|
|
194
|
+
id: "db-export-path",
|
|
195
|
+
className: "db-export-path-input",
|
|
196
|
+
value: destination.value,
|
|
197
|
+
onChange: destination.onChange ? (event) => destination.onChange?.(event.target.value, currentOptions) : void 0,
|
|
198
|
+
readOnly: !destination.onChange,
|
|
199
|
+
disabled: exporting,
|
|
200
|
+
spellCheck: false,
|
|
201
|
+
autoComplete: "off",
|
|
202
|
+
"aria-invalid": Boolean(destination.error),
|
|
203
|
+
"aria-describedby": destination.error ? "db-export-path-error" : void 0
|
|
204
|
+
}
|
|
205
|
+
),
|
|
206
|
+
/* @__PURE__ */ jsx(
|
|
207
|
+
"button",
|
|
208
|
+
{
|
|
209
|
+
type: "button",
|
|
210
|
+
className: "db-export-path-pick",
|
|
211
|
+
onClick: () => void destination.onPick(currentOptions),
|
|
212
|
+
disabled: exporting,
|
|
213
|
+
"aria-label": "Choose export location",
|
|
214
|
+
title: "Choose export location",
|
|
215
|
+
children: "..."
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
] }),
|
|
219
|
+
destination.error && /* @__PURE__ */ jsx(
|
|
220
|
+
"span",
|
|
221
|
+
{
|
|
222
|
+
id: "db-export-path-error",
|
|
223
|
+
className: "db-export-hint db-export-hint--error",
|
|
224
|
+
role: "alert",
|
|
225
|
+
children: destination.error
|
|
226
|
+
}
|
|
227
|
+
),
|
|
228
|
+
destination.hint && /* @__PURE__ */ jsx("span", { className: "db-export-hint", children: destination.hint })
|
|
229
|
+
] }),
|
|
230
|
+
showHtmlOptions && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
231
|
+
/* @__PURE__ */ jsxs("div", { className: "db-export-field", children: [
|
|
232
|
+
/* @__PURE__ */ jsx("span", { className: "db-export-label", children: "Style" }),
|
|
233
|
+
/* @__PURE__ */ jsx(
|
|
234
|
+
ChipRadioGroup,
|
|
235
|
+
{
|
|
236
|
+
name: "Style",
|
|
237
|
+
value: htmlStyle,
|
|
238
|
+
options: HTML_STYLE_CHIPS,
|
|
239
|
+
onChange: setHtmlStyle
|
|
240
|
+
}
|
|
241
|
+
),
|
|
242
|
+
/* @__PURE__ */ jsx("span", { className: "db-export-hint", children: HTML_STYLE_CHIPS.find((c) => c.key === htmlStyle)?.hint })
|
|
243
|
+
] }),
|
|
244
|
+
showHtmlBundle && /* @__PURE__ */ jsxs("div", { className: "db-export-field", children: [
|
|
245
|
+
/* @__PURE__ */ jsx("span", { className: "db-export-label", children: "Bundle" }),
|
|
246
|
+
/* @__PURE__ */ jsx(
|
|
247
|
+
ChipRadioGroup,
|
|
248
|
+
{
|
|
249
|
+
name: "Bundle",
|
|
250
|
+
value: htmlBundle,
|
|
251
|
+
options: HTML_BUNDLE_CHIPS,
|
|
252
|
+
onChange: setHtmlBundle
|
|
253
|
+
}
|
|
254
|
+
),
|
|
255
|
+
/* @__PURE__ */ jsx("span", { className: "db-export-hint", children: HTML_BUNDLE_CHIPS.find((c) => c.key === htmlBundle)?.hint })
|
|
256
|
+
] }),
|
|
257
|
+
showIncludeLinked && /* @__PURE__ */ jsxs("div", { className: "db-export-field", children: [
|
|
258
|
+
/* @__PURE__ */ jsxs("label", { className: "db-export-checkbox", children: [
|
|
259
|
+
/* @__PURE__ */ jsx(
|
|
260
|
+
"input",
|
|
261
|
+
{
|
|
262
|
+
type: "checkbox",
|
|
263
|
+
checked: includeLinkedDocs,
|
|
264
|
+
onChange: (e) => setIncludeLinkedDocs(e.target.checked)
|
|
265
|
+
}
|
|
266
|
+
),
|
|
267
|
+
/* @__PURE__ */ jsx("span", { children: "Include linked-to documents" })
|
|
268
|
+
] }),
|
|
269
|
+
/* @__PURE__ */ jsx("span", { className: "db-export-hint", children: includeLinkedDocs ? "Follows relative .md links from this page and bundles every reachable document as its own .html in a ZIP. Cross-doc links rewrite from .md to .html." : "Only this document is exported." })
|
|
270
|
+
] }),
|
|
271
|
+
showEntryAsIndex && /* @__PURE__ */ jsxs("div", { className: "db-export-field", children: [
|
|
272
|
+
/* @__PURE__ */ jsxs("label", { className: "db-export-checkbox", children: [
|
|
273
|
+
/* @__PURE__ */ jsx(
|
|
274
|
+
"input",
|
|
275
|
+
{
|
|
276
|
+
type: "checkbox",
|
|
277
|
+
checked: entryAsIndex,
|
|
278
|
+
onChange: (e) => setEntryAsIndex(e.target.checked)
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
/* @__PURE__ */ jsx("span", { children: "Name entry page index.html" })
|
|
282
|
+
] }),
|
|
283
|
+
/* @__PURE__ */ jsx("span", { className: "db-export-hint", children: entryAsIndex ? includeLinkedDocs ? "Renames this page to index.html in the ZIP and rewrites any cross-doc links pointing back at it. Drops straight into a static-site host." : "Downloads as index.html instead of the document name. Drops straight into a static-site host." : "Exports under the document name." })
|
|
284
|
+
] })
|
|
285
|
+
] }),
|
|
286
|
+
showTheme && /* @__PURE__ */ jsxs("div", { className: "db-export-field", children: [
|
|
287
|
+
/* @__PURE__ */ jsx("label", { className: "db-export-label", htmlFor: "db-export-theme", children: "Theme" }),
|
|
288
|
+
/* @__PURE__ */ jsx(
|
|
289
|
+
"select",
|
|
290
|
+
{
|
|
291
|
+
id: "db-export-theme",
|
|
292
|
+
className: "db-export-select",
|
|
293
|
+
value: themeId,
|
|
294
|
+
onChange: (e) => setThemeId(e.target.value),
|
|
295
|
+
children: themes.map((t) => /* @__PURE__ */ jsx("option", { value: t.id, children: t.name }, t.id))
|
|
296
|
+
}
|
|
297
|
+
),
|
|
298
|
+
/* @__PURE__ */ jsx("span", { className: "db-export-hint", children: themes.find((t) => t.id === themeId)?.description })
|
|
299
|
+
] }),
|
|
300
|
+
showTransform && /* @__PURE__ */ jsxs("div", { className: "db-export-field", children: [
|
|
301
|
+
/* @__PURE__ */ jsx("label", { className: "db-export-label", htmlFor: "db-export-transform", children: "Transform" }),
|
|
302
|
+
/* @__PURE__ */ jsx(
|
|
303
|
+
"select",
|
|
304
|
+
{
|
|
305
|
+
id: "db-export-transform",
|
|
306
|
+
className: "db-export-select",
|
|
307
|
+
value: transformStyle,
|
|
308
|
+
onChange: (e) => setTransformStyle(e.target.value),
|
|
309
|
+
children: transforms.length === 0 ? /* @__PURE__ */ jsx("option", { value: transformStyle, children: "Loading..." }) : transforms.map((t) => /* @__PURE__ */ jsx("option", { value: t.id, children: t.name }, t.id))
|
|
310
|
+
}
|
|
311
|
+
),
|
|
312
|
+
/* @__PURE__ */ jsx("span", { className: "db-export-hint", children: transforms.find((t) => t.id === transformStyle)?.description })
|
|
313
|
+
] }),
|
|
314
|
+
showPageSize && /* @__PURE__ */ jsxs("div", { className: "db-export-field", children: [
|
|
315
|
+
/* @__PURE__ */ jsx("label", { className: "db-export-label", htmlFor: "db-export-pagesize", children: "Page Size" }),
|
|
316
|
+
/* @__PURE__ */ jsxs(
|
|
317
|
+
"select",
|
|
318
|
+
{
|
|
319
|
+
id: "db-export-pagesize",
|
|
320
|
+
className: "db-export-select",
|
|
321
|
+
value: pageSize,
|
|
322
|
+
onChange: (e) => setPageSize(e.target.value),
|
|
323
|
+
children: [
|
|
324
|
+
/* @__PURE__ */ jsx("option", { value: "letter", children: "US Letter" }),
|
|
325
|
+
/* @__PURE__ */ jsx("option", { value: "a4", children: "A4" })
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
)
|
|
329
|
+
] }),
|
|
330
|
+
onAnimatedGifExport && /* @__PURE__ */ jsxs("div", { className: "db-export-field", children: [
|
|
331
|
+
/* @__PURE__ */ jsx("span", { className: "db-export-label", children: "Animated media" }),
|
|
332
|
+
/* @__PURE__ */ jsx(
|
|
333
|
+
"button",
|
|
334
|
+
{
|
|
335
|
+
type: "button",
|
|
336
|
+
className: "db-export-btn db-export-btn--secondary",
|
|
337
|
+
onClick: onAnimatedGifExport,
|
|
338
|
+
children: "Animated GIF..."
|
|
339
|
+
}
|
|
340
|
+
),
|
|
341
|
+
/* @__PURE__ */ jsx("span", { className: "db-export-hint", children: "Opens timing, orientation, captions, looping, and color controls." })
|
|
342
|
+
] }),
|
|
343
|
+
/* @__PURE__ */ jsxs("p", { className: "db-export-more-formats", children: [
|
|
344
|
+
"Need spreadsheets, ",
|
|
345
|
+
onAnimatedGifExport ? "" : "animated media, ",
|
|
346
|
+
"portable bundles, or automation?",
|
|
347
|
+
" ",
|
|
348
|
+
/* @__PURE__ */ jsx("a", { href: "https://docblocks.com/cli/", target: "_blank", rel: "noopener noreferrer", children: "More formats with the DocBlocks CLI" }),
|
|
349
|
+
"."
|
|
350
|
+
] }),
|
|
351
|
+
error && /* @__PURE__ */ jsx("p", { className: "db-export-error", role: "alert", children: error })
|
|
352
|
+
]
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export {
|
|
358
|
+
ExportDialog
|
|
359
|
+
};
|