aura-glass 2.0.28 → 2.0.30
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.js +41 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -17
- package/dist/index.mjs.map +1 -1
- package/dist/primitives/OptimizedGlassCore.d.ts.map +1 -1
- package/dist/registry/index.js +44 -35
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/index.mjs +44 -35
- package/dist/registry/index.mjs.map +1 -1
- package/dist/ssr/index.js +9 -3
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/index.mjs +9 -3
- package/dist/ssr/index.mjs.map +1 -1
- package/dist/styled/StyledComponentsRegistry.d.ts +2 -4
- package/dist/styled/StyledComponentsRegistry.d.ts.map +1 -1
- package/dist/styled/index.js +79 -51
- package/dist/styled/index.js.map +1 -1
- package/dist/styled/index.mjs +79 -51
- package/dist/styled/index.mjs.map +1 -1
- package/dist/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/utils/env.d.ts.map +1 -1
- package/package.json +60 -62
package/dist/index.js
CHANGED
|
@@ -112,14 +112,20 @@ function cn$1() {
|
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
114
|
* Environment helpers to centralize SSR/browser detection and safe global access.
|
|
115
|
+
*
|
|
116
|
+
* CRITICAL: These must check dynamically, NOT cache at module load time,
|
|
117
|
+
* to handle polyfills and avoid locking in server environment values.
|
|
118
|
+
*/
|
|
119
|
+
/**
|
|
120
|
+
* Dynamic check - re-evaluates on every call to support polyfills
|
|
115
121
|
*/
|
|
116
|
-
const hasWindow = typeof window !== 'undefined';
|
|
117
|
-
const hasDocument = typeof document !== 'undefined';
|
|
118
|
-
const hasNavigator = typeof navigator !== 'undefined';
|
|
122
|
+
const hasWindow = () => typeof window !== 'undefined';
|
|
123
|
+
const hasDocument = () => typeof document !== 'undefined';
|
|
124
|
+
const hasNavigator = () => typeof navigator !== 'undefined';
|
|
119
125
|
/**
|
|
120
126
|
* Returns true when executed in a browser-like environment.
|
|
121
127
|
*/
|
|
122
|
-
const isBrowser = () => hasWindow && hasDocument;
|
|
128
|
+
const isBrowser = () => hasWindow() && hasDocument();
|
|
123
129
|
/**
|
|
124
130
|
* Convenience inverse helper.
|
|
125
131
|
*/
|
|
@@ -127,15 +133,15 @@ const isServer = () => !isBrowser();
|
|
|
127
133
|
/**
|
|
128
134
|
* Safely access the `window` object when available.
|
|
129
135
|
*/
|
|
130
|
-
const getSafeWindow = () => hasWindow ? window : undefined;
|
|
136
|
+
const getSafeWindow = () => hasWindow() ? window : undefined;
|
|
131
137
|
/**
|
|
132
138
|
* Safely access the `document` object when available.
|
|
133
139
|
*/
|
|
134
|
-
const getSafeDocument = () => hasDocument ? document : undefined;
|
|
140
|
+
const getSafeDocument = () => hasDocument() ? document : undefined;
|
|
135
141
|
/**
|
|
136
142
|
* Safely access the `navigator` object when available.
|
|
137
143
|
*/
|
|
138
|
-
const getSafeNavigator = () => hasNavigator ? navigator : undefined;
|
|
144
|
+
const getSafeNavigator = () => hasNavigator() ? navigator : undefined;
|
|
139
145
|
/**
|
|
140
146
|
* Helper to guard feature detection against SSR environments.
|
|
141
147
|
*/
|
|
@@ -3843,20 +3849,33 @@ const OptimizedGlassCore = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
3843
3849
|
style
|
|
3844
3850
|
} = props,
|
|
3845
3851
|
restProps = _objectWithoutProperties(props, _excluded$2S);
|
|
3846
|
-
//
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
if (tier !== 'high') return tier;
|
|
3851
|
-
//
|
|
3852
|
+
// CRITICAL FIX for SSR hydration: Defer tier detection until after initial render
|
|
3853
|
+
// This prevents className mismatches between server and client
|
|
3854
|
+
const [computedTier, setComputedTier] = React.useState(() => {
|
|
3855
|
+
// If tier is explicitly set (not default 'high'), respect it immediately
|
|
3856
|
+
if (tier !== 'high') return tier;
|
|
3857
|
+
// Start with 'medium' for both server and initial client render
|
|
3858
|
+
return 'medium';
|
|
3859
|
+
});
|
|
3860
|
+
// Auto-detect performance tier on client AFTER hydration
|
|
3861
|
+
React.useEffect(() => {
|
|
3862
|
+
// Only auto-detect if using default tier
|
|
3863
|
+
if (tier !== 'high') {
|
|
3864
|
+
setComputedTier(tier);
|
|
3865
|
+
return;
|
|
3866
|
+
}
|
|
3867
|
+
// Skip detection on server
|
|
3868
|
+
if (!isBrowser()) return;
|
|
3869
|
+
// Detect device capabilities and update tier
|
|
3870
|
+
const device = detectDevice();
|
|
3852
3871
|
if (device.capabilities.gpu && device.capabilities.hardwareAcceleration) {
|
|
3853
|
-
|
|
3872
|
+
setComputedTier('high');
|
|
3854
3873
|
} else if (device.capabilities.webgl) {
|
|
3855
|
-
|
|
3874
|
+
setComputedTier('medium');
|
|
3856
3875
|
} else {
|
|
3857
|
-
|
|
3876
|
+
setComputedTier('low');
|
|
3858
3877
|
}
|
|
3859
|
-
}, [tier
|
|
3878
|
+
}, [tier]);
|
|
3860
3879
|
// Use unified glass system with performance tier
|
|
3861
3880
|
const glassStyles = React.useMemo(() => {
|
|
3862
3881
|
const glassOptions = {
|
|
@@ -5478,6 +5497,11 @@ const UnifiedThemeProvider = _ref => {
|
|
|
5478
5497
|
children: jsxRuntime.jsx(ResponsiveContext.Provider, {
|
|
5479
5498
|
value: responsiveContextValue,
|
|
5480
5499
|
children: (() => {
|
|
5500
|
+
// Server-side: skip styled-components entirely
|
|
5501
|
+
if (typeof window === 'undefined') {
|
|
5502
|
+
return children;
|
|
5503
|
+
}
|
|
5504
|
+
// Client-side only: load styled-components
|
|
5481
5505
|
const StyledThemeProvider = getStyledThemeProvider();
|
|
5482
5506
|
return StyledThemeProvider ? jsxRuntime.jsx(StyledThemeProvider, {
|
|
5483
5507
|
theme: theme,
|