@dxos/react-ui-editor 0.4.7-main.ea67fec → 0.4.7-main.f9d3866
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.
- package/dist/lib/browser/index.mjs +46 -14
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/hooks/useTextModel.d.ts.map +1 -1
- package/dist/types/src/styles/cursors.d.ts +5 -0
- package/dist/types/src/styles/cursors.d.ts.map +1 -0
- package/dist/types/src/styles/index.d.ts +1 -0
- package/dist/types/src/styles/index.d.ts.map +1 -1
- package/package.json +24 -24
- package/src/extensions/awareness.ts +3 -3
- package/src/hooks/useTextModel.ts +5 -12
- package/src/styles/cursors.ts +21 -0
- package/src/styles/index.ts +1 -0
|
@@ -596,7 +596,7 @@ var RemoteSelectionsDecorator = class {
|
|
|
596
596
|
to: startLine.from + startLine.length,
|
|
597
597
|
value: Decoration2.mark({
|
|
598
598
|
attributes: {
|
|
599
|
-
style: `background-color: ${
|
|
599
|
+
style: `background-color: ${color}`
|
|
600
600
|
},
|
|
601
601
|
class: "cm-collab-selection"
|
|
602
602
|
})
|
|
@@ -606,7 +606,7 @@ var RemoteSelectionsDecorator = class {
|
|
|
606
606
|
to: end,
|
|
607
607
|
value: Decoration2.mark({
|
|
608
608
|
attributes: {
|
|
609
|
-
style: `background-color: ${
|
|
609
|
+
style: `background-color: ${color}`
|
|
610
610
|
},
|
|
611
611
|
class: "cm-collab-selection"
|
|
612
612
|
})
|
|
@@ -618,7 +618,7 @@ var RemoteSelectionsDecorator = class {
|
|
|
618
618
|
to: linePos,
|
|
619
619
|
value: Decoration2.line({
|
|
620
620
|
attributes: {
|
|
621
|
-
style: `background-color: ${
|
|
621
|
+
style: `background-color: ${color}`,
|
|
622
622
|
class: "cm-collab-selectionLine"
|
|
623
623
|
}
|
|
624
624
|
})
|
|
@@ -1072,6 +1072,44 @@ import { useEffect } from "react";
|
|
|
1072
1072
|
import { debounce } from "@dxos/async";
|
|
1073
1073
|
import { nonNullable } from "@dxos/util";
|
|
1074
1074
|
|
|
1075
|
+
// packages/ui/react-ui-editor/src/styles/cursors.ts
|
|
1076
|
+
import * as random2 from "lib0/random";
|
|
1077
|
+
var cursorColors = [
|
|
1078
|
+
{
|
|
1079
|
+
color: "#30bced",
|
|
1080
|
+
light: "#30bced33"
|
|
1081
|
+
},
|
|
1082
|
+
{
|
|
1083
|
+
color: "#6eeb83",
|
|
1084
|
+
light: "#6eeb8333"
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
color: "#ffbc42",
|
|
1088
|
+
light: "#ffbc4233"
|
|
1089
|
+
},
|
|
1090
|
+
{
|
|
1091
|
+
color: "#ecd444",
|
|
1092
|
+
light: "#ecd44433"
|
|
1093
|
+
},
|
|
1094
|
+
{
|
|
1095
|
+
color: "#ee6352",
|
|
1096
|
+
light: "#ee635233"
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
color: "#9ac2c9",
|
|
1100
|
+
light: "#9ac2c933"
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
color: "#8acb88",
|
|
1104
|
+
light: "#8acb8833"
|
|
1105
|
+
},
|
|
1106
|
+
{
|
|
1107
|
+
color: "#1be7ff",
|
|
1108
|
+
light: "#1be7ff33"
|
|
1109
|
+
}
|
|
1110
|
+
];
|
|
1111
|
+
var cursorColor = cursorColors[random2.uint32() % cursorColors.length];
|
|
1112
|
+
|
|
1075
1113
|
// packages/ui/react-ui-editor/src/styles/markdown.ts
|
|
1076
1114
|
import { mx } from "@dxos/react-ui-theme";
|
|
1077
1115
|
var headings = {
|
|
@@ -4542,15 +4580,11 @@ import { generateName } from "@dxos/display-name";
|
|
|
4542
4580
|
import { getRawDoc } from "@dxos/echo-schema";
|
|
4543
4581
|
import { invariant as invariant3 } from "@dxos/invariant";
|
|
4544
4582
|
import { isAutomergeObject } from "@dxos/react-client/echo";
|
|
4545
|
-
import { hueTokens } from "@dxos/react-ui-theme";
|
|
4546
|
-
import { hexToHue } from "@dxos/util";
|
|
4547
4583
|
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/hooks/useTextModel.ts";
|
|
4548
4584
|
var useTextExtensions = ({ id, text, space, identity }) => {
|
|
4549
4585
|
const extensions = [
|
|
4550
4586
|
automerge(text)
|
|
4551
4587
|
];
|
|
4552
|
-
const peerId = identity?.identityKey.toHex();
|
|
4553
|
-
const { cursorLightValue, cursorDarkValue } = hueTokens[hexToHue(peerId ?? "0")];
|
|
4554
4588
|
if (space && identity) {
|
|
4555
4589
|
const awarenessProvider2 = new SpaceAwarenessProvider({
|
|
4556
4590
|
space,
|
|
@@ -4558,8 +4592,8 @@ var useTextExtensions = ({ id, text, space, identity }) => {
|
|
|
4558
4592
|
peerId: identity.identityKey.toHex(),
|
|
4559
4593
|
info: {
|
|
4560
4594
|
displayName: identity.profile?.displayName ?? generateName(identity.identityKey.toHex()),
|
|
4561
|
-
color:
|
|
4562
|
-
lightColor:
|
|
4595
|
+
color: cursorColor.color,
|
|
4596
|
+
lightColor: cursorColor.light
|
|
4563
4597
|
}
|
|
4564
4598
|
});
|
|
4565
4599
|
extensions.push(awareness(awarenessProvider2));
|
|
@@ -4582,7 +4616,7 @@ var createModel = ({ space, identity, text }) => {
|
|
|
4582
4616
|
}
|
|
4583
4617
|
invariant3(isAutomergeObject(text), void 0, {
|
|
4584
4618
|
F: __dxlog_file7,
|
|
4585
|
-
L:
|
|
4619
|
+
L: 83,
|
|
4586
4620
|
S: void 0,
|
|
4587
4621
|
A: [
|
|
4588
4622
|
"isAutomergeObject(text)",
|
|
@@ -4593,15 +4627,13 @@ var createModel = ({ space, identity, text }) => {
|
|
|
4593
4627
|
const doc = getRawDoc(obj, [
|
|
4594
4628
|
obj.field
|
|
4595
4629
|
]);
|
|
4596
|
-
const peerId = identity?.identityKey.toHex();
|
|
4597
|
-
const { cursorLightValue, cursorDarkValue } = hueTokens[hexToHue(peerId ?? "0")];
|
|
4598
4630
|
const awarenessProvider2 = space && new SpaceAwarenessProvider({
|
|
4599
4631
|
space,
|
|
4600
4632
|
channel: `automerge.awareness.${obj.id}`,
|
|
4601
4633
|
info: {
|
|
4602
4634
|
displayName: identity ? identity.profile?.displayName ?? generateName(identity.identityKey.toHex()) : void 0,
|
|
4603
|
-
color:
|
|
4604
|
-
lightColor:
|
|
4635
|
+
color: cursorColor.color,
|
|
4636
|
+
lightColor: cursorColor.light
|
|
4605
4637
|
},
|
|
4606
4638
|
peerId: identity?.identityKey.toHex() ?? "Anonymous"
|
|
4607
4639
|
});
|