@dxos/react-ui-editor 0.8.3 → 0.8.4-main.f9ba587

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 (85) hide show
  1. package/dist/lib/browser/chunk-22UMM3QJ.mjs +22 -0
  2. package/dist/lib/browser/chunk-22UMM3QJ.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +566 -525
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +1 -1
  7. package/dist/lib/browser/types/index.mjs +13 -0
  8. package/dist/lib/browser/types/index.mjs.map +7 -0
  9. package/dist/lib/node-esm/chunk-YXYQPV6R.mjs +24 -0
  10. package/dist/lib/node-esm/chunk-YXYQPV6R.mjs.map +7 -0
  11. package/dist/lib/node-esm/index.mjs +566 -526
  12. package/dist/lib/node-esm/index.mjs.map +4 -4
  13. package/dist/lib/node-esm/meta.json +1 -1
  14. package/dist/lib/node-esm/testing/index.mjs +1 -1
  15. package/dist/lib/node-esm/types/index.mjs +14 -0
  16. package/dist/lib/node-esm/types/index.mjs.map +7 -0
  17. package/dist/types/src/components/Editor/Editor.d.ts +19 -0
  18. package/dist/types/src/components/Editor/Editor.d.ts.map +1 -0
  19. package/dist/types/src/components/Editor/index.d.ts +2 -0
  20. package/dist/types/src/components/Editor/index.d.ts.map +1 -0
  21. package/dist/types/src/components/EditorToolbar/util.d.ts +4 -3
  22. package/dist/types/src/components/EditorToolbar/util.d.ts.map +1 -1
  23. package/dist/types/src/components/EditorToolbar/view-mode.d.ts +1 -1
  24. package/dist/types/src/components/EditorToolbar/view-mode.d.ts.map +1 -1
  25. package/dist/types/src/components/Popover/RefDropdownMenu.d.ts.map +1 -1
  26. package/dist/types/src/components/index.d.ts +1 -0
  27. package/dist/types/src/components/index.d.ts.map +1 -1
  28. package/dist/types/src/extensions/automerge/automerge.stories.d.ts +28 -28
  29. package/dist/types/src/extensions/automerge/automerge.stories.d.ts.map +1 -1
  30. package/dist/types/src/extensions/blast.d.ts.map +1 -1
  31. package/dist/types/src/extensions/command/index.d.ts +1 -1
  32. package/dist/types/src/extensions/command/index.d.ts.map +1 -1
  33. package/dist/types/src/extensions/command/typeahead.d.ts +7 -2
  34. package/dist/types/src/extensions/command/typeahead.d.ts.map +1 -1
  35. package/dist/types/src/extensions/factories.d.ts +18 -0
  36. package/dist/types/src/extensions/factories.d.ts.map +1 -1
  37. package/dist/types/src/extensions/markdown/formatting.d.ts.map +1 -1
  38. package/dist/types/src/extensions/modes.d.ts +0 -7
  39. package/dist/types/src/extensions/modes.d.ts.map +1 -1
  40. package/dist/types/src/index.d.ts +1 -1
  41. package/dist/types/src/index.d.ts.map +1 -1
  42. package/dist/types/src/stories/CommandMenu.stories.d.ts +1 -1
  43. package/dist/types/src/stories/CommandMenu.stories.d.ts.map +1 -1
  44. package/dist/types/src/stories/EditorToolbar.stories.d.ts +1 -1
  45. package/dist/types/src/stories/EditorToolbar.stories.d.ts.map +1 -1
  46. package/dist/types/src/stories/components/EditorStory.d.ts +2 -2
  47. package/dist/types/src/translations.d.ts +28 -29
  48. package/dist/types/src/translations.d.ts.map +1 -1
  49. package/dist/types/src/types/index.d.ts +2 -0
  50. package/dist/types/src/types/index.d.ts.map +1 -0
  51. package/dist/types/src/types/types.d.ts +21 -0
  52. package/dist/types/src/types/types.d.ts.map +1 -0
  53. package/dist/types/tsconfig.tsbuildinfo +1 -1
  54. package/package.json +44 -41
  55. package/src/components/Editor/Editor.tsx +39 -0
  56. package/src/components/Editor/index.ts +5 -0
  57. package/src/components/EditorToolbar/util.ts +5 -4
  58. package/src/components/EditorToolbar/view-mode.ts +1 -1
  59. package/src/components/Popover/RefDropdownMenu.tsx +9 -3
  60. package/src/components/index.ts +1 -0
  61. package/src/extensions/automerge/automerge.stories.tsx +4 -2
  62. package/src/extensions/blast.ts +3 -16
  63. package/src/extensions/command/index.ts +1 -1
  64. package/src/extensions/command/typeahead.ts +26 -13
  65. package/src/extensions/factories.ts +24 -5
  66. package/src/extensions/markdown/formatting.test.ts +1 -1
  67. package/src/extensions/markdown/formatting.ts +14 -12
  68. package/src/extensions/modes.ts +0 -9
  69. package/src/index.ts +1 -1
  70. package/src/stories/CommandMenu.stories.tsx +1 -1
  71. package/src/stories/EditorToolbar.stories.tsx +3 -4
  72. package/src/stories/Preview.stories.tsx +4 -4
  73. package/src/stories/TextEditor.stories.tsx +1 -1
  74. package/src/styles/theme.ts +1 -1
  75. package/src/translations.ts +4 -2
  76. package/src/types/index.ts +5 -0
  77. package/src/types/types.ts +32 -0
  78. package/dist/lib/node/index.cjs +0 -7754
  79. package/dist/lib/node/index.cjs.map +0 -7
  80. package/dist/lib/node/meta.json +0 -1
  81. package/dist/lib/node/testing/index.cjs +0 -29
  82. package/dist/lib/node/testing/index.cjs.map +0 -7
  83. package/dist/types/src/types.d.ts +0 -14
  84. package/dist/types/src/types.d.ts.map +0 -1
  85. package/src/types.ts +0 -23
@@ -1,8 +1,14 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ EditorInputMode,
4
+ EditorInputModes,
5
+ EditorViewMode,
6
+ EditorViewModes
7
+ } from "./chunk-YXYQPV6R.mjs";
2
8
 
3
- // packages/ui/react-ui-editor/src/translations.ts
9
+ // src/translations.ts
4
10
  var translationKey = "react-ui-editor";
5
- var translations_default = [
11
+ var translations = [
6
12
  {
7
13
  "en-US": {
8
14
  [translationKey]: {
@@ -35,46 +41,27 @@ var translations_default = [
35
41
  }
36
42
  ];
37
43
 
38
- // packages/ui/react-ui-editor/src/index.ts
44
+ // src/index.ts
39
45
  import { EditorState as EditorState4 } from "@codemirror/state";
40
46
  import { EditorView as EditorView27, keymap as keymap14 } from "@codemirror/view";
41
47
  import { tags as tags2 } from "@lezer/highlight";
42
48
  import { TextKind } from "@dxos/protocols/proto/dxos/echo/model/text";
43
49
 
44
- // packages/ui/react-ui-editor/src/components/EditorToolbar/EditorToolbar.tsx
50
+ // src/components/Editor/Editor.tsx
45
51
  import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
46
- import { Rx } from "@effect-rx/rx-react";
47
- import React3, { memo, useMemo as useMemo4 } from "react";
48
- import { rxFromSignal } from "@dxos/app-graph";
49
- import { ElevationProvider } from "@dxos/react-ui";
50
- import { MenuProvider, ToolbarMenu, createGapSeparator, useMenuActions } from "@dxos/react-ui-menu";
52
+ import React3, { forwardRef, useImperativeHandle } from "react";
53
+ import { useThemeContext } from "@dxos/react-ui";
54
+ import { mx as mx6 } from "@dxos/react-ui-theme";
51
55
 
52
- // packages/ui/react-ui-editor/src/components/EditorToolbar/util.ts
53
- import { useMemo } from "react";
54
- import { live } from "@dxos/live-object";
55
- import { createMenuAction, createMenuItemGroup } from "@dxos/react-ui-menu";
56
- var useEditorToolbarState = (initialState = {}) => {
57
- return useMemo(() => live(initialState), []);
58
- };
59
- var createEditorAction = (id, invoke, properties) => {
60
- const { label = [
61
- `${id} label`,
62
- {
63
- ns: translationKey
64
- }
65
- ], ...rest } = properties;
66
- return createMenuAction(id, invoke, {
67
- label,
68
- ...rest
69
- });
70
- };
71
- var createEditorActionGroup = (id, props, icon) => createMenuItemGroup(id, {
72
- icon,
73
- iconOnly: true,
74
- ...props
75
- });
56
+ // src/hooks/useTextEditor.ts
57
+ import { EditorState as EditorState3 } from "@codemirror/state";
58
+ import { EditorView as EditorView26 } from "@codemirror/view";
59
+ import { useFocusableGroup } from "@fluentui/react-tabster";
60
+ import { useCallback as useCallback3, useEffect as useEffect2, useMemo as useMemo3, useRef as useRef2, useState as useState2 } from "react";
61
+ import { log as log8 } from "@dxos/log";
62
+ import { getProviderValue, isNotFalsy as isNotFalsy4 } from "@dxos/util";
76
63
 
77
- // packages/ui/react-ui-editor/src/extensions/annotations.ts
64
+ // src/extensions/annotations.ts
78
65
  import { RangeSetBuilder } from "@codemirror/state";
79
66
  import { Decoration, EditorView, ViewPlugin } from "@codemirror/view";
80
67
  var annotationMark = Decoration.mark({
@@ -115,7 +102,7 @@ var annotations = ({ match } = {}) => {
115
102
  ];
116
103
  };
117
104
 
118
- // packages/ui/react-ui-editor/src/extensions/autocomplete.ts
105
+ // src/extensions/autocomplete.ts
119
106
  import { autocompletion, completionKeymap } from "@codemirror/autocomplete";
120
107
  import { markdownLanguage } from "@codemirror/lang-markdown";
121
108
  import { keymap } from "@codemirror/view";
@@ -152,15 +139,15 @@ var autocomplete = ({ activateOnTyping, override, onSearch } = {}) => {
152
139
  return extensions;
153
140
  };
154
141
 
155
- // packages/ui/react-ui-editor/src/extensions/automerge/automerge.ts
142
+ // src/extensions/automerge/automerge.ts
156
143
  import { next as A3 } from "@automerge/automerge";
157
144
  import { StateField } from "@codemirror/state";
158
145
  import { EditorView as EditorView2, ViewPlugin as ViewPlugin2 } from "@codemirror/view";
159
146
 
160
- // packages/ui/react-ui-editor/src/extensions/automerge/cursor.ts
147
+ // src/extensions/automerge/cursor.ts
161
148
  import { log } from "@dxos/log";
162
149
  import { fromCursor, toCursor } from "@dxos/react-client/echo";
163
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/automerge/cursor.ts";
150
+ var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/automerge/cursor.ts";
164
151
  var cursorConverter = (accessor) => ({
165
152
  toCursor: (pos, assoc) => {
166
153
  try {
@@ -190,7 +177,7 @@ var cursorConverter = (accessor) => ({
190
177
  }
191
178
  });
192
179
 
193
- // packages/ui/react-ui-editor/src/extensions/automerge/defs.ts
180
+ // src/extensions/automerge/defs.ts
194
181
  import { Annotation, StateEffect } from "@codemirror/state";
195
182
  var getPath = (state, field) => state.field(field).path;
196
183
  var getLastHeads = (state, field) => state.field(field).lastHeads;
@@ -203,10 +190,10 @@ var isReconcile = (tr) => {
203
190
  return !!tr.annotation(reconcileAnnotation);
204
191
  };
205
192
 
206
- // packages/ui/react-ui-editor/src/extensions/automerge/sync.ts
193
+ // src/extensions/automerge/sync.ts
207
194
  import { next as A2 } from "@automerge/automerge";
208
195
 
209
- // packages/ui/react-ui-editor/src/extensions/automerge/update-automerge.ts
196
+ // src/extensions/automerge/update-automerge.ts
210
197
  import { next as A } from "@automerge/automerge";
211
198
  var updateAutomerge = (field, handle, transactions, state) => {
212
199
  const { lastHeads, path } = state.field(field);
@@ -237,7 +224,7 @@ var updateAutomerge = (field, handle, transactions, state) => {
237
224
  return newHeads ?? void 0;
238
225
  };
239
226
 
240
- // packages/ui/react-ui-editor/src/extensions/automerge/update-codemirror.ts
227
+ // src/extensions/automerge/update-codemirror.ts
241
228
  import { ChangeSet } from "@codemirror/state";
242
229
  var updateCodeMirror = (view, selection, target, patches) => {
243
230
  for (const patch of patches) {
@@ -344,7 +331,7 @@ var charPath = (textPath, candidatePath) => {
344
331
  return null;
345
332
  };
346
333
 
347
- // packages/ui/react-ui-editor/src/extensions/automerge/sync.ts
334
+ // src/extensions/automerge/sync.ts
348
335
  var Syncer = class {
349
336
  // prettier-ignore
350
337
  constructor(_handle, _state) {
@@ -388,7 +375,7 @@ var Syncer = class {
388
375
  }
389
376
  };
390
377
 
391
- // packages/ui/react-ui-editor/src/util/facet.ts
378
+ // src/util/facet.ts
392
379
  import { Facet } from "@codemirror/state";
393
380
  var singleValueFacet = (defaultValue) => Facet.define({
394
381
  // Called immediately.
@@ -397,7 +384,7 @@ var singleValueFacet = (defaultValue) => Facet.define({
397
384
  }
398
385
  });
399
386
 
400
- // packages/ui/react-ui-editor/src/util/cursor.ts
387
+ // src/util/cursor.ts
401
388
  var overlap = (a, b) => a.from <= b.to && a.to >= b.from;
402
389
  var defaultCursorConverter = {
403
390
  toCursor: (position) => position.toString(),
@@ -432,9 +419,9 @@ var Cursor = class _Cursor {
432
419
  }
433
420
  };
434
421
 
435
- // packages/ui/react-ui-editor/src/util/debug.ts
422
+ // src/util/debug.ts
436
423
  import { log as log2 } from "@dxos/log";
437
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/util/debug.ts";
424
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/util/debug.ts";
438
425
  var wrapWithCatch = (fn) => {
439
426
  return (...args) => {
440
427
  try {
@@ -492,7 +479,7 @@ var logChanges = (trs) => {
492
479
  }
493
480
  };
494
481
 
495
- // packages/ui/react-ui-editor/src/util/dom.ts
482
+ // src/util/dom.ts
496
483
  var flattenRect = (rect, left) => {
497
484
  const x = left ? rect.left : rect.right;
498
485
  return {
@@ -534,7 +521,7 @@ var createElement = (tag, options, children) => {
534
521
  return el;
535
522
  };
536
523
 
537
- // packages/ui/react-ui-editor/src/util/react.tsx
524
+ // src/util/react.tsx
538
525
  import React from "react";
539
526
  import { createRoot } from "react-dom/client";
540
527
  import { ThemeProvider, Tooltip } from "@dxos/react-ui";
@@ -551,7 +538,7 @@ var createRenderer = (Component) => (el, props) => {
551
538
  }, /* @__PURE__ */ React.createElement(Tooltip.Provider, null, /* @__PURE__ */ React.createElement(Component, props))));
552
539
  };
553
540
 
554
- // packages/ui/react-ui-editor/src/extensions/automerge/automerge.ts
541
+ // src/extensions/automerge/automerge.ts
555
542
  var automerge = (accessor) => {
556
543
  const syncState = StateField.define({
557
544
  create: () => ({
@@ -609,12 +596,12 @@ var automerge = (accessor) => {
609
596
  ];
610
597
  };
611
598
 
612
- // packages/ui/react-ui-editor/src/extensions/awareness/awareness.ts
599
+ // src/extensions/awareness/awareness.ts
613
600
  import { Annotation as Annotation2, RangeSet } from "@codemirror/state";
614
601
  import { Decoration as Decoration2, EditorView as EditorView3, ViewPlugin as ViewPlugin3, WidgetType } from "@codemirror/view";
615
602
  import { Event } from "@dxos/async";
616
603
  import { Context } from "@dxos/context";
617
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/awareness/awareness.ts";
604
+ var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/awareness/awareness.ts";
618
605
  var dummyProvider = {
619
606
  remoteStateChange: new Event(),
620
607
  open: () => {
@@ -841,12 +828,12 @@ var styles = EditorView3.theme({
841
828
  }
842
829
  });
843
830
 
844
- // packages/ui/react-ui-editor/src/extensions/awareness/awareness-provider.ts
831
+ // src/extensions/awareness/awareness-provider.ts
845
832
  import { DeferredTask, Event as Event2, sleep } from "@dxos/async";
846
833
  import { Context as Context2 } from "@dxos/context";
847
834
  import { invariant } from "@dxos/invariant";
848
835
  import { log as log3 } from "@dxos/log";
849
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/awareness/awareness-provider.ts";
836
+ var __dxlog_file4 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/awareness/awareness-provider.ts";
850
837
  var DEBOUNCE_INTERVAL = 100;
851
838
  var SpaceAwarenessProvider = class {
852
839
  constructor(params) {
@@ -948,11 +935,12 @@ var SpaceAwarenessProvider = class {
948
935
  }
949
936
  };
950
937
 
951
- // packages/ui/react-ui-editor/src/extensions/blast.ts
938
+ // src/extensions/blast.ts
952
939
  import { EditorView as EditorView4, keymap as keymap2 } from "@codemirror/view";
953
940
  import defaultsDeep from "lodash.defaultsdeep";
941
+ import { throttle } from "@dxos/async";
954
942
  import { invariant as invariant2 } from "@dxos/invariant";
955
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/blast.ts";
943
+ var __dxlog_file5 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/blast.ts";
956
944
  var defaultOptions = {
957
945
  effect: 2,
958
946
  maxParticles: 200,
@@ -1080,7 +1068,7 @@ var Blaster = class {
1080
1068
  initialize() {
1081
1069
  invariant2(!this._canvas && !this._ctx, void 0, {
1082
1070
  F: __dxlog_file5,
1083
- L: 141,
1071
+ L: 142,
1084
1072
  S: this,
1085
1073
  A: [
1086
1074
  "!this._canvas && !this._ctx",
@@ -1117,7 +1105,7 @@ var Blaster = class {
1117
1105
  start() {
1118
1106
  invariant2(this._canvas && this._ctx, void 0, {
1119
1107
  F: __dxlog_file5,
1120
- L: 180,
1108
+ L: 181,
1121
1109
  S: this,
1122
1110
  A: [
1123
1111
  "this._canvas && this._ctx",
@@ -1221,18 +1209,6 @@ var Effect2 = class extends Effect {
1221
1209
  ctx.fill();
1222
1210
  }
1223
1211
  };
1224
- function throttle(callback, limit) {
1225
- let wait = false;
1226
- return function(...args) {
1227
- if (!wait) {
1228
- callback.apply(this, args);
1229
- wait = true;
1230
- setTimeout(() => {
1231
- wait = false;
1232
- }, limit);
1233
- }
1234
- };
1235
- }
1236
1212
  var getRGBComponents = (node, color) => {
1237
1213
  if (typeof color === "function") {
1238
1214
  return color();
@@ -1258,10 +1234,10 @@ var random = (min, max) => {
1258
1234
  return min + ~~(Math.random() * (max - min + 1));
1259
1235
  };
1260
1236
 
1261
- // packages/ui/react-ui-editor/src/extensions/command/action.ts
1237
+ // src/extensions/command/action.ts
1262
1238
  import { StateEffect as StateEffect2 } from "@codemirror/state";
1263
1239
 
1264
- // packages/ui/react-ui-editor/src/extensions/command/state.ts
1240
+ // src/extensions/command/state.ts
1265
1241
  import { StateField as StateField2 } from "@codemirror/state";
1266
1242
  import { showTooltip } from "@codemirror/view";
1267
1243
  var commandConfig = singleValueFacet();
@@ -1274,7 +1250,7 @@ var commandState = StateField2.define({
1274
1250
  }
1275
1251
  const { renderDialog } = tr.state.facet(commandConfig);
1276
1252
  if (effect.is(openEffect) && renderDialog) {
1277
- const { pos, fullWidth } = effect.value;
1253
+ const { pos, fullWidth: fullWidth2 } = effect.value;
1278
1254
  const tooltip = {
1279
1255
  pos,
1280
1256
  above: false,
@@ -1285,7 +1261,7 @@ var commandState = StateField2.define({
1285
1261
  const tooltipView = {
1286
1262
  dom: root,
1287
1263
  mount: (view2) => {
1288
- if (fullWidth) {
1264
+ if (fullWidth2) {
1289
1265
  const parent = root.parentElement;
1290
1266
  const { paddingLeft, paddingRight } = window.getComputedStyle(parent);
1291
1267
  const widthWithoutPadding = parent.clientWidth - parseFloat(paddingLeft) - parseFloat(paddingRight);
@@ -1331,7 +1307,7 @@ var commandState = StateField2.define({
1331
1307
  ]
1332
1308
  });
1333
1309
 
1334
- // packages/ui/react-ui-editor/src/extensions/command/action.ts
1310
+ // src/extensions/command/action.ts
1335
1311
  var openEffect = StateEffect2.define();
1336
1312
  var closeEffect = StateEffect2.define();
1337
1313
  var openCommand = (view) => {
@@ -1371,12 +1347,12 @@ var commandKeyBindings = [
1371
1347
  }
1372
1348
  ];
1373
1349
 
1374
- // packages/ui/react-ui-editor/src/extensions/command/command.ts
1350
+ // src/extensions/command/command.ts
1375
1351
  import { Prec } from "@codemirror/state";
1376
1352
  import { EditorView as EditorView6, keymap as keymap3 } from "@codemirror/view";
1377
1353
  import { isNonNullable } from "@dxos/util";
1378
1354
 
1379
- // packages/ui/react-ui-editor/src/extensions/command/hint.ts
1355
+ // src/extensions/command/hint.ts
1380
1356
  import { RangeSetBuilder as RangeSetBuilder2 } from "@codemirror/state";
1381
1357
  import { Decoration as Decoration3, EditorView as EditorView5, ViewPlugin as ViewPlugin4, WidgetType as WidgetType2 } from "@codemirror/view";
1382
1358
  var hint = ({ delay = 3e3, onHint }) => {
@@ -1460,7 +1436,7 @@ var Hint = class extends WidgetType2 {
1460
1436
  }
1461
1437
  };
1462
1438
 
1463
- // packages/ui/react-ui-editor/src/extensions/command/command.ts
1439
+ // src/extensions/command/command.ts
1464
1440
  var command = (options = {}) => {
1465
1441
  return [
1466
1442
  Prec.highest(keymap3.of(commandKeyBindings)),
@@ -1476,11 +1452,11 @@ var command = (options = {}) => {
1476
1452
  ].filter(isNonNullable);
1477
1453
  };
1478
1454
 
1479
- // packages/ui/react-ui-editor/src/extensions/command/command-menu.ts
1455
+ // src/extensions/command/command-menu.ts
1480
1456
  import { RangeSetBuilder as RangeSetBuilder3, StateField as StateField3, StateEffect as StateEffect3, Prec as Prec2 } from "@codemirror/state";
1481
1457
  import { EditorView as EditorView8, ViewPlugin as ViewPlugin6, Decoration as Decoration5, keymap as keymap4 } from "@codemirror/view";
1482
1458
 
1483
- // packages/ui/react-ui-editor/src/extensions/command/placeholder.ts
1459
+ // src/extensions/command/placeholder.ts
1484
1460
  import { Decoration as Decoration4, EditorView as EditorView7, WidgetType as WidgetType3, ViewPlugin as ViewPlugin5 } from "@codemirror/view";
1485
1461
  var placeholder = ({ delay = 3e3, content }) => {
1486
1462
  const plugin = ViewPlugin5.fromClass(class {
@@ -1562,7 +1538,7 @@ var Placeholder = class extends WidgetType3 {
1562
1538
  }
1563
1539
  };
1564
1540
 
1565
- // packages/ui/react-ui-editor/src/extensions/command/command-menu.ts
1541
+ // src/extensions/command/command-menu.ts
1566
1542
  var commandMenu = (options) => {
1567
1543
  const commandMenuPlugin = ViewPlugin6.fromClass(class {
1568
1544
  constructor(view) {
@@ -1719,7 +1695,7 @@ var commandMenuState = StateField3.define({
1719
1695
  }
1720
1696
  });
1721
1697
 
1722
- // packages/ui/react-ui-editor/src/extensions/command/floating-menu.ts
1698
+ // src/extensions/command/floating-menu.ts
1723
1699
  import { EditorView as EditorView9, ViewPlugin as ViewPlugin7 } from "@codemirror/view";
1724
1700
  import { addEventListener } from "@dxos/async";
1725
1701
  var floatingMenu = (options = {}) => [
@@ -1808,8 +1784,93 @@ var floatingMenu = (options = {}) => [
1808
1784
  })
1809
1785
  ];
1810
1786
 
1811
- // packages/ui/react-ui-editor/src/extensions/command/useCommandMenu.ts
1812
- import { useCallback, useMemo as useMemo2, useRef, useState } from "react";
1787
+ // src/extensions/command/typeahead.ts
1788
+ import { EditorSelection, Prec as Prec3, RangeSetBuilder as RangeSetBuilder4 } from "@codemirror/state";
1789
+ import { Decoration as Decoration6, keymap as keymap5, ViewPlugin as ViewPlugin8 } from "@codemirror/view";
1790
+ var typeahead = ({ onComplete } = {}) => {
1791
+ let hint2;
1792
+ const complete = (view) => {
1793
+ if (!hint2) {
1794
+ return false;
1795
+ }
1796
+ const selection = view.state.selection.main;
1797
+ view.dispatch({
1798
+ changes: [
1799
+ {
1800
+ from: selection.from,
1801
+ to: selection.to,
1802
+ insert: hint2
1803
+ }
1804
+ ],
1805
+ selection: EditorSelection.cursor(selection.from + hint2.length)
1806
+ });
1807
+ return true;
1808
+ };
1809
+ return [
1810
+ ViewPlugin8.fromClass(class {
1811
+ constructor() {
1812
+ this.decorations = Decoration6.none;
1813
+ }
1814
+ update(update2) {
1815
+ const builder = new RangeSetBuilder4();
1816
+ const selection = update2.view.state.selection.main;
1817
+ const line = update2.view.state.doc.lineAt(selection.from);
1818
+ if (selection.from === selection.to && selection.from === line.to) {
1819
+ const str = update2.state.sliceDoc(line.from, selection.from);
1820
+ hint2 = onComplete?.({
1821
+ line: str
1822
+ });
1823
+ if (hint2) {
1824
+ builder.add(selection.from, selection.to, Decoration6.widget({
1825
+ widget: new Hint(hint2)
1826
+ }));
1827
+ }
1828
+ }
1829
+ this.decorations = builder.finish();
1830
+ }
1831
+ }, {
1832
+ decorations: (v) => v.decorations
1833
+ }),
1834
+ // Keys.
1835
+ Prec3.highest(keymap5.of([
1836
+ {
1837
+ key: "Tab",
1838
+ preventDefault: true,
1839
+ run: complete
1840
+ },
1841
+ {
1842
+ key: "ArrowRight",
1843
+ preventDefault: true,
1844
+ run: complete
1845
+ }
1846
+ ]))
1847
+ ];
1848
+ };
1849
+ var staticCompletion = (completions, options = {}) => ({ line }) => {
1850
+ if (line.length === 0 && options.default) {
1851
+ return options.default;
1852
+ }
1853
+ const parts = line.split(/\s+/).filter(Boolean);
1854
+ if (parts.length) {
1855
+ const str = parts.at(-1);
1856
+ if (str.length >= (options.minLength ?? 0)) {
1857
+ for (const completion of completions) {
1858
+ const match = matchCompletion(completion, str);
1859
+ if (match) {
1860
+ return match;
1861
+ }
1862
+ }
1863
+ }
1864
+ }
1865
+ };
1866
+ var matchCompletion = (completion, str, minLength = 0) => {
1867
+ if (str.length >= minLength && completion.length > str.length && completion.startsWith(str)) {
1868
+ return completion.slice(str.length);
1869
+ }
1870
+ };
1871
+
1872
+ // src/extensions/command/useCommandMenu.ts
1873
+ import { useCallback, useMemo, useRef, useState } from "react";
1813
1874
  var useCommandMenu = ({ viewRef, trigger, placeholder: placeholder3, getMenu }) => {
1814
1875
  const triggerRef = useRef(null);
1815
1876
  const currentRef = useRef(null);
@@ -1857,7 +1918,7 @@ var useCommandMenu = ({ viewRef, trigger, placeholder: placeholder3, getMenu })
1857
1918
  void item.onSelect?.(view, selection.head);
1858
1919
  }, []);
1859
1920
  const serializedTrigger = Array.isArray(trigger) ? trigger.join(",") : trigger;
1860
- const _commandMenu = useMemo2(() => {
1921
+ const _commandMenu = useMemo(() => {
1861
1922
  return commandMenu({
1862
1923
  trigger,
1863
1924
  placeholder: placeholder3,
@@ -1909,90 +1970,7 @@ var useCommandMenu = ({ viewRef, trigger, placeholder: placeholder3, getMenu })
1909
1970
  };
1910
1971
  };
1911
1972
 
1912
- // packages/ui/react-ui-editor/src/extensions/command/typeahead.ts
1913
- import { EditorSelection, Prec as Prec3, RangeSetBuilder as RangeSetBuilder4 } from "@codemirror/state";
1914
- import { Decoration as Decoration6, keymap as keymap5, ViewPlugin as ViewPlugin8 } from "@codemirror/view";
1915
- var typeahead = ({ onComplete } = {}) => {
1916
- let hint2;
1917
- const complete = (view) => {
1918
- if (!hint2) {
1919
- return false;
1920
- }
1921
- const selection = view.state.selection.main;
1922
- view.dispatch({
1923
- changes: [
1924
- {
1925
- from: selection.from,
1926
- to: selection.to,
1927
- insert: hint2
1928
- }
1929
- ],
1930
- selection: EditorSelection.cursor(selection.from + hint2.length)
1931
- });
1932
- return true;
1933
- };
1934
- return [
1935
- ViewPlugin8.fromClass(class {
1936
- constructor() {
1937
- this.decorations = Decoration6.none;
1938
- }
1939
- update(update2) {
1940
- const builder = new RangeSetBuilder4();
1941
- const selection = update2.view.state.selection.main;
1942
- const line = update2.view.state.doc.lineAt(selection.from);
1943
- if (selection.from === selection.to && selection.from === line.to) {
1944
- const str = update2.state.sliceDoc(line.from, selection.from);
1945
- hint2 = onComplete?.({
1946
- line: str
1947
- });
1948
- if (hint2) {
1949
- builder.add(selection.from, selection.to, Decoration6.widget({
1950
- widget: new Hint(hint2)
1951
- }));
1952
- }
1953
- }
1954
- this.decorations = builder.finish();
1955
- }
1956
- }, {
1957
- decorations: (v) => v.decorations
1958
- }),
1959
- // Keys.
1960
- Prec3.highest(keymap5.of([
1961
- {
1962
- key: "Tab",
1963
- preventDefault: true,
1964
- run: complete
1965
- },
1966
- {
1967
- key: "ArrowRight",
1968
- preventDefault: true,
1969
- run: complete
1970
- }
1971
- ]))
1972
- ];
1973
- };
1974
- var staticCompletion = (completions, defaultCompletion) => ({ line }) => {
1975
- if (line.length === 0 && defaultCompletion) {
1976
- return defaultCompletion;
1977
- }
1978
- const words = line.split(/\s+/).filter(Boolean);
1979
- if (words.length) {
1980
- const word = words.at(-1);
1981
- for (const completion of completions) {
1982
- const match = matchCompletion(completion, word);
1983
- if (match) {
1984
- return match;
1985
- }
1986
- }
1987
- }
1988
- };
1989
- var matchCompletion = (completion, word) => {
1990
- if (completion.length > word.length && completion.startsWith(word)) {
1991
- return completion.slice(word.length);
1992
- }
1993
- };
1994
-
1995
- // packages/ui/react-ui-editor/src/extensions/comments.ts
1973
+ // src/extensions/comments.ts
1996
1974
  import { invertedEffects } from "@codemirror/commands";
1997
1975
  import { StateEffect as StateEffect4, StateField as StateField4 } from "@codemirror/state";
1998
1976
  import { hoverTooltip, keymap as keymap7, Decoration as Decoration7, EditorView as EditorView11, ViewPlugin as ViewPlugin9 } from "@codemirror/view";
@@ -2002,13 +1980,13 @@ import { debounce as debounce2 } from "@dxos/async";
2002
1980
  import { log as log4 } from "@dxos/log";
2003
1981
  import { isNonNullable as isNonNullable2 } from "@dxos/util";
2004
1982
 
2005
- // packages/ui/react-ui-editor/src/extensions/selection.ts
1983
+ // src/extensions/selection.ts
2006
1984
  import { Transaction } from "@codemirror/state";
2007
1985
  import { EditorView as EditorView10, keymap as keymap6 } from "@codemirror/view";
2008
1986
  import { debounce } from "@dxos/async";
2009
1987
  import { invariant as invariant3 } from "@dxos/invariant";
2010
1988
  import { isNotFalsy } from "@dxos/util";
2011
- var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/selection.ts";
1989
+ var __dxlog_file6 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/selection.ts";
2012
1990
  var documentId = singleValueFacet();
2013
1991
  var stateRestoreAnnotation = "dxos.org/cm/state-restore";
2014
1992
  var createEditorStateTransaction = ({ scrollTo, selection }) => {
@@ -2095,8 +2073,8 @@ var selectionState = ({ getState, setState } = {}) => {
2095
2073
  ].filter(isNotFalsy);
2096
2074
  };
2097
2075
 
2098
- // packages/ui/react-ui-editor/src/extensions/comments.ts
2099
- var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/comments.ts";
2076
+ // src/extensions/comments.ts
2077
+ var __dxlog_file7 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/comments.ts";
2100
2078
  var setComments = StateEffect4.define();
2101
2079
  var setSelection = StateEffect4.define();
2102
2080
  var setCommentState = StateEffect4.define();
@@ -2520,7 +2498,7 @@ var useComments = (view, id, comments2) => {
2520
2498
  });
2521
2499
  };
2522
2500
 
2523
- // packages/ui/react-ui-editor/src/extensions/debug.ts
2501
+ // src/extensions/debug.ts
2524
2502
  import { syntaxTree } from "@codemirror/language";
2525
2503
  import { StateField as StateField5 } from "@codemirror/state";
2526
2504
  var debugNodeLogger = (log9 = console.log) => {
@@ -2533,7 +2511,7 @@ var debugNodeLogger = (log9 = console.log) => {
2533
2511
  });
2534
2512
  };
2535
2513
 
2536
- // packages/ui/react-ui-editor/src/extensions/dnd.ts
2514
+ // src/extensions/dnd.ts
2537
2515
  import { dropCursor, EditorView as EditorView12 } from "@codemirror/view";
2538
2516
  var styles3 = EditorView12.theme({
2539
2517
  ".cm-dropCursor": {
@@ -2569,7 +2547,7 @@ var dropFile = (options = {}) => {
2569
2547
  ];
2570
2548
  };
2571
2549
 
2572
- // packages/ui/react-ui-editor/src/extensions/factories.ts
2550
+ // src/extensions/factories.ts
2573
2551
  import { closeBrackets, closeBracketsKeymap } from "@codemirror/autocomplete";
2574
2552
  import { defaultKeymap, history, historyKeymap, indentWithTab, standardKeymap } from "@codemirror/commands";
2575
2553
  import { bracketMatching, defaultHighlightStyle, syntaxHighlighting } from "@codemirror/language";
@@ -2583,7 +2561,7 @@ import { generateName } from "@dxos/display-name";
2583
2561
  import { log as log5 } from "@dxos/log";
2584
2562
  import { hexToHue, isNotFalsy as isNotFalsy2 } from "@dxos/util";
2585
2563
 
2586
- // packages/ui/react-ui-editor/src/extensions/focus.ts
2564
+ // src/extensions/focus.ts
2587
2565
  import { StateEffect as StateEffect5, StateField as StateField6 } from "@codemirror/state";
2588
2566
  import { EditorView as EditorView13 } from "@codemirror/view";
2589
2567
  var focusEffect = StateEffect5.define();
@@ -2614,11 +2592,11 @@ var focus = [
2614
2592
  })
2615
2593
  ];
2616
2594
 
2617
- // packages/ui/react-ui-editor/src/defaults.ts
2595
+ // src/defaults.ts
2618
2596
  import { EditorView as EditorView14 } from "@codemirror/view";
2619
2597
  import { mx as mx2 } from "@dxos/react-ui-theme";
2620
2598
 
2621
- // packages/ui/react-ui-editor/src/styles/markdown.ts
2599
+ // src/styles/markdown.ts
2622
2600
  import { mx } from "@dxos/react-ui-theme";
2623
2601
  var headings = {
2624
2602
  1: "text-4xl",
@@ -2637,7 +2615,7 @@ var theme = {
2637
2615
  }
2638
2616
  };
2639
2617
 
2640
- // packages/ui/react-ui-editor/src/styles/tokens.ts
2618
+ // src/styles/tokens.ts
2641
2619
  import { tokens } from "@dxos/react-ui-theme";
2642
2620
  import { get } from "@dxos/util";
2643
2621
  var getToken = (path, defaultValue) => {
@@ -2647,7 +2625,7 @@ var getToken = (path, defaultValue) => {
2647
2625
  var fontBody = getToken("fontFamily.body");
2648
2626
  var fontMono = getToken("fontFamily.mono");
2649
2627
 
2650
- // packages/ui/react-ui-editor/src/styles/theme.ts
2628
+ // src/styles/theme.ts
2651
2629
  var defaultTheme = {
2652
2630
  "&": {},
2653
2631
  "&.cm-focused": {
@@ -2711,7 +2689,7 @@ var defaultTheme = {
2711
2689
  borderLeft: "2px solid var(--dx-cmCursor)"
2712
2690
  },
2713
2691
  ".cm-placeholder": {
2714
- color: "var(--dx-subdued)"
2692
+ color: "var(--dx-placeholder)"
2715
2693
  },
2716
2694
  /**
2717
2695
  * Selection (layer).
@@ -2859,7 +2837,7 @@ var defaultTheme = {
2859
2837
  }
2860
2838
  };
2861
2839
 
2862
- // packages/ui/react-ui-editor/src/defaults.ts
2840
+ // src/defaults.ts
2863
2841
  var editorWidth = "!mli-auto is-full max-is-[min(50rem,100%-4rem)]";
2864
2842
  var editorSlots = {
2865
2843
  scroll: {
@@ -2883,8 +2861,8 @@ var editorMonospace = EditorView14.theme({
2883
2861
  var editorWithToolbarLayout = "grid grid-cols-1 grid-rows-[min-content_1fr] data-[toolbar=disabled]:grid-rows-[1fr] justify-center content-start overflow-hidden";
2884
2862
  var stackItemContentEditorClassNames = (role) => mx2("attention-surface dx-focus-ring-inset data-[toolbar=disabled]:pbs-2", role === "section" ? "[&_.cm-scroller]:overflow-hidden [&_.cm-scroller]:min-bs-24" : "min-bs-0");
2885
2863
 
2886
- // packages/ui/react-ui-editor/src/extensions/factories.ts
2887
- var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/factories.ts";
2864
+ // src/extensions/factories.ts
2865
+ var __dxlog_file8 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/factories.ts";
2888
2866
  var preventNewline = EditorState.transactionFilter.of((tr) => tr.newDoc.lines > 1 ? [] : tr);
2889
2867
  var defaultBasicOptions = {
2890
2868
  allowMultipleSelections: true,
@@ -2960,11 +2938,17 @@ var createBasicExtensions = (_props) => {
2960
2938
  ].filter(isNotFalsy2))
2961
2939
  ].filter(isNotFalsy2);
2962
2940
  };
2963
- var defaultThemeSlots = {
2941
+ var grow = {
2942
+ editor: {
2943
+ className: "is-full bs-full"
2944
+ }
2945
+ };
2946
+ var fullWidth = {
2964
2947
  editor: {
2965
- className: "w-full bs-full"
2948
+ className: "is-full"
2966
2949
  }
2967
2950
  };
2951
+ var defaultThemeSlots = grow;
2968
2952
  var createThemeExtensions = ({ themeMode, styles: styles4, syntaxHighlighting: _syntaxHighlighting, slots: _slots } = {}) => {
2969
2953
  const slots = defaultsDeep2({}, _slots, defaultThemeSlots);
2970
2954
  return [
@@ -2982,6 +2966,11 @@ var createThemeExtensions = ({ themeMode, styles: styles4, syntaxHighlighting: _
2982
2966
  constructor(view) {
2983
2967
  view.scrollDOM.classList.add(slots.scroll.className);
2984
2968
  }
2969
+ }),
2970
+ slots.scroller?.className && ViewPlugin10.fromClass(class {
2971
+ constructor(view) {
2972
+ view.dom.querySelector(".cm-scroller")?.classList.add(...slots.scroller.className.split(" "));
2973
+ }
2985
2974
  })
2986
2975
  ].filter(isNotFalsy2);
2987
2976
  };
@@ -3007,7 +2996,7 @@ var createDataExtensions = ({ id, text, space, identity }) => {
3007
2996
  return extensions;
3008
2997
  };
3009
2998
 
3010
- // packages/ui/react-ui-editor/src/extensions/folding.tsx
2999
+ // src/extensions/folding.tsx
3011
3000
  import { codeFolding, foldGutter } from "@codemirror/language";
3012
3001
  import { EditorView as EditorView16 } from "@codemirror/view";
3013
3002
  import React2 from "react";
@@ -3045,7 +3034,7 @@ var folding = (_props = {}) => [
3045
3034
  })
3046
3035
  ];
3047
3036
 
3048
- // packages/ui/react-ui-editor/src/extensions/hashtag.tsx
3037
+ // src/extensions/hashtag.tsx
3049
3038
  import { Decoration as Decoration8, EditorView as EditorView17, MatchDecorator, ViewPlugin as ViewPlugin11, WidgetType as WidgetType4 } from "@codemirror/view";
3050
3039
  import { getHashColor, mx as mx3 } from "@dxos/react-ui-theme";
3051
3040
  var TagWidget = class extends WidgetType4 {
@@ -3088,7 +3077,7 @@ var hashtag = () => [
3088
3077
  })
3089
3078
  ];
3090
3079
 
3091
- // packages/ui/react-ui-editor/src/extensions/json.ts
3080
+ // src/extensions/json.ts
3092
3081
  import { json, jsonParseLinter } from "@codemirror/lang-json";
3093
3082
  import { linter } from "@codemirror/lint";
3094
3083
  import Ajv from "ajv";
@@ -3133,7 +3122,7 @@ var schemaLinter = (validate) => (view) => {
3133
3122
  }
3134
3123
  };
3135
3124
 
3136
- // packages/ui/react-ui-editor/src/extensions/listener.ts
3125
+ // src/extensions/listener.ts
3137
3126
  import { EditorView as EditorView18 } from "@codemirror/view";
3138
3127
  var listener = ({ onFocus, onChange }) => {
3139
3128
  const extensions = [];
@@ -3147,12 +3136,13 @@ var listener = ({ onFocus, onChange }) => {
3147
3136
  return extensions;
3148
3137
  };
3149
3138
 
3150
- // packages/ui/react-ui-editor/src/extensions/markdown/formatting.ts
3139
+ // src/extensions/markdown/formatting.ts
3151
3140
  import { snippet } from "@codemirror/autocomplete";
3152
3141
  import { syntaxTree as syntaxTree2 } from "@codemirror/language";
3153
3142
  import { EditorSelection as EditorSelection2 } from "@codemirror/state";
3154
3143
  import { EditorView as EditorView19, keymap as keymap9 } from "@codemirror/view";
3155
- import { useMemo as useMemo3 } from "react";
3144
+ import { useCallback as useCallback2, useMemo as useMemo2 } from "react";
3145
+ import { debounceAndThrottle } from "@dxos/async";
3156
3146
  var formattingEquals = (a, b) => a.blockType === b.blockType && a.strong === b.strong && a.emphasis === b.emphasis && a.strikethrough === b.strikethrough && a.code === b.code && a.link === b.link && a.listStyle === b.listStyle && a.blockQuote === b.blockQuote;
3157
3147
  var Inline = /* @__PURE__ */ function(Inline2) {
3158
3148
  Inline2[Inline2["Strong"] = 0] = "Strong";
@@ -4240,16 +4230,21 @@ var getFormatting = (state) => {
4240
4230
  };
4241
4231
  };
4242
4232
  var useFormattingState = (state) => {
4243
- return useMemo3(() => EditorView19.updateListener.of((update2) => {
4233
+ const handleUpdate = useCallback2(debounceAndThrottle((update2) => {
4244
4234
  if (update2.docChanged || update2.selectionSet) {
4245
4235
  Object.entries(getFormatting(update2.state)).forEach(([key, active]) => {
4246
4236
  state[key] = active;
4247
4237
  });
4248
4238
  }
4249
- }), []);
4239
+ }, 100), [
4240
+ state
4241
+ ]);
4242
+ return useMemo2(() => EditorView19.updateListener.of(handleUpdate), [
4243
+ handleUpdate
4244
+ ]);
4250
4245
  };
4251
4246
 
4252
- // packages/ui/react-ui-editor/src/extensions/markdown/action.ts
4247
+ // src/extensions/markdown/action.ts
4253
4248
  var processEditorPayload = (view, { type, data }) => {
4254
4249
  let inlineType, listType;
4255
4250
  switch (type) {
@@ -4298,7 +4293,7 @@ var processEditorPayload = (view, { type, data }) => {
4298
4293
  });
4299
4294
  };
4300
4295
 
4301
- // packages/ui/react-ui-editor/src/extensions/markdown/bundle.ts
4296
+ // src/extensions/markdown/bundle.ts
4302
4297
  import { completionKeymap as completionKeymap2 } from "@codemirror/autocomplete";
4303
4298
  import { defaultKeymap as defaultKeymap2, indentWithTab as indentWithTab2 } from "@codemirror/commands";
4304
4299
  import { markdownLanguage as markdownLanguage3, markdown } from "@codemirror/lang-markdown";
@@ -4307,7 +4302,7 @@ import { languages } from "@codemirror/language-data";
4307
4302
  import { keymap as keymap10 } from "@codemirror/view";
4308
4303
  import { isNotFalsy as isNotFalsy3 } from "@dxos/util";
4309
4304
 
4310
- // packages/ui/react-ui-editor/src/extensions/markdown/highlight.ts
4305
+ // src/extensions/markdown/highlight.ts
4311
4306
  import { markdownLanguage as markdownLanguage2 } from "@codemirror/lang-markdown";
4312
4307
  import { HighlightStyle } from "@codemirror/language";
4313
4308
  import { tags, styleTags, Tag } from "@lezer/highlight";
@@ -4486,7 +4481,7 @@ var markdownHighlightStyle = (_options = {}) => {
4486
4481
  });
4487
4482
  };
4488
4483
 
4489
- // packages/ui/react-ui-editor/src/extensions/markdown/bundle.ts
4484
+ // src/extensions/markdown/bundle.ts
4490
4485
  var createMarkdownExtensions = (options = {}) => {
4491
4486
  return [
4492
4487
  // Main extension.
@@ -4521,7 +4516,7 @@ var createMarkdownExtensions = (options = {}) => {
4521
4516
  ];
4522
4517
  };
4523
4518
 
4524
- // packages/ui/react-ui-editor/src/extensions/markdown/debug.ts
4519
+ // src/extensions/markdown/debug.ts
4525
4520
  import { syntaxTree as syntaxTree3 } from "@codemirror/language";
4526
4521
  import { StateField as StateField7 } from "@codemirror/state";
4527
4522
  var debugTree = (cb) => StateField7.define({
@@ -4548,14 +4543,14 @@ var convertTreeToJson = (state) => {
4548
4543
  return treeToJson(syntaxTree3(state).cursor());
4549
4544
  };
4550
4545
 
4551
- // packages/ui/react-ui-editor/src/extensions/markdown/decorate.ts
4546
+ // src/extensions/markdown/decorate.ts
4552
4547
  import { syntaxTree as syntaxTree7 } from "@codemirror/language";
4553
4548
  import { RangeSetBuilder as RangeSetBuilder6, StateEffect as StateEffect6 } from "@codemirror/state";
4554
4549
  import { EditorView as EditorView23, Decoration as Decoration11, WidgetType as WidgetType7, ViewPlugin as ViewPlugin13 } from "@codemirror/view";
4555
4550
  import { invariant as invariant4 } from "@dxos/invariant";
4556
4551
  import { mx as mx4 } from "@dxos/react-ui-theme";
4557
4552
 
4558
- // packages/ui/react-ui-editor/src/extensions/markdown/changes.ts
4553
+ // src/extensions/markdown/changes.ts
4559
4554
  import { syntaxTree as syntaxTree4 } from "@codemirror/language";
4560
4555
  import { Transaction as Transaction2 } from "@codemirror/state";
4561
4556
  import { ViewPlugin as ViewPlugin12 } from "@codemirror/view";
@@ -4699,7 +4694,7 @@ var getValidUrl = (str) => {
4699
4694
  }
4700
4695
  };
4701
4696
 
4702
- // packages/ui/react-ui-editor/src/extensions/markdown/image.ts
4697
+ // src/extensions/markdown/image.ts
4703
4698
  import { syntaxTree as syntaxTree5 } from "@codemirror/language";
4704
4699
  import { StateField as StateField8 } from "@codemirror/state";
4705
4700
  import { Decoration as Decoration9, EditorView as EditorView20, WidgetType as WidgetType5 } from "@codemirror/view";
@@ -4788,7 +4783,7 @@ var ImageWidget = class extends WidgetType5 {
4788
4783
  }
4789
4784
  };
4790
4785
 
4791
- // packages/ui/react-ui-editor/src/extensions/markdown/styles.ts
4786
+ // src/extensions/markdown/styles.ts
4792
4787
  import { EditorView as EditorView21 } from "@codemirror/view";
4793
4788
  var bulletListIndentationWidth = 24;
4794
4789
  var orderedListIndentationWidth = 36;
@@ -4911,7 +4906,7 @@ var formattingStyles = EditorView21.theme({
4911
4906
  }
4912
4907
  });
4913
4908
 
4914
- // packages/ui/react-ui-editor/src/extensions/markdown/table.ts
4909
+ // src/extensions/markdown/table.ts
4915
4910
  import { syntaxTree as syntaxTree6 } from "@codemirror/language";
4916
4911
  import { RangeSetBuilder as RangeSetBuilder5, StateField as StateField9 } from "@codemirror/state";
4917
4912
  import { Decoration as Decoration10, EditorView as EditorView22, WidgetType as WidgetType6 } from "@codemirror/view";
@@ -5009,8 +5004,8 @@ var TableWidget = class extends WidgetType6 {
5009
5004
  }
5010
5005
  };
5011
5006
 
5012
- // packages/ui/react-ui-editor/src/extensions/markdown/decorate.ts
5013
- var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/markdown/decorate.ts";
5007
+ // src/extensions/markdown/decorate.ts
5008
+ var __dxlog_file9 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/markdown/decorate.ts";
5014
5009
  var Unicode = {
5015
5010
  emDash: "\u2014",
5016
5011
  bullet: "\u2022",
@@ -5464,7 +5459,7 @@ var decorateMarkdown = (options = {}) => {
5464
5459
  ];
5465
5460
  };
5466
5461
 
5467
- // packages/ui/react-ui-editor/src/extensions/markdown/link.ts
5462
+ // src/extensions/markdown/link.ts
5468
5463
  import { syntaxTree as syntaxTree8 } from "@codemirror/language";
5469
5464
  import { hoverTooltip as hoverTooltip2 } from "@codemirror/view";
5470
5465
  import { tooltipContent } from "@dxos/react-ui-theme";
@@ -5506,10 +5501,10 @@ var linkTooltip = (renderTooltip) => {
5506
5501
  });
5507
5502
  };
5508
5503
 
5509
- // packages/ui/react-ui-editor/src/extensions/mention.ts
5504
+ // src/extensions/mention.ts
5510
5505
  import { autocompletion as autocompletion2 } from "@codemirror/autocomplete";
5511
5506
  import { log as log6 } from "@dxos/log";
5512
- var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/mention.ts";
5507
+ var __dxlog_file10 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/mention.ts";
5513
5508
  var mention = ({ debug, onSearch }) => {
5514
5509
  return autocompletion2({
5515
5510
  // TODO(burdon): Not working.
@@ -5544,23 +5539,10 @@ var mention = ({ debug, onSearch }) => {
5544
5539
  });
5545
5540
  };
5546
5541
 
5547
- // packages/ui/react-ui-editor/src/extensions/modes.ts
5542
+ // src/extensions/modes.ts
5548
5543
  import { keymap as keymap11 } from "@codemirror/view";
5549
5544
  import { vim } from "@replit/codemirror-vim";
5550
5545
  import { vscodeKeymap } from "@replit/codemirror-vscode-keymap";
5551
- import { Schema } from "effect";
5552
- var EditorViewModes = [
5553
- "preview",
5554
- "readonly",
5555
- "source"
5556
- ];
5557
- var EditorViewMode = Schema.Union(...EditorViewModes.map((mode) => Schema.Literal(mode)));
5558
- var EditorInputModes = [
5559
- "default",
5560
- "vim",
5561
- "vscode"
5562
- ];
5563
- var EditorInputMode = Schema.Union(...EditorInputModes.map((mode) => Schema.Literal(mode)));
5564
5546
  var editorInputMode = singleValueFacet({});
5565
5547
  var InputModeExtensions = {
5566
5548
  default: [],
@@ -5590,21 +5572,21 @@ var InputModeExtensions = {
5590
5572
  ]
5591
5573
  };
5592
5574
 
5593
- // packages/ui/react-ui-editor/src/extensions/outliner/commands.ts
5575
+ // src/extensions/outliner/commands.ts
5594
5576
  import { indentMore } from "@codemirror/commands";
5595
5577
  import { getIndentUnit } from "@codemirror/language";
5596
5578
  import { EditorSelection as EditorSelection3 } from "@codemirror/state";
5597
5579
  import { keymap as keymap12 } from "@codemirror/view";
5598
5580
 
5599
- // packages/ui/react-ui-editor/src/extensions/outliner/selection.ts
5581
+ // src/extensions/outliner/selection.ts
5600
5582
  import { Compartment, Facet as Facet3 } from "@codemirror/state";
5601
5583
 
5602
- // packages/ui/react-ui-editor/src/extensions/outliner/tree.ts
5584
+ // src/extensions/outliner/tree.ts
5603
5585
  import { syntaxTree as syntaxTree9 } from "@codemirror/language";
5604
5586
  import { StateField as StateField10 } from "@codemirror/state";
5605
5587
  import { Facet as Facet2 } from "@codemirror/state";
5606
5588
  import { invariant as invariant5 } from "@dxos/invariant";
5607
- var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/outliner/tree.ts";
5589
+ var __dxlog_file11 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/outliner/tree.ts";
5608
5590
  var itemToJSON = ({ type, index, level, lineRange, contentRange, children }) => {
5609
5591
  return {
5610
5592
  type,
@@ -5898,7 +5880,7 @@ var outlinerTree = (options = {}) => {
5898
5880
  ];
5899
5881
  };
5900
5882
 
5901
- // packages/ui/react-ui-editor/src/extensions/outliner/selection.ts
5883
+ // src/extensions/outliner/selection.ts
5902
5884
  var getSelection = (state) => state.selection.main;
5903
5885
  var selectionEquals = (a, b) => a.length === b.length && a.every((i) => b.includes(i));
5904
5886
  var selectionFacet = Facet3.define({
@@ -5928,7 +5910,7 @@ var selectDown = (view) => {
5928
5910
  return true;
5929
5911
  };
5930
5912
 
5931
- // packages/ui/react-ui-editor/src/extensions/outliner/commands.ts
5913
+ // src/extensions/outliner/commands.ts
5932
5914
  var indentItemMore = (view) => {
5933
5915
  const pos = getSelection(view.state).from;
5934
5916
  const tree = view.state.facet(treeFacet);
@@ -6162,16 +6144,16 @@ var commands = () => keymap12.of([
6162
6144
  }
6163
6145
  ]);
6164
6146
 
6165
- // packages/ui/react-ui-editor/src/extensions/outliner/outliner.ts
6147
+ // src/extensions/outliner/outliner.ts
6166
6148
  import { Prec as Prec4 } from "@codemirror/state";
6167
6149
  import { Decoration as Decoration12, EditorView as EditorView24, ViewPlugin as ViewPlugin15 } from "@codemirror/view";
6168
6150
  import { mx as mx5 } from "@dxos/react-ui-theme";
6169
6151
 
6170
- // packages/ui/react-ui-editor/src/extensions/outliner/editor.ts
6152
+ // src/extensions/outliner/editor.ts
6171
6153
  import { EditorSelection as EditorSelection4, EditorState as EditorState2 } from "@codemirror/state";
6172
6154
  import { ViewPlugin as ViewPlugin14 } from "@codemirror/view";
6173
6155
  import { log as log7 } from "@dxos/log";
6174
- var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/outliner/editor.ts";
6156
+ var __dxlog_file12 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/outliner/editor.ts";
6175
6157
  var LIST_ITEM_REGEX = /^\s*- (\[ \]|\[x\])? /;
6176
6158
  var initialize = () => {
6177
6159
  return ViewPlugin14.fromClass(class {
@@ -6356,7 +6338,7 @@ var editor = () => [
6356
6338
  })
6357
6339
  ];
6358
6340
 
6359
- // packages/ui/react-ui-editor/src/extensions/outliner/outliner.ts
6341
+ // src/extensions/outliner/outliner.ts
6360
6342
  var outliner = (options = {}) => [
6361
6343
  // Commands.
6362
6344
  Prec4.highest(commands()),
@@ -6448,7 +6430,7 @@ var decorations = () => [
6448
6430
  }))
6449
6431
  ];
6450
6432
 
6451
- // packages/ui/react-ui-editor/src/extensions/preview/preview.ts
6433
+ // src/extensions/preview/preview.ts
6452
6434
  import "@dxos/lit-ui/dx-ref-tag.pcss";
6453
6435
  import { syntaxTree as syntaxTree10 } from "@codemirror/language";
6454
6436
  import { RangeSetBuilder as RangeSetBuilder7, StateField as StateField11 } from "@codemirror/state";
@@ -6556,7 +6538,7 @@ var PreviewBlockWidget = class extends WidgetType8 {
6556
6538
  }
6557
6539
  };
6558
6540
 
6559
- // packages/ui/react-ui-editor/src/extensions/typewriter.ts
6541
+ // src/extensions/typewriter.ts
6560
6542
  import { keymap as keymap13 } from "@codemirror/view";
6561
6543
  var defaultItems = [
6562
6544
  "hello world!",
@@ -6613,77 +6595,284 @@ var typewriter = ({ delay = 75, items = defaultItems } = {}) => {
6613
6595
  ];
6614
6596
  };
6615
6597
 
6616
- // packages/ui/react-ui-editor/src/components/EditorToolbar/blocks.ts
6617
- var createBlockGroupAction = (value) => createEditorActionGroup("block", {
6618
- variant: "toggleGroup",
6619
- selectCardinality: "single",
6620
- value
6621
- });
6622
- var createBlockActions = (value, getView, blankLine) => Object.entries({
6623
- blockquote: "ph--quotes--regular",
6624
- codeblock: "ph--code-block--regular",
6625
- table: "ph--table--regular"
6626
- }).map(([type, icon]) => {
6627
- const checked = type === value;
6628
- return createEditorAction(type, () => {
6629
- const view = getView();
6630
- if (!view) {
6631
- return;
6632
- }
6633
- switch (type) {
6634
- case "blockquote":
6635
- checked ? removeBlockquote(view) : addBlockquote(view);
6636
- break;
6637
- case "codeblock":
6638
- checked ? removeCodeblock(view) : addCodeblock(view);
6639
- break;
6640
- case "table":
6641
- insertTable(view);
6642
- break;
6643
- }
6644
- }, {
6645
- checked,
6646
- ...type === "table" && {
6647
- disabled: !!blankLine
6648
- },
6649
- icon
6650
- });
6651
- });
6652
- var createBlocks = (state, getView) => {
6653
- const value = state?.blockQuote ? "blockquote" : state.blockType ?? "";
6654
- const blockGroupAction = createBlockGroupAction(value);
6655
- const blockActions = createBlockActions(value, getView, state.blankLine);
6656
- return {
6657
- nodes: [
6658
- blockGroupAction,
6659
- ...blockActions
6660
- ],
6661
- edges: [
6662
- {
6663
- source: "root",
6664
- target: "block"
6665
- },
6666
- ...blockActions.map(({ id }) => ({
6667
- source: blockGroupAction.id,
6668
- target: id
6669
- }))
6670
- ]
6671
- };
6672
- };
6673
-
6674
- // packages/ui/react-ui-editor/src/components/EditorToolbar/formatting.ts
6675
- var formats = {
6676
- strong: "ph--text-b--regular",
6677
- emphasis: "ph--text-italic--regular",
6678
- strikethrough: "ph--text-strikethrough--regular",
6679
- code: "ph--code--regular",
6680
- link: "ph--link--regular"
6681
- };
6682
- var createFormattingGroup = (formatting) => createEditorActionGroup("formatting", {
6683
- variant: "toggleGroup",
6684
- selectCardinality: "multiple",
6685
- value: Object.keys(formats).filter((key) => !!formatting[key])
6686
- });
6598
+ // src/hooks/useTextEditor.ts
6599
+ var __dxlog_file13 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/hooks/useTextEditor.ts";
6600
+ var instanceCount = 0;
6601
+ var useTextEditor = (props = {}, deps = []) => {
6602
+ const { id, doc, initialValue, extensions, autoFocus, scrollTo, selection, moveToEndOfLine, debug } = useMemo3(() => getProviderValue(props), deps ?? []);
6603
+ const [instanceId] = useState2(() => `text-editor-${++instanceCount}`);
6604
+ const [view, setView] = useState2();
6605
+ const parentRef = useRef2(null);
6606
+ useEffect2(() => {
6607
+ let view2;
6608
+ if (parentRef.current) {
6609
+ log8("create", {
6610
+ id,
6611
+ instanceId,
6612
+ doc: initialValue?.length ?? 0
6613
+ }, {
6614
+ F: __dxlog_file13,
6615
+ L: 75,
6616
+ S: void 0,
6617
+ C: (f, a) => f(...a)
6618
+ });
6619
+ let initialSelection;
6620
+ if (selection?.anchor && initialValue?.length) {
6621
+ if (selection.anchor <= initialValue.length && (selection?.head ?? 0) <= initialValue.length) {
6622
+ initialSelection = selection;
6623
+ }
6624
+ } else if (moveToEndOfLine && selection === void 0) {
6625
+ const index = initialValue?.indexOf("\n");
6626
+ const anchor = !index || index === -1 ? 0 : index;
6627
+ initialSelection = {
6628
+ anchor
6629
+ };
6630
+ }
6631
+ const state = EditorState3.create({
6632
+ doc: doc ?? initialValue,
6633
+ // selection: initialSelection,
6634
+ extensions: [
6635
+ id && documentId.of(id),
6636
+ extensions,
6637
+ // NOTE: This doesn't catch errors in keymap functions.
6638
+ EditorView26.exceptionSink.of((err) => {
6639
+ log8.catch(err, void 0, {
6640
+ F: __dxlog_file13,
6641
+ L: 97,
6642
+ S: void 0,
6643
+ C: (f, a) => f(...a)
6644
+ });
6645
+ })
6646
+ ].filter(isNotFalsy4)
6647
+ });
6648
+ view2 = new EditorView26({
6649
+ parent: parentRef.current,
6650
+ state,
6651
+ scrollTo: scrollTo ? EditorView26.scrollIntoView(scrollTo, {
6652
+ yMargin: 96
6653
+ }) : void 0,
6654
+ dispatchTransactions: debug ? debugDispatcher : void 0
6655
+ });
6656
+ if (moveToEndOfLine && !initialSelection) {
6657
+ const { to } = view2.state.doc.lineAt(0);
6658
+ if (to) {
6659
+ view2.dispatch({
6660
+ selection: {
6661
+ anchor: to
6662
+ }
6663
+ });
6664
+ }
6665
+ }
6666
+ setView(view2);
6667
+ }
6668
+ return () => {
6669
+ log8("destroy", {
6670
+ id
6671
+ }, {
6672
+ F: __dxlog_file13,
6673
+ L: 134,
6674
+ S: void 0,
6675
+ C: (f, a) => f(...a)
6676
+ });
6677
+ view2?.destroy();
6678
+ };
6679
+ }, deps);
6680
+ useEffect2(() => {
6681
+ if (view) {
6682
+ if (scrollTo || selection) {
6683
+ if (selection && selection.anchor > view.state.doc.length) {
6684
+ log8.warn("invalid selection", {
6685
+ length: view.state.doc.length,
6686
+ scrollTo,
6687
+ selection
6688
+ }, {
6689
+ F: __dxlog_file13,
6690
+ L: 143,
6691
+ S: void 0,
6692
+ C: (f, a) => f(...a)
6693
+ });
6694
+ return;
6695
+ }
6696
+ view.dispatch(createEditorStateTransaction({
6697
+ scrollTo,
6698
+ selection
6699
+ }));
6700
+ }
6701
+ }
6702
+ }, [
6703
+ view,
6704
+ scrollTo,
6705
+ selection
6706
+ ]);
6707
+ useEffect2(() => {
6708
+ if (view && autoFocus) {
6709
+ view.focus();
6710
+ }
6711
+ }, [
6712
+ autoFocus,
6713
+ view
6714
+ ]);
6715
+ const focusableGroupAttrs = useFocusableGroup({
6716
+ tabBehavior: "limited",
6717
+ ignoreDefaultKeydown: {
6718
+ Escape: view?.state.facet(editorInputMode).noTabster
6719
+ }
6720
+ });
6721
+ const handleKeyUp = useCallback3((event) => {
6722
+ const { key, target, currentTarget } = event;
6723
+ if (target === currentTarget) {
6724
+ switch (key) {
6725
+ case "Enter": {
6726
+ view?.focus();
6727
+ break;
6728
+ }
6729
+ }
6730
+ }
6731
+ }, [
6732
+ view
6733
+ ]);
6734
+ return {
6735
+ parentRef,
6736
+ view,
6737
+ focusAttributes: {
6738
+ tabIndex: 0,
6739
+ ...focusableGroupAttrs,
6740
+ onKeyUp: handleKeyUp
6741
+ }
6742
+ };
6743
+ };
6744
+
6745
+ // src/components/Editor/Editor.tsx
6746
+ var Editor = /* @__PURE__ */ forwardRef(({ classNames, id, text, ...props }, forwardedRef) => {
6747
+ var _effect = _useSignals();
6748
+ try {
6749
+ const { themeMode } = useThemeContext();
6750
+ const { parentRef, focusAttributes, view } = useTextEditor(() => ({
6751
+ id,
6752
+ initialValue: text.content,
6753
+ ...props
6754
+ }), [
6755
+ id,
6756
+ text,
6757
+ themeMode
6758
+ ]);
6759
+ useImperativeHandle(forwardedRef, () => view, [
6760
+ view
6761
+ ]);
6762
+ return /* @__PURE__ */ React3.createElement("div", {
6763
+ ref: parentRef,
6764
+ className: mx6(classNames),
6765
+ ...focusAttributes
6766
+ });
6767
+ } finally {
6768
+ _effect.f();
6769
+ }
6770
+ });
6771
+
6772
+ // src/components/EditorToolbar/EditorToolbar.tsx
6773
+ import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
6774
+ import { Rx } from "@effect-rx/rx-react";
6775
+ import React4, { memo, useMemo as useMemo5 } from "react";
6776
+ import { rxFromSignal } from "@dxos/app-graph";
6777
+ import { ElevationProvider } from "@dxos/react-ui";
6778
+ import { MenuProvider, ToolbarMenu, createGapSeparator, useMenuActions } from "@dxos/react-ui-menu";
6779
+
6780
+ // src/components/EditorToolbar/util.ts
6781
+ import { useMemo as useMemo4 } from "react";
6782
+ import { live } from "@dxos/live-object";
6783
+ import { createMenuAction, createMenuItemGroup } from "@dxos/react-ui-menu";
6784
+ var useEditorToolbarState = (initialState = {}) => {
6785
+ return useMemo4(() => live(initialState), []);
6786
+ };
6787
+ var createEditorAction = (id, invoke, properties) => {
6788
+ const { label = [
6789
+ `${id} label`,
6790
+ {
6791
+ ns: translationKey
6792
+ }
6793
+ ], ...rest } = properties;
6794
+ return createMenuAction(id, invoke, {
6795
+ label,
6796
+ ...rest
6797
+ });
6798
+ };
6799
+ var createEditorActionGroup = (id, props, icon) => createMenuItemGroup(id, {
6800
+ icon,
6801
+ iconOnly: true,
6802
+ ...props
6803
+ });
6804
+
6805
+ // src/components/EditorToolbar/blocks.ts
6806
+ var createBlockGroupAction = (value) => createEditorActionGroup("block", {
6807
+ variant: "toggleGroup",
6808
+ selectCardinality: "single",
6809
+ value
6810
+ });
6811
+ var createBlockActions = (value, getView, blankLine) => Object.entries({
6812
+ blockquote: "ph--quotes--regular",
6813
+ codeblock: "ph--code-block--regular",
6814
+ table: "ph--table--regular"
6815
+ }).map(([type, icon]) => {
6816
+ const checked = type === value;
6817
+ return createEditorAction(type, () => {
6818
+ const view = getView();
6819
+ if (!view) {
6820
+ return;
6821
+ }
6822
+ switch (type) {
6823
+ case "blockquote":
6824
+ checked ? removeBlockquote(view) : addBlockquote(view);
6825
+ break;
6826
+ case "codeblock":
6827
+ checked ? removeCodeblock(view) : addCodeblock(view);
6828
+ break;
6829
+ case "table":
6830
+ insertTable(view);
6831
+ break;
6832
+ }
6833
+ }, {
6834
+ checked,
6835
+ ...type === "table" && {
6836
+ disabled: !!blankLine
6837
+ },
6838
+ icon
6839
+ });
6840
+ });
6841
+ var createBlocks = (state, getView) => {
6842
+ const value = state?.blockQuote ? "blockquote" : state.blockType ?? "";
6843
+ const blockGroupAction = createBlockGroupAction(value);
6844
+ const blockActions = createBlockActions(value, getView, state.blankLine);
6845
+ return {
6846
+ nodes: [
6847
+ blockGroupAction,
6848
+ ...blockActions
6849
+ ],
6850
+ edges: [
6851
+ {
6852
+ source: "root",
6853
+ target: "block"
6854
+ },
6855
+ ...blockActions.map(({ id }) => ({
6856
+ source: blockGroupAction.id,
6857
+ target: id
6858
+ }))
6859
+ ]
6860
+ };
6861
+ };
6862
+
6863
+ // src/components/EditorToolbar/formatting.ts
6864
+ var formats = {
6865
+ strong: "ph--text-b--regular",
6866
+ emphasis: "ph--text-italic--regular",
6867
+ strikethrough: "ph--text-strikethrough--regular",
6868
+ code: "ph--code--regular",
6869
+ link: "ph--link--regular"
6870
+ };
6871
+ var createFormattingGroup = (formatting) => createEditorActionGroup("formatting", {
6872
+ variant: "toggleGroup",
6873
+ selectCardinality: "multiple",
6874
+ value: Object.keys(formats).filter((key) => !!formatting[key])
6875
+ });
6687
6876
  var createFormattingActions = (formatting, getView) => Object.entries(formats).map(([type, icon]) => {
6688
6877
  const checked = !!formatting[type];
6689
6878
  return createEditorAction(type, () => {
@@ -6723,7 +6912,7 @@ var createFormatting = (state, getView) => {
6723
6912
  };
6724
6913
  };
6725
6914
 
6726
- // packages/ui/react-ui-editor/src/components/EditorToolbar/headings.ts
6915
+ // src/components/EditorToolbar/headings.ts
6727
6916
  var createHeadingGroupAction = (value) => createEditorActionGroup("heading", {
6728
6917
  variant: "dropdownMenu",
6729
6918
  applyActive: true,
@@ -6778,7 +6967,7 @@ var createHeadings = (state, getView) => {
6778
6967
  };
6779
6968
  };
6780
6969
 
6781
- // packages/ui/react-ui-editor/src/components/EditorToolbar/image.ts
6970
+ // src/components/EditorToolbar/image.ts
6782
6971
  var createImageUploadAction = (onImageUpload) => createEditorAction("image", onImageUpload, {
6783
6972
  testId: "editor.toolbar.image",
6784
6973
  icon: "ph--image-square--regular"
@@ -6795,7 +6984,7 @@ var createImageUpload = (onImageUpload) => ({
6795
6984
  ]
6796
6985
  });
6797
6986
 
6798
- // packages/ui/react-ui-editor/src/components/EditorToolbar/lists.ts
6987
+ // src/components/EditorToolbar/lists.ts
6799
6988
  var listStyles = {
6800
6989
  bullet: "ph--list-bullets--regular",
6801
6990
  ordered: "ph--list-numbers--regular",
@@ -6846,7 +7035,7 @@ var createLists = (state, getView) => {
6846
7035
  };
6847
7036
  };
6848
7037
 
6849
- // packages/ui/react-ui-editor/src/components/EditorToolbar/search.ts
7038
+ // src/components/EditorToolbar/search.ts
6850
7039
  import { openSearchPanel } from "@codemirror/search";
6851
7040
  var createSearchAction = (getView) => createEditorAction("search", () => openSearchPanel(getView()), {
6852
7041
  testId: "editor.toolbar.search",
@@ -6864,7 +7053,7 @@ var createSearch = (getView) => ({
6864
7053
  ]
6865
7054
  });
6866
7055
 
6867
- // packages/ui/react-ui-editor/src/components/EditorToolbar/view-mode.ts
7056
+ // src/components/EditorToolbar/view-mode.ts
6868
7057
  var createViewModeGroupAction = (value) => createEditorActionGroup("viewMode", {
6869
7058
  variant: "dropdownMenu",
6870
7059
  applyActive: true,
@@ -6910,7 +7099,7 @@ var createViewMode = (state, onViewModeChange) => {
6910
7099
  };
6911
7100
  };
6912
7101
 
6913
- // packages/ui/react-ui-editor/src/components/EditorToolbar/EditorToolbar.tsx
7102
+ // src/components/EditorToolbar/EditorToolbar.tsx
6914
7103
  var createToolbar = ({ getView, state, customActions, ...features }) => {
6915
7104
  return Rx.make((get2) => {
6916
7105
  const nodes = [];
@@ -6965,7 +7154,7 @@ var createToolbar = ({ getView, state, customActions, ...features }) => {
6965
7154
  });
6966
7155
  };
6967
7156
  var useEditorToolbarActionGraph = (props) => {
6968
- const menuCreator = useMemo4(() => createToolbar({
7157
+ const menuCreator = useMemo5(() => createToolbar({
6969
7158
  getView: props.getView,
6970
7159
  state: props.state,
6971
7160
  customActions: props.customActions,
@@ -6991,15 +7180,15 @@ var useEditorToolbarActionGraph = (props) => {
6991
7180
  return useMenuActions(menuCreator);
6992
7181
  };
6993
7182
  var EditorToolbar = /* @__PURE__ */ memo(({ classNames, attendableId, role, ...props }) => {
6994
- var _effect = _useSignals();
7183
+ var _effect = _useSignals2();
6995
7184
  try {
6996
7185
  const menuProps = useEditorToolbarActionGraph(props);
6997
- return /* @__PURE__ */ React3.createElement(ElevationProvider, {
7186
+ return /* @__PURE__ */ React4.createElement(ElevationProvider, {
6998
7187
  elevation: role === "section" ? "positioned" : "base"
6999
- }, /* @__PURE__ */ React3.createElement(MenuProvider, {
7188
+ }, /* @__PURE__ */ React4.createElement(MenuProvider, {
7000
7189
  ...menuProps,
7001
7190
  attendableId
7002
- }, /* @__PURE__ */ React3.createElement(ToolbarMenu, {
7191
+ }, /* @__PURE__ */ React4.createElement(ToolbarMenu, {
7003
7192
  classNames,
7004
7193
  textBlockWidth: true
7005
7194
  })));
@@ -7008,16 +7197,16 @@ var EditorToolbar = /* @__PURE__ */ memo(({ classNames, attendableId, role, ...p
7008
7197
  }
7009
7198
  });
7010
7199
 
7011
- // packages/ui/react-ui-editor/src/components/Popover/CommandMenu.tsx
7012
- import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
7013
- import React4, { useCallback as useCallback2, useEffect as useEffect2, useRef as useRef2 } from "react";
7014
- import { Icon as Icon2, Popover, toLocalizedString, useThemeContext, useTranslation } from "@dxos/react-ui";
7200
+ // src/components/Popover/CommandMenu.tsx
7201
+ import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
7202
+ import React5, { useCallback as useCallback4, useEffect as useEffect3, useRef as useRef3 } from "react";
7203
+ import { Icon as Icon2, Popover, toLocalizedString, useThemeContext as useThemeContext2, useTranslation } from "@dxos/react-ui";
7015
7204
  var CommandMenu = ({ groups, currentItem, onSelect }) => {
7016
- var _effect = _useSignals2();
7205
+ var _effect = _useSignals3();
7017
7206
  try {
7018
- const { tx } = useThemeContext();
7207
+ const { tx } = useThemeContext2();
7019
7208
  const groupsWithItems = groups.filter((group) => group.items.length > 0);
7020
- return /* @__PURE__ */ React4.createElement(Popover.Portal, null, /* @__PURE__ */ React4.createElement(Popover.Content, {
7209
+ return /* @__PURE__ */ React5.createElement(Popover.Portal, null, /* @__PURE__ */ React5.createElement(Popover.Content, {
7021
7210
  align: "start",
7022
7211
  onOpenAutoFocus: (event) => event.preventDefault(),
7023
7212
  classNames: tx("menu.content", "menu--exotic-unfocusable", {
@@ -7025,15 +7214,15 @@ var CommandMenu = ({ groups, currentItem, onSelect }) => {
7025
7214
  }, [
7026
7215
  "max-h-[300px] overflow-y-auto"
7027
7216
  ])
7028
- }, /* @__PURE__ */ React4.createElement(Popover.Viewport, {
7217
+ }, /* @__PURE__ */ React5.createElement(Popover.Viewport, {
7029
7218
  classNames: tx("menu.viewport", "menu__viewport--exotic-unfocusable", {})
7030
- }, /* @__PURE__ */ React4.createElement("ul", null, groupsWithItems.map((group, index) => /* @__PURE__ */ React4.createElement(React4.Fragment, {
7219
+ }, /* @__PURE__ */ React5.createElement("ul", null, groupsWithItems.map((group, index) => /* @__PURE__ */ React5.createElement(React5.Fragment, {
7031
7220
  key: group.id
7032
- }, /* @__PURE__ */ React4.createElement(CommandGroup, {
7221
+ }, /* @__PURE__ */ React5.createElement(CommandGroup, {
7033
7222
  group,
7034
7223
  currentItem,
7035
7224
  onSelect
7036
- }), index < groupsWithItems.length - 1 && /* @__PURE__ */ React4.createElement("div", {
7225
+ }), index < groupsWithItems.length - 1 && /* @__PURE__ */ React5.createElement("div", {
7037
7226
  className: tx("menu.separator", "menu__item", {})
7038
7227
  })))))));
7039
7228
  } finally {
@@ -7041,13 +7230,13 @@ var CommandMenu = ({ groups, currentItem, onSelect }) => {
7041
7230
  }
7042
7231
  };
7043
7232
  var CommandGroup = ({ group, currentItem, onSelect }) => {
7044
- var _effect = _useSignals2();
7233
+ var _effect = _useSignals3();
7045
7234
  try {
7046
- const { tx } = useThemeContext();
7235
+ const { tx } = useThemeContext2();
7047
7236
  const { t } = useTranslation();
7048
- return /* @__PURE__ */ React4.createElement(React4.Fragment, null, group.label && /* @__PURE__ */ React4.createElement("div", {
7237
+ return /* @__PURE__ */ React5.createElement(React5.Fragment, null, group.label && /* @__PURE__ */ React5.createElement("div", {
7049
7238
  className: tx("menu.groupLabel", "menu__group__label", {})
7050
- }, /* @__PURE__ */ React4.createElement("span", null, toLocalizedString(group.label, t))), group.items.map((item) => /* @__PURE__ */ React4.createElement(CommandItem, {
7239
+ }, /* @__PURE__ */ React5.createElement("span", null, toLocalizedString(group.label, t))), group.items.map((item) => /* @__PURE__ */ React5.createElement(CommandItem, {
7051
7240
  key: item.id,
7052
7241
  item,
7053
7242
  current: currentItem === item.id,
@@ -7058,16 +7247,16 @@ var CommandGroup = ({ group, currentItem, onSelect }) => {
7058
7247
  }
7059
7248
  };
7060
7249
  var CommandItem = ({ item, current, onSelect }) => {
7061
- var _effect = _useSignals2();
7250
+ var _effect = _useSignals3();
7062
7251
  try {
7063
- const ref = useRef2(null);
7064
- const { tx } = useThemeContext();
7252
+ const ref = useRef3(null);
7253
+ const { tx } = useThemeContext2();
7065
7254
  const { t } = useTranslation();
7066
- const handleSelect = useCallback2(() => onSelect(item), [
7255
+ const handleSelect = useCallback4(() => onSelect(item), [
7067
7256
  item,
7068
7257
  onSelect
7069
7258
  ]);
7070
- useEffect2(() => {
7259
+ useEffect3(() => {
7071
7260
  if (current && ref.current) {
7072
7261
  ref.current.scrollIntoView({
7073
7262
  behavior: "smooth",
@@ -7077,16 +7266,16 @@ var CommandItem = ({ item, current, onSelect }) => {
7077
7266
  }, [
7078
7267
  current
7079
7268
  ]);
7080
- return /* @__PURE__ */ React4.createElement("li", {
7269
+ return /* @__PURE__ */ React5.createElement("li", {
7081
7270
  ref,
7082
7271
  className: tx("menu.item", "menu__item--exotic-unfocusable", {}, [
7083
7272
  current && "bg-hoverSurface"
7084
7273
  ]),
7085
7274
  onClick: handleSelect
7086
- }, item.icon && /* @__PURE__ */ React4.createElement(Icon2, {
7275
+ }, item.icon && /* @__PURE__ */ React5.createElement(Icon2, {
7087
7276
  icon: item.icon,
7088
7277
  size: 5
7089
- }), /* @__PURE__ */ React4.createElement("span", {
7278
+ }), /* @__PURE__ */ React5.createElement("span", {
7090
7279
  className: "grow truncate"
7091
7280
  }, toLocalizedString(item.label, t)));
7092
7281
  } finally {
@@ -7273,21 +7462,21 @@ var linkSlashCommands = {
7273
7462
  ]
7274
7463
  };
7275
7464
 
7276
- // packages/ui/react-ui-editor/src/components/Popover/RefPopover.tsx
7277
- import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
7465
+ // src/components/Popover/RefPopover.tsx
7466
+ import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
7278
7467
  import { createContext } from "@radix-ui/react-context";
7279
- import React5, { useRef as useRef3, useState as useState2, useEffect as useEffect3, useCallback as useCallback3, forwardRef } from "react";
7468
+ import React6, { useRef as useRef4, useState as useState3, useEffect as useEffect4, useCallback as useCallback5, forwardRef as forwardRef2 } from "react";
7280
7469
  import { addEventListener as addEventListener2 } from "@dxos/async";
7281
7470
  import { Popover as Popover2 } from "@dxos/react-ui";
7282
7471
  var customEventOptions = {
7283
7472
  capture: true,
7284
7473
  passive: false
7285
7474
  };
7286
- var RefPopover = /* @__PURE__ */ forwardRef(({ children, open, onOpenChange, modal, onActivate }, ref) => {
7287
- var _effect = _useSignals3();
7475
+ var RefPopover = /* @__PURE__ */ forwardRef2(({ children, open, onOpenChange, modal, onActivate }, ref) => {
7476
+ var _effect = _useSignals4();
7288
7477
  try {
7289
- const [rootRef, setRootRef] = useState2(null);
7290
- useEffect3(() => {
7478
+ const [rootRef, setRootRef] = useState3(null);
7479
+ useEffect4(() => {
7291
7480
  if (!rootRef || !onActivate) {
7292
7481
  return;
7293
7482
  }
@@ -7296,13 +7485,13 @@ var RefPopover = /* @__PURE__ */ forwardRef(({ children, open, onOpenChange, mod
7296
7485
  rootRef,
7297
7486
  onActivate
7298
7487
  ]);
7299
- return /* @__PURE__ */ React5.createElement(Popover2.Root, {
7488
+ return /* @__PURE__ */ React6.createElement(Popover2.Root, {
7300
7489
  open,
7301
7490
  onOpenChange,
7302
7491
  modal
7303
- }, /* @__PURE__ */ React5.createElement(Popover2.VirtualTrigger, {
7492
+ }, /* @__PURE__ */ React6.createElement(Popover2.VirtualTrigger, {
7304
7493
  virtualRef: ref
7305
- }), /* @__PURE__ */ React5.createElement("div", {
7494
+ }), /* @__PURE__ */ React6.createElement("div", {
7306
7495
  role: "none",
7307
7496
  className: "contents",
7308
7497
  ref: setRootRef
@@ -7314,12 +7503,12 @@ var RefPopover = /* @__PURE__ */ forwardRef(({ children, open, onOpenChange, mod
7314
7503
  var REF_POPOVER = "RefPopover";
7315
7504
  var [RefPopoverContextProvider, useRefPopover] = createContext(REF_POPOVER, {});
7316
7505
  var PreviewProvider = ({ children, onLookup }) => {
7317
- var _effect = _useSignals3();
7506
+ var _effect = _useSignals4();
7318
7507
  try {
7319
- const trigger = useRef3(null);
7320
- const [value, setValue] = useState2({});
7321
- const [open, setOpen] = useState2(false);
7322
- const handleDxRefTagActivate = useCallback3((event) => {
7508
+ const trigger = useRef4(null);
7509
+ const [value, setValue] = useState3({});
7510
+ const [open, setOpen] = useState3(false);
7511
+ const handleDxRefTagActivate = useCallback5((event) => {
7323
7512
  const { refId, label, trigger: dxTrigger } = event;
7324
7513
  setValue((value2) => ({
7325
7514
  ...value2,
@@ -7342,11 +7531,11 @@ var PreviewProvider = ({ children, onLookup }) => {
7342
7531
  }, [
7343
7532
  onLookup
7344
7533
  ]);
7345
- return /* @__PURE__ */ React5.createElement(RefPopoverContextProvider, {
7534
+ return /* @__PURE__ */ React6.createElement(RefPopoverContextProvider, {
7346
7535
  pending: value.pending,
7347
7536
  link: value.link,
7348
7537
  target: value.target
7349
- }, /* @__PURE__ */ React5.createElement(RefPopover, {
7538
+ }, /* @__PURE__ */ React6.createElement(RefPopover, {
7350
7539
  ref: trigger,
7351
7540
  open,
7352
7541
  onOpenChange: setOpen,
@@ -7357,10 +7546,10 @@ var PreviewProvider = ({ children, onLookup }) => {
7357
7546
  }
7358
7547
  };
7359
7548
 
7360
- // packages/ui/react-ui-editor/src/components/Popover/RefDropdownMenu.tsx
7361
- import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
7549
+ // src/components/Popover/RefDropdownMenu.tsx
7550
+ import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
7362
7551
  import { createContext as createContext2 } from "@radix-ui/react-context";
7363
- import React6, { useRef as useRef4, useState as useState3, useEffect as useEffect4, useCallback as useCallback4 } from "react";
7552
+ import React7, { useRef as useRef5, useState as useState4, useEffect as useEffect5, useCallback as useCallback6 } from "react";
7364
7553
  import { addEventListener as addEventListener3 } from "@dxos/async";
7365
7554
  import { DropdownMenu } from "@dxos/react-ui";
7366
7555
  var customEventOptions2 = {
@@ -7370,13 +7559,13 @@ var customEventOptions2 = {
7370
7559
  var REF_DROPDOWN_MENU = "RefDropdownMenu";
7371
7560
  var [RefDropdownMenuContextProvider, useRefDropdownMenu] = createContext2(REF_DROPDOWN_MENU, {});
7372
7561
  var RefDropdownMenuProvider = ({ children, onLookup }) => {
7373
- var _effect = _useSignals4();
7562
+ var _effect = _useSignals5();
7374
7563
  try {
7375
- const trigger = useRef4(null);
7376
- const [value, setValue] = useState3({});
7377
- const [rootRef, setRootRef] = useState3(null);
7378
- const [open, setOpen] = useState3(false);
7379
- const handleDxRefTagActivate = useCallback4((event) => {
7564
+ const trigger = useRef5(null);
7565
+ const [value, setValue] = useState4({});
7566
+ const [rootRef, setRootRef] = useState4(null);
7567
+ const [open, setOpen] = useState4(false);
7568
+ const handleDxRefTagActivate = useCallback6((event) => {
7380
7569
  const { refId, label, trigger: dxTrigger } = event;
7381
7570
  setValue((value2) => ({
7382
7571
  ...value2,
@@ -7399,7 +7588,7 @@ var RefDropdownMenuProvider = ({ children, onLookup }) => {
7399
7588
  }, [
7400
7589
  onLookup
7401
7590
  ]);
7402
- useEffect4(() => {
7591
+ useEffect5(() => {
7403
7592
  if (!rootRef) {
7404
7593
  return;
7405
7594
  }
@@ -7407,16 +7596,16 @@ var RefDropdownMenuProvider = ({ children, onLookup }) => {
7407
7596
  }, [
7408
7597
  rootRef
7409
7598
  ]);
7410
- return /* @__PURE__ */ React6.createElement(RefDropdownMenuContextProvider, {
7599
+ return /* @__PURE__ */ React7.createElement(RefDropdownMenuContextProvider, {
7411
7600
  pending: value.pending,
7412
7601
  link: value.link,
7413
7602
  target: value.target
7414
- }, /* @__PURE__ */ React6.createElement(DropdownMenu.Root, {
7603
+ }, /* @__PURE__ */ React7.createElement(DropdownMenu.Root, {
7415
7604
  open,
7416
7605
  onOpenChange: setOpen
7417
- }, /* @__PURE__ */ React6.createElement(DropdownMenu.VirtualTrigger, {
7606
+ }, /* @__PURE__ */ React7.createElement(DropdownMenu.VirtualTrigger, {
7418
7607
  virtualRef: trigger
7419
- }), /* @__PURE__ */ React6.createElement("div", {
7608
+ }), /* @__PURE__ */ React7.createElement("div", {
7420
7609
  role: "none",
7421
7610
  className: "contents",
7422
7611
  ref: setRootRef
@@ -7428,162 +7617,10 @@ var RefDropdownMenuProvider = ({ children, onLookup }) => {
7428
7617
  var RefDropdownMenu = {
7429
7618
  Provider: RefDropdownMenuProvider
7430
7619
  };
7431
-
7432
- // packages/ui/react-ui-editor/src/hooks/useTextEditor.ts
7433
- import { EditorState as EditorState3 } from "@codemirror/state";
7434
- import { EditorView as EditorView26 } from "@codemirror/view";
7435
- import { useFocusableGroup } from "@fluentui/react-tabster";
7436
- import { useCallback as useCallback5, useEffect as useEffect5, useMemo as useMemo5, useRef as useRef5, useState as useState4 } from "react";
7437
- import { log as log8 } from "@dxos/log";
7438
- import { getProviderValue, isNotFalsy as isNotFalsy4 } from "@dxos/util";
7439
- var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/hooks/useTextEditor.ts";
7440
- var instanceCount = 0;
7441
- var useTextEditor = (props = {}, deps = []) => {
7442
- const { id, doc, initialValue, extensions, autoFocus, scrollTo, selection, moveToEndOfLine, debug } = useMemo5(() => getProviderValue(props), deps ?? []);
7443
- const [instanceId] = useState4(() => `text-editor-${++instanceCount}`);
7444
- const [view, setView] = useState4();
7445
- const parentRef = useRef5(null);
7446
- useEffect5(() => {
7447
- let view2;
7448
- if (parentRef.current) {
7449
- log8("create", {
7450
- id,
7451
- instanceId,
7452
- doc: initialValue?.length ?? 0
7453
- }, {
7454
- F: __dxlog_file13,
7455
- L: 75,
7456
- S: void 0,
7457
- C: (f, a) => f(...a)
7458
- });
7459
- let initialSelection;
7460
- if (selection?.anchor && initialValue?.length) {
7461
- if (selection.anchor <= initialValue.length && (selection?.head ?? 0) <= initialValue.length) {
7462
- initialSelection = selection;
7463
- }
7464
- } else if (moveToEndOfLine && selection === void 0) {
7465
- const index = initialValue?.indexOf("\n");
7466
- const anchor = !index || index === -1 ? 0 : index;
7467
- initialSelection = {
7468
- anchor
7469
- };
7470
- }
7471
- const state = EditorState3.create({
7472
- doc: doc ?? initialValue,
7473
- // selection: initialSelection,
7474
- extensions: [
7475
- id && documentId.of(id),
7476
- extensions,
7477
- // NOTE: This doesn't catch errors in keymap functions.
7478
- EditorView26.exceptionSink.of((err) => {
7479
- log8.catch(err, void 0, {
7480
- F: __dxlog_file13,
7481
- L: 97,
7482
- S: void 0,
7483
- C: (f, a) => f(...a)
7484
- });
7485
- })
7486
- ].filter(isNotFalsy4)
7487
- });
7488
- view2 = new EditorView26({
7489
- parent: parentRef.current,
7490
- state,
7491
- scrollTo: scrollTo ? EditorView26.scrollIntoView(scrollTo, {
7492
- yMargin: 96
7493
- }) : void 0,
7494
- dispatchTransactions: debug ? debugDispatcher : void 0
7495
- });
7496
- if (moveToEndOfLine && !initialSelection) {
7497
- const { to } = view2.state.doc.lineAt(0);
7498
- if (to) {
7499
- view2.dispatch({
7500
- selection: {
7501
- anchor: to
7502
- }
7503
- });
7504
- }
7505
- }
7506
- setView(view2);
7507
- }
7508
- return () => {
7509
- log8("destroy", {
7510
- id
7511
- }, {
7512
- F: __dxlog_file13,
7513
- L: 134,
7514
- S: void 0,
7515
- C: (f, a) => f(...a)
7516
- });
7517
- view2?.destroy();
7518
- };
7519
- }, deps);
7520
- useEffect5(() => {
7521
- if (view) {
7522
- if (scrollTo || selection) {
7523
- if (selection && selection.anchor > view.state.doc.length) {
7524
- log8.warn("invalid selection", {
7525
- length: view.state.doc.length,
7526
- scrollTo,
7527
- selection
7528
- }, {
7529
- F: __dxlog_file13,
7530
- L: 143,
7531
- S: void 0,
7532
- C: (f, a) => f(...a)
7533
- });
7534
- return;
7535
- }
7536
- view.dispatch(createEditorStateTransaction({
7537
- scrollTo,
7538
- selection
7539
- }));
7540
- }
7541
- }
7542
- }, [
7543
- view,
7544
- scrollTo,
7545
- selection
7546
- ]);
7547
- useEffect5(() => {
7548
- if (view && autoFocus) {
7549
- view.focus();
7550
- }
7551
- }, [
7552
- autoFocus,
7553
- view
7554
- ]);
7555
- const focusableGroupAttrs = useFocusableGroup({
7556
- tabBehavior: "limited",
7557
- ignoreDefaultKeydown: {
7558
- Escape: view?.state.facet(editorInputMode).noTabster
7559
- }
7560
- });
7561
- const handleKeyUp = useCallback5((event) => {
7562
- const { key, target, currentTarget } = event;
7563
- if (target === currentTarget) {
7564
- switch (key) {
7565
- case "Enter": {
7566
- view?.focus();
7567
- break;
7568
- }
7569
- }
7570
- }
7571
- }, [
7572
- view
7573
- ]);
7574
- return {
7575
- parentRef,
7576
- view,
7577
- focusAttributes: {
7578
- tabIndex: 0,
7579
- ...focusableGroupAttrs,
7580
- onKeyUp: handleKeyUp
7581
- }
7582
- };
7583
- };
7584
7620
  export {
7585
7621
  CommandMenu,
7586
7622
  Cursor,
7623
+ Editor,
7587
7624
  EditorInputMode,
7588
7625
  EditorInputModes,
7589
7626
  EditorState4 as EditorState,
@@ -7644,6 +7681,7 @@ export {
7644
7681
  debugTree,
7645
7682
  decorateMarkdown,
7646
7683
  defaultOptions,
7684
+ defaultThemeSlots,
7647
7685
  deleteItem,
7648
7686
  documentId,
7649
7687
  dropFile,
@@ -7661,6 +7699,7 @@ export {
7661
7699
  folding,
7662
7700
  formattingEquals,
7663
7701
  formattingKeymap,
7702
+ fullWidth,
7664
7703
  getFormatting,
7665
7704
  getItem,
7666
7705
  getLinkRef,
@@ -7668,6 +7707,7 @@ export {
7668
7707
  getNextItem,
7669
7708
  getPreviousItem,
7670
7709
  getRange,
7710
+ grow,
7671
7711
  hashtag,
7672
7712
  image,
7673
7713
  indentItemLess,
@@ -7725,7 +7765,7 @@ export {
7725
7765
  toggleStrong,
7726
7766
  toggleStyle,
7727
7767
  toggleTask,
7728
- translations_default as translations,
7768
+ translations,
7729
7769
  traverse,
7730
7770
  treeFacet,
7731
7771
  typeahead,