@dxos/react-ui-editor 0.8.3-main.672df60 → 0.8.3-staging.0fa589b

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 (83) hide show
  1. package/dist/lib/browser/index.mjs +981 -377
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node/index.cjs +1025 -420
  5. package/dist/lib/node/index.cjs.map +4 -4
  6. package/dist/lib/node/meta.json +1 -1
  7. package/dist/lib/node-esm/index.mjs +981 -377
  8. package/dist/lib/node-esm/index.mjs.map +4 -4
  9. package/dist/lib/node-esm/meta.json +1 -1
  10. package/dist/types/src/components/EditorToolbar/EditorToolbar.d.ts.map +1 -1
  11. package/dist/types/src/components/EditorToolbar/util.d.ts +2 -2
  12. package/dist/types/src/components/Popover/CommandMenu.d.ts +34 -0
  13. package/dist/types/src/components/Popover/CommandMenu.d.ts.map +1 -0
  14. package/dist/types/src/components/Popover/RefDropdownMenu.d.ts.map +1 -1
  15. package/dist/types/src/components/Popover/RefPopover.d.ts +19 -6
  16. package/dist/types/src/components/Popover/RefPopover.d.ts.map +1 -1
  17. package/dist/types/src/components/Popover/index.d.ts +1 -0
  18. package/dist/types/src/components/Popover/index.d.ts.map +1 -1
  19. package/dist/types/src/defaults.d.ts +0 -1
  20. package/dist/types/src/defaults.d.ts.map +1 -1
  21. package/dist/types/src/extensions/automerge/automerge.stories.d.ts.map +1 -1
  22. package/dist/types/src/extensions/command/action.d.ts.map +1 -1
  23. package/dist/types/src/extensions/command/command-menu.d.ts +20 -0
  24. package/dist/types/src/extensions/command/command-menu.d.ts.map +1 -0
  25. package/dist/types/src/extensions/command/command.d.ts.map +1 -1
  26. package/dist/types/src/extensions/command/{menu.d.ts → floating-menu.d.ts} +1 -1
  27. package/dist/types/src/extensions/command/floating-menu.d.ts.map +1 -0
  28. package/dist/types/src/extensions/command/hint.d.ts +5 -2
  29. package/dist/types/src/extensions/command/hint.d.ts.map +1 -1
  30. package/dist/types/src/extensions/command/index.d.ts +3 -1
  31. package/dist/types/src/extensions/command/index.d.ts.map +1 -1
  32. package/dist/types/src/extensions/command/placeholder.d.ts +10 -0
  33. package/dist/types/src/extensions/command/placeholder.d.ts.map +1 -0
  34. package/dist/types/src/extensions/command/state.d.ts +1 -1
  35. package/dist/types/src/extensions/command/state.d.ts.map +1 -1
  36. package/dist/types/src/extensions/command/useCommandMenu.d.ts +26 -0
  37. package/dist/types/src/extensions/command/useCommandMenu.d.ts.map +1 -0
  38. package/dist/types/src/extensions/factories.d.ts +1 -0
  39. package/dist/types/src/extensions/factories.d.ts.map +1 -1
  40. package/dist/types/src/extensions/markdown/bundle.d.ts.map +1 -1
  41. package/dist/types/src/extensions/outliner/tree.d.ts.map +1 -1
  42. package/dist/types/src/extensions/preview/preview.d.ts +12 -19
  43. package/dist/types/src/extensions/preview/preview.d.ts.map +1 -1
  44. package/dist/types/src/hooks/useTextEditor.d.ts +8 -9
  45. package/dist/types/src/hooks/useTextEditor.d.ts.map +1 -1
  46. package/dist/types/src/stories/CommandMenu.stories.d.ts +13 -0
  47. package/dist/types/src/stories/CommandMenu.stories.d.ts.map +1 -0
  48. package/dist/types/src/stories/Preview.stories.d.ts.map +1 -1
  49. package/dist/types/src/util/dom.d.ts +5 -0
  50. package/dist/types/src/util/dom.d.ts.map +1 -1
  51. package/dist/types/src/util/react.d.ts +2 -4
  52. package/dist/types/src/util/react.d.ts.map +1 -1
  53. package/package.json +31 -28
  54. package/src/components/EditorToolbar/EditorToolbar.tsx +5 -9
  55. package/src/components/Popover/CommandMenu.tsx +279 -0
  56. package/src/components/Popover/RefDropdownMenu.tsx +5 -3
  57. package/src/components/Popover/RefPopover.tsx +46 -22
  58. package/src/components/Popover/index.ts +1 -0
  59. package/src/defaults.ts +1 -6
  60. package/src/extensions/automerge/automerge.stories.tsx +5 -5
  61. package/src/extensions/command/action.ts +9 -2
  62. package/src/extensions/command/command-menu.ts +210 -0
  63. package/src/extensions/command/command.ts +8 -8
  64. package/src/extensions/command/{menu.ts → floating-menu.ts} +0 -4
  65. package/src/extensions/command/hint.ts +29 -9
  66. package/src/extensions/command/index.ts +3 -1
  67. package/src/extensions/command/placeholder.ts +113 -0
  68. package/src/extensions/command/state.ts +1 -2
  69. package/src/extensions/command/useCommandMenu.ts +118 -0
  70. package/src/extensions/factories.ts +4 -1
  71. package/src/extensions/markdown/bundle.ts +0 -2
  72. package/src/extensions/outliner/outliner.ts +0 -3
  73. package/src/extensions/outliner/tree.test.ts +13 -10
  74. package/src/extensions/outliner/tree.ts +5 -3
  75. package/src/extensions/preview/preview.ts +11 -89
  76. package/src/hooks/useTextEditor.ts +11 -12
  77. package/src/stories/Command.stories.tsx +1 -1
  78. package/src/stories/CommandMenu.stories.tsx +159 -0
  79. package/src/stories/Preview.stories.tsx +157 -78
  80. package/src/stories/components/util.tsx +2 -2
  81. package/src/util/dom.ts +20 -0
  82. package/src/util/react.tsx +3 -20
  83. package/dist/types/src/extensions/command/menu.d.ts.map +0 -1
@@ -35,18 +35,17 @@ var translations_default = [
35
35
 
36
36
  // packages/ui/react-ui-editor/src/index.ts
37
37
  import { EditorState as EditorState4 } from "@codemirror/state";
38
- import { EditorView as EditorView25, keymap as keymap13 } from "@codemirror/view";
38
+ import { EditorView as EditorView27, keymap as keymap14 } from "@codemirror/view";
39
39
  import { tags as tags2 } from "@lezer/highlight";
40
40
  import { TextKind } from "@dxos/protocols/proto/dxos/echo/model/text";
41
41
 
42
42
  // packages/ui/react-ui-editor/src/components/EditorToolbar/EditorToolbar.tsx
43
43
  import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
44
44
  import { Rx } from "@effect-rx/rx-react";
45
- import React3, { memo, useMemo as useMemo3 } from "react";
45
+ import React3, { memo, useMemo as useMemo4 } from "react";
46
46
  import { rxFromSignal } from "@dxos/app-graph";
47
47
  import { ElevationProvider } from "@dxos/react-ui";
48
48
  import { MenuProvider, ToolbarMenu, createGapSeparator, useMenuActions } from "@dxos/react-ui-menu";
49
- import { textBlockWidth } from "@dxos/react-ui-theme";
50
49
 
51
50
  // packages/ui/react-ui-editor/src/components/EditorToolbar/util.ts
52
51
  import { useMemo } from "react";
@@ -517,17 +516,14 @@ var clientRectsFor = (dom) => {
517
516
  return [];
518
517
  }
519
518
  };
520
-
521
- // packages/ui/react-ui-editor/src/util/react.tsx
522
- import React from "react";
523
- import { createRoot } from "react-dom/client";
524
- import { ThemeProvider, Tooltip } from "@dxos/react-ui";
525
- import { defaultTx } from "@dxos/react-ui-theme";
526
519
  var createElement = (tag, options, children) => {
527
520
  const el = document.createElement(tag);
528
521
  if (options?.className) {
529
522
  el.className = options.className;
530
523
  }
524
+ if (options?.text) {
525
+ el.textContent = options.text;
526
+ }
531
527
  if (children) {
532
528
  el.append(...Array.isArray(children) ? children : [
533
529
  children
@@ -535,6 +531,12 @@ var createElement = (tag, options, children) => {
535
531
  }
536
532
  return el;
537
533
  };
534
+
535
+ // packages/ui/react-ui-editor/src/util/react.tsx
536
+ import React from "react";
537
+ import { createRoot } from "react-dom/client";
538
+ import { ThemeProvider, Tooltip } from "@dxos/react-ui";
539
+ import { defaultTx } from "@dxos/react-ui-theme";
538
540
  var renderRoot = (root, node) => {
539
541
  createRoot(root).render(/* @__PURE__ */ React.createElement(ThemeProvider, {
540
542
  tx: defaultTx
@@ -1358,6 +1360,7 @@ var closeCommand = (view) => {
1358
1360
  var commandKeyBindings = [
1359
1361
  {
1360
1362
  key: "/",
1363
+ preventDefault: true,
1361
1364
  run: openCommand
1362
1365
  },
1363
1366
  {
@@ -1367,37 +1370,55 @@ var commandKeyBindings = [
1367
1370
  ];
1368
1371
 
1369
1372
  // packages/ui/react-ui-editor/src/extensions/command/command.ts
1373
+ import { Prec } from "@codemirror/state";
1370
1374
  import { EditorView as EditorView6, keymap as keymap3 } from "@codemirror/view";
1375
+ import { isNonNullable } from "@dxos/util";
1371
1376
 
1372
1377
  // packages/ui/react-ui-editor/src/extensions/command/hint.ts
1373
1378
  import { RangeSetBuilder as RangeSetBuilder2 } from "@codemirror/state";
1374
1379
  import { Decoration as Decoration3, EditorView as EditorView5, ViewPlugin as ViewPlugin4, WidgetType as WidgetType2 } from "@codemirror/view";
1375
- var hintViewPlugin = ({ onHint }) => ViewPlugin4.fromClass(class {
1376
- constructor() {
1377
- this.decorations = Decoration3.none;
1378
- }
1379
- update(update2) {
1380
- const builder = new RangeSetBuilder2();
1381
- const cState = update2.view.state.field(commandState, false);
1382
- if (!cState?.tooltip) {
1383
- const selection = update2.view.state.selection.main;
1384
- const line = update2.view.state.doc.lineAt(selection.from);
1385
- if (selection.from === selection.to && line.from === line.to) {
1386
- const hint = onHint();
1387
- if (hint) {
1388
- builder.add(selection.from, selection.to, Decoration3.widget({
1389
- widget: new Hint(hint)
1390
- }));
1380
+ var hint = ({ delay = 3e3, onHint }) => {
1381
+ return ViewPlugin4.fromClass(class {
1382
+ constructor() {
1383
+ this.decorations = Decoration3.none;
1384
+ }
1385
+ update(update2) {
1386
+ if (this.timeout) {
1387
+ clearTimeout(this.timeout);
1388
+ this.timeout = void 0;
1389
+ }
1390
+ const builder = new RangeSetBuilder2();
1391
+ const cState = update2.view.state.field(commandState, false);
1392
+ if (!cState?.tooltip) {
1393
+ const selection = update2.view.state.selection.main;
1394
+ const line = update2.view.state.doc.lineAt(selection.from);
1395
+ if (selection.from === selection.to && line.from === line.to) {
1396
+ this.timeout = setTimeout(() => {
1397
+ const hint2 = onHint?.();
1398
+ if (hint2) {
1399
+ const builder2 = new RangeSetBuilder2();
1400
+ builder2.add(selection.from, selection.to, Decoration3.widget({
1401
+ widget: new Hint(hint2)
1402
+ }));
1403
+ this.decorations = builder2.finish();
1404
+ update2.view.update([]);
1405
+ }
1406
+ }, delay);
1391
1407
  }
1392
1408
  }
1409
+ this.decorations = builder.finish();
1393
1410
  }
1394
- this.decorations = builder.finish();
1395
- }
1396
- }, {
1397
- provide: (plugin) => [
1398
- EditorView5.decorations.of((view) => view.plugin(plugin)?.decorations ?? Decoration3.none)
1399
- ]
1400
- });
1411
+ destroy() {
1412
+ if (this.timeout) {
1413
+ clearTimeout(this.timeout);
1414
+ }
1415
+ }
1416
+ }, {
1417
+ provide: (plugin) => [
1418
+ EditorView5.decorations.of((view) => view.plugin(plugin)?.decorations ?? Decoration3.none)
1419
+ ]
1420
+ });
1421
+ };
1401
1422
  var Hint = class extends WidgetType2 {
1402
1423
  constructor(content) {
1403
1424
  super(), this.content = content;
@@ -1440,28 +1461,267 @@ var Hint = class extends WidgetType2 {
1440
1461
  // packages/ui/react-ui-editor/src/extensions/command/command.ts
1441
1462
  var command = (options = {}) => {
1442
1463
  return [
1443
- keymap3.of(commandKeyBindings),
1464
+ Prec.highest(keymap3.of(commandKeyBindings)),
1444
1465
  commandConfig.of(options),
1445
1466
  commandState,
1446
- options.onHint ? hintViewPlugin({
1447
- onHint: options.onHint
1448
- }) : [],
1449
- EditorView6.focusChangeEffect.of((_, focusing) => {
1450
- return focusing ? closeEffect.of(null) : null;
1451
- }),
1467
+ options.onHint && hint(options),
1468
+ EditorView6.focusChangeEffect.of((_, focusing) => focusing ? closeEffect.of(null) : null),
1452
1469
  EditorView6.theme({
1453
1470
  ".cm-tooltip": {
1454
1471
  background: "transparent"
1455
1472
  }
1456
1473
  })
1474
+ ].filter(isNonNullable);
1475
+ };
1476
+
1477
+ // packages/ui/react-ui-editor/src/extensions/command/command-menu.ts
1478
+ import { RangeSetBuilder as RangeSetBuilder3, StateField as StateField3, StateEffect as StateEffect3, Prec as Prec2 } from "@codemirror/state";
1479
+ import { EditorView as EditorView8, ViewPlugin as ViewPlugin6, Decoration as Decoration5, keymap as keymap4 } from "@codemirror/view";
1480
+
1481
+ // packages/ui/react-ui-editor/src/extensions/command/placeholder.ts
1482
+ import { Decoration as Decoration4, EditorView as EditorView7, WidgetType as WidgetType3, ViewPlugin as ViewPlugin5 } from "@codemirror/view";
1483
+ var placeholder = ({ delay = 3e3, content }) => {
1484
+ const plugin = ViewPlugin5.fromClass(class {
1485
+ constructor() {
1486
+ this.decorations = Decoration4.none;
1487
+ }
1488
+ update(update2) {
1489
+ if (this.timeout) {
1490
+ window.clearTimeout(this.timeout);
1491
+ this.timeout = void 0;
1492
+ }
1493
+ const activeLine = update2.view.state.doc.lineAt(update2.view.state.selection.main.head);
1494
+ const isEmpty = activeLine.text.trim() === "";
1495
+ if (isEmpty) {
1496
+ const lineStart = activeLine.from;
1497
+ this.timeout = setTimeout(() => {
1498
+ this.decorations = Decoration4.set([
1499
+ Decoration4.widget({
1500
+ widget: new Placeholder(content),
1501
+ side: 1
1502
+ }).range(lineStart)
1503
+ ]);
1504
+ update2.view.update([]);
1505
+ }, delay);
1506
+ }
1507
+ this.decorations = Decoration4.none;
1508
+ }
1509
+ destroy() {
1510
+ if (this.timeout) {
1511
+ clearTimeout(this.timeout);
1512
+ }
1513
+ }
1514
+ }, {
1515
+ provide: (plugin2) => {
1516
+ return [
1517
+ EditorView7.decorations.of((view) => view.plugin(plugin2)?.decorations ?? Decoration4.none)
1518
+ ];
1519
+ }
1520
+ });
1521
+ return typeof content === "string" ? [
1522
+ plugin,
1523
+ EditorView7.contentAttributes.of({
1524
+ "aria-placeholder": content
1525
+ })
1526
+ ] : plugin;
1527
+ };
1528
+ var Placeholder = class extends WidgetType3 {
1529
+ constructor(content) {
1530
+ super(), this.content = content;
1531
+ }
1532
+ toDOM(view) {
1533
+ const wrap = document.createElement("span");
1534
+ wrap.className = "cm-placeholder";
1535
+ wrap.style.pointerEvents = "none";
1536
+ wrap.appendChild(typeof this.content === "string" ? document.createTextNode(this.content) : typeof this.content === "function" ? this.content(view) : this.content.cloneNode(true));
1537
+ wrap.setAttribute("aria-hidden", "true");
1538
+ return wrap;
1539
+ }
1540
+ coordsAt(dom) {
1541
+ const rects = dom.firstChild ? clientRectsFor(dom.firstChild) : [];
1542
+ if (!rects.length) {
1543
+ return null;
1544
+ }
1545
+ const style = window.getComputedStyle(dom.parentNode);
1546
+ const rect = flattenRect(rects[0], style.direction !== "rtl");
1547
+ const lineHeight = parseInt(style.lineHeight);
1548
+ if (rect.bottom - rect.top > lineHeight * 1.5) {
1549
+ return {
1550
+ left: rect.left,
1551
+ right: rect.right,
1552
+ top: rect.top,
1553
+ bottom: rect.top + lineHeight
1554
+ };
1555
+ }
1556
+ return rect;
1557
+ }
1558
+ ignoreEvent() {
1559
+ return false;
1560
+ }
1561
+ };
1562
+
1563
+ // packages/ui/react-ui-editor/src/extensions/command/command-menu.ts
1564
+ var commandMenu = (options) => {
1565
+ const commandMenuPlugin = ViewPlugin6.fromClass(class {
1566
+ constructor(view) {
1567
+ this.view = view;
1568
+ this.decorations = Decoration5.none;
1569
+ }
1570
+ // TODO(wittjosiah): The decorations are repainted on every update, this occasionally causes menu to flicker.
1571
+ update(update2) {
1572
+ const builder = new RangeSetBuilder3();
1573
+ const selection = update2.view.state.selection.main;
1574
+ const { range: activeRange, trigger } = update2.view.state.field(commandMenuState) ?? {};
1575
+ const shouldShowWidget = activeRange && selection.head >= activeRange.from && selection.head <= activeRange.to;
1576
+ if (shouldShowWidget) {
1577
+ builder.add(activeRange.from, activeRange.to, Decoration5.mark({
1578
+ tagName: "dx-ref-tag",
1579
+ class: "cm-ref-tag",
1580
+ attributes: {
1581
+ "data-auto-trigger": "true",
1582
+ "data-trigger": trigger
1583
+ }
1584
+ }));
1585
+ }
1586
+ const activeRangeChanged = update2.transactions.some((tr) => tr.effects.some((effect) => effect.is(commandRangeEffect)));
1587
+ if (activeRange && activeRangeChanged && trigger) {
1588
+ const content = update2.view.state.sliceDoc(activeRange.from + 1, activeRange.to);
1589
+ options.onTextChange?.(trigger, content);
1590
+ }
1591
+ this.decorations = builder.finish();
1592
+ }
1593
+ }, {
1594
+ decorations: (v) => v.decorations
1595
+ });
1596
+ const triggers = Array.isArray(options.trigger) ? options.trigger : [
1597
+ options.trigger
1598
+ ];
1599
+ const commandKeymap = keymap4.of([
1600
+ ...triggers.map((trigger) => ({
1601
+ key: trigger,
1602
+ preventDefault: true,
1603
+ run: (view) => {
1604
+ const selection = view.state.selection.main;
1605
+ const line = view.state.doc.lineAt(selection.head);
1606
+ if (line.text.trim() === "" || selection.head === line.from || selection.head > line.from && line.text[selection.head - line.from - 1] === " ") {
1607
+ view.dispatch({
1608
+ changes: {
1609
+ from: selection.head,
1610
+ insert: trigger
1611
+ },
1612
+ selection: {
1613
+ anchor: selection.head + 1,
1614
+ head: selection.head + 1
1615
+ },
1616
+ effects: commandRangeEffect.of({
1617
+ trigger,
1618
+ range: {
1619
+ from: selection.head,
1620
+ to: selection.head + 1
1621
+ }
1622
+ })
1623
+ });
1624
+ return true;
1625
+ }
1626
+ return false;
1627
+ }
1628
+ })),
1629
+ {
1630
+ key: "Enter",
1631
+ run: (view) => {
1632
+ const activeRange = view.state.field(commandMenuState)?.range;
1633
+ if (activeRange) {
1634
+ view.dispatch({
1635
+ changes: {
1636
+ from: activeRange.from,
1637
+ to: activeRange.to,
1638
+ insert: ""
1639
+ }
1640
+ });
1641
+ options.onEnter?.();
1642
+ return true;
1643
+ }
1644
+ return false;
1645
+ }
1646
+ },
1647
+ {
1648
+ key: "ArrowDown",
1649
+ run: (view) => {
1650
+ const activeRange = view.state.field(commandMenuState)?.range;
1651
+ if (activeRange) {
1652
+ options.onArrowDown?.();
1653
+ return true;
1654
+ }
1655
+ return false;
1656
+ }
1657
+ },
1658
+ {
1659
+ key: "ArrowUp",
1660
+ run: (view) => {
1661
+ const activeRange = view.state.field(commandMenuState)?.range;
1662
+ if (activeRange) {
1663
+ options.onArrowUp?.();
1664
+ return true;
1665
+ }
1666
+ return false;
1667
+ }
1668
+ }
1669
+ ]);
1670
+ const updateListener = EditorView8.updateListener.of((update2) => {
1671
+ const { trigger, range: activeRange } = update2.view.state.field(commandMenuState) ?? {};
1672
+ if (!activeRange || !trigger) {
1673
+ return;
1674
+ }
1675
+ const selection = update2.view.state.selection.main;
1676
+ const firstChar = update2.view.state.doc.sliceString(activeRange.from, activeRange.from + 1);
1677
+ const shouldRemove = firstChar !== trigger || // Trigger deleted.
1678
+ selection.head < activeRange.from || // Cursor moved before the range.
1679
+ selection.head > activeRange.to + 1;
1680
+ const nextRange = shouldRemove ? null : update2.docChanged ? {
1681
+ from: activeRange.from,
1682
+ to: selection.head
1683
+ } : activeRange;
1684
+ if (nextRange !== activeRange) {
1685
+ update2.view.dispatch({
1686
+ effects: commandRangeEffect.of(nextRange ? {
1687
+ trigger,
1688
+ range: nextRange
1689
+ } : null)
1690
+ });
1691
+ }
1692
+ if (shouldRemove) {
1693
+ options.onClose?.();
1694
+ }
1695
+ });
1696
+ return [
1697
+ Prec2.highest(commandKeymap),
1698
+ placeholder(Object.assign({
1699
+ content: `Press '${Array.isArray(options.trigger) ? options.trigger[0] : options.trigger}' for commands`
1700
+ }, options.placeholder)),
1701
+ updateListener,
1702
+ commandMenuState,
1703
+ commandMenuPlugin
1457
1704
  ];
1458
1705
  };
1706
+ var commandRangeEffect = StateEffect3.define();
1707
+ var commandMenuState = StateField3.define({
1708
+ create: () => null,
1709
+ update: (value, tr) => {
1710
+ let newValue = value;
1711
+ for (const effect of tr.effects) {
1712
+ if (effect.is(commandRangeEffect)) {
1713
+ newValue = effect.value;
1714
+ }
1715
+ }
1716
+ return newValue;
1717
+ }
1718
+ });
1459
1719
 
1460
- // packages/ui/react-ui-editor/src/extensions/command/menu.ts
1461
- import { EditorView as EditorView7, ViewPlugin as ViewPlugin5 } from "@codemirror/view";
1720
+ // packages/ui/react-ui-editor/src/extensions/command/floating-menu.ts
1721
+ import { EditorView as EditorView9, ViewPlugin as ViewPlugin7 } from "@codemirror/view";
1462
1722
  import { addEventListener } from "@dxos/async";
1463
1723
  var floatingMenu = (options = {}) => [
1464
- ViewPlugin5.fromClass(class {
1724
+ ViewPlugin7.fromClass(class {
1465
1725
  constructor(view) {
1466
1726
  this.view = view;
1467
1727
  const container = view.scrollDOM;
@@ -1526,7 +1786,7 @@ var floatingMenu = (options = {}) => [
1526
1786
  this.rafId = requestAnimationFrame(this.updateButtonPosition.bind(this));
1527
1787
  }
1528
1788
  }),
1529
- EditorView7.theme({
1789
+ EditorView9.theme({
1530
1790
  ".cm-ref-tag": {
1531
1791
  position: "fixed",
1532
1792
  padding: "0",
@@ -1536,9 +1796,6 @@ var floatingMenu = (options = {}) => [
1536
1796
  "[data-has-focus] & .cm-ref-tag": {
1537
1797
  opacity: "1"
1538
1798
  },
1539
- "[data-is-attention-source] & .cm-ref-tag": {
1540
- opacity: "1"
1541
- },
1542
1799
  ".cm-ref-tag button": {
1543
1800
  display: "grid",
1544
1801
  alignItems: "center",
@@ -1549,13 +1806,114 @@ var floatingMenu = (options = {}) => [
1549
1806
  })
1550
1807
  ];
1551
1808
 
1809
+ // packages/ui/react-ui-editor/src/extensions/command/useCommandMenu.ts
1810
+ import { useCallback, useMemo as useMemo2, useRef, useState } from "react";
1811
+ var useCommandMenu = ({ viewRef, trigger, placeholder: placeholder3, getMenu }) => {
1812
+ const triggerRef = useRef(null);
1813
+ const currentRef = useRef(null);
1814
+ const groupsRef = useRef([]);
1815
+ const [currentItem, setCurrentItem] = useState();
1816
+ const [open, setOpen] = useState(false);
1817
+ const [_, refresh] = useState({});
1818
+ const handleOpenChange = useCallback(async (open2, trigger2) => {
1819
+ if (open2 && trigger2) {
1820
+ groupsRef.current = await getMenu(trigger2);
1821
+ }
1822
+ setOpen(open2);
1823
+ if (!open2) {
1824
+ triggerRef.current = null;
1825
+ setCurrentItem(void 0);
1826
+ viewRef.current?.dispatch({
1827
+ effects: [
1828
+ commandRangeEffect.of(null)
1829
+ ]
1830
+ });
1831
+ }
1832
+ }, [
1833
+ getMenu
1834
+ ]);
1835
+ const handleActivate = useCallback(async (event) => {
1836
+ const item = getItem(groupsRef.current, currentItem);
1837
+ if (item) {
1838
+ currentRef.current = item;
1839
+ }
1840
+ triggerRef.current = event.trigger;
1841
+ const triggerKey = event.trigger.getAttribute("data-trigger");
1842
+ if (!open && triggerKey) {
1843
+ await handleOpenChange(true, triggerKey);
1844
+ }
1845
+ }, [
1846
+ open,
1847
+ handleOpenChange
1848
+ ]);
1849
+ const handleSelect = useCallback((item) => {
1850
+ const view = viewRef.current;
1851
+ if (!view) {
1852
+ return;
1853
+ }
1854
+ const selection = view.state.selection.main;
1855
+ void item.onSelect?.(view, selection.head);
1856
+ }, []);
1857
+ const serializedTrigger = Array.isArray(trigger) ? trigger.join(",") : trigger;
1858
+ const _commandMenu = useMemo2(() => {
1859
+ return commandMenu({
1860
+ trigger,
1861
+ placeholder: placeholder3,
1862
+ onClose: () => handleOpenChange(false),
1863
+ onArrowDown: () => {
1864
+ setCurrentItem((currentItem2) => {
1865
+ const next = getNextItem(groupsRef.current, currentItem2);
1866
+ currentRef.current = next;
1867
+ return next.id;
1868
+ });
1869
+ },
1870
+ onArrowUp: () => {
1871
+ setCurrentItem((currentItem2) => {
1872
+ const previous = getPreviousItem(groupsRef.current, currentItem2);
1873
+ currentRef.current = previous;
1874
+ return previous.id;
1875
+ });
1876
+ },
1877
+ onEnter: () => {
1878
+ if (currentRef.current) {
1879
+ handleSelect(currentRef.current);
1880
+ }
1881
+ },
1882
+ onTextChange: async (trigger2, text) => {
1883
+ groupsRef.current = await getMenu(trigger2, text);
1884
+ const firstItem = groupsRef.current.filter((group) => group.items.length > 0)[0]?.items[0];
1885
+ if (firstItem) {
1886
+ setCurrentItem(firstItem.id);
1887
+ currentRef.current = firstItem;
1888
+ }
1889
+ refresh({});
1890
+ }
1891
+ });
1892
+ }, [
1893
+ handleOpenChange,
1894
+ getMenu,
1895
+ serializedTrigger,
1896
+ placeholder3
1897
+ ]);
1898
+ return {
1899
+ commandMenu: _commandMenu,
1900
+ currentItem,
1901
+ groupsRef,
1902
+ ref: triggerRef,
1903
+ open,
1904
+ onActivate: handleActivate,
1905
+ onOpenChange: setOpen,
1906
+ onSelect: handleSelect
1907
+ };
1908
+ };
1909
+
1552
1910
  // packages/ui/react-ui-editor/src/extensions/command/typeahead.ts
1553
- import { EditorSelection, Prec, RangeSetBuilder as RangeSetBuilder3 } from "@codemirror/state";
1554
- import { Decoration as Decoration4, keymap as keymap4, ViewPlugin as ViewPlugin6 } from "@codemirror/view";
1911
+ import { EditorSelection, Prec as Prec3, RangeSetBuilder as RangeSetBuilder4 } from "@codemirror/state";
1912
+ import { Decoration as Decoration6, keymap as keymap5, ViewPlugin as ViewPlugin8 } from "@codemirror/view";
1555
1913
  var typeahead = ({ onComplete } = {}) => {
1556
- let hint;
1914
+ let hint2;
1557
1915
  const complete = (view) => {
1558
- if (!hint) {
1916
+ if (!hint2) {
1559
1917
  return false;
1560
1918
  }
1561
1919
  const selection = view.state.selection.main;
@@ -1564,30 +1922,30 @@ var typeahead = ({ onComplete } = {}) => {
1564
1922
  {
1565
1923
  from: selection.from,
1566
1924
  to: selection.to,
1567
- insert: hint
1925
+ insert: hint2
1568
1926
  }
1569
1927
  ],
1570
- selection: EditorSelection.cursor(selection.from + hint.length)
1928
+ selection: EditorSelection.cursor(selection.from + hint2.length)
1571
1929
  });
1572
1930
  return true;
1573
1931
  };
1574
1932
  return [
1575
- ViewPlugin6.fromClass(class {
1933
+ ViewPlugin8.fromClass(class {
1576
1934
  constructor() {
1577
- this.decorations = Decoration4.none;
1935
+ this.decorations = Decoration6.none;
1578
1936
  }
1579
1937
  update(update2) {
1580
- const builder = new RangeSetBuilder3();
1938
+ const builder = new RangeSetBuilder4();
1581
1939
  const selection = update2.view.state.selection.main;
1582
1940
  const line = update2.view.state.doc.lineAt(selection.from);
1583
1941
  if (selection.from === selection.to && selection.from === line.to) {
1584
1942
  const str = update2.state.sliceDoc(line.from, selection.from);
1585
- hint = onComplete?.({
1943
+ hint2 = onComplete?.({
1586
1944
  line: str
1587
1945
  });
1588
- if (hint) {
1589
- builder.add(selection.from, selection.to, Decoration4.widget({
1590
- widget: new Hint(hint)
1946
+ if (hint2) {
1947
+ builder.add(selection.from, selection.to, Decoration6.widget({
1948
+ widget: new Hint(hint2)
1591
1949
  }));
1592
1950
  }
1593
1951
  }
@@ -1597,7 +1955,7 @@ var typeahead = ({ onComplete } = {}) => {
1597
1955
  decorations: (v) => v.decorations
1598
1956
  }),
1599
1957
  // Keys.
1600
- Prec.highest(keymap4.of([
1958
+ Prec3.highest(keymap5.of([
1601
1959
  {
1602
1960
  key: "Tab",
1603
1961
  preventDefault: true,
@@ -1634,17 +1992,17 @@ var matchCompletion = (completion, word) => {
1634
1992
 
1635
1993
  // packages/ui/react-ui-editor/src/extensions/comments.ts
1636
1994
  import { invertedEffects } from "@codemirror/commands";
1637
- import { StateEffect as StateEffect3, StateField as StateField3 } from "@codemirror/state";
1638
- import { hoverTooltip, keymap as keymap6, Decoration as Decoration5, EditorView as EditorView9, ViewPlugin as ViewPlugin7 } from "@codemirror/view";
1995
+ import { StateEffect as StateEffect4, StateField as StateField4 } from "@codemirror/state";
1996
+ import { hoverTooltip, keymap as keymap7, Decoration as Decoration7, EditorView as EditorView11, ViewPlugin as ViewPlugin9 } from "@codemirror/view";
1639
1997
  import sortBy from "lodash.sortby";
1640
1998
  import { useEffect } from "react";
1641
1999
  import { debounce as debounce2 } from "@dxos/async";
1642
2000
  import { log as log4 } from "@dxos/log";
1643
- import { isNonNullable } from "@dxos/util";
2001
+ import { isNonNullable as isNonNullable2 } from "@dxos/util";
1644
2002
 
1645
2003
  // packages/ui/react-ui-editor/src/extensions/selection.ts
1646
2004
  import { Transaction } from "@codemirror/state";
1647
- import { EditorView as EditorView8, keymap as keymap5 } from "@codemirror/view";
2005
+ import { EditorView as EditorView10, keymap as keymap6 } from "@codemirror/view";
1648
2006
  import { debounce } from "@dxos/async";
1649
2007
  import { invariant as invariant3 } from "@dxos/invariant";
1650
2008
  import { isNotFalsy } from "@dxos/util";
@@ -1655,7 +2013,7 @@ var createEditorStateTransaction = ({ scrollTo, selection }) => {
1655
2013
  return {
1656
2014
  selection,
1657
2015
  scrollIntoView: !scrollTo,
1658
- effects: scrollTo ? EditorView8.scrollIntoView(scrollTo, {
2016
+ effects: scrollTo ? EditorView10.scrollIntoView(scrollTo, {
1659
2017
  yMargin: 96
1660
2018
  }) : void 0,
1661
2019
  annotations: Transaction.userEvent.of(stateRestoreAnnotation)
@@ -1697,7 +2055,7 @@ var selectionState = ({ getState, setState } = {}) => {
1697
2055
  // setStateDebounced(id, {});
1698
2056
  // },
1699
2057
  // }),
1700
- EditorView8.updateListener.of(({ view, transactions }) => {
2058
+ EditorView10.updateListener.of(({ view, transactions }) => {
1701
2059
  const id = view.state.facet(documentId);
1702
2060
  if (!id || transactions.some((tr) => tr.isUserEvent(stateRestoreAnnotation))) {
1703
2061
  return;
@@ -1720,7 +2078,7 @@ var selectionState = ({ getState, setState } = {}) => {
1720
2078
  }
1721
2079
  }
1722
2080
  }),
1723
- getState && keymap5.of([
2081
+ getState && keymap6.of([
1724
2082
  {
1725
2083
  key: "ctrl-r",
1726
2084
  run: (view) => {
@@ -1737,10 +2095,10 @@ var selectionState = ({ getState, setState } = {}) => {
1737
2095
 
1738
2096
  // packages/ui/react-ui-editor/src/extensions/comments.ts
1739
2097
  var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/comments.ts";
1740
- var setComments = StateEffect3.define();
1741
- var setSelection = StateEffect3.define();
1742
- var setCommentState = StateEffect3.define();
1743
- var commentsState = StateField3.define({
2098
+ var setComments = StateEffect4.define();
2099
+ var setSelection = StateEffect4.define();
2100
+ var setCommentState = StateEffect4.define();
2101
+ var commentsState = StateField4.define({
1744
2102
  create: (state) => ({
1745
2103
  id: state.facet(documentId),
1746
2104
  comments: [],
@@ -1765,7 +2123,7 @@ var commentsState = StateField3.define({
1765
2123
  comment,
1766
2124
  range
1767
2125
  };
1768
- }).filter(isNonNullable);
2126
+ }).filter(isNonNullable2);
1769
2127
  return {
1770
2128
  ...value,
1771
2129
  comments: commentStates
@@ -1778,7 +2136,7 @@ var commentsState = StateField3.define({
1778
2136
  return value;
1779
2137
  }
1780
2138
  });
1781
- var styles2 = EditorView9.theme({
2139
+ var styles2 = EditorView11.theme({
1782
2140
  ".cm-comment, .cm-comment-current": {
1783
2141
  margin: "0 -3px",
1784
2142
  padding: "3px",
@@ -1791,14 +2149,14 @@ var styles2 = EditorView9.theme({
1791
2149
  textDecoration: "underline"
1792
2150
  }
1793
2151
  });
1794
- var createCommentMark = (id, isCurrent) => Decoration5.mark({
2152
+ var createCommentMark = (id, isCurrent) => Decoration7.mark({
1795
2153
  class: isCurrent ? "cm-comment-current" : "cm-comment",
1796
2154
  attributes: {
1797
2155
  "data-testid": "cm-comment",
1798
2156
  "data-comment-id": id
1799
2157
  }
1800
2158
  });
1801
- var commentsDecorations = EditorView9.decorations.compute([
2159
+ var commentsDecorations = EditorView11.decorations.compute([
1802
2160
  commentsState
1803
2161
  ], (state) => {
1804
2162
  const { selection: { current }, comments: comments2 } = state.field(commentsState);
@@ -1817,11 +2175,11 @@ var commentsDecorations = EditorView9.decorations.compute([
1817
2175
  }
1818
2176
  const mark = createCommentMark(comment.comment.id, comment.comment.id === current);
1819
2177
  return mark.range(range.from, range.to);
1820
- }).filter(isNonNullable);
1821
- return Decoration5.set(decorations2);
2178
+ }).filter(isNonNullable2);
2179
+ return Decoration7.set(decorations2);
1822
2180
  });
1823
- var commentClickedEffect = StateEffect3.define();
1824
- var handleCommentClick = EditorView9.domEventHandlers({
2181
+ var commentClickedEffect = StateEffect4.define();
2182
+ var handleCommentClick = EditorView11.domEventHandlers({
1825
2183
  click: (event, view) => {
1826
2184
  let target = event.target;
1827
2185
  const editorRoot = view.dom;
@@ -1860,7 +2218,7 @@ var trackPastedComments = (onUpdate) => {
1860
2218
  }
1861
2219
  };
1862
2220
  return [
1863
- EditorView9.domEventHandlers({
2221
+ EditorView11.domEventHandlers({
1864
2222
  cut: handleTrack,
1865
2223
  copy: handleTrack
1866
2224
  }),
@@ -1882,7 +2240,7 @@ var trackPastedComments = (onUpdate) => {
1882
2240
  return effects;
1883
2241
  }),
1884
2242
  // Handle paste or the undo of comment deletion.
1885
- EditorView9.updateListener.of((update2) => {
2243
+ EditorView11.updateListener.of((update2) => {
1886
2244
  const restore = [];
1887
2245
  for (let i = 0; i < update2.transactions.length; i++) {
1888
2246
  const tr = update2.transactions[i];
@@ -1938,7 +2296,7 @@ var mapTrackedComment = (comment, changes) => ({
1938
2296
  from: changes.mapPos(comment.from, 1),
1939
2297
  to: changes.mapPos(comment.to, 1)
1940
2298
  });
1941
- var restoreCommentEffect = StateEffect3.define({
2299
+ var restoreCommentEffect = StateEffect4.define({
1942
2300
  map: mapTrackedComment
1943
2301
  });
1944
2302
  var createComment = (view) => {
@@ -1983,7 +2341,7 @@ var comments = (options = {}) => {
1983
2341
  //
1984
2342
  // Keymap.
1985
2343
  //
1986
- options.onCreate && keymap6.of([
2344
+ options.onCreate && keymap7.of([
1987
2345
  {
1988
2346
  key: shortcut,
1989
2347
  run: callbackWrapper(createComment)
@@ -2024,7 +2382,7 @@ var comments = (options = {}) => {
2024
2382
  //
2025
2383
  // Track deleted ranges and update ranges for decorations.
2026
2384
  //
2027
- EditorView9.updateListener.of(({ view, state, changes }) => {
2385
+ EditorView11.updateListener.of(({ view, state, changes }) => {
2028
2386
  let mod = false;
2029
2387
  const { comments: comments2, ...value } = state.field(commentsState);
2030
2388
  changes.iterChanges((from, to, from2, to2) => {
@@ -2056,7 +2414,7 @@ var comments = (options = {}) => {
2056
2414
  //
2057
2415
  // Track selection/proximity.
2058
2416
  //
2059
- EditorView9.updateListener.of(({ view, state }) => {
2417
+ EditorView11.updateListener.of(({ view, state }) => {
2060
2418
  let min = Infinity;
2061
2419
  const { selection: { current, closest }, comments: comments2 } = state.field(commentsState);
2062
2420
  const { head } = state.selection.main;
@@ -2090,7 +2448,7 @@ var comments = (options = {}) => {
2090
2448
  }
2091
2449
  }),
2092
2450
  options.onUpdate && trackPastedComments(options.onUpdate)
2093
- ].filter(isNonNullable);
2451
+ ].filter(isNonNullable2);
2094
2452
  };
2095
2453
  var scrollThreadIntoView = (view, id, center = true) => {
2096
2454
  const comment = view.state.field(commentsState).comments.find((range2) => range2.comment.id === id);
@@ -2110,7 +2468,7 @@ var scrollThreadIntoView = (view, id, center = true) => {
2110
2468
  anchor: range.from
2111
2469
  } : void 0,
2112
2470
  effects: [
2113
- needsScroll ? EditorView9.scrollIntoView(range.from, center ? {
2471
+ needsScroll ? EditorView11.scrollIntoView(range.from, center ? {
2114
2472
  y: "center"
2115
2473
  } : void 0) : [],
2116
2474
  needsSelectionUpdate ? setSelection.of({
@@ -2140,7 +2498,7 @@ var ExternalCommentSync = class {
2140
2498
  this.unsubscribe = subscribe(updateComments);
2141
2499
  }
2142
2500
  };
2143
- var createExternalCommentSync = (id, subscribe, getComments) => ViewPlugin7.fromClass(class {
2501
+ var createExternalCommentSync = (id, subscribe, getComments) => ViewPlugin9.fromClass(class {
2144
2502
  constructor(view) {
2145
2503
  return new ExternalCommentSync(view, id, subscribe, getComments);
2146
2504
  }
@@ -2162,20 +2520,20 @@ var useComments = (view, id, comments2) => {
2162
2520
 
2163
2521
  // packages/ui/react-ui-editor/src/extensions/debug.ts
2164
2522
  import { syntaxTree } from "@codemirror/language";
2165
- import { StateField as StateField4 } from "@codemirror/state";
2523
+ import { StateField as StateField5 } from "@codemirror/state";
2166
2524
  var debugNodeLogger = (log9 = console.log) => {
2167
2525
  const logTokens = (state) => syntaxTree(state).iterate({
2168
2526
  enter: (node) => log9(node.type)
2169
2527
  });
2170
- return StateField4.define({
2528
+ return StateField5.define({
2171
2529
  create: (state) => logTokens(state),
2172
2530
  update: (_, tr) => logTokens(tr.state)
2173
2531
  });
2174
2532
  };
2175
2533
 
2176
2534
  // packages/ui/react-ui-editor/src/extensions/dnd.ts
2177
- import { dropCursor, EditorView as EditorView10 } from "@codemirror/view";
2178
- var styles3 = EditorView10.theme({
2535
+ import { dropCursor, EditorView as EditorView12 } from "@codemirror/view";
2536
+ var styles3 = EditorView12.theme({
2179
2537
  ".cm-dropCursor": {
2180
2538
  borderLeft: "2px solid var(--dx-accentText)",
2181
2539
  color: "var(--dx-accentText)",
@@ -2189,7 +2547,7 @@ var dropFile = (options = {}) => {
2189
2547
  return [
2190
2548
  styles3,
2191
2549
  dropCursor(),
2192
- EditorView10.domEventHandlers({
2550
+ EditorView12.domEventHandlers({
2193
2551
  drop: (event, view) => {
2194
2552
  event.preventDefault();
2195
2553
  const files = event.dataTransfer?.files;
@@ -2216,7 +2574,7 @@ import { bracketMatching, defaultHighlightStyle, syntaxHighlighting } from "@cod
2216
2574
  import { searchKeymap } from "@codemirror/search";
2217
2575
  import { EditorState } from "@codemirror/state";
2218
2576
  import { oneDarkHighlightStyle } from "@codemirror/theme-one-dark";
2219
- import { EditorView as EditorView12, ViewPlugin as ViewPlugin8, drawSelection, dropCursor as dropCursor2, highlightActiveLine, keymap as keymap7, lineNumbers, placeholder, scrollPastEnd } from "@codemirror/view";
2577
+ import { EditorView as EditorView15, ViewPlugin as ViewPlugin10, drawSelection, dropCursor as dropCursor2, highlightActiveLine, keymap as keymap8, lineNumbers, placeholder as placeholder2, scrollPastEnd } from "@codemirror/view";
2220
2578
  import defaultsDeep2 from "lodash.defaultsdeep";
2221
2579
  import merge from "lodash.merge";
2222
2580
  import { generateName } from "@dxos/display-name";
@@ -2224,10 +2582,10 @@ import { log as log5 } from "@dxos/log";
2224
2582
  import { hexToHue, isNotFalsy as isNotFalsy2 } from "@dxos/util";
2225
2583
 
2226
2584
  // packages/ui/react-ui-editor/src/extensions/focus.ts
2227
- import { StateEffect as StateEffect4, StateField as StateField5 } from "@codemirror/state";
2228
- import { EditorView as EditorView11 } from "@codemirror/view";
2229
- var focusEffect = StateEffect4.define();
2230
- var focusField = StateField5.define({
2585
+ import { StateEffect as StateEffect5, StateField as StateField6 } from "@codemirror/state";
2586
+ import { EditorView as EditorView13 } from "@codemirror/view";
2587
+ var focusEffect = StateEffect5.define();
2588
+ var focusField = StateField6.define({
2231
2589
  create: () => false,
2232
2590
  update: (value, tr) => {
2233
2591
  for (const effect of tr.effects) {
@@ -2240,7 +2598,7 @@ var focusField = StateField5.define({
2240
2598
  });
2241
2599
  var focus = [
2242
2600
  focusField,
2243
- EditorView11.domEventHandlers({
2601
+ EditorView13.domEventHandlers({
2244
2602
  focus: (event, view) => {
2245
2603
  setTimeout(() => view.dispatch({
2246
2604
  effects: focusEffect.of(true)
@@ -2254,6 +2612,10 @@ var focus = [
2254
2612
  })
2255
2613
  ];
2256
2614
 
2615
+ // packages/ui/react-ui-editor/src/defaults.ts
2616
+ import { EditorView as EditorView14 } from "@codemirror/view";
2617
+ import { mx as mx2 } from "@dxos/react-ui-theme";
2618
+
2257
2619
  // packages/ui/react-ui-editor/src/styles/markdown.ts
2258
2620
  import { mx } from "@dxos/react-ui-theme";
2259
2621
  var headings = {
@@ -2495,6 +2857,30 @@ var defaultTheme = {
2495
2857
  }
2496
2858
  };
2497
2859
 
2860
+ // packages/ui/react-ui-editor/src/defaults.ts
2861
+ var editorWidth = "!mli-auto is-full max-is-[min(50rem,100%-4rem)]";
2862
+ var editorSlots = {
2863
+ scroll: {
2864
+ className: "pbs-2"
2865
+ },
2866
+ content: {
2867
+ className: editorWidth
2868
+ }
2869
+ };
2870
+ var editorGutter = EditorView14.theme({
2871
+ ".cm-gutters": {
2872
+ background: "var(--dx-baseSurface)",
2873
+ paddingRight: "1rem"
2874
+ }
2875
+ });
2876
+ var editorMonospace = EditorView14.theme({
2877
+ ".cm-content": {
2878
+ fontFamily: fontMono
2879
+ }
2880
+ });
2881
+ var editorWithToolbarLayout = "grid grid-cols-1 grid-rows-[min-content_1fr] data-[toolbar=disabled]:grid-rows-[1fr] justify-center content-start overflow-hidden";
2882
+ 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");
2883
+
2498
2884
  // packages/ui/react-ui-editor/src/extensions/factories.ts
2499
2885
  var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/factories.ts";
2500
2886
  var preventNewline = EditorState.transactionFilter.of((tr) => tr.newDoc.lines > 1 ? [] : tr);
@@ -2519,10 +2905,10 @@ var createBasicExtensions = (_props) => {
2519
2905
  const props = defaultsDeep2({}, _props, defaultBasicOptions);
2520
2906
  return [
2521
2907
  // NOTE: Doesn't catch errors in keymap functions.
2522
- EditorView12.exceptionSink.of((err) => {
2908
+ EditorView15.exceptionSink.of((err) => {
2523
2909
  log5.catch(err, void 0, {
2524
2910
  F: __dxlog_file8,
2525
- L: 98,
2911
+ L: 100,
2526
2912
  S: void 0,
2527
2913
  C: (f, a) => f(...a)
2528
2914
  });
@@ -2534,18 +2920,22 @@ var createBasicExtensions = (_props) => {
2534
2920
  props.drawSelection && drawSelection({
2535
2921
  cursorBlinkRate: 1200
2536
2922
  }),
2537
- props.editable !== void 0 && EditorView12.editable.of(props.editable),
2923
+ props.editable !== void 0 && EditorView15.editable.of(props.editable),
2538
2924
  props.focus && focus,
2539
2925
  props.highlightActiveLine && highlightActiveLine(),
2540
2926
  props.history && history(),
2541
- props.lineNumbers && lineNumbers(),
2542
- props.lineWrapping && EditorView12.lineWrapping,
2543
- props.placeholder && placeholder(props.placeholder),
2927
+ props.lineNumbers && [
2928
+ lineNumbers(),
2929
+ editorGutter
2930
+ ],
2931
+ props.lineWrapping && EditorView15.lineWrapping,
2932
+ props.monospace && editorMonospace,
2933
+ props.placeholder && placeholder2(props.placeholder),
2544
2934
  props.readOnly !== void 0 && EditorState.readOnly.of(props.readOnly),
2545
2935
  props.scrollPastEnd && scrollPastEnd(),
2546
2936
  props.tabSize && EditorState.tabSize.of(props.tabSize),
2547
2937
  // https://codemirror.net/docs/ref/#view.KeyBinding
2548
- keymap7.of([
2938
+ keymap8.of([
2549
2939
  ...(props.keymap && keymaps[props.keymap]) ?? [],
2550
2940
  // NOTE: Tabs are also configured by markdown extension.
2551
2941
  // https://codemirror.net/docs/ref/#commands.indentWithTab
@@ -2576,17 +2966,17 @@ var defaultThemeSlots = {
2576
2966
  var createThemeExtensions = ({ themeMode, styles: styles4, syntaxHighlighting: _syntaxHighlighting, slots: _slots } = {}) => {
2577
2967
  const slots = defaultsDeep2({}, _slots, defaultThemeSlots);
2578
2968
  return [
2579
- EditorView12.darkTheme.of(themeMode === "dark"),
2580
- EditorView12.baseTheme(styles4 ? merge({}, defaultTheme, styles4) : defaultTheme),
2969
+ EditorView15.darkTheme.of(themeMode === "dark"),
2970
+ EditorView15.baseTheme(styles4 ? merge({}, defaultTheme, styles4) : defaultTheme),
2581
2971
  // https://github.com/codemirror/theme-one-dark
2582
2972
  _syntaxHighlighting && (themeMode === "dark" ? syntaxHighlighting(oneDarkHighlightStyle) : syntaxHighlighting(defaultHighlightStyle)),
2583
- slots.editor?.className && EditorView12.editorAttributes.of({
2973
+ slots.editor?.className && EditorView15.editorAttributes.of({
2584
2974
  class: slots.editor.className
2585
2975
  }),
2586
- slots.content?.className && EditorView12.contentAttributes.of({
2976
+ slots.content?.className && EditorView15.contentAttributes.of({
2587
2977
  class: slots.content.className
2588
2978
  }),
2589
- slots.scroll?.className && ViewPlugin8.fromClass(class {
2979
+ slots.scroll?.className && ViewPlugin10.fromClass(class {
2590
2980
  constructor(view) {
2591
2981
  view.scrollDOM.classList.add(slots.scroll.className);
2592
2982
  }
@@ -2617,7 +3007,7 @@ var createDataExtensions = ({ id, text, space, identity }) => {
2617
3007
 
2618
3008
  // packages/ui/react-ui-editor/src/extensions/folding.tsx
2619
3009
  import { codeFolding, foldGutter } from "@codemirror/language";
2620
- import { EditorView as EditorView13 } from "@codemirror/view";
3010
+ import { EditorView as EditorView16 } from "@codemirror/view";
2621
3011
  import React2 from "react";
2622
3012
  import { Icon } from "@dxos/react-ui";
2623
3013
  var folding = (_props = {}) => [
@@ -2641,7 +3031,7 @@ var folding = (_props = {}) => [
2641
3031
  }));
2642
3032
  }
2643
3033
  }),
2644
- EditorView13.theme({
3034
+ EditorView16.theme({
2645
3035
  ".cm-foldGutter": {
2646
3036
  opacity: 0.3,
2647
3037
  transition: "opacity 0.3s",
@@ -2654,27 +3044,27 @@ var folding = (_props = {}) => [
2654
3044
  ];
2655
3045
 
2656
3046
  // packages/ui/react-ui-editor/src/extensions/hashtag.tsx
2657
- import { Decoration as Decoration6, EditorView as EditorView14, MatchDecorator, ViewPlugin as ViewPlugin9, WidgetType as WidgetType3 } from "@codemirror/view";
2658
- import { getHashColor, mx as mx2 } from "@dxos/react-ui-theme";
2659
- var TagWidget = class extends WidgetType3 {
3047
+ import { Decoration as Decoration8, EditorView as EditorView17, MatchDecorator, ViewPlugin as ViewPlugin11, WidgetType as WidgetType4 } from "@codemirror/view";
3048
+ import { getHashColor, mx as mx3 } from "@dxos/react-ui-theme";
3049
+ var TagWidget = class extends WidgetType4 {
2660
3050
  constructor(_text) {
2661
3051
  super(), this._text = _text;
2662
3052
  }
2663
3053
  toDOM() {
2664
3054
  const span = document.createElement("span");
2665
- span.className = mx2("cm-tag", getHashColor(this._text).tag);
3055
+ span.className = mx3("cm-tag", getHashColor(this._text).tag);
2666
3056
  span.textContent = this._text;
2667
3057
  return span;
2668
3058
  }
2669
3059
  };
2670
3060
  var tagMatcher = new MatchDecorator({
2671
3061
  regexp: /#(\w+)\W/g,
2672
- decoration: (match) => Decoration6.replace({
3062
+ decoration: (match) => Decoration8.replace({
2673
3063
  widget: new TagWidget(match[1])
2674
3064
  })
2675
3065
  });
2676
3066
  var hashtag = () => [
2677
- ViewPlugin9.fromClass(class {
3067
+ ViewPlugin11.fromClass(class {
2678
3068
  constructor(view) {
2679
3069
  this.tags = tagMatcher.createDeco(view);
2680
3070
  }
@@ -2683,11 +3073,11 @@ var hashtag = () => [
2683
3073
  }
2684
3074
  }, {
2685
3075
  decorations: (instance) => instance.tags,
2686
- provide: (plugin) => EditorView14.atomicRanges.of((view) => {
2687
- return view.plugin(plugin)?.tags || Decoration6.none;
3076
+ provide: (plugin) => EditorView17.atomicRanges.of((view) => {
3077
+ return view.plugin(plugin)?.tags || Decoration8.none;
2688
3078
  })
2689
3079
  }),
2690
- EditorView14.theme({
3080
+ EditorView17.theme({
2691
3081
  ".cm-tag": {
2692
3082
  borderRadius: "4px",
2693
3083
  marginRight: "6px",
@@ -2742,14 +3132,14 @@ var schemaLinter = (validate) => (view) => {
2742
3132
  };
2743
3133
 
2744
3134
  // packages/ui/react-ui-editor/src/extensions/listener.ts
2745
- import { EditorView as EditorView15 } from "@codemirror/view";
3135
+ import { EditorView as EditorView18 } from "@codemirror/view";
2746
3136
  var listener = ({ onFocus, onChange }) => {
2747
3137
  const extensions = [];
2748
- onFocus && extensions.push(EditorView15.focusChangeEffect.of((_, focusing) => {
3138
+ onFocus && extensions.push(EditorView18.focusChangeEffect.of((_, focusing) => {
2749
3139
  onFocus(focusing);
2750
3140
  return null;
2751
3141
  }));
2752
- onChange && extensions.push(EditorView15.updateListener.of((update2) => {
3142
+ onChange && extensions.push(EditorView18.updateListener.of((update2) => {
2753
3143
  onChange(update2.state.doc.toString(), update2.state.facet(documentId));
2754
3144
  }));
2755
3145
  return extensions;
@@ -2759,8 +3149,8 @@ var listener = ({ onFocus, onChange }) => {
2759
3149
  import { snippet } from "@codemirror/autocomplete";
2760
3150
  import { syntaxTree as syntaxTree2 } from "@codemirror/language";
2761
3151
  import { EditorSelection as EditorSelection2 } from "@codemirror/state";
2762
- import { EditorView as EditorView16, keymap as keymap8 } from "@codemirror/view";
2763
- import { useMemo as useMemo2 } from "react";
3152
+ import { EditorView as EditorView19, keymap as keymap9 } from "@codemirror/view";
3153
+ import { useMemo as useMemo3 } from "react";
2764
3154
  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;
2765
3155
  var Inline = /* @__PURE__ */ function(Inline2) {
2766
3156
  Inline2[Inline2["Strong"] = 0] = "Strong";
@@ -3647,7 +4037,7 @@ var toggleCodeblock = (target) => {
3647
4037
  };
3648
4038
  var formattingKeymap = (_options = {}) => {
3649
4039
  return [
3650
- keymap8.of([
4040
+ keymap9.of([
3651
4041
  {
3652
4042
  key: "meta-b",
3653
4043
  run: toggleStrong
@@ -3848,7 +4238,7 @@ var getFormatting = (state) => {
3848
4238
  };
3849
4239
  };
3850
4240
  var useFormattingState = (state) => {
3851
- return useMemo2(() => EditorView16.updateListener.of((update2) => {
4241
+ return useMemo3(() => EditorView19.updateListener.of((update2) => {
3852
4242
  if (update2.docChanged || update2.selectionSet) {
3853
4243
  Object.entries(getFormatting(update2.state)).forEach(([key, active]) => {
3854
4244
  state[key] = active;
@@ -3912,8 +4302,7 @@ import { defaultKeymap as defaultKeymap2, indentWithTab as indentWithTab2 } from
3912
4302
  import { markdownLanguage as markdownLanguage3, markdown } from "@codemirror/lang-markdown";
3913
4303
  import { syntaxHighlighting as syntaxHighlighting2 } from "@codemirror/language";
3914
4304
  import { languages } from "@codemirror/language-data";
3915
- import { lintKeymap } from "@codemirror/lint";
3916
- import { keymap as keymap9 } from "@codemirror/view";
4305
+ import { keymap as keymap10 } from "@codemirror/view";
3917
4306
  import { isNotFalsy as isNotFalsy3 } from "@dxos/util";
3918
4307
 
3919
4308
  // packages/ui/react-ui-editor/src/extensions/markdown/highlight.ts
@@ -4120,21 +4509,20 @@ var createMarkdownExtensions = (options = {}) => {
4120
4509
  }),
4121
4510
  // Custom styles.
4122
4511
  syntaxHighlighting2(markdownHighlightStyle()),
4123
- keymap9.of([
4512
+ keymap10.of([
4124
4513
  // https://codemirror.net/docs/ref/#commands.indentWithTab
4125
4514
  options.indentWithTab !== false && indentWithTab2,
4126
4515
  // https://codemirror.net/docs/ref/#commands.defaultKeymap
4127
4516
  ...defaultKeymap2,
4128
- ...completionKeymap2,
4129
- ...lintKeymap
4517
+ ...completionKeymap2
4130
4518
  ].filter(isNotFalsy3))
4131
4519
  ];
4132
4520
  };
4133
4521
 
4134
4522
  // packages/ui/react-ui-editor/src/extensions/markdown/debug.ts
4135
4523
  import { syntaxTree as syntaxTree3 } from "@codemirror/language";
4136
- import { StateField as StateField6 } from "@codemirror/state";
4137
- var debugTree = (cb) => StateField6.define({
4524
+ import { StateField as StateField7 } from "@codemirror/state";
4525
+ var debugTree = (cb) => StateField7.define({
4138
4526
  create: (state) => cb(convertTreeToJson(state)),
4139
4527
  update: (value, tr) => cb(convertTreeToJson(tr.state))
4140
4528
  });
@@ -4160,17 +4548,17 @@ var convertTreeToJson = (state) => {
4160
4548
 
4161
4549
  // packages/ui/react-ui-editor/src/extensions/markdown/decorate.ts
4162
4550
  import { syntaxTree as syntaxTree7 } from "@codemirror/language";
4163
- import { RangeSetBuilder as RangeSetBuilder5, StateEffect as StateEffect5 } from "@codemirror/state";
4164
- import { EditorView as EditorView20, Decoration as Decoration9, WidgetType as WidgetType6, ViewPlugin as ViewPlugin11 } from "@codemirror/view";
4551
+ import { RangeSetBuilder as RangeSetBuilder6, StateEffect as StateEffect6 } from "@codemirror/state";
4552
+ import { EditorView as EditorView23, Decoration as Decoration11, WidgetType as WidgetType7, ViewPlugin as ViewPlugin13 } from "@codemirror/view";
4165
4553
  import { invariant as invariant4 } from "@dxos/invariant";
4166
- import { mx as mx3 } from "@dxos/react-ui-theme";
4554
+ import { mx as mx4 } from "@dxos/react-ui-theme";
4167
4555
 
4168
4556
  // packages/ui/react-ui-editor/src/extensions/markdown/changes.ts
4169
4557
  import { syntaxTree as syntaxTree4 } from "@codemirror/language";
4170
4558
  import { Transaction as Transaction2 } from "@codemirror/state";
4171
- import { ViewPlugin as ViewPlugin10 } from "@codemirror/view";
4559
+ import { ViewPlugin as ViewPlugin12 } from "@codemirror/view";
4172
4560
  var adjustChanges = () => {
4173
- return ViewPlugin10.fromClass(class {
4561
+ return ViewPlugin12.fromClass(class {
4174
4562
  update(update2) {
4175
4563
  const tree = syntaxTree4(update2.state);
4176
4564
  const adjustments = [];
@@ -4311,13 +4699,13 @@ var getValidUrl = (str) => {
4311
4699
 
4312
4700
  // packages/ui/react-ui-editor/src/extensions/markdown/image.ts
4313
4701
  import { syntaxTree as syntaxTree5 } from "@codemirror/language";
4314
- import { StateField as StateField7 } from "@codemirror/state";
4315
- import { Decoration as Decoration7, EditorView as EditorView17, WidgetType as WidgetType4 } from "@codemirror/view";
4702
+ import { StateField as StateField8 } from "@codemirror/state";
4703
+ import { Decoration as Decoration9, EditorView as EditorView20, WidgetType as WidgetType5 } from "@codemirror/view";
4316
4704
  var image = (_options = {}) => {
4317
4705
  return [
4318
- StateField7.define({
4706
+ StateField8.define({
4319
4707
  create: (state) => {
4320
- return Decoration7.set(buildDecorations(0, state.doc.length, state));
4708
+ return Decoration9.set(buildDecorations(0, state.doc.length, state));
4321
4709
  },
4322
4710
  update: (value, tr) => {
4323
4711
  if (!tr.docChanged && !tr.selection) {
@@ -4340,7 +4728,7 @@ var image = (_options = {}) => {
4340
4728
  add: buildDecorations(from, to, tr.state)
4341
4729
  });
4342
4730
  },
4343
- provide: (field) => EditorView17.decorations.from(field)
4731
+ provide: (field) => EditorView20.decorations.from(field)
4344
4732
  })
4345
4733
  ];
4346
4734
  };
@@ -4358,7 +4746,7 @@ var buildDecorations = (from, to, state) => {
4358
4746
  return;
4359
4747
  }
4360
4748
  preloadImage(url);
4361
- decorations2.push(Decoration7.replace({
4749
+ decorations2.push(Decoration9.replace({
4362
4750
  block: true,
4363
4751
  widget: new ImageWidget(url)
4364
4752
  }).range(hide2 ? node.from : node.to, node.to));
@@ -4378,7 +4766,7 @@ var preloadImage = (url) => {
4378
4766
  preloaded.add(url);
4379
4767
  }
4380
4768
  };
4381
- var ImageWidget = class extends WidgetType4 {
4769
+ var ImageWidget = class extends WidgetType5 {
4382
4770
  constructor(_url) {
4383
4771
  super(), this._url = _url;
4384
4772
  }
@@ -4399,10 +4787,10 @@ var ImageWidget = class extends WidgetType4 {
4399
4787
  };
4400
4788
 
4401
4789
  // packages/ui/react-ui-editor/src/extensions/markdown/styles.ts
4402
- import { EditorView as EditorView18 } from "@codemirror/view";
4790
+ import { EditorView as EditorView21 } from "@codemirror/view";
4403
4791
  var bulletListIndentationWidth = 24;
4404
4792
  var orderedListIndentationWidth = 36;
4405
- var formattingStyles = EditorView18.theme({
4793
+ var formattingStyles = EditorView21.theme({
4406
4794
  /**
4407
4795
  * Horizontal rule.
4408
4796
  */
@@ -4523,17 +4911,17 @@ var formattingStyles = EditorView18.theme({
4523
4911
 
4524
4912
  // packages/ui/react-ui-editor/src/extensions/markdown/table.ts
4525
4913
  import { syntaxTree as syntaxTree6 } from "@codemirror/language";
4526
- import { RangeSetBuilder as RangeSetBuilder4, StateField as StateField8 } from "@codemirror/state";
4527
- import { Decoration as Decoration8, EditorView as EditorView19, WidgetType as WidgetType5 } from "@codemirror/view";
4914
+ import { RangeSetBuilder as RangeSetBuilder5, StateField as StateField9 } from "@codemirror/state";
4915
+ import { Decoration as Decoration10, EditorView as EditorView22, WidgetType as WidgetType6 } from "@codemirror/view";
4528
4916
  var table = (options = {}) => {
4529
- return StateField8.define({
4917
+ return StateField9.define({
4530
4918
  create: (state) => update(state, options),
4531
4919
  update: (_, tr) => update(tr.state, options),
4532
- provide: (field) => EditorView19.decorations.from(field)
4920
+ provide: (field) => EditorView22.decorations.from(field)
4533
4921
  });
4534
4922
  };
4535
4923
  var update = (state, _options) => {
4536
- const builder = new RangeSetBuilder4();
4924
+ const builder = new RangeSetBuilder5();
4537
4925
  const cursor = state.selection.main.head;
4538
4926
  const tables = [];
4539
4927
  const getTable = () => tables[tables.length - 1];
@@ -4574,19 +4962,19 @@ var update = (state, _options) => {
4574
4962
  tables.forEach((table2) => {
4575
4963
  const replace = state.readOnly || cursor < table2.from || cursor > table2.to;
4576
4964
  if (replace) {
4577
- builder.add(table2.from, table2.to, Decoration8.replace({
4965
+ builder.add(table2.from, table2.to, Decoration10.replace({
4578
4966
  block: true,
4579
4967
  widget: new TableWidget(table2)
4580
4968
  }));
4581
4969
  } else {
4582
- builder.add(table2.from, table2.to, Decoration8.mark({
4970
+ builder.add(table2.from, table2.to, Decoration10.mark({
4583
4971
  class: "cm-table"
4584
4972
  }));
4585
4973
  }
4586
4974
  });
4587
4975
  return builder.finish();
4588
4976
  };
4589
- var TableWidget = class extends WidgetType5 {
4977
+ var TableWidget = class extends WidgetType6 {
4590
4978
  constructor(_table) {
4591
4979
  super(), this._table = _table;
4592
4980
  }
@@ -4627,14 +5015,14 @@ var Unicode = {
4627
5015
  bulletSmall: "\u2219",
4628
5016
  bulletSquare: "\u2B1D"
4629
5017
  };
4630
- var HorizontalRuleWidget = class extends WidgetType6 {
5018
+ var HorizontalRuleWidget = class extends WidgetType7 {
4631
5019
  toDOM() {
4632
5020
  const el = document.createElement("span");
4633
5021
  el.className = "cm-hr";
4634
5022
  return el;
4635
5023
  }
4636
5024
  };
4637
- var LinkButton = class extends WidgetType6 {
5025
+ var LinkButton = class extends WidgetType7 {
4638
5026
  constructor(url, render) {
4639
5027
  super(), this.url = url, this.render = render;
4640
5028
  }
@@ -4650,7 +5038,7 @@ var LinkButton = class extends WidgetType6 {
4650
5038
  return el;
4651
5039
  }
4652
5040
  };
4653
- var CheckboxWidget = class extends WidgetType6 {
5041
+ var CheckboxWidget = class extends WidgetType7 {
4654
5042
  constructor(_checked) {
4655
5043
  super(), this._checked = _checked;
4656
5044
  }
@@ -4694,7 +5082,7 @@ var CheckboxWidget = class extends WidgetType6 {
4694
5082
  return false;
4695
5083
  }
4696
5084
  };
4697
- var TextWidget = class extends WidgetType6 {
5085
+ var TextWidget = class extends WidgetType7 {
4698
5086
  constructor(text, className) {
4699
5087
  super(), this.text = text, this.className = className;
4700
5088
  }
@@ -4707,29 +5095,29 @@ var TextWidget = class extends WidgetType6 {
4707
5095
  return el;
4708
5096
  }
4709
5097
  };
4710
- var hide = Decoration9.replace({});
4711
- var blockQuote = Decoration9.line({
5098
+ var hide = Decoration11.replace({});
5099
+ var blockQuote = Decoration11.line({
4712
5100
  class: "cm-blockquote"
4713
5101
  });
4714
- var fencedCodeLine = Decoration9.line({
5102
+ var fencedCodeLine = Decoration11.line({
4715
5103
  class: "cm-code cm-codeblock-line"
4716
5104
  });
4717
- var fencedCodeLineFirst = Decoration9.line({
4718
- class: mx3("cm-code cm-codeblock-line", "cm-codeblock-start")
5105
+ var fencedCodeLineFirst = Decoration11.line({
5106
+ class: mx4("cm-code cm-codeblock-line", "cm-codeblock-start")
4719
5107
  });
4720
- var fencedCodeLineLast = Decoration9.line({
4721
- class: mx3("cm-code cm-codeblock-line", "cm-codeblock-end")
5108
+ var fencedCodeLineLast = Decoration11.line({
5109
+ class: mx4("cm-code cm-codeblock-line", "cm-codeblock-end")
4722
5110
  });
4723
5111
  var commentBlockLine = fencedCodeLine;
4724
5112
  var commentBlockLineFirst = fencedCodeLineFirst;
4725
5113
  var commentBlockLineLast = fencedCodeLineLast;
4726
- var horizontalRule = Decoration9.replace({
5114
+ var horizontalRule = Decoration11.replace({
4727
5115
  widget: new HorizontalRuleWidget()
4728
5116
  });
4729
- var checkedTask = Decoration9.replace({
5117
+ var checkedTask = Decoration11.replace({
4730
5118
  widget: new CheckboxWidget(true)
4731
5119
  });
4732
- var uncheckedTask = Decoration9.replace({
5120
+ var uncheckedTask = Decoration11.replace({
4733
5121
  widget: new CheckboxWidget(false)
4734
5122
  });
4735
5123
  var editingRange = (state, range, focus2) => {
@@ -4745,8 +5133,8 @@ var autoHideTags = /* @__PURE__ */ new Set([
4745
5133
  "SuperscriptMark"
4746
5134
  ]);
4747
5135
  var buildDecorations2 = (view, options, focus2) => {
4748
- const deco = new RangeSetBuilder5();
4749
- const atomicDeco = new RangeSetBuilder5();
5136
+ const deco = new RangeSetBuilder6();
5137
+ const atomicDeco = new RangeSetBuilder6();
4750
5138
  const { state } = view;
4751
5139
  const headerLevels = [];
4752
5140
  const getHeaderLevels = (node, level) => {
@@ -4833,7 +5221,7 @@ var buildDecorations2 = (view, options, focus2) => {
4833
5221
  } else {
4834
5222
  const num = headers.slice(from - 1).map((level2) => level2?.number ?? 0).join(".") + " ";
4835
5223
  if (num.length) {
4836
- atomicDeco.add(mark.from, mark.from + len, Decoration9.replace({
5224
+ atomicDeco.add(mark.from, mark.from + len, Decoration11.replace({
4837
5225
  widget: new TextWidget(num, theme.heading(level))
4838
5226
  }));
4839
5227
  }
@@ -4858,7 +5246,7 @@ var buildDecorations2 = (view, options, focus2) => {
4858
5246
  if (node.from === line.to - 1) {
4859
5247
  return false;
4860
5248
  }
4861
- deco.add(line.from, line.from, Decoration9.line({
5249
+ deco.add(line.from, line.from, Decoration11.line({
4862
5250
  class: "cm-list-item",
4863
5251
  attributes: {
4864
5252
  style: `padding-left: ${offset}px; text-indent: -${width}px;`
@@ -4875,7 +5263,7 @@ var buildDecorations2 = (view, options, focus2) => {
4875
5263
  const label = list.type === "OrderedList" ? `${++list.number}.` : Unicode.bulletSmall;
4876
5264
  const line = state.doc.lineAt(node.from);
4877
5265
  const to = state.doc.sliceString(node.to, node.to + 1) === " " ? node.to + 1 : node.to;
4878
- atomicDeco.add(line.from, to, Decoration9.replace({
5266
+ atomicDeco.add(line.from, to, Decoration11.replace({
4879
5267
  widget: new TextWidget(label, list.type === "OrderedList" ? "cm-list-mark cm-list-mark-ordered" : "cm-list-mark cm-list-mark-bullet")
4880
5268
  }));
4881
5269
  break;
@@ -4962,7 +5350,7 @@ var buildDecorations2 = (view, options, focus2) => {
4962
5350
  if (!editing) {
4963
5351
  atomicDeco.add(node.from, marks[0].to, hide);
4964
5352
  }
4965
- deco.add(marks[0].to, marks[1].from, Decoration9.mark({
5353
+ deco.add(marks[0].to, marks[1].from, Decoration11.mark({
4966
5354
  tagName: "a",
4967
5355
  attributes: {
4968
5356
  class: "cm-link",
@@ -4972,7 +5360,7 @@ var buildDecorations2 = (view, options, focus2) => {
4972
5360
  }
4973
5361
  }));
4974
5362
  if (!editing) {
4975
- atomicDeco.add(marks[1].from, node.to, options.renderLinkButton ? Decoration9.replace({
5363
+ atomicDeco.add(marks[1].from, node.to, options.renderLinkButton ? Decoration11.replace({
4976
5364
  widget: new LinkButton(url, options.renderLinkButton)
4977
5365
  }) : hide);
4978
5366
  }
@@ -5027,10 +5415,10 @@ var buildDecorations2 = (view, options, focus2) => {
5027
5415
  atomicDeco: atomicDeco.finish()
5028
5416
  };
5029
5417
  };
5030
- var forceUpdate = StateEffect5.define();
5418
+ var forceUpdate = StateEffect6.define();
5031
5419
  var decorateMarkdown = (options = {}) => {
5032
5420
  return [
5033
- ViewPlugin11.fromClass(class {
5421
+ ViewPlugin13.fromClass(class {
5034
5422
  constructor(view) {
5035
5423
  ({ deco: this.deco, atomicDeco: this.atomicDeco } = buildDecorations2(view, options, view.hasFocus));
5036
5424
  }
@@ -5062,9 +5450,9 @@ var decorateMarkdown = (options = {}) => {
5062
5450
  }
5063
5451
  }, {
5064
5452
  provide: (plugin) => [
5065
- EditorView20.atomicRanges.of((view) => view.plugin(plugin)?.atomicDeco ?? Decoration9.none),
5066
- EditorView20.decorations.of((view) => view.plugin(plugin)?.atomicDeco ?? Decoration9.none),
5067
- EditorView20.decorations.of((view) => view.plugin(plugin)?.deco ?? Decoration9.none)
5453
+ EditorView23.atomicRanges.of((view) => view.plugin(plugin)?.atomicDeco ?? Decoration11.none),
5454
+ EditorView23.decorations.of((view) => view.plugin(plugin)?.atomicDeco ?? Decoration11.none),
5455
+ EditorView23.decorations.of((view) => view.plugin(plugin)?.deco ?? Decoration11.none)
5068
5456
  ]
5069
5457
  }),
5070
5458
  image(),
@@ -5155,7 +5543,7 @@ var mention = ({ debug, onSearch }) => {
5155
5543
  };
5156
5544
 
5157
5545
  // packages/ui/react-ui-editor/src/extensions/modes.ts
5158
- import { keymap as keymap10 } from "@codemirror/view";
5546
+ import { keymap as keymap11 } from "@codemirror/view";
5159
5547
  import { vim } from "@replit/codemirror-vim";
5160
5548
  import { vscodeKeymap } from "@replit/codemirror-vscode-keymap";
5161
5549
  import { Schema } from "effect";
@@ -5179,7 +5567,7 @@ var InputModeExtensions = {
5179
5567
  editorInputMode.of({
5180
5568
  type: "vscode"
5181
5569
  }),
5182
- keymap10.of(vscodeKeymap)
5570
+ keymap11.of(vscodeKeymap)
5183
5571
  ],
5184
5572
  vim: [
5185
5573
  // https://github.com/replit/codemirror-vim
@@ -5188,7 +5576,7 @@ var InputModeExtensions = {
5188
5576
  type: "vim",
5189
5577
  noTabster: true
5190
5578
  }),
5191
- keymap10.of([
5579
+ keymap11.of([
5192
5580
  {
5193
5581
  key: "Alt-Escape",
5194
5582
  run: (view) => {
@@ -5204,14 +5592,14 @@ var InputModeExtensions = {
5204
5592
  import { indentMore } from "@codemirror/commands";
5205
5593
  import { getIndentUnit } from "@codemirror/language";
5206
5594
  import { EditorSelection as EditorSelection3 } from "@codemirror/state";
5207
- import { keymap as keymap11 } from "@codemirror/view";
5595
+ import { keymap as keymap12 } from "@codemirror/view";
5208
5596
 
5209
5597
  // packages/ui/react-ui-editor/src/extensions/outliner/selection.ts
5210
5598
  import { Compartment, Facet as Facet3 } from "@codemirror/state";
5211
5599
 
5212
5600
  // packages/ui/react-ui-editor/src/extensions/outliner/tree.ts
5213
5601
  import { syntaxTree as syntaxTree9 } from "@codemirror/language";
5214
- import { StateField as StateField9 } from "@codemirror/state";
5602
+ import { StateField as StateField10 } from "@codemirror/state";
5215
5603
  import { Facet as Facet2 } from "@codemirror/state";
5216
5604
  import { invariant as invariant5 } from "@dxos/invariant";
5217
5605
  var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/outliner/tree.ts";
@@ -5309,6 +5697,7 @@ var traverse = (root, cb) => {
5309
5697
  return value;
5310
5698
  }
5311
5699
  }
5700
+ return void 0;
5312
5701
  };
5313
5702
  return t(root, root.type === "root" ? -1 : 0);
5314
5703
  };
@@ -5366,7 +5755,7 @@ var outlinerTree = (options = {}) => {
5366
5755
  case "BulletList": {
5367
5756
  invariant5(current, void 0, {
5368
5757
  F: __dxlog_file11,
5369
- L: 217,
5758
+ L: 219,
5370
5759
  S: void 0,
5371
5760
  A: [
5372
5761
  "current",
@@ -5383,7 +5772,7 @@ var outlinerTree = (options = {}) => {
5383
5772
  case "ListItem": {
5384
5773
  invariant5(parent, void 0, {
5385
5774
  F: __dxlog_file11,
5386
- L: 226,
5775
+ L: 228,
5387
5776
  S: void 0,
5388
5777
  A: [
5389
5778
  "parent",
@@ -5425,7 +5814,7 @@ var outlinerTree = (options = {}) => {
5425
5814
  case "ListMark": {
5426
5815
  invariant5(current, void 0, {
5427
5816
  F: __dxlog_file11,
5428
- L: 270,
5817
+ L: 272,
5429
5818
  S: void 0,
5430
5819
  A: [
5431
5820
  "current",
@@ -5439,7 +5828,7 @@ var outlinerTree = (options = {}) => {
5439
5828
  case "Task": {
5440
5829
  invariant5(current, void 0, {
5441
5830
  F: __dxlog_file11,
5442
- L: 276,
5831
+ L: 278,
5443
5832
  S: void 0,
5444
5833
  A: [
5445
5834
  "current",
@@ -5452,7 +5841,7 @@ var outlinerTree = (options = {}) => {
5452
5841
  case "TaskMarker": {
5453
5842
  invariant5(current, void 0, {
5454
5843
  F: __dxlog_file11,
5455
- L: 281,
5844
+ L: 283,
5456
5845
  S: void 0,
5457
5846
  A: [
5458
5847
  "current",
@@ -5468,7 +5857,7 @@ var outlinerTree = (options = {}) => {
5468
5857
  if (node.name === "BulletList") {
5469
5858
  invariant5(parent, void 0, {
5470
5859
  F: __dxlog_file11,
5471
- L: 289,
5860
+ L: 291,
5472
5861
  S: void 0,
5473
5862
  A: [
5474
5863
  "parent",
@@ -5482,7 +5871,7 @@ var outlinerTree = (options = {}) => {
5482
5871
  });
5483
5872
  invariant5(tree, void 0, {
5484
5873
  F: __dxlog_file11,
5485
- L: 296,
5874
+ L: 298,
5486
5875
  S: void 0,
5487
5876
  A: [
5488
5877
  "tree",
@@ -5492,7 +5881,7 @@ var outlinerTree = (options = {}) => {
5492
5881
  return tree;
5493
5882
  };
5494
5883
  return [
5495
- StateField9.define({
5884
+ StateField10.define({
5496
5885
  create: (state) => {
5497
5886
  return buildTree(state);
5498
5887
  },
@@ -5666,7 +6055,7 @@ var toggleTask = (view) => {
5666
6055
  }
5667
6056
  return true;
5668
6057
  };
5669
- var commands = () => keymap11.of([
6058
+ var commands = () => keymap12.of([
5670
6059
  //
5671
6060
  // Indentation.
5672
6061
  //
@@ -5772,18 +6161,18 @@ var commands = () => keymap11.of([
5772
6161
  ]);
5773
6162
 
5774
6163
  // packages/ui/react-ui-editor/src/extensions/outliner/outliner.ts
5775
- import { Prec as Prec2 } from "@codemirror/state";
5776
- import { Decoration as Decoration10, EditorView as EditorView21, ViewPlugin as ViewPlugin13 } from "@codemirror/view";
5777
- import { mx as mx4 } from "@dxos/react-ui-theme";
6164
+ import { Prec as Prec4 } from "@codemirror/state";
6165
+ import { Decoration as Decoration12, EditorView as EditorView24, ViewPlugin as ViewPlugin15 } from "@codemirror/view";
6166
+ import { mx as mx5 } from "@dxos/react-ui-theme";
5778
6167
 
5779
6168
  // packages/ui/react-ui-editor/src/extensions/outliner/editor.ts
5780
6169
  import { EditorSelection as EditorSelection4, EditorState as EditorState2 } from "@codemirror/state";
5781
- import { ViewPlugin as ViewPlugin12 } from "@codemirror/view";
6170
+ import { ViewPlugin as ViewPlugin14 } from "@codemirror/view";
5782
6171
  import { log as log7 } from "@dxos/log";
5783
6172
  var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/outliner/editor.ts";
5784
6173
  var LIST_ITEM_REGEX = /^\s*- (\[ \]|\[x\])? /;
5785
6174
  var initialize = () => {
5786
- return ViewPlugin12.fromClass(class {
6175
+ return ViewPlugin14.fromClass(class {
5787
6176
  constructor(view) {
5788
6177
  const first = view.state.doc.lineAt(0);
5789
6178
  const text = view.state.sliceDoc(first.from, first.to);
@@ -5968,7 +6357,7 @@ var editor = () => [
5968
6357
  // packages/ui/react-ui-editor/src/extensions/outliner/outliner.ts
5969
6358
  var outliner = (options = {}) => [
5970
6359
  // Commands.
5971
- Prec2.highest(commands()),
6360
+ Prec4.highest(commands()),
5972
6361
  // Selection.
5973
6362
  selectionCompartment.of(selectionFacet.of([])),
5974
6363
  // State.
@@ -5984,14 +6373,14 @@ var outliner = (options = {}) => [
5984
6373
  listPaddingLeft: 8
5985
6374
  }),
5986
6375
  // Researve space for menu.
5987
- EditorView21.contentAttributes.of({
6376
+ EditorView24.contentAttributes.of({
5988
6377
  class: "is-full !mr-[3rem]"
5989
6378
  })
5990
6379
  ];
5991
6380
  var decorations = () => [
5992
- ViewPlugin13.fromClass(class {
6381
+ ViewPlugin15.fromClass(class {
5993
6382
  constructor(view) {
5994
- this.decorations = Decoration10.none;
6383
+ this.decorations = Decoration12.none;
5995
6384
  this.updateDecorations(view.state, view);
5996
6385
  }
5997
6386
  update(update2) {
@@ -6013,18 +6402,18 @@ var decorations = () => [
6013
6402
  const lineFrom = doc.lineAt(item.contentRange.from);
6014
6403
  const lineTo = doc.lineAt(item.contentRange.to);
6015
6404
  const isSelected = selection.includes(item.index) || item === current;
6016
- decorations2.push(Decoration10.line({
6017
- class: mx4("cm-list-item", lineFrom.number === line.number && "cm-list-item-start", lineTo.number === line.number && "cm-list-item-end", isSelected && (hasFocus ? "cm-list-item-focused" : "cm-list-item-selected"))
6405
+ decorations2.push(Decoration12.line({
6406
+ class: mx5("cm-list-item", lineFrom.number === line.number && "cm-list-item-start", lineTo.number === line.number && "cm-list-item-end", isSelected && (hasFocus ? "cm-list-item-focused" : "cm-list-item-selected"))
6018
6407
  }).range(line.from, line.from));
6019
6408
  }
6020
6409
  }
6021
- this.decorations = Decoration10.set(decorations2);
6410
+ this.decorations = Decoration12.set(decorations2);
6022
6411
  }
6023
6412
  }, {
6024
6413
  decorations: (v) => v.decorations
6025
6414
  }),
6026
6415
  // Theme.
6027
- EditorView21.theme(Object.assign({
6416
+ EditorView24.theme(Object.assign({
6028
6417
  ".cm-list-item": {
6029
6418
  borderLeftWidth: "1px",
6030
6419
  borderRightWidth: "1px",
@@ -6053,9 +6442,6 @@ var decorations = () => [
6053
6442
  },
6054
6443
  "[data-has-focus] & .cm-list-item-selected": {
6055
6444
  borderColor: "var(--dx-separator)"
6056
- },
6057
- "[data-is-attention-source] & .cm-list-item-selected": {
6058
- borderColor: "var(--dx-separator)"
6059
6445
  }
6060
6446
  }))
6061
6447
  ];
@@ -6063,29 +6449,19 @@ var decorations = () => [
6063
6449
  // packages/ui/react-ui-editor/src/extensions/preview/preview.ts
6064
6450
  import "@dxos/lit-ui/dx-ref-tag.pcss";
6065
6451
  import { syntaxTree as syntaxTree10 } from "@codemirror/language";
6066
- import { RangeSetBuilder as RangeSetBuilder6, StateField as StateField10 } from "@codemirror/state";
6067
- import { Decoration as Decoration11, EditorView as EditorView22, WidgetType as WidgetType7 } from "@codemirror/view";
6452
+ import { RangeSetBuilder as RangeSetBuilder7, StateField as StateField11 } from "@codemirror/state";
6453
+ import { Decoration as Decoration13, EditorView as EditorView25, WidgetType as WidgetType8 } from "@codemirror/view";
6068
6454
  var preview = (options = {}) => {
6069
6455
  return [
6070
6456
  // NOTE: Atomic block decorations must be created from a state field, now a widget, otherwise it results in the following error:
6071
6457
  // "Block decorations may not be specified via plugins"
6072
- StateField10.define({
6458
+ StateField11.define({
6073
6459
  create: (state) => buildDecorations3(state, options),
6074
6460
  update: (_, tr) => buildDecorations3(tr.state, options),
6075
6461
  provide: (field) => [
6076
- EditorView22.decorations.from(field),
6077
- EditorView22.atomicRanges.of((view) => view.state.field(field))
6462
+ EditorView25.decorations.from(field),
6463
+ EditorView25.atomicRanges.of((view) => view.state.field(field))
6078
6464
  ]
6079
- }),
6080
- EditorView22.theme({
6081
- ".cm-preview-block": {
6082
- marginLeft: "-1rem",
6083
- marginRight: "-1rem",
6084
- padding: "1rem",
6085
- borderRadius: "0.5rem",
6086
- background: "var(--dx-modalSurface)",
6087
- border: "1px solid var(--dx-separator)"
6088
- }
6089
6465
  })
6090
6466
  ];
6091
6467
  };
@@ -6103,7 +6479,7 @@ var getLinkRef = (state, node) => {
6103
6479
  }
6104
6480
  };
6105
6481
  var buildDecorations3 = (state, options) => {
6106
- const builder = new RangeSetBuilder6();
6482
+ const builder = new RangeSetBuilder7();
6107
6483
  syntaxTree10(state).iterate({
6108
6484
  enter: (node) => {
6109
6485
  switch (node.name) {
@@ -6114,7 +6490,7 @@ var buildDecorations3 = (state, options) => {
6114
6490
  case "Link": {
6115
6491
  const link = getLinkRef(state, node.node);
6116
6492
  if (link) {
6117
- builder.add(node.from, node.to, Decoration11.replace({
6493
+ builder.add(node.from, node.to, Decoration13.replace({
6118
6494
  widget: new PreviewInlineWidget(options, link)
6119
6495
  }));
6120
6496
  }
@@ -6126,8 +6502,8 @@ var buildDecorations3 = (state, options) => {
6126
6502
  //
6127
6503
  case "Image": {
6128
6504
  const link = getLinkRef(state, node.node);
6129
- if (options.renderBlock && link) {
6130
- builder.add(node.from, node.to, Decoration11.replace({
6505
+ if (options.addBlockContainer && options.removeBlockContainer && link) {
6506
+ builder.add(node.from, node.to, Decoration13.replace({
6131
6507
  block: true,
6132
6508
  // atomic: true,
6133
6509
  widget: new PreviewBlockWidget(options, link)
@@ -6140,7 +6516,7 @@ var buildDecorations3 = (state, options) => {
6140
6516
  });
6141
6517
  return builder.finish();
6142
6518
  };
6143
- var PreviewInlineWidget = class extends WidgetType7 {
6519
+ var PreviewInlineWidget = class extends WidgetType8 {
6144
6520
  constructor(_options, _link) {
6145
6521
  super(), this._options = _options, this._link = _link;
6146
6522
  }
@@ -6157,7 +6533,7 @@ var PreviewInlineWidget = class extends WidgetType7 {
6157
6533
  return root;
6158
6534
  }
6159
6535
  };
6160
- var PreviewBlockWidget = class extends WidgetType7 {
6536
+ var PreviewBlockWidget = class extends WidgetType8 {
6161
6537
  constructor(_options, _link) {
6162
6538
  super(), this._options = _options, this._link = _link;
6163
6539
  }
@@ -6169,54 +6545,17 @@ var PreviewBlockWidget = class extends WidgetType7 {
6169
6545
  }
6170
6546
  toDOM(view) {
6171
6547
  const root = document.createElement("div");
6172
- root.classList.add("cm-preview-block");
6173
- const handleAction = (action) => {
6174
- const pos = view.posAtDOM(root);
6175
- const node = syntaxTree10(view.state).resolve(pos + 1).node.parent;
6176
- if (!node) {
6177
- return;
6178
- }
6179
- const link = getLinkRef(view.state, node);
6180
- if (link?.ref !== action.link.ref) {
6181
- return;
6182
- }
6183
- switch (action.type) {
6184
- // TODO(burdon): Should we dispatch to the view or mutate the document? (i.e., handle externally?)
6185
- // Insert ref text.
6186
- case "insert": {
6187
- view.dispatch({
6188
- changes: {
6189
- from: node.from,
6190
- to: node.to,
6191
- insert: action.target.text
6192
- }
6193
- });
6194
- break;
6195
- }
6196
- // Remove ref.
6197
- case "delete": {
6198
- view.dispatch({
6199
- changes: {
6200
- from: node.from,
6201
- to: node.to
6202
- }
6203
- });
6204
- break;
6205
- }
6206
- }
6207
- };
6208
- this._options.renderBlock(root, {
6209
- readonly: view.state.readOnly,
6210
- link: this._link,
6211
- onAction: handleAction,
6212
- onLookup: this._options.onLookup
6213
- }, view);
6548
+ root.classList.add("cm-preview-block", "density-coarse");
6549
+ this._options.addBlockContainer?.(this._link, root);
6214
6550
  return root;
6215
6551
  }
6552
+ destroy() {
6553
+ this._options.removeBlockContainer?.(this._link);
6554
+ }
6216
6555
  };
6217
6556
 
6218
6557
  // packages/ui/react-ui-editor/src/extensions/typewriter.ts
6219
- import { keymap as keymap12 } from "@codemirror/view";
6558
+ import { keymap as keymap13 } from "@codemirror/view";
6220
6559
  var defaultItems = [
6221
6560
  "hello world!",
6222
6561
  "this is a test.",
@@ -6226,7 +6565,7 @@ var typewriter = ({ delay = 75, items = defaultItems } = {}) => {
6226
6565
  let t;
6227
6566
  let idx = 0;
6228
6567
  return [
6229
- keymap12.of([
6568
+ keymap13.of([
6230
6569
  {
6231
6570
  // Reset.
6232
6571
  key: "alt-meta-'",
@@ -6569,32 +6908,6 @@ var createViewMode = (state, onViewModeChange) => {
6569
6908
  };
6570
6909
  };
6571
6910
 
6572
- // packages/ui/react-ui-editor/src/defaults.ts
6573
- import { EditorView as EditorView23 } from "@codemirror/view";
6574
- import { mx as mx5 } from "@dxos/react-ui-theme";
6575
- var editorWidth = "!mli-auto is-full max-is-[min(50rem,100%-4rem)]";
6576
- var editorSlots = {
6577
- scroll: {
6578
- className: "pbs-2"
6579
- },
6580
- content: {
6581
- className: editorWidth
6582
- }
6583
- };
6584
- var editorGutter = EditorView23.theme({
6585
- ".cm-gutters": {
6586
- paddingRight: "1rem"
6587
- }
6588
- });
6589
- var editorMonospace = EditorView23.theme({
6590
- ".cm-content": {
6591
- fontFamily: fontMono
6592
- }
6593
- });
6594
- var editorWithToolbarLayout = "grid grid-cols-1 grid-rows-[min-content_1fr] data-[toolbar=disabled]:grid-rows-[1fr] justify-center content-start overflow-hidden";
6595
- var stackItemContentEditorClassNames = (role) => mx5("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");
6596
- var stackItemContentToolbarClassNames = (role) => mx5("relative z-[1] flex is-full bg-toolbarSurface border-be border-subduedSeparator", role === "section" && "sticky block-start-0 -mbe-px min-is-0");
6597
-
6598
6911
  // packages/ui/react-ui-editor/src/components/EditorToolbar/EditorToolbar.tsx
6599
6912
  var createToolbar = ({ getView, state, customActions, ...features }) => {
6600
6913
  return Rx.make((get2) => {
@@ -6650,7 +6963,7 @@ var createToolbar = ({ getView, state, customActions, ...features }) => {
6650
6963
  });
6651
6964
  };
6652
6965
  var useEditorToolbarActionGraph = (props) => {
6653
- const menuCreator = useMemo3(() => createToolbar({
6966
+ const menuCreator = useMemo4(() => createToolbar({
6654
6967
  getView: props.getView,
6655
6968
  state: props.state,
6656
6969
  customActions: props.customActions,
@@ -6679,45 +6992,332 @@ var EditorToolbar = /* @__PURE__ */ memo(({ classNames, attendableId, role, ...p
6679
6992
  var _effect = _useSignals();
6680
6993
  try {
6681
6994
  const menuProps = useEditorToolbarActionGraph(props);
6682
- return /* @__PURE__ */ React3.createElement("div", {
6683
- role: "none",
6684
- className: stackItemContentToolbarClassNames(role)
6685
- }, /* @__PURE__ */ React3.createElement(ElevationProvider, {
6995
+ return /* @__PURE__ */ React3.createElement(ElevationProvider, {
6686
6996
  elevation: role === "section" ? "positioned" : "base"
6687
6997
  }, /* @__PURE__ */ React3.createElement(MenuProvider, {
6688
6998
  ...menuProps,
6689
6999
  attendableId
6690
7000
  }, /* @__PURE__ */ React3.createElement(ToolbarMenu, {
6691
- classNames: [
6692
- textBlockWidth,
6693
- classNames
6694
- ]
6695
- }))));
7001
+ classNames,
7002
+ textBlockWidth: true
7003
+ })));
6696
7004
  } finally {
6697
7005
  _effect.f();
6698
7006
  }
6699
7007
  });
6700
7008
 
6701
- // packages/ui/react-ui-editor/src/components/Popover/RefPopover.tsx
7009
+ // packages/ui/react-ui-editor/src/components/Popover/CommandMenu.tsx
6702
7010
  import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
7011
+ import React4, { useCallback as useCallback2, useEffect as useEffect2, useRef as useRef2 } from "react";
7012
+ import { Icon as Icon2, Popover, toLocalizedString, useThemeContext, useTranslation } from "@dxos/react-ui";
7013
+ var CommandMenu = ({ groups, currentItem, onSelect }) => {
7014
+ var _effect = _useSignals2();
7015
+ try {
7016
+ const { tx } = useThemeContext();
7017
+ const groupsWithItems = groups.filter((group) => group.items.length > 0);
7018
+ return /* @__PURE__ */ React4.createElement(Popover.Portal, null, /* @__PURE__ */ React4.createElement(Popover.Content, {
7019
+ align: "start",
7020
+ onOpenAutoFocus: (event) => event.preventDefault(),
7021
+ classNames: tx("menu.content", "menu--exotic-unfocusable", {
7022
+ elevation: "positioned"
7023
+ }, [
7024
+ "max-h-[300px] overflow-y-auto"
7025
+ ])
7026
+ }, /* @__PURE__ */ React4.createElement(Popover.Viewport, {
7027
+ classNames: tx("menu.viewport", "menu__viewport--exotic-unfocusable", {})
7028
+ }, /* @__PURE__ */ React4.createElement("ul", null, groupsWithItems.map((group, index) => /* @__PURE__ */ React4.createElement(React4.Fragment, {
7029
+ key: group.id
7030
+ }, /* @__PURE__ */ React4.createElement(CommandGroup, {
7031
+ group,
7032
+ currentItem,
7033
+ onSelect
7034
+ }), index < groupsWithItems.length - 1 && /* @__PURE__ */ React4.createElement("div", {
7035
+ className: tx("menu.separator", "menu__item", {})
7036
+ })))))));
7037
+ } finally {
7038
+ _effect.f();
7039
+ }
7040
+ };
7041
+ var CommandGroup = ({ group, currentItem, onSelect }) => {
7042
+ var _effect = _useSignals2();
7043
+ try {
7044
+ const { tx } = useThemeContext();
7045
+ const { t } = useTranslation();
7046
+ return /* @__PURE__ */ React4.createElement(React4.Fragment, null, group.label && /* @__PURE__ */ React4.createElement("div", {
7047
+ className: tx("menu.groupLabel", "menu__group__label", {})
7048
+ }, /* @__PURE__ */ React4.createElement("span", null, toLocalizedString(group.label, t))), group.items.map((item) => /* @__PURE__ */ React4.createElement(CommandItem, {
7049
+ key: item.id,
7050
+ item,
7051
+ current: currentItem === item.id,
7052
+ onSelect
7053
+ })));
7054
+ } finally {
7055
+ _effect.f();
7056
+ }
7057
+ };
7058
+ var CommandItem = ({ item, current, onSelect }) => {
7059
+ var _effect = _useSignals2();
7060
+ try {
7061
+ const ref = useRef2(null);
7062
+ const { tx } = useThemeContext();
7063
+ const { t } = useTranslation();
7064
+ const handleSelect = useCallback2(() => onSelect(item), [
7065
+ item,
7066
+ onSelect
7067
+ ]);
7068
+ useEffect2(() => {
7069
+ if (current && ref.current) {
7070
+ ref.current.scrollIntoView({
7071
+ behavior: "smooth",
7072
+ block: "nearest"
7073
+ });
7074
+ }
7075
+ }, [
7076
+ current
7077
+ ]);
7078
+ return /* @__PURE__ */ React4.createElement("li", {
7079
+ ref,
7080
+ className: tx("menu.item", "menu__item--exotic-unfocusable", {}, [
7081
+ current && "bg-hoverSurface"
7082
+ ]),
7083
+ onClick: handleSelect
7084
+ }, item.icon && /* @__PURE__ */ React4.createElement(Icon2, {
7085
+ icon: item.icon,
7086
+ size: 5
7087
+ }), /* @__PURE__ */ React4.createElement("span", {
7088
+ className: "grow truncate"
7089
+ }, toLocalizedString(item.label, t)));
7090
+ } finally {
7091
+ _effect.f();
7092
+ }
7093
+ };
7094
+ var getItem = (groups, id) => {
7095
+ return groups.flatMap((group) => group.items).find((item) => item.id === id);
7096
+ };
7097
+ var getNextItem = (groups, id) => {
7098
+ const items = groups.flatMap((group) => group.items);
7099
+ const index = items.findIndex((item) => item.id === id);
7100
+ return items[(index + 1) % items.length];
7101
+ };
7102
+ var getPreviousItem = (groups, id) => {
7103
+ const items = groups.flatMap((group) => group.items);
7104
+ const index = items.findIndex((item) => item.id === id);
7105
+ return items[(index - 1 + items.length) % items.length];
7106
+ };
7107
+ var filterItems = (groups, filter) => {
7108
+ return groups.map((group) => ({
7109
+ ...group,
7110
+ items: group.items.filter(filter)
7111
+ }));
7112
+ };
7113
+ var insertAtCursor = (view, head, insert) => {
7114
+ view.dispatch({
7115
+ changes: {
7116
+ from: head,
7117
+ to: head,
7118
+ insert
7119
+ },
7120
+ selection: {
7121
+ anchor: head + insert.length,
7122
+ head: head + insert.length
7123
+ }
7124
+ });
7125
+ };
7126
+ var insertAtLineStart = (view, head, insert) => {
7127
+ const line = view.state.doc.lineAt(head);
7128
+ if (line.from === head) {
7129
+ insertAtCursor(view, head, insert);
7130
+ } else {
7131
+ insert = "\n" + insert;
7132
+ view.dispatch({
7133
+ changes: {
7134
+ from: line.to,
7135
+ to: line.to,
7136
+ insert
7137
+ },
7138
+ selection: {
7139
+ anchor: line.to + insert.length,
7140
+ head: line.to + insert.length
7141
+ }
7142
+ });
7143
+ }
7144
+ };
7145
+ var coreSlashCommands = {
7146
+ id: "markdown",
7147
+ label: "Markdown",
7148
+ items: [
7149
+ {
7150
+ id: "heading-1",
7151
+ label: "Heading 1",
7152
+ icon: "ph--text-h-one--regular",
7153
+ onSelect: (view, head) => insertAtLineStart(view, head, "# ")
7154
+ },
7155
+ {
7156
+ id: "heading-2",
7157
+ label: "Heading 2",
7158
+ icon: "ph--text-h-two--regular",
7159
+ onSelect: (view, head) => insertAtLineStart(view, head, "## ")
7160
+ },
7161
+ {
7162
+ id: "heading-3",
7163
+ label: "Heading 3",
7164
+ icon: "ph--text-h-three--regular",
7165
+ onSelect: (view, head) => insertAtLineStart(view, head, "### ")
7166
+ },
7167
+ {
7168
+ id: "heading-4",
7169
+ label: "Heading 4",
7170
+ icon: "ph--text-h-four--regular",
7171
+ onSelect: (view, head) => insertAtLineStart(view, head, "#### ")
7172
+ },
7173
+ {
7174
+ id: "heading-5",
7175
+ label: "Heading 5",
7176
+ icon: "ph--text-h-five--regular",
7177
+ onSelect: (view, head) => insertAtLineStart(view, head, "##### ")
7178
+ },
7179
+ {
7180
+ id: "heading-6",
7181
+ label: "Heading 6",
7182
+ icon: "ph--text-h-six--regular",
7183
+ onSelect: (view, head) => insertAtLineStart(view, head, "###### ")
7184
+ },
7185
+ {
7186
+ id: "bullet-list",
7187
+ label: "Bullet List",
7188
+ icon: "ph--list-bullets--regular",
7189
+ onSelect: (view, head) => insertAtLineStart(view, head, "- ")
7190
+ },
7191
+ {
7192
+ id: "numbered-list",
7193
+ label: "Numbered List",
7194
+ icon: "ph--list-numbers--regular",
7195
+ onSelect: (view, head) => insertAtLineStart(view, head, "1. ")
7196
+ },
7197
+ {
7198
+ id: "task-list",
7199
+ label: "Task List",
7200
+ icon: "ph--list-checks--regular",
7201
+ onSelect: (view, head) => insertAtLineStart(view, head, "- [ ] ")
7202
+ },
7203
+ {
7204
+ id: "quote",
7205
+ label: "Quote",
7206
+ icon: "ph--quotes--regular",
7207
+ onSelect: (view, head) => insertAtLineStart(view, head, "> ")
7208
+ },
7209
+ {
7210
+ id: "code-block",
7211
+ label: "Code Block",
7212
+ icon: "ph--code-block--regular",
7213
+ onSelect: (view, head) => insertAtLineStart(view, head, "```\n\n```")
7214
+ },
7215
+ {
7216
+ id: "table",
7217
+ label: "Table",
7218
+ icon: "ph--table--regular",
7219
+ onSelect: (view, head) => insertAtLineStart(view, head, "| | | |\n|---|---|---|\n| | | |")
7220
+ }
7221
+ ]
7222
+ };
7223
+ var linkSlashCommands = {
7224
+ id: "link",
7225
+ label: "Link",
7226
+ items: [
7227
+ {
7228
+ id: "inline-link",
7229
+ label: "Inline link",
7230
+ icon: "ph--link--regular",
7231
+ onSelect: (view, head) => view.dispatch({
7232
+ changes: {
7233
+ from: head,
7234
+ insert: "@"
7235
+ },
7236
+ selection: {
7237
+ anchor: head + 1,
7238
+ head: head + 1
7239
+ },
7240
+ effects: commandRangeEffect.of({
7241
+ trigger: "@",
7242
+ range: {
7243
+ from: head,
7244
+ to: head + 1
7245
+ }
7246
+ })
7247
+ })
7248
+ },
7249
+ {
7250
+ id: "block-embed",
7251
+ label: "Block embed",
7252
+ icon: "ph--lego--regular",
7253
+ onSelect: (view, head) => view.dispatch({
7254
+ changes: {
7255
+ from: head,
7256
+ insert: "@@"
7257
+ },
7258
+ selection: {
7259
+ anchor: head + 2,
7260
+ head: head + 2
7261
+ },
7262
+ effects: commandRangeEffect.of({
7263
+ trigger: "@",
7264
+ range: {
7265
+ from: head,
7266
+ to: head + 2
7267
+ }
7268
+ })
7269
+ })
7270
+ }
7271
+ ]
7272
+ };
7273
+
7274
+ // packages/ui/react-ui-editor/src/components/Popover/RefPopover.tsx
7275
+ import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
6703
7276
  import { createContext } from "@radix-ui/react-context";
6704
- import React4, { useRef, useState, useEffect as useEffect2, useCallback } from "react";
7277
+ import React5, { useRef as useRef3, useState as useState2, useEffect as useEffect3, useCallback as useCallback3, forwardRef } from "react";
6705
7278
  import { addEventListener as addEventListener2 } from "@dxos/async";
6706
- import { Popover } from "@dxos/react-ui";
7279
+ import { Popover as Popover2 } from "@dxos/react-ui";
6707
7280
  var customEventOptions = {
6708
7281
  capture: true,
6709
7282
  passive: false
6710
7283
  };
7284
+ var RefPopover = /* @__PURE__ */ forwardRef(({ children, open, onOpenChange, modal, onActivate }, ref) => {
7285
+ var _effect = _useSignals3();
7286
+ try {
7287
+ const [rootRef, setRootRef] = useState2(null);
7288
+ useEffect3(() => {
7289
+ if (!rootRef || !onActivate) {
7290
+ return;
7291
+ }
7292
+ return addEventListener2(rootRef, "dx-ref-tag-activate", onActivate, customEventOptions);
7293
+ }, [
7294
+ rootRef,
7295
+ onActivate
7296
+ ]);
7297
+ return /* @__PURE__ */ React5.createElement(Popover2.Root, {
7298
+ open,
7299
+ onOpenChange,
7300
+ modal
7301
+ }, /* @__PURE__ */ React5.createElement(Popover2.VirtualTrigger, {
7302
+ virtualRef: ref
7303
+ }), /* @__PURE__ */ React5.createElement("div", {
7304
+ role: "none",
7305
+ className: "contents",
7306
+ ref: setRootRef
7307
+ }, children));
7308
+ } finally {
7309
+ _effect.f();
7310
+ }
7311
+ });
6711
7312
  var REF_POPOVER = "RefPopover";
6712
7313
  var [RefPopoverContextProvider, useRefPopover] = createContext(REF_POPOVER, {});
6713
- var RefPopoverProvider = ({ children, onLookup }) => {
6714
- var _effect = _useSignals2();
7314
+ var PreviewProvider = ({ children, onLookup }) => {
7315
+ var _effect = _useSignals3();
6715
7316
  try {
6716
- const trigger = useRef(null);
6717
- const [value, setValue] = useState({});
6718
- const [rootRef, setRootRef] = useState(null);
6719
- const [open, setOpen] = useState(false);
6720
- const handleDxRefTagActivate = useCallback((event) => {
7317
+ const trigger = useRef3(null);
7318
+ const [value, setValue] = useState2({});
7319
+ const [open, setOpen] = useState2(false);
7320
+ const handleDxRefTagActivate = useCallback3((event) => {
6721
7321
  const { refId, label, trigger: dxTrigger } = event;
6722
7322
  setValue((value2) => ({
6723
7323
  ...value2,
@@ -6740,37 +7340,25 @@ var RefPopoverProvider = ({ children, onLookup }) => {
6740
7340
  }, [
6741
7341
  onLookup
6742
7342
  ]);
6743
- useEffect2(() => {
6744
- return rootRef ? addEventListener2(rootRef, "dx-ref-tag-activate", handleDxRefTagActivate, customEventOptions) : void 0;
6745
- }, [
6746
- rootRef
6747
- ]);
6748
- return /* @__PURE__ */ React4.createElement(RefPopoverContextProvider, {
7343
+ return /* @__PURE__ */ React5.createElement(RefPopoverContextProvider, {
6749
7344
  pending: value.pending,
6750
7345
  link: value.link,
6751
7346
  target: value.target
6752
- }, /* @__PURE__ */ React4.createElement(Popover.Root, {
7347
+ }, /* @__PURE__ */ React5.createElement(RefPopover, {
7348
+ ref: trigger,
6753
7349
  open,
6754
- onOpenChange: setOpen
6755
- }, /* @__PURE__ */ React4.createElement(Popover.VirtualTrigger, {
6756
- virtualRef: trigger
6757
- }), /* @__PURE__ */ React4.createElement("div", {
6758
- role: "none",
6759
- className: "contents",
6760
- ref: setRootRef
6761
- }, children)));
7350
+ onOpenChange: setOpen,
7351
+ onActivate: handleDxRefTagActivate
7352
+ }, children));
6762
7353
  } finally {
6763
7354
  _effect.f();
6764
7355
  }
6765
7356
  };
6766
- var RefPopover = {
6767
- Provider: RefPopoverProvider
6768
- };
6769
7357
 
6770
7358
  // packages/ui/react-ui-editor/src/components/Popover/RefDropdownMenu.tsx
6771
- import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
7359
+ import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
6772
7360
  import { createContext as createContext2 } from "@radix-ui/react-context";
6773
- import React5, { useRef as useRef2, useState as useState2, useEffect as useEffect3, useCallback as useCallback2 } from "react";
7361
+ import React6, { useRef as useRef4, useState as useState3, useEffect as useEffect4, useCallback as useCallback4 } from "react";
6774
7362
  import { addEventListener as addEventListener3 } from "@dxos/async";
6775
7363
  import { DropdownMenu } from "@dxos/react-ui";
6776
7364
  var customEventOptions2 = {
@@ -6780,13 +7368,13 @@ var customEventOptions2 = {
6780
7368
  var REF_DROPDOWN_MENU = "RefDropdownMenu";
6781
7369
  var [RefDropdownMenuContextProvider, useRefDropdownMenu] = createContext2(REF_DROPDOWN_MENU, {});
6782
7370
  var RefDropdownMenuProvider = ({ children, onLookup }) => {
6783
- var _effect = _useSignals3();
7371
+ var _effect = _useSignals4();
6784
7372
  try {
6785
- const trigger = useRef2(null);
6786
- const [value, setValue] = useState2({});
6787
- const [rootRef, setRootRef] = useState2(null);
6788
- const [open, setOpen] = useState2(false);
6789
- const handleDxRefTagActivate = useCallback2((event) => {
7373
+ const trigger = useRef4(null);
7374
+ const [value, setValue] = useState3({});
7375
+ const [rootRef, setRootRef] = useState3(null);
7376
+ const [open, setOpen] = useState3(false);
7377
+ const handleDxRefTagActivate = useCallback4((event) => {
6790
7378
  const { refId, label, trigger: dxTrigger } = event;
6791
7379
  setValue((value2) => ({
6792
7380
  ...value2,
@@ -6809,21 +7397,24 @@ var RefDropdownMenuProvider = ({ children, onLookup }) => {
6809
7397
  }, [
6810
7398
  onLookup
6811
7399
  ]);
6812
- useEffect3(() => {
6813
- return rootRef ? addEventListener3(rootRef, "dx-ref-tag-activate", handleDxRefTagActivate, customEventOptions2) : void 0;
7400
+ useEffect4(() => {
7401
+ if (!rootRef) {
7402
+ return;
7403
+ }
7404
+ return addEventListener3(rootRef, "dx-ref-tag-activate", handleDxRefTagActivate, customEventOptions2);
6814
7405
  }, [
6815
7406
  rootRef
6816
7407
  ]);
6817
- return /* @__PURE__ */ React5.createElement(RefDropdownMenuContextProvider, {
7408
+ return /* @__PURE__ */ React6.createElement(RefDropdownMenuContextProvider, {
6818
7409
  pending: value.pending,
6819
7410
  link: value.link,
6820
7411
  target: value.target
6821
- }, /* @__PURE__ */ React5.createElement(DropdownMenu.Root, {
7412
+ }, /* @__PURE__ */ React6.createElement(DropdownMenu.Root, {
6822
7413
  open,
6823
7414
  onOpenChange: setOpen
6824
- }, /* @__PURE__ */ React5.createElement(DropdownMenu.VirtualTrigger, {
7415
+ }, /* @__PURE__ */ React6.createElement(DropdownMenu.VirtualTrigger, {
6825
7416
  virtualRef: trigger
6826
- }), /* @__PURE__ */ React5.createElement("div", {
7417
+ }), /* @__PURE__ */ React6.createElement("div", {
6827
7418
  role: "none",
6828
7419
  className: "contents",
6829
7420
  ref: setRootRef
@@ -6838,19 +7429,19 @@ var RefDropdownMenu = {
6838
7429
 
6839
7430
  // packages/ui/react-ui-editor/src/hooks/useTextEditor.ts
6840
7431
  import { EditorState as EditorState3 } from "@codemirror/state";
6841
- import { EditorView as EditorView24 } from "@codemirror/view";
7432
+ import { EditorView as EditorView26 } from "@codemirror/view";
6842
7433
  import { useFocusableGroup } from "@fluentui/react-tabster";
6843
- import { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo4, useRef as useRef3, useState as useState3 } from "react";
7434
+ import { useCallback as useCallback5, useEffect as useEffect5, useMemo as useMemo5, useRef as useRef5, useState as useState4 } from "react";
6844
7435
  import { log as log8 } from "@dxos/log";
6845
7436
  import { getProviderValue, isNotFalsy as isNotFalsy4 } from "@dxos/util";
6846
7437
  var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/hooks/useTextEditor.ts";
6847
7438
  var instanceCount = 0;
6848
7439
  var useTextEditor = (props = {}, deps = []) => {
6849
- const { id, doc, initialValue, extensions, autoFocus, scrollTo, selection, moveToEndOfLine, debug } = useMemo4(() => getProviderValue(props), deps ?? []);
6850
- const [instanceId] = useState3(() => `text-editor-${++instanceCount}`);
6851
- const [view, setView] = useState3();
6852
- const parentRef = useRef3(null);
6853
- useEffect4(() => {
7440
+ const { id, doc, initialValue, extensions, autoFocus, scrollTo, selection, moveToEndOfLine, debug } = useMemo5(() => getProviderValue(props), deps ?? []);
7441
+ const [instanceId] = useState4(() => `text-editor-${++instanceCount}`);
7442
+ const [view, setView] = useState4();
7443
+ const parentRef = useRef5(null);
7444
+ useEffect5(() => {
6854
7445
  let view2;
6855
7446
  if (parentRef.current) {
6856
7447
  log8("create", {
@@ -6859,7 +7450,7 @@ var useTextEditor = (props = {}, deps = []) => {
6859
7450
  doc: initialValue?.length ?? 0
6860
7451
  }, {
6861
7452
  F: __dxlog_file13,
6862
- L: 76,
7453
+ L: 75,
6863
7454
  S: void 0,
6864
7455
  C: (f, a) => f(...a)
6865
7456
  });
@@ -6882,20 +7473,20 @@ var useTextEditor = (props = {}, deps = []) => {
6882
7473
  id && documentId.of(id),
6883
7474
  extensions,
6884
7475
  // NOTE: This doesn't catch errors in keymap functions.
6885
- EditorView24.exceptionSink.of((err) => {
7476
+ EditorView26.exceptionSink.of((err) => {
6886
7477
  log8.catch(err, void 0, {
6887
7478
  F: __dxlog_file13,
6888
- L: 98,
7479
+ L: 97,
6889
7480
  S: void 0,
6890
7481
  C: (f, a) => f(...a)
6891
7482
  });
6892
7483
  })
6893
7484
  ].filter(isNotFalsy4)
6894
7485
  });
6895
- view2 = new EditorView24({
7486
+ view2 = new EditorView26({
6896
7487
  parent: parentRef.current,
6897
7488
  state,
6898
- scrollTo: scrollTo ? EditorView24.scrollIntoView(scrollTo, {
7489
+ scrollTo: scrollTo ? EditorView26.scrollIntoView(scrollTo, {
6899
7490
  yMargin: 96
6900
7491
  }) : void 0,
6901
7492
  dispatchTransactions: debug ? debugDispatcher : void 0
@@ -6917,14 +7508,14 @@ var useTextEditor = (props = {}, deps = []) => {
6917
7508
  id
6918
7509
  }, {
6919
7510
  F: __dxlog_file13,
6920
- L: 135,
7511
+ L: 134,
6921
7512
  S: void 0,
6922
7513
  C: (f, a) => f(...a)
6923
7514
  });
6924
7515
  view2?.destroy();
6925
7516
  };
6926
7517
  }, deps);
6927
- useEffect4(() => {
7518
+ useEffect5(() => {
6928
7519
  if (view) {
6929
7520
  if (scrollTo || selection) {
6930
7521
  if (selection && selection.anchor > view.state.doc.length) {
@@ -6934,7 +7525,7 @@ var useTextEditor = (props = {}, deps = []) => {
6934
7525
  selection
6935
7526
  }, {
6936
7527
  F: __dxlog_file13,
6937
- L: 144,
7528
+ L: 143,
6938
7529
  S: void 0,
6939
7530
  C: (f, a) => f(...a)
6940
7531
  });
@@ -6951,7 +7542,7 @@ var useTextEditor = (props = {}, deps = []) => {
6951
7542
  scrollTo,
6952
7543
  selection
6953
7544
  ]);
6954
- useEffect4(() => {
7545
+ useEffect5(() => {
6955
7546
  if (view && autoFocus) {
6956
7547
  view.focus();
6957
7548
  }
@@ -6965,7 +7556,7 @@ var useTextEditor = (props = {}, deps = []) => {
6965
7556
  Escape: view?.state.facet(editorInputMode).noTabster
6966
7557
  }
6967
7558
  });
6968
- const handleKeyUp = useCallback3((event) => {
7559
+ const handleKeyUp = useCallback5((event) => {
6969
7560
  const { key, target, currentTarget } = event;
6970
7561
  if (target === currentTarget) {
6971
7562
  switch (key) {
@@ -6989,17 +7580,19 @@ var useTextEditor = (props = {}, deps = []) => {
6989
7580
  };
6990
7581
  };
6991
7582
  export {
7583
+ CommandMenu,
6992
7584
  Cursor,
6993
7585
  EditorInputMode,
6994
7586
  EditorInputModes,
6995
7587
  EditorState4 as EditorState,
6996
7588
  EditorToolbar,
6997
- EditorView25 as EditorView,
7589
+ EditorView27 as EditorView,
6998
7590
  EditorViewMode,
6999
7591
  EditorViewModes,
7000
7592
  Inline,
7001
7593
  InputModeExtensions,
7002
7594
  List,
7595
+ PreviewProvider,
7003
7596
  RefDropdownMenu,
7004
7597
  RefPopover,
7005
7598
  RemoteSelectionsDecorator,
@@ -7023,11 +7616,14 @@ export {
7023
7616
  closeEffect,
7024
7617
  command,
7025
7618
  commandKeyBindings,
7619
+ commandMenu,
7620
+ commandRangeEffect,
7026
7621
  commands,
7027
7622
  commentClickedEffect,
7028
7623
  comments,
7029
7624
  commentsState,
7030
7625
  convertTreeToJson,
7626
+ coreSlashCommands,
7031
7627
  createBasicExtensions,
7032
7628
  createComment,
7033
7629
  createDataExtensions,
@@ -7055,6 +7651,7 @@ export {
7055
7651
  editorSlots,
7056
7652
  editorWidth,
7057
7653
  editorWithToolbarLayout,
7654
+ filterItems,
7058
7655
  flattenRect,
7059
7656
  floatingMenu,
7060
7657
  focus,
@@ -7063,15 +7660,22 @@ export {
7063
7660
  formattingEquals,
7064
7661
  formattingKeymap,
7065
7662
  getFormatting,
7663
+ getItem,
7664
+ getLinkRef,
7066
7665
  getListItemContent,
7666
+ getNextItem,
7667
+ getPreviousItem,
7067
7668
  getRange,
7068
7669
  hashtag,
7069
7670
  image,
7070
7671
  indentItemLess,
7071
7672
  indentItemMore,
7673
+ insertAtCursor,
7674
+ insertAtLineStart,
7072
7675
  insertTable,
7073
7676
  itemToJSON,
7074
- keymap13 as keymap,
7677
+ keymap14 as keymap,
7678
+ linkSlashCommands,
7075
7679
  linkTooltip,
7076
7680
  listItemToString,
7077
7681
  listener,
@@ -7106,7 +7710,6 @@ export {
7106
7710
  setStyle,
7107
7711
  singleValueFacet,
7108
7712
  stackItemContentEditorClassNames,
7109
- stackItemContentToolbarClassNames,
7110
7713
  staticCompletion,
7111
7714
  table,
7112
7715
  tags2 as tags,
@@ -7125,6 +7728,7 @@ export {
7125
7728
  treeFacet,
7126
7729
  typeahead,
7127
7730
  typewriter,
7731
+ useCommandMenu,
7128
7732
  useComments,
7129
7733
  useEditorToolbarState,
7130
7734
  useFormattingState,