visio-react-viewer 0.3.0 → 0.5.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 (33) hide show
  1. package/dist/index.js +4922 -2232
  2. package/dist/types/src/backstage.d.ts +15 -0
  3. package/dist/types/src/contract.d.ts +1 -1
  4. package/dist/types/src/controller.d.ts +5 -0
  5. package/dist/types/src/ribbon-action.d.ts +8 -1
  6. package/dist/types/src/ribbon-home-format.d.ts +2 -0
  7. package/dist/types/src/ribbon-home.d.ts +3 -3
  8. package/dist/types/src/ribbon-keytips.d.ts +2 -0
  9. package/dist/types/src/ribbon-other-tabs.d.ts +12 -0
  10. package/dist/types/src/ribbon-parts.d.ts +49 -9
  11. package/dist/types/src/ribbon-router.d.ts +3 -1
  12. package/dist/types/src/ribbon-view.d.ts +4 -1
  13. package/dist/types/src/ribbon.d.ts +9 -2
  14. package/dist/types/src/shapes-window.d.ts +28 -0
  15. package/dist/types/src/status-bar.d.ts +4 -1
  16. package/dist/types/src/styles.d.ts +1 -1
  17. package/dist/types/src/viewer-backstage.d.ts +33 -0
  18. package/dist/types/src/viewer-canvas.d.ts +21 -0
  19. package/dist/types/src/viewer-chrome.d.ts +9 -6
  20. package/dist/types/src/viewer-commands.d.ts +4 -1
  21. package/dist/types/src/viewer-context-menu.d.ts +8 -0
  22. package/dist/types/src/viewer-draw-tool.d.ts +16 -0
  23. package/dist/types/src/viewer-element.d.ts +7 -0
  24. package/dist/types/src/viewer-fit.d.ts +6 -0
  25. package/dist/types/src/viewer-input.d.ts +0 -2
  26. package/dist/types/src/viewer-options.d.ts +22 -0
  27. package/dist/types/src/viewer-pan-zoom.d.ts +19 -0
  28. package/dist/types/src/viewer-ruler.d.ts +13 -0
  29. package/dist/types/src/viewer-search.d.ts +18 -11
  30. package/dist/types/src/viewer-share.d.ts +20 -0
  31. package/dist/types/src/viewer-stencil.d.ts +6 -0
  32. package/dist/types/src/viewer-tell-me.d.ts +4 -0
  33. package/package.json +4 -4
@@ -0,0 +1,15 @@
1
+ import type { OfficeBackstageItem } from 'ooxml-ui/controls';
2
+ /** Visio's File (backstage) pages, in Visio's order. Save and Close act without a page. */
3
+ export declare const BACKSTAGE_ITEMS: readonly [readonly ["info", "Info"], readonly ["new", "New"], readonly ["open", "Open"], readonly ["save", "Save"], readonly ["save-as", "Save As"], readonly ["print", "Print"], readonly ["share", "Share"], readonly ["export", "Export"], readonly ["close", "Close"]];
4
+ export declare const BACKSTAGE_FOOTER: readonly [readonly ["account", "Account"], readonly ["feedback", "Feedback"], readonly ["options", "Options"]];
5
+ export type BackstagePage = Exclude<(typeof BACKSTAGE_ITEMS)[number][0] | (typeof BACKSTAGE_FOOTER)[number][0], 'save' | 'close' | 'options'>;
6
+ /** The navigation items, with optional disabled states (Save and Close follow the drawing). */
7
+ export declare function backstageItems(state?: Partial<Record<string, {
8
+ disabled: boolean;
9
+ title?: string;
10
+ }>>): OfficeBackstageItem[];
11
+ /**
12
+ * Visio's backstage: a full-window File view with a navigation column and one page per item.
13
+ * Static application structure only; document values are filled in later as text.
14
+ */
15
+ export declare function createBackstage(doc: Document): HTMLElement;
@@ -10,7 +10,7 @@ export interface ViewerEvents {
10
10
  'document-change': {
11
11
  document: VisioDocument;
12
12
  dirty: boolean;
13
- kind: 'edit' | 'undo' | 'redo';
13
+ kind: 'edit' | 'undo' | 'redo' | 'remote';
14
14
  };
15
15
  'document-error': Error;
16
16
  'page-change': number;
@@ -59,6 +59,11 @@ export declare class ViewerController {
59
59
  /** Atomic source-backed edits. Core owns protection, dependency and target validation. */
60
60
  applyEdits(edits: readonly VisioEdit[]): Promise<void>;
61
61
  undo(): Promise<void>;
62
+ /**
63
+ * Adopt a package from a shared session as one undoable history step. Emits `document-change`
64
+ * with kind `remote`, which a session must not publish back.
65
+ */
66
+ applyRemoteSource(bytes: Uint8Array): Promise<void>;
62
67
  redo(): Promise<void>;
63
68
  cancelEdit(): void;
64
69
  exportVsdx(): VsdxExportResult;
@@ -9,18 +9,25 @@ export type VisioRibbonAction = {
9
9
  type: 'delete';
10
10
  } | {
11
11
  type: 'pane';
12
- pane: 'pages' | 'inspector';
12
+ pane: 'shapes' | 'inspector';
13
13
  } | {
14
14
  type: 'reveal';
15
15
  panel: 'edit' | 'notes' | 'selection' | 'layers';
16
16
  focusText?: boolean;
17
17
  } | {
18
18
  type: 'grid';
19
+ } | {
20
+ type: 'panZoom';
21
+ } | {
22
+ type: 'ruler';
19
23
  } | {
20
24
  type: 'fullscreen';
21
25
  } | {
22
26
  type: 'zoom';
23
27
  mode: 'fit' | 'width' | 'actual';
28
+ } | {
29
+ type: 'zoomTo';
30
+ percent: number;
24
31
  } | {
25
32
  type: 'search';
26
33
  } | {
@@ -0,0 +1,2 @@
1
+ /** Visio's Home > Clipboard, Font and Paragraph groups, in Visio's layout. */
2
+ export declare function textGroups(doc: Document): [HTMLElement, HTMLElement, HTMLElement];
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Visio's Home tab, limited to commands this build can honestly perform: Undo, Tools and
3
- * Editing. Clipboard, Font, Paragraph, Shape Styles and Arrange wait for core edit commands.
4
- * The compact (phone) layout folds every group but Undo into the Tools disclosure.
2
+ * Microsoft Visio's Home tab, group for group: Clipboard, Font, Paragraph, Tools, Shape
3
+ * Styles, Arrange and Editing. Commands the core cannot perform yet are shown disabled with the
4
+ * missing capability in their tooltip. On phones every group folds into the Tools disclosure.
5
5
  */
6
6
  export declare function buildHomePanel(doc: Document, panel: HTMLElement): void;
@@ -0,0 +1,2 @@
1
+ /** Annotate the ribbon for KeyTips. Labels and ids are static application strings. */
2
+ export declare function applyKeyTips(toolbar: HTMLElement): void;
@@ -0,0 +1,12 @@
1
+ /** Visio's Insert tab: Pages, Illustrations, Diagram Parts, Links and Text. */
2
+ export declare function buildInsertPanel(doc: Document, panel: HTMLElement): void;
3
+ /** Visio's Design tab: Page Setup, Themes, Variants, Backgrounds and Layout. */
4
+ export declare function buildDesignPanel(doc: Document, panel: HTMLElement): void;
5
+ /** Visio's Data tab. Shape Data Window maps to the viewer's shape inspector. */
6
+ export declare function buildDataPanel(doc: Document, panel: HTMLElement): void;
7
+ /** Visio's Process tab. */
8
+ export declare function buildProcessPanel(doc: Document, panel: HTMLElement): void;
9
+ /** Visio's Review tab: Proofing, Language, Comments and Reports. */
10
+ export declare function buildReviewPanel(doc: Document, panel: HTMLElement): void;
11
+ /** Visio's Help tab. Help content, support and training are not bundled in this viewer. */
12
+ export declare function buildHelpPanel(doc: Document, panel: HTMLElement): void;
@@ -1,20 +1,60 @@
1
1
  import { type VisioRibbonAction } from './ribbon-action.js';
2
- /** A shared `office-ui-button` with Visio-specific state hooks. */
2
+ /** A shared `office-ui-*` command element with Visio state hooks. */
3
3
  export type RibbonCommand = HTMLElement & {
4
4
  disabled: boolean;
5
5
  };
6
6
  /**
7
- * A large stacked ribbon command. `id` is a stable name for state sync and tests; the typed
8
- * `action` is what runs. Labels, icons and shortcuts are static application strings.
7
+ * One ribbon command. `id` is a stable name for state sync and tests; the typed `action` is
8
+ * what runs. Without an action the command is shown, disabled, with `unsupported` explaining
9
+ * what is missing, so the ribbon matches Visio without claiming features it lacks.
9
10
  */
10
- export declare function tool(doc: Document, id: string, label: string, icon: string, action: VisioRibbonAction, options?: {
11
+ export interface CommandSpec {
12
+ id: string;
13
+ label: string;
14
+ icon?: string;
15
+ action?: VisioRibbonAction;
16
+ unsupported?: string;
17
+ /** `large` stacks icon over label; `small` is icon and label in a row; `icon` is icon-only. */
18
+ size?: 'large' | 'small' | 'icon';
11
19
  keys?: [aria: string, hint: string];
12
20
  pressed?: boolean;
13
21
  controls?: string;
14
- }): RibbonCommand;
15
- /** A labelled ribbon group (the shared `office-ui-ribbon-group`). */
16
- export declare function group(doc: Document, label: string, children: readonly HTMLElement[], className?: string): HTMLElement;
22
+ checked?: boolean;
23
+ }
24
+ export interface MenuSpec extends CommandSpec {
25
+ items: readonly CommandSpec[];
26
+ /** Split button: the main part runs `action`, the caret opens the menu. */
27
+ split?: boolean;
28
+ }
29
+ /** A shared `office-ui-button` in Visio's large, small or icon-only size. */
30
+ export declare function command(doc: Document, spec: CommandSpec): RibbonCommand;
31
+ /** A shared `office-ui-menu-button` (dropdown or split) with typed actions per item. */
32
+ export declare function menu(doc: Document, spec: MenuSpec): RibbonCommand;
33
+ /** Office's three-row column of small commands, or a row with `horizontal`. */
34
+ export declare function stack(doc: Document, children: readonly HTMLElement[], horizontal?: boolean): HTMLElement;
35
+ /** A labelled ribbon group; `launcher` shows Visio's dialog launcher, disabled with a reason. */
36
+ export declare function group(doc: Document, label: string, children: readonly HTMLElement[], options?: {
37
+ className?: string;
38
+ launcher?: string;
39
+ }): HTMLElement;
40
+ /** A labelled shared checkbox (Visio's View > Show options). */
41
+ export declare function check(doc: Document, spec: CommandSpec): HTMLElement;
42
+ /** A shared select shown as Visio's font or size combo; disabled until core supports it. */
43
+ export declare function combo(doc: Document, spec: {
44
+ id: string;
45
+ label: string;
46
+ placeholder: string;
47
+ width: number;
48
+ unsupported: string;
49
+ }): HTMLElement;
17
50
  /** A keyboard-navigable row of groups (the shared `office-ui-toolbar`). */
18
51
  export declare function commandRow(doc: Document, label: string, children: readonly HTMLElement[]): HTMLElement;
19
- /** Muted two-line guidance at the end of a ribbon panel. */
20
- export declare function hint(doc: Document, lines: readonly string[]): HTMLElement;
52
+ /**
53
+ * A shared `office-ui-context-menu` of typed commands and separators (`'-'`). Items without an
54
+ * action are shown disabled with their reason, as in the ribbon.
55
+ */
56
+ export declare function contextMenu(doc: Document, id: string, label: string, items: readonly (CommandSpec | '-')[]): HTMLElement & {
57
+ openAt(x: number, y: number): void;
58
+ close(): void;
59
+ open: boolean;
60
+ };
@@ -7,8 +7,10 @@ export interface RibbonTargets {
7
7
  deleteSelection(): void;
8
8
  setTool(tool: 'pointer' | 'rectangle'): void;
9
9
  toggleGrid(): void;
10
+ toggleRuler(): void;
11
+ togglePanZoom(): void;
10
12
  toggleFullscreen(): void;
11
- togglePane(pane: 'pages' | 'inspector'): void;
13
+ togglePane(pane: 'shapes' | 'inspector'): void;
12
14
  reveal(panel: 'edit' | 'notes' | 'selection' | 'layers', focusText: boolean): void;
13
15
  fit(mode: 'page' | 'width'): void;
14
16
  focusSearch(): void;
@@ -1,2 +1,5 @@
1
- /** Visio's View tab: Views, Show (grid and task panes) and Zoom. */
1
+ /**
2
+ * Microsoft Visio's View tab: Views, Show, Zoom, Visual Aids, Window and Macros. Ruler, Grid,
3
+ * Task Panes, Full Screen and every Zoom command work; the rest is shown disabled with a reason.
4
+ */
2
5
  export declare function buildViewPanel(doc: Document, panel: HTMLElement): void;
@@ -1,6 +1,13 @@
1
+ import { buildHomePanel } from './ribbon-home.js';
2
+ import { buildDataPanel, buildDesignPanel, buildHelpPanel, buildInsertPanel, buildProcessPanel, buildReviewPanel } from './ribbon-other-tabs.js';
3
+ import { buildViewPanel } from './ribbon-view.js';
1
4
  export type { VisioRibbonAction } from './ribbon-action.js';
5
+ /** Visio's ribbon tab order. File (backstage) belongs to the host application. */
6
+ export declare const RIBBON_TABS: readonly [readonly ["home", "Home", typeof buildHomePanel], readonly ["insert", "Insert", typeof buildInsertPanel], readonly ["design", "Design", typeof buildDesignPanel], readonly ["data", "Data", typeof buildDataPanel], readonly ["process", "Process", typeof buildProcessPanel], readonly ["review", "Review", typeof buildReviewPanel], readonly ["view", "View", typeof buildViewPanel], readonly ["help", "Help", typeof buildHelpPanel]];
7
+ export type RibbonTab = (typeof RIBBON_TABS)[number][0];
2
8
  /**
3
- * The Visio ribbon: a tab list and one panel per tab. Tab switching and keyboard movement
4
- * belong to the chrome; commands emit `ribbon-action` events for the router.
9
+ * The Visio ribbon on the shared `office-ui-ribbon`: Quick Access Toolbar, File, one panel per
10
+ * tab and Tell me. The shared element owns the tab row, selection and arrow-key movement;
11
+ * commands emit `ribbon-action` events for the router.
5
12
  */
6
13
  export declare function createRibbon(doc: Document): HTMLElement;
@@ -0,0 +1,28 @@
1
+ /** Drag payload type for a stencil master; the value is the master id. */
2
+ export declare const MASTER_MIME = "application/x-visio-viewer-master";
3
+ interface Master {
4
+ id: string;
5
+ name: string;
6
+ /** Preview outline in a 24x24 box (static application geometry). */
7
+ path: string;
8
+ /** Default size in inches when dropped. */
9
+ size?: {
10
+ width: number;
11
+ height: number;
12
+ };
13
+ }
14
+ /** Visio's Basic Shapes stencil, in Visio's order. */
15
+ export declare const BASIC_SHAPES: readonly Master[];
16
+ /**
17
+ * Visio's Shapes window: Stencils and Search views, More Shapes and Quick Shapes rows and the
18
+ * Basic Shapes stencil. Masters are dragged onto the page; Enter adds one at the page centre.
19
+ */
20
+ export declare function createShapesWindow(doc: Document): HTMLElement;
21
+ /** Default size of a stencil master the viewer can create, or nothing when unsupported. */
22
+ export declare function masterSize(id: string): {
23
+ width: number;
24
+ height: number;
25
+ } | undefined;
26
+ /** Visio's minimised Shapes window: a narrow strip that reopens the window. */
27
+ export declare function createShapesStrip(doc: Document): HTMLButtonElement;
28
+ export {};
@@ -3,5 +3,8 @@
3
3
  * message region, compatibility notes, the host footer slot and the shared zoom slider.
4
4
  */
5
5
  export declare function createStatusBar(doc: Document): HTMLElement;
6
- /** Visio's page tabs under the drawing, on the shared document tab strip. */
6
+ /**
7
+ * Visio's page bar under the drawing: the All pages list, the shared document tab strip and
8
+ * Insert Page, which stays disabled until core can add pages.
9
+ */
7
10
  export declare function createPageTabs(doc: Document): HTMLElement;
@@ -1,2 +1,2 @@
1
1
  /** Inherited public tokens use local fallback aliases so host themes are never shadowed. */
2
- export declare const viewerStyles = "\n:host {\n --_vv-bg:var(--vv-background,#eceae8); --_vv-surface:var(--vv-surface,#fff);\n --_vv-secondary:var(--vv-secondary,#f3f2f1); --_vv-ink:var(--vv-ink,#1f1f1f);\n --_vv-muted:var(--vv-muted,#605e5c); --_vv-border:var(--vv-border,#e1dfdd);\n --_vv-accent:var(--vv-accent,#3955a3); --_vv-accent-soft:var(--vv-accent-soft,rgba(57,85,163,.10));\n display:flex; flex-direction:column; min-width:0; min-height:320px; height:100%; overflow:hidden;\n color:var(--_vv-ink); background:var(--_vv-bg); font:12px/1.5 \"Segoe UI\",Arial,sans-serif; contain:layout;\n}\n* { box-sizing:border-box; }\n[hidden] { display:none !important; }\nbutton,select,input,textarea { font:inherit; color:inherit; border:1px solid var(--_vv-border); background:var(--_vv-surface); border-radius:4px; min-height:28px; padding:3px 8px; }\nbutton { cursor:pointer; }\nbutton:hover:enabled { background:var(--_vv-accent-soft); border-color:var(--_vv-accent); }\nbutton:disabled { opacity:.4; cursor:default; }\nbutton:focus-visible,select:focus-visible,input:focus-visible,textarea:focus-visible,summary:focus-visible,[tabindex]:focus-visible { outline:2px solid var(--vv-focus,var(--_vv-accent)); outline-offset:2px; }\nbutton[aria-pressed=\"true\"] { color:var(--_vv-accent); background:var(--_vv-accent-soft); }\n.toolbar { flex:none; min-width:0; border-bottom:1px solid var(--_vv-border); background:var(--_vv-surface); }\n.spacer { flex:1; }\n.ribbon-tabs { height:35px; display:flex; align-items:stretch; padding:0 4px; border-bottom:1px solid var(--_vv-border); }\n.ribbon-tabs button { position:relative; min-height:34px; padding:7px 14px; border:0; border-radius:0; background:transparent; color:var(--_vv-muted); font-size:12px; font-weight:500; }\n.ribbon-tabs button[aria-selected=\"true\"] { color:var(--_vv-accent); }\n.ribbon-tabs button[aria-selected=\"true\"]::after { content:\"\"; position:absolute; inset:auto 0 -1px; height:2.5px; background:var(--_vv-accent); }\n.ribbon-content { min-height:82px; display:flex; align-items:stretch; gap:0; padding:2px 4px; overflow-x:auto; }\n.ribbon-group { display:flex; flex-direction:column; justify-content:space-between; flex:none; gap:2px; padding:3px 10px 4px; border-right:1px solid var(--_vv-border); }\n.group-label { font-size:10px; line-height:12px; color:var(--_vv-muted); text-align:center; }\n.ribbon-actions { display:flex; align-items:stretch; gap:2px; flex:1; }\n.ribbon-command { display:flex; flex-direction:column; justify-content:center; align-items:center; gap:2px; min-width:70px; padding:2px 6px; border-color:transparent; background:transparent; font-size:11px; white-space:nowrap; }\n.ribbon-hint { align-self:center; flex:none; margin:0; padding:0 16px; font-size:11px; line-height:18px; color:var(--_vv-muted); }\n.search-group { width:330px; }\n.search-controls { display:flex; align-items:center; gap:4px; flex-wrap:wrap; }\n.search-controls label { display:flex; align-items:center; min-width:0; gap:6px; flex:1; font-size:11px; }\n.search-controls input { width:100%; min-width:0; padding:3px 6px; font-size:11px; }\n.search-controls button { padding:3px 6px; font-size:10px; background:var(--_vv-secondary); }\n.search-controls [role=\"status\"] { display:block; width:100%; min-height:15px; font-size:10px; line-height:15px; color:var(--_vv-muted); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }\n.workspace { position:relative; display:flex; flex:1; min-width:0; min-height:0; overflow:hidden; }\n.page-rail { flex:0 0 180px; width:180px; min-width:0; overflow:auto; border-right:1px solid var(--_vv-border); background:var(--_vv-secondary); }\n.pane-heading { height:37px; display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 10px; border-bottom:1px solid var(--_vv-border); font-size:11px; font-weight:600; }\n.pane-heading [data-page-count],.inspector-kind { color:var(--_vv-muted); font-size:10px; font-weight:400; }\n.page-list { list-style:none; padding:8px 5px; margin:0; display:flex; flex-direction:column; gap:4px; }\n.page-link { display:flex; align-items:center; position:relative; width:100%; min-width:0; gap:4px; padding:4px 5px 4px 2px; border:0; border-radius:0; background:transparent; color:var(--_vv-muted); text-align:left; }\n.page-link[aria-current=\"page\"] { background:var(--_vv-accent-soft); }\n.page-link[aria-current=\"page\"]::before { content:\"\"; position:absolute; left:0; top:4px; bottom:4px; width:3px; border-radius:0 2px 2px 0; background:var(--_vv-accent); }\n.page-number { flex:0 0 20px; width:20px; padding-right:3px; font-size:10px; text-align:right; }\n.page-card { display:flex; flex-direction:column; align-items:flex-start; min-width:0; width:100%; min-height:98px; gap:3px; padding:10px; border:1px solid var(--_vv-border); border-radius:2px; background:var(--_vv-surface); }\n.page-link[aria-current=\"page\"] .page-card { border-color:var(--_vv-accent); }\n.page-link[aria-current=\"page\"] .page-number { color:var(--_vv-accent); font-weight:600; }\n.page-mark { color:var(--_vv-muted); font-size:20px; line-height:23px; }\n.page-name { color:var(--_vv-ink); font-size:11px; font-weight:500; line-height:16px; overflow-wrap:anywhere; }\n.page-meta { color:var(--_vv-muted); font-size:9px; line-height:14px; }\n.page-empty { margin:12px; color:var(--_vv-muted); font-size:11px; }\n.viewport { position:relative; display:flex; flex-direction:column; flex:1; overflow:auto; min-width:0; min-height:0; padding:16px 4px; background:var(--_vv-bg); }\n.paper { display:block; flex:none; background:white; box-shadow:var(--vv-shadow,0 2px 8px rgb(0 0 0 / 14%)); margin:auto; }\n.paper [data-shape-id] { cursor:pointer; }\n.paper [data-selected=\"true\"] > [data-geometry] { stroke:var(--_vv-accent) !important; stroke-width:.025 !important; }\n.inspector-pane { flex:0 0 288px; width:288px; min-width:0; overflow:auto; border-left:1px solid var(--_vv-border); background:var(--_vv-secondary); }\n.inspector-body { display:flex; flex-direction:column; gap:12px; padding:12px 10px; }\n.inspector-card,.edit-controls,.layer-controls { min-width:0; padding:8px; margin:0; border:1px solid var(--_vv-border); border-radius:4px; background:var(--_vv-surface); font-size:11px; line-height:17px; }\n.document-card h2 { margin:0 0 8px; font-size:10px; font-weight:500; letter-spacing:.5px; text-transform:uppercase; color:var(--_vv-muted); }\n.current-page-name { margin:0 0 8px; font-size:12px; font-weight:500; overflow-wrap:anywhere; }\n.document-card dl { display:grid; grid-template-columns:1fr auto; gap:4px 10px; margin:0; font-size:11px; }\n.document-card dt { color:var(--_vv-muted); }\n.document-card dd { margin:0; text-align:right; overflow-wrap:anywhere; }\n.selection-hint { margin:0; padding:0 2px; color:var(--_vv-muted); font-size:11px; }\nsummary { cursor:pointer; min-height:22px; line-height:22px; font-weight:500; }\nsummary::marker { color:var(--_vv-muted); font-size:10px; }\n.shape-inspector div { max-height:260px; overflow:auto; }\n.shape-inspector p { margin:6px 0; overflow-wrap:anywhere; }\n.shape-inspector dl { display:grid; grid-template-columns:minmax(60px,1fr) 1.5fr; gap:6px 10px; }\n.shape-inspector dt { font-weight:500; }\n.shape-inspector dd { margin:0; overflow-wrap:anywhere; white-space:pre-wrap; }\n.shape-inspector h3 { margin:12px 0 5px; font-size:11px; }\n.shape-inspector a { color:var(--_vv-accent); overflow-wrap:anywhere; }\n.edit-controls p,.layer-controls p { margin:6px 0; color:var(--_vv-muted); overflow-wrap:anywhere; }\n.edit-controls textarea { display:block; width:100%; resize:vertical; max-height:180px; margin-top:4px; background:var(--_vv-secondary); }\n.edit-controls label { display:block; margin-top:8px; }\n.edit-actions { display:flex; flex-wrap:wrap; gap:4px; margin-top:8px; }\n.edit-actions button { font-size:11px; padding:3px 7px; }\n.edit-actions [data-edit=\"apply\"]:enabled { background:var(--_vv-accent); border-color:var(--_vv-accent); color:var(--vv-accent-ink,#fff); }\n.edit-controls [data-geometry] { min-width:0; margin:8px 0 0; padding:6px; border:1px solid var(--_vv-border); }\n.edit-controls [data-geometry-field] { display:block; width:100%; min-width:0; margin-top:4px; }\n.edit-controls [data-geometry-error] { color:var(--vv-danger,#b42318); }\n.edit-controls [data-edit-error] { color:var(--vv-danger,#b42318); }\n.edit-controls [data-edit-diagnostics] { max-height:100px; overflow:auto; padding-left:16px; }\n.layer-controls [data-layer-list] { max-height:240px; overflow:auto; }\n.layer-controls fieldset { border:1px solid var(--_vv-border); margin:6px 0; padding:6px; min-width:0; }\n.layer-controls legend { max-width:100%; overflow-wrap:anywhere; }\n.layer-controls fieldset div { display:flex; align-items:center; gap:6px; margin:3px 0; }\n.layer-controls label { display:flex; align-items:center; gap:6px; overflow-wrap:anywhere; }\n.layer-controls input { flex-shrink:0; width:16px; height:16px; min-height:16px; padding:0; accent-color:var(--_vv-accent); }\n.notes ul { max-height:220px; overflow:auto; padding-left:17px; margin:6px 0 0; color:var(--_vv-muted); }\n.notes li { margin:5px 0; overflow-wrap:anywhere; }\n.notes-strip { flex:none; display:flex; align-items:center; justify-content:space-between; min-height:25.5px; padding:0 12px; border-top:1px solid var(--_vv-border); background:var(--_vv-bg); color:var(--_vv-muted); font-size:10px; }\n.notes-strip button { min-height:24.5px; padding:2px 0; border:0; background:transparent; color:var(--_vv-muted); font-size:11px; }\n.notes-strip button::before { content:\"\u25B8\"; margin-right:6px; }\n.notes-strip button[aria-expanded=\"true\"]::before { content:\"\u25BE\"; }\n.status { flex:none; display:flex; align-items:center; justify-content:space-between; gap:12px; min-width:0; min-height:29px; padding:0 8px 0 12px; border-top:1px solid var(--_vv-border); color:var(--_vv-muted); background:var(--_vv-surface); font-size:10px; }\n.status-message { display:flex; gap:16px; min-width:0; }\n.status-message span { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }\n.empty { max-width:360px; margin:60px auto; padding:16px; text-align:center; color:var(--_vv-muted); font-size:12px; }\n.empty strong { display:block; color:var(--_vv-ink); font-size:18px; font-weight:500; margin-bottom:8px; }\n@media(max-width:1100px) { .ribbon-hint { display:none; } [data-diagnostics] { display:none; } }\n@media(max-width:760px) {\n button,select,input,textarea { min-height:44px; }\n button { min-width:44px; }\n summary { min-height:44px; line-height:44px; }\n .ribbon-tabs { height:44px; }\n .ribbon-tabs button { min-height:44px; padding:8px 16px; }\n .ribbon-content { min-height:86px; }\n .ribbon-group { padding:4px 8px; }\n .search-group { width:100%; border-right:0; }\n .search-controls { gap:4px; }\n .search-controls label { font-size:12px; }\n .search-controls input { font-size:12px; }\n .search-controls button { min-width:44px; font-size:0; padding:3px; }\n .search-controls [data-action=\"search-previous\"]::before { content:\"\u2039\"; font-size:22px; }\n .search-controls [data-action=\"search-next\"]::before { content:\"\u203A\"; font-size:22px; }\n #home-panel>.ribbon-group:not(.search-group):not(.undo-group) { display:none; }\n .ribbon-command { min-width:90px; }\n .workspace { display:block; overflow:auto; }\n .page-rail { width:100%; max-height:190px; border-right:0; border-bottom:1px solid var(--_vv-border); }\n .page-list { flex-direction:row; overflow-x:auto; }\n .page-list li { flex:0 0 155px; }\n .page-card { min-height:86px; }\n .viewport { height:340px; min-height:260px; padding:16px 4px; }\n .inspector-pane { width:100%; overflow:visible; border-left:0; border-top:1px solid var(--_vv-border); }\n .inspector-body { gap:8px; padding:10px; }\n .inspector-card,.edit-controls,.layer-controls { font-size:12px; }\n .layer-controls label { min-height:44px; }\n .layer-controls input { min-width:20px; width:20px; height:20px; min-height:20px; }\n .notes-strip { min-height:44px; padding:0 10px; }\n .notes-strip button { min-height:44px; }\n .status { flex-wrap:wrap; gap:0; padding:4px 8px; }\n .status-message { width:100%; min-height:18px; }\n}\n@media(pointer:coarse) {\n button,select,input,textarea { min-height:44px; }\n button { min-width:44px; }\n summary,.layer-controls label { min-height:44px; line-height:44px; }\n .ribbon-tabs { min-height:44px; height:44px; }\n .ribbon-tabs button { min-height:44px; }\n .ribbon-content { min-height:96px; }\n .search-group { width:380px; max-width:100%; }\n .notes-strip button { min-height:44px; height:44px; }\n .layer-controls input { min-height:20px; }\n}\n/* Suite ribbon: tabs lead directly into Visio command groups. */\n.ribbon-tabs { height:40px; }\n.ribbon-tabs button { min-height:39px; padding:8px 16px; }\n.ribbon-content { min-height:104px; padding:4px 4px; }\n.search-group { order:2; width:320px; }\n.ribbon-hint { order:3; padding:10px 18px; }\n.ribbon-command { min-width:82px; }\n.pane-close { display:none; }\n@media(max-width:760px) {\n .ribbon-tabs { height:44px; }\n .ribbon-tabs button { min-height:44px; }\n .ribbon-content { min-height:54px; padding:4px 0; }\n .search-group { flex:0 0 100%; width:100%; min-height:54px; }\n .search-feedback,.group-label { display:none; }\n .ribbon-content { overflow-x:auto; scroll-snap-type:x mandatory; }\n .workspace { display:flex; position:relative; overflow:hidden; }\n .viewport { flex:1; width:100%; height:100%; min-height:0; padding:16px 4px; }\n .inspector-pane { position:absolute; inset:0 0 0 auto; width:min(320px,100%); z-index:4; overflow:auto; border-left:1px solid var(--_vv-border); box-shadow:-8px 0 24px #0002; }\n .pane-close { display:block; width:44px; height:44px; padding:0; font-size:22px; background:transparent; border:0; }\n .inspector-kind { margin-left:auto; }\n .page-rail { position:absolute; inset:0 auto 0 0; width:180px; max-height:none; z-index:3; border-right:1px solid var(--_vv-border); background:var(--_vv-secondary); }\n .page-list { flex-direction:column; }\n .page-list li { flex:none; }\n .notes-strip { display:none; }\n .status { min-height:48px; padding:2px 8px; }\n .status-message { display:none; }\n}\n.toolbar { position:relative; }\n.ribbon-tools { display:flex; flex:none; order:0; }\n.tools-content { display:flex; align-items:stretch; }\n.ribbon-tools>summary { display:none; }\n.ribbon-command { font-size:12px; min-width:88px; }\n.ribbon-hint { font-size:12px; line-height:20px; flex:1; }\n.group-label { font-size:11px; line-height:14px; }\n.inspector-card,.edit-controls,.layer-controls { font-size:12px; line-height:18px; }\n.selection-hint,.document-card dl { font-size:12px; }\n.pane-heading { font-size:12px; }\n.inspector-pane .pane-heading { position:sticky; top:0; z-index:1; background:var(--_vv-secondary); flex:none; }\n.status .notes-strip { border:0; padding:0 8px; background:transparent; min-height:28px; }\n.status .notes-strip>span { display:none; }\n.status-message { flex:1; }\n@media(max-width:760px) {\n #home-panel { overflow:visible; min-height:54px; padding:4px; }\n .ribbon-tools { display:block; flex:0 0 84px; width:84px; order:1; }\n .ribbon-tools>summary { display:flex; min-height:44px; align-items:center; justify-content:center; gap:6px; padding:0 10px; border:1px solid var(--_vv-border); background:var(--_vv-surface); border-radius:4px; font-size:12px; cursor:pointer; list-style:none; }\n .ribbon-tools>summary::-webkit-details-marker { display:none; }\n .ribbon-tools .tools-content { display:flex; position:absolute; top:100%; left:4px; right:4px; z-index:6; flex-direction:column; padding:12px; gap:12px; border:1px solid var(--_vv-border); border-radius:4px; background:var(--_vv-surface); box-shadow:0 12px 28px #0003; max-height:60vh; overflow:auto; }\n .ribbon-tools:not([open])>.tools-content { display:none; }\n .ribbon-tools .ribbon-group { display:flex; width:100%; min-height:64px; border:0; padding:0; }\n .ribbon-tools .ribbon-actions { justify-content:space-between; }\n .ribbon-tools .ribbon-command { min-width:88px; font-size:12px; }\n .ribbon-tools .search-group { order:1; flex:auto; }\n .ribbon-tools .search-feedback { display:block; }\n .status { flex-wrap:nowrap; gap:4px; min-height:48px; }\n .status .notes-strip { display:none; }\n}\n@media(pointer:coarse) { .ribbon-tabs {height:45px;min-height:45px;} .ribbon-tabs button {min-height:44px;height:44px;} }\n@media(prefers-reduced-motion:reduce) { * { scroll-behavior:auto !important; } }\n";
2
+ export declare const viewerStyles = "\n:host {\n --_vv-bg:var(--vv-background,#eceae8); --_vv-surface:var(--vv-surface,#fff);\n --_vv-secondary:var(--vv-secondary,#f3f2f1); --_vv-ink:var(--vv-ink,#1f1f1f);\n --_vv-muted:var(--vv-muted,#605e5c); --_vv-border:var(--vv-border,#e1dfdd);\n --_vv-accent:var(--vv-accent,#3955a3); --_vv-accent-soft:var(--vv-accent-soft,rgba(57,85,163,.10));\n display:flex; flex-direction:column; min-width:0; min-height:320px; height:100%; overflow:hidden;\n color:var(--_vv-ink); background:var(--_vv-bg); font:12px/1.5 \"Segoe UI\",Arial,sans-serif; contain:layout;\n}\n* { box-sizing:border-box; }\n[hidden] { display:none !important; }\nbutton,select,input,textarea { font:inherit; color:inherit; border:1px solid var(--_vv-border); background:var(--_vv-surface); border-radius:4px; min-height:28px; padding:3px 8px; }\nbutton { cursor:pointer; }\nbutton:hover:enabled { background:var(--_vv-accent-soft); border-color:var(--_vv-accent); }\nbutton:disabled { opacity:.4; cursor:default; }\nbutton:focus-visible,select:focus-visible,input:focus-visible,textarea:focus-visible,summary:focus-visible,[tabindex]:focus-visible { outline:2px solid var(--vv-focus,var(--_vv-accent)); outline-offset:2px; }\nbutton[aria-pressed=\"true\"] { color:var(--_vv-accent); background:var(--_vv-accent-soft); }\n.toolbar { flex:none; min-width:0; border-bottom:1px solid var(--_vv-border); background:var(--_vv-surface); }\n.spacer { flex:1; }\n.ribbon-content { min-height:82px; display:flex; align-items:stretch; gap:0; padding:2px 4px; overflow-x:auto; }\n.ribbon-group { display:flex; flex-direction:column; justify-content:space-between; flex:none; gap:2px; padding:3px 10px 4px; border-right:1px solid var(--_vv-border); }\n.group-label { font-size:10px; line-height:12px; color:var(--_vv-muted); text-align:center; }\n.ribbon-actions { display:flex; align-items:stretch; gap:2px; flex:1; }\n.ribbon-command { display:flex; flex-direction:column; justify-content:center; align-items:center; gap:2px; min-width:70px; padding:2px 6px; border-color:transparent; background:transparent; font-size:11px; white-space:nowrap; }\n.ribbon-hint { align-self:center; flex:none; margin:0; padding:0 16px; font-size:11px; line-height:18px; color:var(--_vv-muted); }\n.workspace { position:relative; display:flex; flex:1; min-width:0; min-height:0; overflow:hidden; }\n.pane-heading { height:37px; display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 10px; border-bottom:1px solid var(--_vv-border); font-size:11px; font-weight:600; }\n.inspector-kind { color:var(--_vv-muted); font-size:10px; font-weight:400; }\n.viewport { position:relative; display:flex; flex-direction:column; flex:1; overflow:auto; min-width:0; min-height:0; padding:16px 4px; background:var(--_vv-bg); }\n.paper { display:block; flex:none; background:white; box-shadow:var(--vv-shadow,0 2px 8px rgb(0 0 0 / 14%)); margin:auto; }\n.paper [data-shape-id] { cursor:pointer; }\n.paper [data-selected=\"true\"] > [data-geometry] { stroke:var(--_vv-accent) !important; stroke-width:.025 !important; }\n.inspector-pane { flex:0 0 288px; width:288px; min-width:0; overflow:auto; border-left:1px solid var(--_vv-border); background:var(--_vv-secondary); }\n.inspector-body { display:flex; flex-direction:column; gap:12px; padding:12px 10px; }\n.inspector-card,.edit-controls,.layer-controls { min-width:0; padding:8px; margin:0; border:1px solid var(--_vv-border); border-radius:4px; background:var(--_vv-surface); font-size:11px; line-height:17px; }\n.document-card h2 { margin:0 0 8px; font-size:10px; font-weight:500; letter-spacing:.5px; text-transform:uppercase; color:var(--_vv-muted); }\n.current-page-name { margin:0 0 8px; font-size:12px; font-weight:500; overflow-wrap:anywhere; }\n.document-card dl { display:grid; grid-template-columns:1fr auto; gap:4px 10px; margin:0; font-size:11px; }\n.document-card dt { color:var(--_vv-muted); }\n.document-card dd { margin:0; text-align:right; overflow-wrap:anywhere; }\n.selection-hint { margin:0; padding:0 2px; color:var(--_vv-muted); font-size:11px; }\nsummary { cursor:pointer; min-height:22px; line-height:22px; font-weight:500; }\nsummary::marker { color:var(--_vv-muted); font-size:10px; }\n.shape-inspector div { max-height:260px; overflow:auto; }\n.shape-inspector p { margin:6px 0; overflow-wrap:anywhere; }\n.shape-inspector dl { display:grid; grid-template-columns:minmax(60px,1fr) 1.5fr; gap:6px 10px; }\n.shape-inspector dt { font-weight:500; }\n.shape-inspector dd { margin:0; overflow-wrap:anywhere; white-space:pre-wrap; }\n.shape-inspector h3 { margin:12px 0 5px; font-size:11px; }\n.shape-inspector a { color:var(--_vv-accent); overflow-wrap:anywhere; }\n.edit-controls p,.layer-controls p { margin:6px 0; color:var(--_vv-muted); overflow-wrap:anywhere; }\n.edit-controls textarea { display:block; width:100%; resize:vertical; max-height:180px; margin-top:4px; background:var(--_vv-secondary); }\n.edit-controls label { display:block; margin-top:8px; }\n.edit-actions { display:flex; flex-wrap:wrap; gap:4px; margin-top:8px; }\n.edit-actions button { font-size:11px; padding:3px 7px; }\n.edit-actions [data-edit=\"apply\"]:enabled { background:var(--_vv-accent); border-color:var(--_vv-accent); color:var(--vv-accent-ink,#fff); }\n.edit-controls [data-geometry] { min-width:0; margin:8px 0 0; padding:6px; border:1px solid var(--_vv-border); }\n.edit-controls [data-geometry-field] { display:block; width:100%; min-width:0; margin-top:4px; }\n.edit-controls [data-geometry-error] { color:var(--vv-danger,#b42318); }\n.edit-controls [data-edit-error] { color:var(--vv-danger,#b42318); }\n.edit-controls [data-edit-diagnostics] { max-height:100px; overflow:auto; padding-left:16px; }\n.layer-controls [data-layer-list] { max-height:240px; overflow:auto; }\n.layer-controls fieldset { border:1px solid var(--_vv-border); margin:6px 0; padding:6px; min-width:0; }\n.layer-controls legend { max-width:100%; overflow-wrap:anywhere; }\n.layer-controls fieldset div { display:flex; align-items:center; gap:6px; margin:3px 0; }\n.layer-controls label { display:flex; align-items:center; gap:6px; overflow-wrap:anywhere; }\n.layer-controls input { flex-shrink:0; width:16px; height:16px; min-height:16px; padding:0; accent-color:var(--_vv-accent); }\n.notes ul { max-height:220px; overflow:auto; padding-left:17px; margin:6px 0 0; color:var(--_vv-muted); }\n.notes li { margin:5px 0; overflow-wrap:anywhere; }\n.notes-strip { flex:none; display:flex; align-items:center; justify-content:space-between; min-height:25.5px; padding:0 12px; border-top:1px solid var(--_vv-border); background:var(--_vv-bg); color:var(--_vv-muted); font-size:10px; }\n.notes-strip button { min-height:24.5px; padding:2px 0; border:0; background:transparent; color:var(--_vv-muted); font-size:11px; }\n.notes-strip button::before { content:\"\u25B8\"; margin-right:6px; }\n.notes-strip button[aria-expanded=\"true\"]::before { content:\"\u25BE\"; }\n.status { flex:none; display:flex; align-items:center; justify-content:space-between; gap:12px; min-width:0; min-height:29px; padding:0 8px 0 12px; border-top:1px solid var(--_vv-border); color:var(--_vv-muted); background:var(--_vv-surface); font-size:10px; }\n.status-message { display:flex; gap:16px; min-width:0; }\n.status-message span { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }\n.empty { max-width:360px; margin:60px auto; padding:16px; text-align:center; color:var(--_vv-muted); font-size:12px; }\n.empty strong { display:block; color:var(--_vv-ink); font-size:18px; font-weight:500; margin-bottom:8px; }\n@media(max-width:1100px) { .ribbon-hint { display:none; } [data-diagnostics] { display:none; } }\n@media(max-width:760px) {\n button,select,input,textarea { min-height:44px; }\n button { min-width:44px; }\n summary { min-height:44px; line-height:44px; }\n .ribbon-content { min-height:86px; }\n .ribbon-group { padding:4px 8px; }\n #home-panel>.ribbon-group:not(.search-group):not(.undo-group) { display:none; }\n .ribbon-command { min-width:90px; }\n .workspace { display:block; overflow:auto; }\n .viewport { height:340px; min-height:260px; padding:16px 4px; }\n .inspector-pane { width:100%; overflow:visible; border-left:0; border-top:1px solid var(--_vv-border); }\n .inspector-body { gap:8px; padding:10px; }\n .inspector-card,.edit-controls,.layer-controls { font-size:12px; }\n .layer-controls label { min-height:44px; }\n .layer-controls input { min-width:20px; width:20px; height:20px; min-height:20px; }\n .notes-strip { min-height:44px; padding:0 10px; }\n .notes-strip button { min-height:44px; }\n .status { flex-wrap:wrap; gap:0; padding:4px 8px; }\n .status-message { width:100%; min-height:18px; }\n}\n@media(pointer:coarse) {\n button,select,input,textarea { min-height:44px; }\n button { min-width:44px; }\n summary,.layer-controls label { min-height:44px; line-height:44px; }\n .ribbon-content { min-height:96px; }\n .notes-strip button { min-height:44px; height:44px; }\n .layer-controls input { min-height:20px; }\n}\n/* Suite ribbon: tabs lead directly into Visio command groups. */\n.ribbon-content { min-height:104px; padding:4px 4px; }\n.ribbon-hint { order:3; padding:10px 18px; }\n.ribbon-command { min-width:82px; }\n.pane-close { display:none; }\n@media(max-width:760px) {\n .ribbon-content { min-height:54px; padding:4px 0; }\n .search-feedback,.group-label { display:none; }\n .ribbon-content { overflow-x:auto; scroll-snap-type:x mandatory; }\n .workspace { display:flex; position:relative; overflow:hidden; }\n .viewport { flex:1; width:100%; height:100%; min-height:0; padding:16px 4px; }\n .inspector-pane { position:absolute; inset:0 0 0 auto; width:min(320px,100%); z-index:4; overflow:auto; border-left:1px solid var(--_vv-border); box-shadow:-8px 0 24px #0002; }\n .pane-close { display:block; width:44px; height:44px; padding:0; font-size:22px; background:transparent; border:0; }\n .inspector-kind { margin-left:auto; }\n .notes-strip { display:none; }\n .status { min-height:48px; padding:2px 8px; }\n .status-message { display:none; }\n}\n.toolbar { position:relative; }\n.ribbon-tools { display:flex; flex:none; order:0; }\n.tools-content { display:flex; align-items:stretch; }\n.ribbon-tools>summary { display:none; }\n.ribbon-command { font-size:12px; min-width:88px; }\n.ribbon-hint { font-size:12px; line-height:20px; flex:1; }\n.group-label { font-size:11px; line-height:14px; }\n.inspector-card,.edit-controls,.layer-controls { font-size:12px; line-height:18px; }\n.selection-hint,.document-card dl { font-size:12px; }\n.pane-heading { font-size:12px; }\n.inspector-pane .pane-heading { position:sticky; top:0; z-index:1; background:var(--_vv-secondary); flex:none; }\n.status .notes-strip { border:0; padding:0 8px; background:transparent; min-height:28px; }\n.status .notes-strip>span { display:none; }\n.status-message { flex:1; }\n@media(max-width:760px) {\n #home-panel { overflow:visible; min-height:54px; padding:4px; }\n .ribbon-tools { display:block; flex:0 0 84px; width:84px; order:1; }\n .ribbon-tools>summary { display:flex; min-height:44px; align-items:center; justify-content:center; gap:6px; padding:0 10px; border:1px solid var(--_vv-border); background:var(--_vv-surface); border-radius:4px; font-size:12px; cursor:pointer; list-style:none; }\n .ribbon-tools>summary::-webkit-details-marker { display:none; }\n .ribbon-tools .tools-content { display:flex; position:absolute; top:100%; left:4px; right:4px; z-index:6; flex-direction:column; padding:12px; gap:12px; border:1px solid var(--_vv-border); border-radius:4px; background:var(--_vv-surface); box-shadow:0 12px 28px #0003; max-height:60vh; overflow:auto; }\n .ribbon-tools:not([open])>.tools-content { display:none; }\n .ribbon-tools .ribbon-group { display:flex; width:100%; min-height:64px; border:0; padding:0; }\n .ribbon-tools .ribbon-actions { justify-content:space-between; }\n .ribbon-tools .ribbon-command { min-width:88px; font-size:12px; }\n .ribbon-tools .search-feedback { display:block; }\n .status { flex-wrap:nowrap; gap:4px; min-height:48px; }\n .status .notes-strip { display:none; }\n}\n@media(prefers-reduced-motion:reduce) { * { scroll-behavior:auto !important; } }\n";
@@ -0,0 +1,33 @@
1
+ import type { ViewerState } from './controller.js';
2
+ import type { VsdxSource } from './contract.js';
3
+ import { type BackstagePage } from './backstage.js';
4
+ /** What the backstage needs from the element; every action delegates to existing APIs. */
5
+ export interface BackstageHost {
6
+ root: ShadowRoot;
7
+ viewport: HTMLElement;
8
+ fileName(): string;
9
+ load(source: VsdxSource): Promise<void>;
10
+ exportVsdx(): {
11
+ bytes: Uint8Array;
12
+ dirty: boolean;
13
+ };
14
+ exportSvg(): {
15
+ svg: string;
16
+ pageIndex: number;
17
+ };
18
+ closeDocument(): void;
19
+ revealNotes(): void;
20
+ showOptions(): void;
21
+ announce(message: string): void;
22
+ noteCount(): number;
23
+ }
24
+ export declare class ViewerBackstage {
25
+ #private;
26
+ private readonly host;
27
+ constructor(host: BackstageHost);
28
+ get open(): boolean;
29
+ show(page?: BackstagePage): void;
30
+ hide(): void;
31
+ wire(): () => void;
32
+ render(state: ViewerState): void;
33
+ }
@@ -0,0 +1,21 @@
1
+ import type { ViewerState } from './controller.js';
2
+ /**
3
+ * The drawing window: renders the current page, owns its resources, lists compatibility notes
4
+ * and marks the selection (revealing search hits). Page re-renders happen only when the
5
+ * document, page or layer overrides change.
6
+ */
7
+ export declare class ViewerCanvas {
8
+ #private;
9
+ private readonly viewport;
10
+ private readonly notes;
11
+ private readonly notesPanel;
12
+ private readonly inspector;
13
+ constructor(viewport: HTMLElement, notes: HTMLUListElement, notesPanel: HTMLElement, inspector: HTMLDetailsElement);
14
+ get warnings(): readonly string[];
15
+ /** Force the next render to redraw the page (fonts loaded, element reconnected). */
16
+ invalidate(): void;
17
+ /** Release page resources and forget selection and search memory. */
18
+ dispose(): void;
19
+ /** Returns true when the page itself was re-rendered. */
20
+ render(state: ViewerState): boolean;
21
+ }
@@ -1,18 +1,21 @@
1
1
  import type { ViewerController, ViewerState } from './controller.js';
2
2
  /**
3
- * Static workspace markup (legacy; migrate to builders when next changed). The ribbon, page
4
- * tabs and status bar are built by `createRibbon`, `createPageTabs` and `createStatusBar`.
5
- * All document labels are inserted as text.
3
+ * Static workspace markup (legacy; migrate to builders when next changed). The ribbon, Shapes
4
+ * window, page tabs and status bar are built by their own modules. Visio keeps pages in the
5
+ * bottom tabs and the All pages list, so there is no page pane. Labels are inserted as text.
6
6
  */
7
- export declare const viewerChromeTemplate = "<div class=\"workspace\">\n <nav id=\"page-rail\" class=\"page-rail\" aria-label=\"Diagram pages\"><div class=\"pane-heading\"><span>Pages</span><span data-page-count>0</span></div><ol class=\"page-list\"></ol><p class=\"page-empty\">Open a drawing to see its pages.</p></nav>\n <div class=\"viewport\" tabindex=\"0\" role=\"region\" aria-label=\"Diagram canvas\"></div>\n <aside id=\"inspector-pane\" class=\"inspector-pane\" aria-label=\"Drawing inspector\">\n <div class=\"pane-heading\"><span>Inspector</span><span class=\"inspector-kind\">Drawing</span><button class=\"pane-close\" type=\"button\" data-chrome=\"inspector\" aria-label=\"Close inspector\">\u00D7</button></div>\n <div class=\"inspector-body\">\n <section class=\"inspector-card document-card\" aria-label=\"Current page\"><h2>Current page</h2><p class=\"current-page-name\" data-page-name>No diagram open</p><dl><dt>Size</dt><dd data-page-size>No page</dd><dt>Shapes</dt><dd data-page-shapes>No shapes</dd></dl></section>\n <p class=\"selection-hint\">Select a shape on the canvas to see its data and links.</p>\n <details class=\"shape-inspector inspector-card\" hidden><summary>Selected shape</summary><div></div></details>\n <details class=\"edit-controls\"><summary>Edit diagram (experimental)</summary><p id=\"edit-warning\">Experimental source-backed editing. Unsupported targets are rejected. Native Visio compatibility is not verified. Keep your original file.</p><p data-edit-target></p><label for=\"edit-text\">Selected shape text</label><textarea id=\"edit-text\" rows=\"3\" aria-describedby=\"edit-warning edit-target edit-status\"></textarea><div class=\"edit-actions\"><button type=\"button\" data-edit=\"apply\">Apply text</button><button type=\"button\" data-edit=\"cancel\">Cancel</button><button type=\"button\" data-edit=\"undo\">Undo</button><button type=\"button\" data-edit=\"redo\">Redo</button></div><p id=\"edit-status\" role=\"status\" aria-live=\"polite\"></p><p data-edit-error role=\"alert\" hidden></p><ul data-edit-diagnostics></ul><fieldset data-geometry><legend>Geometry (experimental)</legend><p>Pin X/Y use drawing inches, bottom-left origin, Y up. Resize holds the rotation pin fixed. Core rejects unsupported formulas, protected cells, unsafe group/master dependencies and referenced deletion. Native Visio reopen fidelity is unverified.</p><label>New rectangle ID <input data-geometry-field=\"id\" type=\"text\" maxlength=\"256\"></label><label>Rectangle text (optional) <input data-geometry-field=\"text\" type=\"text\" maxlength=\"1000000\"></label><label>Pin X (inches) <input data-geometry-field=\"x\" type=\"number\" step=\"any\"></label><label>Pin Y (inches) <input data-geometry-field=\"y\" type=\"number\" step=\"any\"></label><label>Width (inches) <input data-geometry-field=\"width\" type=\"number\" min=\"0\" step=\"any\"></label><label>Height (inches) <input data-geometry-field=\"height\" type=\"number\" min=\"0\" step=\"any\"></label><div class=\"edit-actions\"><button type=\"button\" data-geometry-action=\"create-rectangle\">Create rectangle</button><button type=\"button\" data-geometry-action=\"move-shape\">Move selected</button><button type=\"button\" data-geometry-action=\"resize-shape\">Resize selected</button><button type=\"button\" data-geometry-action=\"delete-shape\">Delete selected</button></div><p data-geometry-error role=\"alert\" hidden></p></fieldset></details><details class=\"layer-controls\" hidden><summary>Layers</summary><p>Display changes only. SVG and print snapshots use saved visibility. Guides, NoShow and unknown hidden reasons remain hidden.</p><div data-layer-list></div><p data-layer-status role=\"status\"></p><button type=\"button\" data-layer-reset=\"all\">Reset all layers</button></details>\n <details class=\"notes inspector-card\"><summary>Compatibility notes</summary><ul></ul></details>\n </div>\n </aside>\n</div>";
7
+ export declare const viewerChromeTemplate = "<div class=\"workspace\">\n <div class=\"viewport\" tabindex=\"0\" role=\"region\" aria-label=\"Diagram canvas\"></div>\n <aside id=\"inspector-pane\" class=\"inspector-pane\" aria-label=\"Drawing inspector\">\n <div class=\"pane-heading\"><span>Inspector</span><span class=\"inspector-kind\">Drawing</span><button class=\"pane-close\" type=\"button\" data-chrome=\"inspector\" aria-label=\"Close inspector\">\u00D7</button></div>\n <div class=\"inspector-body\">\n <section class=\"inspector-card document-card\" aria-label=\"Current page\"><h2>Current page</h2><p class=\"current-page-name\" data-page-name>No diagram open</p><dl><dt>Size</dt><dd data-page-size>No page</dd><dt>Shapes</dt><dd data-page-shapes>No shapes</dd></dl></section>\n <p class=\"selection-hint\">Select a shape on the canvas to see its data and links.</p>\n <details class=\"shape-inspector inspector-card\" hidden><summary>Selected shape</summary><div></div></details>\n <details class=\"edit-controls\"><summary>Edit diagram (experimental)</summary><p id=\"edit-warning\">Experimental source-backed editing. Unsupported targets are rejected. Native Visio compatibility is not verified. Keep your original file.</p><p data-edit-target></p><label for=\"edit-text\">Selected shape text</label><textarea id=\"edit-text\" rows=\"3\" aria-describedby=\"edit-warning edit-target edit-status\"></textarea><div class=\"edit-actions\"><button type=\"button\" data-edit=\"apply\">Apply text</button><button type=\"button\" data-edit=\"cancel\">Cancel</button><button type=\"button\" data-edit=\"undo\">Undo</button><button type=\"button\" data-edit=\"redo\">Redo</button></div><p id=\"edit-status\" role=\"status\" aria-live=\"polite\"></p><p data-edit-error role=\"alert\" hidden></p><ul data-edit-diagnostics></ul><fieldset data-geometry><legend>Geometry (experimental)</legend><p>Pin X/Y use drawing inches, bottom-left origin, Y up. Resize holds the rotation pin fixed. Core rejects unsupported formulas, protected cells, unsafe group/master dependencies and referenced deletion. Native Visio reopen fidelity is unverified.</p><label>New rectangle ID <input data-geometry-field=\"id\" type=\"text\" maxlength=\"256\"></label><label>Rectangle text (optional) <input data-geometry-field=\"text\" type=\"text\" maxlength=\"1000000\"></label><label>Pin X (inches) <input data-geometry-field=\"x\" type=\"number\" step=\"any\"></label><label>Pin Y (inches) <input data-geometry-field=\"y\" type=\"number\" step=\"any\"></label><label>Width (inches) <input data-geometry-field=\"width\" type=\"number\" min=\"0\" step=\"any\"></label><label>Height (inches) <input data-geometry-field=\"height\" type=\"number\" min=\"0\" step=\"any\"></label><div class=\"edit-actions\"><button type=\"button\" data-geometry-action=\"create-rectangle\">Create rectangle</button><button type=\"button\" data-geometry-action=\"move-shape\">Move selected</button><button type=\"button\" data-geometry-action=\"resize-shape\">Resize selected</button><button type=\"button\" data-geometry-action=\"delete-shape\">Delete selected</button></div><p data-geometry-error role=\"alert\" hidden></p></fieldset></details><details class=\"layer-controls\" hidden><summary>Layers</summary><p>Display changes only. SVG and print snapshots use saved visibility. Guides, NoShow and unknown hidden reasons remain hidden.</p><div data-layer-list></div><p data-layer-status role=\"status\"></p><button type=\"button\" data-layer-reset=\"all\">Reset all layers</button></details>\n <details class=\"notes inspector-card\"><summary>Compatibility notes</summary><ul></ul></details>\n </div>\n </aside>\n</div>";
8
+ export type TaskPane = 'shapes' | 'inspector';
8
9
  /** Presentation state stays local; page navigation uses the same controller as every binding. */
9
10
  export declare class ViewerChrome {
10
11
  #private;
11
12
  constructor(root: ShadowRoot, controller: ViewerController);
12
13
  wire(): () => void;
13
- showTab(tab: 'home' | 'view'): void;
14
+ showTab(tab: string): void;
15
+ /** On phones, close the Tools sheet once a command runs. */
16
+ closeCompactTools(): void;
14
17
  /** Show or hide a task pane; compact layouts close the Tools menu afterwards. */
15
- togglePane(pane: 'pages' | 'inspector'): void;
18
+ togglePane(pane: TaskPane): void;
16
19
  /** Open an inspector disclosure; text editing may focus the text field directly (F2). */
17
20
  reveal(kind: 'notes' | 'selection' | 'edit' | 'layers', focusText?: boolean): void;
18
21
  render(state: ViewerState, noteCount: number): void;
@@ -1,14 +1,17 @@
1
1
  import type { ViewerController, ViewerState } from './controller.js';
2
2
  import { type VisioRibbonAction } from './ribbon-action.js';
3
+ import type { Rulers } from './viewer-ruler.js';
3
4
  export type CanvasTool = 'pointer' | 'rectangle';
4
5
  interface CommandHost {
5
6
  root: ShadowRoot;
6
7
  viewport: HTMLElement;
8
+ rulers: Rulers;
7
9
  controller: ViewerController;
8
10
  fit(mode: 'page' | 'width'): void;
9
- togglePane(pane: 'pages' | 'inspector'): void;
11
+ togglePane(pane: 'shapes' | 'inspector'): void;
10
12
  reveal(panel: 'edit' | 'notes' | 'selection' | 'layers', focusText: boolean): void;
11
13
  focusSearch(): void;
14
+ togglePanZoom(): void;
12
15
  /** Transient command feedback for the status bar; document text is never interpreted as markup. */
13
16
  announce(message: string): void;
14
17
  }
@@ -0,0 +1,8 @@
1
+ import type { ViewerController } from './controller.js';
2
+ /** Visio's shape and page context menus; commands the core lacks are shown disabled. */
3
+ export declare function createContextMenus(doc: Document): HTMLElement[];
4
+ /**
5
+ * Right-click, Shift+F10 or the Menu key on the canvas: a shape menu for the shape under the
6
+ * pointer (selecting it first, as Visio does) or a page menu on empty paper.
7
+ */
8
+ export declare function wireContextMenus(root: ShadowRoot, viewport: HTMLElement, controller: ViewerController): () => void;
@@ -2,6 +2,22 @@ import type { VisioPage } from 'ooxml-core/visio';
2
2
  import type { ViewerController } from './controller.js';
3
3
  /** Next free numeric shape ID on the page tree. Core still rejects any collision. */
4
4
  export declare function nextShapeId(page: VisioPage): string;
5
+ /** Page inches with a top-left origin (SVG user space) from a client point. */
6
+ export declare function pagePoint(svg: SVGSVGElement, page: VisioPage, event: Pick<MouseEvent, 'clientX' | 'clientY'>): {
7
+ x: number;
8
+ y: number;
9
+ } | undefined;
10
+ /**
11
+ * Create one rectangle through core and select it. `centre` is in top-left page inches (SVG
12
+ * space); core pins are centre points in bottom-left, y-up drawing inches.
13
+ */
14
+ export declare function insertRectangle(controller: ViewerController, page: VisioPage, centre: {
15
+ x: number;
16
+ y: number;
17
+ }, size: {
18
+ width: number;
19
+ height: number;
20
+ }): Promise<string>;
5
21
  /** Drag-to-draw rectangle tool. The preview is viewer-only; the shape is created by core. */
6
22
  export declare class RectangleDrawTool {
7
23
  #private;
@@ -1,6 +1,7 @@
1
1
  import type { VisioDocument, VisioEdit } from 'ooxml-core/visio';
2
2
  import type { VsdxSource } from './contract.js';
3
3
  import { ViewerController } from './controller.js';
4
+ import { type BackstagePage } from './backstage.js';
4
5
  import { type SvgExportOptions, type SvgExportResult } from './export-svg.js';
5
6
  import { type CurrentPagePrintSnapshotOptions, type PrintSnapshot } from './print-snapshot.js';
6
7
  declare const BaseElement: typeof HTMLElement;
@@ -18,6 +19,12 @@ export declare class VisioViewerElement extends BaseElement {
18
19
  set showToolbar(value: boolean);
19
20
  get renderWarnings(): readonly string[];
20
21
  load(source: VsdxSource): Promise<void>;
22
+ /** Leave Visio's File backstage and return to the drawing. */
23
+ closeBackstage(): void;
24
+ /** Open Visio's File backstage at a page (Info by default). */
25
+ openBackstage(page?: BackstagePage): void;
26
+ /** Name of the last opened local file, or empty for bytes, models and closed drawings. */
27
+ get fileName(): string;
21
28
  applyEdits(edits: readonly VisioEdit[]): Promise<void>;
22
29
  replacePlainText(pageId: string, shapeId: string, text: string): Promise<void>;
23
30
  undo(): Promise<void>;
@@ -0,0 +1,6 @@
1
+ import type { VisioPage } from 'ooxml-core/visio';
2
+ /**
3
+ * Zoom that fits a page into the drawing window, as Visio's Fit to Window (whole page, never
4
+ * enlarged past 100%) or Page Width (fills the width and scrolls vertically).
5
+ */
6
+ export declare function fitZoom(viewport: HTMLElement, page: VisioPage, mode: 'page' | 'width'): number;
@@ -1,11 +1,9 @@
1
1
  import type { ViewerController } from './controller.js';
2
2
  interface Controls {
3
3
  viewport: HTMLDivElement;
4
- commandRoot: ShadowRoot;
5
4
  zoomSlider: HTMLElement & {
6
5
  value: number;
7
6
  };
8
- searchInput: HTMLInputElement;
9
7
  }
10
8
  /** Own every DOM listener and abort them together when the surface is disposed. */
11
9
  export declare function wireViewerInputs(controls: Controls, controller: ViewerController, fit: (mode: 'page' | 'width') => void): () => void;
@@ -0,0 +1,22 @@
1
+ import { type OfficeOptionCategory, type OfficeProfile } from 'ooxml-ui/controls';
2
+ /**
3
+ * Visio's File > Options categories, in Visio's order. Only User name and Initials are honoured
4
+ * today (they are the local profile, also used as the identity in a shared session); every other
5
+ * setting is shown disabled with the capability it is waiting for.
6
+ */
7
+ export declare const VISIO_OPTION_CATEGORIES: readonly OfficeOptionCategory[];
8
+ /** The Options dialog element. Built once and appended to the viewer's shadow root. */
9
+ export declare function createOptionsDialog(doc: Document): HTMLElement;
10
+ /**
11
+ * File > Account and File > Options share one local profile. Edits in either are written to the
12
+ * suite-wide profile store, mirrored into the other and reported through `onProfile`.
13
+ */
14
+ export declare class ViewerProfile {
15
+ #private;
16
+ private readonly onProfile;
17
+ constructor(root: ShadowRoot, onProfile?: (profile: OfficeProfile) => void);
18
+ get profile(): OfficeProfile;
19
+ /** Open Visio Options, on General as Visio does. */
20
+ showOptions(category?: string): void;
21
+ wire(): () => void;
22
+ }
@@ -0,0 +1,19 @@
1
+ import type { ViewerController } from './controller.js';
2
+ /** Visio's Pan & Zoom window: a floating page thumbnail with the visible area outlined. */
3
+ export declare function createPanZoom(doc: Document): HTMLElement;
4
+ /**
5
+ * Keeps the thumbnail and the visible-area rectangle in step with the drawing window, and pans
6
+ * the drawing window from the thumbnail. The thumbnail is a DOM clone of the rendered page.
7
+ */
8
+ export declare class ViewerPanZoom {
9
+ #private;
10
+ private readonly viewport;
11
+ private readonly controller;
12
+ private readonly checked;
13
+ constructor(root: ShadowRoot, viewport: HTMLElement, controller: ViewerController, checked: (open: boolean) => void);
14
+ get open(): boolean;
15
+ toggle(open?: boolean): void;
16
+ wire(): () => void;
17
+ /** Refresh the thumbnail when the page changed, then the visible-area rectangle. */
18
+ render(): void;
19
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Visio's rulers: inch scales along the top and left of the drawing window with 0 at the page's
3
+ * left and bottom edges (vertical values grow upward, as in Visio). Drawn by the shared
4
+ * `office-ui-ruler`; this module only lays them out and says where zero is. Viewer-only
5
+ * presentation: nothing is read from or written to the document beyond the rendered page box.
6
+ */
7
+ export interface Rulers {
8
+ element: HTMLElement;
9
+ render(visible: boolean, zoom: number): void;
10
+ wire(): () => void;
11
+ }
12
+ /** Wraps the viewport in a grid with a corner, a top ruler and a left ruler. */
13
+ export declare function createRulers(viewport: HTMLElement): Rulers;
@@ -1,11 +1,18 @@
1
- import type { ViewerState } from './controller.js';
2
- /** Builds the Find group: a search field, previous/next result buttons and a live status. */
3
- export declare function createSearchGroup(doc: Document): HTMLElement;
4
- export interface SearchControls {
5
- input: HTMLInputElement;
6
- status: HTMLSpanElement;
7
- previous: HTMLButtonElement;
8
- next: HTMLButtonElement;
9
- }
10
- export declare function searchControls(root: ShadowRoot): SearchControls;
11
- export declare function renderSearchControls(controls: SearchControls, state: ViewerState): void;
1
+ import type { ViewerController, ViewerState } from './controller.js';
2
+ export type FindBar = HTMLElement & {
3
+ open: boolean;
4
+ value: string;
5
+ status: string;
6
+ statusTitle: string;
7
+ show(): void;
8
+ close(): void;
9
+ };
10
+ /**
11
+ * Visio opens Find from Home > Editing rather than keeping a box in the ribbon. The shared
12
+ * `office-ui-find-bar` sits under the ribbon, hidden until Find... or Ctrl+F; Enter and
13
+ * Shift+Enter step through matching shapes and Escape clears, then closes.
14
+ */
15
+ export declare function createFindBar(doc: Document): FindBar;
16
+ /** Route the find bar's queries and steps to the controller; `closed` restores focus. */
17
+ export declare function wireFindBar(bar: FindBar, controller: ViewerController, closed: () => void): () => void;
18
+ export declare function renderFindBar(bar: FindBar, state: ViewerState): void;