@dxos/react-ui-editor 0.4.6-main.4d649cb → 0.4.6-main.7879c71

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 (32) hide show
  1. package/dist/lib/browser/index.mjs +90 -94
  2. package/dist/lib/browser/index.mjs.map +3 -3
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/types/src/components/TextEditor/automerge.stories.d.ts +3 -5
  5. package/dist/types/src/components/TextEditor/automerge.stories.d.ts.map +1 -1
  6. package/dist/types/src/extensions/automerge/automerge.d.ts +2 -7
  7. package/dist/types/src/extensions/automerge/automerge.d.ts.map +1 -1
  8. package/dist/types/src/extensions/automerge/cursor.d.ts +2 -3
  9. package/dist/types/src/extensions/automerge/cursor.d.ts.map +1 -1
  10. package/dist/types/src/extensions/automerge/defs.d.ts +9 -2
  11. package/dist/types/src/extensions/automerge/defs.d.ts.map +1 -1
  12. package/dist/types/src/extensions/markdown/decorate.d.ts.map +1 -1
  13. package/dist/types/src/hooks/defs.d.ts +1 -0
  14. package/dist/types/src/hooks/defs.d.ts.map +1 -1
  15. package/dist/types/src/hooks/useEditorView.d.ts +1 -0
  16. package/dist/types/src/hooks/useEditorView.d.ts.map +1 -1
  17. package/dist/types/src/hooks/useTextEditor.d.ts +2 -2
  18. package/dist/types/src/hooks/useTextEditor.d.ts.map +1 -1
  19. package/dist/types/src/hooks/useTextModel.d.ts +12 -4
  20. package/dist/types/src/hooks/useTextModel.d.ts.map +1 -1
  21. package/dist/types/src/themes/default.d.ts.map +1 -1
  22. package/package.json +24 -24
  23. package/src/components/TextEditor/automerge.stories.tsx +15 -16
  24. package/src/extensions/automerge/automerge.ts +10 -15
  25. package/src/extensions/automerge/cursor.ts +2 -3
  26. package/src/extensions/automerge/defs.ts +15 -2
  27. package/src/extensions/markdown/decorate.ts +13 -49
  28. package/src/hooks/defs.ts +2 -0
  29. package/src/hooks/useEditorView.ts +2 -0
  30. package/src/hooks/useTextEditor.ts +6 -10
  31. package/src/hooks/useTextModel.ts +34 -5
  32. package/src/themes/default.ts +7 -0
@@ -189,7 +189,7 @@ import get from "lodash.get";
189
189
  import { next as A } from "@dxos/automerge/automerge";
190
190
  import { log } from "@dxos/log";
191
191
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/automerge/cursor.ts";
192
- var cursorConverter = (handle, path) => ({
192
+ var cursorConverter = ({ handle, path }) => ({
193
193
  // TODO(burdon): Handle assoc to associate with a previous character.
194
194
  toCursor: (pos) => {
195
195
  const doc = handle.docSync();
@@ -205,7 +205,7 @@ var cursorConverter = (handle, path) => ({
205
205
  } catch (err) {
206
206
  log.catch(err, void 0, {
207
207
  F: __dxlog_file,
208
- L: 31,
208
+ L: 30,
209
209
  S: void 0,
210
210
  C: (f, a) => f(...a)
211
211
  });
@@ -233,7 +233,7 @@ var cursorConverter = (handle, path) => ({
233
233
  } catch (err) {
234
234
  log.catch(err, void 0, {
235
235
  F: __dxlog_file,
236
- L: 59,
236
+ L: 58,
237
237
  S: void 0,
238
238
  C: (f, a) => f(...a)
239
239
  });
@@ -244,6 +244,7 @@ var cursorConverter = (handle, path) => ({
244
244
 
245
245
  // packages/ui/react-ui-editor/src/extensions/automerge/defs.ts
246
246
  import { Annotation, StateEffect } from "@codemirror/state";
247
+ import get2 from "lodash.get";
247
248
  var getPath = (state, field) => state.field(field).path;
248
249
  var getLastHeads = (state, field) => state.field(field).lastHeads;
249
250
  var updateHeadsEffect = StateEffect.define({});
@@ -441,16 +442,16 @@ var Syncer = class {
441
442
  };
442
443
 
443
444
  // packages/ui/react-ui-editor/src/extensions/automerge/automerge.ts
444
- var automerge = ({ handle, path }) => {
445
+ var automerge = (accessor) => {
445
446
  const syncState = StateField2.define({
446
447
  create: () => ({
447
- path: path.slice(),
448
- lastHeads: A4.getHeads(handle.docSync()),
448
+ path: accessor.path.slice(),
449
+ lastHeads: A4.getHeads(accessor.handle.docSync()),
449
450
  unreconciledTransactions: []
450
451
  }),
451
452
  update: (value, tr) => {
452
453
  const result = {
453
- path: path.slice(),
454
+ path: accessor.path.slice(),
454
455
  lastHeads: value.lastHeads,
455
456
  unreconciledTransactions: value.unreconciledTransactions.slice()
456
457
  };
@@ -471,18 +472,18 @@ var automerge = ({ handle, path }) => {
471
472
  return result;
472
473
  }
473
474
  });
474
- const syncer = new Syncer(handle, syncState);
475
+ const syncer = new Syncer(accessor.handle, syncState);
475
476
  return [
476
- Cursor.converter.of(cursorConverter(handle, path)),
477
+ Cursor.converter.of(cursorConverter(accessor)),
477
478
  syncState,
478
479
  // Reconcile external updates.
479
480
  ViewPlugin.fromClass(class {
480
481
  constructor(_view) {
481
482
  this._view = _view;
482
- handle.addListener("change", this._handleChange.bind(this));
483
+ accessor.handle.addListener("change", this._handleChange.bind(this));
483
484
  }
484
485
  destroy() {
485
- handle.removeListener("change", this._handleChange.bind(this));
486
+ accessor.handle.removeListener("change", this._handleChange.bind(this));
486
487
  }
487
488
  _handleChange() {
488
489
  syncer.reconcile(this._view, false);
@@ -1133,10 +1134,10 @@ var inlineUrl = mx(code, "px-1");
1133
1134
  var blockquote = mx("pl-1 mr-1 border-is-4 border-primary-500/70 dark:border-primary-500/30", light);
1134
1135
 
1135
1136
  // packages/ui/react-ui-editor/src/styles/tokens.ts
1136
- import get2 from "lodash.get";
1137
+ import get3 from "lodash.get";
1137
1138
  import { tailwindConfig } from "@dxos/react-ui-theme";
1138
1139
  var tokens = tailwindConfig({}).theme;
1139
- var getToken = (path, defaultValue = void 0) => get2(tokens, path, defaultValue);
1140
+ var getToken = (path, defaultValue = void 0) => get3(tokens, path, defaultValue);
1140
1141
 
1141
1142
  // packages/ui/react-ui-editor/src/styles/layout.ts
1142
1143
  var editorWithToolbarLayout = "grid grid-cols-1 grid-rows-[min-content_1fr] data-[toolbar=disabled]:grid-rows-[1fr] justify-center content-start overflow-hidden";
@@ -1899,18 +1900,6 @@ import { syntaxTree } from "@codemirror/language";
1899
1900
  import { RangeSetBuilder } from "@codemirror/state";
1900
1901
  import { EditorView as EditorView10, Decoration as Decoration4, WidgetType as WidgetType2, ViewPlugin as ViewPlugin3 } from "@codemirror/view";
1901
1902
  import { mx as mx2 } from "@dxos/react-ui-theme";
1902
- var FencedCodeBoundary = class extends WidgetType2 {
1903
- constructor(_className) {
1904
- super();
1905
- this._className = _className;
1906
- }
1907
- toDOM() {
1908
- const el = document.createElement("span");
1909
- el.innerHTML = " ";
1910
- el.className = mx2("cm-code cm-codeblock", this._className);
1911
- return el;
1912
- }
1913
- };
1914
1903
  var HorizontalRuleWidget = class extends WidgetType2 {
1915
1904
  toDOM() {
1916
1905
  const el = document.createElement("span");
@@ -1971,11 +1960,14 @@ var CheckboxWidget = class extends WidgetType2 {
1971
1960
  }
1972
1961
  };
1973
1962
  var hide = Decoration4.replace({});
1974
- var fencedCodeTop = Decoration4.replace({
1975
- widget: new FencedCodeBoundary("cm-codeblock-end cm-codeblock-first")
1963
+ var fencedCodeLine = Decoration4.line({
1964
+ class: mx2("cm-code cm-codeblock-line")
1976
1965
  });
1977
- var fencedCodeBottom = Decoration4.replace({
1978
- widget: new FencedCodeBoundary("cm-codeblock-end cm-codeblock-last")
1966
+ var fencedCodeLineFirst = Decoration4.line({
1967
+ class: mx2("cm-code cm-codeblock-line", "cm-codeblock-first")
1968
+ });
1969
+ var fencedCodeLineLast = Decoration4.line({
1970
+ class: mx2("cm-code cm-codeblock-line", "cm-codeblock-last")
1979
1971
  });
1980
1972
  var horizontalRule = Decoration4.replace({
1981
1973
  widget: new HorizontalRuleWidget()
@@ -2016,12 +2008,9 @@ var buildDecorations = (view, options) => {
2016
2008
  }
2017
2009
  const first = block.from <= node.from;
2018
2010
  const last = block.to >= node.to;
2011
+ builder.add(block.from, block.from, first ? fencedCodeLineFirst : last ? fencedCodeLineLast : fencedCodeLine);
2019
2012
  if (!editing && (first || last)) {
2020
- builder.add(block.from, block.to, first ? fencedCodeTop : fencedCodeBottom);
2021
- } else {
2022
- builder.add(block.from, block.from, Decoration4.line({
2023
- class: mx2("cm-code cm-codeblock-line", first && "cm-codeblock-first", last && "cm-codeblock-last")
2024
- }));
2013
+ builder.add(block.from, block.to, hide);
2025
2014
  }
2026
2015
  }
2027
2016
  return false;
@@ -2112,16 +2101,12 @@ var formattingStyles = EditorView10.baseTheme({
2112
2101
  }
2113
2102
  },
2114
2103
  "& .cm-codeblock-first": {
2115
- "&::after": {
2116
- borderTopLeftRadius: ".5rem",
2117
- borderTopRightRadius: ".5rem"
2118
- }
2104
+ borderTopLeftRadius: ".5rem",
2105
+ borderTopRightRadius: ".5rem"
2119
2106
  },
2120
2107
  "& .cm-codeblock-last": {
2121
- "&::after": {
2122
- borderBottomLeftRadius: ".5rem",
2123
- borderBottomRightRadius: ".5rem"
2124
- }
2108
+ borderBottomLeftRadius: ".5rem",
2109
+ borderBottomRightRadius: ".5rem"
2125
2110
  },
2126
2111
  "&light .cm-codeblock-line, &light .cm-activeLine.cm-codeblock-line": {
2127
2112
  background: getToken("extend.semanticColors.input.light"),
@@ -2131,18 +2116,6 @@ var formattingStyles = EditorView10.baseTheme({
2131
2116
  background: getToken("extend.semanticColors.input.dark"),
2132
2117
  mixBlendMode: "lighten"
2133
2118
  },
2134
- "&light .cm-codeblock-first, &light .cm-codeblock-last": {
2135
- mixBlendMode: "darken",
2136
- "&::after": {
2137
- background: getToken("extend.semanticColors.input.light")
2138
- }
2139
- },
2140
- "&dark .cm-codeblock-first, &dark .cm-codeblock-last": {
2141
- mixBlendMode: "lighten",
2142
- "&::after": {
2143
- background: getToken("extend.semanticColors.input.dark")
2144
- }
2145
- },
2146
2119
  "& .cm-hr": {
2147
2120
  display: "inline-block",
2148
2121
  width: "100%",
@@ -3572,7 +3545,7 @@ var typewriter = ({ delay = 75, items = defaultItems } = {}) => {
3572
3545
  };
3573
3546
 
3574
3547
  // packages/ui/react-ui-editor/src/themes/default.ts
3575
- import get3 from "lodash.get";
3548
+ import get4 from "lodash.get";
3576
3549
  var defaultTheme = {
3577
3550
  //
3578
3551
  // Main layout:
@@ -3606,7 +3579,7 @@ var defaultTheme = {
3606
3579
  // TODO(burdon): Reconcile with docs: https://codemirror.net/docs/guide
3607
3580
  // Inside of that is the scroller element. If the editor has its own scrollbar, this one should be styled with overflow: auto. But it doesn't have to—the editor also supports growing to accomodate its content, or growing up to a certain max-height and then scrolling.
3608
3581
  overflowY: "auto",
3609
- fontFamily: get3(tokens, "fontFamily.mono", []).join(","),
3582
+ fontFamily: get4(tokens, "fontFamily.mono", []).join(","),
3610
3583
  lineHeight: 1.5
3611
3584
  },
3612
3585
  ".cm-content": {
@@ -3616,11 +3589,11 @@ var defaultTheme = {
3616
3589
  fontSize: "16px"
3617
3590
  },
3618
3591
  "&light .cm-content": {
3619
- color: get3(tokens, "extend.semanticColors.base.fg.light", "black"),
3592
+ color: get4(tokens, "extend.semanticColors.base.fg.light", "black"),
3620
3593
  caretColor: "black"
3621
3594
  },
3622
3595
  "&dark .cm-content": {
3623
- color: get3(tokens, "extend.semanticColors.base.fg.dark", "white"),
3596
+ color: get4(tokens, "extend.semanticColors.base.fg.dark", "white"),
3624
3597
  caretColor: "white"
3625
3598
  },
3626
3599
  //
@@ -3633,10 +3606,10 @@ var defaultTheme = {
3633
3606
  borderLeft: "2px solid white"
3634
3607
  },
3635
3608
  "&light .cm-placeholder": {
3636
- color: get3(tokens, "extend.semanticColors.description.light", "rgba(0,0,0,.2)")
3609
+ color: get4(tokens, "extend.semanticColors.description.light", "rgba(0,0,0,.2)")
3637
3610
  },
3638
3611
  "&dark .cm-placeholder": {
3639
- color: get3(tokens, "extend.semanticColors.description.dark", "rgba(255,255,255,.2)")
3612
+ color: get4(tokens, "extend.semanticColors.description.dark", "rgba(255,255,255,.2)")
3640
3613
  },
3641
3614
  //
3642
3615
  // line
@@ -3648,39 +3621,45 @@ var defaultTheme = {
3648
3621
  background: "transparent"
3649
3622
  },
3650
3623
  //
3624
+ // gutter
3625
+ //
3626
+ ".cm-gutterElement": {
3627
+ width: "48px"
3628
+ },
3629
+ //
3651
3630
  // Selection
3652
3631
  //
3653
3632
  "&light .cm-selectionBackground": {
3654
- background: get3(tokens, "extend.colors.primary.100")
3633
+ background: get4(tokens, "extend.colors.primary.100")
3655
3634
  },
3656
3635
  "&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground": {
3657
- background: get3(tokens, "extend.colors.primary.200")
3636
+ background: get4(tokens, "extend.colors.primary.200")
3658
3637
  },
3659
3638
  "&dark .cm-selectionBackground": {
3660
- background: get3(tokens, "extend.colors.primary.700")
3639
+ background: get4(tokens, "extend.colors.primary.700")
3661
3640
  },
3662
3641
  "&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground": {
3663
- background: get3(tokens, "extend.colors.primary.600")
3642
+ background: get4(tokens, "extend.colors.primary.600")
3664
3643
  },
3665
3644
  //
3666
3645
  // Search
3667
3646
  //
3668
3647
  "&light .cm-searchMatch": {
3669
- backgroundColor: get3(tokens, "extend.colors.yellow.100")
3648
+ backgroundColor: get4(tokens, "extend.colors.yellow.100")
3670
3649
  },
3671
3650
  "&dark .cm-searchMatch": {
3672
- backgroundColor: get3(tokens, "extend.colors.yellow.700")
3651
+ backgroundColor: get4(tokens, "extend.colors.yellow.700")
3673
3652
  },
3674
3653
  //
3675
3654
  // link
3676
3655
  //
3677
3656
  ".cm-link": {
3678
- color: get3(tokens, "extend.colors.primary.500"),
3657
+ color: get4(tokens, "extend.colors.primary.500"),
3679
3658
  textDecorationLine: "underline",
3680
3659
  textDecorationThickness: "1px",
3681
3660
  textUnderlineOffset: "2px",
3682
3661
  borderRadius: ".125rem",
3683
- fontFamily: get3(tokens, "fontFamily.body", []).join(",")
3662
+ fontFamily: get4(tokens, "fontFamily.body", []).join(",")
3684
3663
  },
3685
3664
  //
3686
3665
  // tooltip
@@ -3702,7 +3681,7 @@ var defaultTheme = {
3702
3681
  display: "none"
3703
3682
  },
3704
3683
  ".cm-completionLabel": {
3705
- fontFamily: get3(tokens, "fontFamily.body", []).join(",")
3684
+ fontFamily: get4(tokens, "fontFamily.body", []).join(",")
3706
3685
  },
3707
3686
  ".cm-completionMatchedText": {
3708
3687
  textDecoration: "none"
@@ -3711,15 +3690,15 @@ var defaultTheme = {
3711
3690
  // table
3712
3691
  //
3713
3692
  ".cm-table *": {
3714
- fontFamily: `${get3(tokens, "fontFamily.mono", []).join(",")} !important`,
3693
+ fontFamily: `${get4(tokens, "fontFamily.mono", []).join(",")} !important`,
3715
3694
  textDecoration: "none !important"
3716
3695
  },
3717
3696
  ".cm-table-head": {
3718
3697
  padding: "2px 16px 2px 0px",
3719
- borderBottom: `1px solid ${get3(tokens, "extend.colors.neutral.500")}`,
3698
+ borderBottom: `1px solid ${get4(tokens, "extend.colors.neutral.500")}`,
3720
3699
  fontWeight: 100,
3721
3700
  textAlign: "left",
3722
- color: get3(tokens, "extend.colors.neutral.500")
3701
+ color: get4(tokens, "extend.colors.neutral.500")
3723
3702
  },
3724
3703
  ".cm-table-cell": {
3725
3704
  padding: "2px 16px 2px 0px"
@@ -3766,23 +3745,23 @@ var defaultTheme = {
3766
3745
  * </div
3767
3746
  */
3768
3747
  ".cm-panels": {
3769
- border: `1px solid ${get3(tokens, "extend.colors.neutral.200")}`
3748
+ border: `1px solid ${get4(tokens, "extend.colors.neutral.200")}`
3770
3749
  },
3771
3750
  ".cm-panel": {
3772
- background: get3(tokens, "extend.colors.neutral.50"),
3773
- fontFamily: get3(tokens, "fontFamily.body", []).join(",")
3751
+ background: get4(tokens, "extend.colors.neutral.50"),
3752
+ fontFamily: get4(tokens, "fontFamily.body", []).join(",")
3774
3753
  },
3775
3754
  ".cm-button": {
3776
3755
  margin: "4px",
3777
- fontFamily: get3(tokens, "fontFamily.body", []).join(","),
3778
- background: get3(tokens, "extend.colors.neutral.100"),
3756
+ fontFamily: get4(tokens, "fontFamily.body", []).join(","),
3757
+ background: get4(tokens, "extend.colors.neutral.100"),
3779
3758
  backgroundImage: "none",
3780
3759
  border: "none",
3781
3760
  "&:hover": {
3782
- background: get3(tokens, "extend.colors.neutral.200")
3761
+ background: get4(tokens, "extend.colors.neutral.200")
3783
3762
  },
3784
3763
  "&:active": {
3785
- background: get3(tokens, "extend.colors.neutral.300"),
3764
+ background: get4(tokens, "extend.colors.neutral.300"),
3786
3765
  backgroundImage: "none"
3787
3766
  }
3788
3767
  },
@@ -3792,26 +3771,26 @@ var defaultTheme = {
3792
3771
  };
3793
3772
  var textTheme = {
3794
3773
  ".cm-scroller": {
3795
- fontFamily: get3(tokens, "fontFamily.body", []).join(",")
3774
+ fontFamily: get4(tokens, "fontFamily.body", []).join(",")
3796
3775
  },
3797
3776
  ".cm-placeholder": {
3798
- fontFamily: get3(tokens, "fontFamily.body", []).join(",")
3777
+ fontFamily: get4(tokens, "fontFamily.body", []).join(",")
3799
3778
  }
3800
3779
  };
3801
3780
  var markdownTheme = {
3802
3781
  ".cm-scroller": {
3803
- fontFamily: get3(tokens, "fontFamily.body", []).join(",")
3782
+ fontFamily: get4(tokens, "fontFamily.body", []).join(",")
3804
3783
  },
3805
3784
  ".cm-placeholder": {
3806
- fontFamily: get3(tokens, "fontFamily.body", []).join(",")
3785
+ fontFamily: get4(tokens, "fontFamily.body", []).join(",")
3807
3786
  }
3808
3787
  };
3809
3788
  var codeTheme = {
3810
3789
  ".cm-scroller": {
3811
- fontFamily: get3(tokens, "fontFamily.mono", []).join(",")
3790
+ fontFamily: get4(tokens, "fontFamily.mono", []).join(",")
3812
3791
  },
3813
3792
  ".cm-placeholder": {
3814
- fontFamily: get3(tokens, "fontFamily.mono", []).join(",")
3793
+ fontFamily: get4(tokens, "fontFamily.mono", []).join(",")
3815
3794
  }
3816
3795
  };
3817
3796
 
@@ -4456,7 +4435,7 @@ import { useEffect as useEffect3, useRef as useRef4, useState as useState5 } fro
4456
4435
  import { log as log5 } from "@dxos/log";
4457
4436
  import { isNotFalsy as isNotFalsy5 } from "@dxos/util";
4458
4437
  var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/hooks/useTextEditor.ts";
4459
- var useTextEditor = ({ autoFocus, scrollTo, debug, doc, selection, extensions } = {}) => {
4438
+ var useTextEditor = ({ autoFocus, scrollTo, debug, doc, selection, extensions } = {}, deps) => {
4460
4439
  const onUpdate = useRef4();
4461
4440
  const [view, setView] = useState5();
4462
4441
  const parentRef = useRef4(null);
@@ -4471,7 +4450,7 @@ var useTextEditor = ({ autoFocus, scrollTo, debug, doc, selection, extensions }
4471
4450
  EditorView15.exceptionSink.of((err) => {
4472
4451
  log5.catch(err, void 0, {
4473
4452
  F: __dxlog_file6,
4474
- L: 61,
4453
+ L: 57,
4475
4454
  S: void 0,
4476
4455
  C: (f, a) => f(...a)
4477
4456
  });
@@ -4500,10 +4479,7 @@ var useTextEditor = ({ autoFocus, scrollTo, debug, doc, selection, extensions }
4500
4479
  return () => {
4501
4480
  view2?.destroy();
4502
4481
  };
4503
- }, [
4504
- doc,
4505
- extensions
4506
- ]);
4482
+ }, deps);
4507
4483
  useEffect3(() => {
4508
4484
  if (view) {
4509
4485
  if (!selection && !view.state.selection.main.anchor) {
@@ -4559,13 +4535,32 @@ var createThemeExtensions = ({ theme, themeMode, slots } = {}) => {
4559
4535
  };
4560
4536
 
4561
4537
  // packages/ui/react-ui-editor/src/hooks/useTextModel.ts
4562
- import get4 from "lodash.get";
4538
+ import get5 from "lodash.get";
4563
4539
  import { useState as useState6, useMemo as useMemo3 } from "react";
4564
4540
  import { generateName } from "@dxos/display-name";
4565
4541
  import { getRawDoc } from "@dxos/echo-schema";
4566
4542
  import { invariant as invariant3 } from "@dxos/invariant";
4567
4543
  import { isAutomergeObject } from "@dxos/react-client/echo";
4568
4544
  var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/hooks/useTextModel.ts";
4545
+ var useTextExtensions = ({ id, text, space, identity }) => {
4546
+ const extensions = [
4547
+ automerge(text)
4548
+ ];
4549
+ if (space && identity) {
4550
+ const awarenessProvider2 = new SpaceAwarenessProvider({
4551
+ space,
4552
+ channel: `awareness.${id}`,
4553
+ peerId: identity.identityKey.toHex(),
4554
+ info: {
4555
+ displayName: identity.profile?.displayName ?? generateName(identity.identityKey.toHex()),
4556
+ color: cursorColor.color,
4557
+ lightColor: cursorColor.light
4558
+ }
4559
+ });
4560
+ extensions.push(awareness(awarenessProvider2));
4561
+ }
4562
+ return extensions;
4563
+ };
4569
4564
  var useTextModel = (props) => useMemo3(() => createModel(props), Object.values(props));
4570
4565
  var useInMemoryTextModel = ({ id, defaultContent }) => {
4571
4566
  const [content, setContent] = useState6(defaultContent ?? "");
@@ -4582,7 +4577,7 @@ var createModel = ({ space, identity, text }) => {
4582
4577
  }
4583
4578
  invariant3(isAutomergeObject(text), void 0, {
4584
4579
  F: __dxlog_file7,
4585
- L: 54,
4580
+ L: 83,
4586
4581
  S: void 0,
4587
4582
  A: [
4588
4583
  "isAutomergeObject(text)",
@@ -4616,7 +4611,7 @@ var createModel = ({ space, identity, text }) => {
4616
4611
  const model = {
4617
4612
  id: obj.id,
4618
4613
  content: doc,
4619
- text: () => get4(doc.handle.docSync(), doc.path),
4614
+ text: () => get5(doc.handle.docSync(), doc.path),
4620
4615
  extension: extensions,
4621
4616
  peer: identity ? {
4622
4617
  id: identity.identityKey.toHex(),
@@ -4718,6 +4713,7 @@ export {
4718
4713
  useFormattingState,
4719
4714
  useInMemoryTextModel,
4720
4715
  useTextEditor,
4716
+ useTextExtensions,
4721
4717
  useTextModel,
4722
4718
  useToolbarContext
4723
4719
  };