File tree Expand file tree Collapse file tree 7 files changed +32
-20
lines changed
packages/use-insertion-effect-with-fallbacks Expand file tree Collapse file tree 7 files changed +32
-20
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @emotion/use-insertion-effect-with-fallbacks ' : minor
3+ ---
4+
5+ Source code has been migrated to TypeScript. From now on type declarations will be emitted based on that, instead of being hand-written.
Original file line number Diff line number Diff line change 44 "description" : " A wrapper package that uses `useInsertionEffect` or a fallback for it" ,
55 "main" : " dist/emotion-use-insertion-effect-with-fallbacks.cjs.js" ,
66 "module" : " dist/emotion-use-insertion-effect-with-fallbacks.esm.js" ,
7+ "types" : " dist/emotion-use-insertion-effect-with-fallbacks.cjs.d.ts" ,
78 "license" : " MIT" ,
89 "repository" : " https://github.com/emotion-js/emotion/tree/main/packages/use-insertion-effect-with-fallbacks" ,
910 "publishConfig" : {
5354 },
5455 "imports" : {
5556 "#is-browser" : {
56- "edge-light" : " ./src/conditions/false.js " ,
57- "workerd" : " ./src/conditions/false.js " ,
58- "worker" : " ./src/conditions/false.js " ,
59- "browser" : " ./src/conditions/true.js " ,
60- "default" : " ./src/conditions/is-browser.js "
57+ "edge-light" : " ./src/conditions/false.ts " ,
58+ "workerd" : " ./src/conditions/false.ts " ,
59+ "worker" : " ./src/conditions/false.ts " ,
60+ "browser" : " ./src/conditions/true.ts " ,
61+ "default" : " ./src/conditions/is-browser.ts "
6162 }
6263 }
6364}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import * as React from 'react'
2+ import isBrowser from '#is-browser'
3+
4+ const syncFallback = < T > ( create : ( ) => T ) => create ( )
5+
6+ const useInsertionEffect = React [
7+ ( 'useInsertion' + 'Effect' ) as 'useInsertionEffect'
8+ ]
9+ ? ( React [ ( 'useInsertion' + 'Effect' ) as 'useInsertionEffect' ] as < T > (
10+ create : ( ) => T
11+ ) => T | undefined )
12+ : false
13+
14+ export const useInsertionEffectAlwaysWithSyncFallback : < T > (
15+ create : ( ) => T
16+ ) => T | undefined = ! isBrowser
17+ ? syncFallback
18+ : useInsertionEffect || syncFallback
19+
20+ export const useInsertionEffectWithLayoutFallback : typeof React . useLayoutEffect =
21+ useInsertionEffect || React . useLayoutEffect
You can’t perform that action at this time.
0 commit comments