@frontify/fondue
Version:
Design system of Frontify
37 lines (36 loc) • 1.35 kB
JavaScript
import { jsx as s } from "react/jsx-runtime";
import { useEditorRef as c } from "@udecode/plate-core";
import { ELEMENT_OL as p, ELEMENT_LI as l } from "@udecode/plate-list";
import { getNodeAncestors as i } from "@udecode/slate";
import { findNodePath as m } from "@udecode/slate-react";
import { MarkupElement as u } from "../../MarkupElement.es.js";
const a = [
"[&>li>p]:before:tw-content-[counter(count,decimal)_'._']",
"[&>li>p]:before:tw-content-[counter(count,_lower-alpha)_'._']",
"[&>li>p]:before:tw-content-[counter(count,lower-roman)_'._']"
], f = (t, o) => {
const e = m(t, o);
if (!e)
return 0;
const r = i(t, e);
return Array.from(r).filter((n) => n[0].type === l).length;
}, d = (t) => `tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px] [&>li>p]:before:tw-whitespace-nowrap [&>li>p]:before:tw-pr-1 [&>li>p]:before:tw-tabular-nums ${a[t % 3]}`, w = { counterReset: "count" }, E = ({
attributes: t,
children: o,
element: e
}) => {
const r = c(), n = f(r, e);
return /* @__PURE__ */ s("ol", { className: d(n), ...t, style: w, children: o });
};
class h extends u {
constructor(o = p, e = E) {
super(o, e);
}
}
export {
w as OL_STYLES,
h as OrderedListMarkupElement,
E as OrderedListMarkupElementNode,
d as getOrderedListClasses
};
//# sourceMappingURL=OrderedListMarkupElement.es.js.map