@dashadmin/dash-boilerplate 1.3.48 → 1.3.49

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.
package/dist/index.cjs CHANGED
@@ -754,16 +754,31 @@ var DashThemeProviderLight = ({
754
754
  for (const mutation of mutations) {
755
755
  for (const node of Array.from(mutation.addedNodes)) {
756
756
  if (!(node instanceof HTMLElement)) continue;
757
- const isStylesheet = node.tagName === "STYLE" || node.tagName === "LINK" && node.rel === "stylesheet";
758
- if (isStylesheet && node.id !== "dash-theme-variables") {
757
+ if (node.id === "dash-theme-variables") continue;
758
+ if (node.tagName === "STYLE") {
759
759
  rerun();
760
- return;
760
+ } else if (node.tagName === "LINK" && node.rel === "stylesheet") {
761
+ const link = node;
762
+ if (link.sheet) {
763
+ rerun();
764
+ } else {
765
+ link.addEventListener("load", rerun, { once: true });
766
+ }
761
767
  }
762
768
  }
763
769
  }
764
770
  });
765
771
  observer.observe(document.head, { childList: true });
766
- return () => observer.disconnect();
772
+ const onWindowLoad = () => rerun();
773
+ if (document.readyState === "complete") {
774
+ rerun();
775
+ } else {
776
+ window.addEventListener("load", onWindowLoad, { once: true });
777
+ }
778
+ return () => {
779
+ observer.disconnect();
780
+ window.removeEventListener("load", onWindowLoad);
781
+ };
767
782
  }, []);
768
783
  const contextValue = (0, import_react4.useMemo)(
769
784
  () => ({
package/dist/index.js CHANGED
@@ -683,16 +683,31 @@ var DashThemeProviderLight = ({
683
683
  for (const mutation of mutations) {
684
684
  for (const node of Array.from(mutation.addedNodes)) {
685
685
  if (!(node instanceof HTMLElement)) continue;
686
- const isStylesheet = node.tagName === "STYLE" || node.tagName === "LINK" && node.rel === "stylesheet";
687
- if (isStylesheet && node.id !== "dash-theme-variables") {
686
+ if (node.id === "dash-theme-variables") continue;
687
+ if (node.tagName === "STYLE") {
688
688
  rerun();
689
- return;
689
+ } else if (node.tagName === "LINK" && node.rel === "stylesheet") {
690
+ const link = node;
691
+ if (link.sheet) {
692
+ rerun();
693
+ } else {
694
+ link.addEventListener("load", rerun, { once: true });
695
+ }
690
696
  }
691
697
  }
692
698
  }
693
699
  });
694
700
  observer.observe(document.head, { childList: true });
695
- return () => observer.disconnect();
701
+ const onWindowLoad = () => rerun();
702
+ if (document.readyState === "complete") {
703
+ rerun();
704
+ } else {
705
+ window.addEventListener("load", onWindowLoad, { once: true });
706
+ }
707
+ return () => {
708
+ observer.disconnect();
709
+ window.removeEventListener("load", onWindowLoad);
710
+ };
696
711
  }, []);
697
712
  const contextValue = useMemo2(
698
713
  () => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashadmin/dash-boilerplate",
3
- "version": "1.3.48",
3
+ "version": "1.3.49",
4
4
  "main": "dist/index.cjs",
5
5
  "type": "module",
6
6
  "scripts": {