@almadar/ui 5.122.3 → 5.122.5
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/avl/index.cjs +79 -87
- package/dist/avl/index.js +79 -87
- package/dist/components/index.cjs +9 -17
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +10 -18
- package/dist/providers/index.cjs +79 -87
- package/dist/providers/index.js +80 -88
- package/dist/runtime/index.cjs +79 -87
- package/dist/runtime/index.js +80 -88
- package/package.json +1 -1
package/dist/runtime/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React82 from 'react';
|
|
2
|
-
import React82__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useSyncExternalStore,
|
|
2
|
+
import React82__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useSyncExternalStore, useLayoutEffect, lazy, useId } from 'react';
|
|
3
3
|
import { EventBusContext, useTraitScopeChain, useEntitySchemaOptional, useEntitySchema, getAllPages, OrbitalProvider, TraitScopeProvider, ServerBridgeProvider, useCurrentPagePath, useGameAudioContextOptional, VerificationProvider, EntitySchemaProvider, OrbitalThemeProvider, useServerBridge } from '@almadar/ui/providers';
|
|
4
4
|
export { EntitySchemaProvider, ServerBridgeProvider, TraitContext, TraitProvider, useEntitySchema, useEntitySchemaOptional, useServerBridge, useTrait, useTraitContext } from '@almadar/ui/providers';
|
|
5
5
|
import { createLogger, setNamespaceLevel, isLogLevelEnabled } from '@almadar/logger';
|
|
@@ -1711,6 +1711,77 @@ var init_Typography = __esm({
|
|
|
1711
1711
|
Typography.displayName = "Typography";
|
|
1712
1712
|
}
|
|
1713
1713
|
});
|
|
1714
|
+
function isMotionEnabled() {
|
|
1715
|
+
if (typeof document === "undefined") return true;
|
|
1716
|
+
if (motionEnabledCache !== null) return motionEnabledCache;
|
|
1717
|
+
const v = getComputedStyle(document.documentElement).getPropertyValue("--motion-enable").trim().toLowerCase();
|
|
1718
|
+
motionEnabledCache = v !== "off";
|
|
1719
|
+
return motionEnabledCache;
|
|
1720
|
+
}
|
|
1721
|
+
function usePresence(show, opts) {
|
|
1722
|
+
const { animation, animate = true, onExited } = opts;
|
|
1723
|
+
const [mounted, setMounted] = useState(show);
|
|
1724
|
+
const [exiting, setExiting] = useState(false);
|
|
1725
|
+
const prev = useRef(show);
|
|
1726
|
+
const onExitedRef = useRef(onExited);
|
|
1727
|
+
onExitedRef.current = onExited;
|
|
1728
|
+
const safeTimer = useRef(null);
|
|
1729
|
+
const clearSafe = useCallback(() => {
|
|
1730
|
+
if (safeTimer.current) {
|
|
1731
|
+
clearTimeout(safeTimer.current);
|
|
1732
|
+
safeTimer.current = null;
|
|
1733
|
+
}
|
|
1734
|
+
}, []);
|
|
1735
|
+
const finishExit = useCallback(() => {
|
|
1736
|
+
clearSafe();
|
|
1737
|
+
setExiting(false);
|
|
1738
|
+
setMounted(false);
|
|
1739
|
+
onExitedRef.current?.();
|
|
1740
|
+
}, [clearSafe]);
|
|
1741
|
+
useLayoutEffect(() => {
|
|
1742
|
+
const moving = animate && isMotionEnabled();
|
|
1743
|
+
if (show && !prev.current) {
|
|
1744
|
+
setExiting(false);
|
|
1745
|
+
setMounted(true);
|
|
1746
|
+
} else if (!show && prev.current) {
|
|
1747
|
+
if (moving) {
|
|
1748
|
+
setExiting(true);
|
|
1749
|
+
clearSafe();
|
|
1750
|
+
safeTimer.current = setTimeout(finishExit, SAFE_EXIT_MS);
|
|
1751
|
+
} else {
|
|
1752
|
+
setMounted(false);
|
|
1753
|
+
setExiting(false);
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
prev.current = show;
|
|
1757
|
+
}, [show, animate, clearSafe, finishExit]);
|
|
1758
|
+
useEffect(() => () => clearSafe(), [clearSafe]);
|
|
1759
|
+
const disabled = !animate || !isMotionEnabled();
|
|
1760
|
+
const className = disabled ? "" : exiting ? `animate-${animation}-out` : `animate-${animation}-in`;
|
|
1761
|
+
const onAnimationEnd = useCallback(
|
|
1762
|
+
(e) => {
|
|
1763
|
+
if (e.target !== e.currentTarget) return;
|
|
1764
|
+
if (exiting) finishExit();
|
|
1765
|
+
},
|
|
1766
|
+
[exiting, finishExit]
|
|
1767
|
+
);
|
|
1768
|
+
return { mounted, exiting, className, onAnimationEnd };
|
|
1769
|
+
}
|
|
1770
|
+
var SAFE_EXIT_MS, motionEnabledCache, Presence;
|
|
1771
|
+
var init_Presence = __esm({
|
|
1772
|
+
"components/core/atoms/Presence.tsx"() {
|
|
1773
|
+
"use client";
|
|
1774
|
+
init_cn();
|
|
1775
|
+
SAFE_EXIT_MS = 1e3;
|
|
1776
|
+
motionEnabledCache = null;
|
|
1777
|
+
Presence = ({ show, className, children, ...opts }) => {
|
|
1778
|
+
const { mounted, className: animClass, onAnimationEnd } = usePresence(show, opts);
|
|
1779
|
+
if (!mounted) return null;
|
|
1780
|
+
return /* @__PURE__ */ jsx("div", { className: cn(animClass, className), onAnimationEnd, children });
|
|
1781
|
+
};
|
|
1782
|
+
Presence.displayName = "Presence";
|
|
1783
|
+
}
|
|
1784
|
+
});
|
|
1714
1785
|
var sizeClasses2, minWidthClasses, lookStyles, Modal;
|
|
1715
1786
|
var init_Modal = __esm({
|
|
1716
1787
|
"components/core/molecules/Modal.tsx"() {
|
|
@@ -1721,6 +1792,7 @@ var init_Modal = __esm({
|
|
|
1721
1792
|
init_Typography();
|
|
1722
1793
|
init_cn();
|
|
1723
1794
|
init_useEventBus();
|
|
1795
|
+
init_Presence();
|
|
1724
1796
|
sizeClasses2 = {
|
|
1725
1797
|
sm: "max-w-md",
|
|
1726
1798
|
md: "max-w-2xl",
|
|
@@ -1765,18 +1837,10 @@ var init_Modal = __esm({
|
|
|
1765
1837
|
const [dragY, setDragY] = useState(0);
|
|
1766
1838
|
const dragStartY = useRef(0);
|
|
1767
1839
|
const isDragging = useRef(false);
|
|
1768
|
-
const
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
wasOpenRef.current = isOpen;
|
|
1773
|
-
}, [isOpen]);
|
|
1774
|
-
const handleAnimEnd = (e) => {
|
|
1775
|
-
if (closing && e.target === e.currentTarget) {
|
|
1776
|
-
setClosing(false);
|
|
1777
|
-
onExited?.();
|
|
1778
|
-
}
|
|
1779
|
-
};
|
|
1840
|
+
const { mounted, exiting, onAnimationEnd: handleAnimEnd } = usePresence(isOpen, {
|
|
1841
|
+
animation: "modal",
|
|
1842
|
+
onExited
|
|
1843
|
+
});
|
|
1780
1844
|
useEffect(() => {
|
|
1781
1845
|
if (isOpen) {
|
|
1782
1846
|
previousActiveElement.current = document.activeElement;
|
|
@@ -1811,10 +1875,9 @@ var init_Modal = __esm({
|
|
|
1811
1875
|
};
|
|
1812
1876
|
}, [isOpen]);
|
|
1813
1877
|
if (typeof document === "undefined") return null;
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
const
|
|
1817
|
-
const overlayAnim = closing ? "animate-overlay-out" : "animate-overlay-in";
|
|
1878
|
+
if (!mounted) return null;
|
|
1879
|
+
const dialogAnim = exiting ? "animate-modal-out" : "animate-modal-in";
|
|
1880
|
+
const overlayAnim = exiting ? "animate-overlay-out" : "animate-overlay-in";
|
|
1818
1881
|
const handleClose = () => {
|
|
1819
1882
|
if (closeEvent) eventBus.emit(`UI:${closeEvent}`, {});
|
|
1820
1883
|
onClose();
|
|
@@ -1945,77 +2008,6 @@ var init_Modal = __esm({
|
|
|
1945
2008
|
Modal.displayName = "Modal";
|
|
1946
2009
|
}
|
|
1947
2010
|
});
|
|
1948
|
-
function isMotionEnabled() {
|
|
1949
|
-
if (typeof document === "undefined") return true;
|
|
1950
|
-
if (motionEnabledCache !== null) return motionEnabledCache;
|
|
1951
|
-
const v = getComputedStyle(document.documentElement).getPropertyValue("--motion-enable").trim().toLowerCase();
|
|
1952
|
-
motionEnabledCache = v !== "off";
|
|
1953
|
-
return motionEnabledCache;
|
|
1954
|
-
}
|
|
1955
|
-
function usePresence(show, opts) {
|
|
1956
|
-
const { animation, animate = true, onExited } = opts;
|
|
1957
|
-
const [mounted, setMounted] = useState(show);
|
|
1958
|
-
const [exiting, setExiting] = useState(false);
|
|
1959
|
-
const prev = useRef(show);
|
|
1960
|
-
const onExitedRef = useRef(onExited);
|
|
1961
|
-
onExitedRef.current = onExited;
|
|
1962
|
-
const safeTimer = useRef(null);
|
|
1963
|
-
const clearSafe = useCallback(() => {
|
|
1964
|
-
if (safeTimer.current) {
|
|
1965
|
-
clearTimeout(safeTimer.current);
|
|
1966
|
-
safeTimer.current = null;
|
|
1967
|
-
}
|
|
1968
|
-
}, []);
|
|
1969
|
-
const finishExit = useCallback(() => {
|
|
1970
|
-
clearSafe();
|
|
1971
|
-
setExiting(false);
|
|
1972
|
-
setMounted(false);
|
|
1973
|
-
onExitedRef.current?.();
|
|
1974
|
-
}, [clearSafe]);
|
|
1975
|
-
useEffect(() => {
|
|
1976
|
-
const moving = animate && isMotionEnabled();
|
|
1977
|
-
if (show && !prev.current) {
|
|
1978
|
-
setExiting(false);
|
|
1979
|
-
setMounted(true);
|
|
1980
|
-
} else if (!show && prev.current) {
|
|
1981
|
-
if (moving) {
|
|
1982
|
-
setExiting(true);
|
|
1983
|
-
clearSafe();
|
|
1984
|
-
safeTimer.current = setTimeout(finishExit, SAFE_EXIT_MS);
|
|
1985
|
-
} else {
|
|
1986
|
-
setMounted(false);
|
|
1987
|
-
setExiting(false);
|
|
1988
|
-
}
|
|
1989
|
-
}
|
|
1990
|
-
prev.current = show;
|
|
1991
|
-
}, [show, animate, clearSafe, finishExit]);
|
|
1992
|
-
useEffect(() => () => clearSafe(), [clearSafe]);
|
|
1993
|
-
const disabled = !animate || !isMotionEnabled();
|
|
1994
|
-
const className = disabled ? "" : exiting ? `animate-${animation}-out` : `animate-${animation}-in`;
|
|
1995
|
-
const onAnimationEnd = useCallback(
|
|
1996
|
-
(e) => {
|
|
1997
|
-
if (e.target !== e.currentTarget) return;
|
|
1998
|
-
if (exiting) finishExit();
|
|
1999
|
-
},
|
|
2000
|
-
[exiting, finishExit]
|
|
2001
|
-
);
|
|
2002
|
-
return { mounted, exiting, className, onAnimationEnd };
|
|
2003
|
-
}
|
|
2004
|
-
var SAFE_EXIT_MS, motionEnabledCache, Presence;
|
|
2005
|
-
var init_Presence = __esm({
|
|
2006
|
-
"components/core/atoms/Presence.tsx"() {
|
|
2007
|
-
"use client";
|
|
2008
|
-
init_cn();
|
|
2009
|
-
SAFE_EXIT_MS = 1e3;
|
|
2010
|
-
motionEnabledCache = null;
|
|
2011
|
-
Presence = ({ show, className, children, ...opts }) => {
|
|
2012
|
-
const { mounted, className: animClass, onAnimationEnd } = usePresence(show, opts);
|
|
2013
|
-
if (!mounted) return null;
|
|
2014
|
-
return /* @__PURE__ */ jsx("div", { className: cn(animClass, className), onAnimationEnd, children });
|
|
2015
|
-
};
|
|
2016
|
-
Presence.displayName = "Presence";
|
|
2017
|
-
}
|
|
2018
|
-
});
|
|
2019
2011
|
var Overlay;
|
|
2020
2012
|
var init_Overlay = __esm({
|
|
2021
2013
|
"components/core/atoms/Overlay.tsx"() {
|