@quirekit/pptx-editor 0.3.0 → 0.3.1

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.
@@ -1,5 +1,4 @@
1
- import { EditorWorkspaceLocale } from "@quirekit/editor-ui/vue/localization";
2
- import { AnimationDirection, AnimationEffect, AnimationShape, AnimationStartCondition, AnimationTextBuild, MediaPlayback, PresentationData, SlideAnimationStep, SlideData } from "@quirekit/office-kit-pptx";
1
+ import { AnimationDirection, AnimationEffect, AnimationShape, AnimationStartCondition, AnimationTextBuild, CustomGeometryPathInput, PresentationData, SlideData } from "@quirekit/office-kit-pptx";
3
2
  import { CommandDescriptor } from "@quirekit/extension-authoring";
4
3
  //#region src/commands/geometry/types.d.ts
5
4
  /** A point in frame fractions: 0 is the frame's left or top edge, 1 its right or bottom edge. */
@@ -325,6 +324,441 @@ interface PptxPastedTable {
325
324
  readonly rowHeights?: readonly number[];
326
325
  }
327
326
  //#endregion
327
+ //#region src/commands/draw/types.d.ts
328
+ /** Colour roles of a design language; slides name these instead of hex values so they stay in one palette. */
329
+ type PptxDesignRole = "background" | "surface" | "text" | "muted" | "dark" | "primary" | "accent" | "data3" | "data4" | "data5" | "data6";
330
+ /** A design language's colours, every role resolved to `#RRGGBB`. */
331
+ type PptxDesignPalette = Readonly<Record<PptxDesignRole, string>>;
332
+ /** Colours a design language is asked for: the primary colour, the page colour, and any other role decided. */
333
+ type PptxDesignPaletteInput = {
334
+ readonly primary: string;
335
+ readonly background: string;
336
+ } & Partial<Readonly<Record<Exclude<PptxDesignRole, "primary" | "background">, string>>>;
337
+ /** A typeface for Chinese text and one for Latin text. */
338
+ interface PptxDesignFont {
339
+ /** Family for Chinese text. */
340
+ readonly chinese: string;
341
+ /** Family for Latin text. */
342
+ readonly latin: string;
343
+ }
344
+ /** Type sizes in points. */
345
+ interface PptxDesignTypeScale {
346
+ /** Cover, section and statement lines. */
347
+ readonly display: number;
348
+ /** Slide titles. */
349
+ readonly title: number;
350
+ /** Subtitles and item headings. */
351
+ readonly subtitle: number;
352
+ /** Running text. */
353
+ readonly body: number;
354
+ /** Labels, sources and page numbers. */
355
+ readonly small: number;
356
+ }
357
+ /** Kinds of page a design language gives its own background. */
358
+ type PptxPageKind = "cover" | "section" | "content" | "data" | "quote" | "closing";
359
+ /** How a deck draws its components, so every card, badge and header of the deck looks alike. */
360
+ interface PptxComponentSkin {
361
+ /** Corner rounding of cards and panels. */
362
+ readonly radius: "none" | "small" | "large";
363
+ /** Depth of cards: flat, a soft or lifted shadow, frosted glass, an outline, or a glowing outline. */
364
+ readonly depth: "flat" | "shadow" | "lifted" | "glass" | "outline" | "glow";
365
+ /** Fill of cards: the surface colour, a light tint of the primary colour, or none. */
366
+ readonly card: "surface" | "tint" | "none";
367
+ /** Shape of number and icon badges. */
368
+ readonly badge: "circle" | "rounded" | "square" | "diamond" | "ring" | "seal";
369
+ /** Content page title area: plain text, a full-width colour band, or a small colour chip before the title. */
370
+ readonly header: "plain" | "band" | "chip";
371
+ /** Byline under a cover title: plain text, a filled pill, or a short rule above it. */
372
+ readonly byline: "plain" | "pill" | "rule";
373
+ /** How items are numbered: 1, 01 or 一. */
374
+ readonly numbers: "arabic" | "padded" | "chinese";
375
+ }
376
+ /** A style card of the deck's own: what a reference or the user's description was distilled into. */
377
+ interface PptxCustomStyle {
378
+ /** Short name. */
379
+ readonly name: string;
380
+ /** The design claim in one sentence. */
381
+ readonly idea: string;
382
+ /** Hero visual: what it is and how it is drawn. */
383
+ readonly hero: string;
384
+ /** Style words for generated pictures. */
385
+ readonly picture?: string | undefined;
386
+ /** Element vocabulary. */
387
+ readonly elements: readonly string[];
388
+ /** Element library motifs that suit it. */
389
+ readonly motifs?: readonly string[] | undefined;
390
+ /** What does not belong in it. */
391
+ readonly taboos?: readonly string[] | undefined;
392
+ /** Where it came from: a reference picture, a template or the user's words, in a few words. */
393
+ readonly source?: string | undefined;
394
+ }
395
+ /** A colour as drawing takes it: a role of the design language or `#RRGGBB`. */
396
+ type PptxDrawColor = string;
397
+ /** What an element is for, so the editor can find the header, leave decoration out of builds and number pages. */
398
+ type PptxDrawRole = "eyebrow" | "title" | "subtitle" | "body" | "number" | "label" | "quote" | "display" | "small" | "decoration" | "pageNumber";
399
+ /** How text in a text element or a shape is set. */
400
+ interface PptxDrawText {
401
+ /** Text, one paragraph per line; `**` around a stretch sets it bold in the page's emphasis colour. */
402
+ readonly text: string;
403
+ /** Size in points; the design language's size for the role when left out. */
404
+ readonly size?: number;
405
+ /** Colour; the text role when left out. */
406
+ readonly color?: PptxDrawColor;
407
+ /** Heading or body typeface; heading for titles, numbers and quotes when left out. */
408
+ readonly font?: "heading" | "body";
409
+ /** Bold. */
410
+ readonly bold?: boolean;
411
+ /** Italic. */
412
+ readonly italic?: boolean;
413
+ /** Horizontal alignment. */
414
+ readonly align?: "left" | "center" | "right";
415
+ /** Vertical placement in the box. */
416
+ readonly anchor?: "top" | "middle" | "bottom";
417
+ /** Line spacing as a multiple of single spacing. */
418
+ readonly lineSpacing?: number;
419
+ /** Bullets before every paragraph. */
420
+ readonly bullets?: boolean;
421
+ }
422
+ /** Position and size in centimetres from the slide's top left corner. */
423
+ interface PptxDrawFrame {
424
+ /** Left edge. */
425
+ readonly x: number;
426
+ /** Top edge. */
427
+ readonly y: number;
428
+ /** Width. */
429
+ readonly w: number;
430
+ /** Height. */
431
+ readonly h: number;
432
+ /** Clockwise rotation in degrees. */
433
+ readonly rotation?: number;
434
+ }
435
+ /** A gradient between two colours. */
436
+ interface PptxDrawGradient {
437
+ /** Colour at the start, or at the centre of a radial gradient. */
438
+ readonly from: PptxDrawColor;
439
+ /** Colour at the end, or at the rim of a radial gradient. */
440
+ readonly to: PptxDrawColor;
441
+ /** Direction in degrees, 90 running top to bottom; ignored for a radial gradient. */
442
+ readonly angle?: number;
443
+ /** Whether it spreads from the centre outwards, as light or a glow does. */
444
+ readonly radial?: boolean;
445
+ /** Opacity at the start, from 0 to 1. */
446
+ readonly fromOpacity?: number;
447
+ /** Opacity at the end, from 0 to 1, so a colour can fade into what lies under it. */
448
+ readonly toOpacity?: number;
449
+ }
450
+ /** Depth and light on a shape or text box. */
451
+ interface PptxDrawEffects {
452
+ /** Drop shadow: soft for a card resting on the page, lifted for one that floats, strong for heavy depth. */
453
+ readonly shadow?: "soft" | "lifted" | "strong";
454
+ /** Glow around the object, in a colour and a radius in points. */
455
+ readonly glow?: {
456
+ readonly color: PptxDrawColor;
457
+ readonly size: number;
458
+ };
459
+ /** Blurred edge in points, so a shape melts into the page. */
460
+ readonly softEdge?: number;
461
+ }
462
+ /** One object of a drawn slide. */
463
+ type PptxDrawElement = (PptxDrawFrame & PptxDrawText & PptxDrawEffects & {
464
+ readonly kind: "text";
465
+ readonly role?: PptxDrawRole;
466
+ readonly fill?: PptxDrawColor | PptxDrawGradient | null;
467
+ }) | (PptxDrawFrame & Partial<PptxDrawText> & PptxDrawEffects & {
468
+ readonly kind: "shape";
469
+ readonly role?: PptxDrawRole; /** Preset geometry. */
470
+ readonly shape: string; /** Fill colour or gradient; none when left out or null. */
471
+ readonly fill?: PptxDrawColor | PptxDrawGradient | null; /** Fill opacity from 0 to 1. */
472
+ readonly opacity?: number; /** Outline colour; none when left out or null. */
473
+ readonly line?: PptxDrawColor | null; /** Dash pattern of the outline. */
474
+ readonly dash?: "solid" | "dash" | "dot"; /** Outline width in points. */
475
+ readonly lineWidth?: number; /** Corner radius of a rounded rectangle as a share of its shorter side, up to 0.5. */
476
+ readonly radius?: number; /** Inner margin of its text in centimetres. */
477
+ readonly padding?: number;
478
+ }) | {
479
+ readonly kind: "line";
480
+ readonly role?: PptxDrawRole; /** Start, in centimetres. */
481
+ readonly x1: number;
482
+ readonly y1: number; /** End, in centimetres. */
483
+ readonly x2: number;
484
+ readonly y2: number; /** Colour; the muted role when left out. */
485
+ readonly color?: PptxDrawColor; /** Width in points. */
486
+ readonly width?: number; /** Dash pattern. */
487
+ readonly dash?: "solid" | "dash" | "dot"; /** Arrowheads. */
488
+ readonly arrow?: "none" | "end" | "both";
489
+ } | (PptxDrawFrame & {
490
+ readonly kind: "chart"; /** Chart kind. */
491
+ readonly chart: "column" | "bar" | "line" | "pie" | "doughnut" | "area"; /** Category labels. */
492
+ readonly categories: readonly string[]; /** Series with one value per category. */
493
+ readonly series: readonly {
494
+ readonly name: string;
495
+ readonly values: readonly number[];
496
+ }[]; /** Categories to pick out: their bars keep the full colour while the others fade, when the chart has one series of bars. */
497
+ readonly highlight?: readonly string[];
498
+ }) | (PptxDrawFrame & {
499
+ readonly kind: "icon";
500
+ readonly role?: PptxDrawRole; /** Line icon name. */
501
+ readonly icon: string; /** Stroke colour; the primary role when left out. */
502
+ readonly color?: PptxDrawColor; /** Stroke width in points; in proportion to the icon's size when left out. */
503
+ readonly lineWidth?: number; /** The icon's paths, resolved from its name before drawing. */
504
+ readonly paths?: readonly CustomGeometryPathInput[];
505
+ }) | (PptxDrawFrame & {
506
+ readonly kind: "motif";
507
+ readonly role?: PptxDrawRole; /** Name of an element of the element library. */
508
+ readonly motif: string; /** Main colour; the library's default for the element when left out. */
509
+ readonly color?: PptxDrawColor; /** Second colour. */
510
+ readonly color2?: PptxDrawColor; /** Overall opacity from 0 to 1. */
511
+ readonly opacity?: number; /** How densely it fills its frame. */
512
+ readonly density?: "sparse" | "medium" | "dense"; /** Number of repeated units. */
513
+ readonly count?: number; /** Seed of its random layout, so another seed draws another arrangement. */
514
+ readonly seed?: number; /** Variant the library lists for the element. */
515
+ readonly variant?: string; /** Text, for elements that hold some. */
516
+ readonly text?: string;
517
+ }) | (PptxDrawFrame & {
518
+ readonly kind: "component";
519
+ readonly role?: PptxDrawRole; /** Name of a component of the component library. */
520
+ readonly component: string; /** Variant the library lists for the component. */
521
+ readonly variant?: string; /** Content: whichever fields the component takes. */
522
+ readonly content: PptxComponentContent;
523
+ }) | (PptxDrawFrame & {
524
+ readonly kind: "image";
525
+ readonly role?: PptxDrawRole; /** What the picture shows, for the host to generate it. */
526
+ readonly prompt: string; /** Corner radius as a share of the shorter side. */
527
+ readonly radius?: number;
528
+ }) | (PptxDrawFrame & {
529
+ readonly kind: "illustration";
530
+ readonly role?: PptxDrawRole; /** SVG markup of a drawing the assistant made, with a viewBox. */
531
+ readonly svg: string;
532
+ }) | (PptxDrawFrame & {
533
+ readonly kind: "table"; /** Rows of cell text, the first row being the header. */
534
+ readonly rows: readonly (readonly string[])[]; /** First-cell text of the rows to pick out in the emphasis colour. */
535
+ readonly highlight?: readonly string[];
536
+ });
537
+ /** A drawn slide's background: a colour or a gradient. */
538
+ type PptxDrawBackground = PptxDrawColor | PptxDrawGradient;
539
+ /** One item of a component that repeats: a card, a step, a stat, a timeline node or an agenda entry. */
540
+ interface PptxComponentItem {
541
+ /** Heading. */
542
+ readonly title?: string | undefined;
543
+ /** Running text. */
544
+ readonly text?: string | undefined;
545
+ /** Large value, such as a figure. */
546
+ readonly value?: string | undefined;
547
+ /** Small label, such as a date or a unit. */
548
+ readonly label?: string | undefined;
549
+ /** Line icon name. */
550
+ readonly icon?: string | undefined;
551
+ /** Whether this item is the one that matters most, which a component sets apart. */
552
+ readonly highlight?: boolean | undefined;
553
+ /** Parts of the item, such as the modules of one layer of an architecture. */
554
+ readonly parts?: readonly string[] | undefined;
555
+ /** The icon's paths, resolved from its name before drawing. */
556
+ readonly paths?: readonly CustomGeometryPathInput[] | undefined;
557
+ }
558
+ /** What a component shows. */
559
+ interface PptxComponentContent {
560
+ /** Small line above the title. */
561
+ readonly eyebrow?: string | undefined;
562
+ /** Title. */
563
+ readonly title?: string | undefined;
564
+ /** Part of the title to set in the primary colour. */
565
+ readonly accent?: string | undefined;
566
+ /** Subtitle. */
567
+ readonly subtitle?: string | undefined;
568
+ /** Byline: presenter, organization and date. */
569
+ readonly byline?: string | undefined;
570
+ /** Running text. */
571
+ readonly text?: string | undefined;
572
+ /** Who a quote or a mock message is from. */
573
+ readonly from?: string | undefined;
574
+ /** Items of a repeating component. */
575
+ readonly items?: readonly PptxComponentItem[] | undefined;
576
+ /** Left and right headings of a comparison, or the two ends of a matrix's horizontal axis, low then high. */
577
+ readonly sides?: readonly [string, string] | undefined;
578
+ /** The two ends of a matrix's vertical axis, low then high. */
579
+ readonly axes?: readonly [string, string] | undefined;
580
+ }
581
+ /** A typeface pair as a design language is given it: the Chinese family under chinese or family. */
582
+ interface PptxDesignFontInput {
583
+ /** Family for Chinese text. */
584
+ readonly chinese?: string;
585
+ /** Same as chinese. */
586
+ readonly family?: string;
587
+ /** Family for Latin text; the Chinese one when left out. */
588
+ readonly latin?: string;
589
+ /** Ignored: weight is set per text object. */
590
+ readonly weight?: string;
591
+ }
592
+ //#endregion
593
+ //#region src/template/types.d.ts
594
+ /** What a template page is for. */
595
+ type PptxTemplatePageKind = "cover" | "agenda" | "section" | "content" | "data" | "quote" | "closing";
596
+ /** What a slot of a template page holds. */
597
+ type PptxTemplateSlotRole = "title" | "subtitle" | "text" | "label" | "picture";
598
+ /** One place of a template page to fill. */
599
+ interface PptxTemplateSlot {
600
+ /** Name the slot is filled by, unique within its page or item. */
601
+ readonly key: string;
602
+ /** What it holds. */
603
+ readonly role: PptxTemplateSlotRole;
604
+ /** Shape id on the example slide; pages made from a layout give `placeholder` instead. */
605
+ readonly shape?: number | undefined;
606
+ /** Placeholder idx on the layout. */
607
+ readonly placeholder?: number | undefined;
608
+ /** Text the template shows there. */
609
+ readonly sample?: string | undefined;
610
+ /** Characters that fit, counting a Chinese character as one. */
611
+ readonly limit?: number | undefined;
612
+ /** Whether the template's own text stays when the slot is left out, such as a number or a decorative word. */
613
+ readonly fixed?: boolean | undefined;
614
+ }
615
+ /** One of the repeated items of a page, such as a card or a step. */
616
+ interface PptxTemplateItem {
617
+ /** Top-level shapes of the item, removed together when fewer items are given. */
618
+ readonly shapes: readonly number[];
619
+ /** What the item holds; the items of a page share their keys. */
620
+ readonly slots: readonly PptxTemplateSlot[];
621
+ }
622
+ /** Repeated items of a page. */
623
+ interface PptxTemplateItems {
624
+ /** Whether items stand side by side, one under another, or in rows and columns. */
625
+ readonly layout: "row" | "column" | "grid";
626
+ /** Items in reading order; a page takes up to this many. */
627
+ readonly members: readonly PptxTemplateItem[];
628
+ }
629
+ /** A frame in centimetres from the slide's top left corner. */
630
+ interface PptxTemplateFrame {
631
+ /** Left edge. */
632
+ readonly x: number;
633
+ /** Top edge. */
634
+ readonly y: number;
635
+ /** Width. */
636
+ readonly w: number;
637
+ /** Height. */
638
+ readonly h: number;
639
+ }
640
+ /** A page a template offers. */
641
+ interface PptxTemplatePage {
642
+ /** Name the page is used by, unique within the template. */
643
+ readonly key: string;
644
+ /** What the page is for. */
645
+ readonly kind: PptxTemplatePageKind;
646
+ /** Name shown to people. */
647
+ readonly name: string;
648
+ /** Where the page comes from: an example slide counted from 1, or a layout by name. */
649
+ readonly source: {
650
+ readonly slide: number;
651
+ } | {
652
+ readonly layout: string;
653
+ };
654
+ /** Places to fill outside the repeated items. */
655
+ readonly slots: readonly PptxTemplateSlot[];
656
+ /** Repeated items. */
657
+ readonly items?: PptxTemplateItems | undefined;
658
+ /** Where free content such as a chart or a diagram may be drawn. */
659
+ readonly area?: PptxTemplateFrame | undefined;
660
+ /** Shapes of the example content that drawing in the area replaces. */
661
+ readonly body?: readonly number[] | undefined;
662
+ }
663
+ /** Colours, typefaces and sizes of a template, as drawing uses them. */
664
+ interface PptxTemplateDesign {
665
+ /** Colour roles. */
666
+ readonly palette: PptxDesignPalette;
667
+ /** Heading and body typefaces. */
668
+ readonly fonts: {
669
+ readonly heading: PptxDesignFont;
670
+ readonly body: PptxDesignFont;
671
+ };
672
+ /** Type sizes in points. */
673
+ readonly type: PptxDesignTypeScale;
674
+ /** Page margin in centimetres. */
675
+ readonly margin: number;
676
+ }
677
+ /** Format name every manifest carries. */
678
+ declare const presentationTemplateFormat = "quirekit.presentation-template";
679
+ /** What a presentation template offers, beside its file: version 1 of the QuireKit presentation template standard. */
680
+ interface PptxTemplateManifest {
681
+ /** Format name. */
682
+ readonly format: typeof presentationTemplateFormat;
683
+ /** Version of the format. */
684
+ readonly formatVersion: 1;
685
+ /** Identity within its source. */
686
+ readonly id: string;
687
+ /** Version of the template. */
688
+ readonly version: string;
689
+ /** Name shown to people. */
690
+ readonly name: string;
691
+ /** What it is for. */
692
+ readonly description?: string | undefined;
693
+ /** Search words. */
694
+ readonly tags?: readonly string[] | undefined;
695
+ /** Pages it offers. */
696
+ readonly pages: readonly PptxTemplatePage[];
697
+ /** Its design; read from the file when left out. */
698
+ readonly design?: PptxTemplateDesign | undefined;
699
+ /** Rules its author states, such as where the logo needs room. */
700
+ readonly notes?: readonly string[] | undefined;
701
+ }
702
+ /** A template as a source lists it. */
703
+ interface PptxTemplateEntry {
704
+ /** Identity within its source. */
705
+ readonly id: string;
706
+ /** Name shown to people. */
707
+ readonly name: string;
708
+ /** What it is for. */
709
+ readonly description?: string | undefined;
710
+ /** Address of a picture of its first page, possibly a data address. */
711
+ readonly thumbnail?: string | undefined;
712
+ /** Search words. */
713
+ readonly tags?: readonly string[] | undefined;
714
+ }
715
+ /** A template's file with what is known about it. */
716
+ interface PptxTemplateFile {
717
+ /** Name, used when the manifest gives none. */
718
+ readonly name: string;
719
+ /** `.pptx` or `.potx` bytes. */
720
+ readonly bytes: Uint8Array;
721
+ /** Manifest as JSON data; the one inside the file, or the editor's own reading of the file, when left out. */
722
+ readonly manifest?: unknown;
723
+ }
724
+ /** Where templates come from: a company's own templates, a template library, or the templates a person uploaded. */
725
+ interface PptxTemplateSource {
726
+ /** Stable identity, kept in decks that use its templates. */
727
+ readonly id: string;
728
+ /** Name shown above its templates. */
729
+ readonly name: string;
730
+ /** @returns The templates it offers. */
731
+ list(): Promise<readonly PptxTemplateEntry[]>;
732
+ /** @param id - Template identity. @returns Its file, or undefined when it is gone. */
733
+ load(id: string): Promise<PptxTemplateFile | undefined>;
734
+ /** @param file - Template to keep. @param thumbnail - Picture of its first page. @returns Its identity; absent for sources people cannot add to. */
735
+ add?(file: PptxTemplateFile, thumbnail?: string): Promise<string>;
736
+ /** @param id - Template to delete; absent for sources people cannot change. */
737
+ remove?(id: string): Promise<void>;
738
+ }
739
+ /** Which template a deck uses; kept in the deck. */
740
+ interface PptxTemplateReference {
741
+ /** Source identity. */
742
+ readonly source: string;
743
+ /** Template identity within the source. */
744
+ readonly id: string;
745
+ /** Template version. */
746
+ readonly version: string;
747
+ /** Template name. */
748
+ readonly name: string;
749
+ }
750
+ /** A template ready to use. */
751
+ interface PptxLoadedTemplate {
752
+ /** Its file, opened; never edited. */
753
+ readonly presentation: PresentationData;
754
+ /** What it offers. */
755
+ readonly manifest: PptxTemplateManifest & {
756
+ readonly design: PptxTemplateDesign;
757
+ };
758
+ /** How decks refer to it. */
759
+ readonly reference: PptxTemplateReference;
760
+ }
761
+ //#endregion
328
762
  //#region src/view/layout/types.d.ts
329
763
  /** An axis-aligned rectangle in slide EMU. */
330
764
  interface PptxLayoutRect {
@@ -924,675 +1358,4 @@ type PptxChain = { readonly [Name in PptxCommandName]: (...args: Parameters<Pptx
924
1358
  /** How a shape's text runs: horizontal, East Asian vertical columns, every line turned 90° or 270°, or stacked letters. */
925
1359
  type PptxTextDirection = "horz" | "eaVert" | "vert" | "vert270" | "wordArtVert";
926
1360
  //#endregion
927
- //#region src/show/timeline/types.d.ts
928
- /** What a behaviour points at: a whole shape, or a range of its paragraphs. */
929
- interface PptxTimelineTarget {
930
- /** Shape id. */
931
- readonly shape: number;
932
- /** First and last paragraph counted from 0, or null for the whole shape. */
933
- readonly paragraphs: readonly [number, number] | null;
934
- }
935
- /** One key time of an `anim` behaviour. */
936
- interface PptxTimelineKey {
937
- /** Position in the behaviour's simple duration, 0–1. */
938
- readonly time: number;
939
- /** A number, or a formula over the shape's geometry such as `#ppt_x` or `0-#ppt_w/2`. */
940
- readonly value: number | string;
941
- /** Formula the value is put through, with `$` standing for it. */
942
- readonly formula: string | null;
943
- }
944
- /** What one behaviour changes, as PresentationML states it. */
945
- type PptxTimelineEffect = /** `p:set` of `style.visibility`. */{
946
- readonly kind: "visibility";
947
- readonly visible: boolean;
948
- } /** `p:animEffect`: a reveal or conceal by a named filter such as `fade` or `wipe(left)`. */ | {
949
- readonly kind: "filter";
950
- readonly filter: string;
951
- readonly entering: boolean;
952
- } /** `p:animMotion` along a path in fractions of the slide, relative to where the shape is laid out. */ | {
953
- readonly kind: "motion";
954
- readonly path: string;
955
- } /** `p:animScale` by a factor per axis, multiplying what the shape already shows. */ | {
956
- readonly kind: "scale";
957
- readonly by: readonly [number, number];
958
- } /** `p:animRot` by degrees, added to what the shape already shows. */ | {
959
- readonly kind: "rotate";
960
- readonly by: number;
961
- } /** `p:anim` or `p:set` of one attribute over key times; from/to values become two keys. */ | {
962
- readonly kind: "anim";
963
- readonly attribute: PptxTimelineAttribute;
964
- readonly keys: readonly PptxTimelineKey[];
965
- readonly discrete: boolean;
966
- };
967
- /** Attributes an `anim` behaviour can drive: the shape's centre, size, turn and opacity. */
968
- type PptxTimelineAttribute = "ppt_x" | "ppt_y" | "ppt_w" | "ppt_h" | "r" | "style.opacity";
969
- /**
970
- * One clock between a click group and a behaviour that changes how time runs: easing, reversal, repeats or
971
- * playing backwards. Containers that only delay their children add no clock of their own.
972
- */
973
- interface PptxTimeFrame {
974
- /** Start on the clock of the frame outside it, or of the click group for the outermost one, in ms. */
975
- readonly begin: number;
976
- /** Simple duration in ms; Infinity for an open-ended one. */
977
- readonly simple: number;
978
- /** Share of the simple duration spent speeding up. */
979
- readonly accel: number;
980
- /** Share of the simple duration spent slowing down. */
981
- readonly decel: number;
982
- /** Whether each repeat plays forward and back. */
983
- readonly autoReverse: boolean;
984
- /** Whether it plays backwards. */
985
- readonly reversed: boolean;
986
- /** Times it repeats; Infinity until something ends it. */
987
- readonly repeat: number;
988
- }
989
- /** A behaviour placed on the clock of its click group. */
990
- interface PptxScheduledBehavior {
991
- /** What it changes. */
992
- readonly effect: PptxTimelineEffect;
993
- /** What it points at. */
994
- readonly target: PptxTimelineTarget;
995
- /** Clocks from the click group down to the behaviour's own, which is last. */
996
- readonly frames: readonly PptxTimeFrame[];
997
- /** Milliseconds from the start of its click group to its start. */
998
- readonly begin: number;
999
- /** Milliseconds from the start of its click group to its end; Infinity for an open-ended one. */
1000
- readonly end: number;
1001
- /** Whether its value stays once it ends. */
1002
- readonly hold: boolean;
1003
- /** Class of the effect it belongs to: `entr`, `exit`, `emph`, `path` or null. */
1004
- readonly presetClass: string | null;
1005
- /** Order in the document, which decides between behaviours that start together. */
1006
- readonly order: number;
1007
- }
1008
- /** One click group of a slide's main sequence. */
1009
- interface PptxTimelineStop {
1010
- /** Whether it starts by itself as the slide opens rather than on a click. */
1011
- readonly auto: boolean;
1012
- /** Behaviours in start order. */
1013
- readonly behaviors: readonly PptxScheduledBehavior[];
1014
- /** Milliseconds until its last behaviour that ends has ended. */
1015
- readonly length: number;
1016
- }
1017
- /** A slide's main sequence ready to play. */
1018
- interface PptxTimeline {
1019
- /** Click groups in order. */
1020
- readonly stops: readonly PptxTimelineStop[];
1021
- /** Targets, by `targetKey`, that start hidden because their first entrance or exit is an entrance. */
1022
- readonly hiddenAtStart: ReadonlySet<string>;
1023
- }
1024
- //#endregion
1025
- //#region src/commands/slide-show/types.d.ts
1026
- /** Which slides a show presents. */
1027
- type PptxShowRange = {
1028
- readonly kind: "all";
1029
- } | {
1030
- readonly kind: "range";
1031
- readonly start: number;
1032
- readonly end: number;
1033
- } | {
1034
- readonly kind: "customShow";
1035
- readonly id: number;
1036
- };
1037
- /** Deck-wide slide show settings as the show settings dialog edits them. */
1038
- interface PptxShowSettings {
1039
- /** `present` for a presenter-driven show, `kiosk` for one that runs by itself at a booth. */
1040
- readonly mode: "present" | "kiosk";
1041
- /** Whether the show starts over after its last slide until Esc; a kiosk show always loops. */
1042
- readonly loop: boolean;
1043
- /** Slides presented; range numbers count slides from 1 in deck order. */
1044
- readonly slides: PptxShowRange;
1045
- /** Whether slides advance by their saved timings; false advances by click only. */
1046
- readonly useTimings: boolean;
1047
- }
1048
- /** A named slide sequence. */
1049
- interface PptxCustomShow {
1050
- /** Stable id, or undefined for a show not yet in the deck. */
1051
- readonly id?: number | undefined;
1052
- /** Name shown in lists. */
1053
- readonly name: string;
1054
- /** Slide part names in show order; a slide may repeat. */
1055
- readonly slides: readonly string[];
1056
- }
1057
- /** One pen or highlighter stroke kept as a drawn shape. */
1058
- interface PptxInkShape {
1059
- /** Points the stroke passes, in EMU on the slide. */
1060
- readonly points: readonly {
1061
- readonly x: number;
1062
- readonly y: number;
1063
- }[];
1064
- /** Stroke colour as `#RRGGBB`. */
1065
- readonly color: string;
1066
- /** Stroke width in EMU. */
1067
- readonly width: number;
1068
- /** Opacity from 0 to 1; highlighters are translucent. */
1069
- readonly opacity: number;
1070
- }
1071
- /** Ink of one slide. */
1072
- interface PptxSlideInk {
1073
- /** Slide part name. */
1074
- readonly slide: string;
1075
- /** Strokes in drawing order. */
1076
- readonly strokes: readonly PptxInkShape[];
1077
- }
1078
- /** Rehearsed time of one slide. */
1079
- interface PptxSlideTiming {
1080
- /** Slide part name. */
1081
- readonly slide: string;
1082
- /** Milliseconds the slide stays on screen before the show advances. */
1083
- readonly ms: number;
1084
- }
1085
- /** Summary properties of a deck as the properties dialog edits them. */
1086
- interface PptxDocumentProperties {
1087
- /** Title. */
1088
- readonly title: string;
1089
- /** Subject. */
1090
- readonly subject: string;
1091
- /** Author. */
1092
- readonly creator: string;
1093
- /** Keywords. */
1094
- readonly keywords: string;
1095
- /** Comments. */
1096
- readonly description: string;
1097
- }
1098
- /** How a clip plays, as the media tools edit it; fields left out stay as they are. */
1099
- interface PptxMediaPlayback {
1100
- /** Starts with the slide instead of waiting for a click. */
1101
- readonly autoplay?: boolean;
1102
- /** Milliseconds after the slide starts before automatic playback. */
1103
- readonly delayMs?: number;
1104
- /** Plays again from the beginning until the slide moves on. */
1105
- readonly loop?: boolean;
1106
- /** Volume from 0 to 1. */
1107
- readonly volume?: number;
1108
- /** Plays without sound. */
1109
- readonly muted?: boolean;
1110
- /** Video only: fills the screen while it plays. */
1111
- readonly fullScreen?: boolean;
1112
- /** Hides the clip while it is not playing; an audio clip is hidden for the whole show. */
1113
- readonly hideWhenStopped?: boolean;
1114
- /** Slides the clip keeps playing across, 1 to 999; 999 plays to the end of the show. */
1115
- readonly slideCount?: number;
1116
- /** Returns to the beginning once it has played. */
1117
- readonly rewindAfterPlaying?: boolean;
1118
- /** Milliseconds cut from the start and the end of the clip. */
1119
- readonly trim?: {
1120
- readonly startMs: number;
1121
- readonly endMs: number;
1122
- };
1123
- /** Milliseconds the sound fades in at the start and out at the end. */
1124
- readonly fade?: {
1125
- readonly inMs: number;
1126
- readonly outMs: number;
1127
- };
1128
- }
1129
- declare module "../../command/types" {
1130
- interface PptxCommandRegistry {
1131
- /** Writes the deck's slide show settings: show type, loop, slide range and how slides advance. */
1132
- setShowSettings: (options: {
1133
- settings: PptxShowSettings;
1134
- }) => PptxCommand;
1135
- /** Replaces the deck's custom shows; a show left out is deleted, and a deleted show the settings presented falls back to all slides. */
1136
- setCustomShows: (options: {
1137
- shows: readonly PptxCustomShow[];
1138
- }) => PptxCommand;
1139
- /** Keeps slide show ink as freeform shapes on their slides. */
1140
- addInkShapes: (options: {
1141
- slides: readonly PptxSlideInk[];
1142
- }) => PptxCommand;
1143
- /** Writes rehearsed timings as each slide's automatic advance and makes the show use them. */
1144
- setSlideTimings: (options: {
1145
- timings: readonly PptxSlideTiming[];
1146
- }) => PptxCommand;
1147
- /** Changes how an audio or video clip plays: start, delay, loop, volume, full screen, hiding, slides it plays across, rewinding, trim and fades. */
1148
- setMediaPlayback: (options: {
1149
- slide: string;
1150
- shape: number;
1151
- playback: PptxMediaPlayback;
1152
- }) => PptxCommand;
1153
- /** Removes media and other parts nothing in the deck uses any more. */
1154
- compactMedia: (options: Record<string, never>) => PptxCommand;
1155
- /** Writes the deck's title, subject, author, keywords and comments; empty text removes a field. */
1156
- setDocumentProperties: (options: {
1157
- properties: Partial<PptxDocumentProperties>;
1158
- }) => PptxCommand;
1159
- }
1160
- } //# sourceMappingURL=types.d.ts.map
1161
- //#endregion
1162
- //#region src/show/types.d.ts
1163
- /** How a show runs, read from the deck's show settings. */
1164
- interface PptxSlideShowSettings {
1165
- /** Whether the show runs by itself at a booth: clicks do not advance and it loops. */
1166
- readonly kiosk: boolean;
1167
- /** Whether the show starts over after its last slide until Esc. */
1168
- readonly loop: boolean;
1169
- /** Whether slides advance by their saved timings. */
1170
- readonly useTimings: boolean;
1171
- }
1172
- /** Slides a show presented at one time, kept while a custom show takes over; opaque to callers. */
1173
- interface PptxShowSequence {
1174
- /** Marks the sequence as the deck's own. */
1175
- readonly kind: "sequence";
1176
- }
1177
- /** Visible slides of one deck version, rendered on demand for a slide show. */
1178
- interface PptxSlideShowDeck {
1179
- /** Number of slides the show presents. */
1180
- readonly count: number;
1181
- /** Slide part names in show order, matching the editor's slide identity; a custom show may repeat one. */
1182
- readonly parts: readonly string[];
1183
- /** Slide numbers counted from 1 in deck order, per show position. */
1184
- readonly numbers: readonly number[];
1185
- /** Slide size in EMU. */
1186
- readonly size: {
1187
- readonly width: number;
1188
- readonly height: number;
1189
- };
1190
- /** How the show runs. */
1191
- readonly settings: PptxSlideShowSettings;
1192
- /**
1193
- * @param index - Show position counted from 0.
1194
- * @returns The slide's speaker notes.
1195
- */
1196
- notes(index: number): string;
1197
- /**
1198
- * Replaces a slide's notes in the show's own copy, so views of the running show read the new text.
1199
- * @param index - Show position.
1200
- * @param text - New notes.
1201
- */
1202
- writeNotes(index: number, text: string): void;
1203
- /**
1204
- * Brings in the slide after the one at a position when that slide is hidden, as presentation apps' H key does.
1205
- * @param index - Show position.
1206
- * @returns Show position of the hidden slide, or -1 when the next slide is not hidden.
1207
- */
1208
- nextHidden(index: number): number;
1209
- /**
1210
- * @param index - Show position counted from 0.
1211
- * @returns The audio and video clips on the slide.
1212
- */
1213
- media(index: number): readonly PptxShowMedia[];
1214
- /**
1215
- * @param index - Show position counted from 0.
1216
- * @returns The sound the slide's transition plays, an order to stop the sound before, or null.
1217
- */
1218
- sound(index: number): PptxShowSound | null;
1219
- /**
1220
- * Brings a slide into the show by its deck number, as a link to a hidden slide does: it joins the
1221
- * show where it stands in the deck, which moves the positions after it on by one.
1222
- * @param number - Slide number counted from 1 in deck order, hidden slides included.
1223
- * @returns Its show position, or -1 when the deck has no such slide.
1224
- */
1225
- reveal(number: number): number;
1226
- /**
1227
- * Presents other slides from now on, as a link to a custom show does.
1228
- * @param slides - Slides to present.
1229
- * @returns What the show presented before, to restore when the custom show returns.
1230
- */
1231
- switchTo(slides: PptxShowRange): PptxShowSequence;
1232
- /** @param sequence - Slides the show presented before a custom show took over. */
1233
- restore(sequence: PptxShowSequence): void;
1234
- /**
1235
- * @param index - Show position counted from 0.
1236
- * @returns The slide as a self-contained SVG document string.
1237
- */
1238
- render(index: number): string;
1239
- /**
1240
- * @param index - Show position counted from 0.
1241
- * @returns How the slide comes on screen and when the show leaves it.
1242
- */
1243
- transition(index: number): PptxSlideShowTransition;
1244
- /**
1245
- * @param index - Show position counted from 0.
1246
- * @returns The slide's animation effects in click order, with repeats and rewinds applied.
1247
- */
1248
- animations(index: number): readonly SlideAnimationStep[];
1249
- /**
1250
- * @param index - Show position counted from 0.
1251
- * @returns Effects played by clicks on trigger shapes, per shape.
1252
- */
1253
- triggers(index: number): PptxShowEffects["triggers"];
1254
- /**
1255
- * @param index - Show position counted from 0.
1256
- * @returns The slide's main sequence read from its time tree, which the show plays behaviour by behaviour.
1257
- */
1258
- timeline?(index: number): PptxTimeline;
1259
- }
1260
- /** Transition of a slide in the show, with how the show advances from it. */
1261
- interface PptxSlideShowTransition extends PptxTransitionPlayback {
1262
- /** Whether a click advances. */
1263
- readonly advanceOnClick: boolean;
1264
- /** Milliseconds after which the show advances by itself, or undefined. */
1265
- readonly advanceAfterMs?: number | undefined;
1266
- }
1267
- /** What the pointer does in a show. */
1268
- type PptxShowTool = "pointer" | "laser" | "spotlight" | "magnifier" | "pen" | "highlighter" | "eraser";
1269
- /** Colour a blanked show covers the slide with. */
1270
- type PptxShowBlank = "black" | "white";
1271
- /** What a show leaves behind for the deck once it ends. */
1272
- interface PptxSlideShowResult {
1273
- /** Ink drawn on each slide, in EMU; empty when nothing was drawn or all of it was erased. */
1274
- readonly ink: readonly PptxSlideInk[];
1275
- /** Rehearsed time per slide, or null when the show was not rehearsed. */
1276
- readonly timings: readonly PptxSlideTiming[] | null;
1277
- }
1278
- /** Clock of a rehearsed show. */
1279
- interface PptxRehearsal {
1280
- /** Whether the clock is paused. */
1281
- readonly paused: boolean;
1282
- /** @returns Milliseconds the current slide has been on screen. */
1283
- slideMs(): number;
1284
- /** @returns Milliseconds the whole rehearsal has taken. */
1285
- totalMs(): number;
1286
- /** Pauses or resumes the clock. */
1287
- toggle(): void;
1288
- /** Restarts the current slide's time. */
1289
- repeat(): void;
1290
- }
1291
- /** A running slide show. */
1292
- interface PptxSlideShow {
1293
- /** Show position counted from 0. */
1294
- readonly index: number;
1295
- /** Slides presented. */
1296
- readonly deck: PptxSlideShowDeck;
1297
- /** Full-screen element; controls placed inside it stay visible in full screen. */
1298
- readonly surface: HTMLElement;
1299
- /** What the pointer does. */
1300
- readonly tool: PptxShowTool;
1301
- /** Colour of the ink tool in hand, or of the pen. */
1302
- readonly inkColor: string;
1303
- /** Colour covering the slide, or null when it shows. */
1304
- readonly blank: PptxShowBlank | null;
1305
- /** Whether any slide carries ink. */
1306
- readonly hasInk: boolean;
1307
- /** Click stops of the current slide's animations: how many have played and how many there are; the next click plays one while some remain. */
1308
- readonly animation: {
1309
- readonly played: number;
1310
- readonly total: number;
1311
- };
1312
- /** Clock of a rehearsed show, or null. */
1313
- readonly rehearsal: PptxRehearsal | null;
1314
- /** Whether the show stays in the browser window, as the reading view does. */
1315
- readonly windowed: boolean;
1316
- /** Milliseconds since the show started. */
1317
- elapsedMs(): number;
1318
- /** Resolves once the show has ended, by the viewer or by `close()`, with its ink and timings. */
1319
- readonly closed: Promise<PptxSlideShowResult>;
1320
- /** @param index - Show position to present; clamped to the deck. */
1321
- go(index: number): void;
1322
- /** Plays the next animation step or moves to the next slide. */
1323
- next(): void;
1324
- /** Steps one animation back or returns to the previous slide. */
1325
- previous(): void;
1326
- /** @param tool - What the pointer does from now on. */
1327
- setTool(tool: PptxShowTool): void;
1328
- /** @param color - Colour of the ink tool in hand as `#RRGGBB`; without one in hand the pen takes it. */
1329
- setInkColor(color: string): void;
1330
- /** @param scope - Erases the ink of the current slide, or of every slide. */
1331
- clearInk(scope?: "slide" | "all"): void;
1332
- /** @param blank - Colour to cover the slide with, or null to show it. */
1333
- setBlank(blank: PptxShowBlank | null): void;
1334
- /**
1335
- * Runs a show key pressed elsewhere, such as in the presenter view.
1336
- * @param event - Key press.
1337
- * @returns Whether it was a show key.
1338
- */
1339
- handleKey(event: Pick<KeyboardEvent, "key" | "ctrlKey" | "metaKey" | "altKey">): boolean;
1340
- /** @param listener - Called after the slide, tool or blank changes. @returns Detaches it. */
1341
- subscribe(listener: () => void): () => void;
1342
- /**
1343
- * Keeps the show covering the page when the browser leaves full screen by itself within the next second, as
1344
- * browsers do when the page opens another window; any later exit ends the show.
1345
- */
1346
- expectWindowed(): void;
1347
- /** Whether slides that advance by their timings wait until resumed. */
1348
- readonly paused: boolean;
1349
- /** @param paused - Holds automatic advancing, or resumes it; a rehearsal clock pauses with it. */
1350
- setPaused(paused: boolean): void;
1351
- /** Whether the ink drawn in the show is shown. */
1352
- readonly inkVisible: boolean;
1353
- /** @param visible - Shows or hides the ink without erasing it. */
1354
- setInkVisible(visible: boolean): void;
1355
- /** Returns to the slide shown before the current one. */
1356
- goLastViewed(): void;
1357
- /** Ends the show and removes its surface. */
1358
- close(): void;
1359
- }
1360
- /** A transition as the player runs it. */
1361
- interface PptxTransitionPlayback {
1362
- /** Effect name; effects the player does not draw fade. */
1363
- readonly effect: string;
1364
- /** Side sliding effects enter from. */
1365
- readonly from?: PptxTransitionSide | undefined;
1366
- /** Whether split and zoom open out (`out`) or close in (`in`). */
1367
- readonly inOut?: "in" | "out" | undefined;
1368
- /** Axis of a split. */
1369
- readonly orientation?: "horz" | "vert" | undefined;
1370
- /**
1371
- * Direction token as the file writes it, for effects whose direction is not a side: `horz` or
1372
- * `vert` for blinds, checker, comb, random bars, doors and window, and a corner (`lu`, `ru`,
1373
- * `ld`, `rd`) for strips. Side tokens name the way the slide moves, so `l` enters from the right.
1374
- */
1375
- readonly direction?: string | undefined;
1376
- /** Spokes of a wheel; four when left out. */
1377
- readonly spokes?: number | undefined;
1378
- /** Whether a fade or cut passes through black. */
1379
- readonly thruBlack?: boolean | undefined;
1380
- /** Length in milliseconds. */
1381
- readonly durationMs: number;
1382
- }
1383
- /** An audio or video clip on a slide of the show. */
1384
- interface PptxShowMedia {
1385
- /** Shape id of the clip's picture. */
1386
- readonly shape: number;
1387
- /** Audio or video; online clips play as video. */
1388
- readonly kind: "audio" | "video";
1389
- /** Embedded bytes with their media type, or the address of a linked clip. */
1390
- readonly source: {
1391
- readonly bytes: Uint8Array;
1392
- readonly type: string;
1393
- } | {
1394
- readonly url: string;
1395
- };
1396
- /** How the clip plays, or null for the file defaults: on click, once. */
1397
- readonly playback: MediaPlayback | null;
1398
- /** Unrotated frame of the picture in fractions of the slide. */
1399
- readonly box: {
1400
- readonly x: number;
1401
- readonly y: number;
1402
- readonly width: number;
1403
- readonly height: number;
1404
- };
1405
- }
1406
- /** Sound of a slide transition. */
1407
- type PptxShowSound = {
1408
- readonly kind: "stop";
1409
- } | {
1410
- readonly kind: "play";
1411
- readonly bytes: Uint8Array;
1412
- readonly loop: boolean;
1413
- readonly name: string;
1414
- };
1415
- /** A slide's effects as the show plays them. */
1416
- interface PptxShowEffects {
1417
- /** Effects of the slide's own click sequence. */
1418
- readonly main: readonly SlideAnimationStep[];
1419
- /** Effects each trigger shape's clicks play, one click group after another. */
1420
- readonly triggers: readonly {
1421
- readonly shape: number;
1422
- readonly steps: readonly SlideAnimationStep[];
1423
- }[];
1424
- }
1425
- //#endregion
1426
- //#region src/types.d.ts
1427
- /** Optional file opened when the workspace first mounts. */
1428
- interface PptxEditorInitialDocument {
1429
- /** File name shown in the title bar and used for downloads. */
1430
- readonly name: string;
1431
- /**
1432
- * Loads the initial deck, falling back to a new presentation when unavailable.
1433
- * @param signal - Aborted when another file opens or the editor is destroyed.
1434
- * @returns Deck bytes, or undefined to start with a new presentation.
1435
- */
1436
- readonly read: (signal: AbortSignal) => Promise<Uint8Array | undefined>;
1437
- }
1438
- /** How a request sent to the assistant runs. */
1439
- interface PptxAskOptions {
1440
- /** Whether it creates the deck, so its edits apply at once instead of waiting for review. */
1441
- readonly create?: boolean | undefined;
1442
- }
1443
- /** One version the host is asked to store. */
1444
- interface PptxEditorSaveRequest {
1445
- /** File name the session knows the deck by. */
1446
- readonly name: string;
1447
- /** Complete deck as `.pptx` bytes. */
1448
- readonly bytes: Uint8Array;
1449
- }
1450
- /** Host configuration for one mounted PPTX editor. */
1451
- interface PptxEditorOptions {
1452
- /** Interface language of this editor. */
1453
- readonly locale?: EditorWorkspaceLocale | undefined;
1454
- /** @param locale - Language chosen in the File menu. */
1455
- readonly onLocaleChange?: ((locale: EditorWorkspaceLocale) => void) | undefined;
1456
- /** License key supplied by the host. Null selects evaluation mode. */
1457
- readonly licenseKey?: string | null;
1458
- /** Initial file. Without a file the editor opens a new presentation. */
1459
- readonly initialDocument?: PptxEditorInitialDocument;
1460
- /**
1461
- * Stores a version on the host. Without it, saving downloads a copy and counts as saved.
1462
- * @param request - Name and bytes of the version.
1463
- * @returns Whether the host stored it; false keeps the deck marked as changed so the user can retry.
1464
- */
1465
- readonly save?: (request: PptxEditorSaveRequest) => Promise<boolean>;
1466
- /** Saves shortly after each edit through `save`; ignored without it. */
1467
- readonly autoSave?: boolean;
1468
- /** @param session - Session of the open deck, or undefined after destruction. */
1469
- readonly onSessionChange?: (session: PptxEditorSession | undefined) => void;
1470
- /** Side panels, such as the assistant from `@quirekit/pptx-editor/ai`. */
1471
- readonly panels?: readonly PptxEditorPanel[] | undefined;
1472
- }
1473
- /** Where an observed change came from: the user, a command call, the AI assistant, undo or redo, or another file. */
1474
- type PptxChangeSource = "user" | "command" | "agent" | "history" | "file";
1475
- /**
1476
- * Where a panel is shown: beside the slide, widened, or over the main area with the slide previewed beside it, still
1477
- * editable.
1478
- */
1479
- type PptxEditorPanelLayout = "side" | "wide" | "page";
1480
- /** What a side panel plugin receives when it mounts. */
1481
- interface PptxEditorPanelContext {
1482
- /** Interface language when the panel mounts. */
1483
- readonly locale?: EditorWorkspaceLocale;
1484
- /** Session of the open deck. */
1485
- readonly session: PptxEditorSession;
1486
- /** Document the editor is mounted in. */
1487
- readonly ownerDocument: Document;
1488
- /** @param part - Slide part name. @returns The editor's drawing of the slide, from the cache the slide list and stage share. */
1489
- readonly renderSlide?: (part: string) => string;
1490
- /**
1491
- * @param part - Slide part name.
1492
- * @param width - Picture width in pixels.
1493
- * @returns The slide drawn as the show draws it, as PNG bytes.
1494
- */
1495
- readonly pictureSlide?: (part: string, width: number) => Promise<Uint8Array>;
1496
- /** Closes the panel. */
1497
- close(): void;
1498
- /** @param layout - Layout to show the panel in, one of the panel's `layouts`; the editor reports it back with `layout`. */
1499
- setLayout(layout: PptxEditorPanelLayout): void;
1500
- }
1501
- /** Mounted content of a side panel. */
1502
- interface PptxEditorPanelMount {
1503
- /** Element placed in the side panel. */
1504
- readonly element: HTMLElement;
1505
- /**
1506
- * Sends a request to an assistant panel as if the person typed it.
1507
- * @param text - Request text.
1508
- * @param options - How the request runs.
1509
- * @returns Whether it was sent or queued.
1510
- */
1511
- ask?(text: string, options?: PptxAskOptions): Promise<boolean>;
1512
- /** @param layout - Layout the editor now shows the panel in; it returns to the side when the panel closes. */
1513
- layout?(layout: PptxEditorPanelLayout): void;
1514
- /** @param locale - New workspace language. */
1515
- setLocale?(locale: EditorWorkspaceLocale): void;
1516
- /** Releases the content. */
1517
- destroy(): void;
1518
- }
1519
- /** A side panel beside the slide, such as the AI assistant. */
1520
- interface PptxEditorPanel {
1521
- /** Stable identity. */
1522
- readonly id: string;
1523
- /** Button and panel name. */
1524
- readonly label: string;
1525
- /** Icon of the panel's rail button, named by the label in its tooltip; a panel icon when left out. */
1526
- readonly icon?: string | undefined;
1527
- /** Open the panel when the editor mounts. */
1528
- readonly defaultOpen?: boolean | undefined;
1529
- /** Layouts the panel can be shown in; default the side only. */
1530
- readonly layouts?: readonly PptxEditorPanelLayout[] | undefined;
1531
- /** Whether the panel is the deck's assistant, which views of the editor can send requests to, such as confirming a storyline. */
1532
- readonly assistant?: boolean | undefined;
1533
- /** @param context - Session and panel controls. @returns Mounted content, created on first open and kept while the editor lives. */
1534
- mount(context: PptxEditorPanelContext): PptxEditorPanelMount;
1535
- }
1536
- /** Event the session reports to its host. */
1537
- type PptxEditorEvent = {
1538
- /** The deck kept an edit, an undo or redo, or another file was opened. */readonly type: "change"; /** Origin of the change. */
1539
- readonly source: PptxChangeSource;
1540
- } | {
1541
- /** The deck gained unsaved changes, or they were saved. */readonly type: "dirty"; /** Whether changes are waiting to be saved. */
1542
- readonly dirty: boolean;
1543
- };
1544
- /** Shape the user has selected, named so that it stays valid while slides move. */
1545
- interface PptxShapeReference {
1546
- /** Slide part name, such as `/ppt/slides/slide3.xml`. */
1547
- readonly slide: string;
1548
- /** Slide position counted from 0 when the selection was read. */
1549
- readonly slideIndex: number;
1550
- /** Shape id inside the slide. */
1551
- readonly shape: number;
1552
- /** Shape name, for people. */
1553
- readonly name: string;
1554
- }
1555
- /** Open deck as the host and its first-party features see it. */
1556
- interface PptxEditorSession {
1557
- /** Resolves once the first deck is open and shown. */
1558
- readonly ready: Promise<void>;
1559
- /** @returns File name the session knows the deck by. */
1560
- name(): string;
1561
- /** @returns Whether the deck has changes the host has not stored. */
1562
- isDirty(): boolean;
1563
- /** @returns Shapes the user has selected. */
1564
- selection(): readonly PptxShapeReference[];
1565
- /** @returns The deck as it is now; it does not save or mark it saved. */
1566
- snapshot(): Promise<Uint8Array>;
1567
- /**
1568
- * Opens another deck in place of the current one.
1569
- * @param name - File name.
1570
- * @param bytes - Deck bytes.
1571
- * @returns Whether the deck could be read and opened.
1572
- */
1573
- open(name: string, bytes: Uint8Array): Promise<boolean>;
1574
- /** Replaces the deck with a new presentation of one title slide. */
1575
- createDocument(): Promise<void>;
1576
- /** @param name - File name to keep the deck under; `.pptx` is added when missing. */
1577
- rename(name: string): void;
1578
- /** @returns Whether a step was undone. */
1579
- undo(): Promise<boolean>;
1580
- /** @returns Whether a step was redone. */
1581
- redo(): Promise<boolean>;
1582
- /** @returns Whether the current version is stored afterwards. */
1583
- save(): Promise<boolean>;
1584
- /** Typed commands; each call is one undoable edit. */
1585
- readonly commands: PptxCommands;
1586
- /** @returns A chain whose commands run as one undoable edit. */
1587
- chain(): PptxChain;
1588
- /**
1589
- * Presents the deck from a slide, by default the one holding the selection.
1590
- * @param start - Slide position counted from 0.
1591
- * @returns The running show.
1592
- */
1593
- present(start?: number): Promise<PptxSlideShow>;
1594
- /** @param listener - Receives every event. @returns Detaches it. */
1595
- subscribe(listener: (event: PptxEditorEvent) => void): () => void;
1596
- }
1597
- //#endregion
1598
- export { PptxCommandName as _, PptxEditorOptions as a, PptxShapeKind as b, PptxEditorPanelLayout as c, PptxEditorSession as d, PptxShapeReference as f, PptxCommandDescriptor as g, PptxCommandAgentContext as h, PptxEditorInitialDocument as i, PptxEditorPanelMount as l, PptxChain as m, PptxChangeSource as n, PptxEditorPanel as o, PptxSlideShow as p, PptxEditorEvent as r, PptxEditorPanelContext as s, PptxAskOptions as t, PptxEditorSaveRequest as u, PptxCommandRegistry as v, PptxLayoutChecker as x, PptxCommands as y };
1361
+ export { PptxDrawBackground as A, presentationTemplateFormat as C, PptxDesignPaletteInput as D, PptxDesignFontInput as E, PptxPageKind as M, PptxDesignRole as O, PptxTemplateSource as S, PptxCustomStyle as T, PptxTemplateManifest as _, PptxCommandRegistry as a, PptxTemplateSlot as b, PptxTransitionSide as c, PptxTemplateDesign as d, PptxTemplateEntry as f, PptxTemplateItems as g, PptxTemplateItem as h, PptxCommandName as i, PptxDrawElement as j, PptxDesignTypeScale as k, PptxLayoutChecker as l, PptxTemplateFrame as m, PptxCommandAgentContext as n, PptxCommands as o, PptxTemplateFile as p, PptxCommandDescriptor as r, PptxShapeKind as s, PptxChain as t, PptxLoadedTemplate as u, PptxTemplatePage as v, PptxComponentSkin as w, PptxTemplateSlotRole as x, PptxTemplatePageKind as y };