Switch Type B layouts to full-body flow

This commit is contained in:
2026-04-06 16:03:16 +09:00
parent 65f800296d
commit 4a71d7db88
39 changed files with 405 additions and 396 deletions

View File

@@ -149,6 +149,18 @@ def _stage_1_5a(ctx: PipelineContext) -> PipelineContext:
ctx.preset_name = preset_name
ctx.preset = LAYOUT_PRESETS.get(preset_name, {})
if not _is_run001_style_document(ctx, ctx.raw_content or ''):
ctx.preset_name = 'sidebar-right'
ctx.preset = {
**LAYOUT_PRESETS.get('sidebar-right', {}),
'grid_columns': '1fr 0fr',
'zones': {
**LAYOUT_PRESETS.get('sidebar-right', {}).get('zones', {}),
'body': {**LAYOUT_PRESETS.get('sidebar-right', {}).get('zones', {}).get('body', {}), 'width_pct': 100},
'sidebar': {**LAYOUT_PRESETS.get('sidebar-right', {}).get('zones', {}).get('sidebar', {}), 'width_pct': 0, 'budget_px': 0},
},
}
container_specs = calculate_container_specs(
page_structure=ctx.page_structure.roles,
topics=[t.model_dump() for t in ctx.topics],
@@ -605,8 +617,7 @@ def _component_placeholder(title: str, summary: str) -> str:
def _type_b_body_shell(inner_html: str) -> str:
return (
'<div style="width:calc(153.85% + 18px); max-width:none; margin-right:calc(-53.85% - 18px); height:100%; '
'box-sizing:border-box; font-family:Segoe UI,sans-serif; color:#0f172a; '
'<div style="width:100%; height:100%; box-sizing:border-box; font-family:Segoe UI,sans-serif; color:#0f172a; '
'display:flex; flex-direction:column; gap:12px; position:relative; z-index:2;">'
f'{inner_html}'
'</div>'
@@ -803,7 +814,7 @@ def _build_goal_image_stakeholder_layout(ctx: PipelineContext, raw: str) -> dict
for group in process_groups[:4]
)
process_card = (
'<div style="background:#ffffff; border:1px solid #cbd5e1; border-radius:14px; padding:14px; box-sizing:border-box; height:100%;">'
'<div style="background:#ffffff; border:1px solid #cbd5e1; border-radius:14px; padding:14px; box-sizing:border-box;">'
f'<div style="font-size:14px; font-weight:900; color:#0f172a; margin-bottom:10px;">{process_title}</div>'
f'<div style="display:grid; grid-template-columns:1fr 1fr; gap:10px;">{process_cards_html}</div>'
f'<div style="display:flex; justify-content:flex-end; margin-top:10px;">{_popup_button("popup-process", "Process details")}</div>'
@@ -824,18 +835,17 @@ def _build_goal_image_stakeholder_layout(ctx: PipelineContext, raw: str) -> dict
stakeholder_cards_html = _component_placeholder(support_title, _prefer_source_text(support_topic, 'No stakeholder detail available.'))
stakeholder_card = (
'<div style="background:#ffffff; border:1px solid #cbd5e1; border-radius:14px; padding:14px; box-sizing:border-box; height:100%; display:flex; flex-direction:column;">'
'<div style="background:#ffffff; border:1px solid #cbd5e1; border-radius:14px; padding:14px; box-sizing:border-box; display:flex; flex-direction:column;">'
f'<div style="font-size:14px; font-weight:900; color:#0f172a; margin-bottom:10px;">{support_title}</div>'
f'<div style="display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:10px; flex:1;">{stakeholder_cards_html}</div>'
f'<div style="display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:10px;">{stakeholder_cards_html}</div>'
f'<div style="display:flex; justify-content:flex-end; margin-top:10px;">{_popup_button("popup-stakeholder", "Stakeholder details")}</div>'
'</div>'
)
body_inner = (
f'{goal_card}'
'<div style="display:grid; grid-template-columns:1.08fr 0.92fr; gap:12px; flex:1;">'
f'{process_card}{stakeholder_card}'
'</div>'
f'{process_card}'
f'{stakeholder_card}'
f'{goal_popup}{process_popup}{stakeholder_popup}'
)
body_html = _type_b_body_shell(body_inner)
@@ -899,7 +909,7 @@ def _build_requirements_process_product_layout(ctx: PipelineContext, raw: str) -
for group in process_groups
)
process_block = (
'<div style="background:#ffffff; border:1px solid #cbd5e1; border-radius:14px; padding:14px; box-sizing:border-box; height:100%;">'
'<div style="background:#ffffff; border:1px solid #cbd5e1; border-radius:14px; padding:14px; box-sizing:border-box;">'
f'<div style="font-size:14px; font-weight:900; color:#0f172a; margin-bottom:10px;">{process_title}</div>'
f'<div style="display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:10px;">{process_cards}</div>'
f'<div style="display:flex; justify-content:flex-end; margin-top:10px;">{_popup_button("popup-process", "Process details")}</div>'
@@ -920,18 +930,17 @@ def _build_requirements_process_product_layout(ctx: PipelineContext, raw: str) -
for group in product_groups
)
product_block = (
'<div style="background:#ffffff; border:1px solid #cbd5e1; border-radius:14px; padding:14px; box-sizing:border-box; height:100%;">'
'<div style="background:#ffffff; border:1px solid #cbd5e1; border-radius:14px; padding:14px; box-sizing:border-box;">'
f'<div style="font-size:14px; font-weight:900; color:#0f172a; margin-bottom:10px;">{product_title}</div>'
f'<div style="display:grid; grid-template-columns:1fr; gap:10px;">{product_cards}</div>'
f'<div style="display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:10px;">{product_cards}</div>'
f'<div style="display:flex; justify-content:flex-end; margin-top:10px;">{_popup_button("popup-product", "Product details")}</div>'
'</div>'
)
body_inner = (
f'{requirements_block}'
'<div style="display:grid; grid-template-columns:1.06fr 0.94fr; gap:12px; flex:1;">'
f'{process_block}{product_block}'
'</div>'
f'{process_block}'
f'{product_block}'
f'{req_popup}{process_popup}{product_popup}'
)
body_html = _type_b_body_shell(body_inner)