@liveblocks/react-tiptap 2.16.0-toolbars5 → 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 (52) hide show
  1. package/dist/LiveblocksExtension.js.map +1 -1
  2. package/dist/LiveblocksExtension.mjs.map +1 -1
  3. package/dist/comments/CommentsExtension.js +11 -20
  4. package/dist/comments/CommentsExtension.js.map +1 -1
  5. package/dist/comments/CommentsExtension.mjs +13 -22
  6. package/dist/comments/CommentsExtension.mjs.map +1 -1
  7. package/dist/comments/FloatingComposer.js +30 -27
  8. package/dist/comments/FloatingComposer.js.map +1 -1
  9. package/dist/comments/FloatingComposer.mjs +32 -29
  10. package/dist/comments/FloatingComposer.mjs.map +1 -1
  11. package/dist/index.d.mts +10 -254
  12. package/dist/index.d.ts +10 -254
  13. package/dist/index.js +0 -4
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +0 -2
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/types.js +3 -7
  18. package/dist/types.js.map +1 -1
  19. package/dist/types.mjs +3 -6
  20. package/dist/types.mjs.map +1 -1
  21. package/dist/utils.js +0 -17
  22. package/dist/utils.js.map +1 -1
  23. package/dist/utils.mjs +1 -16
  24. package/dist/utils.mjs.map +1 -1
  25. package/dist/version-history/HistoryVersionPreview.js +79 -79
  26. package/dist/version-history/HistoryVersionPreview.js.map +1 -1
  27. package/dist/version-history/HistoryVersionPreview.mjs +79 -79
  28. package/dist/version-history/HistoryVersionPreview.mjs.map +1 -1
  29. package/dist/version.js +1 -1
  30. package/dist/version.mjs +1 -1
  31. package/package.json +6 -8
  32. package/src/styles/constants.css +1 -2
  33. package/src/styles/index.css +6 -58
  34. package/src/styles/utils.css +0 -11
  35. package/styles.css +1 -1
  36. package/styles.css.map +1 -1
  37. package/dist/context.js +0 -24
  38. package/dist/context.js.map +0 -1
  39. package/dist/context.mjs +0 -21
  40. package/dist/context.mjs.map +0 -1
  41. package/dist/toolbar/FloatingToolbar.js +0 -321
  42. package/dist/toolbar/FloatingToolbar.js.map +0 -1
  43. package/dist/toolbar/FloatingToolbar.mjs +0 -318
  44. package/dist/toolbar/FloatingToolbar.mjs.map +0 -1
  45. package/dist/toolbar/Toolbar.js +0 -396
  46. package/dist/toolbar/Toolbar.js.map +0 -1
  47. package/dist/toolbar/Toolbar.mjs +0 -371
  48. package/dist/toolbar/Toolbar.mjs.map +0 -1
  49. package/dist/toolbar/shared.js +0 -39
  50. package/dist/toolbar/shared.js.map +0 -1
  51. package/dist/toolbar/shared.mjs +0 -36
  52. package/dist/toolbar/shared.mjs.map +0 -1
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,4BAAA,QAAA,CAAA,SAAA,CAAA,eAAA,CAUA,+BAAA,kDAAA,CAIA,8BAAA,gEAAA,CAIA,qCAAA,2DAAA,CAAA,iDAAA,CAAA,4CAAA,CAAA,yCAAA,CAAA,sCAAA,CAAA,mCAAA,CAaA,uBAAA,gDAAA,CAAA,qDAAA,CAAA,6BAAA,CAAA,WAAA,CAOA,iCAAA,6DAAA,CAAA,8CAAA,CAAA,oCAAA,CAAA,cAAA,CAAA,wBAAA,CAAA,gBAAA,CAAA,YAAA,CAAA,kBAAA,CAAA,uBAAA,CAAA,iBAAA,CAAA,4CAAA,CAAA,YAAA,CAeE,oIAAA,sCAAA,CAAA,yDAAA,CAQA,6FAAA,UAAA,CAAA,kBAAA,CAWA,8CAAA,oCAAA,CAIA,iDAAA,sCAAA,CAIA,kDAAA,qCAAA,CAeF,mBAAA,yCAAA,CAAA,kCAAA,CAAA,sBAAA,CAAA,kCAAA,CAAA,0BAAA,CAAA,iBAAA,CAAA,eAAA,CCrGE,8BAAA,cAAA,CAAA,+BAAA,cAAA,CDgHF,qBAAA,2BAAA,CAAA,iCAAA,CASA,uDAAA,kCAAA,CAAA,0BAAA,CAAA,8BAAA,CA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n@import \"./constants\";\n\n/*************************************\n * Suggestions *\n *************************************/\n\n.lb-tiptap-suggestions-list {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n/*************************************\n * Mention suggestions *\n *************************************/\n\n.lb-tiptap-mention-suggestions {\n --lb-tiptap-mention-suggestion-avatar-size: 1.25rem;\n}\n\n.lb-tiptap-mention-suggestion {\n padding: calc(0.375 * var(--lb-spacing)) calc(0.625 * var(--lb-spacing));\n}\n\n.lb-tiptap-mention-suggestion-avatar {\n inline-size: var(--lb-tiptap-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-tiptap-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-tiptap-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-tiptap-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-tiptap-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-tiptap-suggestions:where(:not([data-state=\"closed\"])) {\n animation-name: lb-animation-appear;\n }\n}\n\n/*************************************\n * Mention *\n *************************************/\n\n.lb-tiptap-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\n.lb-mention-selected {\n background: var(--lb-accent);\n color: var(--lb-accent-foreground);\n}\n\n/*************************************\n * Thread mark *\n *************************************/\n\n:where(.lb-tiptap-thread-mark:not([data-orphan=\"true\"])) {\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\n:where(\n .lb-tiptap-thread-mark:not([data-orphan=\"true\"])\n .lb-tiptap-thread-mark-selected\n ) {\n color: var(--lb-accent);\n text-decoration-line: underline;\n text-decoration-color: var(--lb-accent-moderate);\n text-underline-offset: 2px;\n}\n\n/*************************************\n * Anchored threads *\n *************************************/\n\n.lb-tiptap-anchored-threads {\n --lb-tiptap-anchored-threads-gap: 1.25rem;\n --lb-tiptap-anchored-threads-active-thread-offset: -0.75rem;\n}\n\n.lb-tiptap-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-tiptap-anchored-threads-thread-container {\n transition-duration: 0s;\n }\n}\n\n.lb-tiptap-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-tiptap-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-tiptap-anchored-threads-active-shadow;\n }\n}\n\n/*************************************\n * Floating components *\n *************************************/\n\n.lb-tiptap-floating {\n --lb-tiptap-floating-size: 350px;\n}\n\n/*************************************\n * Floating threads *\n *************************************/\n\n.lb-tiptap-floating-threads-thread {\n inline-size: var(--lb-tiptap-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-tiptap-floating-composer {\n inline-size: var(--lb-tiptap-floating-size);\n}\n\n/*************************************\n * Active selection *\n *************************************/\n\n.lb-tiptap-active-selection {\n background: var(--lb-selection, rgb(0 0 255 / 20%));\n pointer-events: none;\n}\n\n/*************************************\n * Toolbar *\n *************************************/\n\n.lb-tiptap-toolbar {\n --lb-tiptap-toolbar-spacing: calc(0.25 * var(--lb-spacing));\n\n position: relative;\n display: flex;\n flex-direction: row;\n gap: var(--lb-tiptap-toolbar-spacing);\n align-items: center;\n padding: var(--lb-tiptap-toolbar-spacing);\n background: var(--lb-background);\n\n /* overflow-inline: auto; doesn't work as expected */\n /* stylelint-disable-next-line plugin/use-logical-properties-and-values */\n overflow-x: auto;\n\n @include invisible-scrollbar;\n\n > * {\n flex: none;\n }\n}\n\n.lb-tiptap-floating-toolbar {\n --lb-tiptap-toolbar-spacing: $lb-elevation-padding;\n}\n\n.lb-tiptap-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\n/*************************************\n * Collab Cursors *\n *************************************/\n\n/* Give a remote user a caret */\n/* stylelint-disable-next-line selector-class-pattern */\n.collaboration-cursor__caret {\n position: relative;\n margin-inline-start: -1px;\n margin-inline-end: -1px;\n border-inline-start: 1px solid #0d0d0d;\n border-inline-end: 1px solid #0d0d0d;\n word-break: normal;\n pointer-events: none;\n}\n\n/* Render the username above the caret */\n/* stylelint-disable-next-line selector-class-pattern */\n.collaboration-cursor__label {\n position: absolute;\n inset-inline-start: -1px;\n inset-block-start: -1.4em;\n padding: 2px 6px;\n border-radius: 6px;\n border-end-start-radius: 0;\n color: #fff;\n font-weight: 600;\n font-style: normal;\n font-size: 14px;\n line-height: normal;\n white-space: nowrap;\n pointer-events: none;\n user-select: none;\n}\n","@mixin invisible-selection {\n &::selection,\n *::selection {\n background: transparent;\n }\n}\n\n@mixin invisible-scrollbar {\n & {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n\n &::-webkit-scrollbar {\n display: none;\n }\n}\n"]}
1
+ {"version":3,"sources":["src/styles/src/styles/index.css","src/styles/src/styles/utils.css"],"names":[],"mappings":"AAOA,4BAAA,QAAA,CAAA,SAAA,CAAA,eAAA,CAUA,+BAAA,kDAAA,CAIA,8BAAA,gEAAA,CAIA,qCAAA,2DAAA,CAAA,iDAAA,CAAA,4CAAA,CAAA,yCAAA,CAAA,sCAAA,CAAA,mCAAA,CAaA,uBAAA,gDAAA,CAAA,qDAAA,CAAA,6BAAA,CAAA,WAAA,CAOA,iCAAA,6DAAA,CAAA,8CAAA,CAAA,oCAAA,CAAA,cAAA,CAAA,wBAAA,CAAA,gBAAA,CAAA,YAAA,CAAA,kBAAA,CAAA,uBAAA,CAAA,iBAAA,CAAA,4CAAA,CAAA,YAAA,CAeE,2EAAA,sCAAA,CAAA,yDAAA,CAKA,kEAAA,UAAA,CAAA,kBAAA,CAWA,8CAAA,oCAAA,CAIA,iDAAA,sCAAA,CAIA,kDAAA,qCAAA,CAeF,mBAAA,yCAAA,CAAA,kCAAA,CAAA,sBAAA,CAAA,kCAAA,CAAA,0BAAA,CAAA,iBAAA,CAAA,eAAA,CClGE,8BAAA,cAAA,CAAA,+BAAA,cAAA,CD6GF,qBAAA,2BAAA,CAAA,iCAAA,CASA,uDAAA,kCAAA,CAAA,0BAAA,CAAA,8BAAA,CAAA,2DAAA,CAAA,mDAAA,CAAA,yBAAA,CAAA,YAAA,CAAA,eAAA,CAAA,+CAAA,CAWA,uFAAA,sBAAA,CAAA,8BAAA,CAAA,uDAAA,CAAA,+CAAA,CAAA,yBAAA,CAcA,4BAAA,wCAAA,CAAA,yDAAA,CAKA,6CAAA,yDAAA,CAAA,6BAAA,CAWA,mCAAA,8BAAA,CAAA,uCAAA,CAAA,yCAAA,CAAA,iBAAA,CAAA,eAAA,CAAA,uEAAA,CAQE,yCAAA,UAAA,CAAA,SAAA,CAAA,qBAAA,CAAA,iCAAA,CAAA,mBAAA,CAAA,iBAAA,CAAA,OAAA,CAUA,8DAAA,uEAAA,CASF,oBAAA,+BAAA,CAQA,mCAAA,0CAAA,CAGE,8DAAA,sDAAA,CASF,6BAAA,0CAAA,CAIA,4BAAA,oCAAA,CAAA,mBAAA,CAWA,6BAAA,iBAAA,CAAA,mBAAA,CAAA,+BAAA,CAAA,kBAAA,CAAA,iBAAA,CAYA,6BAAA,iBAAA,CAAA,UAAA,CAAA,kBAAA,CAAA,mBAAA,CAAA,wBAAA,CAAA,gBAAA,CAAA,yBAAA,CAAA,eAAA,CAAA,cAAA,CAAA,iBAAA,CAAA,eAAA,CAAA,kBAAA,CAAA,iBAAA,CAAA,wBAAA,CAAA,uBAAA,CAjJA,gCACE,wDAAA,kCAAA,CAiEA,6CAAA,sBAAA,CAAA","file":"styles.css","sourcesContent":["@import \"./utils\";\n@import \"./constants\";\n\n/*************************************\n * Suggestions *\n *************************************/\n\n.lb-tiptap-suggestions-list {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n/*************************************\n * Mention suggestions *\n *************************************/\n\n.lb-tiptap-mention-suggestions {\n --lb-tiptap-mention-suggestion-avatar-size: 1.25rem;\n}\n\n.lb-tiptap-mention-suggestion {\n padding: calc(0.375 * var(--lb-spacing)) calc(0.625 * var(--lb-spacing));\n}\n\n.lb-tiptap-mention-suggestion-avatar {\n inline-size: var(--lb-tiptap-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-tiptap-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-tiptap-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-tiptap-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-tiptap-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-tiptap-suggestions:where(:not([data-state=\"closed\"])) {\n animation-name: lb-animation-appear;\n }\n}\n\n/*************************************\n * Mention *\n *************************************/\n\n.lb-tiptap-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\n.lb-mention-selected {\n background: var(--lb-accent);\n color: var(--lb-accent-foreground);\n}\n\n/*************************************\n * Thread mark *\n *************************************/\n\n:where(.lb-tiptap-thread-mark:not([data-orphan=\"true\"])) {\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\n:where(\n .lb-tiptap-thread-mark:not([data-orphan=\"true\"])\n .lb-tiptap-thread-mark-selected\n ) {\n color: var(--lb-accent);\n text-decoration-line: underline;\n text-decoration-color: var(--lb-accent-moderate);\n text-underline-offset: 2px;\n}\n\n/*************************************\n * Anchored threads *\n *************************************/\n\n.lb-tiptap-anchored-threads {\n --lb-tiptap-anchored-threads-gap: 1.25rem;\n --lb-tiptap-anchored-threads-active-thread-offset: -0.75rem;\n}\n\n.lb-tiptap-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-tiptap-anchored-threads-thread-container {\n transition-duration: 0s;\n }\n}\n\n.lb-tiptap-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-tiptap-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-tiptap-anchored-threads-active-shadow;\n }\n}\n\n/*************************************\n * Floating components *\n *************************************/\n\n.lb-tiptap-floating {\n --lb-tiptap-floating-size: 350px;\n}\n\n/*************************************\n * Floating threads *\n *************************************/\n\n.lb-tiptap-floating-threads-thread {\n inline-size: var(--lb-tiptap-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-tiptap-floating-composer {\n inline-size: var(--lb-tiptap-floating-size);\n}\n\n.lb-tiptap-active-selection {\n background: var(--lb-selection, rgb(0 0 255 / 20%));\n pointer-events: none;\n}\n\n/*************************************\n * Collab Cursors *\n *************************************/\n\n/* Give a remote user a caret */\n/* stylelint-disable-next-line selector-class-pattern */\n.collaboration-cursor__caret {\n position: relative;\n margin-inline-start: -1px;\n margin-inline-end: -1px;\n border-inline-start: 1px solid #0d0d0d;\n border-inline-end: 1px solid #0d0d0d;\n word-break: normal;\n pointer-events: none;\n}\n\n/* Render the username above the caret */\n/* stylelint-disable-next-line selector-class-pattern */\n.collaboration-cursor__label {\n position: absolute;\n inset-inline-start: -1px;\n inset-block-start: -1.4em;\n padding: 2px 6px;\n border-radius: 6px;\n border-end-start-radius: 0;\n color: #fff;\n font-weight: 600;\n font-style: normal;\n font-size: 14px;\n line-height: normal;\n white-space: nowrap;\n pointer-events: none;\n user-select: none;\n}\n","@mixin invisible-selection {\n &::selection,\n *::selection {\n background: transparent;\n }\n}\n"]}
package/dist/context.js DELETED
@@ -1,24 +0,0 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var core = require('@liveblocks/core');
5
- var react = require('react');
6
-
7
- const EditorContext = react.createContext(null);
8
- function EditorProvider({
9
- editor,
10
- children
11
- }) {
12
- return /* @__PURE__ */ jsxRuntime.jsx(EditorContext.Provider, {
13
- value: editor,
14
- children
15
- });
16
- }
17
- function useCurrentEditor(source, parent) {
18
- const currentEditor = react.useContext(EditorContext);
19
- return core.nn(currentEditor, `${source} can\u2019t be used outside of ${parent}.`);
20
- }
21
-
22
- exports.EditorProvider = EditorProvider;
23
- exports.useCurrentEditor = useCurrentEditor;
24
- //# sourceMappingURL=context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.js","sources":["../src/context.tsx"],"sourcesContent":["import { nn } from \"@liveblocks/core\";\nimport type { Editor } from \"@tiptap/react\";\nimport type { PropsWithChildren } from \"react\";\nimport { createContext, useContext } from \"react\";\n\nconst EditorContext = createContext<Editor | null>(null);\n\nexport function EditorProvider({\n editor,\n children,\n}: PropsWithChildren<{ editor: Editor }>) {\n return (\n <EditorContext.Provider value={editor}>{children}</EditorContext.Provider>\n );\n}\n\n/**\n * @tiptap/react already offers a `useCurrentEditor` hook but our components might\n * not live under `EditorProvider` or `EditorContent` so we create our own to reduce\n * repetition within our own nested components.\n *\n * @example\n * <Toolbar editor={editor}> // `editor` is required here\n * <ToolbarSectionInline /> // But it isn't there, because `Toolbar` uses our own `EditorProvider`\n * </Toolbar>\n */\nexport function useCurrentEditor(source: string, parent: string) {\n const currentEditor = useContext(EditorContext);\n\n return nn(currentEditor, `${source} can’t be used outside of ${parent}.`);\n}\n"],"names":["createContext","jsx","useContext","nn"],"mappings":";;;;;;AAKA,MAAM,aAAA,GAAgBA,oBAA6B,IAAI,CAAA,CAAA;AAEhD,SAAS,cAAe,CAAA;AAAA,EAC7B,MAAA;AAAA,EACA,QAAA;AACF,CAA0C,EAAA;AACxC,EACE,uBAAAC,cAAA,CAAC,cAAc,QAAd,EAAA;AAAA,IAAuB,KAAO,EAAA,MAAA;AAAA,IAAS,QAAA;AAAA,GAAS,CAAA,CAAA;AAErD,CAAA;AAYgB,SAAA,gBAAA,CAAiB,QAAgB,MAAgB,EAAA;AAC/D,EAAM,MAAA,aAAA,GAAgBC,iBAAW,aAAa,CAAA,CAAA;AAE9C,EAAA,OAAOC,OAAG,CAAA,aAAA,EAAe,CAAG,EAAA,MAAA,CAAA,+BAAA,EAAmC,MAAS,CAAA,CAAA,CAAA,CAAA,CAAA;AAC1E;;;;;"}
package/dist/context.mjs DELETED
@@ -1,21 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { nn } from '@liveblocks/core';
3
- import { createContext, useContext } from 'react';
4
-
5
- const EditorContext = createContext(null);
6
- function EditorProvider({
7
- editor,
8
- children
9
- }) {
10
- return /* @__PURE__ */ jsx(EditorContext.Provider, {
11
- value: editor,
12
- children
13
- });
14
- }
15
- function useCurrentEditor(source, parent) {
16
- const currentEditor = useContext(EditorContext);
17
- return nn(currentEditor, `${source} can\u2019t be used outside of ${parent}.`);
18
- }
19
-
20
- export { EditorProvider, useCurrentEditor };
21
- //# sourceMappingURL=context.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.mjs","sources":["../src/context.tsx"],"sourcesContent":["import { nn } from \"@liveblocks/core\";\nimport type { Editor } from \"@tiptap/react\";\nimport type { PropsWithChildren } from \"react\";\nimport { createContext, useContext } from \"react\";\n\nconst EditorContext = createContext<Editor | null>(null);\n\nexport function EditorProvider({\n editor,\n children,\n}: PropsWithChildren<{ editor: Editor }>) {\n return (\n <EditorContext.Provider value={editor}>{children}</EditorContext.Provider>\n );\n}\n\n/**\n * @tiptap/react already offers a `useCurrentEditor` hook but our components might\n * not live under `EditorProvider` or `EditorContent` so we create our own to reduce\n * repetition within our own nested components.\n *\n * @example\n * <Toolbar editor={editor}> // `editor` is required here\n * <ToolbarSectionInline /> // But it isn't there, because `Toolbar` uses our own `EditorProvider`\n * </Toolbar>\n */\nexport function useCurrentEditor(source: string, parent: string) {\n const currentEditor = useContext(EditorContext);\n\n return nn(currentEditor, `${source} can’t be used outside of ${parent}.`);\n}\n"],"names":[],"mappings":";;;;AAKA,MAAM,aAAA,GAAgB,cAA6B,IAAI,CAAA,CAAA;AAEhD,SAAS,cAAe,CAAA;AAAA,EAC7B,MAAA;AAAA,EACA,QAAA;AACF,CAA0C,EAAA;AACxC,EACE,uBAAA,GAAA,CAAC,cAAc,QAAd,EAAA;AAAA,IAAuB,KAAO,EAAA,MAAA;AAAA,IAAS,QAAA;AAAA,GAAS,CAAA,CAAA;AAErD,CAAA;AAYgB,SAAA,gBAAA,CAAiB,QAAgB,MAAgB,EAAA;AAC/D,EAAM,MAAA,aAAA,GAAgB,WAAW,aAAa,CAAA,CAAA;AAE9C,EAAA,OAAO,EAAG,CAAA,aAAA,EAAe,CAAG,EAAA,MAAA,CAAA,+BAAA,EAAmC,MAAS,CAAA,CAAA,CAAA,CAAA,CAAA;AAC1E;;;;"}
@@ -1,321 +0,0 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var reactDom = require('@floating-ui/react-dom');
5
- var _private$1 = require('@liveblocks/react/_private');
6
- var _private = require('@liveblocks/react-ui/_private');
7
- var react$1 = require('@tiptap/react');
8
- var react = require('react');
9
- var reactDom$1 = require('react-dom');
10
- var classnames = require('../classnames.js');
11
- var context = require('../context.js');
12
- var shared = require('./shared.js');
13
- var Toolbar = require('./Toolbar.js');
14
-
15
- const FLOATING_TOOLBAR_COLLISION_PADDING = 10;
16
- const FLOATING_TOOLBAR_OPEN_DELAY = 50;
17
- function DefaultFloatingToolbarContent({ editor }) {
18
- const supportsThread = "addPendingComment" in editor.commands;
19
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
20
- children: [
21
- /* @__PURE__ */ jsxRuntime.jsx(Toolbar.Toolbar.BlockSelector, {}),
22
- /* @__PURE__ */ jsxRuntime.jsx(Toolbar.Toolbar.SectionInline, {}),
23
- supportsThread ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
24
- children: [
25
- /* @__PURE__ */ jsxRuntime.jsx(Toolbar.Toolbar.Separator, {}),
26
- /* @__PURE__ */ jsxRuntime.jsx(Toolbar.Toolbar.SectionCollaboration, {})
27
- ]
28
- }) : null
29
- ]
30
- });
31
- }
32
- const FloatingToolbar = Object.assign(
33
- react.forwardRef(
34
- ({
35
- children = DefaultFloatingToolbarContent,
36
- before,
37
- after,
38
- position = "top",
39
- offset: sideOffset = 6,
40
- editor,
41
- onPointerDown,
42
- onFocus,
43
- onBlur,
44
- className,
45
- ...props
46
- }, forwardedRef) => {
47
- const toolbarRef = react.useRef(null);
48
- const externalIds = _private.useInitial(() => /* @__PURE__ */ new Set());
49
- const [isPointerDown, setPointerDown] = react.useState(false);
50
- const [isFocused, setFocused] = react.useState(false);
51
- const [isManuallyClosed, setManuallyClosed] = react.useState(false);
52
- const hasSelectionRange = react$1.useEditorState({
53
- editor,
54
- equalityFn: Object.is,
55
- selector: (ctx) => {
56
- const editor2 = ctx.editor;
57
- if (!editor2) {
58
- return false;
59
- }
60
- const { doc, selection } = editor2.state;
61
- const { empty, ranges } = selection;
62
- const from = Math.min(...ranges.map((range) => range.$from.pos));
63
- const to = Math.max(...ranges.map((range) => range.$to.pos));
64
- if (empty) {
65
- return false;
66
- }
67
- return react$1.isTextSelection(selection) && doc.textBetween(from, to).length > 0;
68
- }
69
- }) ?? false;
70
- const isOpen = isFocused && !isPointerDown && hasSelectionRange && !isManuallyClosed;
71
- const [delayedIsOpen, setDelayedIsOpen] = react.useState(isOpen);
72
- const delayedIsOpenTimeoutRef = react.useRef();
73
- react.useEffect(() => {
74
- if (!editor) {
75
- return;
76
- }
77
- setManuallyClosed(false);
78
- const handleSelectionChange = () => {
79
- setManuallyClosed(false);
80
- };
81
- editor.on("selectionUpdate", handleSelectionChange);
82
- return () => {
83
- editor.off("selectionUpdate", handleSelectionChange);
84
- };
85
- }, [isFocused, hasSelectionRange, editor]);
86
- react.useEffect(() => {
87
- if (!editor) {
88
- return;
89
- }
90
- const handleFocus2 = () => {
91
- setFocused(true);
92
- };
93
- const handleBlur2 = (event) => {
94
- if (event.relatedTarget && toolbarRef.current?.contains(event.relatedTarget)) {
95
- return;
96
- }
97
- if (event.relatedTarget === editor.view.dom) {
98
- return;
99
- }
100
- for (const externalId of externalIds) {
101
- if (document.getElementById(externalId)?.contains(event.relatedTarget)) {
102
- return;
103
- }
104
- }
105
- setFocused(false);
106
- };
107
- editor.view.dom.addEventListener("focus", handleFocus2);
108
- editor.view.dom.addEventListener("blur", handleBlur2);
109
- return () => {
110
- editor.view.dom.removeEventListener("focus", handleFocus2);
111
- editor.view.dom.removeEventListener("blur", handleBlur2);
112
- };
113
- }, [editor, externalIds]);
114
- const handleFocus = react.useCallback(
115
- (event) => {
116
- onFocus?.(event);
117
- if (!event.isDefaultPrevented()) {
118
- setFocused(true);
119
- }
120
- },
121
- [onFocus]
122
- );
123
- const handleBlur = react.useCallback(
124
- (event) => {
125
- onBlur?.(event);
126
- if (!event.isDefaultPrevented()) {
127
- if (event.relatedTarget && toolbarRef.current?.contains(event.relatedTarget)) {
128
- return;
129
- }
130
- if (event.relatedTarget === editor?.view.dom) {
131
- return;
132
- }
133
- for (const externalId of externalIds) {
134
- if (document.getElementById(externalId)?.contains(event.relatedTarget)) {
135
- return;
136
- }
137
- }
138
- setFocused(false);
139
- }
140
- },
141
- [onBlur, editor, externalIds]
142
- );
143
- react.useEffect(() => {
144
- if (isOpen) {
145
- delayedIsOpenTimeoutRef.current = window.setTimeout(() => {
146
- setDelayedIsOpen(true);
147
- }, FLOATING_TOOLBAR_OPEN_DELAY);
148
- } else {
149
- setDelayedIsOpen(false);
150
- }
151
- return () => {
152
- window.clearTimeout(delayedIsOpenTimeoutRef.current);
153
- };
154
- }, [isOpen]);
155
- const floatingOptions = react.useMemo(() => {
156
- const detectOverflowOptions = {
157
- padding: FLOATING_TOOLBAR_COLLISION_PADDING
158
- };
159
- return {
160
- strategy: "fixed",
161
- placement: position,
162
- middleware: [
163
- reactDom.inline(detectOverflowOptions),
164
- reactDom.flip({ ...detectOverflowOptions, crossAxis: false }),
165
- reactDom.hide(detectOverflowOptions),
166
- reactDom.shift({
167
- ...detectOverflowOptions,
168
- limiter: reactDom.limitShift()
169
- }),
170
- reactDom.offset(sideOffset),
171
- reactDom.size(detectOverflowOptions)
172
- ],
173
- whileElementsMounted: (...args) => {
174
- return reactDom.autoUpdate(...args, {
175
- animationFrame: true
176
- });
177
- }
178
- };
179
- }, [position, sideOffset]);
180
- const {
181
- refs: { setReference, setFloating },
182
- strategy,
183
- x,
184
- y,
185
- isPositioned
186
- } = reactDom.useFloating({
187
- ...floatingOptions,
188
- open: delayedIsOpen
189
- });
190
- const mergedRefs = _private.useRefs(forwardedRef, toolbarRef, setFloating);
191
- const handlePointerDown = react.useCallback(
192
- (event) => {
193
- onPointerDown?.(event);
194
- event.stopPropagation();
195
- if (event.target === toolbarRef.current) {
196
- event.preventDefault();
197
- }
198
- },
199
- [onPointerDown]
200
- );
201
- react.useEffect(() => {
202
- if (!editor) {
203
- return;
204
- }
205
- const handlePointerDown2 = () => {
206
- setPointerDown(true);
207
- };
208
- const handlePointerUp = () => {
209
- setPointerDown(false);
210
- };
211
- editor.view.dom.addEventListener("pointerdown", handlePointerDown2);
212
- document.addEventListener("pointercancel", handlePointerUp);
213
- document.addEventListener("pointerup", handlePointerUp);
214
- return () => {
215
- editor.view.dom.removeEventListener("pointerdown", handlePointerDown2);
216
- document.removeEventListener("pointercancel", handlePointerUp);
217
- document.removeEventListener("pointerup", handlePointerUp);
218
- };
219
- }, [editor]);
220
- _private$1.useLayoutEffect(() => {
221
- if (!editor || !delayedIsOpen) {
222
- return;
223
- }
224
- const updateSelectionReference = () => {
225
- const domSelection = window.getSelection();
226
- if (editor.state.selection.empty || !domSelection || !domSelection.rangeCount) {
227
- setReference(null);
228
- } else {
229
- const domRange = domSelection.getRangeAt(0);
230
- setReference(domRange);
231
- }
232
- };
233
- editor.on("transaction", updateSelectionReference);
234
- updateSelectionReference();
235
- return () => {
236
- editor.off("transaction", updateSelectionReference);
237
- };
238
- }, [editor, delayedIsOpen, setReference]);
239
- react.useEffect(() => {
240
- if (!editor || !delayedIsOpen) {
241
- return;
242
- }
243
- const handleKeyDown = (event) => {
244
- if (event.target !== editor.view.dom && event.defaultPrevented) {
245
- return;
246
- }
247
- if (event.key === "Escape") {
248
- event.preventDefault();
249
- event.stopPropagation();
250
- editor.commands.focus();
251
- setManuallyClosed(true);
252
- }
253
- };
254
- editor.view.dom.addEventListener("keydown", handleKeyDown);
255
- return () => {
256
- editor.view.dom.removeEventListener("keydown", handleKeyDown);
257
- };
258
- }, [editor, delayedIsOpen]);
259
- const close = react.useCallback(() => {
260
- setManuallyClosed(true);
261
- }, [setManuallyClosed]);
262
- const registerExternal = react.useCallback(
263
- (id) => {
264
- externalIds.add(id);
265
- return () => {
266
- externalIds.delete(id);
267
- };
268
- },
269
- [externalIds]
270
- );
271
- if (!editor || !delayedIsOpen) {
272
- return null;
273
- }
274
- const slotProps = { editor };
275
- return reactDom$1.createPortal(
276
- /* @__PURE__ */ jsxRuntime.jsx(_private.TooltipProvider, {
277
- children: /* @__PURE__ */ jsxRuntime.jsx(context.EditorProvider, {
278
- editor,
279
- children: /* @__PURE__ */ jsxRuntime.jsx(shared.FloatingToolbarContext.Provider, {
280
- value: { close, registerExternal },
281
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
282
- role: "toolbar",
283
- "aria-label": "Floating toolbar",
284
- "aria-orientation": "horizontal",
285
- className: classnames.classNames(
286
- "lb-root lb-portal lb-elevation lb-tiptap-floating-toolbar lb-tiptap-toolbar",
287
- className
288
- ),
289
- ref: mergedRefs,
290
- style: {
291
- position: strategy,
292
- top: 0,
293
- left: 0,
294
- transform: isPositioned ? `translate3d(${Math.round(x)}px, ${Math.round(y)}px, 0)` : "translate3d(0, -200%, 0)",
295
- minWidth: "max-content"
296
- },
297
- onPointerDown: handlePointerDown,
298
- onFocus: handleFocus,
299
- onBlur: handleBlur,
300
- ...props,
301
- children: [
302
- Toolbar.applyToolbarSlot(before, slotProps),
303
- Toolbar.applyToolbarSlot(children, slotProps),
304
- Toolbar.applyToolbarSlot(after, slotProps)
305
- ]
306
- })
307
- })
308
- })
309
- }),
310
- document.body
311
- );
312
- }
313
- ),
314
- {
315
- External: shared.FloatingToolbarExternal
316
- }
317
- );
318
-
319
- exports.FLOATING_TOOLBAR_COLLISION_PADDING = FLOATING_TOOLBAR_COLLISION_PADDING;
320
- exports.FloatingToolbar = FloatingToolbar;
321
- //# sourceMappingURL=FloatingToolbar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FloatingToolbar.js","sources":["../../src/toolbar/FloatingToolbar.tsx"],"sourcesContent":["import {\n autoUpdate,\n type DetectOverflowOptions,\n flip,\n hide,\n inline,\n limitShift,\n offset,\n shift,\n size,\n useFloating,\n type UseFloatingOptions,\n} from \"@floating-ui/react-dom\";\nimport { useLayoutEffect } from \"@liveblocks/react/_private\";\nimport {\n TooltipProvider,\n useInitial,\n useRefs,\n} from \"@liveblocks/react-ui/_private\";\nimport { type Editor, isTextSelection, useEditorState } from \"@tiptap/react\";\nimport type {\n ComponentProps,\n FocusEvent as ReactFocusEvent,\n PointerEvent as ReactPointerEvent,\n} from \"react\";\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { classNames } from \"../classnames\";\nimport { EditorProvider } from \"../context\";\nimport type { FloatingPosition } from \"../types\";\nimport { FloatingToolbarContext, FloatingToolbarExternal } from \"./shared\";\nimport {\n applyToolbarSlot,\n Toolbar,\n type ToolbarSlot,\n type ToolbarSlotProps,\n} from \"./Toolbar\";\n\nexport interface FloatingToolbarProps\n extends Omit<ComponentProps<\"div\">, \"children\"> {\n /**\n * The Tiptap editor.\n */\n editor: Editor | null;\n\n /**\n * The vertical position of the floating toolbar.\n */\n position?: FloatingPosition;\n\n /**\n * The vertical offset of the floating toolbar from the selection.\n */\n offset?: number;\n\n /**\n * The content of the floating toolbar, overriding the default content.\n * Use the `before` and `after` props if you want to keep and extend the default content.\n */\n children?: ToolbarSlot;\n\n /**\n * The content to display at the start of the floating toolbar.\n */\n before?: ToolbarSlot;\n\n /**\n * The content to display at the end of the floating toolbar.\n */\n after?: ToolbarSlot;\n}\n\nexport const FLOATING_TOOLBAR_COLLISION_PADDING = 10;\nconst FLOATING_TOOLBAR_OPEN_DELAY = 50;\n\nfunction DefaultFloatingToolbarContent({ editor }: ToolbarSlotProps) {\n const supportsThread = \"addPendingComment\" in editor.commands;\n\n return (\n <>\n <Toolbar.BlockSelector />\n <Toolbar.SectionInline />\n {supportsThread ? (\n <>\n <Toolbar.Separator />\n <Toolbar.SectionCollaboration />\n </>\n ) : null}\n </>\n );\n}\n\n/**\n * A floating toolbar attached to the selection and containing actions and values related to the editor.\n *\n * @example\n * <FloatingToolbar editor={editor} />\n *\n * @example\n * <FloatingToolbar editor={editor}>\n * <Toolbar.BlockSelector />\n * <Toolbar.Separator />\n * <Toolbar.SectionInline />\n * <Toolbar.Separator />\n * <Toolbar.Button name=\"Custom action\" onClick={() => { ... }} icon={<Icon.QuestionMark />} />\n * </FloatingToolbar>\n */\nexport const FloatingToolbar = Object.assign(\n forwardRef<HTMLDivElement, FloatingToolbarProps>(\n (\n {\n children = DefaultFloatingToolbarContent,\n before,\n after,\n position = \"top\",\n offset: sideOffset = 6,\n editor,\n onPointerDown,\n onFocus,\n onBlur,\n className,\n ...props\n },\n forwardedRef\n ) => {\n const toolbarRef = useRef<HTMLDivElement>(null);\n const externalIds = useInitial<Set<string>>(() => new Set());\n const [isPointerDown, setPointerDown] = useState(false);\n const [isFocused, setFocused] = useState(false);\n const [isManuallyClosed, setManuallyClosed] = useState(false);\n const hasSelectionRange =\n useEditorState({\n editor,\n equalityFn: Object.is,\n selector: (ctx) => {\n const editor = ctx.editor;\n\n if (!editor) {\n return false;\n }\n\n const { doc, selection } = editor.state;\n const { empty, ranges } = selection;\n const from = Math.min(...ranges.map((range) => range.$from.pos));\n const to = Math.max(...ranges.map((range) => range.$to.pos));\n\n if (empty) {\n return false;\n }\n\n return (\n isTextSelection(selection) && doc.textBetween(from, to).length > 0\n );\n },\n }) ?? false;\n\n const isOpen =\n isFocused && !isPointerDown && hasSelectionRange && !isManuallyClosed;\n const [delayedIsOpen, setDelayedIsOpen] = useState(isOpen);\n const delayedIsOpenTimeoutRef = useRef<number>();\n\n // Reset the manually closed state when there's another change\n useEffect(() => {\n if (!editor) {\n return;\n }\n\n setManuallyClosed(false);\n\n const handleSelectionChange = () => {\n setManuallyClosed(false);\n };\n\n editor.on(\"selectionUpdate\", handleSelectionChange);\n\n return () => {\n editor.off(\"selectionUpdate\", handleSelectionChange);\n };\n }, [isFocused, hasSelectionRange, editor]);\n\n // Don't close when the focus moves from the editor to the toolbar\n useEffect(() => {\n if (!editor) {\n return;\n }\n\n const handleFocus = () => {\n setFocused(true);\n };\n\n const handleBlur = (event: FocusEvent) => {\n if (\n event.relatedTarget &&\n toolbarRef.current?.contains(event.relatedTarget as Node)\n ) {\n return;\n }\n\n if (event.relatedTarget === editor.view.dom) {\n return;\n }\n\n for (const externalId of externalIds) {\n if (\n document\n .getElementById(externalId)\n ?.contains(event.relatedTarget as Node)\n ) {\n return;\n }\n }\n\n setFocused(false);\n };\n\n editor.view.dom.addEventListener(\"focus\", handleFocus);\n editor.view.dom.addEventListener(\"blur\", handleBlur);\n\n return () => {\n editor.view.dom.removeEventListener(\"focus\", handleFocus);\n editor.view.dom.removeEventListener(\"blur\", handleBlur);\n };\n }, [editor, externalIds]);\n\n const handleFocus = useCallback(\n (event: ReactFocusEvent<HTMLDivElement>) => {\n onFocus?.(event);\n\n if (!event.isDefaultPrevented()) {\n setFocused(true);\n }\n },\n [onFocus]\n );\n\n // Close the toolbar when the it loses focus to something else than the editor\n const handleBlur = useCallback(\n (event: ReactFocusEvent<HTMLDivElement>) => {\n onBlur?.(event);\n\n if (!event.isDefaultPrevented()) {\n if (\n event.relatedTarget &&\n toolbarRef.current?.contains(event.relatedTarget as Node)\n ) {\n return;\n }\n\n if (event.relatedTarget === editor?.view.dom) {\n return;\n }\n\n for (const externalId of externalIds) {\n if (\n document\n .getElementById(externalId)\n ?.contains(event.relatedTarget as Node)\n ) {\n return;\n }\n }\n\n setFocused(false);\n }\n },\n [onBlur, editor, externalIds]\n );\n\n // Delay the opening of the toolbar to avoid flickering issues\n useEffect(() => {\n if (isOpen) {\n delayedIsOpenTimeoutRef.current = window.setTimeout(() => {\n setDelayedIsOpen(true);\n }, FLOATING_TOOLBAR_OPEN_DELAY);\n } else {\n setDelayedIsOpen(false);\n }\n\n return () => {\n window.clearTimeout(delayedIsOpenTimeoutRef.current);\n };\n }, [isOpen]);\n\n const floatingOptions: UseFloatingOptions = useMemo(() => {\n const detectOverflowOptions: DetectOverflowOptions = {\n padding: FLOATING_TOOLBAR_COLLISION_PADDING,\n };\n\n return {\n strategy: \"fixed\",\n placement: position,\n middleware: [\n inline(detectOverflowOptions),\n flip({ ...detectOverflowOptions, crossAxis: false }),\n hide(detectOverflowOptions),\n shift({\n ...detectOverflowOptions,\n limiter: limitShift(),\n }),\n offset(sideOffset),\n size(detectOverflowOptions),\n ],\n whileElementsMounted: (...args) => {\n return autoUpdate(...args, {\n animationFrame: true,\n });\n },\n };\n }, [position, sideOffset]);\n const {\n refs: { setReference, setFloating },\n strategy,\n x,\n y,\n isPositioned,\n } = useFloating({\n ...floatingOptions,\n open: delayedIsOpen,\n });\n const mergedRefs = useRefs(forwardedRef, toolbarRef, setFloating);\n\n const handlePointerDown = useCallback(\n (event: ReactPointerEvent<HTMLDivElement>) => {\n onPointerDown?.(event);\n\n event.stopPropagation();\n\n // Prevent the toolbar from closing when clicking on the toolbar itself\n if (event.target === toolbarRef.current) {\n event.preventDefault();\n }\n },\n [onPointerDown]\n );\n\n useEffect(() => {\n if (!editor) {\n return;\n }\n\n const handlePointerDown = () => {\n setPointerDown(true);\n };\n const handlePointerUp = () => {\n setPointerDown(false);\n };\n\n editor.view.dom.addEventListener(\"pointerdown\", handlePointerDown);\n document.addEventListener(\"pointercancel\", handlePointerUp);\n document.addEventListener(\"pointerup\", handlePointerUp);\n\n return () => {\n editor.view.dom.removeEventListener(\"pointerdown\", handlePointerDown);\n document.removeEventListener(\"pointercancel\", handlePointerUp);\n document.removeEventListener(\"pointerup\", handlePointerUp);\n };\n }, [editor]);\n\n useLayoutEffect(() => {\n if (!editor || !delayedIsOpen) {\n return;\n }\n\n const updateSelectionReference = () => {\n const domSelection = window.getSelection();\n\n if (\n editor.state.selection.empty ||\n !domSelection ||\n !domSelection.rangeCount\n ) {\n setReference(null);\n } else {\n const domRange = domSelection.getRangeAt(0);\n\n setReference(domRange);\n }\n };\n\n editor.on(\"transaction\", updateSelectionReference);\n updateSelectionReference();\n\n return () => {\n editor.off(\"transaction\", updateSelectionReference);\n };\n }, [editor, delayedIsOpen, setReference]);\n\n useEffect(() => {\n if (!editor || !delayedIsOpen) {\n return;\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.target !== editor.view.dom && event.defaultPrevented) {\n return;\n }\n\n if (event.key === \"Escape\") {\n event.preventDefault();\n event.stopPropagation();\n\n editor.commands.focus();\n setManuallyClosed(true);\n }\n };\n\n editor.view.dom.addEventListener(\"keydown\", handleKeyDown);\n\n return () => {\n editor.view.dom.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [editor, delayedIsOpen]);\n\n const close = useCallback(() => {\n setManuallyClosed(true);\n }, [setManuallyClosed]);\n\n const registerExternal = useCallback(\n (id: string) => {\n externalIds.add(id);\n\n return () => {\n externalIds.delete(id);\n };\n },\n [externalIds]\n );\n\n if (!editor || !delayedIsOpen) {\n return null;\n }\n\n const slotProps: ToolbarSlotProps = { editor };\n\n return createPortal(\n <TooltipProvider>\n <EditorProvider editor={editor}>\n <FloatingToolbarContext.Provider\n value={{ close, registerExternal }}\n >\n <div\n role=\"toolbar\"\n aria-label=\"Floating toolbar\"\n aria-orientation=\"horizontal\"\n className={classNames(\n \"lb-root lb-portal lb-elevation lb-tiptap-floating-toolbar lb-tiptap-toolbar\",\n className\n )}\n ref={mergedRefs}\n style={{\n position: strategy,\n top: 0,\n left: 0,\n transform: isPositioned\n ? `translate3d(${Math.round(x)}px, ${Math.round(y)}px, 0)`\n : \"translate3d(0, -200%, 0)\",\n minWidth: \"max-content\",\n }}\n onPointerDown={handlePointerDown}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...props}\n >\n {applyToolbarSlot(before, slotProps)}\n {applyToolbarSlot(children, slotProps)}\n {applyToolbarSlot(after, slotProps)}\n </div>\n </FloatingToolbarContext.Provider>\n </EditorProvider>\n </TooltipProvider>,\n document.body\n );\n }\n ),\n {\n /**\n * A component that can be wrapped around elements which are rendered outside of the floating\n * toolbar (e.g. portals) to prevent the toolbar from closing when clicking/focusing within them.\n *\n * @example\n * <FloatingToolbar editor={editor}>\n * <Popover.Root>\n * <Popover.Trigger asChild>\n * <Toolbar.Button>Open popover</Toolbar.Button>\n * </Popover.Trigger>\n * <Popover.Portal>\n * <FloatingToolbar.External>\n * <Popover.Content>\n * This popover is rendered outside of the floating toolbar, but the toolbar will not close when clicking/focusing within it.\n * </Popover.Content>\n * </FloatingToolbar.External>\n * </Popover.Portal>\n * </Popover.Root>\n * </FloatingToolbar>\n */\n External: FloatingToolbarExternal,\n }\n);\n"],"names":["jsxs","Fragment","jsx","Toolbar","forwardRef","useRef","useInitial","useState","useEditorState","editor","isTextSelection","useEffect","handleFocus","handleBlur","useCallback","useMemo","inline","flip","hide","shift","limitShift","offset","size","autoUpdate","useFloating","useRefs","handlePointerDown","useLayoutEffect","createPortal","TooltipProvider","EditorProvider","FloatingToolbarContext","classNames","applyToolbarSlot","FloatingToolbarExternal"],"mappings":";;;;;;;;;;;;;;AAgFO,MAAM,kCAAqC,GAAA,GAAA;AAClD,MAAM,2BAA8B,GAAA,EAAA,CAAA;AAEpC,SAAS,6BAAA,CAA8B,EAAE,MAAA,EAA4B,EAAA;AACnE,EAAM,MAAA,cAAA,GAAiB,uBAAuB,MAAO,CAAA,QAAA,CAAA;AAErD,EACE,uBAAAA,eAAA,CAAAC,mBAAA,EAAA;AAAA,IACE,QAAA,EAAA;AAAA,sBAACC,cAAA,CAAAC,eAAA,CAAQ,eAAR,EAAsB,CAAA;AAAA,sBACvBD,cAAA,CAACC,eAAQ,CAAA,aAAA,EAAR,EAAsB,CAAA;AAAA,MACtB,cACC,mBAAAH,eAAA,CAAAC,mBAAA,EAAA;AAAA,QACE,QAAA,EAAA;AAAA,0BAACC,cAAA,CAAAC,eAA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