Skip to content

Commit 63e7410

Browse files
committed
chore: cr
1 parent b57ee88 commit 63e7410

File tree

6 files changed

+14
-10
lines changed

6 files changed

+14
-10
lines changed

src/components/ScopedTheme.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const ScopedTheme: React.FunctionComponent<React.PropsWithChildren<ThemeP
2121
const mappedChildren = [
2222
<Apply key={name} name={name} />,
2323
children,
24-
<Apply key='dispose' name={previousScopedTheme as never} />
24+
<Apply key='dispose' name={previousScopedTheme as keyof UnistylesThemes | undefined} />
2525
]
2626

2727
return (

src/server/useServerUnistyles.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { UnistylesWeb } from '../web'
55

66
declare global {
77
interface Window {
8-
UNISTYLES_STATE: any
8+
__UNISTYLES_STATE__: ReturnType<typeof UnistylesWeb.registry.css.getState>
99
}
1010
}
1111

@@ -26,7 +26,7 @@ export const useServerUnistyles = () => {
2626
<>
2727
<style id='rnw-style'>{rnwStyle}</style>
2828
<style id='unistyles-web'>{css}</style>
29-
<script id='unistyles-script'>{`window.UNISTYLES_STATE = ${JSON.stringify(state)}`}</script>
29+
<script id='unistyles-script'>{`window.__UNISTYLES_STATE__ = ${JSON.stringify(state)}`}</script>
3030
</>
3131
)
3232
}
@@ -35,6 +35,6 @@ export const useServerUnistyles = () => {
3535
})
3636

3737
if (typeof window !== 'undefined') {
38-
UnistylesWeb.registry.css.hydrate(window.UNISTYLES_STATE)
38+
UnistylesWeb.registry.css.hydrate(window.__UNISTYLES_STATE__)
3939
}
4040
}

src/web/convert/object/filter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { Filters } from '../types'
44
import { getObjectStyle } from './objectStyle'
55
import { normalizeColor, normalizeNumericValue } from '../utils'
66
import { isUnistylesMq } from '../../../mq'
7-
import { UnistylesWeb } from '../..'
7+
import { UnistylesWeb } from '../../index'
88

99
const getDropShadowStyle = (dropShadow: DropShadowValue) => {
1010
const { offsetX = 0, offsetY = 0, standardDeviation = 0, color = '#000' } = dropShadow

src/web/create.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { StyleSheetWithSuperPowers, StyleSheet } from '../types/stylesheet'
2-
import { UnistylesWeb } from '.'
2+
import { UnistylesWeb } from './index'
33
import { assignSecrets, error, removeInlineStyles } from './utils'
44

55
const useVariants = ['useVariants', () => {}]
@@ -10,7 +10,7 @@ export const create = (stylesheet: StyleSheetWithSuperPowers<StyleSheet>, id?: s
1010
}
1111

1212
const computedStylesheet = typeof stylesheet === 'function'
13-
? stylesheet(UnistylesWeb.runtime.theme, UnistylesWeb.runtime.miniRuntime)
13+
? stylesheet(UnistylesWeb.runtime.theme, UnistylesWeb.runtime.miniRuntime)
1414
: stylesheet
1515

1616
const addSecrets = (value: any, key: string, args?: Array<any>) => assignSecrets(value, {

src/web/utils/unistyle.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { StyleSheet, StyleSheetWithSuperPowers, UnistylesValues } from '../
44
import { isUnistylesMq, parseMq } from '../../mq'
55
import { keyInObject, reduceObject } from './common'
66
import type { UnistylesBreakpoints } from '../../global'
7-
import { UnistylesWeb } from '..'
7+
import { UnistylesWeb } from '../index'
88

99
export const schemeToTheme = (scheme: ColorScheme) => {
1010
switch (scheme) {
@@ -66,7 +66,7 @@ export const getMediaQuery = (query: string, allBreakpoints: Array<string>) => {
6666
const breakpointValue = UnistylesWeb.runtime.breakpoints[query as keyof UnistylesBreakpoints] ?? 0
6767
const nextBreakpoint = allBreakpoints
6868
.filter((b): b is keyof UnistylesBreakpoints => b in UnistylesWeb.runtime.breakpoints)
69-
.map(b => UnistylesWeb.runtime.breakpoints[b] ?? 1)
69+
.map(b => UnistylesWeb.runtime.breakpoints[b] as number)
7070
.sort((a, b) => a - b)
7171
.find(b => b > breakpointValue)
7272
const queries = [

src/web/variants.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ type StylesWithVariants = {
77
styles: Record<string, any>
88
}>
99
}
10-
const hasVariants = <T extends object>(value: [string, T]): value is [string, T & StylesWithVariants] => isDefined(value[1]) && 'variants' in value[1]
10+
const hasVariants = <T extends object>(value: [string, T]): value is [string, T & StylesWithVariants] => {
11+
const [, styleValue] = value
12+
13+
return isDefined(styleValue) && 'variants' in styleValue
14+
}
1115

1216
export const getVariants = (styles: ReactNativeStyleSheet<StyleSheet>, selectedVariants: Record<string, any>) => {
1317
return Object.entries(styles)

0 commit comments

Comments
 (0)