@bendyline/docblocks-react 2.7.6 → 2.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES.txt +205 -35
- package/dist/{AiDiagrams-VOCEZS6U.js → AiDiagrams-2IKKSBAU.js} +6 -4
- package/dist/{AiEditorAssistant-2MW6UYNI.js → AiEditorAssistant-ANYGVG7P.js} +128 -12
- package/dist/AiImagePanel-OXWEFOBC.js +314 -0
- package/dist/{AiStudyDialog-DQZVTBI7.js → AiStudyDialog-T3FY74HY.js} +3 -3
- package/dist/{AudioExportDialog-EICCBSSE.js → AudioExportDialog-CBMSLQBS.js} +1 -1
- package/dist/DocumentConflictDialog-4R4QMKBT.js +217 -0
- package/dist/{ExportDialog-LGWBXIWN.js → ExportDialog-FNFD53SY.js} +2 -2
- package/dist/{ExportToolbarControls-4LYTXGT3.js → ExportToolbarControls-ZOYH4I36.js} +146 -68
- package/dist/{GitUI-F3CNBURE.js → GitUI-3FANM7I3.js} +88 -155
- package/dist/{KeyboardShortcutsDialog-HVKDFP5Z.js → KeyboardShortcutsDialog-7XJTDIX2.js} +1 -1
- package/dist/{PresentationMaker-T526TBRJ.js → PresentationMaker-COLTVMTS.js} +3 -3
- package/dist/{QuickOpenDialog-3QEX7RZG.js → QuickOpenDialog-U2FWCEPA.js} +1 -1
- package/dist/{Settings-CfhY489G.d.ts → Settings-ButIB78y.d.ts} +20 -4
- package/dist/{ShareDialog-PF7D7ORP.js → ShareDialog-WOWHI6YI.js} +1 -1
- package/dist/{SpeechToolbarControl-E6OSJGHL.js → SpeechToolbarControl-BZW6IVZM.js} +1 -1
- package/dist/{TextFromNarration-ME6FAYWO.js → TextFromNarration-6BYTUKVZ.js} +2 -2
- package/dist/chunk-27E2OON2.js +90 -0
- package/dist/{chunk-5O5YTOXG.js → chunk-5YMULR6A.js} +13 -1
- package/dist/{chunk-NOYDVL6M.js → chunk-6QHZNL6C.js} +45 -17
- package/dist/{chunk-45YTIVYS.js → chunk-A7BK6QFL.js} +363 -26
- package/dist/{chunk-PRUEYW3G.js → chunk-BGA5UVKL.js} +58 -17
- package/dist/{chunk-T42BH6YX.js → chunk-CXLXGFG2.js} +37 -15
- package/dist/{chunk-7CSBRAMT.js → chunk-F7TR5EKX.js} +8 -6
- package/dist/chunk-HIKMOKBQ.js +37 -0
- package/dist/chunk-OW6JWRAA.js +66 -0
- package/dist/{chunk-BNKIPCXO.js → chunk-QXBV3G6T.js} +5 -3
- package/dist/{chunk-7HBKKXRV.js → chunk-TN7BY5N3.js} +722 -281
- package/dist/{chunk-VJPGZCFS.js → chunk-UYJCL6OW.js} +4 -2
- package/dist/{chunk-GFK4TCKN.js → chunk-WDNE5TI3.js} +21 -7
- package/dist/{chunk-KBUHWZCF.js → chunk-YX275NPE.js} +1 -1
- package/dist/editor.js +3 -3
- package/dist/export/index.d.ts +16 -162
- package/dist/export/index.js +6 -4
- package/dist/image-save-D18dJrUr.d.ts +182 -0
- package/dist/index.d.ts +15 -11
- package/dist/index.js +1365 -1078
- package/dist/{run-export-SPNNH32M.js → run-export-C3PLLWLS.js} +2 -2
- package/dist/settings/index.d.ts +1 -1
- package/dist/settings/index.js +3 -2
- package/package.json +8 -8
- package/src/styles/docblocks.css +349 -11
- package/dist/DocumentConflictDialog-DZ2BV2IH.js +0 -111
|
@@ -19,6 +19,7 @@ function dismissTopmostDialog() {
|
|
|
19
19
|
|
|
20
20
|
// src/components/Dialog.tsx
|
|
21
21
|
import { useCallback, useEffect, useId, useRef } from "react";
|
|
22
|
+
import { createPortal } from "react-dom";
|
|
22
23
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
23
24
|
function Dialog({
|
|
24
25
|
title,
|
|
@@ -57,7 +58,7 @@ function Dialog({
|
|
|
57
58
|
const dialog = dialogRef.current;
|
|
58
59
|
if (!dialog) return;
|
|
59
60
|
const focusable = [...dialog.querySelectorAll(FOCUSABLE_SELECTOR)].filter(
|
|
60
|
-
(element) => !element.hasAttribute("disabled") && element.getAttribute("aria-hidden") !== "true"
|
|
61
|
+
(element) => !element.hasAttribute("disabled") && element.getAttribute("aria-hidden") !== "true" && element.closest("[hidden]") === null
|
|
61
62
|
);
|
|
62
63
|
if (focusable.length === 0) {
|
|
63
64
|
e.preventDefault();
|
|
@@ -96,7 +97,7 @@ function Dialog({
|
|
|
96
97
|
const bodyClasses = ["db-dialog-body", bodyClassName].filter(Boolean).join(" ");
|
|
97
98
|
const footerClasses = ["db-dialog-footer", footerClassName].filter(Boolean).join(" ");
|
|
98
99
|
const overlayClassName = placement === "top" ? "db-dialog-overlay db-dialog-overlay--top" : "db-dialog-overlay";
|
|
99
|
-
|
|
100
|
+
const overlay = /* @__PURE__ */ jsx("div", { className: overlayClassName, onClick: handleBackdropClick, children: /* @__PURE__ */ jsxs(
|
|
100
101
|
"div",
|
|
101
102
|
{
|
|
102
103
|
ref: dialogRef,
|
|
@@ -128,6 +129,7 @@ function Dialog({
|
|
|
128
129
|
]
|
|
129
130
|
}
|
|
130
131
|
) });
|
|
132
|
+
return typeof document === "undefined" ? overlay : createPortal(overlay, document.body);
|
|
131
133
|
}
|
|
132
134
|
var FOCUSABLE_SELECTOR = [
|
|
133
135
|
"a[href]",
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-6MSHXQNB.js";
|
|
10
10
|
import {
|
|
11
11
|
Dialog
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-UYJCL6OW.js";
|
|
13
13
|
|
|
14
14
|
// src/Export/ExportDialog.tsx
|
|
15
15
|
import { useState, useCallback, useEffect, useMemo } from "react";
|
|
@@ -84,6 +84,7 @@ function ExportDialog({
|
|
|
84
84
|
documentThemes,
|
|
85
85
|
exporting,
|
|
86
86
|
error,
|
|
87
|
+
errorAction,
|
|
87
88
|
destination,
|
|
88
89
|
openAfterSave,
|
|
89
90
|
onExport,
|
|
@@ -343,13 +344,26 @@ function ExportDialog({
|
|
|
343
344
|
}
|
|
344
345
|
)
|
|
345
346
|
] }),
|
|
346
|
-
/* @__PURE__ */ jsxs("
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
347
|
+
/* @__PURE__ */ jsxs("details", { className: "db-export-more-formats", children: [
|
|
348
|
+
/* @__PURE__ */ jsx("summary", { children: "More formats and automation" }),
|
|
349
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
350
|
+
"Need spreadsheets, portable bundles, or batch exports?",
|
|
351
|
+
" ",
|
|
352
|
+
/* @__PURE__ */ jsx("a", { href: "https://docblocks.com/cli/", target: "_blank", rel: "noopener noreferrer", children: "Explore the DocBlocks CLI" }),
|
|
353
|
+
"."
|
|
354
|
+
] })
|
|
351
355
|
] }),
|
|
352
|
-
error && /* @__PURE__ */ jsx("p", { className: "db-export-error", role: "alert", children: error })
|
|
356
|
+
error && /* @__PURE__ */ jsx("p", { className: "db-export-error", role: "alert", children: error }),
|
|
357
|
+
error && errorAction && /* @__PURE__ */ jsx("div", { className: "db-export-error-action", children: /* @__PURE__ */ jsx(
|
|
358
|
+
"button",
|
|
359
|
+
{
|
|
360
|
+
type: "button",
|
|
361
|
+
className: "db-export-btn db-export-btn--secondary",
|
|
362
|
+
onClick: errorAction.onClick,
|
|
363
|
+
disabled: exporting,
|
|
364
|
+
children: errorAction.label
|
|
365
|
+
}
|
|
366
|
+
) })
|
|
353
367
|
]
|
|
354
368
|
}
|
|
355
369
|
);
|
package/dist/editor.js
CHANGED
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
} from "./chunk-ACQF63SB.js";
|
|
14
14
|
import {
|
|
15
15
|
PresentationMaker
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-BGA5UVKL.js";
|
|
17
|
+
import "./chunk-CXLXGFG2.js";
|
|
18
18
|
import "./chunk-K4I3NJFL.js";
|
|
19
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-UYJCL6OW.js";
|
|
20
20
|
export {
|
|
21
21
|
EMPTY_DOCUMENT_PROMPTS,
|
|
22
22
|
FindButton,
|
package/dist/export/index.d.ts
CHANGED
|
@@ -1,168 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
export { I as CoverImageSaveAdapter, a as CoverImageSaveOutput, D as DEFAULT_OPTIONS, I as DashboardImageSaveAdapter, a as DashboardImageSaveOutput, j as ExportBehavior, E as ExportBlobSaver, k as ExportConverterOverrides, b as ExportDestinationControl, c as ExportDialog, d as ExportDialogProps, m as ExportErrorAction, e as ExportFormat, f as ExportOptions, n as ExportResult, F as FORMAT_EXTENSIONS, o as FORMAT_LABELS, H as HtmlBundle, g as HtmlStyle, I as ImageSaveAdapter, a as ImageSaveOutput, h as buildExportFilename, i as createCoverImageSaveOutput, i as createDashboardImageSaveOutput, i as createImageSaveOutput, l as loadLastExportOptions, p as resolveExportDialogInitial, r as runExport, s as saveExportOptions, u as updateExportTargetExtension } from '../image-save-D18dJrUr.js';
|
|
2
|
+
import '@bendyline/squisq-formats/pptx';
|
|
3
|
+
import '@bendyline/squisq/storage';
|
|
4
|
+
import '@bendyline/squisq-formats/diagrams';
|
|
5
|
+
import 'react/jsx-runtime';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
type HtmlStyle =
|
|
12
|
-
/** Render via SquisqPlayer (themed, embeds player bundle). */
|
|
13
|
-
'rendered'
|
|
14
|
-
/** Plain semantic HTML — small, no JS, no playback. */
|
|
15
|
-
| 'plain';
|
|
16
|
-
/** Packaging for HTML export. */
|
|
17
|
-
type HtmlBundle =
|
|
18
|
-
/** Single self-contained .html file (images base64-embedded). */
|
|
19
|
-
'single'
|
|
20
|
-
/** ZIP containing index.html + asset files. */
|
|
21
|
-
| 'zip';
|
|
22
|
-
interface ExportOptions {
|
|
23
|
-
format: ExportFormat;
|
|
24
|
-
themeId: string;
|
|
25
|
-
/** Transform style for PPTX; an empty string explicitly disables transforms. */
|
|
26
|
-
transformStyle: string;
|
|
27
|
-
/** Only applies to PDF */
|
|
28
|
-
pageSize: 'letter' | 'a4';
|
|
29
|
-
/** HTML rendering style. Only applies to format=html. */
|
|
30
|
-
htmlStyle: HtmlStyle;
|
|
31
|
-
/** HTML bundle layout. Only applies to format=html. */
|
|
32
|
-
htmlBundle: HtmlBundle;
|
|
33
|
-
/**
|
|
34
|
-
* Recursive HTML bundle: walk relative `.md` links from the entry
|
|
35
|
-
* document, render every reachable sibling/child page, and rewrite
|
|
36
|
-
* cross-doc links from `.md` → `.html`. The output is a ZIP
|
|
37
|
-
* regardless of `htmlBundle` because multi-doc output needs a
|
|
38
|
-
* directory tree. Supported for both plain (`markdownDocsToPlainHtmlBundle`)
|
|
39
|
-
* and rendered (`markdownDocsToHtmlBundle`) HTML styles. Only
|
|
40
|
-
* meaningful when `format === 'html'`.
|
|
41
|
-
*/
|
|
42
|
-
includeLinkedDocs: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Rename the entry page from `<basename>.html` to `index.html` so the
|
|
45
|
-
* export drops straight into a static-site host that expects an
|
|
46
|
-
* `index.html` landing page. For recursive bundles, cross-doc links
|
|
47
|
-
* targeting the entry also rewrite to `index.html` so siblings don't
|
|
48
|
-
* 404. For a single-doc HTML download, this just renames the file.
|
|
49
|
-
* Only meaningful when `format === 'html'`.
|
|
50
|
-
*/
|
|
51
|
-
entryAsIndex: boolean;
|
|
52
|
-
}
|
|
53
|
-
declare const FORMAT_LABELS: Record<ExportFormat, string>;
|
|
54
|
-
declare const FORMAT_EXTENSIONS: Record<ExportFormat, string>;
|
|
55
|
-
declare const DEFAULT_OPTIONS: ExportOptions;
|
|
56
|
-
/**
|
|
57
|
-
* Options that populate the export dialog: the user's last-chosen options
|
|
58
|
-
* (else the built-in defaults) for format, page size and the rest, but always
|
|
59
|
-
* the theme the editor previews this document in -- its own theme, else the
|
|
60
|
-
* workspace default, else Standard. The last export's theme belonged to some
|
|
61
|
-
* other document; carrying it over made the export differ from the preview.
|
|
62
|
-
*/
|
|
63
|
-
declare function resolveExportDialogInitial(lastOptions: ExportOptions | null, docThemeId: string | null | undefined, workspaceThemeId?: string | null): ExportOptions;
|
|
64
|
-
/** A theme as the export dialog's Theme select lists it. */
|
|
65
|
-
interface ExportThemeSummary {
|
|
66
|
-
id: string;
|
|
67
|
-
name: string;
|
|
68
|
-
description?: string;
|
|
69
|
-
}
|
|
70
|
-
declare function loadLastExportOptions(): ExportOptions | null;
|
|
71
|
-
declare function saveExportOptions(options: ExportOptions): void;
|
|
72
|
-
|
|
73
|
-
declare function buildExportFilename(selectedFile: string | null, options: ExportOptions): string;
|
|
74
|
-
|
|
75
|
-
type ExportBlobSaver = (blob: Blob, filename: string) => Promise<void> | void;
|
|
76
|
-
/** Host-provided converters that must be loaded before an export begins. */
|
|
77
|
-
interface ExportConverterOverrides {
|
|
78
|
-
docToPptx?: (typeof _bendyline_squisq_formats_pptx)['docToPptx'];
|
|
79
|
-
/**
|
|
80
|
-
* Draws diagrams as pictures. Defaults to Squisq's browser renderer; tests
|
|
81
|
-
* pass a stand-in because drawing needs a real canvas.
|
|
82
|
-
*/
|
|
83
|
-
diagramRenderer?: DiagramRasterizer;
|
|
84
|
-
}
|
|
85
|
-
/** What an export reports beyond the saved file. */
|
|
86
|
-
interface ExportResult {
|
|
87
|
-
/**
|
|
88
|
-
* What the user should know about the file that was saved, such as
|
|
89
|
-
* characters PDF export had to replace. Empty when nothing was lost.
|
|
90
|
-
*/
|
|
91
|
-
readonly warnings: readonly string[];
|
|
92
|
-
}
|
|
93
|
-
/** Run the export and trigger a download. */
|
|
94
|
-
declare function runExport(markdown: string, selectedFile: string | null, options: ExportOptions, mediaContainer?: ContentContainer | null, saveBlob?: ExportBlobSaver, converterOverrides?: ExportConverterOverrides): Promise<ExportResult>;
|
|
95
|
-
|
|
96
|
-
interface OpenAfterSaveControl {
|
|
97
|
-
checked: boolean;
|
|
98
|
-
onChange: (checked: boolean) => void;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
interface ExportDialogProps {
|
|
102
|
-
/** Initial options (pre-populated from last export). */
|
|
103
|
-
initial: ExportOptions;
|
|
104
|
-
/**
|
|
105
|
-
* Themes the document defines in its own frontmatter. Listed ahead of the
|
|
106
|
-
* built-ins so a document using one exports in the theme it previews in.
|
|
107
|
-
*/
|
|
108
|
-
documentThemes?: readonly ExportThemeSummary[];
|
|
109
|
-
/** Whether the export is currently running. */
|
|
110
|
-
exporting: boolean;
|
|
111
|
-
/**
|
|
112
|
-
* Message from a failed export attempt. Rendered in the dialog, which
|
|
113
|
-
* stays open so the user can adjust options and retry — a failure must
|
|
114
|
-
* never look like a success.
|
|
115
|
-
*/
|
|
116
|
-
error?: string | null;
|
|
117
|
-
/** Optional host-provided destination path control. */
|
|
118
|
-
destination?: ExportDestinationControl;
|
|
119
|
-
/** Present only when the host can open saved exports. */
|
|
120
|
-
openAfterSave?: OpenAfterSaveControl;
|
|
121
|
-
/** Called when the user confirms the export. */
|
|
122
|
-
onExport: (options: ExportOptions) => void;
|
|
123
|
-
/** Called whenever the currently selected options change. */
|
|
124
|
-
onOptionsChange?: (options: ExportOptions) => void;
|
|
125
|
-
/** Host-aware label for the final save action. Defaults to "Export". */
|
|
126
|
-
actionLabel?: (options: ExportOptions) => string;
|
|
127
|
-
/** Called when the dialog is dismissed. */
|
|
128
|
-
onClose: () => void;
|
|
129
|
-
}
|
|
130
|
-
interface ExportDestinationControl {
|
|
131
|
-
value: string;
|
|
132
|
-
/** Enables host-validated edits. Omit to render the destination as read-only. */
|
|
133
|
-
onChange?: (value: string, options: ExportOptions) => void;
|
|
134
|
-
onPick: (options: ExportOptions) => void | Promise<void>;
|
|
135
|
-
hint?: string;
|
|
136
|
-
/** A host-supplied validation error for the current destination value. */
|
|
137
|
-
error?: string | null;
|
|
138
|
-
}
|
|
139
|
-
declare function ExportDialog({ initial, documentThemes, exporting, error, destination, openAfterSave, onExport, onOptionsChange, actionLabel, onClose, }: ExportDialogProps): react_jsx_runtime.JSX.Element;
|
|
140
|
-
|
|
141
|
-
/** Keep a user-edited target name while switching the selected export format. */
|
|
142
|
-
declare function updateExportTargetExtension(targetPath: string, suggestedFilename: string): string;
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Host persistence for Squisq's rendered-output exporters.
|
|
8
|
+
* PDF export stopped before anything was saved because the PDF fonts would
|
|
9
|
+
* replace some of the document's characters (CJK text and most emoji). The
|
|
10
|
+
* user can save it anyway with the replacements, or pick a format that keeps
|
|
11
|
+
* every character.
|
|
146
12
|
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* blob lands. The exporters share one save-output contract upstream
|
|
150
|
-
* (`DashboardImageSaveOutput` is an alias of `CoverImageSaveOutput`, and the
|
|
151
|
-
* video dialog's `saveOutput` has the same shape), so they share one adapter
|
|
152
|
-
* here rather than identical copies.
|
|
13
|
+
* Kept out of `run-export.ts` so the export controls can recognise it without
|
|
14
|
+
* loading the export pipeline.
|
|
153
15
|
*/
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
16
|
+
declare class PdfReplacementsError extends Error {
|
|
17
|
+
/** Squisq's account of what would be replaced, for the message. */
|
|
18
|
+
readonly replacements: readonly string[];
|
|
19
|
+
constructor(replacements: readonly string[]);
|
|
158
20
|
}
|
|
159
|
-
type ImageSaveOutput = (blob: Blob, filename: string) => Promise<boolean | void>;
|
|
160
|
-
/**
|
|
161
|
-
* Adapt DocBlocks' two-step host destination flow to Squisq's rendered output
|
|
162
|
-
* callback. The picker stays host-owned, and cancellation is reported as
|
|
163
|
-
* `false` so the export dialog remains open without showing an error. Squisq
|
|
164
|
-
* shows a failure's message verbatim, so it arrives without IPC internals.
|
|
165
|
-
*/
|
|
166
|
-
declare function createImageSaveOutput<TTarget>(adapter: ImageSaveAdapter<TTarget>): ImageSaveOutput;
|
|
167
21
|
|
|
168
|
-
export {
|
|
22
|
+
export { PdfReplacementsError };
|
package/dist/export/index.js
CHANGED
|
@@ -3,16 +3,17 @@ import {
|
|
|
3
3
|
} from "../chunk-KWG6UP5O.js";
|
|
4
4
|
import {
|
|
5
5
|
runExport
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-F7TR5EKX.js";
|
|
7
7
|
import {
|
|
8
8
|
createImageSaveOutput
|
|
9
9
|
} from "../chunk-UONFWKJ7.js";
|
|
10
10
|
import {
|
|
11
|
+
PdfReplacementsError,
|
|
11
12
|
buildExportFilename
|
|
12
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-5YMULR6A.js";
|
|
13
14
|
import {
|
|
14
15
|
ExportDialog
|
|
15
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-WDNE5TI3.js";
|
|
16
17
|
import "../chunk-H3BK5MK6.js";
|
|
17
18
|
import {
|
|
18
19
|
DEFAULT_OPTIONS,
|
|
@@ -22,12 +23,13 @@ import {
|
|
|
22
23
|
resolveExportDialogInitial,
|
|
23
24
|
saveExportOptions
|
|
24
25
|
} from "../chunk-6MSHXQNB.js";
|
|
25
|
-
import "../chunk-
|
|
26
|
+
import "../chunk-UYJCL6OW.js";
|
|
26
27
|
export {
|
|
27
28
|
DEFAULT_OPTIONS,
|
|
28
29
|
ExportDialog,
|
|
29
30
|
FORMAT_EXTENSIONS,
|
|
30
31
|
FORMAT_LABELS,
|
|
32
|
+
PdfReplacementsError,
|
|
31
33
|
buildExportFilename,
|
|
32
34
|
createImageSaveOutput as createCoverImageSaveOutput,
|
|
33
35
|
createImageSaveOutput as createDashboardImageSaveOutput,
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import * as _bendyline_squisq_formats_pptx from '@bendyline/squisq-formats/pptx';
|
|
2
|
+
import { ContentContainer } from '@bendyline/squisq/storage';
|
|
3
|
+
import { DiagramRasterizer } from '@bendyline/squisq-formats/diagrams';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Export option types and localStorage persistence for quick-export.
|
|
8
|
+
*/
|
|
9
|
+
type ExportFormat = 'docx' | 'pdf' | 'pptx' | 'epub' | 'md' | 'html';
|
|
10
|
+
/** Visual style for HTML export. */
|
|
11
|
+
type HtmlStyle =
|
|
12
|
+
/** Render via SquisqPlayer (themed, embeds player bundle). */
|
|
13
|
+
'rendered'
|
|
14
|
+
/** Plain semantic HTML — small, no JS, no playback. */
|
|
15
|
+
| 'plain';
|
|
16
|
+
/** Packaging for HTML export. */
|
|
17
|
+
type HtmlBundle =
|
|
18
|
+
/** Single self-contained .html file (images base64-embedded). */
|
|
19
|
+
'single'
|
|
20
|
+
/** ZIP containing index.html + asset files. */
|
|
21
|
+
| 'zip';
|
|
22
|
+
interface ExportOptions {
|
|
23
|
+
format: ExportFormat;
|
|
24
|
+
themeId: string;
|
|
25
|
+
/** Transform style for PPTX; an empty string explicitly disables transforms. */
|
|
26
|
+
transformStyle: string;
|
|
27
|
+
/** Only applies to PDF */
|
|
28
|
+
pageSize: 'letter' | 'a4';
|
|
29
|
+
/** HTML rendering style. Only applies to format=html. */
|
|
30
|
+
htmlStyle: HtmlStyle;
|
|
31
|
+
/** HTML bundle layout. Only applies to format=html. */
|
|
32
|
+
htmlBundle: HtmlBundle;
|
|
33
|
+
/**
|
|
34
|
+
* Recursive HTML bundle: walk relative `.md` links from the entry
|
|
35
|
+
* document, render every reachable sibling/child page, and rewrite
|
|
36
|
+
* cross-doc links from `.md` → `.html`. The output is a ZIP
|
|
37
|
+
* regardless of `htmlBundle` because multi-doc output needs a
|
|
38
|
+
* directory tree. Supported for both plain (`markdownDocsToPlainHtmlBundle`)
|
|
39
|
+
* and rendered (`markdownDocsToHtmlBundle`) HTML styles. Only
|
|
40
|
+
* meaningful when `format === 'html'`.
|
|
41
|
+
*/
|
|
42
|
+
includeLinkedDocs: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Rename the entry page from `<basename>.html` to `index.html` so the
|
|
45
|
+
* export drops straight into a static-site host that expects an
|
|
46
|
+
* `index.html` landing page. For recursive bundles, cross-doc links
|
|
47
|
+
* targeting the entry also rewrite to `index.html` so siblings don't
|
|
48
|
+
* 404. For a single-doc HTML download, this just renames the file.
|
|
49
|
+
* Only meaningful when `format === 'html'`.
|
|
50
|
+
*/
|
|
51
|
+
entryAsIndex: boolean;
|
|
52
|
+
}
|
|
53
|
+
declare const FORMAT_LABELS: Record<ExportFormat, string>;
|
|
54
|
+
declare const FORMAT_EXTENSIONS: Record<ExportFormat, string>;
|
|
55
|
+
declare const DEFAULT_OPTIONS: ExportOptions;
|
|
56
|
+
/**
|
|
57
|
+
* Options that populate the export dialog: the user's last-chosen options
|
|
58
|
+
* (else the built-in defaults) for format, page size and the rest, but always
|
|
59
|
+
* the theme the editor previews this document in -- its own theme, else the
|
|
60
|
+
* workspace default, else Standard. The last export's theme belonged to some
|
|
61
|
+
* other document; carrying it over made the export differ from the preview.
|
|
62
|
+
*/
|
|
63
|
+
declare function resolveExportDialogInitial(lastOptions: ExportOptions | null, docThemeId: string | null | undefined, workspaceThemeId?: string | null): ExportOptions;
|
|
64
|
+
/** A theme as the export dialog's Theme select lists it. */
|
|
65
|
+
interface ExportThemeSummary {
|
|
66
|
+
id: string;
|
|
67
|
+
name: string;
|
|
68
|
+
description?: string;
|
|
69
|
+
}
|
|
70
|
+
declare function loadLastExportOptions(): ExportOptions | null;
|
|
71
|
+
declare function saveExportOptions(options: ExportOptions): void;
|
|
72
|
+
|
|
73
|
+
declare function buildExportFilename(selectedFile: string | null, options: ExportOptions): string;
|
|
74
|
+
|
|
75
|
+
type ExportBlobSaver = (blob: Blob, filename: string) => Promise<void> | void;
|
|
76
|
+
/** Host-provided converters that must be loaded before an export begins. */
|
|
77
|
+
interface ExportConverterOverrides {
|
|
78
|
+
docToPptx?: (typeof _bendyline_squisq_formats_pptx)['docToPptx'];
|
|
79
|
+
/**
|
|
80
|
+
* Draws diagrams as pictures. Defaults to Squisq's browser renderer; tests
|
|
81
|
+
* pass a stand-in because drawing needs a real canvas.
|
|
82
|
+
*/
|
|
83
|
+
diagramRenderer?: DiagramRasterizer;
|
|
84
|
+
}
|
|
85
|
+
/** What an export reports beyond the saved file. */
|
|
86
|
+
interface ExportResult {
|
|
87
|
+
/**
|
|
88
|
+
* What the user should know about the file that was saved, such as
|
|
89
|
+
* characters PDF export had to replace. Empty when nothing was lost.
|
|
90
|
+
*/
|
|
91
|
+
readonly warnings: readonly string[];
|
|
92
|
+
}
|
|
93
|
+
/** Choices the user made for this one export, as opposed to its saved options. */
|
|
94
|
+
interface ExportBehavior {
|
|
95
|
+
/**
|
|
96
|
+
* Save a PDF even though its fonts replace some characters. Without it,
|
|
97
|
+
* such an export throws `PdfReplacementsError` before saving anything.
|
|
98
|
+
*/
|
|
99
|
+
allowPdfReplacements?: boolean;
|
|
100
|
+
}
|
|
101
|
+
/** Run the export and trigger a download. */
|
|
102
|
+
declare function runExport(markdown: string, selectedFile: string | null, options: ExportOptions, mediaContainer?: ContentContainer | null, saveBlob?: ExportBlobSaver, converterOverrides?: ExportConverterOverrides, behavior?: ExportBehavior): Promise<ExportResult>;
|
|
103
|
+
|
|
104
|
+
interface OpenAfterSaveControl {
|
|
105
|
+
checked: boolean;
|
|
106
|
+
onChange: (checked: boolean) => void;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
interface ExportDialogProps {
|
|
110
|
+
/** Initial options (pre-populated from last export). */
|
|
111
|
+
initial: ExportOptions;
|
|
112
|
+
/**
|
|
113
|
+
* Themes the document defines in its own frontmatter. Listed ahead of the
|
|
114
|
+
* built-ins so a document using one exports in the theme it previews in.
|
|
115
|
+
*/
|
|
116
|
+
documentThemes?: readonly ExportThemeSummary[];
|
|
117
|
+
/** Whether the export is currently running. */
|
|
118
|
+
exporting: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Message from a failed export attempt. Rendered in the dialog, which
|
|
121
|
+
* stays open so the user can adjust options and retry — a failure must
|
|
122
|
+
* never look like a success.
|
|
123
|
+
*/
|
|
124
|
+
error?: string | null;
|
|
125
|
+
/** A way past the error, shown under it, such as saving a PDF with replacements. */
|
|
126
|
+
errorAction?: ExportErrorAction | null;
|
|
127
|
+
/** Optional host-provided destination path control. */
|
|
128
|
+
destination?: ExportDestinationControl;
|
|
129
|
+
/** Present only when the host can open saved exports. */
|
|
130
|
+
openAfterSave?: OpenAfterSaveControl;
|
|
131
|
+
/** Called when the user confirms the export. */
|
|
132
|
+
onExport: (options: ExportOptions) => void;
|
|
133
|
+
/** Called whenever the currently selected options change. */
|
|
134
|
+
onOptionsChange?: (options: ExportOptions) => void;
|
|
135
|
+
/** Host-aware label for the final save action. Defaults to "Export". */
|
|
136
|
+
actionLabel?: (options: ExportOptions) => string;
|
|
137
|
+
/** Called when the dialog is dismissed. */
|
|
138
|
+
onClose: () => void;
|
|
139
|
+
}
|
|
140
|
+
interface ExportErrorAction {
|
|
141
|
+
label: string;
|
|
142
|
+
onClick: () => void;
|
|
143
|
+
}
|
|
144
|
+
interface ExportDestinationControl {
|
|
145
|
+
value: string;
|
|
146
|
+
/** Enables host-validated edits. Omit to render the destination as read-only. */
|
|
147
|
+
onChange?: (value: string, options: ExportOptions) => void;
|
|
148
|
+
onPick: (options: ExportOptions) => void | Promise<void>;
|
|
149
|
+
hint?: string;
|
|
150
|
+
/** A host-supplied validation error for the current destination value. */
|
|
151
|
+
error?: string | null;
|
|
152
|
+
}
|
|
153
|
+
declare function ExportDialog({ initial, documentThemes, exporting, error, errorAction, destination, openAfterSave, onExport, onOptionsChange, actionLabel, onClose, }: ExportDialogProps): react_jsx_runtime.JSX.Element;
|
|
154
|
+
|
|
155
|
+
/** Keep a user-edited target name while switching the selected export format. */
|
|
156
|
+
declare function updateExportTargetExtension(targetPath: string, suggestedFilename: string): string;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Host persistence for Squisq's rendered-output exporters.
|
|
160
|
+
*
|
|
161
|
+
* Squisq renders the cover image, the Dashboard image, and exported video in
|
|
162
|
+
* the browser and hands the host a finished blob; DocBlocks owns where that
|
|
163
|
+
* blob lands. The exporters share one save-output contract upstream
|
|
164
|
+
* (`DashboardImageSaveOutput` is an alias of `CoverImageSaveOutput`, and the
|
|
165
|
+
* video dialog's `saveOutput` has the same shape), so they share one adapter
|
|
166
|
+
* here rather than identical copies.
|
|
167
|
+
*/
|
|
168
|
+
/** Host persistence shape required by the editor's rendered-output exporters. */
|
|
169
|
+
interface ImageSaveAdapter<TTarget> {
|
|
170
|
+
pickTarget(filename: string, currentTarget?: TTarget | null): Promise<TTarget | null>;
|
|
171
|
+
saveBlob(blob: Blob, filename: string, target?: TTarget | null): Promise<TTarget | null>;
|
|
172
|
+
}
|
|
173
|
+
type ImageSaveOutput = (blob: Blob, filename: string) => Promise<boolean | void>;
|
|
174
|
+
/**
|
|
175
|
+
* Adapt DocBlocks' two-step host destination flow to Squisq's rendered output
|
|
176
|
+
* callback. The picker stays host-owned, and cancellation is reported as
|
|
177
|
+
* `false` so the export dialog remains open without showing an error. Squisq
|
|
178
|
+
* shows a failure's message verbatim, so it arrives without IPC internals.
|
|
179
|
+
*/
|
|
180
|
+
declare function createImageSaveOutput<TTarget>(adapter: ImageSaveAdapter<TTarget>): ImageSaveOutput;
|
|
181
|
+
|
|
182
|
+
export { DEFAULT_OPTIONS as D, type ExportBlobSaver as E, FORMAT_EXTENSIONS as F, type HtmlBundle as H, type ImageSaveAdapter as I, type ImageSaveOutput as a, type ExportDestinationControl as b, ExportDialog as c, type ExportDialogProps as d, type ExportFormat as e, type ExportOptions as f, type HtmlStyle as g, buildExportFilename as h, createImageSaveOutput as i, type ExportBehavior as j, type ExportConverterOverrides as k, loadLastExportOptions as l, type ExportErrorAction as m, type ExportResult as n, FORMAT_LABELS as o, resolveExportDialogInitial as p, runExport as r, saveExportOptions as s, updateExportTargetExtension as u };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,15 +6,15 @@ import { CodeBlockCopyHandler } from '@bendyline/squisq-react';
|
|
|
6
6
|
import { FfmpegWasmLoadConfig } from '@bendyline/squisq-video';
|
|
7
7
|
import { PrunePolicy, SaveVersionResult, DocumentVersionManager } from '@bendyline/squisq/versions';
|
|
8
8
|
import { DocBlocksHostAiAPI, DocBlocksHostSpeechAPI, DocBlocksHostMenuAPI } from '@bendyline/docblocks/host';
|
|
9
|
-
import { T as ThemePreference, A as AccentColor, I as InterfaceFontPreference,
|
|
10
|
-
export { a as AccentColorSettings, b as AccentColorSettingsProps, c as AiSettingsControls, d as AiSettingsControlsProps, D as DEFAULT_INTERFACE_FONT, e as DEFAULT_PROOFING_PREFERENCES, f as DEFAULT_WRITE_CANVAS_FONT_SCHEME, g as InterfaceFontSettings, h as InterfaceFontSettingsProps, i as ProofingSettingsControls, j as ProofingSettingsControlsProps, S as SettingsDialog, k as SettingsDialogProps, l as
|
|
9
|
+
import { T as ThemePreference, A as AccentColor, I as InterfaceFontPreference, W as WriteCanvasPreferences, P as ProofingPreferences } from './Settings-ButIB78y.js';
|
|
10
|
+
export { a as AccentColorSettings, b as AccentColorSettingsProps, c as AiSettingsControls, d as AiSettingsControlsProps, D as DEFAULT_INTERFACE_FONT, e as DEFAULT_PROOFING_PREFERENCES, f as DEFAULT_WRITE_CANVAS_FONT_SCHEME, g as InterfaceFontSettings, h as InterfaceFontSettingsProps, i as ProofingSettingsControls, j as ProofingSettingsControlsProps, S as SettingsDialog, k as SettingsDialogProps, l as SettingsSection, m as ThemeSettings, n as ThemeSettingsProps, o as WRITE_CANVAS_FONT_SCHEMES, p as WriteCanvasFontScheme, q as WriteCanvasFontSchemeGroup, r as WriteCanvasFontSchemeOption, s as WriteCanvasSettingsControls, t as WriteCanvasSettingsControlsProps, u as loadInterfaceFont, v as loadProofingPreferences, w as resolveWriteCanvasFonts, x as saveInterfaceFont, y as saveProofingPreferences } from './Settings-ButIB78y.js';
|
|
11
11
|
import { SharedDocumentMode } from '@bendyline/docblocks/share';
|
|
12
12
|
import { MediaProvider } from '@bendyline/squisq/schemas';
|
|
13
13
|
import { ContentContainer } from '@bendyline/squisq/storage';
|
|
14
14
|
import { VideoExportModalProps } from '@bendyline/squisq-video-react';
|
|
15
15
|
import { MediaEditRenderManager } from '@bendyline/squisq-video-react/media-edit';
|
|
16
|
-
import { ExportBlobSaver } from './
|
|
17
|
-
export { CoverImageSaveAdapter, CoverImageSaveOutput, DEFAULT_OPTIONS,
|
|
16
|
+
import { E as ExportBlobSaver } from './image-save-D18dJrUr.js';
|
|
17
|
+
export { I as CoverImageSaveAdapter, a as CoverImageSaveOutput, D as DEFAULT_OPTIONS, I as DashboardImageSaveAdapter, a as DashboardImageSaveOutput, b as ExportDestinationControl, c as ExportDialog, d as ExportDialogProps, e as ExportFormat, f as ExportOptions, H as HtmlBundle, g as HtmlStyle, I as ImageSaveAdapter, a as ImageSaveOutput, h as buildExportFilename, i as createCoverImageSaveOutput, i as createDashboardImageSaveOutput, i as createImageSaveOutput, l as loadLastExportOptions, r as runExport, u as updateExportTargetExtension } from './image-save-D18dJrUr.js';
|
|
18
18
|
import { DocumentSession, DocumentSessionSnapshot } from '@bendyline/docblocks/document';
|
|
19
19
|
import 'react';
|
|
20
20
|
import '@bendyline/squisq-formats/pptx';
|
|
@@ -443,6 +443,8 @@ declare function DocBlocksShell({ theme: hostTheme, logoUrl, logoDarkUrl, issueR
|
|
|
443
443
|
|
|
444
444
|
type VersioningPreference = 'on' | 'browser-only' | 'off';
|
|
445
445
|
|
|
446
|
+
type AppSettingsSection = 'appearance' | 'ai' | 'dictation' | 'narration' | 'device';
|
|
447
|
+
|
|
446
448
|
interface AppMenuProps {
|
|
447
449
|
/** Optional logo image URL to display instead of the text label. */
|
|
448
450
|
logoUrl?: string;
|
|
@@ -497,9 +499,9 @@ interface AppMenuProps {
|
|
|
497
499
|
*/
|
|
498
500
|
onInstallApp?: () => void | Promise<void>;
|
|
499
501
|
/**
|
|
500
|
-
* Async origin storage usage/quota for the Settings "Storage"
|
|
502
|
+
* Async origin storage usage/quota for the Settings "Storage" group
|
|
501
503
|
* (fetched when the dialog opens). When omitted — Electron, or browsers
|
|
502
|
-
* without `navigator.storage.estimate` — the
|
|
504
|
+
* without `navigator.storage.estimate` — the group is hidden.
|
|
503
505
|
*/
|
|
504
506
|
getStorageEstimate?: () => Promise<{
|
|
505
507
|
usage: number;
|
|
@@ -520,19 +522,21 @@ interface AppMenuProps {
|
|
|
520
522
|
*/
|
|
521
523
|
ai?: DocBlocksHostAiAPI;
|
|
522
524
|
/**
|
|
523
|
-
* The host's speech API. When present, Settings offers
|
|
524
|
-
*
|
|
525
|
+
* The host's speech API. When present, Settings offers Dictation and
|
|
526
|
+
* Narration sections for the engines it has; when omitted both are hidden.
|
|
525
527
|
*/
|
|
526
528
|
speech?: DocBlocksHostSpeechAPI;
|
|
527
529
|
/**
|
|
528
530
|
* The host's menu API, when it offers the opt-in tray / menu bar icon
|
|
529
|
-
* (`hostSupports('trayIcon')`). When omitted the
|
|
531
|
+
* (`hostSupports('trayIcon')`). When omitted the setting is hidden.
|
|
530
532
|
*/
|
|
531
533
|
tray?: DocBlocksHostMenuAPI;
|
|
532
534
|
/** Opens Settings whenever it changes to a new non-zero value. */
|
|
533
535
|
settingsRequest?: number;
|
|
536
|
+
/** The section `settingsRequest` opens on; otherwise the last one shown. */
|
|
537
|
+
settingsRequestSection?: AppSettingsSection;
|
|
534
538
|
}
|
|
535
|
-
declare function AppMenu({ logoUrl, logoDarkUrl, themePreference, onThemeChange, accentColor, onAccentColorChange, interfaceFont, onInterfaceFontChange, writeCanvasSettings, onWriteCanvasSettingsChange, proofingPreferences, onProofingPreferencesChange, versioningPreference, onVersioningPreferenceChange, onOpenWorkspaceSettings, onDownloadAllWorkspaces, onRestoreBackup, onShowKeyboardShortcuts, onKeepBrowserData, onInstallApp, getStorageEstimate, storagePersistent, appVersion, appBuildDate, ai, speech, tray, settingsRequest, }: AppMenuProps): react_jsx_runtime.JSX.Element;
|
|
539
|
+
declare function AppMenu({ logoUrl, logoDarkUrl, themePreference, onThemeChange, accentColor, onAccentColorChange, interfaceFont, onInterfaceFontChange, writeCanvasSettings, onWriteCanvasSettingsChange, proofingPreferences, onProofingPreferencesChange, versioningPreference, onVersioningPreferenceChange, onOpenWorkspaceSettings, onDownloadAllWorkspaces, onRestoreBackup, onShowKeyboardShortcuts, onKeepBrowserData, onInstallApp, getStorageEstimate, storagePersistent, appVersion, appBuildDate, ai, speech, tray, settingsRequest, settingsRequestSection, }: AppMenuProps): react_jsx_runtime.JSX.Element;
|
|
536
540
|
|
|
537
541
|
interface ExportToolbarControlsProps {
|
|
538
542
|
/** Currently selected file path — used to derive the download filename. */
|
|
@@ -612,4 +616,4 @@ interface UseDocumentSessionResult {
|
|
|
612
616
|
*/
|
|
613
617
|
declare function useDocumentSession(autoSaveDelayMs?: number): UseDocumentSessionResult;
|
|
614
618
|
|
|
615
|
-
export { AccentColor, AppMenu, type AppMenuProps, DocBlocksShell, type DocBlocksShellProps, ExportBlobSaver, type ExportDestinationAdapter, type ExportDestinationTarget, ExportToolbarControls, type ExportToolbarControlsProps, FileExplorer, type FileExplorerProps, type FileExplorerSortMode, type FileTreeActions, type FileTreeChange, type FileTreeMutationHandler, FileTreeNode, type FileTreeNodeProps, type FileTreeReadIssue, type FileTreeState, InterfaceFontPreference, type NewFileFormat, ProofingPreferences, ThemePreference, type UseDocumentSessionResult, WorkspacePicker, type WorkspacePickerProps, WriteCanvasPreferences, useDocumentSession, useFileTree };
|
|
619
|
+
export { AccentColor, AppMenu, type AppMenuProps, type AppSettingsSection, DocBlocksShell, type DocBlocksShellProps, ExportBlobSaver, type ExportDestinationAdapter, type ExportDestinationTarget, ExportToolbarControls, type ExportToolbarControlsProps, FileExplorer, type FileExplorerProps, type FileExplorerSortMode, type FileTreeActions, type FileTreeChange, type FileTreeMutationHandler, FileTreeNode, type FileTreeNodeProps, type FileTreeReadIssue, type FileTreeState, InterfaceFontPreference, type NewFileFormat, ProofingPreferences, ThemePreference, type UseDocumentSessionResult, WorkspacePicker, type WorkspacePickerProps, WriteCanvasPreferences, useDocumentSession, useFileTree };
|