@liveblocks/react 2.19.0 → 2.21.0-emails1

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/version.ts
2
2
  var PKG_NAME = "@liveblocks/react";
3
- var PKG_VERSION = "2.19.0";
3
+ var PKG_VERSION = "2.21.0-emails1";
4
4
  var PKG_FORMAT = "cjs";
5
5
 
6
6
  // src/ClientSideSuspense.tsx
@@ -20,4 +20,4 @@ function ClientSideSuspense(props) {
20
20
 
21
21
 
22
22
  exports.PKG_NAME = PKG_NAME; exports.PKG_VERSION = PKG_VERSION; exports.PKG_FORMAT = PKG_FORMAT; exports.ClientSideSuspense = ClientSideSuspense;
23
- //# sourceMappingURL=chunk-CDTX5424.cjs.map
23
+ //# sourceMappingURL=chunk-HAHXKMF2.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/liveblocks/liveblocks/packages/liveblocks-react/dist/chunk-HAHXKMF2.cjs","../src/version.ts","../src/ClientSideSuspense.tsx"],"names":[],"mappings":"AAAA;ACGO,IAAM,SAAA,EAAW,mBAAA;AACjB,IAAM,YAAA,EAAiD,gBAAA;AACvD,IAAM,WAAA,EAAgD,KAAA;ADD7D;AACA;AEJA,8BAA8C;AAkC1C,+CAAA;AAVG,SAAS,kBAAA,CAAmB,KAAA,EAAc;AAC/C,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,EAAA,EAAI,6BAAA,KAAc,CAAA;AAE5C,EAAA,8BAAA,CAAU,EAAA,GAAM;AAGd,IAAA,UAAA,CAAW,IAAI,CAAA;AAAA,EACjB,CAAA,EAAG,CAAC,CAAC,CAAA;AAEL,EAAA,uBACE,6BAAA,eAAC,EAAA,EAAS,QAAA,EAAU,KAAA,CAAM,QAAA,EACvB,QAAA,EAAA,QAAA,EACG,OAAO,KAAA,CAAM,SAAA,IAAa,WAAA,EACxB,KAAA,CAAM,QAAA,CAAS,EAAA,EACf,KAAA,CAAM,SAAA,EACR,KAAA,CAAM,SAAA,CACZ,CAAA;AAEJ;AF5BA;AACA;AACE;AACA;AACA;AACA;AACF,iJAAC","file":"/home/runner/work/liveblocks/liveblocks/packages/liveblocks-react/dist/chunk-HAHXKMF2.cjs","sourcesContent":[null,"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 { Suspense, useEffect, useState } 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] = useState(false);\n\n 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 <Suspense fallback={props.fallback}>\n {mounted\n ? typeof props.children === \"function\"\n ? props.children()\n : props.children\n : props.fallback}\n </Suspense>\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  // src/version.ts
2
2
  var PKG_NAME = "@liveblocks/react";
3
- var PKG_VERSION = "2.19.0";
3
+ var PKG_VERSION = "2.21.0-emails1";
4
4
  var PKG_FORMAT = "esm";
5
5
 
6
6
  // src/ClientSideSuspense.tsx
@@ -20,4 +20,4 @@ export {
20
20
  PKG_FORMAT,
21
21
  ClientSideSuspense
22
22
  };
23
- //# sourceMappingURL=chunk-QYTJHNNQ.js.map
23
+ //# sourceMappingURL=chunk-JN5TEWYU.js.map
@@ -236,14 +236,14 @@ import {
236
236
  batch as batch2,
237
237
  compactObject,
238
238
  console as console2,
239
+ createUserNotificationSettings,
239
240
  DefaultMap,
240
241
  DerivedSignal,
241
- entries,
242
- keys,
243
242
  kInternal,
244
243
  MutableSignal as MutableSignal2,
245
244
  nanoid,
246
245
  nn,
246
+ patchUserNotificationSettings,
247
247
  shallow as shallow3,
248
248
  Signal,
249
249
  stableStringify
@@ -731,14 +731,11 @@ function createStore_forPermissionHints() {
731
731
  };
732
732
  }
733
733
  function createStore_forUserNotificationSettings(updates) {
734
- const signal = new Signal({});
734
+ const signal = new Signal(
735
+ createUserNotificationSettings({})
736
+ );
735
737
  function update(settings) {
736
- signal.set((prevSettings) => {
737
- return {
738
- ...prevSettings,
739
- ...settings
740
- };
741
- });
738
+ signal.set(settings);
742
739
  }
743
740
  return {
744
741
  signal: DerivedSignal.from(
@@ -1499,32 +1496,14 @@ function applyOptimisticUpdates_forSettings(settingsLUT, optimisticUpdates) {
1499
1496
  }
1500
1497
  return settingsByRoomId;
1501
1498
  }
1502
- function applyOptimisticUpdates_forUserNotificationSettings(baseSettings, optimisticUpdates) {
1503
- const outcomingSettings = { ...baseSettings };
1504
- for (const optimisticUpdate of optimisticUpdates) {
1505
- switch (optimisticUpdate.type) {
1506
- case "update-user-notification-settings": {
1507
- const incomingSettings = optimisticUpdate.settings;
1508
- for (const channelKey of keys(incomingSettings)) {
1509
- const key = channelKey;
1510
- const channelUpdates = incomingSettings[key];
1511
- if (channelUpdates) {
1512
- const realChannelUpdates = Object.fromEntries(
1513
- entries(channelUpdates).filter(
1514
- ([_, value]) => value !== void 0
1515
- )
1516
- );
1517
- outcomingSettings[key] = {
1518
- ...outcomingSettings[key],
1519
- ...realChannelUpdates
1520
- };
1521
- }
1522
- }
1523
- break;
1524
- }
1499
+ function applyOptimisticUpdates_forUserNotificationSettings(settings, optimisticUpdates) {
1500
+ let outcoming = settings;
1501
+ for (const update of optimisticUpdates) {
1502
+ if (update.type === "update-user-notification-settings") {
1503
+ outcoming = patchUserNotificationSettings(outcoming, update.settings);
1525
1504
  }
1526
1505
  }
1527
- return outcomingSettings;
1506
+ return outcoming;
1528
1507
  }
1529
1508
  function compareInboxNotifications(inboxNotificationA, inboxNotificationB) {
1530
1509
  if (inboxNotificationA.notifiedAt > inboxNotificationB.notifiedAt) {
@@ -2876,9 +2855,9 @@ function RoomProviderInner(props) {
2876
2855
  }, [roomId, frozenProps, stableEnterRoom]);
2877
2856
  return /* @__PURE__ */ jsx2(RoomContext.Provider, { value: room, children: props.children });
2878
2857
  }
2879
- function useRoom() {
2858
+ function useRoom(options) {
2880
2859
  const room = useRoomOrNull();
2881
- if (room === null) {
2860
+ if (room === null && !options?.allowOutsideRoom) {
2882
2861
  throw new Error("RoomProvider is missing from the React tree.");
2883
2862
  }
2884
2863
  return room;
@@ -4030,7 +4009,6 @@ var _useUpdateMyPresence = useUpdateMyPresence;
4030
4009
 
4031
4010
  export {
4032
4011
  RoomContext,
4033
- useRoomOrNull,
4034
4012
  useSyncExternalStoreWithSelector,
4035
4013
  useSignal,
4036
4014
  ClientContext,
@@ -4134,4 +4112,4 @@ export {
4134
4112
  _useStorageRoot,
4135
4113
  _useUpdateMyPresence
4136
4114
  };
4137
- //# sourceMappingURL=chunk-5RVW253W.js.map
4115
+ //# sourceMappingURL=chunk-URVBSXYW.js.map