@datalayer/jupyter-react 1.1.1 → 1.1.2
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { Colormode } from '../theme';
|
|
2
3
|
import '@primer/primitives/dist/css/functional/themes/light.css';
|
|
3
4
|
import '@primer/primitives/dist/css/functional/themes/dark.css';
|
|
@@ -9,6 +10,7 @@ import '@primer/primitives/dist/css/functional/size/size-fine.css';
|
|
|
9
10
|
import '@primer/primitives/dist/css/functional/size/size.css';
|
|
10
11
|
import '@primer/primitives/dist/css/functional/size/viewport.css';
|
|
11
12
|
import '@primer/primitives/dist/css/functional/typography/typography.css';
|
|
13
|
+
export declare function useJupyterReactColormode(): Colormode;
|
|
12
14
|
type IJupyterLabThemeProps = {
|
|
13
15
|
colormode?: Colormode;
|
|
14
16
|
loadJupyterLabCss?: boolean;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
3
|
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
4
4
|
*
|
|
5
5
|
* MIT License
|
|
6
6
|
*/
|
|
7
|
+
import { createContext, useContext } from 'react';
|
|
7
8
|
import { BaseStyles, ThemeProvider } from '@primer/react';
|
|
8
9
|
import { JupyterLabCss, jupyterLabTheme } from '../theme';
|
|
9
10
|
import '@primer/primitives/dist/css/functional/themes/light.css';
|
|
@@ -16,9 +17,19 @@ import '@primer/primitives/dist/css/functional/size/size-fine.css';
|
|
|
16
17
|
import '@primer/primitives/dist/css/functional/size/size.css';
|
|
17
18
|
import '@primer/primitives/dist/css/functional/size/viewport.css';
|
|
18
19
|
import '@primer/primitives/dist/css/functional/typography/typography.css';
|
|
20
|
+
// Create context for colormode
|
|
21
|
+
const JupyterReactColormodeContext = createContext(undefined);
|
|
22
|
+
// Hook to access the colormode from the context
|
|
23
|
+
export function useJupyterReactColormode() {
|
|
24
|
+
const colormode = useContext(JupyterReactColormodeContext);
|
|
25
|
+
if (colormode === undefined) {
|
|
26
|
+
throw new Error('useJupyterReactColormode must be used within a JupyterReactTheme provider');
|
|
27
|
+
}
|
|
28
|
+
return colormode;
|
|
29
|
+
}
|
|
19
30
|
export function JupyterReactTheme(props) {
|
|
20
31
|
const { children, colormode = 'light', loadJupyterLabCss = true, theme = jupyterLabTheme, } = props;
|
|
21
|
-
return (_jsxs(
|
|
32
|
+
return (_jsxs(JupyterReactColormodeContext.Provider, { value: colormode, children: [loadJupyterLabCss && _jsx(JupyterLabCss, { colormode: colormode }), _jsx(ThemeProvider, { theme: theme, colorMode: colormode === 'light' ? 'day' : 'night', dayScheme: "light", nightScheme: "dark", children: _jsx(BaseStyles, { style: {
|
|
22
33
|
backgroundColor: 'var(--bgColor-default)',
|
|
23
34
|
color: 'var(--fgColor-default)',
|
|
24
35
|
fontSize: 'var(--text-body-size-medium)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JupyterReactTheme.js","sourceRoot":"","sources":["../../src/theme/JupyterReactTheme.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAa,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAErE,OAAO,yDAAyD,CAAC;AACjE,OAAO,wDAAwD,CAAC;AAEhE,OAAO,4DAA4D,CAAC;AACpE,OAAO,wDAAwD,CAAC;AAChE,OAAO,6DAA6D,CAAC;AACrE,OAAO,6DAA6D,CAAC;AACrE,OAAO,2DAA2D,CAAC;AACnE,OAAO,sDAAsD,CAAC;AAC9D,OAAO,0DAA0D,CAAC;AAClE,OAAO,kEAAkE,CAAC;
|
|
1
|
+
{"version":3,"file":"JupyterReactTheme.js","sourceRoot":"","sources":["../../src/theme/JupyterRe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