@bendyline/docblocks-react 2.7.1 → 2.7.3

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 (38) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES.txt +290 -48
  3. package/dist/{AiDiagrams-LFV4YU6W.js → AiDiagrams-QE3LVYFK.js} +2 -2
  4. package/dist/{AiEditorAssistant-GN2KXKZD.js → AiEditorAssistant-YLJ5OZK2.js} +203 -164
  5. package/dist/AiStudyDialog-4TQZZGU3.js +1150 -0
  6. package/dist/{ExportDialog-IMBVGRYG.js → ExportDialog-JRVZCG3J.js} +2 -2
  7. package/dist/{ExportToolbarControls-MUM6HM3K.js → ExportToolbarControls-A2YBKUUD.js} +46 -9
  8. package/dist/KeyboardShortcutsDialog-G5OBDTNR.js +145 -0
  9. package/dist/{PresentationMaker-W2JIBHRN.js → PresentationMaker-P2JP6UUX.js} +2 -2
  10. package/dist/{Settings-DuXk6baH.d.ts → Settings-ByNImjk5.d.ts} +13 -13
  11. package/dist/{SpeechToolbarControl-OSQS7NVY.js → SpeechToolbarControl-CLU7RB2G.js} +1 -1
  12. package/dist/{TextFromNarration-XYRAB6O2.js → TextFromNarration-NITJQ4IB.js} +1 -1
  13. package/dist/{WorkspaceSearchPanel-BKZJRPMY.js → WorkspaceSearchPanel-J6BKEZQJ.js} +1 -1
  14. package/dist/{chunk-X3DDTJKR.js → chunk-3CE5RH2B.js} +255 -17
  15. package/dist/{chunk-UG4G7PJ4.js → chunk-5O5YTOXG.js} +1 -1
  16. package/dist/{chunk-VO2JYYQZ.js → chunk-6JJOGV6M.js} +5 -13
  17. package/dist/{chunk-X437UAF7.js → chunk-6MSHXQNB.js} +7 -2
  18. package/dist/{chunk-BCQZTWE5.js → chunk-6PA7QBZT.js} +107 -24
  19. package/dist/chunk-ACQF63SB.js +136 -0
  20. package/dist/chunk-DICE7VBJ.js +77 -0
  21. package/dist/{chunk-EPOLZNFD.js → chunk-EOU2JWAQ.js} +186 -71
  22. package/dist/{chunk-G4MFB3IO.js → chunk-VG434562.js} +2 -70
  23. package/dist/chunk-XNT66JC2.js +168 -0
  24. package/dist/{chunk-BD54Z5XP.js → chunk-Y5OE3HJC.js} +4 -3
  25. package/dist/{chunk-NAH52736.js → chunk-YPIVCCTB.js} +969 -98
  26. package/dist/{chunk-W55E6TE2.js → chunk-ZMCQO57Q.js} +28 -23
  27. package/dist/editor.js +7 -5
  28. package/dist/export/index.d.ts +27 -8
  29. package/dist/export/index.js +4 -4
  30. package/dist/index.d.ts +36 -8
  31. package/dist/index.js +629 -446
  32. package/dist/run-export-OHRNT2TP.js +13 -0
  33. package/dist/settings/index.d.ts +1 -1
  34. package/dist/settings/index.js +1 -1
  35. package/package.json +9 -8
  36. package/src/styles/docblocks.css +968 -329
  37. package/dist/chunk-EA4BO6E4.js +0 -73
  38. package/dist/run-export-47X5FTYZ.js +0 -11
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  ExportDialog
3
- } from "./chunk-BD54Z5XP.js";
3
+ } from "./chunk-Y5OE3HJC.js";
4
4
  import "./chunk-YBEYTVU2.js";
5
- import "./chunk-X437UAF7.js";
5
+ import "./chunk-6MSHXQNB.js";
6
6
  import "./chunk-56KO2LYN.js";
7
7
  export {
8
8
  ExportDialog
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-UONFWKJ7.js";
15
15
  import {
16
16
  buildExportFilename
17
- } from "./chunk-UG4G7PJ4.js";
17
+ } from "./chunk-5O5YTOXG.js";
18
18
  import {
19
19
  loadTransformStyleSummaries
20
20
  } from "./chunk-YBEYTVU2.js";
@@ -23,7 +23,7 @@ import {
23
23
  loadLastExportOptions,
24
24
  resolveExportDialogInitial,
25
25
  saveExportOptions
26
- } from "./chunk-X437UAF7.js";
26
+ } from "./chunk-6MSHXQNB.js";
27
27
  import {
28
28
  Dialog
29
29
  } from "./chunk-56KO2LYN.js";
@@ -38,19 +38,23 @@ import {
38
38
  useRef,
39
39
  useMemo
40
40
  } from "react";
41
- import { useEditorContext, usePreviewSettings } from "@bendyline/squisq-editor-react";
41
+ import {
42
+ useEditorContext,
43
+ usePreviewSettings,
44
+ usePreviewSettingsOptional
45
+ } from "@bendyline/squisq-editor-react";
42
46
  import { readFrontmatterThemeId } from "@bendyline/squisq/markdown";
43
47
  import { getThemeSummaries } from "@bendyline/squisq/schemas";
44
48
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
45
49
  var ExportDialog = lazy(
46
- () => import("./ExportDialog-IMBVGRYG.js").then((module) => ({ default: module.ExportDialog }))
50
+ () => import("./ExportDialog-JRVZCG3J.js").then((module) => ({ default: module.ExportDialog }))
47
51
  );
48
52
  var ShareDialog = lazy(
49
53
  () => import("./ShareDialog-XUA2OVGI.js").then((module) => ({ default: module.ShareDialog }))
50
54
  );
51
55
  var runExportModulePromise = null;
52
56
  function loadRunExportModule() {
53
- runExportModulePromise ?? (runExportModulePromise = import("./run-export-47X5FTYZ.js"));
57
+ runExportModulePromise ?? (runExportModulePromise = import("./run-export-OHRNT2TP.js"));
54
58
  return runExportModulePromise;
55
59
  }
56
60
  var ExportCancelledError = class extends Error {
@@ -155,6 +159,7 @@ function ExportToolbarControls({
155
159
  const [transformSummaries, setTransformSummaries] = useState([]);
156
160
  const [exporting, setExporting] = useState(false);
157
161
  const [exportError, setExportError] = useState(null);
162
+ const [exportNotice, setExportNotice] = useState(null);
158
163
  const [destinationTarget, setDestinationTarget] = useState(null);
159
164
  const [quickDestination, setQuickDestination] = useState(null);
160
165
  const [quickDestinationPending, setQuickDestinationPending] = useState(false);
@@ -168,9 +173,12 @@ function ExportToolbarControls({
168
173
  () => readFrontmatterThemeId(markdownDoc?.frontmatter),
169
174
  [markdownDoc]
170
175
  );
176
+ const previewSettings = usePreviewSettingsOptional();
177
+ const previewThemeId = previewSettings?.activeThemeId;
178
+ const documentThemes = previewSettings?.customThemes;
171
179
  const dialogInitial = useMemo(
172
- () => resolveExportDialogInitial(lastOptions, docThemeId, defaultThemeId),
173
- [lastOptions, docThemeId, defaultThemeId]
180
+ () => resolveExportDialogInitial(lastOptions, previewThemeId ?? docThemeId, defaultThemeId),
181
+ [lastOptions, previewThemeId, docThemeId, defaultThemeId]
174
182
  );
175
183
  useEffect(() => {
176
184
  if (!menuOpen) return;
@@ -327,6 +335,7 @@ function ExportToolbarControls({
327
335
  async (opts) => {
328
336
  setExporting(true);
329
337
  setExportError(null);
338
+ setExportNotice(null);
330
339
  try {
331
340
  let exportTarget = destinationTarget;
332
341
  if (!fileShare && destinationAdapter?.pickBeforeSave) {
@@ -336,7 +345,7 @@ function ExportToolbarControls({
336
345
  setDestinationTarget(exportTarget);
337
346
  }
338
347
  const { runExport } = await loadRunExportModule();
339
- await runExport(
348
+ const result = await runExport(
340
349
  markdownSource,
341
350
  selectedFile,
342
351
  opts,
@@ -347,6 +356,7 @@ function ExportToolbarControls({
347
356
  } : destinationAdapter ? (blob, filename) => saveToDestination(blob, filename, exportTarget) : saveBlob
348
357
  );
349
358
  setDialogOpen(false);
359
+ if (result.warnings.length > 0) setExportNotice(result.warnings);
350
360
  } catch (caught) {
351
361
  if (!(caught instanceof ExportCancelledError)) setExportError(exportErrorMessage(caught));
352
362
  } finally {
@@ -369,6 +379,7 @@ function ExportToolbarControls({
369
379
  closeMenu(true);
370
380
  setExporting(true);
371
381
  setExportError(null);
382
+ setExportNotice(null);
372
383
  try {
373
384
  saveExportOptions(lastOptions);
374
385
  let quickTarget = null;
@@ -383,13 +394,14 @@ function ExportToolbarControls({
383
394
  }
384
395
  }
385
396
  const { runExport } = await loadRunExportModule();
386
- await runExport(
397
+ const result = await runExport(
387
398
  markdownSource,
388
399
  selectedFile,
389
400
  lastOptions,
390
401
  mediaContainer,
391
402
  destinationAdapter ? async (blob, filename) => saveToDestination(blob, filename, quickTarget) : saveBlob
392
403
  );
404
+ if (result.warnings.length > 0) setExportNotice(result.warnings);
393
405
  } catch (caught) {
394
406
  if (!(caught instanceof ExportCancelledError)) setExportError(exportErrorMessage(caught));
395
407
  } finally {
@@ -409,6 +421,9 @@ function ExportToolbarControls({
409
421
  const handleDismissExportError = useCallback(() => {
410
422
  setExportError(null);
411
423
  }, []);
424
+ const handleDismissExportNotice = useCallback(() => {
425
+ setExportNotice(null);
426
+ }, []);
412
427
  const videoSaveOutput = useMemo(
413
428
  () => destinationAdapter ? createImageSaveOutput(destinationAdapter) : void 0,
414
429
  [destinationAdapter]
@@ -588,6 +603,7 @@ function ExportToolbarControls({
588
603
  ExportDialog,
589
604
  {
590
605
  initial: dialogInitial,
606
+ documentThemes,
591
607
  exporting,
592
608
  error: exportError,
593
609
  destination: destinationAdapter && destinationAdapter.showDestination !== false ? {
@@ -628,6 +644,27 @@ function ExportToolbarControls({
628
644
  children: /* @__PURE__ */ jsx("p", { className: "db-export-error", role: "alert", children: exportError })
629
645
  }
630
646
  ),
647
+ exportNotice && !dialogOpen && !exportError && /* @__PURE__ */ jsx(
648
+ Dialog,
649
+ {
650
+ title: "Export Document",
651
+ onClose: handleDismissExportNotice,
652
+ footer: /* @__PURE__ */ jsx(
653
+ "button",
654
+ {
655
+ type: "button",
656
+ className: "db-export-btn db-export-btn--secondary",
657
+ onClick: handleDismissExportNotice,
658
+ children: "Close"
659
+ }
660
+ ),
661
+ children: /* @__PURE__ */ jsxs("div", { role: "status", children: [
662
+ /* @__PURE__ */ jsx("p", { children: "The file was saved, but not everything in the document could be included." }),
663
+ exportNotice.map((warning) => /* @__PURE__ */ jsx("p", { children: warning }, warning)),
664
+ /* @__PURE__ */ jsx("p", { children: "Export to Word, HTML or EPUB to keep every character." })
665
+ ] })
666
+ }
667
+ ),
631
668
  shareDialogOpen && /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
632
669
  ShareDialog,
633
670
  {
@@ -0,0 +1,145 @@
1
+ import {
2
+ SHELL_SHORTCUTS,
3
+ isApplePlatform
4
+ } from "./chunk-ACQF63SB.js";
5
+ import {
6
+ Dialog
7
+ } from "./chunk-56KO2LYN.js";
8
+
9
+ // src/DocBlocksShell/KeyboardShortcutsDialog.tsx
10
+ import { Fragment, useId, useMemo } from "react";
11
+ import { getHostEnvironment } from "@bendyline/docblocks/host";
12
+
13
+ // src/DocBlocksShell/shortcut-sheet.ts
14
+ var VIEW_KEYS = {
15
+ title: "Views",
16
+ entries: [
17
+ { action: "Write", chords: [["Mod", "Shift", "1"]] },
18
+ { action: "Source", chords: [["Mod", "Shift", "2"]] },
19
+ { action: "Use (preview, slideshow, video)", chords: [["Mod", "Shift", "3"]] }
20
+ ]
21
+ };
22
+ var EDITING_KEYS = {
23
+ title: "Formatting in Write",
24
+ entries: [
25
+ { action: "Bold", chords: [["Mod", "B"]] },
26
+ { action: "Italic", chords: [["Mod", "I"]] },
27
+ { action: "Strikethrough", chords: [["Mod", "Shift", "S"]] },
28
+ { action: "Inline code", chords: [["Mod", "E"]] },
29
+ { action: "Link", chords: [["Mod", "K"]] },
30
+ { action: "Heading 1\u20136", chords: [["Mod", "Alt", "1\u20136"]] },
31
+ { action: "Bulleted list", chords: [["Mod", "Shift", "8"]] },
32
+ { action: "Numbered list", chords: [["Mod", "Shift", "7"]] },
33
+ { action: "Quote", chords: [["Mod", "Shift", "B"]] },
34
+ { action: "Superscript", chords: [["Mod", "."]] },
35
+ { action: "Subscript", chords: [["Mod", ","]] },
36
+ { action: "Line break", chords: [["Shift", "Enter"]] },
37
+ { action: "Undo", chords: [["Mod", "Z"]] },
38
+ { action: "Redo", chords: [["Mod", "Shift", "Z"]] }
39
+ ]
40
+ };
41
+ var PRESENTING_KEYS = {
42
+ title: "Slideshow",
43
+ entries: [
44
+ { action: "Next slide or step", chords: [["\u2192"], ["Space"]] },
45
+ { action: "Previous slide or step", chords: [["\u2190"]] },
46
+ { action: "First or last slide", chords: [["Home"], ["End"]] },
47
+ { action: "Pick a slide", chords: [["\u2191"]] },
48
+ { action: "Leave the presentation", chords: [["Esc"]] }
49
+ ]
50
+ };
51
+ function labelKeys(label) {
52
+ return label.split("+").map((key) => key === "Ctrl" ? "Mod" : key);
53
+ }
54
+ function shellEntries({ nativeHost }) {
55
+ const entries = /* @__PURE__ */ new Map();
56
+ for (const binding of SHELL_SHORTCUTS) {
57
+ if (binding.browserReserved && !nativeHost) continue;
58
+ const entry = entries.get(binding.id) ?? { chords: [] };
59
+ entry.action ?? (entry.action = binding.action);
60
+ entry.chords.push(labelKeys(binding.label));
61
+ entries.set(binding.id, entry);
62
+ }
63
+ return [...entries.values()].flatMap(
64
+ (entry) => entry.action ? [{ action: entry.action, chords: entry.chords }] : []
65
+ );
66
+ }
67
+ function shortcutSheet(options) {
68
+ return [
69
+ { title: "Documents and files", entries: shellEntries(options) },
70
+ VIEW_KEYS,
71
+ EDITING_KEYS,
72
+ PRESENTING_KEYS
73
+ ];
74
+ }
75
+ var APPLE_MODIFIERS = {
76
+ Mod: "\u2318",
77
+ Alt: "\u2325",
78
+ Shift: "\u21E7"
79
+ };
80
+ var APPLE_ORDER = ["Alt", "Shift", "Mod"];
81
+ function displayKeys(chord, apple) {
82
+ if (!apple) return chord.map((key) => key === "Mod" ? "Ctrl" : key);
83
+ const modifiers = APPLE_ORDER.filter((key) => chord.includes(key));
84
+ const rest = chord.filter((key) => !(key in APPLE_MODIFIERS));
85
+ return [...modifiers.map((key) => APPLE_MODIFIERS[key]), ...rest];
86
+ }
87
+ var SPOKEN_KEYS = {
88
+ "\u2192": "Right arrow",
89
+ "\u2190": "Left arrow",
90
+ "\u2191": "Up arrow",
91
+ "?": "Question mark",
92
+ "\\": "Backslash",
93
+ ".": "Period",
94
+ ",": "Comma",
95
+ "1\u20136": "1 to 6"
96
+ };
97
+ function spokenChord(chord, apple) {
98
+ return chord.map(
99
+ (key) => key === "Mod" ? apple ? "Command" : "Control" : key === "Alt" && apple ? "Option" : key
100
+ ).map((key) => SPOKEN_KEYS[key] ?? key).join(" ");
101
+ }
102
+
103
+ // src/DocBlocksShell/KeyboardShortcutsDialog.tsx
104
+ import { jsx, jsxs } from "react/jsx-runtime";
105
+ function KeyboardShortcutsDialog({ onClose }) {
106
+ const idPrefix = useId();
107
+ const apple = isApplePlatform();
108
+ const sections = useMemo(() => shortcutSheet({ nativeHost: getHostEnvironment() !== null }), []);
109
+ return /* @__PURE__ */ jsx(
110
+ Dialog,
111
+ {
112
+ title: "Keyboard shortcuts",
113
+ onClose,
114
+ size: "wide",
115
+ className: "db-shortcuts-dialog",
116
+ children: /* @__PURE__ */ jsx("div", { className: "db-shortcuts", role: "region", "aria-label": "Shortcut list", tabIndex: 0, children: sections.map((section, sectionIndex) => {
117
+ const headingId = `${idPrefix}-${sectionIndex}`;
118
+ return /* @__PURE__ */ jsxs(
119
+ "section",
120
+ {
121
+ className: "db-shortcuts-section",
122
+ "aria-labelledby": headingId,
123
+ children: [
124
+ /* @__PURE__ */ jsx("h3", { id: headingId, className: "db-shortcuts-heading", children: section.title }),
125
+ /* @__PURE__ */ jsx("dl", { className: "db-shortcuts-list", children: section.entries.map((entry) => /* @__PURE__ */ jsxs("div", { className: "db-shortcuts-row", children: [
126
+ /* @__PURE__ */ jsx("dt", { className: "db-shortcuts-action", children: entry.action }),
127
+ /* @__PURE__ */ jsx("dd", { className: "db-shortcuts-keys", children: entry.chords.map((chord, chordIndex) => /* @__PURE__ */ jsxs(Fragment, { children: [
128
+ chordIndex > 0 && /* @__PURE__ */ jsx("span", { className: "db-shortcuts-or", children: "or" }),
129
+ /* @__PURE__ */ jsxs("span", { className: "db-shortcuts-chord", children: [
130
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: displayKeys(chord, apple).map((key) => /* @__PURE__ */ jsx("kbd", { children: key }, key)) }),
131
+ /* @__PURE__ */ jsx("span", { className: "db-visually-hidden", children: spokenChord(chord, apple) })
132
+ ] })
133
+ ] }, chord.join("+"))) })
134
+ ] }, entry.action)) })
135
+ ]
136
+ },
137
+ section.title
138
+ );
139
+ }) })
140
+ }
141
+ );
142
+ }
143
+ export {
144
+ KeyboardShortcutsDialog
145
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PresentationMaker
3
- } from "./chunk-EPOLZNFD.js";
4
- import "./chunk-NAH52736.js";
3
+ } from "./chunk-EOU2JWAQ.js";
4
+ import "./chunk-YPIVCCTB.js";
5
5
  import "./chunk-K4I3NJFL.js";
6
6
  import "./chunk-56KO2LYN.js";
7
7
  export {
@@ -5,22 +5,23 @@ import { WriteCanvasSettings } from '@bendyline/squisq-editor-react';
5
5
 
6
6
  /** Appearance preferences shared by the shell and settings UI. */
7
7
  type ThemePreference = 'auto' | 'light' | 'dark';
8
- declare const ACCENT_COLORS: readonly ["brown", "green", "blue", "purple", "maroon", "orange", "gray"];
8
+ declare const ACCENT_COLORS: readonly ["rust", "green", "blue", "purple", "maroon", "orange", "gray"];
9
9
  type AccentColor = (typeof ACCENT_COLORS)[number];
10
10
  /**
11
11
  * Which typeface the shell chrome uses.
12
12
  *
13
- * `system` resolves `system-ui`, so DocBlocks looks native on each platform —
14
- * the right default, and what almost everyone should keep. `fixed` pins the
15
- * chrome to the bundled `DocBlocks Fixed UI` face (the Roboto variable binary
16
- * already shipped for the document theme of that name) so the interface renders
17
- * identically everywhere.
13
+ * `fixed` — the default — pins the chrome to the bundled `DocBlocks Fixed UI`
14
+ * face: the Hanken Grotesk variable binary every surface already ships for
15
+ * documents set in it, and the sans docblocks.com uses. The app and the site
16
+ * then read as one product, and the interface renders identically on every
17
+ * OS.
18
18
  *
19
- * Two things want that. A user working across machines gets typography that
20
- * does not shift between them. And the visual-regression suite gets a rendering
21
- * it can compare across operating systems at all: under `system` the same
22
- * screenshot differs on every platform, which is why those baselines are
23
- * otherwise captured on one OS and compared only there.
19
+ * `system` resolves `system-ui`, for anyone who would rather DocBlocks looked
20
+ * native on each platform; the chrome then fetches no font.
21
+ *
22
+ * The stored values kept their names when the default changed, so a saved
23
+ * `system` still opts out. A saved `fixed` now gets Hanken Grotesk; it used to
24
+ * get Roboto.
24
25
  */
25
26
  type InterfaceFontPreference = 'system' | 'fixed';
26
27
  declare const DEFAULT_INTERFACE_FONT: InterfaceFontPreference;
@@ -114,8 +115,7 @@ interface InterfaceFontSettingsProps {
114
115
  * The default follows the operating system, which is what almost everyone
115
116
  * should keep. The bundled option exists for two reasons worth stating in the
116
117
  * UI: identical typography across machines, and a rendering that is the same
117
- * everywhere — which is what lets the visual-regression suite compare one set
118
- * of baselines across operating systems at all.
118
+ * on every operating system.
119
119
  */
120
120
  declare function InterfaceFontSettings({ value, onChange, name, }: InterfaceFontSettingsProps): react_jsx_runtime.JSX.Element;
121
121
  interface AccentColorSettingsProps {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useSpeechStatus
3
- } from "./chunk-VO2JYYQZ.js";
3
+ } from "./chunk-6JJOGV6M.js";
4
4
  import {
5
5
  hasDocumentNarration,
6
6
  planSpeech,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useSpeechStatus
3
- } from "./chunk-VO2JYYQZ.js";
3
+ } from "./chunk-6JJOGV6M.js";
4
4
  import {
5
5
  createSpeechInputProvider
6
6
  } from "./chunk-KBDZDFPU.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-TBLZBNQF.js";
4
4
  import {
5
5
  FilesIcon
6
- } from "./chunk-EA4BO6E4.js";
6
+ } from "./chunk-DICE7VBJ.js";
7
7
 
8
8
  // src/WorkspaceSearch/WorkspaceSearchPanel.tsx
9
9
  import { useEffect as useEffect2, useMemo, useRef as useRef2, useState as useState2 } from "react";