lexxy-realtime 0.4.0 → 0.6.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ca9f7e8da5b292e73222ff67b6f49f6abe35825faf45af947157d4442fa37ce
4
- data.tar.gz: a5aa12d0c2835df82d5eefa99e884b1920af507e824eb7ee3ee032d8b1c06a41
3
+ metadata.gz: fa39cd7bc916ac95dd594b5fda64a37d9d3902213849aeee083ea32d9dc37637
4
+ data.tar.gz: 66ccab5f7ffc38dfe92c2e6e62e08e7bb7557a6793557c6a7fe1e535b7132e04
5
5
  SHA512:
6
- metadata.gz: 2eb4bbdc5584615480b1b8cde54df071b1a38cce8c84cd6eaca8e14dbce7a57617f3f5c758d9b3c9dbc226a2c69c15d2f1a84ef69b5aa986824c7182498fb420
7
- data.tar.gz: a9ec33bca8104051993e0d4a2fc6233afb459bf9e8a6cd63d72b1801f316244d5ef161d38e33d1ca7c325446f87d16622eb8bd7ce3cb20952eaf13d146d0f0ed
6
+ metadata.gz: 7be35ca4f957ddd8eecb85cdeb6f399ae384c548f663dcd64dcdacaf5ee29cad191fd8c5aecf017895f7ffaa6b74c4648030712408e3fc9f3e29752d20121045
7
+ data.tar.gz: b34db974efab708be650489123f68fe6e3a739133657c367c3b083673d79586d9c80ab68400099a8a9f9eb2710c5ccea8a4bbad169158ee450f06df5074687f3
@@ -15193,6 +15193,59 @@ function removePendingUploadNodes(editor) {
15193
15193
  });
15194
15194
  }
15195
15195
  //#endregion
15196
+ //#region src/cursor_theme.js
15197
+ const CURSOR_CSS = `
15198
+ .lexxy-collab-cursor {
15199
+ background-color: var(--lexical-cursor-color);
15200
+ width: 2px;
15201
+ border-radius: 1px;
15202
+ z-index: 10;
15203
+ }
15204
+
15205
+ .lexxy-collab-cursor__name {
15206
+ position: absolute;
15207
+ top: 0;
15208
+ left: -2px;
15209
+ transform: translateY(calc(-100% - 3px));
15210
+ background-color: var(--lexical-cursor-color);
15211
+ color: white;
15212
+ font-family: var(--lexxy-font-base, system-ui, sans-serif);
15213
+ font-size: 0.6875rem;
15214
+ font-weight: 600;
15215
+ line-height: 1;
15216
+ padding: 0.3em 0.7em;
15217
+ border-radius: calc(var(--lexxy-radius, 0.5ch) * 1.5);
15218
+ white-space: nowrap;
15219
+ box-shadow: 0 1px 3px oklch(0% 0 0 / 0.25);
15220
+ z-index: 11;
15221
+ }
15222
+
15223
+ .lexxy-collab-selection {
15224
+ z-index: 5;
15225
+ }
15226
+
15227
+ .lexxy-collab-selection__bg {
15228
+ background-color: var(--lexical-cursor-color);
15229
+ opacity: 0.2;
15230
+ border-radius: 2px;
15231
+ }
15232
+ `;
15233
+ function registerCursorTheme(editor) {
15234
+ const theme = editor._config.theme;
15235
+ if (theme.collaboration) return;
15236
+ theme.collaboration = {
15237
+ cursor: "lexxy-collab-cursor",
15238
+ cursorName: "lexxy-collab-cursor__name",
15239
+ selection: "lexxy-collab-selection",
15240
+ selectionBg: "lexxy-collab-selection__bg"
15241
+ };
15242
+ if (getComputedStyle(document.documentElement).getPropertyValue("--lexxy-realtime-cursor-styles").trim() !== "" || document.getElementById("lexxy-realtime-cursor-styles")) return;
15243
+ const style = document.createElement("style");
15244
+ style.id = "lexxy-realtime-cursor-styles";
15245
+ style.textContent = CURSOR_CSS;
15246
+ document.head.appendChild(style);
15247
+ }
15248
+ //#endregion
15196
15249
  //#region src/editor_collaboration.js
15197
15250
  let sharedConsumer;
15198
15251
  let configuredConsumer;
@@ -15252,6 +15305,7 @@ var Collaboration = class extends HTMLElement {
15252
15305
  patchCollabElementSplice(binding);
15253
15306
  const unsubscribeListeners = registerCollaborationListeners(this.editor, provider, binding);
15254
15307
  const cancelBootstrap = bootstrapWhenSynced(this.editor, provider, binding, initialEditorState);
15308
+ registerCursorTheme(this.editor);
15255
15309
  const cursorsContainer = this.#createCursorsContainer();
15256
15310
  binding.cursorsContainer = cursorsContainer;
15257
15311
  initLocalState(provider, name, color, true, {