@bendyline/docblocks-react 2.7.0 → 2.7.2

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.
Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES.txt +98 -48
  3. package/dist/{AiDiagrams-XWOM3YZX.js → AiDiagrams-LFV4YU6W.js} +2 -2
  4. package/dist/{AiEditorAssistant-M4LI2CRY.js → AiEditorAssistant-GN2KXKZD.js} +21 -6
  5. package/dist/{ExportDialog-L6FG6W3H.js → ExportDialog-JRVZCG3J.js} +2 -2
  6. package/dist/{ExportToolbarControls-BRCPZ7H3.js → ExportToolbarControls-2FEIHNMW.js} +28 -18
  7. package/dist/{GitToolbarControl-J4UYZDV6.js → GitToolbarControl-B7KG4MFP.js} +4 -4
  8. package/dist/{GitUI-LZW3IUXO.js → GitUI-RCWUZVS6.js} +2 -2
  9. package/dist/KeyboardShortcutsDialog-NOD4P25G.js +145 -0
  10. package/dist/{PresentationMaker-622NHMIN.js → PresentationMaker-ITNP5SDO.js} +2 -2
  11. package/dist/{Settings-DuXk6baH.d.ts → Settings-RDYvDDI0.d.ts} +13 -11
  12. package/dist/ShareDialog-XUA2OVGI.js +292 -0
  13. package/dist/{SpeechToolbarControl-UZQKGQWD.js → SpeechToolbarControl-CLU7RB2G.js} +2 -2
  14. package/dist/{TextFromNarration-XYRAB6O2.js → TextFromNarration-NITJQ4IB.js} +1 -1
  15. package/dist/{WorkspaceSearchPanel-OUQQ5DOM.js → WorkspaceSearchPanel-J6BKEZQJ.js} +8 -2
  16. package/dist/{chunk-UG4G7PJ4.js → chunk-5O5YTOXG.js} +1 -1
  17. package/dist/{chunk-VO2JYYQZ.js → chunk-6JJOGV6M.js} +5 -13
  18. package/dist/{chunk-X437UAF7.js → chunk-6MSHXQNB.js} +7 -2
  19. package/dist/{chunk-Q5ZVP5LV.js → chunk-BLUEZG7T.js} +40 -32
  20. package/dist/chunk-DICE7VBJ.js +77 -0
  21. package/dist/{chunk-MRUK56JS.js → chunk-GMA4KGGO.js} +7 -3
  22. package/dist/{chunk-BCQZTWE5.js → chunk-HRWEGPTY.js} +18 -4
  23. package/dist/chunk-K7XJDJUJ.js +126 -0
  24. package/dist/{chunk-5OZBGIIT.js → chunk-NAH52736.js} +86 -28
  25. package/dist/{chunk-YS4HVWIO.js → chunk-SPUPWCSI.js} +49 -1
  26. package/dist/{chunk-MMOTEQK6.js → chunk-SSB43524.js} +165 -70
  27. package/dist/{chunk-G4MFB3IO.js → chunk-VG434562.js} +2 -70
  28. package/dist/{chunk-OINKNX26.js → chunk-X3DDTJKR.js} +1 -1
  29. package/dist/{chunk-SGQKTKDX.js → chunk-Y5OE3HJC.js} +14 -4
  30. package/dist/editor.js +7 -5
  31. package/dist/export/index.d.ts +17 -6
  32. package/dist/export/index.js +4 -4
  33. package/dist/index.d.ts +24 -6
  34. package/dist/index.js +452 -247
  35. package/dist/proofing/index.js +11 -1
  36. package/dist/run-export-CS3HRNAZ.js +13 -0
  37. package/dist/settings/index.d.ts +1 -1
  38. package/dist/settings/index.js +1 -1
  39. package/package.json +9 -8
  40. package/src/styles/docblocks.css +481 -271
  41. package/dist/ShareDialog-N7GPM4SB.js +0 -310
  42. package/dist/chunk-EA4BO6E4.js +0 -73
  43. package/dist/run-export-47X5FTYZ.js +0 -11
@@ -1,310 +0,0 @@
1
- import {
2
- buildSharedDocumentQrUrl,
3
- buildSharedDocumentUrl,
4
- createSharedDocumentArchive,
5
- sharedDocumentQrFilename
6
- } from "./chunk-YS4HVWIO.js";
7
-
8
- // src/Export/ShareDialog.tsx
9
- import { useCallback, useEffect, useMemo, useRef, useState } from "react";
10
- import { SHARED_DOCUMENT_LIMITS } from "@bendyline/docblocks/share";
11
-
12
- // src/Export/share-qr.ts
13
- import QRCode from "qrcode";
14
- async function renderSharedDocumentQrPng(url) {
15
- return QRCode.toDataURL(url, {
16
- type: "image/png",
17
- errorCorrectionLevel: "M",
18
- margin: 4,
19
- width: 1024,
20
- color: {
21
- dark: "#111111ff",
22
- light: "#ffffffff"
23
- }
24
- });
25
- }
26
- function qrPngDataUrlToBlob(dataUrl) {
27
- const prefix = "data:image/png;base64,";
28
- if (!dataUrl.startsWith(prefix)) {
29
- throw new Error("The QR code renderer returned an unsupported image format.");
30
- }
31
- const binary = atob(dataUrl.slice(prefix.length));
32
- const bytes = new Uint8Array(binary.length);
33
- for (let index = 0; index < binary.length; index += 1) {
34
- bytes[index] = binary.charCodeAt(index);
35
- }
36
- return new Blob([bytes], { type: "image/png" });
37
- }
38
-
39
- // src/Export/ShareDialog.tsx
40
- import { jsx, jsxs } from "react/jsx-runtime";
41
- var MODES = [
42
- { value: "", label: "Write (no default)" },
43
- { value: "slideshow", label: "Slideshow" },
44
- { value: "video", label: "Video" },
45
- { value: "page", label: "Page" },
46
- { value: "document", label: "Document" },
47
- { value: "narrate", label: "Narrate" }
48
- ];
49
- function ShareDialog({
50
- markdown,
51
- selectedFile,
52
- baseUrl,
53
- onClose
54
- }) {
55
- const [mode, setMode] = useState("");
56
- const [archive, setArchive] = useState(null);
57
- const [archiveError, setArchiveError] = useState(null);
58
- const [copyStatus, setCopyStatus] = useState("idle");
59
- const [qrDataUrl, setQrDataUrl] = useState(null);
60
- const [qrRenderError, setQrRenderError] = useState(null);
61
- const [qrCopyStatus, setQrCopyStatus] = useState("idle");
62
- const linkRef = useRef(null);
63
- useEffect(() => {
64
- let cancelled = false;
65
- setArchive(null);
66
- setArchiveError(null);
67
- void createSharedDocumentArchive(markdown, selectedFile).then((nextArchive) => {
68
- if (!cancelled) setArchive(nextArchive);
69
- }).catch((error) => {
70
- if (!cancelled) {
71
- setArchiveError(
72
- error instanceof Error ? error.message : "DocBlocks could not create the shared link."
73
- );
74
- }
75
- });
76
- return () => {
77
- cancelled = true;
78
- };
79
- }, [markdown, selectedFile]);
80
- const linkResult = useMemo(() => {
81
- if (!archive) return { url: "", error: archiveError };
82
- try {
83
- return { url: buildSharedDocumentUrl(baseUrl, archive, mode || null), error: null };
84
- } catch (error) {
85
- return {
86
- url: "",
87
- error: error instanceof Error ? error.message : "DocBlocks could not create the shared link."
88
- };
89
- }
90
- }, [archive, archiveError, baseUrl, mode]);
91
- const qrLinkResult = useMemo(() => {
92
- if (!archive) return { url: "", error: archiveError };
93
- try {
94
- return { url: buildSharedDocumentQrUrl(archive, mode || null), error: null };
95
- } catch (error) {
96
- return {
97
- url: "",
98
- error: error instanceof Error ? error.message : "DocBlocks could not create the QR code."
99
- };
100
- }
101
- }, [archive, archiveError, mode]);
102
- useEffect(() => {
103
- let cancelled = false;
104
- setQrDataUrl(null);
105
- setQrRenderError(null);
106
- setQrCopyStatus("idle");
107
- if (!qrLinkResult.url) return;
108
- void renderSharedDocumentQrPng(qrLinkResult.url).then((dataUrl) => {
109
- if (!cancelled) setQrDataUrl(dataUrl);
110
- }).catch((error) => {
111
- if (!cancelled) {
112
- setQrRenderError(
113
- error instanceof Error ? error.message : "DocBlocks could not render the QR code."
114
- );
115
- }
116
- });
117
- return () => {
118
- cancelled = true;
119
- };
120
- }, [qrLinkResult.url]);
121
- useEffect(() => setCopyStatus("idle"), [linkResult.url]);
122
- useEffect(() => {
123
- const handleKeyDown = (event) => {
124
- if (event.key === "Escape") onClose();
125
- };
126
- window.addEventListener("keydown", handleKeyDown);
127
- return () => window.removeEventListener("keydown", handleKeyDown);
128
- }, [onClose]);
129
- const copyLink = useCallback(async () => {
130
- if (!linkResult.url) return;
131
- try {
132
- if (navigator.clipboard?.writeText) {
133
- await navigator.clipboard.writeText(linkResult.url);
134
- } else {
135
- linkRef.current?.focus();
136
- linkRef.current?.select();
137
- if (typeof document.execCommand !== "function" || !document.execCommand("copy")) {
138
- throw new Error("Clipboard access is unavailable.");
139
- }
140
- }
141
- setCopyStatus("copied");
142
- } catch {
143
- linkRef.current?.focus();
144
- linkRef.current?.select();
145
- setCopyStatus("failed");
146
- }
147
- }, [linkResult.url]);
148
- const copyQrImage = useCallback(async () => {
149
- if (!qrDataUrl) return;
150
- try {
151
- if (!navigator.clipboard?.write || typeof ClipboardItem === "undefined") {
152
- throw new Error("Image clipboard access is unavailable.");
153
- }
154
- const png = qrPngDataUrlToBlob(qrDataUrl);
155
- await navigator.clipboard.write([new ClipboardItem({ "image/png": png })]);
156
- setQrCopyStatus("copied");
157
- } catch {
158
- setQrCopyStatus("failed");
159
- }
160
- }, [qrDataUrl]);
161
- const saveQrImage = useCallback(() => {
162
- if (!qrDataUrl) return;
163
- const download = document.createElement("a");
164
- download.href = qrDataUrl;
165
- download.download = sharedDocumentQrFilename(selectedFile);
166
- download.style.display = "none";
167
- document.body.append(download);
168
- download.click();
169
- download.remove();
170
- }, [qrDataUrl, selectedFile]);
171
- const isLong = linkResult.url.length > SHARED_DOCUMENT_LIMITS.portableUrlCharacters;
172
- const qrError = qrLinkResult.error ?? qrRenderError;
173
- return /* @__PURE__ */ jsx(
174
- "div",
175
- {
176
- className: "db-dialog-overlay",
177
- onClick: (event) => {
178
- if (event.target === event.currentTarget) onClose();
179
- },
180
- children: /* @__PURE__ */ jsxs(
181
- "div",
182
- {
183
- className: "db-dialog db-export-dialog db-share-dialog",
184
- role: "dialog",
185
- "aria-modal": "true",
186
- "aria-labelledby": "db-share-dialog-title",
187
- children: [
188
- /* @__PURE__ */ jsxs("div", { className: "db-dialog-header", children: [
189
- /* @__PURE__ */ jsx("h2", { className: "db-dialog-title", id: "db-share-dialog-title", children: "Share document" }),
190
- /* @__PURE__ */ jsx("button", { className: "db-dialog-close", type: "button", onClick: onClose, "aria-label": "Close", children: "\xD7" })
191
- ] }),
192
- /* @__PURE__ */ jsxs("div", { className: "db-dialog-body", children: [
193
- /* @__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." }),
194
- /* @__PURE__ */ jsxs("div", { className: "db-export-field", children: [
195
- /* @__PURE__ */ jsx("label", { className: "db-export-label", htmlFor: "db-share-mode", children: "Default mode (optional)" }),
196
- /* @__PURE__ */ jsx(
197
- "select",
198
- {
199
- id: "db-share-mode",
200
- className: "db-export-select",
201
- value: mode,
202
- onChange: (event) => setMode(event.target.value),
203
- children: MODES.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value || "write"))
204
- }
205
- ),
206
- /* @__PURE__ */ jsx("span", { className: "db-export-hint", children: "Without a default, the copied document opens in Write. Other choices open directly in Use." })
207
- ] }),
208
- /* @__PURE__ */ jsxs("div", { className: "db-export-field", children: [
209
- /* @__PURE__ */ jsx("label", { className: "db-export-label", htmlFor: "db-share-link", children: "Share link" }),
210
- /* @__PURE__ */ jsx(
211
- "textarea",
212
- {
213
- ref: linkRef,
214
- id: "db-share-link",
215
- className: "db-share-link",
216
- value: linkResult.url,
217
- readOnly: true,
218
- rows: 3,
219
- spellCheck: false,
220
- "aria-describedby": "db-share-link-status",
221
- placeholder: linkResult.error ? "" : "Creating link..."
222
- }
223
- ),
224
- /* @__PURE__ */ jsx(
225
- "span",
226
- {
227
- id: "db-share-link-status",
228
- className: `db-export-hint${isLong ? " db-share-length-warning" : ""}`,
229
- 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..."
230
- }
231
- )
232
- ] }),
233
- /* @__PURE__ */ jsxs("section", { className: "db-share-qr", "aria-labelledby": "db-share-qr-title", children: [
234
- /* @__PURE__ */ jsxs("div", { className: "db-share-qr-heading", children: [
235
- /* @__PURE__ */ jsxs("div", { children: [
236
- /* @__PURE__ */ jsx("h3", { id: "db-share-qr-title", children: "QR code" }),
237
- /* @__PURE__ */ jsx("span", { className: "db-export-hint", children: "A self-contained docblocks.com link. No document content is uploaded." })
238
- ] }),
239
- /* @__PURE__ */ jsxs("div", { className: "db-share-qr-actions", children: [
240
- /* @__PURE__ */ jsx(
241
- "button",
242
- {
243
- className: "db-export-btn db-export-btn--secondary",
244
- type: "button",
245
- onClick: () => void copyQrImage(),
246
- disabled: !qrDataUrl,
247
- children: qrCopyStatus === "copied" ? "Copied QR" : qrCopyStatus === "failed" ? "Copy unavailable" : "Copy QR image"
248
- }
249
- ),
250
- /* @__PURE__ */ jsx(
251
- "button",
252
- {
253
- className: "db-export-btn db-export-btn--secondary",
254
- type: "button",
255
- onClick: saveQrImage,
256
- disabled: !qrDataUrl,
257
- children: "Save QR PNG"
258
- }
259
- )
260
- ] })
261
- ] }),
262
- qrDataUrl ? /* @__PURE__ */ jsx(
263
- "img",
264
- {
265
- className: "db-share-qr-image",
266
- src: qrDataUrl,
267
- alt: "QR code for this shared DocBlocks document"
268
- }
269
- ) : /* @__PURE__ */ jsx(
270
- "div",
271
- {
272
- className: `db-share-qr-placeholder${qrError ? " db-share-qr-placeholder--error" : ""}`,
273
- role: qrError ? "note" : "status",
274
- children: qrError ?? "Rendering QR code..."
275
- }
276
- ),
277
- /* @__PURE__ */ jsx("span", { className: "db-export-hint db-share-qr-status", "aria-live": "polite", children: qrCopyStatus === "failed" ? "This browser could not copy the PNG. Save it instead." : qrDataUrl ? `${qrLinkResult.url.length.toLocaleString()} of ${SHARED_DOCUMENT_LIMITS.qrUrlCharacters.toLocaleString()} supported QR characters.` : "" })
278
- ] }),
279
- /* @__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." })
280
- ] }),
281
- /* @__PURE__ */ jsxs("div", { className: "db-export-footer", children: [
282
- /* @__PURE__ */ jsx(
283
- "button",
284
- {
285
- className: "db-export-btn db-export-btn--secondary",
286
- type: "button",
287
- onClick: onClose,
288
- children: "Close"
289
- }
290
- ),
291
- /* @__PURE__ */ jsx(
292
- "button",
293
- {
294
- className: "db-export-btn db-export-btn--primary",
295
- type: "button",
296
- onClick: () => void copyLink(),
297
- disabled: !linkResult.url,
298
- children: copyStatus === "copied" ? "Copied" : copyStatus === "failed" ? "Select and copy" : "Copy link"
299
- }
300
- )
301
- ] })
302
- ]
303
- }
304
- )
305
- }
306
- );
307
- }
308
- export {
309
- ShareDialog
310
- };
@@ -1,73 +0,0 @@
1
- // src/icons.tsx
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- function FontAwesomeIcon({ icon }) {
4
- return /* @__PURE__ */ jsx("i", { className: icon, "aria-hidden": "true" });
5
- }
6
- function NewFileIcon() {
7
- return /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: "fa-solid fa-file-circle-plus" });
8
- }
9
- function NewFolderIcon() {
10
- return /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: "fa-solid fa-folder-plus" });
11
- }
12
- function OpenFolderIcon() {
13
- return /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: "fa-solid fa-folder-open" });
14
- }
15
- function SortByNameIcon() {
16
- return /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: "fa-solid fa-arrow-down-a-z" });
17
- }
18
- function SortByLastModifiedIcon() {
19
- return /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: "fa-solid fa-clock" });
20
- }
21
- function FolderIcon() {
22
- return /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: "fa-solid fa-folder" });
23
- }
24
- function MoreIcon() {
25
- return /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: "fa-solid fa-ellipsis" });
26
- }
27
- function PinIcon() {
28
- return /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: "fa-solid fa-thumbtack" });
29
- }
30
- function WorkspaceIcon() {
31
- return /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: "fa-solid fa-gear" });
32
- }
33
- function SplitViewIcon() {
34
- return /* @__PURE__ */ jsxs(
35
- "svg",
36
- {
37
- width: "16",
38
- height: "16",
39
- viewBox: "0 0 16 16",
40
- fill: "none",
41
- stroke: "currentColor",
42
- strokeWidth: "1.5",
43
- strokeLinecap: "round",
44
- strokeLinejoin: "round",
45
- "aria-hidden": "true",
46
- children: [
47
- /* @__PURE__ */ jsx("rect", { x: "1.5", y: "2.5", width: "13", height: "11", rx: "1" }),
48
- /* @__PURE__ */ jsx("line", { x1: "6", y1: "2.5", x2: "6", y2: "13.5" })
49
- ]
50
- }
51
- );
52
- }
53
- function SearchIcon() {
54
- return /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: "fa-solid fa-magnifying-glass" });
55
- }
56
- function FilesIcon() {
57
- return /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: "fa-solid fa-folder-tree" });
58
- }
59
-
60
- export {
61
- NewFileIcon,
62
- NewFolderIcon,
63
- OpenFolderIcon,
64
- SortByNameIcon,
65
- SortByLastModifiedIcon,
66
- FolderIcon,
67
- MoreIcon,
68
- PinIcon,
69
- WorkspaceIcon,
70
- SplitViewIcon,
71
- SearchIcon,
72
- FilesIcon
73
- };
@@ -1,11 +0,0 @@
1
- import {
2
- runExport
3
- } from "./chunk-BCQZTWE5.js";
4
- import {
5
- buildExportFilename
6
- } from "./chunk-UG4G7PJ4.js";
7
- import "./chunk-X437UAF7.js";
8
- export {
9
- buildExportFilename,
10
- runExport
11
- };