@dxos/react-ui-editor 0.3.11-next.e28df4f → 0.3.11-next.ee2b64c

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.
@@ -1,6 +1,7 @@
1
1
  // packages/ui/react-ui-editor/src/index.ts
2
2
  import { TextKind } from "@dxos/protocols/proto/dxos/echo/model/text";
3
3
  import { Doc, YText, YXmlFragment } from "@dxos/text-model";
4
+ import { keymap as keymap7 } from "@codemirror/view";
4
5
 
5
6
  // packages/ui/react-ui-editor/src/components/TextEditor/index.ts
6
7
  import { tags as tags2 } from "@lezer/highlight";
@@ -13,7 +14,7 @@ import defaultsDeep2 from "lodash.defaultsdeep";
13
14
  import React, { forwardRef, useCallback, useEffect as useEffect2, useImperativeHandle, useRef, useState } from "react";
14
15
  import { log as log2 } from "@dxos/log";
15
16
  import { useThemeContext } from "@dxos/react-ui";
16
- import { attentionSurface, mx as mx3 } from "@dxos/react-ui-theme";
17
+ import { focusRing, mx as mx3 } from "@dxos/react-ui-theme";
17
18
  import { isNotFalsy as isNotFalsy3 } from "@dxos/util";
18
19
 
19
20
  // packages/ui/react-ui-editor/src/extensions/autocomplete.ts
@@ -782,7 +783,7 @@ var Blaster = class {
782
783
  initialize() {
783
784
  invariant(!this._canvas && !this._ctx, void 0, {
784
785
  F: __dxlog_file,
785
- L: 138,
786
+ L: 141,
786
787
  S: this,
787
788
  A: [
788
789
  "!this._canvas && !this._ctx",
@@ -819,7 +820,7 @@ var Blaster = class {
819
820
  start() {
820
821
  invariant(this._canvas && this._ctx, void 0, {
821
822
  F: __dxlog_file,
822
- L: 177,
823
+ L: 180,
823
824
  S: this,
824
825
  A: [
825
826
  "this._canvas && this._ctx",
@@ -1073,11 +1074,25 @@ var logChanges = (trs) => {
1073
1074
 
1074
1075
  // packages/ui/react-ui-editor/src/extensions/comments.ts
1075
1076
  var styles2 = EditorView5.baseTheme({
1076
- "& .cm-comment": {
1077
+ "&light .cm-comment, &light .cm-comment-current": {
1078
+ mixBlendMode: "darken"
1079
+ },
1080
+ "&dark .cm-comment, &dark .cm-comment-current": {
1081
+ mixBlendMode: "plus-lighter"
1082
+ },
1083
+ "&light .cm-comment": {
1077
1084
  backgroundColor: getToken("extend.colors.yellow.50")
1078
1085
  },
1079
- "& .cm-comment-current": {
1086
+ "&light .cm-comment-current": {
1080
1087
  backgroundColor: getToken("extend.colors.yellow.100")
1088
+ },
1089
+ "&dark .cm-comment": {
1090
+ color: getToken("extend.colors.yellow.50"),
1091
+ backgroundColor: getToken("extend.colors.yellow.900")
1092
+ },
1093
+ "&dark .cm-comment-current": {
1094
+ color: getToken("extend.colors.yellow.100"),
1095
+ backgroundColor: getToken("extend.colors.yellow.950")
1081
1096
  }
1082
1097
  });
1083
1098
  var commentMark = Decoration2.mark({
@@ -2590,11 +2605,11 @@ var defaultTheme = {
2590
2605
  fontSize: "16px"
2591
2606
  },
2592
2607
  "&light .cm-content": {
2593
- color: get3(tokens, "extend.colors.neutral.900", "black"),
2608
+ color: get3(tokens, "extend.semanticColors.base.fg.light", "black"),
2594
2609
  caretColor: "black"
2595
2610
  },
2596
2611
  "&dark .cm-content": {
2597
- color: get3(tokens, "extend.colors.neutral.100", "white"),
2612
+ color: get3(tokens, "extend.semanticColors.base.fg.dark", "white"),
2598
2613
  caretColor: "white"
2599
2614
  },
2600
2615
  //
@@ -2606,8 +2621,11 @@ var defaultTheme = {
2606
2621
  "&dark .cm-cursor, &dark .cm-dropCursor": {
2607
2622
  borderLeft: "2px solid white"
2608
2623
  },
2609
- ".cm-placeholder": {
2610
- fontWeight: 100
2624
+ "&light .cm-placeholder": {
2625
+ color: get3(tokens, "extend.semanticColors.description.light", "rgba(0,0,0,.2)")
2626
+ },
2627
+ "&dark .cm-placeholder": {
2628
+ color: get3(tokens, "extend.semanticColors.description.dark", "rgba(255,255,255,.2)")
2611
2629
  },
2612
2630
  //
2613
2631
  // line
@@ -2948,11 +2966,10 @@ var MarkdownEditor = /* @__PURE__ */ forwardRef(({ readonly, placeholder: placeh
2948
2966
  });
2949
2967
  var defaultSlots = {
2950
2968
  root: {
2951
- // TODO(burdon): Add focusRing by default/as property?
2952
- className: mx3("flex flex-col grow overflow-y-auto", attentionSurface)
2969
+ className: mx3("grow", focusRing)
2953
2970
  },
2954
2971
  editor: {
2955
- className: "h-full p-2"
2972
+ className: "bs-full"
2956
2973
  }
2957
2974
  };
2958
2975
  var defaultTextSlots = {
@@ -3412,10 +3429,19 @@ var useTextModel = (props) => {
3412
3429
  ]);
3413
3430
  return model;
3414
3431
  };
3432
+ var useInMemoryTextModel = ({ id, defaultContent }) => {
3433
+ const [content, setContent] = useState4(defaultContent ?? "");
3434
+ return {
3435
+ id,
3436
+ content,
3437
+ setContent,
3438
+ text: () => content
3439
+ };
3440
+ };
3415
3441
  var createModel = ({ space, identity, text }) => {
3416
3442
  invariant3(isAutomergeObject(text), void 0, {
3417
3443
  F: __dxlog_file6,
3418
- L: 34,
3444
+ L: 50,
3419
3445
  S: void 0,
3420
3446
  A: [
3421
3447
  "isAutomergeObject(text)",
@@ -3499,6 +3525,7 @@ export {
3499
3525
  image,
3500
3526
  insertCodeblock,
3501
3527
  insertTable,
3528
+ keymap7 as keymap,
3502
3529
  link,
3503
3530
  listener,
3504
3531
  logChanges,
@@ -3525,6 +3552,7 @@ export {
3525
3552
  useActionHandler,
3526
3553
  useComments,
3527
3554
  useEditorView,
3555
+ useInMemoryTextModel,
3528
3556
  useTextEditor,
3529
3557
  useTextModel,
3530
3558
  useToolbarContext