@qodin-co/sol 0.1.2 → 0.1.4
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/devtools/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as getSessionIsLive, c as setSessionTimeMinutes, i as clearSessionTimeMinutes, n as useSolarTheme, o as getSessionTimeMinutes, s as setSessionLive } from "../solar-theme-provider-
|
|
1
|
+
import { a as getSessionIsLive, c as setSessionTimeMinutes, i as clearSessionTimeMinutes, n as useSolarTheme, o as getSessionTimeMinutes, s as setSessionLive } from "../solar-theme-provider-DSYQUslj.js";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { createPortal } from "react-dom";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as lerpHex, n as useSolarTheme, r as SKINS, t as SolarThemeProvider } from "./solar-theme-provider-
|
|
1
|
+
import { l as lerpHex, n as useSolarTheme, r as SKINS, t as SolarThemeProvider } from "./solar-theme-provider-DSYQUslj.js";
|
|
2
2
|
import { useEffect, useMemo, useState } from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -650,6 +650,11 @@ function buildPhaseTimeline(times) {
|
|
|
650
650
|
];
|
|
651
651
|
}
|
|
652
652
|
function getSolarBlend(localMinutes, times) {
|
|
653
|
+
if (!times) return {
|
|
654
|
+
phase: "morning",
|
|
655
|
+
nextPhase: "solar-noon",
|
|
656
|
+
t: 0
|
|
657
|
+
};
|
|
653
658
|
const timeline = buildPhaseTimeline(times);
|
|
654
659
|
for (let i$1 = 0; i$1 < timeline.length; i$1++) {
|
|
655
660
|
const { phase, startMinute, endMinute } = timeline[i$1];
|
|
@@ -696,10 +701,10 @@ function useSolarPosition(options = {}) {
|
|
|
696
701
|
const tz = timezone ?? DEFAULT_TZ;
|
|
697
702
|
simulatedDate?.getTime();
|
|
698
703
|
const [position, setPosition] = useState(() => {
|
|
699
|
-
if (typeof window !== "undefined") {
|
|
704
|
+
if (typeof window !== "undefined" && typeof document !== "undefined") try {
|
|
700
705
|
const date = simulatedDate ?? /* @__PURE__ */ new Date();
|
|
701
706
|
return computeSolarPosition(date, lat, lon, utcOffsetFromTimezone(tz, date));
|
|
702
|
-
}
|
|
707
|
+
} catch {}
|
|
703
708
|
return {
|
|
704
709
|
altitude: 45,
|
|
705
710
|
azimuth: 180,
|
|
@@ -719,7 +724,7 @@ function useSolarPosition(options = {}) {
|
|
|
719
724
|
});
|
|
720
725
|
const [isReady, setIsReady] = useState(() => typeof window !== "undefined");
|
|
721
726
|
const prevCoordsRef = useRef(null);
|
|
722
|
-
if (typeof window !== "undefined") {
|
|
727
|
+
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
723
728
|
const prev = prevCoordsRef.current;
|
|
724
729
|
if (prev === null || prev.lat !== lat || prev.lon !== lon || prev.tz !== tz) {
|
|
725
730
|
prevCoordsRef.current = {
|
|
@@ -53731,4 +53736,4 @@ function SolarThemeProvider({ children, initialDesign = "foundry", isolated = fa
|
|
|
53731
53736
|
|
|
53732
53737
|
//#endregion
|
|
53733
53738
|
export { getSessionIsLive as a, setSessionTimeMinutes as c, clearSessionTimeMinutes as i, lerpHex as l, useSolarTheme as n, getSessionTimeMinutes as o, SKINS as r, setSessionLive as s, SolarThemeProvider as t };
|
|
53734
|
-
//# sourceMappingURL=solar-theme-provider-
|
|
53739
|
+
//# sourceMappingURL=solar-theme-provider-DSYQUslj.js.map
|