@dxos/react-ui-editor 0.8.4-main.3f58842 → 0.8.4-main.5ea62a8

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 (147) hide show
  1. package/dist/lib/browser/index.mjs +768 -452
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/browser/testing/index.mjs.map +2 -2
  5. package/dist/lib/node-esm/index.mjs +768 -452
  6. package/dist/lib/node-esm/index.mjs.map +4 -4
  7. package/dist/lib/node-esm/meta.json +1 -1
  8. package/dist/lib/node-esm/testing/index.mjs.map +2 -2
  9. package/dist/types/src/components/Editor/Editor.d.ts.map +1 -1
  10. package/dist/types/src/components/EditorToolbar/EditorToolbar.d.ts.map +1 -1
  11. package/dist/types/src/components/EditorToolbar/blocks.d.ts.map +1 -1
  12. package/dist/types/src/components/EditorToolbar/formatting.d.ts.map +1 -1
  13. package/dist/types/src/components/EditorToolbar/headings.d.ts.map +1 -1
  14. package/dist/types/src/components/EditorToolbar/image.d.ts.map +1 -1
  15. package/dist/types/src/components/EditorToolbar/lists.d.ts.map +1 -1
  16. package/dist/types/src/components/EditorToolbar/search.d.ts.map +1 -1
  17. package/dist/types/src/components/EditorToolbar/util.d.ts +2 -2
  18. package/dist/types/src/components/EditorToolbar/util.d.ts.map +1 -1
  19. package/dist/types/src/components/EditorToolbar/view-mode.d.ts +1 -1
  20. package/dist/types/src/components/EditorToolbar/view-mode.d.ts.map +1 -1
  21. package/dist/types/src/components/Popover/CommandMenu.d.ts.map +1 -1
  22. package/dist/types/src/defaults.d.ts.map +1 -1
  23. package/dist/types/src/extensions/autocomplete.d.ts +1 -1
  24. package/dist/types/src/extensions/autocomplete.d.ts.map +1 -1
  25. package/dist/types/src/extensions/automerge/automerge.d.ts.map +1 -1
  26. package/dist/types/src/extensions/automerge/automerge.stories.d.ts +9 -18
  27. package/dist/types/src/extensions/automerge/automerge.stories.d.ts.map +1 -1
  28. package/dist/types/src/extensions/automerge/defs.d.ts +1 -1
  29. package/dist/types/src/extensions/automerge/defs.d.ts.map +1 -1
  30. package/dist/types/src/extensions/automerge/sync.d.ts.map +1 -1
  31. package/dist/types/src/extensions/automerge/update-automerge.d.ts.map +1 -1
  32. package/dist/types/src/extensions/command/action.d.ts +1 -1
  33. package/dist/types/src/extensions/command/action.d.ts.map +1 -1
  34. package/dist/types/src/extensions/command/command-menu.d.ts +1 -1
  35. package/dist/types/src/extensions/command/command-menu.d.ts.map +1 -1
  36. package/dist/types/src/extensions/command/command.d.ts.map +1 -1
  37. package/dist/types/src/extensions/command/hint.d.ts.map +1 -1
  38. package/dist/types/src/extensions/command/state.d.ts +1 -1
  39. package/dist/types/src/extensions/command/state.d.ts.map +1 -1
  40. package/dist/types/src/extensions/command/typeahead.d.ts.map +1 -1
  41. package/dist/types/src/extensions/command/useCommandMenu.d.ts +1 -1
  42. package/dist/types/src/extensions/command/useCommandMenu.d.ts.map +1 -1
  43. package/dist/types/src/extensions/comments.d.ts +1 -1
  44. package/dist/types/src/extensions/comments.d.ts.map +1 -1
  45. package/dist/types/src/extensions/dnd.d.ts.map +1 -1
  46. package/dist/types/src/extensions/factories.d.ts.map +1 -1
  47. package/dist/types/src/extensions/markdown/action.d.ts.map +1 -1
  48. package/dist/types/src/extensions/markdown/bundle.d.ts +2 -0
  49. package/dist/types/src/extensions/markdown/bundle.d.ts.map +1 -1
  50. package/dist/types/src/extensions/markdown/changes.d.ts.map +1 -1
  51. package/dist/types/src/extensions/markdown/decorate.d.ts.map +1 -1
  52. package/dist/types/src/extensions/markdown/formatting.d.ts +1 -1
  53. package/dist/types/src/extensions/markdown/formatting.d.ts.map +1 -1
  54. package/dist/types/src/extensions/markdown/formatting.test.d.ts.map +1 -1
  55. package/dist/types/src/extensions/markdown/highlight.d.ts.map +1 -1
  56. package/dist/types/src/extensions/outliner/outliner.d.ts.map +1 -1
  57. package/dist/types/src/extensions/outliner/selection.d.ts.map +1 -1
  58. package/dist/types/src/extensions/outliner/tree.d.ts +1 -1
  59. package/dist/types/src/extensions/outliner/tree.d.ts.map +1 -1
  60. package/dist/types/src/hooks/useTextEditor.d.ts.map +1 -1
  61. package/dist/types/src/stories/Command.stories.d.ts +12 -4
  62. package/dist/types/src/stories/Command.stories.d.ts.map +1 -1
  63. package/dist/types/src/stories/CommandMenu.stories.d.ts +10 -3
  64. package/dist/types/src/stories/CommandMenu.stories.d.ts.map +1 -1
  65. package/dist/types/src/stories/Comments.stories.d.ts +21 -9
  66. package/dist/types/src/stories/Comments.stories.d.ts.map +1 -1
  67. package/dist/types/src/stories/EditorToolbar.stories.d.ts +39 -2
  68. package/dist/types/src/stories/EditorToolbar.stories.d.ts.map +1 -1
  69. package/dist/types/src/stories/Experimental.stories.d.ts +22 -12
  70. package/dist/types/src/stories/Experimental.stories.d.ts.map +1 -1
  71. package/dist/types/src/stories/Markdown.stories.d.ts +32 -42
  72. package/dist/types/src/stories/Markdown.stories.d.ts.map +1 -1
  73. package/dist/types/src/stories/Outliner.stories.d.ts +15 -20
  74. package/dist/types/src/stories/Outliner.stories.d.ts.map +1 -1
  75. package/dist/types/src/stories/Preview.stories.d.ts +21 -6
  76. package/dist/types/src/stories/Preview.stories.d.ts.map +1 -1
  77. package/dist/types/src/stories/TextEditor.stories.d.ts +38 -51
  78. package/dist/types/src/stories/TextEditor.stories.d.ts.map +1 -1
  79. package/dist/types/src/stories/components/EditorStory.d.ts +3 -6
  80. package/dist/types/src/stories/components/EditorStory.d.ts.map +1 -1
  81. package/dist/types/src/styles/theme.d.ts.map +1 -1
  82. package/dist/types/src/testing/util.d.ts +1 -0
  83. package/dist/types/src/testing/util.d.ts.map +1 -1
  84. package/dist/types/src/translations.d.ts +1 -1
  85. package/dist/types/src/util/cursor.d.ts.map +1 -1
  86. package/dist/types/tsconfig.tsbuildinfo +1 -1
  87. package/package.json +43 -40
  88. package/src/components/Editor/Editor.tsx +1 -1
  89. package/src/components/EditorToolbar/EditorToolbar.tsx +40 -30
  90. package/src/components/EditorToolbar/blocks.ts +21 -24
  91. package/src/components/EditorToolbar/formatting.ts +22 -25
  92. package/src/components/EditorToolbar/headings.ts +10 -5
  93. package/src/components/EditorToolbar/image.ts +8 -4
  94. package/src/components/EditorToolbar/lists.ts +16 -19
  95. package/src/components/EditorToolbar/search.ts +8 -4
  96. package/src/components/EditorToolbar/util.ts +16 -5
  97. package/src/components/EditorToolbar/view-mode.ts +11 -6
  98. package/src/components/Popover/CommandMenu.tsx +3 -3
  99. package/src/components/Popover/RefDropdownMenu.tsx +1 -1
  100. package/src/components/Popover/RefPopover.tsx +4 -4
  101. package/src/defaults.ts +5 -2
  102. package/src/extensions/autocomplete.ts +3 -3
  103. package/src/extensions/automerge/automerge.stories.tsx +25 -18
  104. package/src/extensions/automerge/automerge.ts +4 -3
  105. package/src/extensions/automerge/defs.ts +1 -1
  106. package/src/extensions/automerge/sync.ts +1 -1
  107. package/src/extensions/automerge/update-automerge.ts +1 -1
  108. package/src/extensions/awareness/awareness.ts +2 -2
  109. package/src/extensions/command/action.ts +1 -1
  110. package/src/extensions/command/command-menu.ts +4 -3
  111. package/src/extensions/command/command.ts +3 -3
  112. package/src/extensions/command/hint.ts +2 -1
  113. package/src/extensions/command/placeholder.ts +1 -1
  114. package/src/extensions/command/state.ts +4 -3
  115. package/src/extensions/command/typeahead.ts +2 -2
  116. package/src/extensions/command/useCommandMenu.ts +2 -1
  117. package/src/extensions/comments.ts +13 -12
  118. package/src/extensions/dnd.ts +1 -1
  119. package/src/extensions/factories.ts +4 -3
  120. package/src/extensions/markdown/action.ts +2 -1
  121. package/src/extensions/markdown/bundle.ts +4 -1
  122. package/src/extensions/markdown/changes.ts +1 -1
  123. package/src/extensions/markdown/decorate.ts +7 -6
  124. package/src/extensions/markdown/formatting.test.ts +6 -6
  125. package/src/extensions/markdown/formatting.ts +3 -3
  126. package/src/extensions/markdown/highlight.ts +1 -1
  127. package/src/extensions/mention.ts +1 -1
  128. package/src/extensions/outliner/outliner.test.ts +3 -2
  129. package/src/extensions/outliner/outliner.ts +4 -3
  130. package/src/extensions/outliner/selection.ts +1 -1
  131. package/src/extensions/outliner/tree.test.ts +2 -1
  132. package/src/extensions/outliner/tree.ts +1 -1
  133. package/src/hooks/useTextEditor.ts +3 -3
  134. package/src/stories/Command.stories.tsx +12 -8
  135. package/src/stories/CommandMenu.stories.tsx +16 -14
  136. package/src/stories/Comments.stories.tsx +10 -6
  137. package/src/stories/EditorToolbar.stories.tsx +7 -7
  138. package/src/stories/Experimental.stories.tsx +12 -8
  139. package/src/stories/Markdown.stories.tsx +21 -17
  140. package/src/stories/Outliner.stories.tsx +14 -10
  141. package/src/stories/Preview.stories.tsx +27 -25
  142. package/src/stories/TextEditor.stories.tsx +36 -32
  143. package/src/stories/components/EditorStory.tsx +8 -9
  144. package/src/styles/theme.ts +8 -6
  145. package/src/testing/util.ts +2 -0
  146. package/src/translations.ts +1 -1
  147. package/src/util/cursor.ts +2 -1
@@ -25,8 +25,8 @@ var translations = [
25
25
  "selection overlaps existing comment label": "Selection overlaps existing comment",
26
26
  "select text to comment label": "Select text to comment",
27
27
  "image label": "Insert image",
28
- "heading label": "Heading level",
29
28
  "table label": "Create table",
29
+ "heading label": "Heading level",
30
30
  "heading level label_zero": "Paragraph",
31
31
  "heading level label_one": "Heading level {{count}}",
32
32
  "heading level label_other": "Heading level {{count}}",
@@ -63,15 +63,25 @@ import { getProviderValue, isNotFalsy as isNotFalsy4 } from "@dxos/util";
63
63
  // src/extensions/annotations.ts
64
64
  import { RangeSetBuilder } from "@codemirror/state";
65
65
  import { Decoration, EditorView, ViewPlugin } from "@codemirror/view";
66
+ function _define_property(obj, key, value) {
67
+ if (key in obj) {
68
+ Object.defineProperty(obj, key, {
69
+ value,
70
+ enumerable: true,
71
+ configurable: true,
72
+ writable: true
73
+ });
74
+ } else {
75
+ obj[key] = value;
76
+ }
77
+ return obj;
78
+ }
66
79
  var annotationMark = Decoration.mark({
67
80
  class: "cm-annotation"
68
81
  });
69
82
  var annotations = ({ match } = {}) => {
70
83
  return [
71
84
  ViewPlugin.fromClass(class {
72
- constructor() {
73
- this.decorations = Decoration.none;
74
- }
75
85
  update(update2) {
76
86
  const builder = new RangeSetBuilder();
77
87
  if (match) {
@@ -88,6 +98,9 @@ var annotations = ({ match } = {}) => {
88
98
  }
89
99
  this.decorations = builder.finish();
90
100
  }
101
+ constructor() {
102
+ _define_property(this, "decorations", Decoration.none);
103
+ }
91
104
  }, {
92
105
  decorations: (v) => v.decorations
93
106
  }),
@@ -143,17 +156,187 @@ import { next as A3 } from "@automerge/automerge";
143
156
  import { StateField } from "@codemirror/state";
144
157
  import { EditorView as EditorView2, ViewPlugin as ViewPlugin2 } from "@codemirror/view";
145
158
 
146
- // src/extensions/automerge/cursor.ts
159
+ // src/util/facet.ts
160
+ import { Facet } from "@codemirror/state";
161
+ var singleValueFacet = (defaultValue) => Facet.define({
162
+ // Called immediately.
163
+ combine: (providers) => {
164
+ return providers[0] ?? defaultValue;
165
+ }
166
+ });
167
+
168
+ // src/util/cursor.ts
169
+ function _define_property2(obj, key, value) {
170
+ if (key in obj) {
171
+ Object.defineProperty(obj, key, {
172
+ value,
173
+ enumerable: true,
174
+ configurable: true,
175
+ writable: true
176
+ });
177
+ } else {
178
+ obj[key] = value;
179
+ }
180
+ return obj;
181
+ }
182
+ var overlap = (a, b) => a.from <= b.to && a.to >= b.from;
183
+ var defaultCursorConverter = {
184
+ toCursor: (position) => position.toString(),
185
+ fromCursor: (cursor) => parseInt(cursor)
186
+ };
187
+ var Cursor = class {
188
+ };
189
+ _define_property2(Cursor, "converter", singleValueFacet(defaultCursorConverter));
190
+ _define_property2(Cursor, "getCursorFromRange", (state, range) => {
191
+ const cursorConverter2 = state.facet(Cursor.converter);
192
+ const from = cursorConverter2.toCursor(range.from);
193
+ const to = cursorConverter2.toCursor(range.to, -1);
194
+ return [
195
+ from,
196
+ to
197
+ ].join(":");
198
+ });
199
+ _define_property2(Cursor, "getRangeFromCursor", (state, cursor) => {
200
+ const cursorConverter2 = state.facet(Cursor.converter);
201
+ const parts = cursor.split(":");
202
+ const from = cursorConverter2.fromCursor(parts[0]);
203
+ const to = cursorConverter2.fromCursor(parts[1]);
204
+ return from !== void 0 && to !== void 0 ? {
205
+ from,
206
+ to
207
+ } : void 0;
208
+ });
209
+
210
+ // src/util/debug.ts
147
211
  import { log } from "@dxos/log";
212
+ var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/util/debug.ts";
213
+ var wrapWithCatch = (fn) => {
214
+ return (...args) => {
215
+ try {
216
+ return fn(...args);
217
+ } catch (err) {
218
+ log.catch(err, void 0, {
219
+ F: __dxlog_file,
220
+ L: 15,
221
+ S: void 0,
222
+ C: (f, a) => f(...a)
223
+ });
224
+ }
225
+ };
226
+ };
227
+ var callbackWrapper = (fn) => (...args) => {
228
+ try {
229
+ return fn(...args);
230
+ } catch (err) {
231
+ log.catch(err, void 0, {
232
+ F: __dxlog_file,
233
+ L: 29,
234
+ S: void 0,
235
+ C: (f, a) => f(...a)
236
+ });
237
+ }
238
+ };
239
+ var debugDispatcher = (trs, view) => {
240
+ logChanges(trs);
241
+ view.update(trs);
242
+ };
243
+ var logChanges = (trs) => {
244
+ const changes = trs.flatMap((tr) => {
245
+ if (tr.changes.empty) {
246
+ return void 0;
247
+ }
248
+ const changes2 = [];
249
+ tr.changes.iterChanges((fromA, toA, fromB, toB, inserted) => changes2.push(JSON.stringify({
250
+ fromA,
251
+ toA,
252
+ fromB,
253
+ toB,
254
+ inserted: inserted.toString()
255
+ })));
256
+ return changes2;
257
+ }).filter(Boolean);
258
+ if (changes.length) {
259
+ log("changes", {
260
+ changes
261
+ }, {
262
+ F: __dxlog_file,
263
+ L: 62,
264
+ S: void 0,
265
+ C: (f, a) => f(...a)
266
+ });
267
+ }
268
+ };
269
+
270
+ // src/util/dom.ts
271
+ var flattenRect = (rect, left) => {
272
+ const x = left ? rect.left : rect.right;
273
+ return {
274
+ left: x,
275
+ right: x,
276
+ top: rect.top,
277
+ bottom: rect.bottom
278
+ };
279
+ };
280
+ var scratchRange;
281
+ var textRange = (node, from, to = from) => {
282
+ const range = scratchRange || (scratchRange = document.createRange());
283
+ range.setEnd(node, to);
284
+ range.setStart(node, from);
285
+ return range;
286
+ };
287
+ var clientRectsFor = (dom) => {
288
+ if (dom.nodeType === 3) {
289
+ return textRange(dom, 0, dom.nodeValue.length).getClientRects();
290
+ } else if (dom.nodeType === 1) {
291
+ return dom.getClientRects();
292
+ } else {
293
+ return [];
294
+ }
295
+ };
296
+ var createElement = (tag, options, children) => {
297
+ const el = document.createElement(tag);
298
+ if (options?.className) {
299
+ el.className = options.className;
300
+ }
301
+ if (options?.text) {
302
+ el.textContent = options.text;
303
+ }
304
+ if (children) {
305
+ el.append(...Array.isArray(children) ? children : [
306
+ children
307
+ ]);
308
+ }
309
+ return el;
310
+ };
311
+
312
+ // src/util/react.tsx
313
+ import React from "react";
314
+ import { createRoot } from "react-dom/client";
315
+ import { ThemeProvider, Tooltip } from "@dxos/react-ui";
316
+ import { defaultTx } from "@dxos/react-ui-theme";
317
+ var renderRoot = (root, node) => {
318
+ createRoot(root).render(/* @__PURE__ */ React.createElement(ThemeProvider, {
319
+ tx: defaultTx
320
+ }, node));
321
+ return root;
322
+ };
323
+ var createRenderer = (Component) => (el, props) => {
324
+ renderRoot(el, /* @__PURE__ */ React.createElement(ThemeProvider, {
325
+ tx: defaultTx
326
+ }, /* @__PURE__ */ React.createElement(Tooltip.Provider, null, /* @__PURE__ */ React.createElement(Component, props))));
327
+ };
328
+
329
+ // src/extensions/automerge/cursor.ts
330
+ import { log as log2 } from "@dxos/log";
148
331
  import { fromCursor, toCursor } from "@dxos/react-client/echo";
149
- var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/automerge/cursor.ts";
332
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/automerge/cursor.ts";
150
333
  var cursorConverter = (accessor) => ({
151
334
  toCursor: (pos, assoc) => {
152
335
  try {
153
336
  return toCursor(accessor, pos, assoc);
154
337
  } catch (err) {
155
- log.catch(err, void 0, {
156
- F: __dxlog_file,
338
+ log2.catch(err, void 0, {
339
+ F: __dxlog_file2,
157
340
  L: 15,
158
341
  S: void 0,
159
342
  C: (f, a) => f(...a)
@@ -165,8 +348,8 @@ var cursorConverter = (accessor) => ({
165
348
  try {
166
349
  return fromCursor(accessor, cursor);
167
350
  } catch (err) {
168
- log.catch(err, void 0, {
169
- F: __dxlog_file,
351
+ log2.catch(err, void 0, {
352
+ F: __dxlog_file2,
170
353
  L: 24,
171
354
  S: void 0,
172
355
  C: (f, a) => f(...a)
@@ -331,13 +514,20 @@ var charPath = (textPath, candidatePath) => {
331
514
  };
332
515
 
333
516
  // src/extensions/automerge/sync.ts
334
- var Syncer = class {
335
- // prettier-ignore
336
- constructor(_handle, _state) {
337
- this._handle = _handle;
338
- this._state = _state;
339
- this._pending = false;
517
+ function _define_property3(obj, key, value) {
518
+ if (key in obj) {
519
+ Object.defineProperty(obj, key, {
520
+ value,
521
+ enumerable: true,
522
+ configurable: true,
523
+ writable: true
524
+ });
525
+ } else {
526
+ obj[key] = value;
340
527
  }
528
+ return obj;
529
+ }
530
+ var Syncer = class {
341
531
  reconcile(view, editor2) {
342
532
  if (this._pending) {
343
533
  return;
@@ -372,172 +562,31 @@ var Syncer = class {
372
562
  annotations: reconcileAnnotation.of(false)
373
563
  });
374
564
  }
375
- };
376
-
377
- // src/util/facet.ts
378
- import { Facet } from "@codemirror/state";
379
- var singleValueFacet = (defaultValue) => Facet.define({
380
- // Called immediately.
381
- combine: (providers) => {
382
- return providers[0] ?? defaultValue;
383
- }
384
- });
385
-
386
- // src/util/cursor.ts
387
- var overlap = (a, b) => a.from <= b.to && a.to >= b.from;
388
- var defaultCursorConverter = {
389
- toCursor: (position) => position.toString(),
390
- fromCursor: (cursor) => parseInt(cursor)
391
- };
392
- var Cursor = class _Cursor {
393
- static {
394
- this.converter = singleValueFacet(defaultCursorConverter);
395
- }
396
- static {
397
- this.getCursorFromRange = (state, range) => {
398
- const cursorConverter2 = state.facet(_Cursor.converter);
399
- const from = cursorConverter2.toCursor(range.from);
400
- const to = cursorConverter2.toCursor(range.to, -1);
401
- return [
402
- from,
403
- to
404
- ].join(":");
405
- };
406
- }
407
- static {
408
- this.getRangeFromCursor = (state, cursor) => {
409
- const cursorConverter2 = state.facet(_Cursor.converter);
410
- const parts = cursor.split(":");
411
- const from = cursorConverter2.fromCursor(parts[0]);
412
- const to = cursorConverter2.fromCursor(parts[1]);
413
- return from !== void 0 && to !== void 0 ? {
414
- from,
415
- to
416
- } : void 0;
417
- };
565
+ // prettier-ignore
566
+ constructor(_handle, _state) {
567
+ _define_property3(this, "_handle", void 0);
568
+ _define_property3(this, "_state", void 0);
569
+ _define_property3(this, "_pending", void 0);
570
+ this._handle = _handle;
571
+ this._state = _state;
572
+ this._pending = false;
418
573
  }
419
574
  };
420
575
 
421
- // src/util/debug.ts
422
- import { log as log2 } from "@dxos/log";
423
- var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/util/debug.ts";
424
- var wrapWithCatch = (fn) => {
425
- return (...args) => {
426
- try {
427
- return fn(...args);
428
- } catch (err) {
429
- log2.catch(err, void 0, {
430
- F: __dxlog_file2,
431
- L: 15,
432
- S: void 0,
433
- C: (f, a) => f(...a)
434
- });
435
- }
436
- };
437
- };
438
- var callbackWrapper = (fn) => (...args) => {
439
- try {
440
- return fn(...args);
441
- } catch (err) {
442
- log2.catch(err, void 0, {
443
- F: __dxlog_file2,
444
- L: 29,
445
- S: void 0,
446
- C: (f, a) => f(...a)
447
- });
448
- }
449
- };
450
- var debugDispatcher = (trs, view) => {
451
- logChanges(trs);
452
- view.update(trs);
453
- };
454
- var logChanges = (trs) => {
455
- const changes = trs.flatMap((tr) => {
456
- if (tr.changes.empty) {
457
- return void 0;
458
- }
459
- const changes2 = [];
460
- tr.changes.iterChanges((fromA, toA, fromB, toB, inserted) => changes2.push(JSON.stringify({
461
- fromA,
462
- toA,
463
- fromB,
464
- toB,
465
- inserted: inserted.toString()
466
- })));
467
- return changes2;
468
- }).filter(Boolean);
469
- if (changes.length) {
470
- log2("changes", {
471
- changes
472
- }, {
473
- F: __dxlog_file2,
474
- L: 62,
475
- S: void 0,
476
- C: (f, a) => f(...a)
576
+ // src/extensions/automerge/automerge.ts
577
+ function _define_property4(obj, key, value) {
578
+ if (key in obj) {
579
+ Object.defineProperty(obj, key, {
580
+ value,
581
+ enumerable: true,
582
+ configurable: true,
583
+ writable: true
477
584
  });
478
- }
479
- };
480
-
481
- // src/util/dom.ts
482
- var flattenRect = (rect, left) => {
483
- const x = left ? rect.left : rect.right;
484
- return {
485
- left: x,
486
- right: x,
487
- top: rect.top,
488
- bottom: rect.bottom
489
- };
490
- };
491
- var scratchRange;
492
- var textRange = (node, from, to = from) => {
493
- const range = scratchRange || (scratchRange = document.createRange());
494
- range.setEnd(node, to);
495
- range.setStart(node, from);
496
- return range;
497
- };
498
- var clientRectsFor = (dom) => {
499
- if (dom.nodeType === 3) {
500
- return textRange(dom, 0, dom.nodeValue.length).getClientRects();
501
- } else if (dom.nodeType === 1) {
502
- return dom.getClientRects();
503
585
  } else {
504
- return [];
505
- }
506
- };
507
- var createElement = (tag, options, children) => {
508
- const el = document.createElement(tag);
509
- if (options?.className) {
510
- el.className = options.className;
511
- }
512
- if (options?.text) {
513
- el.textContent = options.text;
586
+ obj[key] = value;
514
587
  }
515
- if (children) {
516
- el.append(...Array.isArray(children) ? children : [
517
- children
518
- ]);
519
- }
520
- return el;
521
- };
522
-
523
- // 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
- var renderRoot = (root, node) => {
529
- createRoot(root).render(/* @__PURE__ */ React.createElement(ThemeProvider, {
530
- tx: defaultTx
531
- }, node));
532
- return root;
533
- };
534
- var createRenderer = (Component) => (el, props) => {
535
- renderRoot(el, /* @__PURE__ */ React.createElement(ThemeProvider, {
536
- tx: defaultTx
537
- }, /* @__PURE__ */ React.createElement(Tooltip.Provider, null, /* @__PURE__ */ React.createElement(Component, props))));
538
- };
539
-
540
- // src/extensions/automerge/automerge.ts
588
+ return obj;
589
+ }
541
590
  var automerge = (accessor) => {
542
591
  const syncState = StateField.define({
543
592
  create: () => ({
@@ -575,16 +624,18 @@ var automerge = (accessor) => {
575
624
  syncState,
576
625
  // Reconcile external updates.
577
626
  ViewPlugin2.fromClass(class {
627
+ destroy() {
628
+ accessor.handle.removeListener("change", this._handleChange);
629
+ }
578
630
  constructor(_view) {
631
+ _define_property4(this, "_view", void 0);
632
+ _define_property4(this, "_handleChange", void 0);
579
633
  this._view = _view;
580
634
  this._handleChange = () => {
581
635
  syncer.reconcile(this._view, false);
582
636
  };
583
637
  accessor.handle.addListener("change", this._handleChange);
584
638
  }
585
- destroy() {
586
- accessor.handle.removeListener("change", this._handleChange);
587
- }
588
639
  }),
589
640
  // Reconcile local updates.
590
641
  EditorView2.updateListener.of(({ view, changes }) => {
@@ -600,6 +651,19 @@ import { Annotation as Annotation2, RangeSet } from "@codemirror/state";
600
651
  import { Decoration as Decoration2, EditorView as EditorView3, ViewPlugin as ViewPlugin3, WidgetType } from "@codemirror/view";
601
652
  import { Event } from "@dxos/async";
602
653
  import { Context } from "@dxos/context";
654
+ function _define_property5(obj, key, value) {
655
+ if (key in obj) {
656
+ Object.defineProperty(obj, key, {
657
+ value,
658
+ enumerable: true,
659
+ configurable: true,
660
+ writable: true
661
+ });
662
+ } else {
663
+ obj[key] = value;
664
+ }
665
+ return obj;
666
+ }
603
667
  var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/awareness/awareness.ts";
604
668
  var dummyProvider = {
605
669
  remoteStateChange: new Event(),
@@ -623,23 +687,6 @@ var awareness = (provider = dummyProvider) => {
623
687
  ];
624
688
  };
625
689
  var RemoteSelectionsDecorator = class {
626
- constructor(view) {
627
- this._ctx = new Context(void 0, {
628
- F: __dxlog_file3,
629
- L: 80
630
- });
631
- this.decorations = RangeSet.of([]);
632
- this._cursorConverter = view.state.facet(Cursor.converter);
633
- this._provider = view.state.facet(awarenessProvider);
634
- this._provider.open();
635
- this._provider.remoteStateChange.on(this._ctx, () => {
636
- view.dispatch({
637
- annotations: [
638
- RemoteSelectionChangedAnnotation.of([])
639
- ]
640
- });
641
- });
642
- }
643
690
  destroy() {
644
691
  void this._ctx.dispose();
645
692
  this._provider.close();
@@ -734,11 +781,29 @@ var RemoteSelectionsDecorator = class {
734
781
  }
735
782
  this.decorations = Decoration2.set(decorations2, true);
736
783
  }
784
+ constructor(view) {
785
+ _define_property5(this, "_ctx", new Context(void 0, {
786
+ F: __dxlog_file3,
787
+ L: 80
788
+ }));
789
+ _define_property5(this, "_cursorConverter", void 0);
790
+ _define_property5(this, "_provider", void 0);
791
+ _define_property5(this, "_lastAnchor", void 0);
792
+ _define_property5(this, "_lastHead", void 0);
793
+ _define_property5(this, "decorations", RangeSet.of([]));
794
+ this._cursorConverter = view.state.facet(Cursor.converter);
795
+ this._provider = view.state.facet(awarenessProvider);
796
+ this._provider.open();
797
+ this._provider.remoteStateChange.on(this._ctx, () => {
798
+ view.dispatch({
799
+ annotations: [
800
+ RemoteSelectionChangedAnnotation.of([])
801
+ ]
802
+ });
803
+ });
804
+ }
737
805
  };
738
806
  var RemoteCaretWidget = class extends WidgetType {
739
- constructor(_name, _color) {
740
- super(), this._name = _name, this._color = _color;
741
- }
742
807
  toDOM() {
743
808
  const span = document.createElement("span");
744
809
  span.className = "cm-collab-selectionCaret";
@@ -768,6 +833,9 @@ var RemoteCaretWidget = class extends WidgetType {
768
833
  ignoreEvent() {
769
834
  return true;
770
835
  }
836
+ constructor(_name, _color) {
837
+ super(), _define_property5(this, "_name", void 0), _define_property5(this, "_color", void 0), this._name = _name, this._color = _color;
838
+ }
771
839
  };
772
840
  var styles = EditorView3.theme({
773
841
  ".cm-collab-selection": {},
@@ -832,17 +900,22 @@ import { DeferredTask, Event as Event2, sleep } from "@dxos/async";
832
900
  import { Context as Context2 } from "@dxos/context";
833
901
  import { invariant } from "@dxos/invariant";
834
902
  import { log as log3 } from "@dxos/log";
903
+ function _define_property6(obj, key, value) {
904
+ if (key in obj) {
905
+ Object.defineProperty(obj, key, {
906
+ value,
907
+ enumerable: true,
908
+ configurable: true,
909
+ writable: true
910
+ });
911
+ } else {
912
+ obj[key] = value;
913
+ }
914
+ return obj;
915
+ }
835
916
  var __dxlog_file4 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/awareness/awareness-provider.ts";
836
917
  var DEBOUNCE_INTERVAL = 100;
837
918
  var SpaceAwarenessProvider = class {
838
- constructor(params) {
839
- this._remoteStates = /* @__PURE__ */ new Map();
840
- this.remoteStateChange = new Event2();
841
- this._space = params.space;
842
- this._channel = params.channel;
843
- this._peerId = params.peerId;
844
- this._info = params.info;
845
- }
846
919
  open() {
847
920
  this._ctx = new Context2(void 0, {
848
921
  F: __dxlog_file4,
@@ -932,6 +1005,21 @@ var SpaceAwarenessProvider = class {
932
1005
  this._remoteStates.set(message.state.peerId, message.state);
933
1006
  this.remoteStateChange.emit();
934
1007
  }
1008
+ constructor(params) {
1009
+ _define_property6(this, "_remoteStates", /* @__PURE__ */ new Map());
1010
+ _define_property6(this, "_space", void 0);
1011
+ _define_property6(this, "_channel", void 0);
1012
+ _define_property6(this, "_peerId", void 0);
1013
+ _define_property6(this, "_info", void 0);
1014
+ _define_property6(this, "_ctx", void 0);
1015
+ _define_property6(this, "_postTask", void 0);
1016
+ _define_property6(this, "_localState", void 0);
1017
+ _define_property6(this, "remoteStateChange", new Event2());
1018
+ this._space = params.space;
1019
+ this._channel = params.channel;
1020
+ this._peerId = params.peerId;
1021
+ this._info = params.info;
1022
+ }
935
1023
  };
936
1024
 
937
1025
  // src/extensions/blast.ts
@@ -939,6 +1027,19 @@ import { EditorView as EditorView4, keymap as keymap2 } from "@codemirror/view";
939
1027
  import defaultsDeep from "lodash.defaultsdeep";
940
1028
  import { throttle } from "@dxos/async";
941
1029
  import { invariant as invariant2 } from "@dxos/invariant";
1030
+ function _define_property7(obj, key, value) {
1031
+ if (key in obj) {
1032
+ Object.defineProperty(obj, key, {
1033
+ value,
1034
+ enumerable: true,
1035
+ configurable: true,
1036
+ writable: true
1037
+ });
1038
+ } else {
1039
+ obj[key] = value;
1040
+ }
1041
+ return obj;
1042
+ }
942
1043
  var __dxlog_file5 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/blast.ts";
943
1044
  var defaultOptions = {
944
1045
  effect: 2,
@@ -1033,34 +1134,6 @@ var blast = (options = defaultOptions) => {
1033
1134
  ];
1034
1135
  };
1035
1136
  var Blaster = class {
1036
- constructor(_node, _options) {
1037
- this._node = _node;
1038
- this._options = _options;
1039
- this._running = false;
1040
- this._shakeTime = 0;
1041
- this._shakeTimeMax = 0;
1042
- this._particles = [];
1043
- this._particlePointer = 0;
1044
- this._lastPoint = {
1045
- x: 0,
1046
- y: 0
1047
- };
1048
- this.shake = throttle(({ time }) => {
1049
- this._shakeTime = this._shakeTimeMax || time;
1050
- this._shakeTimeMax = time;
1051
- }, 100);
1052
- this.spawn = throttle(({ element, point }) => {
1053
- const color = getRGBComponents(element, this._options.color);
1054
- const numParticles = random(this._options.particleNumRange.min, this._options.particleNumRange.max);
1055
- const dir = this._lastPoint.x === point.x ? 0 : this._lastPoint.x < point.x ? 1 : -1;
1056
- this._lastPoint = point;
1057
- for (let i = numParticles; i--; i > 0) {
1058
- this._particles[this._particlePointer] = this._effect.create(point.x - dir * 16, point.y, color);
1059
- this._particlePointer = (this._particlePointer + 1) % this._options.maxParticles;
1060
- }
1061
- }, 100);
1062
- this._effect = this._options.effect === 1 ? new Effect1(_options) : new Effect2(_options);
1063
- }
1064
1137
  get node() {
1065
1138
  return this._node;
1066
1139
  }
@@ -1124,7 +1197,7 @@ var Blaster = class {
1124
1197
  }
1125
1198
  this._ctx.clearRect(0, 0, this._canvas.width ?? 0, this._canvas.height ?? 0);
1126
1199
  const now = (/* @__PURE__ */ new Date()).getTime();
1127
- this._lastTime ??= now;
1200
+ this._lastTime ?? (this._lastTime = now);
1128
1201
  const dt = (now - this._lastTime) / 1e3;
1129
1202
  this._lastTime = now;
1130
1203
  if (this._shakeTime > 0) {
@@ -1149,9 +1222,52 @@ var Blaster = class {
1149
1222
  this._effect.update(this._ctx, particle);
1150
1223
  }
1151
1224
  }
1225
+ constructor(_node, _options) {
1226
+ _define_property7(this, "_node", void 0);
1227
+ _define_property7(this, "_options", void 0);
1228
+ _define_property7(this, "_effect", void 0);
1229
+ _define_property7(this, "_canvas", void 0);
1230
+ _define_property7(this, "_ctx", void 0);
1231
+ _define_property7(this, "_running", void 0);
1232
+ _define_property7(this, "_lastTime", void 0);
1233
+ _define_property7(this, "_shakeTime", void 0);
1234
+ _define_property7(this, "_shakeTimeMax", void 0);
1235
+ _define_property7(this, "_particles", void 0);
1236
+ _define_property7(this, "_particlePointer", void 0);
1237
+ _define_property7(this, "_lastPoint", void 0);
1238
+ _define_property7(this, "shake", void 0);
1239
+ _define_property7(this, "spawn", void 0);
1240
+ this._node = _node;
1241
+ this._options = _options;
1242
+ this._running = false;
1243
+ this._shakeTime = 0;
1244
+ this._shakeTimeMax = 0;
1245
+ this._particles = [];
1246
+ this._particlePointer = 0;
1247
+ this._lastPoint = {
1248
+ x: 0,
1249
+ y: 0
1250
+ };
1251
+ this.shake = throttle(({ time }) => {
1252
+ this._shakeTime = this._shakeTimeMax || time;
1253
+ this._shakeTimeMax = time;
1254
+ }, 100);
1255
+ this.spawn = throttle(({ element, point }) => {
1256
+ const color = getRGBComponents(element, this._options.color);
1257
+ const numParticles = random(this._options.particleNumRange.min, this._options.particleNumRange.max);
1258
+ const dir = this._lastPoint.x === point.x ? 0 : this._lastPoint.x < point.x ? 1 : -1;
1259
+ this._lastPoint = point;
1260
+ for (let i = numParticles; i--; i > 0) {
1261
+ this._particles[this._particlePointer] = this._effect.create(point.x - dir * 16, point.y, color);
1262
+ this._particlePointer = (this._particlePointer + 1) % this._options.maxParticles;
1263
+ }
1264
+ }, 100);
1265
+ this._effect = this._options.effect === 1 ? new Effect1(_options) : new Effect2(_options);
1266
+ }
1152
1267
  };
1153
1268
  var Effect = class {
1154
1269
  constructor(_options) {
1270
+ _define_property7(this, "_options", void 0);
1155
1271
  this._options = _options;
1156
1272
  }
1157
1273
  };
@@ -1354,11 +1470,21 @@ import { isNonNullable } from "@dxos/util";
1354
1470
  // src/extensions/command/hint.ts
1355
1471
  import { RangeSetBuilder as RangeSetBuilder2 } from "@codemirror/state";
1356
1472
  import { Decoration as Decoration3, EditorView as EditorView5, ViewPlugin as ViewPlugin4, WidgetType as WidgetType2 } from "@codemirror/view";
1473
+ function _define_property8(obj, key, value) {
1474
+ if (key in obj) {
1475
+ Object.defineProperty(obj, key, {
1476
+ value,
1477
+ enumerable: true,
1478
+ configurable: true,
1479
+ writable: true
1480
+ });
1481
+ } else {
1482
+ obj[key] = value;
1483
+ }
1484
+ return obj;
1485
+ }
1357
1486
  var hint = ({ delay = 3e3, onHint }) => {
1358
1487
  return ViewPlugin4.fromClass(class {
1359
- constructor() {
1360
- this.decorations = Decoration3.none;
1361
- }
1362
1488
  update(update2) {
1363
1489
  if (this.timeout) {
1364
1490
  clearTimeout(this.timeout);
@@ -1390,6 +1516,10 @@ var hint = ({ delay = 3e3, onHint }) => {
1390
1516
  clearTimeout(this.timeout);
1391
1517
  }
1392
1518
  }
1519
+ constructor() {
1520
+ _define_property8(this, "decorations", Decoration3.none);
1521
+ _define_property8(this, "timeout", void 0);
1522
+ }
1393
1523
  }, {
1394
1524
  provide: (plugin) => [
1395
1525
  EditorView5.decorations.of((view) => view.plugin(plugin)?.decorations ?? Decoration3.none)
@@ -1397,9 +1527,6 @@ var hint = ({ delay = 3e3, onHint }) => {
1397
1527
  });
1398
1528
  };
1399
1529
  var Hint = class extends WidgetType2 {
1400
- constructor(content) {
1401
- super(), this.content = content;
1402
- }
1403
1530
  toDOM() {
1404
1531
  const wrap = document.createElement("span");
1405
1532
  wrap.className = "cm-placeholder";
@@ -1433,6 +1560,9 @@ var Hint = class extends WidgetType2 {
1433
1560
  ignoreEvent() {
1434
1561
  return false;
1435
1562
  }
1563
+ constructor(content) {
1564
+ super(), _define_property8(this, "content", void 0), this.content = content;
1565
+ }
1436
1566
  };
1437
1567
 
1438
1568
  // src/extensions/command/command.ts
@@ -1452,16 +1582,26 @@ var command = (options = {}) => {
1452
1582
  };
1453
1583
 
1454
1584
  // src/extensions/command/command-menu.ts
1455
- import { RangeSetBuilder as RangeSetBuilder3, StateField as StateField3, StateEffect as StateEffect3, Prec as Prec2 } from "@codemirror/state";
1456
- import { EditorView as EditorView8, ViewPlugin as ViewPlugin6, Decoration as Decoration5, keymap as keymap4 } from "@codemirror/view";
1585
+ import { Prec as Prec2, RangeSetBuilder as RangeSetBuilder3, StateEffect as StateEffect3, StateField as StateField3 } from "@codemirror/state";
1586
+ import { Decoration as Decoration5, EditorView as EditorView8, ViewPlugin as ViewPlugin6, keymap as keymap4 } from "@codemirror/view";
1457
1587
 
1458
1588
  // src/extensions/command/placeholder.ts
1459
- import { Decoration as Decoration4, EditorView as EditorView7, WidgetType as WidgetType3, ViewPlugin as ViewPlugin5 } from "@codemirror/view";
1589
+ import { Decoration as Decoration4, EditorView as EditorView7, ViewPlugin as ViewPlugin5, WidgetType as WidgetType3 } from "@codemirror/view";
1590
+ function _define_property9(obj, key, value) {
1591
+ if (key in obj) {
1592
+ Object.defineProperty(obj, key, {
1593
+ value,
1594
+ enumerable: true,
1595
+ configurable: true,
1596
+ writable: true
1597
+ });
1598
+ } else {
1599
+ obj[key] = value;
1600
+ }
1601
+ return obj;
1602
+ }
1460
1603
  var placeholder = ({ delay = 3e3, content }) => {
1461
1604
  const plugin = ViewPlugin5.fromClass(class {
1462
- constructor() {
1463
- this.decorations = Decoration4.none;
1464
- }
1465
1605
  update(update2) {
1466
1606
  if (this.timeout) {
1467
1607
  window.clearTimeout(this.timeout);
@@ -1488,6 +1628,10 @@ var placeholder = ({ delay = 3e3, content }) => {
1488
1628
  clearTimeout(this.timeout);
1489
1629
  }
1490
1630
  }
1631
+ constructor() {
1632
+ _define_property9(this, "decorations", Decoration4.none);
1633
+ _define_property9(this, "timeout", void 0);
1634
+ }
1491
1635
  }, {
1492
1636
  provide: (plugin2) => {
1493
1637
  return [
@@ -1503,9 +1647,6 @@ var placeholder = ({ delay = 3e3, content }) => {
1503
1647
  ] : plugin;
1504
1648
  };
1505
1649
  var Placeholder = class extends WidgetType3 {
1506
- constructor(content) {
1507
- super(), this.content = content;
1508
- }
1509
1650
  toDOM(view) {
1510
1651
  const wrap = document.createElement("span");
1511
1652
  wrap.className = "cm-placeholder";
@@ -1535,15 +1676,27 @@ var Placeholder = class extends WidgetType3 {
1535
1676
  ignoreEvent() {
1536
1677
  return false;
1537
1678
  }
1679
+ constructor(content) {
1680
+ super(), _define_property9(this, "content", void 0), this.content = content;
1681
+ }
1538
1682
  };
1539
1683
 
1540
1684
  // src/extensions/command/command-menu.ts
1541
- var commandMenu = (options) => {
1542
- const commandMenuPlugin = ViewPlugin6.fromClass(class {
1543
- constructor(view) {
1544
- this.view = view;
1545
- this.decorations = Decoration5.none;
1546
- }
1685
+ function _define_property10(obj, key, value) {
1686
+ if (key in obj) {
1687
+ Object.defineProperty(obj, key, {
1688
+ value,
1689
+ enumerable: true,
1690
+ configurable: true,
1691
+ writable: true
1692
+ });
1693
+ } else {
1694
+ obj[key] = value;
1695
+ }
1696
+ return obj;
1697
+ }
1698
+ var commandMenu = (options) => {
1699
+ const commandMenuPlugin = ViewPlugin6.fromClass(class {
1547
1700
  // TODO(wittjosiah): The decorations are repainted on every update, this occasionally causes menu to flicker.
1548
1701
  update(update2) {
1549
1702
  const builder = new RangeSetBuilder3();
@@ -1567,6 +1720,12 @@ var commandMenu = (options) => {
1567
1720
  }
1568
1721
  this.decorations = builder.finish();
1569
1722
  }
1723
+ constructor(view) {
1724
+ _define_property10(this, "view", void 0);
1725
+ _define_property10(this, "decorations", void 0);
1726
+ this.view = view;
1727
+ this.decorations = Decoration5.none;
1728
+ }
1570
1729
  }, {
1571
1730
  decorations: (v) => v.decorations
1572
1731
  });
@@ -1697,28 +1856,21 @@ var commandMenuState = StateField3.define({
1697
1856
  // src/extensions/command/floating-menu.ts
1698
1857
  import { EditorView as EditorView9, ViewPlugin as ViewPlugin7 } from "@codemirror/view";
1699
1858
  import { addEventListener } from "@dxos/async";
1859
+ function _define_property11(obj, key, value) {
1860
+ if (key in obj) {
1861
+ Object.defineProperty(obj, key, {
1862
+ value,
1863
+ enumerable: true,
1864
+ configurable: true,
1865
+ writable: true
1866
+ });
1867
+ } else {
1868
+ obj[key] = value;
1869
+ }
1870
+ return obj;
1871
+ }
1700
1872
  var floatingMenu = (options = {}) => [
1701
1873
  ViewPlugin7.fromClass(class {
1702
- constructor(view) {
1703
- this.view = view;
1704
- const container = view.scrollDOM;
1705
- if (getComputedStyle(container).position === "static") {
1706
- container.style.position = "relative";
1707
- }
1708
- {
1709
- const icon = document.createElement("dx-icon");
1710
- icon.setAttribute("icon", options.icon ?? "ph--dots-three-vertical--regular");
1711
- const button = document.createElement("button");
1712
- button.appendChild(icon);
1713
- this.tag = document.createElement("dx-ref-tag");
1714
- this.tag.classList.add("cm-ref-tag");
1715
- this.tag.appendChild(button);
1716
- }
1717
- container.appendChild(this.tag);
1718
- const handler = () => this.scheduleUpdate();
1719
- this.cleanup = addEventListener(container, "scroll", handler);
1720
- this.scheduleUpdate();
1721
- }
1722
1874
  destroy() {
1723
1875
  this.cleanup?.();
1724
1876
  this.tag.remove();
@@ -1762,6 +1914,30 @@ var floatingMenu = (options = {}) => [
1762
1914
  }
1763
1915
  this.rafId = requestAnimationFrame(this.updateButtonPosition.bind(this));
1764
1916
  }
1917
+ constructor(view) {
1918
+ _define_property11(this, "view", void 0);
1919
+ _define_property11(this, "tag", void 0);
1920
+ _define_property11(this, "rafId", void 0);
1921
+ _define_property11(this, "cleanup", void 0);
1922
+ this.view = view;
1923
+ const container = view.scrollDOM;
1924
+ if (getComputedStyle(container).position === "static") {
1925
+ container.style.position = "relative";
1926
+ }
1927
+ {
1928
+ const icon = document.createElement("dx-icon");
1929
+ icon.setAttribute("icon", options.icon ?? "ph--dots-three-vertical--regular");
1930
+ const button = document.createElement("button");
1931
+ button.appendChild(icon);
1932
+ this.tag = document.createElement("dx-ref-tag");
1933
+ this.tag.classList.add("cm-ref-tag");
1934
+ this.tag.appendChild(button);
1935
+ }
1936
+ container.appendChild(this.tag);
1937
+ const handler = () => this.scheduleUpdate();
1938
+ this.cleanup = addEventListener(container, "scroll", handler);
1939
+ this.scheduleUpdate();
1940
+ }
1765
1941
  }),
1766
1942
  EditorView9.theme({
1767
1943
  ".cm-ref-tag": {
@@ -1785,7 +1961,20 @@ var floatingMenu = (options = {}) => [
1785
1961
 
1786
1962
  // src/extensions/command/typeahead.ts
1787
1963
  import { EditorSelection, Prec as Prec3, RangeSetBuilder as RangeSetBuilder4 } from "@codemirror/state";
1788
- import { Decoration as Decoration6, keymap as keymap5, ViewPlugin as ViewPlugin8 } from "@codemirror/view";
1964
+ import { Decoration as Decoration6, ViewPlugin as ViewPlugin8, keymap as keymap5 } from "@codemirror/view";
1965
+ function _define_property12(obj, key, value) {
1966
+ if (key in obj) {
1967
+ Object.defineProperty(obj, key, {
1968
+ value,
1969
+ enumerable: true,
1970
+ configurable: true,
1971
+ writable: true
1972
+ });
1973
+ } else {
1974
+ obj[key] = value;
1975
+ }
1976
+ return obj;
1977
+ }
1789
1978
  var typeahead = ({ onComplete } = {}) => {
1790
1979
  let hint2;
1791
1980
  const complete = (view) => {
@@ -1807,9 +1996,6 @@ var typeahead = ({ onComplete } = {}) => {
1807
1996
  };
1808
1997
  return [
1809
1998
  ViewPlugin8.fromClass(class {
1810
- constructor() {
1811
- this.decorations = Decoration6.none;
1812
- }
1813
1999
  update(update2) {
1814
2000
  const builder = new RangeSetBuilder4();
1815
2001
  const selection = update2.view.state.selection.main;
@@ -1827,6 +2013,9 @@ var typeahead = ({ onComplete } = {}) => {
1827
2013
  }
1828
2014
  this.decorations = builder.finish();
1829
2015
  }
2016
+ constructor() {
2017
+ _define_property12(this, "decorations", Decoration6.none);
2018
+ }
1830
2019
  }, {
1831
2020
  decorations: (v) => v.decorations
1832
2021
  }),
@@ -1972,7 +2161,7 @@ var useCommandMenu = ({ viewRef, trigger, placeholder: placeholder3, getMenu })
1972
2161
  // src/extensions/comments.ts
1973
2162
  import { invertedEffects } from "@codemirror/commands";
1974
2163
  import { StateEffect as StateEffect4, StateField as StateField4 } from "@codemirror/state";
1975
- import { hoverTooltip, keymap as keymap7, Decoration as Decoration7, EditorView as EditorView11, ViewPlugin as ViewPlugin9 } from "@codemirror/view";
2164
+ import { Decoration as Decoration7, EditorView as EditorView11, ViewPlugin as ViewPlugin9, hoverTooltip, keymap as keymap7 } from "@codemirror/view";
1976
2165
  import sortBy from "lodash.sortby";
1977
2166
  import { useEffect } from "react";
1978
2167
  import { debounce as debounce2 } from "@dxos/async";
@@ -2073,6 +2262,19 @@ var selectionState = ({ getState, setState } = {}) => {
2073
2262
  };
2074
2263
 
2075
2264
  // src/extensions/comments.ts
2265
+ function _define_property13(obj, key, value) {
2266
+ if (key in obj) {
2267
+ Object.defineProperty(obj, key, {
2268
+ value,
2269
+ enumerable: true,
2270
+ configurable: true,
2271
+ writable: true
2272
+ });
2273
+ } else {
2274
+ obj[key] = value;
2275
+ }
2276
+ return obj;
2277
+ }
2076
2278
  var __dxlog_file7 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/comments.ts";
2077
2279
  var setComments = StateEffect4.define();
2078
2280
  var setSelection = StateEffect4.define();
@@ -2117,15 +2319,15 @@ var commentsState = StateField4.define({
2117
2319
  });
2118
2320
  var styles2 = EditorView11.theme({
2119
2321
  ".cm-comment, .cm-comment-current": {
2120
- margin: "0 -3px",
2121
- padding: "3px",
2122
- borderRadius: "3px",
2322
+ padding: "3px 0",
2323
+ backgroundColor: "var(--dx-cmCommentSurface)"
2324
+ },
2325
+ ".cm-comment > span, .cm-comment-current > span": {
2326
+ boxDecorationBreak: "clone",
2327
+ boxShadow: "0 0 1px 3px var(--dx-cmCommentSurface)",
2123
2328
  backgroundColor: "var(--dx-cmCommentSurface)",
2124
2329
  color: "var(--dx-cmComment)",
2125
2330
  cursor: "pointer"
2126
- },
2127
- ".cm-comment:hover, .cm-comment-current": {
2128
- textDecoration: "underline"
2129
2331
  }
2130
2332
  });
2131
2333
  var createCommentMark = (id, isCurrent) => Decoration7.mark({
@@ -2144,7 +2346,7 @@ var commentsDecorations = EditorView11.decorations.compute([
2144
2346
  if (!range) {
2145
2347
  log4.warn("Invalid range:", range, {
2146
2348
  F: __dxlog_file7,
2147
- L: 135,
2349
+ L: 136,
2148
2350
  S: void 0,
2149
2351
  C: (f, a) => f(...a)
2150
2352
  });
@@ -2460,9 +2662,10 @@ var scrollThreadIntoView = (view, id, center = true) => {
2460
2662
  };
2461
2663
  var ExternalCommentSync = class {
2462
2664
  constructor(view, id, subscribe, getComments) {
2463
- this.destroy = () => {
2665
+ _define_property13(this, "unsubscribe", void 0);
2666
+ _define_property13(this, "destroy", () => {
2464
2667
  this.unsubscribe();
2465
- };
2668
+ });
2466
2669
  const updateComments = () => {
2467
2670
  const comments2 = getComments();
2468
2671
  if (id === view.state.facet(documentId)) {
@@ -2511,7 +2714,7 @@ var debugNodeLogger = (log9 = console.log) => {
2511
2714
  };
2512
2715
 
2513
2716
  // src/extensions/dnd.ts
2514
- import { dropCursor, EditorView as EditorView12 } from "@codemirror/view";
2717
+ import { EditorView as EditorView12, dropCursor } from "@codemirror/view";
2515
2718
  var styles3 = EditorView12.theme({
2516
2719
  ".cm-dropCursor": {
2517
2720
  borderLeft: "2px solid var(--dx-accentText)",
@@ -2560,39 +2763,8 @@ import { generateName } from "@dxos/display-name";
2560
2763
  import { log as log5 } from "@dxos/log";
2561
2764
  import { hexToHue, isNotFalsy as isNotFalsy2 } from "@dxos/util";
2562
2765
 
2563
- // src/extensions/focus.ts
2564
- import { StateEffect as StateEffect5, StateField as StateField6 } from "@codemirror/state";
2565
- import { EditorView as EditorView13 } from "@codemirror/view";
2566
- var focusEffect = StateEffect5.define();
2567
- var focusField = StateField6.define({
2568
- create: () => false,
2569
- update: (value, tr) => {
2570
- for (const effect of tr.effects) {
2571
- if (effect.is(focusEffect)) {
2572
- return effect.value;
2573
- }
2574
- }
2575
- return value;
2576
- }
2577
- });
2578
- var focus = [
2579
- focusField,
2580
- EditorView13.domEventHandlers({
2581
- focus: (event, view) => {
2582
- setTimeout(() => view.dispatch({
2583
- effects: focusEffect.of(true)
2584
- }));
2585
- },
2586
- blur: (event, view) => {
2587
- setTimeout(() => view.dispatch({
2588
- effects: focusEffect.of(false)
2589
- }));
2590
- }
2591
- })
2592
- ];
2593
-
2594
2766
  // src/defaults.ts
2595
- import { EditorView as EditorView14 } from "@codemirror/view";
2767
+ import { EditorView as EditorView13 } from "@codemirror/view";
2596
2768
  import { mx as mx2 } from "@dxos/react-ui-theme";
2597
2769
 
2598
2770
  // src/styles/markdown.ts
@@ -2645,7 +2817,7 @@ var defaultTheme = {
2645
2817
  fontFamily: fontBody,
2646
2818
  // NOTE: Base font size (otherwise defined by HTML tag, which might be different for storybook).
2647
2819
  fontSize: "16px",
2648
- lineHeight: 1.5,
2820
+ lineHeight: "24px",
2649
2821
  color: "unset"
2650
2822
  },
2651
2823
  /**
@@ -2653,8 +2825,7 @@ var defaultTheme = {
2653
2825
  * NOTE: Gutters should have the same top margin as the content.
2654
2826
  */
2655
2827
  ".cm-gutters": {
2656
- borderRight: "none",
2657
- background: "transparent"
2828
+ borderRight: "none"
2658
2829
  },
2659
2830
  ".cm-gutter": {},
2660
2831
  ".cm-gutter.cm-lineNumbers": {
@@ -2668,13 +2839,14 @@ var defaultTheme = {
2668
2839
  * Height is set to match the corresponding line (which may have wrapped).
2669
2840
  */
2670
2841
  ".cm-gutterElement": {
2671
- fontSize: "12px",
2672
- lineHeight: "24px"
2842
+ lineHeight: "24px",
2843
+ fontSize: "12px"
2673
2844
  },
2674
2845
  /**
2675
2846
  * Line.
2676
2847
  */
2677
2848
  ".cm-line": {
2849
+ lineHeight: "24px",
2678
2850
  paddingInline: 0
2679
2851
  },
2680
2852
  ".cm-activeLine": {
@@ -2729,7 +2901,7 @@ var defaultTheme = {
2729
2901
  * Tooltip.
2730
2902
  */
2731
2903
  ".cm-tooltip": {
2732
- background: "var(--dx-baseSurface)"
2904
+ background: "var(--dx-modalSurface)"
2733
2905
  },
2734
2906
  ".cm-tooltip-below": {},
2735
2907
  /**
@@ -2749,7 +2921,8 @@ var defaultTheme = {
2749
2921
  padding: "4px"
2750
2922
  },
2751
2923
  ".cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected]": {
2752
- background: "var(--dx-hoverSurface)"
2924
+ background: "var(--dx-accentSurface)",
2925
+ color: "var(--dx-accentSurfaceText)"
2753
2926
  },
2754
2927
  ".cm-tooltip.cm-tooltip-autocomplete > ul > completion-section": {
2755
2928
  paddingLeft: "4px !important",
@@ -2803,7 +2976,7 @@ var defaultTheme = {
2803
2976
  outline: "1px solid transparent"
2804
2977
  },
2805
2978
  ".cm-panel input, .cm-panel button": {
2806
- backgroundColor: "var(--dx-input)"
2979
+ backgroundColor: "var(--dx-inputSurface)"
2807
2980
  },
2808
2981
  ".cm-panel input:focus, .cm-panel button:focus": {
2809
2982
  outline: "1px solid var(--dx-neutralFocusIndicator)"
@@ -2845,19 +3018,52 @@ var editorSlots = {
2845
3018
  className: editorWidth
2846
3019
  }
2847
3020
  };
2848
- var editorGutter = EditorView14.theme({
3021
+ var editorGutter = EditorView13.theme({
2849
3022
  ".cm-gutters": {
2850
- background: "var(--dx-baseSurface)",
3023
+ // NOTE: Color required to cover content if scrolling horizontally.
3024
+ // TODO(burdon): Non-transparent background clips the focus ring.
3025
+ background: "var(--dx-baseSurface) !important",
2851
3026
  paddingRight: "1rem"
2852
3027
  }
2853
3028
  });
2854
- var editorMonospace = EditorView14.theme({
3029
+ var editorMonospace = EditorView13.theme({
2855
3030
  ".cm-content": {
2856
3031
  fontFamily: fontMono
2857
3032
  }
2858
3033
  });
2859
3034
  var editorWithToolbarLayout = "grid grid-cols-1 grid-rows-[min-content_1fr] data-[toolbar=disabled]:grid-rows-[1fr] justify-center content-start overflow-hidden";
2860
- 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");
3035
+ var stackItemContentEditorClassNames = (role) => mx2("p-0.5 dx-focus-ring-inset attention-surface data-[toolbar=disabled]:pbs-2", role === "section" ? "[&_.cm-scroller]:overflow-hidden [&_.cm-scroller]:min-bs-24" : "min-bs-0");
3036
+
3037
+ // src/extensions/focus.ts
3038
+ import { StateEffect as StateEffect5, StateField as StateField6 } from "@codemirror/state";
3039
+ import { EditorView as EditorView14 } from "@codemirror/view";
3040
+ var focusEffect = StateEffect5.define();
3041
+ var focusField = StateField6.define({
3042
+ create: () => false,
3043
+ update: (value, tr) => {
3044
+ for (const effect of tr.effects) {
3045
+ if (effect.is(focusEffect)) {
3046
+ return effect.value;
3047
+ }
3048
+ }
3049
+ return value;
3050
+ }
3051
+ });
3052
+ var focus = [
3053
+ focusField,
3054
+ EditorView14.domEventHandlers({
3055
+ focus: (event, view) => {
3056
+ setTimeout(() => view.dispatch({
3057
+ effects: focusEffect.of(true)
3058
+ }));
3059
+ },
3060
+ blur: (event, view) => {
3061
+ setTimeout(() => view.dispatch({
3062
+ effects: focusEffect.of(false)
3063
+ }));
3064
+ }
3065
+ })
3066
+ ];
2861
3067
 
2862
3068
  // src/extensions/factories.ts
2863
3069
  var __dxlog_file8 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/factories.ts";
@@ -2871,7 +3077,7 @@ var defaultBasicOptions = {
2871
3077
  history: true,
2872
3078
  keymap: "standard",
2873
3079
  lineWrapping: true,
2874
- search: true
3080
+ search: false
2875
3081
  };
2876
3082
  var keymaps = {
2877
3083
  // https://codemirror.net/docs/ref/#commands.standardKeymap
@@ -2886,7 +3092,7 @@ var createBasicExtensions = (_props) => {
2886
3092
  EditorView15.exceptionSink.of((err) => {
2887
3093
  log5.catch(err, void 0, {
2888
3094
  F: __dxlog_file8,
2889
- L: 100,
3095
+ L: 101,
2890
3096
  S: void 0,
2891
3097
  C: (f, a) => f(...a)
2892
3098
  });
@@ -3035,16 +3241,29 @@ var folding = (_props = {}) => [
3035
3241
  // src/extensions/hashtag.tsx
3036
3242
  import { Decoration as Decoration8, EditorView as EditorView17, MatchDecorator, ViewPlugin as ViewPlugin11, WidgetType as WidgetType4 } from "@codemirror/view";
3037
3243
  import { getHashColor, mx as mx3 } from "@dxos/react-ui-theme";
3038
- var TagWidget = class extends WidgetType4 {
3039
- constructor(_text) {
3040
- super(), this._text = _text;
3244
+ function _define_property14(obj, key, value) {
3245
+ if (key in obj) {
3246
+ Object.defineProperty(obj, key, {
3247
+ value,
3248
+ enumerable: true,
3249
+ configurable: true,
3250
+ writable: true
3251
+ });
3252
+ } else {
3253
+ obj[key] = value;
3041
3254
  }
3255
+ return obj;
3256
+ }
3257
+ var TagWidget = class extends WidgetType4 {
3042
3258
  toDOM() {
3043
3259
  const span = document.createElement("span");
3044
3260
  span.className = mx3("cm-tag", getHashColor(this._text).tag);
3045
3261
  span.textContent = this._text;
3046
3262
  return span;
3047
3263
  }
3264
+ constructor(_text) {
3265
+ super(), _define_property14(this, "_text", void 0), this._text = _text;
3266
+ }
3048
3267
  };
3049
3268
  var tagMatcher = new MatchDecorator({
3050
3269
  regexp: /#(\w+)\W/g,
@@ -3054,12 +3273,13 @@ var tagMatcher = new MatchDecorator({
3054
3273
  });
3055
3274
  var hashtag = () => [
3056
3275
  ViewPlugin11.fromClass(class {
3057
- constructor(view) {
3058
- this.tags = tagMatcher.createDeco(view);
3059
- }
3060
3276
  update(update2) {
3061
3277
  this.tags = tagMatcher.updateDeco(update2, this.tags);
3062
3278
  }
3279
+ constructor(view) {
3280
+ _define_property14(this, "tags", void 0);
3281
+ this.tags = tagMatcher.createDeco(view);
3282
+ }
3063
3283
  }, {
3064
3284
  decorations: (instance) => instance.tags,
3065
3285
  provide: (plugin) => EditorView17.atomicRanges.of((view) => {
@@ -4294,7 +4514,7 @@ var processEditorPayload = (view, { type, data }) => {
4294
4514
  // src/extensions/markdown/bundle.ts
4295
4515
  import { completionKeymap as completionKeymap2 } from "@codemirror/autocomplete";
4296
4516
  import { defaultKeymap as defaultKeymap2, indentWithTab as indentWithTab2 } from "@codemirror/commands";
4297
- import { markdownLanguage as markdownLanguage3, markdown } from "@codemirror/lang-markdown";
4517
+ import { markdown, markdownLanguage as markdownLanguage3 } from "@codemirror/lang-markdown";
4298
4518
  import { syntaxHighlighting as syntaxHighlighting2 } from "@codemirror/language";
4299
4519
  import { languages } from "@codemirror/language-data";
4300
4520
  import { keymap as keymap10 } from "@codemirror/view";
@@ -4303,7 +4523,7 @@ import { isNotFalsy as isNotFalsy3 } from "@dxos/util";
4303
4523
  // src/extensions/markdown/highlight.ts
4304
4524
  import { markdownLanguage as markdownLanguage2 } from "@codemirror/lang-markdown";
4305
4525
  import { HighlightStyle } from "@codemirror/language";
4306
- import { tags, styleTags, Tag } from "@lezer/highlight";
4526
+ import { Tag, styleTags, tags } from "@lezer/highlight";
4307
4527
  import { Table } from "@lezer/markdown";
4308
4528
  var markdownTags = {
4309
4529
  Blockquote: Tag.define(),
@@ -4499,7 +4719,8 @@ var createMarkdownExtensions = (options = {}) => {
4499
4719
  // Parser extensions.
4500
4720
  extensions: [
4501
4721
  // GFM provided by default.
4502
- markdownTagsExtensions
4722
+ markdownTagsExtensions,
4723
+ ...options.extensions ?? []
4503
4724
  ]
4504
4725
  }),
4505
4726
  // Custom styles.
@@ -4544,7 +4765,7 @@ var convertTreeToJson = (state) => {
4544
4765
  // src/extensions/markdown/decorate.ts
4545
4766
  import { syntaxTree as syntaxTree7 } from "@codemirror/language";
4546
4767
  import { RangeSetBuilder as RangeSetBuilder6, StateEffect as StateEffect6 } from "@codemirror/state";
4547
- import { EditorView as EditorView23, Decoration as Decoration11, WidgetType as WidgetType7, ViewPlugin as ViewPlugin13 } from "@codemirror/view";
4768
+ import { Decoration as Decoration11, EditorView as EditorView23, ViewPlugin as ViewPlugin13, WidgetType as WidgetType7 } from "@codemirror/view";
4548
4769
  import { invariant as invariant4 } from "@dxos/invariant";
4549
4770
  import { mx as mx4 } from "@dxos/react-ui-theme";
4550
4771
 
@@ -4696,6 +4917,19 @@ var getValidUrl = (str) => {
4696
4917
  import { syntaxTree as syntaxTree5 } from "@codemirror/language";
4697
4918
  import { StateField as StateField8 } from "@codemirror/state";
4698
4919
  import { Decoration as Decoration9, EditorView as EditorView20, WidgetType as WidgetType5 } from "@codemirror/view";
4920
+ function _define_property15(obj, key, value) {
4921
+ if (key in obj) {
4922
+ Object.defineProperty(obj, key, {
4923
+ value,
4924
+ enumerable: true,
4925
+ configurable: true,
4926
+ writable: true
4927
+ });
4928
+ } else {
4929
+ obj[key] = value;
4930
+ }
4931
+ return obj;
4932
+ }
4699
4933
  var image = (_options = {}) => {
4700
4934
  return [
4701
4935
  StateField8.define({
@@ -4762,9 +4996,6 @@ var preloadImage = (url) => {
4762
4996
  }
4763
4997
  };
4764
4998
  var ImageWidget = class extends WidgetType5 {
4765
- constructor(_url) {
4766
- super(), this._url = _url;
4767
- }
4768
4999
  eq(other) {
4769
5000
  return this._url === other._url;
4770
5001
  }
@@ -4779,6 +5010,9 @@ var ImageWidget = class extends WidgetType5 {
4779
5010
  }
4780
5011
  return img;
4781
5012
  }
5013
+ constructor(_url) {
5014
+ super(), _define_property15(this, "_url", void 0), this._url = _url;
5015
+ }
4782
5016
  };
4783
5017
 
4784
5018
  // src/extensions/markdown/styles.ts
@@ -4908,6 +5142,19 @@ var formattingStyles = EditorView21.theme({
4908
5142
  import { syntaxTree as syntaxTree6 } from "@codemirror/language";
4909
5143
  import { RangeSetBuilder as RangeSetBuilder5, StateField as StateField9 } from "@codemirror/state";
4910
5144
  import { Decoration as Decoration10, EditorView as EditorView22, WidgetType as WidgetType6 } from "@codemirror/view";
5145
+ function _define_property16(obj, key, value) {
5146
+ if (key in obj) {
5147
+ Object.defineProperty(obj, key, {
5148
+ value,
5149
+ enumerable: true,
5150
+ configurable: true,
5151
+ writable: true
5152
+ });
5153
+ } else {
5154
+ obj[key] = value;
5155
+ }
5156
+ return obj;
5157
+ }
4911
5158
  var table = (options = {}) => {
4912
5159
  return StateField9.define({
4913
5160
  create: (state) => update(state, options),
@@ -4939,7 +5186,8 @@ var update = (state, _options) => {
4939
5186
  break;
4940
5187
  }
4941
5188
  case "TableRow": {
4942
- (getTable().rows ??= []).push([]);
5189
+ var _getTable;
5190
+ ((_getTable = getTable()).rows ?? (_getTable.rows = [])).push([]);
4943
5191
  break;
4944
5192
  }
4945
5193
  case "TableCell": {
@@ -4970,9 +5218,6 @@ var update = (state, _options) => {
4970
5218
  return builder.finish();
4971
5219
  };
4972
5220
  var TableWidget = class extends WidgetType6 {
4973
- constructor(_table) {
4974
- super(), this._table = _table;
4975
- }
4976
5221
  eq(other) {
4977
5222
  return this._table.header?.join() === other._table.header?.join() && this._table.rows?.join() === other._table.rows?.join();
4978
5223
  }
@@ -5000,9 +5245,25 @@ var TableWidget = class extends WidgetType6 {
5000
5245
  ignoreEvent(e) {
5001
5246
  return !/^mouse/.test(e.type);
5002
5247
  }
5248
+ constructor(_table) {
5249
+ super(), _define_property16(this, "_table", void 0), this._table = _table;
5250
+ }
5003
5251
  };
5004
5252
 
5005
5253
  // src/extensions/markdown/decorate.ts
5254
+ function _define_property17(obj, key, value) {
5255
+ if (key in obj) {
5256
+ Object.defineProperty(obj, key, {
5257
+ value,
5258
+ enumerable: true,
5259
+ configurable: true,
5260
+ writable: true
5261
+ });
5262
+ } else {
5263
+ obj[key] = value;
5264
+ }
5265
+ return obj;
5266
+ }
5006
5267
  var __dxlog_file9 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/markdown/decorate.ts";
5007
5268
  var Unicode = {
5008
5269
  emDash: "\u2014",
@@ -5018,9 +5279,6 @@ var HorizontalRuleWidget = class extends WidgetType7 {
5018
5279
  }
5019
5280
  };
5020
5281
  var LinkButton = class extends WidgetType7 {
5021
- constructor(url, render) {
5022
- super(), this.url = url, this.render = render;
5023
- }
5024
5282
  eq(other) {
5025
5283
  return this.url === other.url;
5026
5284
  }
@@ -5032,11 +5290,11 @@ var LinkButton = class extends WidgetType7 {
5032
5290
  }, view);
5033
5291
  return el;
5034
5292
  }
5293
+ constructor(url, render) {
5294
+ super(), _define_property17(this, "url", void 0), _define_property17(this, "render", void 0), this.url = url, this.render = render;
5295
+ }
5035
5296
  };
5036
5297
  var CheckboxWidget = class extends WidgetType7 {
5037
- constructor(_checked) {
5038
- super(), this._checked = _checked;
5039
- }
5040
5298
  eq(other) {
5041
5299
  return this._checked === other._checked;
5042
5300
  }
@@ -5076,11 +5334,11 @@ var CheckboxWidget = class extends WidgetType7 {
5076
5334
  ignoreEvent() {
5077
5335
  return false;
5078
5336
  }
5337
+ constructor(_checked) {
5338
+ super(), _define_property17(this, "_checked", void 0), this._checked = _checked;
5339
+ }
5079
5340
  };
5080
5341
  var TextWidget = class extends WidgetType7 {
5081
- constructor(text, className) {
5082
- super(), this.text = text, this.className = className;
5083
- }
5084
5342
  toDOM() {
5085
5343
  const el = document.createElement("span");
5086
5344
  if (this.className) {
@@ -5089,6 +5347,9 @@ var TextWidget = class extends WidgetType7 {
5089
5347
  el.innerText = this.text;
5090
5348
  return el;
5091
5349
  }
5350
+ constructor(text, className) {
5351
+ super(), _define_property17(this, "text", void 0), _define_property17(this, "className", void 0), this.text = text, this.className = className;
5352
+ }
5092
5353
  };
5093
5354
  var hide = Decoration11.replace({});
5094
5355
  var blockQuote = Decoration11.line({
@@ -5135,7 +5396,7 @@ var buildDecorations2 = (view, options, focus2) => {
5135
5396
  const getHeaderLevels = (node, level) => {
5136
5397
  invariant4(level > 0, void 0, {
5137
5398
  F: __dxlog_file9,
5138
- L: 179,
5399
+ L: 180,
5139
5400
  S: void 0,
5140
5401
  A: [
5141
5402
  "level > 0",
@@ -5174,7 +5435,7 @@ var buildDecorations2 = (view, options, focus2) => {
5174
5435
  const getCurrentListLevel = () => {
5175
5436
  invariant4(listLevels.length, void 0, {
5176
5437
  F: __dxlog_file9,
5177
- L: 201,
5438
+ L: 202,
5178
5439
  S: void 0,
5179
5440
  A: [
5180
5441
  "listLevels.length",
@@ -5414,9 +5675,6 @@ var forceUpdate = StateEffect6.define();
5414
5675
  var decorateMarkdown = (options = {}) => {
5415
5676
  return [
5416
5677
  ViewPlugin13.fromClass(class {
5417
- constructor(view) {
5418
- ({ deco: this.deco, atomicDeco: this.atomicDeco } = buildDecorations2(view, options, view.hasFocus));
5419
- }
5420
5678
  update(update2) {
5421
5679
  if (update2.docChanged || update2.viewportChanged || update2.focusChanged || update2.transactions.some((tr) => tr.effects.some((effect) => effect.is(forceUpdate))) || update2.selectionSet && !options.selectionChangeDelay) {
5422
5680
  ({ deco: this.deco, atomicDeco: this.atomicDeco } = buildDecorations2(update2.view, options, update2.view.hasFocus));
@@ -5443,6 +5701,12 @@ var decorateMarkdown = (options = {}) => {
5443
5701
  destroy() {
5444
5702
  this.clearUpdate();
5445
5703
  }
5704
+ constructor(view) {
5705
+ _define_property17(this, "deco", void 0);
5706
+ _define_property17(this, "atomicDeco", void 0);
5707
+ _define_property17(this, "pendingUpdate", void 0);
5708
+ ({ deco: this.deco, atomicDeco: this.atomicDeco } = buildDecorations2(view, options, view.hasFocus));
5709
+ }
5446
5710
  }, {
5447
5711
  provide: (plugin) => [
5448
5712
  EditorView23.atomicRanges.of((view) => view.plugin(plugin)?.atomicDeco ?? Decoration11.none),
@@ -5584,6 +5848,19 @@ import { syntaxTree as syntaxTree9 } from "@codemirror/language";
5584
5848
  import { StateField as StateField10 } from "@codemirror/state";
5585
5849
  import { Facet as Facet2 } from "@codemirror/state";
5586
5850
  import { invariant as invariant5 } from "@dxos/invariant";
5851
+ function _define_property18(obj, key, value) {
5852
+ if (key in obj) {
5853
+ Object.defineProperty(obj, key, {
5854
+ value,
5855
+ enumerable: true,
5856
+ configurable: true,
5857
+ writable: true
5858
+ });
5859
+ } else {
5860
+ obj[key] = value;
5861
+ }
5862
+ return obj;
5863
+ }
5587
5864
  var __dxlog_file11 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/extensions/outliner/tree.ts";
5588
5865
  var itemToJSON = ({ type, index, level, lineRange, contentRange, children }) => {
5589
5866
  return {
@@ -5596,18 +5873,6 @@ var itemToJSON = ({ type, index, level, lineRange, contentRange, children }) =>
5596
5873
  };
5597
5874
  };
5598
5875
  var Tree = class {
5599
- constructor(node) {
5600
- this.type = "root";
5601
- this.index = -1;
5602
- this.level = -1;
5603
- this.children = [];
5604
- this.node = node;
5605
- this.lineRange = {
5606
- from: node.from,
5607
- to: node.to
5608
- };
5609
- this.contentRange = this.lineRange;
5610
- }
5611
5876
  toJSON() {
5612
5877
  return itemToJSON(this);
5613
5878
  }
@@ -5657,6 +5922,21 @@ var Tree = class {
5657
5922
  lastDescendant(item) {
5658
5923
  return item.children.length > 0 ? this.lastDescendant(item.children.at(-1)) : item;
5659
5924
  }
5925
+ constructor(node) {
5926
+ _define_property18(this, "type", "root");
5927
+ _define_property18(this, "index", -1);
5928
+ _define_property18(this, "level", -1);
5929
+ _define_property18(this, "node", void 0);
5930
+ _define_property18(this, "lineRange", void 0);
5931
+ _define_property18(this, "contentRange", void 0);
5932
+ _define_property18(this, "children", []);
5933
+ this.node = node;
5934
+ this.lineRange = {
5935
+ from: node.from,
5936
+ to: node.to
5937
+ };
5938
+ this.contentRange = this.lineRange;
5939
+ }
5660
5940
  };
5661
5941
  var getRange = (tree, item) => {
5662
5942
  const lastDescendant = tree.lastDescendant(item);
@@ -6337,6 +6617,19 @@ var editor = () => [
6337
6617
  ];
6338
6618
 
6339
6619
  // src/extensions/outliner/outliner.ts
6620
+ function _define_property19(obj, key, value) {
6621
+ if (key in obj) {
6622
+ Object.defineProperty(obj, key, {
6623
+ value,
6624
+ enumerable: true,
6625
+ configurable: true,
6626
+ writable: true
6627
+ });
6628
+ } else {
6629
+ obj[key] = value;
6630
+ }
6631
+ return obj;
6632
+ }
6340
6633
  var outliner = (options = {}) => [
6341
6634
  // Commands.
6342
6635
  Prec4.highest(commands()),
@@ -6361,10 +6654,6 @@ var outliner = (options = {}) => [
6361
6654
  ];
6362
6655
  var decorations = () => [
6363
6656
  ViewPlugin15.fromClass(class {
6364
- constructor(view) {
6365
- this.decorations = Decoration12.none;
6366
- this.updateDecorations(view.state, view);
6367
- }
6368
6657
  update(update2) {
6369
6658
  const selectionChanged = !selectionEquals(update2.state.facet(selectionFacet), update2.startState.facet(selectionFacet));
6370
6659
  if (update2.focusChanged || update2.docChanged || update2.viewportChanged || update2.selectionSet || selectionChanged) {
@@ -6391,6 +6680,10 @@ var decorations = () => [
6391
6680
  }
6392
6681
  this.decorations = Decoration12.set(decorations2);
6393
6682
  }
6683
+ constructor(view) {
6684
+ _define_property19(this, "decorations", Decoration12.none);
6685
+ this.updateDecorations(view.state, view);
6686
+ }
6394
6687
  }, {
6395
6688
  decorations: (v) => v.decorations
6396
6689
  }),
@@ -6433,6 +6726,19 @@ import "@dxos/lit-ui/dx-ref-tag.pcss";
6433
6726
  import { syntaxTree as syntaxTree10 } from "@codemirror/language";
6434
6727
  import { RangeSetBuilder as RangeSetBuilder7, StateField as StateField11 } from "@codemirror/state";
6435
6728
  import { Decoration as Decoration13, EditorView as EditorView25, WidgetType as WidgetType8 } from "@codemirror/view";
6729
+ function _define_property20(obj, key, value) {
6730
+ if (key in obj) {
6731
+ Object.defineProperty(obj, key, {
6732
+ value,
6733
+ enumerable: true,
6734
+ configurable: true,
6735
+ writable: true
6736
+ });
6737
+ } else {
6738
+ obj[key] = value;
6739
+ }
6740
+ return obj;
6741
+ }
6436
6742
  var preview = (options = {}) => {
6437
6743
  return [
6438
6744
  // NOTE: Atomic block decorations must be created from a state field, now a widget, otherwise it results in the following error:
@@ -6499,9 +6805,6 @@ var buildDecorations3 = (state, options) => {
6499
6805
  return builder.finish();
6500
6806
  };
6501
6807
  var PreviewInlineWidget = class extends WidgetType8 {
6502
- constructor(_options, _link) {
6503
- super(), this._options = _options, this._link = _link;
6504
- }
6505
6808
  // override ignoreEvent() {
6506
6809
  // return false;
6507
6810
  // }
@@ -6514,11 +6817,11 @@ var PreviewInlineWidget = class extends WidgetType8 {
6514
6817
  root.setAttribute("refId", this._link.ref);
6515
6818
  return root;
6516
6819
  }
6517
- };
6518
- var PreviewBlockWidget = class extends WidgetType8 {
6519
6820
  constructor(_options, _link) {
6520
- super(), this._options = _options, this._link = _link;
6821
+ super(), _define_property20(this, "_options", void 0), _define_property20(this, "_link", void 0), this._options = _options, this._link = _link;
6521
6822
  }
6823
+ };
6824
+ var PreviewBlockWidget = class extends WidgetType8 {
6522
6825
  // override ignoreEvent() {
6523
6826
  // return true;
6524
6827
  // }
@@ -6534,6 +6837,9 @@ var PreviewBlockWidget = class extends WidgetType8 {
6534
6837
  destroy() {
6535
6838
  this._options.removeBlockContainer?.(this._link);
6536
6839
  }
6840
+ constructor(_options, _link) {
6841
+ super(), _define_property20(this, "_options", void 0), _define_property20(this, "_link", void 0), this._options = _options, this._link = _link;
6842
+ }
6537
6843
  };
6538
6844
 
6539
6845
  // src/extensions/typewriter.ts
@@ -6782,23 +7088,32 @@ import { createMenuAction, createMenuItemGroup } from "@dxos/react-ui-menu";
6782
7088
  var useEditorToolbarState = (initialState = {}) => {
6783
7089
  return useMemo4(() => live(initialState), []);
6784
7090
  };
6785
- var createEditorAction = (id, invoke, properties) => {
7091
+ var createEditorAction = (id, props, invoke) => {
6786
7092
  const { label = [
6787
7093
  `${id} label`,
6788
7094
  {
6789
7095
  ns: translationKey
6790
7096
  }
6791
- ], ...rest } = properties;
7097
+ ], ...rest } = props;
6792
7098
  return createMenuAction(id, invoke, {
6793
7099
  label,
6794
7100
  ...rest
6795
7101
  });
6796
7102
  };
6797
- var createEditorActionGroup = (id, props, icon) => createMenuItemGroup(id, {
6798
- icon,
6799
- iconOnly: true,
6800
- ...props
6801
- });
7103
+ var createEditorActionGroup = (id, props, icon) => {
7104
+ const { label = [
7105
+ `${id} label`,
7106
+ {
7107
+ ns: translationKey
7108
+ }
7109
+ ], ...rest } = props;
7110
+ return createMenuItemGroup(id, {
7111
+ label,
7112
+ icon,
7113
+ iconOnly: true,
7114
+ ...rest
7115
+ });
7116
+ };
6802
7117
 
6803
7118
  // src/components/EditorToolbar/blocks.ts
6804
7119
  var createBlockGroupAction = (value) => createEditorActionGroup("block", {
@@ -6812,7 +7127,13 @@ var createBlockActions = (value, getView, blankLine) => Object.entries({
6812
7127
  table: "ph--table--regular"
6813
7128
  }).map(([type, icon]) => {
6814
7129
  const checked = type === value;
6815
- return createEditorAction(type, () => {
7130
+ return createEditorAction(type, {
7131
+ checked,
7132
+ ...type === "table" && {
7133
+ disabled: !!blankLine
7134
+ },
7135
+ icon
7136
+ }, () => {
6816
7137
  const view = getView();
6817
7138
  if (!view) {
6818
7139
  return;
@@ -6828,12 +7149,6 @@ var createBlockActions = (value, getView, blankLine) => Object.entries({
6828
7149
  insertTable(view);
6829
7150
  break;
6830
7151
  }
6831
- }, {
6832
- checked,
6833
- ...type === "table" && {
6834
- disabled: !!blankLine
6835
- },
6836
- icon
6837
7152
  });
6838
7153
  });
6839
7154
  var createBlocks = (state, getView) => {
@@ -6873,7 +7188,10 @@ var createFormattingGroup = (formatting) => createEditorActionGroup("formatting"
6873
7188
  });
6874
7189
  var createFormattingActions = (formatting, getView) => Object.entries(formats).map(([type, icon]) => {
6875
7190
  const checked = !!formatting[type];
6876
- return createEditorAction(type, () => {
7191
+ return createEditorAction(type, {
7192
+ checked,
7193
+ icon
7194
+ }, () => {
6877
7195
  const view = getView();
6878
7196
  if (!view) {
6879
7197
  return;
@@ -6884,9 +7202,6 @@ var createFormattingActions = (formatting, getView) => Object.entries(formats).m
6884
7202
  }
6885
7203
  const inlineType = type === "strong" ? Inline.Strong : type === "emphasis" ? Inline.Emphasis : type === "strikethrough" ? Inline.Strikethrough : Inline.Code;
6886
7204
  setStyle(inlineType, !checked)(view);
6887
- }, {
6888
- checked,
6889
- icon
6890
7205
  });
6891
7206
  });
6892
7207
  var createFormatting = (state, getView) => {
@@ -6927,7 +7242,7 @@ var createHeadingActions = (getView) => Object.entries({
6927
7242
  "6": "ph--text-h-six--regular"
6928
7243
  }).map(([levelStr, icon]) => {
6929
7244
  const level = parseInt(levelStr);
6930
- return createEditorAction(`heading--${levelStr}`, () => setHeading(level)(getView()), {
7245
+ return createEditorAction(`heading--${levelStr}`, {
6931
7246
  label: [
6932
7247
  "heading level label",
6933
7248
  {
@@ -6936,7 +7251,7 @@ var createHeadingActions = (getView) => Object.entries({
6936
7251
  }
6937
7252
  ],
6938
7253
  icon
6939
- });
7254
+ }, () => setHeading(level)(getView()));
6940
7255
  });
6941
7256
  var computeHeadingValue = (state) => {
6942
7257
  const blockType = state ? state.blockType : "paragraph";
@@ -6966,10 +7281,10 @@ var createHeadings = (state, getView) => {
6966
7281
  };
6967
7282
 
6968
7283
  // src/components/EditorToolbar/image.ts
6969
- var createImageUploadAction = (onImageUpload) => createEditorAction("image", onImageUpload, {
7284
+ var createImageUploadAction = (onImageUpload) => createEditorAction("image", {
6970
7285
  testId: "editor.toolbar.image",
6971
7286
  icon: "ph--image-square--regular"
6972
- });
7287
+ }, onImageUpload);
6973
7288
  var createImageUpload = (onImageUpload) => ({
6974
7289
  nodes: [
6975
7290
  createImageUploadAction(onImageUpload)
@@ -6995,7 +7310,10 @@ var createListGroupAction = (value) => createEditorActionGroup("list", {
6995
7310
  });
6996
7311
  var createListActions = (value, getView) => Object.entries(listStyles).map(([listStyle, icon]) => {
6997
7312
  const checked = value === listStyle;
6998
- return createEditorAction(`list-${listStyle}`, () => {
7313
+ return createEditorAction(`list-${listStyle}`, {
7314
+ checked,
7315
+ icon
7316
+ }, () => {
6999
7317
  const view = getView();
7000
7318
  if (!view) {
7001
7319
  return;
@@ -7006,9 +7324,6 @@ var createListActions = (value, getView) => Object.entries(listStyles).map(([lis
7006
7324
  } else {
7007
7325
  addList(listType)(view);
7008
7326
  }
7009
- }, {
7010
- checked,
7011
- icon
7012
7327
  });
7013
7328
  });
7014
7329
  var createLists = (state, getView) => {
@@ -7035,10 +7350,10 @@ var createLists = (state, getView) => {
7035
7350
 
7036
7351
  // src/components/EditorToolbar/search.ts
7037
7352
  import { openSearchPanel } from "@codemirror/search";
7038
- var createSearchAction = (getView) => createEditorAction("search", () => openSearchPanel(getView()), {
7353
+ var createSearchAction = (getView) => createEditorAction("search", {
7039
7354
  testId: "editor.toolbar.search",
7040
7355
  icon: "ph--magnifying-glass--regular"
7041
- });
7356
+ }, () => openSearchPanel(getView()));
7042
7357
  var createSearch = (getView) => ({
7043
7358
  nodes: [
7044
7359
  createSearchAction(getView)
@@ -7064,7 +7379,7 @@ var createViewModeActions = (value, onViewModeChange) => Object.entries({
7064
7379
  readonly: "ph--pencil-slash--regular"
7065
7380
  }).map(([viewMode, icon]) => {
7066
7381
  const checked = viewMode === value;
7067
- return createEditorAction(`view-mode--${viewMode}`, () => onViewModeChange(viewMode), {
7382
+ return createEditorAction(`view-mode--${viewMode}`, {
7068
7383
  label: [
7069
7384
  `${viewMode} mode label`,
7070
7385
  {
@@ -7073,7 +7388,7 @@ var createViewModeActions = (value, onViewModeChange) => Object.entries({
7073
7388
  ],
7074
7389
  checked,
7075
7390
  icon
7076
- });
7391
+ }, () => onViewModeChange(viewMode));
7077
7392
  });
7078
7393
  var createViewMode = (state, onViewModeChange) => {
7079
7394
  const value = state.viewMode ?? "source";
@@ -7098,61 +7413,62 @@ var createViewMode = (state, onViewModeChange) => {
7098
7413
  };
7099
7414
 
7100
7415
  // src/components/EditorToolbar/EditorToolbar.tsx
7101
- var createToolbar = ({ getView, state, customActions, ...features }) => {
7416
+ var createToolbarActions = ({ getView, state, customActions, ...features }) => {
7102
7417
  return Rx.make((get2) => {
7103
- const nodes = [];
7104
- const edges = [];
7418
+ const graph = {
7419
+ nodes: [],
7420
+ edges: []
7421
+ };
7105
7422
  if (features.headings ?? true) {
7106
7423
  const headings2 = get2(rxFromSignal(() => createHeadings(state, getView)));
7107
- nodes.push(...headings2.nodes);
7108
- edges.push(...headings2.edges);
7424
+ graph.nodes.push(...headings2.nodes);
7425
+ graph.edges.push(...headings2.edges);
7109
7426
  }
7110
7427
  if (features.formatting ?? true) {
7111
7428
  const formatting = get2(rxFromSignal(() => createFormatting(state, getView)));
7112
- nodes.push(...formatting.nodes);
7113
- edges.push(...formatting.edges);
7429
+ graph.nodes.push(...formatting.nodes);
7430
+ graph.edges.push(...formatting.edges);
7114
7431
  }
7115
7432
  if (features.lists ?? true) {
7116
7433
  const lists = get2(rxFromSignal(() => createLists(state, getView)));
7117
- nodes.push(...lists.nodes);
7118
- edges.push(...lists.edges);
7434
+ graph.nodes.push(...lists.nodes);
7435
+ graph.edges.push(...lists.edges);
7119
7436
  }
7120
7437
  if (features.blocks ?? true) {
7121
7438
  const blocks = get2(rxFromSignal(() => createBlocks(state, getView)));
7122
- nodes.push(...blocks.nodes);
7123
- edges.push(...blocks.edges);
7439
+ graph.nodes.push(...blocks.nodes);
7440
+ graph.edges.push(...blocks.edges);
7124
7441
  }
7125
7442
  if (features.image) {
7126
7443
  const image2 = get2(rxFromSignal(() => createImageUpload(features.image)));
7127
- nodes.push(...image2.nodes);
7128
- edges.push(...image2.edges);
7444
+ graph.nodes.push(...image2.nodes);
7445
+ graph.edges.push(...image2.edges);
7446
+ }
7447
+ {
7448
+ const gap = createGapSeparator();
7449
+ graph.nodes.push(...gap.nodes);
7450
+ graph.edges.push(...gap.edges);
7129
7451
  }
7130
- const editorToolbarGap = createGapSeparator();
7131
- nodes.push(...editorToolbarGap.nodes);
7132
- edges.push(...editorToolbarGap.edges);
7133
7452
  if (customActions) {
7134
7453
  const custom = get2(customActions);
7135
- nodes.push(...custom.nodes);
7136
- edges.push(...custom.edges);
7454
+ graph.nodes.push(...custom.nodes);
7455
+ graph.edges.push(...custom.edges);
7137
7456
  }
7138
7457
  if (features.search ?? true) {
7139
7458
  const search = get2(rxFromSignal(() => createSearch(getView)));
7140
- nodes.push(...search.nodes);
7141
- edges.push(...search.edges);
7459
+ graph.nodes.push(...search.nodes);
7460
+ graph.edges.push(...search.edges);
7142
7461
  }
7143
7462
  if (features.viewMode) {
7144
7463
  const viewMode = get2(rxFromSignal(() => createViewMode(state, features.viewMode)));
7145
- nodes.push(...viewMode.nodes);
7146
- edges.push(...viewMode.edges);
7464
+ graph.nodes.push(...viewMode.nodes);
7465
+ graph.edges.push(...viewMode.edges);
7147
7466
  }
7148
- return {
7149
- nodes,
7150
- edges
7151
- };
7467
+ return graph;
7152
7468
  });
7153
7469
  };
7154
7470
  var useEditorToolbarActionGraph = (props) => {
7155
- const menuCreator = useMemo5(() => createToolbar({
7471
+ const menuCreator = useMemo5(() => createToolbarActions({
7156
7472
  getView: props.getView,
7157
7473
  state: props.state,
7158
7474
  customActions: props.customActions,
@@ -7197,7 +7513,7 @@ var EditorToolbar = /* @__PURE__ */ memo(({ classNames, attendableId, role, ...p
7197
7513
 
7198
7514
  // src/components/Popover/CommandMenu.tsx
7199
7515
  import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
7200
- import React5, { useCallback as useCallback4, useEffect as useEffect3, useRef as useRef3 } from "react";
7516
+ import React5, { Fragment, useCallback as useCallback4, useEffect as useEffect3, useRef as useRef3 } from "react";
7201
7517
  import { Icon as Icon2, Popover, toLocalizedString, useThemeContext as useThemeContext2, useTranslation } from "@dxos/react-ui";
7202
7518
  var CommandMenu = ({ groups, currentItem, onSelect }) => {
7203
7519
  var _effect = _useSignals3();
@@ -7214,7 +7530,7 @@ var CommandMenu = ({ groups, currentItem, onSelect }) => {
7214
7530
  ])
7215
7531
  }, /* @__PURE__ */ React5.createElement(Popover.Viewport, {
7216
7532
  classNames: tx("menu.viewport", "menu__viewport--exotic-unfocusable", {})
7217
- }, /* @__PURE__ */ React5.createElement("ul", null, groupsWithItems.map((group, index) => /* @__PURE__ */ React5.createElement(React5.Fragment, {
7533
+ }, /* @__PURE__ */ React5.createElement("ul", null, groupsWithItems.map((group, index) => /* @__PURE__ */ React5.createElement(Fragment, {
7218
7534
  key: group.id
7219
7535
  }, /* @__PURE__ */ React5.createElement(CommandGroup, {
7220
7536
  group,
@@ -7463,7 +7779,7 @@ var linkSlashCommands = {
7463
7779
  // src/components/Popover/RefPopover.tsx
7464
7780
  import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
7465
7781
  import { createContext } from "@radix-ui/react-context";
7466
- import React6, { useRef as useRef4, useState as useState3, useEffect as useEffect4, useCallback as useCallback5, forwardRef as forwardRef2 } from "react";
7782
+ import React6, { forwardRef as forwardRef2, useCallback as useCallback5, useEffect as useEffect4, useRef as useRef4, useState as useState3 } from "react";
7467
7783
  import { addEventListener as addEventListener2 } from "@dxos/async";
7468
7784
  import { Popover as Popover2 } from "@dxos/react-ui";
7469
7785
  var customEventOptions = {
@@ -7547,7 +7863,7 @@ var PreviewProvider = ({ children, onLookup }) => {
7547
7863
  // src/components/Popover/RefDropdownMenu.tsx
7548
7864
  import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
7549
7865
  import { createContext as createContext2 } from "@radix-ui/react-context";
7550
- import React7, { useRef as useRef5, useState as useState4, useEffect as useEffect5, useCallback as useCallback6 } from "react";
7866
+ import React7, { useCallback as useCallback6, useEffect as useEffect5, useRef as useRef5, useState as useState4 } from "react";
7551
7867
  import { addEventListener as addEventListener3 } from "@dxos/async";
7552
7868
  import { DropdownMenu } from "@dxos/react-ui";
7553
7869
  var customEventOptions2 = {