@bendyline/docblocks-react 2.6.1 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +3 -10
  2. package/THIRD_PARTY_NOTICES.txt +4284 -3651
  3. package/dist/AiDiagrams-XWOM3YZX.js +13 -0
  4. package/dist/AiEditorAssistant-M4LI2CRY.js +771 -0
  5. package/dist/AudioExportDialog-F23QXNPB.js +253 -0
  6. package/dist/DocumentConflictDialog-5LRVIGXS.js +111 -0
  7. package/dist/ExportDialog-L6FG6W3H.js +9 -0
  8. package/dist/{ExportToolbarControls-QYLBRWM7.js → ExportToolbarControls-BRCPZ7H3.js} +108 -42
  9. package/dist/{GitUI-L5T3XHZG.js → GitUI-LZW3IUXO.js} +5 -5
  10. package/dist/PresentationMaker-622NHMIN.js +9 -0
  11. package/dist/QuickOpenDialog-2KK4SEBU.js +356 -0
  12. package/dist/Settings-DuXk6baH.d.ts +144 -0
  13. package/dist/{ShareDialog-4OX3UPJ4.js → ShareDialog-N7GPM4SB.js} +10 -59
  14. package/dist/SpeechToolbarControl-UZQKGQWD.js +434 -0
  15. package/dist/TextFromNarration-XYRAB6O2.js +598 -0
  16. package/dist/WorkspaceSearchPanel-OUQQ5DOM.js +328 -0
  17. package/dist/chunk-2IYBBFQX.js +201 -0
  18. package/dist/{chunk-LG6HAWCK.js → chunk-56KO2LYN.js} +35 -4
  19. package/dist/chunk-5OZBGIIT.js +1826 -0
  20. package/dist/chunk-6B7G33D5.js +88 -0
  21. package/dist/chunk-ARATARVJ.js +40 -0
  22. package/dist/{chunk-ODYNOPC3.js → chunk-BCQZTWE5.js} +57 -17
  23. package/dist/chunk-EA4BO6E4.js +73 -0
  24. package/dist/chunk-G4MFB3IO.js +208 -0
  25. package/dist/chunk-I44HKDQX.js +314 -0
  26. package/dist/chunk-K4I3NJFL.js +49 -0
  27. package/dist/chunk-KBDZDFPU.js +61 -0
  28. package/dist/{chunk-FNSRCCBC.js → chunk-KWG6UP5O.js} +0 -10
  29. package/dist/chunk-MMOTEQK6.js +518 -0
  30. package/dist/chunk-OINKNX26.js +574 -0
  31. package/dist/chunk-Q5ZVP5LV.js +1711 -0
  32. package/dist/chunk-RP3DVNTI.js +62 -0
  33. package/dist/{chunk-FMDLZ4ZG.js → chunk-SGQKTKDX.js} +2 -2
  34. package/dist/chunk-TBLZBNQF.js +25 -0
  35. package/dist/{chunk-M5Y5WO7Z.js → chunk-UG4G7PJ4.js} +1 -1
  36. package/dist/chunk-UONFWKJ7.js +22 -0
  37. package/dist/chunk-VO2JYYQZ.js +40 -0
  38. package/dist/{chunk-EBWYGTN7.js → chunk-X437UAF7.js} +6 -0
  39. package/dist/chunk-YS4HVWIO.js +63 -0
  40. package/dist/editor.d.ts +36 -1
  41. package/dist/editor.js +16 -1
  42. package/dist/export/index.d.ts +27 -11
  43. package/dist/export/index.js +11 -7
  44. package/dist/index.d.ts +100 -13
  45. package/dist/index.js +3916 -1633
  46. package/dist/{run-export-I2XOVGG4.js → run-export-47X5FTYZ.js} +3 -3
  47. package/dist/settings/index.d.ts +32 -101
  48. package/dist/settings/index.js +14 -2
  49. package/package.json +9 -9
  50. package/src/styles/docblocks.css +2337 -650
  51. package/dist/ExportDialog-Q4VWI43H.js +0 -9
  52. package/dist/chunk-JDJVRDOP.js +0 -92
  53. package/dist/chunk-Q6XNIKDG.js +0 -669
  54. package/dist/{GitToolbarControl-O5AXBC6T.js → GitToolbarControl-J4UYZDV6.js} +3 -3
@@ -1,3 +1,6 @@
1
+ import {
2
+ buildVideoExportDoc
3
+ } from "./chunk-RP3DVNTI.js";
1
4
  import {
2
5
  browserSaveMode,
3
6
  saveActionLabel
@@ -5,21 +8,25 @@ import {
5
8
  import {
6
9
  useMenuKeyboard
7
10
  } from "./chunk-MRUK56JS.js";
11
+ import {
12
+ createImageSaveOutput,
13
+ hostErrorDetail
14
+ } from "./chunk-UONFWKJ7.js";
8
15
  import {
9
16
  buildExportFilename
10
- } from "./chunk-M5Y5WO7Z.js";
17
+ } from "./chunk-UG4G7PJ4.js";
11
18
  import {
12
19
  loadTransformStyleSummaries
13
20
  } from "./chunk-YBEYTVU2.js";
14
21
  import {
15
- DEFAULT_OPTIONS,
16
22
  FORMAT_EXTENSIONS,
17
23
  loadLastExportOptions,
24
+ resolveExportDialogInitial,
18
25
  saveExportOptions
19
- } from "./chunk-EBWYGTN7.js";
26
+ } from "./chunk-X437UAF7.js";
20
27
  import {
21
28
  Dialog
22
- } from "./chunk-LG6HAWCK.js";
29
+ } from "./chunk-56KO2LYN.js";
23
30
 
24
31
  // src/Export/ExportToolbarControls.tsx
25
32
  import {
@@ -32,22 +39,27 @@ import {
32
39
  useMemo
33
40
  } from "react";
34
41
  import { useEditorContext, usePreviewSettings } from "@bendyline/squisq-editor-react";
42
+ import { readFrontmatterThemeId } from "@bendyline/squisq/markdown";
35
43
  import { getThemeSummaries } from "@bendyline/squisq/schemas";
36
- import { parseMarkdown } from "@bendyline/squisq/markdown";
37
44
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
38
45
  var ExportDialog = lazy(
39
- () => import("./ExportDialog-Q4VWI43H.js").then((module) => ({ default: module.ExportDialog }))
46
+ () => import("./ExportDialog-L6FG6W3H.js").then((module) => ({ default: module.ExportDialog }))
40
47
  );
41
48
  var ShareDialog = lazy(
42
- () => import("./ShareDialog-4OX3UPJ4.js").then((module) => ({ default: module.ShareDialog }))
49
+ () => import("./ShareDialog-N7GPM4SB.js").then((module) => ({ default: module.ShareDialog }))
43
50
  );
44
51
  var runExportModulePromise = null;
45
52
  function loadRunExportModule() {
46
- runExportModulePromise ?? (runExportModulePromise = import("./run-export-I2XOVGG4.js"));
53
+ runExportModulePromise ?? (runExportModulePromise = import("./run-export-47X5FTYZ.js"));
47
54
  return runExportModulePromise;
48
55
  }
49
56
  var ExportCancelledError = class extends Error {
50
57
  };
58
+ var AudioExportDialog = lazy(
59
+ () => import("./AudioExportDialog-F23QXNPB.js").then((module) => ({
60
+ default: module.AudioExportDialog
61
+ }))
62
+ );
51
63
  var SHARED_USE_MODES = Object.freeze({
52
64
  slideshow: "slideshow",
53
65
  video: "video",
@@ -70,19 +82,16 @@ function SharedModeInitializer({ mode }) {
70
82
  var videoExportModulesPromise = null;
71
83
  function loadVideoExportModules() {
72
84
  videoExportModulesPromise ?? (videoExportModulesPromise = Promise.all([
73
- import("@bendyline/squisq/doc"),
74
85
  import("@bendyline/squisq-video-react"),
75
86
  import("@bendyline/squisq-react/standalone-source")
76
- ]).then(([docModule, videoModule, playerModule]) => ({
87
+ ]).then(([videoModule, playerModule]) => ({
77
88
  Modal: videoModule.VideoExportModal,
78
- markdownToDoc: docModule.markdownToDoc,
79
- resolveAudioMapping: docModule.resolveAudioMapping,
80
89
  playerScript: playerModule.PLAYER_BUNDLE
81
90
  })));
82
91
  return videoExportModulesPromise;
83
92
  }
84
93
  function exportErrorMessage(caught) {
85
- const detail = caught instanceof Error ? caught.message.replace(/^Error invoking remote method '[^']+': Error:\s*/, "").trim() : "";
94
+ const detail = hostErrorDetail(caught);
86
95
  return detail ? `Export failed: ${detail}` : "Export failed. The document could not be exported.";
87
96
  }
88
97
  function quickLabel(opts, transformSummaries, saveMode, destinationPath) {
@@ -118,6 +127,7 @@ function ExportToolbarControls({
118
127
  mediaContainer,
119
128
  workspaceContainer,
120
129
  mediaProvider,
130
+ mediaEditRenders = null,
121
131
  saveBlob,
122
132
  destinationAdapter,
123
133
  trigger = "menu",
@@ -126,13 +136,17 @@ function ExportToolbarControls({
126
136
  colorScheme = "light",
127
137
  videoExportPalette,
128
138
  shareBaseUrl,
129
- initialSharedMode = null
139
+ initialSharedMode = null,
140
+ speech,
141
+ defaultThemeId
130
142
  }) {
131
143
  const { markdownSource, markdownDoc } = useEditorContext();
132
144
  const [menuOpen, setMenuOpen] = useState(false);
133
145
  const [dialogOpen, setDialogOpen] = useState(false);
146
+ const [fileShare, setFileShare] = useState(false);
134
147
  const [shareDialogOpen, setShareDialogOpen] = useState(false);
135
148
  const [videoModalOpen, setVideoModalOpen] = useState(false);
149
+ const [audioDialogOpen, setAudioDialogOpen] = useState(false);
136
150
  const [videoOutputFormat, setVideoOutputFormat] = useState("mp4");
137
151
  const [videoLoading, setVideoLoading] = useState(false);
138
152
  const [videoLoadError, setVideoLoadError] = useState(null);
@@ -150,19 +164,14 @@ function ExportToolbarControls({
150
164
  const lastOptions = loadLastExportOptions();
151
165
  const quickDestinationKey = lastOptions ? JSON.stringify([selectedFile, lastOptions]) : null;
152
166
  const quickDestinationTarget = quickDestination?.key === quickDestinationKey ? quickDestination.target : null;
153
- const docThemeId = useMemo(() => {
154
- const fm = markdownDoc?.frontmatter;
155
- if (!fm) return null;
156
- const candidates = [fm["squisq-theme"], fm["theme"], fm["themeId"]];
157
- for (const v of candidates) {
158
- if (typeof v === "string" && v.trim()) return v.trim();
159
- }
160
- return null;
161
- }, [markdownDoc]);
162
- const dialogInitial = useMemo(() => {
163
- const base = lastOptions ?? DEFAULT_OPTIONS;
164
- return docThemeId ? { ...base, themeId: docThemeId } : base;
165
- }, [lastOptions, docThemeId]);
167
+ const docThemeId = useMemo(
168
+ () => readFrontmatterThemeId(markdownDoc?.frontmatter),
169
+ [markdownDoc]
170
+ );
171
+ const dialogInitial = useMemo(
172
+ () => resolveExportDialogInitial(lastOptions, docThemeId, defaultThemeId),
173
+ [lastOptions, docThemeId, defaultThemeId]
174
+ );
166
175
  useEffect(() => {
167
176
  if (!menuOpen) return;
168
177
  const onPointerDown = (e) => {
@@ -233,6 +242,7 @@ function ExportToolbarControls({
233
242
  [destinationAdapter, selectedFile]
234
243
  );
235
244
  const handleOpenDialog = useCallback(() => {
245
+ setFileShare(false);
236
246
  setMenuOpen(false);
237
247
  setExportError(null);
238
248
  setDialogOpen(true);
@@ -264,10 +274,12 @@ function ExportToolbarControls({
264
274
  }
265
275
  setVideoLoading(true);
266
276
  try {
267
- const modules = videoModules ?? await loadVideoExportModules();
277
+ const [modules, exportDoc] = await Promise.all([
278
+ videoModules ?? loadVideoExportModules(),
279
+ // The same projection the Video preview plays, so the MP4 matches it.
280
+ buildVideoExportDoc(markdownSource, { fileName: selectedFile, workspaceContainer })
281
+ ]);
268
282
  setVideoModules(modules);
269
- const parsedDoc = modules.markdownToDoc(parseMarkdown(markdownSource));
270
- const exportDoc = workspaceContainer ? await modules.resolveAudioMapping(parsedDoc, workspaceContainer) : parsedDoc;
271
283
  setVideoDoc(exportDoc);
272
284
  } catch {
273
285
  setVideoLoadError("Video export could not be loaded.");
@@ -275,7 +287,7 @@ function ExportToolbarControls({
275
287
  setVideoLoading(false);
276
288
  }
277
289
  },
278
- [markdownSource, videoModules, workspaceContainer]
290
+ [markdownSource, selectedFile, videoModules, workspaceContainer]
279
291
  );
280
292
  const handleCloseVideoModal = useCallback(() => {
281
293
  setVideoModalOpen(false);
@@ -317,7 +329,7 @@ function ExportToolbarControls({
317
329
  setExportError(null);
318
330
  try {
319
331
  let exportTarget = destinationTarget;
320
- if (destinationAdapter?.pickBeforeSave) {
332
+ if (!fileShare && destinationAdapter?.pickBeforeSave) {
321
333
  const filename = buildExportFilename(selectedFile, opts);
322
334
  exportTarget = await destinationAdapter.pickTarget(filename, destinationTarget);
323
335
  if (!exportTarget) return;
@@ -329,7 +341,10 @@ function ExportToolbarControls({
329
341
  selectedFile,
330
342
  opts,
331
343
  mediaContainer,
332
- destinationAdapter ? (blob, filename) => saveToDestination(blob, filename, exportTarget) : saveBlob
344
+ fileShare && destinationAdapter?.shareBlob ? async (blob, filename) => {
345
+ const outcome = await destinationAdapter.shareBlob(blob, filename);
346
+ if (outcome === "cancelled") throw new ExportCancelledError();
347
+ } : destinationAdapter ? (blob, filename) => saveToDestination(blob, filename, exportTarget) : saveBlob
333
348
  );
334
349
  setDialogOpen(false);
335
350
  } catch (caught) {
@@ -339,6 +354,7 @@ function ExportToolbarControls({
339
354
  }
340
355
  },
341
356
  [
357
+ fileShare,
342
358
  markdownSource,
343
359
  selectedFile,
344
360
  mediaContainer,
@@ -392,13 +408,8 @@ function ExportToolbarControls({
392
408
  const handleDismissExportError = useCallback(() => {
393
409
  setExportError(null);
394
410
  }, []);
395
- const handleVideoSave = useCallback(
396
- async (blob, filename) => {
397
- if (!destinationAdapter) return false;
398
- const target = await destinationAdapter.pickTarget(filename, null);
399
- if (!target) return false;
400
- return await destinationAdapter.saveBlob(blob, filename, target) !== null;
401
- },
411
+ const videoSaveOutput = useMemo(
412
+ () => destinationAdapter ? createImageSaveOutput(destinationAdapter) : void 0,
402
413
  [destinationAdapter]
403
414
  );
404
415
  const LoadedVideoExportModal = videoModules?.Modal;
@@ -478,6 +489,22 @@ function ExportToolbarControls({
478
489
  children: "Export document..."
479
490
  }
480
491
  ),
492
+ destinationAdapter?.shareBlob && /* @__PURE__ */ jsx(
493
+ "button",
494
+ {
495
+ type: "button",
496
+ role: "menuitem",
497
+ tabIndex: -1,
498
+ className: "db-toolbar-menu-item",
499
+ onClick: () => {
500
+ setFileShare(true);
501
+ setMenuOpen(false);
502
+ setExportError(null);
503
+ setDialogOpen(true);
504
+ },
505
+ children: "Share file..."
506
+ }
507
+ ),
481
508
  /* @__PURE__ */ jsx(
482
509
  "button",
483
510
  {
@@ -502,6 +529,20 @@ function ExportToolbarControls({
502
529
  children: "Export video..."
503
530
  }
504
531
  ),
532
+ speech && /* @__PURE__ */ jsx(
533
+ "button",
534
+ {
535
+ type: "button",
536
+ role: "menuitem",
537
+ tabIndex: -1,
538
+ className: "db-toolbar-menu-item",
539
+ onClick: () => {
540
+ setMenuOpen(false);
541
+ setAudioDialogOpen(true);
542
+ },
543
+ children: "Export audio..."
544
+ }
545
+ ),
505
546
  showAnimatedGifExport && /* @__PURE__ */ jsx(
506
547
  "button",
507
548
  {
@@ -518,6 +559,29 @@ function ExportToolbarControls({
518
559
  }
519
560
  )
520
561
  ] }),
562
+ audioDialogOpen && /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
563
+ AudioExportDialog,
564
+ {
565
+ speech,
566
+ selectedFile,
567
+ workspaceContainer: workspaceContainer ?? null,
568
+ onSave: async (blob, filename) => {
569
+ try {
570
+ if (destinationAdapter) {
571
+ const target = await destinationAdapter.resolveTarget(filename).catch(() => null);
572
+ await saveToDestination(blob, filename, target);
573
+ } else if (saveBlob) {
574
+ await saveBlob(blob, filename);
575
+ }
576
+ return true;
577
+ } catch (caught) {
578
+ if (caught instanceof ExportCancelledError) return false;
579
+ throw caught;
580
+ }
581
+ },
582
+ onClose: () => setAudioDialogOpen(false)
583
+ }
584
+ ) }),
521
585
  dialogOpen && /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
522
586
  ExportDialog,
523
587
  {
@@ -533,6 +597,7 @@ function ExportToolbarControls({
533
597
  onOptionsChange: destinationAdapter ? handleOptionsChange : void 0,
534
598
  actionLabel: (options) => {
535
599
  const extension = options.format === "html" && (options.includeLinkedDocs || options.htmlBundle === "zip") ? "ZIP" : FORMAT_EXTENSIONS[options.format].slice(1);
600
+ if (fileShare) return `Share ${extension.toUpperCase()}`;
536
601
  if (destinationAdapter && !destinationAdapter.pickBeforeSave) {
537
602
  return `Save ${extension.toUpperCase()}`;
538
603
  }
@@ -584,6 +649,7 @@ function ExportToolbarControls({
584
649
  doc: videoDoc,
585
650
  playerScript: videoModules.playerScript,
586
651
  ...mediaProvider ? { mediaProvider } : {},
652
+ mediaEditRenders,
587
653
  colorScheme,
588
654
  uiPalette: videoExportPalette,
589
655
  defaultConfig: {
@@ -591,8 +657,8 @@ function ExportToolbarControls({
591
657
  ...ffmpegWasm ? { ffmpegWasm } : {},
592
658
  outputFormat: videoOutputFormat
593
659
  },
594
- ...destinationAdapter ? {
595
- saveOutput: handleVideoSave,
660
+ ...videoSaveOutput ? {
661
+ saveOutput: videoSaveOutput,
596
662
  saveActionLabel: (format) => saveActionLabel(format, "save-as")
597
663
  } : {},
598
664
  onClose: handleCloseVideoModal
@@ -6,15 +6,15 @@ import {
6
6
  formatAheadBehind,
7
7
  summarizeDirty
8
8
  } from "./chunk-V2ENBGUA.js";
9
- import {
10
- useMenuKeyboard
11
- } from "./chunk-MRUK56JS.js";
12
9
  import {
13
10
  useGitContext
14
11
  } from "./chunk-6E635KCJ.js";
12
+ import {
13
+ useMenuKeyboard
14
+ } from "./chunk-MRUK56JS.js";
15
15
  import {
16
16
  Dialog
17
- } from "./chunk-LG6HAWCK.js";
17
+ } from "./chunk-56KO2LYN.js";
18
18
 
19
19
  // src/Git/GitStatusBar.tsx
20
20
  import { useCallback, useEffect, useRef, useState } from "react";
@@ -867,7 +867,7 @@ function GitAuthGuidanceDialog({
867
867
  {
868
868
  type: "button",
869
869
  className: "db-git-secondary-btn",
870
- onClick: () => void maybeGetDocBlocksHost()?.shell.openExternal(LEARN_MORE_URL),
870
+ onClick: () => void maybeGetDocBlocksHost()?.shell?.openExternal(LEARN_MORE_URL),
871
871
  children: "Learn more"
872
872
  }
873
873
  ),
@@ -0,0 +1,9 @@
1
+ import {
2
+ PresentationMaker
3
+ } from "./chunk-MMOTEQK6.js";
4
+ import "./chunk-5OZBGIIT.js";
5
+ import "./chunk-K4I3NJFL.js";
6
+ import "./chunk-56KO2LYN.js";
7
+ export {
8
+ PresentationMaker
9
+ };