@mitcsutt/kiln-dnd
Version:
Kiln drag and drop: sortable lists, boards, drop zones and grid layouts with one keyboard model and one announcer, rendered through kiln-ui
35 lines (34 loc) • 958 B
JavaScript
import { cloneLayout as e, correctBounds as t } from "./layout.js";
import { getCompactor as n } from "./compactors.js";
//#region src/grid/engine/responsive.ts
function r(e) {
return Object.keys(e).sort((t, n) => e[t] - e[n]);
}
function i(e, t) {
let n = r(e), i = n[0];
if (i === void 0) throw Error("No breakpoints defined");
for (let r = 1; r < n.length; r++) {
let a = n[r];
a !== void 0 && t > e[a] && (i = a);
}
return i;
}
function a(i, a, o, s, c, l) {
let u = i[o];
if (u) return e(u);
let d = i[s], f = r(a), p = f.slice(f.indexOf(o));
for (let e = 0; e < p.length; e++) {
let t = p[e];
if (t === void 0) continue;
let n = i[t];
if (n) {
d = n;
break;
}
}
let m = e(d ?? []), h = t(m, { cols: c });
return (typeof l == "object" && l ? l : n(l)).compact(h, c);
}
//#endregion
export { a as findOrGenerateResponsiveLayout, i as getBreakpointFromWidth, r as sortBreakpoints };
//# sourceMappingURL=responsive.js.map