@liveblocks/react-ui 2.15.1 → 2.16.0-toolbars1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_private/index.d.mts +56 -5
- package/dist/_private/index.d.ts +56 -5
- package/dist/_private/index.js +46 -0
- package/dist/_private/index.js.map +1 -1
- package/dist/_private/index.mjs +21 -0
- package/dist/_private/index.mjs.map +1 -1
- package/dist/components/Comment.js +13 -33
- package/dist/components/Comment.js.map +1 -1
- package/dist/components/Comment.mjs +15 -35
- package/dist/components/Comment.mjs.map +1 -1
- package/dist/components/Composer.js +26 -66
- package/dist/components/Composer.js.map +1 -1
- package/dist/components/Composer.mjs +28 -68
- package/dist/components/Composer.mjs.map +1 -1
- package/dist/components/InboxNotification.js +7 -17
- package/dist/components/InboxNotification.js.map +1 -1
- package/dist/components/InboxNotification.mjs +7 -17
- package/dist/components/InboxNotification.mjs.map +1 -1
- package/dist/components/Thread.js +1 -5
- package/dist/components/Thread.js.map +1 -1
- package/dist/components/Thread.mjs +1 -5
- package/dist/components/Thread.mjs.map +1 -1
- package/dist/components/internal/Button.js +23 -2
- package/dist/components/internal/Button.js.map +1 -1
- package/dist/components/internal/Button.mjs +24 -4
- package/dist/components/internal/Button.mjs.map +1 -1
- package/dist/components/internal/Dropdown.js +19 -8
- package/dist/components/internal/Dropdown.js.map +1 -1
- package/dist/components/internal/Dropdown.mjs +19 -8
- package/dist/components/internal/Dropdown.mjs.map +1 -1
- package/dist/components/internal/EmojiPicker.js +1 -3
- package/dist/components/internal/EmojiPicker.js.map +1 -1
- package/dist/components/internal/EmojiPicker.mjs +1 -3
- package/dist/components/internal/EmojiPicker.mjs.map +1 -1
- package/dist/components/internal/Tooltip.js +41 -15
- package/dist/components/internal/Tooltip.js.map +1 -1
- package/dist/components/internal/Tooltip.mjs +43 -16
- package/dist/components/internal/Tooltip.mjs.map +1 -1
- package/dist/icons/ChevronDown.js +16 -0
- package/dist/icons/ChevronDown.js.map +1 -0
- package/dist/icons/ChevronDown.mjs +14 -0
- package/dist/icons/ChevronDown.mjs.map +1 -0
- package/dist/icons/ChevronLeft.js +16 -0
- package/dist/icons/ChevronLeft.js.map +1 -0
- package/dist/icons/ChevronLeft.mjs +14 -0
- package/dist/icons/ChevronLeft.mjs.map +1 -0
- package/dist/icons/ChevronRight.js +16 -0
- package/dist/icons/ChevronRight.js.map +1 -0
- package/dist/icons/ChevronRight.mjs +14 -0
- package/dist/icons/ChevronRight.mjs.map +1 -0
- package/dist/icons/ChevronUp.js +16 -0
- package/dist/icons/ChevronUp.js.map +1 -0
- package/dist/icons/ChevronUp.mjs +14 -0
- package/dist/icons/ChevronUp.mjs.map +1 -0
- package/dist/icons/Comment.js +16 -0
- package/dist/icons/Comment.js.map +1 -0
- package/dist/icons/Comment.mjs +14 -0
- package/dist/icons/Comment.mjs.map +1 -0
- package/dist/icons/Lengthen.js +16 -0
- package/dist/icons/Lengthen.js.map +1 -0
- package/dist/icons/Lengthen.mjs +14 -0
- package/dist/icons/Lengthen.mjs.map +1 -0
- package/dist/icons/QuestionMark.js +26 -0
- package/dist/icons/QuestionMark.js.map +1 -0
- package/dist/icons/QuestionMark.mjs +24 -0
- package/dist/icons/QuestionMark.mjs.map +1 -0
- package/dist/icons/Redo.js +21 -0
- package/dist/icons/Redo.js.map +1 -0
- package/dist/icons/Redo.mjs +19 -0
- package/dist/icons/Redo.mjs.map +1 -0
- package/dist/icons/Shorten.js +16 -0
- package/dist/icons/Shorten.js.map +1 -0
- package/dist/icons/Shorten.mjs +14 -0
- package/dist/icons/Shorten.mjs.map +1 -0
- package/dist/icons/Sparkles.js +16 -0
- package/dist/icons/Sparkles.js.map +1 -0
- package/dist/icons/Sparkles.mjs +14 -0
- package/dist/icons/Sparkles.mjs.map +1 -0
- package/dist/icons/Translate.js +21 -0
- package/dist/icons/Translate.js.map +1 -0
- package/dist/icons/Translate.mjs +19 -0
- package/dist/icons/Translate.mjs.map +1 -0
- package/dist/icons/Underline.js +16 -0
- package/dist/icons/Underline.js.map +1 -0
- package/dist/icons/Underline.mjs +14 -0
- package/dist/icons/Underline.mjs.map +1 -0
- package/dist/icons/Undo.js +21 -0
- package/dist/icons/Undo.js.map +1 -0
- package/dist/icons/Undo.mjs +19 -0
- package/dist/icons/Undo.mjs.map +1 -0
- package/dist/icons/index.js +34 -0
- package/dist/icons/index.js.map +1 -1
- package/dist/icons/index.mjs +17 -0
- package/dist/icons/index.mjs.map +1 -1
- package/dist/index.d.mts +25 -25
- package/dist/index.d.ts +25 -25
- package/dist/primitives/Composer/index.js +4 -5
- package/dist/primitives/Composer/index.js.map +1 -1
- package/dist/primitives/Composer/index.mjs +2 -3
- package/dist/primitives/Composer/index.mjs.map +1 -1
- package/dist/primitives/Composer/utils.js +2 -1
- package/dist/primitives/Composer/utils.js.map +1 -1
- package/dist/primitives/Composer/utils.mjs +2 -1
- package/dist/primitives/Composer/utils.mjs.map +1 -1
- package/dist/primitives/EmojiPicker/index.js +2 -1
- package/dist/primitives/EmojiPicker/index.js.map +1 -1
- package/dist/primitives/EmojiPicker/index.mjs +2 -1
- package/dist/primitives/EmojiPicker/index.mjs.map +1 -1
- package/dist/primitives/index.d.mts +23 -23
- package/dist/primitives/index.d.ts +23 -23
- package/dist/utils/Persist.js +6 -5
- package/dist/utils/Persist.js.map +1 -1
- package/dist/utils/Persist.mjs +3 -2
- package/dist/utils/Persist.mjs.map +1 -1
- package/dist/utils/Portal.js +2 -2
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/package.json +6 -6
- package/src/styles/index.css +142 -35
- package/styles.css +1 -1
- package/styles.css.map +1 -1
- package/dist/utils/flush-sync.js +0 -12
- package/dist/utils/flush-sync.js.map +0 -1
- package/dist/utils/flush-sync.mjs +0 -10
- package/dist/utils/flush-sync.mjs.map +0 -1
|
@@ -3,34 +3,34 @@ import { ElementType, ComponentPropsWithoutRef, ReactNode, ComponentType, FormEv
|
|
|
3
3
|
import { CommentBody as CommentBody$1, CommentAttachment, CommentMixedAttachment } from '@liveblocks/core';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
type Direction = "ltr" | "rtl";
|
|
7
|
+
type SlotProp = {
|
|
8
8
|
/**
|
|
9
9
|
* Replace the rendered element by the one passed as a child.
|
|
10
10
|
*/
|
|
11
11
|
asChild?: boolean;
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
type ComponentPropsWithSlot<TElement extends ElementType<any>> = ComponentPropsWithoutRef<TElement> & SlotProp;
|
|
14
|
+
type ComposerBodyText = {
|
|
15
15
|
bold?: boolean;
|
|
16
16
|
italic?: boolean;
|
|
17
17
|
strikethrough?: boolean;
|
|
18
18
|
code?: boolean;
|
|
19
19
|
text: string;
|
|
20
20
|
};
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
type ComposerBodyMark = keyof Omit<ComposerBodyText, "text">;
|
|
22
|
+
type ComposerBodyMarks = {
|
|
23
23
|
[K in ComposerBodyMark]: boolean;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
type CommentMentionProps = ComponentPropsWithSlot<"span">;
|
|
27
|
+
type CommentBodyMentionProps = {
|
|
28
28
|
/**
|
|
29
29
|
* The mention's user ID.
|
|
30
30
|
*/
|
|
31
31
|
userId: string;
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
type CommentLinkProps = ComponentPropsWithSlot<"a">;
|
|
34
34
|
interface CommentBodyLinkProps {
|
|
35
35
|
/**
|
|
36
36
|
* The link's absolute URL.
|
|
@@ -121,7 +121,7 @@ interface ComposerEditorLinkProps {
|
|
|
121
121
|
*/
|
|
122
122
|
children: ReactNode;
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
type ComposerEditorMentionSuggestionsProps = {
|
|
125
125
|
/**
|
|
126
126
|
* The list of suggested user IDs.
|
|
127
127
|
*/
|
|
@@ -131,11 +131,11 @@ declare type ComposerEditorMentionSuggestionsProps = {
|
|
|
131
131
|
*/
|
|
132
132
|
selectedUserId?: string;
|
|
133
133
|
};
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
type ComposerEditorFloatingToolbarProps = Record<string, never>;
|
|
135
|
+
type ComposerMentionProps = ComponentPropsWithSlot<"span">;
|
|
136
|
+
type ComposerLinkProps = ComponentPropsWithSlot<"a">;
|
|
137
|
+
type ComposerFloatingToolbarProps = ComponentPropsWithSlot<"div">;
|
|
138
|
+
type ComposerSuggestionsListProps = ComponentPropsWithSlot<"ul">;
|
|
139
139
|
interface ComposerSuggestionsListItemProps extends ComponentPropsWithSlot<"li"> {
|
|
140
140
|
/**
|
|
141
141
|
* The suggestion's value.
|
|
@@ -217,8 +217,8 @@ interface ComposerFormProps extends ComponentPropsWithSlot<"form"> {
|
|
|
217
217
|
*/
|
|
218
218
|
preventUnsavedChanges?: boolean;
|
|
219
219
|
}
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
type ComposerSubmitProps = ComponentPropsWithSlot<"button">;
|
|
221
|
+
type ComposerAttachFilesProps = ComponentPropsWithSlot<"button">;
|
|
222
222
|
interface ComposerMarkToggleProps extends ComponentPropsWithSlot<"button"> {
|
|
223
223
|
/**
|
|
224
224
|
* The text mark to toggle.
|
|
@@ -360,7 +360,7 @@ declare namespace index$1 {
|
|
|
360
360
|
};
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
-
|
|
363
|
+
type ComposerContext = {
|
|
364
364
|
/**
|
|
365
365
|
* Whether the composer is currently disabled.
|
|
366
366
|
*/
|
|
@@ -435,9 +435,9 @@ declare class AttachmentTooLargeError extends Error {
|
|
|
435
435
|
constructor(message: string, origin?: "client" | "server");
|
|
436
436
|
}
|
|
437
437
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
438
|
+
type EmojiPickerContentLoadingProps = ComponentPropsWithoutRef<"div">;
|
|
439
|
+
type EmojiPickerContentEmptyProps = ComponentPropsWithoutRef<"div">;
|
|
440
|
+
type EmojiPickerContentGridProps = ComponentPropsWithoutRef<"div">;
|
|
441
441
|
interface EmojiPickerContentErrorProps extends ComponentPropsWithoutRef<"div"> {
|
|
442
442
|
/**
|
|
443
443
|
* The error.
|
|
@@ -450,7 +450,7 @@ interface EmojiPickerContentCategoryHeaderProps extends ComponentPropsWithoutRef
|
|
|
450
450
|
*/
|
|
451
451
|
category: string;
|
|
452
452
|
}
|
|
453
|
-
|
|
453
|
+
type EmojiPickerContentEmojiRowAttributes = {
|
|
454
454
|
/**
|
|
455
455
|
* The current row's index.
|
|
456
456
|
*/
|
|
@@ -526,7 +526,7 @@ interface EmojiPickerContentProps extends ComponentPropsWithSlot<"div"> {
|
|
|
526
526
|
*/
|
|
527
527
|
components?: Partial<EmojiPickerContentComponents>;
|
|
528
528
|
}
|
|
529
|
-
|
|
529
|
+
type EmojiPickerSearchProps = ComponentPropsWithSlot<"input">;
|
|
530
530
|
|
|
531
531
|
/**
|
|
532
532
|
* @private
|
|
@@ -3,34 +3,34 @@ import { ElementType, ComponentPropsWithoutRef, ReactNode, ComponentType, FormEv
|
|
|
3
3
|
import { CommentBody as CommentBody$1, CommentAttachment, CommentMixedAttachment } from '@liveblocks/core';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
type Direction = "ltr" | "rtl";
|
|
7
|
+
type SlotProp = {
|
|
8
8
|
/**
|
|
9
9
|
* Replace the rendered element by the one passed as a child.
|
|
10
10
|
*/
|
|
11
11
|
asChild?: boolean;
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
type ComponentPropsWithSlot<TElement extends ElementType<any>> = ComponentPropsWithoutRef<TElement> & SlotProp;
|
|
14
|
+
type ComposerBodyText = {
|
|
15
15
|
bold?: boolean;
|
|
16
16
|
italic?: boolean;
|
|
17
17
|
strikethrough?: boolean;
|
|
18
18
|
code?: boolean;
|
|
19
19
|
text: string;
|
|
20
20
|
};
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
type ComposerBodyMark = keyof Omit<ComposerBodyText, "text">;
|
|
22
|
+
type ComposerBodyMarks = {
|
|
23
23
|
[K in ComposerBodyMark]: boolean;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
type CommentMentionProps = ComponentPropsWithSlot<"span">;
|
|
27
|
+
type CommentBodyMentionProps = {
|
|
28
28
|
/**
|
|
29
29
|
* The mention's user ID.
|
|
30
30
|
*/
|
|
31
31
|
userId: string;
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
type CommentLinkProps = ComponentPropsWithSlot<"a">;
|
|
34
34
|
interface CommentBodyLinkProps {
|
|
35
35
|
/**
|
|
36
36
|
* The link's absolute URL.
|
|
@@ -121,7 +121,7 @@ interface ComposerEditorLinkProps {
|
|
|
121
121
|
*/
|
|
122
122
|
children: ReactNode;
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
type ComposerEditorMentionSuggestionsProps = {
|
|
125
125
|
/**
|
|
126
126
|
* The list of suggested user IDs.
|
|
127
127
|
*/
|
|
@@ -131,11 +131,11 @@ declare type ComposerEditorMentionSuggestionsProps = {
|
|
|
131
131
|
*/
|
|
132
132
|
selectedUserId?: string;
|
|
133
133
|
};
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
type ComposerEditorFloatingToolbarProps = Record<string, never>;
|
|
135
|
+
type ComposerMentionProps = ComponentPropsWithSlot<"span">;
|
|
136
|
+
type ComposerLinkProps = ComponentPropsWithSlot<"a">;
|
|
137
|
+
type ComposerFloatingToolbarProps = ComponentPropsWithSlot<"div">;
|
|
138
|
+
type ComposerSuggestionsListProps = ComponentPropsWithSlot<"ul">;
|
|
139
139
|
interface ComposerSuggestionsListItemProps extends ComponentPropsWithSlot<"li"> {
|
|
140
140
|
/**
|
|
141
141
|
* The suggestion's value.
|
|
@@ -217,8 +217,8 @@ interface ComposerFormProps extends ComponentPropsWithSlot<"form"> {
|
|
|
217
217
|
*/
|
|
218
218
|
preventUnsavedChanges?: boolean;
|
|
219
219
|
}
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
type ComposerSubmitProps = ComponentPropsWithSlot<"button">;
|
|
221
|
+
type ComposerAttachFilesProps = ComponentPropsWithSlot<"button">;
|
|
222
222
|
interface ComposerMarkToggleProps extends ComponentPropsWithSlot<"button"> {
|
|
223
223
|
/**
|
|
224
224
|
* The text mark to toggle.
|
|
@@ -360,7 +360,7 @@ declare namespace index$1 {
|
|
|
360
360
|
};
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
-
|
|
363
|
+
type ComposerContext = {
|
|
364
364
|
/**
|
|
365
365
|
* Whether the composer is currently disabled.
|
|
366
366
|
*/
|
|
@@ -435,9 +435,9 @@ declare class AttachmentTooLargeError extends Error {
|
|
|
435
435
|
constructor(message: string, origin?: "client" | "server");
|
|
436
436
|
}
|
|
437
437
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
438
|
+
type EmojiPickerContentLoadingProps = ComponentPropsWithoutRef<"div">;
|
|
439
|
+
type EmojiPickerContentEmptyProps = ComponentPropsWithoutRef<"div">;
|
|
440
|
+
type EmojiPickerContentGridProps = ComponentPropsWithoutRef<"div">;
|
|
441
441
|
interface EmojiPickerContentErrorProps extends ComponentPropsWithoutRef<"div"> {
|
|
442
442
|
/**
|
|
443
443
|
* The error.
|
|
@@ -450,7 +450,7 @@ interface EmojiPickerContentCategoryHeaderProps extends ComponentPropsWithoutRef
|
|
|
450
450
|
*/
|
|
451
451
|
category: string;
|
|
452
452
|
}
|
|
453
|
-
|
|
453
|
+
type EmojiPickerContentEmojiRowAttributes = {
|
|
454
454
|
/**
|
|
455
455
|
* The current row's index.
|
|
456
456
|
*/
|
|
@@ -526,7 +526,7 @@ interface EmojiPickerContentProps extends ComponentPropsWithSlot<"div"> {
|
|
|
526
526
|
*/
|
|
527
527
|
components?: Partial<EmojiPickerContentComponents>;
|
|
528
528
|
}
|
|
529
|
-
|
|
529
|
+
type EmojiPickerSearchProps = ComponentPropsWithSlot<"input">;
|
|
530
530
|
|
|
531
531
|
/**
|
|
532
532
|
* @private
|
package/dist/utils/Persist.js
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var core = require('@liveblocks/core');
|
|
6
|
+
var _private = require('@liveblocks/react/_private');
|
|
6
7
|
var react = require('react');
|
|
7
|
-
var
|
|
8
|
+
var reactDom = require('react-dom');
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
const PERSIST_NAME = "Persist";
|
|
@@ -21,7 +22,7 @@ function useAnimationPersist(ref) {
|
|
|
21
22
|
const [isPresent, unmount] = usePersist();
|
|
22
23
|
const previousAnimationName = react.useRef(null);
|
|
23
24
|
const unmountAnimationName = react.useRef(null);
|
|
24
|
-
|
|
25
|
+
_private.useLayoutEffect(() => {
|
|
25
26
|
const element = ref.current;
|
|
26
27
|
if (!element) {
|
|
27
28
|
return;
|
|
@@ -39,7 +40,7 @@ function useAnimationPersist(ref) {
|
|
|
39
40
|
element.removeEventListener("animationend", handleAnimationEnd);
|
|
40
41
|
};
|
|
41
42
|
}, [ref, unmount]);
|
|
42
|
-
|
|
43
|
+
_private.useLayoutEffect(() => {
|
|
43
44
|
const element = ref.current;
|
|
44
45
|
let animationFrameId;
|
|
45
46
|
if (!element) {
|
|
@@ -64,9 +65,9 @@ function Persist({ children }) {
|
|
|
64
65
|
const lastPresentChild = react.useRef(null);
|
|
65
66
|
const child = getChild(children);
|
|
66
67
|
const unmount = react.useCallback(() => {
|
|
67
|
-
|
|
68
|
+
reactDom.flushSync(() => setPersisting(false));
|
|
68
69
|
}, []);
|
|
69
|
-
|
|
70
|
+
_private.useLayoutEffect(() => {
|
|
70
71
|
if (child) {
|
|
71
72
|
setPersisting(true);
|
|
72
73
|
lastPresentChild.current = child;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Persist.js","sources":["../../src/utils/Persist.tsx"],"sourcesContent":["\"use client\";\n\nimport { nn } from \"@liveblocks/core\";\nimport type { ReactNode, RefObject } from \"react\";\nimport {\n Children,\n createContext,\n isValidElement,\n useCallback,\n useContext,\n
|
|
1
|
+
{"version":3,"file":"Persist.js","sources":["../../src/utils/Persist.tsx"],"sourcesContent":["\"use client\";\n\nimport { nn } from \"@liveblocks/core\";\nimport { useLayoutEffect } from \"@liveblocks/react/_private\";\nimport type { ReactNode, RefObject } from \"react\";\nimport {\n Children,\n createContext,\n isValidElement,\n useCallback,\n useContext,\n useRef,\n useState,\n} from \"react\";\nimport { flushSync } from \"react-dom\";\n\n// Persist is an overly simplified version of Framer Motion's AnimatePresence,\n// mostly mimicking its usePresence API: https://github.com/framer/motion/blob/main/packages/framer-motion/src/components/AnimatePresence/use-presence.ts\n\nconst PERSIST_NAME = \"Persist\";\n\ninterface PersistProps {\n children: Exclude<ReactNode, Iterable<ReactNode>>;\n}\n\ntype PersistContext = [boolean, () => void];\n\nconst PersistContext = createContext<PersistContext | null>(null);\n\nexport function usePersist() {\n const persistContext = useContext(PersistContext);\n\n return nn(persistContext, \"Persist is missing from the React tree.\");\n}\n\nfunction getChild(children: ReactNode) {\n const child: ReactNode = Array.isArray(children)\n ? Children.only(children)\n : children;\n\n return isValidElement(child) ? child : undefined;\n}\n\nexport function useAnimationPersist(ref: RefObject<HTMLElement>) {\n const [isPresent, unmount] = usePersist();\n const previousAnimationName = useRef<string | null>(null);\n const unmountAnimationName = useRef<string | null>(null);\n\n useLayoutEffect(() => {\n const element = ref.current;\n\n if (!element) {\n return;\n }\n\n /**\n * Stop persisting at the end of the last animation.\n *\n * We keep track of all ending animations because animations stay\n * on getComputedStyle(element).animationName even if they're over,\n * so we need to keep track of previous animations to truly know if\n * an animation should be waited on.\n */\n const handleAnimationEnd = (event: AnimationEvent) => {\n if (event.animationName === unmountAnimationName.current) {\n unmount();\n }\n\n previousAnimationName.current = event.animationName;\n };\n\n element.addEventListener(\"animationcancel\", handleAnimationEnd);\n element.addEventListener(\"animationend\", handleAnimationEnd);\n\n return () => {\n element.removeEventListener(\"animationcancel\", handleAnimationEnd);\n element.removeEventListener(\"animationend\", handleAnimationEnd);\n };\n }, [ref, unmount]);\n\n useLayoutEffect(() => {\n const element = ref.current;\n let animationFrameId: number;\n\n if (!element) {\n return;\n }\n\n if (!isPresent) {\n // If the element should be unmounting, wait for a repaint and check\n // if it is visible and has an animation. If not, unmount immediately.\n animationFrameId = requestAnimationFrame(() => {\n const styles = getComputedStyle(element);\n unmountAnimationName.current = styles.animationName;\n\n if (\n styles.animationName === \"none\" ||\n styles.animationName === previousAnimationName.current ||\n styles.display === \"none\"\n ) {\n unmount();\n }\n });\n }\n\n return () => {\n cancelAnimationFrame(animationFrameId);\n };\n }, [isPresent, ref, unmount]);\n}\n\n/**\n * Persist a component until it decides to unmount by\n * itself (instead of orchestrating the unmount from the parent).\n */\nexport function Persist({ children }: PersistProps) {\n const [isPersisting, setPersisting] = useState(true);\n const lastPresentChild = useRef<ReactNode>(null);\n const child = getChild(children);\n\n const unmount = useCallback(() => {\n flushSync(() => setPersisting(false));\n }, []);\n\n useLayoutEffect(() => {\n if (child) {\n setPersisting(true);\n lastPresentChild.current = child;\n }\n }, [child]);\n\n return (\n <PersistContext.Provider value={[Boolean(child), unmount]}>\n {child ?? (isPersisting ? lastPresentChild.current : null)}\n </PersistContext.Provider>\n );\n}\n\nif (process.env.NODE_ENV !== \"production\") {\n Persist.displayName = PERSIST_NAME;\n}\n"],"names":[],"mappings":";;;;;;;;;AAAA;AAmBA;AAQA;AAEO;AACL;AAEA;AACF;AAEA;AACE;AAIA;AACF;AAEO;AACL;AACA;AACA;AAEA;AACE;AAEA;AACE;AAAA;AAWF;AACE;AACE;AAAQ;AAGV;AAAsC;AAGxC;AACA;AAEA;AACE;AACA;AAA8D;AAChE;AAGF;AACE;AACA;AAEA;AACE;AAAA;AAGF;AAGE;AACE;AACA;AAEA;AAKE;AAAQ;AACV;AACD;AAGH;AACE;AAAqC;AACvC;AAEJ;AAMgB;AACd;AACA;AACA;AAEA;AACE;AAAoC;AAGtC;AACE;AACE;AACA;AAA2B;AAC7B;AAGF;AACG;AAAuD;AACD;AAG3D;AAEA;AACE;AACF;;;;"}
|
package/dist/utils/Persist.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { nn } from '@liveblocks/core';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useLayoutEffect } from '@liveblocks/react/_private';
|
|
5
|
+
import { createContext, useContext, Children, isValidElement, useRef, useState, useCallback } from 'react';
|
|
6
|
+
import { flushSync } from 'react-dom';
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
const PERSIST_NAME = "Persist";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Persist.mjs","sources":["../../src/utils/Persist.tsx"],"sourcesContent":["\"use client\";\n\nimport { nn } from \"@liveblocks/core\";\nimport type { ReactNode, RefObject } from \"react\";\nimport {\n Children,\n createContext,\n isValidElement,\n useCallback,\n useContext,\n
|
|
1
|
+
{"version":3,"file":"Persist.mjs","sources":["../../src/utils/Persist.tsx"],"sourcesContent":["\"use client\";\n\nimport { nn } from \"@liveblocks/core\";\nimport { useLayoutEffect } from \"@liveblocks/react/_private\";\nimport type { ReactNode, RefObject } from \"react\";\nimport {\n Children,\n createContext,\n isValidElement,\n useCallback,\n useContext,\n useRef,\n useState,\n} from \"react\";\nimport { flushSync } from \"react-dom\";\n\n// Persist is an overly simplified version of Framer Motion's AnimatePresence,\n// mostly mimicking its usePresence API: https://github.com/framer/motion/blob/main/packages/framer-motion/src/components/AnimatePresence/use-presence.ts\n\nconst PERSIST_NAME = \"Persist\";\n\ninterface PersistProps {\n children: Exclude<ReactNode, Iterable<ReactNode>>;\n}\n\ntype PersistContext = [boolean, () => void];\n\nconst PersistContext = createContext<PersistContext | null>(null);\n\nexport function usePersist() {\n const persistContext = useContext(PersistContext);\n\n return nn(persistContext, \"Persist is missing from the React tree.\");\n}\n\nfunction getChild(children: ReactNode) {\n const child: ReactNode = Array.isArray(children)\n ? Children.only(children)\n : children;\n\n return isValidElement(child) ? child : undefined;\n}\n\nexport function useAnimationPersist(ref: RefObject<HTMLElement>) {\n const [isPresent, unmount] = usePersist();\n const previousAnimationName = useRef<string | null>(null);\n const unmountAnimationName = useRef<string | null>(null);\n\n useLayoutEffect(() => {\n const element = ref.current;\n\n if (!element) {\n return;\n }\n\n /**\n * Stop persisting at the end of the last animation.\n *\n * We keep track of all ending animations because animations stay\n * on getComputedStyle(element).animationName even if they're over,\n * so we need to keep track of previous animations to truly know if\n * an animation should be waited on.\n */\n const handleAnimationEnd = (event: AnimationEvent) => {\n if (event.animationName === unmountAnimationName.current) {\n unmount();\n }\n\n previousAnimationName.current = event.animationName;\n };\n\n element.addEventListener(\"animationcancel\", handleAnimationEnd);\n element.addEventListener(\"animationend\", handleAnimationEnd);\n\n return () => {\n element.removeEventListener(\"animationcancel\", handleAnimationEnd);\n element.removeEventListener(\"animationend\", handleAnimationEnd);\n };\n }, [ref, unmount]);\n\n useLayoutEffect(() => {\n const element = ref.current;\n let animationFrameId: number;\n\n if (!element) {\n return;\n }\n\n if (!isPresent) {\n // If the element should be unmounting, wait for a repaint and check\n // if it is visible and has an animation. If not, unmount immediately.\n animationFrameId = requestAnimationFrame(() => {\n const styles = getComputedStyle(element);\n unmountAnimationName.current = styles.animationName;\n\n if (\n styles.animationName === \"none\" ||\n styles.animationName === previousAnimationName.current ||\n styles.display === \"none\"\n ) {\n unmount();\n }\n });\n }\n\n return () => {\n cancelAnimationFrame(animationFrameId);\n };\n }, [isPresent, ref, unmount]);\n}\n\n/**\n * Persist a component until it decides to unmount by\n * itself (instead of orchestrating the unmount from the parent).\n */\nexport function Persist({ children }: PersistProps) {\n const [isPersisting, setPersisting] = useState(true);\n const lastPresentChild = useRef<ReactNode>(null);\n const child = getChild(children);\n\n const unmount = useCallback(() => {\n flushSync(() => setPersisting(false));\n }, []);\n\n useLayoutEffect(() => {\n if (child) {\n setPersisting(true);\n lastPresentChild.current = child;\n }\n }, [child]);\n\n return (\n <PersistContext.Provider value={[Boolean(child), unmount]}>\n {child ?? (isPersisting ? lastPresentChild.current : null)}\n </PersistContext.Provider>\n );\n}\n\nif (process.env.NODE_ENV !== \"production\") {\n Persist.displayName = PERSIST_NAME;\n}\n"],"names":[],"mappings":";;;;;;;AAAA;AAmBA;AAQA;AAEO;AACL;AAEA;AACF;AAEA;AACE;AAIA;AACF;AAEO;AACL;AACA;AACA;AAEA;AACE;AAEA;AACE;AAAA;AAWF;AACE;AACE;AAAQ;AAGV;AAAsC;AAGxC;AACA;AAEA;AACE;AACA;AAA8D;AAChE;AAGF;AACE;AACA;AAEA;AACE;AAAA;AAGF;AAGE;AACE;AACA;AAEA;AAKE;AAAQ;AACV;AACD;AAGH;AACE;AAAqC;AACvC;AAEJ;AAMgB;AACd;AACA;AACA;AAEA;AACE;AAAoC;AAGtC;AACE;AACE;AACA;AAA2B;AAC7B;AAGF;AACG;AAAuD;AACD;AAG3D;AAEA;AACE;AACF;;"}
|
package/dist/utils/Portal.js
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var reactSlot = require('@radix-ui/react-slot');
|
|
6
6
|
var react = require('react');
|
|
7
|
-
var
|
|
7
|
+
var reactDom = require('react-dom');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
const PORTAL_NAME = "Portal";
|
|
11
11
|
const Portal = react.forwardRef(
|
|
12
12
|
({ container = document?.body, asChild, ...props }, forwardedRef) => {
|
|
13
13
|
const Component = asChild ? reactSlot.Slot : "div";
|
|
14
|
-
return container ?
|
|
14
|
+
return container ? reactDom.createPortal(
|
|
15
15
|
/* @__PURE__ */ jsxRuntime.jsx(Component, {
|
|
16
16
|
"data-liveblocks-portal": "",
|
|
17
17
|
...props,
|
package/dist/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const PKG_NAME = "@liveblocks/react-ui";
|
|
4
|
-
const PKG_VERSION = typeof "2.
|
|
4
|
+
const PKG_VERSION = typeof "2.16.0-toolbars1" === "string" && "2.16.0-toolbars1";
|
|
5
5
|
const PKG_FORMAT = typeof "cjs" === "string" && "cjs";
|
|
6
6
|
|
|
7
7
|
exports.PKG_FORMAT = PKG_FORMAT;
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-ui\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":";;AAGO,MAAM,QAAW,GAAA,uBAAA;AACX,MAAA,WAAA,GAAc,OAAO,
|
|
1
|
+
{"version":3,"file":"version.js","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-ui\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":";;AAGO,MAAM,QAAW,GAAA,uBAAA;AACX,MAAA,WAAA,GAAc,OAAO,kBAAA,KAAgB,QAAY,IAAA,mBAAA;AACjD,MAAA,UAAA,GAAa,OAAO,KAAA,KAAkB,QAAY,IAAA;;;;;;"}
|
package/dist/version.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const PKG_NAME = "@liveblocks/react-ui";
|
|
2
|
-
const PKG_VERSION = typeof "2.
|
|
2
|
+
const PKG_VERSION = typeof "2.16.0-toolbars1" === "string" && "2.16.0-toolbars1";
|
|
3
3
|
const PKG_FORMAT = typeof "esm" === "string" && "esm";
|
|
4
4
|
|
|
5
5
|
export { PKG_FORMAT, PKG_NAME, PKG_VERSION };
|
package/dist/version.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-ui\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":"AAGO,MAAM,QAAW,GAAA,uBAAA;AACX,MAAA,WAAA,GAAc,OAAO,
|
|
1
|
+
{"version":3,"file":"version.mjs","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-ui\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":"AAGO,MAAM,QAAW,GAAA,uBAAA;AACX,MAAA,WAAA,GAAc,OAAO,kBAAA,KAAgB,QAAY,IAAA,mBAAA;AACjD,MAAA,UAAA,GAAa,OAAO,KAAA,KAAkB,QAAY,IAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liveblocks/react-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.0-toolbars1",
|
|
4
4
|
"description": "A set of React pre-built components for the Liveblocks products. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@floating-ui/react-dom": "^2.1.2",
|
|
78
|
-
"@liveblocks/client": "2.
|
|
79
|
-
"@liveblocks/core": "2.
|
|
80
|
-
"@liveblocks/react": "2.
|
|
78
|
+
"@liveblocks/client": "2.16.0-toolbars1",
|
|
79
|
+
"@liveblocks/core": "2.16.0-toolbars1",
|
|
80
|
+
"@liveblocks/react": "2.16.0-toolbars1",
|
|
81
81
|
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
|
82
82
|
"@radix-ui/react-popover": "^1.1.2",
|
|
83
83
|
"@radix-ui/react-slot": "^1.1.0",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"emojibase": "^15.3.0",
|
|
102
102
|
"eslint-plugin-react": "^7.33.2",
|
|
103
103
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
104
|
-
"msw": "^
|
|
104
|
+
"msw": "^1.3.5",
|
|
105
105
|
"rollup": "3.28.0",
|
|
106
106
|
"stylelint": "^15.10.2",
|
|
107
107
|
"stylelint-config-standard": "^34.0.0",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
},
|
|
115
115
|
"repository": {
|
|
116
116
|
"type": "git",
|
|
117
|
-
"url": "https://github.com/liveblocks/liveblocks.git",
|
|
117
|
+
"url": "git+https://github.com/liveblocks/liveblocks.git",
|
|
118
118
|
"directory": "packages/liveblocks-react-ui"
|
|
119
119
|
},
|
|
120
120
|
"homepage": "https://liveblocks.io",
|