laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
55 lines (54 loc) • 1.75 kB
JavaScript
"use client";
import { htmlVoidElements as r } from "../../html-void-elements/index.js";
import { svg as a, html as n } from "../../property-information/index.js";
import { handle as i } from "./handle/index.js";
const c = {}, m = {}, f = [];
function C(s, o) {
const e = o || c, t = e.quote || '"', l = t === '"' ? "'" : '"';
if (t !== '"' && t !== "'")
throw new Error("Invalid quote `" + t + "`, expected `'` or `\"`");
return {
one: p,
all: u,
settings: {
omitOptionalTags: e.omitOptionalTags || !1,
allowParseErrors: e.allowParseErrors || !1,
allowDangerousCharacters: e.allowDangerousCharacters || !1,
quoteSmart: e.quoteSmart || !1,
preferUnquoted: e.preferUnquoted || !1,
tightAttributes: e.tightAttributes || !1,
upperDoctype: e.upperDoctype || !1,
tightDoctype: e.tightDoctype || !1,
bogusComments: e.bogusComments || !1,
tightCommaSeparatedLists: e.tightCommaSeparatedLists || !1,
tightSelfClosing: e.tightSelfClosing || !1,
collapseEmptyAttributes: e.collapseEmptyAttributes || !1,
allowDangerousHtml: e.allowDangerousHtml || !1,
voids: e.voids || r,
characterReferences: e.characterReferences || m,
closeSelfClosing: e.closeSelfClosing || !1,
closeEmptyElements: e.closeEmptyElements || !1
},
schema: e.space === "svg" ? a : n,
quote: t,
alternative: l
}.one(
Array.isArray(s) ? { type: "root", children: s } : s,
void 0,
void 0
);
}
function p(s, o, e) {
return i(s, o, e, this);
}
function u(s) {
const o = [], e = s && s.children || f;
let t = -1;
for (; ++t < e.length; )
o[t] = this.one(e[t], t, s);
return o.join("");
}
export {
u as all,
C as toHtml
};