@mdzip/editor 1.4.7 → 1.4.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/dist/view.js CHANGED
@@ -746,19 +746,19 @@ depth = 0) {
746
746
  : isImageFile(node.entry.path)
747
747
  ? IMAGE_ICON_HTML
748
748
  : FILE_ICON_HTML;
749
- const orphanBtnHtml = isOrphaned && options.allowOrphanActions ? `
750
- <span class="nav-orphan-button" role="button" tabindex="0"
751
- title="Orphaned asset" aria-label="Orphaned asset actions"
752
- data-orphan-path="${safePath}">
753
- ${ORPHAN_ICON_HTML}
749
+ const orphanBtnHtml = isOrphaned && options.allowOrphanActions ? `
750
+ <span class="nav-orphan-button" role="button" tabindex="0"
751
+ title="Orphaned asset" aria-label="Orphaned asset actions"
752
+ data-orphan-path="${safePath}">
753
+ ${ORPHAN_ICON_HTML}
754
754
  </span>` : '';
755
755
  const draggable = options.allowDrag && !isManifest;
756
- return `<button type="button" class="${classes}" title="${title}"
757
- data-nav-path="${safePath}" data-orphan="${isOrphaned ? 'true' : ''}"${draggable ? ' draggable="true"' : ''}>
758
- ${guides}<span class="nav-caret"></span>
759
- <span class="nav-file-icon ${iconKind}">${iconHtml}</span>
760
- ${orphanBtnHtml}
761
- <span class="nav-label">${safeName}</span>
756
+ return `<button type="button" class="${classes}" title="${title}"
757
+ data-nav-path="${safePath}" data-orphan="${isOrphaned ? 'true' : ''}"${draggable ? ' draggable="true"' : ''}>
758
+ ${guides}<span class="nav-caret"></span>
759
+ <span class="nav-file-icon ${iconKind}">${iconHtml}</span>
760
+ ${orphanBtnHtml}
761
+ <span class="nav-label">${safeName}</span>
762
762
  </button>`;
763
763
  }
764
764
  const childTrail = depth === 0 ? [] : [...trail, !isLast];
@@ -766,14 +766,14 @@ depth = 0) {
766
766
  .map((child, index) => renderNavNode(child, state, options, childTrail, index === node.children.length - 1, depth + 1))
767
767
  .join('');
768
768
  const pending = options.pendingFolders.has(node.path.toLowerCase());
769
- return `<details class="nav-directory${pending ? ' pending-folder' : ''}" open data-nav-dir="${escapeHtml(node.path)}">
770
- <summary${pending ? ` title="${escapeHtml(node.path)} — not saved until it contains a file"` : ''}>
771
- ${guides}<span class="nav-caret" aria-hidden="true"></span>
772
- <span class="nav-folder-icon closed">${FOLDER_CLOSED_ICON_HTML}</span>
773
- <span class="nav-folder-icon open">${FOLDER_OPEN_ICON_HTML}</span>
774
- <span class="nav-label">${escapeHtml(node.name)}</span>
775
- </summary>
776
- <div class="nav-directory-children">${children}</div>
769
+ return `<details class="nav-directory${pending ? ' pending-folder' : ''}" open data-nav-dir="${escapeHtml(node.path)}">
770
+ <summary${pending ? ` title="${escapeHtml(node.path)} — not saved until it contains a file"` : ''}>
771
+ ${guides}<span class="nav-caret" aria-hidden="true"></span>
772
+ <span class="nav-folder-icon closed">${FOLDER_CLOSED_ICON_HTML}</span>
773
+ <span class="nav-folder-icon open">${FOLDER_OPEN_ICON_HTML}</span>
774
+ <span class="nav-label">${escapeHtml(node.name)}</span>
775
+ </summary>
776
+ <div class="nav-directory-children">${children}</div>
777
777
  </details>`;
778
778
  }
779
779
  // Inserts view-local pending (not yet saved) folders into the nav tree so they
@@ -1283,7 +1283,12 @@ export class MdzipWorkspaceView {
1283
1283
  void this.notifyChanged(event);
1284
1284
  });
1285
1285
  this.render();
1286
- void this.notifyChanged(this.initialWorkspaceEvent(ws.snapshot()));
1286
+ // A lazy workspace handed over without archiveBytes can only be exported
1287
+ // by rebuilding it, reading every lazy document first — and the host that
1288
+ // passed it in already holds those bytes. Skip reporting them on open.
1289
+ const initialBytesNeedRebuild = !options.archiveBytes?.length
1290
+ && workspace.documents.some((document) => document.isLazy);
1291
+ void this.notifyChanged(this.initialWorkspaceEvent(ws.snapshot()), { reportBytes: !initialBytesNeedRebuild });
1287
1292
  }
1288
1293
  catch (error) {
1289
1294
  if (generation !== this.openGeneration) {
@@ -5794,7 +5799,7 @@ export class MdzipWorkspaceView {
5794
5799
  });
5795
5800
  editor.focus();
5796
5801
  }
5797
- async notifyChanged(event) {
5802
+ async notifyChanged(event, { reportBytes = true } = {}) {
5798
5803
  if (!this.workspace) {
5799
5804
  return;
5800
5805
  }
@@ -5806,7 +5811,13 @@ export class MdzipWorkspaceView {
5806
5811
  const delegatedToManifestHandler = this.options.onManifestChanged
5807
5812
  && event.changes.length === 1
5808
5813
  && event.changes[0] === 'manifest';
5809
- if (this.options.onChanged && !delegatedToManifestHandler) {
5814
+ // Opening another path changes nothing in the archive, so there are no
5815
+ // new bytes to report. Exporting anyway rebuilt the whole archive on
5816
+ // every navigation when opened without archiveBytes — reading every
5817
+ // lazy document's text first (752 host round-trips on a 153MB archive,
5818
+ // which starved the one read the user actually asked for).
5819
+ const selectionOnly = event.changes.every((change) => change === 'selection');
5820
+ if (this.options.onChanged && reportBytes && !delegatedToManifestHandler && !selectionOnly) {
5810
5821
  const bytes = await this.workspace.exportBytes();
5811
5822
  this.options.onChanged(bytes, snapshot);
5812
5823
  }
@@ -6736,325 +6747,325 @@ function formatMetadataValue(value) {
6736
6747
  }
6737
6748
  return 'Not available';
6738
6749
  }
6739
- const SHELL_HTML = `
6740
- <section class="mdzip-root">
6741
- <div class="document-strip" data-ref="document-strip" hidden>
6742
- <button type="button" class="title-button" data-ref="title-btn"></button>
6743
- <button type="button" class="document-info-button" data-ref="document-info-btn"
6744
- title="Document information" aria-label="Document information">
6745
- ${INFO_ICON_HTML}
6746
- </button>
6747
- </div>
6748
-
6749
- <header class="toolbar" data-ref="toolbar" hidden>
6750
- <div class="toolbar-start">
6751
- <div class="toolbar-left">
6752
- <button type="button" class="icon-toggle nav-toggle" data-ref="nav-btn" title="Toggle contents" aria-label="Toggle contents">
6753
- ${NAV_TOGGLE_ICON_HTML}
6754
- </button>
6755
- </div>
6756
-
6757
- <div class="edit-toolbar" data-ref="edit-toolbar" role="toolbar" aria-label="Markdown formatting">
6758
- <div class="edit-toolbar-group">
6759
- <button type="button" data-format="bold" data-format-control="bold" title="Bold" aria-label="Bold">${BOLD_ICON_HTML}</button>
6760
- <button type="button" data-format="italic" data-format-control="italic" title="Italic" aria-label="Italic">${ITALIC_ICON_HTML}</button>
6761
- <button type="button" data-format="strike" data-format-control="strikethrough" title="Strikethrough" aria-label="Strikethrough">${STRIKE_ICON_HTML}</button>
6762
- <div class="format-menu" data-format-control="headings">
6763
- <button type="button" class="format-menu-toggle" data-format-menu-toggle
6764
- aria-label="Heading" aria-haspopup="menu" aria-expanded="false">
6765
- ${HEADING_ICON_HTML}${CHEVRON_ICON_HTML}
6766
- </button>
6767
- <div class="format-menu-popover" data-format-menu role="menu" aria-label="Heading level" hidden>
6768
- <button type="button" role="menuitem" data-format="paragraph">Paragraph</button>
6769
- <button type="button" role="menuitem" data-format="heading-1" data-heading-level="1"><strong>H1</strong> Heading 1</button>
6770
- <button type="button" role="menuitem" data-format="heading-2" data-heading-level="2"><strong>H2</strong> Heading 2</button>
6771
- <button type="button" role="menuitem" data-format="heading-3" data-heading-level="3"><strong>H3</strong> Heading 3</button>
6772
- <button type="button" role="menuitem" data-format="heading-4" data-heading-level="4"><strong>H4</strong> Heading 4</button>
6773
- <button type="button" role="menuitem" data-format="heading-5" data-heading-level="5"><strong>H5</strong> Heading 5</button>
6774
- <button type="button" role="menuitem" data-format="heading-6" data-heading-level="6"><strong>H6</strong> Heading 6</button>
6775
- </div>
6776
- </div>
6777
- </div>
6778
- <span class="edit-toolbar-divider" aria-hidden="true"></span>
6779
- <div class="edit-toolbar-group">
6780
- <button type="button" data-format="bullet-list" data-format-control="bulletList" title="Bulleted list" aria-label="Bulleted list">${BULLET_LIST_ICON_HTML}</button>
6781
- <button type="button" data-format="ordered-list" data-format-control="orderedList" title="Numbered list" aria-label="Numbered list">${ORDERED_LIST_ICON_HTML}</button>
6782
- <div class="format-menu" data-format-control="code">
6783
- <button type="button" class="format-menu-toggle" data-format-menu-toggle
6784
- aria-label="Code" aria-haspopup="menu" aria-expanded="false">
6785
- ${CODE_ICON_HTML}${CHEVRON_ICON_HTML}
6786
- </button>
6787
- <div class="format-menu-popover" data-format-menu role="menu" aria-label="Code format" hidden>
6788
- <button type="button" role="menuitem" data-format="code" data-code-kind="inline">Inline code</button>
6789
- <button type="button" role="menuitem" data-format="code-block" data-code-kind="block">Code block</button>
6790
- </div>
6791
- </div>
6792
- <button type="button" data-format="quote" data-format-control="blockquote" title="Blockquote" aria-label="Blockquote">${QUOTE_ICON_HTML}</button>
6793
- <button type="button" data-format="line-break" data-format-control="lineBreak" title="Line break" aria-label="Line break">${LINE_BREAK_ICON_HTML}</button>
6794
- </div>
6795
- <span class="edit-toolbar-divider" aria-hidden="true"></span>
6796
- <div class="edit-toolbar-group">
6797
- <button type="button" data-format="link" data-format-control="link" title="Link" aria-label="Link">${LINK_ICON_HTML}</button>
6798
- <button type="button" data-format="image" data-format-control="image" title="Image" aria-label="Image">${IMAGE_FORMAT_ICON_HTML}</button>
6799
- <input type="file" data-ref="image-input" accept="image/*" hidden />
6800
- </div>
6801
- </div>
6802
- </div>
6803
-
6804
- <div class="toolbar-buttons view-mode-toggle-group" data-ref="layout-controls" role="group" aria-label="Editor layout">
6805
- <button type="button" class="icon-toggle view-mode-toggle" data-ref="source-btn" title="Edit" aria-label="Edit" aria-pressed="false">
6806
- <span class="commandbar-flex-container" data-ref="source-icon">${SOURCE_EDIT_ICON_HTML}</span>
6807
- </button>
6808
- <button type="button" class="icon-toggle view-mode-toggle" data-ref="split-btn" title="Split" aria-label="Split" aria-pressed="false">
6809
- <span class="commandbar-flex-container">
6810
- ${SPLIT_ICON_HTML}
6811
- </span>
6812
- </button>
6813
- <button type="button" class="icon-toggle view-mode-toggle" data-ref="preview-btn" title="View" aria-label="View" aria-pressed="false">
6814
- <span class="commandbar-flex-container">
6815
- ${PREVIEW_ICON_HTML}
6816
- </span>
6817
- </button>
6818
- </div>
6819
-
6820
- <div class="toolbar-controls" data-ref="toolbar-controls">
6821
- <button type="button" class="icon-toggle" data-ref="search-btn" title="Find/replace (Mod-F)" aria-label="Find/replace">
6822
- ${SEARCH_ICON_HTML}
6823
- </button>
6824
- <button type="button" class="icon-toggle" data-ref="save-btn" title="Save" aria-label="Save">
6825
- ${SAVE_ICON_HTML}
6826
- </button>
6827
- <button type="button" class="icon-toggle zoom-toggle" data-ref="zoom-btn" title="Zoom controls" aria-label="Zoom controls">
6828
- ${ZOOM_ICON_HTML}
6829
- </button>
6830
- <div class="theme-toggle-group" data-ref="theme-controls" role="group" aria-label="Color scheme">
6831
- <button type="button" class="icon-toggle theme-toggle" data-ref="dark-theme-btn"
6832
- title="Dark mode" aria-label="Dark mode" aria-pressed="false">
6833
- ${DARK_THEME_ICON_HTML}
6834
- </button>
6835
- <button type="button" class="icon-toggle theme-toggle" data-ref="light-theme-btn"
6836
- title="Light mode" aria-label="Light mode" aria-pressed="false">
6837
- ${LIGHT_THEME_ICON_HTML}
6838
- </button>
6839
- </div>
6840
- <div class="zoom-popover" data-ref="zoom-popover" hidden role="group" aria-label="Zoom">
6841
- <span class="zoom-level" data-ref="zoom-level">100%</span>
6842
- <span class="zoom-stepper">
6843
- <button type="button" data-action="zoom-out" title="Zoom out" aria-label="Zoom out">-</button>
6844
- <button type="button" data-action="zoom-in" title="Zoom in" aria-label="Zoom in">+</button>
6845
- </span>
6846
- <button type="button" class="zoom-reset" data-action="zoom-reset" title="Reset zoom">Reset</button>
6847
- </div>
6848
- </div>
6849
- </header>
6850
-
6851
- <div class="workspace-shell" data-ref="workspace-shell" hidden>
6852
- <aside class="nav-pane" data-ref="nav-pane" aria-label="Package contents">
6853
- <div class="nav-tree" data-ref="nav-tree"></div>
6854
- </aside>
6855
- <div class="nav-resizer" data-ref="nav-resizer"
6856
- role="separator" aria-orientation="vertical" aria-label="Resize contents pane"></div>
6857
-
6858
- <div class="pane-stack" data-ref="pane-stack">
6859
- <section class="pane edit-pane" data-ref="edit-pane">
6860
- <div class="editor-host" data-ref="editor-host"></div>
6861
- </section>
6862
- <div class="split-resizer" data-ref="split-resizer"
6863
- role="separator" aria-orientation="vertical" aria-label="Resize split panes"></div>
6864
- <section class="pane preview-pane" data-ref="preview-pane" tabindex="-1">
6865
- <article class="preview-content" data-ref="preview-content"></article>
6866
- </section>
6867
- <section class="pane entry-pane" data-ref="entry-pane"></section>
6868
- </div>
6869
- </div>
6870
-
6871
- <div class="title-dialog-backdrop" data-ref="title-dialog" hidden
6872
- role="dialog" aria-modal="true" aria-labelledby="mdzip-title-dialog-heading">
6873
- <div class="title-dialog">
6874
- <h3 id="mdzip-title-dialog-heading">Set Document Title</h3>
6875
- <p>This is the package-level title stored in manifest.json.</p>
6876
- <input type="text" maxlength="120" data-ref="title-input" aria-label="Document title" />
6877
- <p class="title-dialog-validation" data-ref="title-validation" hidden>Title cannot be empty.</p>
6878
- <p>If unset, consumers may fall back to entry point, filename, or first heading.</p>
6879
- <div class="title-dialog-actions">
6880
- <button type="button" class="reset-title" data-ref="title-reset-btn">Reset</button>
6881
- <button type="button" data-action="cancel-title">Cancel</button>
6882
- <button type="button" class="save-title" data-ref="title-save-btn">Save</button>
6883
- </div>
6884
- </div>
6885
- </div>
6886
-
6887
- <div class="title-dialog-backdrop" data-ref="conversion-dialog" hidden
6888
- role="dialog" aria-modal="true" aria-labelledby="mdzip-conversion-dialog-heading">
6889
- <div class="title-dialog">
6890
- <h3 id="mdzip-conversion-dialog-heading">Convert to MDZ?</h3>
6891
- <p>
6892
- Regular Markdown files contain only text. Convert this document to an
6893
- MDZ package to add images, package navigation, and document metadata.
6894
- </p>
6895
- <p>The next save will produce an .mdz file.</p>
6896
- <div class="title-dialog-actions">
6897
- <button type="button" data-action="cancel-conversion">Cancel</button>
6898
- <button type="button" class="save-title" data-ref="conversion-confirm-btn">Convert</button>
6899
- </div>
6900
- </div>
6901
- </div>
6902
-
6903
- <div class="title-dialog-backdrop" data-ref="image-insert-dialog" hidden
6904
- role="dialog" aria-modal="true" aria-labelledby="mdzip-image-insert-dialog-heading">
6905
- <div class="title-dialog image-insert-dialog">
6906
- <h3 id="mdzip-image-insert-dialog-heading">Insert Image</h3>
6907
- <p>Choose the Markdown inserted for this image.</p>
6908
- <fieldset class="image-insert-options">
6909
- <legend>Output</legend>
6910
- <label>
6911
- <input type="radio" name="mdzip-image-insert-mode" value="markdown"
6912
- data-ref="image-insert-mode-markdown" checked />
6913
- Markdown image
6914
- </label>
6915
- <label>
6916
- <input type="radio" name="mdzip-image-insert-mode" value="html"
6917
- data-ref="image-insert-mode-html" />
6918
- HTML &lt;img&gt; with sizing
6919
- </label>
6920
- </fieldset>
6921
- <label class="image-insert-field">
6922
- <span>Alt text</span>
6923
- <input type="text" data-ref="image-insert-alt" />
6924
- </label>
6925
- <div class="image-insert-grid">
6926
- <label class="image-insert-field">
6927
- <span>Size by</span>
6928
- <select data-ref="image-insert-size-mode">
6929
- <option value="original">Original size</option>
6930
- <option value="width" selected>Width</option>
6931
- <option value="height">Height</option>
6932
- <option value="percent">Percent</option>
6933
- </select>
6934
- </label>
6935
- <label class="image-insert-field">
6936
- <span>Value</span>
6937
- <input type="number" min="1" step="1" data-ref="image-insert-size-value" />
6938
- </label>
6939
- </div>
6940
- <label class="image-insert-field">
6941
- <span>Position</span>
6942
- <select data-ref="image-insert-position">
6943
- <option value="inline">Inline/default</option>
6944
- <option value="left">Left</option>
6945
- <option value="center">Center</option>
6946
- <option value="right">Right</option>
6947
- <option value="wrap-left">Wrap left</option>
6948
- <option value="wrap-right">Wrap right</option>
6949
- </select>
6950
- </label>
6951
- <div class="title-dialog-actions">
6952
- <button type="button" data-action="cancel-image-insert">Cancel</button>
6953
- <button type="button" class="save-title" data-ref="image-insert-confirm-btn">Insert</button>
6954
- </div>
6955
- </div>
6956
- </div>
6957
-
6958
- <div class="title-dialog-backdrop" data-ref="pack-files-dialog" hidden
6959
- role="dialog" aria-modal="true" aria-labelledby="mdzip-pack-files-dialog-heading">
6960
- <div class="title-dialog pack-files-dialog">
6961
- <h3 id="mdzip-pack-files-dialog-heading">Package Markdown Files</h3>
6962
- <p>These files contain more than one Markdown document. Choose how to package them.</p>
6963
- <fieldset class="pack-files-options">
6964
- <legend>Mode</legend>
6965
- <label>
6966
- <input type="radio" name="mdzip-pack-files-mode" value="document"
6967
- data-ref="pack-files-mode-document" checked />
6968
- Document — one primary page; the rest are attached
6969
- </label>
6970
- <label>
6971
- <input type="radio" name="mdzip-pack-files-mode" value="project"
6972
- data-ref="pack-files-mode-project" />
6973
- Project — a set of related documents
6974
- </label>
6975
- </fieldset>
6976
- <label class="pack-files-field">
6977
- <span>Entry point</span>
6978
- <select data-ref="pack-files-entry"></select>
6979
- </label>
6980
- <div class="title-dialog-actions">
6981
- <button type="button" data-action="cancel-pack-files">Cancel</button>
6982
- <button type="button" class="save-title" data-ref="pack-files-confirm-btn">Package</button>
6983
- </div>
6984
- </div>
6985
- </div>
6986
-
6987
- <div class="title-dialog-backdrop" data-ref="copy-render-dialog" hidden
6988
- role="dialog" aria-modal="true" aria-labelledby="mdzip-copy-render-dialog-heading">
6989
- <div class="title-dialog copy-render-dialog">
6990
- <h3 id="mdzip-copy-render-dialog-heading" data-ref="copy-render-heading">Copying document...</h3>
6991
- <div data-ref="copy-render-progress-section">
6992
- <p data-ref="copy-render-progress-text">Rendering the full document...</p>
6993
- <div class="copy-render-progress-track">
6994
- <div class="copy-render-progress-bar" data-ref="copy-render-progress-bar"></div>
6995
- </div>
6996
- </div>
6997
- <p data-ref="copy-render-ready-text" hidden>
6998
- The document is ready. Browsers only allow a clipboard write right after a click, so this needs one more —
6999
- click Copy to finish.
7000
- </p>
7001
- <p data-ref="copy-render-done-text" hidden></p>
7002
- <div class="title-dialog-actions">
7003
- <button type="button" data-action="cancel-copy-render" data-ref="copy-render-cancel-btn">Cancel</button>
7004
- <button type="button" data-action="cancel-copy-ready" data-ref="copy-render-ready-cancel-btn" hidden>Cancel</button>
7005
- <button type="button" class="save-title" data-action="confirm-copy-ready" data-ref="copy-render-confirm-btn" hidden>Copy</button>
7006
- <button type="button" class="save-title" data-action="dismiss-copy-render" data-ref="copy-render-dismiss-btn" hidden>Dismiss</button>
7007
- </div>
7008
- </div>
7009
- </div>
7010
-
7011
- <div class="title-dialog-backdrop" data-ref="metadata-dialog" hidden
7012
- role="dialog" aria-modal="true" aria-labelledby="mdzip-metadata-dialog-heading">
7013
- <div class="title-dialog metadata-dialog">
7014
- <h3 id="mdzip-metadata-dialog-heading">Document Information</h3>
7015
- <dl data-ref="metadata-list"></dl>
7016
- <h4>Libraries</h4>
7017
- <dl data-ref="library-list"></dl>
7018
- <div class="title-dialog-actions">
7019
- <button type="button" class="save-title" data-action="close-metadata">Close</button>
7020
- </div>
7021
- </div>
7022
- </div>
7023
-
7024
- <div class="title-dialog-backdrop" data-ref="name-dialog" hidden
7025
- role="dialog" aria-modal="true" aria-labelledby="mdzip-name-dialog-heading">
7026
- <div class="title-dialog">
7027
- <h3 id="mdzip-name-dialog-heading" data-ref="name-dialog-heading">New Markdown File</h3>
7028
- <input type="text" maxlength="260" data-ref="name-input" aria-label="File name" />
7029
- <p class="title-dialog-validation" data-ref="name-validation" hidden></p>
7030
- <div class="title-dialog-actions">
7031
- <button type="button" data-action="cancel-name">Cancel</button>
7032
- <button type="button" class="save-title" data-ref="name-confirm-btn">Create</button>
7033
- </div>
7034
- </div>
7035
- </div>
7036
-
7037
- <div class="title-dialog-backdrop" data-ref="delete-dialog" hidden
7038
- role="dialog" aria-modal="true" aria-labelledby="mdzip-delete-dialog-heading">
7039
- <div class="title-dialog">
7040
- <h3 id="mdzip-delete-dialog-heading">Delete File?</h3>
7041
- <p data-ref="delete-dialog-text"></p>
7042
- <div class="title-dialog-actions">
7043
- <button type="button" data-action="cancel-delete">Cancel</button>
7044
- <button type="button" class="danger-action" data-ref="delete-confirm-btn">Delete</button>
7045
- </div>
7046
- </div>
7047
- </div>
7048
-
7049
- <input type="file" data-ref="replace-input" hidden />
7050
-
7051
- <div class="nav-context-menu" data-ref="nav-menu" hidden role="menu"></div>
7052
-
7053
- <div class="mdzip-tooltip" data-ref="tooltip" role="tooltip" hidden></div>
7054
-
7055
- <div class="mdzip-copy-toast" data-ref="copy-toast" role="status" aria-live="polite" hidden></div>
7056
-
7057
- <p class="mdzip-empty" data-ref="empty-state">No MDZip workspace loaded.</p>
7058
- </section>
6750
+ const SHELL_HTML = `
6751
+ <section class="mdzip-root">
6752
+ <div class="document-strip" data-ref="document-strip" hidden>
6753
+ <button type="button" class="title-button" data-ref="title-btn"></button>
6754
+ <button type="button" class="document-info-button" data-ref="document-info-btn"
6755
+ title="Document information" aria-label="Document information">
6756
+ ${INFO_ICON_HTML}
6757
+ </button>
6758
+ </div>
6759
+
6760
+ <header class="toolbar" data-ref="toolbar" hidden>
6761
+ <div class="toolbar-start">
6762
+ <div class="toolbar-left">
6763
+ <button type="button" class="icon-toggle nav-toggle" data-ref="nav-btn" title="Toggle contents" aria-label="Toggle contents">
6764
+ ${NAV_TOGGLE_ICON_HTML}
6765
+ </button>
6766
+ </div>
6767
+
6768
+ <div class="edit-toolbar" data-ref="edit-toolbar" role="toolbar" aria-label="Markdown formatting">
6769
+ <div class="edit-toolbar-group">
6770
+ <button type="button" data-format="bold" data-format-control="bold" title="Bold" aria-label="Bold">${BOLD_ICON_HTML}</button>
6771
+ <button type="button" data-format="italic" data-format-control="italic" title="Italic" aria-label="Italic">${ITALIC_ICON_HTML}</button>
6772
+ <button type="button" data-format="strike" data-format-control="strikethrough" title="Strikethrough" aria-label="Strikethrough">${STRIKE_ICON_HTML}</button>
6773
+ <div class="format-menu" data-format-control="headings">
6774
+ <button type="button" class="format-menu-toggle" data-format-menu-toggle
6775
+ aria-label="Heading" aria-haspopup="menu" aria-expanded="false">
6776
+ ${HEADING_ICON_HTML}${CHEVRON_ICON_HTML}
6777
+ </button>
6778
+ <div class="format-menu-popover" data-format-menu role="menu" aria-label="Heading level" hidden>
6779
+ <button type="button" role="menuitem" data-format="paragraph">Paragraph</button>
6780
+ <button type="button" role="menuitem" data-format="heading-1" data-heading-level="1"><strong>H1</strong> Heading 1</button>
6781
+ <button type="button" role="menuitem" data-format="heading-2" data-heading-level="2"><strong>H2</strong> Heading 2</button>
6782
+ <button type="button" role="menuitem" data-format="heading-3" data-heading-level="3"><strong>H3</strong> Heading 3</button>
6783
+ <button type="button" role="menuitem" data-format="heading-4" data-heading-level="4"><strong>H4</strong> Heading 4</button>
6784
+ <button type="button" role="menuitem" data-format="heading-5" data-heading-level="5"><strong>H5</strong> Heading 5</button>
6785
+ <button type="button" role="menuitem" data-format="heading-6" data-heading-level="6"><strong>H6</strong> Heading 6</button>
6786
+ </div>
6787
+ </div>
6788
+ </div>
6789
+ <span class="edit-toolbar-divider" aria-hidden="true"></span>
6790
+ <div class="edit-toolbar-group">
6791
+ <button type="button" data-format="bullet-list" data-format-control="bulletList" title="Bulleted list" aria-label="Bulleted list">${BULLET_LIST_ICON_HTML}</button>
6792
+ <button type="button" data-format="ordered-list" data-format-control="orderedList" title="Numbered list" aria-label="Numbered list">${ORDERED_LIST_ICON_HTML}</button>
6793
+ <div class="format-menu" data-format-control="code">
6794
+ <button type="button" class="format-menu-toggle" data-format-menu-toggle
6795
+ aria-label="Code" aria-haspopup="menu" aria-expanded="false">
6796
+ ${CODE_ICON_HTML}${CHEVRON_ICON_HTML}
6797
+ </button>
6798
+ <div class="format-menu-popover" data-format-menu role="menu" aria-label="Code format" hidden>
6799
+ <button type="button" role="menuitem" data-format="code" data-code-kind="inline">Inline code</button>
6800
+ <button type="button" role="menuitem" data-format="code-block" data-code-kind="block">Code block</button>
6801
+ </div>
6802
+ </div>
6803
+ <button type="button" data-format="quote" data-format-control="blockquote" title="Blockquote" aria-label="Blockquote">${QUOTE_ICON_HTML}</button>
6804
+ <button type="button" data-format="line-break" data-format-control="lineBreak" title="Line break" aria-label="Line break">${LINE_BREAK_ICON_HTML}</button>
6805
+ </div>
6806
+ <span class="edit-toolbar-divider" aria-hidden="true"></span>
6807
+ <div class="edit-toolbar-group">
6808
+ <button type="button" data-format="link" data-format-control="link" title="Link" aria-label="Link">${LINK_ICON_HTML}</button>
6809
+ <button type="button" data-format="image" data-format-control="image" title="Image" aria-label="Image">${IMAGE_FORMAT_ICON_HTML}</button>
6810
+ <input type="file" data-ref="image-input" accept="image/*" hidden />
6811
+ </div>
6812
+ </div>
6813
+ </div>
6814
+
6815
+ <div class="toolbar-buttons view-mode-toggle-group" data-ref="layout-controls" role="group" aria-label="Editor layout">
6816
+ <button type="button" class="icon-toggle view-mode-toggle" data-ref="source-btn" title="Edit" aria-label="Edit" aria-pressed="false">
6817
+ <span class="commandbar-flex-container" data-ref="source-icon">${SOURCE_EDIT_ICON_HTML}</span>
6818
+ </button>
6819
+ <button type="button" class="icon-toggle view-mode-toggle" data-ref="split-btn" title="Split" aria-label="Split" aria-pressed="false">
6820
+ <span class="commandbar-flex-container">
6821
+ ${SPLIT_ICON_HTML}
6822
+ </span>
6823
+ </button>
6824
+ <button type="button" class="icon-toggle view-mode-toggle" data-ref="preview-btn" title="View" aria-label="View" aria-pressed="false">
6825
+ <span class="commandbar-flex-container">
6826
+ ${PREVIEW_ICON_HTML}
6827
+ </span>
6828
+ </button>
6829
+ </div>
6830
+
6831
+ <div class="toolbar-controls" data-ref="toolbar-controls">
6832
+ <button type="button" class="icon-toggle" data-ref="search-btn" title="Find/replace (Mod-F)" aria-label="Find/replace">
6833
+ ${SEARCH_ICON_HTML}
6834
+ </button>
6835
+ <button type="button" class="icon-toggle" data-ref="save-btn" title="Save" aria-label="Save">
6836
+ ${SAVE_ICON_HTML}
6837
+ </button>
6838
+ <button type="button" class="icon-toggle zoom-toggle" data-ref="zoom-btn" title="Zoom controls" aria-label="Zoom controls">
6839
+ ${ZOOM_ICON_HTML}
6840
+ </button>
6841
+ <div class="theme-toggle-group" data-ref="theme-controls" role="group" aria-label="Color scheme">
6842
+ <button type="button" class="icon-toggle theme-toggle" data-ref="dark-theme-btn"
6843
+ title="Dark mode" aria-label="Dark mode" aria-pressed="false">
6844
+ ${DARK_THEME_ICON_HTML}
6845
+ </button>
6846
+ <button type="button" class="icon-toggle theme-toggle" data-ref="light-theme-btn"
6847
+ title="Light mode" aria-label="Light mode" aria-pressed="false">
6848
+ ${LIGHT_THEME_ICON_HTML}
6849
+ </button>
6850
+ </div>
6851
+ <div class="zoom-popover" data-ref="zoom-popover" hidden role="group" aria-label="Zoom">
6852
+ <span class="zoom-level" data-ref="zoom-level">100%</span>
6853
+ <span class="zoom-stepper">
6854
+ <button type="button" data-action="zoom-out" title="Zoom out" aria-label="Zoom out">-</button>
6855
+ <button type="button" data-action="zoom-in" title="Zoom in" aria-label="Zoom in">+</button>
6856
+ </span>
6857
+ <button type="button" class="zoom-reset" data-action="zoom-reset" title="Reset zoom">Reset</button>
6858
+ </div>
6859
+ </div>
6860
+ </header>
6861
+
6862
+ <div class="workspace-shell" data-ref="workspace-shell" hidden>
6863
+ <aside class="nav-pane" data-ref="nav-pane" aria-label="Package contents">
6864
+ <div class="nav-tree" data-ref="nav-tree"></div>
6865
+ </aside>
6866
+ <div class="nav-resizer" data-ref="nav-resizer"
6867
+ role="separator" aria-orientation="vertical" aria-label="Resize contents pane"></div>
6868
+
6869
+ <div class="pane-stack" data-ref="pane-stack">
6870
+ <section class="pane edit-pane" data-ref="edit-pane">
6871
+ <div class="editor-host" data-ref="editor-host"></div>
6872
+ </section>
6873
+ <div class="split-resizer" data-ref="split-resizer"
6874
+ role="separator" aria-orientation="vertical" aria-label="Resize split panes"></div>
6875
+ <section class="pane preview-pane" data-ref="preview-pane" tabindex="-1">
6876
+ <article class="preview-content" data-ref="preview-content"></article>
6877
+ </section>
6878
+ <section class="pane entry-pane" data-ref="entry-pane"></section>
6879
+ </div>
6880
+ </div>
6881
+
6882
+ <div class="title-dialog-backdrop" data-ref="title-dialog" hidden
6883
+ role="dialog" aria-modal="true" aria-labelledby="mdzip-title-dialog-heading">
6884
+ <div class="title-dialog">
6885
+ <h3 id="mdzip-title-dialog-heading">Set Document Title</h3>
6886
+ <p>This is the package-level title stored in manifest.json.</p>
6887
+ <input type="text" maxlength="120" data-ref="title-input" aria-label="Document title" />
6888
+ <p class="title-dialog-validation" data-ref="title-validation" hidden>Title cannot be empty.</p>
6889
+ <p>If unset, consumers may fall back to entry point, filename, or first heading.</p>
6890
+ <div class="title-dialog-actions">
6891
+ <button type="button" class="reset-title" data-ref="title-reset-btn">Reset</button>
6892
+ <button type="button" data-action="cancel-title">Cancel</button>
6893
+ <button type="button" class="save-title" data-ref="title-save-btn">Save</button>
6894
+ </div>
6895
+ </div>
6896
+ </div>
6897
+
6898
+ <div class="title-dialog-backdrop" data-ref="conversion-dialog" hidden
6899
+ role="dialog" aria-modal="true" aria-labelledby="mdzip-conversion-dialog-heading">
6900
+ <div class="title-dialog">
6901
+ <h3 id="mdzip-conversion-dialog-heading">Convert to MDZ?</h3>
6902
+ <p>
6903
+ Regular Markdown files contain only text. Convert this document to an
6904
+ MDZ package to add images, package navigation, and document metadata.
6905
+ </p>
6906
+ <p>The next save will produce an .mdz file.</p>
6907
+ <div class="title-dialog-actions">
6908
+ <button type="button" data-action="cancel-conversion">Cancel</button>
6909
+ <button type="button" class="save-title" data-ref="conversion-confirm-btn">Convert</button>
6910
+ </div>
6911
+ </div>
6912
+ </div>
6913
+
6914
+ <div class="title-dialog-backdrop" data-ref="image-insert-dialog" hidden
6915
+ role="dialog" aria-modal="true" aria-labelledby="mdzip-image-insert-dialog-heading">
6916
+ <div class="title-dialog image-insert-dialog">
6917
+ <h3 id="mdzip-image-insert-dialog-heading">Insert Image</h3>
6918
+ <p>Choose the Markdown inserted for this image.</p>
6919
+ <fieldset class="image-insert-options">
6920
+ <legend>Output</legend>
6921
+ <label>
6922
+ <input type="radio" name="mdzip-image-insert-mode" value="markdown"
6923
+ data-ref="image-insert-mode-markdown" checked />
6924
+ Markdown image
6925
+ </label>
6926
+ <label>
6927
+ <input type="radio" name="mdzip-image-insert-mode" value="html"
6928
+ data-ref="image-insert-mode-html" />
6929
+ HTML &lt;img&gt; with sizing
6930
+ </label>
6931
+ </fieldset>
6932
+ <label class="image-insert-field">
6933
+ <span>Alt text</span>
6934
+ <input type="text" data-ref="image-insert-alt" />
6935
+ </label>
6936
+ <div class="image-insert-grid">
6937
+ <label class="image-insert-field">
6938
+ <span>Size by</span>
6939
+ <select data-ref="image-insert-size-mode">
6940
+ <option value="original">Original size</option>
6941
+ <option value="width" selected>Width</option>
6942
+ <option value="height">Height</option>
6943
+ <option value="percent">Percent</option>
6944
+ </select>
6945
+ </label>
6946
+ <label class="image-insert-field">
6947
+ <span>Value</span>
6948
+ <input type="number" min="1" step="1" data-ref="image-insert-size-value" />
6949
+ </label>
6950
+ </div>
6951
+ <label class="image-insert-field">
6952
+ <span>Position</span>
6953
+ <select data-ref="image-insert-position">
6954
+ <option value="inline">Inline/default</option>
6955
+ <option value="left">Left</option>
6956
+ <option value="center">Center</option>
6957
+ <option value="right">Right</option>
6958
+ <option value="wrap-left">Wrap left</option>
6959
+ <option value="wrap-right">Wrap right</option>
6960
+ </select>
6961
+ </label>
6962
+ <div class="title-dialog-actions">
6963
+ <button type="button" data-action="cancel-image-insert">Cancel</button>
6964
+ <button type="button" class="save-title" data-ref="image-insert-confirm-btn">Insert</button>
6965
+ </div>
6966
+ </div>
6967
+ </div>
6968
+
6969
+ <div class="title-dialog-backdrop" data-ref="pack-files-dialog" hidden
6970
+ role="dialog" aria-modal="true" aria-labelledby="mdzip-pack-files-dialog-heading">
6971
+ <div class="title-dialog pack-files-dialog">
6972
+ <h3 id="mdzip-pack-files-dialog-heading">Package Markdown Files</h3>
6973
+ <p>These files contain more than one Markdown document. Choose how to package them.</p>
6974
+ <fieldset class="pack-files-options">
6975
+ <legend>Mode</legend>
6976
+ <label>
6977
+ <input type="radio" name="mdzip-pack-files-mode" value="document"
6978
+ data-ref="pack-files-mode-document" checked />
6979
+ Document — one primary page; the rest are attached
6980
+ </label>
6981
+ <label>
6982
+ <input type="radio" name="mdzip-pack-files-mode" value="project"
6983
+ data-ref="pack-files-mode-project" />
6984
+ Project — a set of related documents
6985
+ </label>
6986
+ </fieldset>
6987
+ <label class="pack-files-field">
6988
+ <span>Entry point</span>
6989
+ <select data-ref="pack-files-entry"></select>
6990
+ </label>
6991
+ <div class="title-dialog-actions">
6992
+ <button type="button" data-action="cancel-pack-files">Cancel</button>
6993
+ <button type="button" class="save-title" data-ref="pack-files-confirm-btn">Package</button>
6994
+ </div>
6995
+ </div>
6996
+ </div>
6997
+
6998
+ <div class="title-dialog-backdrop" data-ref="copy-render-dialog" hidden
6999
+ role="dialog" aria-modal="true" aria-labelledby="mdzip-copy-render-dialog-heading">
7000
+ <div class="title-dialog copy-render-dialog">
7001
+ <h3 id="mdzip-copy-render-dialog-heading" data-ref="copy-render-heading">Copying document...</h3>
7002
+ <div data-ref="copy-render-progress-section">
7003
+ <p data-ref="copy-render-progress-text">Rendering the full document...</p>
7004
+ <div class="copy-render-progress-track">
7005
+ <div class="copy-render-progress-bar" data-ref="copy-render-progress-bar"></div>
7006
+ </div>
7007
+ </div>
7008
+ <p data-ref="copy-render-ready-text" hidden>
7009
+ The document is ready. Browsers only allow a clipboard write right after a click, so this needs one more —
7010
+ click Copy to finish.
7011
+ </p>
7012
+ <p data-ref="copy-render-done-text" hidden></p>
7013
+ <div class="title-dialog-actions">
7014
+ <button type="button" data-action="cancel-copy-render" data-ref="copy-render-cancel-btn">Cancel</button>
7015
+ <button type="button" data-action="cancel-copy-ready" data-ref="copy-render-ready-cancel-btn" hidden>Cancel</button>
7016
+ <button type="button" class="save-title" data-action="confirm-copy-ready" data-ref="copy-render-confirm-btn" hidden>Copy</button>
7017
+ <button type="button" class="save-title" data-action="dismiss-copy-render" data-ref="copy-render-dismiss-btn" hidden>Dismiss</button>
7018
+ </div>
7019
+ </div>
7020
+ </div>
7021
+
7022
+ <div class="title-dialog-backdrop" data-ref="metadata-dialog" hidden
7023
+ role="dialog" aria-modal="true" aria-labelledby="mdzip-metadata-dialog-heading">
7024
+ <div class="title-dialog metadata-dialog">
7025
+ <h3 id="mdzip-metadata-dialog-heading">Document Information</h3>
7026
+ <dl data-ref="metadata-list"></dl>
7027
+ <h4>Libraries</h4>
7028
+ <dl data-ref="library-list"></dl>
7029
+ <div class="title-dialog-actions">
7030
+ <button type="button" class="save-title" data-action="close-metadata">Close</button>
7031
+ </div>
7032
+ </div>
7033
+ </div>
7034
+
7035
+ <div class="title-dialog-backdrop" data-ref="name-dialog" hidden
7036
+ role="dialog" aria-modal="true" aria-labelledby="mdzip-name-dialog-heading">
7037
+ <div class="title-dialog">
7038
+ <h3 id="mdzip-name-dialog-heading" data-ref="name-dialog-heading">New Markdown File</h3>
7039
+ <input type="text" maxlength="260" data-ref="name-input" aria-label="File name" />
7040
+ <p class="title-dialog-validation" data-ref="name-validation" hidden></p>
7041
+ <div class="title-dialog-actions">
7042
+ <button type="button" data-action="cancel-name">Cancel</button>
7043
+ <button type="button" class="save-title" data-ref="name-confirm-btn">Create</button>
7044
+ </div>
7045
+ </div>
7046
+ </div>
7047
+
7048
+ <div class="title-dialog-backdrop" data-ref="delete-dialog" hidden
7049
+ role="dialog" aria-modal="true" aria-labelledby="mdzip-delete-dialog-heading">
7050
+ <div class="title-dialog">
7051
+ <h3 id="mdzip-delete-dialog-heading">Delete File?</h3>
7052
+ <p data-ref="delete-dialog-text"></p>
7053
+ <div class="title-dialog-actions">
7054
+ <button type="button" data-action="cancel-delete">Cancel</button>
7055
+ <button type="button" class="danger-action" data-ref="delete-confirm-btn">Delete</button>
7056
+ </div>
7057
+ </div>
7058
+ </div>
7059
+
7060
+ <input type="file" data-ref="replace-input" hidden />
7061
+
7062
+ <div class="nav-context-menu" data-ref="nav-menu" hidden role="menu"></div>
7063
+
7064
+ <div class="mdzip-tooltip" data-ref="tooltip" role="tooltip" hidden></div>
7065
+
7066
+ <div class="mdzip-copy-toast" data-ref="copy-toast" role="status" aria-live="polite" hidden></div>
7067
+
7068
+ <p class="mdzip-empty" data-ref="empty-state">No MDZip workspace loaded.</p>
7069
+ </section>
7059
7070
  `;
7060
7071
  //# sourceMappingURL=view.js.map