diff --git a/src/components/ScopedTheme.tsx b/src/components/ScopedTheme.tsx
index dc9452a9..b2ad83d2 100644
--- a/src/components/ScopedTheme.tsx
+++ b/src/components/ScopedTheme.tsx
@@ -21,7 +21,7 @@ export const ScopedTheme: React.FunctionComponent,
children,
-
+
]
return (
diff --git a/src/server/useServerUnistyles.tsx b/src/server/useServerUnistyles.tsx
index 653b0c8c..7d33d368 100644
--- a/src/server/useServerUnistyles.tsx
+++ b/src/server/useServerUnistyles.tsx
@@ -5,7 +5,7 @@ import { UnistylesWeb } from '../web'
declare global {
interface Window {
- UNISTYLES_STATE: any
+ __UNISTYLES_STATE__: ReturnType
}
}
@@ -26,7 +26,7 @@ export const useServerUnistyles = () => {
<>
-
+
>
)
}
@@ -35,6 +35,6 @@ export const useServerUnistyles = () => {
})
if (typeof window !== 'undefined') {
- UnistylesWeb.registry.css.hydrate(window.UNISTYLES_STATE)
+ UnistylesWeb.registry.css.hydrate(window.__UNISTYLES_STATE__)
}
}
diff --git a/src/web/convert/object/filter.ts b/src/web/convert/object/filter.ts
index f7eca354..89046a97 100644
--- a/src/web/convert/object/filter.ts
+++ b/src/web/convert/object/filter.ts
@@ -4,7 +4,7 @@ import type { Filters } from '../types'
import { getObjectStyle } from './objectStyle'
import { normalizeColor, normalizeNumericValue } from '../utils'
import { isUnistylesMq } from '../../../mq'
-import { UnistylesWeb } from '../..'
+import { UnistylesWeb } from '../../index'
const getDropShadowStyle = (dropShadow: DropShadowValue) => {
const { offsetX = 0, offsetY = 0, standardDeviation = 0, color = '#000' } = dropShadow
diff --git a/src/web/create.ts b/src/web/create.ts
index d5c0d199..46b56fc0 100644
--- a/src/web/create.ts
+++ b/src/web/create.ts
@@ -1,5 +1,5 @@
import type { StyleSheetWithSuperPowers, StyleSheet } from '../types/stylesheet'
-import { UnistylesWeb } from '.'
+import { UnistylesWeb } from './index'
import { assignSecrets, error, removeInlineStyles } from './utils'
const useVariants = ['useVariants', () => {}]
@@ -10,7 +10,7 @@ export const create = (stylesheet: StyleSheetWithSuperPowers, id?: s
}
const computedStylesheet = typeof stylesheet === 'function'
- ? stylesheet(UnistylesWeb.runtime.theme, UnistylesWeb.runtime.miniRuntime)
+ ? stylesheet(UnistylesWeb.runtime.theme, UnistylesWeb.runtime.miniRuntime)
: stylesheet
const addSecrets = (value: any, key: string, args?: Array) => assignSecrets(value, {
diff --git a/src/web/utils/unistyle.ts b/src/web/utils/unistyle.ts
index 02008fdb..8c3c2e94 100644
--- a/src/web/utils/unistyle.ts
+++ b/src/web/utils/unistyle.ts
@@ -4,7 +4,7 @@ import type { StyleSheet, StyleSheetWithSuperPowers, UnistylesValues } from '../
import { isUnistylesMq, parseMq } from '../../mq'
import { keyInObject, reduceObject } from './common'
import type { UnistylesBreakpoints } from '../../global'
-import { UnistylesWeb } from '..'
+import { UnistylesWeb } from '../index'
export const schemeToTheme = (scheme: ColorScheme) => {
switch (scheme) {
@@ -66,7 +66,7 @@ export const getMediaQuery = (query: string, allBreakpoints: Array) => {
const breakpointValue = UnistylesWeb.runtime.breakpoints[query as keyof UnistylesBreakpoints] ?? 0
const nextBreakpoint = allBreakpoints
.filter((b): b is keyof UnistylesBreakpoints => b in UnistylesWeb.runtime.breakpoints)
- .map(b => UnistylesWeb.runtime.breakpoints[b] ?? 1)
+ .map(b => UnistylesWeb.runtime.breakpoints[b] as number)
.sort((a, b) => a - b)
.find(b => b > breakpointValue)
const queries = [
diff --git a/src/web/variants.ts b/src/web/variants.ts
index eb236f1b..4359443c 100644
--- a/src/web/variants.ts
+++ b/src/web/variants.ts
@@ -7,7 +7,11 @@ type StylesWithVariants = {
styles: Record
}>
}
-const hasVariants = (value: [string, T]): value is [string, T & StylesWithVariants] => isDefined(value[1]) && 'variants' in value[1]
+const hasVariants = (value: [string, T]): value is [string, T & StylesWithVariants] => {
+ const [, styleValue] = value
+
+ return isDefined(styleValue) && 'variants' in styleValue
+}
export const getVariants = (styles: ReactNativeStyleSheet, selectedVariants: Record) => {
return Object.entries(styles)