@visactor/vgrammar-core
Version:
VGrammar is a visual grammar library
26 lines (20 loc) • 813 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.richJsx = exports.richXul = void 0;
const vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@visactor/vutils");
function richXul(strings, ...insertVars) {
return {
type: "rich",
text: (0, vrender_core_1.xul)(strings.reduce(((res, temp, i) => res + temp + (i >= insertVars.length ? "" : insertVars[i])), ""))
};
}
function richJsx(richText) {
return {
type: "rich",
text: richText instanceof vrender_core_1.RichText ? richText.attribute.textConfig : (0,
vutils_1.isArray)(richText) ? richText.map((entry => entry.type ? entry.attribute : entry)) : []
};
}
exports.richXul = richXul, exports.richJsx = richJsx;
//# sourceMappingURL=text.js.map