/**
* 画个标 · 海报渲染引擎:元素数组 → SVG 字符串
*/
const HGB_PosterRenderer = (function () {
'use strict';
function esc(s) {
return String(s).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"');
}
function elToSvg(el) {
if (el.type === 'rect') {
return ``;
}
if (el.type === 'circle') {
return ``;
}
if (el.type === 'text') {
const anchor = el.align === 'middle' ? 'middle' : 'start';
return `${esc(el.text)}`;
}
if (el.type === 'icon') {
return `${el.svg}`;
}
return '';
}
function render(spec, elements) {
const body = (elements || []).map(elToSvg).join('');
return ``;
}
return { render };
})();