upgrade: adopt V8.31.1 (theme 1.3/1.4 redesigns, editor deep-canvas, guided launch, component library)

Overlay 190 upstream items (V8.22→8.31) preserving trade-pro theme,
registry tests, and design docs. Re-applied full patch set on identical
anchors (discovery/env_for/blocks.css/type-mapping/locale-override/
theme_color/frontend entries/test_theme_pro_v3 mods) plus compose pins.

Verified: theme suites 35/35; dual-baseline full run 415 passed vs
pristine 386+29 ours, FAILED-set diff EMPTY (same 10 Windows env fails).
Live: container 8.31.1-dev.1 healthy, hesupipe 192 entries intact,
trade-pro build 203 pages 0 errors.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-10-26 09:43:17 +08:00
parent a63548c645
commit 8884e100f9
647 changed files with 20853 additions and 271 deletions
+36
View File
@@ -277,6 +277,36 @@ def theme_preview_pro_css(theme_id:str,version:str=''):
asset=folder/'pro.css'
return Response(asset.read_text(encoding='utf-8') if asset.exists() else '',media_type='text/css')
@router.get('/themes/{theme_id}/preview.bundle.css')
def preview_automotive_bundle_css(theme_id:str,version:str=''):
"""Read-only editor preview: same cascade as the static automotive build."""
from fastapi.responses import Response
from . import static_site
folder=theme_store.resolve(theme_id,version or None)
if theme_id != 'automotive' or not (folder/'auto-icons.svg').is_file():
raise HTTPException(404,'此主题没有优化资源包')
names=[folder/'theme.css',static_site.ASSETS/'blocks.css',static_site.ASSETS/'factory.css',
static_site.ASSETS/'pro-base.css',folder/'pro.css',static_site.ASSETS/'commercial.css']
return Response('\n'.join(p.read_text(encoding='utf-8') for p in names), media_type='text/css')
@router.get('/themes/{theme_id}/preview.bundle.js')
def preview_automotive_bundle_js(theme_id:str,version:str=''):
from fastapi.responses import Response
from . import static_site
folder=theme_store.resolve(theme_id,version or None)
if theme_id != 'automotive' or not (folder/'auto-icons.svg').is_file():
raise HTTPException(404,'此主题没有优化资源包')
names=[static_site.ASSETS/name for name in ('site-runtime.js','pro.js','auto31.js')]
return Response('\n;\n'.join(p.read_text(encoding='utf-8') for p in names),media_type='application/javascript')
@router.get('/themes/{theme_id}/preview.icons.svg')
def preview_automotive_icons(theme_id:str,version:str=''):
from fastapi.responses import Response
folder=theme_store.resolve(theme_id,version or None)
if theme_id != 'automotive' or not (folder/'auto-icons.svg').is_file():
raise HTTPException(404,'此主题没有此图标集')
return Response((folder/'auto-icons.svg').read_bytes(),media_type='image/svg+xml',headers={'Cache-Control':'public,max-age=300'})
@router.get('/themes/{theme_id}/visual/hero.svg')
def theme_preview_hero(theme_id:str,version:str=''):
from fastapi.responses import Response
@@ -319,6 +349,12 @@ def theme_preview(theme_id:str,version:str='',page_type:str='home'):
context=theme_pro.make_context(site,page,records,'home' if page_type=='home' else ('notfound' if page_type=='notfound' else 'detail'),[])
context.update(custom_blocks=Markup(''),has_custom=False,noindex=page_type=='notfound',theme_overrides=True)
html=env.get_template('pro.html').render(**context)
if theme_id=='automotive' and (directory/'auto-icons.svg').is_file():
ver=version or theme_store.latest(theme_id)
root=f'/api/factory/themes/automotive/preview'
html=html.replace('assets/auto-compiled.css',f'{root}.bundle.css?version={ver}')
html=html.replace('assets/auto-compiled.js',f'{root}.bundle.js?version={ver}')
html=html.replace('assets/auto-icons.svg#',f'{root}.icons.svg?version={ver}#')
html=html.replace('assets/pro-base.css','/ui/pro-base.css').replace('assets/pro.js','/ui/pro.js').replace('assets/commercial.css','/ui/commercial.css')
html=html.replace('assets/pro.css',f'/api/factory/themes/{theme_id}/preview.pro.css?version={version or theme_store.latest(theme_id)}')
html=html.replace('assets/theme-overrides.css',f'/api/factory/themes/{theme_id}/preview.css?version={version or theme_store.latest(theme_id)}')