Initial TrueGrowth source import

This commit is contained in:
2026-07-07 09:36:36 +08:00
commit 3b6781d695
2283 changed files with 691996 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
## Context
The current PPT editor uses an image-first model: each slide is a Frame whose primary content is a full-slide image plus light `pptMeta`. This maps naturally to PowerPoint slide transitions, but not to element-level animation.
`pptxgenjs@4.0.1` does not expose a slide transition API, so exported PPTX transition support requires writing transition XML into `ppt/slides/slideN.xml` after generation.
## Goals
- Store transition configuration per PPT page without duplicating media data.
- Offer a right-click submenu that is quick to scan and works via hover.
- Make in-app slideshow playback honor the selected transition.
- Make downloaded PPTX files contain matching slide transition metadata.
- Keep memory usage bounded for high-page-count decks.
## Non-Goals
- Element-level animation such as text fly-in, object emphasis, or path animation.
- New dependency-heavy PPT generation pipeline.
- Auto-advance timing unless added in a later change.
## Decisions
- Use a small enum-like `PPTSlideTransitionType` with PowerPoint-aligned names: none, fade, push, wipe, split, cover, uncover.
- Store transition data on `PPTFrameMeta.transition` with a duration in milliseconds.
- Apply playback effects as CSS transforms/opacity on a lightweight overlay around the visible Frame area.
- Export transitions by generating a Blob/ArrayBuffer from `pptxgenjs`, loading it through the existing `jszip` dependency, patching slide XML, then triggering the same download behavior.
- Treat unsupported or malformed transition metadata as `none`.
## Risks / Trade-offs
- OOXML transition tags can vary across PowerPoint/WPS/Keynote. Keep the initial transition set small and test generated XML directly.
- PPTX post-processing holds the generated PPTX zip in memory. Avoid additional image decoding or full-slide rasterization during this phase.
- In-app CSS playback can approximate PowerPoint transitions but will not be pixel-perfect for every office suite.
## Validation
- Unit test transition sanitization and XML injection.
- Targeted PPT export test verifies generated slide XML contains expected transition tags.
- Manual browser check verifies right-click hover submenu, metadata persistence, and slideshow transition playback.

View File

@@ -0,0 +1,23 @@
# Change: Add PPT slide transitions
## Why
PPT pages currently play and export as immediate cuts. Users need per-page transition choices that feel close to PowerPoint, apply during in-app playback, and survive PPTX download.
## What Changes
- Add per-PPT-page transition metadata to Frame PPT data.
- Add an animation/transition submenu to the single-page PPT right-click menu with hover-revealed transition choices.
- Apply the selected page transition during `FrameSlideshow` playback.
- Export selected transitions into downloaded PPTX files by post-processing generated OOXML, because `pptxgenjs` does not expose a slide transition API.
- Keep scope to slide/page transitions; element-level entrance/emphasis animations are out of scope for the current image-first PPT model.
## Impact
- Affected specs: `ppt-editing`
- Affected code:
- `packages/drawnix/src/services/ppt/ppt.types.ts`
- `packages/drawnix/src/components/project-drawer/FramePanel.tsx`
- `packages/drawnix/src/components/project-drawer/FrameSlideshow.tsx`
- `packages/drawnix/src/services/ppt/ppt-export-service.ts`
- PPT-related tests

View File

@@ -0,0 +1,52 @@
## ADDED Requirements
### Requirement: PPT Page Transition Menu
The system SHALL provide a per-page PPT transition menu from the single-page PPT right-click menu.
#### Scenario: Hover transition submenu
- **GIVEN** the PPT editing panel shows slide page cards
- **WHEN** the user right-clicks a single PPT page card and hovers the animation menu
- **THEN** the system SHALL show supported slide transition choices
- **AND** the currently selected transition SHALL be indicated
#### Scenario: Select transition
- **GIVEN** the user opens the PPT page transition submenu
- **WHEN** the user selects a transition
- **THEN** the system SHALL store the transition on that page's PPT metadata
- **AND** subsequent editor renders SHALL show the selected transition as current
### Requirement: PPT Slideshow Transition Playback
The system SHALL apply the selected per-page transition during in-app PPT slideshow playback.
#### Scenario: Navigate to page with transition
- **GIVEN** a PPT page has a supported transition configured
- **WHEN** slideshow playback navigates to that page
- **THEN** the visible page change SHALL use the configured transition effect
#### Scenario: Reduced motion
- **GIVEN** the user environment prefers reduced motion
- **WHEN** slideshow playback navigates between PPT pages
- **THEN** the system SHALL avoid animated transition effects
### Requirement: PPTX Transition Export
The system SHALL include supported per-page slide transitions in downloaded PPTX files.
#### Scenario: Export configured transitions
- **GIVEN** PPT pages have supported transitions configured
- **WHEN** the user downloads the PPT deck
- **THEN** the generated PPTX SHALL include slide transition metadata for those pages
- **AND** pages without configured transitions SHALL keep the existing no-transition behavior
#### Scenario: Ignore invalid transition metadata
- **GIVEN** a PPT page contains missing or invalid transition metadata
- **WHEN** the user downloads the PPT deck or plays the slideshow
- **THEN** the system SHALL treat that page as having no transition

View File

@@ -0,0 +1,28 @@
## 1. Data Model
- [x] 1.1 Add PPT slide transition types and sanitization helpers.
- [x] 1.2 Extend `PPTFrameMeta` with optional transition metadata.
## 2. Editor UI
- [x] 2.1 Add a right-click animation/transition submenu for single PPT pages.
- [x] 2.2 Show the currently selected transition in the submenu.
- [x] 2.3 Persist transition changes through `setFramePPTMeta`.
## 3. Playback
- [x] 3.1 Make `FrameSlideshow` read per-page transition metadata.
- [x] 3.2 Apply matching lightweight CSS transition effects when navigating pages.
- [x] 3.3 Respect reduced-motion preferences by falling back to no animation.
## 4. PPTX Export
- [x] 4.1 Change PPT export to produce a Blob/ArrayBuffer before download.
- [x] 4.2 Patch generated slide XML with transition tags for supported transition types.
- [x] 4.3 Preserve existing export behavior when no transitions are configured.
## 5. Tests
- [x] 5.1 Add unit tests for transition metadata normalization.
- [x] 5.2 Add unit tests for PPTX transition XML injection.
- [x] 5.3 Run targeted PPT tests and a focused typecheck if feasible.