visio-angular-viewer 0.5.2 → 0.5.4

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 (74) hide show
  1. package/NOTICE +1 -1
  2. package/README.md +5 -5
  3. package/dist/index.js +3 -7487
  4. package/dist/types/packages/bindings/src/angular.d.ts +5 -5
  5. package/dist/types/packages/bindings/src/common.d.ts +8 -8
  6. package/dist/types/src/index.d.ts +1 -14
  7. package/package.json +10 -7
  8. package/dist/assets/edit-worker-CZbtTOr4.js +0 -56328
  9. package/dist/assets/parse-worker-BEaLqUCJ.js +0 -61176
  10. package/dist/types/src/arrowheads.d.ts +0 -3
  11. package/dist/types/src/backstage.d.ts +0 -15
  12. package/dist/types/src/binding.d.ts +0 -27
  13. package/dist/types/src/contract.d.ts +0 -32
  14. package/dist/types/src/controller.d.ts +0 -71
  15. package/dist/types/src/demo-document.d.ts +0 -3
  16. package/dist/types/src/diagnostics.d.ts +0 -9
  17. package/dist/types/src/document-history.d.ts +0 -42
  18. package/dist/types/src/document-text-search.d.ts +0 -44
  19. package/dist/types/src/edit-commands.d.ts +0 -3
  20. package/dist/types/src/edit-error.d.ts +0 -4
  21. package/dist/types/src/edit-worker.d.ts +0 -1
  22. package/dist/types/src/export-svg.d.ts +0 -25
  23. package/dist/types/src/foreign-vector-budget.d.ts +0 -24
  24. package/dist/types/src/office-ui.d.ts +0 -2
  25. package/dist/types/src/paragraph-layout.d.ts +0 -18
  26. package/dist/types/src/parse-worker.d.ts +0 -1
  27. package/dist/types/src/print-snapshot.d.ts +0 -87
  28. package/dist/types/src/render-fill.d.ts +0 -2
  29. package/dist/types/src/render-foreign-vector-shape.d.ts +0 -4
  30. package/dist/types/src/render-foreign-vector.d.ts +0 -3
  31. package/dist/types/src/render-image.d.ts +0 -4
  32. package/dist/types/src/render-resources.d.ts +0 -10
  33. package/dist/types/src/render-svg.d.ts +0 -17
  34. package/dist/types/src/render-text.d.ts +0 -4
  35. package/dist/types/src/ribbon-action.d.ts +0 -41
  36. package/dist/types/src/ribbon-home-format.d.ts +0 -2
  37. package/dist/types/src/ribbon-home.d.ts +0 -6
  38. package/dist/types/src/ribbon-keytips.d.ts +0 -2
  39. package/dist/types/src/ribbon-other-tabs.d.ts +0 -12
  40. package/dist/types/src/ribbon-parts.d.ts +0 -60
  41. package/dist/types/src/ribbon-router.d.ts +0 -19
  42. package/dist/types/src/ribbon-view.d.ts +0 -5
  43. package/dist/types/src/ribbon.d.ts +0 -13
  44. package/dist/types/src/scene-details.d.ts +0 -7
  45. package/dist/types/src/scene-validation.d.ts +0 -4
  46. package/dist/types/src/shape-inspector.d.ts +0 -5
  47. package/dist/types/src/shapes-window.d.ts +0 -28
  48. package/dist/types/src/snapshot-scene.d.ts +0 -8
  49. package/dist/types/src/status-bar.d.ts +0 -10
  50. package/dist/types/src/styles/index.d.ts +0 -5
  51. package/dist/types/src/styles.d.ts +0 -2
  52. package/dist/types/src/text-layout.d.ts +0 -45
  53. package/dist/types/src/viewer-backstage.d.ts +0 -33
  54. package/dist/types/src/viewer-canvas.d.ts +0 -21
  55. package/dist/types/src/viewer-chrome.d.ts +0 -22
  56. package/dist/types/src/viewer-commands.d.ts +0 -34
  57. package/dist/types/src/viewer-context-menu.d.ts +0 -8
  58. package/dist/types/src/viewer-draw-tool.d.ts +0 -33
  59. package/dist/types/src/viewer-edit-controls.d.ts +0 -12
  60. package/dist/types/src/viewer-element.d.ts +0 -51
  61. package/dist/types/src/viewer-fit.d.ts +0 -6
  62. package/dist/types/src/viewer-geometry-controls.d.ts +0 -14
  63. package/dist/types/src/viewer-input.d.ts +0 -10
  64. package/dist/types/src/viewer-layer-controls.d.ts +0 -5
  65. package/dist/types/src/viewer-layers.d.ts +0 -22
  66. package/dist/types/src/viewer-options.d.ts +0 -22
  67. package/dist/types/src/viewer-pan-zoom.d.ts +0 -19
  68. package/dist/types/src/viewer-ruler.d.ts +0 -13
  69. package/dist/types/src/viewer-search.d.ts +0 -18
  70. package/dist/types/src/viewer-share.d.ts +0 -20
  71. package/dist/types/src/viewer-stencil.d.ts +0 -6
  72. package/dist/types/src/viewer-tell-me.d.ts +0 -4
  73. package/dist/types/src/worker-editor.d.ts +0 -23
  74. package/dist/types/src/worker-parser.d.ts +0 -13
@@ -1,3 +0,0 @@
1
- import type { VisioStyle } from 'ooxml-core/visio';
2
- /** Common Visio line/triangle and concave arrow styles. Sizes remain a documented visual approximation. */
3
- export declare function applyArrowheads(path: SVGPathElement, style: VisioStyle, defs: SVGDefsElement, warnings: Set<string>): void;
@@ -1,15 +0,0 @@
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;
@@ -1,27 +0,0 @@
1
- import type { VisioEdit } from 'ooxml-core/visio';
2
- import type { ViewerOptions, VsdxSource } from './contract.js';
3
- import { type VisioViewerElement } from './viewer-element.js';
4
- import type { ViewerController } from './controller.js';
5
- import type { SvgExportOptions, SvgExportResult } from './export-svg.js';
6
- import type { CurrentPagePrintSnapshotOptions, PrintSnapshot } from './print-snapshot.js';
7
- import type { VsdxExportResult } from './document-history.js';
8
- export interface MountedViewer {
9
- readonly element: VisioViewerElement;
10
- readonly controller: ViewerController;
11
- update(options: ViewerOptions): void;
12
- load(source: VsdxSource): Promise<void>;
13
- applyEdits(edits: readonly VisioEdit[]): Promise<void>;
14
- replacePlainText(pageId: string, shapeId: string, text: string): Promise<void>;
15
- undo(): Promise<void>;
16
- redo(): Promise<void>;
17
- cancelEdit(): void;
18
- exportVsdx(): VsdxExportResult;
19
- fit(): void;
20
- setLayerVisibility(pageId: string, layerId: string, visible: boolean | null): void;
21
- resetLayerVisibility(pageId?: string): void;
22
- exportSvg(options?: SvgExportOptions): SvgExportResult;
23
- createPrintSnapshot(options?: CurrentPagePrintSnapshotOptions): PrintSnapshot;
24
- destroy(): void;
25
- }
26
- /** One client-only lifecycle adapter; framework wrappers forward to this implementation. */
27
- export declare function mountViewer(container: HTMLElement, initial?: ViewerOptions): MountedViewer;
@@ -1,32 +0,0 @@
1
- import type { VisioDocument } from 'ooxml-core/visio';
2
- export interface ViewerProperties {
3
- document: VisioDocument | null;
4
- pageIndex: number;
5
- zoom: number;
6
- showToolbar: boolean;
7
- }
8
- export interface ViewerEvents {
9
- 'document-load': VisioDocument;
10
- 'document-change': {
11
- document: VisioDocument;
12
- dirty: boolean;
13
- kind: 'edit' | 'undo' | 'redo' | 'remote';
14
- };
15
- 'document-error': Error;
16
- 'page-change': number;
17
- 'zoom-change': number;
18
- 'shape-select': {
19
- id: string;
20
- name: string;
21
- pageId?: string;
22
- } | null;
23
- }
24
- export type ViewerCallbacks = {
25
- [K in keyof ViewerEvents]?: (detail: ViewerEvents[K]) => void;
26
- };
27
- export declare const propertyKeys: readonly ["document", "pageIndex", "zoom", "showToolbar"];
28
- export declare const eventKeys: readonly ["document-load", "document-change", "document-error", "page-change", "zoom-change", "shape-select"];
29
- export type VsdxSource = ArrayBuffer | Uint8Array | Blob;
30
- export interface ViewerOptions extends Partial<ViewerProperties> {
31
- events?: ViewerCallbacks;
32
- }
@@ -1,71 +0,0 @@
1
- import { type ViewerEditState, type VsdxExportResult } from './document-history.js';
2
- import { type CancellableEditor } from './worker-editor.js';
3
- import { type VisioDocument, type VisioEdit } from 'ooxml-core/visio';
4
- import { type LayerVisibilityOverride } from './viewer-layers.js';
5
- import type { CancellableParser } from './worker-parser.js';
6
- import type { ViewerEvents } from './contract.js';
7
- import { type TextSearchState } from './document-text-search.js';
8
- export interface ViewerState {
9
- readonly document: VisioDocument | null;
10
- readonly edit: ViewerEditState;
11
- readonly pageIndex: number;
12
- readonly zoom: number;
13
- readonly loading: boolean;
14
- readonly error: Error | null;
15
- readonly search: TextSearchState;
16
- /** Viewer-only display overrides, independent of saved model and print policy. */
17
- readonly layerVisibilityOverrides: readonly LayerVisibilityOverride[];
18
- readonly selectedShape: {
19
- id: string;
20
- name: string;
21
- pageId?: string;
22
- } | null;
23
- }
24
- type Parser = CancellableParser;
25
- type EventListener = <K extends keyof ViewerEvents>(name: K, detail: ViewerEvents[K]) => void;
26
- export declare class ViewerController {
27
- #private;
28
- private readonly parser;
29
- private readonly listenerError;
30
- private readonly editor;
31
- constructor(parser?: Parser, listenerError?: (error: unknown) => void, editor?: CancellableEditor);
32
- get state(): ViewerState;
33
- /** Accepted document replacements, including the same object, invalidate captured artifacts. */
34
- get documentGeneration(): number;
35
- /** Accepted source/model replacements invalidate drafts; edit/undo/redo keep this source epoch. */
36
- get sourceGeneration(): number;
37
- subscribe(listener: (state: ViewerState) => void): () => void;
38
- onEvent(listener: EventListener): () => void;
39
- setDocument(document: VisioDocument | null): void;
40
- setPage(index: number): void;
41
- setZoom(zoom: number): void;
42
- selectShape(shape: ViewerState['selectedShape']): void;
43
- /** Override one source-page layer for viewing. null restores its saved display flag. */
44
- setLayerVisibility(pageId: string, layerId: string, visible: boolean | null): void;
45
- /** Reset a source page, or all pages when omitted. Does not modify the document. */
46
- resetLayerVisibility(pageId?: string): void;
47
- /** Search does not change the page or selection until explicit result navigation. */
48
- setSearchQuery(query: string): void;
49
- selectSearchResult(index: number): void;
50
- nextSearchResult(): void;
51
- previousSearchResult(): void;
52
- load(bytes: Uint8Array | ArrayBuffer): Promise<void>;
53
- /** Reading bytes shares the same request epoch and error state as parsing them. */
54
- loadSource(read: () => Uint8Array | ArrayBuffer | Promise<Uint8Array | ArrayBuffer>): Promise<void>;
55
- cancelLoad(): void;
56
- destroy(): void;
57
- /** Replace one source-backed local plain-text target. Core decides target support. */
58
- replacePlainText(pageId: string, shapeId: string, text: string): Promise<void>;
59
- /** Atomic source-backed edits. Core owns protection, dependency and target validation. */
60
- applyEdits(edits: readonly VisioEdit[]): Promise<void>;
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>;
67
- redo(): Promise<void>;
68
- cancelEdit(): void;
69
- exportVsdx(): VsdxExportResult;
70
- }
71
- export {};
@@ -1,3 +0,0 @@
1
- import type { VisioDocument } from 'ooxml-core/visio';
2
- /** Original sample scene, not a Visio-authored reference fixture. */
3
- export declare const demoDocument: VisioDocument;
@@ -1,9 +0,0 @@
1
- import type { VisioDiagnostic } from 'ooxml-core/visio';
2
- export interface CompatibilityNote {
3
- message: string;
4
- count: number;
5
- severity: 'info' | 'warning';
6
- }
7
- /** Presentation-only grouping keeps repeated per-shape diagnostics readable without losing counts. */
8
- export declare function compatibilityNotes(diagnostics: readonly VisioDiagnostic[], renderWarnings?: readonly string[]): CompatibilityNote[];
9
- export declare function compatibilityText(note: CompatibilityNote): string;
@@ -1,42 +0,0 @@
1
- /** Source snapshots only. No document model is serialized by the viewer. */
2
- export interface EditDiagnostic {
3
- readonly code: string;
4
- readonly message: string;
5
- }
6
- export interface VsdxExportResult {
7
- bytes: Uint8Array;
8
- dirty: boolean;
9
- diagnostics: readonly EditDiagnostic[];
10
- }
11
- export interface ViewerEditState {
12
- readonly sourceAvailable: boolean;
13
- readonly busy: boolean;
14
- readonly dirty: boolean;
15
- readonly canUndo: boolean;
16
- readonly canRedo: boolean;
17
- readonly historyTruncated: boolean;
18
- readonly error: Error | null;
19
- readonly diagnostics: readonly EditDiagnostic[];
20
- }
21
- export declare const EMPTY_EDIT_STATE: ViewerEditState;
22
- export declare const EDIT_HISTORY_LIMITS: Readonly<{
23
- maxBytes: number;
24
- maxEntries: 20;
25
- }>;
26
- export interface SourceSnapshot {
27
- readonly bytes: Uint8Array;
28
- readonly diagnostics: readonly EditDiagnostic[];
29
- }
30
- /** Private controller-owned bytes; transient worker copies and models are separate from this budget. */
31
- export declare class DocumentHistory {
32
- #private;
33
- readonly original: SourceSnapshot;
34
- constructor(bytes: Uint8Array);
35
- get current(): SourceSnapshot;
36
- get undoTarget(): SourceSnapshot | undefined;
37
- get redoTarget(): SourceSnapshot | undefined;
38
- get state(): ViewerEditState;
39
- append(bytes: Uint8Array, diagnostics: readonly EditDiagnostic[]): void;
40
- move(target: SourceSnapshot): void;
41
- export(): VsdxExportResult;
42
- }
@@ -1,44 +0,0 @@
1
- import type { VisioDocument, VisioShape } from 'ooxml-core/visio';
2
- /** UTF-16 character bounds, applied before copying or case conversion. */
3
- export declare const TEXT_SEARCH_LIMITS: Readonly<{
4
- queryCharacters: 256;
5
- results: 500;
6
- indexedCharacters: 2000000;
7
- shapeCharacters: 32768;
8
- previewCharacters: 160;
9
- shapes: 25000;
10
- depth: 64;
11
- }>;
12
- export interface TextSearchResult {
13
- readonly pageIndex: number;
14
- readonly pageId: string;
15
- readonly pageName: string;
16
- readonly shapeId: string;
17
- readonly shapeName: string;
18
- /** Bounded start-of-text preview, not a match offset or highlighted excerpt. */
19
- readonly preview: string;
20
- }
21
- export interface TextSearchState {
22
- readonly query: string;
23
- readonly results: readonly TextSearchResult[];
24
- /** -1 until the user explicitly navigates, or after manual page/shape selection. */
25
- readonly activeIndex: number;
26
- readonly indexTruncated: boolean;
27
- readonly resultsTruncated: boolean;
28
- }
29
- interface SearchEntry {
30
- readonly result: TextSearchResult;
31
- readonly foldedText: string;
32
- }
33
- export interface DocumentTextIndex {
34
- readonly entries: readonly SearchEntry[];
35
- readonly truncated: boolean;
36
- }
37
- export declare const EMPTY_TEXT_SEARCH: TextSearchState;
38
- /** Index canonical text for the current display state. No XML, DOM or layout parsing. */
39
- export declare function indexDocumentText(model: VisioDocument | null, isVisible?: (shape: VisioShape) => boolean): DocumentTextIndex;
40
- export declare function validateSearchQuery(query: string): void;
41
- /** One match per shape, literal ECMAScript lowercase comparison; no regex or language collation. */
42
- export declare function searchDocumentText(index: DocumentTextIndex, query: string): TextSearchState;
43
- export declare function textSearchStatus(search: TextSearchState): string;
44
- export {};
@@ -1,3 +0,0 @@
1
- import type { VisioEdit } from 'ooxml-core/visio';
2
- /** Bound cloning and strip arbitrary host properties. Semantic validation belongs to core. */
3
- export declare function snapshotEdits(edits: readonly VisioEdit[]): VisioEdit[];
@@ -1,4 +0,0 @@
1
- /** Core error codes remain visible for a refused transaction; document content is plain text. */
2
- export declare function editErrorMessage(error: unknown): string;
3
- /** Superseded worker/load operations are cancellation, not a refused document edit. */
4
- export declare function isEditCancellation(error: unknown): boolean;
@@ -1 +0,0 @@
1
- export {};
@@ -1,25 +0,0 @@
1
- import { type VisioDocument, type VisioPage } from 'ooxml-core/visio';
2
- import { type CompatibilityNote } from './diagnostics.js';
3
- export declare const MAX_SVG_EXPORT_BYTES: number;
4
- export interface SvgExportOptions {
5
- /** UTF-8 output ceiling. May lower, but never raise, the 16 MiB safety limit. */
6
- maxBytes?: number;
7
- }
8
- export interface SvgExportResult {
9
- readonly svg: string;
10
- readonly byteLength: number;
11
- readonly pageIndex: number;
12
- readonly pageName: string;
13
- /** Saved page dimensions in inches, independent of viewport zoom. */
14
- readonly width: number;
15
- readonly height: number;
16
- readonly diagnostics: CompatibilityNote[];
17
- }
18
- /**
19
- * Export one page through the shared renderer, including its resolved backgrounds.
20
- * Requires a browser DOM at call time, never uploads, downloads or mutates viewer state.
21
- * Conservative preflight limits can reject a page whose eventual serialization would be smaller.
22
- */
23
- export declare function exportPageSvg(model: VisioDocument, pageIndex?: number, options?: SvgExportOptions): SvgExportResult;
24
- /** @internal Call only after canonical scene validation. Shared conservative allocation preflight. */
25
- export declare function estimatePageSvgBytes(model: VisioDocument, page: VisioPage, maxBytes: number): number;
@@ -1,24 +0,0 @@
1
- import { type VisioForeignVector } from 'ooxml-core/visio';
2
- /** UI allocation limits, charged for every instance, including repeated shared resources. */
3
- export declare const FOREIGN_VECTOR_SCENE_LIMITS: Readonly<{
4
- maxNodes: 100000;
5
- maxCommands: 400000;
6
- maxOperands: 1000000;
7
- }>;
8
- export interface ForeignVectorResource {
9
- readonly vector: VisioForeignVector;
10
- readonly nodes: number;
11
- readonly commands: number;
12
- readonly operands: number;
13
- readonly svgBytes: number;
14
- readonly validationWork: number;
15
- }
16
- /** Count work only after canonical validation. Interpretation and safety remain in core. */
17
- export declare function inspectForeignVectorResource(source: unknown): ForeignVectorResource;
18
- /** Invocation-local budget. Never trusts frozen host objects or caches across calls. */
19
- export declare class ForeignVectorBudget {
20
- private nodes;
21
- private commands;
22
- private operands;
23
- take(source: unknown): ForeignVectorResource;
24
- }
@@ -1,2 +0,0 @@
1
- /** Define the shared Office controls the viewer chrome uses. Idempotent; browser only. */
2
- export declare function registerViewerControls(registry?: CustomElementRegistry): void;
@@ -1,18 +0,0 @@
1
- import type { VisioParagraph, VisioText } from 'ooxml-core/visio';
2
- import { type TextLayoutBudget, type MeasureText, type TextLine } from './text-layout.js';
3
- export interface PositionedLine extends TextLine {
4
- x: number;
5
- y: number;
6
- availableWidth: number;
7
- align: VisioParagraph['horizontalAlign'];
8
- direction: 'ltr' | 'rtl';
9
- last: boolean;
10
- bullet?: NonNullable<VisioParagraph['bullet']> & {
11
- x: number;
12
- };
13
- }
14
- export interface ParagraphLayout {
15
- lines: PositionedLine[];
16
- height: number;
17
- }
18
- export declare function layoutParagraphs(text: VisioText, measure?: MeasureText, budget?: TextLayoutBudget): ParagraphLayout;
@@ -1 +0,0 @@
1
- export {};
@@ -1,87 +0,0 @@
1
- import { type VisioDocument } from 'ooxml-core/visio';
2
- import type { CompatibilityNote } from './diagnostics.js';
3
- /** Application guardrails, not printer capabilities or Microsoft Visio limits. */
4
- export declare const PRINT_SNAPSHOT_LIMITS: Readonly<{
5
- maxPages: 32;
6
- maxTotalBytes: number;
7
- maxPageBytes: number;
8
- maxShapeInstances: 100000;
9
- maxGeometryInstances: 100000;
10
- maxPathCharacters: 16000000;
11
- maxTextCharacters: 1000000;
12
- maxTextRuns: 100000;
13
- maxImageBytes: number;
14
- maxUniqueImagePixels: 64000000;
15
- maxImageInstancePixels: 256000000;
16
- maxVectorNodes: 100000;
17
- maxVectorCommands: 400000;
18
- maxVectorOperands: 1000000;
19
- maxPageAxisCssPixels: 4096;
20
- maxPageAreaCssPixels: 16000000;
21
- maxTotalAreaCssPixels: 64000000;
22
- maxValidationShapeVisits: 1000000;
23
- maxValidationWork: number;
24
- }>;
25
- export type PrintSnapshotLimits = {
26
- -readonly [K in keyof typeof PRINT_SNAPSHOT_LIMITS]: number;
27
- };
28
- export interface PrintSnapshotOptions {
29
- /** Explicit output order. Background pages are included as sheets only when selected. */
30
- readonly pageIndices: readonly number[];
31
- /** Positive integer limits may lower, but never raise, the hard ceilings. */
32
- readonly limits?: Partial<PrintSnapshotLimits>;
33
- }
34
- /** Viewer handles always capture exactly the current page. */
35
- export type CurrentPagePrintSnapshotOptions = Omit<PrintSnapshotOptions, 'pageIndices'>;
36
- export interface PrintSnapshotPage {
37
- readonly pageIndex: number;
38
- readonly pageId: string;
39
- readonly pageName: string;
40
- /** Saved drawing dimensions, not printer paper, margins, orientation or scale. */
41
- readonly drawingSize: Readonly<{
42
- width: number;
43
- height: number;
44
- unit: 'in';
45
- }>;
46
- /** An isolated SVG document. Do not concatenate page trees with colliding resource IDs. */
47
- readonly svg: string;
48
- readonly byteLength: number;
49
- readonly diagnostics: readonly Readonly<CompatibilityNote>[];
50
- }
51
- export interface PrintSnapshotUsage {
52
- readonly estimatedSvgBytes: number;
53
- readonly svgBytes: number;
54
- readonly shapeInstances: number;
55
- readonly geometryInstances: number;
56
- readonly pathCharacters: number;
57
- readonly textCharacters: number;
58
- readonly textRuns: number;
59
- /** Raw resources counted once per byte identity per output page, including backgrounds. */
60
- readonly imageBytes: number;
61
- readonly uniqueImagePixels: number;
62
- readonly imageInstancePixels: number;
63
- /** Includes all clip reference expansions and repeated/background vector instances. */
64
- readonly vectorNodes: number;
65
- readonly vectorCommands: number;
66
- readonly vectorOperands: number;
67
- readonly totalAreaCssPixels: number;
68
- readonly validationShapeVisits: number;
69
- /** Conservative bytes, characters and records across validation and the private copy pass. */
70
- readonly validationWork: number;
71
- }
72
- export interface PrintSnapshot {
73
- readonly appearance: 'saved-display';
74
- readonly pageIndices: readonly number[];
75
- readonly pages: readonly PrintSnapshotPage[];
76
- readonly byteLength: number;
77
- readonly limits: Readonly<PrintSnapshotLimits>;
78
- readonly usage: PrintSnapshotUsage;
79
- readonly limitations: readonly string[];
80
- }
81
- /**
82
- * Synchronously prepare bounded, immutable page artifacts through the shared SVG renderer.
83
- * Requires its DOM/serializer, but never mounts nodes, downloads, fetches, opens frames or prints.
84
- * Canonical scene/raster validation is repeated on every call. No source object is frozen.
85
- * Conservative budgets include hidden content and can reject otherwise exportable individual pages.
86
- */
87
- export declare function createPrintSnapshot(model: VisioDocument, options: PrintSnapshotOptions): PrintSnapshot;
@@ -1,2 +0,0 @@
1
- import type { VisioStyle } from 'ooxml-core/visio';
2
- export declare function fillPaint(style: VisioStyle, defs: SVGDefsElement): string;
@@ -1,4 +0,0 @@
1
- import type { VisioShape } from 'ooxml-core/visio';
2
- import type { ForeignVectorBudget } from './foreign-vector-budget.js';
3
- /** Core supplies shape-local placement; converter coordinates have a downward Y axis. */
4
- export declare function renderForeignVectorShape(shape: VisioShape, budget: ForeignVectorBudget): SVGGElement | undefined;
@@ -1,3 +0,0 @@
1
- import { ForeignVectorBudget } from './foreign-vector-budget.js';
2
- /** Render an independently validated inert scene. Never forwards source tags, IDs or attributes. */
3
- export declare function renderForeignVector(source: unknown, owner?: Document, budget?: ForeignVectorBudget): SVGSVGElement;
@@ -1,4 +0,0 @@
1
- import type { VisioShape } from 'ooxml-core/visio';
2
- import type { RenderResources } from './render-resources.js';
3
- /** URLs are created only from bounded embedded raster bytes, never from document strings. */
4
- export declare function renderImage(shape: VisioShape, resources: RenderResources): SVGGElement | undefined;
@@ -1,10 +0,0 @@
1
- import type { VisioImage } from 'ooxml-core/visio';
2
- /** One reference per shared core image resource, with explicit per-render disposal. */
3
- export declare class RenderResources {
4
- #private;
5
- private readonly definitions?;
6
- constructor(definitions?: SVGDefsElement | undefined);
7
- get portable(): boolean;
8
- imageUrl(image: VisioImage): string;
9
- dispose(): void;
10
- }
@@ -1,17 +0,0 @@
1
- import { type VisioDocument, type VisioPage, type VisioMatrix } from 'ooxml-core/visio';
2
- import { type LayerVisibilityOverride } from './viewer-layers.js';
3
- export declare function svgElement<K extends keyof SVGElementTagNameMap>(name: K): SVGElementTagNameMap[K];
4
- export declare function safeColor(value: string, fallback?: string): string;
5
- export declare function matrix(value: VisioMatrix): string;
6
- export interface RenderResult {
7
- svg: SVGSVGElement;
8
- warnings: string[];
9
- dispose(): void;
10
- }
11
- export interface RenderOptions {
12
- /** Static output embeds rasters and omits viewer selection semantics. Prefer exportPageSvg for bounded serialization. */
13
- static?: boolean;
14
- /** Optional viewer display state. Export/print snapshot APIs deliberately use saved display. */
15
- layerVisibilityOverrides?: readonly LayerVisibilityOverride[];
16
- }
17
- export declare function renderPage(model: VisioDocument, page: VisioPage, options?: RenderOptions): RenderResult;
@@ -1,4 +0,0 @@
1
- import type { VisioText } from 'ooxml-core/visio';
2
- import type { TextLayoutBudget } from './text-layout.js';
3
- /** Browser-font layout is approximate until compared with the licensed Visio reference corpus. */
4
- export declare function renderText(text: VisioText, warnings: Set<string>, budget?: TextLayoutBudget): SVGGElement;
@@ -1,41 +0,0 @@
1
- /** Every command the Visio ribbon, status bar or a shortcut can raise, as a `ribbon-action` event. */
2
- export type VisioRibbonAction = {
3
- type: 'history';
4
- key: 'undo' | 'redo';
5
- } | {
6
- type: 'tool';
7
- tool: 'pointer' | 'rectangle';
8
- } | {
9
- type: 'delete';
10
- } | {
11
- type: 'pane';
12
- pane: 'shapes' | 'inspector';
13
- } | {
14
- type: 'reveal';
15
- panel: 'edit' | 'notes' | 'selection' | 'layers';
16
- focusText?: boolean;
17
- } | {
18
- type: 'grid';
19
- } | {
20
- type: 'panZoom';
21
- } | {
22
- type: 'ruler';
23
- } | {
24
- type: 'fullscreen';
25
- } | {
26
- type: 'zoom';
27
- mode: 'fit' | 'width' | 'actual';
28
- } | {
29
- type: 'zoomTo';
30
- percent: number;
31
- } | {
32
- type: 'search';
33
- } | {
34
- type: 'page';
35
- step: 1 | -1;
36
- };
37
- /** Event name shared by every ribbon control; detail is the typed action. */
38
- export declare const RIBBON_ACTION_EVENT = "ribbon-action";
39
- export type RibbonActionEvent = CustomEvent<VisioRibbonAction>;
40
- /** Internal, non-composed event: it stays inside the viewer's shadow tree. */
41
- export declare function emitRibbonAction(target: EventTarget, action: VisioRibbonAction): void;
@@ -1,2 +0,0 @@
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 +0,0 @@
1
- /**
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
- */
6
- export declare function buildHomePanel(doc: Document, panel: HTMLElement): void;
@@ -1,2 +0,0 @@
1
- /** Annotate the ribbon for KeyTips. Labels and ids are static application strings. */
2
- export declare function applyKeyTips(toolbar: HTMLElement): void;
@@ -1,12 +0,0 @@
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,60 +0,0 @@
1
- import { type VisioRibbonAction } from './ribbon-action.js';
2
- /** A shared `office-ui-*` command element with Visio state hooks. */
3
- export type RibbonCommand = HTMLElement & {
4
- disabled: boolean;
5
- };
6
- /**
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.
10
- */
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';
19
- keys?: [aria: string, hint: string];
20
- pressed?: boolean;
21
- controls?: string;
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;
50
- /** A keyboard-navigable row of groups (the shared `office-ui-toolbar`). */
51
- export declare function commandRow(doc: Document, label: string, children: readonly HTMLElement[]): 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
- };