@dxos/react-ui-editor 0.8.4-main.21d9917 → 0.8.4-main.2244d791bb

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.
Files changed (32) hide show
  1. package/dist/lib/browser/index.mjs +23 -20
  2. package/dist/lib/browser/index.mjs.map +3 -3
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +23 -20
  5. package/dist/lib/node-esm/index.mjs.map +3 -3
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/components/Editor/Editor.d.ts.map +1 -1
  8. package/dist/types/src/components/EditorMenuProvider/EditorMenuProvider.d.ts.map +1 -1
  9. package/dist/types/src/components/EditorPreviewProvider/EditorPreviewProvider.d.ts.map +1 -1
  10. package/dist/types/src/components/EditorToolbar/EditorToolbar.d.ts.map +1 -1
  11. package/dist/types/src/stories/Automerge.stories.d.ts +1 -0
  12. package/dist/types/src/stories/Automerge.stories.d.ts.map +1 -1
  13. package/dist/types/src/stories/Preview.stories.d.ts.map +1 -1
  14. package/dist/types/tsconfig.tsbuildinfo +1 -1
  15. package/package.json +42 -42
  16. package/src/components/Editor/Editor.stories.tsx +1 -1
  17. package/src/components/Editor/Editor.tsx +11 -5
  18. package/src/components/EditorMenuProvider/EditorMenuProvider.tsx +7 -13
  19. package/src/components/EditorPreviewProvider/EditorPreviewProvider.tsx +5 -7
  20. package/src/components/EditorToolbar/EditorToolbar.tsx +0 -1
  21. package/src/stories/Automerge.stories.tsx +2 -3
  22. package/src/stories/CommandDialog.stories.tsx +2 -2
  23. package/src/stories/Comments.stories.tsx +2 -2
  24. package/src/stories/EditorToolbar.stories.tsx +2 -2
  25. package/src/stories/Experimental.stories.tsx +2 -2
  26. package/src/stories/Markdown.stories.tsx +2 -2
  27. package/src/stories/Outliner.stories.tsx +2 -2
  28. package/src/stories/Popover.stories.tsx +2 -2
  29. package/src/stories/Preview.stories.tsx +14 -13
  30. package/src/stories/Tags.stories.tsx +2 -2
  31. package/src/stories/TextEditor.stories.tsx +2 -2
  32. package/src/stories/Theme.stories.tsx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-editor",
3
- "version": "0.8.4-main.21d9917",
3
+ "version": "0.8.4-main.2244d791bb",
4
4
  "description": "Text editor components.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -63,32 +63,32 @@
63
63
  "lodash.merge": "^4.6.2",
64
64
  "lodash.sortby": "^4.7.0",
65
65
  "style-mod": "^4.1.0",
66
- "@dxos/app-graph": "0.8.4-main.21d9917",
67
- "@dxos/async": "0.8.4-main.21d9917",
68
- "@dxos/client": "0.8.4-main.21d9917",
69
- "@dxos/context": "0.8.4-main.21d9917",
70
- "@dxos/debug": "0.8.4-main.21d9917",
71
- "@dxos/display-name": "0.8.4-main.21d9917",
72
- "@dxos/echo": "0.8.4-main.21d9917",
73
- "@dxos/echo-db": "0.8.4-main.21d9917",
74
- "@dxos/invariant": "0.8.4-main.21d9917",
75
- "@dxos/lit-ui": "0.8.4-main.21d9917",
76
- "@dxos/protocols": "0.8.4-main.21d9917",
77
- "@dxos/log": "0.8.4-main.21d9917",
78
- "@dxos/react-ui-menu": "0.8.4-main.21d9917",
79
- "@dxos/react-hooks": "0.8.4-main.21d9917",
80
- "@dxos/react-ui-mosaic": "0.8.4-main.21d9917",
81
- "@dxos/ui": "0.8.4-main.21d9917",
82
- "@dxos/util": "0.8.4-main.21d9917",
83
- "@dxos/ui-editor": "0.8.4-main.21d9917",
84
- "@dxos/ui-theme": "0.8.4-main.21d9917"
66
+ "@dxos/app-graph": "0.8.4-main.2244d791bb",
67
+ "@dxos/async": "0.8.4-main.2244d791bb",
68
+ "@dxos/context": "0.8.4-main.2244d791bb",
69
+ "@dxos/debug": "0.8.4-main.2244d791bb",
70
+ "@dxos/display-name": "0.8.4-main.2244d791bb",
71
+ "@dxos/echo": "0.8.4-main.2244d791bb",
72
+ "@dxos/client": "0.8.4-main.2244d791bb",
73
+ "@dxos/echo-db": "0.8.4-main.2244d791bb",
74
+ "@dxos/lit-ui": "0.8.4-main.2244d791bb",
75
+ "@dxos/invariant": "0.8.4-main.2244d791bb",
76
+ "@dxos/log": "0.8.4-main.2244d791bb",
77
+ "@dxos/protocols": "0.8.4-main.2244d791bb",
78
+ "@dxos/react-hooks": "0.8.4-main.2244d791bb",
79
+ "@dxos/react-ui-mosaic": "0.8.4-main.2244d791bb",
80
+ "@dxos/react-ui-menu": "0.8.4-main.2244d791bb",
81
+ "@dxos/ui-editor": "0.8.4-main.2244d791bb",
82
+ "@dxos/ui": "0.8.4-main.2244d791bb",
83
+ "@dxos/util": "0.8.4-main.2244d791bb",
84
+ "@dxos/ui-theme": "0.8.4-main.2244d791bb"
85
85
  },
86
86
  "devDependencies": {
87
87
  "@automerge/automerge": "3.2.3",
88
88
  "@automerge/automerge-repo": "2.5.1",
89
89
  "@automerge/automerge-repo-network-broadcastchannel": "2.5.1",
90
- "@effect-atom/atom-react": "^0.4.6",
91
- "@effect/platform": "0.93.6",
90
+ "@effect-atom/atom-react": "^0.5.0",
91
+ "@effect/platform": "0.94.4",
92
92
  "@types/chai": "^4.2.15",
93
93
  "@types/chai-dom": "^1.11.0",
94
94
  "@types/lodash.defaultsdeep": "^4.6.6",
@@ -99,7 +99,7 @@
99
99
  "@types/react-test-renderer": "^17.0.2",
100
100
  "chai": "^4.4.1",
101
101
  "chai-dom": "^1.11.0",
102
- "effect": "3.19.11",
102
+ "effect": "3.19.16",
103
103
  "happy-dom": "^13.3.1",
104
104
  "jsdom": "^27.0.0",
105
105
  "mocha": "^10.6.0",
@@ -109,29 +109,29 @@
109
109
  "vite": "7.1.9",
110
110
  "vite-plugin-top-level-await": "^1.6.0",
111
111
  "vite-plugin-wasm": "^3.5.0",
112
- "@dxos/echo": "0.8.4-main.21d9917",
113
- "@dxos/config": "0.8.4-main.21d9917",
114
- "@dxos/echo-atom": "0.8.4-main.21d9917",
115
- "@dxos/keyboard": "0.8.4-main.21d9917",
116
- "@dxos/random": "0.8.4-main.21d9917",
117
- "@dxos/react-client": "0.8.4-main.21d9917",
118
- "@dxos/react-ui": "0.8.4-main.21d9917",
119
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.21d9917",
120
- "@dxos/react-ui-attention": "0.8.4-main.21d9917",
121
- "@dxos/storybook-utils": "0.8.4-main.21d9917",
122
- "@dxos/schema": "0.8.4-main.21d9917",
123
- "@dxos/ui-theme": "0.8.4-main.21d9917",
124
- "@dxos/ui-types": "0.8.4-main.21d9917"
112
+ "@dxos/config": "0.8.4-main.2244d791bb",
113
+ "@dxos/echo-atom": "0.8.4-main.2244d791bb",
114
+ "@dxos/echo": "0.8.4-main.2244d791bb",
115
+ "@dxos/random": "0.8.4-main.2244d791bb",
116
+ "@dxos/keyboard": "0.8.4-main.2244d791bb",
117
+ "@dxos/react-client": "0.8.4-main.2244d791bb",
118
+ "@dxos/react-ui": "0.8.4-main.2244d791bb",
119
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.2244d791bb",
120
+ "@dxos/react-ui-attention": "0.8.4-main.2244d791bb",
121
+ "@dxos/storybook-utils": "0.8.4-main.2244d791bb",
122
+ "@dxos/ui-theme": "0.8.4-main.2244d791bb",
123
+ "@dxos/ui-types": "0.8.4-main.2244d791bb",
124
+ "@dxos/schema": "0.8.4-main.2244d791bb"
125
125
  },
126
126
  "peerDependencies": {
127
- "@effect-atom/atom-react": "^0.4.6",
128
- "@effect/platform": "0.93.6",
129
- "effect": "3.19.11",
127
+ "@effect-atom/atom-react": "^0.5.0",
128
+ "@effect/platform": "0.94.4",
129
+ "effect": "3.19.16",
130
130
  "react": "~19.2.3",
131
131
  "react-dom": "~19.2.3",
132
- "@dxos/react-ui": "0.8.4-main.21d9917",
133
- "@dxos/ui-theme": "0.8.4-main.21d9917",
134
- "@dxos/react-client": "0.8.4-main.21d9917"
132
+ "@dxos/react-ui": "0.8.4-main.2244d791bb",
133
+ "@dxos/react-client": "0.8.4-main.2244d791bb",
134
+ "@dxos/ui-theme": "0.8.4-main.2244d791bb"
135
135
  },
136
136
  "publishConfig": {
137
137
  "access": "public"
@@ -53,7 +53,7 @@ const withExtensions: Decorator<EditorContentProps> = (Story, { args }) => {
53
53
  const meta = {
54
54
  title: 'ui/react-ui-editor/Editor',
55
55
  component: Editor.Content,
56
- decorators: [withExtensions, withTheme, withLayout({ layout: 'column' }), withAttention],
56
+ decorators: [withExtensions, withTheme(), withLayout({ layout: 'column' }), withAttention()],
57
57
  parameters: {
58
58
  layout: 'fullscreen',
59
59
  },
@@ -84,6 +84,8 @@ EditorRoot.displayName = 'Editor.Root';
84
84
  // Viewport
85
85
  //
86
86
 
87
+ const EDITOR_VIEWPORT_NAME = 'Editor.Viewport';
88
+
87
89
  type EditorViewportProps = ThemedClassName<PropsWithChildren<{}>>;
88
90
 
89
91
  /**
@@ -97,12 +99,14 @@ const EditorViewport = ({ classNames, children }: EditorViewportProps) => {
97
99
  );
98
100
  };
99
101
 
100
- EditorViewport.displayName = 'Editor.Viewport';
102
+ EditorViewport.displayName = EDITOR_VIEWPORT_NAME;
101
103
 
102
104
  //
103
105
  // Content
104
106
  //
105
107
 
108
+ const EDITOR_CONTENT_NAME = 'Editor.Content';
109
+
106
110
  type EditorContentProps = Omit<NaturalEditorContentProps, 'ref'>;
107
111
 
108
112
  /**
@@ -110,7 +114,7 @@ type EditorContentProps = Omit<NaturalEditorContentProps, 'ref'>;
110
114
  * Automatically registers the editor controller with the context.
111
115
  */
112
116
  const EditorContent = ({ extensions: providedExtensions, ...props }: EditorContentProps) => {
113
- const { extensions: additionalExtensions = [], setController } = useEditorContext(EditorContent.displayName);
117
+ const { extensions: additionalExtensions = [], setController } = useEditorContext(EDITOR_CONTENT_NAME);
114
118
 
115
119
  const extensions = useMemo(
116
120
  () => [additionalExtensions, providedExtensions].filter(isNonNullable).flat(),
@@ -120,12 +124,14 @@ const EditorContent = ({ extensions: providedExtensions, ...props }: EditorConte
120
124
  return <NaturalEditorContent {...props} extensions={extensions} ref={setController} />;
121
125
  };
122
126
 
123
- EditorContent.displayName = 'Editor.Content';
127
+ EditorContent.displayName = EDITOR_CONTENT_NAME;
124
128
 
125
129
  //
126
130
  // Toolbar
127
131
  //
128
132
 
133
+ const EDITOR_TOOLBAR_NAME = 'Editor.Toolbar';
134
+
129
135
  type EditorToolbarProps = Omit<NaturalEditorToolbarProps, 'getView' | 'state'>;
130
136
 
131
137
  /**
@@ -133,7 +139,7 @@ type EditorToolbarProps = Omit<NaturalEditorToolbarProps, 'getView' | 'state'>;
133
139
  * Automatically connects to the editor view through context.
134
140
  */
135
141
  const EditorToolbar = (props: EditorToolbarProps) => {
136
- const { controller, state } = useEditorContext(EditorToolbar.displayName);
142
+ const { controller, state } = useEditorContext(EDITOR_TOOLBAR_NAME);
137
143
 
138
144
  // TODO(burdon): Fix invariant.
139
145
  const getView = useCallback(() => {
@@ -144,7 +150,7 @@ const EditorToolbar = (props: EditorToolbarProps) => {
144
150
  return <NaturalEditorToolbar {...props} getView={getView} state={state} />;
145
151
  };
146
152
 
147
- EditorToolbar.displayName = 'Editor.Toolbar';
153
+ EditorToolbar.displayName = EDITOR_TOOLBAR_NAME;
148
154
 
149
155
  //
150
156
  // Editor
@@ -78,10 +78,8 @@ export const EditorMenuProvider = ({
78
78
  root,
79
79
  DX_ANCHOR_ACTIVATE as any,
80
80
  (event: DxAnchorActivate) => {
81
- const { trigger, refId } = event;
82
-
83
- // If this has a `refId`, then it’s probably a URL or DXN and out of scope for this component.
84
- if (!refId) {
81
+ const { trigger, dxn } = event;
82
+ if (!dxn) {
85
83
  triggerRef.current = trigger as HTMLButtonElement;
86
84
  if (onActivate) {
87
85
  onActivate({ view: viewRef.current!, trigger: trigger.getAttribute('data-trigger') ?? undefined });
@@ -115,7 +113,7 @@ export const EditorMenuProvider = ({
115
113
  <Popover.Portal>
116
114
  <Popover.Content
117
115
  align='start'
118
- classNames={tx('menu.content', 'menu--exotic-unfocusable', { elevation: 'positioned' }, [
116
+ classNames={tx('menu.content', { elevation: 'positioned' }, [
119
117
  'overflow-y-auto',
120
118
  !menuGroups.length && 'hidden',
121
119
  ])}
@@ -132,7 +130,7 @@ export const EditorMenuProvider = ({
132
130
  }}
133
131
  onOpenAutoFocus={(event) => event.preventDefault()}
134
132
  >
135
- <Popover.Viewport classNames={tx('menu.viewport', 'menu__viewport--exotic-unfocusable', {})}>
133
+ <Popover.Viewport classNames={tx('menu.viewport', {})}>
136
134
  <Menu groups={menuGroups} currentItem={currentItem} onSelect={handleSelect} />
137
135
  </Popover.Viewport>
138
136
  <Popover.Arrow />
@@ -162,7 +160,7 @@ const Menu = ({ groups, currentItem, onSelect }: MenuProps) => {
162
160
  {groups.map((group, index) => (
163
161
  <Fragment key={group.id}>
164
162
  <MenuGroup group={group} currentItem={currentItem} onSelect={onSelect} />
165
- {index < groups.length - 1 && <div className={tx('menu.separator', 'menu__item', {})} />}
163
+ {index < groups.length - 1 && <div className={tx('menu.separator', {})} />}
166
164
  </Fragment>
167
165
  ))}
168
166
  </ul>
@@ -185,7 +183,7 @@ const MenuGroup = ({ group, currentItem, onSelect }: MenuGroupProps) => {
185
183
  return (
186
184
  <>
187
185
  {group.label && (
188
- <div className={tx('menu.groupLabel', 'menu__group__label', {})}>
186
+ <div className={tx('menu.groupLabel', {})}>
189
187
  <span>{toLocalizedString(group.label, t)}</span>
190
188
  </div>
191
189
  )}
@@ -221,11 +219,7 @@ const MenuItem = ({ item, current, onSelect }: MenuItemProps) => {
221
219
  const handleSelect = useCallback(() => onSelect?.(item), [item, onSelect]);
222
220
 
223
221
  return (
224
- <li
225
- ref={listRef}
226
- className={tx('menu.item', 'menu__item--exotic-unfocusable', {}, [current && 'bg-hoverSurface'])}
227
- onClick={handleSelect}
228
- >
222
+ <li ref={listRef} className={tx('menu.item', {}, [current && 'bg-hoverSurface'])} onClick={handleSelect}>
229
223
  {item.icon && <Icon icon={item.icon} size={5} />}
230
224
  <span className='grow truncate'>{toLocalizedString(item.label, t)}</span>
231
225
  </li>
@@ -32,16 +32,16 @@ export const EditorPreviewProvider = ({ children, onLookup }: EditorPreviewProvi
32
32
 
33
33
  const handleActivate = useCallback(
34
34
  (event: DxAnchorActivate) => {
35
- const { refId, label, trigger: dxTrigger } = event;
35
+ const { dxn, label, trigger } = event;
36
36
  setValue((value) => ({
37
37
  ...value,
38
- link: { label, ref: refId },
38
+ link: { label, dxn },
39
39
  pending: true,
40
40
  }));
41
41
 
42
- triggerRef.current = dxTrigger;
42
+ triggerRef.current = trigger;
43
43
  queueMicrotask(() => setOpen(true));
44
- void onLookup?.({ label, ref: refId }).then((target) =>
44
+ void onLookup?.({ label, dxn }).then((target) =>
45
45
  setValue((value) => ({
46
46
  ...value,
47
47
  target: target ?? undefined,
@@ -68,9 +68,7 @@ export const EditorPreviewProvider = ({ children, onLookup }: EditorPreviewProvi
68
68
  <EditorPreviewContextProvider pending={value.pending} link={value.link} target={value.target}>
69
69
  <Popover.Root open={open} onOpenChange={setOpen}>
70
70
  <Popover.VirtualTrigger virtualRef={triggerRef as unknown as RefObject<HTMLButtonElement>} />
71
-
72
- {/* Content */}
73
- <div ref={setRoot} role='none' className='contents'>
71
+ <div role='none' className='contents' ref={setRoot}>
74
72
  {children}
75
73
  </div>
76
74
  </Popover.Root>
@@ -55,7 +55,6 @@ export type EditorToolbarProps = ThemedClassName<
55
55
  } & (EditorToolbarActionGraphProps & EditorToolbarFeatureFlags)
56
56
  >;
57
57
 
58
- // TODO(burdon): Remove role dependency.
59
58
  export const EditorToolbar = memo(({ classNames, role, attendableId, onAction, ...props }: EditorToolbarProps) => {
60
59
  const menuProps = useEditorToolbarActionGraph(props);
61
60
 
@@ -16,7 +16,7 @@ import { Query, useQuery, useSpace } from '@dxos/react-client/echo';
16
16
  import { type Identity, useIdentity } from '@dxos/react-client/halo';
17
17
  import { useClientStory, withMultiClientProvider } from '@dxos/react-client/testing';
18
18
  import { Button, useThemeContext } from '@dxos/react-ui';
19
- import { withTheme } from '@dxos/react-ui/testing';
19
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
20
20
  import { render } from '@dxos/storybook-utils';
21
21
  import { createBasicExtensions, createDataExtensions, createThemeExtensions } from '@dxos/ui-editor';
22
22
 
@@ -137,6 +137,7 @@ const EchoStory = () => {
137
137
  const meta = {
138
138
  title: 'ui/react-ui-editor/Automerge',
139
139
  component: Editor as any,
140
+ decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
140
141
  parameters: {
141
142
  layout: 'fullscreen',
142
143
  translations,
@@ -149,14 +150,12 @@ type Story = StoryObj<typeof meta>;
149
150
 
150
151
  // TODO(burdon): ERROR: factories.ts:126 Error: Non-base58 character
151
152
  export const Default: Story = {
152
- decorators: [withTheme],
153
153
  render: render(DefaultStory),
154
154
  };
155
155
 
156
156
  // TODO(burdon): Failing (doesn't sync)
157
157
  export const WithEcho: Story = {
158
158
  decorators: [
159
- withTheme,
160
159
  withMultiClientProvider({
161
160
  numClients: 2,
162
161
  createIdentity: true,
@@ -6,7 +6,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import React, { type KeyboardEvent, useState } from 'react';
7
7
 
8
8
  import { type Button, IconButton, Input } from '@dxos/react-ui';
9
- import { withTheme } from '@dxos/react-ui/testing';
9
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
10
10
  import { editorWidth, join } from '@dxos/ui-editor';
11
11
  import { mx } from '@dxos/ui-theme';
12
12
 
@@ -68,7 +68,7 @@ const CommandDialog = ({ onAction }: { onAction: (action?: any) => void }) => {
68
68
  const meta = {
69
69
  title: 'ui/react-ui-editor/CommandDialog',
70
70
  render: () => <EditorStory text={join('# Command', '', '')} extensions={[]} />,
71
- decorators: [withTheme],
71
+ decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
72
72
  parameters: {
73
73
  layout: 'fullscreen',
74
74
  },
@@ -9,7 +9,7 @@ import React, { type FC, useContext, useMemo } from 'react';
9
9
  import { keySymbols, parseShortcut } from '@dxos/keyboard';
10
10
  import { PublicKey } from '@dxos/keys';
11
11
  import { log } from '@dxos/log';
12
- import { withTheme } from '@dxos/react-ui/testing';
12
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
13
13
  import { withRegistry } from '@dxos/storybook-utils';
14
14
  import { type Comment, annotations, comments, createExternalCommentSync } from '@dxos/ui-editor';
15
15
 
@@ -20,7 +20,7 @@ import { EditorStory, content, longText } from './components';
20
20
  const meta = {
21
21
  title: 'ui/react-ui-editor/Comments',
22
22
  component: EditorStory,
23
- decorators: [withRegistry, withTheme],
23
+ decorators: [withRegistry, withTheme(), withLayout({ layout: 'fullscreen' })],
24
24
  parameters: {
25
25
  layout: 'fullscreen',
26
26
  },
@@ -8,7 +8,7 @@ import React, { useCallback, useContext, useState } from 'react';
8
8
 
9
9
  import { invariant } from '@dxos/invariant';
10
10
  import { useThemeContext } from '@dxos/react-ui';
11
- import { withTheme } from '@dxos/react-ui/testing';
11
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
12
12
  import { withRegistry } from '@dxos/storybook-utils';
13
13
  import {
14
14
  type EditorInputMode,
@@ -91,7 +91,7 @@ const DefaultStory = ({ autoFocus, initialValue, placeholder }: StoryProps) => {
91
91
  const meta = {
92
92
  title: 'ui/react-ui-editor/EditorToolbar',
93
93
  render: DefaultStory,
94
- decorators: [withRegistry, withTheme],
94
+ decorators: [withRegistry, withTheme(), withLayout({ layout: 'fullscreen' })],
95
95
  parameters: {
96
96
  layout: 'fullscreen',
97
97
  translations,
@@ -8,7 +8,7 @@ import React from 'react';
8
8
 
9
9
  import { log } from '@dxos/log';
10
10
  import { faker } from '@dxos/random';
11
- import { withTheme } from '@dxos/react-ui/testing';
11
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
12
12
  import { blast, defaultOptions, dropFile, join, typewriter } from '@dxos/ui-editor';
13
13
 
14
14
  import { EditorStory, content } from './components';
@@ -16,7 +16,7 @@ import { EditorStory, content } from './components';
16
16
  const meta = {
17
17
  title: 'ui/react-ui-editor/Experimental',
18
18
  component: EditorStory,
19
- decorators: [withTheme],
19
+ decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
20
20
  parameters: {
21
21
  layout: 'fullscreen',
22
22
  },
@@ -6,7 +6,7 @@ import { markdown } from '@codemirror/lang-markdown';
6
6
  import { type Meta, type StoryObj } from '@storybook/react-vite';
7
7
  import React from 'react';
8
8
 
9
- import { withTheme } from '@dxos/react-ui/testing';
9
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
10
10
  import { decorateMarkdown, image, join, linkTooltip, table } from '@dxos/ui-editor';
11
11
 
12
12
  import { EditorStory, content, defaultExtensions, headings, renderLinkTooltip, text } from './components';
@@ -14,7 +14,7 @@ import { EditorStory, content, defaultExtensions, headings, renderLinkTooltip, t
14
14
  const meta = {
15
15
  title: 'ui/react-ui-editor/Markdown',
16
16
  component: EditorStory,
17
- decorators: [withTheme],
17
+ decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
18
18
  parameters: {
19
19
  layout: 'fullscreen',
20
20
  },
@@ -5,7 +5,7 @@
5
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import React, { useMemo, useState } from 'react';
7
7
 
8
- import { withTheme } from '@dxos/react-ui/testing';
8
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
9
9
  import { withAttention } from '@dxos/react-ui-attention/testing';
10
10
  import { deleteItem, hashtag, join, listItemToString, outliner, treeFacet } from '@dxos/ui-editor';
11
11
 
@@ -68,7 +68,7 @@ const DefaultStory = ({ text }: StoryProps) => {
68
68
  const meta = {
69
69
  title: 'ui/react-ui-editor/Outliner',
70
70
  render: DefaultStory,
71
- decorators: [withTheme, withAttention],
71
+ decorators: [withTheme(), withLayout({ layout: 'fullscreen' }), withAttention()],
72
72
  parameters: {
73
73
  layout: 'fullscreen',
74
74
  },
@@ -8,7 +8,7 @@ import React, { useCallback, useState } from 'react';
8
8
  import { Obj, Query } from '@dxos/echo';
9
9
  import { faker } from '@dxos/random';
10
10
  import { useClientStory, withClientProvider } from '@dxos/react-client/testing';
11
- import { withTheme } from '@dxos/react-ui/testing';
11
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
12
12
  import { TestSchema, type ValueGenerator, createObjectFactory } from '@dxos/schema/testing';
13
13
  import { Domino, mx } from '@dxos/ui';
14
14
  import { insertAtCursor, insertAtLineStart, join } from '@dxos/ui-editor';
@@ -103,7 +103,7 @@ const LinkStory = (args: StoryProps) => {
103
103
  const meta = {
104
104
  title: 'ui/react-ui-editor/Popover',
105
105
  render: DefaultStory,
106
- decorators: [withTheme],
106
+ decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
107
107
  parameters: {
108
108
  layout: 'fullscreen',
109
109
  },
@@ -11,7 +11,7 @@ import { createPortal } from 'react-dom';
11
11
  import { invariant } from '@dxos/invariant';
12
12
  import { faker } from '@dxos/random';
13
13
  import { Popover } from '@dxos/react-ui';
14
- import { withTheme } from '@dxos/react-ui/testing';
14
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
15
15
  import { Card } from '@dxos/react-ui-mosaic';
16
16
  import {
17
17
  type PreviewBlock,
@@ -28,9 +28,9 @@ import { type EditorController, EditorPreviewProvider, useEditorPreview } from '
28
28
 
29
29
  import { EditorStory } from './components';
30
30
 
31
- const handlePreviewLookup = async ({ label, ref }: PreviewLinkRef): Promise<PreviewLinkTarget> => {
31
+ const handlePreviewLookup = async ({ dxn, label }: PreviewLinkRef): Promise<PreviewLinkTarget> => {
32
32
  // Random text.
33
- faker.seed(ref.split('').reduce((acc: number, char: string) => acc + char.charCodeAt(0), 1));
33
+ faker.seed(dxn.split('').reduce((acc: number, char: string) => acc + char.charCodeAt(0), 1));
34
34
  const text = Array.from({ length: 2 }, () => faker.lorem.paragraphs()).join('\n\n');
35
35
  return {
36
36
  label,
@@ -51,6 +51,9 @@ const useRefTarget = (link: PreviewLinkRef): PreviewLinkTarget | undefined => {
51
51
 
52
52
  const PreviewCard = () => {
53
53
  const { target } = useEditorPreview('PreviewCard');
54
+ if (!target) {
55
+ return null;
56
+ }
54
57
 
55
58
  return (
56
59
  <Popover.Portal>
@@ -59,16 +62,14 @@ const PreviewCard = () => {
59
62
  <Card.Root border={false}>
60
63
  <Card.Toolbar>
61
64
  <Card.Icon toolbar icon='ph--file-text--regular' />
62
- <Card.Title>{target?.label}</Card.Title>
65
+ <Card.Title>{target.label}</Card.Title>
63
66
  <Popover.Close asChild>
64
67
  <Card.Close />
65
68
  </Popover.Close>
66
69
  </Card.Toolbar>
67
- {target && (
68
- <Card.Row>
69
- <Card.Text variant='description'>{target.text}</Card.Text>
70
- </Card.Row>
71
- )}
70
+ <Card.Row>
71
+ <Card.Text variant='description'>{target.text}</Card.Text>
72
+ </Card.Row>
72
73
  </Card.Root>
73
74
  </Popover.Viewport>
74
75
  <Popover.Arrow />
@@ -101,7 +102,7 @@ const PreviewBlockComponent = ({ link, el, view }: { link: PreviewLinkRef; el: H
101
102
  }
102
103
 
103
104
  const link = getLinkRef(view.state, node);
104
- if (link?.ref !== action.link.ref) {
105
+ if (link?.dxn !== action.link.dxn) {
105
106
  return;
106
107
  }
107
108
 
@@ -180,7 +181,7 @@ const PreviewBlockComponent = ({ link, el, view }: { link: PreviewLinkRef; el: H
180
181
  const meta = {
181
182
  title: 'ui/react-ui-editor/Preview',
182
183
  component: EditorStory,
183
- decorators: [withTheme],
184
+ decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
184
185
  parameters: {
185
186
  layout: 'fullscreen',
186
187
  },
@@ -217,7 +218,7 @@ export const Default: Story = {
217
218
  setPreviewBlocks((prev) => [...prev, block]);
218
219
  },
219
220
  removeBlockContainer: (block) => {
220
- setPreviewBlocks((prev) => prev.filter(({ link: prevLink }) => prevLink.ref !== block.link.ref));
221
+ setPreviewBlocks((prev) => prev.filter(({ link: prevLink }) => prevLink.dxn !== block.link.dxn));
221
222
  },
222
223
  }),
223
224
  ];
@@ -230,7 +231,7 @@ export const Default: Story = {
230
231
  <PreviewCard />
231
232
  {controller?.view &&
232
233
  previewBlocks.map(({ link, el }) => (
233
- <PreviewBlockComponent key={link.ref} link={link} el={el} view={controller.view!} />
234
+ <PreviewBlockComponent key={link.dxn} link={link} el={el} view={controller.view!} />
234
235
  ))}
235
236
  </EditorPreviewProvider>
236
237
  );
@@ -7,7 +7,7 @@ import React, { useEffect, useState } from 'react';
7
7
  import { createPortal } from 'react-dom';
8
8
 
9
9
  import { useThemeContext } from '@dxos/react-ui';
10
- import { withTheme } from '@dxos/react-ui/testing';
10
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
11
11
  import {
12
12
  type XmlWidgetRegistry,
13
13
  type XmlWidgetState,
@@ -87,7 +87,7 @@ const text = trim`
87
87
  const meta = {
88
88
  title: 'ui/react-ui-editor/Tags',
89
89
  render: DefaultStory,
90
- decorators: [withTheme],
90
+ decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
91
91
  parameters: {
92
92
  layout: 'fullscreen',
93
93
  },
@@ -8,7 +8,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
8
  import React from 'react';
9
9
 
10
10
  import { log } from '@dxos/log';
11
- import { withTheme } from '@dxos/react-ui/testing';
11
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
12
12
  import {
13
13
  InputModeExtensions,
14
14
  decorateMarkdown,
@@ -37,7 +37,7 @@ import {
37
37
  const meta = {
38
38
  title: 'ui/react-ui-editor/TextEditor',
39
39
  component: EditorStory,
40
- decorators: [withTheme],
40
+ decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
41
41
  parameters: {
42
42
  layout: 'fullscreen',
43
43
  controls: { disable: true },
@@ -46,7 +46,7 @@ const DefaultStory = () => {
46
46
  const meta: Meta<typeof DefaultStory> = {
47
47
  title: 'ui/react-ui-editor/Theme',
48
48
  component: DefaultStory,
49
- decorators: [withTheme, withLayout()],
49
+ decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
50
50
  parameters: {
51
51
  layout: 'fullscreen',
52
52
  },