Comparing version 0.7.2 to 0.7.3
@@ -45,2 +45,3 @@ import { Annotation, Theme, LanguageAlias, ThemeColors, Lines, Tokens, Token } from '@code-hike/lighter'; | ||
type DoubleTheme = { | ||
lightSelector?: string; | ||
dark: Theme; | ||
@@ -74,2 +75,3 @@ light: Theme; | ||
mode?: "dark" | "light"; | ||
lightThemeSelector?: string; | ||
style?: React.CSSProperties; | ||
@@ -76,0 +78,0 @@ className?: string; |
@@ -323,3 +323,10 @@ "use strict"; | ||
children: [ | ||
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Style, { mode, lineNumbers: props.lineNumbers }), | ||
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)( | ||
Style, | ||
{ | ||
mode, | ||
lineNumbers: props.lineNumbers, | ||
lightThemeSelector: props.lightThemeSelector | ||
} | ||
), | ||
title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TitleBar, { ...props }), | ||
@@ -357,3 +364,4 @@ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Pre2, { ...props }) | ||
mode, | ||
lineNumbers | ||
lineNumbers, | ||
lightThemeSelector | ||
}) { | ||
@@ -367,3 +375,3 @@ const lineNumbersStyle = `[data-bright-theme] [data-bright-ln] { | ||
}`; | ||
const css = `${displayStyle(mode)} | ||
const css = `${displayStyle(mode, lightThemeSelector)} | ||
[data-bright-theme] ::selection { background-color: var(--selection-background) } | ||
@@ -374,3 +382,3 @@ ${lineNumbers ? lineNumbersStyle : ""} | ||
} | ||
function displayStyle(mode) { | ||
function displayStyle(mode, lightThemeSelector = '[data-theme="light"]') { | ||
if (!mode) | ||
@@ -380,6 +388,6 @@ return ""; | ||
return `[data-bright-mode="dark"] { display: block } | ||
[data-theme="light"] [data-bright-mode="dark"] { display: none }`; | ||
${lightThemeSelector} [data-bright-mode="dark"] { display: none }`; | ||
if (mode === "light") | ||
return `[data-bright-mode="light"] { display: none } | ||
[data-theme="light"] [data-bright-mode="light"] { display: block }`; | ||
${lightThemeSelector} [data-bright-mode="light"] { display: block }`; | ||
return ""; | ||
@@ -425,4 +433,20 @@ } | ||
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [ | ||
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AnnotatedCode, { ...props, theme: darkTheme, mode: "dark" }), | ||
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AnnotatedCode, { ...props, theme: lightTheme, mode: "light" }) | ||
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)( | ||
AnnotatedCode, | ||
{ | ||
...props, | ||
theme: darkTheme, | ||
mode: "dark", | ||
lightThemeSelector: doubleTheme.lightSelector | ||
} | ||
), | ||
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)( | ||
AnnotatedCode, | ||
{ | ||
...props, | ||
theme: lightTheme, | ||
mode: "light", | ||
lightThemeSelector: doubleTheme.lightSelector | ||
} | ||
) | ||
] }); | ||
@@ -429,0 +453,0 @@ }; |
{ | ||
"name": "bright", | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"main": "./dist/index.js", | ||
@@ -19,3 +19,3 @@ "module": "./dist/index.mjs", | ||
"dependencies": { | ||
"@code-hike/lighter": "0.6.2", | ||
"@code-hike/lighter": "0.6.6", | ||
"server-only": "^0.0.1" | ||
@@ -22,0 +22,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36698
1169
+ Added@code-hike/lighter@0.6.6(transitive)
- Removed@code-hike/lighter@0.6.2(transitive)
Updated@code-hike/lighter@0.6.6