@liveblocks/react 2.25.0-aiprivatebeta5 → 2.25.0-aiprivatebeta7

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.25.0-aiprivatebeta5";
3
+ var PKG_VERSION = "2.25.0-aiprivatebeta7";
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-CYTE2LUB.cjs.map
23
+ //# sourceMappingURL=chunk-BJ6T5M3P.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/liveblocks/liveblocks/packages/liveblocks-react/dist/chunk-CYTE2LUB.cjs","../src/version.ts","../src/ClientSideSuspense.tsx"],"names":[],"mappings":"AAAA;ACGO,IAAM,SAAA,EAAW,mBAAA;AACjB,IAAM,YAAA,EAAiD,uBAAA;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-CYTE2LUB.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
+ {"version":3,"sources":["/home/runner/work/liveblocks/liveblocks/packages/liveblocks-react/dist/chunk-BJ6T5M3P.cjs","../src/version.ts","../src/ClientSideSuspense.tsx"],"names":[],"mappings":"AAAA;ACGO,IAAM,SAAA,EAAW,mBAAA;AACjB,IAAM,YAAA,EAAiD,uBAAA;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-BJ6T5M3P.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.25.0-aiprivatebeta5";
3
+ var PKG_VERSION = "2.25.0-aiprivatebeta7";
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-G5J24Q3E.js.map
23
+ //# sourceMappingURL=chunk-IXWATLVF.js.map
@@ -746,21 +746,26 @@ function createStore_forHistoryVersions() {
746
746
  };
747
747
  }
748
748
  function createStore_forPermissionHints() {
749
- const signal = new MutableSignal3(
750
- new DefaultMap(() => /* @__PURE__ */ new Set())
749
+ const permissionsByRoomId = new DefaultMap(
750
+ () => new Signal(/* @__PURE__ */ new Set())
751
751
  );
752
752
  function update(newHints) {
753
- signal.mutate((lut) => {
754
- for (const [roomId, newPermissions] of Object.entries(newHints)) {
755
- const existing = lut.getOrCreate(roomId);
756
- for (const permission of newPermissions) {
757
- existing.add(permission);
753
+ batch2(() => {
754
+ for (const [roomId, permissions] of Object.entries(newHints)) {
755
+ const signal = permissionsByRoomId.getOrCreate(roomId);
756
+ const existingPermissions = new Set(signal.get());
757
+ for (const permission of permissions) {
758
+ existingPermissions.add(permission);
758
759
  }
760
+ signal.set(existingPermissions);
759
761
  }
760
762
  });
761
763
  }
764
+ function getPermissionForRoom\u03A3(roomId) {
765
+ return permissionsByRoomId.getOrCreate(roomId);
766
+ }
762
767
  return {
763
- signal: signal.asReadonly(),
768
+ getPermissionForRoom\u03A3,
764
769
  // Mutations
765
770
  update
766
771
  };
@@ -2496,7 +2501,7 @@ function useCreateAiChat() {
2496
2501
  const client = useClient();
2497
2502
  return useCallback2(
2498
2503
  (options) => {
2499
- client[kInternal2].ai.createChat(options.id).catch((err) => {
2504
+ client[kInternal2].ai.getOrCreateChat(options.id).catch((err) => {
2500
2505
  console.error(
2501
2506
  `Failed to create chat with ID "${options.id}": ${String(err)}`
2502
2507
  );
@@ -4450,14 +4455,10 @@ function useAttachmentUrlSuspense(attachmentId) {
4450
4455
  error: void 0
4451
4456
  };
4452
4457
  }
4453
- var NO_PERMISSIONS = /* @__PURE__ */ new Set();
4454
4458
  function useRoomPermissions(roomId) {
4455
4459
  const client = useClient();
4456
4460
  const store = getRoomExtrasForClient(client).store;
4457
- return useSignal(
4458
- store.permissionHints.signal,
4459
- (hints) => hints.get(roomId) ?? NO_PERMISSIONS
4460
- );
4461
+ return useSignal(store.permissionHints.getPermissionForRoom\u03A3(roomId));
4461
4462
  }
4462
4463
  function createRoomContext(client) {
4463
4464
  return getOrCreateRoomContextBundle(client);
@@ -4620,4 +4621,4 @@ export {
4620
4621
  _useStorageRoot,
4621
4622
  _useUpdateMyPresence
4622
4623
  };
4623
- //# sourceMappingURL=chunk-E6PCFJWE.js.map
4624
+ //# sourceMappingURL=chunk-S4TM7L5S.js.map