Phase 3: - Declare PowerPointApi 1.5 and replace template manifest values - Remove the dead command pipeline and the tracked Babel/polyfill setup - Extract constants, status/settings contexts, PowerPoint services, and an error boundary - Build with ES2020 and strict TypeScript; hash production assets and drop prod source maps - Add Vitest tests, CI, LICENSE, Node 20 pinning, and prune unused dependencies - Correct the README, user guide, developer guide, and audit notes Phase 4: - Add a persisted 16:9/4:3 slide size setting used by all layout tools - Add dark mode with Office/system theme detection - Make sections collapsible and move to accessible Fluent controls - Announce status through aria-live and add semantic status icons - Add a progress counter with cooperative cancellation and a Stop button - Update the tracked dependency tree for the pruned packages
This commit is contained in:
1 parent
e57258afe9
commit
89989c04e9
6211 files changed
+7028
-274819
No files matched your search
@@ -18,16 +18,11 @@ import {
|
||||
TextboxAlignMiddleRegular,
|
||||
TextboxAlignBottomRegular
|
||||
} from "@fluentui/react-icons";
|
||||
import { useStatusContext } from "./App";
|
||||
import { useStatusContext } from "../context/StatusContext";
|
||||
import { useSettings } from "../context/SettingsContext";
|
||||
import { useCommonStyles } from "./commonStyles";
|
||||
import { getErrorMessage } from "../types/office-types";
|
||||
|
||||
/**
|
||||
* Slide dimensions in points (16:9). Shapes are aligned to the slide edges
|
||||
* and center, matching PowerPoint's "Align to Slide" behavior.
|
||||
*/
|
||||
const SLIDE_WIDTH = 960;
|
||||
const SLIDE_HEIGHT = 540;
|
||||
import { resetCancellation } from "../services/cancellation";
|
||||
|
||||
/**
|
||||
* Warning message when no shapes are selected
|
||||
@@ -69,6 +64,7 @@ const useStyles = makeStyles({
|
||||
export const AlignmentButtons: React.FC = () => {
|
||||
const styles = useStyles();
|
||||
const commonStyles = useCommonStyles();
|
||||
const { slideSize } = useSettings();
|
||||
const {
|
||||
setStatusMessage,
|
||||
setStatusType,
|
||||
@@ -94,6 +90,7 @@ export const AlignmentButtons: React.FC = () => {
|
||||
* @param alignmentType - The type of horizontal alignment to apply
|
||||
*/
|
||||
const handleHorizontalAlignment = async (alignmentType: HorizontalAlignmentType): Promise<void> => {
|
||||
resetCancellation();
|
||||
setIsProcessing(true);
|
||||
try {
|
||||
await PowerPoint.run(async (context) => {
|
||||
@@ -122,10 +119,10 @@ export const AlignmentButtons: React.FC = () => {
|
||||
shape.left = 0;
|
||||
break;
|
||||
case "center":
|
||||
shape.left = Math.max(0, (SLIDE_WIDTH - shape.width) / 2);
|
||||
shape.left = Math.max(0, (slideSize.width - shape.width) / 2);
|
||||
break;
|
||||
case "right":
|
||||
shape.left = Math.max(0, SLIDE_WIDTH - shape.width);
|
||||
shape.left = Math.max(0, slideSize.width - shape.width);
|
||||
break;
|
||||
}
|
||||
});
|
||||
@@ -149,6 +146,7 @@ export const AlignmentButtons: React.FC = () => {
|
||||
* @param alignmentType - The type of vertical alignment to apply
|
||||
*/
|
||||
const handleVerticalAlignment = async (alignmentType: VerticalAlignmentType): Promise<void> => {
|
||||
resetCancellation();
|
||||
setIsProcessing(true);
|
||||
try {
|
||||
await PowerPoint.run(async (context) => {
|
||||
@@ -177,10 +175,10 @@ export const AlignmentButtons: React.FC = () => {
|
||||
shape.top = 0;
|
||||
break;
|
||||
case "middle":
|
||||
shape.top = Math.max(0, (SLIDE_HEIGHT - shape.height) / 2);
|
||||
shape.top = Math.max(0, (slideSize.height - shape.height) / 2);
|
||||
break;
|
||||
case "bottom":
|
||||
shape.top = Math.max(0, SLIDE_HEIGHT - shape.height);
|
||||
shape.top = Math.max(0, slideSize.height - shape.height);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user