8884e100f9
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>
47 lines
2.4 KiB
JavaScript
47 lines
2.4 KiB
JavaScript
/* SiteForge V8.29: presentation-only studio helpers. No persisted-schema changes. */
|
|
'use strict';
|
|
(function(root){
|
|
const themes=new Set(['automotive','industrial','corporate','minimal']);
|
|
const pages=new Set(['home','listing','product','article','about','contact']);
|
|
const categories={
|
|
visual:new Set(['hero','banner','carousel','gallery','image','image_text','image-grid','video','slider']),
|
|
business:new Set(['collection','products','product_list','brand_wall','brands','features','stats','testimonials','faq','contact','form','cta','map']),
|
|
advanced:new Set(['layout','columns','tabs','accordion','html-embed','embed','spacer','divider'])
|
|
};
|
|
function categoryOf(key){for(const [name,ids] of Object.entries(categories))if(ids.has(key))return name;return 'basic'}
|
|
function groupBlocks(blocks,query=''){
|
|
const result={basic:[],visual:[],business:[],advanced:[]};
|
|
const q=String(query).trim().toLocaleLowerCase().slice(0,70);
|
|
for(const [key,block] of Object.entries(blocks||{})){
|
|
if(!block||typeof block!=='object')continue;
|
|
const text=[key,block.name,block.description].join(' ').toLocaleLowerCase();
|
|
if(q&&!text.includes(q))continue;
|
|
result[categoryOf(key)].push({key,block});
|
|
}
|
|
return result;
|
|
}
|
|
function previewUrl(theme,page){
|
|
if(!themes.has(theme)||!pages.has(page))return null;
|
|
return `/api/factory/themes/${theme}/preview?page_type=${page}`;
|
|
}
|
|
/* Only CSS-token values accepted by the existing server-side block validator. */
|
|
const designPalettes={
|
|
automotive:['#ffffff','#14283d','#f3f6f9','#102e47'],
|
|
industrial:['#ffffff','#193f59','#eef5f8','#104a6d'],
|
|
corporate:['#ffffff','#262d58','#f4f3fb','#34397b'],
|
|
minimal:['#faf9f5','#292924','#f0efe9','#30302c']
|
|
};
|
|
function stylePreset(theme,preset){
|
|
const [base,ink,soft,dark]=designPalettes[themes.has(theme)?theme:'corporate'];
|
|
switch(preset){
|
|
case 'clean':return {background:base,text_color:ink,padding:72};
|
|
case 'soft':return {background:soft,text_color:ink,padding:58};
|
|
case 'feature':return {background:dark,text_color:'#ffffff',padding:90};
|
|
default:return null;
|
|
}
|
|
}
|
|
const api=Object.freeze({categoryOf,groupBlocks,previewUrl,stylePreset});
|
|
if(typeof module!=='undefined'&&module.exports)module.exports=api;
|
|
if(root)root.SiteForgeStudioExperience=api;
|
|
})(typeof window!=='undefined'?window:null);
|