@primer/react 38.35.1 → 38.36.0-rc.7156e7efc
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/CHANGELOG.md +7 -0
- package/dist/ThemeContext.d.ts +20 -0
- package/dist/ThemeProvider.d.ts +3 -0
- package/dist/ThemeProvider.js +39 -129
- package/dist/internal/components/ThemeProviderBase.js +50 -0
- package/dist/internal/hooks/useThemeProvider.js +71 -0
- package/dist/legacy-theme/ts/color-schemes.js +3942 -3942
- package/dist/next/ThemeProvider.d.ts +7 -0
- package/dist/next/ThemeProvider.js +35 -0
- package/dist/next/index.d.ts +4 -1
- package/dist/next/index.js +3 -1
- package/dist/theme.d.ts +16 -54
- package/dist/useTheme.d.ts +2 -14
- package/generated/hooks.json +2 -7
- package/package.json +1 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ThemeProviderProps } from "../ThemeProvider.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/next/ThemeProvider.d.ts
|
|
5
|
+
declare const ThemeProvider: React.FC<React.PropsWithChildren<ThemeProviderProps>>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { ThemeProvider, ThemeProvider as default };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ThemeProviderBase } from "../internal/components/ThemeProviderBase.js";
|
|
2
|
+
import { useThemeProvider } from "../internal/hooks/useThemeProvider.js";
|
|
3
|
+
import { c } from "react-compiler-runtime";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/next/ThemeProvider.tsx
|
|
6
|
+
const ThemeProvider = (t0) => {
|
|
7
|
+
const $ = c(7);
|
|
8
|
+
let children;
|
|
9
|
+
let props;
|
|
10
|
+
if ($[0] !== t0) {
|
|
11
|
+
({children, ...props} = t0);
|
|
12
|
+
$[0] = t0;
|
|
13
|
+
$[1] = children;
|
|
14
|
+
$[2] = props;
|
|
15
|
+
} else {
|
|
16
|
+
children = $[1];
|
|
17
|
+
props = $[2];
|
|
18
|
+
}
|
|
19
|
+
const { value } = useThemeProvider(props);
|
|
20
|
+
let t1;
|
|
21
|
+
if ($[3] !== children || $[4] !== props.contextOnly || $[5] !== value) {
|
|
22
|
+
t1 = /*#__PURE__*/ jsx(ThemeProviderBase, {
|
|
23
|
+
contextOnly: props.contextOnly,
|
|
24
|
+
value,
|
|
25
|
+
children
|
|
26
|
+
});
|
|
27
|
+
$[3] = children;
|
|
28
|
+
$[4] = props.contextOnly;
|
|
29
|
+
$[5] = value;
|
|
30
|
+
$[6] = t1;
|
|
31
|
+
} else t1 = $[6];
|
|
32
|
+
return t1;
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { ThemeProvider, ThemeProvider as default };
|
package/dist/next/index.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
import { ThemeProviderProps } from "../ThemeProvider.js";
|
|
2
|
+
import { useColorSchemeVar, useTheme } from "../useTheme.js";
|
|
1
3
|
import { Tooltip, TooltipProps } from "../TooltipV2/Tooltip.js";
|
|
2
|
-
|
|
4
|
+
import { ThemeProvider } from "./ThemeProvider.js";
|
|
5
|
+
export { ThemeProvider, type ThemeProviderProps, Tooltip, type TooltipProps, useColorSchemeVar, useTheme };
|
package/dist/next/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useColorSchemeVar, useTheme } from "../useTheme.js";
|
|
2
3
|
import { Tooltip } from "../TooltipV2/Tooltip.js";
|
|
3
|
-
|
|
4
|
+
import { ThemeProvider } from "./ThemeProvider.js";
|
|
5
|
+
export { ThemeProvider, Tooltip, useColorSchemeVar, useTheme };
|
package/dist/theme.d.ts
CHANGED
|
@@ -1082,6 +1082,7 @@ declare const theme: {
|
|
|
1082
1082
|
}>;
|
|
1083
1083
|
}>;
|
|
1084
1084
|
};
|
|
1085
|
+
/** @deprecated Use `ThemeProvider` from `@primer/react/next` to migrate away from JavaScript theme values. */
|
|
1085
1086
|
type ThemeColors = {
|
|
1086
1087
|
fg: {
|
|
1087
1088
|
default: string;
|
|
@@ -1106,60 +1107,21 @@ type ThemeColors = {
|
|
|
1106
1107
|
muted: string;
|
|
1107
1108
|
subtle: string;
|
|
1108
1109
|
};
|
|
1109
|
-
accent:
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
muted: string;
|
|
1125
|
-
subtle: string;
|
|
1126
|
-
};
|
|
1127
|
-
severe: {
|
|
1128
|
-
fg: string;
|
|
1129
|
-
emphasis: string;
|
|
1130
|
-
muted: string;
|
|
1131
|
-
subtle: string;
|
|
1132
|
-
};
|
|
1133
|
-
danger: {
|
|
1134
|
-
fg: string;
|
|
1135
|
-
emphasis: string;
|
|
1136
|
-
muted: string;
|
|
1137
|
-
subtle: string;
|
|
1138
|
-
};
|
|
1139
|
-
open: {
|
|
1140
|
-
fg: string;
|
|
1141
|
-
emphasis: string;
|
|
1142
|
-
muted: string;
|
|
1143
|
-
subtle: string;
|
|
1144
|
-
};
|
|
1145
|
-
closed: {
|
|
1146
|
-
fg: string;
|
|
1147
|
-
emphasis: string;
|
|
1148
|
-
muted: string;
|
|
1149
|
-
subtle: string;
|
|
1150
|
-
};
|
|
1151
|
-
done: {
|
|
1152
|
-
fg: string;
|
|
1153
|
-
emphasis: string;
|
|
1154
|
-
muted: string;
|
|
1155
|
-
subtle: string;
|
|
1156
|
-
};
|
|
1157
|
-
sponsors: {
|
|
1158
|
-
fg: string;
|
|
1159
|
-
emphasis: string;
|
|
1160
|
-
muted: string;
|
|
1161
|
-
subtle: string;
|
|
1162
|
-
};
|
|
1110
|
+
accent: ThemeRole;
|
|
1111
|
+
success: ThemeRole;
|
|
1112
|
+
attention: ThemeRole;
|
|
1113
|
+
severe: ThemeRole;
|
|
1114
|
+
danger: ThemeRole;
|
|
1115
|
+
open: ThemeRole;
|
|
1116
|
+
closed: ThemeRole;
|
|
1117
|
+
done: ThemeRole;
|
|
1118
|
+
sponsors: ThemeRole;
|
|
1119
|
+
};
|
|
1120
|
+
type ThemeRole = {
|
|
1121
|
+
fg: string;
|
|
1122
|
+
emphasis: string;
|
|
1123
|
+
muted: string;
|
|
1124
|
+
subtle: string;
|
|
1163
1125
|
};
|
|
1164
1126
|
type ThemeShadows = {
|
|
1165
1127
|
shadow: {
|
package/dist/useTheme.d.ts
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React from "react";
|
|
1
|
+
import { ThemeContextValue } from "./ThemeContext.js";
|
|
3
2
|
|
|
4
3
|
//#region src/useTheme.d.ts
|
|
5
|
-
declare function useTheme():
|
|
6
|
-
theme?: Theme;
|
|
7
|
-
colorScheme?: string;
|
|
8
|
-
colorMode?: ColorModeWithAuto;
|
|
9
|
-
resolvedColorMode?: ColorMode;
|
|
10
|
-
resolvedColorScheme?: string;
|
|
11
|
-
dayScheme?: string;
|
|
12
|
-
nightScheme?: string;
|
|
13
|
-
setColorMode: React.Dispatch<React.SetStateAction<ColorModeWithAuto>>;
|
|
14
|
-
setDayScheme: React.Dispatch<React.SetStateAction<string>>;
|
|
15
|
-
setNightScheme: React.Dispatch<React.SetStateAction<string>>;
|
|
16
|
-
};
|
|
4
|
+
declare function useTheme(): ThemeContextValue;
|
|
17
5
|
declare function useColorSchemeVar(values: Partial<Record<string, string>>, fallback: string): string;
|
|
18
6
|
//#endregion
|
|
19
7
|
export { useColorSchemeVar, useTheme };
|
package/generated/hooks.json
CHANGED
|
@@ -960,11 +960,6 @@
|
|
|
960
960
|
{
|
|
961
961
|
"name": "ThemeProviderProps",
|
|
962
962
|
"properties": [
|
|
963
|
-
{
|
|
964
|
-
"name": "theme",
|
|
965
|
-
"type": "{[key: string]: any}",
|
|
966
|
-
"description": "The theme object to be applied."
|
|
967
|
-
},
|
|
968
963
|
{
|
|
969
964
|
"name": "colorMode",
|
|
970
965
|
"type": "'auto' | 'day' | 'night' | 'light' | 'dark'",
|
|
@@ -993,7 +988,7 @@
|
|
|
993
988
|
{
|
|
994
989
|
"name": "theme",
|
|
995
990
|
"type": "Theme",
|
|
996
|
-
"description": "
|
|
991
|
+
"description": "Deprecated: Use `ThemeProvider` from `@primer/react/next` to migrate away from JavaScript theme values."
|
|
997
992
|
},
|
|
998
993
|
{
|
|
999
994
|
"name": "colorScheme",
|
|
@@ -1008,7 +1003,7 @@
|
|
|
1008
1003
|
{
|
|
1009
1004
|
"name": "resolvedColorScheme",
|
|
1010
1005
|
"type": "string",
|
|
1011
|
-
"description": "
|
|
1006
|
+
"description": "Deprecated: Use `colorScheme` with `ThemeProvider` from `@primer/react/next`."
|
|
1012
1007
|
},
|
|
1013
1008
|
{
|
|
1014
1009
|
"name": "resolvedColorMode",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "38.
|
|
4
|
+
"version": "38.36.0-rc.7156e7efc",
|
|
5
5
|
"description": "An implementation of GitHub's Primer Design System using React",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
"build:docs:preview": "NODE_OPTIONS=--openssl-legacy-provider script/build-docs preview",
|
|
46
46
|
"build:components.json": "tsx script/components-json/build.ts",
|
|
47
47
|
"build:hooks.json": "tsx script/hooks-json/build.ts",
|
|
48
|
-
"build:precompile-color-schemes": "tsx script/precompile-color-schemes.ts",
|
|
49
48
|
"lint:npm": "publint --types",
|
|
50
49
|
"lint:react-compiler": "node script/lint-react-compiler.ts",
|
|
51
50
|
"storybook": "storybook",
|
|
@@ -64,7 +63,6 @@
|
|
|
64
63
|
],
|
|
65
64
|
"files": [
|
|
66
65
|
"dist",
|
|
67
|
-
"!dist/legacy-theme/ts/colors",
|
|
68
66
|
"generated",
|
|
69
67
|
"CHANGELOG.md"
|
|
70
68
|
],
|