@pyreon/styler 0.11.5 → 0.11.7
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/README.md +27 -23
- package/lib/index.d.ts +9 -2
- package/lib/index.js +49 -4
- package/package.json +22 -22
- package/src/ThemeProvider.ts +10 -3
- package/src/__tests__/ThemeProvider.test.ts +21 -21
- package/src/__tests__/benchmark.bench.ts +56 -45
- package/src/__tests__/composition-chain.test.ts +200 -151
- package/src/__tests__/forward.test.ts +122 -122
- package/src/__tests__/globalStyle.test.ts +18 -18
- package/src/__tests__/hash.test.ts +27 -27
- package/src/__tests__/hybrid-injection.test.ts +83 -59
- package/src/__tests__/index.ts +10 -10
- package/src/__tests__/insertion-effect.test.ts +45 -32
- package/src/__tests__/integration.test.ts +81 -51
- package/src/__tests__/keyframes.test.ts +13 -13
- package/src/__tests__/memory-growth.test.ts +21 -21
- package/src/__tests__/p3-features.test.ts +162 -104
- package/src/__tests__/shared.test.ts +51 -33
- package/src/__tests__/sheet-advanced.test.ts +227 -227
- package/src/__tests__/sheet-split-atrules.test.ts +85 -85
- package/src/__tests__/sheet.test.ts +69 -69
- package/src/__tests__/styled-ssr.test.ts +36 -28
- package/src/__tests__/styled.test.ts +214 -145
- package/src/__tests__/theme.test.ts +11 -11
- package/src/__tests__/useCSS.test.ts +89 -59
- package/src/css.ts +1 -1
- package/src/forward.ts +187 -187
- package/src/globalStyle.ts +5 -5
- package/src/index.ts +15 -15
- package/src/keyframes.ts +3 -3
- package/src/resolve.ts +14 -14
- package/src/shared.ts +2 -2
- package/src/sheet.ts +26 -26
- package/src/styled.tsx +157 -100
- package/src/useCSS.ts +4 -4
package/src/useCSS.ts
CHANGED
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
* Use this when you need computed CSS class names on plain elements
|
|
6
6
|
* without the overhead of a styled component layer.
|
|
7
7
|
*/
|
|
8
|
-
import { type CSSResult, normalizeCSS, resolve } from
|
|
9
|
-
import { sheet } from
|
|
10
|
-
import { useTheme } from
|
|
8
|
+
import { type CSSResult, normalizeCSS, resolve } from './resolve'
|
|
9
|
+
import { sheet } from './sheet'
|
|
10
|
+
import { useTheme } from './ThemeProvider'
|
|
11
11
|
|
|
12
12
|
export function useCSS(template: CSSResult, props?: Record<string, any>, boost?: boolean): string {
|
|
13
13
|
const theme = useTheme()
|
|
14
14
|
const allProps = theme ? { ...props, theme } : (props ?? {})
|
|
15
15
|
const cssText = normalizeCSS(resolve(template.strings, template.values, allProps))
|
|
16
16
|
|
|
17
|
-
if (!cssText.trim()) return
|
|
17
|
+
if (!cssText.trim()) return ''
|
|
18
18
|
|
|
19
19
|
return sheet.insert(cssText, boost)
|
|
20
20
|
}
|