@liveblocks/react-ui 2.12.1-test1 → 2.12.1-test2

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 (37) hide show
  1. package/dist/components/Comment.js +26 -18
  2. package/dist/components/Comment.js.map +1 -1
  3. package/dist/components/Comment.mjs +27 -19
  4. package/dist/components/Comment.mjs.map +1 -1
  5. package/dist/components/Composer.js +41 -10
  6. package/dist/components/Composer.js.map +1 -1
  7. package/dist/components/Composer.mjs +45 -14
  8. package/dist/components/Composer.mjs.map +1 -1
  9. package/dist/components/Thread.js +5 -3
  10. package/dist/components/Thread.js.map +1 -1
  11. package/dist/components/Thread.mjs +6 -4
  12. package/dist/components/Thread.mjs.map +1 -1
  13. package/dist/components/internal/Attachment.js +32 -14
  14. package/dist/components/internal/Attachment.js.map +1 -1
  15. package/dist/components/internal/Attachment.mjs +32 -14
  16. package/dist/components/internal/Attachment.mjs.map +1 -1
  17. package/dist/components/internal/InboxNotificationThread.js +2 -1
  18. package/dist/components/internal/InboxNotificationThread.js.map +1 -1
  19. package/dist/components/internal/InboxNotificationThread.mjs +2 -1
  20. package/dist/components/internal/InboxNotificationThread.mjs.map +1 -1
  21. package/dist/primitives/Composer/contexts.js.map +1 -1
  22. package/dist/primitives/Composer/contexts.mjs.map +1 -1
  23. package/dist/primitives/Composer/index.js +31 -12
  24. package/dist/primitives/Composer/index.js.map +1 -1
  25. package/dist/primitives/Composer/index.mjs +32 -13
  26. package/dist/primitives/Composer/index.mjs.map +1 -1
  27. package/dist/primitives/Composer/utils.js +6 -4
  28. package/dist/primitives/Composer/utils.js.map +1 -1
  29. package/dist/primitives/Composer/utils.mjs +8 -6
  30. package/dist/primitives/Composer/utils.mjs.map +1 -1
  31. package/dist/shared.js +3 -19
  32. package/dist/shared.js.map +1 -1
  33. package/dist/shared.mjs +5 -21
  34. package/dist/shared.mjs.map +1 -1
  35. package/dist/version.js +1 -1
  36. package/dist/version.mjs +1 -1
  37. package/package.json +4 -4
package/dist/shared.mjs CHANGED
@@ -1,31 +1,15 @@
1
- import { raise, kInternal } from '@liveblocks/core';
2
- import { ClientContext, RoomContext, useSelf } from '@liveblocks/react';
3
- import { useContext } from 'react';
1
+ import { kInternal } from '@liveblocks/core';
2
+ import { useClient } from '@liveblocks/react';
4
3
  import { useSyncExternalStore } from 'use-sync-external-store/shim/index.js';
5
4
 
6
- function useCurrentUserIdFromRoom() {
7
- return useSelf((user) => typeof user.id === "string" ? user.id : null);
8
- }
9
- function useCurrentUserIdFromClient_withClient(client) {
5
+ function useCurrentUserId() {
6
+ const client = useClient();
10
7
  const currentUserIdStore = client[kInternal].currentUserIdStore;
11
8
  return useSyncExternalStore(
12
9
  currentUserIdStore.subscribe,
13
10
  currentUserIdStore.get,
14
11
  currentUserIdStore.get
15
- );
16
- }
17
- function useCurrentUserId() {
18
- const client = useContext(ClientContext);
19
- const room = useContext(RoomContext);
20
- if (room !== null) {
21
- return useCurrentUserIdFromRoom();
22
- } else if (client !== null) {
23
- return useCurrentUserIdFromClient_withClient(client);
24
- } else {
25
- raise(
26
- "LiveblocksProvider or RoomProvider are missing from the React tree."
27
- );
28
- }
12
+ ) ?? null;
29
13
  }
30
14
 
31
15
  export { useCurrentUserId };
@@ -1 +1 @@
1
- {"version":3,"file":"shared.mjs","sources":["../src/shared.ts"],"sourcesContent":["import type { OpaqueClient } from \"@liveblocks/core\";\nimport { kInternal, raise } from \"@liveblocks/core\";\nimport { ClientContext, RoomContext, useSelf } from \"@liveblocks/react\";\nimport { useContext } from \"react\";\nimport { useSyncExternalStore } from \"use-sync-external-store/shim/index.js\";\n\nfunction useCurrentUserIdFromRoom() {\n return useSelf((user) => (typeof user.id === \"string\" ? user.id : null));\n}\n\nfunction useCurrentUserIdFromClient_withClient(client: OpaqueClient) {\n const currentUserIdStore = client[kInternal].currentUserIdStore;\n return useSyncExternalStore(\n currentUserIdStore.subscribe,\n currentUserIdStore.get,\n currentUserIdStore.get\n );\n}\n\nexport function useCurrentUserId(): string | null {\n const client = useContext(ClientContext);\n const room = useContext(RoomContext);\n\n // NOTE: These hooks are called conditionally, but in a way that will not\n // take different code paths between re-renders, so we can ignore the\n // rules-of-hooks lint warning here.\n /* eslint-disable react-hooks/rules-of-hooks */\n if (room !== null) {\n return useCurrentUserIdFromRoom();\n } else if (client !== null) {\n return useCurrentUserIdFromClient_withClient(client);\n } else {\n raise(\n \"LiveblocksProvider or RoomProvider are missing from the React tree.\"\n );\n }\n /* eslint-enable react-hooks/rules-of-hooks */\n}\n"],"names":[],"mappings":";;;;;AAMA,SAAS,wBAA2B,GAAA;AAClC,EAAO,OAAA,OAAA,CAAQ,CAAC,IAAU,KAAA,OAAO,KAAK,EAAO,KAAA,QAAA,GAAW,IAAK,CAAA,EAAA,GAAK,IAAK,CAAA,CAAA;AACzE,CAAA;AAEA,SAAS,sCAAsC,MAAsB,EAAA;AACnE,EAAM,MAAA,kBAAA,GAAqB,OAAO,SAAW,CAAA,CAAA,kBAAA,CAAA;AAC7C,EAAO,OAAA,oBAAA;AAAA,IACL,kBAAmB,CAAA,SAAA;AAAA,IACnB,kBAAmB,CAAA,GAAA;AAAA,IACnB,kBAAmB,CAAA,GAAA;AAAA,GACrB,CAAA;AACF,CAAA;AAEO,SAAS,gBAAkC,GAAA;AAChD,EAAM,MAAA,MAAA,GAAS,WAAW,aAAa,CAAA,CAAA;AACvC,EAAM,MAAA,IAAA,GAAO,WAAW,WAAW,CAAA,CAAA;AAMnC,EAAA,IAAI,SAAS,IAAM,EAAA;AACjB,IAAA,OAAO,wBAAyB,EAAA,CAAA;AAAA,GAClC,MAAA,IAAW,WAAW,IAAM,EAAA;AAC1B,IAAA,OAAO,sCAAsC,MAAM,CAAA,CAAA;AAAA,GAC9C,MAAA;AACL,IAAA,KAAA;AAAA,MACE,qEAAA;AAAA,KACF,CAAA;AAAA,GACF;AAEF;;;;"}
1
+ {"version":3,"file":"shared.mjs","sources":["../src/shared.ts"],"sourcesContent":["import { kInternal } from \"@liveblocks/core\";\nimport { useClient } from \"@liveblocks/react\";\nimport { useSyncExternalStore } from \"use-sync-external-store/shim/index.js\";\n\nexport function useCurrentUserId(): string | null {\n const client = useClient();\n const currentUserIdStore = client[kInternal].currentUserIdStore;\n return (\n useSyncExternalStore(\n currentUserIdStore.subscribe,\n currentUserIdStore.get,\n currentUserIdStore.get\n ) ?? null\n );\n}\n"],"names":[],"mappings":";;;;AAIO,SAAS,gBAAkC,GAAA;AAChD,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAM,MAAA,kBAAA,GAAqB,OAAO,SAAW,CAAA,CAAA,kBAAA,CAAA;AAC7C,EACE,OAAA,oBAAA;AAAA,IACE,kBAAmB,CAAA,SAAA;AAAA,IACnB,kBAAmB,CAAA,GAAA;AAAA,IACnB,kBAAmB,CAAA,GAAA;AAAA,GAChB,IAAA,IAAA,CAAA;AAET;;;;"}
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 = "2.12.1-test1";
4
+ const PKG_VERSION = "2.12.1-test2";
5
5
  const PKG_FORMAT = "cjs";
6
6
 
7
7
  exports.PKG_FORMAT = PKG_FORMAT;
package/dist/version.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  const PKG_NAME = "@liveblocks/react-ui";
2
- const PKG_VERSION = "2.12.1-test1";
2
+ const PKG_VERSION = "2.12.1-test2";
3
3
  const PKG_FORMAT = "esm";
4
4
 
5
5
  export { PKG_FORMAT, PKG_NAME, PKG_VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/react-ui",
3
- "version": "2.12.1-test1",
3
+ "version": "2.12.1-test2",
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.12.1-test1",
79
- "@liveblocks/core": "2.12.1-test1",
80
- "@liveblocks/react": "2.12.1-test1",
78
+ "@liveblocks/client": "2.12.1-test2",
79
+ "@liveblocks/core": "2.12.1-test2",
80
+ "@liveblocks/react": "2.12.1-test2",
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",