@dxos/react-ui-syntax-highlighter 0.16.0 → 0.17.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-syntax-highlighter",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "A syntax highlighter wrapper.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -25,29 +25,29 @@
25
25
  "src"
26
26
  ],
27
27
  "dependencies": {
28
+ "@dxos/react-hooks": "0.17.0",
29
+ "@dxos/ui-theme": "0.17.0",
30
+ "@dxos/ui-types": "0.17.0",
31
+ "@dxos/util": "0.17.0",
28
32
  "jsonpath-plus": "^10.3.0",
29
- "react-syntax-highlighter": "^15.6.1",
30
- "@dxos/ui-theme": "0.16.0",
31
- "@dxos/react-hooks": "0.16.0",
32
- "@dxos/util": "0.16.0",
33
- "@dxos/ui-types": "0.16.0"
33
+ "react-syntax-highlighter": "^15.6.1"
34
34
  },
35
35
  "devDependencies": {
36
+ "@dxos/random": "0.17.0",
37
+ "@dxos/react-ui": "0.17.0",
38
+ "@dxos/util": "0.17.0",
36
39
  "@storybook/react-vite": "^10.6.0",
37
- "@types/react": "~19.2.17",
38
- "@types/react-dom": "~19.2.3",
40
+ "@types/react": "~19.3.0",
41
+ "@types/react-dom": "~19.3.0",
39
42
  "@types/react-syntax-highlighter": "^15.5.13",
40
- "react": "~19.2.7",
41
- "react-dom": "~19.2.7",
42
- "vite": "^8.3.4",
43
- "@dxos/random": "0.16.0",
44
- "@dxos/util": "0.16.0",
45
- "@dxos/react-ui": "0.16.0"
43
+ "react": "~19.3.1",
44
+ "react-dom": "~19.3.1",
45
+ "vite": "^8.3.4"
46
46
  },
47
47
  "peerDependencies": {
48
- "react": "~19.2.7",
49
- "react-dom": "~19.2.7",
50
- "@dxos/react-ui": "^0.16.0"
48
+ "@dxos/react-ui": "^0.17.0",
49
+ "react": "~19.3.1",
50
+ "react-dom": "~19.3.1"
51
51
  },
52
52
  "publishConfig": {
53
53
  "access": "public"
@@ -12,7 +12,7 @@ import * as ScrollArea from '@dxos/react-ui/ScrollArea';
12
12
  import * as SystemButton from '@dxos/react-ui/SystemButton';
13
13
  import * as Util from '@dxos/react-ui/Util';
14
14
  import { mx } from '@dxos/ui-theme';
15
- import { type AllowedAxis } from '@dxos/ui-types';
15
+ import { type AllowedAxis, type ThemeMode } from '@dxos/ui-types';
16
16
 
17
17
  import { renderRows } from './renderer.ts';
18
18
 
@@ -43,6 +43,8 @@ export type SyntaxHighlighterProps = Pick<
43
43
  | 'PreTag'
44
44
  > & {
45
45
  themeStyle?: NaturalSyntaxHighlighterProps['style'];
46
+ /** Picks the built-in light or dark style regardless of the app's mode (default: the app's mode). */
47
+ themeMode?: ThemeMode;
46
48
  fallback?: string;
47
49
  copyButton?: boolean;
48
50
  /**
@@ -121,6 +123,7 @@ const SyntaxHighlighterLeaf = Util.composable<HTMLDivElement, Omit<SyntaxHighlig
121
123
  role,
122
124
  style,
123
125
  themeStyle,
126
+ themeMode: themeModeProp,
124
127
  language: languageProp = 'text',
125
128
  fallback = zeroWidthSpace,
126
129
  copyButton,
@@ -128,7 +131,8 @@ const SyntaxHighlighterLeaf = Util.composable<HTMLDivElement, Omit<SyntaxHighlig
128
131
  },
129
132
  forwardedRef,
130
133
  ) => {
131
- const themeMode = Hooks.useThemeMode();
134
+ const appThemeMode = Hooks.useThemeMode();
135
+ const themeMode = themeModeProp ?? appThemeMode;
132
136
  const source = sourceOf(children, fallback);
133
137
  const language = source.length > MAX_HIGHLIGHTED_LENGTH ? 'text' : languageProp;
134
138
 
@@ -7,4 +7,5 @@ import createElement from 'react-syntax-highlighter/dist/esm/create-element';
7
7
 
8
8
  export { createElement };
9
9
 
10
+ export * from './renderer.ts';
10
11
  export * from './SyntaxHighlighter.tsx';