@dxos/react-ui-markdown 0.8.4-main.3c1ae3b → 0.8.4-main.422d1c7879

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,9 +1,13 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-markdown",
3
- "version": "0.8.4-main.3c1ae3b",
3
+ "version": "0.8.4-main.422d1c7879",
4
4
  "description": "Markdown components.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/dxos/dxos"
10
+ },
7
11
  "license": "MIT",
8
12
  "author": "DXOS.org",
9
13
  "type": "module",
@@ -15,9 +19,6 @@
15
19
  }
16
20
  },
17
21
  "types": "dist/types/src/index.d.ts",
18
- "typesVersions": {
19
- "*": {}
20
- },
21
22
  "files": [
22
23
  "dist",
23
24
  "src"
@@ -31,44 +32,42 @@
31
32
  "@lezer/highlight": "^1.2.1",
32
33
  "@lezer/markdown": "^1.3.1",
33
34
  "@lezer/xml": "^1.0.6",
34
- "@preact-signals/safe-react": "^0.9.0",
35
- "@preact/signals-core": "^1.12.1",
36
35
  "@radix-ui/react-compose-refs": "1.1.1",
37
36
  "@radix-ui/react-context": "1.1.1",
38
- "effect": "3.18.3",
37
+ "effect": "3.20.0",
39
38
  "json5": "^2.2.3",
40
39
  "react-markdown": "^10.1.0",
41
40
  "react-resize-detector": "^11.0.1",
42
41
  "remark-gfm": "^4.0.1",
43
- "@dxos/async": "0.8.4-main.3c1ae3b",
44
- "@dxos/invariant": "0.8.4-main.3c1ae3b",
45
- "@dxos/echo": "0.8.4-main.3c1ae3b",
46
- "@dxos/log": "0.8.4-main.3c1ae3b",
47
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.3c1ae3b",
48
- "@dxos/react-ui-editor": "0.8.4-main.3c1ae3b",
49
- "@dxos/util": "0.8.4-main.3c1ae3b"
42
+ "@dxos/async": "0.8.4-main.422d1c7879",
43
+ "@dxos/invariant": "0.8.4-main.422d1c7879",
44
+ "@dxos/echo": "0.8.4-main.422d1c7879",
45
+ "@dxos/log": "0.8.4-main.422d1c7879",
46
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.422d1c7879",
47
+ "@dxos/util": "0.8.4-main.422d1c7879",
48
+ "@dxos/react-ui-editor": "0.8.4-main.422d1c7879"
50
49
  },
51
50
  "devDependencies": {
52
- "@types/react": "~19.2.2",
53
- "@types/react-dom": "~19.2.2",
54
- "react": "~19.2.0",
55
- "react-dom": "~19.2.0",
56
- "vite": "7.1.9",
57
- "@dxos/echo": "0.8.4-main.3c1ae3b",
58
- "@dxos/lit-ui": "0.8.4-main.3c1ae3b",
59
- "@dxos/random": "0.8.4-main.3c1ae3b",
60
- "@dxos/react-client": "0.8.4-main.3c1ae3b",
61
- "@dxos/react-ui": "0.8.4-main.3c1ae3b",
62
- "@dxos/react-ui-theme": "0.8.4-main.3c1ae3b",
63
- "@dxos/schema": "0.8.4-main.3c1ae3b",
64
- "@dxos/storybook-utils": "0.8.4-main.3c1ae3b"
51
+ "@types/react": "~19.2.7",
52
+ "@types/react-dom": "~19.2.3",
53
+ "react": "~19.2.3",
54
+ "react-dom": "~19.2.3",
55
+ "vite": "^7.1.11",
56
+ "@dxos/echo": "0.8.4-main.422d1c7879",
57
+ "@dxos/lit-ui": "0.8.4-main.422d1c7879",
58
+ "@dxos/random": "0.8.4-main.422d1c7879",
59
+ "@dxos/react-client": "0.8.4-main.422d1c7879",
60
+ "@dxos/react-ui": "0.8.4-main.422d1c7879",
61
+ "@dxos/storybook-utils": "0.8.4-main.422d1c7879",
62
+ "@dxos/ui-theme": "0.8.4-main.422d1c7879",
63
+ "@dxos/schema": "0.8.4-main.422d1c7879"
65
64
  },
66
65
  "peerDependencies": {
67
- "effect": "3.17.7",
68
- "react": "^19.0.0",
69
- "react-dom": "^19.0.0",
70
- "@dxos/react-ui": "0.8.4-main.3c1ae3b",
71
- "@dxos/react-ui-theme": "0.8.4-main.3c1ae3b"
66
+ "effect": "3.20.0",
67
+ "react": "~19.2.3",
68
+ "react-dom": "~19.2.3",
69
+ "@dxos/react-ui": "0.8.4-main.422d1c7879",
70
+ "@dxos/ui-theme": "0.8.4-main.422d1c7879"
72
71
  },
73
72
  "publishConfig": {
74
73
  "access": "public"
@@ -4,18 +4,18 @@
4
4
 
5
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
 
7
- import { faker } from '@dxos/random';
7
+ import { random } from '@dxos/random';
8
8
  import { withLayout, withTheme } from '@dxos/react-ui/testing';
9
9
  import { trim } from '@dxos/util';
10
10
 
11
11
  import { MarkdownViewer } from './MarkdownViewer';
12
12
 
13
- faker.seed(0);
13
+ random.seed(0);
14
14
 
15
15
  const meta = {
16
16
  title: 'ui/react-ui-markdown/MarkdownViewer',
17
17
  component: MarkdownViewer,
18
- decorators: [withTheme, withLayout({ container: 'column' })],
18
+ decorators: [withTheme(), withLayout({ layout: 'column' })],
19
19
  } satisfies Meta<typeof MarkdownViewer>;
20
20
 
21
21
  export default meta;
@@ -27,7 +27,7 @@ const content = trim`
27
27
 
28
28
  > An example of the MarkdownViewer component.
29
29
 
30
- ${faker.lorem.paragraphs(1)}
30
+ ${random.lorem.paragraphs(1)}
31
31
 
32
32
  Here's a JSON block:
33
33
 
@@ -64,12 +64,12 @@ const content = trim`
64
64
 
65
65
  ## Examples
66
66
 
67
- ${faker.lorem.paragraphs(1)}
67
+ ${random.lorem.paragraphs(1)}
68
68
  `;
69
69
 
70
70
  export const Default: Story = {
71
71
  args: {
72
- classNames: 'p-4 border border-border rounded-md overflow-y-auto bg-baseSurface',
72
+ classNames: 'p-4 border border-border rounded-md overflow-y-auto bg-base-surface',
73
73
  content,
74
74
  },
75
75
  };
@@ -8,7 +8,7 @@ import remarkGfm from 'remark-gfm';
8
8
 
9
9
  import { type ThemedClassName } from '@dxos/react-ui';
10
10
  import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
11
- import { mx } from '@dxos/react-ui-theme';
11
+ import { mx } from '@dxos/ui-theme';
12
12
 
13
13
  export type MarkdownViewerProps = ThemedClassName<
14
14
  PropsWithChildren<{
@@ -36,21 +36,21 @@ export const MarkdownViewer = ({ classNames, children, components, content = ''
36
36
 
37
37
  const defaultComponents: ReactMarkdownOptions['components'] = {
38
38
  h1: ({ children }) => {
39
- return <h1 className='pbs-1 pbe-1 text-xl'>{children}</h1>;
39
+ return <h1 className='pt-1 pb-1 text-accent-text text-xl'>{children}</h1>;
40
40
  },
41
41
  h2: ({ children }) => {
42
- return <h2 className='pbs-1 pbe-1 text-lg'>{children}</h2>;
42
+ return <h2 className='pt-1 pb-1 text-accent-text text-lg'>{children}</h2>;
43
43
  },
44
44
  h3: ({ children }) => {
45
- return <h3 className='pbs-1 pbe-1 text-base'>{children}</h3>;
45
+ return <h3 className='pt-1 pb-1 text-accent-text text-base'>{children}</h3>;
46
46
  },
47
47
  blockquote: ({ children, ...props }) => (
48
- <blockquote className='pis-4 mbs-2 mbe-2 pbs-2 pbe-2 border-l-4 border-accentText text-accentText' {...props}>
48
+ <blockquote className='ps-4 mt-2 mb-2 pt-2 pb-2 border-l-4 border-accent-text text-accent-text' {...props}>
49
49
  {children}
50
50
  </blockquote>
51
51
  ),
52
52
  p: ({ children }) => {
53
- return <div className='pbs-1 pbe-1'>{children}</div>;
53
+ return <div className='pt-1 pb-1'>{children}</div>;
54
54
  },
55
55
  a: ({ children, href, ...props }) => (
56
56
  <a
@@ -64,12 +64,12 @@ const defaultComponents: ReactMarkdownOptions['components'] = {
64
64
  </a>
65
65
  ),
66
66
  ol: ({ children, ...props }) => (
67
- <ol className='pbs-1 pbe-1 pis-6 leading-tight list-decimal' {...props}>
67
+ <ol className='pt-1 pb-1 ps-6 leading-tight list-decimal' {...props}>
68
68
  {children}
69
69
  </ol>
70
70
  ),
71
71
  ul: ({ children, ...props }) => (
72
- <ul className='pbs-1 pbe-1 pis-6 leading-tight list-disc' {...props}>
72
+ <ul className='pt-1 pb-1 ps-6 leading-tight list-disc' {...props}>
73
73
  {children}
74
74
  </ul>
75
75
  ),
@@ -79,13 +79,18 @@ const defaultComponents: ReactMarkdownOptions['components'] = {
79
79
  </li>
80
80
  ),
81
81
  pre: ({ children }) => children,
82
- // TODO(burdon): Copy/paste button.
83
- code: ({ children, className }) => {
82
+ code: ({ children, className, node }) => {
84
83
  const [, language] = /language-(\w+)/.exec(className || '') || [];
84
+ const inline = !className && node?.position?.start.line === node?.position?.end.line;
85
+ if (inline) {
86
+ return <code className='rounded-xs bg-group-surface px-1 py-0.5 text-sm text-info-text'>{children}</code>;
87
+ }
88
+
85
89
  return (
86
90
  <SyntaxHighlighter
87
91
  language={language}
88
- classNames='mbs-2 mbe-2 border border-separator rounded-sm text-sm bg-groupSurface'
92
+ classNames='mt-2 mb-2 p-2 border border-separator rounded-xs text-sm bg-group-surface'
93
+ copyButton
89
94
  PreTag='pre'
90
95
  >
91
96
  {children}