laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
37 lines (36 loc) • 1.61 kB
JavaScript
"use client";
import { checkBullet as o } from "../util/check-bullet.js";
import { checkBulletOther as b } from "../util/check-bullet-other.js";
import { checkBulletOrdered as x } from "../util/check-bullet-ordered.js";
import { checkRule as g } from "../util/check-rule.js";
function C(l, h, e, u) {
const d = e.enter("list"), k = e.bulletCurrent;
let r = l.ordered ? x(e) : o(e);
const f = l.ordered ? r === "." ? ")" : "." : b(e);
let n = h && e.bulletLastUsed ? r === e.bulletLastUsed : !1;
if (!l.ordered) {
const c = l.children ? l.children[0] : void 0;
if (
// Bullet could be used as a thematic break marker:
(r === "*" || r === "-") && // Empty first list item:
c && (!c.children || !c.children[0]) && // Directly in two other list items:
e.stack[e.stack.length - 1] === "list" && e.stack[e.stack.length - 2] === "listItem" && e.stack[e.stack.length - 3] === "list" && e.stack[e.stack.length - 4] === "listItem" && // That are each the first child.
e.indexStack[e.indexStack.length - 1] === 0 && e.indexStack[e.indexStack.length - 2] === 0 && e.indexStack[e.indexStack.length - 3] === 0 && (n = !0), g(e) === r && c
) {
let t = -1;
for (; ++t < l.children.length; ) {
const i = l.children[t];
if (i && i.type === "listItem" && i.children && i.children[0] && i.children[0].type === "thematicBreak") {
n = !0;
break;
}
}
}
}
n && (r = f), e.bulletCurrent = r;
const m = e.containerFlow(l, u);
return e.bulletLastUsed = r, e.bulletCurrent = k, d(), m;
}
export {
C as list
};