@underverse-ui/underverse 1.0.31 → 1.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@underverse-ui/underverse",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
4
4
  "sourceEntry": "src/index.ts",
5
5
  "totalExports": 206,
6
6
  "exports": [
package/dist/index.cjs CHANGED
@@ -107,7 +107,7 @@ __export(index_exports, {
107
107
  NotificationModal: () => NotificationModal_default,
108
108
  NumberInput: () => NumberInput,
109
109
  OverlayControls: () => OverlayControls,
110
- OverlayScrollbarProvider: () => OverlayScrollbarProvider,
110
+ OverlayScrollbarProvider: () => OverlayScrollbarProvider_default,
111
111
  PageLoading: () => PageLoading,
112
112
  Pagination: () => Pagination,
113
113
  PasswordInput: () => PasswordInput,
@@ -19018,16 +19018,14 @@ var LoadingBar = ({
19018
19018
  // ../../components/ui/OverlayScrollbarProvider.tsx
19019
19019
  var import_react33 = require("react");
19020
19020
  var import_overlayscrollbars = require("overlayscrollbars");
19021
- var EXPLICIT_SCROLLABLE_SELECTOR = [".thin-scrollbar", ".scrollbar-thin", ".custom-scrollbar", "[data-os-scrollbar]"].join(", ");
19022
- var GENERIC_SCROLLABLE_SELECTOR = [
19023
- ".overflow-auto",
19024
- ".overflow-x-auto",
19025
- ".overflow-y-auto",
19026
- ".overflow-scroll",
19027
- ".overflow-x-scroll",
19028
- ".overflow-y-scroll"
19021
+ var EXPLICIT_SELECTOR = [".thin-scrollbar", ".scrollbar-thin", ".custom-scrollbar", "[data-os-scrollbar]"].join(", ");
19022
+ var PORTAL_EXCLUDE_SELECTOR = [
19023
+ "[data-radix-portal]",
19024
+ "[role='dialog']",
19025
+ "[aria-modal='true']",
19026
+ "[data-sonner-toaster]"
19029
19027
  ].join(", ");
19030
- var SCROLLBAR_OPTIONS = {
19028
+ var OPTIONS = {
19031
19029
  scrollbars: {
19032
19030
  theme: "os-theme-underverse",
19033
19031
  visibility: "auto",
@@ -19037,42 +19035,27 @@ var SCROLLBAR_OPTIONS = {
19037
19035
  clickScroll: false
19038
19036
  }
19039
19037
  };
19038
+ function shouldSkip(element) {
19039
+ if (element === document.body || element === document.documentElement) return true;
19040
+ if (element.hasAttribute("data-os-ignore")) return true;
19041
+ if (element.hasAttribute("data-overlayscrollbars")) return true;
19042
+ if (element.closest(PORTAL_EXCLUDE_SELECTOR)) return true;
19043
+ return false;
19044
+ }
19040
19045
  function OverlayScrollbarProvider() {
19041
19046
  (0, import_react33.useEffect)(() => {
19042
- const bodyInstance = (0, import_overlayscrollbars.OverlayScrollbars)(document.body, SCROLLBAR_OPTIONS);
19043
19047
  const instances = /* @__PURE__ */ new Map();
19044
- const shouldSkip = (element) => {
19045
- if (element === document.body) return true;
19046
- if (element.hasAttribute("data-os-ignore")) return true;
19047
- if (element.hasAttribute("data-overlayscrollbars")) return true;
19048
- return false;
19049
- };
19050
- const initElement = (element) => {
19048
+ let rafId = 0;
19049
+ const init = (element) => {
19051
19050
  if (shouldSkip(element)) return;
19052
19051
  if (instances.has(element)) return;
19053
- instances.set(element, (0, import_overlayscrollbars.OverlayScrollbars)(element, SCROLLBAR_OPTIONS));
19054
- };
19055
- const collectCandidates = (root, selector) => {
19056
- const candidates = [];
19057
- if (root instanceof HTMLElement && root.matches(selector)) {
19058
- candidates.push(root);
19059
- }
19060
- if ("querySelectorAll" in root) {
19061
- root.querySelectorAll(selector).forEach((element) => {
19062
- candidates.push(element);
19063
- });
19064
- }
19065
- return candidates.filter((element, index) => candidates.indexOf(element) === index);
19052
+ instances.set(element, (0, import_overlayscrollbars.OverlayScrollbars)(element, OPTIONS));
19066
19053
  };
19067
19054
  const scan = (root) => {
19068
- const explicitCandidates = collectCandidates(root, EXPLICIT_SCROLLABLE_SELECTOR).filter((element) => !shouldSkip(element));
19069
- explicitCandidates.forEach(initElement);
19070
- const genericCandidates = collectCandidates(root, GENERIC_SCROLLABLE_SELECTOR).filter((element) => !shouldSkip(element));
19071
- const filteredGeneric = genericCandidates.filter(
19072
- (element) => !explicitCandidates.some((explicit) => explicit === element || explicit.contains(element) || element.contains(explicit))
19073
- );
19074
- const leafGeneric = filteredGeneric.filter((element) => !filteredGeneric.some((other) => other !== element && element.contains(other)));
19075
- leafGeneric.forEach(initElement);
19055
+ if (root instanceof HTMLElement && root.matches(EXPLICIT_SELECTOR)) {
19056
+ init(root);
19057
+ }
19058
+ root.querySelectorAll(EXPLICIT_SELECTOR).forEach(init);
19076
19059
  };
19077
19060
  const cleanup = () => {
19078
19061
  instances.forEach((instance, element) => {
@@ -19083,14 +19066,13 @@ function OverlayScrollbarProvider() {
19083
19066
  });
19084
19067
  };
19085
19068
  scan(document.body);
19086
- let rafId = 0;
19087
19069
  const observer = new MutationObserver((mutations) => {
19088
19070
  if (rafId) return;
19089
- rafId = window.requestAnimationFrame(() => {
19071
+ rafId = requestAnimationFrame(() => {
19090
19072
  rafId = 0;
19091
19073
  const scanRoots = /* @__PURE__ */ new Set();
19092
19074
  mutations.forEach((mutation) => {
19093
- if (mutation.target instanceof Element || mutation.target instanceof Document || mutation.target instanceof DocumentFragment) {
19075
+ if (mutation.target instanceof HTMLElement || mutation.target instanceof Document || mutation.target instanceof DocumentFragment) {
19094
19076
  scanRoots.add(mutation.target);
19095
19077
  }
19096
19078
  mutation.addedNodes.forEach((node) => {
@@ -19103,16 +19085,17 @@ function OverlayScrollbarProvider() {
19103
19085
  cleanup();
19104
19086
  });
19105
19087
  });
19106
- observer.observe(document.body, { childList: true, subtree: true });
19088
+ observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ["class"] });
19107
19089
  return () => {
19108
- if (rafId) window.cancelAnimationFrame(rafId);
19090
+ if (rafId) cancelAnimationFrame(rafId);
19109
19091
  observer.disconnect();
19110
19092
  instances.forEach((instance) => instance.destroy());
19111
- bodyInstance.destroy();
19093
+ instances.clear();
19112
19094
  };
19113
19095
  }, []);
19114
19096
  return null;
19115
19097
  }
19098
+ var OverlayScrollbarProvider_default = OverlayScrollbarProvider;
19116
19099
 
19117
19100
  // ../../components/ui/Table.tsx
19118
19101
  var import_react34 = __toESM(require("react"), 1);