+2
-0
@@ -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; |
+32
-8
@@ -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 @@ }; |
+32
-8
@@ -290,3 +290,10 @@ // src/index.tsx | ||
| children: [ | ||
| /* @__PURE__ */ jsx4(Style, { mode, lineNumbers: props.lineNumbers }), | ||
| /* @__PURE__ */ jsx4( | ||
| Style, | ||
| { | ||
| mode, | ||
| lineNumbers: props.lineNumbers, | ||
| lightThemeSelector: props.lightThemeSelector | ||
| } | ||
| ), | ||
| title && /* @__PURE__ */ jsx4(TitleBar, { ...props }), | ||
@@ -324,3 +331,4 @@ /* @__PURE__ */ jsx4(Pre2, { ...props }) | ||
| mode, | ||
| lineNumbers | ||
| lineNumbers, | ||
| lightThemeSelector | ||
| }) { | ||
@@ -334,3 +342,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) } | ||
@@ -341,3 +349,3 @@ ${lineNumbers ? lineNumbersStyle : ""} | ||
| } | ||
| function displayStyle(mode) { | ||
| function displayStyle(mode, lightThemeSelector = '[data-theme="light"]') { | ||
| if (!mode) | ||
@@ -347,6 +355,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 ""; | ||
@@ -392,4 +400,20 @@ } | ||
| return /* @__PURE__ */ jsxs4(Fragment4, { children: [ | ||
| /* @__PURE__ */ jsx5(AnnotatedCode, { ...props, theme: darkTheme, mode: "dark" }), | ||
| /* @__PURE__ */ jsx5(AnnotatedCode, { ...props, theme: lightTheme, mode: "light" }) | ||
| /* @__PURE__ */ jsx5( | ||
| AnnotatedCode, | ||
| { | ||
| ...props, | ||
| theme: darkTheme, | ||
| mode: "dark", | ||
| lightThemeSelector: doubleTheme.lightSelector | ||
| } | ||
| ), | ||
| /* @__PURE__ */ jsx5( | ||
| AnnotatedCode, | ||
| { | ||
| ...props, | ||
| theme: lightTheme, | ||
| mode: "light", | ||
| lightThemeSelector: doubleTheme.lightSelector | ||
| } | ||
| ) | ||
| ] }); | ||
@@ -396,0 +420,0 @@ }; |
+2
-2
| { | ||
| "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 @@ }, |
36698
2.5%1169
4.47%+ Added
- Removed
Updated