pptx-vanilla-viewer 0.3.0 → 0.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.
- package/CHANGELOG.md +2 -0
- package/dist/index.cjs +165 -127
- package/dist/index.d.cts +168 -3
- package/dist/index.d.ts +168 -3
- package/dist/index.js +165 -127
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n, o, m, P, a, e, f, X, p, q, r, s, t, u, v, w, x, y, z, A, B, D, E, F, G, H, J, K, L, i, j, l, k, g, h, a0 } from './presentation-BfnrtJV1.js';
|
|
1
|
+
import { n, o, m, P, a, e, f, X, p, q, r, s, t, u, v, w, x, y, z, A, B, D, E, F, G, H, J, K, L, i, j, l, k, g, h, a0, ca } from './presentation-BfnrtJV1.js';
|
|
2
2
|
export { a as PptxElement, P as PptxSlide } from './presentation-BfnrtJV1.js';
|
|
3
3
|
import { ViewerTheme } from './theme/index.js';
|
|
4
4
|
export { ViewerTheme, ViewerThemeColors, defaultCssVars, defaultRadius, defaultThemeColors, themeToCssVars, vermilionDarkTheme, vermilionLightTheme } from './theme/index.js';
|
|
@@ -1431,6 +1431,42 @@ interface CollaborationConfig {
|
|
|
1431
1431
|
/** A neutral CSS map (framework `CSSProperties` are structurally compatible). */
|
|
1432
1432
|
type CssStyleMap = Record<string, string | number>;
|
|
1433
1433
|
|
|
1434
|
+
/**
|
|
1435
|
+
* `animation-authoring` — pure, immutable helpers for the editor's element
|
|
1436
|
+
* animation authoring UI (the Animations ribbon tab / animation panel).
|
|
1437
|
+
*
|
|
1438
|
+
* Animation data lives on the SLIDE (`PptxSlide.animations`), keyed by
|
|
1439
|
+
* `elementId`, NOT on the element itself. The authoring UI reads and emits the
|
|
1440
|
+
* entire slide-level `animations` array. Every function here returns a new
|
|
1441
|
+
* `PptxElementAnimation[]` without mutating its input, so they're trivially
|
|
1442
|
+
* unit-testable and safe to drive editor undo/redo from.
|
|
1443
|
+
*
|
|
1444
|
+
* Two families coexist here, both used across the bindings:
|
|
1445
|
+
*
|
|
1446
|
+
* - **Granular field setters** (`setAnimationEntrance` / `setTrigger` /
|
|
1447
|
+
* `setDuration` / … plus `reorderAnimationUp` / `removeAnimation`): the
|
|
1448
|
+
* Angular authoring panel + React's `useAnimationHandlers` model. They
|
|
1449
|
+
* upsert a single field on the element's entry, creating the entry with
|
|
1450
|
+
* sensible defaults when absent and removing it when all three effect
|
|
1451
|
+
* buckets become empty.
|
|
1452
|
+
* - **Group preset apply/remove** (`applyAnimationPreset` /
|
|
1453
|
+
* `removeElementAnimation`): the Vue ribbon model, a coarser
|
|
1454
|
+
* "set one of entrance/emphasis/exit, keep the rest" upsert.
|
|
1455
|
+
*
|
|
1456
|
+
* The option *catalogs* here are intentionally **value-only** (preset id +
|
|
1457
|
+
* nothing else): the human label / icon / i18n key for each option is
|
|
1458
|
+
* framework-specific (React uses `react-icons` + label keys, Angular uses
|
|
1459
|
+
* Unicode arrow glyphs + plain labels), so each binding maps these ids to its
|
|
1460
|
+
* own display metadata.
|
|
1461
|
+
*
|
|
1462
|
+
* Pure: imports only `pptx-viewer-core` types; no framework, no DOM.
|
|
1463
|
+
*
|
|
1464
|
+
* @module render/animation-authoring
|
|
1465
|
+
*/
|
|
1466
|
+
|
|
1467
|
+
/** One of the three animation buckets a preset can occupy on an element. */
|
|
1468
|
+
type AnimationGroup = 'entrance' | 'emphasis' | 'exit';
|
|
1469
|
+
|
|
1434
1470
|
/**
|
|
1435
1471
|
* Pure geometry helpers for the align / distribute editor operations.
|
|
1436
1472
|
*
|
|
@@ -1484,6 +1520,31 @@ type ChangeCaseMode = 'sentence' | 'lower' | 'upper' | 'capitalize' | 'toggle';
|
|
|
1484
1520
|
|
|
1485
1521
|
/** Connection lifecycle states for the Yjs WebSocket provider. */
|
|
1486
1522
|
type ConnectionStatus = 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
1523
|
+
|
|
1524
|
+
/**
|
|
1525
|
+
* Pure helpers for the gradient picker editor control, shared by every binding.
|
|
1526
|
+
*
|
|
1527
|
+
* Readers extract current gradient values from a PptxElement (falling back to
|
|
1528
|
+
* sensible defaults), and patch-builders produce shallow-merge-ready
|
|
1529
|
+
* `Partial<PptxElement>` objects safe to pass to each binding's element-update
|
|
1530
|
+
* action.
|
|
1531
|
+
*
|
|
1532
|
+
* No framework imports; every type is concrete or `unknown` + narrowed.
|
|
1533
|
+
*/
|
|
1534
|
+
|
|
1535
|
+
/** A single gradient stop, mirroring the ShapeStyle array item shape. */
|
|
1536
|
+
interface GradientStop {
|
|
1537
|
+
color: string;
|
|
1538
|
+
position: number;
|
|
1539
|
+
opacity?: number;
|
|
1540
|
+
}
|
|
1541
|
+
/** The editable gradient state surfaced to the component. */
|
|
1542
|
+
interface GradientState {
|
|
1543
|
+
type: 'linear' | 'radial';
|
|
1544
|
+
/** Angle in degrees (only meaningful for linear). */
|
|
1545
|
+
angle: number;
|
|
1546
|
+
stops: GradientStop[];
|
|
1547
|
+
}
|
|
1487
1548
|
/** In-memory clipboard payload stored when an element is copied or cut. */
|
|
1488
1549
|
interface ElementClipboardPayload {
|
|
1489
1550
|
element: a;
|
|
@@ -1620,6 +1681,24 @@ interface ViewerState {
|
|
|
1620
1681
|
clipboardPayload: ElementClipboardPayload | null;
|
|
1621
1682
|
}
|
|
1622
1683
|
|
|
1684
|
+
/**
|
|
1685
|
+
* Element-animation actions for the ribbon's Animations tab.
|
|
1686
|
+
*
|
|
1687
|
+
* Animation data lives on the SLIDE (`PptxSlide.animations`, keyed by
|
|
1688
|
+
* `elementId`), not on the element itself, matching how the presentation
|
|
1689
|
+
* playback state machine reads it (`buildClickGroups(slide.animations)` in
|
|
1690
|
+
* `animation/presentation-playback.ts`). Both actions target the currently
|
|
1691
|
+
* selected element and route through the shared `animation-authoring.ts`
|
|
1692
|
+
* "coarse group preset" model (`applyAnimationPreset` / `removeElementAnimation`),
|
|
1693
|
+
* the same one the Vue ribbon uses: applying a preset sets one of
|
|
1694
|
+
* entrance/emphasis/exit without touching the others; remove drops the whole
|
|
1695
|
+
* entry.
|
|
1696
|
+
*/
|
|
1697
|
+
interface AnimationActions {
|
|
1698
|
+
addAnimation(group: AnimationGroup, preset: g): void;
|
|
1699
|
+
removeAnimation(): void;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1623
1702
|
/**
|
|
1624
1703
|
* Z-order, align, flip, and group/ungroup actions for the ribbon's
|
|
1625
1704
|
* Home > Arrange group.
|
|
@@ -1651,6 +1730,18 @@ interface ArrangeActions {
|
|
|
1651
1730
|
ungroupSelected(): void;
|
|
1652
1731
|
}
|
|
1653
1732
|
|
|
1733
|
+
/**
|
|
1734
|
+
* Slide-background actions for the ribbon's Design > Format Background panel.
|
|
1735
|
+
* Solid-colour fill only (matches the docked panel's scope: a single colour
|
|
1736
|
+
* input); clearing removes every background field so the slide falls back to
|
|
1737
|
+
* its layout/master background. Both mutations are history-integrated,
|
|
1738
|
+
* mirroring `editor-slide-actions.ts`.
|
|
1739
|
+
*/
|
|
1740
|
+
interface SlideBackgroundActions {
|
|
1741
|
+
setSlideBackgroundColor(color: string): void;
|
|
1742
|
+
clearSlideBackground(): void;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1654
1745
|
/**
|
|
1655
1746
|
* Cut/copy/paste actions for the ribbon's Home > Clipboard group, backed by
|
|
1656
1747
|
* the shared `element-clipboard.ts` codec. The in-memory clipboard payload
|
|
@@ -1676,6 +1767,36 @@ interface ClipboardActions {
|
|
|
1676
1767
|
/** The element kinds the Insert ribbon tab can create directly. */
|
|
1677
1768
|
type InsertKind = 'text' | 'table' | 'shape';
|
|
1678
1769
|
|
|
1770
|
+
/**
|
|
1771
|
+
* Element-type-aware inspector actions: text vertical-align/wrap/autofit,
|
|
1772
|
+
* gradient fill + fill/stroke opacity, image brightness/contrast/saturation +
|
|
1773
|
+
* crop, and table-level header-row/banded-rows/cell-padding. Every method is a
|
|
1774
|
+
* thin `applyToSelected` wrapper around pure builders from `pptx-viewer-shared`
|
|
1775
|
+
* (or the local `patchShapeStyle`), mirroring `editor-text-actions.ts`.
|
|
1776
|
+
*
|
|
1777
|
+
* These extend the base position/size/rotation + flat fill/stroke inspector
|
|
1778
|
+
* that `editor-edit-ops.ts` already exposes; see `ui/inspector/` for the
|
|
1779
|
+
* per-element-type panels that call these.
|
|
1780
|
+
*/
|
|
1781
|
+
interface InspectorActions {
|
|
1782
|
+
setTextVerticalAlign(vAlign: NonNullable<a0['vAlign']>): void;
|
|
1783
|
+
setTextWrap(wrap: NonNullable<a0['textWrap']>): void;
|
|
1784
|
+
setAutoFitMode(mode: NonNullable<a0['autoFitMode']>): void;
|
|
1785
|
+
setFillOpacity(opacity: number): void;
|
|
1786
|
+
setStrokeOpacity(opacity: number): void;
|
|
1787
|
+
setGradientFill(state: GradientState): void;
|
|
1788
|
+
addGradientStop(color: string, position: number): void;
|
|
1789
|
+
removeGradientStop(index: number): void;
|
|
1790
|
+
updateGradientStop(index: number, changes: Partial<GradientState['stops'][number]>): void;
|
|
1791
|
+
setImageBrightness(value: number): void;
|
|
1792
|
+
setImageContrast(value: number): void;
|
|
1793
|
+
setImageSaturation(value: number): void;
|
|
1794
|
+
setImageCrop(edge: 'left' | 'top' | 'right' | 'bottom', value: number): void;
|
|
1795
|
+
setTableHeaderRow(enabled: boolean): void;
|
|
1796
|
+
setTableBandedRows(enabled: boolean): void;
|
|
1797
|
+
setTableCellPadding(padding: number): void;
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1679
1800
|
/**
|
|
1680
1801
|
* New/duplicate/delete-slide actions for the ribbon's Home > Slides group,
|
|
1681
1802
|
* backed by the shared `slide-operations.ts` factory. Every mutation is
|
|
@@ -1718,6 +1839,23 @@ interface TextActions {
|
|
|
1718
1839
|
setLineSpacing(value: number): void;
|
|
1719
1840
|
}
|
|
1720
1841
|
|
|
1842
|
+
/**
|
|
1843
|
+
* Slide-transition actions for the ribbon's Transitions tab. Playback already
|
|
1844
|
+
* reads `PptxSlide.transition` (see `animation/presentation-playback.ts`), so
|
|
1845
|
+
* this only needs to write that same field, history-integrated like every
|
|
1846
|
+
* other ribbon mutation.
|
|
1847
|
+
*
|
|
1848
|
+
* `applyTransition` covers both the preset gallery buttons and the duration
|
|
1849
|
+
* input (the tab re-applies the currently-selected preset whenever the
|
|
1850
|
+
* duration changes), plus the "Apply to All Slides" checkbox: when
|
|
1851
|
+
* `applyToAll` is true every slide gets the same fresh `{ type, durationMs }`
|
|
1852
|
+
* transition; otherwise only the current slide is patched, preserving any
|
|
1853
|
+
* advanced fields (direction, sound, ...) it already carried.
|
|
1854
|
+
*/
|
|
1855
|
+
interface TransitionActions {
|
|
1856
|
+
applyTransition(type: k, durationMs: number, applyToAll: boolean): void;
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1721
1859
|
/** A geometry patch from the inspector (all fields optional). */
|
|
1722
1860
|
interface GeometryPatch {
|
|
1723
1861
|
x?: number;
|
|
@@ -1735,7 +1873,7 @@ interface GeometryPatch {
|
|
|
1735
1873
|
* directly here. Every mutating action is history-integrated (push -> mutate
|
|
1736
1874
|
* -> commit) via the shared {@link EditorOps}.
|
|
1737
1875
|
*/
|
|
1738
|
-
interface EditActions extends TextActions, ArrangeActions, ClipboardActions, SlideActions {
|
|
1876
|
+
interface EditActions extends TextActions, ArrangeActions, ClipboardActions, SlideActions, SlideBackgroundActions, TransitionActions, AnimationActions, InspectorActions {
|
|
1739
1877
|
setShapeFill(color: string): void;
|
|
1740
1878
|
setShapeStroke(color: string): void;
|
|
1741
1879
|
setShapeStrokeWidth(width: number): void;
|
|
@@ -1743,6 +1881,12 @@ interface EditActions extends TextActions, ArrangeActions, ClipboardActions, Sli
|
|
|
1743
1881
|
setGeometry(patch: GeometryPatch): void;
|
|
1744
1882
|
insert(kind: InsertKind, shapeType?: ShapePresetType): void;
|
|
1745
1883
|
insertImage(): Promise<void>;
|
|
1884
|
+
insertMedia(): Promise<void>;
|
|
1885
|
+
insertChart(chartType: l): void;
|
|
1886
|
+
insertSmartArt(layout: ca, defaultItems: string[]): void;
|
|
1887
|
+
insertEquation(omml: Record<string, unknown>): void;
|
|
1888
|
+
insertActionButton(shapeType: string): void;
|
|
1889
|
+
insertField(fieldType: string, value?: string): void;
|
|
1746
1890
|
duplicateSelected(): void;
|
|
1747
1891
|
deleteSelected(): void;
|
|
1748
1892
|
}
|
|
@@ -1788,10 +1932,13 @@ type TranslationMessages = Record<string, Record<string, string>>;
|
|
|
1788
1932
|
*/
|
|
1789
1933
|
declare function createTranslator(locale?: string, messages?: TranslationMessages): Translator;
|
|
1790
1934
|
|
|
1791
|
-
/** Selection-derived state the inspector reflects
|
|
1935
|
+
/** Selection-derived state the inspector reflects, computed by `buildInspectorState`. */
|
|
1792
1936
|
interface InspectorState {
|
|
1793
1937
|
hasSelection: boolean;
|
|
1794
1938
|
canShape: boolean;
|
|
1939
|
+
canText: boolean;
|
|
1940
|
+
isImage: boolean;
|
|
1941
|
+
isTable: boolean;
|
|
1795
1942
|
x: number;
|
|
1796
1943
|
y: number;
|
|
1797
1944
|
width: number;
|
|
@@ -1800,6 +1947,23 @@ interface InspectorState {
|
|
|
1800
1947
|
fillColor: string | undefined;
|
|
1801
1948
|
strokeColor: string | undefined;
|
|
1802
1949
|
strokeWidth: number;
|
|
1950
|
+
fillOpacity: number;
|
|
1951
|
+
strokeOpacity: number;
|
|
1952
|
+
gradientEnabled: boolean;
|
|
1953
|
+
gradient: GradientState;
|
|
1954
|
+
vAlign: 'top' | 'middle' | 'bottom';
|
|
1955
|
+
textWrap: 'square' | 'none';
|
|
1956
|
+
autoFitMode: 'shrink' | 'normal' | 'none';
|
|
1957
|
+
imageBrightness: number;
|
|
1958
|
+
imageContrast: number;
|
|
1959
|
+
imageSaturation: number;
|
|
1960
|
+
cropLeft: number;
|
|
1961
|
+
cropTop: number;
|
|
1962
|
+
cropRight: number;
|
|
1963
|
+
cropBottom: number;
|
|
1964
|
+
tableHeaderRow: boolean;
|
|
1965
|
+
tableBandedRows: boolean;
|
|
1966
|
+
tableCellPadding: number;
|
|
1803
1967
|
}
|
|
1804
1968
|
interface Inspector {
|
|
1805
1969
|
el: HTMLElement;
|
|
@@ -2519,6 +2683,7 @@ interface ChromeHost {
|
|
|
2519
2683
|
exportGif(): Promise<void>;
|
|
2520
2684
|
exportVideo(): Promise<void>;
|
|
2521
2685
|
print(): Promise<boolean>;
|
|
2686
|
+
setTheme(theme: ViewerTheme | undefined): void;
|
|
2522
2687
|
}
|
|
2523
2688
|
|
|
2524
2689
|
/** The export slice of the public viewer API (see `PptxViewerInstance`). */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n, o, m, P, a, e, f, X, p, q, r, s, t, u, v, w, x, y, z, A, B, D, E, F, G, H, J, K, L, i, j, l, k, g, h, a0 } from './presentation-BfnrtJV1.js';
|
|
1
|
+
import { n, o, m, P, a, e, f, X, p, q, r, s, t, u, v, w, x, y, z, A, B, D, E, F, G, H, J, K, L, i, j, l, k, g, h, a0, ca } from './presentation-BfnrtJV1.js';
|
|
2
2
|
export { a as PptxElement, P as PptxSlide } from './presentation-BfnrtJV1.js';
|
|
3
3
|
import { ViewerTheme } from './theme/index.js';
|
|
4
4
|
export { ViewerTheme, ViewerThemeColors, defaultCssVars, defaultRadius, defaultThemeColors, themeToCssVars, vermilionDarkTheme, vermilionLightTheme } from './theme/index.js';
|
|
@@ -1431,6 +1431,42 @@ interface CollaborationConfig {
|
|
|
1431
1431
|
/** A neutral CSS map (framework `CSSProperties` are structurally compatible). */
|
|
1432
1432
|
type CssStyleMap = Record<string, string | number>;
|
|
1433
1433
|
|
|
1434
|
+
/**
|
|
1435
|
+
* `animation-authoring` — pure, immutable helpers for the editor's element
|
|
1436
|
+
* animation authoring UI (the Animations ribbon tab / animation panel).
|
|
1437
|
+
*
|
|
1438
|
+
* Animation data lives on the SLIDE (`PptxSlide.animations`), keyed by
|
|
1439
|
+
* `elementId`, NOT on the element itself. The authoring UI reads and emits the
|
|
1440
|
+
* entire slide-level `animations` array. Every function here returns a new
|
|
1441
|
+
* `PptxElementAnimation[]` without mutating its input, so they're trivially
|
|
1442
|
+
* unit-testable and safe to drive editor undo/redo from.
|
|
1443
|
+
*
|
|
1444
|
+
* Two families coexist here, both used across the bindings:
|
|
1445
|
+
*
|
|
1446
|
+
* - **Granular field setters** (`setAnimationEntrance` / `setTrigger` /
|
|
1447
|
+
* `setDuration` / … plus `reorderAnimationUp` / `removeAnimation`): the
|
|
1448
|
+
* Angular authoring panel + React's `useAnimationHandlers` model. They
|
|
1449
|
+
* upsert a single field on the element's entry, creating the entry with
|
|
1450
|
+
* sensible defaults when absent and removing it when all three effect
|
|
1451
|
+
* buckets become empty.
|
|
1452
|
+
* - **Group preset apply/remove** (`applyAnimationPreset` /
|
|
1453
|
+
* `removeElementAnimation`): the Vue ribbon model, a coarser
|
|
1454
|
+
* "set one of entrance/emphasis/exit, keep the rest" upsert.
|
|
1455
|
+
*
|
|
1456
|
+
* The option *catalogs* here are intentionally **value-only** (preset id +
|
|
1457
|
+
* nothing else): the human label / icon / i18n key for each option is
|
|
1458
|
+
* framework-specific (React uses `react-icons` + label keys, Angular uses
|
|
1459
|
+
* Unicode arrow glyphs + plain labels), so each binding maps these ids to its
|
|
1460
|
+
* own display metadata.
|
|
1461
|
+
*
|
|
1462
|
+
* Pure: imports only `pptx-viewer-core` types; no framework, no DOM.
|
|
1463
|
+
*
|
|
1464
|
+
* @module render/animation-authoring
|
|
1465
|
+
*/
|
|
1466
|
+
|
|
1467
|
+
/** One of the three animation buckets a preset can occupy on an element. */
|
|
1468
|
+
type AnimationGroup = 'entrance' | 'emphasis' | 'exit';
|
|
1469
|
+
|
|
1434
1470
|
/**
|
|
1435
1471
|
* Pure geometry helpers for the align / distribute editor operations.
|
|
1436
1472
|
*
|
|
@@ -1484,6 +1520,31 @@ type ChangeCaseMode = 'sentence' | 'lower' | 'upper' | 'capitalize' | 'toggle';
|
|
|
1484
1520
|
|
|
1485
1521
|
/** Connection lifecycle states for the Yjs WebSocket provider. */
|
|
1486
1522
|
type ConnectionStatus = 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
1523
|
+
|
|
1524
|
+
/**
|
|
1525
|
+
* Pure helpers for the gradient picker editor control, shared by every binding.
|
|
1526
|
+
*
|
|
1527
|
+
* Readers extract current gradient values from a PptxElement (falling back to
|
|
1528
|
+
* sensible defaults), and patch-builders produce shallow-merge-ready
|
|
1529
|
+
* `Partial<PptxElement>` objects safe to pass to each binding's element-update
|
|
1530
|
+
* action.
|
|
1531
|
+
*
|
|
1532
|
+
* No framework imports; every type is concrete or `unknown` + narrowed.
|
|
1533
|
+
*/
|
|
1534
|
+
|
|
1535
|
+
/** A single gradient stop, mirroring the ShapeStyle array item shape. */
|
|
1536
|
+
interface GradientStop {
|
|
1537
|
+
color: string;
|
|
1538
|
+
position: number;
|
|
1539
|
+
opacity?: number;
|
|
1540
|
+
}
|
|
1541
|
+
/** The editable gradient state surfaced to the component. */
|
|
1542
|
+
interface GradientState {
|
|
1543
|
+
type: 'linear' | 'radial';
|
|
1544
|
+
/** Angle in degrees (only meaningful for linear). */
|
|
1545
|
+
angle: number;
|
|
1546
|
+
stops: GradientStop[];
|
|
1547
|
+
}
|
|
1487
1548
|
/** In-memory clipboard payload stored when an element is copied or cut. */
|
|
1488
1549
|
interface ElementClipboardPayload {
|
|
1489
1550
|
element: a;
|
|
@@ -1620,6 +1681,24 @@ interface ViewerState {
|
|
|
1620
1681
|
clipboardPayload: ElementClipboardPayload | null;
|
|
1621
1682
|
}
|
|
1622
1683
|
|
|
1684
|
+
/**
|
|
1685
|
+
* Element-animation actions for the ribbon's Animations tab.
|
|
1686
|
+
*
|
|
1687
|
+
* Animation data lives on the SLIDE (`PptxSlide.animations`, keyed by
|
|
1688
|
+
* `elementId`), not on the element itself, matching how the presentation
|
|
1689
|
+
* playback state machine reads it (`buildClickGroups(slide.animations)` in
|
|
1690
|
+
* `animation/presentation-playback.ts`). Both actions target the currently
|
|
1691
|
+
* selected element and route through the shared `animation-authoring.ts`
|
|
1692
|
+
* "coarse group preset" model (`applyAnimationPreset` / `removeElementAnimation`),
|
|
1693
|
+
* the same one the Vue ribbon uses: applying a preset sets one of
|
|
1694
|
+
* entrance/emphasis/exit without touching the others; remove drops the whole
|
|
1695
|
+
* entry.
|
|
1696
|
+
*/
|
|
1697
|
+
interface AnimationActions {
|
|
1698
|
+
addAnimation(group: AnimationGroup, preset: g): void;
|
|
1699
|
+
removeAnimation(): void;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1623
1702
|
/**
|
|
1624
1703
|
* Z-order, align, flip, and group/ungroup actions for the ribbon's
|
|
1625
1704
|
* Home > Arrange group.
|
|
@@ -1651,6 +1730,18 @@ interface ArrangeActions {
|
|
|
1651
1730
|
ungroupSelected(): void;
|
|
1652
1731
|
}
|
|
1653
1732
|
|
|
1733
|
+
/**
|
|
1734
|
+
* Slide-background actions for the ribbon's Design > Format Background panel.
|
|
1735
|
+
* Solid-colour fill only (matches the docked panel's scope: a single colour
|
|
1736
|
+
* input); clearing removes every background field so the slide falls back to
|
|
1737
|
+
* its layout/master background. Both mutations are history-integrated,
|
|
1738
|
+
* mirroring `editor-slide-actions.ts`.
|
|
1739
|
+
*/
|
|
1740
|
+
interface SlideBackgroundActions {
|
|
1741
|
+
setSlideBackgroundColor(color: string): void;
|
|
1742
|
+
clearSlideBackground(): void;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1654
1745
|
/**
|
|
1655
1746
|
* Cut/copy/paste actions for the ribbon's Home > Clipboard group, backed by
|
|
1656
1747
|
* the shared `element-clipboard.ts` codec. The in-memory clipboard payload
|
|
@@ -1676,6 +1767,36 @@ interface ClipboardActions {
|
|
|
1676
1767
|
/** The element kinds the Insert ribbon tab can create directly. */
|
|
1677
1768
|
type InsertKind = 'text' | 'table' | 'shape';
|
|
1678
1769
|
|
|
1770
|
+
/**
|
|
1771
|
+
* Element-type-aware inspector actions: text vertical-align/wrap/autofit,
|
|
1772
|
+
* gradient fill + fill/stroke opacity, image brightness/contrast/saturation +
|
|
1773
|
+
* crop, and table-level header-row/banded-rows/cell-padding. Every method is a
|
|
1774
|
+
* thin `applyToSelected` wrapper around pure builders from `pptx-viewer-shared`
|
|
1775
|
+
* (or the local `patchShapeStyle`), mirroring `editor-text-actions.ts`.
|
|
1776
|
+
*
|
|
1777
|
+
* These extend the base position/size/rotation + flat fill/stroke inspector
|
|
1778
|
+
* that `editor-edit-ops.ts` already exposes; see `ui/inspector/` for the
|
|
1779
|
+
* per-element-type panels that call these.
|
|
1780
|
+
*/
|
|
1781
|
+
interface InspectorActions {
|
|
1782
|
+
setTextVerticalAlign(vAlign: NonNullable<a0['vAlign']>): void;
|
|
1783
|
+
setTextWrap(wrap: NonNullable<a0['textWrap']>): void;
|
|
1784
|
+
setAutoFitMode(mode: NonNullable<a0['autoFitMode']>): void;
|
|
1785
|
+
setFillOpacity(opacity: number): void;
|
|
1786
|
+
setStrokeOpacity(opacity: number): void;
|
|
1787
|
+
setGradientFill(state: GradientState): void;
|
|
1788
|
+
addGradientStop(color: string, position: number): void;
|
|
1789
|
+
removeGradientStop(index: number): void;
|
|
1790
|
+
updateGradientStop(index: number, changes: Partial<GradientState['stops'][number]>): void;
|
|
1791
|
+
setImageBrightness(value: number): void;
|
|
1792
|
+
setImageContrast(value: number): void;
|
|
1793
|
+
setImageSaturation(value: number): void;
|
|
1794
|
+
setImageCrop(edge: 'left' | 'top' | 'right' | 'bottom', value: number): void;
|
|
1795
|
+
setTableHeaderRow(enabled: boolean): void;
|
|
1796
|
+
setTableBandedRows(enabled: boolean): void;
|
|
1797
|
+
setTableCellPadding(padding: number): void;
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1679
1800
|
/**
|
|
1680
1801
|
* New/duplicate/delete-slide actions for the ribbon's Home > Slides group,
|
|
1681
1802
|
* backed by the shared `slide-operations.ts` factory. Every mutation is
|
|
@@ -1718,6 +1839,23 @@ interface TextActions {
|
|
|
1718
1839
|
setLineSpacing(value: number): void;
|
|
1719
1840
|
}
|
|
1720
1841
|
|
|
1842
|
+
/**
|
|
1843
|
+
* Slide-transition actions for the ribbon's Transitions tab. Playback already
|
|
1844
|
+
* reads `PptxSlide.transition` (see `animation/presentation-playback.ts`), so
|
|
1845
|
+
* this only needs to write that same field, history-integrated like every
|
|
1846
|
+
* other ribbon mutation.
|
|
1847
|
+
*
|
|
1848
|
+
* `applyTransition` covers both the preset gallery buttons and the duration
|
|
1849
|
+
* input (the tab re-applies the currently-selected preset whenever the
|
|
1850
|
+
* duration changes), plus the "Apply to All Slides" checkbox: when
|
|
1851
|
+
* `applyToAll` is true every slide gets the same fresh `{ type, durationMs }`
|
|
1852
|
+
* transition; otherwise only the current slide is patched, preserving any
|
|
1853
|
+
* advanced fields (direction, sound, ...) it already carried.
|
|
1854
|
+
*/
|
|
1855
|
+
interface TransitionActions {
|
|
1856
|
+
applyTransition(type: k, durationMs: number, applyToAll: boolean): void;
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1721
1859
|
/** A geometry patch from the inspector (all fields optional). */
|
|
1722
1860
|
interface GeometryPatch {
|
|
1723
1861
|
x?: number;
|
|
@@ -1735,7 +1873,7 @@ interface GeometryPatch {
|
|
|
1735
1873
|
* directly here. Every mutating action is history-integrated (push -> mutate
|
|
1736
1874
|
* -> commit) via the shared {@link EditorOps}.
|
|
1737
1875
|
*/
|
|
1738
|
-
interface EditActions extends TextActions, ArrangeActions, ClipboardActions, SlideActions {
|
|
1876
|
+
interface EditActions extends TextActions, ArrangeActions, ClipboardActions, SlideActions, SlideBackgroundActions, TransitionActions, AnimationActions, InspectorActions {
|
|
1739
1877
|
setShapeFill(color: string): void;
|
|
1740
1878
|
setShapeStroke(color: string): void;
|
|
1741
1879
|
setShapeStrokeWidth(width: number): void;
|
|
@@ -1743,6 +1881,12 @@ interface EditActions extends TextActions, ArrangeActions, ClipboardActions, Sli
|
|
|
1743
1881
|
setGeometry(patch: GeometryPatch): void;
|
|
1744
1882
|
insert(kind: InsertKind, shapeType?: ShapePresetType): void;
|
|
1745
1883
|
insertImage(): Promise<void>;
|
|
1884
|
+
insertMedia(): Promise<void>;
|
|
1885
|
+
insertChart(chartType: l): void;
|
|
1886
|
+
insertSmartArt(layout: ca, defaultItems: string[]): void;
|
|
1887
|
+
insertEquation(omml: Record<string, unknown>): void;
|
|
1888
|
+
insertActionButton(shapeType: string): void;
|
|
1889
|
+
insertField(fieldType: string, value?: string): void;
|
|
1746
1890
|
duplicateSelected(): void;
|
|
1747
1891
|
deleteSelected(): void;
|
|
1748
1892
|
}
|
|
@@ -1788,10 +1932,13 @@ type TranslationMessages = Record<string, Record<string, string>>;
|
|
|
1788
1932
|
*/
|
|
1789
1933
|
declare function createTranslator(locale?: string, messages?: TranslationMessages): Translator;
|
|
1790
1934
|
|
|
1791
|
-
/** Selection-derived state the inspector reflects
|
|
1935
|
+
/** Selection-derived state the inspector reflects, computed by `buildInspectorState`. */
|
|
1792
1936
|
interface InspectorState {
|
|
1793
1937
|
hasSelection: boolean;
|
|
1794
1938
|
canShape: boolean;
|
|
1939
|
+
canText: boolean;
|
|
1940
|
+
isImage: boolean;
|
|
1941
|
+
isTable: boolean;
|
|
1795
1942
|
x: number;
|
|
1796
1943
|
y: number;
|
|
1797
1944
|
width: number;
|
|
@@ -1800,6 +1947,23 @@ interface InspectorState {
|
|
|
1800
1947
|
fillColor: string | undefined;
|
|
1801
1948
|
strokeColor: string | undefined;
|
|
1802
1949
|
strokeWidth: number;
|
|
1950
|
+
fillOpacity: number;
|
|
1951
|
+
strokeOpacity: number;
|
|
1952
|
+
gradientEnabled: boolean;
|
|
1953
|
+
gradient: GradientState;
|
|
1954
|
+
vAlign: 'top' | 'middle' | 'bottom';
|
|
1955
|
+
textWrap: 'square' | 'none';
|
|
1956
|
+
autoFitMode: 'shrink' | 'normal' | 'none';
|
|
1957
|
+
imageBrightness: number;
|
|
1958
|
+
imageContrast: number;
|
|
1959
|
+
imageSaturation: number;
|
|
1960
|
+
cropLeft: number;
|
|
1961
|
+
cropTop: number;
|
|
1962
|
+
cropRight: number;
|
|
1963
|
+
cropBottom: number;
|
|
1964
|
+
tableHeaderRow: boolean;
|
|
1965
|
+
tableBandedRows: boolean;
|
|
1966
|
+
tableCellPadding: number;
|
|
1803
1967
|
}
|
|
1804
1968
|
interface Inspector {
|
|
1805
1969
|
el: HTMLElement;
|
|
@@ -2519,6 +2683,7 @@ interface ChromeHost {
|
|
|
2519
2683
|
exportGif(): Promise<void>;
|
|
2520
2684
|
exportVideo(): Promise<void>;
|
|
2521
2685
|
print(): Promise<boolean>;
|
|
2686
|
+
setTheme(theme: ViewerTheme | undefined): void;
|
|
2522
2687
|
}
|
|
2523
2688
|
|
|
2524
2689
|
/** The export slice of the public viewer API (see `PptxViewerInstance`). */
|