@dxos/react-ui-editor 0.8.4-main.c1de068 → 0.8.4-main.f5c0578

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 (122) hide show
  1. package/dist/lib/browser/index.mjs +299 -249
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/browser/testing/index.mjs.map +2 -2
  5. package/dist/lib/node-esm/index.mjs +299 -249
  6. package/dist/lib/node-esm/index.mjs.map +4 -4
  7. package/dist/lib/node-esm/meta.json +1 -1
  8. package/dist/lib/node-esm/testing/index.mjs.map +2 -2
  9. package/dist/types/src/components/Editor/Editor.d.ts.map +1 -1
  10. package/dist/types/src/components/EditorToolbar/blocks.d.ts.map +1 -1
  11. package/dist/types/src/components/EditorToolbar/formatting.d.ts.map +1 -1
  12. package/dist/types/src/components/EditorToolbar/headings.d.ts.map +1 -1
  13. package/dist/types/src/components/EditorToolbar/lists.d.ts.map +1 -1
  14. package/dist/types/src/components/EditorToolbar/util.d.ts.map +1 -1
  15. package/dist/types/src/components/EditorToolbar/view-mode.d.ts +1 -1
  16. package/dist/types/src/components/EditorToolbar/view-mode.d.ts.map +1 -1
  17. package/dist/types/src/extensions/autocomplete.d.ts +1 -1
  18. package/dist/types/src/extensions/autocomplete.d.ts.map +1 -1
  19. package/dist/types/src/extensions/automerge/automerge.d.ts.map +1 -1
  20. package/dist/types/src/extensions/automerge/automerge.stories.d.ts.map +1 -1
  21. package/dist/types/src/extensions/automerge/defs.d.ts +1 -1
  22. package/dist/types/src/extensions/automerge/defs.d.ts.map +1 -1
  23. package/dist/types/src/extensions/automerge/sync.d.ts.map +1 -1
  24. package/dist/types/src/extensions/automerge/update-automerge.d.ts.map +1 -1
  25. package/dist/types/src/extensions/command/action.d.ts +1 -1
  26. package/dist/types/src/extensions/command/action.d.ts.map +1 -1
  27. package/dist/types/src/extensions/command/command-menu.d.ts +1 -1
  28. package/dist/types/src/extensions/command/command-menu.d.ts.map +1 -1
  29. package/dist/types/src/extensions/command/command.d.ts.map +1 -1
  30. package/dist/types/src/extensions/command/hint.d.ts.map +1 -1
  31. package/dist/types/src/extensions/command/state.d.ts +1 -1
  32. package/dist/types/src/extensions/command/state.d.ts.map +1 -1
  33. package/dist/types/src/extensions/command/typeahead.d.ts.map +1 -1
  34. package/dist/types/src/extensions/command/useCommandMenu.d.ts +1 -1
  35. package/dist/types/src/extensions/command/useCommandMenu.d.ts.map +1 -1
  36. package/dist/types/src/extensions/comments.d.ts +1 -1
  37. package/dist/types/src/extensions/comments.d.ts.map +1 -1
  38. package/dist/types/src/extensions/dnd.d.ts.map +1 -1
  39. package/dist/types/src/extensions/factories.d.ts.map +1 -1
  40. package/dist/types/src/extensions/markdown/action.d.ts.map +1 -1
  41. package/dist/types/src/extensions/markdown/changes.d.ts.map +1 -1
  42. package/dist/types/src/extensions/markdown/decorate.d.ts.map +1 -1
  43. package/dist/types/src/extensions/markdown/formatting.d.ts +1 -1
  44. package/dist/types/src/extensions/markdown/formatting.d.ts.map +1 -1
  45. package/dist/types/src/extensions/markdown/formatting.test.d.ts.map +1 -1
  46. package/dist/types/src/extensions/markdown/highlight.d.ts.map +1 -1
  47. package/dist/types/src/extensions/outliner/outliner.d.ts.map +1 -1
  48. package/dist/types/src/extensions/outliner/selection.d.ts.map +1 -1
  49. package/dist/types/src/extensions/outliner/tree.d.ts +1 -1
  50. package/dist/types/src/extensions/outliner/tree.d.ts.map +1 -1
  51. package/dist/types/src/hooks/useTextEditor.d.ts.map +1 -1
  52. package/dist/types/src/stories/Command.stories.d.ts.map +1 -1
  53. package/dist/types/src/stories/CommandMenu.stories.d.ts.map +1 -1
  54. package/dist/types/src/stories/Comments.stories.d.ts.map +1 -1
  55. package/dist/types/src/stories/EditorToolbar.stories.d.ts.map +1 -1
  56. package/dist/types/src/stories/Experimental.stories.d.ts.map +1 -1
  57. package/dist/types/src/stories/Markdown.stories.d.ts.map +1 -1
  58. package/dist/types/src/stories/Outliner.stories.d.ts.map +1 -1
  59. package/dist/types/src/stories/Preview.stories.d.ts.map +1 -1
  60. package/dist/types/src/stories/TextEditor.stories.d.ts.map +1 -1
  61. package/dist/types/src/stories/components/EditorStory.d.ts.map +1 -1
  62. package/dist/types/src/styles/theme.d.ts.map +1 -1
  63. package/dist/types/src/testing/util.d.ts +1 -0
  64. package/dist/types/src/testing/util.d.ts.map +1 -1
  65. package/dist/types/src/util/cursor.d.ts.map +1 -1
  66. package/dist/types/tsconfig.tsbuildinfo +1 -1
  67. package/package.json +40 -37
  68. package/src/components/Editor/Editor.tsx +1 -1
  69. package/src/components/EditorToolbar/EditorToolbar.tsx +1 -1
  70. package/src/components/EditorToolbar/blocks.ts +3 -2
  71. package/src/components/EditorToolbar/formatting.ts +3 -2
  72. package/src/components/EditorToolbar/headings.ts +2 -1
  73. package/src/components/EditorToolbar/lists.ts +3 -2
  74. package/src/components/EditorToolbar/util.ts +1 -1
  75. package/src/components/EditorToolbar/view-mode.ts +2 -1
  76. package/src/components/Popover/RefDropdownMenu.tsx +1 -1
  77. package/src/components/Popover/RefPopover.tsx +4 -4
  78. package/src/extensions/autocomplete.ts +3 -3
  79. package/src/extensions/automerge/automerge.stories.tsx +4 -4
  80. package/src/extensions/automerge/automerge.ts +4 -3
  81. package/src/extensions/automerge/defs.ts +1 -1
  82. package/src/extensions/automerge/sync.ts +1 -1
  83. package/src/extensions/automerge/update-automerge.ts +1 -1
  84. package/src/extensions/awareness/awareness.ts +2 -2
  85. package/src/extensions/command/action.ts +1 -1
  86. package/src/extensions/command/command-menu.ts +4 -3
  87. package/src/extensions/command/command.ts +3 -3
  88. package/src/extensions/command/hint.ts +2 -1
  89. package/src/extensions/command/placeholder.ts +1 -1
  90. package/src/extensions/command/state.ts +4 -3
  91. package/src/extensions/command/typeahead.ts +2 -2
  92. package/src/extensions/command/useCommandMenu.ts +2 -1
  93. package/src/extensions/comments.ts +7 -6
  94. package/src/extensions/dnd.ts +1 -1
  95. package/src/extensions/factories.ts +4 -3
  96. package/src/extensions/markdown/action.ts +2 -1
  97. package/src/extensions/markdown/bundle.ts +1 -1
  98. package/src/extensions/markdown/changes.ts +1 -1
  99. package/src/extensions/markdown/decorate.ts +7 -6
  100. package/src/extensions/markdown/formatting.test.ts +6 -6
  101. package/src/extensions/markdown/formatting.ts +3 -3
  102. package/src/extensions/markdown/highlight.ts +1 -1
  103. package/src/extensions/mention.ts +1 -1
  104. package/src/extensions/outliner/outliner.test.ts +3 -2
  105. package/src/extensions/outliner/outliner.ts +4 -3
  106. package/src/extensions/outliner/selection.ts +1 -1
  107. package/src/extensions/outliner/tree.test.ts +2 -1
  108. package/src/extensions/outliner/tree.ts +1 -1
  109. package/src/hooks/useTextEditor.ts +3 -3
  110. package/src/stories/Command.stories.tsx +6 -5
  111. package/src/stories/CommandMenu.stories.tsx +5 -4
  112. package/src/stories/Comments.stories.tsx +3 -2
  113. package/src/stories/EditorToolbar.stories.tsx +3 -3
  114. package/src/stories/Experimental.stories.tsx +4 -3
  115. package/src/stories/Markdown.stories.tsx +3 -2
  116. package/src/stories/Outliner.stories.tsx +4 -3
  117. package/src/stories/Preview.stories.tsx +21 -22
  118. package/src/stories/TextEditor.stories.tsx +15 -14
  119. package/src/stories/components/EditorStory.tsx +5 -5
  120. package/src/styles/theme.ts +4 -3
  121. package/src/testing/util.ts +2 -0
  122. package/src/util/cursor.ts +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-editor",
3
- "version": "0.8.4-main.c1de068",
3
+ "version": "0.8.4-main.f5c0578",
4
4
  "description": "Document editing experience within a DXOS shell.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -10,16 +10,19 @@
10
10
  "type": "module",
11
11
  "exports": {
12
12
  ".": {
13
+ "source": "./src/index.ts",
13
14
  "types": "./dist/types/src/index.d.ts",
14
15
  "browser": "./dist/lib/browser/index.mjs",
15
16
  "node": "./dist/lib/node-esm/index.mjs"
16
17
  },
17
18
  "./types": {
19
+ "source": "./src/types/index.ts",
18
20
  "types": "./dist/types/src/types/index.d.ts",
19
21
  "browser": "./dist/lib/browser/types/index.mjs",
20
22
  "node": "./dist/lib/node-esm/types/index.mjs"
21
23
  },
22
24
  "./testing": {
25
+ "source": "./src/testing/index.ts",
23
26
  "types": "./dist/types/src/testing/index.d.ts",
24
27
  "browser": "./dist/lib/browser/testing/index.mjs",
25
28
  "node": "./dist/lib/node-esm/testing/index.mjs"
@@ -34,7 +37,7 @@
34
37
  "src"
35
38
  ],
36
39
  "dependencies": {
37
- "@automerge/automerge": "3.0.0",
40
+ "@automerge/automerge": "3.1.1",
38
41
  "@codemirror/autocomplete": "^6.18.1",
39
42
  "@codemirror/commands": "^6.6.2",
40
43
  "@codemirror/lang-javascript": "^6.2.2",
@@ -64,28 +67,28 @@
64
67
  "lodash.merge": "^4.6.2",
65
68
  "lodash.sortby": "^4.7.0",
66
69
  "style-mod": "^4.1.0",
67
- "@dxos/app-graph": "0.8.4-main.c1de068",
68
- "@dxos/async": "0.8.4-main.c1de068",
69
- "@dxos/context": "0.8.4-main.c1de068",
70
- "@dxos/debug": "0.8.4-main.c1de068",
71
- "@dxos/display-name": "0.8.4-main.c1de068",
72
- "@dxos/echo-schema": "0.8.4-main.c1de068",
73
- "@dxos/lit-ui": "0.8.4-main.c1de068",
74
- "@dxos/live-object": "0.8.4-main.c1de068",
75
- "@dxos/protocols": "0.8.4-main.c1de068",
76
- "@dxos/log": "0.8.4-main.c1de068",
77
- "@dxos/react-hooks": "0.8.4-main.c1de068",
78
- "@dxos/react-ui-menu": "0.8.4-main.c1de068",
79
- "@dxos/react-ui-stack": "0.8.4-main.c1de068",
80
- "@dxos/util": "0.8.4-main.c1de068",
81
- "@dxos/invariant": "0.8.4-main.c1de068"
70
+ "@dxos/app-graph": "0.8.4-main.f5c0578",
71
+ "@dxos/async": "0.8.4-main.f5c0578",
72
+ "@dxos/context": "0.8.4-main.f5c0578",
73
+ "@dxos/debug": "0.8.4-main.f5c0578",
74
+ "@dxos/echo-schema": "0.8.4-main.f5c0578",
75
+ "@dxos/display-name": "0.8.4-main.f5c0578",
76
+ "@dxos/lit-ui": "0.8.4-main.f5c0578",
77
+ "@dxos/log": "0.8.4-main.f5c0578",
78
+ "@dxos/live-object": "0.8.4-main.f5c0578",
79
+ "@dxos/invariant": "0.8.4-main.f5c0578",
80
+ "@dxos/protocols": "0.8.4-main.f5c0578",
81
+ "@dxos/react-hooks": "0.8.4-main.f5c0578",
82
+ "@dxos/react-ui-menu": "0.8.4-main.f5c0578",
83
+ "@dxos/util": "0.8.4-main.f5c0578",
84
+ "@dxos/react-ui-stack": "0.8.4-main.f5c0578"
82
85
  },
83
86
  "devDependencies": {
84
- "@automerge/automerge": "3.0.0",
85
- "@automerge/automerge-repo": "2.0.8",
86
- "@automerge/automerge-repo-network-broadcastchannel": "2.0.8",
87
+ "@automerge/automerge": "3.1.1",
88
+ "@automerge/automerge-repo": "2.3.0-alpha.0",
89
+ "@automerge/automerge-repo-network-broadcastchannel": "2.3.0-alpha.0",
87
90
  "@effect-rx/rx-react": "0.38.0",
88
- "@effect/platform": "0.89.0",
91
+ "@effect/platform": "0.90.2",
89
92
  "@types/chai": "^4.2.15",
90
93
  "@types/chai-dom": "^1.11.0",
91
94
  "@types/lodash.defaultsdeep": "^4.6.6",
@@ -96,7 +99,7 @@
96
99
  "@types/react-test-renderer": "^17.0.2",
97
100
  "chai": "^4.4.1",
98
101
  "chai-dom": "^1.11.0",
99
- "effect": "3.17.0",
102
+ "effect": "3.17.7",
100
103
  "happy-dom": "^13.3.1",
101
104
  "jsdom": "^24.0.0",
102
105
  "mocha": "^10.6.0",
@@ -106,18 +109,18 @@
106
109
  "vite": "5.4.7",
107
110
  "vite-plugin-top-level-await": "^1.4.1",
108
111
  "vite-plugin-wasm": "^3.3.0",
109
- "@dxos/config": "0.8.4-main.c1de068",
110
- "@dxos/echo": "0.8.4-main.c1de068",
111
- "@dxos/echo-signals": "0.8.4-main.c1de068",
112
- "@dxos/keyboard": "0.8.4-main.c1de068",
113
- "@dxos/random": "0.8.4-main.c1de068",
114
- "@dxos/react-client": "0.8.4-main.c1de068",
115
- "@dxos/react-ui": "0.8.4-main.c1de068",
116
- "@dxos/react-ui-attention": "0.8.4-main.c1de068",
117
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.c1de068",
118
- "@dxos/react-ui-theme": "0.8.4-main.c1de068",
119
- "@dxos/schema": "0.8.4-main.c1de068",
120
- "@dxos/storybook-utils": "0.8.4-main.c1de068"
112
+ "@dxos/config": "0.8.4-main.f5c0578",
113
+ "@dxos/echo-signals": "0.8.4-main.f5c0578",
114
+ "@dxos/echo": "0.8.4-main.f5c0578",
115
+ "@dxos/keyboard": "0.8.4-main.f5c0578",
116
+ "@dxos/random": "0.8.4-main.f5c0578",
117
+ "@dxos/react-client": "0.8.4-main.f5c0578",
118
+ "@dxos/react-ui": "0.8.4-main.f5c0578",
119
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.f5c0578",
120
+ "@dxos/react-ui-attention": "0.8.4-main.f5c0578",
121
+ "@dxos/react-ui-theme": "0.8.4-main.f5c0578",
122
+ "@dxos/schema": "0.8.4-main.f5c0578",
123
+ "@dxos/storybook-utils": "0.8.4-main.f5c0578"
121
124
  },
122
125
  "peerDependencies": {
123
126
  "@effect-rx/rx-react": "^0.34.1",
@@ -125,9 +128,9 @@
125
128
  "effect": "^3.13.3",
126
129
  "react": "~18.2.0",
127
130
  "react-dom": "~18.2.0",
128
- "@dxos/react-client": "0.8.4-main.c1de068",
129
- "@dxos/react-ui": "0.8.4-main.c1de068",
130
- "@dxos/react-ui-theme": "0.8.4-main.c1de068"
131
+ "@dxos/react-client": "0.8.4-main.f5c0578",
132
+ "@dxos/react-ui": "0.8.4-main.f5c0578",
133
+ "@dxos/react-ui-theme": "0.8.4-main.f5c0578"
131
134
  },
132
135
  "publishConfig": {
133
136
  "access": "public"
@@ -9,7 +9,7 @@ import { type ThemedClassName, useThemeContext } from '@dxos/react-ui';
9
9
  import { mx } from '@dxos/react-ui-theme';
10
10
  import { type DataType } from '@dxos/schema';
11
11
 
12
- import { useTextEditor, type UseTextEditorProps } from '../../hooks';
12
+ import { type UseTextEditorProps, useTextEditor } from '../../hooks';
13
13
 
14
14
  export type EditorProps = ThemedClassName<
15
15
  {
@@ -5,7 +5,7 @@
5
5
  import { Rx } from '@effect-rx/rx-react';
6
6
  import React, { memo, useMemo } from 'react';
7
7
 
8
- import { rxFromSignal, type NodeArg } from '@dxos/app-graph';
8
+ import { type NodeArg, rxFromSignal } from '@dxos/app-graph';
9
9
  import { ElevationProvider } from '@dxos/react-ui';
10
10
  import { MenuProvider, ToolbarMenu, createGapSeparator, useMenuActions } from '@dxos/react-ui-menu';
11
11
 
@@ -7,8 +7,9 @@ import { type EditorView } from '@codemirror/view';
7
7
  import { type NodeArg } from '@dxos/app-graph';
8
8
  import { type ToolbarMenuActionGroupProperties } from '@dxos/react-ui-menu';
9
9
 
10
- import { createEditorAction, createEditorActionGroup, type EditorToolbarState } from './util';
11
- import { removeBlockquote, addBlockquote, removeCodeblock, addCodeblock, insertTable } from '../../extensions';
10
+ import { addBlockquote, addCodeblock, insertTable, removeBlockquote, removeCodeblock } from '../../extensions';
11
+
12
+ import { type EditorToolbarState, createEditorAction, createEditorActionGroup } from './util';
12
13
 
13
14
  const createBlockGroupAction = (value: string) =>
14
15
  createEditorActionGroup('block', {
@@ -7,8 +7,9 @@ import { type EditorView } from '@codemirror/view';
7
7
  import { type NodeArg } from '@dxos/app-graph';
8
8
  import { type ToolbarMenuActionGroupProperties } from '@dxos/react-ui-menu';
9
9
 
10
- import { createEditorAction, createEditorActionGroup, type EditorToolbarState } from './util';
11
- import { addLink, Inline, removeLink, setStyle, type Formatting } from '../../extensions';
10
+ import { type Formatting, Inline, addLink, removeLink, setStyle } from '../../extensions';
11
+
12
+ import { type EditorToolbarState, createEditorAction, createEditorActionGroup } from './util';
12
13
 
13
14
  const formats = {
14
15
  strong: 'ph--text-b--regular',
@@ -7,10 +7,11 @@ import { type EditorView } from '@codemirror/view';
7
7
  import { type NodeArg } from '@dxos/app-graph';
8
8
  import { type ToolbarMenuActionGroupProperties } from '@dxos/react-ui-menu';
9
9
 
10
- import { createEditorAction, createEditorActionGroup, type EditorToolbarState } from './util';
11
10
  import { setHeading } from '../../extensions';
12
11
  import { translationKey } from '../../translations';
13
12
 
13
+ import { type EditorToolbarState, createEditorAction, createEditorActionGroup } from './util';
14
+
14
15
  const createHeadingGroupAction = (value: string) =>
15
16
  createEditorActionGroup(
16
17
  'heading',
@@ -7,8 +7,9 @@ import { type EditorView } from '@codemirror/view';
7
7
  import { type NodeArg } from '@dxos/app-graph';
8
8
  import { type ToolbarMenuActionGroupProperties } from '@dxos/react-ui-menu';
9
9
 
10
- import { createEditorAction, createEditorActionGroup, type EditorToolbarState } from './util';
11
- import { addList, List, removeList } from '../../extensions';
10
+ import { List, addList, removeList } from '../../extensions';
11
+
12
+ import { type EditorToolbarState, createEditorAction, createEditorActionGroup } from './util';
12
13
 
13
14
  const listStyles = {
14
15
  bullet: 'ph--list-bullets--regular',
@@ -7,7 +7,7 @@ import { type Rx } from '@effect-rx/rx-react';
7
7
  import { useMemo } from 'react';
8
8
 
9
9
  import { type Action } from '@dxos/app-graph';
10
- import { live, type Live } from '@dxos/live-object';
10
+ import { type Live, live } from '@dxos/live-object';
11
11
  import { type ThemedClassName } from '@dxos/react-ui';
12
12
  import {
13
13
  type ActionGraphProps,
@@ -5,10 +5,11 @@
5
5
  import { type NodeArg } from '@dxos/app-graph';
6
6
  import { type ToolbarMenuActionGroupProperties } from '@dxos/react-ui-menu';
7
7
 
8
- import { createEditorAction, createEditorActionGroup, type EditorToolbarState } from './util';
9
8
  import { translationKey } from '../../translations';
10
9
  import { type EditorViewMode } from '../../types';
11
10
 
11
+ import { type EditorToolbarState, createEditorAction, createEditorActionGroup } from './util';
12
+
12
13
  const createViewModeGroupAction = (value: string) =>
13
14
  createEditorActionGroup(
14
15
  'viewMode',
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { createContext } from '@radix-ui/react-context';
6
- import React, { type PropsWithChildren, useRef, useState, useEffect, useCallback, type RefObject } from 'react';
6
+ import React, { type PropsWithChildren, type RefObject, useCallback, useEffect, useRef, useState } from 'react';
7
7
 
8
8
  import { addEventListener } from '@dxos/async';
9
9
  import { type DxRefTag, type DxRefTagActivate } from '@dxos/lit-ui';
@@ -5,12 +5,12 @@
5
5
  import { createContext } from '@radix-ui/react-context';
6
6
  import React, {
7
7
  type PropsWithChildren,
8
- useRef,
9
- useState,
10
- useEffect,
11
- useCallback,
12
8
  type RefObject,
13
9
  forwardRef,
10
+ useCallback,
11
+ useEffect,
12
+ useRef,
13
+ useState,
14
14
  } from 'react';
15
15
 
16
16
  import { addEventListener } from '@dxos/async';
@@ -3,12 +3,12 @@
3
3
  //
4
4
 
5
5
  import {
6
- autocompletion,
7
- completionKeymap,
8
- type CompletionSource,
9
6
  type Completion,
10
7
  type CompletionContext,
11
8
  type CompletionResult,
9
+ type CompletionSource,
10
+ autocompletion,
11
+ completionKeymap,
12
12
  } from '@codemirror/autocomplete';
13
13
  import { markdownLanguage } from '@codemirror/lang-markdown';
14
14
  import { type Extension } from '@codemirror/state';
@@ -11,9 +11,9 @@ import { BroadcastChannelNetworkAdapter } from '@automerge/automerge-repo-networ
11
11
  import React, { useEffect, useState } from 'react';
12
12
 
13
13
  import { Obj, Ref, Type } from '@dxos/echo';
14
- import { DocAccessor, createDocAccessor, useQuery, useSpace, type Space, Query } from '@dxos/react-client/echo';
15
- import { useIdentity, type Identity } from '@dxos/react-client/halo';
16
- import { ClientRepeater, type ClientRepeatedComponentProps } from '@dxos/react-client/testing';
14
+ import { DocAccessor, Query, type Space, createDocAccessor, useQuery, useSpace } from '@dxos/react-client/echo';
15
+ import { type Identity, useIdentity } from '@dxos/react-client/halo';
16
+ import { type ClientRepeatedComponentProps, ClientRepeater } from '@dxos/react-client/testing';
17
17
  import { useThemeContext } from '@dxos/react-ui';
18
18
  import { withLayout, withTheme } from '@dxos/storybook-utils';
19
19
 
@@ -41,7 +41,7 @@ const Editor = ({ source, autoFocus, space, identity }: EditorProps) => {
41
41
  () => ({
42
42
  initialValue: DocAccessor.getValue(source),
43
43
  extensions: [
44
- createBasicExtensions({ placeholder: 'Type here...' }),
44
+ createBasicExtensions({ placeholder: 'Type here...', search: true }),
45
45
  createThemeExtensions({ themeMode, slots: editorSlots }),
46
46
  createDataExtensions({ id: 'test', text: source, space, identity }),
47
47
  ],
@@ -5,15 +5,16 @@
5
5
  //
6
6
 
7
7
  import { next as A } from '@automerge/automerge';
8
- import { StateField, type Extension } from '@codemirror/state';
8
+ import { type Extension, StateField } from '@codemirror/state';
9
9
  import { EditorView, ViewPlugin } from '@codemirror/view';
10
10
 
11
11
  import { type DocAccessor } from '@dxos/react-client/echo';
12
12
 
13
+ import { Cursor } from '../../util';
14
+
13
15
  import { cursorConverter } from './cursor';
14
- import { updateHeadsEffect, isReconcile, type State } from './defs';
16
+ import { type State, isReconcile, updateHeadsEffect } from './defs';
15
17
  import { Syncer } from './sync';
16
- import { Cursor } from '../../util';
17
18
 
18
19
  export const automerge = (accessor: DocAccessor): Extension => {
19
20
  const syncState = StateField.define<State>({
@@ -5,7 +5,7 @@
5
5
  //
6
6
 
7
7
  import { type Heads, type Prop } from '@automerge/automerge';
8
- import { Annotation, StateEffect, type StateField, type EditorState, type Transaction } from '@codemirror/state';
8
+ import { Annotation, type EditorState, StateEffect, type StateField, type Transaction } from '@codemirror/state';
9
9
 
10
10
  export type State = {
11
11
  path: Prop[];
@@ -10,7 +10,7 @@ import { type EditorView } from '@codemirror/view';
10
10
 
11
11
  import { type IDocHandle } from '@dxos/react-client/echo';
12
12
 
13
- import { getLastHeads, getPath, isReconcile, reconcileAnnotation, type State, updateHeads } from './defs';
13
+ import { type State, getLastHeads, getPath, isReconcile, reconcileAnnotation, updateHeads } from './defs';
14
14
  import { updateAutomerge } from './update-automerge';
15
15
  import { updateCodeMirror } from './update-codemirror';
16
16
 
@@ -5,7 +5,7 @@
5
5
  //
6
6
 
7
7
  import { next as A, type Heads } from '@automerge/automerge';
8
- import { type EditorState, type StateField, type Transaction, type Text } from '@codemirror/state';
8
+ import { type EditorState, type StateField, type Text, type Transaction } from '@codemirror/state';
9
9
 
10
10
  import { type IDocHandle } from '@dxos/react-client/echo';
11
11
 
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Annotation, type Extension, RangeSet, type Range } from '@codemirror/state';
5
+ import { Annotation, type Extension, type Range, RangeSet } from '@codemirror/state';
6
6
  import {
7
7
  Decoration,
8
8
  type DecorationSet,
@@ -16,7 +16,7 @@ import {
16
16
  import { Event } from '@dxos/async';
17
17
  import { Context } from '@dxos/context';
18
18
 
19
- import { singleValueFacet, Cursor, type CursorConverter } from '../../util';
19
+ import { Cursor, type CursorConverter, singleValueFacet } from '../../util';
20
20
 
21
21
  export interface AwarenessProvider {
22
22
  remoteStateChange: Event<void>;
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { StateEffect } from '@codemirror/state';
6
- import { type KeyBinding, type Command, type EditorView } from '@codemirror/view';
6
+ import { type Command, type EditorView, type KeyBinding } from '@codemirror/view';
7
7
 
8
8
  import { commandState } from './state';
9
9
 
@@ -2,12 +2,13 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { RangeSetBuilder, StateField, StateEffect, Prec } from '@codemirror/state';
6
- import { EditorView, ViewPlugin, type ViewUpdate, Decoration, keymap, type DecorationSet } from '@codemirror/view';
5
+ import { Prec, RangeSetBuilder, StateEffect, StateField } from '@codemirror/state';
6
+ import { Decoration, type DecorationSet, EditorView, ViewPlugin, type ViewUpdate, keymap } from '@codemirror/view';
7
7
 
8
- import { placeholder, type PlaceholderOptions } from './placeholder';
9
8
  import { type Range } from '../../types';
10
9
 
10
+ import { type PlaceholderOptions, placeholder } from './placeholder';
11
+
11
12
  export type CommandMenuOptions = {
12
13
  trigger: string | string[];
13
14
  placeholder?: Partial<PlaceholderOptions>;
@@ -2,14 +2,14 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Prec, type Extension } from '@codemirror/state';
5
+ import { type Extension, Prec } from '@codemirror/state';
6
6
  import { EditorView, keymap } from '@codemirror/view';
7
7
 
8
8
  import { isNonNullable } from '@dxos/util';
9
9
 
10
10
  import { closeEffect, commandKeyBindings } from './action';
11
- import { hint, type HintOptions } from './hint';
12
- import { commandConfig, commandState, type PopupOptions } from './state';
11
+ import { type HintOptions, hint } from './hint';
12
+ import { type PopupOptions, commandConfig, commandState } from './state';
13
13
 
14
14
  // TODO(burdon): Create knowledge base for CM notes and ideas.
15
15
  // https://discuss.codemirror.net/t/inline-code-hints-like-vscode/5533/4
@@ -6,9 +6,10 @@
6
6
  import { RangeSetBuilder } from '@codemirror/state';
7
7
  import { Decoration, EditorView, ViewPlugin, type ViewUpdate, WidgetType } from '@codemirror/view';
8
8
 
9
- import { commandState } from './state';
10
9
  import { clientRectsFor, flattenRect } from '../../util';
11
10
 
11
+ import { commandState } from './state';
12
+
12
13
  export type HintOptions = {
13
14
  delay?: number;
14
15
  onHint?: () => string | undefined;
@@ -4,7 +4,7 @@
4
4
  //
5
5
 
6
6
  import { type Extension } from '@codemirror/state';
7
- import { Decoration, EditorView, WidgetType, ViewPlugin, type ViewUpdate } from '@codemirror/view';
7
+ import { Decoration, EditorView, ViewPlugin, type ViewUpdate, WidgetType } from '@codemirror/view';
8
8
 
9
9
  import { clientRectsFor, flattenRect } from '../../util';
10
10
 
@@ -3,13 +3,14 @@
3
3
  //
4
4
 
5
5
  import { StateField } from '@codemirror/state';
6
- import { showTooltip, type EditorView, type Tooltip, type TooltipView } from '@codemirror/view';
6
+ import { type EditorView, type Tooltip, type TooltipView, showTooltip } from '@codemirror/view';
7
7
 
8
- import { closeEffect, type Action, openEffect } from './action';
9
- import { type CommandOptions } from './command';
10
8
  import { type RenderCallback } from '../../types';
11
9
  import { singleValueFacet } from '../../util';
12
10
 
11
+ import { type Action, closeEffect, openEffect } from './action';
12
+ import { type CommandOptions } from './command';
13
+
13
14
  export const commandConfig = singleValueFacet<CommandOptions>();
14
15
 
15
16
  export type PopupOptions = {
@@ -2,15 +2,15 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { EditorSelection, Prec, RangeSetBuilder, type Extension } from '@codemirror/state';
5
+ import { EditorSelection, type Extension, Prec, RangeSetBuilder } from '@codemirror/state';
6
6
  import {
7
7
  type Command,
8
8
  Decoration,
9
9
  type DecorationSet,
10
10
  type EditorView,
11
- keymap,
12
11
  ViewPlugin,
13
12
  type ViewUpdate,
13
+ keymap,
14
14
  } from '@codemirror/view';
15
15
 
16
16
  import { Hint } from './hint';
@@ -8,9 +8,10 @@ import { type RefObject, useCallback, useMemo, useRef, useState } from 'react';
8
8
  import { type DxRefTag, type DxRefTagActivate } from '@dxos/lit-ui';
9
9
  import { type MaybePromise } from '@dxos/util';
10
10
 
11
+ import { type CommandMenuGroup, type CommandMenuItem, getItem, getNextItem, getPreviousItem } from '../../components';
12
+
11
13
  import { commandMenu, commandRangeEffect } from './command-menu';
12
14
  import { type PlaceholderOptions } from './placeholder';
13
- import { getItem, getNextItem, getPreviousItem, type CommandMenuGroup, type CommandMenuItem } from '../../components';
14
15
 
15
16
  export type UseCommandMenuOptions = {
16
17
  viewRef: RefObject<EditorView | undefined>;
@@ -5,25 +5,26 @@
5
5
  import { invertedEffects } from '@codemirror/commands';
6
6
  import { type ChangeDesc, type Extension, StateEffect, StateField, type Text } from '@codemirror/state';
7
7
  import {
8
- hoverTooltip,
9
- keymap,
10
8
  type Command,
11
9
  Decoration,
12
10
  EditorView,
13
- type Rect,
14
11
  type PluginValue,
12
+ type Rect,
15
13
  ViewPlugin,
14
+ hoverTooltip,
15
+ keymap,
16
16
  } from '@codemirror/view';
17
17
  import sortBy from 'lodash.sortby';
18
18
  import { useEffect } from 'react';
19
19
 
20
- import { debounce, type CleanupFn } from '@dxos/async';
20
+ import { type CleanupFn, debounce } from '@dxos/async';
21
21
  import { log } from '@dxos/log';
22
22
  import { isNonNullable } from '@dxos/util';
23
23
 
24
+ import { type Comment, type Range, type RenderCallback } from '../types';
25
+ import { Cursor, callbackWrapper, singleValueFacet } from '../util';
26
+
24
27
  import { documentId } from './selection';
25
- import { type RenderCallback, type Comment, type Range } from '../types';
26
- import { Cursor, singleValueFacet, callbackWrapper } from '../util';
27
28
 
28
29
  //
29
30
  // State management.
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import type { Extension } from '@codemirror/state';
6
- import { dropCursor, EditorView } from '@codemirror/view';
6
+ import { EditorView, dropCursor } from '@codemirror/view';
7
7
 
8
8
  export type DNDOptions = { onDrop?: (view: EditorView, event: { files: FileList }) => void };
9
9
 
@@ -31,11 +31,12 @@ import { type ThemeMode } from '@dxos/react-ui';
31
31
  import { type HuePalette } from '@dxos/react-ui-theme';
32
32
  import { hexToHue, isNotFalsy } from '@dxos/util';
33
33
 
34
+ import { editorGutter, editorMonospace } from '../defaults';
35
+ import { type ThemeStyles, defaultTheme } from '../styles';
36
+
34
37
  import { automerge } from './automerge';
35
38
  import { SpaceAwarenessProvider, awareness } from './awareness';
36
39
  import { focus } from './focus';
37
- import { editorGutter, editorMonospace } from '../defaults';
38
- import { type ThemeStyles, defaultTheme } from '../styles';
39
40
 
40
41
  //
41
42
  // Basic
@@ -82,7 +83,7 @@ const defaultBasicOptions: BasicExtensionsOptions = {
82
83
  history: true,
83
84
  keymap: 'standard',
84
85
  lineWrapping: true,
85
- search: true,
86
+ search: false,
86
87
  } as const;
87
88
 
88
89
  const keymaps: { [key: string]: readonly KeyBinding[] } = {
@@ -7,6 +7,8 @@ import { type EditorView } from '@codemirror/view';
7
7
  import { type Action } from '@dxos/app-graph';
8
8
  import { type MenuActionProperties } from '@dxos/react-ui-menu';
9
9
 
10
+ import { createComment } from '../comments';
11
+
10
12
  import {
11
13
  Inline,
12
14
  List,
@@ -25,7 +27,6 @@ import {
25
27
  toggleList,
26
28
  toggleStyle,
27
29
  } from './formatting';
28
- import { createComment } from '../comments';
29
30
 
30
31
  export type PayloadType =
31
32
  | 'view-mode'
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { completionKeymap } from '@codemirror/autocomplete';
6
6
  import { defaultKeymap, indentWithTab } from '@codemirror/commands';
7
- import { markdownLanguage, markdown } from '@codemirror/lang-markdown';
7
+ import { markdown, markdownLanguage } from '@codemirror/lang-markdown';
8
8
  import { syntaxHighlighting } from '@codemirror/language';
9
9
  import { languages } from '@codemirror/language-data';
10
10
  import { type Extension } from '@codemirror/state';
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { syntaxTree } from '@codemirror/language';
6
6
  import { type ChangeSpec, Transaction } from '@codemirror/state';
7
- import { ViewPlugin, type ViewUpdate, type PluginValue } from '@codemirror/view';
7
+ import { type PluginValue, ViewPlugin, type ViewUpdate } from '@codemirror/view';
8
8
 
9
9
  /**
10
10
  * Monitors and augments changes.
@@ -3,20 +3,21 @@
3
3
  //
4
4
 
5
5
  import { syntaxTree } from '@codemirror/language';
6
- import { RangeSetBuilder, type EditorState, StateEffect } from '@codemirror/state';
7
- import { EditorView, Decoration, type DecorationSet, WidgetType, ViewPlugin, type ViewUpdate } from '@codemirror/view';
6
+ import { type EditorState, RangeSetBuilder, StateEffect } from '@codemirror/state';
7
+ import { Decoration, type DecorationSet, EditorView, ViewPlugin, type ViewUpdate, WidgetType } from '@codemirror/view';
8
8
  import { type SyntaxNodeRef } from '@lezer/common';
9
9
 
10
10
  import { invariant } from '@dxos/invariant';
11
11
  import { mx } from '@dxos/react-ui-theme';
12
12
 
13
+ import { type HeadingLevel, theme } from '../../styles';
14
+ import { type RenderCallback } from '../../types';
15
+ import { wrapWithCatch } from '../../util';
16
+
13
17
  import { adjustChanges } from './changes';
14
18
  import { image } from './image';
15
- import { formattingStyles, bulletListIndentationWidth, orderedListIndentationWidth } from './styles';
19
+ import { bulletListIndentationWidth, formattingStyles, orderedListIndentationWidth } from './styles';
16
20
  import { table } from './table';
17
- import { theme, type HeadingLevel } from '../../styles';
18
- import { type RenderCallback } from '../../types';
19
- import { wrapWithCatch } from '../../util';
20
21
 
21
22
  /**
22
23
  * Unicode characters.