Skip to content

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

fix(native): project SVG-first chart/table chrome into native payloads and fail closed on drift

hugohe362fb58403d0b
diff --git a/skills/ppt-master/references/executor-chart.md b/skills/ppt-master/references/executor-chart.md
index 630da694..f09f73e6 100644
--- a/skills/ppt-master/references/executor-chart.md
+++ b/skills/ppt-master/references/executor-chart.md
@@ -42,7 +42,7 @@ A dual-axis chart is valid only when both series share the exact time/category
domain and the units and visual identities stay unambiguous; otherwise separate
the views.
-**Per-object completeness**: preserve every authoritative series, category, point, label, unit, qualifier, source, and scale cue needed to read the chart. When the source cannot determine a required scale or derived value, return the ambiguity upstream in Default or resolve it from explicit source facts in Quick; never fabricate it at draw time.
+**Per-object completeness**: preserve every authoritative series, category, point, label, unit, qualifier, source, and scale cue needed to read the chart. For a `<object-key>=yes` chart, the JSON mirrors the drawn fallback item by item in the same edit: legend labels verbatim, point-level exception colors as `point_colors`, the axis scale, the classic `plot_area` taken from the plot-area marker, visible data labels or summary figures as `data_labels` or companion text, and the actual label / axis / grid colors — omit `text_color` and its siblings rather than guess them. When the source cannot determine a required scale or derived value, return the ambiguity upstream in Default or resolve it from explicit source facts in Quick; never fabricate it at draw time.
**Hard rule — schedule geometry**: A schedule is a Gantt chart when dates or
durations determine each task bar's `x` and `width`, even if the source was a
diff --git a/skills/ppt-master/references/executor-table.md b/skills/ppt-master/references/executor-table.md
index 5b62037b..ffce2070 100644
--- a/skills/ppt-master/references/executor-table.md
+++ b/skills/ppt-master/references/executor-table.md
@@ -45,6 +45,7 @@ shared row/column information-model boundary.
3. Place every cell value, unit, qualifier, status, and source-bearing note in its correct intersection.
4. Apply alignment consistently by content role, including comparable numeric alignment and stable header/body hierarchy.
5. Add rules, fills, banding, highlights, and in-cell indicators only after the grid reads correctly in plain form.
+6. For a `<object-key>=yes` table, project the finished grid into the JSON in the same edit: `row_heights`, header fill / text / bold / alignment, whole-row or whole-column fills, first-column emphasis, padding, and per-side `borders` mirroring the drawn rules; a font size plus a uniform border is not a projection. A graphical cell (inset badge, colored chip, mini bar) cannot be expressed by `a:tbl`: return that object to `Native-ready=no`.
**Per-cell completeness**: never drop a row, column, summary, footnote, unit, or qualifier to imitate a lighter catalog preview. Reflow text, widen the affected column, rebalance adjacent columns, or increase row height while preserving the active page's information contract and [`executor-base.md`](./executor-base.md) typography bounds.
diff --git a/skills/ppt-master/references/native-data-interface.md b/skills/ppt-master/references/native-data-interface.md
index 1ea7bf3d..2cc95b58 100644
--- a/skills/ppt-master/references/native-data-interface.md
+++ b/skills/ppt-master/references/native-data-interface.md
@@ -249,7 +249,7 @@ per-cell `font_size` only when the fallback visibly differs. If the fallback
has no explicit table font, Default uses the deck body family and declared body
anchor from `spec_lock.md`; Quick uses its active-context body family and size.
-**Hard rule — table native payload is complete**: Every row, summary line,
+**Hard rule — table native payload is complete**: A payload holding only `font_size` and a uniform border is not complete when the fallback draws a header band, row or column fills, first-column emphasis, non-uniform row heights, or sparse rules. Every row, summary line,
value, and cell-level style that must survive `--native-charts-and-tables` must
be present in `columns` / `rows`; SVG fallback text is discarded on that route.
For SVG-first objects this payload is a synchronized projection of the visible
@@ -362,8 +362,7 @@ slide-px bounds; partial bounds or `subtitle` fail. Use `name`, not
`title`, for object naming. `title`, `subtitle`, and axis-title objects may set
`text`, `font_size`, `font_family`, and `color`. On SVG-first markers the
checker rejects title/axis text absent from the fallback and export omits it
-with a warning; JSON-first keeps it. ChartEx keeps an empty `<cx:title>` and
-emits title/subtitle as companion editable text boxes. Axis
+with a warning; JSON-first keeps it. ChartEx writes no `<cx:title>` unless the payload gives a title — an empty ChartEx title makes PowerPoint show the series name as an automatic title — and emits title/subtitle as companion editable text boxes. Axis
titles are optional and explicit: use `axis_titles` with
`category`, `value`, `x`, `y`, or `secondary_value` keys, or the root aliases
`category_axis_title`, `value_axis_title`, `x_axis_title`, `y_axis_title`, and
@@ -399,7 +398,7 @@ payloads default to uppercase `#RRGGBB`. The exporter retains compatibility for
inversion so negative bars keep the same series fill instead of turning into
white/theme fill.
-For ChartEx native charts, valid payload `style.colors` (or root `colors`)
+For treemap and sunburst, `style.colors` projects the visible tile palette in order; aggregate figures drawn inside the marker belong in companion text. For ChartEx native charts, valid payload `style.colors` (or root `colors`)
populate the ChartEx color-style part instead of being replaced by a fixed
accent1–accent6 list. Other ChartEx style semantics remain normalized.
diff --git a/skills/ppt-master/scripts/prompt_audit_manifest.json b/skills/ppt-master/scripts/prompt_audit_manifest.json
index 99d17594..54acc6f5 100644
--- a/skills/ppt-master/scripts/prompt_audit_manifest.json
+++ b/skills/ppt-master/scripts/prompt_audit_manifest.json
@@ -24,14 +24,14 @@
"skills/ppt-master/references/executor-visualization.md": 1250,
"skills/ppt-master/references/executor-structure.md": 2250,
"skills/ppt-master/references/topology-assembly.md": 3750,
- "skills/ppt-master/references/executor-table.md": 1000,
+ "skills/ppt-master/references/executor-table.md": 1250,
"skills/ppt-master/references/executor-image.md": 2000,
"skills/ppt-master/references/executor-web-image.md": 750,
"skills/ppt-master/references/executor-notes.md": 1000,
"skills/ppt-master/references/shared-standards.md": 500,
"skills/ppt-master/references/shared-standards-core.md": 13000,
"skills/ppt-master/references/svg-effects.md": 16000,
- "skills/ppt-master/references/native-data-interface.md": 7500,
+ "skills/ppt-master/references/native-data-interface.md": 7750,
"skills/ppt-master/references/pptx-structure-interface.md": 4750,
"skills/ppt-master/references/preset-shape-vocabulary.md": 2750,
"skills/ppt-master/references/strategist.md": 18000,
@@ -1066,12 +1066,12 @@
"max_tokens": 1250
},
"stage.generate.executor.table": {
- "description": "Conditional semantic cell-grid construction rules.",
+ "description": "Conditional semantic cell-grid construction rules. Ceiling raised after the native projection step was added (BUDGET_FILE/BUDGET_LOAD_SET reported 1022 tokens).",
"scope": "incremental",
"files": [
"skills/ppt-master/references/executor-table.md"
],
- "max_tokens": 1000
+ "max_tokens": 1250
},
"stage.generate.strategist.template": {
"description": "Conditional Strategist module for an explicitly installed template workspace.",
@@ -1082,12 +1082,12 @@
"max_tokens": 3000
},
"stage.generate.executor.native-data": {
- "description": "Conditional preset-pattern and native chart/table metadata interface. Ceiling raised after BUDGET_FILE and BUDGET_LOAD_SET reported 6774 tokens.",
+ "description": "Conditional preset-pattern and native chart/table metadata interface. Ceiling raised after BUDGET_FILE and BUDGET_LOAD_SET reported 6774 tokens. Ceiling raised again after the table-payload completeness and ChartEx title clauses were added (7573 tokens).",
"scope": "incremental",
"files": [
"skills/ppt-master/references/native-data-interface.md"
],
- "max_tokens": 7500
+ "max_tokens": 7750
},
"stage.generate.executor.formula": {
"description": "Conditional direct authoring contract for PowerPoint-native inline and block formulas.",
diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/__init__.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/__init__.py
index 15138879..8e7b515b 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/__init__.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/__init__.py
@@ -98,6 +98,7 @@ __all__ = [
"native_json_is_authoritative",
"native_marker_legacy_warnings",
"native_object_marker_warnings",
+ "native_object_projection_warnings",
"native_replacement_kind",
"native_replacement_status",
"native_marker_transform",
@@ -453,9 +454,10 @@ def _validate_native_object_marker_payload(
off_x, off_y, ext_cx, ext_cy, _ = _validate_bounds_inputs(elem, payload, bounds_ctx)
validated_data: list[list[Any]] | FormulaSpec | None = None
if kind == "table":
- _expanded_payload, table_rows, col_count, _merge_layout = (
+ expanded_payload, table_rows, col_count, _merge_layout = (
_validate_table_payload(payload)
)
+ payload = expanded_payload
validated_data = table_rows
if ext_cx < col_count or ext_cy < len(table_rows):
raise RuntimeError(
@@ -504,6 +506,42 @@ def validate_native_object_marker(
_validate_native_object_marker_payload(elem, ancestors=ancestors)
+def _projection_warnings_for_validated_marker(
+ elem: ET.Element,
+ kind: str,
+ payload: dict[str, Any],
+ validated_data: list[list[Any]] | FormulaSpec | None,
+) -> list[str]:
+ if (
+ native_json_is_authoritative(elem)
+ or native_import_source(elem) == "pptx"
+ ):
+ return []
+ if kind == "table" and isinstance(validated_data, list):
+ return _native_table_warnings(elem, payload, validated_data)
+ if kind == "chart" and payload.get("source_package") is None:
+ return _native_chart_chrome_warnings(elem, payload)
+ return []
+
+
+def native_object_projection_warnings(
+ elem: ET.Element,
+ *,
+ ancestors: tuple[ET.Element, ...] = (),
+) -> list[str]:
+ """Return SVG-first fallback details that marker metadata does not project."""
+ kind, payload, validated_data = _validate_native_object_marker_payload(
+ elem,
+ ancestors=ancestors,
+ )
+ return _projection_warnings_for_validated_marker(
+ elem,
+ kind,
+ payload,
+ validated_data,
+ )
+
+
def validate_native_object_marker_with_warnings(
elem: ET.Element,
*,
@@ -522,13 +560,14 @@ def validate_native_object_marker_with_warnings(
)
if kind in {"chart", "table"} else []
)
- if native_json_is_authoritative(elem):
- return warnings
- if kind == "table" and isinstance(validated_data, list):
- warnings.extend(_native_table_warnings(elem, validated_data))
- elif kind == "chart":
- if payload.get("source_package") is None:
- warnings.extend(_native_chart_chrome_warnings(elem, payload))
+ warnings.extend(
+ _projection_warnings_for_validated_marker(
+ elem,
+ kind,
+ payload,
+ validated_data,
+ )
+ )
return warnings
diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_style.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_style.py
index 3b9ab513..c2b86cbc 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_style.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_style.py
@@ -18,16 +18,19 @@ from ..drawingml.utils import (
text_has_rtl_characters,
text_uses_rtl,
)
-from .chart_data import _DEFAULT_CHART_COLORS
+from .chart_data import _DEFAULT_CHART_COLORS, _chart_data
from .marker_common import (
_bool_attr,
_bounds,
_chart_bool,
_clean_hex,
_compact_key,
+ _fallback_concentric_circle_radii,
_fallback_fill_candidates,
+ _fallback_shape_records,
_fallback_stroke_colors,
_fallback_text_colors,
+ _fallback_text_records,
_first_present,
_font_size_hpt,
_hex_or_none,
@@ -39,7 +42,6 @@ from .marker_common import (
_normalized_fallback_text,
_powerpoint_emu,
_powerpoint_emu_value,
- _relative_luminance,
_style_attr,
_visible_fallback_texts,
)
@@ -115,6 +117,48 @@ def _most_common_font_size(values: list[str]) -> str | None:
return candidates[0]
+def _record_has_label(record: Any, *needles: str) -> bool:
+ return any(
+ needle in label
+ for label in record.labels
+ for needle in needles
+ )
+
+
+def _fallback_chart_colors(
+ elem: ET.Element,
+ inherited_styles: dict[str, str] | None = None,
+) -> dict[str, str | None]:
+ inherited_styles = inherited_styles or {}
+ text_color = _most_common_color(
+ _fallback_text_colors(elem, inherited_styles.get("fill"))
+ )
+ stroke_colors = _fallback_stroke_colors(
+ elem,
+ inherited_styles.get("stroke"),
+ )
+ shape_records = _fallback_shape_records(
+ elem,
+ inherited_stroke=inherited_styles.get("stroke"),
+ )
+ axis_colors = [
+ record.stroke
+ for record in shape_records
+ if record.stroke and _record_has_label(record, "axis")
+ ]
+ grid_colors = [
+ record.stroke
+ for record in shape_records
+ if record.stroke and _record_has_label(record, "grid", "gridline")
+ ]
+ dominant_stroke = _most_common_color(stroke_colors)
+ return {
+ "text_color": text_color,
+ "axis_color": _most_common_color(axis_colors) or dominant_stroke,
+ "grid_color": _most_common_color(grid_colors) or dominant_stroke,
+ }
+
+
def _classic_chart_style(
payload: dict[str, Any],
elem: ET.Element,
@@ -123,20 +167,12 @@ def _classic_chart_style(
inherited_styles = inherited_styles or {}
json_authority = native_json_is_authoritative(elem)
fallback_background = None if json_authority else _inferred_chart_background(elem)
- text_color = (
- None
+ fallback_colors = (
+ {"text_color": None, "axis_color": None, "grid_color": None}
if json_authority
- else _most_common_color(
- _fallback_text_colors(elem, inherited_styles.get("fill"))
- )
- ) or "404040"
- stroke_colors = (
- []
- if json_authority
- else _fallback_stroke_colors(elem, inherited_styles.get("stroke"))
+ else _fallback_chart_colors(elem, inherited_styles)
)
- darkest_stroke = min(stroke_colors, key=_relative_luminance) if stroke_colors else None
- lightest_stroke = max(stroke_colors, key=_relative_luminance) if stroke_colors else None
+ text_color = fallback_colors["text_color"] or "404040"
raw_font_face = _chart_style_value(payload, "font_family", "fontFamily", "font_face", "fontFace")
fallback_font_face = (
None
@@ -150,12 +186,8 @@ def _classic_chart_style(
)
)
font_face = str(raw_font_face).strip() if raw_font_face is not None else fallback_font_face
- axis_color = darkest_stroke or text_color
- grid_color = (
- lightest_stroke
- if lightest_stroke and _relative_luminance(lightest_stroke) > _relative_luminance(axis_color)
- else "D9DED8"
- )
+ axis_color = fallback_colors["axis_color"] or text_color
+ grid_color = fallback_colors["grid_color"] or "D9DED8"
chart_fill = _chart_style_color(
payload,
(
@@ -598,11 +630,15 @@ def _native_chart_export_payload(
show_legend = payload.get("show_legend", style.get("show_legend", False))
if show_legend:
legend_texts = _legend_candidate_texts(payload)
- if legend_texts and not any(text in fallback_texts for text in legend_texts):
+ missing_legend = [
+ text for text in legend_texts if text not in fallback_texts
+ ]
+ if missing_legend:
mutable_payload()["show_legend"] = False
+ sample = ", ".join(repr(text) for text in missing_legend)
messages.append(
- "omitted native chart legend because show_legend=true has no "
- "visible fallback legend text"
+ "omitted native chart legend because these expected labels are "
+ f"missing from the fallback: {sample}"
)
return output, messages
@@ -641,6 +677,253 @@ def _legend_candidate_texts(payload: dict[str, Any]) -> list[str]:
return normalized
+def _native_chart_style_color_warnings(
+ elem: ET.Element,
+ payload: dict[str, Any],
+) -> list[str]:
+ inferred = _fallback_chart_colors(elem)
+ fields = {
+ "text_color": (
+ "text_color", "textColor", "label_color", "labelColor",
+ "font_color", "fontColor",
+ ),
+ "axis_color": (
+ "axis_color", "axisColor", "axis_line_color", "axisLineColor",
+ ),
+ "grid_color": (
+ "grid_color", "gridColor", "gridline_color", "gridlineColor",
+ ),
+ }
+ warnings: list[str] = []
+ for field_name, aliases in fields.items():
+ raw = _chart_style_value(payload, *aliases)
+ if raw is None:
+ continue
+ payload_color = _hex_or_none(raw)
+ fallback_color = inferred[field_name]
+ if (
+ payload_color is None
+ or fallback_color is None
+ or payload_color == fallback_color
+ ):
+ continue
+ warnings.append(
+ f"Native PPTX chart style.{field_name} #{payload_color} differs "
+ f"from fallback dominant {field_name} #{fallback_color}"
+ )
+ return warnings
+
+
+def _native_chart_point_color_warnings(
+ elem: ET.Element,
+ payload: dict[str, Any],
+ chart_data: dict[str, Any],
+) -> list[str]:
+ if chart_data.get("kind") != "category" or chart_data.get("type") not in {
+ "bar", "column",
+ }:
+ return []
+ series = chart_data.get("series")
+ if not isinstance(series, list) or not series:
+ return []
+ style = payload.get("style") if isinstance(payload.get("style"), dict) else {}
+ raw_colors = _first_present(style.get("colors"), payload.get("colors"))
+ palette = (
+ [_clean_hex(color, "#4472C4") for color in raw_colors]
+ if isinstance(raw_colors, list) and raw_colors
+ else list(_DEFAULT_CHART_COLORS)
+ )
+ series_colors = {
+ palette[idx % len(palette)]
+ for idx in range(len(series))
+ }
+ point_colors = {
+ color
+ for item in series
+ if isinstance(item, dict)
+ for color in item.get("point_colors", [])
+ }
+ deviations = sorted({
+ record.fill
+ for record in _fallback_shape_records(elem)
+ if (
+ record.tag == "rect"
+ and record.fill is not None
+ and _record_has_label(record, "bar", "column")
+ and not _record_has_label(record, "legend")
+ and record.fill not in series_colors
+ and record.fill not in point_colors
+ )
+ })
+ return [
+ "Native PPTX chart data mark fill "
+ f"#{color} deviates from its series color, but series point_colors is absent"
+ for color in deviations
+ ]
+
+
+def _native_chart_radial_warnings(
+ elem: ET.Element,
+ payload: dict[str, Any],
+ chart_data: dict[str, Any],
+) -> list[str]:
+ if chart_data.get("kind") != "category" or chart_data.get("type") != "radar":
+ return []
+ radii = _fallback_concentric_circle_radii(elem)
+ if len(radii) < 2:
+ return []
+ warnings: list[str] = []
+ if payload.get("plot_area") is None:
+ warnings.append(
+ "Native PPTX radial chart plot area is visible in the fallback, but "
+ "classic payload has no plot_area"
+ )
+ axes = chart_data.get("axes") if isinstance(chart_data.get("axes"), dict) else {}
+ value_axis = axes.get("value") if isinstance(axes.get("value"), dict) else {}
+ if not all(value_axis.get(field) is not None for field in (
+ "minimum", "maximum", "major_unit",
+ )):
+ warnings.append(
+ f"Native PPTX radial chart has {len(radii)} countable radial gridlines, "
+ "but payload has no complete axes.value minimum/maximum/major_unit scale"
+ )
+ return warnings
+
+
+def _native_chart_tile_color_warnings(
+ elem: ET.Element,
+ payload: dict[str, Any],
+ chart_data: dict[str, Any],
+) -> list[str]:
+ if chart_data.get("kind") != "chartex" or chart_data.get("type") not in {
+ "sunburst", "treemap",
+ }:
+ return []
+ values = chart_data.get("values")
+ if not isinstance(values, list) or not values:
+ return []
+ all_shapes = _fallback_shape_records(elem)
+ tile_shapes = [
+ record
+ for record in all_shapes
+ if (
+ record.fill is not None
+ and record.tag in {"path", "polygon", "rect"}
+ and _record_has_label(record, "tile", "sector", "segment", "slice")
+ and not _record_has_label(record, "legend")
+ )
+ ]
+ if len(tile_shapes) < len(values):
+ return []
+ fallback_colors = [record.fill for record in tile_shapes[:len(values)]]
+ style = payload.get("style") if isinstance(payload.get("style"), dict) else {}
+ raw_colors = _first_present(style.get("colors"), payload.get("colors"))
+ payload_colors = (
+ [_clean_hex(color, "#4472C4") for color in raw_colors]
+ if isinstance(raw_colors, list)
+ else []
+ )
+ if fallback_colors == payload_colors:
+ return []
+ return [
+ "Native PPTX ChartEx tile color sequence not projected: fallback has "
+ f"{len(fallback_colors)} colors, payload style.colors has "
+ f"{len(payload_colors)}"
+ ]
+
+
+def _chart_projection_text_variants(value: Any) -> set[str]:
+ text = _normalized_fallback_text(value)
+ variants = {text} if text else set()
+ numeric = _maybe_number(value)
+ if numeric is not None and numeric.is_integer():
+ variants.add(str(int(numeric)))
+ return variants
+
+
+def _chart_projected_texts(
+ payload: dict[str, Any],
+ chart_data: dict[str, Any],
+) -> set[str]:
+ projected: set[str] = set()
+
+ def add(value: Any) -> None:
+ if isinstance(value, dict):
+ for key, item in value.items():
+ if key in {
+ "categories", "levels", "name", "series", "sizes",
+ "values", "x", "y",
+ }:
+ add(item)
+ return
+ if isinstance(value, list):
+ for item in value:
+ add(item)
+ return
+ projected.update(_chart_projection_text_variants(value))
+
+ for key in ("categories", "levels", "plots", "series", "values"):
+ add(chart_data.get(key))
+ for field_name in ("title", "subtitle"):
+ text = _metadata_text(payload.get(field_name))
+ if text:
+ projected.add(text)
+ for value in _axis_titles(payload).values():
+ text = _metadata_text(value)
+ if text:
+ projected.add(text)
+ for item in _chart_companion_entries(
+ payload,
+ include_title=True,
+ include_subtitle_as_caption=True,
+ ):
+ projected.update(_chart_projection_text_variants(item.get("text")))
+
+ axes = chart_data.get("axes") if isinstance(chart_data.get("axes"), dict) else {}
+ for config in axes.values():
+ if not isinstance(config, dict):
+ continue
+ minimum = _maybe_number(config.get("minimum"))
+ maximum = _maybe_number(config.get("maximum"))
+ major_unit = _maybe_number(config.get("major_unit"))
+ if (
+ minimum is None
+ or maximum is None
+ or major_unit is None
+ or major_unit <= 0
+ ):
+ continue
+ value = minimum
+ for _ in range(1000):
+ if value > maximum + major_unit * 1e-6:
+ break
+ projected.update(_chart_projection_text_variants(value))
+ value += major_unit
+ return projected
+
+
+def _native_chart_reverse_text_warnings(
+ elem: ET.Element,
+ payload: dict[str, Any],
+ chart_data: dict[str, Any],
+) -> list[str]:
+ projected = _chart_projected_texts(payload, chart_data)
+ missing: list[str] = []
+ for record in _fallback_text_records(elem):
+ if _record_has_label(record, "legend"):
+ continue
+ if record.text not in projected and record.text not in missing:
+ missing.append(record.text)
+ if not missing:
+ return []
+ sample = ", ".join(repr(text) for text in missing[:8])
+ suffix = "" if len(missing) <= 8 else f", and {len(missing) - 8} more"
+ return [
+ "Native PPTX chart visible text not projected: "
+ f"{sample}{suffix}. Use categories/data labels/axis labels/legend or companion text."
+ ]
+
+
def _native_chart_chrome_warnings(elem: ET.Element, payload: dict[str, Any]) -> list[str]:
fallback_texts = set(_visible_fallback_texts(elem))
warnings: list[str] = []
@@ -648,11 +931,13 @@ def _native_chart_chrome_warnings(elem: ET.Element, payload: dict[str, Any]) ->
show_legend = payload.get("show_legend", style.get("show_legend", False))
if show_legend:
legend_texts = _legend_candidate_texts(payload)
- if legend_texts and not any(text in fallback_texts for text in legend_texts):
+ missing_legend = [
+ text for text in legend_texts if text not in fallback_texts
+ ]
+ for text in missing_legend:
warnings.append(
- "Native PPTX chart has show_legend=true, but no series/category "
- "legend text is visible inside the fallback marker. Add the "
- "fallback legend or remove show_legend."
+ "Native PPTX chart legend label is not visible inside the fallback "
+ f"marker: {text!r}. Add the expected label or remove show_legend."
)
companion_entries = _chart_companion_entries(
@@ -674,6 +959,12 @@ def _native_chart_chrome_warnings(elem: ET.Element, payload: dict[str, Any]) ->
f"{sample}{suffix}. "
"Keep companion metadata aligned with visible chart annotations."
)
+ warnings.extend(_native_chart_style_color_warnings(elem, payload))
+ chart_data = _chart_data(payload)
+ warnings.extend(_native_chart_point_color_warnings(elem, payload, chart_data))
+ warnings.extend(_native_chart_radial_warnings(elem, payload, chart_data))
+ warnings.extend(_native_chart_tile_color_warnings(elem, payload, chart_data))
+ warnings.extend(_native_chart_reverse_text_warnings(elem, payload, chart_data))
return warnings
diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chartex.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chartex.py
index e0577d88..36c8fcfd 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chartex.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chartex.py
@@ -114,8 +114,33 @@ def _chart_ex_data_xml(chart_data: dict[str, Any]) -> str:
raise RuntimeError(f"Native PPTX {chart_type} chart is outside current basic chart support")
-def _chart_ex_series_xml(chart_data: dict[str, Any]) -> str:
+def _chart_ex_title_text(payload: dict[str, Any]) -> str | None:
+ raw_title = payload.get("title")
+ if isinstance(raw_title, dict):
+ raw_title = raw_title.get("text")
+ if raw_title is None:
+ return None
+ title = str(raw_title).strip()
+ return title or None
+
+
+def _chart_ex_series_name(
+ payload: dict[str, Any],
+ chart_data: dict[str, Any],
+) -> str:
+ return str(
+ _chart_ex_title_text(payload)
+ or payload.get("name")
+ or chart_data["type"].replace("_", " ").title()
+ )
+
+
+def _chart_ex_series_xml(
+ payload: dict[str, Any],
+ chart_data: dict[str, Any],
+) -> str:
chart_type = chart_data["type"]
+ series_name = _xml_escape(_chart_ex_series_name(payload, chart_data))
if chart_type in {"sunburst", "treemap"}:
layout_id = chart_type
label_pos = "ctr" if chart_type == "sunburst" else "inEnd"
@@ -129,7 +154,7 @@ def _chart_ex_series_xml(chart_data: dict[str, Any]) -> str:
)
return (
f'<cx:series layoutId="{layout_id}" uniqueId="{{00000000-0000-4000-8000-000000000001}}">'
- '<cx:tx><cx:txData><cx:f>Sheet1!$A$1</cx:f><cx:v>Series 1</cx:v></cx:txData></cx:tx>'
+ f'<cx:tx><cx:txData><cx:f>Sheet1!$A$1</cx:f><cx:v>{series_name}</cx:v></cx:txData></cx:tx>'
f'<cx:dataLabels pos="{label_pos}"><cx:visibility seriesName="0" categoryName="1" value="1"/></cx:dataLabels>'
'<cx:dataId val="0"/>'
f"{layout_pr}"
@@ -138,14 +163,14 @@ def _chart_ex_series_xml(chart_data: dict[str, Any]) -> str:
if chart_type == "histogram":
return (
'<cx:series layoutId="clusteredColumn" uniqueId="{00000000-0000-4000-8000-000000000001}">'
- '<cx:tx><cx:txData><cx:f>Sheet1!$A$1</cx:f><cx:v>Series 1</cx:v></cx:txData></cx:tx>'
+ f'<cx:tx><cx:txData><cx:f>Sheet1!$A$1</cx:f><cx:v>{series_name}</cx:v></cx:txData></cx:tx>'
'<cx:dataId val="0"/><cx:layoutPr><cx:binning intervalClosed="r"/></cx:layoutPr>'
"</cx:series>"
)
if chart_type == "pareto":
return (
'<cx:series layoutId="clusteredColumn" uniqueId="{00000000-0000-4000-8000-000000000001}">'
- '<cx:tx><cx:txData><cx:f>Sheet1!$B$1</cx:f><cx:v>Series 1</cx:v></cx:txData></cx:tx>'
+ f'<cx:tx><cx:txData><cx:f>Sheet1!$B$1</cx:f><cx:v>{series_name}</cx:v></cx:txData></cx:tx>'
'<cx:dataId val="0"/><cx:layoutPr><cx:aggregation/></cx:layoutPr>'
'<cx:axisId val="1"/></cx:series>'
'<cx:series layoutId="paretoLine" ownerIdx="0" uniqueId="{00000000-0000-4000-8000-000000000002}">'
@@ -158,7 +183,7 @@ def _chart_ex_series_xml(chart_data: dict[str, Any]) -> str:
subtotals_xml = f"<cx:subtotals>{subtotal_items}</cx:subtotals>"
return (
'<cx:series layoutId="waterfall" uniqueId="{00000000-0000-4000-8000-000000000001}">'
- '<cx:tx><cx:txData><cx:f>Sheet1!$B$1</cx:f><cx:v>Series 1</cx:v></cx:txData></cx:tx>'
+ f'<cx:tx><cx:txData><cx:f>Sheet1!$B$1</cx:f><cx:v>{series_name}</cx:v></cx:txData></cx:tx>'
'<cx:dataLabels pos="outEnd"><cx:visibility seriesName="0" categoryName="0" value="1"/></cx:dataLabels>'
f'<cx:dataId val="0"/><cx:layoutPr>{subtotals_xml}</cx:layoutPr>'
"</cx:series>"
@@ -166,7 +191,7 @@ def _chart_ex_series_xml(chart_data: dict[str, Any]) -> str:
if chart_type == "funnel":
return (
'<cx:series layoutId="funnel" uniqueId="{00000000-0000-4000-8000-000000000001}">'
- '<cx:tx><cx:txData><cx:f>Sheet1!$B$1</cx:f><cx:v>Series 1</cx:v></cx:txData></cx:tx>'
+ f'<cx:tx><cx:txData><cx:f>Sheet1!$B$1</cx:f><cx:v>{series_name}</cx:v></cx:txData></cx:tx>'
'<cx:dataLabels><cx:visibility seriesName="0" categoryName="0" value="1"/></cx:dataLabels>'
'<cx:dataId val="0"/></cx:series>'
)
@@ -214,14 +239,21 @@ def _chart_ex_xml(
chart_rels_id: str,
) -> bytes:
data_xml = _chart_ex_data_xml(chart_data)
- series_xml = _chart_ex_series_xml(chart_data)
+ series_xml = _chart_ex_series_xml(payload, chart_data)
axes_xml = _chart_ex_axes_xml(chart_data)
+ title = _chart_ex_title_text(payload)
+ title_xml = (
+ '<cx:title pos="t" align="ctr" overlay="0">'
+ f'<cx:tx><cx:txData><cx:v>{_xml_escape(title)}</cx:v>'
+ '</cx:txData></cx:tx></cx:title>'
+ if title is not None else ""
+ )
xml = f'''<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cx:chartSpace xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
xmlns:cx="{CHARTEX_URI}">
<cx:chartData><cx:externalData r:id="{chart_rels_id}" cx:autoUpdate="0"/>{data_xml}</cx:chartData>
-<cx:chart><cx:title pos="t" align="ctr" overlay="0"/>
+<cx:chart>{title_xml}
<cx:plotArea><cx:plotAreaRegion>{series_xml}</cx:plotAreaRegion>{axes_xml}</cx:plotArea>
{_chart_ex_legend_xml(payload)}</cx:chart>
</cx:chartSpace>'''
diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.py
index db3c90ac..a5424d4e 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.py
@@ -6,6 +6,7 @@ import json
import math
import re
from collections.abc import Iterable
+from dataclasses import dataclass
from typing import Any
from xml.etree import ElementTree as ET
@@ -78,6 +79,26 @@ _CSS_NAMED_COLORS = {
}
+@dataclass(frozen=True)
+class _FallbackShapeRecord:
+ tag: str
+ bounds: tuple[float, float, float, float]
+ fill: str | None
+ stroke: str | None
+ labels: tuple[str, ...]
+
+
+@dataclass(frozen=True)
+class _FallbackTextRecord:
+ text: str
+ x: float | None
+ y: float | None
+ fill: str | None
+ bold: bool
+ anchor: str
+ labels: tuple[str, ...]
+
+
def _local_tag(elem: ET.Element) -> str:
return elem.tag.rsplit("}", 1)[-1] if "}" in elem.tag else elem.tag
@@ -497,6 +518,185 @@ def _inferred_bounds(elem: ET.Element) -> tuple[float, float, float, float] | No
return bbox
+def _fallback_element_labels(elem: ET.Element) -> tuple[str, ...]:
+ labels: list[str] = []
+ for attribute in ("id", "class", "data-name"):
+ raw = elem.get(attribute)
+ if raw:
+ labels.append(str(raw).strip().lower())
+ return tuple(labels)
+
+
+def _fallback_shape_records(
+ elem: ET.Element,
+ matrix: tuple[float, float, float, float, float, float] = IDENTITY_MATRIX,
+ inherited_fill: str | None = "000000",
+ inherited_stroke: str | None = None,
+ inherited_labels: tuple[str, ...] = (),
+) -> list[_FallbackShapeRecord]:
+ """Collect visible painted fallback geometry with resolved bounds and ancestry."""
+ tag = _local_tag(elem)
+ if tag == "metadata" or tag in {"defs", "clipPath", "mask", "filter", "style"}:
+ return []
+ if (
+ _style_attr(elem, "display") == "none"
+ or _style_attr(elem, "visibility") == "hidden"
+ ):
+ return []
+
+ local_matrix = matrix
+ transform = elem.get("transform")
+ if transform:
+ local_matrix = matrix_multiply(matrix, parse_transform_matrix(transform))
+
+ own_fill = _style_attr(elem, "fill")
+ own_stroke = _style_attr(elem, "stroke")
+ fill = own_fill if own_fill is not None else inherited_fill
+ stroke = own_stroke if own_stroke is not None else inherited_stroke
+ labels = inherited_labels + _fallback_element_labels(elem)
+
+ records: list[_FallbackShapeRecord] = []
+ if tag in {
+ "circle", "ellipse", "line", "path", "polygon", "polyline", "rect",
+ }:
+ fill_color = (
+ _hex_or_none(fill)
+ if fill and _paint_visible(elem, "fill") and tag != "line"
+ else None
+ )
+ stroke_color = (
+ _hex_or_none(stroke)
+ if stroke and _paint_visible(elem, "stroke")
+ else None
+ )
+ if fill_color is not None or stroke_color is not None:
+ local_bbox = _element_local_bbox(elem)
+ if local_bbox is not None:
+ records.append(
+ _FallbackShapeRecord(
+ tag=tag,
+ bounds=_apply_matrix_bbox(local_bbox, local_matrix),
+ fill=fill_color,
+ stroke=stroke_color,
+ labels=labels,
+ )
+ )
+
+ for child in elem:
+ records.extend(
+ _fallback_shape_records(
+ child,
+ local_matrix,
+ fill,
+ stroke,
+ labels,
+ )
+ )
+ return records
+
+
+def _fallback_text_records(
+ elem: ET.Element,
+ matrix: tuple[float, float, float, float, float, float] = IDENTITY_MATRIX,
+ inherited_fill: str | None = "000000",
+ inherited_weight: str | None = None,
+ inherited_anchor: str | None = None,
+ inherited_labels: tuple[str, ...] = (),
+) -> list[_FallbackTextRecord]:
+ """Collect visible fallback text with resolved paint, emphasis, and anchor."""
+ tag = _local_tag(elem)
+ if tag == "metadata" or tag in {"defs", "clipPath", "mask", "filter", "style"}:
+ return []
+ if (
+ _style_attr(elem, "display") == "none"
+ or _style_attr(elem, "visibility") == "hidden"
+ ):
+ return []
+
+ local_matrix = matrix
+ transform = elem.get("transform")
+ if transform:
+ local_matrix = matrix_multiply(matrix, parse_transform_matrix(transform))
+
+ own_fill = _style_attr(elem, "fill")
+ own_weight = _style_attr(elem, "font-weight")
+ own_anchor = _style_attr(elem, "text-anchor")
+ fill = own_fill if own_fill is not None else inherited_fill
+ weight = own_weight if own_weight is not None else inherited_weight
+ anchor = own_anchor if own_anchor is not None else inherited_anchor
+ labels = inherited_labels + _fallback_element_labels(elem)
+
+ if tag == "text":
+ text = _normalized_fallback_text("".join(elem.itertext()))
+ if not text:
+ return []
+ x = _project_geometry_number(elem, "x") if elem.get("x") is not None else None
+ y = _project_geometry_number(elem, "y") if elem.get("y") is not None else None
+ if x is not None and y is not None:
+ x, y = transform_point(local_matrix, x, y)
+ raw_weight = str(weight or "").strip().lower()
+ numeric_weight = _maybe_number(raw_weight)
+ bold = raw_weight in {"bold", "bolder"} or (
+ numeric_weight is not None and numeric_weight >= 600
+ )
+ return [
+ _FallbackTextRecord(
+ text=text,
+ x=x,
+ y=y,
+ fill=_hex_or_none(fill),
+ bold=bold,
+ anchor=str(anchor or "start").strip().lower(),
+ labels=labels,
+ )
+ ]
+
+ records: list[_FallbackTextRecord] = []
+ for child in elem:
+ records.extend(
+ _fallback_text_records(
+ child,
+ local_matrix,
+ fill,
+ weight,
+ anchor,
+ labels,
+ )
+ )
+ return records
+
+
+def _fallback_concentric_circle_radii(elem: ET.Element) -> list[float]:
+ """Return the largest countable set of concentric circular grid radii."""
+ groups: list[tuple[float, float, list[float]]] = []
+ for record in _fallback_shape_records(elem):
+ if record.tag != "circle" or record.stroke is None:
+ continue
+ x1, y1, x2, y2 = record.bounds
+ radius_x = (x2 - x1) / 2
+ radius_y = (y2 - y1) / 2
+ if radius_x <= 0 or abs(radius_x - radius_y) > 1:
+ continue
+ center_x = (x1 + x2) / 2
+ center_y = (y1 + y2) / 2
+ group = next(
+ (
+ item
+ for item in groups
+ if abs(item[0] - center_x) <= 1 and abs(item[1] - center_y) <= 1
+ ),
+ None,
+ )
+ if group is None:
+ group = (center_x, center_y, [])
+ groups.append(group)
+ group[2].append(radius_x)
+ if not groups:
+ return []
+ radii = max(groups, key=lambda item: len(item[2]))[2]
+ return sorted({round(radius, 3) for radius in radii})
+
+
def _fallback_fill_candidates(
elem: ET.Element,
matrix: tuple[float, float, float, float, float, float] = IDENTITY_MATRIX,
diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/table.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/table.py
index 74ddfc35..b82c1b63 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/table.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/table.py
@@ -25,9 +25,12 @@ from .marker_common import (
_bool_attr,
_bounds,
_clean_hex,
+ _fallback_shape_records,
+ _fallback_text_records,
_first_present,
_font_size_hpt,
_hex_or_none,
+ _maybe_number,
_normalized_fallback_text,
_number,
_powerpoint_emu,
@@ -674,26 +677,585 @@ def _native_table_metadata_texts(table_rows: list[list[Any]]) -> dict[str, int]:
return counts
-def _native_table_warnings(elem: ET.Element, table_rows: list[list[Any]]) -> list[str]:
- fallback_texts = _visible_fallback_texts(elem)
- if not fallback_texts:
+def _table_fallback_frame(
+ elem: ET.Element,
+ payload: dict[str, Any],
+) -> tuple[float, float, float, float] | None:
+ values = tuple(_maybe_number(payload.get(key)) for key in ("x", "y", "width", "height"))
+ if all(value is not None for value in values):
+ x, y, width, height = values
+ assert x is not None and y is not None and width is not None and height is not None
+ if width > 0 and height > 0:
+ return x, y, width, height
+
+ raw_bounds = elem.get("data-pptx-bounds")
+ if raw_bounds:
+ parts = [_maybe_number(value) for value in raw_bounds.replace(",", " ").split()]
+ if len(parts) == 4 and all(value is not None for value in parts):
+ x, y, width, height = parts
+ assert x is not None and y is not None and width is not None and height is not None
+ if width > 0 and height > 0:
+ return x, y, width, height
+ return None
+
+
+def _dedupe_table_edges(values: list[float], tolerance: float = 2.0) -> list[float]:
+ edges: list[float] = []
+ for value in sorted(values):
+ if edges and abs(edges[-1] - value) <= tolerance:
+ edges[-1] = (edges[-1] + value) / 2
+ else:
+ edges.append(value)
+ return edges
+
+
+def _table_fallback_grid(
+ elem: ET.Element,
+ payload: dict[str, Any],
+ table_rows: list[list[Any]],
+) -> tuple[list[float], list[float], list[Any], list[Any]] | None:
+ frame = _table_fallback_frame(elem, payload)
+ if frame is None or not table_rows:
+ return None
+ x, y, width, height = frame
+ col_count = max(len(row) for row in table_rows)
+ raw_widths = payload.get("column_widths")
+ weights = (
+ [_number(value, "table fallback column width") for value in raw_widths]
+ if isinstance(raw_widths, list) and len(raw_widths) == col_count
+ else [1.0] * col_count
+ )
+ weight_total = sum(weights)
+ if weight_total <= 0:
+ return None
+ payload_column_edges = [x]
+ for weight in weights:
+ payload_column_edges.append(
+ payload_column_edges[-1] + width * weight / weight_total
+ )
+
+ shape_records = _fallback_shape_records(elem)
+ vertical_candidates = [x, x + width]
+ for record in shape_records:
+ x1, y1, x2, y2 = record.bounds
+ if (
+ record.tag == "line"
+ and record.stroke is not None
+ and abs(x2 - x1) <= 1
+ and y2 - y1 >= height * 0.5
+ ):
+ vertical_candidates.append((x1 + x2) / 2)
+ fallback_column_edges = _dedupe_table_edges(vertical_candidates)
+ column_edges = (
+ fallback_column_edges
+ if len(fallback_column_edges) == col_count + 1
+ else payload_column_edges
+ )
+
+ row_candidates: list[float] = []
+ for record in shape_records:
+ x1, y1, x2, y2 = record.bounds
+ if record.tag == "rect" and record.fill is not None and x2 - x1 >= width * 0.85:
+ if x1 <= x + width * 0.1 and x2 >= x + width * 0.9:
+ row_candidates.extend((y1, y2))
+ elif (
+ record.tag == "line"
+ and record.stroke is not None
+ and abs(y2 - y1) <= 1
+ and x2 - x1 >= width * 0.75
+ ):
+ row_candidates.append((y1 + y2) / 2)
+ row_candidates = [
+ value
+ for value in row_candidates
+ if y - 5 <= value <= y + height + 5
+ ]
+ row_edges = _dedupe_table_edges(row_candidates)
+ expected_count = len(table_rows) + 1
+ if len(row_edges) < expected_count:
+ row_edges = _dedupe_table_edges(row_edges + [y, y + height])
+ if len(row_edges) != expected_count:
+ return None
+ return column_edges, row_edges, shape_records, _fallback_text_records(elem)
+
+
+def _table_cell_at(
+ x: float | None,
+ y: float | None,
+ column_edges: list[float],
+ row_edges: list[float],
+) -> tuple[int, int] | None:
+ if x is None or y is None:
+ return None
+ col_idx = next(
+ (
+ idx
+ for idx in range(len(column_edges) - 1)
+ if column_edges[idx] - 1 <= x <= column_edges[idx + 1] + 1
+ ),
+ None,
+ )
+ row_idx = next(
+ (
+ idx
+ for idx in range(len(row_edges) - 1)
+ if row_edges[idx] - 1 <= y <= row_edges[idx + 1] + 1
+ ),
+ None,
+ )
+ if row_idx is None or col_idx is None:
+ return None
+ return row_idx, col_idx
+
+
+def _table_cell_texts(cell: Any) -> set[str]:
+ cell_data = _cell_payload(cell)
+ paragraphs = _table_cell_paragraphs(cell_data)
+ values = (
+ [paragraph.text for paragraph in paragraphs]
+ if paragraphs is not None
+ else [cell_data.get("text")]
+ )
+ normalized = [
+ _normalized_fallback_text(value)
+ for value in values
+ if value is not None
+ ]
+ texts = {text for text in normalized if text}
+ if len(texts) > 1:
+ texts.add(_normalized_fallback_text(" ".join(normalized)))
+ return texts
+
+
+def _table_text_cells(
+ text_records: list[Any],
+ table_rows: list[list[Any]],
+ column_edges: list[float],
+ row_edges: list[float],
+) -> list[tuple[Any, int, int]]:
+ records: list[tuple[Any, int, int]] = []
+ for record in text_records:
+ position = _table_cell_at(record.x, record.y, column_edges, row_edges)
+ if position is None:
+ continue
+ row_idx, col_idx = position
+ if row_idx >= len(table_rows) or col_idx >= len(table_rows[row_idx]):
+ continue
+ if record.text not in _table_cell_texts(table_rows[row_idx][col_idx]):
+ continue
+ records.append((record, row_idx, col_idx))
+ return records
+
+
+def _fallback_table_alignment(anchor: str) -> str:
+ return {
+ "middle": "ctr",
+ "end": "r",
+ "right": "r",
+ }.get(anchor, "l")
+
+
+def _native_table_header_warnings(
+ payload: dict[str, Any],
+ table_rows: list[list[Any]],
+ column_edges: list[float],
+ row_edges: list[float],
+ shape_records: list[Any],
+ text_cells: list[tuple[Any, int, int]],
+) -> list[str]:
+ header_rows = _table_header_rows(payload, len(table_rows))
+ if header_rows <= 0:
+ return []
+ style = payload.get("style") if isinstance(payload.get("style"), dict) else {}
+ header_text_cells = [item for item in text_cells if item[1] < header_rows]
+ if not header_text_cells:
+ return []
+
+ missing: list[str] = []
+ table_left, table_right = column_edges[0], column_edges[-1]
+ header_top, header_bottom = row_edges[0], row_edges[header_rows]
+ header_fill = next(
+ (
+ record.fill
+ for record in sorted(
+ shape_records,
+ key=lambda item: (item.bounds[2] - item.bounds[0]) * (item.bounds[3] - item.bounds[1]),
+ reverse=True,
+ )
+ if (
+ record.tag == "rect"
+ and record.fill is not None
+ and record.bounds[0] <= table_left + 3
+ and record.bounds[2] >= table_right - 3
+ and record.bounds[1] <= header_top + 3
+ and record.bounds[3] >= header_bottom - 3
+ )
+ ),
+ None,
+ )
+ if header_fill is not None and style.get("header_fill") is None:
+ if not all(
+ _hex_or_none(_cell_payload(cell).get("fill")) == header_fill
+ for row in table_rows[:header_rows]
+ for cell in row
+ ):
+ missing.append("style.header_fill")
+
+ header_colors = [record.fill for record, _, _ in header_text_cells if record.fill]
+ header_text_color = max(set(header_colors), key=header_colors.count) if header_colors else None
+ if header_text_color is not None and style.get("header_text") is None:
+ if not all(
+ _hex_or_none(_cell_payload(table_rows[row_idx][col_idx]).get("color"))
+ == record.fill
+ for record, row_idx, col_idx in header_text_cells
+ if record.fill is not None
+ ):
+ missing.append("style.header_text")
+
+ if any(
+ record.bold
+ and _cell_payload(table_rows[row_idx][col_idx]).get("bold") is not True
+ for record, row_idx, col_idx in header_text_cells
+ ):
+ missing.append("columns[].bold")
+ if any(
+ _cell_payload(table_rows[row_idx][col_idx]).get("align")
+ != _fallback_table_alignment(record.anchor)
+ for record, row_idx, col_idx in header_text_cells
+ ):
+ missing.append("columns[].align")
+ if not missing:
+ return []
+ return [
+ "Native PPTX table header style not projected from fallback: "
+ + ", ".join(missing)
+ ]
+
+
+def _native_table_fill_warnings(
+ table_rows: list[list[Any]],
+ header_rows: int,
+ column_edges: list[float],
+ row_edges: list[float],
+ shape_records: list[Any],
+) -> list[str]:
+ warnings: list[str] = []
+ col_count = len(column_edges) - 1
+ row_count = len(row_edges) - 1
+
+ def edge_index(value: float, edges: list[float]) -> int | None:
+ return next(
+ (idx for idx, edge in enumerate(edges) if abs(edge - value) <= 3),
+ None,
+ )
+
+ seen: set[tuple[str, int, int, str]] = set()
+ for record in shape_records:
+ if record.tag != "rect" or record.fill in {None, "FFFFFF"}:
+ continue
+ x1, y1, x2, y2 = record.bounds
+ start_col = edge_index(x1, column_edges)
+ end_col = edge_index(x2, column_edges)
+ start_row = edge_index(y1, row_edges)
+ end_row = edge_index(y2, row_edges)
+ if None in {start_col, end_col, start_row, end_row}:
+ continue
+ assert start_col is not None and end_col is not None
+ assert start_row is not None and end_row is not None
+ if end_col <= start_col or end_row <= start_row:
+ continue
+
+ label: tuple[str, int, int, str] | None = None
+ targets: list[tuple[int, int]] = []
+ if start_col == 0 and end_col == col_count and start_row >= header_rows:
+ label = ("row", start_row, end_row, record.fill)
+ targets = [
+ (row_idx, col_idx)
+ for row_idx in range(start_row, end_row)
+ for col_idx in range(col_count)
+ ]
+ elif (
+ start_row <= header_rows
+ and end_row == row_count
+ and end_col - start_col < col_count
+ ):
+ body_start = max(start_row, header_rows)
+ label = ("column", start_col, end_col, record.fill)
+ targets = [
+ (row_idx, col_idx)
+ for row_idx in range(body_start, end_row)
+ for col_idx in range(start_col, end_col)
+ ]
+ if label is None or label in seen or not targets:
+ continue
+ seen.add(label)
+ if all(
+ _hex_or_none(_cell_payload(table_rows[row_idx][col_idx]).get("fill"))
+ == record.fill
+ for row_idx, col_idx in targets
+ ):
+ continue
+ axis, start, end, color = label
+ human_start = start + 1
+ human_end = end
+ span = str(human_start) if human_start == human_end else f"{human_start}-{human_end}"
+ warnings.append(
+ f"Native PPTX table whole {axis} {span} fill #{color} is not projected to cell fill"
+ )
+ return warnings
+
+
+def _native_table_first_column_warnings(
+ table_rows: list[list[Any]],
+ header_rows: int,
+ text_cells: list[tuple[Any, int, int]],
+) -> list[str]:
+ body_records = [item for item in text_cells if item[1] >= header_rows]
+ first_column = [item for item in body_records if item[2] == 0]
+ if not first_column:
return []
- metadata_counts = _native_table_metadata_texts(table_rows)
+ body_colors = [
+ record.fill
+ for record, _, col_idx in body_records
+ if col_idx != 0 and record.fill
+ ]
+ body_color = max(set(body_colors), key=body_colors.count) if body_colors else None
missing: list[str] = []
- seen_counts: dict[str, int] = {}
- for text in fallback_texts:
- seen_counts[text] = seen_counts.get(text, 0) + 1
- if seen_counts[text] > metadata_counts.get(text, 0):
- missing.append(text)
+ if any(
+ record.bold
+ and _cell_payload(table_rows[row_idx][col_idx]).get("bold") is not True
+ for record, row_idx, col_idx in first_column
+ ):
+ missing.append("bold")
+ missing_colors = sorted({
+ record.fill
+ for record, row_idx, col_idx in first_column
+ if (
+ record.fill is not None
+ and record.fill != body_color
+ and _hex_or_none(_cell_payload(table_rows[row_idx][col_idx]).get("color"))
+ != record.fill
+ )
+ })
+ if missing_colors:
+ missing.append("color " + "/".join(f"#{color}" for color in missing_colors))
if not missing:
return []
+ return [
+ "Native PPTX table first-column text style not projected from fallback: "
+ + ", ".join(missing)
+ ]
+
+
+def _native_table_inset_graphic_warnings(
+ table_rows: list[list[Any]],
+ header_rows: int,
+ column_edges: list[float],
+ row_edges: list[float],
+ shape_records: list[Any],
+ text_cells: list[tuple[Any, int, int]],
+) -> list[str]:
+ for record in shape_records:
+ if record.tag != "rect" or record.fill in {None, "FFFFFF"}:
+ continue
+ x1, y1, x2, y2 = record.bounds
+ for row_idx in range(header_rows, len(row_edges) - 1):
+ for col_idx in range(len(column_edges) - 1):
+ cell_x1, cell_x2 = column_edges[col_idx], column_edges[col_idx + 1]
+ cell_y1, cell_y2 = row_edges[row_idx], row_edges[row_idx + 1]
+ cell_width = cell_x2 - cell_x1
+ cell_height = cell_y2 - cell_y1
+ if not (
+ x1 > cell_x1 + max(1, cell_width * 0.02)
+ and x2 < cell_x2 - max(1, cell_width * 0.02)
+ and y1 > cell_y1 + max(1, cell_height * 0.02)
+ and y2 < cell_y2 - max(1, cell_height * 0.02)
+ and x2 - x1 <= cell_width * 0.9
+ and y2 - y1 <= cell_height * 0.9
+ ):
+ continue
+ has_text = any(
+ text_row == row_idx
+ and text_col == col_idx
+ and text_record.x is not None
+ and text_record.y is not None
+ and x1 <= text_record.x <= x2
+ and y1 <= text_record.y <= y2
+ for text_record, text_row, text_col in text_cells
+ )
+ if has_text:
+ return [
+ "Native PPTX table contains an inset graphical cell with text; "
+ "the a:tbl schema cannot express it and the object should be Native-ready=no"
+ ]
+ return []
+
+
+def _native_table_border_topology_warnings(
+ payload: dict[str, Any],
+ table_rows: list[list[Any]],
+ column_edges: list[float],
+ row_edges: list[float],
+ shape_records: list[Any],
+) -> list[str]:
+ style = payload.get("style") if isinstance(payload.get("style"), dict) else {}
+ cells = [_cell_payload(cell) for row in table_rows for cell in row]
+ per_side = any(
+ isinstance(cell.get("borders"), dict)
+ and any(
+ side in cell["borders"]
+ for side in ("left", "right", "top", "bottom")
+ )
+ for cell in cells
+ )
+ style_width = _maybe_number(style.get("border_width"))
+ style_uniform = style.get("border_color") is not None or (
+ style_width is not None and style_width > 0
+ )
+ cell_uniform = any(
+ cell.get("border_color") is not None
+ or (_maybe_number(cell.get("border_width")) or 0) > 0
+ for cell in cells
+ )
+ if per_side or not (style_uniform or cell_uniform):
+ return []
- sample = ", ".join(repr(text) for text in missing[:5])
- suffix = "" if len(missing) <= 5 else f", and {len(missing) - 5} more"
+ covered: set[tuple[str, int, int]] = set()
+ row_count = len(row_edges) - 1
+ col_count = len(column_edges) - 1
+ for record in shape_records:
+ if record.tag != "line" or record.stroke is None:
+ continue
+ x1, y1, x2, y2 = record.bounds
+ if abs(y2 - y1) <= 1:
+ boundary = next(
+ (idx for idx, edge in enumerate(row_edges) if abs(edge - y1) <= 2),
+ None,
+ )
+ if boundary is None:
+ continue
+ for col_idx in range(col_count):
+ if x1 <= column_edges[col_idx] + 2 and x2 >= column_edges[col_idx + 1] - 2:
+ covered.add(("h", boundary, col_idx))
+ elif abs(x2 - x1) <= 1:
+ boundary = next(
+ (idx for idx, edge in enumerate(column_edges) if abs(edge - x1) <= 2),
+ None,
+ )
+ if boundary is None:
+ continue
+ for row_idx in range(row_count):
+ if y1 <= row_edges[row_idx] + 2 and y2 >= row_edges[row_idx + 1] - 2:
+ covered.add(("v", boundary, row_idx))
+ full_count = (row_count + 1) * col_count + (col_count + 1) * row_count
+ if not covered or len(covered) >= full_count:
+ return []
return [
- "Native PPTX table fallback text is missing from metadata columns/rows "
- f"and will disappear with --native-charts-and-tables: {sample}{suffix}"
+ "Native PPTX table border topology not projected: fallback rules cover only "
+ f"{len(covered)} of {full_count} cardinal cell edges, but payload has only a uniform border"
+ ]
+
+
+def _native_table_warnings(
+ elem: ET.Element,
+ payload: dict[str, Any],
+ table_rows: list[list[Any]],
+) -> list[str]:
+ fallback_texts = _visible_fallback_texts(elem)
+ warnings: list[str] = []
+ if fallback_texts:
+ metadata_counts = _native_table_metadata_texts(table_rows)
+ missing: list[str] = []
+ seen_counts: dict[str, int] = {}
+ for text in fallback_texts:
+ seen_counts[text] = seen_counts.get(text, 0) + 1
+ if seen_counts[text] > metadata_counts.get(text, 0):
+ missing.append(text)
+ if missing:
+ sample = ", ".join(repr(text) for text in missing[:5])
+ suffix = "" if len(missing) <= 5 else f", and {len(missing) - 5} more"
+ warnings.append(
+ "Native PPTX table fallback text is missing from metadata columns/rows "
+ f"and will disappear with --native-charts-and-tables: {sample}{suffix}"
+ )
+
+ grid = _table_fallback_grid(elem, payload, table_rows)
+ if grid is None:
+ return warnings
+ column_edges, row_edges, shape_records, text_records = grid
+ text_cells = _table_text_cells(
+ text_records,
+ table_rows,
+ column_edges,
+ row_edges,
+ )
+ fallback_heights = [
+ row_edges[idx + 1] - row_edges[idx]
+ for idx in range(len(row_edges) - 1)
]
+ non_uniform = (
+ max(fallback_heights) - min(fallback_heights)
+ > max(1.0, max(fallback_heights) * 0.02)
+ )
+ raw_heights = payload.get("row_heights")
+ payload_uniform = not isinstance(raw_heights, list) or not raw_heights or (
+ max(_number(value, "table row height") for value in raw_heights)
+ - min(_number(value, "table row height") for value in raw_heights)
+ <= 1e-6
+ )
+ if non_uniform and payload_uniform:
+ warnings.append(
+ "Native PPTX table fallback row heights are non-uniform, but payload "
+ "row_heights is missing or uniform"
+ )
+
+ header_rows = _table_header_rows(payload, len(table_rows))
+ warnings.extend(
+ _native_table_header_warnings(
+ payload,
+ table_rows,
+ column_edges,
+ row_edges,
+ shape_records,
+ text_cells,
+ )
+ )
+ warnings.extend(
+ _native_table_fill_warnings(
+ table_rows,
+ header_rows,
+ column_edges,
+ row_edges,
+ shape_records,
+ )
+ )
+ warnings.extend(
+ _native_table_first_column_warnings(
+ table_rows,
+ header_rows,
+ text_cells,
+ )
+ )
+ warnings.extend(
+ _native_table_border_topology_warnings(
+ payload,
+ table_rows,
+ column_edges,
+ row_edges,
+ shape_records,
+ )
+ )
+ warnings.extend(
+ _native_table_inset_graphic_warnings(
+ table_rows,
+ header_rows,
+ column_edges,
+ row_edges,
+ shape_records,
+ text_cells,
+ )
+ )
+ return warnings
def _weighted_lengths(
@@ -947,7 +1509,8 @@ def _table_border_specs(
side: (
_table_border_override(border_overrides[side], side)
if side in border_overrides
- else legacy_spec
+ else legacy_spec if side in {"left", "right", "top", "bottom"}
+ else None
)
for side in _TABLE_BORDER_SIDES
}
diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py
index f660b462..94f761ef 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py
@@ -84,6 +84,7 @@ from .discovery import NotesFileReadError, find_notes_files, find_svg_files
from .builder import RoundtripSlidePatch, create_pptx_with_native_svg
from ..native_objects import (
native_fallback_kind,
+ native_object_projection_warnings,
native_replacement_kind,
native_replacement_status,
)
@@ -1707,6 +1708,47 @@ def _native_object_fallbacks(svg_files: list[Path]) -> list[tuple[str, str, str]
return fallbacks
+def _native_object_projection_findings(
+ svg_files: list[Path],
+) -> list[tuple[str, str, str]]:
+ """Return SVG-first Chart/Table details that native metadata would discard."""
+ findings: list[tuple[str, str, str]] = []
+ for svg_path in svg_files:
+ try:
+ root = ET.parse(svg_path).getroot()
+ except (OSError, ET.ParseError):
+ continue
+ parent_map = {
+ child: parent
+ for parent in root.iter()
+ for child in parent
+ }
+ for elem in root.iter():
+ if elem.tag.rsplit('}', 1)[-1] == 'metadata':
+ continue
+ if native_replacement_kind(elem) not in {'chart', 'table'}:
+ continue
+ marker_id = elem.get('id') or elem.get('data-name') or '<unnamed>'
+ ancestors: list[ET.Element] = []
+ parent = parent_map.get(elem)
+ while parent is not None and parent is not root:
+ if parent.tag.rsplit('}', 1)[-1] == 'g':
+ ancestors.append(parent)
+ parent = parent_map.get(parent)
+ try:
+ warnings = native_object_projection_warnings(
+ elem,
+ ancestors=tuple(reversed(ancestors)),
+ )
+ except RuntimeError as exc:
+ warnings = [f"projection validation failed: {exc}"]
+ findings.extend(
+ (svg_path.name, marker_id, warning)
+ for warning in warnings
+ )
+ return findings
+
+
def _release_blocked_graphics(
svg_files: list[Path],
) -> list[tuple[str, str, str]]:
@@ -3063,6 +3105,25 @@ Recorded narration:
)
if args.native_objects:
+ projection_findings = _native_object_projection_findings(native_files)
+ if projection_findings:
+ print(
+ "Error: --native-charts-and-tables stopped because visible "
+ "SVG-first fallback details are not projected by marker metadata:",
+ file=sys.stderr,
+ )
+ for filename, marker_id, finding in projection_findings:
+ print(
+ f" {filename}: {marker_id}: {finding}",
+ file=sys.stderr,
+ )
+ print(
+ "Project every listed detail into the closed native payload, or "
+ "remove the active replacement marker and keep the object "
+ "Native-ready=no.",
+ file=sys.stderr,
+ )
+ return 1
print(
"Warning: --native-charts-and-tables replaces shape-based SVG fallbacks "
"with PowerPoint Chart/Table objects. The native objects may normalize "
diff --git a/skills/ppt-master/scripts/tests/fixtures/native_projection/06_1145_completion.svg b/skills/ppt-master/scripts/tests/fixtures/native_projection/06_1145_completion.svg
new file mode 100644
index 00000000..2083aa2e
--- /dev/null
+++ b/skills/ppt-master/scripts/tests/fixtures/native_projection/06_1145_completion.svg
@@ -0,0 +1,188 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 720">
+ <g id="fiveyear-target-vs-actual" data-pptx-replace-with="chart" data-pptx-bounds="96 246 724 336" data-pptx-fallback-sha256="431a9b3eb0f292c1e7309cd363fd09f863ff08b17dbd92168b782e7e19099764">
+ <metadata type="application/json">
+ {
+ "x": 96,
+ "y": 246,
+ "width": 724,
+ "height": 336,
+ "name": "fiveyear-target-vs-actual",
+ "type": "column",
+ "grouping": "clustered",
+ "categories": [
+ "2021",
+ "2022",
+ "2023",
+ "2024",
+ "2025"
+ ],
+ "series": [
+ {
+ "name": "目标",
+ "values": [
+ 341,
+ 210,
+ 175,
+ 329,
+ 356
+ ]
+ },
+ {
+ "name": "完成",
+ "values": [
+ 313.02,
+ 275.04,
+ 175.12,
+ 286.2,
+ 130.53
+ ]
+ }
+ ],
+ "show_legend": true,
+ "legend_position": "top",
+ "axes": {
+ "category": {
+ "kind": "text",
+ "position": "bottom"
+ },
+ "value": {
+ "kind": "value",
+ "position": "left",
+ "minimum": 0,
+ "maximum": 400,
+ "major_unit": 100,
+ "major_gridlines": true
+ }
+ },
+ "style": {
+ "colors": [
+ "#9FB6CE",
+ "#004EA1"
+ ],
+ "font_family": "Arial",
+ "axis_font_size": 18,
+ "legend_font_size": 18,
+ "chart_area_fill": "none",
+ "plot_area_fill": "none",
+ "text_color": "#1A1A1A",
+ "axis_color": "#DDE3E9",
+ "grid_color": "#DDE3E9"
+ },
+ "plot_area": {
+ "x": 140,
+ "y": 280,
+ "width": 670,
+ "height": 260
+ },
+ "notes": [
+ {
+ "text": "91.79%",
+ "x": 162,
+ "y": 292,
+ "width": 90,
+ "height": 24,
+ "font_size": 18,
+ "bold": true,
+ "align": "ctr",
+ "color": "#4A5568"
+ },
+ {
+ "text": "130.97%",
+ "x": 296,
+ "y": 335,
+ "width": 90,
+ "height": 24,
+ "font_size": 18,
+ "bold": true,
+ "align": "ctr",
+ "color": "#4A5568"
+ },
+ {
+ "text": "100.07%",
+ "x": 430,
+ "y": 400,
+ "width": 90,
+ "height": 24,
+ "font_size": 18,
+ "bold": true,
+ "align": "ctr",
+ "color": "#4A5568"
+ },
+ {
+ "text": "86.99%",
+ "x": 564,
+ "y": 300,
+ "width": 90,
+ "height": 24,
+ "font_size": 18,
+ "bold": true,
+ "align": "ctr",
+ "color": "#4A5568"
+ },
+ {
+ "text": "36.67%",
+ "x": 698,
+ "y": 282,
+ "width": 90,
+ "height": 24,
+ "font_size": 18,
+ "bold": true,
+ "align": "ctr",
+ "color": "#C90A4F"
+ }
+ ]
+ }
+ </metadata>
+ <g id="fiveyear-target-vs-actual-legend" font-family="Arial, &quot;Microsoft YaHei&quot;, sans-serif" font-size="18" fill="#4A5568">
+ <rect x="560" y="262" width="24" height="12" fill="#9FB6CE" />
+ <text x="592" y="274">目标</text>
+ <rect x="656" y="262" width="24" height="12" fill="#004EA1" />
+ <text x="688" y="274">完成</text>
+ </g>
+ <g id="fiveyear-target-vs-actual-chartArea">
+ <g id="fiveyear-target-vs-actual-grid" stroke="#DDE3E9" stroke-width="1">
+ <line x1="140" y1="280" x2="810" y2="280" />
+ <line x1="140" y1="345" x2="810" y2="345" />
+ <line x1="140" y1="410" x2="810" y2="410" />
+ <line x1="140" y1="475" x2="810" y2="475" />
+ <line x1="140" y1="540" x2="810" y2="540" stroke="#9FB6CE" />
+ <line x1="140" y1="280" x2="140" y2="540" />
+ </g>
+ <g id="fiveyear-target-vs-actual-yaxis" font-family="Arial, sans-serif" font-size="18" text-anchor="end" fill="#4A5568">
+ <text x="132" y="286">400</text>
+ <text x="132" y="351">300</text>
+ <text x="132" y="416">200</text>
+ <text x="132" y="481">100</text>
+ <text x="132" y="546">0</text>
+ </g>
+ <g id="fiveyear-target-vs-actual-bars-target" fill="#9FB6CE">
+ <rect x="157" y="318.35" width="44" height="221.65" />
+ <rect x="291" y="403.5" width="44" height="136.5" />
+ <rect x="425" y="426.25" width="44" height="113.75" />
+ <rect x="559" y="326.15" width="44" height="213.85" />
+ <rect x="693" y="308.6" width="44" height="231.4" />
+ </g>
+ <g id="fiveyear-target-vs-actual-bars-actual" fill="#004EA1">
+ <rect x="213" y="336.54" width="44" height="203.46" />
+ <rect x="347" y="361.22" width="44" height="178.78" />
+ <rect x="481" y="426.17" width="44" height="113.83" />
+ <rect x="615" y="353.97" width="44" height="186.03" />
+ <rect x="749" y="455.16" width="44" height="84.84" fill="#C90A4F" />
+ </g>
+ </g>
+ <g id="fiveyear-target-vs-actual-rates" font-family="Arial, sans-serif" font-size="18" font-weight="bold" text-anchor="middle" fill="#4A5568">
+ <text x="207" y="308">91.79%</text>
+ <text x="341" y="351">130.97%</text>
+ <text x="475" y="416">100.07%</text>
+ <text x="609" y="316">86.99%</text>
+ <text x="743" y="298" fill="#C90A4F">36.67%</text>
+ </g>
+ <g id="fiveyear-target-vs-actual-xaxis" font-family="Arial, sans-serif" font-size="18" text-anchor="middle" fill="#4A5568">
+ <text x="207" y="568">2021</text>
+ <text x="341" y="568">2022</text>
+ <text x="475" y="568">2023</text>
+ <text x="609" y="568">2024</text>
+ <text x="743" y="568">2025</text>
+ </g>
+ </g>
+</svg>
diff --git a/skills/ppt-master/scripts/tests/fixtures/native_projection/07_segment_mix.svg b/skills/ppt-master/scripts/tests/fixtures/native_projection/07_segment_mix.svg
new file mode 100644
index 00000000..d3b0cd6a
--- /dev/null
+++ b/skills/ppt-master/scripts/tests/fixtures/native_projection/07_segment_mix.svg
@@ -0,0 +1,75 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 720">
+ <g id="segment-mix-by-year" data-pptx-replace-with="chart" data-pptx-bounds="96 246 724 336" data-pptx-fallback-sha256="0c7ae6b6bcb06e33c59a7f7ff0aed4569c08901fa4aa7ac4eec178c518c99bb8">
+ <metadata type="application/json">
+ {
+ "x": 96, "y": 246, "width": 724, "height": 336,
+ "name": "segment-mix-by-year",
+ "type": "area",
+ "grouping": "stacked",
+ "categories": ["2021", "2022", "2023", "2024", "2025"],
+ "series": [
+ {"name": "水资源与环境", "values": [215.42, 40.9, 9.4, 10.33, 8.45]},
+ {"name": "能源电力", "values": [24.33, 29.0, 56.6, 52.96, 36.96]},
+ {"name": "城市建设与基础设施", "values": [71.37, 202.35, 107.33, 221.85, 69.24]},
+ {"name": "其他业务", "values": [1.9, 2.78, 1.79, 1.06, 15.88]}
+ ],
+ "show_legend": true,
+ "legend_position": "top",
+ "axes": {
+ "category": {"kind": "text", "position": "bottom"},
+ "value": {"kind": "value", "position": "left", "minimum": 0, "maximum": 350, "major_unit": 100, "major_gridlines": true}
+ },
+ "style": {
+ "colors": ["#004EA1", "#4A7BB5", "#0E7C9B", "#9FB6CE"],
+ "font_family": "Arial",
+ "axis_font_size": 18,
+ "legend_font_size": 18,
+ "chart_area_fill": "none",
+ "plot_area_fill": "none",
+ "text_color": "#1A1A1A",
+ "axis_color": "#DDE3E9",
+ "grid_color": "#DDE3E9"
+ },
+ "plot_area": {"x": 140, "y": 280, "width": 670, "height": 260}
+ }
+ </metadata>
+ <g id="segment-mix-by-year-legend" font-family="Arial, &quot;Microsoft YaHei&quot;, sans-serif" font-size="18" fill="#4A5568">
+ <rect x="180" y="262" width="24" height="12" fill="#004EA1" />
+ <text x="212" y="274">水资源与环境</text>
+ <rect x="344" y="262" width="24" height="12" fill="#4A7BB5" />
+ <text x="376" y="274">能源电力</text>
+ <rect x="472" y="262" width="24" height="12" fill="#0E7C9B" />
+ <text x="504" y="274">城市建设与基础设施</text>
+ <rect x="690" y="262" width="24" height="12" fill="#9FB6CE" />
+ <text x="722" y="274">其他</text>
+ </g>
+ <g id="segment-mix-by-year-chartArea">
+ <g id="segment-mix-by-year-grid" stroke="#DDE3E9" stroke-width="1">
+ <line x1="140" y1="317.14" x2="810" y2="317.14" />
+ <line x1="140" y1="391.43" x2="810" y2="391.43" />
+ <line x1="140" y1="465.71" x2="810" y2="465.71" />
+ <line x1="140" y1="540" x2="810" y2="540" stroke="#9FB6CE" />
+ <line x1="140" y1="280" x2="140" y2="540" />
+ </g>
+ <g id="segment-mix-by-year-yaxis" font-family="Arial, sans-serif" font-size="18" text-anchor="end" fill="#4A5568">
+ <text x="132" y="323">300</text>
+ <text x="132" y="397">200</text>
+ <text x="132" y="472">100</text>
+ <text x="132" y="546">0</text>
+ </g>
+ <g id="segment-mix-by-year-bands">
+ <polygon points="140,379.98 307.5,509.62 475,533.02 642.5,532.33 810,533.72 810,540 140,540" fill="#004EA1" />
+ <polygon points="140,361.9 307.5,488.07 475,490.97 642.5,492.99 810,506.27 810,533.72 642.5,532.33 475,533.02 307.5,509.62 140,379.98" fill="#4A7BB5" />
+ <polygon points="140,308.89 307.5,337.76 475,411.24 642.5,328.18 810,454.83 810,506.27 642.5,492.99 475,490.97 307.5,488.07 140,361.9" fill="#0E7C9B" />
+ <polygon points="140,307.48 307.5,335.7 475,409.91 642.5,327.39 810,443.03 810,454.83 642.5,328.18 475,411.24 307.5,337.76 140,308.89" fill="#9FB6CE" />
+ </g>
+ </g>
+ <g id="segment-mix-by-year-xaxis" font-family="Arial, sans-serif" font-size="18" text-anchor="middle" fill="#4A5568">
+ <text x="140" y="568">2021</text>
+ <text x="307.5" y="568">2022</text>
+ <text x="475" y="568">2023</text>
+ <text x="642.5" y="568">2024</text>
+ <text x="810" y="568">2025</text>
+ </g>
+ </g>
+</svg>
diff --git a/skills/ppt-master/scripts/tests/fixtures/native_projection/10_competitiveness.svg b/skills/ppt-master/scripts/tests/fixtures/native_projection/10_competitiveness.svg
new file mode 100644
index 00000000..c2c245f2
--- /dev/null
+++ b/skills/ppt-master/scripts/tests/fixtures/native_projection/10_competitiveness.svg
@@ -0,0 +1,71 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 720">
+ <g id="competitor-capability-radar" data-pptx-replace-with="chart" data-pptx-bounds="192 208 520 424" data-pptx-fallback-sha256="78bd902df74e19d8ae89a269a64280dd0130f120e74b76506446935c1acb4e10">
+ <metadata type="application/json">
+ {
+ "x": 192, "y": 208, "width": 520, "height": 424,
+ "name": "competitor-capability-radar",
+ "type": "radar",
+ "categories": ["政企合作", "属地化", "市场规模", "赛道适配", "资金实力", "品牌口碑", "技术履约", "成本管控", "资质全链", "风险合规", "新兴赛道", "人才团队"],
+ "series": [
+ {"name": "中国电建", "values": [4.0, 3.67, 3.58, 4.25, 3.5, 3.92, 4.0, 3.5, 3.92, 4.42, 4.75, 3.92]},
+ {"name": "中国建筑", "values": [4.92, 4.75, 4.92, 4.25, 4.75, 4.33, 4.25, 4.25, 5.0, 3.75, 3.75, 4.5]},
+ {"name": "行业均值", "values": [4.12, 4.01, 3.87, 4.12, 4.02, 3.93, 4.12, 3.77, 4.24, 3.94, 3.94, 3.99]}
+ ],
+ "show_value_axis_labels": false,
+ "style": {
+ "colors": ["#004EA1", "#0E7C9B", "#9FB6CE"],
+ "font_family": "Arial",
+ "axis_font_size": 18,
+ "chart_area_fill": "none",
+ "plot_area_fill": "none",
+ "text_color": "#1A1A1A",
+ "axis_color": "#DDE3E9",
+ "grid_color": "#DDE3E9"
+ }
+ }
+ </metadata>
+ <g id="competitor-capability-radar-chartArea">
+ <g id="competitor-capability-radar-grid" fill="none" stroke="#DDE3E9" stroke-width="1">
+ <circle cx="450" cy="420" r="33" />
+ <circle cx="450" cy="420" r="66" />
+ <circle cx="450" cy="420" r="99" />
+ <circle cx="450" cy="420" r="132" />
+ <circle cx="450" cy="420" r="165" />
+ <line x1="450" y1="420" x2="450" y2="255" />
+ <line x1="450" y1="420" x2="532.5" y2="277.11" />
+ <line x1="450" y1="420" x2="592.89" y2="337.5" />
+ <line x1="450" y1="420" x2="615" y2="420" />
+ <line x1="450" y1="420" x2="592.89" y2="502.5" />
+ <line x1="450" y1="420" x2="532.5" y2="562.89" />
+ <line x1="450" y1="420" x2="450" y2="585" />
+ <line x1="450" y1="420" x2="367.5" y2="562.89" />
+ <line x1="450" y1="420" x2="307.11" y2="502.5" />
+ <line x1="450" y1="420" x2="285" y2="420" />
+ <line x1="450" y1="420" x2="307.11" y2="337.5" />
+ <line x1="450" y1="420" x2="367.5" y2="277.11" />
+ </g>
+ <polygon points="450,284.04 516.17,305.4 560.6,356.14 585.96,420 564.88,486.33 514.85,532.31 450,555.96 387.79,527.74 328.83,489.96 319.98,420 337.4,354.99 384.16,305.97" fill="none" stroke="#9FB6CE" stroke-width="2" />
+ <polygon points="450,257.64 528.38,284.25 590.6,338.82 590.25,420 585.75,498.38 521.45,543.75 450,560.25 379.87,541.46 307.11,502.5 326.25,420 342.83,358.12 375.75,291.38" fill="none" stroke="#0E7C9B" stroke-width="2" stroke-dasharray="6,3" />
+ <polygon points="450,288 510.56,315.12 552.31,360.93 590.25,420 550.02,477.75 514.68,532.03 450,552 392.25,520.02 337.97,484.68 304.14,420 314.25,341.62 385.32,307.97" fill="#004EA1" fill-opacity="0.16" stroke="#004EA1" stroke-width="3" />
+ <g id="competitor-capability-radar-weak" fill="#C90A4F">
+ <circle cx="550.02" cy="477.75" r="6" />
+ <circle cx="392.25" cy="520.02" r="6" />
+ <circle cx="552.31" cy="360.93" r="6" />
+ </g>
+ </g>
+ <g id="competitor-capability-radar-labels" font-family="Arial, &quot;Microsoft YaHei&quot;, sans-serif" font-size="18" fill="#4A5568">
+ <text x="450" y="228" text-anchor="middle">政企合作</text>
+ <text x="545" y="272">属地化</text>
+ <text x="612" y="333">市场规模</text>
+ <text x="632" y="426">赛道适配</text>
+ <text x="612" y="519">资金实力</text>
+ <text x="545" y="580">品牌口碑</text>
+ <text x="450" y="618" text-anchor="middle">技术履约</text>
+ <text x="355" y="580" text-anchor="end">成本管控</text>
+ <text x="288" y="519" text-anchor="end">资质全链</text>
+ <text x="268" y="426" text-anchor="end">风险合规</text>
+ <text x="288" y="333" text-anchor="end">新兴赛道</text>
+ <text x="355" y="272" text-anchor="end">人才团队</text>
+ </g>
+ </g>
+</svg>
diff --git a/skills/ppt-master/scripts/tests/fixtures/native_projection/11_market_space.svg b/skills/ppt-master/scripts/tests/fixtures/native_projection/11_market_space.svg
new file mode 100644
index 00000000..e2774e3c
--- /dev/null
+++ b/skills/ppt-master/scripts/tests/fixtures/native_projection/11_market_space.svg
@@ -0,0 +1,61 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 720">
+ <g id="market-space-breakdown" data-pptx-replace-with="chart" data-pptx-bounds="96 250 604 320" data-pptx-fallback-sha256="c64262840a568de1cccbd992132213b85a71b1d40622da99ef582bd94584bc40">
+ <metadata type="application/json">
+ {
+ "x": 96, "y": 250, "width": 604, "height": 320,
+ "name": "market-space-breakdown",
+ "type": "treemap",
+ "parent_label_layout": "banner",
+ "categories": [
+ ["城市建设与基础设施", "房建"], ["城市建设与基础设施", "市政"], ["城市建设与基础设施", "综合交通"],
+ ["水资源与环境", "水利工程"], ["水资源与环境", "水环境治理和生态修复"], ["水资源与环境", "水务工程"], ["水资源与环境", "环保"],
+ ["能源电力", "光伏"], ["能源电力", "电网"], ["能源电力", "火电"], ["能源电力", "抽水蓄能"], ["能源电力", "风电"], ["能源电力", "常规水电"],
+ ["战略性新兴业务", "人工智能"], ["战略性新兴业务", "低空经济"], ["战略性新兴业务", "氢能"], ["战略性新兴业务", "新型储能"], ["战略性新兴业务", "土壤修复"],
+ ["数字化", "工程基建数字化"], ["数字化", "城市治理数字化"], ["数字化", "能源算力数字化"], ["数字化", "战略性新兴数字化"]
+ ],
+ "values": [4720, 2420, 573, 2198.31, 211.41, 204.53, 37.6, 559, 300, 240, 223, 209, 45, 200, 80, 50, 46.5, 10.3, 65, 52, 48, 35],
+ "style": {
+ "colors": ["#0E7C9B", "#004EA1", "#4A7BB5", "#7FA3C4", "#B8CBE0"],
+ "font_family": "Arial",
+ "chart_area_fill": "none",
+ "text_color": "#FFFFFF"
+ }
+ }
+ </metadata>
+ <g id="market-space-breakdown-tiles" stroke="#FFFFFF" stroke-width="1">
+ <rect x="96" y="250" width="227.6" height="320" fill="#0E7C9B" />
+ <rect x="323.6" y="250" width="116.7" height="320" fill="#2E90AD" />
+ <rect x="440.3" y="250" width="27.6" height="320" fill="#57A9C0" />
+ <rect x="467.9" y="250" width="192.4" height="176.3" fill="#004EA1" />
+ <rect x="660.3" y="250" width="39.7" height="82.2" fill="#2A6FB5" />
+ <rect x="660.3" y="332.2" width="39.7" height="79.5" fill="#4A7BB5" />
+ <rect x="660.3" y="411.7" width="39.7" height="14.6" fill="#6F9BCB" />
+ <rect x="467.9" y="426.3" width="82.3" height="104.7" fill="#4A7BB5" />
+ <rect x="550.2" y="426.3" width="44.2" height="104.7" fill="#5E89BE" />
+ <rect x="594.4" y="426.3" width="35.3" height="104.7" fill="#7098C7" />
+ <rect x="629.7" y="426.3" width="32.8" height="104.7" fill="#83A6D0" />
+ <rect x="662.5" y="426.3" width="30.8" height="104.7" fill="#96B4D8" />
+ <rect x="693.3" y="426.3" width="6.7" height="104.7" fill="#A9C2E0" />
+ <rect x="467.9" y="531" width="120" height="25.7" fill="#7FA3C4" />
+ <rect x="587.9" y="531" width="48" height="25.7" fill="#8CADCB" />
+ <rect x="635.9" y="531" width="30" height="25.7" fill="#99B7D2" />
+ <rect x="665.9" y="531" width="27.9" height="25.7" fill="#A6C1D9" />
+ <rect x="693.8" y="531" width="6.2" height="25.7" fill="#B3CBE0" />
+ <rect x="467.9" y="556.7" width="75.4" height="13.3" fill="#B8CBE0" />
+ <rect x="543.3" y="556.7" width="60.3" height="13.3" fill="#C2D3E5" />
+ <rect x="603.6" y="556.7" width="55.7" height="13.3" fill="#CCDBEA" />
+ <rect x="659.3" y="556.7" width="40.7" height="13.3" fill="#D6E3EF" />
+ </g>
+ <g id="market-space-breakdown-labels" fill="#FFFFFF">
+ <text x="112" y="290" font-size="24" font-weight="bold">城市建设与基础设施</text>
+ <text x="112" y="330" font-family="Arial, sans-serif" font-size="32" font-weight="bold">7713</text>
+ <text x="112" y="356" font-family="Arial, sans-serif" font-size="18">61.57%</text>
+ <text x="484" y="286" font-size="18" font-weight="bold">水资源与环境</text>
+ <text x="484" y="320" font-family="Arial, sans-serif" font-size="28" font-weight="bold">2651.85</text>
+ <text x="484" y="344" font-family="Arial, sans-serif" font-size="15">21.17%</text>
+ <text x="484" y="452" font-size="18" font-weight="bold">能源电力</text>
+ <text x="484" y="482" font-family="Arial, sans-serif" font-size="24" font-weight="bold">1576</text>
+ <text x="484" y="504" font-family="Arial, sans-serif" font-size="15">12.58%</text>
+ </g>
+ </g>
+</svg>
diff --git a/skills/ppt-master/scripts/tests/fixtures/native_projection/15_signing_target.svg b/skills/ppt-master/scripts/tests/fixtures/native_projection/15_signing_target.svg
new file mode 100644
index 00000000..f0ea2b6f
--- /dev/null
+++ b/skills/ppt-master/scripts/tests/fixtures/native_projection/15_signing_target.svg
@@ -0,0 +1,228 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 720">
+ <g id="annual-signing-target" data-pptx-replace-with="chart" data-pptx-bounds="96 246 724 336" data-pptx-fallback-sha256="6af940e79ef2bf066aedf2860173a4785c9861ad5c3293e59ce36f5a81666b94">
+ <metadata type="application/json">
+ {
+ "x": 96,
+ "y": 246,
+ "width": 724,
+ "height": 336,
+ "name": "annual-signing-target",
+ "type": "column",
+ "grouping": "stacked",
+ "categories": [
+ "2026",
+ "2027",
+ "2028",
+ "2029",
+ "2030"
+ ],
+ "series": [
+ {
+ "name": "水",
+ "values": [
+ 59,
+ 70,
+ 81,
+ 89,
+ 92
+ ]
+ },
+ {
+ "name": "城",
+ "values": [
+ 66,
+ 70,
+ 76,
+ 85,
+ 92
+ ]
+ },
+ {
+ "name": "能",
+ "values": [
+ 18,
+ 21,
+ 24,
+ 27,
+ 28
+ ]
+ },
+ {
+ "name": "战兴业务",
+ "values": [
+ 7,
+ 8,
+ 9,
+ 10,
+ 11
+ ]
+ }
+ ],
+ "show_legend": true,
+ "legend_position": "top",
+ "axes": {
+ "category": {
+ "kind": "text",
+ "position": "bottom"
+ },
+ "value": {
+ "kind": "value",
+ "position": "left",
+ "minimum": 0,
+ "maximum": 240,
+ "major_unit": 60,
+ "major_gridlines": true
+ }
+ },
+ "style": {
+ "colors": [
+ "#004EA1",
+ "#0E7C9B",
+ "#4A7BB5",
+ "#9FB6CE"
+ ],
+ "font_family": "Arial",
+ "axis_font_size": 18,
+ "legend_font_size": 18,
+ "chart_area_fill": "none",
+ "plot_area_fill": "none",
+ "text_color": "#1A1A1A",
+ "axis_color": "#DDE3E9",
+ "grid_color": "#DDE3E9"
+ },
+ "plot_area": {
+ "x": 140,
+ "y": 280,
+ "width": 670,
+ "height": 260
+ },
+ "notes": [
+ {
+ "text": "150",
+ "x": 172,
+ "y": 344,
+ "width": 70,
+ "height": 30,
+ "font_size": 24,
+ "bold": true,
+ "align": "ctr",
+ "color": "#1A1A1A"
+ },
+ {
+ "text": "169",
+ "x": 306,
+ "y": 323,
+ "width": 70,
+ "height": 30,
+ "font_size": 24,
+ "bold": true,
+ "align": "ctr",
+ "color": "#1A1A1A"
+ },
+ {
+ "text": "190",
+ "x": 440,
+ "y": 300,
+ "width": 70,
+ "height": 30,
+ "font_size": 24,
+ "bold": true,
+ "align": "ctr",
+ "color": "#1A1A1A"
+ },
+ {
+ "text": "211",
+ "x": 574,
+ "y": 278,
+ "width": 70,
+ "height": 30,
+ "font_size": 24,
+ "bold": true,
+ "align": "ctr",
+ "color": "#1A1A1A"
+ },
+ {
+ "text": "223",
+ "x": 708,
+ "y": 265,
+ "width": 70,
+ "height": 30,
+ "font_size": 24,
+ "bold": true,
+ "align": "ctr",
+ "color": "#C90A4F"
+ }
+ ]
+ }
+ </metadata>
+ <g id="annual-signing-target-legend" font-family="Arial, &quot;Microsoft YaHei&quot;, sans-serif" font-size="18" fill="#4A5568">
+ <rect x="380" y="262" width="24" height="12" fill="#004EA1" />
+ <text x="412" y="274">水</text>
+ <rect x="470" y="262" width="24" height="12" fill="#0E7C9B" />
+ <text x="502" y="274">城</text>
+ <rect x="560" y="262" width="24" height="12" fill="#4A7BB5" />
+ <text x="592" y="274">能</text>
+ <rect x="650" y="262" width="24" height="12" fill="#9FB6CE" />
+ <text x="682" y="274">战兴业务</text>
+ </g>
+ <g id="annual-signing-target-chartArea">
+ <g id="annual-signing-target-grid" stroke="#DDE3E9" stroke-width="1">
+ <line x1="140" y1="280" x2="810" y2="280" />
+ <line x1="140" y1="345" x2="810" y2="345" />
+ <line x1="140" y1="410" x2="810" y2="410" />
+ <line x1="140" y1="475" x2="810" y2="475" />
+ <line x1="140" y1="540" x2="810" y2="540" stroke="#9FB6CE" />
+ <line x1="140" y1="280" x2="140" y2="540" />
+ </g>
+ <g id="annual-signing-target-yaxis" font-family="Arial, sans-serif" font-size="18" text-anchor="end" fill="#4A5568">
+ <text x="132" y="286">240</text>
+ <text x="132" y="351">180</text>
+ <text x="132" y="416">120</text>
+ <text x="132" y="481">60</text>
+ <text x="132" y="546">0</text>
+ </g>
+ <g id="annual-signing-target-water" fill="#004EA1">
+ <rect x="165" y="476.08" width="84" height="63.92" />
+ <rect x="299" y="464.17" width="84" height="75.83" />
+ <rect x="433" y="452.25" width="84" height="87.75" />
+ <rect x="567" y="443.58" width="84" height="96.42" />
+ <rect x="701" y="440.33" width="84" height="99.67" />
+ </g>
+ <g id="annual-signing-target-city" fill="#0E7C9B">
+ <rect x="165" y="404.58" width="84" height="71.5" />
+ <rect x="299" y="388.34" width="84" height="75.83" />
+ <rect x="433" y="369.92" width="84" height="82.33" />
+ <rect x="567" y="351.5" width="84" height="92.08" />
+ <rect x="701" y="340.66" width="84" height="99.67" />
+ </g>
+ <g id="annual-signing-target-energy" fill="#4A7BB5">
+ <rect x="165" y="385.08" width="84" height="19.5" />
+ <rect x="299" y="365.59" width="84" height="22.75" />
+ <rect x="433" y="343.92" width="84" height="26" />
+ <rect x="567" y="322.25" width="84" height="29.25" />
+ <rect x="701" y="310.33" width="84" height="30.33" />
+ </g>
+ <g id="annual-signing-target-new" fill="#9FB6CE">
+ <rect x="165" y="377.5" width="84" height="7.58" />
+ <rect x="299" y="356.92" width="84" height="8.67" />
+ <rect x="433" y="334.17" width="84" height="9.75" />
+ <rect x="567" y="311.42" width="84" height="10.83" />
+ <rect x="701" y="298.41" width="84" height="11.92" />
+ </g>
+ </g>
+ <g id="annual-signing-target-totals" font-family="Arial, sans-serif" font-size="24" font-weight="bold" text-anchor="middle" fill="#1A1A1A">
+ <text x="207" y="366">150</text>
+ <text x="341" y="345">169</text>
+ <text x="475" y="322">190</text>
+ <text x="609" y="300">211</text>
+ <text x="743" y="287" fill="#C90A4F">223</text>
+ </g>
+ <g id="annual-signing-target-xaxis" font-family="Arial, sans-serif" font-size="18" text-anchor="middle" fill="#4A5568">
+ <text x="207" y="568">2026</text>
+ <text x="341" y="568">2027</text>
+ <text x="475" y="568">2028</text>
+ <text x="609" y="568">2029</text>
+ <text x="743" y="568">2030</text>
+ </g>
+ </g>
+</svg>
diff --git a/skills/ppt-master/scripts/tests/fixtures/native_projection/27_business_models.svg b/skills/ppt-master/scripts/tests/fixtures/native_projection/27_business_models.svg
new file mode 100644
index 00000000..6f3da7ae
--- /dev/null
+++ b/skills/ppt-master/scripts/tests/fixtures/native_projection/27_business_models.svg
@@ -0,0 +1,77 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 720">
+ <g id="business-model-toolbox" data-pptx-replace-with="table" data-pptx-bounds="96 272 1112 316" data-pptx-fallback-sha256="27a219bd543ea061bd085c13f2c4129ebf577580838dc89af561a52809e14702">
+ <metadata type="application/json">
+ {
+ "schema": "ppt-master.semantic-table.v2",
+ "x": 96, "y": 272, "width": 1112, "height": 316,
+ "name": "business-model-toolbox",
+ "header_rows": 1,
+ "column_widths": [160, 240, 220, 220, 272],
+ "columns": ["项目属性", "典型场景", "建议模式", "主要收益来源", "关键合规边界"],
+ "rows": [
+ ["公益性", "老旧小区、城市生命线、公益性水利及生态修复", "政府投资+DB/EPC;必要时 EPC+O", "财政及政策性资金支付的工程或服务费用", "不垫资、不承诺融资兜底;资金落实后实施"],
+ ["准经营性/使用者付费", "供排水、停车、垃圾处理、综合管廊、部分交通和能源设施", "BOT、BOOT、TOT、ROT 等特许经营", "使用者付费、依法依规的可行性缺口补助", "公开竞争选择经营者;不得承诺保本保收益"],
+ ["市场化经营性", "园区综合能源、分布式新能源、工商业储能、智慧运维", "股权投资、BOO、EMC、投建营一体化", "售电、供能、节能分享、租赁及运营服务收入", "独立核算、风险自担;退出路径和收益边界清晰"]
+ ],
+ "style": {
+ "font_family": "Microsoft YaHei",
+ "font_size": 18,
+ "band_row": false,
+ "border_color": "#DDE3E9",
+ "border_width": 1
+ }
+ }
+ </metadata>
+ <rect x="96" y="272" width="1112" height="48" fill="#004EA1" />
+ <g id="business-model-toolbox-head" font-size="18" font-weight="bold" fill="#FFFFFF">
+ <text x="112" y="302">项目属性</text>
+ <text x="272" y="302">典型场景</text>
+ <text x="512" y="302">建议模式</text>
+ <text x="732" y="302">主要收益来源</text>
+ <text x="952" y="302">关键合规边界</text>
+ </g>
+ <g id="business-model-toolbox-rules" stroke="#DDE3E9" stroke-width="1">
+ <line x1="96" y1="408" x2="1208" y2="408" />
+ <line x1="96" y1="496" x2="1208" y2="496" />
+ <line x1="96" y1="584" x2="1208" y2="584" />
+ <line x1="256" y1="320" x2="256" y2="584" />
+ <line x1="496" y1="320" x2="496" y2="584" />
+ <line x1="716" y1="320" x2="716" y2="584" />
+ <line x1="936" y1="320" x2="936" y2="584" />
+ </g>
+ <rect x="936" y="320" width="272" height="264" fill="#F4F6F8" />
+ <g id="business-model-toolbox-body" font-family="Arial, &quot;Microsoft YaHei&quot;, sans-serif" font-size="18" fill="#1A1A1A">
+ <text x="112" y="352" font-weight="bold" fill="#004EA1">公益性</text>
+ <text x="272" y="352">老旧小区、城市生命线、<tspan x="272" dy="24">公益性水利及生态修复</tspan>
+ </text>
+ <text x="512" y="352">政府投资+DB/EPC;<tspan x="512" dy="24">必要时 EPC+O</tspan>
+ </text>
+ <text x="732" y="352">财政及政策性资金支付<tspan x="732" dy="24">的工程或服务费用</tspan>
+ </text>
+ <text x="952" y="352">不垫资、不承诺融资兜底;<tspan x="952" dy="24">资金落实后实施</tspan>
+ </text>
+ <text x="112" y="440" font-weight="bold" fill="#004EA1">准经营性/<tspan x="112" dy="24">使用者付费</tspan>
+ </text>
+ <text x="272" y="440">供排水、停车、垃圾处理、<tspan x="272" dy="24">综合管廊、部分交通和</tspan>
+ <tspan x="272" dy="24">能源设施</tspan>
+ </text>
+ <text x="512" y="440">BOT、BOOT、TOT、<tspan x="512" dy="24">ROT 等特许经营</tspan>
+ </text>
+ <text x="732" y="440">使用者付费、依法依规<tspan x="732" dy="24">的可行性缺口补助</tspan>
+ </text>
+ <text x="952" y="440">公开竞争选择经营者;<tspan x="952" dy="24">不得承诺保本保收益</tspan>
+ </text>
+ <text x="112" y="528" font-weight="bold" fill="#004EA1">市场化<tspan x="112" dy="24">经营性</tspan>
+ </text>
+ <text x="272" y="528">园区综合能源、分布式<tspan x="272" dy="24">新能源、工商业储能、</tspan>
+ <tspan x="272" dy="24">智慧运维</tspan>
+ </text>
+ <text x="512" y="528">股权投资、BOO、EMC、<tspan x="512" dy="24">投建营一体化</tspan>
+ </text>
+ <text x="732" y="528">售电、供能、节能分享、<tspan x="732" dy="24">租赁及运营服务收入</tspan>
+ </text>
+ <text x="952" y="528">独立核算、风险自担;<tspan x="952" dy="24">退出路径和收益边界清晰</tspan>
+ </text>
+ </g>
+ </g>
+</svg>
diff --git a/skills/ppt-master/scripts/tests/fixtures/native_projection/30_risk_matrix.svg b/skills/ppt-master/scripts/tests/fixtures/native_projection/30_risk_matrix.svg
new file mode 100644
index 00000000..abc2e17b
--- /dev/null
+++ b/skills/ppt-master/scripts/tests/fixtures/native_projection/30_risk_matrix.svg
@@ -0,0 +1,111 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 720">
+ <g id="risk-matrix" data-pptx-replace-with="table" data-pptx-bounds="96 242 1112 388" data-pptx-fallback-sha256="0ca66360858c77eda15ddea9f1bb21223ea73442ef2d73c260dbdba6c9f73f2a">
+ <metadata type="application/json">
+ {
+ "schema": "ppt-master.semantic-table.v2",
+ "x": 96, "y": 242, "width": 1112, "height": 388,
+ "name": "risk-matrix",
+ "header_rows": 1,
+ "column_widths": [190, 110, 100, 110, 350, 252],
+ "columns": ["风险类别", "发生可能性", "影响程度", "综合等级", "重点监测信号", "主要责任主体"],
+ "rows": [
+ ["政策与市场风险", "高", "高", "红色", "规划调整、准入规则变化、项目清单和建设时序变化", "区域总部、市场经营及专业单位"],
+ ["地方财政与支付风险", "高", "高", "红色", "资金未落实、预算调整、回款逾期、业主负债率上升", "投资、财务、市场及项目公司"],
+ ["电力市场价格风险", "高", "高", "红色", "现货价格波动、偏差考核增加、机制电量变化、限电上升", "投资、能源专业单位及运营主体"],
+ ["生态用地与建设条件风险", "中高", "高", "红色", "触及生态保护红线、用地手续滞后、地灾和征拆协调困难", "前期、设计、工程及属地项目单位"],
+ ["竞争与内部协同风险", "高", "中高", "橙色", "低价竞争、重复营销、内部抢标、资源投入分散", "区域总部及在渝成员企业"],
+ ["技术迭代风险", "中", "高", "橙色", "设备性能不达标、技术路线更替、运维成本超预期", "科技、设计、采购及运营单位"]
+ ],
+ "style": {
+ "font_family": "Microsoft YaHei",
+ "font_size": 18,
+ "band_row": false,
+ "border_color": "#DDE3E9",
+ "border_width": 1
+ }
+ }
+ </metadata>
+ <rect x="96" y="246" width="1112" height="40" fill="#004EA1" />
+ <g id="risk-matrix-head" font-size="18" font-weight="bold" fill="#FFFFFF">
+ <text x="112" y="272">风险类别</text>
+ <text x="302" y="272">发生可能性</text>
+ <text x="412" y="272">影响程度</text>
+ <text x="512" y="272">综合等级</text>
+ <text x="622" y="272">重点监测信号</text>
+ <text x="972" y="272">主要责任主体</text>
+ </g>
+ <g id="risk-matrix-rules" stroke="#DDE3E9" stroke-width="1">
+ <line x1="96" y1="342" x2="1208" y2="342" />
+ <line x1="96" y1="398" x2="1208" y2="398" />
+ <line x1="96" y1="454" x2="1208" y2="454" />
+ <line x1="96" y1="510" x2="1208" y2="510" />
+ <line x1="96" y1="566" x2="1208" y2="566" />
+ <line x1="96" y1="622" x2="1208" y2="622" />
+ <line x1="286" y1="286" x2="286" y2="622" />
+ <line x1="396" y1="286" x2="396" y2="622" />
+ <line x1="496" y1="286" x2="496" y2="622" />
+ <line x1="606" y1="286" x2="606" y2="622" />
+ <line x1="956" y1="286" x2="956" y2="622" />
+ </g>
+ <g id="risk-matrix-levels">
+ <rect x="506" y="300" width="90" height="28" fill="#C90A4F" />
+ <rect x="506" y="356" width="90" height="28" fill="#C90A4F" />
+ <rect x="506" y="412" width="90" height="28" fill="#C90A4F" />
+ <rect x="506" y="468" width="90" height="28" fill="#C90A4F" />
+ <rect x="506" y="524" width="90" height="28" fill="#D97706" />
+ <rect x="506" y="580" width="90" height="28" fill="#D97706" />
+ </g>
+ <g id="risk-matrix-level-text" font-size="18" font-weight="bold" text-anchor="middle" fill="#FFFFFF">
+ <text x="551" y="320">红色</text>
+ <text x="551" y="376">红色</text>
+ <text x="551" y="432">红色</text>
+ <text x="551" y="488">红色</text>
+ <text x="551" y="544">橙色</text>
+ <text x="551" y="600">橙色</text>
+ </g>
+ <g id="risk-matrix-body" font-family="Arial, &quot;Microsoft YaHei&quot;, sans-serif" font-size="18" fill="#1A1A1A">
+ <text x="112" y="312" font-weight="bold">政策与市场风险</text>
+ <text x="302" y="312">高</text>
+ <text x="412" y="312">高</text>
+ <text x="622" y="312">规划调整、准入规则变化、<tspan x="622" dy="24">项目清单和建设时序变化</tspan>
+ </text>
+ <text x="972" y="312">区域总部、市场经营及<tspan x="972" dy="24">专业单位</tspan>
+ </text>
+ <text x="112" y="368" font-weight="bold">地方财政与支付风险</text>
+ <text x="302" y="368">高</text>
+ <text x="412" y="368">高</text>
+ <text x="622" y="368">资金未落实、预算调整、<tspan x="622" dy="24">回款逾期、业主负债率上升</tspan>
+ </text>
+ <text x="972" y="368">投资、财务、市场及<tspan x="972" dy="24">项目公司</tspan>
+ </text>
+ <text x="112" y="424" font-weight="bold">电力市场价格风险</text>
+ <text x="302" y="424">高</text>
+ <text x="412" y="424">高</text>
+ <text x="622" y="424">现货价格波动、偏差考核增加、<tspan x="622" dy="24">机制电量变化、限电上升</tspan>
+ </text>
+ <text x="972" y="424">投资、能源专业单位及<tspan x="972" dy="24">运营主体</tspan>
+ </text>
+ <text x="112" y="480" font-weight="bold">生态用地与建设<tspan x="112" dy="24">条件风险</tspan>
+ </text>
+ <text x="302" y="480">中高</text>
+ <text x="412" y="480">高</text>
+ <text x="622" y="480">触及生态保护红线、用地手续<tspan x="622" dy="24">滞后、地灾和征拆协调困难</tspan>
+ </text>
+ <text x="972" y="480">前期、设计、工程及<tspan x="972" dy="24">属地项目单位</tspan>
+ </text>
+ <text x="112" y="536" font-weight="bold">竞争与内部协同风险</text>
+ <text x="302" y="536">高</text>
+ <text x="412" y="536">中高</text>
+ <text x="622" y="536">低价竞争、重复营销、<tspan x="622" dy="24">内部抢标、资源投入分散</tspan>
+ </text>
+ <text x="972" y="536">区域总部及在渝成员企业</text>
+ <text x="112" y="592" font-weight="bold">技术迭代风险</text>
+ <text x="302" y="592">中</text>
+ <text x="412" y="592">高</text>
+ <text x="622" y="592">设备性能不达标、技术路线<tspan x="622" dy="24">更替、运维成本超预期</tspan>
+ </text>
+ <text x="972" y="592">科技、设计、采购及<tspan x="972" dy="24">运营单位</tspan>
+ </text>
+ </g>
+ </g>
+</svg>
diff --git a/skills/ppt-master/scripts/tests/fixtures/native_projection/31_power_market.svg b/skills/ppt-master/scripts/tests/fixtures/native_projection/31_power_market.svg
new file mode 100644
index 00000000..d25c1838
--- /dev/null
+++ b/skills/ppt-master/scripts/tests/fixtures/native_projection/31_power_market.svg
@@ -0,0 +1,95 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 720">
+ <g id="power-market-calculation" data-pptx-replace-with="table" data-pptx-bounds="96 242 1112 340" data-pptx-fallback-sha256="1491f4f30ab59c73e10734b61064513e25fcdcba8e23ef18a1e35109aff4cf3e">
+ <metadata type="application/json">
+ {
+ "schema": "ppt-master.semantic-table.v2",
+ "x": 96, "y": 242, "width": 1112, "height": 340,
+ "name": "power-market-calculation",
+ "header_rows": 1,
+ "column_widths": [150, 280, 240, 240, 202],
+ "columns": ["测算模块", "核心参数", "基准情景要求", "压力测试重点", "管理用途"],
+ "rows": [
+ ["电量", "P50/P90 发电量、可利用率、限电率、储能循环次数", "采用代表年和中长期资源评估结果", "利用小时下降、限电和设备衰减叠加", "确定容量、设备方案及偿债边界"],
+ ["电价与交易", "中长期、现货、机制电价、绿电绿证", "采用最新规则和可验证市场数据", "低价时段增加、机制电量下降、价差扩大", "评估年度收入和套期保值策略"],
+ ["辅助服务与调节", "调频、备用、需求响应、容量租赁", "仅计入具备准入条件且可持续的收入", "调用频次、性能考核和市场竞争变化", "评价储能、虚拟电厂和灵活性价值"],
+ ["成本与考核", "偏差考核、交易费、损耗、运维和保险", "全额纳入运营现金流", "偏差率提高、损耗增加、运维超支", "确定报价底线和运维预算"],
+ ["融资与退出", "利率、偿债覆盖率、残值和退出估值", "与真实融资条件和资产寿命匹配", "利率上升、再融资受限、估值折价", "控制资本金、负债率和退出时点"]
+ ],
+ "style": {
+ "font_family": "Microsoft YaHei",
+ "font_size": 18,
+ "band_row": false,
+ "border_color": "#DDE3E9",
+ "border_width": 1
+ }
+ }
+ </metadata>
+ <rect x="96" y="246" width="1112" height="40" fill="#004EA1" />
+ <rect x="726" y="286" width="240" height="292" fill="#F4F6F8" />
+ <g id="power-market-calculation-head" font-size="18" font-weight="bold" fill="#FFFFFF">
+ <text x="112" y="272">测算模块</text>
+ <text x="262" y="272">核心参数</text>
+ <text x="542" y="272">基准情景要求</text>
+ <text x="742" y="272">压力测试重点</text>
+ <text x="982" y="272">管理用途</text>
+ </g>
+ <g id="power-market-calculation-rules" stroke="#DDE3E9" stroke-width="1">
+ <line x1="96" y1="344" x2="1208" y2="344" />
+ <line x1="96" y1="402" x2="1208" y2="402" />
+ <line x1="96" y1="460" x2="1208" y2="460" />
+ <line x1="96" y1="518" x2="1208" y2="518" />
+ <line x1="96" y1="576" x2="1208" y2="576" />
+ <line x1="246" y1="286" x2="246" y2="576" />
+ <line x1="526" y1="286" x2="526" y2="576" />
+ <line x1="726" y1="286" x2="726" y2="576" />
+ <line x1="966" y1="286" x2="966" y2="576" />
+ </g>
+ <g id="power-market-calculation-body" font-family="Arial, &quot;Microsoft YaHei&quot;, sans-serif" font-size="18" fill="#1A1A1A">
+ <text x="112" y="314" font-weight="bold" fill="#004EA1">电量</text>
+ <text x="262" y="314">P50/P90 发电量、可利用率、<tspan x="262" dy="24">限电率、储能循环次数</tspan>
+ </text>
+ <text x="542" y="314">采用代表年和中长期<tspan x="542" dy="24">资源评估结果</tspan>
+ </text>
+ <text x="742" y="314">利用小时下降、限电和<tspan x="742" dy="24">设备衰减叠加</tspan>
+ </text>
+ <text x="982" y="314">确定容量、设备方案<tspan x="982" dy="24">及偿债边界</tspan>
+ </text>
+ <text x="112" y="372" font-weight="bold" fill="#004EA1">电价与交易</text>
+ <text x="262" y="372">中长期、现货、机制电价、<tspan x="262" dy="24">绿电绿证</tspan>
+ </text>
+ <text x="542" y="372">采用最新规则和<tspan x="542" dy="24">可验证市场数据</tspan>
+ </text>
+ <text x="742" y="372">低价时段增加、机制电量<tspan x="742" dy="24">下降、价差扩大</tspan>
+ </text>
+ <text x="982" y="372">评估年度收入和<tspan x="982" dy="24">套期保值策略</tspan>
+ </text>
+ <text x="112" y="430" font-weight="bold" fill="#004EA1">辅助服务<tspan x="112" dy="24">与调节</tspan>
+ </text>
+ <text x="262" y="430">调频、备用、需求响应、<tspan x="262" dy="24">容量租赁</tspan>
+ </text>
+ <text x="542" y="430">仅计入具备准入条件<tspan x="542" dy="24">且可持续的收入</tspan>
+ </text>
+ <text x="742" y="430">调用频次、性能考核和<tspan x="742" dy="24">市场竞争变化</tspan>
+ </text>
+ <text x="982" y="430">评价储能、虚拟电厂<tspan x="982" dy="24">和灵活性价值</tspan>
+ </text>
+ <text x="112" y="488" font-weight="bold" fill="#004EA1">成本与考核</text>
+ <text x="262" y="488">偏差考核、交易费、损耗、<tspan x="262" dy="24">运维和保险</tspan>
+ </text>
+ <text x="542" y="488">全额纳入运营现金流</text>
+ <text x="742" y="488">偏差率提高、损耗增加、<tspan x="742" dy="24">运维超支</tspan>
+ </text>
+ <text x="982" y="488">确定报价底线和<tspan x="982" dy="24">运维预算</tspan>
+ </text>
+ <text x="112" y="546" font-weight="bold" fill="#004EA1">融资与退出</text>
+ <text x="262" y="546">利率、偿债覆盖率、残值和<tspan x="262" dy="24">退出估值</tspan>
+ </text>
+ <text x="542" y="546">与真实融资条件和<tspan x="542" dy="24">资产寿命匹配</tspan>
+ </text>
+ <text x="742" y="546">利率上升、再融资受限、<tspan x="742" dy="24">估值折价</tspan>
+ </text>
+ <text x="982" y="546">控制资本金、负债率<tspan x="982" dy="24">和退出时点</tspan>
+ </text>
+ </g>
+ </g>
+</svg>
diff --git a/skills/ppt-master/scripts/tests/test_native_chart_table_parity.py b/skills/ppt-master/scripts/tests/test_native_chart_table_parity.py
new file mode 100644
index 00000000..18161ee8
--- /dev/null
+++ b/skills/ppt-master/scripts/tests/test_native_chart_table_parity.py
@@ -0,0 +1,295 @@
+#!/usr/bin/env python3
+"""Regression tests for native ChartEx and table projection behavior."""
+
+from __future__ import annotations
+
+import sys
+import unittest
+from pathlib import Path
+from xml.etree import ElementTree as ET
+
+
+SCRIPTS_DIR = Path(__file__).resolve().parents[1]
+if str(SCRIPTS_DIR) not in sys.path:
+ sys.path.insert(0, str(SCRIPTS_DIR))
+
+from svg_to_pptx.native_objects.chartex import ( # noqa: E402
+ _chart_ex_series_xml,
+ _chart_ex_xml,
+)
+from svg_to_pptx.native_objects import ( # noqa: E402
+ native_object_projection_warnings,
+)
+from svg_to_pptx.native_objects.table import ( # noqa: E402
+ _table_border_specs,
+ _table_border_xml,
+)
+from svg_to_pptx.pptx_package.cli import ( # noqa: E402
+ _native_object_projection_findings,
+)
+from svg_quality.checker import SVGQualityChecker # noqa: E402
+
+
+FIXTURES_DIR = Path(__file__).resolve().parent / "fixtures" / "native_projection"
+
+
+def _fixture_root(filename: str) -> ET.Element:
+ return ET.parse(FIXTURES_DIR / filename).getroot()
+
+
+def _fixture_marker(filename: str) -> ET.Element:
+ return next(
+ elem
+ for elem in _fixture_root(filename).iter()
+ if elem.get("data-pptx-replace-with") in {"chart", "table"}
+ )
+
+
+class NativeTableBorderTests(unittest.TestCase):
+ def test_legacy_uniform_border_is_cardinal_only(self) -> None:
+ for cell, style in (
+ ({}, {"border_color": "#DDE3E9", "border_width": 1}),
+ ({"border_color": "#DDE3E9", "border_width": 1}, {}),
+ ):
+ with self.subTest(cell=cell, style=style):
+ specs = _table_border_specs(cell, style)
+ border_xml = _table_border_xml(cell, style, None)
+
+ self.assertTrue(all(specs[side] is not None for side in (
+ "left", "right", "top", "bottom",
+ )))
+ self.assertIsNone(specs["diagonal_down"])
+ self.assertIsNone(specs["diagonal_up"])
+ self.assertNotIn("lnTlToBr", border_xml)
+ self.assertNotIn("lnBlToTr", border_xml)
+
+ def test_diagonal_borders_require_explicit_cell_overrides(self) -> None:
+ cell = {
+ "borders": {
+ "diagonal_down": {
+ "style": "solid",
+ "color": "#C90A4F",
+ "width": 2,
+ },
+ "diagonal_up": {"style": "none"},
+ },
+ }
+
+ specs = _table_border_specs(cell, {})
+ border_xml = _table_border_xml(cell, {}, None)
+
+ self.assertEqual(specs["diagonal_down"].style, "solid")
+ self.assertEqual(specs["diagonal_up"].style, "none")
+ self.assertIn("lnTlToBr", border_xml)
+ self.assertIn("lnBlToTr", border_xml)
+
+
+class NativeChartExTests(unittest.TestCase):
+ @staticmethod
+ def _chart_data(chart_type: str) -> dict:
+ if chart_type in {"sunburst", "treemap"}:
+ return {
+ "type": chart_type,
+ "levels": [["A", "B"]],
+ "values": [1, 2],
+ }
+ if chart_type == "histogram":
+ return {"type": chart_type, "values": [1, 2]}
+ return {
+ "type": chart_type,
+ "categories": ["A", "B"],
+ "values": [1, 2],
+ "subtotals": [],
+ }
+
+ def test_chart_without_title_omits_title_element_and_uses_payload_name(self) -> None:
+ chart_data = self._chart_data("treemap")
+ for payload in (
+ {"name": "Market & <Space>"},
+ {"name": "Market & <Space>", "title": ""},
+ {"name": "Market & <Space>", "title": {"text": " "}},
+ ):
+ with self.subTest(payload=payload):
+ chart_xml = _chart_ex_xml(
+ payload,
+ chart_data,
+ chart_rels_id="rId1",
+ ).decode("utf-8")
+
+ self.assertNotIn("<cx:title", chart_xml)
+ self.assertIn("<cx:v>Market &amp; &lt;Space&gt;</cx:v>", chart_xml)
+ self.assertNotIn("Series 1", chart_xml)
+
+ def test_chart_title_contains_text_and_supplies_series_name(self) -> None:
+ chart_data = self._chart_data("treemap")
+ title_xml = (
+ '<cx:title pos="t" align="ctr" overlay="0">'
+ '<cx:tx><cx:txData><cx:v>Visible &amp; &lt;Title&gt;</cx:v>'
+ '</cx:txData></cx:tx></cx:title>'
+ )
+ for title in ("Visible & <Title>", {"text": "Visible & <Title>"}):
+ with self.subTest(title=title):
+ chart_xml = _chart_ex_xml(
+ {"name": "internal-name", "title": title},
+ chart_data,
+ chart_rels_id="rId1",
+ ).decode("utf-8")
+
+ self.assertIn(title_xml, chart_xml)
+ self.assertGreaterEqual(
+ chart_xml.count("<cx:v>Visible &amp; &lt;Title&gt;</cx:v>"),
+ 2,
+ )
+
+ def test_chart_ex_series_families_do_not_hardcode_series_one(self) -> None:
+ for chart_type in (
+ "treemap",
+ "sunburst",
+ "histogram",
+ "pareto",
+ "waterfall",
+ "funnel",
+ ):
+ with self.subTest(chart_type=chart_type):
+ series_xml = _chart_ex_series_xml(
+ {"name": "Native & Series"},
+ self._chart_data(chart_type),
+ )
+ self.assertNotIn("Series 1", series_xml)
+ self.assertIn("Native &amp; Series", series_xml)
+
+
+class NativeProjectionCheckerTests(unittest.TestCase):
+ EXPECTED_FINDINGS = {
+ "06_1145_completion.svg": (
+ "style.text_color",
+ "data mark fill #C90A4F",
+ ),
+ "07_segment_mix.svg": (
+ "legend label is not visible",
+ "'其他业务'",
+ "style.text_color",
+ ),
+ "10_competitiveness.svg": (
+ "style.text_color",
+ "plot area is visible",
+ "5 countable radial gridlines",
+ ),
+ "11_market_space.svg": (
+ "tile color sequence not projected",
+ "visible text not projected",
+ "'61.57%'",
+ ),
+ "15_signing_target.svg": (
+ "style.text_color",
+ ),
+ "27_business_models.svg": (
+ "fallback row heights are non-uniform",
+ "header style not projected",
+ "whole column 5 fill #F4F6F8",
+ "first-column text style not projected",
+ "border topology not projected",
+ ),
+ "30_risk_matrix.svg": (
+ "fallback row heights are non-uniform",
+ "header style not projected",
+ "first-column text style not projected",
+ "border topology not projected",
+ "inset graphical cell with text",
+ "Native-ready=no",
+ ),
+ "31_power_market.svg": (
+ "fallback row heights are non-uniform",
+ "header style not projected",
+ "whole column 4 fill #F4F6F8",
+ "first-column text style not projected",
+ "border topology not projected",
+ ),
+ }
+
+ def test_projection_helpers_report_each_diagnosed_page(self) -> None:
+ for filename, expected in self.EXPECTED_FINDINGS.items():
+ with self.subTest(filename=filename):
+ warnings = native_object_projection_warnings(
+ _fixture_marker(filename)
+ )
+ joined = "\n".join(warnings)
+ for text in expected:
+ self.assertIn(text, joined)
+
+ def test_explicit_chart_text_axis_and_grid_colors_use_role_inference(self) -> None:
+ marker = ET.fromstring("""
+ <g data-pptx-replace-with="chart" data-pptx-bounds="0 0 400 240">
+ <metadata type="application/json">
+ {
+ "x": 0, "y": 0, "width": 400, "height": 240,
+ "type": "column",
+ "categories": ["A"],
+ "series": [{"name": "Series", "values": [1]}],
+ "style": {
+ "text_color": "#111111",
+ "axis_color": "#222222",
+ "grid_color": "#333333"
+ }
+ }
+ </metadata>
+ <text x="20" y="220" fill="#AAAAAA">A</text>
+ <line id="x-axis" x1="20" y1="200" x2="380" y2="200"
+ stroke="#BBBBBB" />
+ <line id="gridline-1" x1="20" y1="100" x2="380" y2="100"
+ stroke="#CCCCCC" />
+ <rect id="bar-0" x="100" y="80" width="80" height="120"
+ fill="#4472C4" />
+ </g>
+ """)
+
+ joined = "\n".join(native_object_projection_warnings(marker))
+
+ self.assertIn(
+ "style.text_color #111111 differs from fallback dominant text_color #AAAAAA",
+ joined,
+ )
+ self.assertIn(
+ "style.axis_color #222222 differs from fallback dominant axis_color #BBBBBB",
+ joined,
+ )
+ self.assertIn(
+ "style.grid_color #333333 differs from fallback dominant grid_color #CCCCCC",
+ joined,
+ )
+
+ def test_checker_surfaces_projection_findings_as_warnings(self) -> None:
+ checker = SVGQualityChecker()
+ for filename, expected in self.EXPECTED_FINDINGS.items():
+ with self.subTest(filename=filename):
+ result = {"errors": [], "warnings": []}
+ checker._check_native_object_markers(
+ _fixture_root(filename),
+ result,
+ )
+ joined = "\n".join(result["warnings"])
+ for text in expected:
+ self.assertIn(text, joined)
+ self.assertFalse(result["errors"])
+
+ def test_native_export_preflight_collects_the_same_findings(self) -> None:
+ fixture_paths = [
+ FIXTURES_DIR / filename
+ for filename in self.EXPECTED_FINDINGS
+ ]
+
+ findings = _native_object_projection_findings(fixture_paths)
+ findings_by_page: dict[str, str] = {}
+ for filename, _marker_id, warning in findings:
+ findings_by_page.setdefault(filename, "")
+ findings_by_page[filename] += warning + "\n"
+
+ self.assertEqual(set(findings_by_page), set(self.EXPECTED_FINDINGS))
+ for filename, expected in self.EXPECTED_FINDINGS.items():
+ with self.subTest(filename=filename):
+ for text in expected:
+ self.assertIn(text, findings_by_page[filename])
+
+
+if __name__ == "__main__":
+ unittest.main()