ooxml-ui 1.3.0 → 1.4.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 (60) hide show
  1. package/custom-elements.json +101 -2
  2. package/dist/chrome/find-bar.d.ts +85 -0
  3. package/dist/chrome/find-bar.d.ts.map +1 -1
  4. package/dist/chrome/find-replace-fields.d.ts +21 -0
  5. package/dist/chrome/find-replace-fields.d.ts.map +1 -0
  6. package/dist/{chunk-723JC3OC.js → chunk-BOIZWKM7.js} +154 -48
  7. package/dist/{chunk-5OFAJDMQ.js → chunk-L4XGRNHF.js} +1 -1
  8. package/dist/{chunk-V6P6KZCO.js → chunk-R3LV6SGC.js} +2 -2
  9. package/dist/clipboard-worker.js +21 -0
  10. package/dist/controls.d.ts +1 -1
  11. package/dist/controls.d.ts.map +1 -1
  12. package/dist/controls.js +1 -1
  13. package/dist/docx.js +1 -1
  14. package/dist/index.js +3 -3
  15. package/dist/keytips.d.ts.map +1 -1
  16. package/dist/menu/menu-button.d.ts +11 -1
  17. package/dist/menu/menu-button.d.ts.map +1 -1
  18. package/dist/teams.js +2 -2
  19. package/dist/visio/binding.d.ts +10 -2
  20. package/dist/visio/clipboard-capture.d.ts +39 -0
  21. package/dist/visio/clipboard-worker.d.ts +1 -0
  22. package/dist/visio/controller.d.ts +45 -8
  23. package/dist/visio/creation-token.d.ts +26 -0
  24. package/dist/visio/index.d.ts +3 -1
  25. package/dist/visio/replacement-token.d.ts +56 -0
  26. package/dist/visio/ribbon-action.d.ts +61 -2
  27. package/dist/visio/ribbon-parts.d.ts +3 -2
  28. package/dist/visio/ribbon-router.d.ts +14 -1
  29. package/dist/visio/ribbon-style-options.d.ts +5 -0
  30. package/dist/visio/viewer-arrangement.d.ts +13 -0
  31. package/dist/visio/viewer-backstage.d.ts +1 -0
  32. package/dist/visio/viewer-clipboard.d.ts +21 -0
  33. package/dist/visio/viewer-commands.d.ts +5 -0
  34. package/dist/visio/viewer-draw-tool.d.ts +9 -29
  35. package/dist/visio/viewer-drawing-gesture.d.ts +36 -0
  36. package/dist/visio/viewer-duplication.d.ts +11 -0
  37. package/dist/visio/viewer-element.d.ts +11 -1
  38. package/dist/visio/viewer-formatting.d.ts +12 -0
  39. package/dist/visio/viewer-gesture-overlays.d.ts +2 -0
  40. package/dist/visio/viewer-handle-events.d.ts +3 -0
  41. package/dist/visio/viewer-layers.d.ts +1 -2
  42. package/dist/visio/viewer-movement-preview.d.ts +7 -0
  43. package/dist/visio/viewer-new-drawing.d.ts +5 -0
  44. package/dist/visio/viewer-page-point.d.ts +6 -0
  45. package/dist/visio/viewer-paint-dialog.d.ts +28 -0
  46. package/dist/visio/viewer-paint-menu.d.ts +4 -0
  47. package/dist/visio/viewer-paint-properties.d.ts +13 -0
  48. package/dist/visio/viewer-pointer-gestures.d.ts +14 -0
  49. package/dist/visio/viewer-replace-status.d.ts +6 -0
  50. package/dist/visio/viewer-replace.d.ts +14 -0
  51. package/dist/visio/viewer-resize-frame.d.ts +9 -0
  52. package/dist/visio/viewer-resize-handles.d.ts +14 -0
  53. package/dist/visio/viewer-search.d.ts +15 -0
  54. package/dist/visio/viewer-size-position.d.ts +13 -0
  55. package/dist/visio/viewer-text-draft.d.ts +9 -0
  56. package/dist/visio/viewer-text-tool.d.ts +17 -0
  57. package/dist/visio/worker-clipboard.d.ts +16 -0
  58. package/dist/visio.js +5948 -2618
  59. package/dist/xlsx.js +4 -4
  60. package/package.json +2 -2
@@ -1,43 +1,23 @@
1
1
  import type { VisioPage } from 'ooxml-core/visio';
2
- import type { CanvasTool } from './ribbon-action.js';
3
- import type { ViewerController } from './controller.js';
2
+ import { type VisioDrawingPoint } from 'ooxml-core/visio/ui';
3
+ import type { ViewerController, ViewerState } from './controller.js';
4
+ export { pagePoint } from './viewer-page-point.js';
4
5
  export { visioNextShapeId as nextShapeId } from 'ooxml-core/visio/ui';
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'>, options?: {
7
- snap?: boolean;
8
- bounded?: boolean;
9
- }): {
10
- x: number;
11
- y: number;
12
- } | undefined;
13
- /**
14
- * Create one rectangle through core and select it. `centre` is in top-left page inches (SVG
15
- * space); core pins are centre points in bottom-left, y-up drawing inches.
16
- */
17
- export declare function insertRectangle(controller: ViewerController, page: VisioPage, centre: {
18
- x: number;
19
- y: number;
20
- }, size: {
6
+ export declare function insertRectangle(controller: ViewerController, page: VisioPage, centre: VisioDrawingPoint, size: {
21
7
  width: number;
22
8
  height: number;
23
9
  }): Promise<string>;
24
- export declare function insertLine(controller: ViewerController, page: VisioPage, begin: {
25
- x: number;
26
- y: number;
27
- }, end: {
28
- x: number;
29
- y: number;
30
- }): Promise<string>;
31
- /** Shared rectangle/line gesture lifecycle. Preview is DOM-only; core owns creation. */
10
+ export declare function insertLine(controller: ViewerController, page: VisioPage, begin: VisioDrawingPoint, end: VisioDrawingPoint): Promise<string>;
11
+ /** Core-backed ordinary shape drawing with one captured creation transaction. */
32
12
  export declare class ShapeDrawTool {
33
13
  #private;
34
- private readonly viewport;
35
14
  private readonly controller;
36
- private readonly options;
37
15
  constructor(viewport: HTMLElement, controller: ViewerController, options: {
38
- tool(): Exclude<CanvasTool, 'pointer'> | undefined;
16
+ tool(): 'rectangle' | 'ellipse' | 'line' | undefined;
39
17
  announce(message: string): void;
40
18
  });
41
19
  get drawing(): boolean;
20
+ cancel(): void;
21
+ render(state: ViewerState): void;
42
22
  wire(): () => void;
43
23
  }
@@ -0,0 +1,36 @@
1
+ import type { VisioPage, VisioDocument } from 'ooxml-core/visio';
2
+ import { type VisioDrawingPoint, type VisioDrawingTool } from 'ooxml-core/visio/ui';
3
+ import type { ViewerController, ViewerState } from './controller.js';
4
+ import type { ViewerCreationToken } from './creation-token.js';
5
+ export interface DrawingGesture {
6
+ pointer: number;
7
+ svg: SVGSVGElement;
8
+ page: VisioPage;
9
+ document: VisioDocument;
10
+ start: VisioDrawingPoint;
11
+ kind: VisioDrawingTool;
12
+ token: ViewerCreationToken;
13
+ preview: SVGRectElement | SVGEllipseElement | SVGLineElement;
14
+ sourceGeneration: number;
15
+ selection: ViewerState['selectedShapes'];
16
+ zoom: number;
17
+ layers: ViewerState['layerVisibilityOverrides'];
18
+ }
19
+ /** One captured drawing intent. Core plans geometry; the DOM owns capture and a temporary frame. */
20
+ export declare class ViewerDrawingGesture {
21
+ #private;
22
+ private readonly viewport;
23
+ private readonly controller;
24
+ private readonly options;
25
+ constructor(viewport: HTMLElement, controller: ViewerController, options: {
26
+ tool(): VisioDrawingTool | undefined;
27
+ finish(drag: DrawingGesture, end: VisioDrawingPoint): Promise<void>;
28
+ existingShape?(event: PointerEvent): boolean;
29
+ announce(message: string): void;
30
+ });
31
+ get drawing(): boolean;
32
+ current(drag: DrawingGesture): boolean;
33
+ render(_state: ViewerState): void;
34
+ wire(): () => void;
35
+ cancel(): void;
36
+ }
@@ -0,0 +1,11 @@
1
+ import type { ViewerController, ViewerState } from './controller.js';
2
+ /** Source duplication availability; the controller owns the transaction and new selection. */
3
+ export declare class ViewerDuplication {
4
+ private readonly root;
5
+ private readonly controller;
6
+ private readonly edit;
7
+ constructor(root: ShadowRoot, controller: ViewerController, edit: (run: () => Promise<void>, message: string) => void);
8
+ private reason;
9
+ run(): void;
10
+ render(state: ViewerState): void;
11
+ }
@@ -1,7 +1,8 @@
1
1
  import type { VisioDocument, VisioEdit } from 'ooxml-core/visio';
2
- import type { VsdxSource } from 'ooxml-core/visio/ui';
2
+ import type { VsdxSource, VisioShapeSelection } from 'ooxml-core/visio/ui';
3
3
  import { ViewerController } from './controller.js';
4
4
  import { type BackstagePage } from './backstage.js';
5
+ import type { CreateVsdxOptions } from 'ooxml-core/visio';
5
6
  import { type SvgExportOptions, type SvgExportResult } from './export-svg.js';
6
7
  import { type CurrentPagePrintSnapshotOptions, type PrintSnapshot } from './print-snapshot.js';
7
8
  declare const BaseElement: typeof HTMLElement;
@@ -19,6 +20,8 @@ export declare class VisioViewerElement extends BaseElement {
19
20
  set showToolbar(value: boolean);
20
21
  get renderWarnings(): readonly string[];
21
22
  load(source: VsdxSource): Promise<void>;
23
+ /** Create a source-backed drawing and name only the accepted request. */
24
+ createBlankDrawing(options?: CreateVsdxOptions): Promise<void>;
22
25
  /** Leave Visio's File backstage and return to the drawing. */
23
26
  closeBackstage(): void;
24
27
  /** Open Visio's File backstage at a page (Info by default). */
@@ -26,6 +29,13 @@ export declare class VisioViewerElement extends BaseElement {
26
29
  /** Name of the last opened local file, or empty for bytes, models and closed drawings. */
27
30
  get fileName(): string;
28
31
  applyEdits(edits: readonly VisioEdit[]): Promise<void>;
32
+ selectShapes(shapes: readonly VisioShapeSelection[]): void;
33
+ selectAll(): void;
34
+ clearSelection(): void;
35
+ duplicateSelection(): Promise<void>;
36
+ copySelection(): Promise<void>;
37
+ cutSelection(): Promise<void>;
38
+ pasteSelection(): Promise<void>;
29
39
  replacePlainText(pageId: string, shapeId: string, text: string): Promise<void>;
30
40
  undo(): Promise<void>;
31
41
  redo(): Promise<void>;
@@ -0,0 +1,12 @@
1
+ import type { ViewerController, ViewerState } from './controller.js';
2
+ import type { VisioFormattingAction } from './ribbon-action.js';
3
+ /** Selection-aware ribbon presentation; all writes go through the controller's edit worker. */
4
+ export declare class ViewerFormatting {
5
+ #private;
6
+ private readonly root;
7
+ private readonly controller;
8
+ private readonly edit;
9
+ constructor(root: ShadowRoot, controller: ViewerController, edit: (run: () => Promise<void>, success: string) => void);
10
+ run(action: VisioFormattingAction): void;
11
+ render(state: ViewerState): void;
12
+ }
@@ -0,0 +1,2 @@
1
+ /** Restore only captured nodes; a replacement render owns its newly created overlays. */
2
+ export declare function hideGestureOverlays(viewport: HTMLElement, selector: string): () => void;
@@ -16,4 +16,7 @@ export declare function wireHandleEvents(viewport: HTMLElement, callbacks: {
16
16
  move(event: PointerEvent): void;
17
17
  finish(event: PointerEvent): Promise<void>;
18
18
  cancel(): void;
19
+ /** General shape drags leave ordinary below-threshold clicks unchanged. */
20
+ shouldSuppressClick?(): boolean;
21
+ consumeClick?(): boolean;
19
22
  }): () => void;
@@ -1,3 +1,4 @@
1
+ export { hasVisibleShapeContent } from 'ooxml-core/visio/ui';
1
2
  import { type VisioDocument, type VisioShape } from 'ooxml-core/visio';
2
3
  /** UI limits. Visibility semantics and shape traversal remain in ooxml-core. */
3
4
  export declare const VIEWER_LAYER_LIMITS: Readonly<{
@@ -18,5 +19,3 @@ export declare function visibleSelection(model: VisioDocument | null, pageIndex:
18
19
  readonly id: string;
19
20
  readonly pageId?: string;
20
21
  } | null, visible: WeakMap<VisioShape, boolean>): boolean;
21
- /** Rendering eligibility shared by selection and SVG containers; no format interpretation. */
22
- export declare function hasVisibleShapeContent(shape: VisioShape, visible: WeakMap<VisioShape, boolean> | undefined, cache?: WeakMap<VisioShape, boolean>): boolean;
@@ -0,0 +1,7 @@
1
+ import type { VisioPage } from 'ooxml-core/visio';
2
+ import { type VisioPagePoint } from 'ooxml-core/visio/ui';
3
+ /** Share existing inert SVG resources; moving a preview never mutates the scene or source. */
4
+ export declare function createMovementPreview(svg: SVGSVGElement, page: VisioPage, ids: readonly string[]): {
5
+ update(delta: VisioPagePoint): void;
6
+ dispose(): void;
7
+ };
@@ -0,0 +1,5 @@
1
+ /** File New and its shortcut share the element's source lifecycle. */
2
+ export declare function wireNewDrawing(root: ShadowRoot, create: () => Promise<void>, busy: () => boolean, announce: (message: string) => void): {
3
+ run(): void;
4
+ dispose(): void;
5
+ };
@@ -0,0 +1,6 @@
1
+ import type { VisioPage } from 'ooxml-core/visio';
2
+ /** Client coordinates projected into physical SVG page inches. */
3
+ export declare function pagePoint(svg: SVGSVGElement, page: VisioPage, event: Pick<MouseEvent, 'clientX' | 'clientY'>, options?: {
4
+ snap?: boolean;
5
+ bounded?: boolean;
6
+ }): import("ooxml-core/visio/ui").VisioDrawingPoint | undefined;
@@ -0,0 +1,28 @@
1
+ export type PaintField = 'fillPattern' | 'fillBackgroundColor' | 'fillTransparency' | 'linePattern' | 'lineTransparency';
2
+ export type PaintInput = HTMLInputElement | (HTMLElement & {
3
+ value: string;
4
+ disabled: boolean;
5
+ options: {
6
+ value: string;
7
+ label: string;
8
+ disabled?: boolean;
9
+ }[];
10
+ });
11
+ export type PaintDialog = HTMLElement & {
12
+ open: boolean;
13
+ show(): void;
14
+ close(): void;
15
+ updateComplete: Promise<boolean>;
16
+ };
17
+ export type PaintButton = HTMLElement & {
18
+ disabled: boolean;
19
+ };
20
+ export declare const paintFields: readonly PaintField[];
21
+ /** Typed presentation only; the core defines native pattern and transparency semantics. */
22
+ export declare function createPaintDialog(doc: Document): {
23
+ dialog: PaintDialog;
24
+ fields: Map<PaintField, PaintInput>;
25
+ error: HTMLParagraphElement;
26
+ apply: PaintButton;
27
+ cancel: PaintButton;
28
+ };
@@ -0,0 +1,4 @@
1
+ import type { VisioShape } from 'ooxml-core/visio';
2
+ import type { RibbonCommand } from './ribbon-parts.js';
3
+ /** Paint menu checks use source property state; mixed selections have no checked choice. */
4
+ export declare function renderPaintMenus(root: ShadowRoot, shapes: readonly VisioShape[], reason: string, set: (element: RibbonCommand | null, reason: string) => void): void;
@@ -0,0 +1,13 @@
1
+ import type { ViewerController, ViewerState } from './controller.js';
2
+ /** Stable selection draft; one changed-fields-only worker transaction commits the dialog. */
3
+ export declare class ViewerPaintProperties {
4
+ #private;
5
+ private readonly root;
6
+ private readonly controller;
7
+ private readonly announce;
8
+ constructor(root: ShadowRoot, controller: ViewerController, announce: (message: string) => void);
9
+ wire(): () => void;
10
+ show(): void;
11
+ close(): void;
12
+ render(state: ViewerState): void;
13
+ }
@@ -0,0 +1,14 @@
1
+ import type { ViewerController, ViewerState } from './controller.js';
2
+ /** Direct pointer movement and full-enclosure marquee; release is the only source edit. */
3
+ export declare class ViewerPointerGestures {
4
+ #private;
5
+ private readonly viewport;
6
+ private readonly controller;
7
+ private readonly options;
8
+ constructor(viewport: HTMLElement, controller: ViewerController, options: {
9
+ active(): boolean;
10
+ announce(message: string): void;
11
+ });
12
+ render(state: ViewerState): void;
13
+ wire(): () => void;
14
+ }
@@ -0,0 +1,6 @@
1
+ import type { VisioTextOccurrence } from 'ooxml-core/visio/ui';
2
+ import type { ViewerState } from './controller.js';
3
+ import type { FindBar } from './viewer-search.js';
4
+ export declare const sameTextOccurrence: (a: VisioTextOccurrence, b: VisioTextOccurrence) => boolean;
5
+ /** Occurrence status is presentation only; the controller and core own all matching. */
6
+ export declare function renderReplaceStatus(bar: FindBar, state: ViewerState, matches: readonly VisioTextOccurrence[], current: VisioTextOccurrence | undefined, pending: boolean, summary: string): void;
@@ -0,0 +1,14 @@
1
+ import type { ViewerController, ViewerState } from './controller.js';
2
+ import { type FindBar } from './viewer-search.js';
3
+ /** Literal occurrence draft. Controller tokens retain scope through owned result navigation. */
4
+ export declare class ViewerReplace {
5
+ #private;
6
+ private readonly bar;
7
+ private readonly controller;
8
+ private readonly announce;
9
+ constructor(bar: FindBar, controller: ViewerController, announce: (message: string) => void);
10
+ wire(): () => void;
11
+ showReplace(): void;
12
+ showFind(): void;
13
+ render(state: ViewerState): void;
14
+ }
@@ -0,0 +1,9 @@
1
+ import type { VisioPage, VisioShape } from 'ooxml-core/visio';
2
+ import { type VisioResizeFrame } from 'ooxml-core/visio/ui';
3
+ /** A bounds preview, leaving the saved shape content visible until source acceptance. */
4
+ export declare function createResizeFrame(svg: SVGSVGElement, page: VisioPage, shape: VisioShape, scale: number): {
5
+ element: SVGGElement;
6
+ rectangle: SVGRectElement;
7
+ update: (frame: VisioResizeFrame) => void;
8
+ dispose: () => void;
9
+ };
@@ -0,0 +1,14 @@
1
+ import type { ViewerController, ViewerState } from './controller.js';
2
+ /** Eight source-backed single-selection handles; saved content is never speculatively resized. */
3
+ export declare class ViewerResizeHandles {
4
+ #private;
5
+ private readonly viewport;
6
+ private readonly controller;
7
+ private readonly options;
8
+ constructor(viewport: HTMLElement, controller: ViewerController, options: {
9
+ active(): boolean;
10
+ announce(message: string): void;
11
+ });
12
+ render(state: ViewerState): void;
13
+ wire(): () => void;
14
+ }
@@ -4,6 +4,21 @@ export type FindBar = HTMLElement & {
4
4
  value: string;
5
5
  status: string;
6
6
  statusTitle: string;
7
+ replaceMode: boolean;
8
+ replacement: string;
9
+ replacementMaxlength: number;
10
+ scope: string;
11
+ scopeOptions: {
12
+ value: string;
13
+ label: string;
14
+ disabled?: boolean;
15
+ }[];
16
+ matchCase: boolean;
17
+ matchCaseDisabled: boolean;
18
+ replaceDisabled: boolean;
19
+ replaceAllDisabled: boolean;
20
+ error: string;
21
+ updateComplete: Promise<boolean>;
7
22
  show(): void;
8
23
  close(): void;
9
24
  };
@@ -0,0 +1,13 @@
1
+ import type { ViewerController, ViewerState } from './controller.js';
2
+ /** Static presentation only; source quantities and edit conversion belong to core. */
3
+ export declare function createSizePosition(doc: Document): HTMLElement;
4
+ /** One committed numeric field creates one strict selection transaction. */
5
+ export declare class ViewerSizePosition {
6
+ #private;
7
+ private readonly controller;
8
+ private readonly checked;
9
+ constructor(root: ShadowRoot, controller: ViewerController, checked: (open: boolean) => void);
10
+ toggle(open?: boolean): void;
11
+ wire(): () => void;
12
+ render(state: ViewerState): void;
13
+ }
@@ -0,0 +1,9 @@
1
+ import type { VisioDrawingBounds } from 'ooxml-core/visio/ui';
2
+ /** Plain browser input, separate from the saved SVG text and its layout. */
3
+ export declare function createTextDraft(viewport: HTMLElement, svg: SVGSVGElement, bounds: VisioDrawingBounds, apply: () => void, cancel: () => void): {
4
+ element: HTMLElement;
5
+ input: HTMLTextAreaElement;
6
+ error: HTMLParagraphElement;
7
+ setBusy(busy: boolean): void;
8
+ dispose(): void;
9
+ };
@@ -0,0 +1,17 @@
1
+ import type { ViewerController, ViewerState } from './controller.js';
2
+ /** Fixed-size plain-text boxes. Native automatic sizing and rich content editing are separate. */
3
+ export declare class ViewerTextTool {
4
+ #private;
5
+ private readonly viewport;
6
+ private readonly controller;
7
+ private readonly options;
8
+ constructor(viewport: HTMLElement, controller: ViewerController, options: {
9
+ active(): boolean;
10
+ announce(message: string): void;
11
+ revealEdit(): void;
12
+ });
13
+ get drafting(): boolean;
14
+ wire(): () => void;
15
+ render(state: ViewerState): void;
16
+ cancel(): void;
17
+ }
@@ -0,0 +1,16 @@
1
+ export interface ClipboardCaptureRequest {
2
+ bytes: ArrayBuffer;
3
+ pageId: string;
4
+ shapeIds: readonly string[];
5
+ }
6
+ export interface ClipboardWorkerLike {
7
+ onmessage: ((event: MessageEvent) => void) | null;
8
+ onerror: ((event: ErrorEvent) => void) | null;
9
+ postMessage(message: ClipboardCaptureRequest, transfer: Transferable[]): void;
10
+ terminate(): void;
11
+ }
12
+ export type CancellableClipboardCapture = ((bytes: Uint8Array, pageId: string, shapeIds: readonly string[]) => Promise<string>) & {
13
+ cancel?: () => void;
14
+ };
15
+ /** Isolated source capture with an owned input, bounded response and cancellable lifetime. */
16
+ export declare function createWorkerClipboardCapture(factory?: () => ClipboardWorkerLike, timeoutMs?: number): CancellableClipboardCapture;