@liveblocks/react 2.9.3-experimental1 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,22 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }// src/version.ts
2
+ var PKG_NAME = "@liveblocks/react";
3
+ var PKG_VERSION = "2.10.0";
4
+ var PKG_FORMAT = "cjs";
5
+
6
+ // src/ClientSideSuspense.tsx
7
+ var _react = require('react'); var React = _interopRequireWildcard(_react);
8
+ function ClientSideSuspense(props) {
9
+ const [mounted, setMounted] = React.useState(false);
10
+ React.useEffect(() => {
11
+ setMounted(true);
12
+ }, []);
13
+ return /* @__PURE__ */ React.createElement(React.Suspense, { fallback: props.fallback }, mounted ? typeof props.children === "function" ? props.children() : props.children : props.fallback);
14
+ }
15
+
16
+
17
+
18
+
19
+
20
+
21
+ exports.PKG_NAME = PKG_NAME; exports.PKG_VERSION = PKG_VERSION; exports.PKG_FORMAT = PKG_FORMAT; exports.ClientSideSuspense = ClientSideSuspense;
22
+ //# sourceMappingURL=chunk-PJN3AKDH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/version.ts","../src/ClientSideSuspense.tsx"],"names":[],"mappings":";AAGO,IAAM,WAAW;AACjB,IAAM,cAAiD;AACvD,IAAM,aAAgD;;;ACJ7D,YAAY,WAAW;AAwBhB,SAAS,mBAAmB,OAAc;AAC/C,QAAM,CAAC,SAAS,UAAU,IAAU,eAAS,KAAK;AAElD,EAAM,gBAAU,MAAM;AAGpB,eAAW,IAAI;AAAA,EACjB,GAAG,CAAC,CAAC;AAEL,SACE,oCAAO,gBAAN,EAAe,UAAU,MAAM,YAC7B,UACG,OAAO,MAAM,aAAa,aACxB,MAAM,SAAS,IACf,MAAM,WACR,MAAM,QACZ;AAEJ","sourcesContent":["declare const __VERSION__: string;\ndeclare const TSUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof TSUP_FORMAT === \"string\" && TSUP_FORMAT;\n","import type { ReactNode } from \"react\";\nimport * as React from \"react\";\n\ntype Props = {\n fallback: ReactNode;\n children: (() => ReactNode | undefined) | ReactNode | undefined;\n};\n\n/**\n * Almost like a normal <Suspense> component, except that for server-side\n * renders, the fallback will be used.\n *\n * The child props will have to be provided in a function, i.e. change:\n *\n * <Suspense fallback={<Loading />}>\n * <MyRealComponent a={1} />\n * </Suspense>\n *\n * To:\n *\n * <ClientSideSuspense fallback={<Loading />}>\n * <MyRealComponent a={1} />\n * </ClientSideSuspense>\n *\n */\nexport function ClientSideSuspense(props: Props) {\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n // Effects are never executed on the server side. The point of this is to\n // delay the flipping of this boolean until after hydration has happened.\n setMounted(true);\n }, []);\n\n return (\n <React.Suspense fallback={props.fallback}>\n {mounted\n ? typeof props.children === \"function\"\n ? props.children()\n : props.children\n : props.fallback}\n </React.Suspense>\n );\n}\n"]}
@@ -0,0 +1,22 @@
1
+ // src/version.ts
2
+ var PKG_NAME = "@liveblocks/react";
3
+ var PKG_VERSION = "2.10.0";
4
+ var PKG_FORMAT = "esm";
5
+
6
+ // src/ClientSideSuspense.tsx
7
+ import * as React from "react";
8
+ function ClientSideSuspense(props) {
9
+ const [mounted, setMounted] = React.useState(false);
10
+ React.useEffect(() => {
11
+ setMounted(true);
12
+ }, []);
13
+ return /* @__PURE__ */ React.createElement(React.Suspense, { fallback: props.fallback }, mounted ? typeof props.children === "function" ? props.children() : props.children : props.fallback);
14
+ }
15
+
16
+ export {
17
+ PKG_NAME,
18
+ PKG_VERSION,
19
+ PKG_FORMAT,
20
+ ClientSideSuspense
21
+ };
22
+ //# sourceMappingURL=chunk-PXKGBTHT.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/version.ts","../src/ClientSideSuspense.tsx"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const TSUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof TSUP_FORMAT === \"string\" && TSUP_FORMAT;\n","import type { ReactNode } from \"react\";\nimport * as React from \"react\";\n\ntype Props = {\n fallback: ReactNode;\n children: (() => ReactNode | undefined) | ReactNode | undefined;\n};\n\n/**\n * Almost like a normal <Suspense> component, except that for server-side\n * renders, the fallback will be used.\n *\n * The child props will have to be provided in a function, i.e. change:\n *\n * <Suspense fallback={<Loading />}>\n * <MyRealComponent a={1} />\n * </Suspense>\n *\n * To:\n *\n * <ClientSideSuspense fallback={<Loading />}>\n * <MyRealComponent a={1} />\n * </ClientSideSuspense>\n *\n */\nexport function ClientSideSuspense(props: Props) {\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n // Effects are never executed on the server side. The point of this is to\n // delay the flipping of this boolean until after hydration has happened.\n setMounted(true);\n }, []);\n\n return (\n <React.Suspense fallback={props.fallback}>\n {mounted\n ? typeof props.children === \"function\"\n ? props.children()\n : props.children\n : props.fallback}\n </React.Suspense>\n );\n}\n"],"mappings":";AAGO,IAAM,WAAW;AACjB,IAAM,cAAiD;AACvD,IAAM,aAAgD;;;ACJ7D,YAAY,WAAW;AAwBhB,SAAS,mBAAmB,OAAc;AAC/C,QAAM,CAAC,SAAS,UAAU,IAAU,eAAS,KAAK;AAElD,EAAM,gBAAU,MAAM;AAGpB,eAAW,IAAI;AAAA,EACjB,GAAG,CAAC,CAAC;AAEL,SACE,oCAAO,gBAAN,EAAe,UAAU,MAAM,YAC7B,UACG,OAAO,MAAM,aAAa,aACxB,MAAM,SAAS,IACf,MAAM,WACR,MAAM,QACZ;AAEJ;","names":[]}
@@ -1,23 +1,8 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/version.ts
2
- var PKG_NAME = "@liveblocks/react";
3
- var PKG_VERSION = "2.9.3-experimental1";
4
- var PKG_FORMAT = "cjs";
5
-
6
- // src/ClientSideSuspense.tsx
7
- var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React5 = _interopRequireWildcard(_react); var React4 = _interopRequireWildcard(_react);
8
- function ClientSideSuspense(props) {
9
- const [mounted, setMounted] = React.useState(false);
10
- React.useEffect(() => {
11
- setMounted(true);
12
- }, []);
13
- return /* @__PURE__ */ React.createElement(React.Suspense, { fallback: props.fallback }, mounted ? typeof props.children === "function" ? props.children() : props.children : props.fallback);
14
- }
15
-
16
- // src/contexts.ts
17
-
18
- var RoomContext = React2.createContext(null);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/contexts.ts
2
+ var _react = require('react'); var React = _interopRequireWildcard(_react); var React4 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react);
3
+ var RoomContext = React.createContext(null);
19
4
  function useRoomOrNull() {
20
- return React2.useContext(RoomContext);
5
+ return React.useContext(RoomContext);
21
6
  }
22
7
  function useIsInsideRoom() {
23
8
  const room = useRoomOrNull();
@@ -1804,20 +1789,21 @@ function useUser_withClient(client, userId) {
1804
1789
  () => usersStore.getState(userId),
1805
1790
  [usersStore, userId]
1806
1791
  );
1807
- _react.useEffect.call(void 0, () => {
1808
- void usersStore.get(userId);
1809
- }, [usersStore, userId]);
1810
1792
  const selector = _react.useCallback.call(void 0,
1811
1793
  (state) => selectorFor_useUser(state, userId),
1812
1794
  [userId]
1813
1795
  );
1814
- return _withselectorjs.useSyncExternalStoreWithSelector.call(void 0,
1796
+ const result = _withselectorjs.useSyncExternalStoreWithSelector.call(void 0,
1815
1797
  usersStore.subscribe,
1816
1798
  getUserState,
1817
1799
  getUserState,
1818
1800
  selector,
1819
1801
  _core.shallow
1820
1802
  );
1803
+ _react.useEffect.call(void 0, () => {
1804
+ void usersStore.get(userId);
1805
+ }, [usersStore, userId, result]);
1806
+ return result;
1821
1807
  }
1822
1808
  function useUserSuspense_withClient(client, userId) {
1823
1809
  const usersStore = client[_core.kInternal].usersStore;
@@ -1859,16 +1845,17 @@ function useRoomInfo_withClient(client, roomId) {
1859
1845
  (state) => selectorFor_useRoomInfo(state, roomId),
1860
1846
  [roomId]
1861
1847
  );
1862
- _react.useEffect.call(void 0, () => {
1863
- void roomsInfoStore.get(roomId);
1864
- }, [roomsInfoStore, roomId]);
1865
- return _withselectorjs.useSyncExternalStoreWithSelector.call(void 0,
1848
+ const result = _withselectorjs.useSyncExternalStoreWithSelector.call(void 0,
1866
1849
  roomsInfoStore.subscribe,
1867
1850
  getRoomInfoState,
1868
1851
  getRoomInfoState,
1869
1852
  selector,
1870
1853
  _core.shallow
1871
1854
  );
1855
+ _react.useEffect.call(void 0, () => {
1856
+ void roomsInfoStore.get(roomId);
1857
+ }, [roomsInfoStore, roomId, result]);
1858
+ return result;
1872
1859
  }
1873
1860
  function useRoomInfoSuspense_withClient(client, roomId) {
1874
1861
  const roomsInfoStore = client[_core.kInternal].roomsInfoStore;
@@ -2213,7 +2200,7 @@ function handleScrollToCommentOnLoad(shouldScrollOnLoad, state) {
2213
2200
  comment.scrollIntoView();
2214
2201
  }
2215
2202
  function useScrollToCommentOnLoadEffect(shouldScrollOnLoad, state) {
2216
- React4.useEffect(
2203
+ React3.useEffect(
2217
2204
  () => {
2218
2205
  handleScrollToCommentOnLoad(shouldScrollOnLoad, state);
2219
2206
  },
@@ -2416,7 +2403,7 @@ function makeRoomExtrasForClient(client) {
2416
2403
  }
2417
2404
  function makeRoomContextBundle(client) {
2418
2405
  function RoomProvider_withImplicitLiveblocksProvider(props) {
2419
- return /* @__PURE__ */ React5.createElement(LiveblocksProviderWithClient, { client, allowNesting: true }, /* @__PURE__ */ React5.createElement(RoomProvider, { ...props }));
2406
+ return /* @__PURE__ */ React4.createElement(LiveblocksProviderWithClient, { client, allowNesting: true }, /* @__PURE__ */ React4.createElement(RoomProvider, { ...props }));
2420
2407
  }
2421
2408
  const shared = createSharedContext(client);
2422
2409
  const bundle = {
@@ -2520,10 +2507,10 @@ function makeRoomContextBundle(client) {
2520
2507
  }
2521
2508
  function RoomProvider(props) {
2522
2509
  const client = useClient();
2523
- const [cache] = React5.useState(
2510
+ const [cache] = React4.useState(
2524
2511
  () => /* @__PURE__ */ new Map()
2525
2512
  );
2526
- const stableEnterRoom = React5.useCallback(
2513
+ const stableEnterRoom = React4.useCallback(
2527
2514
  (roomId, options) => {
2528
2515
  const cached = cache.get(roomId);
2529
2516
  if (cached) return cached;
@@ -2538,7 +2525,7 @@ function RoomProvider(props) {
2538
2525
  },
2539
2526
  [client, cache]
2540
2527
  );
2541
- return /* @__PURE__ */ React5.createElement(
2528
+ return /* @__PURE__ */ React4.createElement(
2542
2529
  RoomProviderInner,
2543
2530
  {
2544
2531
  ...props,
@@ -2558,7 +2545,7 @@ function RoomProviderInner(props) {
2558
2545
  if (!isString(roomId)) {
2559
2546
  throw new Error("RoomProvider id property should be a string.");
2560
2547
  }
2561
- const majorReactVersion = parseInt(React5.version) || 1;
2548
+ const majorReactVersion = parseInt(React4.version) || 1;
2562
2549
  const oldReactVersion = majorReactVersion < 18;
2563
2550
  _core.errorIf.call(void 0,
2564
2551
  oldReactVersion && props.unstable_batchedUpdates === void 0,
@@ -2575,14 +2562,14 @@ function RoomProviderInner(props) {
2575
2562
  unstable_batchedUpdates: props.unstable_batchedUpdates,
2576
2563
  autoConnect: _nullishCoalesce(props.autoConnect, () => ( typeof window !== "undefined"))
2577
2564
  });
2578
- const [{ room }, setRoomLeavePair] = React5.useState(
2565
+ const [{ room }, setRoomLeavePair] = React4.useState(
2579
2566
  () => stableEnterRoom(roomId, {
2580
2567
  ...frozenProps,
2581
2568
  autoConnect: false
2582
2569
  // Deliberately using false here on the first render, see below
2583
2570
  })
2584
2571
  );
2585
- React5.useEffect(() => {
2572
+ React4.useEffect(() => {
2586
2573
  const { store } = getRoomExtrasForClient(client);
2587
2574
  async function handleCommentEvent(message) {
2588
2575
  if (message.type === _core.ServerMsgCode.THREAD_DELETED) {
@@ -2617,12 +2604,12 @@ function RoomProviderInner(props) {
2617
2604
  (message) => void handleCommentEvent(message)
2618
2605
  );
2619
2606
  }, [client, room]);
2620
- React5.useEffect(() => {
2607
+ React4.useEffect(() => {
2621
2608
  const store = getRoomExtrasForClient(client).store;
2622
2609
  void store.fetchRoomThreadsDeltaUpdate(room.id).catch(() => {
2623
2610
  });
2624
2611
  }, [client, room.id]);
2625
- React5.useEffect(() => {
2612
+ React4.useEffect(() => {
2626
2613
  function handleIsOnline() {
2627
2614
  const store = getRoomExtrasForClient(client).store;
2628
2615
  void store.fetchRoomThreadsDeltaUpdate(room.id).catch(() => {
@@ -2633,7 +2620,7 @@ function RoomProviderInner(props) {
2633
2620
  window.removeEventListener("online", handleIsOnline);
2634
2621
  };
2635
2622
  }, [client, room.id]);
2636
- React5.useEffect(() => {
2623
+ React4.useEffect(() => {
2637
2624
  const pair = stableEnterRoom(roomId, frozenProps);
2638
2625
  setRoomLeavePair(pair);
2639
2626
  const { room: room2, leave } = pair;
@@ -2644,7 +2631,7 @@ function RoomProviderInner(props) {
2644
2631
  leave();
2645
2632
  };
2646
2633
  }, [roomId, frozenProps, stableEnterRoom]);
2647
- return /* @__PURE__ */ React5.createElement(RoomContext.Provider, { value: room }, props.children);
2634
+ return /* @__PURE__ */ React4.createElement(RoomContext.Provider, { value: room }, props.children);
2648
2635
  }
2649
2636
  function useRoom() {
2650
2637
  const room = useRoomOrNull();
@@ -2677,9 +2664,9 @@ function useStorageStatusImmediate() {
2677
2664
  }
2678
2665
  function useStorageStatusSmooth() {
2679
2666
  const room = useRoom();
2680
- const [status, setStatus] = React5.useState(room.getStorageStatus);
2667
+ const [status, setStatus] = React4.useState(room.getStorageStatus);
2681
2668
  const oldStatus = useLatest(room.getStorageStatus());
2682
- React5.useEffect(() => {
2669
+ React4.useEffect(() => {
2683
2670
  let timeoutId;
2684
2671
  const unsub = room.events.storageStatus.subscribe((newStatus) => {
2685
2672
  if (oldStatus.current === "synchronizing" && newStatus === "synchronized") {
@@ -2701,7 +2688,7 @@ function useBatch() {
2701
2688
  }
2702
2689
  function useBroadcastEvent() {
2703
2690
  const room = useRoom();
2704
- return React5.useCallback(
2691
+ return React4.useCallback(
2705
2692
  (event, options = { shouldQueueEventIfNotReady: false }) => {
2706
2693
  room.broadcastEvent(event, options);
2707
2694
  },
@@ -2711,7 +2698,7 @@ function useBroadcastEvent() {
2711
2698
  function useOthersListener(callback) {
2712
2699
  const room = useRoom();
2713
2700
  const savedCallback = useLatest(callback);
2714
- React5.useEffect(
2701
+ React4.useEffect(
2715
2702
  () => room.events.others.subscribe((event) => savedCallback.current(event)),
2716
2703
  [room, savedCallback]
2717
2704
  );
@@ -2719,7 +2706,7 @@ function useOthersListener(callback) {
2719
2706
  function useLostConnectionListener(callback) {
2720
2707
  const room = useRoom();
2721
2708
  const savedCallback = useLatest(callback);
2722
- React5.useEffect(
2709
+ React4.useEffect(
2723
2710
  () => room.events.lostConnection.subscribe(
2724
2711
  (event) => savedCallback.current(event)
2725
2712
  ),
@@ -2729,7 +2716,7 @@ function useLostConnectionListener(callback) {
2729
2716
  function useErrorListener(callback) {
2730
2717
  const room = useRoom();
2731
2718
  const savedCallback = useLatest(callback);
2732
- React5.useEffect(
2719
+ React4.useEffect(
2733
2720
  () => room.events.error.subscribe((e) => savedCallback.current(e)),
2734
2721
  [room, savedCallback]
2735
2722
  );
@@ -2737,7 +2724,7 @@ function useErrorListener(callback) {
2737
2724
  function useEventListener(callback) {
2738
2725
  const room = useRoom();
2739
2726
  const savedCallback = useLatest(callback);
2740
- React5.useEffect(() => {
2727
+ React4.useEffect(() => {
2741
2728
  const listener = (eventData) => {
2742
2729
  savedCallback.current(eventData);
2743
2730
  };
@@ -2770,7 +2757,7 @@ function useSelf(maybeSelector, isEqual) {
2770
2757
  const subscribe = room.events.self.subscribe;
2771
2758
  const getSnapshot = room.getSelf;
2772
2759
  const selector = _nullishCoalesce(maybeSelector, () => ( identity2));
2773
- const wrappedSelector = React5.useCallback(
2760
+ const wrappedSelector = React4.useCallback(
2774
2761
  (me) => me !== null ? selector(me) : null,
2775
2762
  [selector]
2776
2763
  );
@@ -2808,11 +2795,11 @@ function useOthers(selector, isEqual) {
2808
2795
  );
2809
2796
  }
2810
2797
  function useOthersMapped(itemSelector, itemIsEqual) {
2811
- const wrappedSelector = React5.useCallback(
2798
+ const wrappedSelector = React4.useCallback(
2812
2799
  (others) => others.map((other) => [other.connectionId, itemSelector(other)]),
2813
2800
  [itemSelector]
2814
2801
  );
2815
- const wrappedIsEqual = React5.useCallback(
2802
+ const wrappedIsEqual = React4.useCallback(
2816
2803
  (a, b) => {
2817
2804
  const eq = _nullishCoalesce(itemIsEqual, () => ( Object.is));
2818
2805
  return a.length === b.length && a.every((atuple, index) => {
@@ -2829,14 +2816,14 @@ function useOthersConnectionIds() {
2829
2816
  }
2830
2817
  var NOT_FOUND = Symbol();
2831
2818
  function useOther(connectionId, selector, isEqual) {
2832
- const wrappedSelector = React5.useCallback(
2819
+ const wrappedSelector = React4.useCallback(
2833
2820
  (others) => {
2834
2821
  const other2 = others.find((other3) => other3.connectionId === connectionId);
2835
2822
  return other2 !== void 0 ? selector(other2) : NOT_FOUND;
2836
2823
  },
2837
2824
  [connectionId, selector]
2838
2825
  );
2839
- const wrappedIsEqual = React5.useCallback(
2826
+ const wrappedIsEqual = React4.useCallback(
2840
2827
  (prev, curr) => {
2841
2828
  if (prev === NOT_FOUND || curr === NOT_FOUND) {
2842
2829
  return prev === curr;
@@ -2867,15 +2854,15 @@ function useStorageRoot() {
2867
2854
  function useStorage(selector, isEqual) {
2868
2855
  const room = useRoom();
2869
2856
  const rootOrNull = useMutableStorageRoot();
2870
- const wrappedSelector = React5.useCallback(
2857
+ const wrappedSelector = React4.useCallback(
2871
2858
  (rootOrNull2) => rootOrNull2 !== null ? selector(rootOrNull2) : null,
2872
2859
  [selector]
2873
2860
  );
2874
- const subscribe = React5.useCallback(
2861
+ const subscribe = React4.useCallback(
2875
2862
  (onStoreChange) => rootOrNull !== null ? room.subscribe(rootOrNull, onStoreChange, { isDeep: true }) : noop3,
2876
2863
  [room, rootOrNull]
2877
2864
  );
2878
- const getSnapshot = React5.useCallback(() => {
2865
+ const getSnapshot = React4.useCallback(() => {
2879
2866
  if (rootOrNull === null) {
2880
2867
  return null;
2881
2868
  } else {
@@ -2895,7 +2882,7 @@ function useStorage(selector, isEqual) {
2895
2882
  }
2896
2883
  function useMutation(callback, deps) {
2897
2884
  const room = useRoom();
2898
- return React5.useMemo(
2885
+ return React4.useMemo(
2899
2886
  () => {
2900
2887
  return (...args) => (
2901
2888
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
@@ -2921,7 +2908,7 @@ function useThreads(options = {
2921
2908
  const client = useClient();
2922
2909
  const room = useRoom();
2923
2910
  const { store, subscribeToRoomThreadsDeltaUpdates: subscribeToDeltaUpdates } = getRoomExtrasForClient(client);
2924
- React5.useEffect(
2911
+ React4.useEffect(
2925
2912
  () => {
2926
2913
  void store.waitUntilRoomThreadsLoaded(room.id, options.query).catch(() => {
2927
2914
  });
@@ -2935,8 +2922,8 @@ function useThreads(options = {
2935
2922
  // 3. If ever the promise would fail, then after 5 seconds it would reset, and on the very
2936
2923
  // *next* render after that, a *new* fetch/promise will get created.
2937
2924
  );
2938
- React5.useEffect(subscribeToDeltaUpdates, [subscribeToDeltaUpdates]);
2939
- const getter = React5.useCallback(
2925
+ React4.useEffect(subscribeToDeltaUpdates, [subscribeToDeltaUpdates]);
2926
+ const getter = React4.useCallback(
2940
2927
  () => store.getRoomThreadsAsync(room.id, options.query),
2941
2928
  [store, room.id, options.query]
2942
2929
  );
@@ -2955,14 +2942,14 @@ function useCommentsErrorListener(callback) {
2955
2942
  const client = useClient();
2956
2943
  const savedCallback = useLatest(callback);
2957
2944
  const { commentsErrorEventSource } = getRoomExtrasForClient(client);
2958
- React5.useEffect(() => {
2945
+ React4.useEffect(() => {
2959
2946
  return commentsErrorEventSource.subscribe(savedCallback.current);
2960
2947
  }, [savedCallback, commentsErrorEventSource]);
2961
2948
  }
2962
2949
  function useCreateThread() {
2963
2950
  const client = useClient();
2964
2951
  const room = useRoom();
2965
- return React5.useCallback(
2952
+ return React4.useCallback(
2966
2953
  (options) => {
2967
2954
  const body = options.body;
2968
2955
  const metadata = _nullishCoalesce(options.metadata, () => ( {}));
@@ -3022,7 +3009,7 @@ function useCreateThread() {
3022
3009
  function useDeleteThread() {
3023
3010
  const client = useClient();
3024
3011
  const room = useRoom();
3025
- return React5.useCallback(
3012
+ return React4.useCallback(
3026
3013
  (threadId) => {
3027
3014
  const { store, onMutationFailure } = getRoomExtrasForClient(client);
3028
3015
  const thread = store.getFullState().threadsById[threadId];
@@ -3053,7 +3040,7 @@ function useDeleteThread() {
3053
3040
  function useEditThreadMetadata() {
3054
3041
  const client = useClient();
3055
3042
  const room = useRoom();
3056
- return React5.useCallback(
3043
+ return React4.useCallback(
3057
3044
  (options) => {
3058
3045
  if (!options.metadata) {
3059
3046
  return;
@@ -3095,7 +3082,7 @@ function useEditThreadMetadata() {
3095
3082
  function useCreateComment() {
3096
3083
  const client = useClient();
3097
3084
  const room = useRoom();
3098
- return React5.useCallback(
3085
+ return React4.useCallback(
3099
3086
  ({ threadId, body, attachments }) => {
3100
3087
  const commentId = _core.createCommentId.call(void 0, );
3101
3088
  const createdAt = /* @__PURE__ */ new Date();
@@ -3139,7 +3126,7 @@ function useCreateComment() {
3139
3126
  function useEditComment() {
3140
3127
  const client = useClient();
3141
3128
  const room = useRoom();
3142
- return React5.useCallback(
3129
+ return React4.useCallback(
3143
3130
  ({ threadId, commentId, body, attachments }) => {
3144
3131
  const editedAt = /* @__PURE__ */ new Date();
3145
3132
  const { store, onMutationFailure } = getRoomExtrasForClient(client);
@@ -3191,7 +3178,7 @@ function useEditComment() {
3191
3178
  function useDeleteComment() {
3192
3179
  const client = useClient();
3193
3180
  const room = useRoom();
3194
- return React5.useCallback(
3181
+ return React4.useCallback(
3195
3182
  ({ threadId, commentId }) => {
3196
3183
  const deletedAt = /* @__PURE__ */ new Date();
3197
3184
  const { store, onMutationFailure } = getRoomExtrasForClient(client);
@@ -3228,7 +3215,7 @@ function useDeleteComment() {
3228
3215
  function useAddReaction() {
3229
3216
  const client = useClient();
3230
3217
  const room = useRoom();
3231
- return React5.useCallback(
3218
+ return React4.useCallback(
3232
3219
  ({ threadId, commentId, emoji }) => {
3233
3220
  const createdAt = /* @__PURE__ */ new Date();
3234
3221
  const userId = getCurrentUserId(room);
@@ -3271,7 +3258,7 @@ function useAddReaction() {
3271
3258
  function useRemoveReaction() {
3272
3259
  const client = useClient();
3273
3260
  const room = useRoom();
3274
- return React5.useCallback(
3261
+ return React4.useCallback(
3275
3262
  ({ threadId, commentId, emoji }) => {
3276
3263
  const userId = getCurrentUserId(room);
3277
3264
  const removedAt = /* @__PURE__ */ new Date();
@@ -3313,7 +3300,7 @@ function useRemoveReaction() {
3313
3300
  function useMarkThreadAsRead() {
3314
3301
  const client = useClient();
3315
3302
  const room = useRoom();
3316
- return React5.useCallback(
3303
+ return React4.useCallback(
3317
3304
  (threadId) => {
3318
3305
  const { store, onMutationFailure } = getRoomExtrasForClient(client);
3319
3306
  const inboxNotification = Object.values(
@@ -3354,7 +3341,7 @@ function useMarkThreadAsRead() {
3354
3341
  function useMarkThreadAsResolved() {
3355
3342
  const client = useClient();
3356
3343
  const room = useRoom();
3357
- return React5.useCallback(
3344
+ return React4.useCallback(
3358
3345
  (threadId) => {
3359
3346
  const updatedAt = /* @__PURE__ */ new Date();
3360
3347
  const { store, onMutationFailure } = getRoomExtrasForClient(client);
@@ -3388,7 +3375,7 @@ function useMarkThreadAsResolved() {
3388
3375
  function useMarkThreadAsUnresolved() {
3389
3376
  const client = useClient();
3390
3377
  const room = useRoom();
3391
- return React5.useCallback(
3378
+ return React4.useCallback(
3392
3379
  (threadId) => {
3393
3380
  const updatedAt = /* @__PURE__ */ new Date();
3394
3381
  const { store, onMutationFailure } = getRoomExtrasForClient(client);
@@ -3422,7 +3409,7 @@ function useMarkThreadAsUnresolved() {
3422
3409
  function useThreadSubscription(threadId) {
3423
3410
  const client = useClient();
3424
3411
  const { store } = getRoomExtrasForClient(client);
3425
- const selector = React5.useCallback(
3412
+ const selector = React4.useCallback(
3426
3413
  (state) => {
3427
3414
  const inboxNotification = state.notifications.find(
3428
3415
  (inboxNotification2) => inboxNotification2.kind === "thread" && inboxNotification2.threadId === threadId
@@ -3452,11 +3439,11 @@ function useRoomNotificationSettings() {
3452
3439
  const client = useClient();
3453
3440
  const room = useRoom();
3454
3441
  const { store } = getRoomExtrasForClient(client);
3455
- const getter = React5.useCallback(
3442
+ const getter = React4.useCallback(
3456
3443
  () => store.getNotificationSettingsAsync(room.id),
3457
3444
  [store, room.id]
3458
3445
  );
3459
- React5.useEffect(() => {
3446
+ React4.useEffect(() => {
3460
3447
  const { getInboxNotificationSettings } = getRoomExtrasForClient(client);
3461
3448
  void getInboxNotificationSettings(room);
3462
3449
  }, [client, room]);
@@ -3467,7 +3454,7 @@ function useRoomNotificationSettings() {
3467
3454
  identity2,
3468
3455
  _client2.shallow
3469
3456
  );
3470
- return React5.useMemo(() => {
3457
+ return React4.useMemo(() => {
3471
3458
  return [settings, updateRoomNotificationSettings];
3472
3459
  }, [settings, updateRoomNotificationSettings]);
3473
3460
  }
@@ -3476,7 +3463,7 @@ function useRoomNotificationSettingsSuspense() {
3476
3463
  const client = useClient();
3477
3464
  const room = useRoom();
3478
3465
  const { store } = getRoomExtrasForClient(client);
3479
- const getter = React5.useCallback(
3466
+ const getter = React4.useCallback(
3480
3467
  () => store.getNotificationSettingsAsync(room.id),
3481
3468
  [store, room.id]
3482
3469
  );
@@ -3493,16 +3480,16 @@ function useRoomNotificationSettingsSuspense() {
3493
3480
  } else if (settings.error) {
3494
3481
  throw settings.error;
3495
3482
  }
3496
- return React5.useMemo(() => {
3483
+ return React4.useMemo(() => {
3497
3484
  return [settings, updateRoomNotificationSettings];
3498
3485
  }, [settings, updateRoomNotificationSettings]);
3499
3486
  }
3500
3487
  function useHistoryVersionData(versionId) {
3501
- const [state, setState] = React5.useState({
3488
+ const [state, setState] = React4.useState({
3502
3489
  isLoading: true
3503
3490
  });
3504
3491
  const room = useRoom();
3505
- React5.useEffect(() => {
3492
+ React4.useEffect(() => {
3506
3493
  setState({ isLoading: true });
3507
3494
  const load = async () => {
3508
3495
  try {
@@ -3530,11 +3517,11 @@ function useHistoryVersions() {
3530
3517
  const client = useClient();
3531
3518
  const room = useRoom();
3532
3519
  const { store, getRoomVersions } = getRoomExtrasForClient(client);
3533
- const getter = React5.useCallback(
3520
+ const getter = React4.useCallback(
3534
3521
  () => store.getVersionsAsync(room.id),
3535
3522
  [store, room.id]
3536
3523
  );
3537
- React5.useEffect(() => {
3524
+ React4.useEffect(() => {
3538
3525
  void getRoomVersions(room);
3539
3526
  }, [room]);
3540
3527
  const state = _withselectorjs.useSyncExternalStoreWithSelector.call(void 0,
@@ -3550,7 +3537,7 @@ function useHistoryVersionsSuspense() {
3550
3537
  const client = useClient();
3551
3538
  const room = useRoom();
3552
3539
  const { store } = getRoomExtrasForClient(client);
3553
- const getter = React5.useCallback(
3540
+ const getter = React4.useCallback(
3554
3541
  () => store.getVersionsAsync(room.id),
3555
3542
  [store, room.id]
3556
3543
  );
@@ -3572,7 +3559,7 @@ function useHistoryVersionsSuspense() {
3572
3559
  function useUpdateRoomNotificationSettings() {
3573
3560
  const client = useClient();
3574
3561
  const room = useRoom();
3575
- return React5.useCallback(
3562
+ return React4.useCallback(
3576
3563
  (settings) => {
3577
3564
  const { store, onMutationFailure } = getRoomExtrasForClient(client);
3578
3565
  const optimisticUpdateId = store.addOptimisticUpdate({
@@ -3682,11 +3669,11 @@ function selectorFor_useAttachmentUrl(state) {
3682
3669
  function useAttachmentUrl(attachmentId) {
3683
3670
  const room = useRoom();
3684
3671
  const { attachmentUrlsStore } = room[_core.kInternal];
3685
- const getAttachmentUrlState = React5.useCallback(
3672
+ const getAttachmentUrlState = React4.useCallback(
3686
3673
  () => attachmentUrlsStore.getState(attachmentId),
3687
3674
  [attachmentUrlsStore, attachmentId]
3688
3675
  );
3689
- React5.useEffect(() => {
3676
+ React4.useEffect(() => {
3690
3677
  void attachmentUrlsStore.get(attachmentId);
3691
3678
  }, [attachmentUrlsStore, attachmentId]);
3692
3679
  return _withselectorjs.useSyncExternalStoreWithSelector.call(void 0,
@@ -3700,7 +3687,7 @@ function useAttachmentUrl(attachmentId) {
3700
3687
  function useAttachmentUrlSuspense(attachmentId) {
3701
3688
  const room = useRoom();
3702
3689
  const { attachmentUrlsStore } = room[_core.kInternal];
3703
- const getAttachmentUrlState = React5.useCallback(
3690
+ const getAttachmentUrlState = React4.useCallback(
3704
3691
  () => attachmentUrlsStore.getState(attachmentId),
3705
3692
  [attachmentUrlsStore, attachmentId]
3706
3693
  );
@@ -3845,9 +3832,5 @@ var _useUpdateMyPresence = useUpdateMyPresence;
3845
3832
 
3846
3833
 
3847
3834
 
3848
-
3849
-
3850
-
3851
-
3852
- exports.PKG_NAME = PKG_NAME; exports.PKG_VERSION = PKG_VERSION; exports.PKG_FORMAT = PKG_FORMAT; exports.ClientSideSuspense = ClientSideSuspense; exports.RoomContext = RoomContext; exports.selectThreads = selectThreads; exports.ClientContext = ClientContext; exports.getUmbrellaStoreForClient = getUmbrellaStoreForClient; exports.useClient = useClient; exports.LiveblocksProvider = LiveblocksProvider; exports.createLiveblocksContext = createLiveblocksContext; exports.useInboxNotifications = useInboxNotifications; exports.useInboxNotificationsSuspense = useInboxNotificationsSuspense; exports.useMarkAllInboxNotificationsAsRead = useMarkAllInboxNotificationsAsRead; exports.useMarkInboxNotificationAsRead = useMarkInboxNotificationAsRead; exports.useDeleteAllInboxNotifications = useDeleteAllInboxNotifications; exports.useDeleteInboxNotification = useDeleteInboxNotification; exports.useUnreadInboxNotificationsCount = useUnreadInboxNotificationsCount; exports.useUnreadInboxNotificationsCountSuspense = useUnreadInboxNotificationsCountSuspense; exports.useRoomInfo = useRoomInfo; exports.useRoomInfoSuspense = useRoomInfoSuspense; exports._useInboxNotificationThread = _useInboxNotificationThread; exports._useUser = _useUser; exports._useUserSuspense = _useUserSuspense; exports._useUserThreads_experimental = _useUserThreads_experimental; exports._useUserThreadsSuspense_experimental = _useUserThreadsSuspense_experimental; exports.CreateThreadError = CreateThreadError; exports.useStatus = useStatus; exports.useStorageStatus = useStorageStatus; exports.useBatch = useBatch; exports.useLostConnectionListener = useLostConnectionListener; exports.useErrorListener = useErrorListener; exports.useHistory = useHistory; exports.useUndo = useUndo; exports.useRedo = useRedo; exports.useCanUndo = useCanUndo; exports.useCanRedo = useCanRedo; exports.useOthersConnectionIds = useOthersConnectionIds; exports.useCommentsErrorListener = useCommentsErrorListener; exports.useCreateComment = useCreateComment; exports.useEditComment = useEditComment; exports.useDeleteComment = useDeleteComment; exports.useRemoveReaction = useRemoveReaction; exports.useMarkThreadAsRead = useMarkThreadAsRead; exports.useMarkThreadAsResolved = useMarkThreadAsResolved; exports.useMarkThreadAsUnresolved = useMarkThreadAsUnresolved; exports.useThreadSubscription = useThreadSubscription; exports.useRoomNotificationSettings = useRoomNotificationSettings; exports.useHistoryVersionData = useHistoryVersionData; exports.useUpdateRoomNotificationSettings = useUpdateRoomNotificationSettings; exports.useOthersConnectionIdsSuspense = useOthersConnectionIdsSuspense; exports.useStorageStatusSuspense = useStorageStatusSuspense; exports.useAttachmentUrl = useAttachmentUrl; exports.useAttachmentUrlSuspense = useAttachmentUrlSuspense; exports.createRoomContext = createRoomContext; exports._RoomProvider = _RoomProvider; exports._useBroadcastEvent = _useBroadcastEvent; exports._useOthersListener = _useOthersListener; exports._useRoom = _useRoom; exports._useIsInsideRoom = _useIsInsideRoom; exports._useAddReaction = _useAddReaction; exports._useMutation = _useMutation; exports._useCreateThread = _useCreateThread; exports._useDeleteThread = _useDeleteThread; exports._useEditThreadMetadata = _useEditThreadMetadata; exports._useEventListener = _useEventListener; exports._useMyPresence = _useMyPresence; exports._useOthersMapped = _useOthersMapped; exports._useOthersMappedSuspense = _useOthersMappedSuspense; exports._useThreads = _useThreads; exports._useThreadsSuspense = _useThreadsSuspense; exports._useHistoryVersions = _useHistoryVersions; exports._useHistoryVersionsSuspense = _useHistoryVersionsSuspense; exports._useOther = _useOther; exports._useOthers = _useOthers; exports._useOtherSuspense = _useOtherSuspense; exports._useOthersSuspense = _useOthersSuspense; exports._useStorage = _useStorage; exports._useStorageSuspense = _useStorageSuspense; exports._useSelf = _useSelf; exports._useSelfSuspense = _useSelfSuspense; exports._useStorageRoot = _useStorageRoot; exports._useUpdateMyPresence = _useUpdateMyPresence;
3853
- //# sourceMappingURL=chunk-PZIVKFDZ.js.map
3835
+ exports.RoomContext = RoomContext; exports.selectThreads = selectThreads; exports.ClientContext = ClientContext; exports.getUmbrellaStoreForClient = getUmbrellaStoreForClient; exports.useClient = useClient; exports.LiveblocksProvider = LiveblocksProvider; exports.createLiveblocksContext = createLiveblocksContext; exports.useInboxNotifications = useInboxNotifications; exports.useInboxNotificationsSuspense = useInboxNotificationsSuspense; exports.useMarkAllInboxNotificationsAsRead = useMarkAllInboxNotificationsAsRead; exports.useMarkInboxNotificationAsRead = useMarkInboxNotificationAsRead; exports.useDeleteAllInboxNotifications = useDeleteAllInboxNotifications; exports.useDeleteInboxNotification = useDeleteInboxNotification; exports.useUnreadInboxNotificationsCount = useUnreadInboxNotificationsCount; exports.useUnreadInboxNotificationsCountSuspense = useUnreadInboxNotificationsCountSuspense; exports.useRoomInfo = useRoomInfo; exports.useRoomInfoSuspense = useRoomInfoSuspense; exports._useInboxNotificationThread = _useInboxNotificationThread; exports._useUser = _useUser; exports._useUserSuspense = _useUserSuspense; exports._useUserThreads_experimental = _useUserThreads_experimental; exports._useUserThreadsSuspense_experimental = _useUserThreadsSuspense_experimental; exports.CreateThreadError = CreateThreadError; exports.useStatus = useStatus; exports.useStorageStatus = useStorageStatus; exports.useBatch = useBatch; exports.useLostConnectionListener = useLostConnectionListener; exports.useErrorListener = useErrorListener; exports.useHistory = useHistory; exports.useUndo = useUndo; exports.useRedo = useRedo; exports.useCanUndo = useCanUndo; exports.useCanRedo = useCanRedo; exports.useOthersConnectionIds = useOthersConnectionIds; exports.useCommentsErrorListener = useCommentsErrorListener; exports.useCreateComment = useCreateComment; exports.useEditComment = useEditComment; exports.useDeleteComment = useDeleteComment; exports.useRemoveReaction = useRemoveReaction; exports.useMarkThreadAsRead = useMarkThreadAsRead; exports.useMarkThreadAsResolved = useMarkThreadAsResolved; exports.useMarkThreadAsUnresolved = useMarkThreadAsUnresolved; exports.useThreadSubscription = useThreadSubscription; exports.useRoomNotificationSettings = useRoomNotificationSettings; exports.useHistoryVersionData = useHistoryVersionData; exports.useUpdateRoomNotificationSettings = useUpdateRoomNotificationSettings; exports.useOthersConnectionIdsSuspense = useOthersConnectionIdsSuspense; exports.useStorageStatusSuspense = useStorageStatusSuspense; exports.useAttachmentUrl = useAttachmentUrl; exports.useAttachmentUrlSuspense = useAttachmentUrlSuspense; exports.createRoomContext = createRoomContext; exports._RoomProvider = _RoomProvider; exports._useBroadcastEvent = _useBroadcastEvent; exports._useOthersListener = _useOthersListener; exports._useRoom = _useRoom; exports._useIsInsideRoom = _useIsInsideRoom; exports._useAddReaction = _useAddReaction; exports._useMutation = _useMutation; exports._useCreateThread = _useCreateThread; exports._useDeleteThread = _useDeleteThread; exports._useEditThreadMetadata = _useEditThreadMetadata; exports._useEventListener = _useEventListener; exports._useMyPresence = _useMyPresence; exports._useOthersMapped = _useOthersMapped; exports._useOthersMappedSuspense = _useOthersMappedSuspense; exports._useThreads = _useThreads; exports._useThreadsSuspense = _useThreadsSuspense; exports._useHistoryVersions = _useHistoryVersions; exports._useHistoryVersionsSuspense = _useHistoryVersionsSuspense; exports._useOther = _useOther; exports._useOthers = _useOthers; exports._useOtherSuspense = _useOtherSuspense; exports._useOthersSuspense = _useOthersSuspense; exports._useStorage = _useStorage; exports._useStorageSuspense = _useStorageSuspense; exports._useSelf = _useSelf; exports._useSelfSuspense = _useSelfSuspense; exports._useStorageRoot = _useStorageRoot; exports._useUpdateMyPresence = _useUpdateMyPresence;
3836
+ //# sourceMappingURL=chunk-WJLAYICR.js.map