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(roundtrip): extract complex vector decorations on demand
hugohe34ac7e15087e2
diff --git a/skills/ppt-master/references/shared-standards-core.md b/skills/ppt-master/references/shared-standards-core.mdindex cf7df553..58932b18 100644--- a/skills/ppt-master/references/shared-standards-core.md+++ b/skills/ppt-master/references/shared-standards-core.md@@ -335,15 +335,23 @@ machine manifest. Moving a referenced subtree intothe vector inventory; re-inlining re-establishes the same mapping. Final materializedtemplate SVGs and normal project `svg_output/` must not contain this attribute.-A round-trip flat bundle may represent one large imported logical object as an-atomic `<image data-pptx-source-proxy="native-restore">` whose hashed SVG preview-lives under `images/source-object-previews/`. The page keeps only the outer-source ref; descendant source identity remains in immutable backing. An-unchanged proxy restores the complete native object. Complete removal deletes a-Slide-local object; an inherited Master/Layout proxy must remain because one-flat page cannot delete shared structure. Any proxy or preview edit must fail-export rather than downgrade the object. This compaction is round-trip-only and-does not apply to layered create-template authoring IR.+**Hard rule — round-trip decoration extraction**: move text-free+vector decorations from `authoring-svg-flat/` into `icons/imported/` and leave+a `<use data-icon="imported/...">` reference in the page. Retain refs+in the inventory. The live editor expands the reference; an unchanged asset+restores native source objects, while an edited asset is one page-local vector+edit unit.++**Hard rule — round-trip source proxy fallback**: represent a+semantic/native-payload object that cannot safely become an editable vector+asset as an atomic `<image data-pptx-source-proxy="native-restore">` whose+SVG preview lives under `images/source-object-previews/`. The page keeps only+the outer source ref; descendant identity remains in immutable backing. An+unchanged proxy restores the native object. Complete removal deletes a+Slide-local object; an inherited Master/Layout proxy must remain+because a flat page cannot delete shared structure. Proxy or preview edits must+fail export rather than downgrade the object. Both compactions are+round-trip-only and do not apply to layered create-template authoring IR.**Hard rule — structural-layer boundary**: An unchanged imported logical objectmay keep currently supported metadata while it remains Slide-local or inside adiff --git a/skills/ppt-master/scripts/README.md b/skills/ppt-master/scripts/README.mdindex fdbb7c0e..6952752d 100644--- a/skills/ppt-master/scripts/README.md+++ b/skills/ppt-master/scripts/README.md@@ -295,6 +295,10 @@ python3 scripts/compact_svg_coordinates.py <template_workspace>/templates --inplpython3 scripts/mirror_template_materialize.py <import_workspace> <template_workspace> # Type A mirror only; destination owns no roster```+Round-trip import runs the flat vector extraction automatically after creating+`authoring-svg-flat/`; the manual two-pass commands above remain the+create-template path.+`extract_svg_assets.py` fingerprints each extracted subtree before generated-IDnamespacing. Process the layered authoring view first, then pass its inventory tothe flat view with `--reuse-inventory`; matching flat subtrees reference thediff --git a/skills/ppt-master/scripts/authoring_roundtrip.py b/skills/ppt-master/scripts/authoring_roundtrip.pyindex 3eb3039d..a43f2470 100644--- a/skills/ppt-master/scripts/authoring_roundtrip.py+++ b/skills/ppt-master/scripts/authoring_roundtrip.py@@ -33,6 +33,7 @@ from extract_svg_assets import extract_filefrom pptx_workspace import ROUNDTRIP_MANIFEST_PATHfrom slide_roster import discover_slide_svgsfrom svg_authoring_view import (+ AUTHORING_OMITTED_SOURCE_ATTRIBUTES,AUTHORING_MANIFEST_NAME,AUTHORING_SCHEMA,SOURCE_REF_ATTRIBUTE,@@ -49,6 +50,12 @@ XLINK_NS = "http://www.w3.org/1999/xlink"VECTOR_INVENTORY_SCHEMA = "vector_asset_inventory.v1"IMPORTED_ICON_NAMESPACE = "imported"_URL_ID_RE = re.compile(r"url\(\s*(['\"]?)#([^)'\"\s]+)\1\s*\)")+_PRESERVED_EFFECT_ATTRIBUTES = frozenset({+ "data-pptx-effect-ooxml",+ "data-pptx-effect-ooxml-sha256",+ "data-pptx-effect-reason",+ "data-pptx-effect-status",+})ET.register_namespace("", SVG_NS)ET.register_namespace("xlink", XLINK_NS)@@ -656,6 +663,11 @@ def _normalized_hash(asset: VectorAssetRecord | None = None,) -> str:normalized = copy.deepcopy(element)+ if asset is not None and not asset.unchanged:+ normalized.set(+ "data-pptx-edited-vector-asset-sha256",+ asset.actual_asset_sha256,+ )prefix = f"{asset.element_prefix}_" if asset is not None else Nonedef rewrite_url(match: re.Match[str]) -> str:@@ -675,6 +687,22 @@ def _normalized_hash(rewritten = "#" + rewritten[len(prefix) + 1:]if rewritten != value:item.set(name, rewritten)+ if asset is not None:+ for name, value in list(item.attrib.items()):+ if _local_name(name) != "href" or value.startswith(("#", "data:")):+ continue+ parsed = urlsplit(value)+ if parsed.scheme or parsed.netloc or not parsed.path:+ continue+ resolved = (+ asset.asset_path.parent / unquote(parsed.path)+ ).resolve()+ normalized_ref = f"asset-resource:{resolved.as_posix()}"+ if parsed.query:+ normalized_ref += f"?{parsed.query}"+ if parsed.fragment:+ normalized_ref += f"#{parsed.fragment}"+ item.set(name, normalized_ref)icon = item.get("data-icon")record = assets.get(icon or "")if record is not None:@@ -863,6 +891,15 @@ def _merge_defs(definition_id = clone.get("id")if definition_id and definition_id in by_id:index, previous = by_id[definition_id]+ projected_previous = copy.deepcopy(previous)+ for item in projected_previous.iter():+ for name in AUTHORING_OMITTED_SOURCE_ATTRIBUTES:+ item.attrib.pop(name, None)+ if (+ semantic_subtree_sha256(projected_previous)+ == semantic_subtree_sha256(clone)+ ):+ continuemerged.remove(previous)merged.insert(index, clone)by_id[definition_id] = (index, clone)@@ -920,6 +957,30 @@ def _rebase_resource_references(node.set(name, urlunsplit(("", "", relative, "", "")))+def _restore_preserved_effect_metadata(+ target: ET.Element,+ source: ET.Element,+) -> None:+ """Keep source-native effects when an author edits other object semantics."""+ source_by_id = {+ item_id: item+ for item in source.iter()+ if (item_id := item.get("id"))+ }+ for item in target.iter():+ source_item = (+ source+ if item is target+ else source_by_id.get(item.get("id") or "")+ )+ if source_item is None:+ continue+ for name in _PRESERVED_EFFECT_ATTRIBUTES:+ value = source_item.get(name)+ if value is not None and item.get(name) is None:+ item.set(name, value)++def _materialize_document(project_path: Path,document: AuthoringDocument,@@ -931,6 +992,10 @@ def _materialize_document(current_root = _parse_svg(document.authoring_path)baseline_root = _parse_svg(baseline_path)layered_root = _parse_svg(document.layered_source_path)+ document_unchanged = (+ _normalized_hash(current_root, current_assets)+ == _normalized_hash(baseline_root, baseline_assets)+ )layered_index = _layered_ref_index(layered_root)current_referenced_assets = _referenced_assets(current_root,@@ -1049,28 +1114,11 @@ def _materialize_document("slide cannot delete shared structure")- baseline_use_counts: Counter[tuple[str, str]] = Counter()- for use in baseline_root.iter():- icon = (use.get("data-icon") or "").strip()- record = baseline_assets.get(icon)- if record is None:- continue- baseline_use_counts[- (record.baseline_key, _normalized_hash(use, baseline_assets))- ] += 1- unchanged_use_ids: set[int] = set()- for use in current_root.iter():- icon = (use.get("data-icon") or "").strip()- record = current_assets.get(icon)- if record is None or not record.unchanged:- continue- key = (record.baseline_key, _normalized_hash(use, current_assets))- if baseline_use_counts[key] <= 0:- continue- baseline_use_counts[key] -= 1- unchanged_use_ids.add(id(use))-- def restore_nodes(element: ET.Element) -> list[ET.Element]:+ def restore_nodes(+ element: ET.Element,+ source_dir: Path | None = None,+ ) -> list[ET.Element]:+ source_dir = source_dir or document.authoring_path.parentsource_ref = element.get(SOURCE_REF_ATTRIBUTE)if source_ref in unchanged_refs:scope = source_ref.split(":", 1)[0]@@ -1096,19 +1144,20 @@ def _materialize_document(referenced = current_referenced_assets.get(icon)if referenced is not None:record, asset_root = referenced- if record.unchanged and id(element) in unchanged_use_ids:- outer_refs = _outer_source_ref_elements(asset_root)- if outer_refs:- restored: list[ET.Element] = []- for outer in outer_refs:- restored.extend(restore_nodes(outer))- return restored+ outer_refs = _outer_source_ref_elements(asset_root)+ if outer_refs:+ restored: list[ET.Element] = []+ for outer in outer_refs:+ restored.extend(+ restore_nodes(outer, record.asset_path.parent)+ )+ return restoredclone = copy.deepcopy(element)for child in list(clone):clone.remove(child)for original_child in element:- replacements = restore_nodes(original_child)+ replacements = restore_nodes(original_child, source_dir)if replacements:replacements[-1].tail = original_child.tailfor replacement in replacements:@@ -1116,22 +1165,24 @@ def _materialize_document(clone.attrib.pop(SOURCE_REF_ATTRIBUTE, None)_rebase_resource_references(clone,- document.authoring_path.parent,+ source_dir,output_path.parent,project_path,recursive=False,)- if source_ref and source_ref.startswith("slide:"):+ if source_ref:source = layered_index.get(source_ref)if source is not None:- for name in (- "data-pptx-shape-id",- "data-pptx-shape-scope",- "data-pptx-shape-name",- "data-name",- ):- if clone.get(name) is None and source.get(name) is not None:- clone.set(name, str(source.get(name)))+ if source_ref.startswith("slide:"):+ for name in (+ "data-pptx-shape-id",+ "data-pptx-shape-scope",+ "data-pptx-shape-name",+ "data-name",+ ):+ if clone.get(name) is None and source.get(name) is not None:+ clone.set(name, str(source.get(name)))+ _restore_preserved_effect_metadata(clone, source)return [clone]baseline_unreferenced = Counter(@@ -1169,6 +1220,47 @@ def _materialize_document(current_defs_root,include_authoring_changes=defs_changed or bool(edited_refs),)+ merged_definition_ids = {+ definition_id+ for definition in (list(merged_defs) if merged_defs is not None else [])+ if (definition_id := definition.get("id"))+ }+ merged_definition_hashes = {+ semantic_subtree_sha256(definition)+ for definition in (list(merged_defs) if merged_defs is not None else [])+ }+ for record, asset_root in current_referenced_assets.values():+ asset_defs = _direct_defs(asset_root)+ if (+ record.unchanged+ or asset_defs is None+ or not _outer_source_ref_elements(asset_root)+ ):+ continue+ if merged_defs is None:+ merged_defs = ET.Element(f"{{{SVG_NS}}}defs")+ for definition in asset_defs:+ clone = copy.deepcopy(definition)+ _rebase_resource_references(+ clone,+ record.asset_path.parent,+ output_path.parent,+ project_path,+ recursive=True,+ )+ definition_id = clone.get("id")+ definition_hash = semantic_subtree_sha256(clone)+ if definition_hash in merged_definition_hashes:+ continue+ if definition_id and definition_id in merged_definition_ids:+ raise AuthoringRoundtripError(+ f"{document.name} edited vector asset definition id "+ f"collides with page definitions: {definition_id!r}"+ )+ merged_defs.append(clone)+ merged_definition_hashes.add(definition_hash)+ if definition_id:+ merged_definition_ids.add(definition_id)if merged_defs is not None and list(merged_defs):output_root.append(merged_defs)@@ -1204,10 +1296,7 @@ def _materialize_document(output_path.write_bytes(_serialize_svg(output_root))return {"file": document.name,- "document_unchanged": (- _sha256_file(document.authoring_path)- == document.initial_authoring_sha256- ),+ "document_unchanged": document_unchanged,"source_ref_count": len(expected_refs),"source_ref_ids": sorted(expected_refs),"unchanged_refs": len(unchanged_refs),diff --git a/skills/ppt-master/scripts/docs/svg-pipeline.md b/skills/ppt-master/scripts/docs/svg-pipeline.mdindex 8b3a837d..01779c74 100644--- a/skills/ppt-master/scripts/docs/svg-pipeline.md+++ b/skills/ppt-master/scripts/docs/svg-pipeline.md@@ -46,24 +46,33 @@ The projected copy:- compacts imported model-facing frames and safe transform page coordinates toat most two decimals.-Round-trip flat projection additionally replaces any large source-backed-logical object with one compact-`<image data-pptx-source-proxy="native-restore">`. Its hashed SVG preview is-stored under `images/source-object-previews/`, while the complete imported SVG-and source PPTX remain the semantic authority. This keeps tables and complex-group geometry out of model-facing page files without changing their browser-rendering. A source proxy is atomic: leave it unchanged to restore the original-native PowerPoint object. A complete Slide-local proxy may be removed to delete-that object; an inherited Master/Layout proxy must remain because one flat page-cannot delete shared structure. Editing the proxy or its preview asset fails-round-trip export instead of silently rasterizing or flattening the object.+Round-trip publication applies two object-level compactions after projection:++- text-free vector decorations that cross the readability threshold move to+ editable `icons/imported/*.svg` assets; the page retains one compact+ `<use data-icon="imported/...">`, and+ `authoring-svg-flat_vector_asset_inventory.json` reconnects its source refs;+- large semantic/native-payload objects that cannot safely become editable+ vector assets become+ `<image data-pptx-source-proxy="native-restore">` references whose hashed SVG+ previews live under `images/source-object-previews/`.++The live editor expands `data-icon` references for complete-page preview. Read+an imported vector asset only when editing that decoration. An unchanged asset+restores its native source objects; editing the asset rebuilds only its owning+slide as one vector edit unit. A source proxy remains atomic: leave it unchanged+to restore the original native PowerPoint object. A complete Slide-local proxy+may be removed to delete that object; an inherited Master/Layout proxy must+remain because one flat page cannot delete shared structure. Editing the proxy+or its preview asset fails round-trip export instead of silently rasterizing or+flattening the object.The summary stores the current SVG roster plus compact per-file canvas, size,-text, image, vector, placeholder, icon, source-ref, and source-proxy counts. Models read the-summary and editable SVGs; they do not read the machine manifest. The manifest-stores relative source/authoring filenames, source and initial authoring hashes,-source element paths, and immutable preview hashes for source proxies. It-deliberately does not copy the opaque payload.+text, image, vector, placeholder, icon, source-ref, and source-proxy counts.+Models read the summary and editable SVGs; they do not read the machine+manifest. The manifest stores relative source/authoring filenames, source and initial authoring+hashes, source element paths, and immutable preview hashes for source proxies.+It deliberately does not copy the opaque payload.The layered authoring bundle remains the editable source for template creation;the complete imported SVG remains immutable native-payload backing. Final`templates/*.svg` files are materialized and validated from that pair. A@@ -73,10 +82,12 @@ imported-deck round-trip. `pptx_to_svg.py --roundtrip` places image media indirectories, opaque payloads in `native-payloads/`, the source package in`sources/`, and tool-owned backing/contracts in `analysis/`; `assets/` isinvalid. `svg_to_pptx.py --roundtrip` always reads `authoring-svg-flat/`,-restores unchanged source refs from `analysis/roundtrip-svg/`, and retains-edits/deletions/new content without rewriting the bundle. Unchanged slides and-resources pass through byte-for-byte; an edit rebuilds only its owner. Resource-hrefs resolve exactly relative to the SVG and must remain inside the workspace.+restores unchanged source refs from `analysis/roundtrip-svg/`, expands imported+vector edit units from `icons/imported/`, and retains edits/deletions/new+content without rewriting the bundle. Unchanged slides and resources pass+through byte-for-byte; an edit rebuilds only its owner. Resource hrefs resolve+exactly relative to the page or extracted asset and must remain inside the+workspace.Regenerate the summary after direct edits that do not pass through one of thein-place normalization tools:@@ -377,6 +388,12 @@ python3 scripts/extract_svg_assets.py <flat_svg_dir> \--inplace --id-prefix flat```+`pptx_to_svg.py --roundtrip` invokes the same extractor automatically for+`authoring-svg-flat/` after source-proxy projection. It uses the imported+namespace and records the thresholds in the adjacent vector inventory so+`svg_to_pptx.py --roundtrip` can regenerate the same baseline before comparing+edits.+The first pass records a source fingerprint before namespacing each extractedasset's internal ids. The second pass reuses a fingerprint-matched asset andwrites no duplicate SVG file. Unmatched flat-only subtrees still extractdiff --git a/skills/ppt-master/scripts/extract_svg_assets.py b/skills/ppt-master/scripts/extract_svg_assets.pyindex f5e6fc20..0c35340d 100644--- a/skills/ppt-master/scripts/extract_svg_assets.py+++ b/skills/ppt-master/scripts/extract_svg_assets.py@@ -886,40 +886,65 @@ def build_parser() -> argparse.ArgumentParser:return parser-def main(argv: Optional[list[str]] = None) -> int:- args = build_parser().parse_args(argv)- svg_dir = Path(args.svg_dir)+def extract_directory(+ svg_dir: Path,+ icons_dir: Path,+ icon_namespace: str,+ *,+ min_drawables: int = DEFAULT_MIN_DRAWABLES,+ min_bytes: int = DEFAULT_MIN_BYTES,+ min_decoration_bytes: int = DEFAULT_MIN_DECORATION_BYTES,+ inplace: bool = False,+ id_prefix: str = "",+ rewritten_dir: Path | None = None,+ inventory_path: Path | None = None,+ reuse_inventory_path: Path | None = None,+ clean_stale: bool = False,+ skip_unparseable: bool = False,+) -> tuple[dict, Path | None, tuple[tuple[Path, str], ...]]:+ """Extract one SVG directory and publish its deterministic inventory.++ Thresholds select vector groups or decoration runs. In-place authoring+ bundles also refresh their model-readable summary. Returns the inventory,+ optional summary path, and any parse failures skipped by the CLI mode.+ """+ svg_dir = Path(svg_dir)+ icons_dir = Path(icons_dir)if not svg_dir.is_dir():- print(f"[ERROR] svg_dir not found: {svg_dir}", file=sys.stderr)- return 1-- icons_dir = Path(args.icons_dir) if args.icons_dir else svg_dir.parent / "icons"- icons_dir.mkdir(parents=True, exist_ok=True)- icon_namespace = args.icon_namespace.strip()+ raise ValueError(f"svg_dir not found: {svg_dir}")if icon_namespace and not ICON_NAMESPACE_RE.fullmatch(icon_namespace):- print(- "[ERROR] --icon-namespace must be one lower-case ASCII directory name "- "using only letters, digits, '_' or '-'",- file=sys.stderr,+ raise ValueError(+ "icon_namespace must be one lower-case ASCII directory name "+ "using only letters, digits, '_' or '-'")- return 1- reusable_assets: dict[str, dict] = {}- reuse_inventory_path = Path(args.reuse_inventory) if args.reuse_inventory else None- if reuse_inventory_path is not None:- try:- reusable_assets = _load_reusable_assets(reuse_inventory_path, icons_dir)- except ValueError as exc:- print(f"[ERROR] {exc}", file=sys.stderr)- return 1- rewritten_dir = Path(args.rewritten_dir) if args.rewritten_dir else None+ if min(min_drawables, min_bytes, min_decoration_bytes) < 0:+ raise ValueError("vector extraction thresholds must be non-negative")++ icons_dir.mkdir(parents=True, exist_ok=True)+ reusable_assets = (+ _load_reusable_assets(reuse_inventory_path, icons_dir)+ if reuse_inventory_path is not None+ else {}+ )inventory_path = (- Path(args.inventory)- if args.inventory+ Path(inventory_path)+ if inventory_path is not Noneelse svg_dir.parent / f"{svg_dir.name}_vector_asset_inventory.json")- svg_paths = sorted(svg_dir.glob("*.svg"))+ def manifest_path(path: Path | None) -> str | None:+ if path is None:+ return None+ try:+ return path.resolve().relative_to(+ inventory_path.parent.resolve()+ ).as_posix()+ except ValueError:+ return str(path)++ svg_paths = sorted(svg_dir.glob("*.svg"))inventory: list[dict] = []+ skipped: list[tuple[Path, str]] = []for svg_path in svg_paths:try:inventory.extend(@@ -927,20 +952,24 @@ def main(argv: Optional[list[str]] = None) -> int:svg_path,icons_dir,icon_namespace,- args.min_drawables,- args.min_bytes,- args.min_decoration_bytes,- args.inplace,- args.id_prefix,+ min_drawables,+ min_bytes,+ min_decoration_bytes,+ inplace,+ id_prefix,rewritten_dir,reusable_assets,))except ET.ParseError as exc:- print(f"[WARN] skip unparseable {svg_path.name}: {exc}", file=sys.stderr)+ if not skip_unparseable:+ raise+ skipped.append((svg_path, str(exc)))extracted_count = sum(entry.get("source") == "extracted" for entry in inventory)- reused_count = sum(entry.get("source") == "reused-inventory" for entry in inventory)+ reused_count = sum(+ entry.get("source") == "reused-inventory" for entry in inventory+ )known_assets = {str(entry["asset"]) for entry in inventory}inventory.extend(_existing_placeholder_entries(@@ -952,31 +981,37 @@ def main(argv: Optional[list[str]] = None) -> int:)stale_removed: list[str] = []- if args.clean_stale:+ if clean_stale:keep_assets = {str(entry["asset"]) for entry in inventory}keep_assets.update(_referenced_icon_assets(svg_paths, icon_namespace))stale_removed = _clean_stale_assets(icons_dir,icon_namespace,svg_paths,- args.id_prefix,+ id_prefix,keep_assets,)manifest = {"schema": "vector_asset_inventory.v1",- "svg_dir": str(svg_dir),- "icons_dir": str(icons_dir),+ "svg_dir": manifest_path(svg_dir),+ "icons_dir": manifest_path(icons_dir),"icon_namespace": icon_namespace or None,"rewritten_dir": (None- if args.inplace- else str(_rewritten_path(svg_dir / "_sample.svg", rewritten_dir, False).parent)+ if inplace+ else manifest_path(+ _rewritten_path(+ svg_dir / "_sample.svg",+ rewritten_dir,+ False,+ ).parent+ )),- "reuse_inventory": str(reuse_inventory_path) if reuse_inventory_path is not None else None,- "min_drawables": args.min_drawables,- "min_bytes": args.min_bytes,- "min_decoration_bytes": args.min_decoration_bytes,+ "reuse_inventory": manifest_path(reuse_inventory_path),+ "min_drawables": min_drawables,+ "min_bytes": min_bytes,+ "min_decoration_bytes": min_decoration_bytes,"extracted_count": extracted_count,"reused_count": reused_count,"asset_count": len(inventory),@@ -984,18 +1019,55 @@ def main(argv: Optional[list[str]] = None) -> int:"assets": inventory,}inventory_path.parent.mkdir(parents=True, exist_ok=True)- inventory_path.write_text(json.dumps(manifest, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")- summary_path: Path | None = None- if args.inplace and (svg_dir / AUTHORING_MANIFEST_NAME).is_file():- try:- summary_path = write_authoring_summary(svg_dir)- except (OSError, ValueError) as exc:- print(- f"[ERROR] vector extraction succeeded but authoring summary "- f"refresh failed: {exc}",- file=sys.stderr,- )- return 1+ inventory_path.write_text(+ json.dumps(manifest, ensure_ascii=False, indent=2) + "\n",+ encoding="utf-8",+ )+ summary_path = (+ write_authoring_summary(svg_dir)+ if inplace and (svg_dir / AUTHORING_MANIFEST_NAME).is_file()+ else None+ )+ return manifest, summary_path, tuple(skipped)+++def main(argv: Optional[list[str]] = None) -> int:+ args = build_parser().parse_args(argv)+ svg_dir = Path(args.svg_dir)+ icons_dir = Path(args.icons_dir) if args.icons_dir else svg_dir.parent / "icons"+ icon_namespace = args.icon_namespace.strip()+ reuse_inventory_path = Path(args.reuse_inventory) if args.reuse_inventory else None+ rewritten_dir = Path(args.rewritten_dir) if args.rewritten_dir else None+ inventory_path = (+ Path(args.inventory)+ if args.inventory+ else svg_dir.parent / f"{svg_dir.name}_vector_asset_inventory.json"+ )+ try:+ manifest, summary_path, skipped = extract_directory(+ svg_dir,+ icons_dir,+ icon_namespace,+ min_drawables=args.min_drawables,+ min_bytes=args.min_bytes,+ min_decoration_bytes=args.min_decoration_bytes,+ inplace=args.inplace,+ id_prefix=args.id_prefix,+ rewritten_dir=rewritten_dir,+ inventory_path=inventory_path,+ reuse_inventory_path=reuse_inventory_path,+ clean_stale=args.clean_stale,+ skip_unparseable=True,+ )+ except (OSError, ValueError) as exc:+ print(f"[ERROR] {exc}", file=sys.stderr)+ return 1+ for svg_path, reason in skipped:+ print(f"[WARN] skip unparseable {svg_path.name}: {reason}", file=sys.stderr)+ extracted_count = int(manifest["extracted_count"])+ reused_count = int(manifest["reused_count"])+ inventory = list(manifest["assets"])+ stale_removed = list(manifest["stale_removed"])print(f"[OK] extracted {extracted_count} new asset(s), reused {reused_count} asset(s), "f"inventoried {len(inventory)} asset reference(s) -> "diff --git a/skills/ppt-master/scripts/pptx_to_svg.py b/skills/ppt-master/scripts/pptx_to_svg.pyindex ac1eed71..61bded5f 100644--- a/skills/ppt-master/scripts/pptx_to_svg.py+++ b/skills/ppt-master/scripts/pptx_to_svg.py@@ -11,6 +11,9 @@ Usage:Output structure (``--roundtrip``):<output_dir>/authoring-svg-flat/ sole editable SVG page source+ icons/imported/ on-demand complex vector decorations+ authoring-svg-flat_vector_asset_inventory.json+ extracted-decoration source mappinganimations.json normalized transition/object-motion sidecarimages/ raster/SVG/EMF/WMF picture resourcessounds/ transition/object cue audio, when presentdiff --git a/skills/ppt-master/scripts/pptx_to_svg/converter.py b/skills/ppt-master/scripts/pptx_to_svg/converter.pyindex 2812a187..51ca376c 100644--- a/skills/ppt-master/scripts/pptx_to_svg/converter.py+++ b/skills/ppt-master/scripts/pptx_to_svg/converter.py@@ -28,6 +28,7 @@ from urllib.parse import unquote, urlsplit, urlunsplitfrom xml.etree import ElementTree as ETfrom xml.sax.saxutils import quoteattr+from extract_svg_assets import extract_directoryfrom pptx_embedded_fonts import (FONT_BUNDLE_DIR,EmbeddedFontBundle,@@ -95,6 +96,9 @@ _MANAGED_FLAT_SVG_RE = re.compile(r"slide_\d+\.svg")_MANAGED_TRANSITION_SOUND_RE = re.compile(r"transition_sound_[0-9a-f]{16}\.wav")+_ROUNDTRIP_VECTOR_MIN_DRAWABLES = 2+_ROUNDTRIP_VECTOR_MIN_BYTES = 512+_ROUNDTRIP_VECTOR_MIN_DECORATION_BYTES = 512_SVG_HREF_RE = re.compile(r"\b(?:href|xlink:href)\s*=\s*[\"']([^\"']+)[\"']")@@ -1470,6 +1474,20 @@ def _write_artifact_tree(projection_kind="flat",source_proxy_dir=source_proxy_dir,)+ extract_directory(+ authoring_dir,+ output_dir / "icons",+ "imported",+ min_drawables=_ROUNDTRIP_VECTOR_MIN_DRAWABLES,+ min_bytes=_ROUNDTRIP_VECTOR_MIN_BYTES,+ min_decoration_bytes=_ROUNDTRIP_VECTOR_MIN_DECORATION_BYTES,+ inplace=True,+ id_prefix="flat",+ inventory_path=(+ output_dir+ / f"{authoring_dir.name}_vector_asset_inventory.json"+ ),+ )_write_roundtrip_manifest(output_dir, result, options)diff --git a/skills/ppt-master/scripts/svg_authoring_view.py b/skills/ppt-master/scripts/svg_authoring_view.pyindex 7f2ee21f..6404f289 100644--- a/skills/ppt-master/scripts/svg_authoring_view.py+++ b/skills/ppt-master/scripts/svg_authoring_view.py@@ -63,9 +63,10 @@ AUTHORING_SUMMARY_SCHEMA = "ppt-master.svg-authoring-summary.v1"SOURCE_REF_ATTRIBUTE = "data-pptx-source-ref"SOURCE_PROXY_ATTRIBUTE = "data-pptx-source-proxy"SOURCE_PROXY_KIND = "native-restore"-# Keep ordinary text and shape groups inline. Objects beyond one filesystem-# block are treated as atomic source-backed visuals in round-trip flat pages.+# Keep ordinary text and vectors inline. Large semantic/native payload objects+# that cannot move to an editable vector asset become atomic source proxies.SOURCE_PROXY_MIN_BYTES = 4096+_SEMANTIC_CONTENT_TAGS = frozenset({"foreignObject", "text", "tspan"})_DRAWABLE_TAGS = frozenset({"circle","ellipse",@@ -80,10 +81,17 @@ _URL_ID_RE = re.compile(r"url\(\s*(['\"]?)#([^)'\"\s]+)\1\s*\)")ET.register_namespace("", SVG_NS)ET.register_namespace("xlink", XLINK_NS)-# These fields identify the source OOXML object or guard its exact imported-# fallback. They belong in the complete import SVG, not its lightweight view.-IMPORT_SOURCE_ATTRIBUTES = {+# These fields identify source OOXML objects or carry opaque paint/effect+# payloads. They belong in the complete import SVG, not its lightweight view.+AUTHORING_OMITTED_SOURCE_ATTRIBUTES = {"data-name",+ "data-pptx-effect-ooxml",+ "data-pptx-effect-ooxml-sha256",+ "data-pptx-effect-reason",+ "data-pptx-effect-status",+ "data-pptx-gradient-ooxml",+ "data-pptx-gradient-ooxml-sha256",+ "data-pptx-gradient-preview-sha256","data-pptx-preview-sha256","data-pptx-shape-id","data-pptx-shape-name",@@ -91,6 +99,19 @@ IMPORT_SOURCE_ATTRIBUTES = {"data-pptx-shape-style",}+_TSPAN_INHERITED_ATTRIBUTES = frozenset({+ "fill",+ "fill-opacity",+ "font-family",+ "font-size",+ "font-style",+ "font-weight",+ "stroke",+ "stroke-opacity",+ "text-anchor",+ "text-decoration",+})+# Compact native-shape intent is intentionally not in the removal set:# data-pptx-object, data-pptx-prst, and data-pptx-frame remain useful while# reviewing the visible fallback. Structural markers also pass through@@ -270,6 +291,8 @@ class ProjectionStats:compatibility_normalizations: int = 0asset_references_rewritten: int = 0coordinate_attributes_compacted: int = 0+ inherited_text_attributes_compacted: int = 0+ single_tspans_collapsed: int = 0source_object_proxies: int = 0source_object_proxy_bytes: int = 0unused_definitions_pruned: int = 0@@ -285,6 +308,10 @@ class ProjectionStats:"source_attributes": dict(sorted(self.source_attributes.items())),"asset_references_rewritten": self.asset_references_rewritten,"coordinate_attributes_compacted": self.coordinate_attributes_compacted,+ "inherited_text_attributes_compacted": (+ self.inherited_text_attributes_compacted+ ),+ "single_tspans_collapsed": self.single_tspans_collapsed,"source_object_proxies": self.source_object_proxies,"source_object_proxy_bytes": self.source_object_proxy_bytes,"unused_definitions_pruned": self.unused_definitions_pruned,@@ -300,6 +327,10 @@ class ProjectionStats:self.coordinate_attributes_compacted += (other.coordinate_attributes_compacted)+ self.inherited_text_attributes_compacted += (+ other.inherited_text_attributes_compacted+ )+ self.single_tspans_collapsed += other.single_tspans_collapsedself.source_object_proxies += other.source_object_proxiesself.source_object_proxy_bytes += other.source_object_proxy_bytesself.unused_definitions_pruned += other.unused_definitions_pruned@@ -391,12 +422,44 @@ def _unwrap_preview(parent: ET.Element, wrapper: ET.Element) -> bool:def _strip_import_attributes(element: ET.Element, stats: ProjectionStats) -> None:for name in list(element.attrib):- if name not in IMPORT_SOURCE_ATTRIBUTES:+ if name not in AUTHORING_OMITTED_SOURCE_ATTRIBUTES:continuestats.source_attributes[name] += 1del element.attrib[name]+def _compact_text_runs(root: ET.Element, stats: ProjectionStats) -> None:+ """Remove redundant run paint while preserving directly editable text."""+ for text in root.iter():+ if _local_name(text.tag) != "text":+ continue+ for span in list(text):+ if _local_name(span.tag) != "tspan":+ continue+ for name in list(span.attrib):+ if (+ name in _TSPAN_INHERITED_ATTRIBUTES+ and span.get(name) == text.get(name)+ ):+ del span.attrib[name]+ stats.inherited_text_attributes_compacted += 1++ if len(text) != 1:+ continue+ span = text[0]+ if (+ _local_name(span.tag) != "tspan"+ or span.attrib+ or len(span)+ or text.text not in {None, ""}+ or span.tail not in {None, ""}+ ):+ continue+ text.text = span.text+ text.remove(span)+ stats.single_tspans_collapsed += 1++def _project_subtree(parent: ET.Element, stats: ProjectionStats) -> None:for child in list(parent):part = child.get("data-pptx-part")@@ -608,6 +671,10 @@ def _source_proxy_element("id","data-pptx-object","data-pptx-frame",+ "data-pptx-prst",+ "data-pptx-av-adj",+ "data-pptx-av-adj1",+ "data-pptx-av-adj2","data-pptx-import-source","data-pptx-replacement-status","data-pptx-replace-with",@@ -630,6 +697,24 @@ def _source_proxy_element(return proxy+def _prefer_editable_vector_asset(element: ET.Element) -> bool:+ """Keep pure vector decorations available for later `<use>` extraction."""+ if any(+ _local_name(item.tag) in _SEMANTIC_CONTENT_TAGS+ for item in element.iter()+ ):+ return False+ if any(+ "chart" in (item.get("id") or "").lower()+ for item in element.iter()+ ):+ return False+ return any(+ _local_name(item.tag) in _DRAWABLE_TAGS+ for item in element.iter()+ )++def _externalize_large_source_objects(root: ET.Element,references: list[SourceReference],@@ -655,7 +740,10 @@ def _externalize_large_source_objects(assets: dict[Path, bytes] = {}for parent, element in candidates:original_bytes = len(ET.tostring(element, encoding="utf-8"))- if original_bytes < SOURCE_PROXY_MIN_BYTES:+ if (+ original_bytes < SOURCE_PROXY_MIN_BYTES+ or _prefer_editable_vector_asset(element)+ ):continuesource_ref = element.get(SOURCE_REF_ATTRIBUTE)if not source_ref or source_ref not in reference_by_id:@@ -723,6 +811,7 @@ def _render_projection(source_references = _stamp_source_references(root)stats = ProjectionStats()_project_subtree(root, stats)+ _compact_text_runs(root, stats)stats.compatibility_normalizations += len(normalize_single_child_group_filters(root))diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.pyindex 7242739c..45e18129 100644--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py@@ -39,6 +39,7 @@ from pptx_transitions import (NATIVE_TRANSITIONS,create_transition_xml,normalize_transition_effect_request,+ serialize_source_xml,set_directory_use_timings,validate_generated_transition_xml,validate_pptx_morph_pairs,@@ -1296,7 +1297,9 @@ def _apply_roundtrip_slide_overlay("animations.json explicitly: "+ ", ".join(sorted(missing_timing_targets, key=int)))- _write_xml_tree(generated_slide_path, ET.ElementTree(source_root))+ generated_slide_path.write_bytes(+ serialize_source_xml(source_root, source_slide)+ )def _remove_relationships_by_type(rels_path: Path, rel_type: str) -> int: