@liveblocks/react-lexical 2.16.0-toolbars4 → 2.17.0-channels1

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 (45) hide show
  1. package/dist/comments/floating-composer.js +2 -4
  2. package/dist/comments/floating-composer.js.map +1 -1
  3. package/dist/comments/floating-composer.mjs +2 -4
  4. package/dist/comments/floating-composer.mjs.map +1 -1
  5. package/dist/index.d.mts +3 -239
  6. package/dist/index.d.ts +3 -239
  7. package/dist/index.js +0 -8
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +0 -4
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/version-history/history-version-preview.js +10 -3
  12. package/dist/version-history/history-version-preview.js.map +1 -1
  13. package/dist/version-history/history-version-preview.mjs +10 -3
  14. package/dist/version-history/history-version-preview.mjs.map +1 -1
  15. package/dist/version.js +1 -1
  16. package/dist/version.mjs +1 -1
  17. package/package.json +6 -10
  18. package/src/styles/constants.css +1 -1
  19. package/src/styles/index.css +6 -44
  20. package/styles.css +1 -1
  21. package/styles.css.map +1 -1
  22. package/dist/get-active-block-element.js +0 -26
  23. package/dist/get-active-block-element.js.map +0 -1
  24. package/dist/get-active-block-element.mjs +0 -24
  25. package/dist/get-active-block-element.mjs.map +0 -1
  26. package/dist/is-command-registered.js +0 -11
  27. package/dist/is-command-registered.js.map +0 -1
  28. package/dist/is-command-registered.mjs +0 -9
  29. package/dist/is-command-registered.mjs.map +0 -1
  30. package/dist/is-text-format-active.js +0 -16
  31. package/dist/is-text-format-active.js.map +0 -1
  32. package/dist/is-text-format-active.mjs +0 -14
  33. package/dist/is-text-format-active.mjs.map +0 -1
  34. package/dist/toolbar/floating-toolbar.js +0 -312
  35. package/dist/toolbar/floating-toolbar.js.map +0 -1
  36. package/dist/toolbar/floating-toolbar.mjs +0 -309
  37. package/dist/toolbar/floating-toolbar.mjs.map +0 -1
  38. package/dist/toolbar/shared.js +0 -39
  39. package/dist/toolbar/shared.js.map +0 -1
  40. package/dist/toolbar/shared.mjs +0 -36
  41. package/dist/toolbar/shared.mjs.map +0 -1
  42. package/dist/toolbar/toolbar.js +0 -443
  43. package/dist/toolbar/toolbar.js.map +0 -1
  44. package/dist/toolbar/toolbar.mjs +0 -418
  45. package/dist/toolbar/toolbar.mjs.map +0 -1
@@ -37,7 +37,7 @@
37
37
  *************************************/
38
38
 
39
39
  .lb-lexical-suggestions {
40
- padding: $lb-elevation-padding;
40
+ padding: $lb-elevation-list-padding;
41
41
  animation-duration: var(--lb-transition-duration);
42
42
  animation-timing-function: var(--lb-transition-easing);
43
43
  will-change: transform, opacity;
@@ -47,26 +47,23 @@
47
47
  display: flex;
48
48
  align-items: center;
49
49
  padding: calc(0.25 * var(--lb-spacing)) calc(0.5 * var(--lb-spacing));
50
- border-radius: calc(var(--lb-radius) - 0.75 * $lb-elevation-padding);
50
+ border-radius: calc(var(--lb-radius) - 0.75 * $lb-elevation-list-padding);
51
51
  color: var(--lb-foreground-secondary);
52
52
  outline: none;
53
53
  font-size: 0.875rem;
54
54
  cursor: pointer;
55
55
  user-select: none;
56
56
  transition-property: background, color, opacity;
57
- scroll-margin-block: $lb-elevation-padding;
57
+ scroll-margin-block: $lb-elevation-list-padding;
58
58
  }
59
59
 
60
60
  :is(.lb-lexical-suggestions-list-item) {
61
- &:where(
62
- [data-highlighted]:not([data-highlighted="false"]),
63
- [data-selected]:not([data-selected="false"])
64
- ) {
61
+ &:where([data-highlighted], [data-selected]) {
65
62
  background: var(--lb-foreground-subtle);
66
63
  transition-duration: calc(var(--lb-transition-duration) / 2);
67
64
  }
68
65
 
69
- &:where(:disabled, [data-disabled]:not([data-disabled="false"])) {
66
+ &:where(:disabled, [data-disabled]) {
70
67
  opacity: 0.5;
71
68
  cursor: not-allowed;
72
69
  }
@@ -110,7 +107,7 @@
110
107
 
111
108
  @include invisible-selection;
112
109
 
113
- &:where([data-selected]:not([data-selected="false"])) {
110
+ &:where([data-selected]) {
114
111
  background: var(--lb-accent);
115
112
  color: var(--lb-accent-foreground);
116
113
  }
@@ -206,38 +203,3 @@
206
203
  .lb-lexical-floating-composer {
207
204
  inline-size: var(--lb-lexical-floating-size);
208
205
  }
209
-
210
- /*************************************
211
- * Toolbar *
212
- *************************************/
213
-
214
- .lb-lexical-toolbar {
215
- --lb-lexical-toolbar-spacing: calc(0.25 * var(--lb-spacing));
216
-
217
- position: relative;
218
- display: flex;
219
- flex-direction: row;
220
- gap: var(--lb-lexical-toolbar-spacing);
221
- align-items: center;
222
- padding: var(--lb-lexical-toolbar-spacing);
223
- background: var(--lb-background);
224
- }
225
-
226
- .lb-lexical-floating-toolbar {
227
- --lb-lexical-toolbar-spacing: $lb-elevation-padding;
228
- }
229
-
230
- .lb-lexical-toolbar-separator {
231
- position: relative;
232
- align-self: stretch;
233
- inline-size: 1px;
234
- margin-inline: 1px;
235
- pointer-events: none;
236
-
237
- &::before {
238
- content: "";
239
- position: absolute;
240
- inset: 10% 0;
241
- background: var(--lb-foreground-subtle);
242
- }
243
- }
package/styles.css CHANGED
@@ -1 +1 @@
1
- .lb-lexical-suggestions-list{margin:0;padding:0;list-style:none}.lb-lexical-mention-suggestions{--lb-lexical-mention-suggestion-avatar-size:1.25rem}.lb-lexical-mention-suggestion{padding:calc(.375*var(--lb-spacing))calc(.625*var(--lb-spacing))}.lb-lexical-mention-suggestion-avatar{inline-size:var(--lb-lexical-mention-suggestion-avatar-size);margin-inline-start:calc(-.125*var(--lb-spacing));margin-inline-end:calc(.5*var(--lb-spacing));margin-block:calc(.125*var(--lb-spacing));background:var(--lb-foreground-subtle);color:var(--lb-foreground-moderate)}.lb-lexical-suggestions{animation-duration:var(--lb-transition-duration);animation-timing-function:var(--lb-transition-easing);will-change:transform,opacity;padding:4px}.lb-lexical-suggestions-list-item{padding:calc(.25*var(--lb-spacing))calc(.5*var(--lb-spacing));border-radius:calc(var(--lb-radius) - .75*4px);color:var(--lb-foreground-secondary);cursor:pointer;-webkit-user-select:none;user-select:none;outline:none;align-items:center;scroll-margin-block:4px;font-size:.875rem;transition-property:background,color,opacity;display:flex}.lb-lexical-suggestions-list-item:where([data-highlighted]:not([data-highlighted=false]),[data-selected]:not([data-selected=false])){background:var(--lb-foreground-subtle);transition-duration:calc(var(--lb-transition-duration)/2)}.lb-lexical-suggestions-list-item:where(:disabled,[data-disabled]:not([data-disabled=false])){opacity:.5;cursor:not-allowed}.lb-lexical-suggestions:where([data-side=top]){animation-name:lb-animation-slide-up}.lb-lexical-suggestions:where([data-side=bottom]){animation-name:lb-animation-slide-down}.lb-lexical-suggestions:where([data-state=closed]){animation-name:lb-animation-disappear}.lb-lexical-mention{border-radius:calc(.675*var(--lb-radius));background:var(--lb-accent-subtle);color:var(--lb-accent);-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:.1em .3em;font-weight:500}.lb-lexical-mention::selection{background:0 0}.lb-lexical-mention ::selection{background:0 0}.lb-lexical-mention:where([data-selected]:not([data-selected=false])){background:var(--lb-accent);color:var(--lb-accent-foreground)}.lb-lexical-thread-mark{background:var(--lb-accent-subtle);color:var(--lb-foreground);text-decoration-line:underline;-webkit-text-decoration-color:var(--lb-foreground-moderate);text-decoration-color:var(--lb-foreground-moderate);text-underline-offset:2px;outline:none;font-weight:500;transition-property:color,text-decoration-color}.lb-lexical-thread-mark:where([data-state=active]){color:var(--lb-accent);-webkit-text-decoration-color:var(--lb-accent-moderate);text-decoration-color:var(--lb-accent-moderate)}.lb-lexical-anchored-threads{--lb-lexical-anchored-threads-gap:1.25rem;--lb-lexical-anchored-threads-active-thread-offset:-.75rem}.lb-lexical-anchored-threads-thread-container{transition-duration:calc(var(--lb-transition-duration)*2);transition-property:transform}.lb-lexical-anchored-threads-thread{border-radius:var(--lb-radius);background:var(--lb-dynamic-background);transition-property:background,box-shadow;position:relative;overflow:hidden;box-shadow:0 0 0 1px #0000000a,0 2px 6px #0000000a,0 6px 20px #0000000f}.lb-lexical-anchored-threads-thread:after{content:"";z-index:1;border-radius:inherit;box-shadow:var(--lb-inset-shadow);pointer-events:none;position:absolute;inset:0}.lb-lexical-anchored-threads-thread:where([data-state=active]){box-shadow:0 0 0 1px #0000000a,0 2px 6px #00000014,0 8px 26px #0000001f}.lb-lexical-floating{--lb-lexical-floating-size:350px}.lb-lexical-floating-threads-thread{inline-size:var(--lb-lexical-floating-size)}.lb-lexical-floating-threads-thread:where(:not(:last-of-type)){border-block-end:1px solid var(--lb-foreground-subtle)}.lb-lexical-floating-composer{inline-size:var(--lb-lexical-floating-size)}.lb-lexical-toolbar{--lb-lexical-toolbar-spacing:calc(.25*var(--lb-spacing));gap:var(--lb-lexical-toolbar-spacing);padding:var(--lb-lexical-toolbar-spacing);background:var(--lb-background);flex-direction:row;align-items:center;display:flex;position:relative}.lb-lexical-floating-toolbar{--lb-lexical-toolbar-spacing:4px}.lb-lexical-toolbar-separator{pointer-events:none;align-self:stretch;inline-size:1px;margin-inline:1px;position:relative}.lb-lexical-toolbar-separator:before{content:"";background:var(--lb-foreground-subtle);position:absolute;inset:10% 0}@media (prefers-reduced-motion){.lb-lexical-suggestions:where(:not([data-state=closed])){animation-name:lb-animation-appear}.lb-lexical-anchored-threads-thread-container{transition-duration:0s}}
1
+ .lb-lexical-suggestions-list{margin:0;padding:0;list-style:none}.lb-lexical-mention-suggestions{--lb-lexical-mention-suggestion-avatar-size:1.25rem}.lb-lexical-mention-suggestion{padding:calc(.375*var(--lb-spacing))calc(.625*var(--lb-spacing))}.lb-lexical-mention-suggestion-avatar{inline-size:var(--lb-lexical-mention-suggestion-avatar-size);margin-inline-start:calc(-.125*var(--lb-spacing));margin-inline-end:calc(.5*var(--lb-spacing));margin-block:calc(.125*var(--lb-spacing));background:var(--lb-foreground-subtle);color:var(--lb-foreground-moderate)}.lb-lexical-suggestions{animation-duration:var(--lb-transition-duration);animation-timing-function:var(--lb-transition-easing);will-change:transform,opacity;padding:4px}.lb-lexical-suggestions-list-item{padding:calc(.25*var(--lb-spacing))calc(.5*var(--lb-spacing));border-radius:calc(var(--lb-radius) - .75*4px);color:var(--lb-foreground-secondary);cursor:pointer;-webkit-user-select:none;user-select:none;outline:none;align-items:center;scroll-margin-block:4px;font-size:.875rem;transition-property:background,color,opacity;display:flex}.lb-lexical-suggestions-list-item:where([data-highlighted],[data-selected]){background:var(--lb-foreground-subtle);transition-duration:calc(var(--lb-transition-duration)/2)}.lb-lexical-suggestions-list-item:where(:disabled,[data-disabled]){opacity:.5;cursor:not-allowed}.lb-lexical-suggestions:where([data-side=top]){animation-name:lb-animation-slide-up}.lb-lexical-suggestions:where([data-side=bottom]){animation-name:lb-animation-slide-down}.lb-lexical-suggestions:where([data-state=closed]){animation-name:lb-animation-disappear}.lb-lexical-mention{border-radius:calc(.675*var(--lb-radius));background:var(--lb-accent-subtle);color:var(--lb-accent);-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:.1em .3em;font-weight:500}.lb-lexical-mention::selection{background:0 0}.lb-lexical-mention ::selection{background:0 0}.lb-lexical-mention:where([data-selected]){background:var(--lb-accent);color:var(--lb-accent-foreground)}.lb-lexical-thread-mark{background:var(--lb-accent-subtle);color:var(--lb-foreground);text-decoration-line:underline;-webkit-text-decoration-color:var(--lb-foreground-moderate);text-decoration-color:var(--lb-foreground-moderate);text-underline-offset:2px;outline:none;font-weight:500;transition-property:color,text-decoration-color}.lb-lexical-thread-mark:where([data-state=active]){color:var(--lb-accent);-webkit-text-decoration-color:var(--lb-accent-moderate);text-decoration-color:var(--lb-accent-moderate)}.lb-lexical-anchored-threads{--lb-lexical-anchored-threads-gap:1.25rem;--lb-lexical-anchored-threads-active-thread-offset:-.75rem}.lb-lexical-anchored-threads-thread-container{transition-duration:calc(var(--lb-transition-duration)*2);transition-property:transform}.lb-lexical-anchored-threads-thread{border-radius:var(--lb-radius);background:var(--lb-dynamic-background);transition-property:background,box-shadow;position:relative;overflow:hidden;box-shadow:0 0 0 1px #0000000a,0 2px 6px #0000000a,0 6px 20px #0000000f}.lb-lexical-anchored-threads-thread:after{content:"";z-index:1;border-radius:inherit;box-shadow:var(--lb-inset-shadow);pointer-events:none;position:absolute;inset:0}.lb-lexical-anchored-threads-thread:where([data-state=active]){box-shadow:0 0 0 1px #0000000a,0 2px 6px #00000014,0 8px 26px #0000001f}.lb-lexical-floating{--lb-lexical-floating-size:350px}.lb-lexical-floating-threads-thread{inline-size:var(--lb-lexical-floating-size)}.lb-lexical-floating-threads-thread:where(:not(:last-of-type)){border-block-end:1px solid var(--lb-foreground-subtle)}.lb-lexical-floating-composer{inline-size:var(--lb-lexical-floating-size)}@media (prefers-reduced-motion){.lb-lexical-suggestions:where(:not([data-state=closed])){animation-name:lb-animation-appear}.lb-lexical-anchored-threads-thread-container{transition-duration:0s}}
package/styles.css.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["src/styles/src/styles/index.css","src/styles/src/styles/utils.css"],"names":[],"mappings":"AAOA,6BAAA,QAAA,CAAA,SAAA,CAAA,eAAA,CAUA,gCAAA,mDAAA,CAIA,+BAAA,gEAAA,CAIA,sCAAA,4DAAA,CAAA,iDAAA,CAAA,4CAAA,CAAA,yCAAA,CAAA,sCAAA,CAAA,mCAAA,CAaA,wBAAA,gDAAA,CAAA,qDAAA,CAAA,6BAAA,CAAA,WAAA,CAOA,kCAAA,6DAAA,CAAA,8CAAA,CAAA,oCAAA,CAAA,cAAA,CAAA,wBAAA,CAAA,gBAAA,CAAA,YAAA,CAAA,kBAAA,CAAA,uBAAA,CAAA,iBAAA,CAAA,4CAAA,CAAA,YAAA,CAeE,qIAAA,sCAAA,CAAA,yDAAA,CAQA,8FAAA,UAAA,CAAA,kBAAA,CAWA,+CAAA,oCAAA,CAIA,kDAAA,sCAAA,CAIA,mDAAA,qCAAA,CAeF,oBAAA,yCAAA,CAAA,kCAAA,CAAA,sBAAA,CAAA,kCAAA,CAAA,0BAAA,CAAA,iBAAA,CAAA,eAAA,CCrGE,+BAAA,cAAA,CAAA,gCAAA,cAAA,CD+GA,sEAAA,2BAAA,CAAA,iCAAA,CAUF,wBAAA,kCAAA,CAAA,0BAAA,CAAA,8BAAA,CAAA,2DAAA,CAAA,mDAAA,CAAA,yBAAA,CAAA,YAAA,CAAA,eAAA,CAAA,+CAAA,CAUE,mDAAA,sBAAA,CAAA,uDAAA,CAAA,+CAAA,CAUF,6BAAA,yCAAA,CAAA,0DAAA,CAKA,8CAAA,yDAAA,CAAA,6BAAA,CAWA,oCAAA,8BAAA,CAAA,uCAAA,CAAA,yCAAA,CAAA,iBAAA,CAAA,eAAA,CAAA,uEAAA,CAQE,0CAAA,UAAA,CAAA,SAAA,CAAA,qBAAA,CAAA,iCAAA,CAAA,mBAAA,CAAA,iBAAA,CAAA,OAAA,CAUA,+DAAA,uEAAA,CASF,qBAAA,gCAAA,CAQA,oCAAA,2CAAA,CAGE,+DAAA,sDAAA,CASF,8BAAA,2CAAA,CAQA,oBAAA,wDAAA,CAAA,qCAAA,CAAA,yCAAA,CAAA,+BAAA,CAAA,kBAAA,CAAA,kBAAA,CAAA,YAAA,CAAA,iBAAA,CAYA,6BAAA,gCAAA,CAIA,8BAAA,mBAAA,CAAA,kBAAA,CAAA,eAAA,CAAA,iBAAA,CAAA,iBAAA,CAOE,qCAAA,UAAA,CAAA,sCAAA,CAAA,iBAAA,CAAA,WAAA,CAhJF,gCACE,yDAAA,kCAAA,CA4DA,8CAAA,sBAAA,CAAA","file":"styles.css","sourcesContent":["@import \"./utils\";\n@import \"./constants\";\n\n/*************************************\n * Suggestions *\n *************************************/\n\n.lb-lexical-suggestions-list {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n/*************************************\n * Mention suggestions *\n *************************************/\n\n.lb-lexical-mention-suggestions {\n --lb-lexical-mention-suggestion-avatar-size: 1.25rem;\n}\n\n.lb-lexical-mention-suggestion {\n padding: calc(0.375 * var(--lb-spacing)) calc(0.625 * var(--lb-spacing));\n}\n\n.lb-lexical-mention-suggestion-avatar {\n inline-size: var(--lb-lexical-mention-suggestion-avatar-size);\n margin-inline-start: calc(-0.125 * var(--lb-spacing));\n margin-inline-end: calc(0.5 * var(--lb-spacing));\n margin-block: calc(0.125 * var(--lb-spacing));\n background: var(--lb-foreground-subtle);\n color: var(--lb-foreground-moderate);\n}\n\n/*************************************\n * Elevation lists *\n *************************************/\n\n.lb-lexical-suggestions {\n padding: $lb-elevation-padding;\n animation-duration: var(--lb-transition-duration);\n animation-timing-function: var(--lb-transition-easing);\n will-change: transform, opacity;\n}\n\n.lb-lexical-suggestions-list-item {\n display: flex;\n align-items: center;\n padding: calc(0.25 * var(--lb-spacing)) calc(0.5 * var(--lb-spacing));\n border-radius: calc(var(--lb-radius) - 0.75 * $lb-elevation-padding);\n color: var(--lb-foreground-secondary);\n outline: none;\n font-size: 0.875rem;\n cursor: pointer;\n user-select: none;\n transition-property: background, color, opacity;\n scroll-margin-block: $lb-elevation-padding;\n}\n\n:is(.lb-lexical-suggestions-list-item) {\n &:where(\n [data-highlighted]:not([data-highlighted=\"false\"]),\n [data-selected]:not([data-selected=\"false\"])\n ) {\n background: var(--lb-foreground-subtle);\n transition-duration: calc(var(--lb-transition-duration) / 2);\n }\n\n &:where(:disabled, [data-disabled]:not([data-disabled=\"false\"])) {\n opacity: 0.5;\n cursor: not-allowed;\n }\n}\n\n/*************************************\n * Floating animations *\n *************************************/\n\n:is(.lb-lexical-suggestions) {\n &:where([data-side=\"top\"]) {\n animation-name: lb-animation-slide-up;\n }\n\n &:where([data-side=\"bottom\"]) {\n animation-name: lb-animation-slide-down;\n }\n\n &:where([data-state=\"closed\"]) {\n animation-name: lb-animation-disappear;\n }\n}\n\n@media (prefers-reduced-motion) {\n .lb-lexical-suggestions:where(:not([data-state=\"closed\"])) {\n animation-name: lb-animation-appear;\n }\n}\n\n/*************************************\n * Mention *\n *************************************/\n\n.lb-lexical-mention {\n padding: 0.1em 0.3em;\n border-radius: calc(0.675 * var(--lb-radius));\n background: var(--lb-accent-subtle);\n color: var(--lb-accent);\n box-decoration-break: clone;\n font-weight: 500;\n\n @include invisible-selection;\n\n &:where([data-selected]:not([data-selected=\"false\"])) {\n background: var(--lb-accent);\n color: var(--lb-accent-foreground);\n }\n}\n\n/*************************************\n * Thread mark *\n *************************************/\n\n.lb-lexical-thread-mark {\n background: var(--lb-accent-subtle);\n color: var(--lb-foreground);\n outline: none;\n font-weight: 500;\n transition-property: color, text-decoration-color;\n text-decoration-line: underline;\n text-decoration-color: var(--lb-foreground-moderate);\n text-underline-offset: 2px;\n\n &:where([data-state=\"active\"]) {\n color: var(--lb-accent);\n text-decoration-color: var(--lb-accent-moderate);\n }\n}\n\n/*************************************\n * Anchored threads *\n *************************************/\n\n.lb-lexical-anchored-threads {\n --lb-lexical-anchored-threads-gap: 1.25rem;\n --lb-lexical-anchored-threads-active-thread-offset: -0.75rem;\n}\n\n.lb-lexical-anchored-threads-thread-container {\n transition-duration: calc(var(--lb-transition-duration) * 2);\n transition-property: transform;\n}\n\n@media (prefers-reduced-motion) {\n .lb-lexical-anchored-threads-thread-container {\n transition-duration: 0s;\n }\n}\n\n.lb-lexical-anchored-threads-thread {\n position: relative;\n overflow: hidden;\n border-radius: var(--lb-radius);\n background: var(--lb-dynamic-background);\n box-shadow: $lb-lexical-anchored-threads-shadow;\n transition-property: background, box-shadow;\n\n &::after {\n content: \"\";\n position: absolute;\n inset: 0;\n z-index: 1;\n border-radius: inherit;\n box-shadow: var(--lb-inset-shadow);\n pointer-events: none;\n }\n\n &:where([data-state=\"active\"]) {\n box-shadow: $lb-lexical-anchored-threads-active-shadow;\n }\n}\n\n/*************************************\n * Floating components *\n *************************************/\n\n.lb-lexical-floating {\n --lb-lexical-floating-size: 350px;\n}\n\n/*************************************\n * Floating threads *\n *************************************/\n\n.lb-lexical-floating-threads-thread {\n inline-size: var(--lb-lexical-floating-size);\n\n &:where(:not(:last-of-type)) {\n border-block-end: 1px solid var(--lb-foreground-subtle);\n }\n}\n\n/*************************************\n * Floating composer *\n *************************************/\n\n.lb-lexical-floating-composer {\n inline-size: var(--lb-lexical-floating-size);\n}\n\n/*************************************\n * Toolbar *\n *************************************/\n\n.lb-lexical-toolbar {\n --lb-lexical-toolbar-spacing: calc(0.25 * var(--lb-spacing));\n\n position: relative;\n display: flex;\n flex-direction: row;\n gap: var(--lb-lexical-toolbar-spacing);\n align-items: center;\n padding: var(--lb-lexical-toolbar-spacing);\n background: var(--lb-background);\n}\n\n.lb-lexical-floating-toolbar {\n --lb-lexical-toolbar-spacing: $lb-elevation-padding;\n}\n\n.lb-lexical-toolbar-separator {\n position: relative;\n align-self: stretch;\n inline-size: 1px;\n margin-inline: 1px;\n pointer-events: none;\n\n &::before {\n content: \"\";\n position: absolute;\n inset: 10% 0;\n background: var(--lb-foreground-subtle);\n }\n}\n","@mixin invisible-selection {\n &::selection,\n *::selection {\n background: transparent;\n }\n}\n"]}
1
+ {"version":3,"sources":["src/styles/src/styles/index.css","src/styles/src/styles/utils.css"],"names":[],"mappings":"AAOA,6BAAA,QAAA,CAAA,SAAA,CAAA,eAAA,CAUA,gCAAA,mDAAA,CAIA,+BAAA,gEAAA,CAIA,sCAAA,4DAAA,CAAA,iDAAA,CAAA,4CAAA,CAAA,yCAAA,CAAA,sCAAA,CAAA,mCAAA,CAaA,wBAAA,gDAAA,CAAA,qDAAA,CAAA,6BAAA,CAAA,WAAA,CAOA,kCAAA,6DAAA,CAAA,8CAAA,CAAA,oCAAA,CAAA,cAAA,CAAA,wBAAA,CAAA,gBAAA,CAAA,YAAA,CAAA,kBAAA,CAAA,uBAAA,CAAA,iBAAA,CAAA,4CAAA,CAAA,YAAA,CAeE,4EAAA,sCAAA,CAAA,yDAAA,CAKA,mEAAA,UAAA,CAAA,kBAAA,CAWA,+CAAA,oCAAA,CAIA,kDAAA,sCAAA,CAIA,mDAAA,qCAAA,CAeF,oBAAA,yCAAA,CAAA,kCAAA,CAAA,sBAAA,CAAA,kCAAA,CAAA,0BAAA,CAAA,iBAAA,CAAA,eAAA,CClGE,+BAAA,cAAA,CAAA,gCAAA,cAAA,CD4GA,2CAAA,2BAAA,CAAA,iCAAA,CAUF,wBAAA,kCAAA,CAAA,0BAAA,CAAA,8BAAA,CAAA,2DAAA,CAAA,mDAAA,CAAA,yBAAA,CAAA,YAAA,CAAA,eAAA,CAAA,+CAAA,CAUE,mDAAA,sBAAA,CAAA,uDAAA,CAAA,+CAAA,CAUF,6BAAA,yCAAA,CAAA,0DAAA,CAKA,8CAAA,yDAAA,CAAA,6BAAA,CAWA,oCAAA,8BAAA,CAAA,uCAAA,CAAA,yCAAA,CAAA,iBAAA,CAAA,eAAA,CAAA,uEAAA,CAQE,0CAAA,UAAA,CAAA,SAAA,CAAA,qBAAA,CAAA,iCAAA,CAAA,mBAAA,CAAA,iBAAA,CAAA,OAAA,CAUA,+DAAA,uEAAA,CASF,qBAAA,gCAAA,CAQA,oCAAA,2CAAA,CAGE,+DAAA,sDAAA,CASF,8BAAA,2CAAA,CAjHA,gCACE,yDAAA,kCAAA,CA4DA,8CAAA,sBAAA,CAAA","file":"styles.css","sourcesContent":["@import \"./utils\";\n@import \"./constants\";\n\n/*************************************\n * Suggestions *\n *************************************/\n\n.lb-lexical-suggestions-list {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n/*************************************\n * Mention suggestions *\n *************************************/\n\n.lb-lexical-mention-suggestions {\n --lb-lexical-mention-suggestion-avatar-size: 1.25rem;\n}\n\n.lb-lexical-mention-suggestion {\n padding: calc(0.375 * var(--lb-spacing)) calc(0.625 * var(--lb-spacing));\n}\n\n.lb-lexical-mention-suggestion-avatar {\n inline-size: var(--lb-lexical-mention-suggestion-avatar-size);\n margin-inline-start: calc(-0.125 * var(--lb-spacing));\n margin-inline-end: calc(0.5 * var(--lb-spacing));\n margin-block: calc(0.125 * var(--lb-spacing));\n background: var(--lb-foreground-subtle);\n color: var(--lb-foreground-moderate);\n}\n\n/*************************************\n * Elevation lists *\n *************************************/\n\n.lb-lexical-suggestions {\n padding: $lb-elevation-list-padding;\n animation-duration: var(--lb-transition-duration);\n animation-timing-function: var(--lb-transition-easing);\n will-change: transform, opacity;\n}\n\n.lb-lexical-suggestions-list-item {\n display: flex;\n align-items: center;\n padding: calc(0.25 * var(--lb-spacing)) calc(0.5 * var(--lb-spacing));\n border-radius: calc(var(--lb-radius) - 0.75 * $lb-elevation-list-padding);\n color: var(--lb-foreground-secondary);\n outline: none;\n font-size: 0.875rem;\n cursor: pointer;\n user-select: none;\n transition-property: background, color, opacity;\n scroll-margin-block: $lb-elevation-list-padding;\n}\n\n:is(.lb-lexical-suggestions-list-item) {\n &:where([data-highlighted], [data-selected]) {\n background: var(--lb-foreground-subtle);\n transition-duration: calc(var(--lb-transition-duration) / 2);\n }\n\n &:where(:disabled, [data-disabled]) {\n opacity: 0.5;\n cursor: not-allowed;\n }\n}\n\n/*************************************\n * Floating animations *\n *************************************/\n\n:is(.lb-lexical-suggestions) {\n &:where([data-side=\"top\"]) {\n animation-name: lb-animation-slide-up;\n }\n\n &:where([data-side=\"bottom\"]) {\n animation-name: lb-animation-slide-down;\n }\n\n &:where([data-state=\"closed\"]) {\n animation-name: lb-animation-disappear;\n }\n}\n\n@media (prefers-reduced-motion) {\n .lb-lexical-suggestions:where(:not([data-state=\"closed\"])) {\n animation-name: lb-animation-appear;\n }\n}\n\n/*************************************\n * Mention *\n *************************************/\n\n.lb-lexical-mention {\n padding: 0.1em 0.3em;\n border-radius: calc(0.675 * var(--lb-radius));\n background: var(--lb-accent-subtle);\n color: var(--lb-accent);\n box-decoration-break: clone;\n font-weight: 500;\n\n @include invisible-selection;\n\n &:where([data-selected]) {\n background: var(--lb-accent);\n color: var(--lb-accent-foreground);\n }\n}\n\n/*************************************\n * Thread mark *\n *************************************/\n\n.lb-lexical-thread-mark {\n background: var(--lb-accent-subtle);\n color: var(--lb-foreground);\n outline: none;\n font-weight: 500;\n transition-property: color, text-decoration-color;\n text-decoration-line: underline;\n text-decoration-color: var(--lb-foreground-moderate);\n text-underline-offset: 2px;\n\n &:where([data-state=\"active\"]) {\n color: var(--lb-accent);\n text-decoration-color: var(--lb-accent-moderate);\n }\n}\n\n/*************************************\n * Anchored threads *\n *************************************/\n\n.lb-lexical-anchored-threads {\n --lb-lexical-anchored-threads-gap: 1.25rem;\n --lb-lexical-anchored-threads-active-thread-offset: -0.75rem;\n}\n\n.lb-lexical-anchored-threads-thread-container {\n transition-duration: calc(var(--lb-transition-duration) * 2);\n transition-property: transform;\n}\n\n@media (prefers-reduced-motion) {\n .lb-lexical-anchored-threads-thread-container {\n transition-duration: 0s;\n }\n}\n\n.lb-lexical-anchored-threads-thread {\n position: relative;\n overflow: hidden;\n border-radius: var(--lb-radius);\n background: var(--lb-dynamic-background);\n box-shadow: $lb-lexical-anchored-threads-shadow;\n transition-property: background, box-shadow;\n\n &::after {\n content: \"\";\n position: absolute;\n inset: 0;\n z-index: 1;\n border-radius: inherit;\n box-shadow: var(--lb-inset-shadow);\n pointer-events: none;\n }\n\n &:where([data-state=\"active\"]) {\n box-shadow: $lb-lexical-anchored-threads-active-shadow;\n }\n}\n\n/*************************************\n * Floating components *\n *************************************/\n\n.lb-lexical-floating {\n --lb-lexical-floating-size: 350px;\n}\n\n/*************************************\n * Floating threads *\n *************************************/\n\n.lb-lexical-floating-threads-thread {\n inline-size: var(--lb-lexical-floating-size);\n\n &:where(:not(:last-of-type)) {\n border-block-end: 1px solid var(--lb-foreground-subtle);\n }\n}\n\n/*************************************\n * Floating composer *\n *************************************/\n\n.lb-lexical-floating-composer {\n inline-size: var(--lb-lexical-floating-size);\n}\n","@mixin invisible-selection {\n &::selection,\n *::selection {\n background: transparent;\n }\n}\n"]}
@@ -1,26 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('@lexical/utils');
4
- var lexical = require('lexical');
5
-
6
- function isParentRootOrShadowRoot(node) {
7
- const parent = node.getParent();
8
- return parent !== null && lexical.$isRootOrShadowRoot(parent);
9
- }
10
- function getActiveBlockElement(editor) {
11
- return editor.getEditorState().read(() => {
12
- const selection = lexical.$getSelection();
13
- if (!lexical.$isRangeSelection(selection))
14
- return null;
15
- const anchor = selection.anchor.getNode();
16
- const focus = selection.focus.getNode();
17
- const commonAncestor = anchor.getCommonAncestor(focus);
18
- if (!commonAncestor || lexical.$isRootOrShadowRoot(commonAncestor))
19
- return null;
20
- const element = isParentRootOrShadowRoot(commonAncestor) ? commonAncestor : utils.$findMatchingParent(commonAncestor, isParentRootOrShadowRoot);
21
- return element;
22
- });
23
- }
24
-
25
- exports.getActiveBlockElement = getActiveBlockElement;
26
- //# sourceMappingURL=get-active-block-element.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-active-block-element.js","sources":["../src/get-active-block-element.ts"],"sourcesContent":["import { $findMatchingParent } from \"@lexical/utils\";\nimport type { LexicalEditor, LexicalNode } from \"lexical\";\nimport { $getSelection, $isRangeSelection, $isRootOrShadowRoot } from \"lexical\";\n\nfunction isParentRootOrShadowRoot(node: LexicalNode) {\n const parent = node.getParent();\n\n return parent !== null && $isRootOrShadowRoot(parent);\n}\n\nexport function getActiveBlockElement(editor: LexicalEditor) {\n return editor.getEditorState().read(() => {\n const selection = $getSelection();\n\n if (!$isRangeSelection(selection)) return null;\n\n const anchor = selection.anchor.getNode();\n const focus = selection.focus.getNode();\n\n const commonAncestor = anchor.getCommonAncestor(focus);\n\n if (!commonAncestor || $isRootOrShadowRoot(commonAncestor)) return null;\n\n const element = isParentRootOrShadowRoot(commonAncestor)\n ? commonAncestor\n : $findMatchingParent(commonAncestor, isParentRootOrShadowRoot);\n\n return element;\n });\n}\n"],"names":["$isRootOrShadowRoot","$getSelection","$isRangeSelection","$findMatchingParent"],"mappings":";;;;;AAIA,SAAS,yBAAyB,IAAmB,EAAA;AACnD,EAAM,MAAA,MAAA,GAAS,KAAK,SAAU,EAAA,CAAA;AAE9B,EAAO,OAAA,MAAA,KAAW,IAAQ,IAAAA,2BAAA,CAAoB,MAAM,CAAA,CAAA;AACtD,CAAA;AAEO,SAAS,sBAAsB,MAAuB,EAAA;AAC3D,EAAA,OAAO,MAAO,CAAA,cAAA,EAAiB,CAAA,IAAA,CAAK,MAAM;AACxC,IAAA,MAAM,YAAYC,qBAAc,EAAA,CAAA;AAEhC,IAAI,IAAA,CAACC,0BAAkB,SAAS,CAAA;AAAG,MAAO,OAAA,IAAA,CAAA;AAE1C,IAAM,MAAA,MAAA,GAAS,SAAU,CAAA,MAAA,CAAO,OAAQ,EAAA,CAAA;AACxC,IAAM,MAAA,KAAA,GAAQ,SAAU,CAAA,KAAA,CAAM,OAAQ,EAAA,CAAA;AAEtC,IAAM,MAAA,cAAA,GAAiB,MAAO,CAAA,iBAAA,CAAkB,KAAK,CAAA,CAAA;AAErD,IAAI,IAAA,CAAC,cAAkB,IAAAF,2BAAA,CAAoB,cAAc,CAAA;AAAG,MAAO,OAAA,IAAA,CAAA;AAEnE,IAAA,MAAM,UAAU,wBAAyB,CAAA,cAAc,IACnD,cACA,GAAAG,yBAAA,CAAoB,gBAAgB,wBAAwB,CAAA,CAAA;AAEhE,IAAO,OAAA,OAAA,CAAA;AAAA,GACR,CAAA,CAAA;AACH;;;;"}
@@ -1,24 +0,0 @@
1
- import { $findMatchingParent } from '@lexical/utils';
2
- import { $isRootOrShadowRoot, $getSelection, $isRangeSelection } from 'lexical';
3
-
4
- function isParentRootOrShadowRoot(node) {
5
- const parent = node.getParent();
6
- return parent !== null && $isRootOrShadowRoot(parent);
7
- }
8
- function getActiveBlockElement(editor) {
9
- return editor.getEditorState().read(() => {
10
- const selection = $getSelection();
11
- if (!$isRangeSelection(selection))
12
- return null;
13
- const anchor = selection.anchor.getNode();
14
- const focus = selection.focus.getNode();
15
- const commonAncestor = anchor.getCommonAncestor(focus);
16
- if (!commonAncestor || $isRootOrShadowRoot(commonAncestor))
17
- return null;
18
- const element = isParentRootOrShadowRoot(commonAncestor) ? commonAncestor : $findMatchingParent(commonAncestor, isParentRootOrShadowRoot);
19
- return element;
20
- });
21
- }
22
-
23
- export { getActiveBlockElement };
24
- //# sourceMappingURL=get-active-block-element.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-active-block-element.mjs","sources":["../src/get-active-block-element.ts"],"sourcesContent":["import { $findMatchingParent } from \"@lexical/utils\";\nimport type { LexicalEditor, LexicalNode } from \"lexical\";\nimport { $getSelection, $isRangeSelection, $isRootOrShadowRoot } from \"lexical\";\n\nfunction isParentRootOrShadowRoot(node: LexicalNode) {\n const parent = node.getParent();\n\n return parent !== null && $isRootOrShadowRoot(parent);\n}\n\nexport function getActiveBlockElement(editor: LexicalEditor) {\n return editor.getEditorState().read(() => {\n const selection = $getSelection();\n\n if (!$isRangeSelection(selection)) return null;\n\n const anchor = selection.anchor.getNode();\n const focus = selection.focus.getNode();\n\n const commonAncestor = anchor.getCommonAncestor(focus);\n\n if (!commonAncestor || $isRootOrShadowRoot(commonAncestor)) return null;\n\n const element = isParentRootOrShadowRoot(commonAncestor)\n ? commonAncestor\n : $findMatchingParent(commonAncestor, isParentRootOrShadowRoot);\n\n return element;\n });\n}\n"],"names":[],"mappings":";;;AAIA,SAAS,yBAAyB,IAAmB,EAAA;AACnD,EAAM,MAAA,MAAA,GAAS,KAAK,SAAU,EAAA,CAAA;AAE9B,EAAO,OAAA,MAAA,KAAW,IAAQ,IAAA,mBAAA,CAAoB,MAAM,CAAA,CAAA;AACtD,CAAA;AAEO,SAAS,sBAAsB,MAAuB,EAAA;AAC3D,EAAA,OAAO,MAAO,CAAA,cAAA,EAAiB,CAAA,IAAA,CAAK,MAAM;AACxC,IAAA,MAAM,YAAY,aAAc,EAAA,CAAA;AAEhC,IAAI,IAAA,CAAC,kBAAkB,SAAS,CAAA;AAAG,MAAO,OAAA,IAAA,CAAA;AAE1C,IAAM,MAAA,MAAA,GAAS,SAAU,CAAA,MAAA,CAAO,OAAQ,EAAA,CAAA;AACxC,IAAM,MAAA,KAAA,GAAQ,SAAU,CAAA,KAAA,CAAM,OAAQ,EAAA,CAAA;AAEtC,IAAM,MAAA,cAAA,GAAiB,MAAO,CAAA,iBAAA,CAAkB,KAAK,CAAA,CAAA;AAErD,IAAI,IAAA,CAAC,cAAkB,IAAA,mBAAA,CAAoB,cAAc,CAAA;AAAG,MAAO,OAAA,IAAA,CAAA;AAEnE,IAAA,MAAM,UAAU,wBAAyB,CAAA,cAAc,IACnD,cACA,GAAA,mBAAA,CAAoB,gBAAgB,wBAAwB,CAAA,CAAA;AAEhE,IAAO,OAAA,OAAA,CAAA;AAAA,GACR,CAAA,CAAA;AACH;;;;"}
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
4
-
5
- function useIsCommandRegistered(command) {
6
- const [editor] = LexicalComposerContext.useLexicalComposerContext();
7
- return editor._commands.has(command);
8
- }
9
-
10
- exports.useIsCommandRegistered = useIsCommandRegistered;
11
- //# sourceMappingURL=is-command-registered.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-command-registered.js","sources":["../src/is-command-registered.ts"],"sourcesContent":["import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport type { LexicalCommand } from \"lexical\";\n\n/**\n * Checks if a command is registered in the current Lexical editor.\n */\nexport function useIsCommandRegistered(command: LexicalCommand<unknown>) {\n const [editor] = useLexicalComposerContext();\n\n return editor._commands.has(command);\n}\n"],"names":["useLexicalComposerContext"],"mappings":";;;;AAMO,SAAS,uBAAuB,OAAkC,EAAA;AACvE,EAAM,MAAA,CAAC,MAAM,CAAA,GAAIA,gDAA0B,EAAA,CAAA;AAE3C,EAAO,OAAA,MAAA,CAAO,SAAU,CAAA,GAAA,CAAI,OAAO,CAAA,CAAA;AACrC;;;;"}
@@ -1,9 +0,0 @@
1
- import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
2
-
3
- function useIsCommandRegistered(command) {
4
- const [editor] = useLexicalComposerContext();
5
- return editor._commands.has(command);
6
- }
7
-
8
- export { useIsCommandRegistered };
9
- //# sourceMappingURL=is-command-registered.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-command-registered.mjs","sources":["../src/is-command-registered.ts"],"sourcesContent":["import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport type { LexicalCommand } from \"lexical\";\n\n/**\n * Checks if a command is registered in the current Lexical editor.\n */\nexport function useIsCommandRegistered(command: LexicalCommand<unknown>) {\n const [editor] = useLexicalComposerContext();\n\n return editor._commands.has(command);\n}\n"],"names":[],"mappings":";;AAMO,SAAS,uBAAuB,OAAkC,EAAA;AACvE,EAAM,MAAA,CAAC,MAAM,CAAA,GAAI,yBAA0B,EAAA,CAAA;AAE3C,EAAO,OAAA,MAAA,CAAO,SAAU,CAAA,GAAA,CAAI,OAAO,CAAA,CAAA;AACrC;;;;"}
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- var lexical = require('lexical');
4
-
5
- function isTextFormatActive(editor, format) {
6
- return editor.getEditorState().read(() => {
7
- const selection = lexical.$getSelection();
8
- if (!lexical.$isRangeSelection(selection) || selection.isCollapsed()) {
9
- return false;
10
- }
11
- return selection.hasFormat(format);
12
- });
13
- }
14
-
15
- exports.isTextFormatActive = isTextFormatActive;
16
- //# sourceMappingURL=is-text-format-active.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-text-format-active.js","sources":["../src/is-text-format-active.ts"],"sourcesContent":["import type { LexicalEditor, TextFormatType } from \"lexical\";\nimport { $getSelection, $isRangeSelection } from \"lexical\";\n\nexport function isTextFormatActive(\n editor: LexicalEditor,\n format: TextFormatType\n) {\n return editor.getEditorState().read(() => {\n const selection = $getSelection();\n\n if (!$isRangeSelection(selection) || selection.isCollapsed()) {\n return false;\n }\n\n return selection.hasFormat(format);\n });\n}\n"],"names":["$getSelection","$isRangeSelection"],"mappings":";;;;AAGgB,SAAA,kBAAA,CACd,QACA,MACA,EAAA;AACA,EAAA,OAAO,MAAO,CAAA,cAAA,EAAiB,CAAA,IAAA,CAAK,MAAM;AACxC,IAAA,MAAM,YAAYA,qBAAc,EAAA,CAAA;AAEhC,IAAA,IAAI,CAACC,yBAAkB,CAAA,SAAS,CAAK,IAAA,SAAA,CAAU,aAAe,EAAA;AAC5D,MAAO,OAAA,KAAA,CAAA;AAAA,KACT;AAEA,IAAO,OAAA,SAAA,CAAU,UAAU,MAAM,CAAA,CAAA;AAAA,GAClC,CAAA,CAAA;AACH;;;;"}
@@ -1,14 +0,0 @@
1
- import { $getSelection, $isRangeSelection } from 'lexical';
2
-
3
- function isTextFormatActive(editor, format) {
4
- return editor.getEditorState().read(() => {
5
- const selection = $getSelection();
6
- if (!$isRangeSelection(selection) || selection.isCollapsed()) {
7
- return false;
8
- }
9
- return selection.hasFormat(format);
10
- });
11
- }
12
-
13
- export { isTextFormatActive };
14
- //# sourceMappingURL=is-text-format-active.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-text-format-active.mjs","sources":["../src/is-text-format-active.ts"],"sourcesContent":["import type { LexicalEditor, TextFormatType } from \"lexical\";\nimport { $getSelection, $isRangeSelection } from \"lexical\";\n\nexport function isTextFormatActive(\n editor: LexicalEditor,\n format: TextFormatType\n) {\n return editor.getEditorState().read(() => {\n const selection = $getSelection();\n\n if (!$isRangeSelection(selection) || selection.isCollapsed()) {\n return false;\n }\n\n return selection.hasFormat(format);\n });\n}\n"],"names":[],"mappings":";;AAGgB,SAAA,kBAAA,CACd,QACA,MACA,EAAA;AACA,EAAA,OAAO,MAAO,CAAA,cAAA,EAAiB,CAAA,IAAA,CAAK,MAAM;AACxC,IAAA,MAAM,YAAY,aAAc,EAAA,CAAA;AAEhC,IAAA,IAAI,CAAC,iBAAkB,CAAA,SAAS,CAAK,IAAA,SAAA,CAAU,aAAe,EAAA;AAC5D,MAAO,OAAA,KAAA,CAAA;AAAA,KACT;AAEA,IAAO,OAAA,SAAA,CAAU,UAAU,MAAM,CAAA,CAAA;AAAA,GAClC,CAAA,CAAA;AACH;;;;"}
@@ -1,312 +0,0 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var reactDom = require('@floating-ui/react-dom');
5
- var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
6
- var _private = require('@liveblocks/react-ui/_private');
7
- var lexical = require('lexical');
8
- var react = require('react');
9
- var reactDom$1 = require('react-dom');
10
- var classnames = require('../classnames.js');
11
- var floatingComposer = require('../comments/floating-composer.js');
12
- var createDomRange = require('../create-dom-range.js');
13
- var isCommandRegistered = require('../is-command-registered.js');
14
- var shared = require('./shared.js');
15
- var toolbar = require('./toolbar.js');
16
-
17
- const FLOATING_TOOLBAR_COLLISION_PADDING = 10;
18
- const FLOATING_TOOLBAR_OPEN_DELAY = 50;
19
- function DefaultFloatingToolbarContent() {
20
- const supportsTextFormat = isCommandRegistered.useIsCommandRegistered(lexical.FORMAT_TEXT_COMMAND);
21
- const supportsThread = isCommandRegistered.useIsCommandRegistered(floatingComposer.OPEN_FLOATING_COMPOSER_COMMAND);
22
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
23
- children: [
24
- supportsTextFormat ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
25
- children: [
26
- /* @__PURE__ */ jsxRuntime.jsx(toolbar.Toolbar.BlockSelector, {}),
27
- /* @__PURE__ */ jsxRuntime.jsx(toolbar.Toolbar.SectionInline, {})
28
- ]
29
- }) : null,
30
- supportsThread ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
31
- children: [
32
- /* @__PURE__ */ jsxRuntime.jsx(toolbar.Toolbar.Separator, {}),
33
- /* @__PURE__ */ jsxRuntime.jsx(toolbar.Toolbar.SectionCollaboration, {})
34
- ]
35
- }) : null
36
- ]
37
- });
38
- }
39
- const FloatingToolbar = Object.assign(
40
- react.forwardRef(
41
- ({
42
- children = DefaultFloatingToolbarContent,
43
- before,
44
- after,
45
- position = "top",
46
- offset: sideOffset = 6,
47
- onPointerDown,
48
- onFocus,
49
- onBlur,
50
- className,
51
- ...props
52
- }, forwardedRef) => {
53
- const toolbarRef = react.useRef(null);
54
- const externalIds = _private.useInitial(() => /* @__PURE__ */ new Set());
55
- const [isPointerDown, setPointerDown] = react.useState(false);
56
- const [editor] = LexicalComposerContext.useLexicalComposerContext();
57
- const [isFocused, setFocused] = react.useState(false);
58
- const [isManuallyClosed, setManuallyClosed] = react.useState(false);
59
- const [hasSelectionRange, setHasSelectionRange] = react.useState(false);
60
- const isOpen = isFocused && !isPointerDown && hasSelectionRange && !isManuallyClosed;
61
- const [delayedIsOpen, setDelayedIsOpen] = react.useState(isOpen);
62
- const delayedIsOpenTimeoutRef = react.useRef();
63
- react.useEffect(() => {
64
- setManuallyClosed(false);
65
- }, [isFocused, hasSelectionRange, editor]);
66
- react.useEffect(() => {
67
- const root = editor.getRootElement();
68
- if (!root) {
69
- return;
70
- }
71
- const handleFocus2 = () => {
72
- setFocused(true);
73
- };
74
- const handleBlur2 = (event) => {
75
- if (event.relatedTarget && toolbarRef.current?.contains(event.relatedTarget)) {
76
- return;
77
- }
78
- if (event.relatedTarget === editor.getRootElement()) {
79
- return;
80
- }
81
- for (const externalId of externalIds) {
82
- if (document.getElementById(externalId)?.contains(event.relatedTarget)) {
83
- return;
84
- }
85
- }
86
- setFocused(false);
87
- };
88
- root.addEventListener("focus", handleFocus2);
89
- root.addEventListener("blur", handleBlur2);
90
- return () => {
91
- root.removeEventListener("focus", handleFocus2);
92
- root.removeEventListener("blur", handleBlur2);
93
- };
94
- }, [editor, externalIds]);
95
- const handleFocus = react.useCallback(
96
- (event) => {
97
- onFocus?.(event);
98
- if (!event.isDefaultPrevented()) {
99
- setFocused(true);
100
- }
101
- },
102
- [onFocus]
103
- );
104
- const handleBlur = react.useCallback(
105
- (event) => {
106
- onBlur?.(event);
107
- if (!event.isDefaultPrevented()) {
108
- if (event.relatedTarget && toolbarRef.current?.contains(event.relatedTarget)) {
109
- return;
110
- }
111
- if (event.relatedTarget === editor?.getRootElement()) {
112
- return;
113
- }
114
- for (const externalId of externalIds) {
115
- if (document.getElementById(externalId)?.contains(event.relatedTarget)) {
116
- return;
117
- }
118
- }
119
- setFocused(false);
120
- }
121
- },
122
- [onBlur, editor, externalIds]
123
- );
124
- react.useEffect(() => {
125
- if (isOpen) {
126
- delayedIsOpenTimeoutRef.current = window.setTimeout(() => {
127
- setDelayedIsOpen(true);
128
- }, FLOATING_TOOLBAR_OPEN_DELAY);
129
- } else {
130
- setDelayedIsOpen(false);
131
- }
132
- return () => {
133
- window.clearTimeout(delayedIsOpenTimeoutRef.current);
134
- };
135
- }, [isOpen]);
136
- const floatingOptions = react.useMemo(() => {
137
- const detectOverflowOptions = {
138
- padding: FLOATING_TOOLBAR_COLLISION_PADDING
139
- };
140
- return {
141
- strategy: "fixed",
142
- placement: position,
143
- middleware: [
144
- reactDom.inline(detectOverflowOptions),
145
- reactDom.flip({ ...detectOverflowOptions, crossAxis: false }),
146
- reactDom.hide(detectOverflowOptions),
147
- reactDom.shift({
148
- ...detectOverflowOptions,
149
- limiter: reactDom.limitShift()
150
- }),
151
- reactDom.offset(sideOffset),
152
- reactDom.size(detectOverflowOptions)
153
- ],
154
- whileElementsMounted: (...args) => {
155
- return reactDom.autoUpdate(...args, {
156
- animationFrame: true
157
- });
158
- }
159
- };
160
- }, [position, sideOffset]);
161
- const {
162
- refs: { setReference, setFloating },
163
- strategy,
164
- x,
165
- y,
166
- isPositioned
167
- } = reactDom.useFloating({
168
- ...floatingOptions,
169
- open: delayedIsOpen
170
- });
171
- const mergedRefs = _private.useRefs(forwardedRef, toolbarRef, setFloating);
172
- const handlePointerDown = react.useCallback(
173
- (event) => {
174
- onPointerDown?.(event);
175
- event.stopPropagation();
176
- if (event.target === toolbarRef.current) {
177
- event.preventDefault();
178
- }
179
- },
180
- [onPointerDown]
181
- );
182
- react.useEffect(() => {
183
- if (!editor) {
184
- return;
185
- }
186
- const handlePointerDown2 = () => {
187
- setPointerDown(true);
188
- };
189
- const handlePointerUp = () => {
190
- setPointerDown(false);
191
- };
192
- const root = editor.getRootElement();
193
- if (!root) {
194
- return;
195
- }
196
- root.addEventListener("pointerdown", handlePointerDown2);
197
- root.addEventListener("pointercancel", handlePointerUp);
198
- root.addEventListener("pointerup", handlePointerUp);
199
- return () => {
200
- root.removeEventListener("pointerdown", handlePointerDown2);
201
- root.removeEventListener("pointercancel", handlePointerUp);
202
- root.removeEventListener("pointerup", handlePointerUp);
203
- };
204
- }, [editor]);
205
- react.useEffect(() => {
206
- const unregister = editor.registerUpdateListener(({ tags }) => {
207
- return editor.getEditorState().read(() => {
208
- if (tags.has("collaboration"))
209
- return;
210
- setManuallyClosed(false);
211
- const selection = lexical.$getSelection();
212
- if (!lexical.$isRangeSelection(selection) || selection.isCollapsed()) {
213
- setHasSelectionRange(false);
214
- setReference(null);
215
- return;
216
- }
217
- const { anchor, focus } = selection;
218
- const range = createDomRange.createDOMRange(
219
- editor,
220
- anchor.getNode(),
221
- anchor.offset,
222
- focus.getNode(),
223
- focus.offset
224
- );
225
- setHasSelectionRange(true);
226
- setReference(range);
227
- });
228
- });
229
- return unregister;
230
- }, [editor, setReference]);
231
- react.useEffect(() => {
232
- const root = editor.getRootElement();
233
- if (!root || !delayedIsOpen) {
234
- return;
235
- }
236
- const handleKeyDown = (event) => {
237
- if (event.target !== root && event.defaultPrevented) {
238
- return;
239
- }
240
- if (event.key === "Escape") {
241
- event.preventDefault();
242
- event.stopPropagation();
243
- editor.focus();
244
- setManuallyClosed(true);
245
- }
246
- };
247
- root.addEventListener("keydown", handleKeyDown);
248
- return () => {
249
- root.removeEventListener("keydown", handleKeyDown);
250
- };
251
- }, [editor, delayedIsOpen]);
252
- const close = react.useCallback(() => {
253
- editor.focus();
254
- setManuallyClosed(true);
255
- }, [editor, setManuallyClosed]);
256
- const registerExternal = react.useCallback(
257
- (id) => {
258
- externalIds.add(id);
259
- return () => {
260
- externalIds.delete(id);
261
- };
262
- },
263
- [externalIds]
264
- );
265
- if (!delayedIsOpen) {
266
- return null;
267
- }
268
- const slotProps = { editor };
269
- return reactDom$1.createPortal(
270
- /* @__PURE__ */ jsxRuntime.jsx(_private.TooltipProvider, {
271
- children: /* @__PURE__ */ jsxRuntime.jsx(shared.FloatingToolbarContext.Provider, {
272
- value: { close, registerExternal },
273
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
274
- role: "toolbar",
275
- "aria-label": "Floating toolbar",
276
- "aria-orientation": "horizontal",
277
- className: classnames.classNames(
278
- "lb-root lb-portal lb-elevation lb-lexical-floating-toolbar lb-lexical-toolbar",
279
- className
280
- ),
281
- ref: mergedRefs,
282
- style: {
283
- position: strategy,
284
- top: 0,
285
- left: 0,
286
- transform: isPositioned ? `translate3d(${Math.round(x)}px, ${Math.round(y)}px, 0)` : "translate3d(0, -200%, 0)",
287
- minWidth: "max-content"
288
- },
289
- onPointerDown: handlePointerDown,
290
- onFocus: handleFocus,
291
- onBlur: handleBlur,
292
- ...props,
293
- children: [
294
- toolbar.applyToolbarSlot(before, slotProps),
295
- toolbar.applyToolbarSlot(children, slotProps),
296
- toolbar.applyToolbarSlot(after, slotProps)
297
- ]
298
- })
299
- })
300
- }),
301
- document.body
302
- );
303
- }
304
- ),
305
- {
306
- External: shared.FloatingToolbarExternal
307
- }
308
- );
309
-
310
- exports.FLOATING_TOOLBAR_COLLISION_PADDING = FLOATING_TOOLBAR_COLLISION_PADDING;
311
- exports.FloatingToolbar = FloatingToolbar;
312
- //# sourceMappingURL=floating-toolbar.js.map