UNPKG

@polgubau/utils

Version:

A collection of utility functions for TypeScript

22 lines 662 B
// src/accessibility/doc-dir/getDocumentDirection.ts var DirEnum = /* @__PURE__ */ ((DirEnum2) => { DirEnum2["rtl"] = "rtl"; DirEnum2["ltr"] = "ltr"; DirEnum2["auto"] = "auto"; return DirEnum2; })(DirEnum || {}); function getDocumentDirection() { if (typeof window === "undefined" || !window.document) { return "ltr"; } const dirAttribute = document.documentElement.getAttribute("dir"); if (dirAttribute === "auto" /* auto */ || !dirAttribute) { return window.getComputedStyle(document.documentElement).direction; } return dirAttribute; } export { DirEnum, getDocumentDirection }; //# sourceMappingURL=getDocumentDirection.mjs.map