UNPKG

laif-ds

Version:

Design System di Laif con componenti React basati su principi di Atomic Design

103 lines (102 loc) 3.46 kB
"use client"; import { $isElementNode as a, $getRoot as u, $getChildCaret as d, makeStepwiseIterator as f, $isSiblingCaret as m } from "../../lexical/Lexical.prod.js"; import { isBlockDomNode as j, isHTMLAnchorElement as O, isHTMLElement as _, isInlineDomNode as k } from "../../lexical/Lexical.prod.js"; function g(t, ...n) { const e = new URL("https://lexical.dev/docs/error"), o = new URLSearchParams(); o.append("code", t); for (const r of n) o.append("v", r); throw e.search = o.toString(), Error(`Minified Lexical error #${t}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`); } const i = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, p = i && "documentMode" in document ? document.documentMode : null, h = i && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent); !(!i || !("InputEvent" in window) || p) && "getTargetRanges" in new window.InputEvent("input"); function l(...t) { const n = []; for (const e of t) if (e && typeof e == "string") for (const [o] of e.matchAll(/\S+/g)) n.push(o); return n; } function N(...t) { return () => { for (let n = t.length - 1; n >= 0; n--) t[n](); t.length = 0; }; } const w = i, v = h; function A(t, ...n) { const e = l(...n); e.length > 0 && t.classList.add(...e); } function L(t, ...n) { const e = l(...n); e.length > 0 && t.classList.remove(...e); } function M(t) { return t ? t.getAdjacentCaret() : null; } function S(t, n) { let e = t; for (; e != null; ) { if (e instanceof n) return e; e = e.getParent(); } return null; } function x(t) { const n = y(t, ((e) => a(e) && !e.isInline())); return a(n) || g(4, t.__key), n; } const y = (t, n) => { let e = t; for (; e !== u() && e != null; ) { if (n(e)) return e; e = e.getParent(); } return null; }; function I(t, n) { return t !== null && Object.getPrototypeOf(t).constructor.name === n.name; } let s = !(v || !w) && void 0; function P(t) { let n = 1; if ((function() { if (s === void 0) { const e = document.createElement("div"); e.style.cssText = "position: absolute; opacity: 0; width: 100px; left: -1000px;", document.body.appendChild(e); const o = e.getBoundingClientRect(); e.style.setProperty("zoom", "2"), s = e.getBoundingClientRect().width === o.width, document.body.removeChild(e); } return s; })()) for (; t; ) n *= Number(window.getComputedStyle(t).getPropertyValue("zoom")), t = t.parentElement; return n; } function R(t, n) { const e = [], o = Array.from(t).reverse(); for (let r = o.pop(); r !== void 0; r = o.pop()) if (n(r)) e.push(r); else if (a(r)) for (const c of C(r)) o.push(c); return e; } function C(t) { return E(d(t, "previous")); } function E(t) { return f({ hasNext: m, initial: t.getAdjacentCaret(), map: (n) => n.origin.getLatest(), step: (n) => n.getAdjacentCaret() }); } export { R as $descendantsMatching, y as $findMatchingParent, M as $getAdjacentCaret, x as $getNearestBlockElementAncestorOrThrow, S as $getNearestNodeOfType, C as $lastToFirstIterator, w as CAN_USE_DOM, v as IS_FIREFOX, A as addClassNamesToElement, P as calculateZoomLevel, j as isBlockDomNode, O as isHTMLAnchorElement, _ as isHTMLElement, k as isInlineDomNode, N as mergeRegister, I as objectKlassEquals, L as removeClassNamesFromElement };