diff --git a/src/index.d.ts b/src/index.d.ts index 678fd46..1984b95 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -51,6 +51,17 @@ export declare function ThemeProvider< } >(props: T): JSX.Element; export declare function useTheme(): DefaultTheme; +export interface StyleSheetManagerProps { + /** + * DOM node whose root (`document.head` or a shadow root) generated styles are + * injected into. Use to render into another document — an Electron child + * `BrowserWindow`, an iframe, a pop-out `window.open`, or a shadow root. + * Omit to use the main `document.head` (default). + */ + target?: Node; + children?: any; +} +export declare function StyleSheetManager(props: StyleSheetManagerProps): JSX.Element; export interface ThemeProp { theme?: DefaultTheme; } diff --git a/src/index.js b/src/index.js index 346ed9a..027ef15 100644 --- a/src/index.js +++ b/src/index.js @@ -33,11 +33,36 @@ export function useTheme() { return useContext(ThemeContext); } +// Carries the DOM node whose root (`document.head` or a shadow root) goober +// should inject generated rules into. `undefined` = goober's default +// (the main `document.head`). Set via ``. +const StyleTargetContext = createContext(); + +// Mirrors styled-components' ``: every `styled` +// component / `createGlobalStyles` rendered inside this provider injects its +// `