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:
+6
-1
@@ -104,9 +104,14 @@ def validate_blocks(blocks):
|
||||
if not re.fullmatch('[a-zA-Z0-9_-]{4,50}',ident) or ident in found:raise ValueError('区块 ID 缺失或重复')
|
||||
found.add(ident)
|
||||
spec=BLOCKS[block['type']]
|
||||
allowed=set(spec['fields'])|{'id','type','visible','style'}
|
||||
allowed=set(spec['fields'])|{'id','type','visible','style','shared_ref'}
|
||||
normalized={key:val for key,val in block.items() if key in allowed}
|
||||
normalized['id']=ident
|
||||
if 'shared_ref' in normalized:
|
||||
ref=normalized['shared_ref']
|
||||
if not isinstance(ref,dict) or set(ref)!={'id','version','hash'} or not isinstance(ref['id'],str) or not re.fullmatch(r'[a-zA-Z0-9_-]{8,64}',ref['id']) or type(ref['version']) is not int or not 1<=ref['version']<=1000000 or not isinstance(ref['hash'],str) or not re.fullmatch('[a-f0-9]{64}',ref['hash']):
|
||||
raise ValueError('无效的公共组件引用')
|
||||
normalized['shared_ref']={'id':ref['id'],'version':ref['version'],'hash':ref['hash']}
|
||||
if 'style' in normalized:
|
||||
style=normalized['style']
|
||||
if not isinstance(style,dict):raise ValueError('样式必须为对象')
|
||||
|
||||
Reference in New Issue
Block a user