AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He
feat(pptx-shapes): author native preset shapes in SVG
hugohe3ec58dc8d3b15
diff --git a/skills/ppt-master/SKILL.md b/skills/ppt-master/SKILL.mdindex d827df18..bc1ba523 100644--- a/skills/ppt-master/SKILL.md+++ b/skills/ppt-master/SKILL.md@@ -39,7 +39,7 @@ description: >> 6. **NO SUB-AGENT SVG GENERATION** — Executor Step 6 SVG generation is context-dependent and MUST be completed by the current main agent end-to-end. Delegating page SVG generation to sub-agents is FORBIDDEN> 7. **SEQUENTIAL PAGE GENERATION ONLY** — In Executor Step 6, after the global design context is confirmed, SVG pages MUST be generated sequentially page by page in one continuous pass. Grouped page batches (for example, 5 pages at a time) are FORBIDDEN> 8. **SPEC_LOCK RE-READ PER PAGE** — Before generating each SVG page, Executor MUST `read_file <project_path>/spec_lock.md`. All colors / fonts / icons / images MUST come from this file — no values from memory or invented on the fly. Executor MUST also look up the confirmed `pptx_structure.template_adherence` when present, the current page's `page_rhythm` (`anchor` / `dense` / `breathing`), `page_layouts` (which template SVG to inherit), `page_charts` (which chart template to adapt, if any), and — when `pptx_structure.mode` is `template` or `preserve` — `pptx_layouts` (which native PowerPoint layout the page references). Deck/layout template routes require both mappings for every page: `strict` reuses the selected layout contract; `adaptive` may create a new explicit layout contract from the selected reference. Empty / absent `page_layouts` rows are reserved for free design and brand-only routes — see executor-base.md §2.1. This rule exists to resist context-compression drift on long decks and to break the uniform "every page is a card grid" default-> 9. **SVG MUST BE HAND-WRITTEN, NOT SCRIPT-GENERATED** — Every SVG page is written by the main agent directly, one page at a time (see rules 6 and 7). Writing or running a Python / Node / shell script that produces the SVG files in batch — looping over pages, templating from data, or emitting them via a generator — is FORBIDDEN, including under "save tokens", "quick draft", or "user is in a hurry" pretexts. The script-generation path was tried on a feature branch and abandoned: cross-page visual consistency depends on per-page authoring with full upstream context, which a generator script cannot reproduce+> 9. **SVG MUST BE HAND-WRITTEN, NOT SCRIPT-GENERATED** — Every SVG page is written by the main agent directly, one page at a time (see rules 6 and 7). Writing or running a Python / Node / shell script that produces the SVG files in batch — looping over pages, templating from data, or emitting them via a generator — is FORBIDDEN, including under "save tokens", "quick draft", or "user is in a hurry" pretexts. The script-generation path was tried on a feature branch and abandoned: cross-page visual consistency depends on per-page authoring with full upstream context, which a generator script cannot reproduce. **Narrow exception**: `preset_shape_svg.py` may print one deterministic stock-shape fragment to stdout after the main agent has selected its semantic role, frame, and paint. It cannot write `svg_output/`, choose layout, batch shapes, or generate a page; the main agent reads the fragment and inserts it through the normal hand-authored page edit> 10. **FOLLOW DETERMINISTIC ROUTING RULES** — Do not add blocking routing questions when this skill defines a route. If the user request violates a route precondition, state the required prerequisite and stop that route instead of asking the user to choose around the rule. Ordinary finite options, stylistic preferences, and recoverable details are surfaced with a recommended value plus alternatives at the next existing confirmation gate.> [!IMPORTANT]@@ -91,6 +91,7 @@ description: >| `${SKILL_DIR}/scripts/image_gen.py` | AI image generation (multi-provider) || `${SKILL_DIR}/scripts/slice_images.py` | Slice one AI illustration sheet into individual spot-illustration elements || `${SKILL_DIR}/scripts/svg_quality_checker.py` | SVG quality check |+| `${SKILL_DIR}/scripts/preset_shape_svg.py` | Print one registry-backed native PowerPoint preset fragment to stdout for hand-authored SVG insertion || `${SKILL_DIR}/scripts/total_md_split.py` | Speaker notes splitting || `${SKILL_DIR}/scripts/finalize_svg.py` | SVG post-processing (unified entry) || `${SKILL_DIR}/scripts/svg_to_pptx.py` | Export to PPTX |@@ -597,11 +598,12 @@ Read the execution references for this deck's locked `mode` + `visual_style` (fr```Read references/executor-base.md # REQUIRED: common guidelinesRead references/shared-standards.md # REQUIRED: SVG/PPT technical constraints+Read references/native-shape-authoring.md # REQUIRED: stock-shape selection and fragment helper contractRead references/modes/<locked-mode>.md # narrative skeleton (spec_lock.md `mode`)Read references/visual-styles/<locked-style>.md # aesthetic (spec_lock.md `visual_style`)```-> Read executor-base + shared-standards + the one locked mode file + the one locked visual-style file. For `mode: custom` or `visual_style: custom`, skip that preset file and follow `mode_behavior` / `visual_style_behavior` from `spec_lock.md` instead. Never glob `modes/` or `visual-styles/`.+> Read executor-base + shared-standards + native-shape-authoring + the one locked mode file + the one locked visual-style file. For `mode: custom` or `visual_style: custom`, skip that preset file and follow `mode_behavior` / `visual_style_behavior` from `spec_lock.md` instead. Never glob `modes/` or `visual-styles/`.**Design Parameter Confirmation (Mandatory)**: before the first SVG, output key design parameters from the spec (canvas dimensions, color scheme, font plan, body font size). See executor-base.md §2.@@ -627,7 +629,7 @@ python3 ${SKILL_DIR}/scripts/svg_editor/server.py <project_path> --live --daemon**Visual Construction Phase**: generate SVG pages sequentially, one at a time, in one continuous pass → `<project_path>/svg_output/`-Each completed SVG MUST be a standalone, complete representation of that slide's visible design. Template SVGs and locked planning artifacts may guide construction, but export must not reach back to them to add visible objects omitted from `svg_output/`. Speaker notes, animation, narration, transitions, and direct native-PPTX workflows remain separately owned artifacts/capabilities.+Each completed SVG MUST be a standalone, complete representation of that slide's visible design. Template SVGs and locked planning artifacts may guide construction, but export must not reach back to them to add visible objects omitted from `svg_output/`. Speaker notes, animation, narration, transitions, and direct native-PPTX workflows remain separately owned artifacts/capabilities. Before drawing a literal stock shape, apply [`native-shape-authoring.md`](references/native-shape-authoring.md): use the stdout-only helper when one PowerPoint preset exactly matches, keep basic SVG primitives for rect/round-rect/ellipse, and keep free SVG for custom semantics. Never infer a preset from contour similarity.Every `baseline` / free-design page root MUST declare one canonical `data-pptx-page-role`; `template` / `preserve` pages already declare `data-pptx-layout` and MUST NOT duplicate that identity merely to satisfy this rule. Add `data-pptx-role` only to structural page-frame objects whose package, page-number, or animation behavior is not already expressed by `data-pptx-layer`, `data-pptx-placeholder`, or `data-pptx-native`; such an element needs a stable unique `id`. Do not add generic content roles to ordinary titles, body text, cards, KPIs, diagrams, charts, icons, or images. Full contract: [`references/semantic-svg.md`](references/semantic-svg.md).@@ -915,6 +917,7 @@ Before switching roles, **MUST first read** the corresponding reference file. Ou| Resource | Path ||----------|------|| Shared technical constraints | `references/shared-standards.md` |+| Native preset shape authoring | `references/native-shape-authoring.md` || Semantic SVG marker contract | `references/semantic-svg.md` || Canvas format specification | `references/canvas-formats.md` || Image-text layout patterns (Primary structures + Modifier layers — combine freely) | `references/image-layout-patterns.md` |diff --git a/skills/ppt-master/references/executor-base.md b/skills/ppt-master/references/executor-base.mdindex 9ce469ad..d189c131 100644--- a/skills/ppt-master/references/executor-base.md+++ b/skills/ppt-master/references/executor-base.md@@ -223,6 +223,39 @@ Before drawing each page, look up its entry in `page_charts` to decide which cha2. **Quality Check Gate**: run `python3 scripts/svg_quality_checker.py <project_path>` on `svg_output/`. Any `error` (banned features, viewBox mismatch, spec_lock drift, non-PPT-safe font, etc.) MUST be fixed on the offending page before proceeding — regenerate and re-check. Address `warning`s when straightforward. Do NOT defer to after `finalize_svg.py` — finalize rewrites SVG and masks some violations.3. **Logic Construction Phase**: after SVGs pass the quality check, batch-generate speaker notes for narrative continuity.+### 3.0 Native Preset Shape Selection++**Default — use one native preset when it exactly expresses one object (may+override for page-specific geometry)**: apply the decision gate in+[`native-shape-authoring.md`](./native-shape-authoring.md) before drawing a+literal stock shape, block arrow, standard flowchart node, connector, callout,+ribbon, or Office symbol.++| Decision | Action |+|---|---|+| Plain rect / symmetric round rect / circle / ellipse | Keep the ordinary SVG primitive; it is already natively editable. |+| Exact single-preset match | Call `preset_shape_svg.py render` and paste its complete stdout fragment into the current hand-authored SVG. |+| Page-specific, compound, organic, branded, icon, or data geometry | Keep ordinary SVG path/polygon geometry. |+| Similar-looking contour only | Never guess; keep ordinary SVG. |++This automatic decision applies only before drawing a new object. Do not scan+existing SVG, classify path contours, or upgrade ordinary SVG during export.++**Hard rule**: do not hand-write `data-pptx-authoring`, `data-pptx-prst`,+`data-pptx-frame`, adjustment, carrier, preview, or fingerprint metadata. The+helper generates them atomically from the shared 187-shape registry. Rerun the+helper when geometry or paint changes.++Connector-family presets require `--object-kind connector`, `fill="none"`, and+a visible stroke. They export as unconnected `p:cxnSp`; do not hand-add+endpoint/site metadata. `actionButton*` presets provide visual geometry only,+not actions or hyperlinks.++**Hard rule — narrow helper scope**: the helper prints one shape fragment to+stdout. It does not write a page or choose layout. Read the fragment and insert+it through the normal `apply_patch` page edit; never redirect, loop, or batch it+into `svg_output/`.+### 3.1 Chart Plot-Area Marker (MANDATORY on every chart page)> The [`verify-charts`](../workflows/verify-charts.md) workflow enumerates chart pages from `design_spec.md §VII`, then reads each page's plot-area marker to feed `svg_position_calculator.py`. Missing marker → verify-charts has to re-derive the plot area from axis lines, paying the cost on every run.diff --git a/skills/ppt-master/references/native-shape-authoring.md b/skills/ppt-master/references/native-shape-authoring.mdnew file mode 100644index 00000000..cb1c041d--- /dev/null+++ b/skills/ppt-master/references/native-shape-authoring.md@@ -0,0 +1,137 @@+> See [`shared-standards.md`](./shared-standards.md) §§1.4–1.5 for the native-shape metadata and validation contracts.++# Native Preset Shape Authoring Reference++Use this reference during Executor SVG construction when one standard+PowerPoint shape can express one complete geometric object. The helper does+not create the preset shape's own `p:txBody`; keep visible text outside the+atomic fragment.++## 1. Selection Gate++Apply this decision order before drawing a stock geometric object.++| Condition | Action |+|---|---|+| Plain rectangle, symmetric rounded rectangle, circle, or ellipse | Write the ordinary SVG primitive; the exporter already emits an editable native shape. |+| One DrawingML preset exactly expresses the intended object | Run `preset_shape_svg.py render`, then insert its complete stdout fragment into the hand-authored page. |+| The visual meaning or contour exceeds one stock shape | Write ordinary `<path>` / `<polygon>` geometry; export keeps it as editable custom geometry. |+| The shape only resembles a preset | Keep ordinary SVG; never infer a preset from contour similarity. |+| Mirror/preserve input already owns native-shape metadata | Keep the existing object and metadata; never reselect its preset. |++**Hard rule**: `preset_shape_svg.py` is the only authoring entry for+`data-pptx-authoring="preset"`. Never add `data-pptx-prst`, frame, adjustment,+carrier, preview, or fingerprint attributes to a hand-written path.++---++## 2. Semantic Preset Candidate Guide++"Automatic" means the Executor independently applies this semantic decision+gate before drawing a new object. It does not scan existing SVG, classify+paths or contours, or upgrade ordinary SVG during export.++| Visual intent | Candidate presets | Boundary |+|---|---|---|+| Literal geometric body | `triangle`, `diamond`, `pentagon`, `hexagon`, `octagon`, `star5` | Use only when the named geometry itself is the intent. |+| Solid block direction | `rightArrow`, `leftArrow`, `upArrow`, `downArrow`, `leftRightArrow`, `upDownArrow`, `chevron` | Thin relationship geometry remains an ordinary SVG `<line>` / `<path>` with no attachment semantics. |+| Standard flowchart node | `flowChartProcess`, `flowChartDecision`, `flowChartInputOutput`, `flowChartTerminator`, `flowChartDocument` | Use only for an actual flowchart; ordinary content cards remain cards. |+| Standard connector route | `straightConnector1`, `bentConnector*`, `curvedConnector*` | The SVG route must match the selected preset; otherwise use a free path. |+| Stock callout | `wedgeRectCallout`, `wedgeRoundRectCallout`, `wedgeEllipseCallout`, `cloudCallout` | Brand-specific or custom-tail callouts remain free SVG. |+| Stock ribbon or scroll | `ribbon*`, `ellipseRibbon*`, `verticalScroll`, `horizontalScroll` | Select only when the stock contour is visually acceptable. |+| Standalone math symbol | `mathPlus`, `mathMinus`, `mathMultiply`, `mathDivide`, `mathEqual`, `mathNotEqual` | Inline formulas and prose symbols remain text/formula assets. |+| Literal Office symbol | `heart`, `sun`, `moon`, `lightningBolt`, `gear6`, `gear9` | Never replace an icon required by `spec_lock.icons`. |++Use registry search for a less common literal shape:++```bash+python3 ${SKILL_DIR}/scripts/preset_shape_svg.py list --search arrow+python3 ${SKILL_DIR}/scripts/preset_shape_svg.py describe rightArrow+```++**Forbidden — false native semantics**:++- `actionButton*` when navigation or trigger behavior is expected; the helper+ maps its visual preset geometry only and never creates an action or hyperlink;+- `chartX`, `chartStar`, or `chartPlus` as a substitute for native charts;+- logo, icon glyph, illustration, brand contour, or data-chart marks.++---++## 3. Fragment Generation++Run one command for one selected object. Colors must come from the current+page's re-read `spec_lock.md`.++```bash+python3 ${SKILL_DIR}/scripts/preset_shape_svg.py render rightArrow \+ --id p03-growth-arrow \+ --frame 160 210 320 112 \+ --fill "#2563EB" \+ --stroke none \+ --adjust "adj1=val 50000"+```++For a native connector:++```bash+python3 ${SKILL_DIR}/scripts/preset_shape_svg.py render bentConnector3 \+ --id p03-flow-connector \+ --object-kind connector \+ --frame 420 180 220 140 \+ --fill none \+ --stroke "#475569" \+ --stroke-width 2+```++Every connector-family preset requires `--object-kind connector`, `--fill none`,+and a visible stroke. It exports as an unconnected `p:cxnSp`; a connector+preset can never be authored as an ordinary `shape`.++**Hard rule — stdout-only exception**: the helper prints one deterministic+`<g>` fragment. Read that output and insert it with the normal page+`apply_patch` edit. Do not redirect it into `svg_output/`, loop over pages,+batch shapes, or let it choose layout. The main Agent still authors every+complete SVG page sequentially.++---++## 4. Atomic Fragment Contract++The helper emits one logical group containing exactly one hidden native carrier+and one complete visible preview.++| Component | Ownership |+|---|---|+| Logical `<g data-pptx-authoring="preset">` | Stable id, object kind, preset, frame, adjustments, and preview fingerprint. |+| `path[data-pptx-part="geometry"]` | Native PowerPoint export authority; hidden from the browser. |+| `g[data-pptx-part="geometry-preview"]` | Browser-visible preset drawing. |+| `path[data-pptx-part="geometry-detail"]` | One visible layer per DrawingML path, including path-level fill/stroke behavior. |++**Hard rule**: treat the returned group as atomic. Put labels, icons, or other+decorations beside it in a parent `<g>`, never inside the preset group.++**Regeneration rule**: rerun the helper when preset, frame, adjustment, fill,+stroke, or stroke width changes. Moving, scaling, rotating, or flipping the+complete logical group is allowed; zero-scale transforms and shear/skew are+forbidden, and the transformed frame must remain inside DrawingML's coordinate+range. Stroke width must remain inside DrawingML's line-width range. To freely+edit the contour, replace the whole fragment with ordinary SVG rather than+modifying a `geometry-detail` path.++---++## 5. Boundaries++| Concern | Behavior |+|---|---|+| Shape text | Keep visible SVG `<text>` outside the atomic fragment. It remains editable but may export as a grouped text box rather than the preset's own `p:txBody`. |+| Connector attachment | Authoring helper v1 creates an unconnected `p:cxnSp` and does not accept endpoint/site metadata. Do not hand-add it. The imported-shape contract may preserve an attachment that already exists in a source PPTX; creating a new attached connector is currently unsupported. |+| Action button behavior | `actionButton*` presets map visual geometry only. No action, navigation target, or hyperlink is created automatically. |+| Gradient/pattern paint | Authoring helper v1 accepts solid HEX paint only. Use ordinary SVG when a complex paint treatment is essential. |+| Multi-path darken/lighten | Browser preview uses the shared normalized paint behavior from the PPTX importer. |+| External edits | Any preview or semantic mismatch fails quality check and export; regenerate the fragment. |++**Validation**: `svg_quality_checker.py` independently rerenders every authored+preset from registry metadata and compares the carrier, visible layers, style,+and fingerprint before export.diff --git a/skills/ppt-master/references/semantic-svg.md b/skills/ppt-master/references/semantic-svg.mdindex a8115f9a..4b34228d 100644--- a/skills/ppt-master/references/semantic-svg.md+++ b/skills/ppt-master/references/semantic-svg.md@@ -23,9 +23,12 @@ Use the existing specialized contracts for specialized facts:- `data-pptx-placeholder` owns PowerPoint placeholder identity;- `data-pptx-native` owns native chart/table reconstruction.- `data-pptx-object`, `data-pptx-prst`, `data-pptx-frame`, `data-pptx-av-*`,- `data-pptx-geometry-*`, and `data-pptx-part` own imported native-shape- round-trip semantics under- [`shared-standards.md §1.4`](shared-standards.md#14-imported-native-powerpoint-shapes-conditional-contract).+ `data-pptx-geometry-*`, `data-pptx-authoring`, and `data-pptx-part` own+ imported round-trip and authored preset-shape semantics under+ [`shared-standards.md`](./shared-standards.md) §§1.4–1.5.++Authored preset metadata comes only from `preset_shape_svg.py`; ordinary SVG+paths are never scanned, classified, or automatically upgraded to a preset.Do not duplicate those facts with `data-pptx-role`. Consumers resolve semanticsin this order: specialized metadata, minimal compiler hints, then legacydiff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.mdindex 0cdc369e..a20adf6b 100644--- a/skills/ppt-master/references/shared-standards.md+++ b/skills/ppt-master/references/shared-standards.md@@ -7,7 +7,7 @@ Other files link here instead of restating its contracts.| Section | Owns | Strength ||---|---|---|-| §1 Required Foundation, Forbidden Features, and Conditional Interfaces | XML validity, the exhaustive structural blacklist, native line ends, image clipping, static local reuse, and imported native-shape semantics | Required / Forbidden / Conditional |+| §1 Required Foundation, Forbidden Features, and Conditional Interfaces | XML validity, the exhaustive structural blacklist, native line ends, image clipping, static local reuse, and imported/authored native-shape semantics | Required / Forbidden / Conditional || §2 Conditional Compatibility Mappings | Inline geometry and approximate group opacity | Conditional || §3 Canvas Format Quick Reference | Pointer to the complete canvas catalog | Reference || §4 Required Page Contract and Conditional Packaging | Complete-page authority, semantic markers, editable text/grouping, and package promotion | Required / Conditional |@@ -29,6 +29,7 @@ Other files link here instead of restating its contracts.| Transforms and composition | Translate, scale, rotate, mirror, supported matrix composition, layering, and static local reuse | §1.3, §6.8 || Freeform geometry | Full SVG path vocabulary, curves, organic containers, multi-subpaths, and asymmetric rounded rectangles | §6.9 || Imported PowerPoint shapes | All 187 preset geometries, adjustments, logical frames, custom geometry, connectors, and unchanged native text bodies | §1.4 |+| Authored PowerPoint preset shapes | Registry-generated visible fragments that export as one native preset shape or connector | §1.5; [`native-shape-authoring.md`](./native-shape-authoring.md) || Radial/chart geometry | Pie/donut arcs, dashed-circle ring segments, gauges, progress rings, sunbursts, and diagonal polygon arrowheads | §6.10 || Constructed visual styles | Faux glass, hand-drawn marks, ink wash, Riso offset, pixel grid, halftone, isometric facets, paper cut, and line-plus-area data treatment | §6.11 || Unsupported-effect fallbacks | Raster baking or explicit-geometry alternatives for blur, inner shadow, soft edge, reflection, turbulence, blend modes, and arbitrary masks | §6.12 |@@ -103,6 +104,8 @@ under the conditional contracts below.>> **Imported native-shape metadata is conditional** — see §1.4.>+> **Authored native preset fragments are conditional** — see §1.5.+>> **Inline CSS geometry, group opacity, simple gradients, and filters are> conditional** — see §2 and §6.>@@ -262,6 +265,65 @@ reconstruction are also normalized rather than byte-identical OOXML.---+### 1.5 Authored Native PowerPoint Presets (Conditional Contract)++New SVG pages may opt one complete geometric object into a native DrawingML+preset through the deterministic fragment helper. Selection behavior lives in+[`native-shape-authoring.md`](./native-shape-authoring.md); this section owns+the machine contract.++| Metadata / structure | Required behavior |+|---|---|+| `data-pptx-authoring="preset"` | Appears on the logical group and hidden carrier; distinguishes the strict new authoring contract from legacy/imported metadata. |+| `data-pptx-object` | `shape` or `connector`; connector-family presets must use `connector`, and `connector` must use a connector-family preset. Authored connectors require `fill="none"` plus a visible stroke and export as unconnected `p:cxnSp`. |+| `data-pptx-prst`, `data-pptx-frame`, `data-pptx-av-*` | Generated together from the locked registry; group and carrier values must be identical. |+| One direct `path[data-pptx-part="geometry"]` | Hidden native export authority; carries the same semantics and solid paint used for regeneration. |+| One direct `g[data-pptx-part="geometry-preview"]` | Complete browser-visible preview with one ordered detail path per registry path. |+| `data-pptx-preview-sha256` | Identical on group/carrier and equal to an independent registry rerender of metadata, paint, and preview. |++Generate one fragment at a time:++```bash+python3 ${SKILL_DIR}/scripts/preset_shape_svg.py render rightArrow \+ --id p03-growth-arrow \+ --frame 160 210 320 112 \+ --fill "#2563EB" \+ --stroke none \+ --adjust "adj1=val 50000"+```++**Hard rule — helper-only metadata**: never add or edit authored preset+metadata on a hand-written leaf. The helper output is atomic. Regenerate it+when preset, frame, adjustment, fill, stroke, or stroke width changes. Replace+the whole fragment with ordinary SVG when free contour editing is required.++**Hard rule — visible page closure**: the helper prints a complete visible+fragment to stdout; export never invents its preview. The main Agent inserts+that output into the hand-authored page. The helper cannot write a project,+select layout, or generate a page.++**Authoring paint boundary**: v1 accepts `none` or six-digit solid HEX fill and+stroke, optional fill/stroke opacity, stroke width, line cap, and line join.+Colors come from `spec_lock.md`. Use ordinary SVG for gradients, patterns,+filters, or other treatments outside this narrow contract.++**Validation**: quality check and export both rerender authored fragments from+`preset + frame + adjustments + carrier paint`. They require one carrier, one+preview, equal group/carrier semantics, exact ordered registry paths, and a+matching fingerprint. Preview edits, metadata-only edits, unknown adjustments,+out-of-range frames/transforms, zero-scale transforms, and shear/skew fail+closed.++**Fidelity boundary**: an unchanged authored fragment is `Native-stable` as+one `p:sp` or `p:cxnSp`. Text remains outside the atomic fragment and may export+as a grouped editable text box. Authoring v1 creates only unconnected+`p:cxnSp`; it does not accept hand-written endpoint/site metadata. An+`actionButton*` preset maps visual geometry only. Preset appearance never+invents connector attachment, action behavior, navigation targets, or+hyperlinks.++---+## 2. Conditional Compatibility Mappings### 2.1 Literal Inline Geometry@@ -336,7 +398,8 @@ metadata. See[`semantic-svg.md`](semantic-svg.md) for the canonical vocabulary and examples.- **Canvas authority**: `viewBox` MUST match the selected canvas dimensions.- Root `width` and `height` are optional and do not override it.+ Root `width` and `height` are optional and do not override it. Root `<svg>`+ `transform` is forbidden; apply transforms to child elements or groups.- **Font portability**: font families used by the deck must resolve to installedexport faces. `@font-face` remains forbidden; the typography contract lives in[`strategist.md §g`](strategist.md).diff --git a/skills/ppt-master/scripts/README.md b/skills/ppt-master/scripts/README.mdindex 663ecfb7..a26d5ba9 100644--- a/skills/ppt-master/scripts/README.md+++ b/skills/ppt-master/scripts/README.md@@ -45,7 +45,7 @@ python3 scripts/update_repo.py|------|-----------------|---------------|| Conversion | `source_to_md.py`, `source_to_md/pdf_to_md.py`, `source_to_md/doc_to_md.py`, `source_to_md/excel_to_md.py`, `source_to_md/ppt_to_md.py`, `source_to_md/web_to_md.py`, `pptx_intake.py`, `pptx_to_svg.py` | [docs/conversion.md](./docs/conversion.md) || Project management | `project_manager.py`, `batch_validate.py`, `generate_examples_index.py`, `error_helper.py`, `pptx_template_import.py`, `template_fill_pptx.py`, `native_enhance_pptx.py` | [docs/project.md](./docs/project.md) |-| SVG pipeline | `finalize_svg.py`, `svg_to_pptx.py`, `total_md_split.py`, `svg_quality_checker.py`, `extract_svg_assets.py`, `animation_config.py`, `notes_to_audio.py` | [docs/svg-pipeline.md](./docs/svg-pipeline.md) |+| SVG pipeline | `preset_shape_svg.py`, `finalize_svg.py`, `svg_to_pptx.py`, `total_md_split.py`, `svg_quality_checker.py`, `extract_svg_assets.py`, `animation_config.py`, `notes_to_audio.py` | [docs/svg-pipeline.md](./docs/svg-pipeline.md); [native preset authoring](../references/native-shape-authoring.md) || PPTX transitions | `pptx_transitions.py` | [docs/pptx-transitions.md](./docs/pptx-transitions.md) || PPTX animations | `pptx_animations.py`, `animation_config.py` | [docs/pptx-animations.md](./docs/pptx-animations.md) || Spec maintenance | `update_spec.py` | [docs/update_spec.md](./docs/update_spec.md) |@@ -107,6 +107,16 @@ python3 scripts/native_enhance_pptx.py validate <project_path>python3 scripts/native_enhance_pptx.py apply <project_path>```+Native preset shape authoring (one registry-backed fragment on stdout):++```bash+python3 scripts/preset_shape_svg.py list --search arrow+python3 scripts/preset_shape_svg.py describe rightArrow+python3 scripts/preset_shape_svg.py render rightArrow --id process-arrow --frame 120 180 240 96 --fill '#2563EB'+```++The helper never writes a page or project file. Select one exact semantic stock-shape match, inspect the emitted fragment, and insert it into the hand-authored SVG with the normal patch workflow. Keep ordinary rectangles, ellipses, freeform geometry, charts, icons, and ambiguous silhouettes as regular SVG. See [`references/native-shape-authoring.md`](../references/native-shape-authoring.md) for the selection and metadata contract.+Post-processing and export:```bashdiff --git a/skills/ppt-master/scripts/pptx_shapes/__init__.py b/skills/ppt-master/scripts/pptx_shapes/__init__.pyindex 74a9fde8..ce41ad40 100644--- a/skills/ppt-master/scripts/pptx_shapes/__init__.py+++ b/skills/ppt-master/scripts/pptx_shapes/__init__.py@@ -25,11 +25,16 @@ from .errors import ()from .formula import (FULL_CIRCLE,+ OOXML_COORDINATE_MAX,+ OOXML_COORDINATE_MIN,OOXML_DEGREE,+ OOXML_LINE_WIDTH_MAX,SUPPORTED_OPERATORS,FormulaEvaluator,build_builtin_guides,evaluate_formula,+ validate_ooxml_line_width,+ validate_ooxml_xfrm,)from .loader import (BUNDLED_DEFINITIONS_PATH,@@ -67,7 +72,10 @@ __all__ = ["DRAWINGML_NS","EXPECTED_SHAPE_COUNT","FULL_CIRCLE",+ "OOXML_COORDINATE_MAX",+ "OOXML_COORDINATE_MIN","OOXML_DEGREE",+ "OOXML_LINE_WIDTH_MAX","SUPPORTED_OPERATORS","EvaluatedPresetGeometry","FormulaEvaluationError",@@ -89,4 +97,6 @@ __all__ = ["resolve_preset_preview_hash","svg_text_fingerprint","svg_preset_preview_fingerprint",+ "validate_ooxml_line_width",+ "validate_ooxml_xfrm",]diff --git a/skills/ppt-master/scripts/pptx_shapes/formula.py b/skills/ppt-master/scripts/pptx_shapes/formula.pyindex 389952e6..3c07a23f 100644--- a/skills/ppt-master/scripts/pptx_shapes/formula.py+++ b/skills/ppt-master/scripts/pptx_shapes/formula.py@@ -31,6 +31,9 @@ from .errors import (OOXML_DEGREE = 60000.0FULL_CIRCLE = 360.0 * OOXML_DEGREE+OOXML_COORDINATE_MIN = -27273042329600+OOXML_COORDINATE_MAX = 27273042316900+OOXML_LINE_WIDTH_MAX = 20116800_OPERATOR_ARITY = {"val": 1,@@ -57,6 +60,35 @@ _DIMENSION_GUIDE_RE = re.compile(r"^(wd|hd|ssd)([1-9][0-9]*)$")_ANGLE_GUIDE_RE = re.compile(r"^(?:(\d+))?cd([1-9][0-9]*)$")+def validate_ooxml_xfrm(+ off_x: int,+ off_y: int,+ ext_cx: int,+ ext_cy: int,+) -> None:+ """Validate DrawingML shape offsets and extents in EMU."""+ for name, value in (("x", off_x), ("y", off_y)):+ if not OOXML_COORDINATE_MIN <= value <= OOXML_COORDINATE_MAX:+ raise ValueError(+ f"DrawingML xfrm offset {name}={value} is outside the "+ "OOXML coordinate range"+ )+ for name, value in (("cx", ext_cx), ("cy", ext_cy)):+ if value < 0 or value > OOXML_COORDINATE_MAX:+ raise ValueError(+ f"DrawingML xfrm extent {name}={value} is outside the "+ "OOXML positive-coordinate range"+ )+++def validate_ooxml_line_width(width: int) -> None:+ """Validate one DrawingML ``ST_LineWidth`` value in EMU."""+ if width < 0 or width > OOXML_LINE_WIDTH_MAX:+ raise ValueError(+ f"DrawingML line width {width} is outside the OOXML line-width range"+ )++def build_builtin_guides(width: float,height: float,diff --git a/skills/ppt-master/scripts/pptx_to_svg/__init__.py b/skills/ppt-master/scripts/pptx_to_svg/__init__.pyindex 446630d7..31ed220b 100644--- a/skills/ppt-master/scripts/pptx_to_svg/__init__.py+++ b/skills/ppt-master/scripts/pptx_to_svg/__init__.py@@ -8,6 +8,13 @@ Public entry: convert_pptx_to_svg().from __future__ import annotations-from .converter import convert_pptx_to_svg-__all__ = ["convert_pptx_to_svg"]+++def __getattr__(name: str):+ """Load the public converter lazily so shared submodules stay lightweight."""+ if name != "convert_pptx_to_svg":+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")+ from .converter import convert_pptx_to_svg++ return convert_pptx_to_svgdiff --git a/skills/ppt-master/scripts/pptx_to_svg/preset_authoring.py b/skills/ppt-master/scripts/pptx_to_svg/preset_authoring.pynew file mode 100644index 00000000..e47a8953--- /dev/null+++ b/skills/ppt-master/scripts/pptx_to_svg/preset_authoring.py@@ -0,0 +1,581 @@+#!/usr/bin/env python3+"""+PPT Master - Authored Preset Shape Contract++Build and validate canonical SVG fragments for newly authored PowerPoint+preset shapes.++Usage:+ Import render_preset_shape_fragment or validate_authored_preset_group.++Examples:+ fragment = render_preset_shape_fragment("rightArrow", (80, 120, 240, 96))++Dependencies:+ None (only uses standard library and local PPT Master modules)+"""++from __future__ import annotations++import math+import re+from typing import Mapping+from xml.etree import ElementTree as ET++from pptx_shapes import (+ CONNECTOR_PRESET_TYPES,+ OOXML_COORDINATE_MAX,+ OOXML_COORDINATE_MIN,+ SUPPORTED_OPERATORS,+ get_preset_registry,+ resolve_preset_preview_hash,+ svg_preset_preview_fingerprint,+ validate_ooxml_line_width,+ validate_ooxml_xfrm,+)++from .emu_units import EMU_PER_PX, Xfrm, fmt_num+from .preset_registry_to_svg import render_preset_geometry+from .preset_svg_markup import attrs_to_xml, serialize_preset_layers+++AUTHORING_ATTR = "data-pptx-authoring"+AUTHORING_VALUE = "preset"+_ID_RE = re.compile(r"[A-Za-z_][A-Za-z0-9_.:-]*")+_PAINT_RE = re.compile(r"(?:none|#[0-9A-Fa-f]{6})")+_INTEGER_RE = re.compile(r"[+-]?\d+")+_ADJUSTMENT_PREFIX = "data-pptx-av-"+_STYLE_ATTRS = (+ "fill",+ "fill-opacity",+ "stroke",+ "stroke-linecap",+ "stroke-linejoin",+ "stroke-opacity",+ "stroke-width",+)+_SEMANTIC_ATTRS = (+ AUTHORING_ATTR,+ "data-pptx-object",+ "data-pptx-prst",+ "data-pptx-frame",+)+++def render_preset_shape_fragment(+ preset: str,+ frame: tuple[float, float, float, float],+ *,+ adjustments: Mapping[str, str | int | float] | None = None,+ object_kind: str = "shape",+ element_id: str,+ name: str | None = None,+ style: Mapping[str, str] | None = None,+) -> str:+ """Render one complete authored preset fragment for manual SVG insertion."""+ registry = get_preset_registry()+ if preset not in registry:+ raise ValueError(f"Unknown DrawingML preset shape: {preset!r}")+ if _ID_RE.fullmatch(element_id) is None:+ raise ValueError(f"Invalid SVG element id: {element_id!r}")+ if object_kind not in {"shape", "connector"}:+ raise ValueError("object_kind must be 'shape' or 'connector'")+ if preset in CONNECTOR_PRESET_TYPES and object_kind != "connector":+ raise ValueError(+ f"Connector preset {preset!r} requires object_kind='connector'"+ )+ if object_kind == "connector" and preset not in CONNECTOR_PRESET_TYPES:+ raise ValueError(+ f"Authored connector requires a connector preset, got {preset!r}"+ )++ x, y, width, height = _validate_frame(frame, object_kind)+ adjustment_values = _normalize_adjustments(adjustments or {})+ _validate_adjustments(preset, adjustment_values)+ registry.evaluate(+ preset,+ width,+ height,+ adjustments=adjustment_values,+ )+ rendered = render_preset_geometry(+ preset,+ Xfrm(x=x, y=y, w=width, h=height),+ adjustment_values,+ )+ if not rendered.paths:+ raise ValueError(f"Preset {preset!r} produced no visible SVG paths")++ frame_text = " ".join(+ fmt_num(value, 8) for value in (x, y, width, height)+ )+ semantic_attrs = {+ AUTHORING_ATTR: AUTHORING_VALUE,+ "data-pptx-object": object_kind,+ "data-pptx-prst": preset,+ "data-pptx-frame": frame_text,+ }+ if name:+ semantic_attrs["data-pptx-shape-name"] = name+ for guide_name, formula in adjustment_values.items():+ semantic_attrs[f"{_ADJUSTMENT_PREFIX}{guide_name}"] = str(formula)++ style_attrs = _validate_style(style or {})+ if object_kind == "connector":+ if style_attrs.get("fill", "none") != "none":+ raise ValueError("Authored connector fill must be none")+ if not _has_visible_stroke(style_attrs):+ raise ValueError("Authored connector requires a visible stroke")+ markup = serialize_preset_layers(+ rendered.paths,+ semantic_attrs,+ style_attrs,+ )+ group_attrs = {+ "id": element_id,+ **semantic_attrs,+ "data-pptx-preview-sha256": markup.preview_hash,+ }+ return (+ f'<g{attrs_to_xml(group_attrs)}>\n'+ f"{markup.markup}\n"+ "</g>"+ )+++def validate_authored_preset_group(group: ET.Element) -> list[str]:+ """Return canonical authored-preset contract errors for one logical group."""+ if group.get(AUTHORING_ATTR) != AUTHORING_VALUE:+ return []+ errors: list[str] = []+ if _local_name(group.tag) != "g":+ return [f'{AUTHORING_ATTR}="{AUTHORING_VALUE}" requires an SVG <g>']+ element_id = group.get("id")+ if element_id is None:+ errors.append("Authored preset logical group requires a stable id")+ elif _ID_RE.fullmatch(element_id) is None:+ errors.append(f"Authored preset logical group has invalid id {element_id!r}")++ unexpected_group_attrs = sorted(+ name for name in group.attrib+ if _is_unexpected_group_attr(name)+ )+ if unexpected_group_attrs:+ errors.append(+ "Authored preset logical group has unsupported attributes: "+ + ", ".join(unexpected_group_attrs)+ )++ direct_children = list(group)+ carriers = [+ child+ for child in direct_children+ if child.get("data-pptx-part") == "geometry"+ ]+ previews = [+ child+ for child in direct_children+ if child.get("data-pptx-part") == "geometry-preview"+ ]+ if len(carriers) != 1:+ errors.append(+ f"Authored preset requires exactly one direct geometry carrier; "+ f"found {len(carriers)}"+ )+ if len(previews) != 1:+ errors.append(+ f"Authored preset requires exactly one direct geometry preview; "+ f"found {len(previews)}"+ )+ allowed_children = set(carriers + previews)+ foreign_children = [+ child for child in direct_children+ if child not in allowed_children+ ]+ if foreign_children:+ errors.append(+ "Authored preset groups are atomic; place labels or decorations "+ "in a parent group"+ )+ if len(carriers) != 1 or len(previews) != 1:+ return errors++ carrier = carriers[0]+ preview = previews[0]+ if _local_name(carrier.tag) != "path":+ errors.append("Authored preset geometry carrier must be an SVG <path>")+ if _local_name(preview.tag) != "g":+ errors.append("Authored preset geometry preview must be an SVG <g>")+ if carrier.get("visibility") != "hidden":+ errors.append('Authored preset carrier requires visibility="hidden"')+ if carrier.get("pointer-events") != "none":+ errors.append('Authored preset carrier requires pointer-events="none"')++ for attr_name in _SEMANTIC_ATTRS:+ if group.get(attr_name) != carrier.get(attr_name):+ errors.append(+ f"Authored preset group/carrier {attr_name} values differ"+ )+ adjustment_names = {+ name+ for element in (group, carrier)+ for name in element.attrib+ if name.startswith(_ADJUSTMENT_PREFIX)+ }+ for attr_name in sorted(adjustment_names):+ if group.get(attr_name) != carrier.get(attr_name):+ errors.append(+ f"Authored preset group/carrier {attr_name} values differ"+ )++ unexpected_carrier_attrs = [+ name+ for name in carrier.attrib+ if _is_unexpected_carrier_attr(name)+ ]+ if unexpected_carrier_attrs:+ errors.append(+ "Authored preset carrier has unsupported presentation attributes: "+ + ", ".join(sorted(unexpected_carrier_attrs))+ )++ preset = carrier.get("data-pptx-prst") or ""+ object_kind = carrier.get("data-pptx-object") or ""+ if object_kind not in {"shape", "connector"}:+ errors.append(+ "Authored preset data-pptx-object must be 'shape' or 'connector'"+ )+ if preset in CONNECTOR_PRESET_TYPES and object_kind != "connector":+ errors.append(+ f"Connector preset {preset!r} requires data-pptx-object='connector'"+ )+ if object_kind == "connector" and preset not in CONNECTOR_PRESET_TYPES:+ errors.append(+ f"Authored connector requires a connector preset, got {preset!r}"+ )+ try:+ frame = _parse_frame(carrier.get("data-pptx-frame"), object_kind)+ adjustments = {+ name[len(_ADJUSTMENT_PREFIX):]: value+ for name, value in carrier.attrib.items()+ if name.startswith(_ADJUSTMENT_PREFIX)+ }+ _validate_adjustments(preset, adjustments)+ rendered = render_preset_geometry(+ preset,+ Xfrm(x=frame[0], y=frame[1], w=frame[2], h=frame[3]),+ adjustments,+ )+ style_attrs = _validate_style({+ name: carrier.attrib[name]+ for name in _STYLE_ATTRS+ if name in carrier.attrib+ })+ if object_kind == "connector":+ if style_attrs.get("fill", "none") != "none":+ raise ValueError("Authored connector fill must be none")+ if not _has_visible_stroke(style_attrs):+ raise ValueError("Authored connector requires a visible stroke")+ expected = serialize_preset_layers(+ rendered.paths,+ {+ name: value+ for name, value in carrier.attrib.items()+ if name in _SEMANTIC_ATTRS+ or name.startswith(_ADJUSTMENT_PREFIX)+ or name == "data-pptx-shape-name"+ },+ style_attrs,+ )+ except ValueError as exc:+ errors.append(f"Cannot regenerate authored preset preview: {exc}")+ return errors++ if (carrier.get("d") or "").strip() != _carrier_path(rendered.paths):+ errors.append("Authored preset carrier path differs from registry output")+ actual_preview_hash = svg_preset_preview_fingerprint(group)+ if actual_preview_hash != expected.preview_hash:+ errors.append("Authored preset visible preview differs from registry output")+ try:+ stored_hash = resolve_preset_preview_hash(group)+ except ValueError as exc:+ errors.append(f"Invalid authored preset preview fingerprint: {exc}")+ else:+ if stored_hash != expected.preview_hash:+ errors.append(+ "Authored preset fingerprint does not match regenerated metadata"+ )+ return errors+++def validate_authored_preset_tree(root: ET.Element) -> list[str]:+ """Return structural errors for every authored preset marker in one SVG."""+ errors: list[str] = []+ id_counts: dict[str, int] = {}+ for element in root.iter():+ element_id = element.get("id")+ if element_id:+ id_counts[element_id] = id_counts.get(element_id, 0) + 1+ parents = {+ child: parent+ for parent in root.iter()+ for child in parent+ }+ for element in root.iter():+ authoring = element.get(AUTHORING_ATTR)+ if authoring is None:+ continue+ tag = _local_name(element.tag)+ label = _element_label(element)+ if authoring != AUTHORING_VALUE:+ errors.append(+ f"{label}: unsupported {AUTHORING_ATTR} value {authoring!r}"+ )+ continue+ if tag == "g":+ errors.extend(+ f"{label}: {error}"+ for error in validate_authored_preset_group(element)+ )+ element_id = element.get("id")+ if element_id and id_counts.get(element_id, 0) > 1:+ errors.append(+ f"{label}: authored preset logical group id must be "+ "globally unique"+ )+ continue+ if element.get("data-pptx-part") != "geometry":+ errors.append(+ f"{label}: authored preset metadata is allowed only on the "+ "logical group and its direct geometry carrier"+ )+ continue+ parent = parents.get(element)+ if (+ parent is None+ or _local_name(parent.tag) != "g"+ or parent.get(AUTHORING_ATTR) != AUTHORING_VALUE+ ):+ errors.append(+ f"{label}: authored preset geometry carrier must be a direct "+ "child of its authored logical group"+ )+ return errors+++def _validate_frame(+ frame: tuple[float, float, float, float],+ object_kind: str,+) -> tuple[float, float, float, float]:+ if len(frame) != 4:+ raise ValueError("frame must contain x, y, width, and height")+ values = tuple(float(value) for value in frame)+ if not all(math.isfinite(value) for value in values):+ raise ValueError("frame values must be finite")+ width, height = values[2], values[3]+ if object_kind == "connector":+ if width < 0 or height < 0 or (width == 0 and height == 0):+ raise ValueError(+ "connector frame dimensions must be non-negative and not both zero"+ )+ elif width <= 0 or height <= 0:+ raise ValueError("shape frame width and height must be positive")+ validate_ooxml_xfrm(+ round(values[0] * EMU_PER_PX),+ round(values[1] * EMU_PER_PX),+ round(width * EMU_PER_PX),+ round(height * EMU_PER_PX),+ )+ return values+++def _parse_frame(+ raw: str | None,+ object_kind: str,+) -> tuple[float, float, float, float]:+ if raw is None:+ raise ValueError("authored preset requires data-pptx-frame")+ parts = re.split(r"[\s,]+", raw.strip())+ if len(parts) != 4:+ raise ValueError("data-pptx-frame must contain four numbers")+ return _validate_frame(tuple(float(part) for part in parts), object_kind)+++def _validate_style(style: Mapping[str, str]) -> dict[str, str]:+ unknown = sorted(set(style) - set(_STYLE_ATTRS))+ if unknown:+ raise ValueError(f"Unsupported authored preset style attributes: {unknown}")+ normalized = {name: str(value).strip() for name, value in style.items()}+ if not normalized:+ raise ValueError("Authored preset requires explicit fill and/or stroke")+ if normalized.get("fill", "none") == "none" and normalized.get(+ "stroke", "none"+ ) == "none":+ raise ValueError("Authored preset cannot have both fill and stroke set to none")+ for name in ("fill", "stroke"):+ value = normalized.get(name, "none")+ if _PAINT_RE.fullmatch(value) is None:+ raise ValueError(f"{name} must be none or a six-digit HEX color")+ normalized[name] = value.upper() if value != "none" else value+ if normalized.get("stroke", "none") == "none":+ unused_stroke_attrs = sorted(+ name for name in normalized+ if name.startswith("stroke-")+ )+ if unused_stroke_attrs:+ raise ValueError(+ "Stroke presentation attributes require a visible stroke: "+ + ", ".join(unused_stroke_attrs)+ )+ if normalized.get("stroke-linecap") not in {None, "butt", "round", "square"}:+ raise ValueError("stroke-linecap must be butt, round, or square")+ if normalized.get("stroke-linejoin") not in {None, "miter", "round", "bevel"}:+ raise ValueError("stroke-linejoin must be miter, round, or bevel")+ for name in ("fill-opacity", "stroke-opacity"):+ if name not in normalized:+ continue+ value = float(normalized[name])+ if not math.isfinite(value) or value < 0 or value > 1:+ raise ValueError(f"{name} must be between 0 and 1")+ normalized[name] = fmt_num(value, 6)+ if "stroke-width" in normalized:+ width = float(normalized["stroke-width"])+ if not math.isfinite(width) or width < 0:+ raise ValueError("stroke-width must be finite and non-negative")+ validate_ooxml_line_width(round(width * EMU_PER_PX))+ normalized["stroke-width"] = fmt_num(width, 6)+ if normalized.get("fill", "none") == "none" and "fill-opacity" in normalized:+ raise ValueError("fill-opacity requires a visible fill paint")+ if not _has_visible_fill(normalized) and not _has_visible_stroke(normalized):+ raise ValueError(+ "Authored preset requires at least one non-transparent visible paint"+ )+ return normalized+++def _normalize_adjustments(+ adjustments: Mapping[str, str | int | float],+) -> dict[str, str]:+ normalized: dict[str, str] = {}+ for name, value in adjustments.items():+ if isinstance(value, bool):+ raise ValueError(f"Adjustment {name!r} must not be boolean")+ if isinstance(value, int):+ formula = f"val {value}"+ elif isinstance(value, float):+ if not math.isfinite(value) or not value.is_integer():+ raise ValueError(+ f"Numeric adjustment {name!r} must be a finite integer"+ )+ formula = f"val {int(value)}"+ else:+ formula = str(value).strip()+ if len(formula.split()) == 1:+ formula = f"val {formula}"+ normalized[str(name)] = formula+ return normalized+++def _validate_adjustments(+ preset: str,+ adjustments: Mapping[str, str | int | float],+) -> None:+ registry = get_preset_registry()+ if preset not in registry:+ raise ValueError(f"Unknown DrawingML preset shape: {preset!r}")+ for name, formula in adjustments.items():+ if not isinstance(formula, str) or not formula.strip():+ raise ValueError(f"Adjustment {name!r} requires a formula")+ parts = formula.split()+ if parts[0] not in SUPPORTED_OPERATORS:+ raise ValueError(+ f"Adjustment {name!r} must use a DrawingML formula operator"+ )+ if parts[0] == "val" and len(parts) == 2:+ try:+ float(parts[1])+ except ValueError:+ pass+ else:+ if _INTEGER_RE.fullmatch(parts[1]) is None:+ raise ValueError(+ f"Adjustment {name!r} val operand must be an integer "+ "coordinate"+ )+ if not adjustments:+ return+ evaluated = registry.evaluate(+ preset,+ 100000,+ 100000,+ adjustments=adjustments,+ )+ for name, value in evaluated.adjustments.items():+ if name not in adjustments:+ continue+ if not OOXML_COORDINATE_MIN <= value <= OOXML_COORDINATE_MAX:+ raise ValueError(+ f"Adjustment {name!r} evaluates outside OOXML coordinate range"+ )+++def _has_visible_fill(style: Mapping[str, str]) -> bool:+ return (+ style.get("fill", "none") != "none"+ and float(style.get("fill-opacity", "1")) > 0+ )+++def _has_visible_stroke(style: Mapping[str, str]) -> bool:+ return (+ style.get("stroke", "none") != "none"+ and float(style.get("stroke-opacity", "1")) > 0+ and float(style.get("stroke-width", "1")) > 0+ )+++def _is_unexpected_carrier_attr(name: str) -> bool:+ if name in {+ "d",+ "data-pptx-preview-sha256",+ "data-pptx-part",+ "data-pptx-shape-name",+ "visibility",+ "pointer-events",+ *_SEMANTIC_ATTRS,+ *_STYLE_ATTRS,+ }:+ return False+ return not name.startswith(_ADJUSTMENT_PREFIX)+++def _is_unexpected_group_attr(name: str) -> bool:+ if name in {+ "id",+ "transform",+ "data-pptx-preview-sha256",+ "data-pptx-shape-name",+ *_SEMANTIC_ATTRS,+ }:+ return False+ if name.startswith(_ADJUSTMENT_PREFIX):+ return False+ if name.startswith("data-pptx-runtime-") or name.startswith("aria-"):+ return False+ return name not in {"role", "tabindex"}+++def _carrier_path(paths) -> str:+ return " ".join(path.d for path in paths).strip()+++def _local_name(tag: str) -> str:+ return tag.rsplit("}", 1)[-1]+++def _element_label(element: ET.Element) -> str:+ tag = _local_name(element.tag)+ element_id = element.get("id")+ if element_id:+ return f'<{tag} id="{element_id}">'+ return f"<{tag}>"diff --git a/skills/ppt-master/scripts/pptx_to_svg/preset_svg_markup.py b/skills/ppt-master/scripts/pptx_to_svg/preset_svg_markup.pynew file mode 100644index 00000000..25658376--- /dev/null+++ b/skills/ppt-master/scripts/pptx_to_svg/preset_svg_markup.py@@ -0,0 +1,166 @@+#!/usr/bin/env python3+"""+PPT Master - Preset Shape SVG Markup++Serialize evaluated DrawingML preset layers into one native carrier and one+browser-visible SVG preview.++Usage:+ Import serialize_preset_layers from pptx_to_svg.preset_svg_markup.++Examples:+ markup = serialize_preset_layers(layers, semantic_attrs, style_attrs)++Dependencies:+ None (only uses standard library and local PPT Master modules)+"""++from __future__ import annotations++from dataclasses import dataclass+from typing import Mapping, Sequence+from xml.etree import ElementTree as ET++from pptx_shapes import svg_preset_preview_fingerprint++from .preset_registry_to_svg import SvgPresetPath+++@dataclass(frozen=True)+class PresetSvgMarkup:+ """Canonical hidden-carrier and visible-preview markup for one preset."""++ carrier: str+ preview: str+ preview_hash: str++ @property+ def markup(self) -> str:+ """Return the carrier and preview in canonical document order."""+ return f"{self.carrier}\n{self.preview}"+++def serialize_preset_layers(+ layers: Sequence[SvgPresetPath],+ semantic_attrs: Mapping[str, str],+ style_attrs: Mapping[str, str],+) -> PresetSvgMarkup:+ """Serialize one preset without duplicating its native PowerPoint object."""+ detail_style_attrs = dict(style_attrs)+ preview_group_attrs = {"data-pptx-part": "geometry-preview"}+ for name in ("filter", "opacity"):+ value = detail_style_attrs.pop(name, None)+ if value is not None:+ preview_group_attrs[name] = value++ detail_layers: list[str] = []+ for layer in layers:+ attrs = dict(detail_style_attrs)+ apply_preset_path_fill(attrs, layer.fill)+ if not layer.stroke:+ remove_stroke_attrs(attrs)+ attrs["stroke"] = "none"+ attrs["data-pptx-part"] = "geometry-detail"+ detail_layers.append(+ f'<path d="{_xml_escape(layer.d)}"{attrs_to_xml(attrs)}/>'+ )++ preview = (+ f'<g{attrs_to_xml(preview_group_attrs)}>\n'+ + "\n".join(detail_layers)+ + "\n</g>"+ )+ preview_root = ET.fromstring(+ f'<svg xmlns="http://www.w3.org/2000/svg">{preview}</svg>'+ )+ preview_hash = svg_preset_preview_fingerprint(preview_root)+ carrier_attrs = {+ **style_attrs,+ **semantic_attrs,+ "data-pptx-preview-sha256": preview_hash,+ "data-pptx-part": "geometry",+ "visibility": "hidden",+ "pointer-events": "none",+ }+ combined_path = " ".join(layer.d for layer in layers)+ carrier = (+ f'<path d="{_xml_escape(combined_path)}"'+ f'{attrs_to_xml(carrier_attrs)}/>'+ )+ return PresetSvgMarkup(+ carrier=carrier,+ preview=preview,+ preview_hash=preview_hash,+ )+++def apply_preset_path_fill(attrs: dict[str, str], mode: str) -> None:+ """Apply one DrawingML path fill mode to SVG presentation attributes."""+ if mode == "none":+ attrs["fill"] = "none"+ attrs.pop("fill-opacity", None)+ return+ if mode == "norm":+ return+ color = attrs.get("fill", "")+ if not color.startswith("#") or len(color) != 7:+ return+ try:+ channels = tuple(+ int(color[offset:offset + 2], 16)+ for offset in (1, 3, 5)+ )+ except ValueError:+ return+ if mode in {"darken", "darkenLess"}:+ factor = 0.65 if mode == "darken" else 0.82+ adjusted = tuple(round(channel * factor) for channel in channels)+ elif mode in {"lighten", "lightenLess"}:+ amount = 0.4 if mode == "lighten" else 0.2+ adjusted = tuple(+ round(channel + (255 - channel) * amount)+ for channel in channels+ )+ else:+ return+ attrs["fill"] = "#" + "".join(+ f"{channel:02X}" for channel in adjusted+ )+++def remove_stroke_attrs(attrs: dict[str, str]) -> None:+ """Remove inherited stroke and marker attributes from one path layer."""+ for name in tuple(attrs):+ if name.startswith("stroke") or name in {"marker-start", "marker-end"}:+ attrs.pop(name, None)+++def attrs_to_xml(attrs: Mapping[str, str]) -> str:+ """Serialize SVG attributes in deterministic insertion order."""+ return "".join(+ f' {name}="{_xml_escape(value)}"'+ for name, value in attrs.items()+ )+++def _xml_escape(value: str) -> str:+ text = str(value)+ if any(not _is_xml_10_character(character) for character in text):+ raise ValueError("SVG markup contains an XML 1.0-incompatible character")+ return (+ text+ .replace("&", "&")+ .replace("<", "<")+ .replace(">", ">")+ .replace('"', """)+ )+++def _is_xml_10_character(character: str) -> bool:+ codepoint = ord(character)+ return (+ codepoint in {0x09, 0x0A, 0x0D}+ or 0x20 <= codepoint <= 0xD7FF+ or 0xE000 <= codepoint <= 0xFFFD+ or 0x10000 <= codepoint <= 0x10FFFF+ )diff --git a/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.py b/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.pyindex 3eaffd3a..0d6b9b49 100644--- a/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.py+++ b/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.py@@ -31,7 +31,6 @@ from xml.etree import ElementTree as ETfrom pptx_shapes import (CONNECTOR_PRESET_TYPES,has_relationship_attributes,- svg_preset_preview_fingerprint,svg_text_fingerprint,)@@ -45,6 +44,7 @@ from .ln_to_svg import resolve_strokefrom .ooxml_loader import OoxmlPackage, PartRef, SlideReffrom .pic_to_svg import convert_blip_fill, convert_picturefrom .prstgeom_to_svg import GeomResult, convert_prst_geom+from .preset_svg_markup import serialize_preset_layersfrom .shape_walker import (CONNECTOR, GRAPHIC, GROUP, PICTURE, SHAPE,ShapeNode, get_background, walk_sp_tree,@@ -592,77 +592,14 @@ def _preset_layers_to_svg(reproduce the preset's independent paint behavior without being exportedas duplicate PowerPoint shapes."""- detail_style_attrs = dict(style_attrs)- preview_group_attrs = {"data-pptx-part": "geometry-preview"}- for name in ("filter", "opacity"):- value = detail_style_attrs.pop(name, None)- if value is not None:- preview_group_attrs[name] = value- detail_layers: list[str] = []- for layer in geom.layers:- attrs = dict(detail_style_attrs)- _apply_preset_path_fill(attrs, layer.fill)- if not layer.stroke:- _remove_stroke_attrs(attrs)- attrs["stroke"] = "none"- attrs["data-pptx-part"] = "geometry-detail"- detail_layers.append(- f'<path d="{layer.d}"{_attrs_to_xml(attrs)}/>'- )- preview_markup = (- f'<g{_attrs_to_xml(preview_group_attrs)}>\n'- + "\n".join(detail_layers)- + "\n</g>"- )- preview_root = ET.fromstring(- f'<svg xmlns="http://www.w3.org/2000/svg">{preview_markup}</svg>'+ markup = serialize_preset_layers(+ geom.layers,+ semantic_attrs,+ style_attrs,)- preview_hash = svg_preset_preview_fingerprint(preview_root)- geom.attrs["data-pptx-preview-sha256"] = preview_hash- semantic_attrs["data-pptx-preview-sha256"] = preview_hash- carrier_attrs = {- **style_attrs,- **semantic_attrs,- "data-pptx-part": "geometry",- "visibility": "hidden",- "pointer-events": "none",- }- carrier = f'<path d="{geom.path_d}"{_attrs_to_xml(carrier_attrs)}/>'- return f"{carrier}\n{preview_markup}"---def _apply_preset_path_fill(attrs: dict[str, str], mode: str) -> None:- if mode == "none":- attrs["fill"] = "none"- attrs.pop("fill-opacity", None)- return- if mode == "norm":- return- color = attrs.get("fill", "")- if not color.startswith("#") or len(color) != 7:- return- try:- channels = tuple(int(color[offset:offset + 2], 16) for offset in (1, 3, 5))- except ValueError:- return- if mode in {"darken", "darkenLess"}:- factor = 0.65 if mode == "darken" else 0.82- adjusted = tuple(round(channel * factor) for channel in channels)- elif mode in {"lighten", "lightenLess"}:- amount = 0.4 if mode == "lighten" else 0.2- adjusted = tuple(- round(channel + (255 - channel) * amount)- for channel in channels- )- else:- return- attrs["fill"] = "#" + "".join(f"{channel:02X}" for channel in adjusted)---def _remove_stroke_attrs(attrs: dict[str, str]) -> None:- for name in tuple(attrs):- if name.startswith("stroke") or name in {"marker-start", "marker-end"}:- attrs.pop(name, None)+ geom.attrs["data-pptx-preview-sha256"] = markup.preview_hash+ semantic_attrs["data-pptx-preview-sha256"] = markup.preview_hash+ return markup.markupdef _clip_blip_image(image_xml: str, geom: GeomResult | None,diff --git a/skills/ppt-master/scripts/preset_shape_svg.py b/skills/ppt-master/scripts/preset_shape_svg.pynew file mode 100644index 00000000..9969d154--- /dev/null+++ b/skills/ppt-master/scripts/preset_shape_svg.py@@ -0,0 +1,233 @@+#!/usr/bin/env python3+"""+PPT Master - Preset Shape SVG Fragment Tool++List DrawingML presets or print one canonical native-preset SVG fragment to+stdout for manual insertion into a hand-authored slide.++Usage:+ python3 scripts/preset_shape_svg.py list [--search QUERY]+ python3 scripts/preset_shape_svg.py describe PRESET+ python3 scripts/preset_shape_svg.py render PRESET --id ID --frame X Y W H++Examples:+ python3 scripts/preset_shape_svg.py list --search arrow+ python3 scripts/preset_shape_svg.py describe rightArrow+ python3 scripts/preset_shape_svg.py render rightArrow --id next-step \+ --frame 160 210 320 112 --fill "#2563EB" --stroke none++Dependencies:+ None (only uses standard library and local PPT Master modules)+"""++from __future__ import annotations++import argparse+import json+import sys+from typing import Sequence++from console_encoding import configure_utf8_stdio+from pptx_shapes import CONNECTOR_PRESET_TYPES, get_preset_registry+from pptx_to_svg.preset_authoring import render_preset_shape_fragment+++configure_utf8_stdio()+++def build_parser() -> argparse.ArgumentParser:+ parser = argparse.ArgumentParser(+ description=(+ "Print one canonical DrawingML preset SVG fragment. "+ "This tool never writes SVG files or page layouts."+ ),+ formatter_class=argparse.RawDescriptionHelpFormatter,+ )+ subparsers = parser.add_subparsers(dest="command", required=True)++ list_parser = subparsers.add_parser(+ "list",+ help="List preset names, optionally filtered by substring.",+ )+ list_parser.add_argument(+ "--search",+ default="",+ help="Case-insensitive preset-name substring.",+ )++ describe_parser = subparsers.add_parser(+ "describe",+ help="Print preset adjustment and path metadata as JSON.",+ )+ describe_parser.add_argument("preset", help="DrawingML preset name.")++ render_parser = subparsers.add_parser(+ "render",+ help="Print one canonical authored-preset <g> fragment to stdout.",+ )+ render_parser.add_argument("preset", help="DrawingML preset name.")+ render_parser.add_argument(+ "--id",+ required=True,+ dest="element_id",+ help="Stable unique SVG group id.",+ )+ render_parser.add_argument(+ "--frame",+ required=True,+ nargs=4,+ type=float,+ metavar=("X", "Y", "WIDTH", "HEIGHT"),+ help="Absolute SVG frame in page coordinates.",+ )+ render_parser.add_argument(+ "--object-kind",+ choices=("shape", "connector"),+ default="shape",+ help="Emit a normal shape or a native PowerPoint connector.",+ )+ render_parser.add_argument(+ "--name",+ help="Optional PowerPoint object name.",+ )+ render_parser.add_argument(+ "--fill",+ default="none",+ help="Solid SVG fill from spec_lock, or none.",+ )+ render_parser.add_argument(+ "--fill-opacity",+ type=float,+ help="Fill opacity from 0 to 1.",+ )+ render_parser.add_argument(+ "--stroke",+ default="none",+ help="Solid SVG stroke from spec_lock, or none.",+ )+ render_parser.add_argument(+ "--stroke-width",+ type=float,+ help="Stroke width in SVG page units; defaults to 1 when stroked.",+ )+ render_parser.add_argument(+ "--stroke-opacity",+ type=float,+ help="Stroke opacity from 0 to 1.",+ )+ render_parser.add_argument(+ "--stroke-linecap",+ choices=("butt", "round", "square"),+ )+ render_parser.add_argument(+ "--stroke-linejoin",+ choices=("miter", "round", "bevel"),+ )+ render_parser.add_argument(+ "--adjust",+ action="append",+ default=[],+ metavar="NAME=FORMULA",+ help=(+ "DrawingML adjustment formula; repeat for multiple guides, "+ "for example --adjust 'adj1=val 50000'."+ ),+ )+ return parser+++def main(argv: Sequence[str] | None = None) -> int:+ parser = build_parser()+ args = parser.parse_args(argv)+ registry = get_preset_registry()++ if args.command == "list":+ query = args.search.casefold().strip()+ names = [+ name for name in registry.names+ if not query or query in name.casefold()+ ]+ if not names:+ print(f"No preset names match {args.search!r}", file=sys.stderr)+ return 1+ print("\n".join(names))+ return 0++ if args.command == "describe":+ if args.preset not in registry:+ print(f"Unknown DrawingML preset: {args.preset!r}", file=sys.stderr)+ return 1+ definition = registry.get(args.preset)+ payload = {+ "preset": definition.name,+ "connector_preset": definition.name in CONNECTOR_PRESET_TYPES,+ "adjustments": [+ {"name": guide.name, "formula": guide.formula}+ for guide in definition.adjustments+ ],+ "path_count": len(definition.paths),+ "connection_site_count": len(definition.connections),+ "has_text_rectangle": definition.text_rectangle is not None,+ }+ print(json.dumps(payload, ensure_ascii=False, indent=2))+ return 0++ try:+ adjustments = _parse_adjustments(args.adjust)+ style = _style_from_args(args)+ fragment = render_preset_shape_fragment(+ args.preset,+ tuple(args.frame),+ adjustments=adjustments,+ object_kind=args.object_kind,+ element_id=args.element_id,+ name=args.name,+ style=style,+ )+ except ValueError as exc:+ print(f"Error: {exc}", file=sys.stderr)+ return 1+ print(fragment)+ return 0+++def _parse_adjustments(values: Sequence[str]) -> dict[str, str]:+ adjustments: dict[str, str] = {}+ for value in values:+ name, separator, formula = value.partition("=")+ name = name.strip()+ formula = formula.strip()+ if not separator or not name or not formula:+ raise ValueError(+ f"Invalid adjustment {value!r}; expected NAME=FORMULA"+ )+ if name in adjustments:+ raise ValueError(f"Duplicate adjustment guide: {name!r}")+ adjustments[name] = formula+ return adjustments+++def _style_from_args(args: argparse.Namespace) -> dict[str, str]:+ style = {+ "fill": args.fill,+ "stroke": args.stroke,+ }+ if args.fill_opacity is not None:+ style["fill-opacity"] = str(args.fill_opacity)+ if args.stroke != "none":+ style["stroke-width"] = str(+ 1.0 if args.stroke_width is None else args.stroke_width+ )+ elif args.stroke_width is not None:+ raise ValueError("--stroke-width requires a non-none --stroke")+ if args.stroke_opacity is not None:+ style["stroke-opacity"] = str(args.stroke_opacity)+ if args.stroke_linecap is not None:+ style["stroke-linecap"] = args.stroke_linecap+ if args.stroke_linejoin is not None:+ style["stroke-linejoin"] = args.stroke_linejoin+ return style+++if __name__ == "__main__":+ raise SystemExit(main())diff --git a/skills/ppt-master/scripts/svg_quality_checker.py b/skills/ppt-master/scripts/svg_quality_checker.pyindex 63e25cc3..fbf2163c 100644--- a/skills/ppt-master/scripts/svg_quality_checker.py+++ b/skills/ppt-master/scripts/svg_quality_checker.py@@ -53,14 +53,24 @@ else:try:from svg_to_pptx.drawingml.utils import (+ IDENTITY_MATRIX as _IDENTITY_MATRIX,+ matrix_multiply as _matrix_multiply,+ parse_transform_matrix as _parse_transform_matrix,parse_font_family as _parse_export_font_family,parse_inline_style as _parse_inline_style,parse_svg_color as _parse_export_color,+ rect_to_dml_xfrm as _rect_to_dml_xfrm,+ validate_dml_shape_matrix as _validate_dml_shape_matrix,)except ImportError:+ _IDENTITY_MATRIX = None+ _matrix_multiply = None+ _parse_transform_matrix = None_parse_export_font_family = None_parse_inline_style = None_parse_export_color = None+ _rect_to_dml_xfrm = None+ _validate_dml_shape_matrix = Nonetry:from svg_to_pptx.drawingml.converter import (@@ -76,12 +86,23 @@ try:except ImportError:_validate_preset_geometry_metadata = None+try:+ from pptx_to_svg.preset_authoring import (+ AUTHORING_ATTR as _AUTHORING_ATTR,+ validate_authored_preset_tree as _validate_authored_preset_tree,+ )+except ImportError:+ _AUTHORING_ATTR = 'data-pptx-authoring'+ _validate_authored_preset_tree = None+try:from pptx_shapes import (+ CONNECTOR_PRESET_TYPES as _CONNECTOR_PRESET_TYPES,resolve_preset_preview_hash as _resolve_preset_preview_hash,svg_preset_preview_fingerprint as _svg_preset_preview_fingerprint,)except ImportError:+ _CONNECTOR_PRESET_TYPES = frozenset()_resolve_preset_preview_hash = None_svg_preset_preview_fingerprint = None@@ -472,6 +493,12 @@ class SVGQualityChecker:# produce misleading errors on a broken document.root = self._parse_xml_root(content, result)if root is not None:+ if root.get('transform'):+ result['errors'].append(+ 'Root <svg> transform is unsupported; apply transforms '+ 'to child elements or groups'+ )+# 1. Check viewBoxself._check_viewbox(root, result, expected_format)@@ -504,6 +531,7 @@ class SVGQualityChecker:# 7c. Fail closed on invalid PPTX preset/adjustment metadata.self._check_preset_geometry_metadata(root, result)+ self._check_preset_geometry_transforms(root, result)# 8. Check object-level animation anchor quality.self._check_animation_group_ids(root, result)@@ -1303,6 +1331,7 @@ class SVGQualityChecker:or elem.get('data-pptx-shape-id') is not Noneor elem.get('data-pptx-shape-scope') is not Noneor elem.get('data-pptx-shape-style') is not None+ or elem.get(_AUTHORING_ATTR) is not Noneor any(attr.startswith('data-pptx-av-') for attr in elem.attrib))]@@ -1322,6 +1351,17 @@ class SVGQualityChecker:label = f'<{tag} id="{elem_id}">' if elem_id else f'<{tag}>'for error in _validate_preset_geometry_metadata(elem):issues.add(f'{label} has invalid PPTX shape metadata: {error}')+ if _validate_authored_preset_tree is None:+ if any(+ elem.get(_AUTHORING_ATTR) is not None+ for elem in root.iter()+ ):+ issues.add(+ 'Unable to import authored PPTX preset validator'+ )+ else:+ for error in _validate_authored_preset_tree(root):+ issues.add(f'Invalid authored PPTX preset: {error}')if (_svg_preset_preview_fingerprint is Noneor _resolve_preset_preview_hash is None@@ -1355,6 +1395,88 @@ class SVGQualityChecker:)result['errors'].extend(sorted(issues))+ def _check_preset_geometry_transforms(+ self,+ root: ET.Element,+ result: Dict,+ ) -> None:+ """Reject preset transforms that DrawingML cannot represent exactly."""+ helpers = (+ _IDENTITY_MATRIX,+ _matrix_multiply,+ _parse_transform_matrix,+ _rect_to_dml_xfrm,+ _validate_dml_shape_matrix,+ )+ if any(helper is None for helper in helpers):+ return++ relevant: set[ET.Element] = set()++ def mark_relevant(element: ET.Element) -> bool:+ found = element.get('data-pptx-prst') is not None+ for child in element:+ found = mark_relevant(child) or found+ if found:+ relevant.add(element)+ return found++ mark_relevant(root)+ issues = set()++ def visit(element: ET.Element, parent_matrix) -> None:+ if element not in relevant:+ return+ matrix = parent_matrix+ transform = element.get('transform')+ if transform:+ try:+ local_matrix = _parse_transform_matrix(transform)+ matrix = _matrix_multiply(parent_matrix, local_matrix)+ except ValueError as exc:+ issues.add(+ f'<{_local_name(element)}> has invalid preset '+ f'transform: {exc}'+ )+ return+ if element.get('data-pptx-prst') is not None:+ try:+ raw_frame = element.get('data-pptx-frame')+ if raw_frame:+ frame = tuple(+ float(part)+ for part in re.split(r'[\s,]+', raw_frame.strip())+ )+ if len(frame) != 4:+ raise ValueError(+ 'data-pptx-frame must contain four numbers'+ )+ preset = element.get('data-pptx-prst') or ''+ _rect_to_dml_xfrm(+ frame[0],+ frame[1],+ frame[2],+ frame[3],+ matrix,+ preserve_degenerate_axes=(+ element.get('data-pptx-object') == 'connector'+ or preset in _CONNECTOR_PRESET_TYPES+ ),+ )+ else:+ _validate_dml_shape_matrix(matrix)+ except ValueError as exc:+ elem_id = element.get('id') or '(no id)'+ issues.add(+ f'<{_local_name(element)} id="{elem_id}"> has '+ f'unsupported preset transform: {exc}'+ )+ for child in element:+ visit(child, matrix)++ visit(root, _IDENTITY_MATRIX)+ result['errors'].extend(sorted(issues))+def _check_animation_group_ids(self, root: ET.Element, result: Dict):"""Warn when visible top-level groups cannot be customized."""non_visual = {'defs', 'title', 'desc', 'metadata', 'style'}diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.pyindex 885d959b..0be8588f 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py@@ -16,6 +16,13 @@ from pptx_shapes import (resolve_preset_preview_hash,svg_preset_preview_fingerprint,svg_text_fingerprint,+ validate_ooxml_xfrm,+)+from pptx_to_svg.preset_authoring import (+ AUTHORING_ATTR,+ AUTHORING_VALUE,+ validate_authored_preset_group,+ validate_authored_preset_tree,)from resource_paths import icon_search_dirs_for_svg@@ -372,6 +379,13 @@ def convert_g(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:elem.get('data-pptx-object') in {'shape', 'connector'}and elem.get('data-pptx-prst') is not None):+ if elem.get(AUTHORING_ATTR) == AUTHORING_VALUE:+ authoring_errors = validate_authored_preset_group(elem)+ if authoring_errors:+ raise SvgNativeConversionError(+ 'Invalid authored preset shape: '+ + '; '.join(authoring_errors)+ )_require_unchanged_preset_preview(elem)txbody_meta = _txbody_metadata(elem)@@ -535,6 +549,8 @@ def convert_g(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:rot_emu = 0 if matrix_supported else int(angle_deg * 60000)rot_attr = f' rot="{rot_emu}"' if rot_emu else ''+ validate_ooxml_xfrm(off_x, off_y, group_w, group_h)+ validate_ooxml_xfrm(group_x, group_y, group_w, group_h)return ShapeResult(xml=f'''<p:grpSp><p:nvGrpSpPr>@@ -1050,6 +1066,16 @@ def convert_svg_to_slide_shapes("""tree = ET.parse(str(svg_path))root = tree.getroot()+ if root.get('transform'):+ raise SvgNativeConversionError(+ 'Root <svg> transform is unsupported; apply transforms to child '+ 'elements or groups'+ )+ authored_errors = validate_authored_preset_tree(root)+ if authored_errors:+ raise SvgNativeConversionError(+ 'Invalid authored preset structure: ' + '; '.join(authored_errors)+ )_mark_unchanged_txbody_groups(root)_mark_unchanged_preset_previews(root)trace_events: list[dict[str, Any]] | None = [] if trace_out is not None else Nonediff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/elements.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/elements.pyindex edd05de1..a6a94801 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/elements.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/elements.py@@ -15,10 +15,14 @@ from xml.etree import ElementTree as ETfrom pptx_shapes import (CONNECTOR_PRESET_TYPES,+ OOXML_COORDINATE_MAX,+ OOXML_COORDINATE_MIN,get_preset_registry,has_relationship_attributes,load_shape_type_values,+ validate_ooxml_xfrm,)+from pptx_to_svg.preset_authoring import AUTHORING_ATTR, AUTHORING_VALUEfrom resource_paths import resolve_external_image_referencefrom .context import ConvertContext, ShapeResult@@ -377,15 +381,35 @@ PPTX_PRESET_SHAPE_TYPES = frozenset(load_shape_type_values())_PPTX_AV_PREFIX = 'data-pptx-av-'_PPTX_GUIDE_NAME_RE = re.compile(r'[A-Za-z_][A-Za-z0-9_.-]{0,63}')_PPTX_VAL_FORMULA_RE = re.compile(r'val[\t ]+([+-]?\d+)')-_PPTX_COORD_MIN = -27273042329600-_PPTX_COORD_MAX = 27273042316900--def _parse_preset_geometry_metadata(elem: ET.Element,) -> tuple[str | None, list[tuple[str, str]], tuple[float, float, float, float] | None]:"""Parse and validate rendering-neutral preset geometry metadata."""status = (elem.get('data-pptx-geometry-status') or '').strip()+ authoring = elem.get(AUTHORING_ATTR)+ if authoring not in {None, AUTHORING_VALUE}:+ raise ValueError(f'Unsupported {AUTHORING_ATTR} value {authoring!r}')+ if authoring == AUTHORING_VALUE:+ object_kind = elem.get('data-pptx-object')+ if object_kind not in {'shape', 'connector'}:+ raise ValueError(+ 'Authored preset metadata requires data-pptx-object='+ '"shape" or "connector"'+ )+ preset = elem.get('data-pptx-prst')+ if preset is None:+ raise ValueError('Authored preset metadata requires data-pptx-prst')+ if preset in CONNECTOR_PRESET_TYPES and object_kind != 'connector':+ raise ValueError(+ f'Connector preset {preset!r} requires '+ 'data-pptx-object="connector"'+ )+ if object_kind == 'connector' and preset not in CONNECTOR_PRESET_TYPES:+ raise ValueError(+ f'Authored connector requires a connector preset, got {preset!r}'+ )+ if elem.get('data-pptx-frame') is None:+ raise ValueError('Authored preset metadata requires data-pptx-frame')if status not in {'', 'exact', 'unsupported'}:raise ValueError(f'Unsupported data-pptx-geometry-status {status!r}; '@@ -430,7 +454,7 @@ def _parse_preset_geometry_metadata(match = _PPTX_VAL_FORMULA_RE.fullmatch(formula)if match is not None:value = int(match.group(1))- if not _PPTX_COORD_MIN <= value <= _PPTX_COORD_MAX:+ if not OOXML_COORDINATE_MIN <= value <= OOXML_COORDINATE_MAX:raise ValueError(f'{attr_name} value {value} is outside OOXML coordinate range')@@ -467,7 +491,12 @@ def _parse_preset_geometry_metadata(f'Invalid adjustment formula for preset {prst!r}: {exc}') from excfor name, value in evaluated.adjustments.items():- if name in guide_formulas and not _PPTX_COORD_MIN <= value <= _PPTX_COORD_MAX:+ if (+ name in guide_formulas+ and not OOXML_COORDINATE_MIN+ <= value+ <= OOXML_COORDINATE_MAX+ ):raise ValueError(f'data-pptx-av-{name} evaluates outside OOXML coordinate range')@@ -505,6 +534,12 @@ def _parse_preset_geometry_metadata(raise ValueError(f'data-pptx-frame width and height must be positive, got {raw_frame!r}')+ validate_ooxml_xfrm(+ px_to_emu(frame[0]),+ px_to_emu(frame[1]),+ px_to_emu(frame[2]),+ px_to_emu(frame[3]),+ )return prst, guides, framediff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/styles.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/styles.pyindex 218c1842..87eb53ae 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/styles.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/styles.py@@ -6,6 +6,8 @@ import mathimport refrom xml.etree import ElementTree as ET+from pptx_shapes import validate_ooxml_line_width+from .context import ConvertContextfrom .theme_colors import ThemeColorSpec, color_node_xmlfrom .utils import (@@ -454,6 +456,7 @@ def build_stroke_xml(width = parse_svg_length(_get_attr(elem, 'stroke-width', ctx), 1.0)width_emu = px_to_emu(width)+ validate_ooxml_line_width(width_emu)# Dash patterndash_xml = ''diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.pyindex 386f415b..340287be 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py@@ -7,6 +7,8 @@ import mathimport refrom xml.etree import ElementTree as ET+from pptx_shapes import validate_ooxml_xfrm+from .context import AffineMatrix, ConvertContext, IDENTITY_MATRIX# ---------------------------------------------------------------------------@@ -336,6 +338,24 @@ def transform_point(matrix: AffineMatrix, x: float, y: float) -> tuple[float, flreturn a * x + c * y + e, b * x + d * y + f+def validate_dml_shape_matrix(matrix: AffineMatrix) -> None:+ """Reject affine shear that a DrawingML shape transform cannot express."""+ a, b, c, d, _e, _f = matrix+ x_length = math.hypot(a, b)+ y_length = math.hypot(c, d)+ if x_length <= 1e-12 or y_length <= 1e-12:+ raise ValueError(+ 'SVG zero-scale transform cannot be represented by a visible '+ 'DrawingML shape'+ )+ dot = a * c + b * d+ if abs(dot) > x_length * y_length * 1e-9:+ raise ValueError(+ 'SVG shear/skew cannot be represented by a DrawingML '+ 'shape transform'+ )++def rect_to_dml_xfrm(x: float,y: float,@@ -363,13 +383,7 @@ def rect_to_dml_xfrm(rect_w = math.hypot(ux, uy)rect_h = math.hypot(vx, vy)- if rect_w > 1e-12 and rect_h > 1e-12:- dot = ux * vx + uy * vy- if abs(dot) > rect_w * rect_h * 1e-9:- raise ValueError(- 'SVG shear/skew cannot be represented by a DrawingML '- 'shape transform'- )+ validate_dml_shape_matrix(matrix)if not preserve_degenerate_axes:rect_w = max(rect_w, 0.001)rect_h = max(rect_h, 0.001)@@ -394,6 +408,7 @@ def rect_to_dml_xfrm(off_y = px_to_emu(center_y - rect_h / 2)ext_cx = px_to_emu(rect_w)ext_cy = px_to_emu(rect_h)+ validate_ooxml_xfrm(off_x, off_y, ext_cx, ext_cy)xs = [p0[0], p1[0], p2[0], p3[0]]ys = [p0[1], p1[1], p2[1], p3[1]]