@mdzip/editor 2.4.2 → 2.6.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 (77) hide show
  1. package/AGENTS.md +8 -0
  2. package/README.md +322 -5
  3. package/dist/diff-rendered.d.ts +54 -0
  4. package/dist/diff-rendered.d.ts.map +1 -0
  5. package/dist/diff-rendered.js +462 -0
  6. package/dist/diff-rendered.js.map +1 -0
  7. package/dist/diff-view-css.d.ts +2 -0
  8. package/dist/diff-view-css.d.ts.map +1 -1
  9. package/dist/diff-view-css.js +69 -6
  10. package/dist/diff-view-css.js.map +1 -1
  11. package/dist/diff-view.d.ts +112 -9
  12. package/dist/diff-view.d.ts.map +1 -1
  13. package/dist/diff-view.js +435 -49
  14. package/dist/diff-view.js.map +1 -1
  15. package/dist/front-matter-extension.d.ts.map +1 -1
  16. package/dist/front-matter-extension.js +2 -8
  17. package/dist/front-matter-extension.js.map +1 -1
  18. package/dist/heading-outline.d.ts +66 -0
  19. package/dist/heading-outline.d.ts.map +1 -0
  20. package/dist/heading-outline.js +208 -0
  21. package/dist/heading-outline.js.map +1 -0
  22. package/dist/index.d.ts +4 -0
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +4 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/json-validation.d.ts +97 -0
  27. package/dist/json-validation.d.ts.map +1 -0
  28. package/dist/json-validation.js +496 -0
  29. package/dist/json-validation.js.map +1 -0
  30. package/dist/library-info.d.ts +7 -2
  31. package/dist/library-info.d.ts.map +1 -1
  32. package/dist/library-info.js +8 -2
  33. package/dist/library-info.js.map +1 -1
  34. package/dist/manifest-form.d.ts +46 -0
  35. package/dist/manifest-form.d.ts.map +1 -0
  36. package/dist/manifest-form.js +327 -0
  37. package/dist/manifest-form.js.map +1 -0
  38. package/dist/merge-conflicts.d.ts +56 -0
  39. package/dist/merge-conflicts.d.ts.map +1 -0
  40. package/dist/merge-conflicts.js +130 -0
  41. package/dist/merge-conflicts.js.map +1 -0
  42. package/dist/merge-regions.d.ts +92 -0
  43. package/dist/merge-regions.d.ts.map +1 -0
  44. package/dist/merge-regions.js +416 -0
  45. package/dist/merge-regions.js.map +1 -0
  46. package/dist/merge-view.d.ts +267 -0
  47. package/dist/merge-view.d.ts.map +1 -0
  48. package/dist/merge-view.js +2039 -0
  49. package/dist/merge-view.js.map +1 -0
  50. package/dist/preview-find.d.ts +30 -0
  51. package/dist/preview-find.d.ts.map +1 -0
  52. package/dist/preview-find.js +172 -0
  53. package/dist/preview-find.js.map +1 -0
  54. package/dist/rendering.d.ts +17 -52
  55. package/dist/rendering.d.ts.map +1 -1
  56. package/dist/rendering.js +21 -324
  57. package/dist/rendering.js.map +1 -1
  58. package/dist/scroll-anchors.d.ts +33 -0
  59. package/dist/scroll-anchors.d.ts.map +1 -0
  60. package/dist/scroll-anchors.js +80 -0
  61. package/dist/scroll-anchors.js.map +1 -0
  62. package/dist/view-css.d.ts.map +1 -1
  63. package/dist/view-css.js +679 -0
  64. package/dist/view-css.js.map +1 -1
  65. package/dist/view.d.ts +412 -9
  66. package/dist/view.d.ts.map +1 -1
  67. package/dist/view.js +2276 -427
  68. package/dist/view.js.map +1 -1
  69. package/dist/workspace-view.d.ts +2 -0
  70. package/dist/workspace-view.d.ts.map +1 -1
  71. package/dist/workspace-view.js +25 -2
  72. package/dist/workspace-view.js.map +1 -1
  73. package/dist/workspace.d.ts +29 -0
  74. package/dist/workspace.d.ts.map +1 -1
  75. package/dist/workspace.js +124 -9
  76. package/dist/workspace.js.map +1 -1
  77. package/package.json +93 -83
@@ -1 +1 @@
1
- {"version":3,"file":"view-css.js","sourceRoot":"","sources":["../src/view-css.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB,MAAM,wBAAwB,GAAG,qBAAqB,CAAC,UAAU,CAC/D,UAAU,EACV,kBAAkB,CACnB,CAAC;AACF,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA81F1B,CAAC"}
package/dist/view.d.ts CHANGED
@@ -2,6 +2,7 @@ import { type MdzWorkspace, type MdzWorkspaceAsset } from '@mdzip/core-js';
2
2
  import { type MdzipAssetCache } from './asset-cache.js';
3
3
  import type { MdzipDocumentChangeEvent, MdzipEditorSnapshot, MdzipRemoveAssetOptions, MdzipWorkspaceOpenOptions } from './workspace.js';
4
4
  import { type MdzipLinkKind } from './workspace-view.js';
5
+ import { type MdzipJsonValidity } from './json-validation.js';
5
6
  import { type MdzipEntryRenderer, type MdzipMarkdownRenderer, type MdzipMarkdownRenderExtension } from './rendering.js';
6
7
  import { type MdzipFrontMatterOptions } from './front-matter-extension.js';
7
8
  import type { MdzipWorkspaceSnapshot } from './workspace.js';
@@ -198,6 +199,12 @@ export interface MdzipControlPolicy {
198
199
  /** Right-click context menus for the source editor and rendered preview. */
199
200
  contextMenu?: boolean | MdzipContextMenuControlPolicy;
200
201
  lineNumbers?: boolean;
202
+ /**
203
+ * The toolbar button (¶) that shows spaces as faint dots and tabs as
204
+ * arrows in the source editor. On in the editor and viewer presets; the
205
+ * marks themselves start hidden unless `showWhitespace` is set.
206
+ */
207
+ whitespace?: boolean;
201
208
  save?: boolean;
202
209
  zoom?: boolean;
203
210
  /** The page-width menu (Narrow, Default, Wide, Full width). */
@@ -208,6 +215,8 @@ export interface MdzipControlPolicy {
208
215
  fileActions?: boolean;
209
216
  /** Enables the find/replace toolbar button and Mod-f shortcut. */
210
217
  search?: boolean;
218
+ /** The toolbar button that shows and hides the outline panel (see `outline`). */
219
+ outline?: boolean;
211
220
  /**
212
221
  * Enables the preview's per-block code chrome: a language-name header, a
213
222
  * copy-to-clipboard button, and (on long enough blocks) a collapse/expand
@@ -253,6 +262,7 @@ export interface MdzipResolvedControlPolicy {
253
262
  formatting: MdzipResolvedFormattingControlPolicy;
254
263
  contextMenu: MdzipResolvedContextMenuControlPolicy;
255
264
  lineNumbers: boolean;
265
+ whitespace: boolean;
256
266
  save: boolean;
257
267
  zoom: boolean;
258
268
  previewWidth: boolean;
@@ -260,6 +270,7 @@ export interface MdzipResolvedControlPolicy {
260
270
  orphanActions: boolean;
261
271
  fileActions: boolean;
262
272
  search: boolean;
273
+ outline: boolean;
263
274
  codeBlockTools: boolean;
264
275
  }
265
276
  export interface MdzipWorkspaceChange {
@@ -357,11 +368,54 @@ export interface MdzipFileActionTarget {
357
368
  export interface MdzipFileAction {
358
369
  /** Unique within the list. */
359
370
  id: string;
360
- label: string;
371
+ /**
372
+ * The item's text. A function names it for the file, for example "Open in
373
+ * Word" for a `.docx` from the app the system opens it with; after the
374
+ * answer changes, call {@link MdzipWorkspaceView.refreshFileActions}.
375
+ */
376
+ label: string | ((file: MdzipFileActionTarget) => string);
361
377
  /** Which files get the item. All files when omitted. */
362
378
  appliesTo?: (file: MdzipFileActionTarget) => boolean;
379
+ /**
380
+ * The main thing to do with a file the preview can't show: its button on
381
+ * the file's card comes first and stands out. The menu is unchanged.
382
+ */
383
+ primary?: boolean;
384
+ /**
385
+ * What the action does, in a sentence, under the buttons on the card of a
386
+ * file the preview can't show (for example "Opens it in Word. Each time
387
+ * you save there, the changes come back here."). A function describes it
388
+ * for the file. Not shown in the menu.
389
+ */
390
+ description?: string | ((file: MdzipFileActionTarget) => string);
391
+ run: (file: MdzipFileActionTarget) => void | Promise<void>;
392
+ }
393
+ /** The link at the bottom of the card of a file the preview can't show; see {@link MdzipWorkspaceViewOptions.fileCardHelp}. */
394
+ export interface MdzipFileCardHelp {
395
+ /** The link's text, such as "More about files in a document". */
396
+ label: string;
363
397
  run: (file: MdzipFileActionTarget) => void | Promise<void>;
364
398
  }
399
+ /** How many of the preview's images have loaded; see {@link MdzipWorkspaceViewOptions.onAssetsProgress}. */
400
+ export interface MdzipAssetsProgress {
401
+ loaded: number;
402
+ total: number;
403
+ }
404
+ /** A file taken out of the archive: its archive path and its bytes. */
405
+ export interface MdzipExtractedFile {
406
+ path: string;
407
+ bytes: Uint8Array;
408
+ }
409
+ /** What the contents pane's Extract… asks the host to write; see {@link MdzipWorkspaceViewOptions.onExtractFiles}. */
410
+ export interface MdzipExtractRequest {
411
+ /** The files, in archive order, each with its full archive path (`images/a.webp`). */
412
+ files: MdzipExtractedFile[];
413
+ /** What was picked: files, and folders (`''` is the whole archive). */
414
+ selection: {
415
+ files: string[];
416
+ folders: string[];
417
+ };
418
+ }
365
419
  export interface MdzipWorkspaceViewOptions {
366
420
  /**
367
421
  * Additional host or framework libraries to show in Document Information.
@@ -446,6 +500,13 @@ export interface MdzipWorkspaceViewOptions {
446
500
  */
447
501
  showSpellingSuggestionsHint?: boolean;
448
502
  initialLayout?: MdzipWorkspaceLayout;
503
+ /**
504
+ * How `manifest.json` opens: `'form'` (the default) shows the document's
505
+ * properties as a form (the View layout), `'json'` the JSON editor (Edit).
506
+ * The manifest remembers its own layout, apart from the other files', so
507
+ * switching between it and a document keeps each one's choice.
508
+ */
509
+ manifestView?: 'form' | 'json';
449
510
  /**
450
511
  * Starting color scheme. `'system'` (the default) follows the operating
451
512
  * system's light/dark setting and updates when it changes, or the host's
@@ -553,11 +614,46 @@ export interface MdzipWorkspaceViewOptions {
553
614
  * preview links. SVGs without links stay images. Defaults to `true`.
554
615
  */
555
616
  inlineSvgLinks?: boolean;
617
+ /**
618
+ * Loads every archive image in the preview as soon as it mounts, instead
619
+ * of only those near the visible part of the preview. For a preview
620
+ * nobody scrolls, such as an off-screen copy rendered for printing or a
621
+ * PDF: without it, images far down a long document never load, so
622
+ * {@link onAssetsHydrated} never fires. Use with
623
+ * `progressiveTextRendering: false` so all the text is mounted too.
624
+ * Defaults to `false`. Read when the view is created.
625
+ */
626
+ eagerImages?: boolean;
556
627
  /**
557
628
  * Extra items for the file tree's right-click menu on files, run by the
558
629
  * host (for example "Open in VS Code Editor"). See {@link MdzipFileAction}.
559
630
  */
560
631
  hostFileActions?: readonly MdzipFileAction[];
632
+ /**
633
+ * A line for the card shown in place of a file the preview can't show (a
634
+ * Word document, say), for what the host knows about it: for example
635
+ * "Open in Word: changes come back each time you save there." Null for
636
+ * none. After the answer changes, call
637
+ * {@link MdzipWorkspaceView.refreshFileActions}.
638
+ */
639
+ fileNote?: (file: MdzipFileActionTarget) => string | null;
640
+ /**
641
+ * A link at the bottom of that card, to the host's help on files in a
642
+ * document (what the buttons do, which apps open what). None when omitted.
643
+ */
644
+ fileCardHelp?: MdzipFileCardHelp;
645
+ /**
646
+ * Writes files taken out of the archive (#69), for hosts that can write to
647
+ * disk themselves, such as a desktop app. With it, the contents pane's
648
+ * menu offers **Extract…** for a file, a folder or several selected rows,
649
+ * and calls this with their bytes: show a folder picker (or, for one file,
650
+ * a save dialog), keep the paths below the folder chosen, and ask before
651
+ * replacing files. Without it (a web page), one file is offered as
652
+ * **Download**, and folders or several files as **Download as ZIP**, plus
653
+ * **Extract to Folder…** where the browser can write to a folder
654
+ * (`showDirectoryPicker`). The archive itself is unchanged either way.
655
+ */
656
+ onExtractFiles?: (request: MdzipExtractRequest) => void | Promise<void>;
561
657
  /**
562
658
  * Reads files dropped as addresses rather than contents, so they can be
563
659
  * added to the archive. Some hosts only pass a dragged file's URI: VS Code,
@@ -585,6 +681,13 @@ export interface MdzipWorkspaceViewOptions {
585
681
  * preview contains no images. See also {@link MdzipWorkspaceView.whenRendered}.
586
682
  */
587
683
  onAssetsHydrated?: (snapshot: MdzipWorkspaceSnapshot) => void;
684
+ /**
685
+ * Reports the images {@link onAssetsHydrated} waits for as they load:
686
+ * `{ loaded: 0, total }` when loading starts, then after each image, ending
687
+ * with `loaded === total` just before `onAssetsHydrated`. Not called when
688
+ * there are none. For a host's progress bar, as when printing.
689
+ */
690
+ onAssetsProgress?: (progress: MdzipAssetsProgress) => void;
588
691
  onFailed?: (error: unknown) => void;
589
692
  /**
590
693
  * Lets the host take over the markdown→MDZ conversion flow (triggered by the
@@ -632,7 +735,67 @@ export interface MdzipWorkspaceViewOptions {
632
735
  * {@link MdzipFrontMatterOptions}.
633
736
  */
634
737
  frontMatter?: MdzipFrontMatterOptions;
738
+ /**
739
+ * The outline panel: a table of contents from the document's headings,
740
+ * beside the preview, which marks the section being read and jumps to a
741
+ * section on click. `true` opens it at start; an object also configures
742
+ * it. It shows while the preview of a Markdown document is visible (View
743
+ * or Split layout). The toolbar button (`controls.outline`) shows and hides it.
744
+ */
745
+ outline?: boolean | MdzipOutlineViewOptions;
746
+ /** Called when the outline panel is shown or hidden from the toolbar, so a host can remember the choice. */
747
+ onOutlineVisibilityChanged?: (visible: boolean) => void;
748
+ /** Called when the toolbar button moves the outline panel to the other side, so a host can remember the choice. */
749
+ onOutlinePositionChanged?: (position: MdzipOutlinePosition) => void;
750
+ /** Called when the reader finishes dragging the outline panel to a new width (pixels), so a host can remember it. */
751
+ onOutlineWidthChanged?: (width: number) => void;
752
+ /**
753
+ * Show spaces (as faint dots) and tabs (as arrows) in the source editor at
754
+ * start. Default `false`. The toolbar button (`controls.whitespace`) and
755
+ * `setWhitespaceVisible()` switch it.
756
+ */
757
+ showWhitespace?: boolean;
758
+ /** Called when whitespace is shown or hidden from the toolbar, so a host can remember the choice. */
759
+ onWhitespaceVisibilityChanged?: (visible: boolean) => void;
760
+ /**
761
+ * Show the status line under the editor while a `.json` file is open
762
+ * ("Valid manifest", or the first error). Default `true`. Problems are
763
+ * underlined in the text either way; a host that draws its own indicator
764
+ * can turn this off and use `onJsonValidityChanged`.
765
+ */
766
+ jsonStatus?: boolean;
767
+ /**
768
+ * Called (debounced, as you type) with the validity of the open `.json`
769
+ * file, and with `null` when another kind of file is opened. While the
770
+ * archive's `manifest.json` has an error (`validity.canSave === false`),
771
+ * saving fails with `MdzipManifestInvalidError`.
772
+ */
773
+ onJsonValidityChanged?: (validity: MdzipJsonValidity | null, path: string | null) => void;
774
+ }
775
+ /** Options for {@link MdzipWorkspaceView.scrollToAnchor}. */
776
+ export interface MdzipScrollToAnchorOptions {
777
+ /** Scroll smoothly instead of jumping (skipped under `prefers-reduced-motion`). Default false. */
778
+ smooth?: boolean;
635
779
  }
780
+ export interface MdzipOutlineViewOptions {
781
+ /** Open the panel at start. Default `false`. */
782
+ visible?: boolean;
783
+ /** Heading levels to list. Default `[1, 2, 3]`. */
784
+ levels?: readonly number[];
785
+ /** Show deeper levels only under the current section. Default `true`. */
786
+ collapse?: boolean;
787
+ /** Accessible name and title of the panel. Default "Outline". */
788
+ label?: string;
789
+ /** Which side of the document the panel goes on. Default `'right'`. */
790
+ position?: MdzipOutlinePosition;
791
+ /**
792
+ * Width in pixels at start (the reader can drag the panel's edge). Default
793
+ * 240, or `--mdzip-outline-pane-width` when the host's styles set it.
794
+ */
795
+ width?: number;
796
+ }
797
+ /** Which side of the document the outline panel goes on. */
798
+ export type MdzipOutlinePosition = 'left' | 'right';
636
799
  /** Options accepted by {@link MdzipWorkspaceView.setRenderingOptions}. */
637
800
  export interface MdzipRenderingOptions {
638
801
  /** Pass `null` to restore the default renderer. */
@@ -690,6 +853,10 @@ export declare class MdzipWorkspaceView {
690
853
  private contextMenuState;
691
854
  private nameDialogState;
692
855
  private deleteDialogState;
856
+ private navSelection;
857
+ private navSelectionAnchor;
858
+ private readonly navCollapsed;
859
+ private confirmDialogState;
693
860
  private readonly pendingNewFolders;
694
861
  private pendingReplacePath;
695
862
  private conversionHookPending;
@@ -706,11 +873,17 @@ export declare class MdzipWorkspaceView {
706
873
  private cmEditor;
707
874
  private readonly readOnlyCompartment;
708
875
  private readonly lineNumbersCompartment;
876
+ private readonly whitespaceCompartment;
709
877
  private readonly searchCompartment;
878
+ private readonly languageCompartment;
879
+ private cmLanguage;
880
+ private jsonValidity;
881
+ private jsonValidityPath;
710
882
  private updatingCm;
711
883
  private syncing;
712
884
  private lastSyncedEditorScrollTop;
713
885
  private lastSyncedPreviewScrollTop;
886
+ private splitBlockCache;
714
887
  private lastContentChangeTime;
715
888
  private static readonly SCROLL_SYNC_SETTLE_MS;
716
889
  private lastEditorGestureTime;
@@ -726,6 +899,7 @@ export declare class MdzipWorkspaceView {
726
899
  private previewCopyId;
727
900
  /** The preview Ctrl+A selection's boundaries; Ctrl+C copies the whole document while it's unchanged. */
728
901
  private previewSelectAll;
902
+ private previewGlide;
729
903
  private anchorPin;
730
904
  private externalLinkOriginals;
731
905
  private bottomDrainGeneration;
@@ -761,6 +935,43 @@ export declare class MdzipWorkspaceView {
761
935
  private readonly elSourceIcon;
762
936
  private readonly elSaveBtn;
763
937
  private readonly elSearchBtn;
938
+ private readonly elFind;
939
+ private readonly elFindInput;
940
+ private readonly elFindCount;
941
+ private readonly elFindCase;
942
+ private readonly elFindPrevious;
943
+ private readonly elFindNext;
944
+ private readonly elFindClose;
945
+ private findOpen;
946
+ private findMatchCase;
947
+ private findState;
948
+ private findDomTexts;
949
+ private readonly findTextCache;
950
+ private findObserver;
951
+ private findRefreshQueued;
952
+ private findIndexing;
953
+ private findRevealTimer;
954
+ private readonly elOutlineBtn;
955
+ private readonly elOutlinePane;
956
+ private readonly elOutlineResizer;
957
+ private outlinePosition;
958
+ private outlineWidth;
959
+ private outlineVisible;
960
+ private outlineButtonTurn;
961
+ private outlineButtonPending;
962
+ private whitespaceVisible;
963
+ private formattingShown;
964
+ private manifestLayout;
965
+ private documentLayout;
966
+ private layoutIsManifest;
967
+ private manifestForm;
968
+ private whitespaceControlShown;
969
+ private formatJsonShown;
970
+ private readonly elWhitespaceBtn;
971
+ private readonly elFormatJsonBtn;
972
+ private outlineOptions;
973
+ private outline;
974
+ private outlineGeneration;
764
975
  private readonly elZoomBtn;
765
976
  private readonly elWidthControls;
766
977
  private readonly elWidthMenuBtn;
@@ -784,6 +995,7 @@ export declare class MdzipWorkspaceView {
784
995
  private readonly elEditToolbar;
785
996
  private readonly elImageInput;
786
997
  private readonly elEditorHost;
998
+ private readonly elJsonStatus;
787
999
  private readonly elSplitResizer;
788
1000
  private readonly elPreviewPane;
789
1001
  private readonly elPreviewContent;
@@ -829,6 +1041,10 @@ export declare class MdzipWorkspaceView {
829
1041
  private readonly elNameValidation;
830
1042
  private readonly elNameConfirmBtn;
831
1043
  private readonly elDeleteDialog;
1044
+ private readonly elConfirmDialog;
1045
+ private readonly elConfirmDialogTitle;
1046
+ private readonly elConfirmDialogText;
1047
+ private readonly elConfirmDialogOk;
832
1048
  private readonly elDeleteDialogText;
833
1049
  private readonly elDeleteConfirmBtn;
834
1050
  private readonly elReplaceInput;
@@ -890,14 +1106,46 @@ export declare class MdzipWorkspaceView {
890
1106
  executeCommand(command: MdzipEditorCommand, file?: File): Promise<boolean>;
891
1107
  private runFormatShortcut;
892
1108
  /**
893
- * Opens CodeMirror's find/replace panel for the current document. Unlike
894
- * {@link executeCommand}, this works in read-only (Viewer) hosts too —
895
- * searching doesn't require edit access, only a visible source pane. If
896
- * the current layout is preview-only, switches to split/source first so
897
- * the panel has somewhere to render.
1109
+ * Opens find for the current document. In the View layout it's a find
1110
+ * bar over the preview that searches the rendered text, the whole
1111
+ * document including parts not drawn yet, and leaves the layout as it is.
1112
+ * In Edit and Split it's CodeMirror's find/replace panel. Works in
1113
+ * read-only (Viewer) hosts too. When the preview belongs to an entry
1114
+ * renderer, switches to split/source for the panel.
898
1115
  */
899
1116
  openSearch(): Promise<boolean>;
900
1117
  closeSearch(): boolean;
1118
+ /** Whether the find bar is open over the preview. */
1119
+ get isFindOpen(): boolean;
1120
+ private findApplies;
1121
+ private openFind;
1122
+ private revealFindMatchSoon;
1123
+ private closeFind;
1124
+ private scheduleFindRefresh;
1125
+ private findChunks;
1126
+ /**
1127
+ * Matches the query against every chunk's text and repaints. `viewport`
1128
+ * (a new query) makes the first match at or below the top of the pane
1129
+ * current and scrolls to it; `keep` (the document changed under the bar)
1130
+ * keeps the current match.
1131
+ */
1132
+ private refreshFind;
1133
+ private firstFindMatchInView;
1134
+ private paintFind;
1135
+ private scrollFindRangeIntoView;
1136
+ /**
1137
+ * Goes to the next (1) or previous (-1) match, drawing its chunk first
1138
+ * when it isn't yet. A current match that hasn't been shown (its chunk
1139
+ * isn't drawn) is gone to first, not skipped; 0 only does that.
1140
+ */
1141
+ private moveFind;
1142
+ private mountChunksThrough;
1143
+ /**
1144
+ * Finds the text of chunks not drawn yet, a few at a time between frames,
1145
+ * so the count covers the whole document: each chunk's HTML (cached, or
1146
+ * rendered) in a detached fragment, read the same way as the preview.
1147
+ */
1148
+ private indexFindChunks;
901
1149
  convertToMdz(): Promise<boolean>;
902
1150
  focus(): void;
903
1151
  destroy(): void;
@@ -1029,6 +1277,21 @@ export declare class MdzipWorkspaceView {
1029
1277
  * size, alignment and source path, so the layout matches the `<img>`.
1030
1278
  */
1031
1279
  private mountInlineSvg;
1280
+ /**
1281
+ * In place of a file the preview can't show (a Word document, a ZIP): a
1282
+ * card naming it and what it is, with a button for each host file action
1283
+ * that applies to it (the `primary` one first, such as "Open in Word"),
1284
+ * then Extract… (or Download) and, in an editable document, Replace….
1285
+ */
1286
+ private mountFileCard;
1287
+ /**
1288
+ * Asks the host's file actions and {@link MdzipWorkspaceViewOptions.fileNote}
1289
+ * again, for the card of a file the preview can't show: call it when a
1290
+ * label or note would now be different (the file was opened in another
1291
+ * app, or the app that opens it is now known). The contents pane's menu
1292
+ * asks each time it opens.
1293
+ */
1294
+ refreshFileActions(): void;
1032
1295
  /**
1033
1296
  * Replaces an image of a raw draw.io diagram (`.drawio`, `.dio`) with a card
1034
1297
  * saying what it is, why the preview can't draw it yet (#59) and how to show
@@ -1273,8 +1536,49 @@ export declare class MdzipWorkspaceView {
1273
1536
  * anchor (`''` and `'top'` scroll to the top and resolve `true`), and
1274
1537
  * `false` when nothing matches, an entry renderer owns the pane, or the
1275
1538
  * view is destroyed first.
1276
- */
1277
- scrollToAnchor(anchor: string): Promise<boolean>;
1539
+ *
1540
+ * `{ smooth: true }` glides there instead of jumping, as an outline click
1541
+ * does; it jumps anyway when the user asked for reduced motion.
1542
+ */
1543
+ scrollToAnchor(anchor: string, options?: MdzipScrollToAnchorOptions): Promise<boolean>;
1544
+ /** Whether the outline panel is switched on (it shows while a Markdown preview is visible). */
1545
+ get isOutlineVisible(): boolean;
1546
+ /** Whether spaces and tabs are shown in the source editor. */
1547
+ get isWhitespaceVisible(): boolean;
1548
+ /** Shows or hides spaces and tabs in the source editor, as the ¶ toolbar button does (without calling `onWhitespaceVisibilityChanged`). */
1549
+ setWhitespaceVisible(visible: boolean): void;
1550
+ /** Shows or hides the outline panel, as its toolbar button does (without calling `onOutlineVisibilityChanged`). */
1551
+ setOutlineVisible(visible: boolean): void;
1552
+ /** Which side of the document the outline panel is on. */
1553
+ get outlineSide(): MdzipOutlinePosition;
1554
+ /** Puts the outline panel on the left or the right of the document (without calling `onOutlinePositionChanged`). */
1555
+ setOutlinePosition(position: MdzipOutlinePosition): void;
1556
+ private setOutlineSideFromButton;
1557
+ /**
1558
+ * Runs `change` (which shows, hides or moves the outline panel) with
1559
+ * movement instead of a jump: the panel slides out toward its side and
1560
+ * fades, the document glides to where it now sits, and the panel slides in
1561
+ * on its new side. The layout changes once, in the middle, so a long
1562
+ * document isn't laid out again on every frame. Instant when the system
1563
+ * asks for reduced motion, or where elements can't animate.
1564
+ */
1565
+ private canAnimateOutline;
1566
+ private animateOutlineChange;
1567
+ private syncOutlineButton;
1568
+ /** The outline panel's width in pixels, as last set or dragged; null while the style sheet's width applies. */
1569
+ get outlinePaneWidth(): number | null;
1570
+ private syncOutlineGeometry;
1571
+ private syncOutlinePane;
1572
+ /** Rebuilds the outline after the preview renders a new version of the document. */
1573
+ private refreshOutline;
1574
+ /**
1575
+ * The document's headings for the outline, ids without the
1576
+ * `user-content-` prefix. Under progressive rendering they come from the
1577
+ * chunks' tokens, so headings in chunks that aren't mounted yet are listed
1578
+ * too (without an element until they mount).
1579
+ */
1580
+ private outlineHeadings;
1581
+ private findOutlineElement;
1278
1582
  /**
1279
1583
  * The anchors {@link scrollToAnchor} can reach in the current preview, in
1280
1584
  * document order: every heading id (without the `user-content-` prefix),
@@ -1292,8 +1596,19 @@ export declare class MdzipWorkspaceView {
1292
1596
  * a chunk that hasn't been mounted yet, so this mounts everything up to and
1293
1597
  * including that chunk first. Returns whether an anchor was found.
1294
1598
  */
1599
+ private prefersReducedMotion;
1295
1600
  private scrollPreviewToAnchor;
1601
+ private paneTopOf;
1296
1602
  private scrollPaneToElement;
1603
+ /**
1604
+ * Scrolls the preview to `targetTop()` over a few hundred milliseconds.
1605
+ * The target is measured again every frame, so images loading above it
1606
+ * while it moves bend the path instead of restarting it (the browser's
1607
+ * own smooth scroll restarts on every change and stutters). A wheel,
1608
+ * touch or click in the pane stops it, as it releases the anchor pin.
1609
+ */
1610
+ private glidePreviewTo;
1611
+ private cancelPreviewGlide;
1297
1612
  /** See `anchorPin`. */
1298
1613
  private pinPreviewAnchor;
1299
1614
  private releaseAnchorPin;
@@ -1333,6 +1648,22 @@ export declare class MdzipWorkspaceView {
1333
1648
  /** Briefly shows a status message (e.g. "Text copied to clipboard") near the bottom of the view, auto-hiding after a couple of seconds. */
1334
1649
  private showCopyToast;
1335
1650
  private save;
1651
+ private showManifestProblems;
1652
+ /**
1653
+ * Re-indents the open JSON file (2 spaces), changing only whitespace, as
1654
+ * the toolbar's Format JSON button and Shift+Alt+F do. One undo step.
1655
+ * Returns `false` when no JSON file is open in an editable editor or its
1656
+ * text isn't valid JSON.
1657
+ */
1658
+ formatJson(): boolean;
1659
+ /**
1660
+ * The problems of the edited `manifest.json` that block saving, or `null`
1661
+ * when the archive can be saved.
1662
+ */
1663
+ getManifestValidity(): MdzipJsonValidity | null;
1664
+ private syncEditorLanguage;
1665
+ private jsonLinter;
1666
+ private setJsonValidity;
1336
1667
  private downloadSavedBlob;
1337
1668
  private saveTitle;
1338
1669
  private renderMetadata;
@@ -1614,12 +1945,26 @@ export declare class MdzipWorkspaceView {
1614
1945
  /** Closes the color scheme menu; `refocus` returns focus to its button (keyboard use). */
1615
1946
  private closeThemeMenu;
1616
1947
  private setColorSchemeFromToolbar;
1617
- private setLayout;
1948
+ /** The layout showing: `'source'` (Edit), `'split'` or `'preview'` (View). */
1949
+ get layoutMode(): MdzipWorkspaceLayout;
1950
+ /**
1951
+ * Switches to Edit (`'source'`), Split or View (`'preview'`), as the
1952
+ * toolbar's buttons do, for example to show an imported document in View.
1953
+ * A file that can't be shown that way gets the nearest layout it can.
1954
+ */
1955
+ setLayout(requested: MdzipWorkspaceLayout): Promise<void>;
1618
1956
  private navMenuTargetFromElement;
1619
1957
  private fileMenuTarget;
1620
1958
  private showNavMenuForPath;
1621
1959
  private showNavMenu;
1622
1960
  private navMenuItems;
1961
+ /**
1962
+ * Taking files out of the archive: **Extract…** where the host writes
1963
+ * them (`onExtractFiles`), else **Download** for one file, and for several
1964
+ * **Download as ZIP** plus **Extract to Folder…** where the browser can
1965
+ * write to a folder.
1966
+ */
1967
+ private extractMenuItems;
1623
1968
  /** Menu items for the host's {@link MdzipFileAction}s that apply to this file. */
1624
1969
  private fileActionItems;
1625
1970
  private handleNavMenuAction;
@@ -1633,6 +1978,28 @@ export declare class MdzipWorkspaceView {
1633
1978
  private insertArchiveLinkAtCoords;
1634
1979
  private handleEditorImageDrop;
1635
1980
  private downloadArchiveFile;
1981
+ /**
1982
+ * The files of the archive as `{ path, bytes }`, for a host or a test to
1983
+ * write elsewhere (#69). Each path names a file, or a folder (with or
1984
+ * without a trailing `/`; `''` is the whole archive) whose files are all
1985
+ * included when `includeFolders` isn't false. `manifest.json` comes only
1986
+ * when named. In archive order, each file once; paths that match nothing
1987
+ * are skipped. Bytes are the file's current content, as Download gives.
1988
+ */
1989
+ extractFiles(paths: readonly string[], options?: {
1990
+ includeFolders?: boolean;
1991
+ }): Promise<MdzipExtractedFile[]>;
1992
+ private collectExtractPaths;
1993
+ private readExtractFiles;
1994
+ private extractNavTarget;
1995
+ private extractToPickedFolder;
1996
+ /** Asks a yes/no question in the editor's own dialog (no browser confirm(), which some hosts block). */
1997
+ private askConfirm;
1998
+ private answerConfirm;
1999
+ private navRowKeys;
2000
+ private selectNavRange;
2001
+ private syncNavSelection;
2002
+ private navRowKeysAll;
1636
2003
  private duplicateFile;
1637
2004
  private replaceFileFromPicker;
1638
2005
  private attachNavDragAndDrop;
@@ -1640,9 +2007,45 @@ export declare class MdzipWorkspaceView {
1640
2007
  private moveFileToDirectory;
1641
2008
  private addDroppedUris;
1642
2009
  private addDroppedFiles;
2010
+ private shownLayout;
2011
+ private isManifestFormPath;
2012
+ private swapManifestLayout;
2013
+ private mountManifestForm;
2014
+ private setManifestValue;
1643
2015
  private validLayoutForSnapshot;
2016
+ /**
2017
+ * In Split, scrolls the source to match the preview. Normally only after
2018
+ * the reader scrolled the preview themselves; `driven` is for the editor's
2019
+ * own moves (going to a heading from the outline or a link), which no
2020
+ * gesture precedes.
2021
+ */
1644
2022
  private syncScrollFromPreview;
1645
2023
  private syncScrollToPreview;
2024
+ /**
2025
+ * The two pairs of [offset in the editor, offset in the preview] for the
2026
+ * same content around `scrollTop` of one pane (#13), for
2027
+ * `mapScrollPosition` to interpolate between: the mounted top-level
2028
+ * blocks the renderer marked (`data-mdzip-block`), each at its token's
2029
+ * first source line. The panes stay together past a tall image, table or
2030
+ * code block, where one ratio for the whole document drifts. Null when
2031
+ * nothing is marked (a custom renderer) or the preview isn't laid out:
2032
+ * the sync falls back to that ratio.
2033
+ *
2034
+ * Only the two blocks around the position are measured, found by binary
2035
+ * search (both panes keep blocks in document order), so a scroll costs
2036
+ * the same in a document of any length.
2037
+ */
2038
+ private splitScrollAnchors;
2039
+ /**
2040
+ * The preview's mounted, marked blocks in order, each with its token's
2041
+ * offset in the editor's text. Offsets come from each token's `raw` text,
2042
+ * found in order in the editor's current text rather than counted from
2043
+ * the tokens: front matter is stripped before tokenizing, and the preview
2044
+ * can be a render behind the editor while typing (a block not found is
2045
+ * left out). Kept until the text or the mounted chunks change; no layout
2046
+ * is read here.
2047
+ */
2048
+ private splitScrollBlocks;
1646
2049
  /**
1647
2050
  * Handles syncScrollToPreview's bottom edge when the preview still has
1648
2051
  * unmounted chunks: force-mounts the rest (same drain Copy All uses) so