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